n8n-nodes-docuparse 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -538,7 +538,7 @@ end
|
|
|
538
538
|
end`},i1e=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return"<"+e.join("")+">"},CT=function(e){return a1e.toHexStringOfMinLength(e,4)},ont=function(e){if(bT.isWithinBMP(e))return CT(e);if(bT.hasSurrogates(e)){var t=bT.highSurrogate(e),r=bT.lowSurrogate(e);return""+CT(t)+CT(r)}var n=a1e.toHexString(e),i="0x"+n+" is not a valid UTF-8 or UTF-16 codepoint.";throw new Error(i)}});var o1e=U(xT=>{"use strict";Object.defineProperty(xT,"__esModule",{value:!0});xT.deriveFontFlags=void 0;var unt=function(e){var t=0,r=function(n){t|=1<<n-1};return e.fixedPitch&&r(1),e.serif&&r(2),e.symbolic&&r(3),e.script&&r(4),e.nonsymbolic&&r(6),e.italic&&r(7),e.allCap&&r(17),e.smallCap&&r(18),e.forceBold&&r(19),t};xT.deriveFontFlags=function(e){var t=e["OS/2"]?e["OS/2"].sFamilyClass:0,r=unt({fixedPitch:e.post.isFixedPitch,serif:1<=t&&t<=7,symbolic:!0,script:t===10,italic:e.head.macStyle.italic});return r}});var Fc=U(iL=>{"use strict";Object.defineProperty(iL,"__esModule",{value:!0});var nL=(ct(),ze(ut)),cnt=nL.__importDefault(_s()),di=nL.__importDefault(kn()),Wu=fr(),fnt=Nn(),lnt=(function(e){nL.__extends(t,e);function t(r){var n=e.call(this)||this;return n.value=r,n}return t.prototype.asBytes=function(){for(var r=[],n="",i=!1,s=function(C){C!==void 0&&r.push(C),i=!1},u=0,f=this.value.length;u<f;u++){var h=this.value[u],g=Wu.toCharCode(h),p=this.value[u+1];i?g===di.default.Newline||g===di.default.CarriageReturn?s():g===di.default.n?s(di.default.Newline):g===di.default.r?s(di.default.CarriageReturn):g===di.default.t?s(di.default.Tab):g===di.default.b?s(di.default.Backspace):g===di.default.f?s(di.default.FormFeed):g===di.default.LeftParen?s(di.default.LeftParen):g===di.default.RightParen?s(di.default.RightParen):g===di.default.Backspace?s(di.default.BackSlash):g>=di.default.Zero&&g<=di.default.Seven?(n+=h,(n.length===3||!(p>="0"&&p<="7"))&&(s(parseInt(n,8)),n="")):s(g):g===di.default.BackSlash?i=!0:s(g)}return new Uint8Array(r)},t.prototype.decodeText=function(){var r=this.asBytes();return Wu.hasUtf16BOM(r)?Wu.utf16Decode(r):Wu.pdfDocEncodingDecode(r)},t.prototype.decodeDate=function(){var r=this.decodeText(),n=Wu.parseDate(r);if(!n)throw new fnt.InvalidPDFDateStringError(r);return n},t.prototype.asString=function(){return this.value},t.prototype.clone=function(){return t.of(this.value)},t.prototype.toString=function(){return"("+this.value+")"},t.prototype.sizeInBytes=function(){return this.value.length+2},t.prototype.copyBytesInto=function(r,n){return r[n++]=di.default.LeftParen,n+=Wu.copyStringIntoBuffer(this.value,r,n),r[n++]=di.default.RightParen,this.value.length+2},t.of=function(r){return new t(r)},t.fromDate=function(r){var n=Wu.padStart(String(r.getUTCFullYear()),4,"0"),i=Wu.padStart(String(r.getUTCMonth()+1),2,"0"),s=Wu.padStart(String(r.getUTCDate()),2,"0"),u=Wu.padStart(String(r.getUTCHours()),2,"0"),f=Wu.padStart(String(r.getUTCMinutes()),2,"0"),h=Wu.padStart(String(r.getUTCSeconds()),2,"0");return new t("D:"+n+i+s+u+f+h+"Z")},t})(cnt.default);iL.default=lnt});var sL=U(aL=>{"use strict";Object.defineProperty(aL,"__esModule",{value:!0});var fo=(ct(),ze(ut)),Ant=s1e(),dnt=o1e(),hnt=fo.__importDefault(co()),u1e=fo.__importDefault(Fc()),vT=fr(),gnt=(function(){function e(t,r,n,i){var s=this;this.allGlyphsInFontSortedById=function(){for(var u=new Array(s.font.characterSet.length),f=0,h=u.length;f<h;f++){var g=s.font.characterSet[f];u[f]=s.font.glyphForCodePoint(g)}return vT.sortedUniq(u.sort(vT.byAscendingId),function(p){return p.id})},this.font=t,this.scale=1e3/this.font.unitsPerEm,this.fontData=r,this.fontName=this.font.postscriptName||"Font",this.customName=n,this.fontFeatures=i,this.baseFontName="",this.glyphCache=vT.Cache.populatedBy(this.allGlyphsInFontSortedById)}return e.for=function(t,r,n,i){return fo.__awaiter(this,void 0,void 0,function(){var s;return fo.__generator(this,function(u){switch(u.label){case 0:return[4,t.create(r)];case 1:return s=u.sent(),[2,new e(s,r,n,i)]}})})},e.prototype.encodeText=function(t){for(var r=this.font.layout(t,this.fontFeatures).glyphs,n=new Array(r.length),i=0,s=r.length;i<s;i++)n[i]=vT.toHexStringOfMinLength(r[i].id,4);return hnt.default.of(n.join(""))},e.prototype.widthOfTextAtSize=function(t,r){for(var n=this.font.layout(t,this.fontFeatures).glyphs,i=0,s=0,u=n.length;s<u;s++)i+=n[s].advanceWidth*this.scale;var f=r/1e3;return i*f},e.prototype.heightOfFontAtSize=function(t,r){r===void 0&&(r={});var n=r.descender,i=n===void 0?!0:n,s=this.font,u=s.ascent,f=s.descent,h=s.bbox,g=(u||h.maxY)*this.scale,p=(f||h.minY)*this.scale,C=g-p;return i||(C-=Math.abs(f)||0),C/1e3*t},e.prototype.sizeOfFontAtHeight=function(t){var r=this.font,n=r.ascent,i=r.descent,s=r.bbox,u=(n||s.maxY)*this.scale,f=(i||s.minY)*this.scale;return 1e3*t/(u-f)},e.prototype.embedIntoContext=function(t,r){return this.baseFontName=this.customName||t.addRandomSuffix(this.fontName),this.embedFontDict(t,r)},e.prototype.embedFontDict=function(t,r){return fo.__awaiter(this,void 0,void 0,function(){var n,i,s;return fo.__generator(this,function(u){switch(u.label){case 0:return[4,this.embedCIDFontDict(t)];case 1:return n=u.sent(),i=this.embedUnicodeCmap(t),s=t.obj({Type:"Font",Subtype:"Type0",BaseFont:this.baseFontName,Encoding:"Identity-H",DescendantFonts:[n],ToUnicode:i}),r?(t.assign(r,s),[2,r]):[2,t.register(s)]}})})},e.prototype.isCFF=function(){return this.font.cff},e.prototype.embedCIDFontDict=function(t){return fo.__awaiter(this,void 0,void 0,function(){var r,n;return fo.__generator(this,function(i){switch(i.label){case 0:return[4,this.embedFontDescriptor(t)];case 1:return r=i.sent(),n=t.obj({Type:"Font",Subtype:this.isCFF()?"CIDFontType0":"CIDFontType2",CIDToGIDMap:"Identity",BaseFont:this.baseFontName,CIDSystemInfo:{Registry:u1e.default.of("Adobe"),Ordering:u1e.default.of("Identity"),Supplement:0},FontDescriptor:r,W:this.computeWidths()}),[2,t.register(n)]}})})},e.prototype.embedFontDescriptor=function(t){return fo.__awaiter(this,void 0,void 0,function(){var r,n,i,s,u,f,h,g,p,C,y,x,v,T,Q;return fo.__generator(this,function(F){switch(F.label){case 0:return[4,this.embedFontStream(t)];case 1:return r=F.sent(),n=this.scale,i=this.font,s=i.italicAngle,u=i.ascent,f=i.descent,h=i.capHeight,g=i.xHeight,p=this.font.bbox,C=p.minX,y=p.minY,x=p.maxX,v=p.maxY,T=t.obj((Q={Type:"FontDescriptor",FontName:this.baseFontName,Flags:dnt.deriveFontFlags(this.font),FontBBox:[C*n,y*n,x*n,v*n],ItalicAngle:s,Ascent:u*n,Descent:f*n,CapHeight:(h||u)*n,XHeight:(g||0)*n,StemV:0},Q[this.isCFF()?"FontFile3":"FontFile2"]=r,Q)),[2,t.register(T)]}})})},e.prototype.serializeFont=function(){return fo.__awaiter(this,void 0,void 0,function(){return fo.__generator(this,function(t){return[2,this.fontData]})})},e.prototype.embedFontStream=function(t){return fo.__awaiter(this,void 0,void 0,function(){var r,n,i;return fo.__generator(this,function(s){switch(s.label){case 0:return i=(n=t).flateStream,[4,this.serializeFont()];case 1:return r=i.apply(n,[s.sent(),{Subtype:this.isCFF()?"CIDFontType0C":void 0}]),[2,t.register(r)]}})})},e.prototype.embedUnicodeCmap=function(t){var r=Ant.createCmap(this.glyphCache.access(),this.glyphId.bind(this)),n=t.flateStream(r);return t.register(n)},e.prototype.glyphId=function(t){return t?t.id:-1},e.prototype.computeWidths=function(){for(var t=this.glyphCache.access(),r=[],n=[],i=0,s=t.length;i<s;i++){var u=t[i],f=t[i-1],h=this.glyphId(u),g=this.glyphId(f);i===0?r.push(h):h-g!==1&&(r.push(n),r.push(h),n=[]),n.push(u.advanceWidth*this.scale)}return r.push(n),r},e})();aL.default=gnt});var c1e=U(uL=>{"use strict";Object.defineProperty(uL,"__esModule",{value:!0});var wy=(ct(),ze(ut)),pnt=wy.__importDefault(sL()),mnt=wy.__importDefault(co()),oL=fr(),Ent=(function(e){wy.__extends(t,e);function t(r,n,i,s){var u=e.call(this,r,n,i,s)||this;return u.subset=u.font.createSubset(),u.glyphs=[],u.glyphCache=oL.Cache.populatedBy(function(){return u.glyphs}),u.glyphIdMap=new Map,u}return t.for=function(r,n,i,s){return wy.__awaiter(this,void 0,void 0,function(){var u;return wy.__generator(this,function(f){switch(f.label){case 0:return[4,r.create(n)];case 1:return u=f.sent(),[2,new t(u,n,i,s)]}})})},t.prototype.encodeText=function(r){for(var n=this.font.layout(r,this.fontFeatures).glyphs,i=new Array(n.length),s=0,u=n.length;s<u;s++){var f=n[s],h=this.subset.includeGlyph(f);this.glyphs[h-1]=f,this.glyphIdMap.set(f.id,h),i[s]=oL.toHexStringOfMinLength(h,4)}return this.glyphCache.invalidate(),mnt.default.of(i.join(""))},t.prototype.isCFF=function(){return this.subset.cff},t.prototype.glyphId=function(r){return r?this.glyphIdMap.get(r.id):-1},t.prototype.serializeFont=function(){var r=this;return new Promise(function(n,i){var s=[];r.subset.encodeStream().on("data",function(u){return s.push(u)}).on("end",function(){return n(oL.mergeUint8Arrays(s))}).on("error",function(u){return i(u)})})},t})(pnt.default);uL.default=Ent});var fL=U(xm=>{"use strict";Object.defineProperty(xm,"__esModule",{value:!0});xm.AFRelationship=void 0;var IT=(ct(),ze(ut)),cL=IT.__importDefault(Fc()),f1e=IT.__importDefault(co()),bnt;(function(e){e.Source="Source",e.Data="Data",e.Alternative="Alternative",e.Supplement="Supplement",e.EncryptedPayload="EncryptedPayload",e.FormData="EncryptedPayload",e.Schema="Schema",e.Unspecified="Unspecified"})(bnt=xm.AFRelationship||(xm.AFRelationship={}));var Cnt=(function(){function e(t,r,n){n===void 0&&(n={}),this.fileData=t,this.fileName=r,this.options=n}return e.for=function(t,r,n){return n===void 0&&(n={}),new e(t,r,n)},e.prototype.embedIntoContext=function(t,r){return IT.__awaiter(this,void 0,void 0,function(){var n,i,s,u,f,h,g,p,C;return IT.__generator(this,function(y){return n=this.options,i=n.mimeType,s=n.description,u=n.creationDate,f=n.modificationDate,h=n.afRelationship,g=t.flateStream(this.fileData,{Type:"EmbeddedFile",Subtype:i??void 0,Params:{Size:this.fileData.length,CreationDate:u?cL.default.fromDate(u):void 0,ModDate:f?cL.default.fromDate(f):void 0}}),p=t.register(g),C=t.obj({Type:"Filespec",F:cL.default.of(this.fileName),UF:f1e.default.fromText(this.fileName),EF:{F:p},Desc:s?f1e.default.fromText(s):void 0,AFRelationship:h??void 0}),r?(t.assign(r,C),[2,r]):[2,t.register(C)]})})},e})();xm.default=Cnt});var A1e=U(lL=>{"use strict";Object.defineProperty(lL,"__esModule",{value:!0});var DT=(ct(),ze(ut)),l1e=[65472,65473,65474,65475,65477,65478,65479,65480,65481,65482,65483,65484,65485,65486,65487],vm;(function(e){e.DeviceGray="DeviceGray",e.DeviceRGB="DeviceRGB",e.DeviceCMYK="DeviceCMYK"})(vm||(vm={}));var ynt={1:vm.DeviceGray,3:vm.DeviceRGB,4:vm.DeviceCMYK},xnt=(function(){function e(t,r,n,i,s){this.imageData=t,this.bitsPerComponent=r,this.width=n,this.height=i,this.colorSpace=s}return e.for=function(t){return DT.__awaiter(this,void 0,void 0,function(){var r,n,i,s,u,f,h,g,p,C;return DT.__generator(this,function(y){if(r=new DataView(t.buffer),n=r.getUint16(0),n!==65496)throw new Error("SOI not found in JPEG");for(i=2;i<r.byteLength&&(s=r.getUint16(i),i+=2,!l1e.includes(s));)i+=r.getUint16(i);if(!l1e.includes(s))throw new Error("Invalid JPEG");if(i+=2,u=r.getUint8(i++),f=r.getUint16(i),i+=2,h=r.getUint16(i),i+=2,g=r.getUint8(i++),p=ynt[g],!p)throw new Error("Unknown JPEG channel.");return C=p,[2,new e(t,u,h,f,C)]})})},e.prototype.embedIntoContext=function(t,r){return DT.__awaiter(this,void 0,void 0,function(){var n;return DT.__generator(this,function(i){return n=t.stream(this.imageData,{Type:"XObject",Subtype:"Image",BitsPerComponent:this.bitsPerComponent,Width:this.width,Height:this.height,ColorSpace:this.colorSpace,Filter:"DCTDecode",Decode:this.colorSpace===vm.DeviceCMYK?[1,0,1,0,1,0,1,0]:void 0}),r?(t.assign(r,n),[2,r]):[2,t.register(n)]})})},e})();lL.default=xnt});var d1e=U(BT=>{"use strict";Object.defineProperty(BT,"__esModule",{value:!0});BT.default=void 0;var vnt=Int(B1());function Int(e){return e&&e.__esModule?e:{default:e}}var lt={};lt.toRGBA8=function(e){var t=e.width,r=e.height;if(e.tabs.acTL==null)return[lt.toRGBA8.decodeImage(e.data,t,r,e).buffer];var n=[];e.frames[0].data==null&&(e.frames[0].data=e.data);for(var i=t*r*4,s=new Uint8Array(i),u=new Uint8Array(i),f=new Uint8Array(i),h=0;h<e.frames.length;h++){var g=e.frames[h],p=g.rect.x,C=g.rect.y,y=g.rect.width,x=g.rect.height,v=lt.toRGBA8.decodeImage(g.data,y,x,e);if(h!=0)for(var T=0;T<i;T++)f[T]=s[T];if(g.blend==0?lt._copyTile(v,y,x,s,t,r,p,C,0):g.blend==1&<._copyTile(v,y,x,s,t,r,p,C,1),n.push(s.buffer.slice(0)),g.dispose!=0){if(g.dispose==1)lt._copyTile(u,y,x,s,t,r,p,C,0);else if(g.dispose==2)for(var T=0;T<i;T++)s[T]=f[T]}}return n};lt.toRGBA8.decodeImage=function(e,t,r,n){var i=t*r,s=lt.decode._getBPP(n),u=Math.ceil(t*s/8),f=new Uint8Array(i*4),h=new Uint32Array(f.buffer),g=n.ctype,p=n.depth,C=lt._bin.readUshort,y=Date.now();if(g==6){var x=i<<2;if(p==8)for(var v=0;v<x;v+=4)f[v]=e[v],f[v+1]=e[v+1],f[v+2]=e[v+2],f[v+3]=e[v+3];if(p==16)for(var v=0;v<x;v++)f[v]=e[v<<1]}else if(g==2){var T=n.tabs.tRNS;if(T==null){if(p==8)for(var v=0;v<i;v++){var Q=v*3;h[v]=255<<24|e[Q+2]<<16|e[Q+1]<<8|e[Q]}if(p==16)for(var v=0;v<i;v++){var Q=v*6;h[v]=255<<24|e[Q+4]<<16|e[Q+2]<<8|e[Q]}}else{var F=T[0],_=T[1],S=T[2];if(p==8)for(var v=0;v<i;v++){var N=v<<2,Q=v*3;h[v]=255<<24|e[Q+2]<<16|e[Q+1]<<8|e[Q],e[Q]==F&&e[Q+1]==_&&e[Q+2]==S&&(f[N+3]=0)}if(p==16)for(var v=0;v<i;v++){var N=v<<2,Q=v*6;h[v]=255<<24|e[Q+4]<<16|e[Q+2]<<8|e[Q],C(e,Q)==F&&C(e,Q+2)==_&&C(e,Q+4)==S&&(f[N+3]=0)}}}else if(g==3){var O=n.tabs.PLTE,H=n.tabs.tRNS,q=H?H.length:0;if(p==1)for(var G=0;G<r;G++)for(var J=G*u,Ie=G*t,v=0;v<t;v++){var N=Ie+v<<2,fe=e[J+(v>>3)]>>7-((v&7)<<0)&1,z=3*fe;f[N]=O[z],f[N+1]=O[z+1],f[N+2]=O[z+2],f[N+3]=fe<q?H[fe]:255}if(p==2)for(var G=0;G<r;G++)for(var J=G*u,Ie=G*t,v=0;v<t;v++){var N=Ie+v<<2,fe=e[J+(v>>2)]>>6-((v&3)<<1)&3,z=3*fe;f[N]=O[z],f[N+1]=O[z+1],f[N+2]=O[z+2],f[N+3]=fe<q?H[fe]:255}if(p==4)for(var G=0;G<r;G++)for(var J=G*u,Ie=G*t,v=0;v<t;v++){var N=Ie+v<<2,fe=e[J+(v>>1)]>>4-((v&1)<<2)&15,z=3*fe;f[N]=O[z],f[N+1]=O[z+1],f[N+2]=O[z+2],f[N+3]=fe<q?H[fe]:255}if(p==8)for(var v=0;v<i;v++){var N=v<<2,fe=e[v],z=3*fe;f[N]=O[z],f[N+1]=O[z+1],f[N+2]=O[z+2],f[N+3]=fe<q?H[fe]:255}}else if(g==4){if(p==8)for(var v=0;v<i;v++){var N=v<<2,ge=v<<1,ne=e[ge];f[N]=ne,f[N+1]=ne,f[N+2]=ne,f[N+3]=e[ge+1]}if(p==16)for(var v=0;v<i;v++){var N=v<<2,ge=v<<2,ne=e[ge];f[N]=ne,f[N+1]=ne,f[N+2]=ne,f[N+3]=e[ge+2]}}else if(g==0)for(var F=n.tabs.tRNS?n.tabs.tRNS:-1,G=0;G<r;G++){var Le=G*u,X=G*t;if(p==1)for(var se=0;se<t;se++){var ne=255*(e[Le+(se>>>3)]>>>7-(se&7)&1),j=ne==F*255?0:255;h[X+se]=j<<24|ne<<16|ne<<8|ne}else if(p==2)for(var se=0;se<t;se++){var ne=85*(e[Le+(se>>>2)]>>>6-((se&3)<<1)&3),j=ne==F*85?0:255;h[X+se]=j<<24|ne<<16|ne<<8|ne}else if(p==4)for(var se=0;se<t;se++){var ne=17*(e[Le+(se>>>1)]>>>4-((se&1)<<2)&15),j=ne==F*17?0:255;h[X+se]=j<<24|ne<<16|ne<<8|ne}else if(p==8)for(var se=0;se<t;se++){var ne=e[Le+se],j=ne==F?0:255;h[X+se]=j<<24|ne<<16|ne<<8|ne}else if(p==16)for(var se=0;se<t;se++){var ne=e[Le+(se<<1)],j=C(e,Le+(se<<v))==F?0:255;h[X+se]=j<<24|ne<<16|ne<<8|ne}}return f};lt.decode=function(e){for(var t=new Uint8Array(e),r=8,n=lt._bin,i=n.readUshort,s=n.readUint,u={tabs:{},frames:[]},f=new Uint8Array(t.length),h=0,g,p=0,C=[137,80,78,71,13,10,26,10],y=0;y<8;y++)if(t[y]!=C[y])throw"The input is not a PNG file!";for(;r<t.length;){var x=n.readUint(t,r);r+=4;var v=n.readASCII(t,r,4);if(r+=4,v=="IHDR")lt.decode._IHDR(t,r,u);else if(v=="IDAT"){for(var y=0;y<x;y++)f[h+y]=t[r+y];h+=x}else if(v=="acTL")u.tabs[v]={num_frames:s(t,r),num_plays:s(t,r+4)},g=new Uint8Array(t.length);else if(v=="fcTL"){if(p!=0){var T=u.frames[u.frames.length-1];T.data=lt.decode._decompress(u,g.slice(0,p),T.rect.width,T.rect.height),p=0}var Q={x:s(t,r+12),y:s(t,r+16),width:s(t,r+4),height:s(t,r+8)},F=i(t,r+22);F=i(t,r+20)/(F==0?100:F);var _={rect:Q,delay:Math.round(F*1e3),dispose:t[r+24],blend:t[r+25]};u.frames.push(_)}else if(v=="fdAT"){for(var y=0;y<x-4;y++)g[p+y]=t[r+y+4];p+=x-4}else if(v=="pHYs")u.tabs[v]=[n.readUint(t,r),n.readUint(t,r+4),t[r+8]];else if(v=="cHRM"){u.tabs[v]=[];for(var y=0;y<8;y++)u.tabs[v].push(n.readUint(t,r+y*4))}else if(v=="tEXt"){u.tabs[v]==null&&(u.tabs[v]={});var S=n.nextZero(t,r),N=n.readASCII(t,r,S-r),O=n.readASCII(t,S+1,r+x-S-1);u.tabs[v][N]=O}else if(v=="iTXt"){u.tabs[v]==null&&(u.tabs[v]={});var S=0,H=r;S=n.nextZero(t,H);var N=n.readASCII(t,H,S-H);H=S+1;var q=t[H],G=t[H+1];H+=2,S=n.nextZero(t,H);var J=n.readASCII(t,H,S-H);H=S+1,S=n.nextZero(t,H);var Ie=n.readUTF8(t,H,S-H);H=S+1;var O=n.readUTF8(t,H,x-(H-r));u.tabs[v][N]=O}else if(v=="PLTE")u.tabs[v]=n.readBytes(t,r,x);else if(v=="hIST"){var fe=u.tabs.PLTE.length/3;u.tabs[v]=[];for(var y=0;y<fe;y++)u.tabs[v].push(i(t,r+y*2))}else if(v=="tRNS")u.ctype==3?u.tabs[v]=n.readBytes(t,r,x):u.ctype==0?u.tabs[v]=i(t,r):u.ctype==2&&(u.tabs[v]=[i(t,r),i(t,r+2),i(t,r+4)]);else if(v=="gAMA")u.tabs[v]=n.readUint(t,r)/1e5;else if(v=="sRGB")u.tabs[v]=t[r];else if(v=="bKGD")u.ctype==0||u.ctype==4?u.tabs[v]=[i(t,r)]:u.ctype==2||u.ctype==6?u.tabs[v]=[i(t,r),i(t,r+2),i(t,r+4)]:u.ctype==3&&(u.tabs[v]=t[r]);else if(v=="IEND")break;r+=x;var z=n.readUint(t,r);r+=4}if(p!=0){var T=u.frames[u.frames.length-1];T.data=lt.decode._decompress(u,g.slice(0,p),T.rect.width,T.rect.height),p=0}return u.data=lt.decode._decompress(u,f,u.width,u.height),delete u.compress,delete u.interlace,delete u.filter,u};lt.decode._decompress=function(e,t,r,n){var f=Date.now(),i=lt.decode._getBPP(e),s=Math.ceil(r*i/8),u=new Uint8Array((s+1+e.interlace)*n);t=lt.decode._inflate(t,u);var f=Date.now();return e.interlace==0?t=lt.decode._filterZero(t,e,0,r,n):e.interlace==1&&(t=lt.decode._readInterlace(t,e)),t};lt.decode._inflate=function(e,t){var r=lt.inflateRaw(new Uint8Array(e.buffer,2,e.length-6),t);return r};lt.inflateRaw=(function(){var e={};return e.H={},e.H.N=function(t,r){var n=Uint8Array,i=0,s=0,u=0,f=0,h=0,g=0,p=0,C=0,y=0,x,v;if(t[0]==3&&t[1]==0)return r||new n(0);var T=e.H,Q=T.b,F=T.e,_=T.R,S=T.n,N=T.A,O=T.Z,H=T.m,q=r==null;for(q&&(r=new n(t.length>>>2<<3));i==0;){if(i=Q(t,y,1),s=Q(t,y+1,2),y+=3,s==0){(y&7)!=0&&(y+=8-(y&7));var G=(y>>>3)+4,J=t[G-4]|t[G-3]<<8;q&&(r=e.H.W(r,C+J)),r.set(new n(t.buffer,t.byteOffset+G,J),C),y=G+J<<3,C+=J;continue}if(q&&(r=e.H.W(r,C+(1<<17))),s==1&&(x=H.J,v=H.h,g=511,p=31),s==2){u=F(t,y,5)+257,f=F(t,y+5,5)+1,h=F(t,y+10,4)+4,y+=14;for(var Ie=y,fe=1,z=0;z<38;z+=2)H.Q[z]=0,H.Q[z+1]=0;for(var z=0;z<h;z++){var ge=F(t,y+z*3,3);H.Q[(H.X[z]<<1)+1]=ge,ge>fe&&(fe=ge)}y+=3*h,S(H.Q,fe),N(H.Q,fe,H.u),x=H.w,v=H.d,y=_(H.u,(1<<fe)-1,u+f,t,y,H.v);var ne=T.V(H.v,0,u,H.C);g=(1<<ne)-1;var Le=T.V(H.v,u,f,H.D);p=(1<<Le)-1,S(H.C,ne),N(H.C,ne,x),S(H.D,Le),N(H.D,Le,v)}for(;;){var X=x[O(t,y)&g];y+=X&15;var se=X>>>4;if(!(se>>>8))r[C++]=se;else{if(se==256)break;var j=C+se-254;if(se>264){var Y=H.q[se-257];j=C+(Y>>>3)+F(t,y,Y&7),y+=Y&7}var me=v[O(t,y)&p];y+=me&15;var xe=me>>>4,Be=H.c[xe],Te=(Be>>>4)+Q(t,y,Be&15);for(y+=Be&15;C<j;)r[C]=r[C++-Te],r[C]=r[C++-Te],r[C]=r[C++-Te],r[C]=r[C++-Te];C=j}}}return r.length==C?r:r.slice(0,C)},e.H.W=function(t,r){var n=t.length;if(r<=n)return t;var i=new Uint8Array(n<<1);return i.set(t,0),i},e.H.R=function(t,r,n,i,s,u){for(var f=e.H.e,h=e.H.Z,g=0;g<n;){var p=t[h(i,s)&r];s+=p&15;var C=p>>>4;if(C<=15)u[g]=C,g++;else{var y=0,x=0;C==16?(x=3+f(i,s,2),s+=2,y=u[g-1]):C==17?(x=3+f(i,s,3),s+=3):C==18&&(x=11+f(i,s,7),s+=7);for(var v=g+x;g<v;)u[g]=y,g++}}return s},e.H.V=function(t,r,n,i){for(var s=0,u=0,f=i.length>>>1;u<n;){var h=t[u+r];i[u<<1]=0,i[(u<<1)+1]=h,h>s&&(s=h),u++}for(;u<f;)i[u<<1]=0,i[(u<<1)+1]=0,u++;return s},e.H.n=function(t,r){for(var n=e.H.m,i=t.length,s,u,f,h,g,p=n.j,h=0;h<=r;h++)p[h]=0;for(h=1;h<i;h+=2)p[t[h]]++;var C=n.K;for(s=0,p[0]=0,u=1;u<=r;u++)s=s+p[u-1]<<1,C[u]=s;for(f=0;f<i;f+=2)g=t[f+1],g!=0&&(t[f]=C[g],C[g]++)},e.H.A=function(t,r,n){for(var i=t.length,s=e.H.m,u=s.r,f=0;f<i;f+=2)if(t[f+1]!=0)for(var h=f>>1,g=t[f+1],p=h<<4|g,C=r-g,y=t[f]<<C,x=y+(1<<C);y!=x;){var v=u[y]>>>15-r;n[v]=p,y++}},e.H.l=function(t,r){for(var n=e.H.m.r,i=15-r,s=0;s<t.length;s+=2){var u=t[s]<<r-t[s+1];t[s]=n[u]>>>i}},e.H.M=function(t,r,n){n=n<<(r&7);var i=r>>>3;t[i]|=n,t[i+1]|=n>>>8},e.H.I=function(t,r,n){n=n<<(r&7);var i=r>>>3;t[i]|=n,t[i+1]|=n>>>8,t[i+2]|=n>>>16},e.H.e=function(t,r,n){return(t[r>>>3]|t[(r>>>3)+1]<<8)>>>(r&7)&(1<<n)-1},e.H.b=function(t,r,n){return(t[r>>>3]|t[(r>>>3)+1]<<8|t[(r>>>3)+2]<<16)>>>(r&7)&(1<<n)-1},e.H.Z=function(t,r){return(t[r>>>3]|t[(r>>>3)+1]<<8|t[(r>>>3)+2]<<16)>>>(r&7)},e.H.i=function(t,r){return(t[r>>>3]|t[(r>>>3)+1]<<8|t[(r>>>3)+2]<<16|t[(r>>>3)+3]<<24)>>>(r&7)},e.H.m=(function(){var t=Uint16Array,r=Uint32Array;return{K:new t(16),j:new t(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new t(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new r(32),J:new t(512),_:[],h:new t(32),$:[],w:new t(32768),C:[],v:[],d:new t(32768),D:[],u:new t(512),Q:[],r:new t(32768),s:new r(286),Y:new r(30),a:new r(19),t:new r(15e3),k:new t(65536),g:new t(32768)}})(),(function(){for(var t=e.H.m,r=32768,n=0;n<r;n++){var i=n;i=(i&2863311530)>>>1|(i&1431655765)<<1,i=(i&3435973836)>>>2|(i&858993459)<<2,i=(i&4042322160)>>>4|(i&252645135)<<4,i=(i&4278255360)>>>8|(i&16711935)<<8,t.r[n]=(i>>>16|i<<16)>>>17}function s(u,f,h){for(;f--!=0;)u.push(0,h)}for(var n=0;n<32;n++)t.q[n]=t.S[n]<<3|t.T[n],t.c[n]=t.p[n]<<4|t.z[n];s(t._,144,8),s(t._,112,9),s(t._,24,7),s(t._,8,8),e.H.n(t._,9),e.H.A(t._,9,t.J),e.H.l(t._,9),s(t.$,32,5),e.H.n(t.$,5),e.H.A(t.$,5,t.h),e.H.l(t.$,5),s(t.Q,19,0),s(t.C,286,0),s(t.D,30,0),s(t.v,320,0)})(),e.H.N})();lt.decode._readInterlace=function(e,t){for(var r=t.width,n=t.height,i=lt.decode._getBPP(t),s=i>>3,u=Math.ceil(r*i/8),f=new Uint8Array(n*u),h=0,g=[0,0,4,0,2,0,1],p=[0,4,0,2,0,1,0],C=[8,8,8,4,4,2,2],y=[8,8,4,4,2,2,1],x=0;x<7;){for(var v=C[x],T=y[x],Q=0,F=0,_=g[x];_<n;)_+=v,F++;for(var S=p[x];S<r;)S+=T,Q++;var N=Math.ceil(Q*i/8);lt.decode._filterZero(e,t,h,Q,F);for(var O=0,H=g[x];H<n;){for(var q=p[x],G=h+O*N<<3;q<r;){if(i==1){var J=e[G>>3];J=J>>7-(G&7)&1,f[H*u+(q>>3)]|=J<<7-((q&7)<<0)}if(i==2){var J=e[G>>3];J=J>>6-(G&7)&3,f[H*u+(q>>2)]|=J<<6-((q&3)<<1)}if(i==4){var J=e[G>>3];J=J>>4-(G&7)&15,f[H*u+(q>>1)]|=J<<4-((q&1)<<2)}if(i>=8)for(var Ie=H*u+q*s,fe=0;fe<s;fe++)f[Ie+fe]=e[(G>>3)+fe];G+=i,q+=T}O++,H+=v}Q*F!=0&&(h+=F*(1+N)),x=x+1}return f};lt.decode._getBPP=function(e){var t=[1,null,3,1,2,null,4][e.ctype];return t*e.depth};lt.decode._filterZero=function(e,t,r,n,i){var s=lt.decode._getBPP(t),u=Math.ceil(n*s/8),f=lt.decode._paeth;s=Math.ceil(s/8);var h=0,g=1,p=e[r],C=0;if(p>1&&(e[r]=[0,0,1][p-2]),p==3)for(C=s;C<u;C++)e[C+1]=e[C+1]+(e[C+1-s]>>>1)&255;for(var y=0;y<i;y++)if(h=r+y*u,g=h+y+1,p=e[g-1],C=0,p==0)for(;C<u;C++)e[h+C]=e[g+C];else if(p==1){for(;C<s;C++)e[h+C]=e[g+C];for(;C<u;C++)e[h+C]=e[g+C]+e[h+C-s]}else if(p==2)for(;C<u;C++)e[h+C]=e[g+C]+e[h+C-u];else if(p==3){for(;C<s;C++)e[h+C]=e[g+C]+(e[h+C-u]>>>1);for(;C<u;C++)e[h+C]=e[g+C]+(e[h+C-u]+e[h+C-s]>>>1)}else{for(;C<s;C++)e[h+C]=e[g+C]+f(0,e[h+C-u],0);for(;C<u;C++)e[h+C]=e[g+C]+f(e[h+C-s],e[h+C-u],e[h+C-s-u])}return e};lt.decode._paeth=function(e,t,r){var n=e+t-r,i=n-e,s=n-t,u=n-r;return i*i<=s*s&&i*i<=u*u?e:s*s<=u*u?t:r};lt.decode._IHDR=function(e,t,r){var n=lt._bin;r.width=n.readUint(e,t),t+=4,r.height=n.readUint(e,t),t+=4,r.depth=e[t],t++,r.ctype=e[t],t++,r.compress=e[t],t++,r.filter=e[t],t++,r.interlace=e[t],t++};lt._bin={nextZero:function(e,t){for(;e[t]!=0;)t++;return t},readUshort:function(e,t){return e[t]<<8|e[t+1]},writeUshort:function(e,t,r){e[t]=r>>8&255,e[t+1]=r&255},readUint:function(e,t){return e[t]*(256*256*256)+(e[t+1]<<16|e[t+2]<<8|e[t+3])},writeUint:function(e,t,r){e[t]=r>>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=r&255},readASCII:function(e,t,r){for(var n="",i=0;i<r;i++)n+=String.fromCharCode(e[t+i]);return n},writeASCII:function(e,t,r){for(var n=0;n<r.length;n++)e[t+n]=r.charCodeAt(n)},readBytes:function(e,t,r){for(var n=[],i=0;i<r;i++)n.push(e[t+i]);return n},pad:function(e){return e.length<2?"0"+e:e},readUTF8:function(e,t,r){for(var n="",i,s=0;s<r;s++)n+="%"+lt._bin.pad(e[t+s].toString(16));try{i=decodeURIComponent(n)}catch{return lt._bin.readASCII(e,t,r)}return i}};lt._copyTile=function(e,t,r,n,i,s,u,f,h){for(var g=Math.min(t,i),p=Math.min(r,s),C=0,y=0,x=0;x<p;x++)for(var v=0;v<g;v++)if(u>=0&&f>=0?(C=x*t+v<<2,y=(f+x)*i+u+v<<2):(C=(-f+x)*t-u+v<<2,y=x*i+v<<2),h==0)n[y]=e[C],n[y+1]=e[C+1],n[y+2]=e[C+2],n[y+3]=e[C+3];else if(h==1){var T=e[C+3]*.00392156862745098,Q=e[C]*T,F=e[C+1]*T,_=e[C+2]*T,S=n[y+3]*(1/255),N=n[y]*S,O=n[y+1]*S,H=n[y+2]*S,q=1-T,G=T+S*q,J=G==0?0:1/G;n[y+3]=255*G,n[y+0]=(Q+N*q)*J,n[y+1]=(F+O*q)*J,n[y+2]=(_+H*q)*J}else if(h==2){var T=e[C+3],Q=e[C],F=e[C+1],_=e[C+2],S=n[y+3],N=n[y],O=n[y+1],H=n[y+2];T==S&&Q==N&&F==O&&_==H?(n[y]=0,n[y+1]=0,n[y+2]=0,n[y+3]=0):(n[y]=Q,n[y+1]=F,n[y+2]=_,n[y+3]=T)}else if(h==3){var T=e[C+3],Q=e[C],F=e[C+1],_=e[C+2],S=n[y+3],N=n[y],O=n[y+1],H=n[y+2];if(T==S&&Q==N&&F==O&&_==H)continue;if(T<220&&S>20)return!1}return!0};lt.encode=function(e,t,r,n,i,s,u){n==null&&(n=0),u==null&&(u=!1);var f=lt.encode.compress(e,t,r,n,[!1,!1,!1,0,u]);return lt.encode.compressPNG(f,-1),lt.encode._main(f,t,r,i,s)};lt.encodeLL=function(e,t,r,n,i,s,u,f){for(var h={ctype:0+(n==1?0:2)+(i==0?0:4),depth:s,frames:[]},g=Date.now(),p=(n+i)*s,C=p*t,y=0;y<e.length;y++)h.frames.push({rect:{x:0,y:0,width:t,height:r},img:new Uint8Array(e[y]),blend:0,dispose:1,bpp:Math.ceil(p/8),bpl:Math.ceil(C/8)});lt.encode.compressPNG(h,0,!0);var x=lt.encode._main(h,t,r,u,f);return x};lt.encode._main=function(e,t,r,n,i){i==null&&(i={});var s=lt.crc.crc,u=lt._bin.writeUint,f=lt._bin.writeUshort,h=lt._bin.writeASCII,g=8,p=e.frames.length>1,C=!1,y=33+(p?20:0);if(i.sRGB!=null&&(y+=13),i.pHYs!=null&&(y+=21),e.ctype==3){for(var x=e.plte.length,v=0;v<x;v++)e.plte[v]>>>24!=255&&(C=!0);y+=8+x*3+4+(C?8+x*1+4:0)}for(var T=0;T<e.frames.length;T++){var Q=e.frames[T];p&&(y+=38),y+=Q.cimg.length+12,T!=0&&(y+=4)}y+=12;for(var F=new Uint8Array(y),_=[137,80,78,71,13,10,26,10],v=0;v<8;v++)F[v]=_[v];if(u(F,g,13),g+=4,h(F,g,"IHDR"),g+=4,u(F,g,t),g+=4,u(F,g,r),g+=4,F[g]=e.depth,g++,F[g]=e.ctype,g++,F[g]=0,g++,F[g]=0,g++,F[g]=0,g++,u(F,g,s(F,g-17,17)),g+=4,i.sRGB!=null&&(u(F,g,1),g+=4,h(F,g,"sRGB"),g+=4,F[g]=i.sRGB,g++,u(F,g,s(F,g-5,5)),g+=4),i.pHYs!=null&&(u(F,g,9),g+=4,h(F,g,"pHYs"),g+=4,u(F,g,i.pHYs[0]),g+=4,u(F,g,i.pHYs[1]),g+=4,F[g]=i.pHYs[2],g++,u(F,g,s(F,g-13,13)),g+=4),p&&(u(F,g,8),g+=4,h(F,g,"acTL"),g+=4,u(F,g,e.frames.length),g+=4,u(F,g,i.loop!=null?i.loop:0),g+=4,u(F,g,s(F,g-12,12)),g+=4),e.ctype==3){var x=e.plte.length;u(F,g,x*3),g+=4,h(F,g,"PLTE"),g+=4;for(var v=0;v<x;v++){var S=v*3,N=e.plte[v],O=N&255,H=N>>>8&255,q=N>>>16&255;F[g+S+0]=O,F[g+S+1]=H,F[g+S+2]=q}if(g+=x*3,u(F,g,s(F,g-x*3-4,x*3+4)),g+=4,C){u(F,g,x),g+=4,h(F,g,"tRNS"),g+=4;for(var v=0;v<x;v++)F[g+v]=e.plte[v]>>>24&255;g+=x,u(F,g,s(F,g-x-4,x+4)),g+=4}}for(var G=0,T=0;T<e.frames.length;T++){var Q=e.frames[T];p&&(u(F,g,26),g+=4,h(F,g,"fcTL"),g+=4,u(F,g,G++),g+=4,u(F,g,Q.rect.width),g+=4,u(F,g,Q.rect.height),g+=4,u(F,g,Q.rect.x),g+=4,u(F,g,Q.rect.y),g+=4,f(F,g,n[T]),g+=2,f(F,g,1e3),g+=2,F[g]=Q.dispose,g++,F[g]=Q.blend,g++,u(F,g,s(F,g-30,30)),g+=4);var J=Q.cimg,x=J.length;u(F,g,x+(T==0?0:4)),g+=4;var Ie=g;h(F,g,T==0?"IDAT":"fdAT"),g+=4,T!=0&&(u(F,g,G++),g+=4),F.set(J,g),g+=x,u(F,g,s(F,Ie,g-Ie)),g+=4}return u(F,g,0),g+=4,h(F,g,"IEND"),g+=4,u(F,g,s(F,g-4,4)),g+=4,F.buffer};lt.encode.compressPNG=function(e,t,r){for(var n=0;n<e.frames.length;n++){var i=e.frames[n],s=i.rect.width,u=i.rect.height,f=new Uint8Array(u*i.bpl+u);i.cimg=lt.encode._filterZero(i.img,u,i.bpp,i.bpl,f,t,r)}};lt.encode.compress=function(e,t,r,n,i){for(var s=i[0],u=i[1],f=i[2],h=i[3],g=i[4],p=6,C=8,y=255,x=0;x<e.length;x++)for(var v=new Uint8Array(e[x]),T=v.length,Q=0;Q<T;Q+=4)y&=v[Q+3];var F=y!=255,_=lt.encode.framize(e,t,r,s,u,f),S={},N=[],O=[];if(n!=0){for(var H=[],Q=0;Q<_.length;Q++)H.push(_[Q].img.buffer);for(var q=lt.encode.concatRGBA(H),G=lt.quantize(q,n),J=0,Ie=new Uint8Array(G.abuf),Q=0;Q<_.length;Q++){var fe=_[Q].img,z=fe.length;O.push(new Uint8Array(G.inds.buffer,J>>2,z>>2));for(var x=0;x<z;x+=4)fe[x]=Ie[J+x],fe[x+1]=Ie[J+x+1],fe[x+2]=Ie[J+x+2],fe[x+3]=Ie[J+x+3];J+=z}for(var Q=0;Q<G.plte.length;Q++)N.push(G.plte[Q].est.rgba)}else for(var x=0;x<_.length;x++){var ge=_[x],ne=new Uint32Array(ge.img.buffer),Le=ge.rect.width,T=ne.length,X=new Uint8Array(T);O.push(X);for(var Q=0;Q<T;Q++){var se=ne[Q];if(Q!=0&&se==ne[Q-1])X[Q]=X[Q-1];else if(Q>Le&&se==ne[Q-Le])X[Q]=X[Q-Le];else{var j=S[se];if(j==null&&(S[se]=j=N.length,N.push(se),N.length>=300))break;X[Q]=j}}}var Y=N.length;Y<=256&&g==!1&&(Y<=2?C=1:Y<=4?C=2:Y<=16?C=4:C=8,C=Math.max(C,h));for(var x=0;x<_.length;x++){var ge=_[x],me=ge.rect.x,xe=ge.rect.y,Le=ge.rect.width,Be=ge.rect.height,Te=ge.img,Ge=new Uint32Array(Te.buffer),ye=4*Le,mt=4;if(Y<=256&&g==!1){ye=Math.ceil(C*Le/8);for(var ot=new Uint8Array(ye*Be),sr=O[x],Qr=0;Qr<Be;Qr++){var Q=Qr*ye,tt=Qr*Le;if(C==8)for(var Tt=0;Tt<Le;Tt++)ot[Q+Tt]=sr[tt+Tt];else if(C==4)for(var Tt=0;Tt<Le;Tt++)ot[Q+(Tt>>1)]|=sr[tt+Tt]<<4-(Tt&1)*4;else if(C==2)for(var Tt=0;Tt<Le;Tt++)ot[Q+(Tt>>2)]|=sr[tt+Tt]<<6-(Tt&3)*2;else if(C==1)for(var Tt=0;Tt<Le;Tt++)ot[Q+(Tt>>3)]|=sr[tt+Tt]<<7-(Tt&7)*1}Te=ot,p=3,mt=1}else if(F==!1&&_.length==1){for(var ot=new Uint8Array(Le*Be*3),ve=Le*Be,Q=0;Q<ve;Q++){var fe=Q*3,at=Q*4;ot[fe]=Te[at],ot[fe+1]=Te[at+1],ot[fe+2]=Te[at+2]}Te=ot,p=2,mt=3,ye=3*Le}ge.img=Te,ge.bpl=ye,ge.bpp=mt}return{ctype:p,depth:C,plte:N,frames:_}};lt.encode.framize=function(e,t,r,n,i,s){for(var u=[],f=0;f<e.length;f++){var h=new Uint8Array(e[f]),g=new Uint32Array(h.buffer),p,C=0,y=0,x=t,v=r,T=n?1:0;if(f!=0){for(var Q=s||n||f==1||u[f-2].dispose!=0?1:2,F=0,_=1e9,S=0;S<Q;S++){for(var ge=new Uint8Array(e[f-1-S]),N=new Uint32Array(e[f-1-S]),O=t,H=r,q=-1,G=-1,J=0;J<r;J++)for(var Ie=0;Ie<t;Ie++){var fe=J*t+Ie;g[fe]!=N[fe]&&(Ie<O&&(O=Ie),Ie>q&&(q=Ie),J<H&&(H=J),J>G&&(G=J))}q==-1&&(O=H=q=G=0),i&&((O&1)==1&&O--,(H&1)==1&&H--);var z=(q-O+1)*(G-H+1);z<_&&(_=z,F=S,C=O,y=H,x=q-O+1,v=G-H+1)}var ge=new Uint8Array(e[f-1-F]);F==1&&(u[f-1].dispose=2),p=new Uint8Array(x*v*4),lt._copyTile(ge,t,r,p,x,v,-C,-y,0),T=lt._copyTile(h,t,r,p,x,v,-C,-y,3)?1:0,T==1?lt.encode._prepareDiff(h,t,r,p,{x:C,y,width:x,height:v}):lt._copyTile(h,t,r,p,x,v,-C,-y,0)}else p=h.slice(0);u.push({rect:{x:C,y,width:x,height:v},img:p,blend:T,dispose:0})}if(n)for(var f=0;f<u.length;f++){var ne=u[f];if(ne.blend!=1){var Le=ne.rect,X=u[f-1].rect,se=Math.min(Le.x,X.x),j=Math.min(Le.y,X.y),Y=Math.max(Le.x+Le.width,X.x+X.width),me=Math.max(Le.y+Le.height,X.y+X.height),xe={x:se,y:j,width:Y-se,height:me-j};u[f-1].dispose=1,f-1!=0&<.encode._updateFrame(e,t,r,u,f-1,xe,i),lt.encode._updateFrame(e,t,r,u,f,xe,i)}}var Be=0;if(e.length!=1)for(var fe=0;fe<u.length;fe++){var ne=u[fe];Be+=ne.rect.width*ne.rect.height}return u};lt.encode._updateFrame=function(e,t,r,n,i,s,u){for(var f=Uint8Array,h=Uint32Array,g=new f(e[i-1]),p=new h(e[i-1]),C=i+1<e.length?new f(e[i+1]):null,y=new f(e[i]),x=new h(y.buffer),v=t,T=r,Q=-1,F=-1,_=0;_<s.height;_++)for(var S=0;S<s.width;S++){var N=s.x+S,O=s.y+_,H=O*t+N,q=x[H];q==0||n[i-1].dispose==0&&p[H]==q&&(C==null||C[H*4+3]!=0)||(N<v&&(v=N),N>Q&&(Q=N),O<T&&(T=O),O>F&&(F=O))}Q==-1&&(v=T=Q=F=0),u&&((v&1)==1&&v--,(T&1)==1&&T--),s={x:v,y:T,width:Q-v+1,height:F-T+1};var G=n[i];G.rect=s,G.blend=1,G.img=new Uint8Array(s.width*s.height*4),n[i-1].dispose==0?(lt._copyTile(g,t,r,G.img,s.width,s.height,-s.x,-s.y,0),lt.encode._prepareDiff(y,t,r,G.img,s)):lt._copyTile(y,t,r,G.img,s.width,s.height,-s.x,-s.y,0)};lt.encode._prepareDiff=function(e,t,r,n,i){lt._copyTile(e,t,r,n,i.width,i.height,-i.x,-i.y,2)};lt.encode._filterZero=function(e,t,r,n,i,s,u){var f=[],h=[0,1,2,3,4];s!=-1?h=[s]:(t*n>5e5||r==1)&&(h=[0]);var g;u&&(g={level:0});for(var p=u&&UZIP!=null?UZIP:vnt.default,C=0;C<h.length;C++){for(var y=0;y<t;y++)lt.encode._filterLine(i,e,y,n,r,h[C]);f.push(p.deflate(i,g))}for(var x,v=1e9,C=0;C<f.length;C++)f[C].length<v&&(x=C,v=f[C].length);return f[x]};lt.encode._filterLine=function(e,t,r,n,i,s){var u=r*n,f=u+r,h=lt.decode._paeth;if(e[f]=s,f++,s==0)if(n<500)for(var g=0;g<n;g++)e[f+g]=t[u+g];else e.set(new Uint8Array(t.buffer,u,n),f);else if(s==1){for(var g=0;g<i;g++)e[f+g]=t[u+g];for(var g=i;g<n;g++)e[f+g]=t[u+g]-t[u+g-i]+256&255}else if(r==0){for(var g=0;g<i;g++)e[f+g]=t[u+g];if(s==2)for(var g=i;g<n;g++)e[f+g]=t[u+g];if(s==3)for(var g=i;g<n;g++)e[f+g]=t[u+g]-(t[u+g-i]>>1)+256&255;if(s==4)for(var g=i;g<n;g++)e[f+g]=t[u+g]-h(t[u+g-i],0,0)+256&255}else{if(s==2)for(var g=0;g<n;g++)e[f+g]=t[u+g]+256-t[u+g-n]&255;if(s==3){for(var g=0;g<i;g++)e[f+g]=t[u+g]+256-(t[u+g-n]>>1)&255;for(var g=i;g<n;g++)e[f+g]=t[u+g]+256-(t[u+g-n]+t[u+g-i]>>1)&255}if(s==4){for(var g=0;g<i;g++)e[f+g]=t[u+g]+256-h(0,t[u+g-n],0)&255;for(var g=i;g<n;g++)e[f+g]=t[u+g]+256-h(t[u+g-i],t[u+g-n],t[u+g-i-n])&255}}};lt.crc={table:(function(){for(var e=new Uint32Array(256),t=0;t<256;t++){for(var r=t,n=0;n<8;n++)r&1?r=3988292384^r>>>1:r=r>>>1;e[t]=r}return e})(),update:function(e,t,r,n){for(var i=0;i<n;i++)e=lt.crc.table[(e^t[r+i])&255]^e>>>8;return e},crc:function(e,t,r){return lt.crc.update(4294967295,e,t,r)^4294967295}};lt.quantize=function(e,t){for(var r=new Uint8Array(e),n=r.slice(0),i=new Uint32Array(n.buffer),s=lt.quantize.getKDtree(n,t),u=s[0],f=s[1],h=lt.quantize.planeDst,g=r,p=i,C=g.length,y=new Uint8Array(r.length>>2),x=0;x<C;x+=4){var v=g[x]*.00392156862745098,T=g[x+1]*(1/255),Q=g[x+2]*(1/255),F=g[x+3]*(1/255),_=lt.quantize.getNearest(u,v,T,Q,F);y[x>>2]=_.ind,p[x>>2]=_.est.rgba}return{abuf:n.buffer,inds:y,plte:f}};lt.quantize.getKDtree=function(e,t,r){r==null&&(r=1e-4);var n=new Uint32Array(e.buffer),i={i0:0,i1:e.length,bst:null,est:null,tdst:0,left:null,right:null};i.bst=lt.quantize.stats(e,i.i0,i.i1),i.est=lt.quantize.estats(i.bst);for(var s=[i];s.length<t;){for(var u=0,f=0,h=0;h<s.length;h++)s[h].est.L>u&&(u=s[h].est.L,f=h);if(u<r)break;var g=s[f],p=lt.quantize.splitPixels(e,n,g.i0,g.i1,g.est.e,g.est.eMq255),C=g.i0>=p||g.i1<=p;if(C){g.est.L=0;continue}var y={i0:g.i0,i1:p,bst:null,est:null,tdst:0,left:null,right:null};y.bst=lt.quantize.stats(e,y.i0,y.i1),y.est=lt.quantize.estats(y.bst);var x={i0:p,i1:g.i1,bst:null,est:null,tdst:0,left:null,right:null};x.bst={R:[],m:[],N:g.bst.N-y.bst.N};for(var h=0;h<16;h++)x.bst.R[h]=g.bst.R[h]-y.bst.R[h];for(var h=0;h<4;h++)x.bst.m[h]=g.bst.m[h]-y.bst.m[h];x.est=lt.quantize.estats(x.bst),g.left=y,g.right=x,s[f]=y,s.push(x)}s.sort(function(v,T){return T.bst.N-v.bst.N});for(var h=0;h<s.length;h++)s[h].ind=h;return[i,s]};lt.quantize.getNearest=function(e,t,r,n,i){if(e.left==null)return e.tdst=lt.quantize.dist(e.est.q,t,r,n,i),e;var s=lt.quantize.planeDst(e.est,t,r,n,i),u=e.left,f=e.right;s>0&&(u=e.right,f=e.left);var h=lt.quantize.getNearest(u,t,r,n,i);if(h.tdst<=s*s)return h;var g=lt.quantize.getNearest(f,t,r,n,i);return g.tdst<h.tdst?g:h};lt.quantize.planeDst=function(e,t,r,n,i){var s=e.e;return s[0]*t+s[1]*r+s[2]*n+s[3]*i-e.eMq};lt.quantize.dist=function(e,t,r,n,i){var s=t-e[0],u=r-e[1],f=n-e[2],h=i-e[3];return s*s+u*u+f*f+h*h};lt.quantize.splitPixels=function(e,t,r,n,i,s){var u=lt.quantize.vecDot;n-=4;for(var f=0;r<n;){for(;u(e,r,i)<=s;)r+=4;for(;u(e,n,i)>s;)n-=4;if(r>=n)break;var h=t[r>>2];t[r>>2]=t[n>>2],t[n>>2]=h,r+=4,n-=4}for(;u(e,r,i)>s;)r-=4;return r+4};lt.quantize.vecDot=function(e,t,r){return e[t]*r[0]+e[t+1]*r[1]+e[t+2]*r[2]+e[t+3]*r[3]};lt.quantize.stats=function(e,t,r){for(var n=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i=[0,0,0,0],s=r-t>>2,u=t;u<r;u+=4){var f=e[u]*.00392156862745098,h=e[u+1]*(1/255),g=e[u+2]*(1/255),p=e[u+3]*(1/255);i[0]+=f,i[1]+=h,i[2]+=g,i[3]+=p,n[0]+=f*f,n[1]+=f*h,n[2]+=f*g,n[3]+=f*p,n[5]+=h*h,n[6]+=h*g,n[7]+=h*p,n[10]+=g*g,n[11]+=g*p,n[15]+=p*p}return n[4]=n[1],n[8]=n[2],n[9]=n[6],n[12]=n[3],n[13]=n[7],n[14]=n[11],{R:n,m:i,N:s}};lt.quantize.estats=function(e){var t=e.R,r=e.m,n=e.N,i=r[0],s=r[1],u=r[2],f=r[3],h=n==0?0:1/n,g=[t[0]-i*i*h,t[1]-i*s*h,t[2]-i*u*h,t[3]-i*f*h,t[4]-s*i*h,t[5]-s*s*h,t[6]-s*u*h,t[7]-s*f*h,t[8]-u*i*h,t[9]-u*s*h,t[10]-u*u*h,t[11]-u*f*h,t[12]-f*i*h,t[13]-f*s*h,t[14]-f*u*h,t[15]-f*f*h],p=g,C=lt.M4,y=[.5,.5,.5,.5],x=0,v=0;if(n!=0)for(var T=0;T<10&&(y=C.multVec(p,y),v=Math.sqrt(C.dot(y,y)),y=C.sml(1/v,y),!(Math.abs(v-x)<1e-9));T++)x=v;var Q=[i*h,s*h,u*h,f*h],F=C.dot(C.sml(255,Q),y);return{Cov:g,q:Q,e:y,L:x,eMq255:F,eMq:C.dot(y,Q),rgba:(Math.round(255*Q[3])<<24|Math.round(255*Q[2])<<16|Math.round(255*Q[1])<<8|Math.round(255*Q[0])<<0)>>>0}};lt.M4={multVec:function(e,t){return[e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3],e[4]*t[0]+e[5]*t[1]+e[6]*t[2]+e[7]*t[3],e[8]*t[0]+e[9]*t[1]+e[10]*t[2]+e[11]*t[3],e[12]*t[0]+e[13]*t[1]+e[14]*t[2]+e[15]*t[3]]},dot:function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},sml:function(e,t){return[e*t[0],e*t[1],e*t[2],e*t[3]]}};lt.encode.concatRGBA=function(e){for(var t=0,r=0;r<e.length;r++)t+=e[r].byteLength;for(var n=new Uint8Array(t),i=0,r=0;r<e.length;r++){for(var s=new Uint8Array(e[r]),u=s.length,f=0;f<u;f+=4){var h=s[f],g=s[f+1],p=s[f+2],C=s[f+3];C==0&&(h=g=p=0),n[i+f]=h,n[i+f+1]=g,n[i+f+2]=p,n[i+f+3]=C}i+=u}return n.buffer};var Dnt=lt;BT.default=Dnt});var g1e=U(Xh=>{"use strict";Object.defineProperty(Xh,"__esModule",{value:!0});Xh.PNG=Xh.PngType=void 0;var Bnt=(ct(),ze(ut)),h1e=Bnt.__importDefault(d1e()),wnt=function(e){if(e===0)return Im.Greyscale;if(e===2)return Im.Truecolour;if(e===3)return Im.IndexedColour;if(e===4)return Im.GreyscaleWithAlpha;if(e===6)return Im.TruecolourWithAlpha;throw new Error("Unknown color type: "+e)},Fnt=function(e){for(var t=Math.floor(e.length/4),r=new Uint8Array(t*3),n=new Uint8Array(t*1),i=0,s=0,u=0;i<e.length;)r[s++]=e[i++],r[s++]=e[i++],r[s++]=e[i++],n[u++]=e[i++];return{rgbChannel:r,alphaChannel:n}},Im;(function(e){e.Greyscale="Greyscale",e.Truecolour="Truecolour",e.IndexedColour="IndexedColour",e.GreyscaleWithAlpha="GreyscaleWithAlpha",e.TruecolourWithAlpha="TruecolourWithAlpha"})(Im=Xh.PngType||(Xh.PngType={}));var Tnt=(function(){function e(t){var r=h1e.default.decode(t),n=h1e.default.toRGBA8(r);if(n.length>1)throw new Error("Animated PNGs are not supported");var i=new Uint8Array(n[0]),s=Fnt(i),u=s.rgbChannel,f=s.alphaChannel;this.rgbChannel=u;var h=f.some(function(g){return g<255});h&&(this.alphaChannel=f),this.type=wnt(r.ctype),this.width=r.width,this.height=r.height,this.bitsPerComponent=8}return e.load=function(t){return new e(t)},e})();Xh.PNG=Tnt});var p1e=U(AL=>{"use strict";Object.defineProperty(AL,"__esModule",{value:!0});var wT=(ct(),ze(ut)),Snt=g1e(),Qnt=(function(){function e(t){this.image=t,this.bitsPerComponent=t.bitsPerComponent,this.width=t.width,this.height=t.height,this.colorSpace="DeviceRGB"}return e.for=function(t){return wT.__awaiter(this,void 0,void 0,function(){var r;return wT.__generator(this,function(n){return r=Snt.PNG.load(t),[2,new e(r)]})})},e.prototype.embedIntoContext=function(t,r){return wT.__awaiter(this,void 0,void 0,function(){var n,i;return wT.__generator(this,function(s){return n=this.embedAlphaChannel(t),i=t.flateStream(this.image.rgbChannel,{Type:"XObject",Subtype:"Image",BitsPerComponent:this.image.bitsPerComponent,Width:this.image.width,Height:this.image.height,ColorSpace:this.colorSpace,SMask:n}),r?(t.assign(r,i),[2,r]):[2,t.register(i)]})})},e.prototype.embedAlphaChannel=function(t){if(this.image.alphaChannel){var r=t.flateStream(this.image.alphaChannel,{Type:"XObject",Subtype:"Image",Height:this.image.height,Width:this.image.width,BitsPerComponent:this.image.bitsPerComponent,ColorSpace:"DeviceGray",Decode:[0,1]});return t.register(r)}},e})();AL.default=Qnt});var hL=U(dL=>{"use strict";Object.defineProperty(dL,"__esModule",{value:!0});var _nt=(function(){function e(t,r,n){this.bytes=t,this.start=r||0,this.pos=this.start,this.end=r&&n?r+n:this.bytes.length}return Object.defineProperty(e.prototype,"length",{get:function(){return this.end-this.start},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.length===0},enumerable:!1,configurable:!0}),e.prototype.getByte=function(){return this.pos>=this.end?-1:this.bytes[this.pos++]},e.prototype.getUint16=function(){var t=this.getByte(),r=this.getByte();return t===-1||r===-1?-1:(t<<8)+r},e.prototype.getInt32=function(){var t=this.getByte(),r=this.getByte(),n=this.getByte(),i=this.getByte();return(t<<24)+(r<<16)+(n<<8)+i},e.prototype.getBytes=function(t,r){r===void 0&&(r=!1);var n=this.bytes,i=this.pos,s=this.end;if(t){var f=i+t;f>s&&(f=s),this.pos=f;var u=n.subarray(i,f);return r?new Uint8ClampedArray(u):u}else{var u=n.subarray(i,s);return r?new Uint8ClampedArray(u):u}},e.prototype.peekByte=function(){var t=this.getByte();return this.pos--,t},e.prototype.peekBytes=function(t,r){r===void 0&&(r=!1);var n=this.getBytes(t,r);return this.pos-=n.length,n},e.prototype.skip=function(t){t||(t=1),this.pos+=t},e.prototype.reset=function(){this.pos=this.start},e.prototype.moveStart=function(){this.start=this.pos},e.prototype.makeSubStream=function(t,r){return new e(this.bytes,t,r)},e.prototype.decode=function(){return this.bytes},e})();dL.default=_nt});var Dm=U(gL=>{"use strict";Object.defineProperty(gL,"__esModule",{value:!0});var Nnt=(ct(),ze(ut)),knt=Nn(),Rnt=Nnt.__importDefault(hL()),Unt=new Uint8Array(0),Mnt=(function(){function e(t){if(this.pos=0,this.bufferLength=0,this.eof=!1,this.buffer=Unt,this.minBufferLength=512,t)for(;this.minBufferLength<t;)this.minBufferLength*=2}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){for(;!this.eof&&this.bufferLength===0;)this.readBlock();return this.bufferLength===0},enumerable:!1,configurable:!0}),e.prototype.getByte=function(){for(var t=this.pos;this.bufferLength<=t;){if(this.eof)return-1;this.readBlock()}return this.buffer[this.pos++]},e.prototype.getUint16=function(){var t=this.getByte(),r=this.getByte();return t===-1||r===-1?-1:(t<<8)+r},e.prototype.getInt32=function(){var t=this.getByte(),r=this.getByte(),n=this.getByte(),i=this.getByte();return(t<<24)+(r<<16)+(n<<8)+i},e.prototype.getBytes=function(t,r){r===void 0&&(r=!1);var n,i=this.pos;if(t){for(this.ensureBuffer(i+t),n=i+t;!this.eof&&this.bufferLength<n;)this.readBlock();var s=this.bufferLength;n>s&&(n=s)}else{for(;!this.eof;)this.readBlock();n=this.bufferLength}this.pos=n;var u=this.buffer.subarray(i,n);return r&&!(u instanceof Uint8ClampedArray)?new Uint8ClampedArray(u):u},e.prototype.peekByte=function(){var t=this.getByte();return this.pos--,t},e.prototype.peekBytes=function(t,r){r===void 0&&(r=!1);var n=this.getBytes(t,r);return this.pos-=n.length,n},e.prototype.skip=function(t){t||(t=1),this.pos+=t},e.prototype.reset=function(){this.pos=0},e.prototype.makeSubStream=function(t,r){for(var n=t+r;this.bufferLength<=n&&!this.eof;)this.readBlock();return new Rnt.default(this.buffer,t,r)},e.prototype.decode=function(){for(;!this.eof;)this.readBlock();return this.buffer.subarray(0,this.bufferLength)},e.prototype.readBlock=function(){throw new knt.MethodNotImplementedError(this.constructor.name,"readBlock")},e.prototype.ensureBuffer=function(t){var r=this.buffer;if(t<=r.byteLength)return r;for(var n=this.minBufferLength;n<t;)n*=2;var i=new Uint8Array(n);return i.set(r),this.buffer=i},e})();gL.default=Mnt});var b1e=U(pL=>{"use strict";Object.defineProperty(pL,"__esModule",{value:!0});var E1e=(ct(),ze(ut)),Ont=E1e.__importDefault(Dm()),m1e=function(e){return e===32||e===9||e===13||e===10},Lnt=(function(e){E1e.__extends(t,e);function t(r,n){var i=e.call(this,n)||this;return i.stream=r,i.input=new Uint8Array(5),n&&(n=.8*n),i}return t.prototype.readBlock=function(){for(var r=126,n=122,i=-1,s=this.stream,u=s.getByte();m1e(u);)u=s.getByte();if(u===i||u===r){this.eof=!0;return}var f=this.bufferLength,h,g;if(u===n){for(h=this.ensureBuffer(f+4),g=0;g<4;++g)h[f+g]=0;this.bufferLength+=4}else{var p=this.input;for(p[0]=u,g=1;g<5;++g){for(u=s.getByte();m1e(u);)u=s.getByte();if(p[g]=u,u===i||u===r)break}if(h=this.ensureBuffer(f+g-1),this.bufferLength+=g-1,g<5){for(;g<5;++g)p[g]=117;this.eof=!0}var C=0;for(g=0;g<5;++g)C=C*85+(p[g]-33);for(g=3;g>=0;--g)h[f+g]=C&255,C>>=8}},t})(Ont.default);pL.default=Lnt});var y1e=U(mL=>{"use strict";Object.defineProperty(mL,"__esModule",{value:!0});var C1e=(ct(),ze(ut)),Pnt=C1e.__importDefault(Dm()),Hnt=(function(e){C1e.__extends(t,e);function t(r,n){var i=e.call(this,n)||this;return i.stream=r,i.firstDigit=-1,n&&(n=.5*n),i}return t.prototype.readBlock=function(){var r=8e3,n=this.stream.getBytes(r);if(!n.length){this.eof=!0;return}for(var i=n.length+1>>1,s=this.ensureBuffer(this.bufferLength+i),u=this.bufferLength,f=this.firstDigit,h=0,g=n.length;h<g;h++){var p=n[h],C=void 0;if(p>=48&&p<=57)C=p&15;else if(p>=65&&p<=70||p>=97&&p<=102)C=(p&15)+9;else if(p===62){this.eof=!0;break}else continue;f<0?f=C:(s[u++]=f<<4|C,f=-1)}f>=0&&this.eof&&(s[u++]=f<<4,f=-1),this.firstDigit=f,this.bufferLength=u},t})(Pnt.default);mL.default=Hnt});var I1e=U(EL=>{"use strict";Object.defineProperty(EL,"__esModule",{value:!0});var v1e=(ct(),ze(ut)),qnt=v1e.__importDefault(Dm()),x1e=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Wnt=new Int32Array([3,4,5,6,7,8,9,10,65547,65549,65551,65553,131091,131095,131099,131103,196643,196651,196659,196667,262211,262227,262243,262259,327811,327843,327875,327907,258,258,258]),Gnt=new Int32Array([1,2,3,4,65541,65543,131081,131085,196625,196633,262177,262193,327745,327777,393345,393409,459009,459137,524801,525057,590849,591361,657409,658433,724993,727041,794625,798721,868353,876545]),Vnt=[new Int32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,59e4,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],Ynt=[new Int32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5],jnt=(function(e){v1e.__extends(t,e);function t(r,n){var i=e.call(this,n)||this;i.stream=r;var s=r.getByte(),u=r.getByte();if(s===-1||u===-1)throw new Error("Invalid header in flate stream: "+s+", "+u);if((s&15)!==8)throw new Error("Unknown compression method in flate stream: "+s+", "+u);if(((s<<8)+u)%31!==0)throw new Error("Bad FCHECK in flate stream: "+s+", "+u);if(u&32)throw new Error("FDICT bit set in flate stream: "+s+", "+u);return i.codeSize=0,i.codeBuf=0,i}return t.prototype.readBlock=function(){var r,n,i=this.stream,s=this.getBits(3);if(s&1&&(this.eof=!0),s>>=1,s===0){var u=void 0;if((u=i.getByte())===-1)throw new Error("Bad block header in flate stream");var f=u;if((u=i.getByte())===-1)throw new Error("Bad block header in flate stream");if(f|=u<<8,(u=i.getByte())===-1)throw new Error("Bad block header in flate stream");var h=u;if((u=i.getByte())===-1)throw new Error("Bad block header in flate stream");if(h|=u<<8,h!==(~f&65535)&&(f!==0||h!==0))throw new Error("Bad uncompressed block length in flate stream");this.codeBuf=0,this.codeSize=0;var g=this.bufferLength;r=this.ensureBuffer(g+f);var p=g+f;if(this.bufferLength=p,f===0)i.peekByte()===-1&&(this.eof=!0);else for(var C=g;C<p;++C){if((u=i.getByte())===-1){this.eof=!0;break}r[C]=u}return}var y,x;if(s===1)y=Vnt,x=Ynt;else if(s===2){var v=this.getBits(5)+257,T=this.getBits(5)+1,Q=this.getBits(4)+4,F=new Uint8Array(x1e.length),_=void 0;for(_=0;_<Q;++_)F[x1e[_]]=this.getBits(3);var S=this.generateHuffmanTable(F);n=0,_=0;for(var N=v+T,O=new Uint8Array(N),H=void 0,q=void 0,G=void 0;_<N;){var J=this.getCode(S);if(J===16)H=2,q=3,G=n;else if(J===17)H=3,q=3,G=n=0;else if(J===18)H=7,q=11,G=n=0;else{O[_++]=n=J;continue}for(var Ie=this.getBits(H)+q;Ie-- >0;)O[_++]=G}y=this.generateHuffmanTable(O.subarray(0,v)),x=this.generateHuffmanTable(O.subarray(v,N))}else throw new Error("Unknown block type in flate stream");r=this.buffer;for(var fe=r?r.length:0,z=this.bufferLength;;){var ge=this.getCode(y);if(ge<256){z+1>=fe&&(r=this.ensureBuffer(z+1),fe=r.length),r[z++]=ge;continue}if(ge===256){this.bufferLength=z;return}ge-=257,ge=Wnt[ge];var ne=ge>>16;ne>0&&(ne=this.getBits(ne)),n=(ge&65535)+ne,ge=this.getCode(x),ge=Gnt[ge],ne=ge>>16,ne>0&&(ne=this.getBits(ne));var Le=(ge&65535)+ne;z+n>=fe&&(r=this.ensureBuffer(z+n),fe=r.length);for(var X=0;X<n;++X,++z)r[z]=r[z-Le]}},t.prototype.getBits=function(r){for(var n=this.stream,i=this.codeSize,s=this.codeBuf,u;i<r;){if((u=n.getByte())===-1)throw new Error("Bad encoding in flate stream");s|=u<<i,i+=8}return u=s&(1<<r)-1,this.codeBuf=s>>r,this.codeSize=i-=r,u},t.prototype.getCode=function(r){for(var n=this.stream,i=r[0],s=r[1],u=this.codeSize,f=this.codeBuf,h;u<s&&(h=n.getByte())!==-1;)f|=h<<u,u+=8;var g=i[f&(1<<s)-1];typeof i=="number"&&console.log("FLATE:",g);var p=g>>16,C=g&65535;if(p<1||u<p)throw new Error("Bad encoding in flate stream");return this.codeBuf=f>>p,this.codeSize=u-p,C},t.prototype.generateHuffmanTable=function(r){var n=r.length,i=0,s;for(s=0;s<n;++s)r[s]>i&&(i=r[s]);for(var u=1<<i,f=new Int32Array(u),h=1,g=0,p=2;h<=i;++h,g<<=1,p<<=1)for(var C=0;C<n;++C)if(r[C]===h){var y=0,x=g;for(s=0;s<h;++s)y=y<<1|x&1,x>>=1;for(s=y;s<u;s+=p)f[s]=h<<16|C;++g}return[f,i]},t})(qnt.default);EL.default=jnt});var B1e=U(bL=>{"use strict";Object.defineProperty(bL,"__esModule",{value:!0});var D1e=(ct(),ze(ut)),Jnt=D1e.__importDefault(Dm()),Xnt=(function(e){D1e.__extends(t,e);function t(r,n,i){var s=e.call(this,n)||this;s.stream=r,s.cachedData=0,s.bitsCached=0;for(var u=4096,f={earlyChange:i,codeLength:9,nextCode:258,dictionaryValues:new Uint8Array(u),dictionaryLengths:new Uint16Array(u),dictionaryPrevCodes:new Uint16Array(u),currentSequence:new Uint8Array(u),currentSequenceLength:0},h=0;h<256;++h)f.dictionaryValues[h]=h,f.dictionaryLengths[h]=1;return s.lzwState=f,s}return t.prototype.readBlock=function(){var r=512,n=r*2,i=r,s,u,f,h=this.lzwState;if(h){var g=h.earlyChange,p=h.nextCode,C=h.dictionaryValues,y=h.dictionaryLengths,x=h.dictionaryPrevCodes,v=h.codeLength,T=h.prevCode,Q=h.currentSequence,F=h.currentSequenceLength,_=0,S=this.bufferLength,N=this.ensureBuffer(this.bufferLength+n);for(s=0;s<r;s++){var O=this.readBits(v),H=F>0;if(!O||O<256)Q[0]=O,F=1;else if(O>=258)if(O<p)for(F=y[O],u=F-1,f=O;u>=0;u--)Q[u]=C[f],f=x[f];else Q[F++]=Q[0];else if(O===256){v=9,p=258,F=0;continue}else{this.eof=!0,delete this.lzwState;break}if(H&&(x[p]=T,y[p]=y[T]+1,C[p]=Q[0],p++,v=p+g&p+g-1?v:Math.min(Math.log(p+g)/.6931471805599453+1,12)|0),T=O,_+=F,n<_){do n+=i;while(n<_);N=this.ensureBuffer(this.bufferLength+n)}for(u=0;u<F;u++)N[S++]=Q[u]}h.nextCode=p,h.codeLength=v,h.prevCode=T,h.currentSequenceLength=F,this.bufferLength=S}},t.prototype.readBits=function(r){for(var n=this.bitsCached,i=this.cachedData;n<r;){var s=this.stream.getByte();if(s===-1)return this.eof=!0,null;i=i<<8|s,n+=8}return this.bitsCached=n-=r,this.cachedData=i,i>>>n&(1<<r)-1},t})(Jnt.default);bL.default=Xnt});var F1e=U(CL=>{"use strict";Object.defineProperty(CL,"__esModule",{value:!0});var w1e=(ct(),ze(ut)),Knt=w1e.__importDefault(Dm()),znt=(function(e){w1e.__extends(t,e);function t(r,n){var i=e.call(this,n)||this;return i.stream=r,i}return t.prototype.readBlock=function(){var r=this.stream.getBytes(2);if(!r||r.length<2||r[0]===128){this.eof=!0;return}var n,i=this.bufferLength,s=r[0];if(s<128){if(n=this.ensureBuffer(i+s+1),n[i++]=r[1],s>0){var u=this.stream.getBytes(s);n.set(u,i),i+=s}}else{s=257-s;var f=r[1];n=this.ensureBuffer(i+s+1);for(var h=0;h<s;h++)n[i++]=f}this.bufferLength=i},t})(Knt.default);CL.default=znt});var TT=U(FT=>{"use strict";Object.defineProperty(FT,"__esModule",{value:!0});FT.decodePDFRawStream=void 0;var Q0=(ct(),ze(ut)),Q1e=Nn(),T1e=Q0.__importDefault(Oa()),_1e=Q0.__importDefault(ls()),Tc=Q0.__importDefault(zr()),Znt=Q0.__importDefault(ki()),$nt=Q0.__importDefault(b1e()),eit=Q0.__importDefault(y1e()),tit=Q0.__importDefault(I1e()),rit=Q0.__importDefault(B1e()),nit=Q0.__importDefault(F1e()),iit=Q0.__importDefault(hL()),S1e=function(e,t,r){if(t===Tc.default.of("FlateDecode"))return new tit.default(e);if(t===Tc.default.of("LZWDecode")){var n=1;if(r instanceof _1e.default){var i=r.lookup(Tc.default.of("EarlyChange"));i instanceof Znt.default&&(n=i.asNumber())}return new rit.default(e,void 0,n)}if(t===Tc.default.of("ASCII85Decode"))return new $nt.default(e);if(t===Tc.default.of("ASCIIHexDecode"))return new eit.default(e);if(t===Tc.default.of("RunLengthDecode"))return new nit.default(e);throw new Q1e.UnsupportedEncodingError(t.asString())};FT.decodePDFRawStream=function(e){var t=e.dict,r=e.contents,n=new iit.default(r),i=t.lookup(Tc.default.of("Filter")),s=t.lookup(Tc.default.of("DecodeParms"));if(i instanceof Tc.default)n=S1e(n,i,s);else if(i instanceof T1e.default)for(var u=0,f=i.size();u<f;u++)n=S1e(n,i.lookup(u,Tc.default),s&&s.lookupMaybe(u,_1e.default));else if(i)throw new Q1e.UnexpectedObjectTypeError([Tc.default,T1e.default],i);return n}});var k1e=U(yL=>{"use strict";Object.defineProperty(yL,"__esModule",{value:!0});var Jf=(ct(),ze(ut)),N1e=Nn(),ST=Jf.__importDefault(ki()),ait=Jf.__importDefault(Em()),sit=Jf.__importDefault(jf()),oit=TT(),uit=Jf.__importDefault(cT()),cit=Jf.__importDefault(kn()),fit=fr(),lit=function(e){var t=e.MediaBox(),r=t.lookup(2,ST.default).asNumber()-t.lookup(0,ST.default).asNumber(),n=t.lookup(3,ST.default).asNumber()-t.lookup(1,ST.default).asNumber();return{left:0,bottom:0,right:r,top:n}},Ait=function(e){return[1,0,0,1,-e.left,-e.bottom]},dit=(function(){function e(t,r,n){this.page=t;var i=r??lit(t);this.width=i.right-i.left,this.height=i.top-i.bottom,this.boundingBox=i,this.transformationMatrix=n??Ait(i)}return e.for=function(t,r,n){return Jf.__awaiter(this,void 0,void 0,function(){return Jf.__generator(this,function(i){return[2,new e(t,r,n)]})})},e.prototype.embedIntoContext=function(t,r){return Jf.__awaiter(this,void 0,void 0,function(){var n,i,s,u,f,h,g,p,C,y;return Jf.__generator(this,function(x){if(n=this.page.normalizedEntries(),i=n.Contents,s=n.Resources,!i)throw new N1e.MissingPageContentsEmbeddingError;return u=this.decodeContents(i),f=this.boundingBox,h=f.left,g=f.bottom,p=f.right,C=f.top,y=t.flateStream(u,{Type:"XObject",Subtype:"Form",FormType:1,BBox:[h,g,p,C],Matrix:this.transformationMatrix,Resources:s}),r?(t.assign(r,y),[2,r]):[2,t.register(y)]})})},e.prototype.decodeContents=function(t){for(var r=Uint8Array.of(cit.default.Newline),n=[],i=0,s=t.size();i<s;i++){var u=t.lookup(i,sit.default),f=void 0;if(u instanceof ait.default)f=oit.decodePDFRawStream(u).decode();else if(u instanceof uit.default)f=u.getUnencodedContents();else throw new N1e.UnrecognizedStreamTypeError(u);n.push(f,r)}return fit.mergeIntoTypedArray.apply(void 0,n)},e})();yL.default=dit});var IL=U(ks=>{"use strict";Object.defineProperty(ks,"__esModule",{value:!0});ks.Duplex=ks.PrintScaling=ks.ReadingDirection=ks.NonFullScreenPageMode=void 0;var RT=(ct(),ze(ut)),hit=RT.__importDefault(Oa()),git=RT.__importDefault(by()),Bi=RT.__importDefault(zr()),xL=RT.__importDefault(ki()),Kh=fr(),QT=function(e,t){if(e!==void 0)return t[e]},_T;(function(e){e.UseNone="UseNone",e.UseOutlines="UseOutlines",e.UseThumbs="UseThumbs",e.UseOC="UseOC"})(_T=ks.NonFullScreenPageMode||(ks.NonFullScreenPageMode={}));var NT;(function(e){e.L2R="L2R",e.R2L="R2L"})(NT=ks.ReadingDirection||(ks.ReadingDirection={}));var kT;(function(e){e.None="None",e.AppDefault="AppDefault"})(kT=ks.PrintScaling||(ks.PrintScaling={}));var vL;(function(e){e.Simplex="Simplex",e.DuplexFlipShortEdge="DuplexFlipShortEdge",e.DuplexFlipLongEdge="DuplexFlipLongEdge"})(vL=ks.Duplex||(ks.Duplex={}));var pit=(function(){function e(t){this.dict=t}return e.prototype.lookupBool=function(t){var r=this.dict.lookup(Bi.default.of(t));if(r instanceof git.default)return r},e.prototype.lookupName=function(t){var r=this.dict.lookup(Bi.default.of(t));if(r instanceof Bi.default)return r},e.prototype.HideToolbar=function(){return this.lookupBool("HideToolbar")},e.prototype.HideMenubar=function(){return this.lookupBool("HideMenubar")},e.prototype.HideWindowUI=function(){return this.lookupBool("HideWindowUI")},e.prototype.FitWindow=function(){return this.lookupBool("FitWindow")},e.prototype.CenterWindow=function(){return this.lookupBool("CenterWindow")},e.prototype.DisplayDocTitle=function(){return this.lookupBool("DisplayDocTitle")},e.prototype.NonFullScreenPageMode=function(){return this.lookupName("NonFullScreenPageMode")},e.prototype.Direction=function(){return this.lookupName("Direction")},e.prototype.PrintScaling=function(){return this.lookupName("PrintScaling")},e.prototype.Duplex=function(){return this.lookupName("Duplex")},e.prototype.PickTrayByPDFSize=function(){return this.lookupBool("PickTrayByPDFSize")},e.prototype.PrintPageRange=function(){var t=this.dict.lookup(Bi.default.of("PrintPageRange"));if(t instanceof hit.default)return t},e.prototype.NumCopies=function(){var t=this.dict.lookup(Bi.default.of("NumCopies"));if(t instanceof xL.default)return t},e.prototype.getHideToolbar=function(){var t,r;return(r=(t=this.HideToolbar())===null||t===void 0?void 0:t.asBoolean())!==null&&r!==void 0?r:!1},e.prototype.getHideMenubar=function(){var t,r;return(r=(t=this.HideMenubar())===null||t===void 0?void 0:t.asBoolean())!==null&&r!==void 0?r:!1},e.prototype.getHideWindowUI=function(){var t,r;return(r=(t=this.HideWindowUI())===null||t===void 0?void 0:t.asBoolean())!==null&&r!==void 0?r:!1},e.prototype.getFitWindow=function(){var t,r;return(r=(t=this.FitWindow())===null||t===void 0?void 0:t.asBoolean())!==null&&r!==void 0?r:!1},e.prototype.getCenterWindow=function(){var t,r;return(r=(t=this.CenterWindow())===null||t===void 0?void 0:t.asBoolean())!==null&&r!==void 0?r:!1},e.prototype.getDisplayDocTitle=function(){var t,r;return(r=(t=this.DisplayDocTitle())===null||t===void 0?void 0:t.asBoolean())!==null&&r!==void 0?r:!1},e.prototype.getNonFullScreenPageMode=function(){var t,r,n=(t=this.NonFullScreenPageMode())===null||t===void 0?void 0:t.decodeText();return(r=QT(n,_T))!==null&&r!==void 0?r:_T.UseNone},e.prototype.getReadingDirection=function(){var t,r,n=(t=this.Direction())===null||t===void 0?void 0:t.decodeText();return(r=QT(n,NT))!==null&&r!==void 0?r:NT.L2R},e.prototype.getPrintScaling=function(){var t,r,n=(t=this.PrintScaling())===null||t===void 0?void 0:t.decodeText();return(r=QT(n,kT))!==null&&r!==void 0?r:kT.AppDefault},e.prototype.getDuplex=function(){var t,r=(t=this.Duplex())===null||t===void 0?void 0:t.decodeText();return QT(r,vL)},e.prototype.getPickTrayByPDFSize=function(){var t;return(t=this.PickTrayByPDFSize())===null||t===void 0?void 0:t.asBoolean()},e.prototype.getPrintPageRange=function(){var t=this.PrintPageRange();if(!t)return[];for(var r=[],n=0;n<t.size();n+=2){var i=t.lookup(n,xL.default).asNumber(),s=t.lookup(n+1,xL.default).asNumber();r.push({start:i,end:s})}return r},e.prototype.getNumCopies=function(){var t,r;return(r=(t=this.NumCopies())===null||t===void 0?void 0:t.asNumber())!==null&&r!==void 0?r:1},e.prototype.setHideToolbar=function(t){var r=this.dict.context.obj(t);this.dict.set(Bi.default.of("HideToolbar"),r)},e.prototype.setHideMenubar=function(t){var r=this.dict.context.obj(t);this.dict.set(Bi.default.of("HideMenubar"),r)},e.prototype.setHideWindowUI=function(t){var r=this.dict.context.obj(t);this.dict.set(Bi.default.of("HideWindowUI"),r)},e.prototype.setFitWindow=function(t){var r=this.dict.context.obj(t);this.dict.set(Bi.default.of("FitWindow"),r)},e.prototype.setCenterWindow=function(t){var r=this.dict.context.obj(t);this.dict.set(Bi.default.of("CenterWindow"),r)},e.prototype.setDisplayDocTitle=function(t){var r=this.dict.context.obj(t);this.dict.set(Bi.default.of("DisplayDocTitle"),r)},e.prototype.setNonFullScreenPageMode=function(t){Kh.assertIsOneOf(t,"nonFullScreenPageMode",_T);var r=Bi.default.of(t);this.dict.set(Bi.default.of("NonFullScreenPageMode"),r)},e.prototype.setReadingDirection=function(t){Kh.assertIsOneOf(t,"readingDirection",NT);var r=Bi.default.of(t);this.dict.set(Bi.default.of("Direction"),r)},e.prototype.setPrintScaling=function(t){Kh.assertIsOneOf(t,"printScaling",kT);var r=Bi.default.of(t);this.dict.set(Bi.default.of("PrintScaling"),r)},e.prototype.setDuplex=function(t){Kh.assertIsOneOf(t,"duplex",vL);var r=Bi.default.of(t);this.dict.set(Bi.default.of("Duplex"),r)},e.prototype.setPickTrayByPDFSize=function(t){var r=this.dict.context.obj(t);this.dict.set(Bi.default.of("PickTrayByPDFSize"),r)},e.prototype.setPrintPageRange=function(t){Array.isArray(t)||(t=[t]);for(var r=[],n=0,i=t.length;n<i;n++)r.push(t[n].start),r.push(t[n].end);Kh.assertEachIs(r,"printPageRange",["number"]);var s=this.dict.context.obj(r);this.dict.set(Bi.default.of("PrintPageRange"),s)},e.prototype.setNumCopies=function(t){Kh.assertRange(t,"numCopies",1,Number.MAX_VALUE),Kh.assertInteger(t,"numCopies");var r=this.dict.context.obj(t);this.dict.set(Bi.default.of("NumCopies"),r)},e.fromDict=function(t){return new e(t)},e.create=function(t){var r=t.obj({});return new e(r)},e})();ks.default=pit});var MT=U(BL=>{"use strict";Object.defineProperty(BL,"__esModule",{value:!0});var zh=(ct(),ze(ut)),mit=zh.__importDefault(ls()),DL=zh.__importDefault(Fc()),UT=zh.__importDefault(co()),lo=zh.__importDefault(zr()),R1e=zh.__importDefault(ki()),Eit=zh.__importDefault(Oa()),bit=zh.__importDefault(Ns()),Cit=fr(),U1e=Nn(),yit=/\/([^\0\t\n\f\r\ ]+)[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]+Tf/,xit=(function(){function e(t,r){this.dict=t,this.ref=r}return e.prototype.T=function(){return this.dict.lookupMaybe(lo.default.of("T"),DL.default,UT.default)},e.prototype.Ff=function(){var t=this.getInheritableAttribute(lo.default.of("Ff"));return this.dict.context.lookupMaybe(t,R1e.default)},e.prototype.V=function(){var t=this.getInheritableAttribute(lo.default.of("V"));return this.dict.context.lookup(t)},e.prototype.Kids=function(){return this.dict.lookupMaybe(lo.default.of("Kids"),Eit.default)},e.prototype.DA=function(){var t=this.dict.lookup(lo.default.of("DA"));if(t instanceof DL.default||t instanceof UT.default)return t},e.prototype.setKids=function(t){this.dict.set(lo.default.of("Kids"),this.dict.context.obj(t))},e.prototype.getParent=function(){var t=this.dict.get(lo.default.of("Parent"));if(t instanceof bit.default){var r=this.dict.lookup(lo.default.of("Parent"),mit.default);return new e(r,t)}},e.prototype.setParent=function(t){t?this.dict.set(lo.default.of("Parent"),t):this.dict.delete(lo.default.of("Parent"))},e.prototype.getFullyQualifiedName=function(){var t=this.getParent();return t?t.getFullyQualifiedName()+"."+this.getPartialName():this.getPartialName()},e.prototype.getPartialName=function(){var t;return(t=this.T())===null||t===void 0?void 0:t.decodeText()},e.prototype.setPartialName=function(t){t?this.dict.set(lo.default.of("T"),UT.default.fromText(t)):this.dict.delete(lo.default.of("T"))},e.prototype.setDefaultAppearance=function(t){this.dict.set(lo.default.of("DA"),DL.default.of(t))},e.prototype.getDefaultAppearance=function(){var t=this.DA();return t instanceof UT.default?t.decodeText():t?.asString()},e.prototype.setFontSize=function(t){var r,n=(r=this.getFullyQualifiedName())!==null&&r!==void 0?r:"",i=this.getDefaultAppearance();if(!i)throw new U1e.MissingDAEntryError(n);var s=Cit.findLastMatch(i,yit);if(!s.match)throw new U1e.MissingTfOperatorError(n);var u=i.slice(0,s.pos-s.match[0].length),f=s.pos<=i.length?i.slice(s.pos):"",h=s.match[1],g=u+" /"+h+" "+t+" Tf "+f;this.setDefaultAppearance(g)},e.prototype.getFlags=function(){var t,r;return(r=(t=this.Ff())===null||t===void 0?void 0:t.asNumber())!==null&&r!==void 0?r:0},e.prototype.setFlags=function(t){this.dict.set(lo.default.of("Ff"),R1e.default.of(t))},e.prototype.hasFlag=function(t){var r=this.getFlags();return(r&t)!==0},e.prototype.setFlag=function(t){var r=this.getFlags();this.setFlags(r|t)},e.prototype.clearFlag=function(t){var r=this.getFlags();this.setFlags(r&~t)},e.prototype.setFlagTo=function(t,r){r?this.setFlag(t):this.clearFlag(t)},e.prototype.getInheritableAttribute=function(t){var r;return this.ascend(function(n){r||(r=n.dict.get(t))}),r},e.prototype.ascend=function(t){t(this);var r=this.getParent();r&&r.ascend(t)},e})();BL.default=xit});var L1e=U(wL=>{"use strict";Object.defineProperty(wL,"__esModule",{value:!0});var O1e=(ct(),ze(ut)),M1e=O1e.__importDefault(zr()),vit=O1e.__importDefault(ki()),Iit=(function(){function e(t){this.dict=t}return e.prototype.W=function(){var t=this.dict.lookup(M1e.default.of("W"));if(t instanceof vit.default)return t},e.prototype.getWidth=function(){var t,r;return(r=(t=this.W())===null||t===void 0?void 0:t.asNumber())!==null&&r!==void 0?r:1},e.prototype.setWidth=function(t){var r=this.dict.context.obj(t);this.dict.set(M1e.default.of("W"),r)},e.fromDict=function(t){return new e(t)},e})();wL.default=Iit});var SL=U(TL=>{"use strict";Object.defineProperty(TL,"__esModule",{value:!0});var Bm=(ct(),ze(ut)),Fy=Bm.__importDefault(ls()),ra=Bm.__importDefault(zr()),FL=Bm.__importDefault(jf()),Dit=Bm.__importDefault(Oa()),Bit=Bm.__importDefault(Ns()),P1e=Bm.__importDefault(ki()),wit=(function(){function e(t){this.dict=t}return e.prototype.Rect=function(){return this.dict.lookup(ra.default.of("Rect"),Dit.default)},e.prototype.AP=function(){return this.dict.lookupMaybe(ra.default.of("AP"),Fy.default)},e.prototype.F=function(){var t=this.dict.lookup(ra.default.of("F"));return this.dict.context.lookupMaybe(t,P1e.default)},e.prototype.getRectangle=function(){var t,r=this.Rect();return(t=r?.asRectangle())!==null&&t!==void 0?t:{x:0,y:0,width:0,height:0}},e.prototype.setRectangle=function(t){var r=t.x,n=t.y,i=t.width,s=t.height,u=this.dict.context.obj([r,n,r+i,n+s]);this.dict.set(ra.default.of("Rect"),u)},e.prototype.getAppearanceState=function(){var t=this.dict.lookup(ra.default.of("AS"));if(t instanceof ra.default)return t},e.prototype.setAppearanceState=function(t){this.dict.set(ra.default.of("AS"),t)},e.prototype.setAppearances=function(t){this.dict.set(ra.default.of("AP"),t)},e.prototype.ensureAP=function(){var t=this.AP();return t||(t=this.dict.context.obj({}),this.dict.set(ra.default.of("AP"),t)),t},e.prototype.getNormalAppearance=function(){var t=this.ensureAP(),r=t.get(ra.default.of("N"));if(r instanceof Bit.default||r instanceof Fy.default)return r;throw new Error("Unexpected N type: "+r?.constructor.name)},e.prototype.setNormalAppearance=function(t){var r=this.ensureAP();r.set(ra.default.of("N"),t)},e.prototype.setRolloverAppearance=function(t){var r=this.ensureAP();r.set(ra.default.of("R"),t)},e.prototype.setDownAppearance=function(t){var r=this.ensureAP();r.set(ra.default.of("D"),t)},e.prototype.removeRolloverAppearance=function(){var t=this.AP();t?.delete(ra.default.of("R"))},e.prototype.removeDownAppearance=function(){var t=this.AP();t?.delete(ra.default.of("D"))},e.prototype.getAppearances=function(){var t=this.AP();if(t){var r=t.lookup(ra.default.of("N"),Fy.default,FL.default),n=t.lookupMaybe(ra.default.of("R"),Fy.default,FL.default),i=t.lookupMaybe(ra.default.of("D"),Fy.default,FL.default);return{normal:r,rollover:n,down:i}}},e.prototype.getFlags=function(){var t,r;return(r=(t=this.F())===null||t===void 0?void 0:t.asNumber())!==null&&r!==void 0?r:0},e.prototype.setFlags=function(t){this.dict.set(ra.default.of("F"),P1e.default.of(t))},e.prototype.hasFlag=function(t){var r=this.getFlags();return(r&t)!==0},e.prototype.setFlag=function(t){var r=this.getFlags();this.setFlags(r|t)},e.prototype.clearFlag=function(t){var r=this.getFlags();this.setFlags(r&~t)},e.prototype.setFlagTo=function(t,r){r?this.setFlag(t):this.clearFlag(t)},e.fromDict=function(t){return new e(t)},e})();TL.default=wit});var kL=U(NL=>{"use strict";Object.defineProperty(NL,"__esModule",{value:!0});var Ty=(ct(),ze(ut)),Ao=Ty.__importDefault(zr()),QL=Ty.__importDefault(ki()),H1e=Ty.__importDefault(Oa()),wm=Ty.__importDefault(co()),_L=Ty.__importDefault(Fc()),Fit=(function(){function e(t){this.dict=t}return e.prototype.R=function(){var t=this.dict.lookup(Ao.default.of("R"));if(t instanceof QL.default)return t},e.prototype.BC=function(){var t=this.dict.lookup(Ao.default.of("BC"));if(t instanceof H1e.default)return t},e.prototype.BG=function(){var t=this.dict.lookup(Ao.default.of("BG"));if(t instanceof H1e.default)return t},e.prototype.CA=function(){var t=this.dict.lookup(Ao.default.of("CA"));if(t instanceof wm.default||t instanceof _L.default)return t},e.prototype.RC=function(){var t=this.dict.lookup(Ao.default.of("RC"));if(t instanceof wm.default||t instanceof _L.default)return t},e.prototype.AC=function(){var t=this.dict.lookup(Ao.default.of("AC"));if(t instanceof wm.default||t instanceof _L.default)return t},e.prototype.getRotation=function(){var t;return(t=this.R())===null||t===void 0?void 0:t.asNumber()},e.prototype.getBorderColor=function(){var t=this.BC();if(t){for(var r=[],n=0,i=t?.size();n<i;n++){var s=t.get(n);s instanceof QL.default&&r.push(s.asNumber())}return r}},e.prototype.getBackgroundColor=function(){var t=this.BG();if(t){for(var r=[],n=0,i=t?.size();n<i;n++){var s=t.get(n);s instanceof QL.default&&r.push(s.asNumber())}return r}},e.prototype.getCaptions=function(){var t=this.CA(),r=this.RC(),n=this.AC();return{normal:t?.decodeText(),rollover:r?.decodeText(),down:n?.decodeText()}},e.prototype.setRotation=function(t){var r=this.dict.context.obj(t);this.dict.set(Ao.default.of("R"),r)},e.prototype.setBorderColor=function(t){var r=this.dict.context.obj(t);this.dict.set(Ao.default.of("BC"),r)},e.prototype.setBackgroundColor=function(t){var r=this.dict.context.obj(t);this.dict.set(Ao.default.of("BG"),r)},e.prototype.setCaptions=function(t){var r=wm.default.fromText(t.normal);if(this.dict.set(Ao.default.of("CA"),r),t.rollover){var n=wm.default.fromText(t.rollover);this.dict.set(Ao.default.of("RC"),n)}else this.dict.delete(Ao.default.of("RC"));if(t.down){var i=wm.default.fromText(t.down);this.dict.set(Ao.default.of("AC"),i)}else this.dict.delete(Ao.default.of("AC"))},e.fromDict=function(t){return new e(t)},e})();NL.default=Fit});var LL=U(OL=>{"use strict";Object.defineProperty(OL,"__esModule",{value:!0});var Kf=(ct(),ze(ut)),RL=Kf.__importDefault(ls()),Xf=Kf.__importDefault(zr()),Tit=Kf.__importDefault(Ns()),q1e=Kf.__importDefault(Fc()),W1e=Kf.__importDefault(co()),UL=Kf.__importDefault(L1e()),Sit=Kf.__importDefault(SL()),ML=Kf.__importDefault(kL()),Qit=(function(e){Kf.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.MK=function(){var r=this.dict.lookup(Xf.default.of("MK"));if(r instanceof RL.default)return r},t.prototype.BS=function(){var r=this.dict.lookup(Xf.default.of("BS"));if(r instanceof RL.default)return r},t.prototype.DA=function(){var r=this.dict.lookup(Xf.default.of("DA"));if(r instanceof q1e.default||r instanceof W1e.default)return r},t.prototype.P=function(){var r=this.dict.get(Xf.default.of("P"));if(r instanceof Tit.default)return r},t.prototype.setP=function(r){this.dict.set(Xf.default.of("P"),r)},t.prototype.setDefaultAppearance=function(r){this.dict.set(Xf.default.of("DA"),q1e.default.of(r))},t.prototype.getDefaultAppearance=function(){var r=this.DA();return r instanceof W1e.default?r.decodeText():r?.asString()},t.prototype.getAppearanceCharacteristics=function(){var r=this.MK();if(r)return ML.default.fromDict(r)},t.prototype.getOrCreateAppearanceCharacteristics=function(){var r=this.MK();if(r)return ML.default.fromDict(r);var n=ML.default.fromDict(this.dict.context.obj({}));return this.dict.set(Xf.default.of("MK"),n.dict),n},t.prototype.getBorderStyle=function(){var r=this.BS();if(r)return UL.default.fromDict(r)},t.prototype.getOrCreateBorderStyle=function(){var r=this.BS();if(r)return UL.default.fromDict(r);var n=UL.default.fromDict(this.dict.context.obj({}));return this.dict.set(Xf.default.of("BS"),n.dict),n},t.prototype.getOnValue=function(){var r,n=(r=this.getAppearances())===null||r===void 0?void 0:r.normal;if(n instanceof RL.default)for(var i=n.keys(),s=0,u=i.length;s<u;s++){var f=i[s];if(f!==Xf.default.of("Off"))return f}},t.fromDict=function(r){return new t(r)},t.create=function(r,n){var i=r.obj({Type:"Annot",Subtype:"Widget",Rect:[0,0,0,0],Parent:n});return new t(i)},t})(Sit.default);OL.default=Qit});var Zh=U(HL=>{"use strict";Object.defineProperty(HL,"__esModule",{value:!0});var Sy=(ct(),ze(ut)),_it=Sy.__importDefault(ls()),PL=Sy.__importDefault(zr()),Nit=Sy.__importDefault(MT()),G1e=Sy.__importDefault(LL()),V1e=Nn(),kit=(function(e){Sy.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.FT=function(){var r=this.getInheritableAttribute(PL.default.of("FT"));return this.dict.context.lookup(r,PL.default)},t.prototype.getWidgets=function(){var r=this.Kids();if(!r)return[G1e.default.fromDict(this.dict)];for(var n=new Array(r.size()),i=0,s=r.size();i<s;i++){var u=r.lookup(i,_it.default);n[i]=G1e.default.fromDict(u)}return n},t.prototype.addWidget=function(r){var n=this.normalizedEntries().Kids;n.push(r)},t.prototype.removeWidget=function(r){var n=this.Kids();if(n){if(r<0||r>n.size())throw new V1e.IndexOutOfBoundsError(r,0,n.size());n.remove(r)}else{if(r!==0)throw new V1e.IndexOutOfBoundsError(r,0,0);this.setKids([])}},t.prototype.normalizedEntries=function(){var r=this.Kids();return r||(r=this.dict.context.obj([this.ref]),this.dict.set(PL.default.of("Kids"),r)),{Kids:r}},t.fromDict=function(r,n){return new t(r,n)},t})(Nit.default);HL.default=kit});var _y=U(WL=>{"use strict";Object.defineProperty(WL,"__esModule",{value:!0});var Fm=(ct(),ze(ut)),OT=Fm.__importDefault(Fc()),Qy=Fm.__importDefault(co()),Rit=Fm.__importDefault(Oa()),qL=Fm.__importDefault(zr()),Uit=Fm.__importDefault(Zh()),Y1e=Nn(),Mit=(function(e){Fm.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.Opt=function(){return this.dict.lookupMaybe(qL.default.of("Opt"),OT.default,Qy.default,Rit.default)},t.prototype.setOpt=function(r){this.dict.set(qL.default.of("Opt"),this.dict.context.obj(r))},t.prototype.getExportValues=function(){var r=this.Opt();if(r){if(r instanceof OT.default||r instanceof Qy.default)return[r];for(var n=[],i=0,s=r.size();i<s;i++){var u=r.lookup(i);(u instanceof OT.default||u instanceof Qy.default)&&n.push(u)}return n}},t.prototype.removeExportValue=function(r){var n=this.Opt();if(n)if(n instanceof OT.default||n instanceof Qy.default){if(r!==0)throw new Y1e.IndexOutOfBoundsError(r,0,0);this.setOpt([])}else{if(r<0||r>n.size())throw new Y1e.IndexOutOfBoundsError(r,0,n.size());n.remove(r)}},t.prototype.normalizeExportValues=function(){for(var r,n,i,s,u=(r=this.getExportValues())!==null&&r!==void 0?r:[],f=[],h=this.getWidgets(),g=0,p=h.length;g<p;g++){var C=h[g],y=(n=u[g])!==null&&n!==void 0?n:Qy.default.fromText((s=(i=C.getOnValue())===null||i===void 0?void 0:i.decodeText())!==null&&s!==void 0?s:"");f.push(y)}this.setOpt(f)},t.prototype.addOpt=function(r,n){var i;this.normalizeExportValues();var s=r.decodeText(),u;if(n)for(var f=(i=this.getExportValues())!==null&&i!==void 0?i:[],h=0,g=f.length;h<g;h++){var p=f[h];p.decodeText()===s&&(u=h)}var C=this.Opt();return C.push(r),u??C.size()-1},t.prototype.addWidgetWithOpt=function(r,n,i){var s=this.addOpt(n,i),u=qL.default.of(String(s));return this.addWidget(r),u},t})(Uit.default);WL.default=Mit});var YL=U(VL=>{"use strict";Object.defineProperty(VL,"__esModule",{value:!0});var GL=(ct(),ze(ut)),Tm=GL.__importDefault(zr()),Oit=GL.__importDefault(_y()),Lit=Nn(),Pit=(function(e){GL.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.setValue=function(r){var n,i=(n=this.getOnValue())!==null&&n!==void 0?n:Tm.default.of("Yes");if(r!==i&&r!==Tm.default.of("Off"))throw new Lit.InvalidAcroFieldValueError;this.dict.set(Tm.default.of("V"),r);for(var s=this.getWidgets(),u=0,f=s.length;u<f;u++){var h=s[u],g=h.getOnValue()===r?r:Tm.default.of("Off");h.setAppearanceState(g)}},t.prototype.getValue=function(){var r=this.V();return r instanceof Tm.default?r:Tm.default.of("Off")},t.prototype.getOnValue=function(){var r=this.getWidgets()[0];return r?.getOnValue()},t.fromDict=function(r,n){return new t(r,n)},t.create=function(r){var n=r.obj({FT:"Btn",Kids:[]}),i=r.register(n);return new t(n,i)},t})(Oit.default);VL.default=Pit});var $h=U(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});ho.AcroChoiceFlags=ho.AcroTextFlags=ho.AcroButtonFlags=ho.AcroFieldFlags=void 0;var Ji=function(e){return 1<<e},Hit;(function(e){e[e.ReadOnly=Ji(0)]="ReadOnly",e[e.Required=Ji(1)]="Required",e[e.NoExport=Ji(2)]="NoExport"})(Hit=ho.AcroFieldFlags||(ho.AcroFieldFlags={}));var qit;(function(e){e[e.NoToggleToOff=Ji(14)]="NoToggleToOff",e[e.Radio=Ji(15)]="Radio",e[e.PushButton=Ji(16)]="PushButton",e[e.RadiosInUnison=Ji(25)]="RadiosInUnison"})(qit=ho.AcroButtonFlags||(ho.AcroButtonFlags={}));var Wit;(function(e){e[e.Multiline=Ji(12)]="Multiline",e[e.Password=Ji(13)]="Password",e[e.FileSelect=Ji(20)]="FileSelect",e[e.DoNotSpellCheck=Ji(22)]="DoNotSpellCheck",e[e.DoNotScroll=Ji(23)]="DoNotScroll",e[e.Comb=Ji(24)]="Comb",e[e.RichText=Ji(25)]="RichText"})(Wit=ho.AcroTextFlags||(ho.AcroTextFlags={}));var Git;(function(e){e[e.Combo=Ji(17)]="Combo",e[e.Edit=Ji(18)]="Edit",e[e.Sort=Ji(19)]="Sort",e[e.MultiSelect=Ji(21)]="MultiSelect",e[e.DoNotSpellCheck=Ji(22)]="DoNotSpellCheck",e[e.CommitOnSelChange=Ji(26)]="CommitOnSelChange"})(Git=ho.AcroChoiceFlags||(ho.AcroChoiceFlags={}))});var PT=U(JL=>{"use strict";Object.defineProperty(JL,"__esModule",{value:!0});var Sm=(ct(),ze(ut)),Vit=Sm.__importDefault(Zh()),eg=Sm.__importDefault(co()),tg=Sm.__importDefault(Fc()),LT=Sm.__importDefault(Oa()),rg=Sm.__importDefault(zr()),jL=$h(),j1e=Nn(),Yit=(function(e){Sm.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.setValues=function(r){if(this.hasFlag(jL.AcroChoiceFlags.Combo)&&!this.hasFlag(jL.AcroChoiceFlags.Edit)&&!this.valuesAreValid(r))throw new j1e.InvalidAcroFieldValueError;if(r.length===0&&this.dict.delete(rg.default.of("V")),r.length===1&&this.dict.set(rg.default.of("V"),r[0]),r.length>1){if(!this.hasFlag(jL.AcroChoiceFlags.MultiSelect))throw new j1e.MultiSelectValueError;this.dict.set(rg.default.of("V"),this.dict.context.obj(r))}this.updateSelectedIndices(r)},t.prototype.valuesAreValid=function(r){for(var n=this.getOptions(),i=function(h,g){var p=r[h].decodeText();if(!n.find(function(C){return p===(C.display||C.value).decodeText()}))return{value:!1}},s=0,u=r.length;s<u;s++){var f=i(s,u);if(typeof f=="object")return f.value}return!0},t.prototype.updateSelectedIndices=function(r){if(r.length>1){for(var n=new Array(r.length),i=this.getOptions(),s=function(h,g){var p=r[h].decodeText();n[h]=i.findIndex(function(C){return p===(C.display||C.value).decodeText()})},u=0,f=r.length;u<f;u++)s(u,f);this.dict.set(rg.default.of("I"),this.dict.context.obj(n.sort()))}else this.dict.delete(rg.default.of("I"))},t.prototype.getValues=function(){var r=this.V();if(r instanceof tg.default||r instanceof eg.default)return[r];if(r instanceof LT.default){for(var n=[],i=0,s=r.size();i<s;i++){var u=r.lookup(i);(u instanceof tg.default||u instanceof eg.default)&&n.push(u)}return n}return[]},t.prototype.Opt=function(){return this.dict.lookupMaybe(rg.default.of("Opt"),tg.default,eg.default,LT.default)},t.prototype.setOptions=function(r){for(var n=new Array(r.length),i=0,s=r.length;i<s;i++){var u=r[i],f=u.value,h=u.display;n[i]=this.dict.context.obj([f,h||f])}this.dict.set(rg.default.of("Opt"),this.dict.context.obj(n))},t.prototype.getOptions=function(){var r=this.Opt();if(r instanceof tg.default||r instanceof eg.default)return[{value:r,display:r}];if(r instanceof LT.default){for(var n=[],i=0,s=r.size();i<s;i++){var u=r.lookup(i);if((u instanceof tg.default||u instanceof eg.default)&&n.push({value:u,display:u}),u instanceof LT.default&&u.size()>0){var f=u.lookup(0,tg.default,eg.default),h=u.lookupMaybe(1,tg.default,eg.default);n.push({value:f,display:h||f})}}return n}return[]},t})(Vit.default);JL.default=Yit});var KL=U(XL=>{"use strict";Object.defineProperty(XL,"__esModule",{value:!0});var J1e=(ct(),ze(ut)),jit=J1e.__importDefault(PT()),Jit=$h(),Xit=(function(e){J1e.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.fromDict=function(r,n){return new t(r,n)},t.create=function(r){var n=r.obj({FT:"Ch",Ff:Jit.AcroChoiceFlags.Combo,Kids:[]}),i=r.register(n);return new t(n,i)},t})(jit.default);XL.default=Xit});var HT=U(ZL=>{"use strict";Object.defineProperty(ZL,"__esModule",{value:!0});var zL=(ct(),ze(ut)),Kit=zL.__importDefault(zr()),zit=zL.__importDefault(MT()),Zit=(function(e){zL.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.addField=function(r){var n=this.normalizedEntries().Kids;n?.push(r)},t.prototype.normalizedEntries=function(){var r=this.Kids();return r||(r=this.dict.context.obj([]),this.dict.set(Kit.default.of("Kids"),r)),{Kids:r}},t.fromDict=function(r,n){return new t(r,n)},t.create=function(r){var n=r.obj({}),i=r.register(n);return new t(n,i)},t})(zit.default);ZL.default=Zit});var e7=U($L=>{"use strict";Object.defineProperty($L,"__esModule",{value:!0});var X1e=(ct(),ze(ut)),$it=X1e.__importDefault(Zh()),eat=(function(e){X1e.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.fromDict=function(r,n){return new t(r,n)},t})($it.default);$L.default=eat});var r7=U(t7=>{"use strict";Object.defineProperty(t7,"__esModule",{value:!0});var Qm=(ct(),ze(ut)),qT=Qm.__importDefault(ki()),tat=Qm.__importDefault(Fc()),rat=Qm.__importDefault(co()),ng=Qm.__importDefault(zr()),nat=Qm.__importDefault(Zh()),iat=(function(e){Qm.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.MaxLen=function(){var r=this.dict.lookup(ng.default.of("MaxLen"));if(r instanceof qT.default)return r},t.prototype.Q=function(){var r=this.dict.lookup(ng.default.of("Q"));if(r instanceof qT.default)return r},t.prototype.setMaxLength=function(r){this.dict.set(ng.default.of("MaxLen"),qT.default.of(r))},t.prototype.removeMaxLength=function(){this.dict.delete(ng.default.of("MaxLen"))},t.prototype.getMaxLength=function(){var r;return(r=this.MaxLen())===null||r===void 0?void 0:r.asNumber()},t.prototype.setQuadding=function(r){this.dict.set(ng.default.of("Q"),qT.default.of(r))},t.prototype.getQuadding=function(){var r;return(r=this.Q())===null||r===void 0?void 0:r.asNumber()},t.prototype.setValue=function(r){this.dict.set(ng.default.of("V"),r)},t.prototype.removeValue=function(){this.dict.delete(ng.default.of("V"))},t.prototype.getValue=function(){var r=this.V();if(r instanceof tat.default||r instanceof rat.default)return r},t.fromDict=function(r,n){return new t(r,n)},t.create=function(r){var n=r.obj({FT:"Tx",Kids:[]}),i=r.register(n);return new t(n,i)},t})(nat.default);t7.default=iat});var i7=U(n7=>{"use strict";Object.defineProperty(n7,"__esModule",{value:!0});var K1e=(ct(),ze(ut)),aat=K1e.__importDefault(_y()),sat=$h(),oat=(function(e){K1e.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.fromDict=function(r,n){return new t(r,n)},t.create=function(r){var n=r.obj({FT:"Btn",Ff:sat.AcroButtonFlags.PushButton,Kids:[]}),i=r.register(n);return new t(n,i)},t})(aat.default);n7.default=oat});var o7=U(s7=>{"use strict";Object.defineProperty(s7,"__esModule",{value:!0});var a7=(ct(),ze(ut)),Ny=a7.__importDefault(zr()),uat=a7.__importDefault(_y()),cat=$h(),fat=Nn(),lat=(function(e){a7.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.setValue=function(r){var n=this.getOnValues();if(!n.includes(r)&&r!==Ny.default.of("Off"))throw new fat.InvalidAcroFieldValueError;this.dict.set(Ny.default.of("V"),r);for(var i=this.getWidgets(),s=0,u=i.length;s<u;s++){var f=i[s],h=f.getOnValue()===r?r:Ny.default.of("Off");f.setAppearanceState(h)}},t.prototype.getValue=function(){var r=this.V();return r instanceof Ny.default?r:Ny.default.of("Off")},t.prototype.getOnValues=function(){for(var r=this.getWidgets(),n=[],i=0,s=r.length;i<s;i++){var u=r[i].getOnValue();u&&n.push(u)}return n},t.fromDict=function(r,n){return new t(r,n)},t.create=function(r){var n=r.obj({FT:"Btn",Ff:cat.AcroButtonFlags.Radio,Kids:[]}),i=r.register(n);return new t(n,i)},t})(uat.default);s7.default=lat});var c7=U(u7=>{"use strict";Object.defineProperty(u7,"__esModule",{value:!0});var z1e=(ct(),ze(ut)),Aat=z1e.__importDefault(PT()),dat=(function(e){z1e.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.fromDict=function(r,n){return new t(r,n)},t.create=function(r){var n=r.obj({FT:"Ch",Kids:[]}),i=r.register(n);return new t(n,i)},t})(Aat.default);u7.default=dat});var h7=U(ig=>{"use strict";Object.defineProperty(ig,"__esModule",{value:!0});ig.createPDFAcroField=ig.createPDFAcroFields=void 0;var go=(ct(),ze(ut)),Z1e=go.__importDefault(ki()),A7=go.__importDefault(ls()),Sc=go.__importDefault(zr()),hat=go.__importDefault(Oa()),gat=go.__importDefault(Ns()),pat=go.__importDefault(Zh()),mat=go.__importDefault(HT()),Eat=go.__importDefault(e7()),bat=go.__importDefault(r7()),Cat=go.__importDefault(i7()),yat=go.__importDefault(o7()),xat=go.__importDefault(YL()),vat=go.__importDefault(KL()),Iat=go.__importDefault(c7()),f7=$h();ig.createPDFAcroFields=function(e){if(!e)return[];for(var t=[],r=0,n=e.size();r<n;r++){var i=e.get(r),s=e.lookup(r);i instanceof gat.default&&s instanceof A7.default&&t.push([ig.createPDFAcroField(s,i),i])}return t};ig.createPDFAcroField=function(e,t){var r=Dat(e);return r?mat.default.fromDict(e,t):Bat(e,t)};var Dat=function(e){var t=e.lookup(Sc.default.of("Kids"));if(t instanceof hat.default)for(var r=0,n=t.size();r<n;r++){var i=t.lookup(r),s=i instanceof A7.default&&i.has(Sc.default.of("T"));if(s)return!0}return!1},Bat=function(e,t){var r=d7(e,Sc.default.of("FT")),n=e.context.lookup(r,Sc.default);return n===Sc.default.of("Btn")?wat(e,t):n===Sc.default.of("Ch")?Fat(e,t):n===Sc.default.of("Tx")?bat.default.fromDict(e,t):n===Sc.default.of("Sig")?Eat.default.fromDict(e,t):pat.default.fromDict(e,t)},wat=function(e,t){var r,n=d7(e,Sc.default.of("Ff")),i=e.context.lookupMaybe(n,Z1e.default),s=(r=i?.asNumber())!==null&&r!==void 0?r:0;return l7(s,f7.AcroButtonFlags.PushButton)?Cat.default.fromDict(e,t):l7(s,f7.AcroButtonFlags.Radio)?yat.default.fromDict(e,t):xat.default.fromDict(e,t)},Fat=function(e,t){var r,n=d7(e,Sc.default.of("Ff")),i=e.context.lookupMaybe(n,Z1e.default),s=(r=i?.asNumber())!==null&&r!==void 0?r:0;return l7(s,f7.AcroChoiceFlags.Combo)?vat.default.fromDict(e,t):Iat.default.fromDict(e,t)},l7=function(e,t){return(e&t)!==0},d7=function(e,t){var r;return $1e(e,function(n){r||(r=n.get(t))}),r},$1e=function(e,t){t(e);var r=e.lookupMaybe(Sc.default.of("Parent"),A7.default);r&&$1e(r,t)}});var rpe=U(g7=>{"use strict";Object.defineProperty(g7,"__esModule",{value:!0});var WT=(ct(),ze(ut)),Tat=WT.__importDefault(ls()),Sat=WT.__importDefault(Oa()),epe=WT.__importDefault(zr()),Qat=WT.__importDefault(HT()),tpe=h7(),_at=(function(){function e(t){this.dict=t}return e.prototype.Fields=function(){var t=this.dict.lookup(epe.default.of("Fields"));if(t instanceof Sat.default)return t},e.prototype.getFields=function(){for(var t=this.normalizedEntries().Fields,r=new Array(t.size()),n=0,i=t.size();n<i;n++){var s=t.get(n),u=t.lookup(n,Tat.default);r[n]=[tpe.createPDFAcroField(u,s),s]}return r},e.prototype.getAllFields=function(){var t=[],r=function(n){if(n)for(var i=0,s=n.length;i<s;i++){var u=n[i];t.push(u);var f=u[0];f instanceof Qat.default&&r(tpe.createPDFAcroFields(f.Kids()))}};return r(this.getFields()),t},e.prototype.addField=function(t){var r=this.normalizedEntries().Fields;r?.push(t)},e.prototype.removeField=function(t){var r=t.getParent(),n=r===void 0?this.normalizedEntries().Fields:r.Kids(),i=n?.indexOf(t.ref);if(n===void 0||i===void 0)throw new Error("Tried to remove inexistent field "+t.getFullyQualifiedName());n.remove(i),r!==void 0&&n.size()===0&&this.removeField(r)},e.prototype.normalizedEntries=function(){var t=this.Fields();return t||(t=this.dict.context.obj([]),this.dict.set(epe.default.of("Fields"),t)),{Fields:t}},e.fromDict=function(t){return new e(t)},e.create=function(t){var r=t.obj({Fields:[]});return new e(r)},e})();g7.default=_at});var p7=U(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0});var npe=(ct(),ze(ut)),Nat=_y();Object.defineProperty(La,"PDFAcroButton",{enumerable:!0,get:function(){return Nat.default}});var kat=YL();Object.defineProperty(La,"PDFAcroCheckBox",{enumerable:!0,get:function(){return kat.default}});var Rat=PT();Object.defineProperty(La,"PDFAcroChoice",{enumerable:!0,get:function(){return Rat.default}});var Uat=KL();Object.defineProperty(La,"PDFAcroComboBox",{enumerable:!0,get:function(){return Uat.default}});var Mat=MT();Object.defineProperty(La,"PDFAcroField",{enumerable:!0,get:function(){return Mat.default}});var Oat=rpe();Object.defineProperty(La,"PDFAcroForm",{enumerable:!0,get:function(){return Oat.default}});var Lat=c7();Object.defineProperty(La,"PDFAcroListBox",{enumerable:!0,get:function(){return Lat.default}});var Pat=HT();Object.defineProperty(La,"PDFAcroNonTerminal",{enumerable:!0,get:function(){return Pat.default}});var Hat=i7();Object.defineProperty(La,"PDFAcroPushButton",{enumerable:!0,get:function(){return Hat.default}});var qat=o7();Object.defineProperty(La,"PDFAcroRadioButton",{enumerable:!0,get:function(){return qat.default}});var Wat=e7();Object.defineProperty(La,"PDFAcroSignature",{enumerable:!0,get:function(){return Wat.default}});var Gat=Zh();Object.defineProperty(La,"PDFAcroTerminal",{enumerable:!0,get:function(){return Gat.default}});var Vat=r7();Object.defineProperty(La,"PDFAcroText",{enumerable:!0,get:function(){return Vat.default}});npe.__exportStar($h(),La);npe.__exportStar(h7(),La)});var E7=U(m7=>{"use strict";Object.defineProperty(m7,"__esModule",{value:!0});var VT=(ct(),ze(ut)),GT=VT.__importDefault(ls()),zf=VT.__importDefault(zr()),ipe=p7(),ape=VT.__importDefault(IL()),Yat=(function(e){VT.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.Pages=function(){return this.lookup(zf.default.of("Pages"),GT.default)},t.prototype.AcroForm=function(){return this.lookupMaybe(zf.default.of("AcroForm"),GT.default)},t.prototype.getAcroForm=function(){var r=this.AcroForm();if(r)return ipe.PDFAcroForm.fromDict(r)},t.prototype.getOrCreateAcroForm=function(){var r=this.getAcroForm();if(!r){r=ipe.PDFAcroForm.create(this.context);var n=this.context.register(r.dict);this.set(zf.default.of("AcroForm"),n)}return r},t.prototype.ViewerPreferences=function(){return this.lookupMaybe(zf.default.of("ViewerPreferences"),GT.default)},t.prototype.getViewerPreferences=function(){var r=this.ViewerPreferences();if(r)return ape.default.fromDict(r)},t.prototype.getOrCreateViewerPreferences=function(){var r=this.getViewerPreferences();if(!r){r=ape.default.create(this.context);var n=this.context.register(r.dict);this.set(zf.default.of("ViewerPreferences"),n)}return r},t.prototype.insertLeafNode=function(r,n){var i=this.get(zf.default.of("Pages")),s=this.Pages().insertLeafNode(r,n);return s||i},t.prototype.removeLeafNode=function(r){this.Pages().removeLeafNode(r)},t.withContextAndPages=function(r,n){var i=new Map;return i.set(zf.default.of("Type"),zf.default.of("Catalog")),i.set(zf.default.of("Pages"),n),new t(i,r)},t.fromMapWithContext=function(r,n){return new t(r,n)},t})(GT.default);m7.default=Yat});var x7=U(y7=>{"use strict";Object.defineProperty(y7,"__esModule",{value:!0});var _m=(ct(),ze(ut)),jat=_m.__importDefault(Oa()),Jat=_m.__importDefault(ls()),_0=_m.__importDefault(zr()),b7=_m.__importDefault(ki()),C7=_m.__importDefault(Iy()),YT=Nn(),Xat=(function(e){_m.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.Parent=function(){return this.lookup(_0.default.of("Parent"))},t.prototype.Kids=function(){return this.lookup(_0.default.of("Kids"),jat.default)},t.prototype.Count=function(){return this.lookup(_0.default.of("Count"),b7.default)},t.prototype.pushTreeNode=function(r){var n=this.Kids();n.push(r)},t.prototype.pushLeafNode=function(r){var n=this.Kids();this.insertLeafKid(n.size(),r)},t.prototype.insertLeafNode=function(r,n){var i=this.Kids(),s=this.Count().asNumber();if(n>s)throw new YT.InvalidTargetIndexError(n,s);for(var u=n,f=0,h=i.size();f<h;f++){if(u===0){this.insertLeafKid(f,r);return}var g=i.get(f),p=this.context.lookup(g);if(p instanceof t){if(p.Count().asNumber()>u)return p.insertLeafNode(r,u)||g;u-=p.Count().asNumber()}p instanceof C7.default&&(u-=1)}if(u===0){this.insertLeafKid(i.size(),r);return}throw new YT.CorruptPageTreeError(n,"insertLeafNode")},t.prototype.removeLeafNode=function(r,n){n===void 0&&(n=!0);var i=this.Kids(),s=this.Count().asNumber();if(r>=s)throw new YT.InvalidTargetIndexError(r,s);for(var u=r,f=0,h=i.size();f<h;f++){var g=i.get(f),p=this.context.lookup(g);if(p instanceof t)if(p.Count().asNumber()>u){p.removeLeafNode(u,n),n&&p.Kids().size()===0&&i.remove(f);return}else u-=p.Count().asNumber();if(p instanceof C7.default)if(u===0){this.removeKid(f);return}else u-=1}throw new YT.CorruptPageTreeError(r,"removeLeafNode")},t.prototype.ascend=function(r){r(this);var n=this.Parent();n&&n.ascend(r)},t.prototype.traverse=function(r){for(var n=this.Kids(),i=0,s=n.size();i<s;i++){var u=n.get(i),f=this.context.lookup(u);f instanceof t&&f.traverse(r),r(f,u)}},t.prototype.insertLeafKid=function(r,n){var i=this.Kids();this.ascend(function(s){var u=s.Count().asNumber()+1;s.set(_0.default.of("Count"),b7.default.of(u))}),i.insert(r,n)},t.prototype.removeKid=function(r){var n=this.Kids(),i=n.lookup(r);i instanceof C7.default&&this.ascend(function(s){var u=s.Count().asNumber()-1;s.set(_0.default.of("Count"),b7.default.of(u))}),n.remove(r)},t.withContext=function(r,n){var i=new Map;return i.set(_0.default.of("Type"),_0.default.of("Pages")),i.set(_0.default.of("Kids"),r.obj([])),i.set(_0.default.of("Count"),r.obj(0)),n&&i.set(_0.default.of("Parent"),n),new t(i,r)},t.fromMapWithContext=function(r,n){return new t(r,n)},t})(Jat.default);y7.default=Xat});var jT=U(ii=>{"use strict";Object.defineProperty(ii,"__esModule",{value:!0});ii.IsNumeric=ii.IsNumericPrefix=ii.IsDigit=void 0;var Kat=(ct(),ze(ut)),Ko=Kat.__importDefault(kn());ii.IsDigit=new Uint8Array(256);ii.IsDigit[Ko.default.Zero]=1;ii.IsDigit[Ko.default.One]=1;ii.IsDigit[Ko.default.Two]=1;ii.IsDigit[Ko.default.Three]=1;ii.IsDigit[Ko.default.Four]=1;ii.IsDigit[Ko.default.Five]=1;ii.IsDigit[Ko.default.Six]=1;ii.IsDigit[Ko.default.Seven]=1;ii.IsDigit[Ko.default.Eight]=1;ii.IsDigit[Ko.default.Nine]=1;ii.IsNumericPrefix=new Uint8Array(256);ii.IsNumericPrefix[Ko.default.Period]=1;ii.IsNumericPrefix[Ko.default.Plus]=1;ii.IsNumericPrefix[Ko.default.Minus]=1;ii.IsNumeric=new Uint8Array(256);for(Nm=0,spe=256;Nm<spe;Nm++)ii.IsNumeric[Nm]=ii.IsDigit[Nm]||ii.IsNumericPrefix[Nm]?1:0;var Nm,spe});var fpe=U(D7=>{"use strict";Object.defineProperty(D7,"__esModule",{value:!0});var zat=(ct(),ze(ut)),ope=Nn(),JT=zat.__importDefault(kn()),v7=jT(),Zat=aT(),I7=fr(),upe=JT.default.Newline,cpe=JT.default.CarriageReturn,$at=(function(){function e(t,r){r===void 0&&(r=!1),this.bytes=t,this.capNumbers=r}return e.prototype.parseRawInt=function(){for(var t="";!this.bytes.done();){var r=this.bytes.peek();if(!v7.IsDigit[r])break;t+=I7.charFromCode(this.bytes.next())}var n=Number(t);if(!t||!isFinite(n))throw new ope.NumberParsingError(this.bytes.position(),t);return n},e.prototype.parseRawNumber=function(){for(var t="";!this.bytes.done();){var r=this.bytes.peek();if(!v7.IsNumeric[r]||(t+=I7.charFromCode(this.bytes.next()),r===JT.default.Period))break}for(;!this.bytes.done();){var r=this.bytes.peek();if(!v7.IsDigit[r])break;t+=I7.charFromCode(this.bytes.next())}var n=Number(t);if(!t||!isFinite(n))throw new ope.NumberParsingError(this.bytes.position(),t);if(n>Number.MAX_SAFE_INTEGER)if(this.capNumbers){var i="Parsed number that is too large for some PDF readers: "+t+", using Number.MAX_SAFE_INTEGER instead.";return console.warn(i),Number.MAX_SAFE_INTEGER}else{var i="Parsed number that is too large for some PDF readers: "+t+", not capping.";console.warn(i)}return n},e.prototype.skipWhitespace=function(){for(;!this.bytes.done()&&Zat.IsWhitespace[this.bytes.peek()];)this.bytes.next()},e.prototype.skipLine=function(){for(;!this.bytes.done();){var t=this.bytes.peek();if(t===upe||t===cpe)return;this.bytes.next()}},e.prototype.skipComment=function(){if(this.bytes.peek()!==JT.default.Percent)return!1;for(;!this.bytes.done();){var t=this.bytes.peek();if(t===upe||t===cpe)return!0;this.bytes.next()}return!0},e.prototype.skipWhitespaceAndComments=function(){for(this.skipWhitespace();this.skipComment();)this.skipWhitespace()},e.prototype.matchKeyword=function(t){for(var r=this.bytes.offset(),n=0,i=t.length;n<i;n++)if(this.bytes.done()||this.bytes.next()!==t[n])return this.bytes.moveTo(r),!1;return!0},e})();D7.default=$at});var ky=U(B7=>{"use strict";Object.defineProperty(B7,"__esModule",{value:!0});var est=(ct(),ze(ut)),tst=Nn(),rst=TT(),nst=est.__importDefault(kn()),ist=(function(){function e(t){this.idx=0,this.line=0,this.column=0,this.bytes=t,this.length=this.bytes.length}return e.prototype.moveTo=function(t){this.idx=t},e.prototype.next=function(){var t=this.bytes[this.idx++];return t===nst.default.Newline?(this.line+=1,this.column=0):this.column+=1,t},e.prototype.assertNext=function(t){if(this.peek()!==t)throw new tst.NextByteAssertionError(this.position(),t,this.peek());return this.next()},e.prototype.peek=function(){return this.bytes[this.idx]},e.prototype.peekAhead=function(t){return this.bytes[this.idx+t]},e.prototype.peekAt=function(t){return this.bytes[t]},e.prototype.done=function(){return this.idx>=this.length},e.prototype.offset=function(){return this.idx},e.prototype.slice=function(t,r){return this.bytes.slice(t,r)},e.prototype.position=function(){return{line:this.line,column:this.column,offset:this.idx}},e.of=function(t){return new e(t)},e.fromPDFRawStream=function(t){return e.of(rst.decodePDFRawStream(t).decode())},e})();B7.default=ist});var w7=U(KT=>{"use strict";Object.defineProperty(KT,"__esModule",{value:!0});KT.Keywords=void 0;var FA=(ct(),ze(ut)),Mt=FA.__importDefault(kn()),ast=Mt.default.Space,Ry=Mt.default.CarriageReturn,Uy=Mt.default.Newline,My=[Mt.default.s,Mt.default.t,Mt.default.r,Mt.default.e,Mt.default.a,Mt.default.m],XT=[Mt.default.e,Mt.default.n,Mt.default.d,Mt.default.s,Mt.default.t,Mt.default.r,Mt.default.e,Mt.default.a,Mt.default.m];KT.Keywords={header:[Mt.default.Percent,Mt.default.P,Mt.default.D,Mt.default.F,Mt.default.Dash],eof:[Mt.default.Percent,Mt.default.Percent,Mt.default.E,Mt.default.O,Mt.default.F],obj:[Mt.default.o,Mt.default.b,Mt.default.j],endobj:[Mt.default.e,Mt.default.n,Mt.default.d,Mt.default.o,Mt.default.b,Mt.default.j],xref:[Mt.default.x,Mt.default.r,Mt.default.e,Mt.default.f],trailer:[Mt.default.t,Mt.default.r,Mt.default.a,Mt.default.i,Mt.default.l,Mt.default.e,Mt.default.r],startxref:[Mt.default.s,Mt.default.t,Mt.default.a,Mt.default.r,Mt.default.t,Mt.default.x,Mt.default.r,Mt.default.e,Mt.default.f],true:[Mt.default.t,Mt.default.r,Mt.default.u,Mt.default.e],false:[Mt.default.f,Mt.default.a,Mt.default.l,Mt.default.s,Mt.default.e],null:[Mt.default.n,Mt.default.u,Mt.default.l,Mt.default.l],stream:My,streamEOF1:FA.__spreadArrays(My,[ast,Ry,Uy]),streamEOF2:FA.__spreadArrays(My,[Ry,Uy]),streamEOF3:FA.__spreadArrays(My,[Ry]),streamEOF4:FA.__spreadArrays(My,[Uy]),endstream:XT,EOF1endstream:FA.__spreadArrays([Ry,Uy],XT),EOF2endstream:FA.__spreadArrays([Ry],XT),EOF3endstream:FA.__spreadArrays([Uy],XT)}});var zT=U(S7=>{"use strict";Object.defineProperty(S7,"__esModule",{value:!0});var Pa=(ct(),ze(ut)),F7=Nn(),sst=Pa.__importDefault(Oa()),lpe=Pa.__importDefault(by()),ost=Pa.__importDefault(ls()),ust=Pa.__importDefault(co()),km=Pa.__importDefault(zr()),cst=Pa.__importDefault(yy()),Ape=Pa.__importDefault(ki()),fst=Pa.__importDefault(Em()),lst=Pa.__importDefault(Ns()),Ast=Pa.__importDefault(Fc()),dst=Pa.__importDefault(fpe()),hst=Pa.__importDefault(ky()),gst=Pa.__importDefault(E7()),pst=Pa.__importDefault(Iy()),mst=Pa.__importDefault(x7()),ai=Pa.__importDefault(kn()),Est=bO(),po=w7(),dpe=jT(),bst=aT(),T7=fr(),Cst=(function(e){Pa.__extends(t,e);function t(r,n,i){i===void 0&&(i=!1);var s=e.call(this,r,i)||this;return s.context=n,s}return t.prototype.parseObject=function(){if(this.skipWhitespaceAndComments(),this.matchKeyword(po.Keywords.true))return lpe.default.True;if(this.matchKeyword(po.Keywords.false))return lpe.default.False;if(this.matchKeyword(po.Keywords.null))return cst.default;var r=this.bytes.peek();if(r===ai.default.LessThan&&this.bytes.peekAhead(1)===ai.default.LessThan)return this.parseDictOrStream();if(r===ai.default.LessThan)return this.parseHexString();if(r===ai.default.LeftParen)return this.parseString();if(r===ai.default.ForwardSlash)return this.parseName();if(r===ai.default.LeftSquareBracket)return this.parseArray();if(dpe.IsNumeric[r])return this.parseNumberOrRef();throw new F7.PDFObjectParsingError(this.bytes.position(),r)},t.prototype.parseNumberOrRef=function(){var r=this.parseRawNumber();this.skipWhitespaceAndComments();var n=this.bytes.offset();if(dpe.IsDigit[this.bytes.peek()]){var i=this.parseRawNumber();if(this.skipWhitespaceAndComments(),this.bytes.peek()===ai.default.R)return this.bytes.assertNext(ai.default.R),lst.default.of(r,i)}return this.bytes.moveTo(n),Ape.default.of(r)},t.prototype.parseHexString=function(){var r="";for(this.bytes.assertNext(ai.default.LessThan);!this.bytes.done()&&this.bytes.peek()!==ai.default.GreaterThan;)r+=T7.charFromCode(this.bytes.next());return this.bytes.assertNext(ai.default.GreaterThan),ust.default.of(r)},t.prototype.parseString=function(){for(var r=0,n=!1,i="";!this.bytes.done();){var s=this.bytes.next();if(i+=T7.charFromCode(s),n||(s===ai.default.LeftParen&&(r+=1),s===ai.default.RightParen&&(r-=1)),s===ai.default.BackSlash?n=!n:n&&(n=!1),r===0)return Ast.default.of(i.substring(1,i.length-1))}throw new F7.UnbalancedParenthesisError(this.bytes.position())},t.prototype.parseName=function(){this.bytes.assertNext(ai.default.ForwardSlash);for(var r="";!this.bytes.done();){var n=this.bytes.peek();if(bst.IsWhitespace[n]||Est.IsDelimiter[n])break;r+=T7.charFromCode(n),this.bytes.next()}return km.default.of(r)},t.prototype.parseArray=function(){this.bytes.assertNext(ai.default.LeftSquareBracket),this.skipWhitespaceAndComments();for(var r=sst.default.withContext(this.context);this.bytes.peek()!==ai.default.RightSquareBracket;){var n=this.parseObject();r.push(n),this.skipWhitespaceAndComments()}return this.bytes.assertNext(ai.default.RightSquareBracket),r},t.prototype.parseDict=function(){this.bytes.assertNext(ai.default.LessThan),this.bytes.assertNext(ai.default.LessThan),this.skipWhitespaceAndComments();for(var r=new Map;!this.bytes.done()&&this.bytes.peek()!==ai.default.GreaterThan&&this.bytes.peekAhead(1)!==ai.default.GreaterThan;){var n=this.parseName(),i=this.parseObject();r.set(n,i),this.skipWhitespaceAndComments()}this.skipWhitespaceAndComments(),this.bytes.assertNext(ai.default.GreaterThan),this.bytes.assertNext(ai.default.GreaterThan);var s=r.get(km.default.of("Type"));return s===km.default.of("Catalog")?gst.default.fromMapWithContext(r,this.context):s===km.default.of("Pages")?mst.default.fromMapWithContext(r,this.context):s===km.default.of("Page")?pst.default.fromMapWithContext(r,this.context):ost.default.fromMapWithContext(r,this.context)},t.prototype.parseDictOrStream=function(){var r=this.bytes.position(),n=this.parseDict();if(this.skipWhitespaceAndComments(),!this.matchKeyword(po.Keywords.streamEOF1)&&!this.matchKeyword(po.Keywords.streamEOF2)&&!this.matchKeyword(po.Keywords.streamEOF3)&&!this.matchKeyword(po.Keywords.streamEOF4)&&!this.matchKeyword(po.Keywords.stream))return n;var i=this.bytes.offset(),s,u=n.get(km.default.of("Length"));u instanceof Ape.default?(s=i+u.asNumber(),this.bytes.moveTo(s),this.skipWhitespaceAndComments(),this.matchKeyword(po.Keywords.endstream)||(this.bytes.moveTo(i),s=this.findEndOfStreamFallback(r))):s=this.findEndOfStreamFallback(r);var f=this.bytes.slice(i,s);return fst.default.of(n,f)},t.prototype.findEndOfStreamFallback=function(r){for(var n=1,i=this.bytes.offset();!this.bytes.done()&&(i=this.bytes.offset(),this.matchKeyword(po.Keywords.stream)?n+=1:this.matchKeyword(po.Keywords.EOF1endstream)||this.matchKeyword(po.Keywords.EOF2endstream)||this.matchKeyword(po.Keywords.EOF3endstream)||this.matchKeyword(po.Keywords.endstream)?n-=1:this.bytes.next(),n!==0););if(n!==0)throw new F7.PDFStreamParsingError(r);return i},t.forBytes=function(r,n,i){return new t(hst.default.of(r),n,i)},t.forByteStream=function(r,n,i){return i===void 0&&(i=!1),new t(r,n,i)},t})(dst.default);S7.default=Cst});var _7=U(Q7=>{"use strict";Object.defineProperty(Q7,"__esModule",{value:!0});var TA=(ct(),ze(ut)),yst=Nn(),hpe=TA.__importDefault(zr()),gpe=TA.__importDefault(ki()),xst=TA.__importDefault(Ns()),vst=TA.__importDefault(ky()),Ist=TA.__importDefault(zT()),Dst=fr(),Bst=(function(e){TA.__extends(t,e);function t(r,n){var i=e.call(this,vst.default.fromPDFRawStream(r),r.dict.context)||this,s=r.dict;return i.alreadyParsed=!1,i.shouldWaitForTick=n||(function(){return!1}),i.firstOffset=s.lookup(hpe.default.of("First"),gpe.default).asNumber(),i.objectCount=s.lookup(hpe.default.of("N"),gpe.default).asNumber(),i}return t.prototype.parseIntoContext=function(){return TA.__awaiter(this,void 0,void 0,function(){var r,n,i,s,u,f,h,g;return TA.__generator(this,function(p){switch(p.label){case 0:if(this.alreadyParsed)throw new yst.ReparseError("PDFObjectStreamParser","parseIntoContext");this.alreadyParsed=!0,r=this.parseOffsetsAndObjectNumbers(),n=0,i=r.length,p.label=1;case 1:return n<i?(s=r[n],u=s.objectNumber,f=s.offset,this.bytes.moveTo(this.firstOffset+f),h=this.parseObject(),g=xst.default.of(u,0),this.context.assign(g,h),this.shouldWaitForTick()?[4,Dst.waitForTick()]:[3,3]):[3,4];case 2:p.sent(),p.label=3;case 3:return n++,[3,1];case 4:return[2]}})})},t.prototype.parseOffsetsAndObjectNumbers=function(){for(var r=[],n=0,i=this.objectCount;n<i;n++){this.skipWhitespaceAndComments();var s=this.parseRawInt();this.skipWhitespaceAndComments();var u=this.parseRawInt();r.push({objectNumber:s,offset:u})}return r},t.forStream=function(r,n){return new t(r,n)},t})(Ist.default);Q7.default=Bst});var k7=U(N7=>{"use strict";Object.defineProperty(N7,"__esModule",{value:!0});var Oy=(ct(),ze(ut)),wst=Nn(),ppe=Oy.__importDefault(Oa()),ag=Oy.__importDefault(zr()),ZT=Oy.__importDefault(ki()),Fst=Oy.__importDefault(Ns()),Tst=Oy.__importDefault(ky()),Sst=(function(){function e(t){this.alreadyParsed=!1,this.dict=t.dict,this.bytes=Tst.default.fromPDFRawStream(t),this.context=this.dict.context;var r=this.dict.lookup(ag.default.of("Size"),ZT.default),n=this.dict.lookup(ag.default.of("Index"));if(n instanceof ppe.default){this.subsections=[];for(var i=0,s=n.size();i<s;i+=2){var u=n.lookup(i+0,ZT.default).asNumber(),f=n.lookup(i+1,ZT.default).asNumber();this.subsections.push({firstObjectNumber:u,length:f})}}else this.subsections=[{firstObjectNumber:0,length:r.asNumber()}];var h=this.dict.lookup(ag.default.of("W"),ppe.default);this.byteWidths=[-1,-1,-1];for(var i=0,s=h.size();i<s;i++)this.byteWidths[i]=h.lookup(i,ZT.default).asNumber()}return e.prototype.parseIntoContext=function(){if(this.alreadyParsed)throw new wst.ReparseError("PDFXRefStreamParser","parseIntoContext");this.alreadyParsed=!0,this.context.trailerInfo={Root:this.dict.get(ag.default.of("Root")),Encrypt:this.dict.get(ag.default.of("Encrypt")),Info:this.dict.get(ag.default.of("Info")),ID:this.dict.get(ag.default.of("ID"))};var t=this.parseEntries();return t},e.prototype.parseEntries=function(){for(var t=[],r=this.byteWidths,n=r[0],i=r[1],s=r[2],u=0,f=this.subsections.length;u<f;u++)for(var h=this.subsections[u],g=h.firstObjectNumber,p=h.length,C=0;C<p;C++){for(var y=0,x=0,v=n;x<v;x++)y=y<<8|this.bytes.next();for(var T=0,x=0,v=i;x<v;x++)T=T<<8|this.bytes.next();for(var Q=0,x=0,v=s;x<v;x++)Q=Q<<8|this.bytes.next();n===0&&(y=1);var F=g+C,_={ref:Fst.default.of(F,Q),offset:T,deleted:y===0,inObjectStream:y===2};t.push(_)}return t},e.forStream=function(t){return new e(t)},e})();N7.default=Sst});var bpe=U(R7=>{"use strict";Object.defineProperty(R7,"__esModule",{value:!0});var hi=(ct(),ze(ut)),Qst=hi.__importDefault(lT()),_st=hi.__importDefault(lm()),Nst=hi.__importDefault(Dy()),Ly=Nn(),kst=hi.__importDefault(ls()),Rst=hi.__importDefault(gT()),N0=hi.__importDefault(zr()),mpe=hi.__importDefault(Em()),$T=hi.__importDefault(Ns()),Ust=hi.__importDefault(ky()),Mst=hi.__importDefault(zT()),Ost=hi.__importDefault(_7()),Lst=hi.__importDefault(k7()),Pst=hi.__importDefault(PO()),Rm=hi.__importDefault(kn()),mo=w7(),Epe=jT(),Hst=fr(),qst=(function(e){hi.__extends(t,e);function t(r,n,i,s){n===void 0&&(n=1/0),i===void 0&&(i=!1),s===void 0&&(s=!1);var u=e.call(this,Ust.default.of(r),Pst.default.create(),s)||this;return u.alreadyParsed=!1,u.parsedObjects=0,u.shouldWaitForTick=function(){return u.parsedObjects+=1,u.parsedObjects%u.objectsPerTick===0},u.objectsPerTick=n,u.throwOnInvalidObject=i,u}return t.prototype.parseDocument=function(){return hi.__awaiter(this,void 0,void 0,function(){var r,n;return hi.__generator(this,function(i){switch(i.label){case 0:if(this.alreadyParsed)throw new Ly.ReparseError("PDFParser","parseDocument");this.alreadyParsed=!0,this.context.header=this.parseHeader(),i.label=1;case 1:return this.bytes.done()?[3,3]:[4,this.parseDocumentSection()];case 2:if(i.sent(),n=this.bytes.offset(),n===r)throw new Ly.StalledParserError(this.bytes.position());return r=n,[3,1];case 3:return this.maybeRecoverRoot(),this.context.lookup($T.default.of(0))&&(console.warn("Removing parsed object: 0 0 R"),this.context.delete($T.default.of(0))),[2,this.context]}})})},t.prototype.maybeRecoverRoot=function(){var r=function(p){return p instanceof kst.default&&p.lookup(N0.default.of("Type"))===N0.default.of("Catalog")},n=this.context.lookup(this.context.trailerInfo.Root);if(!r(n))for(var i=this.context.enumerateIndirectObjects(),s=0,u=i.length;s<u;s++){var f=i[s],h=f[0],g=f[1];r(g)&&(this.context.trailerInfo.Root=h)}},t.prototype.parseHeader=function(){for(;!this.bytes.done();){if(this.matchKeyword(mo.Keywords.header)){var r=this.parseRawInt();this.bytes.assertNext(Rm.default.Period);var n=this.parseRawInt(),i=_st.default.forVersion(r,n);return this.skipBinaryHeaderComment(),i}this.bytes.next()}throw new Ly.MissingPDFHeaderError(this.bytes.position())},t.prototype.parseIndirectObjectHeader=function(){this.skipWhitespaceAndComments();var r=this.parseRawInt();this.skipWhitespaceAndComments();var n=this.parseRawInt();if(this.skipWhitespaceAndComments(),!this.matchKeyword(mo.Keywords.obj))throw new Ly.MissingKeywordError(this.bytes.position(),mo.Keywords.obj);return $T.default.of(r,n)},t.prototype.matchIndirectObjectHeader=function(){var r=this.bytes.offset();try{return this.parseIndirectObjectHeader(),!0}catch{return this.bytes.moveTo(r),!1}},t.prototype.parseIndirectObject=function(){return hi.__awaiter(this,void 0,void 0,function(){var r,n;return hi.__generator(this,function(i){switch(i.label){case 0:return r=this.parseIndirectObjectHeader(),this.skipWhitespaceAndComments(),n=this.parseObject(),this.skipWhitespaceAndComments(),this.matchKeyword(mo.Keywords.endobj),n instanceof mpe.default&&n.dict.lookup(N0.default.of("Type"))===N0.default.of("ObjStm")?[4,Ost.default.forStream(n,this.shouldWaitForTick).parseIntoContext()]:[3,2];case 1:return i.sent(),[3,3];case 2:n instanceof mpe.default&&n.dict.lookup(N0.default.of("Type"))===N0.default.of("XRef")?Lst.default.forStream(n).parseIntoContext():this.context.assign(r,n),i.label=3;case 3:return[2,r]}})})},t.prototype.tryToParseInvalidIndirectObject=function(){var r=this.bytes.position(),n="Trying to parse invalid object: "+JSON.stringify(r)+")";if(this.throwOnInvalidObject)throw new Error(n);console.warn(n);var i=this.parseIndirectObjectHeader();console.warn("Invalid object ref: "+i),this.skipWhitespaceAndComments();for(var s=this.bytes.offset(),u=!0;!this.bytes.done()&&(this.matchKeyword(mo.Keywords.endobj)&&(u=!1),!!u);)this.bytes.next();if(u)throw new Ly.PDFInvalidObjectParsingError(r);var f=this.bytes.offset()-mo.Keywords.endobj.length,h=Rst.default.of(this.bytes.slice(s,f));return this.context.assign(i,h),i},t.prototype.parseIndirectObjects=function(){return hi.__awaiter(this,void 0,void 0,function(){var r,n;return hi.__generator(this,function(i){switch(i.label){case 0:this.skipWhitespaceAndComments(),i.label=1;case 1:if(!(!this.bytes.done()&&Epe.IsDigit[this.bytes.peek()]))return[3,8];r=this.bytes.offset(),i.label=2;case 2:return i.trys.push([2,4,,5]),[4,this.parseIndirectObject()];case 3:return i.sent(),[3,5];case 4:return n=i.sent(),this.bytes.moveTo(r),this.tryToParseInvalidIndirectObject(),[3,5];case 5:return this.skipWhitespaceAndComments(),this.skipJibberish(),this.shouldWaitForTick()?[4,Hst.waitForTick()]:[3,7];case 6:i.sent(),i.label=7;case 7:return[3,1];case 8:return[2]}})})},t.prototype.maybeParseCrossRefSection=function(){if(this.skipWhitespaceAndComments(),!!this.matchKeyword(mo.Keywords.xref)){this.skipWhitespaceAndComments();for(var r=-1,n=Qst.default.createEmpty();!this.bytes.done()&&Epe.IsDigit[this.bytes.peek()];){var i=this.parseRawInt();this.skipWhitespaceAndComments();var s=this.parseRawInt();this.skipWhitespaceAndComments();var u=this.bytes.peek();if(u===Rm.default.n||u===Rm.default.f){var f=$T.default.of(r,s);this.bytes.next()===Rm.default.n?n.addEntry(f,i):n.addDeletedEntry(f,i),r+=1}else r=i;this.skipWhitespaceAndComments()}return n}},t.prototype.maybeParseTrailerDict=function(){if(this.skipWhitespaceAndComments(),!!this.matchKeyword(mo.Keywords.trailer)){this.skipWhitespaceAndComments();var r=this.parseDict(),n=this.context;n.trailerInfo={Root:r.get(N0.default.of("Root"))||n.trailerInfo.Root,Encrypt:r.get(N0.default.of("Encrypt"))||n.trailerInfo.Encrypt,Info:r.get(N0.default.of("Info"))||n.trailerInfo.Info,ID:r.get(N0.default.of("ID"))||n.trailerInfo.ID}}},t.prototype.maybeParseTrailer=function(){if(this.skipWhitespaceAndComments(),!!this.matchKeyword(mo.Keywords.startxref)){this.skipWhitespaceAndComments();var r=this.parseRawInt();return this.skipWhitespace(),this.matchKeyword(mo.Keywords.eof),this.skipWhitespaceAndComments(),this.matchKeyword(mo.Keywords.eof),this.skipWhitespaceAndComments(),Nst.default.forLastCrossRefSectionOffset(r)}},t.prototype.parseDocumentSection=function(){return hi.__awaiter(this,void 0,void 0,function(){return hi.__generator(this,function(r){switch(r.label){case 0:return[4,this.parseIndirectObjects()];case 1:return r.sent(),this.maybeParseCrossRefSection(),this.maybeParseTrailerDict(),this.maybeParseTrailer(),this.skipJibberish(),[2]}})})},t.prototype.skipJibberish=function(){for(this.skipWhitespaceAndComments();!this.bytes.done();){var r=this.bytes.offset(),n=this.bytes.peek(),i=n>=Rm.default.Space&&n<=Rm.default.Tilde;if(i&&(this.matchKeyword(mo.Keywords.xref)||this.matchKeyword(mo.Keywords.trailer)||this.matchKeyword(mo.Keywords.startxref)||this.matchIndirectObjectHeader())){this.bytes.moveTo(r);break}this.bytes.next()}},t.prototype.skipBinaryHeaderComment=function(){this.skipWhitespaceAndComments();try{var r=this.bytes.offset();this.parseIndirectObjectHeader(),this.bytes.moveTo(r)}catch{this.bytes.next(),this.skipWhitespaceAndComments()}},t.forBytesWithOptions=function(r,n,i,s){return new t(r,n,i,s)},t})(Mst.default);R7.default=qst});var Cpe=U(Py=>{"use strict";Object.defineProperty(Py,"__esModule",{value:!0});Py.AnnotationFlags=void 0;var k0=function(e){return 1<<e},Wst;(function(e){e[e.Invisible=k0(0)]="Invisible",e[e.Hidden=k0(1)]="Hidden",e[e.Print=k0(2)]="Print",e[e.NoZoom=k0(3)]="NoZoom",e[e.NoRotate=k0(4)]="NoRotate",e[e.NoView=k0(5)]="NoView",e[e.ReadOnly=k0(6)]="ReadOnly",e[e.Locked=k0(7)]="Locked",e[e.ToggleNoView=k0(8)]="ToggleNoView",e[e.LockedContents=k0(9)]="LockedContents"})(Wst=Py.AnnotationFlags||(Py.AnnotationFlags={}))});var ype=U(Um=>{"use strict";Object.defineProperty(Um,"__esModule",{value:!0});var Gst=(ct(),ze(ut)),Vst=SL();Object.defineProperty(Um,"PDFAnnotation",{enumerable:!0,get:function(){return Vst.default}});var Yst=LL();Object.defineProperty(Um,"PDFWidgetAnnotation",{enumerable:!0,get:function(){return Yst.default}});var jst=kL();Object.defineProperty(Um,"AppearanceCharacteristics",{enumerable:!0,get:function(){return jst.default}});Gst.__exportStar(Cpe(),Um)});var Xi=U($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});var U7=(ct(),ze(ut));U7.__exportStar(Nn(),$t);var Jst=kn();Object.defineProperty($t,"CharCodes",{enumerable:!0,get:function(){return Jst.default}});var Xst=PO();Object.defineProperty($t,"PDFContext",{enumerable:!0,get:function(){return Xst.default}});var Kst=Xge();Object.defineProperty($t,"PDFObjectCopier",{enumerable:!0,get:function(){return Kst.default}});var zst=KO();Object.defineProperty($t,"PDFWriter",{enumerable:!0,get:function(){return zst.default}});var Zst=e1e();Object.defineProperty($t,"PDFStreamWriter",{enumerable:!0,get:function(){return Zst.default}});var $st=lm();Object.defineProperty($t,"PDFHeader",{enumerable:!0,get:function(){return $st.default}});var eot=Dy();Object.defineProperty($t,"PDFTrailer",{enumerable:!0,get:function(){return eot.default}});var tot=YO();Object.defineProperty($t,"PDFTrailerDict",{enumerable:!0,get:function(){return tot.default}});var rot=lT();Object.defineProperty($t,"PDFCrossRefSection",{enumerable:!0,get:function(){return rot.default}});var not=n1e();Object.defineProperty($t,"StandardFontEmbedder",{enumerable:!0,get:function(){return not.default}});var iot=sL();Object.defineProperty($t,"CustomFontEmbedder",{enumerable:!0,get:function(){return iot.default}});var aot=c1e();Object.defineProperty($t,"CustomFontSubsetEmbedder",{enumerable:!0,get:function(){return aot.default}});var xpe=fL();Object.defineProperty($t,"FileEmbedder",{enumerable:!0,get:function(){return xpe.default}});Object.defineProperty($t,"AFRelationship",{enumerable:!0,get:function(){return xpe.AFRelationship}});var sot=A1e();Object.defineProperty($t,"JpegEmbedder",{enumerable:!0,get:function(){return sot.default}});var oot=p1e();Object.defineProperty($t,"PngEmbedder",{enumerable:!0,get:function(){return oot.default}});var uot=k1e();Object.defineProperty($t,"PDFPageEmbedder",{enumerable:!0,get:function(){return uot.default}});var Hy=IL();Object.defineProperty($t,"ViewerPreferences",{enumerable:!0,get:function(){return Hy.default}});Object.defineProperty($t,"NonFullScreenPageMode",{enumerable:!0,get:function(){return Hy.NonFullScreenPageMode}});Object.defineProperty($t,"ReadingDirection",{enumerable:!0,get:function(){return Hy.ReadingDirection}});Object.defineProperty($t,"PrintScaling",{enumerable:!0,get:function(){return Hy.PrintScaling}});Object.defineProperty($t,"Duplex",{enumerable:!0,get:function(){return Hy.Duplex}});var cot=_s();Object.defineProperty($t,"PDFObject",{enumerable:!0,get:function(){return cot.default}});var fot=by();Object.defineProperty($t,"PDFBool",{enumerable:!0,get:function(){return fot.default}});var lot=ki();Object.defineProperty($t,"PDFNumber",{enumerable:!0,get:function(){return lot.default}});var Aot=Fc();Object.defineProperty($t,"PDFString",{enumerable:!0,get:function(){return Aot.default}});var dot=co();Object.defineProperty($t,"PDFHexString",{enumerable:!0,get:function(){return dot.default}});var hot=zr();Object.defineProperty($t,"PDFName",{enumerable:!0,get:function(){return hot.default}});var got=yy();Object.defineProperty($t,"PDFNull",{enumerable:!0,get:function(){return got.default}});var pot=Oa();Object.defineProperty($t,"PDFArray",{enumerable:!0,get:function(){return pot.default}});var mot=ls();Object.defineProperty($t,"PDFDict",{enumerable:!0,get:function(){return mot.default}});var Eot=Ns();Object.defineProperty($t,"PDFRef",{enumerable:!0,get:function(){return Eot.default}});var bot=gT();Object.defineProperty($t,"PDFInvalidObject",{enumerable:!0,get:function(){return bot.default}});var Cot=jf();Object.defineProperty($t,"PDFStream",{enumerable:!0,get:function(){return Cot.default}});var yot=Em();Object.defineProperty($t,"PDFRawStream",{enumerable:!0,get:function(){return yot.default}});var xot=E7();Object.defineProperty($t,"PDFCatalog",{enumerable:!0,get:function(){return xot.default}});var vot=cT();Object.defineProperty($t,"PDFContentStream",{enumerable:!0,get:function(){return vot.default}});var Iot=ZO();Object.defineProperty($t,"PDFCrossRefStream",{enumerable:!0,get:function(){return Iot.default}});var Dot=dT();Object.defineProperty($t,"PDFObjectStream",{enumerable:!0,get:function(){return Dot.default}});var Bot=x7();Object.defineProperty($t,"PDFPageTree",{enumerable:!0,get:function(){return Bot.default}});var wot=Iy();Object.defineProperty($t,"PDFPageLeaf",{enumerable:!0,get:function(){return wot.default}});var Fot=vy();Object.defineProperty($t,"PDFFlateStream",{enumerable:!0,get:function(){return Fot.default}});var Tot=SO();Object.defineProperty($t,"PDFOperator",{enumerable:!0,get:function(){return Tot.default}});var Sot=NO();Object.defineProperty($t,"PDFOperatorNames",{enumerable:!0,get:function(){return Sot.default}});var Qot=zT();Object.defineProperty($t,"PDFObjectParser",{enumerable:!0,get:function(){return Qot.default}});var _ot=_7();Object.defineProperty($t,"PDFObjectStreamParser",{enumerable:!0,get:function(){return _ot.default}});var Not=bpe();Object.defineProperty($t,"PDFParser",{enumerable:!0,get:function(){return Not.default}});var kot=k7();Object.defineProperty($t,"PDFXRefStreamParser",{enumerable:!0,get:function(){return kot.default}});var Rot=TT();Object.defineProperty($t,"decodePDFRawStream",{enumerable:!0,get:function(){return Rot.decodePDFRawStream}});U7.__exportStar(ype(),$t);U7.__exportStar(p7(),$t)});var e3=U(SA=>{"use strict";Object.defineProperty(SA,"__esModule",{value:!0});SA.asNumber=SA.asPDFNumber=SA.asPDFName=void 0;var qy=Xi();SA.asPDFName=function(e){return e instanceof qy.PDFName?e:qy.PDFName.of(e)};SA.asPDFNumber=function(e){return e instanceof qy.PDFNumber?e:qy.PDFNumber.of(e)};SA.asNumber=function(e){return e instanceof qy.PDFNumber?e.asNumber():e}});var zo=U(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.rotateRectangle=Ln.adjustDimsForRotation=Ln.reduceRotation=Ln.toDegrees=Ln.toRadians=Ln.radiansToDegrees=Ln.degreesToRadians=Ln.degrees=Ln.radians=Ln.RotationTypes=void 0;var t3=fr(),Wy;(function(e){e.Degrees="degrees",e.Radians="radians"})(Wy=Ln.RotationTypes||(Ln.RotationTypes={}));Ln.radians=function(e){return t3.assertIs(e,"radianAngle",["number"]),{type:Wy.Radians,angle:e}};Ln.degrees=function(e){return t3.assertIs(e,"degreeAngle",["number"]),{type:Wy.Degrees,angle:e}};var vpe=Wy.Radians,Ipe=Wy.Degrees;Ln.degreesToRadians=function(e){return e*Math.PI/180};Ln.radiansToDegrees=function(e){return e*180/Math.PI};Ln.toRadians=function(e){return e.type===vpe?e.angle:e.type===Ipe?Ln.degreesToRadians(e.angle):t3.error("Invalid rotation: "+JSON.stringify(e))};Ln.toDegrees=function(e){return e.type===vpe?Ln.radiansToDegrees(e.angle):e.type===Ipe?e.angle:t3.error("Invalid rotation: "+JSON.stringify(e))};Ln.reduceRotation=function(e){e===void 0&&(e=0);var t=e/90%4;return t===0?0:t===1?90:t===2?180:t===3?270:0};Ln.adjustDimsForRotation=function(e,t){t===void 0&&(t=0);var r=Ln.reduceRotation(t);return r===90||r===270?{width:e.height,height:e.width}:{width:e.width,height:e.height}};Ln.rotateRectangle=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=0);var n=e.x,i=e.y,s=e.width,u=e.height,f=Ln.reduceRotation(r),h=t/2;return f===0?{x:n-h,y:i-h,width:s,height:u}:f===90?{x:n-u+h,y:i-h,width:u,height:s}:f===180?{x:n-s+h,y:i-u+h,width:s,height:u}:f===270?{x:n-h,y:i-s+h,width:u,height:s}:{x:n-h,y:i-h,width:s,height:u}}});var QA=U($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.endMarkedContent=$e.beginMarkedContent=$e.setStrokingCmykColor=$e.setFillingCmykColor=$e.setStrokingRgbColor=$e.setFillingRgbColor=$e.setStrokingGrayscaleColor=$e.setFillingGrayscaleColor=$e.drawObject=$e.rotateAndSkewTextDegreesAndTranslate=$e.rotateAndSkewTextRadiansAndTranslate=$e.setTextMatrix=$e.setTextRenderingMode=$e.TextRenderingMode=$e.setTextRise=$e.setLineHeight=$e.setCharacterSqueeze=$e.setWordSpacing=$e.setCharacterSpacing=$e.setFontAndSize=$e.endText=$e.beginText=$e.showText=$e.moveText=$e.nextLine=$e.endPath=$e.fillAndStroke=$e.fill=$e.stroke=$e.square=$e.rectangle=$e.lineTo=$e.moveTo=$e.closePath=$e.appendQuadraticCurve=$e.appendBezierCurve=$e.setLineWidth=$e.popGraphicsState=$e.pushGraphicsState=$e.setGraphicsState=$e.setLineJoin=$e.LineJoinStyle=$e.setLineCap=$e.LineCapStyle=$e.restoreDashPattern=$e.setDashPattern=$e.skewDegrees=$e.skewRadians=$e.rotateDegrees=$e.rotateRadians=$e.scale=$e.translate=$e.concatTransformationMatrix=$e.clipEvenOdd=$e.clip=void 0;var Ft=e3(),Mm=zo(),Dt=Xi();$e.clip=function(){return Dt.PDFOperator.of(Dt.PDFOperatorNames.ClipNonZero)};$e.clipEvenOdd=function(){return Dt.PDFOperator.of(Dt.PDFOperatorNames.ClipEvenOdd)};var r3=Math.cos,n3=Math.sin,i3=Math.tan;$e.concatTransformationMatrix=function(e,t,r,n,i,s){return Dt.PDFOperator.of(Dt.PDFOperatorNames.ConcatTransformationMatrix,[Ft.asPDFNumber(e),Ft.asPDFNumber(t),Ft.asPDFNumber(r),Ft.asPDFNumber(n),Ft.asPDFNumber(i),Ft.asPDFNumber(s)])};$e.translate=function(e,t){return $e.concatTransformationMatrix(1,0,0,1,e,t)};$e.scale=function(e,t){return $e.concatTransformationMatrix(e,0,0,t,0,0)};$e.rotateRadians=function(e){return $e.concatTransformationMatrix(r3(Ft.asNumber(e)),n3(Ft.asNumber(e)),-n3(Ft.asNumber(e)),r3(Ft.asNumber(e)),0,0)};$e.rotateDegrees=function(e){return $e.rotateRadians(Mm.degreesToRadians(Ft.asNumber(e)))};$e.skewRadians=function(e,t){return $e.concatTransformationMatrix(1,i3(Ft.asNumber(e)),i3(Ft.asNumber(t)),1,0,0)};$e.skewDegrees=function(e,t){return $e.skewRadians(Mm.degreesToRadians(Ft.asNumber(e)),Mm.degreesToRadians(Ft.asNumber(t)))};$e.setDashPattern=function(e,t){return Dt.PDFOperator.of(Dt.PDFOperatorNames.SetLineDashPattern,["["+e.map(Ft.asPDFNumber).join(" ")+"]",Ft.asPDFNumber(t)])};$e.restoreDashPattern=function(){return $e.setDashPattern([],0)};var Uot;(function(e){e[e.Butt=0]="Butt",e[e.Round=1]="Round",e[e.Projecting=2]="Projecting"})(Uot=$e.LineCapStyle||($e.LineCapStyle={}));$e.setLineCap=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.SetLineCapStyle,[Ft.asPDFNumber(e)])};var Mot;(function(e){e[e.Miter=0]="Miter",e[e.Round=1]="Round",e[e.Bevel=2]="Bevel"})(Mot=$e.LineJoinStyle||($e.LineJoinStyle={}));$e.setLineJoin=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.SetLineJoinStyle,[Ft.asPDFNumber(e)])};$e.setGraphicsState=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.SetGraphicsStateParams,[Ft.asPDFName(e)])};$e.pushGraphicsState=function(){return Dt.PDFOperator.of(Dt.PDFOperatorNames.PushGraphicsState)};$e.popGraphicsState=function(){return Dt.PDFOperator.of(Dt.PDFOperatorNames.PopGraphicsState)};$e.setLineWidth=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.SetLineWidth,[Ft.asPDFNumber(e)])};$e.appendBezierCurve=function(e,t,r,n,i,s){return Dt.PDFOperator.of(Dt.PDFOperatorNames.AppendBezierCurve,[Ft.asPDFNumber(e),Ft.asPDFNumber(t),Ft.asPDFNumber(r),Ft.asPDFNumber(n),Ft.asPDFNumber(i),Ft.asPDFNumber(s)])};$e.appendQuadraticCurve=function(e,t,r,n){return Dt.PDFOperator.of(Dt.PDFOperatorNames.CurveToReplicateInitialPoint,[Ft.asPDFNumber(e),Ft.asPDFNumber(t),Ft.asPDFNumber(r),Ft.asPDFNumber(n)])};$e.closePath=function(){return Dt.PDFOperator.of(Dt.PDFOperatorNames.ClosePath)};$e.moveTo=function(e,t){return Dt.PDFOperator.of(Dt.PDFOperatorNames.MoveTo,[Ft.asPDFNumber(e),Ft.asPDFNumber(t)])};$e.lineTo=function(e,t){return Dt.PDFOperator.of(Dt.PDFOperatorNames.LineTo,[Ft.asPDFNumber(e),Ft.asPDFNumber(t)])};$e.rectangle=function(e,t,r,n){return Dt.PDFOperator.of(Dt.PDFOperatorNames.AppendRectangle,[Ft.asPDFNumber(e),Ft.asPDFNumber(t),Ft.asPDFNumber(r),Ft.asPDFNumber(n)])};$e.square=function(e,t,r){return $e.rectangle(e,t,r,r)};$e.stroke=function(){return Dt.PDFOperator.of(Dt.PDFOperatorNames.StrokePath)};$e.fill=function(){return Dt.PDFOperator.of(Dt.PDFOperatorNames.FillNonZero)};$e.fillAndStroke=function(){return Dt.PDFOperator.of(Dt.PDFOperatorNames.FillNonZeroAndStroke)};$e.endPath=function(){return Dt.PDFOperator.of(Dt.PDFOperatorNames.EndPath)};$e.nextLine=function(){return Dt.PDFOperator.of(Dt.PDFOperatorNames.NextLine)};$e.moveText=function(e,t){return Dt.PDFOperator.of(Dt.PDFOperatorNames.MoveText,[Ft.asPDFNumber(e),Ft.asPDFNumber(t)])};$e.showText=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.ShowText,[e])};$e.beginText=function(){return Dt.PDFOperator.of(Dt.PDFOperatorNames.BeginText)};$e.endText=function(){return Dt.PDFOperator.of(Dt.PDFOperatorNames.EndText)};$e.setFontAndSize=function(e,t){return Dt.PDFOperator.of(Dt.PDFOperatorNames.SetFontAndSize,[Ft.asPDFName(e),Ft.asPDFNumber(t)])};$e.setCharacterSpacing=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.SetCharacterSpacing,[Ft.asPDFNumber(e)])};$e.setWordSpacing=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.SetWordSpacing,[Ft.asPDFNumber(e)])};$e.setCharacterSqueeze=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.SetTextHorizontalScaling,[Ft.asPDFNumber(e)])};$e.setLineHeight=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.SetTextLineHeight,[Ft.asPDFNumber(e)])};$e.setTextRise=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.SetTextRise,[Ft.asPDFNumber(e)])};var Oot;(function(e){e[e.Fill=0]="Fill",e[e.Outline=1]="Outline",e[e.FillAndOutline=2]="FillAndOutline",e[e.Invisible=3]="Invisible",e[e.FillAndClip=4]="FillAndClip",e[e.OutlineAndClip=5]="OutlineAndClip",e[e.FillAndOutlineAndClip=6]="FillAndOutlineAndClip",e[e.Clip=7]="Clip"})(Oot=$e.TextRenderingMode||($e.TextRenderingMode={}));$e.setTextRenderingMode=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.SetTextRenderingMode,[Ft.asPDFNumber(e)])};$e.setTextMatrix=function(e,t,r,n,i,s){return Dt.PDFOperator.of(Dt.PDFOperatorNames.SetTextMatrix,[Ft.asPDFNumber(e),Ft.asPDFNumber(t),Ft.asPDFNumber(r),Ft.asPDFNumber(n),Ft.asPDFNumber(i),Ft.asPDFNumber(s)])};$e.rotateAndSkewTextRadiansAndTranslate=function(e,t,r,n,i){return $e.setTextMatrix(r3(Ft.asNumber(e)),n3(Ft.asNumber(e))+i3(Ft.asNumber(t)),-n3(Ft.asNumber(e))+i3(Ft.asNumber(r)),r3(Ft.asNumber(e)),n,i)};$e.rotateAndSkewTextDegreesAndTranslate=function(e,t,r,n,i){return $e.rotateAndSkewTextRadiansAndTranslate(Mm.degreesToRadians(Ft.asNumber(e)),Mm.degreesToRadians(Ft.asNumber(t)),Mm.degreesToRadians(Ft.asNumber(r)),n,i)};$e.drawObject=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.DrawObject,[Ft.asPDFName(e)])};$e.setFillingGrayscaleColor=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.NonStrokingColorGray,[Ft.asPDFNumber(e)])};$e.setStrokingGrayscaleColor=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.StrokingColorGray,[Ft.asPDFNumber(e)])};$e.setFillingRgbColor=function(e,t,r){return Dt.PDFOperator.of(Dt.PDFOperatorNames.NonStrokingColorRgb,[Ft.asPDFNumber(e),Ft.asPDFNumber(t),Ft.asPDFNumber(r)])};$e.setStrokingRgbColor=function(e,t,r){return Dt.PDFOperator.of(Dt.PDFOperatorNames.StrokingColorRgb,[Ft.asPDFNumber(e),Ft.asPDFNumber(t),Ft.asPDFNumber(r)])};$e.setFillingCmykColor=function(e,t,r,n){return Dt.PDFOperator.of(Dt.PDFOperatorNames.NonStrokingColorCmyk,[Ft.asPDFNumber(e),Ft.asPDFNumber(t),Ft.asPDFNumber(r),Ft.asPDFNumber(n)])};$e.setStrokingCmykColor=function(e,t,r,n){return Dt.PDFOperator.of(Dt.PDFOperatorNames.StrokingColorCmyk,[Ft.asPDFNumber(e),Ft.asPDFNumber(t),Ft.asPDFNumber(r),Ft.asPDFNumber(n)])};$e.beginMarkedContent=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.BeginMarkedContent,[Ft.asPDFName(e)])};$e.endMarkedContent=function(){return Dt.PDFOperator.of(Dt.PDFOperatorNames.EndMarkedContent)}});var Gu=U(wi=>{"use strict";Object.defineProperty(wi,"__esModule",{value:!0});wi.colorToComponents=wi.componentsToColor=wi.setStrokingColor=wi.setFillingColor=wi.cmyk=wi.rgb=wi.grayscale=wi.ColorTypes=void 0;var Om=QA(),Qc=fr(),sg;(function(e){e.Grayscale="Grayscale",e.RGB="RGB",e.CMYK="CMYK"})(sg=wi.ColorTypes||(wi.ColorTypes={}));wi.grayscale=function(e){return Qc.assertRange(e,"gray",0,1),{type:sg.Grayscale,gray:e}};wi.rgb=function(e,t,r){return Qc.assertRange(e,"red",0,1),Qc.assertRange(t,"green",0,1),Qc.assertRange(r,"blue",0,1),{type:sg.RGB,red:e,green:t,blue:r}};wi.cmyk=function(e,t,r,n){return Qc.assertRange(e,"cyan",0,1),Qc.assertRange(t,"magenta",0,1),Qc.assertRange(r,"yellow",0,1),Qc.assertRange(n,"key",0,1),{type:sg.CMYK,cyan:e,magenta:t,yellow:r,key:n}};var M7=sg.Grayscale,O7=sg.RGB,L7=sg.CMYK;wi.setFillingColor=function(e){return e.type===M7?Om.setFillingGrayscaleColor(e.gray):e.type===O7?Om.setFillingRgbColor(e.red,e.green,e.blue):e.type===L7?Om.setFillingCmykColor(e.cyan,e.magenta,e.yellow,e.key):Qc.error("Invalid color: "+JSON.stringify(e))};wi.setStrokingColor=function(e){return e.type===M7?Om.setStrokingGrayscaleColor(e.gray):e.type===O7?Om.setStrokingRgbColor(e.red,e.green,e.blue):e.type===L7?Om.setStrokingCmykColor(e.cyan,e.magenta,e.yellow,e.key):Qc.error("Invalid color: "+JSON.stringify(e))};wi.componentsToColor=function(e,t){return t===void 0&&(t=1),e?.length===1?wi.grayscale(e[0]*t):e?.length===3?wi.rgb(e[0]*t,e[1]*t,e[2]*t):e?.length===4?wi.cmyk(e[0]*t,e[1]*t,e[2]*t,e[3]*t):void 0};wi.colorToComponents=function(e){return e.type===M7?[e.gray]:e.type===O7?[e.red,e.green,e.blue]:e.type===L7?[e.cyan,e.magenta,e.yellow,e.key]:Qc.error("Invalid color: "+JSON.stringify(e))}});var Fpe=U(a3=>{"use strict";Object.defineProperty(a3,"__esModule",{value:!0});a3.svgPathToOperators=void 0;var na=QA(),Yt=0,jt=0,Pr=0,Hr=0,Gy=0,Vy=0,Dpe=new Map([["A",7],["a",7],["C",6],["c",6],["H",1],["h",1],["L",2],["l",2],["M",2],["m",2],["Q",4],["q",4],["S",4],["s",4],["T",2],["t",2],["V",1],["v",1],["Z",0],["z",0]]),Lot=function(e){for(var t,r=[],n=[],i="",s=!1,u=0,f=0,h=e;f<h.length;f++){var g=h[f];if(Dpe.has(g))u=Dpe.get(g),t&&(i.length>0&&(n[n.length]=+i),r[r.length]={cmd:t,args:n},n=[],i="",s=!1),t=g;else if([" ",","].includes(g)||g==="-"&&i.length>0&&i[i.length-1]!=="e"||g==="."&&s){if(i.length===0)continue;n.length===u?(r[r.length]={cmd:t,args:n},n=[+i],t==="M"&&(t="L"),t==="m"&&(t="l")):n[n.length]=+i,s=g===".",i=["-","."].includes(g)?g:""}else i+=g,g==="."&&(s=!0)}return i.length>0&&(n.length===u?(r[r.length]={cmd:t,args:n},n=[+i],t==="M"&&(t="L"),t==="m"&&(t="l")):n[n.length]=+i),r[r.length]={cmd:t,args:n},r},Pot=function(e){Yt=jt=Pr=Hr=Gy=Vy=0;for(var t=[],r=0;r<e.length;r++){var n=e[r];if(n.cmd&&typeof Bpe[n.cmd]=="function"){var i=Bpe[n.cmd](n.args);Array.isArray(i)?t=t.concat(i):t.push(i)}}return t},Bpe={M:function(e){return Yt=e[0],jt=e[1],Pr=Hr=null,Gy=Yt,Vy=jt,na.moveTo(Yt,jt)},m:function(e){return Yt+=e[0],jt+=e[1],Pr=Hr=null,Gy=Yt,Vy=jt,na.moveTo(Yt,jt)},C:function(e){return Yt=e[4],jt=e[5],Pr=e[2],Hr=e[3],na.appendBezierCurve(e[0],e[1],e[2],e[3],e[4],e[5])},c:function(e){var t=na.appendBezierCurve(e[0]+Yt,e[1]+jt,e[2]+Yt,e[3]+jt,e[4]+Yt,e[5]+jt);return Pr=Yt+e[2],Hr=jt+e[3],Yt+=e[4],jt+=e[5],t},S:function(e){(Pr===null||Hr===null)&&(Pr=Yt,Hr=jt);var t=na.appendBezierCurve(Yt-(Pr-Yt),jt-(Hr-jt),e[0],e[1],e[2],e[3]);return Pr=e[0],Hr=e[1],Yt=e[2],jt=e[3],t},s:function(e){(Pr===null||Hr===null)&&(Pr=Yt,Hr=jt);var t=na.appendBezierCurve(Yt-(Pr-Yt),jt-(Hr-jt),Yt+e[0],jt+e[1],Yt+e[2],jt+e[3]);return Pr=Yt+e[0],Hr=jt+e[1],Yt+=e[2],jt+=e[3],t},Q:function(e){return Pr=e[0],Hr=e[1],Yt=e[2],jt=e[3],na.appendQuadraticCurve(e[0],e[1],Yt,jt)},q:function(e){var t=na.appendQuadraticCurve(e[0]+Yt,e[1]+jt,e[2]+Yt,e[3]+jt);return Pr=Yt+e[0],Hr=jt+e[1],Yt+=e[2],jt+=e[3],t},T:function(e){Pr===null||Hr===null?(Pr=Yt,Hr=jt):(Pr=Yt-(Pr-Yt),Hr=jt-(Hr-jt));var t=na.appendQuadraticCurve(Pr,Hr,e[0],e[1]);return Pr=Yt-(Pr-Yt),Hr=jt-(Hr-jt),Yt=e[0],jt=e[1],t},t:function(e){Pr===null||Hr===null?(Pr=Yt,Hr=jt):(Pr=Yt-(Pr-Yt),Hr=jt-(Hr-jt));var t=na.appendQuadraticCurve(Pr,Hr,Yt+e[0],jt+e[1]);return Yt+=e[0],jt+=e[1],t},A:function(e){var t=wpe(Yt,jt,e);return Yt=e[5],jt=e[6],t},a:function(e){e[5]+=Yt,e[6]+=jt;var t=wpe(Yt,jt,e);return Yt=e[5],jt=e[6],t},L:function(e){return Yt=e[0],jt=e[1],Pr=Hr=null,na.lineTo(Yt,jt)},l:function(e){return Yt+=e[0],jt+=e[1],Pr=Hr=null,na.lineTo(Yt,jt)},H:function(e){return Yt=e[0],Pr=Hr=null,na.lineTo(Yt,jt)},h:function(e){return Yt+=e[0],Pr=Hr=null,na.lineTo(Yt,jt)},V:function(e){return jt=e[0],Pr=Hr=null,na.lineTo(Yt,jt)},v:function(e){return jt+=e[0],Pr=Hr=null,na.lineTo(Yt,jt)},Z:function(){var e=na.closePath();return Yt=Gy,jt=Vy,e},z:function(){var e=na.closePath();return Yt=Gy,jt=Vy,e}},wpe=function(e,t,r){for(var n=r[0],i=r[1],s=r[2],u=r[3],f=r[4],h=r[5],g=r[6],p=Hot(h,g,n,i,u,f,s,e,t),C=[],y=0,x=p;y<x.length;y++){var v=x[y],T=qot.apply(void 0,v);C.push(na.appendBezierCurve.apply(void 0,T))}return C},Hot=function(e,t,r,n,i,s,u,f,h){var g=u*(Math.PI/180),p=Math.sin(g),C=Math.cos(g);r=Math.abs(r),n=Math.abs(n),Pr=C*(f-e)*.5+p*(h-t)*.5,Hr=C*(h-t)*.5-p*(f-e)*.5;var y=Pr*Pr/(r*r)+Hr*Hr/(n*n);y>1&&(y=Math.sqrt(y),r*=y,n*=y);var x=C/r,v=p/r,T=-p/n,Q=C/n,F=x*f+v*h,_=T*f+Q*h,S=x*e+v*t,N=T*e+Q*t,O=(S-F)*(S-F)+(N-_)*(N-_),H=1/O-.25;H<0&&(H=0);var q=Math.sqrt(H);s===i&&(q=-q);var G=.5*(F+S)-q*(N-_),J=.5*(_+N)+q*(S-F),Ie=Math.atan2(_-J,F-G),fe=Math.atan2(N-J,S-G),z=fe-Ie;z<0&&s===1?z+=2*Math.PI:z>0&&s===0&&(z-=2*Math.PI);for(var ge=Math.ceil(Math.abs(z/(Math.PI*.5+.001))),ne=[],Le=0;Le<ge;Le++){var X=Ie+Le*z/ge,se=Ie+(Le+1)*z/ge;ne[Le]=[G,J,X,se,r,n,p,C]}return ne},qot=function(e,t,r,n,i,s,u,f){var h=f*i,g=-u*s,p=u*i,C=f*s,y=.5*(n-r),x=8/3*Math.sin(y*.5)*Math.sin(y*.5)/Math.sin(y),v=e+Math.cos(r)-x*Math.sin(r),T=t+Math.sin(r)+x*Math.cos(r),Q=e+Math.cos(n),F=t+Math.sin(n),_=Q+x*Math.sin(n),S=F-x*Math.cos(n),N=[h*v+g*T,p*v+C*T,h*_+g*S,p*_+C*S,h*Q+g*F,p*Q+C*F];return N};a3.svgPathToOperators=function(e){return Pot(Lot(e))}});var Lm=U(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.drawOptionList=lr.drawTextField=lr.drawTextLines=lr.drawButton=lr.drawRadioButton=lr.drawCheckBox=lr.rotateInPlace=lr.drawCheckMark=lr.drawSvgPath=lr.drawEllipse=lr.drawEllipsePath=lr.drawRectangle=lr.drawLine=lr.drawPage=lr.drawImage=lr.drawLinesOfText=lr.drawText=void 0;var Zf=(ct(),ze(ut)),_c=Gu(),Ue=QA(),hr=zo(),Wot=Fpe(),An=e3();lr.drawText=function(e,t){return[Ue.pushGraphicsState(),t.graphicsState&&Ue.setGraphicsState(t.graphicsState),Ue.beginText(),_c.setFillingColor(t.color),Ue.setFontAndSize(t.font,t.size),Ue.rotateAndSkewTextRadiansAndTranslate(hr.toRadians(t.rotate),hr.toRadians(t.xSkew),hr.toRadians(t.ySkew),t.x,t.y),Ue.showText(e),Ue.endText(),Ue.popGraphicsState()].filter(Boolean)};lr.drawLinesOfText=function(e,t){for(var r=[Ue.pushGraphicsState(),t.graphicsState&&Ue.setGraphicsState(t.graphicsState),Ue.beginText(),_c.setFillingColor(t.color),Ue.setFontAndSize(t.font,t.size),Ue.setLineHeight(t.lineHeight),Ue.rotateAndSkewTextRadiansAndTranslate(hr.toRadians(t.rotate),hr.toRadians(t.xSkew),hr.toRadians(t.ySkew),t.x,t.y)].filter(Boolean),n=0,i=e.length;n<i;n++)r.push(Ue.showText(e[n]),Ue.nextLine());return r.push(Ue.endText(),Ue.popGraphicsState()),r};lr.drawImage=function(e,t){return[Ue.pushGraphicsState(),t.graphicsState&&Ue.setGraphicsState(t.graphicsState),Ue.translate(t.x,t.y),Ue.rotateRadians(hr.toRadians(t.rotate)),Ue.scale(t.width,t.height),Ue.skewRadians(hr.toRadians(t.xSkew),hr.toRadians(t.ySkew)),Ue.drawObject(e),Ue.popGraphicsState()].filter(Boolean)};lr.drawPage=function(e,t){return[Ue.pushGraphicsState(),t.graphicsState&&Ue.setGraphicsState(t.graphicsState),Ue.translate(t.x,t.y),Ue.rotateRadians(hr.toRadians(t.rotate)),Ue.scale(t.xScale,t.yScale),Ue.skewRadians(hr.toRadians(t.xSkew),hr.toRadians(t.ySkew)),Ue.drawObject(e),Ue.popGraphicsState()].filter(Boolean)};lr.drawLine=function(e){var t,r;return[Ue.pushGraphicsState(),e.graphicsState&&Ue.setGraphicsState(e.graphicsState),e.color&&_c.setStrokingColor(e.color),Ue.setLineWidth(e.thickness),Ue.setDashPattern((t=e.dashArray)!==null&&t!==void 0?t:[],(r=e.dashPhase)!==null&&r!==void 0?r:0),Ue.moveTo(e.start.x,e.start.y),e.lineCap&&Ue.setLineCap(e.lineCap),Ue.moveTo(e.start.x,e.start.y),Ue.lineTo(e.end.x,e.end.y),Ue.stroke(),Ue.popGraphicsState()].filter(Boolean)};lr.drawRectangle=function(e){var t,r;return[Ue.pushGraphicsState(),e.graphicsState&&Ue.setGraphicsState(e.graphicsState),e.color&&_c.setFillingColor(e.color),e.borderColor&&_c.setStrokingColor(e.borderColor),Ue.setLineWidth(e.borderWidth),e.borderLineCap&&Ue.setLineCap(e.borderLineCap),Ue.setDashPattern((t=e.borderDashArray)!==null&&t!==void 0?t:[],(r=e.borderDashPhase)!==null&&r!==void 0?r:0),Ue.translate(e.x,e.y),Ue.rotateRadians(hr.toRadians(e.rotate)),Ue.skewRadians(hr.toRadians(e.xSkew),hr.toRadians(e.ySkew)),Ue.moveTo(0,0),Ue.lineTo(0,e.height),Ue.lineTo(e.width,e.height),Ue.lineTo(e.width,0),Ue.closePath(),e.color&&e.borderWidth?Ue.fillAndStroke():e.color?Ue.fill():e.borderColor?Ue.stroke():Ue.closePath(),Ue.popGraphicsState()].filter(Boolean)};var s3=4*((Math.sqrt(2)-1)/3);lr.drawEllipsePath=function(e){var t=An.asNumber(e.x),r=An.asNumber(e.y),n=An.asNumber(e.xScale),i=An.asNumber(e.yScale);t-=n,r-=i;var s=n*s3,u=i*s3,f=t+n*2,h=r+i*2,g=t+n,p=r+i;return[Ue.pushGraphicsState(),Ue.moveTo(t,p),Ue.appendBezierCurve(t,p-u,g-s,r,g,r),Ue.appendBezierCurve(g+s,r,f,p-u,f,p),Ue.appendBezierCurve(f,p+u,g+s,h,g,h),Ue.appendBezierCurve(g-s,h,t,p+u,t,p),Ue.popGraphicsState()]};var Got=function(e){var t=An.asNumber(e.x),r=An.asNumber(e.y),n=An.asNumber(e.xScale),i=An.asNumber(e.yScale),s=-n,u=-i,f=n*s3,h=i*s3,g=s+n*2,p=u+i*2,C=s+n,y=u+i;return[Ue.translate(t,r),Ue.rotateRadians(hr.toRadians(e.rotate)),Ue.moveTo(s,y),Ue.appendBezierCurve(s,y-h,C-f,u,C,u),Ue.appendBezierCurve(C+f,u,g,y-h,g,y),Ue.appendBezierCurve(g,y+h,C+f,p,C,p),Ue.appendBezierCurve(C-f,p,s,y+h,s,y)]};lr.drawEllipse=function(e){var t,r,n;return Zf.__spreadArrays([Ue.pushGraphicsState(),e.graphicsState&&Ue.setGraphicsState(e.graphicsState),e.color&&_c.setFillingColor(e.color),e.borderColor&&_c.setStrokingColor(e.borderColor),Ue.setLineWidth(e.borderWidth),e.borderLineCap&&Ue.setLineCap(e.borderLineCap),Ue.setDashPattern((t=e.borderDashArray)!==null&&t!==void 0?t:[],(r=e.borderDashPhase)!==null&&r!==void 0?r:0)],e.rotate===void 0?lr.drawEllipsePath({x:e.x,y:e.y,xScale:e.xScale,yScale:e.yScale}):Got({x:e.x,y:e.y,xScale:e.xScale,yScale:e.yScale,rotate:(n=e.rotate)!==null&&n!==void 0?n:hr.degrees(0)}),[e.color&&e.borderWidth?Ue.fillAndStroke():e.color?Ue.fill():e.borderColor?Ue.stroke():Ue.closePath(),Ue.popGraphicsState()]).filter(Boolean)};lr.drawSvgPath=function(e,t){var r,n,i;return Zf.__spreadArrays([Ue.pushGraphicsState(),t.graphicsState&&Ue.setGraphicsState(t.graphicsState),Ue.translate(t.x,t.y),Ue.rotateRadians(hr.toRadians((r=t.rotate)!==null&&r!==void 0?r:hr.degrees(0))),t.scale?Ue.scale(t.scale,-t.scale):Ue.scale(1,-1),t.color&&_c.setFillingColor(t.color),t.borderColor&&_c.setStrokingColor(t.borderColor),t.borderWidth&&Ue.setLineWidth(t.borderWidth),t.borderLineCap&&Ue.setLineCap(t.borderLineCap),Ue.setDashPattern((n=t.borderDashArray)!==null&&n!==void 0?n:[],(i=t.borderDashPhase)!==null&&i!==void 0?i:0)],Wot.svgPathToOperators(e),[t.color&&t.borderWidth?Ue.fillAndStroke():t.color?Ue.fill():t.borderColor?Ue.stroke():Ue.closePath(),Ue.popGraphicsState()]).filter(Boolean)};lr.drawCheckMark=function(e){var t=An.asNumber(e.size),r=-1+.75,n=-1+.51,i=1-.525,s=1-.31,u=-1+.325,f=-((u-r)*(s-r))/(i-n)+n;return[Ue.pushGraphicsState(),e.color&&_c.setStrokingColor(e.color),Ue.setLineWidth(e.thickness),Ue.translate(e.x,e.y),Ue.moveTo(u*t,f*t),Ue.lineTo(r*t,n*t),Ue.lineTo(s*t,i*t),Ue.stroke(),Ue.popGraphicsState()].filter(Boolean)};lr.rotateInPlace=function(e){return e.rotation===0?[Ue.translate(0,0),Ue.rotateDegrees(0)]:e.rotation===90?[Ue.translate(e.width,0),Ue.rotateDegrees(90)]:e.rotation===180?[Ue.translate(e.width,e.height),Ue.rotateDegrees(180)]:e.rotation===270?[Ue.translate(0,e.height),Ue.rotateDegrees(270)]:[]};lr.drawCheckBox=function(e){var t=lr.drawRectangle({x:e.x,y:e.y,width:e.width,height:e.height,borderWidth:e.borderWidth,color:e.color,borderColor:e.borderColor,rotate:hr.degrees(0),xSkew:hr.degrees(0),ySkew:hr.degrees(0)});if(!e.filled)return t;var r=An.asNumber(e.width),n=An.asNumber(e.height),i=Math.min(r,n)/2,s=lr.drawCheckMark({x:r/2,y:n/2,size:i,thickness:e.thickness,color:e.markColor});return Zf.__spreadArrays([Ue.pushGraphicsState()],t,s,[Ue.popGraphicsState()])};lr.drawRadioButton=function(e){var t=An.asNumber(e.width),r=An.asNumber(e.height),n=Math.min(t,r)/2,i=lr.drawEllipse({x:e.x,y:e.y,xScale:n,yScale:n,color:e.color,borderColor:e.borderColor,borderWidth:e.borderWidth});if(!e.filled)return i;var s=lr.drawEllipse({x:e.x,y:e.y,xScale:n*.45,yScale:n*.45,color:e.dotColor,borderColor:void 0,borderWidth:0});return Zf.__spreadArrays([Ue.pushGraphicsState()],i,s,[Ue.popGraphicsState()])};lr.drawButton=function(e){var t=An.asNumber(e.x),r=An.asNumber(e.y),n=An.asNumber(e.width),i=An.asNumber(e.height),s=lr.drawRectangle({x:t,y:r,width:n,height:i,borderWidth:e.borderWidth,color:e.color,borderColor:e.borderColor,rotate:hr.degrees(0),xSkew:hr.degrees(0),ySkew:hr.degrees(0)}),u=lr.drawTextLines(e.textLines,{color:e.textColor,font:e.font,size:e.fontSize,rotate:hr.degrees(0),xSkew:hr.degrees(0),ySkew:hr.degrees(0)});return Zf.__spreadArrays([Ue.pushGraphicsState()],s,u,[Ue.popGraphicsState()])};lr.drawTextLines=function(e,t){for(var r=[Ue.beginText(),_c.setFillingColor(t.color),Ue.setFontAndSize(t.font,t.size)],n=0,i=e.length;n<i;n++){var s=e[n],u=s.encoded,f=s.x,h=s.y;r.push(Ue.rotateAndSkewTextRadiansAndTranslate(hr.toRadians(t.rotate),hr.toRadians(t.xSkew),hr.toRadians(t.ySkew),f,h),Ue.showText(u))}return r.push(Ue.endText()),r};lr.drawTextField=function(e){var t=An.asNumber(e.x),r=An.asNumber(e.y),n=An.asNumber(e.width),i=An.asNumber(e.height),s=An.asNumber(e.borderWidth),u=An.asNumber(e.padding),f=t+s/2+u,h=r+s/2+u,g=n-(s/2+u)*2,p=i-(s/2+u)*2,C=[Ue.moveTo(f,h),Ue.lineTo(f,h+p),Ue.lineTo(f+g,h+p),Ue.lineTo(f+g,h),Ue.closePath(),Ue.clip(),Ue.endPath()],y=lr.drawRectangle({x:t,y:r,width:n,height:i,borderWidth:e.borderWidth,color:e.color,borderColor:e.borderColor,rotate:hr.degrees(0),xSkew:hr.degrees(0),ySkew:hr.degrees(0)}),x=lr.drawTextLines(e.textLines,{color:e.textColor,font:e.font,size:e.fontSize,rotate:hr.degrees(0),xSkew:hr.degrees(0),ySkew:hr.degrees(0)}),v=Zf.__spreadArrays([Ue.beginMarkedContent("Tx"),Ue.pushGraphicsState()],x,[Ue.popGraphicsState(),Ue.endMarkedContent()]);return Zf.__spreadArrays([Ue.pushGraphicsState()],y,C,v,[Ue.popGraphicsState()])};lr.drawOptionList=function(e){for(var t=An.asNumber(e.x),r=An.asNumber(e.y),n=An.asNumber(e.width),i=An.asNumber(e.height),s=An.asNumber(e.lineHeight),u=An.asNumber(e.borderWidth),f=An.asNumber(e.padding),h=t+u/2+f,g=r+u/2+f,p=n-(u/2+f)*2,C=i-(u/2+f)*2,y=[Ue.moveTo(h,g),Ue.lineTo(h,g+C),Ue.lineTo(h+p,g+C),Ue.lineTo(h+p,g),Ue.closePath(),Ue.clip(),Ue.endPath()],x=lr.drawRectangle({x:t,y:r,width:n,height:i,borderWidth:e.borderWidth,color:e.color,borderColor:e.borderColor,rotate:hr.degrees(0),xSkew:hr.degrees(0),ySkew:hr.degrees(0)}),v=[],T=0,Q=e.selectedLines.length;T<Q;T++){var F=e.textLines[e.selectedLines[T]];v.push.apply(v,lr.drawRectangle({x:F.x-f,y:F.y-(s-F.height)/2,width:n-u,height:F.height+(s-F.height)/2,borderWidth:0,color:e.selectedColor,borderColor:void 0,rotate:hr.degrees(0),xSkew:hr.degrees(0),ySkew:hr.degrees(0)}))}var _=lr.drawTextLines(e.textLines,{color:e.textColor,font:e.font,size:e.fontSize,rotate:hr.degrees(0),xSkew:hr.degrees(0),ySkew:hr.degrees(0)}),S=Zf.__spreadArrays([Ue.beginMarkedContent("Tx"),Ue.pushGraphicsState()],_,[Ue.popGraphicsState(),Ue.endMarkedContent()]);return Zf.__spreadArrays([Ue.pushGraphicsState()],x,v,y,S,[Ue.popGraphicsState()])}});var Pm=U(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.InvalidMaxLengthError=dn.ExceededMaxLengthError=dn.CombedTextLayoutError=dn.RichTextFieldReadError=dn.FieldExistsAsNonTerminalError=dn.InvalidFieldNamePartError=dn.FieldAlreadyExistsError=dn.MissingOnValueCheckError=dn.UnexpectedFieldTypeError=dn.NoSuchFieldError=dn.RemovePageFromEmptyDocumentError=dn.ForeignPageError=dn.FontkitNotRegisteredError=dn.EncryptedPDFError=void 0;var Eo=(ct(),ze(ut)),Vot=(function(e){Eo.__extends(t,e);function t(){var r=this,n="Input document to `PDFDocument.load` is encrypted. You can use `PDFDocument.load(..., { ignoreEncryption: true })` if you wish to load the document anyways.";return r=e.call(this,n)||this,r}return t})(Error);dn.EncryptedPDFError=Vot;var Yot=(function(e){Eo.__extends(t,e);function t(){var r=this,n="Input to `PDFDocument.embedFont` was a custom font, but no `fontkit` instance was found. You must register a `fontkit` instance with `PDFDocument.registerFontkit(...)` before embedding custom fonts.";return r=e.call(this,n)||this,r}return t})(Error);dn.FontkitNotRegisteredError=Yot;var jot=(function(e){Eo.__extends(t,e);function t(){var r=this,n="A `page` passed to `PDFDocument.addPage` or `PDFDocument.insertPage` was from a different (foreign) PDF document. If you want to copy pages from one PDFDocument to another, you must use `PDFDocument.copyPages(...)` to copy the pages before adding or inserting them.";return r=e.call(this,n)||this,r}return t})(Error);dn.ForeignPageError=jot;var Jot=(function(e){Eo.__extends(t,e);function t(){var r=this,n="PDFDocument has no pages so `PDFDocument.removePage` cannot be called";return r=e.call(this,n)||this,r}return t})(Error);dn.RemovePageFromEmptyDocumentError=Jot;var Xot=(function(e){Eo.__extends(t,e);function t(r){var n=this,i='PDFDocument has no form field with the name "'+r+'"';return n=e.call(this,i)||this,n}return t})(Error);dn.NoSuchFieldError=Xot;var Kot=(function(e){Eo.__extends(t,e);function t(r,n,i){var s,u,f=this,h=n?.name,g=(u=(s=i?.constructor)===null||s===void 0?void 0:s.name)!==null&&u!==void 0?u:i,p='Expected field "'+r+'" to be of type '+h+", "+("but it is actually of type "+g);return f=e.call(this,p)||this,f}return t})(Error);dn.UnexpectedFieldTypeError=Kot;var zot=(function(e){Eo.__extends(t,e);function t(r){var n=this,i='Failed to select check box due to missing onValue: "'+r+'"';return n=e.call(this,i)||this,n}return t})(Error);dn.MissingOnValueCheckError=zot;var Zot=(function(e){Eo.__extends(t,e);function t(r){var n=this,i='A field already exists with the specified name: "'+r+'"';return n=e.call(this,i)||this,n}return t})(Error);dn.FieldAlreadyExistsError=Zot;var $ot=(function(e){Eo.__extends(t,e);function t(r){var n=this,i='Field name contains invalid component: "'+r+'"';return n=e.call(this,i)||this,n}return t})(Error);dn.InvalidFieldNamePartError=$ot;var eut=(function(e){Eo.__extends(t,e);function t(r){var n=this,i='A non-terminal field already exists with the specified name: "'+r+'"';return n=e.call(this,i)||this,n}return t})(Error);dn.FieldExistsAsNonTerminalError=eut;var tut=(function(e){Eo.__extends(t,e);function t(r){var n=this,i="Reading rich text fields is not supported: Attempted to read rich text field: "+r;return n=e.call(this,i)||this,n}return t})(Error);dn.RichTextFieldReadError=tut;var rut=(function(e){Eo.__extends(t,e);function t(r,n){var i=this,s="Failed to layout combed text as lineLength="+r+" is greater than cellCount="+n;return i=e.call(this,s)||this,i}return t})(Error);dn.CombedTextLayoutError=rut;var nut=(function(e){Eo.__extends(t,e);function t(r,n,i){var s=this,u="Attempted to set text with length="+r+" for TextField with maxLength="+n+" and name="+i;return s=e.call(this,u)||this,s}return t})(Error);dn.ExceededMaxLengthError=nut;var iut=(function(e){Eo.__extends(t,e);function t(r,n,i){var s=this,u="Attempted to set maxLength="+n+", which is less than "+r+", the length of this field's current value (name="+i+")";return s=e.call(this,u)||this,s}return t})(Error);dn.InvalidMaxLengthError=iut});var jy=U(Yy=>{"use strict";Object.defineProperty(Yy,"__esModule",{value:!0});Yy.TextAlignment=void 0;var aut;(function(e){e[e.Left=0]="Left",e[e.Center=1]="Center",e[e.Right=2]="Right"})(aut=Yy.TextAlignment||(Yy.TextAlignment={}))});var P7=U(NA=>{"use strict";Object.defineProperty(NA,"__esModule",{value:!0});NA.layoutSinglelineText=NA.layoutCombedText=NA.layoutMultilineText=void 0;var sut=Pm(),Hm=jy(),_A=fr(),Tpe=4,Spe=500,Qpe=function(e,t,r,n){n===void 0&&(n=!1);for(var i=Tpe;i<Spe;){for(var s=0,u=0,f=e.length;u<f;u++){s+=1;for(var h=e[u],g=h.split(" "),p=r.width,C=0,y=g.length;C<y;C++){var x=C===y-1,v=x?g[C]:g[C]+" ",T=t.widthOfTextAtSize(v,i);p-=T,p<=0&&(s+=1,p=r.width-T)}}if(!n&&s>e.length)return i-1;var Q=t.heightAtSize(i),F=Q+Q*.2,_=F*s;if(_>Math.abs(r.height))return i-1;i+=1}return i},out=function(e,t,r,n){for(var i=r.width/n,s=r.height,u=Tpe,f=_A.charSplit(e);u<Spe;){for(var h=0,g=f.length;h<g;h++){var p=f[h],C=t.widthOfTextAtSize(p,u)>i*.75;if(C)return u-1}var y=t.heightAtSize(u,{descender:!1});if(y>s)return u-1;u+=1}return u},uut=function(e){for(var t=e.length;t>0;t--)if(/\s/.test(e[t]))return t},cut=function(e,t,r,n){for(var i,s=e.length;s>0;){var u=e.substring(0,s),f=r.encodeText(u),h=r.widthOfTextAtSize(u,n);if(h<t){var g=e.substring(s)||void 0;return{line:u,encoded:f,width:h,remainder:g}}s=(i=uut(u))!==null&&i!==void 0?i:0}return{line:e,encoded:r.encodeText(e),width:r.widthOfTextAtSize(e,n),remainder:void 0}};NA.layoutMultilineText=function(e,t){var r=t.alignment,n=t.fontSize,i=t.font,s=t.bounds,u=_A.lineSplit(_A.cleanText(e));(n===void 0||n===0)&&(n=Qpe(u,i,s,!0));for(var f=i.heightAtSize(n),h=f+f*.2,g=[],p=s.x,C=s.y,y=s.x+s.width,x=s.y+s.height,v=s.y+s.height,T=0,Q=u.length;T<Q;T++)for(var F=u[T];F!==void 0;){var _=cut(F,s.width,i,n),S=_.line,N=_.encoded,O=_.width,H=_.remainder,q=r===Hm.TextAlignment.Left?s.x:r===Hm.TextAlignment.Center?s.x+s.width/2-O/2:r===Hm.TextAlignment.Right?s.x+s.width-O:s.x;v-=h,q<p&&(p=q),v<C&&(C=v),q+O>y&&(y=q+O),v+f>x&&(x=v+f),g.push({text:S,encoded:N,width:O,height:f,x:q,y:v}),F=H?.trim()}return{fontSize:n,lineHeight:h,lines:g,bounds:{x:p,y:C,width:y-p,height:x-C}}};NA.layoutCombedText=function(e,t){var r=t.fontSize,n=t.font,i=t.bounds,s=t.cellCount,u=_A.mergeLines(_A.cleanText(e));if(u.length>s)throw new sut.CombedTextLayoutError(u.length,s);(r===void 0||r===0)&&(r=out(u,n,i,s));for(var f=i.width/s,h=n.heightAtSize(r,{descender:!1}),g=i.y+(i.height/2-h/2),p=[],C=i.x,y=i.y,x=i.x+i.width,v=i.y+i.height,T=0,Q=0;T<s;){var F=_A.charAtIndex(u,Q),_=F[0],S=F[1],N=n.encodeText(_),O=n.widthOfTextAtSize(_,r),H=i.x+(f*T+f/2),q=H-O/2;q<C&&(C=q),g<y&&(y=g),q+O>x&&(x=q+O),g+h>v&&(v=g+h),p.push({text:u,encoded:N,width:O,height:h,x:q,y:g}),T+=1,Q+=S}return{fontSize:r,cells:p,bounds:{x:C,y,width:x-C,height:v-y}}};NA.layoutSinglelineText=function(e,t){var r=t.alignment,n=t.fontSize,i=t.font,s=t.bounds,u=_A.mergeLines(_A.cleanText(e));(n===void 0||n===0)&&(n=Qpe([u],i,s));var f=i.encodeText(u),h=i.widthOfTextAtSize(u,n),g=i.heightAtSize(n,{descender:!1}),p=r===Hm.TextAlignment.Left?s.x:r===Hm.TextAlignment.Center?s.x+s.width/2-h/2:r===Hm.TextAlignment.Right?s.x+s.width-h:s.x,C=s.y+(s.height/2-g/2);return{fontSize:n,line:{text:u,encoded:f,width:h,height:g,x:p,y:C},bounds:{x:p,y:C,width:h,height:g}}}});var RA=U(ds=>{"use strict";Object.defineProperty(ds,"__esModule",{value:!0});ds.defaultOptionListAppearanceProvider=ds.defaultDropdownAppearanceProvider=ds.defaultTextFieldAppearanceProvider=ds.defaultButtonAppearanceProvider=ds.defaultRadioGroupAppearanceProvider=ds.defaultCheckBoxAppearanceProvider=ds.normalizeAppearance=void 0;var pr=(ct(),ze(ut)),ia=Lm(),Gn=Gu(),Vu=zo(),og=P7(),o3=jy(),fut=QA(),_pe=fr();ds.normalizeAppearance=function(e){return"normal"in e?e:{normal:e}};var lut=/\/([^\0\t\n\f\r\ ]+)[\0\t\n\f\r\ ]+(\d*\.\d+|\d+)[\0\t\n\f\r\ ]+Tf/,kA=function(e){var t,r,n=(t=e.getDefaultAppearance())!==null&&t!==void 0?t:"",i=(r=_pe.findLastMatch(n,lut).match)!==null&&r!==void 0?r:[],s=Number(i[2]);return isFinite(s)?s:void 0},Aut=/(\d*\.\d+|\d+)[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]+(g|rg|k)/,Yu=function(e){var t,r=(t=e.getDefaultAppearance())!==null&&t!==void 0?t:"",n=_pe.findLastMatch(r,Aut).match,i=n??[],s=i[1],u=i[2],f=i[3],h=i[4],g=i[5];if(g==="g"&&s)return Gn.grayscale(Number(s));if(g==="rg"&&s&&u&&f)return Gn.rgb(Number(s),Number(u),Number(f));if(g==="k"&&s&&u&&f&&h)return Gn.cmyk(Number(s),Number(u),Number(f),Number(h))},ju=function(e,t,r,n){var i;n===void 0&&(n=0);var s=[Gn.setFillingColor(t).toString(),fut.setFontAndSize((i=r?.name)!==null&&i!==void 0?i:"dummy__noop",n).toString()].join(`
|
|
539
539
|
`);e.setDefaultAppearance(s)};ds.defaultCheckBoxAppearanceProvider=function(e,t){var r,n,i,s=Yu(t),u=Yu(e.acroField),f=t.getRectangle(),h=t.getAppearanceCharacteristics(),g=t.getBorderStyle(),p=(r=g?.getWidth())!==null&&r!==void 0?r:0,C=Vu.reduceRotation(h?.getRotation()),y=Vu.adjustDimsForRotation(f,C),x=y.width,v=y.height,T=ia.rotateInPlace(pr.__assign(pr.__assign({},f),{rotation:C})),Q=Gn.rgb(0,0,0),F=(n=Gn.componentsToColor(h?.getBorderColor()))!==null&&n!==void 0?n:Q,_=Gn.componentsToColor(h?.getBackgroundColor()),S=Gn.componentsToColor(h?.getBackgroundColor(),.8),N=(i=s??u)!==null&&i!==void 0?i:Q;ju(s?t:e.acroField,N);var O={x:0+p/2,y:0+p/2,width:x-p,height:v-p,thickness:1.5,borderWidth:p,borderColor:F,markColor:N};return{normal:{on:pr.__spreadArrays(T,ia.drawCheckBox(pr.__assign(pr.__assign({},O),{color:_,filled:!0}))),off:pr.__spreadArrays(T,ia.drawCheckBox(pr.__assign(pr.__assign({},O),{color:_,filled:!1})))},down:{on:pr.__spreadArrays(T,ia.drawCheckBox(pr.__assign(pr.__assign({},O),{color:S,filled:!0}))),off:pr.__spreadArrays(T,ia.drawCheckBox(pr.__assign(pr.__assign({},O),{color:S,filled:!1})))}}};ds.defaultRadioGroupAppearanceProvider=function(e,t){var r,n,i,s=Yu(t),u=Yu(e.acroField),f=t.getRectangle(),h=t.getAppearanceCharacteristics(),g=t.getBorderStyle(),p=(r=g?.getWidth())!==null&&r!==void 0?r:0,C=Vu.reduceRotation(h?.getRotation()),y=Vu.adjustDimsForRotation(f,C),x=y.width,v=y.height,T=ia.rotateInPlace(pr.__assign(pr.__assign({},f),{rotation:C})),Q=Gn.rgb(0,0,0),F=(n=Gn.componentsToColor(h?.getBorderColor()))!==null&&n!==void 0?n:Q,_=Gn.componentsToColor(h?.getBackgroundColor()),S=Gn.componentsToColor(h?.getBackgroundColor(),.8),N=(i=s??u)!==null&&i!==void 0?i:Q;ju(s?t:e.acroField,N);var O={x:x/2,y:v/2,width:x-p,height:v-p,borderWidth:p,borderColor:F,dotColor:N};return{normal:{on:pr.__spreadArrays(T,ia.drawRadioButton(pr.__assign(pr.__assign({},O),{color:_,filled:!0}))),off:pr.__spreadArrays(T,ia.drawRadioButton(pr.__assign(pr.__assign({},O),{color:_,filled:!1})))},down:{on:pr.__spreadArrays(T,ia.drawRadioButton(pr.__assign(pr.__assign({},O),{color:S,filled:!0}))),off:pr.__spreadArrays(T,ia.drawRadioButton(pr.__assign(pr.__assign({},O),{color:S,filled:!1})))}}};ds.defaultButtonAppearanceProvider=function(e,t,r){var n,i,s,u,f,h=Yu(t),g=Yu(e.acroField),p=kA(t),C=kA(e.acroField),y=t.getRectangle(),x=t.getAppearanceCharacteristics(),v=t.getBorderStyle(),T=x?.getCaptions(),Q=(n=T?.normal)!==null&&n!==void 0?n:"",F=(s=(i=T?.down)!==null&&i!==void 0?i:Q)!==null&&s!==void 0?s:"",_=(u=v?.getWidth())!==null&&u!==void 0?u:0,S=Vu.reduceRotation(x?.getRotation()),N=Vu.adjustDimsForRotation(y,S),O=N.width,H=N.height,q=ia.rotateInPlace(pr.__assign(pr.__assign({},y),{rotation:S})),G=Gn.rgb(0,0,0),J=Gn.componentsToColor(x?.getBorderColor()),Ie=Gn.componentsToColor(x?.getBackgroundColor()),fe=Gn.componentsToColor(x?.getBackgroundColor(),.8),z={x:_,y:_,width:O-_*2,height:H-_*2},ge=og.layoutSinglelineText(Q,{alignment:o3.TextAlignment.Center,fontSize:p??C,font:r,bounds:z}),ne=og.layoutSinglelineText(F,{alignment:o3.TextAlignment.Center,fontSize:p??C,font:r,bounds:z}),Le=Math.min(ge.fontSize,ne.fontSize),X=(f=h??g)!==null&&f!==void 0?f:G;ju(h||p!==void 0?t:e.acroField,X,r,Le);var se={x:0+_/2,y:0+_/2,width:O-_,height:H-_,borderWidth:_,borderColor:J,textColor:X,font:r.name,fontSize:Le};return{normal:pr.__spreadArrays(q,ia.drawButton(pr.__assign(pr.__assign({},se),{color:Ie,textLines:[ge.line]}))),down:pr.__spreadArrays(q,ia.drawButton(pr.__assign(pr.__assign({},se),{color:fe,textLines:[ne.line]})))}};ds.defaultTextFieldAppearanceProvider=function(e,t,r){var n,i,s,u,f=Yu(t),h=Yu(e.acroField),g=kA(t),p=kA(e.acroField),C=t.getRectangle(),y=t.getAppearanceCharacteristics(),x=t.getBorderStyle(),v=(n=e.getText())!==null&&n!==void 0?n:"",T=(i=x?.getWidth())!==null&&i!==void 0?i:0,Q=Vu.reduceRotation(y?.getRotation()),F=Vu.adjustDimsForRotation(C,Q),_=F.width,S=F.height,N=ia.rotateInPlace(pr.__assign(pr.__assign({},C),{rotation:Q})),O=Gn.rgb(0,0,0),H=Gn.componentsToColor(y?.getBorderColor()),q=Gn.componentsToColor(y?.getBackgroundColor()),G,J,Ie=e.isCombed()?0:1,fe={x:T+Ie,y:T+Ie,width:_-(T+Ie)*2,height:S-(T+Ie)*2};if(e.isMultiline()){var z=og.layoutMultilineText(v,{alignment:e.getAlignment(),fontSize:g??p,font:r,bounds:fe});G=z.lines,J=z.fontSize}else if(e.isCombed()){var z=og.layoutCombedText(v,{fontSize:g??p,font:r,bounds:fe,cellCount:(s=e.getMaxLength())!==null&&s!==void 0?s:0});G=z.cells,J=z.fontSize}else{var z=og.layoutSinglelineText(v,{alignment:e.getAlignment(),fontSize:g??p,font:r,bounds:fe});G=[z.line],J=z.fontSize}var ge=(u=f??h)!==null&&u!==void 0?u:O;ju(f||g!==void 0?t:e.acroField,ge,r,J);var ne={x:0+T/2,y:0+T/2,width:_-T,height:S-T,borderWidth:T??0,borderColor:H,textColor:ge,font:r.name,fontSize:J,color:q,textLines:G,padding:Ie};return pr.__spreadArrays(N,ia.drawTextField(ne))};ds.defaultDropdownAppearanceProvider=function(e,t,r){var n,i,s,u=Yu(t),f=Yu(e.acroField),h=kA(t),g=kA(e.acroField),p=t.getRectangle(),C=t.getAppearanceCharacteristics(),y=t.getBorderStyle(),x=(n=e.getSelected()[0])!==null&&n!==void 0?n:"",v=(i=y?.getWidth())!==null&&i!==void 0?i:0,T=Vu.reduceRotation(C?.getRotation()),Q=Vu.adjustDimsForRotation(p,T),F=Q.width,_=Q.height,S=ia.rotateInPlace(pr.__assign(pr.__assign({},p),{rotation:T})),N=Gn.rgb(0,0,0),O=Gn.componentsToColor(C?.getBorderColor()),H=Gn.componentsToColor(C?.getBackgroundColor()),q=1,G={x:v+q,y:v+q,width:F-(v+q)*2,height:_-(v+q)*2},J=og.layoutSinglelineText(x,{alignment:o3.TextAlignment.Left,fontSize:h??g,font:r,bounds:G}),Ie=J.line,fe=J.fontSize,z=(s=u??f)!==null&&s!==void 0?s:N;ju(u||h!==void 0?t:e.acroField,z,r,fe);var ge={x:0+v/2,y:0+v/2,width:F-v,height:_-v,borderWidth:v??0,borderColor:O,textColor:z,font:r.name,fontSize:fe,color:H,textLines:[Ie],padding:q};return pr.__spreadArrays(S,ia.drawTextField(ge))};ds.defaultOptionListAppearanceProvider=function(e,t,r){var n,i,s=Yu(t),u=Yu(e.acroField),f=kA(t),h=kA(e.acroField),g=t.getRectangle(),p=t.getAppearanceCharacteristics(),C=t.getBorderStyle(),y=(n=C?.getWidth())!==null&&n!==void 0?n:0,x=Vu.reduceRotation(p?.getRotation()),v=Vu.adjustDimsForRotation(g,x),T=v.width,Q=v.height,F=ia.rotateInPlace(pr.__assign(pr.__assign({},g),{rotation:x})),_=Gn.rgb(0,0,0),S=Gn.componentsToColor(p?.getBorderColor()),N=Gn.componentsToColor(p?.getBackgroundColor()),O=e.getOptions(),H=e.getSelected();e.isSorted()&&O.sort();for(var q="",G=0,J=O.length;G<J;G++)q+=O[G],G<J-1&&(q+=`
|
|
540
540
|
`);for(var Ie=1,fe={x:y+Ie,y:y+Ie,width:T-(y+Ie)*2,height:Q-(y+Ie)*2},z=og.layoutMultilineText(q,{alignment:o3.TextAlignment.Left,fontSize:f??h,font:r,bounds:fe}),ge=z.lines,ne=z.fontSize,Le=z.lineHeight,X=[],G=0,J=ge.length;G<J;G++){var se=ge[G];H.includes(se.text)&&X.push(G)}var j=Gn.rgb(153/255,193/255,218/255),Y=(i=s??u)!==null&&i!==void 0?i:_;return ju(s||f!==void 0?t:e.acroField,Y,r,ne),pr.__spreadArrays(F,ia.drawOptionList({x:0+y/2,y:0+y/2,width:T-y,height:Q-y,borderWidth:y??0,borderColor:S,textColor:Y,font:r.name,fontSize:ne,color:N,textLines:ge,lineHeight:Le,selectedColor:j,selectedLines:X,padding:Ie}))}});var c3=U(q7=>{"use strict";Object.defineProperty(q7,"__esModule",{value:!0});var H7=(ct(),ze(ut)),dut=H7.__importDefault(UA()),Npe=Xi(),u3=fr(),hut=(function(){function e(t,r,n){this.alreadyEmbedded=!1,u3.assertIs(t,"ref",[[Npe.PDFRef,"PDFRef"]]),u3.assertIs(r,"doc",[[dut.default,"PDFDocument"]]),u3.assertIs(n,"embedder",[[Npe.PDFPageEmbedder,"PDFPageEmbedder"]]),this.ref=t,this.doc=r,this.width=n.width,this.height=n.height,this.embedder=n}return e.prototype.scale=function(t){return u3.assertIs(t,"factor",["number"]),{width:this.width*t,height:this.height*t}},e.prototype.size=function(){return this.scale(1)},e.prototype.embed=function(){return H7.__awaiter(this,void 0,void 0,function(){return H7.__generator(this,function(t){switch(t.label){case 0:return this.alreadyEmbedded?[3,2]:[4,this.embedder.embedIntoContext(this.doc.context,this.ref)];case 1:t.sent(),this.alreadyEmbedded=!0,t.label=2;case 2:return[2]}})})},e.of=function(t,r,n){return new e(t,r,n)},e})();q7.default=hut});var el=U(G7=>{"use strict";Object.defineProperty(G7,"__esModule",{value:!0});var W7=(ct(),ze(ut)),gut=W7.__importDefault(UA()),f3=Xi(),$f=fr(),put=(function(){function e(t,r,n){this.modified=!0,$f.assertIs(t,"ref",[[f3.PDFRef,"PDFRef"]]),$f.assertIs(r,"doc",[[gut.default,"PDFDocument"]]),$f.assertIs(n,"embedder",[[f3.CustomFontEmbedder,"CustomFontEmbedder"],[f3.StandardFontEmbedder,"StandardFontEmbedder"]]),this.ref=t,this.doc=r,this.name=n.fontName,this.embedder=n}return e.prototype.encodeText=function(t){return $f.assertIs(t,"text",["string"]),this.modified=!0,this.embedder.encodeText(t)},e.prototype.widthOfTextAtSize=function(t,r){return $f.assertIs(t,"text",["string"]),$f.assertIs(r,"size",["number"]),this.embedder.widthOfTextAtSize(t,r)},e.prototype.heightAtSize=function(t,r){var n;return $f.assertIs(t,"size",["number"]),$f.assertOrUndefined(r?.descender,"options.descender",["boolean"]),this.embedder.heightOfFontAtSize(t,{descender:(n=r?.descender)!==null&&n!==void 0?n:!0})},e.prototype.sizeAtHeight=function(t){return $f.assertIs(t,"height",["number"]),this.embedder.sizeOfFontAtHeight(t)},e.prototype.getCharacterSet=function(){return this.embedder instanceof f3.StandardFontEmbedder?this.embedder.encoding.supportedCodePoints:this.embedder.font.characterSet},e.prototype.embed=function(){return W7.__awaiter(this,void 0,void 0,function(){return W7.__generator(this,function(t){switch(t.label){case 0:return this.modified?[4,this.embedder.embedIntoContext(this.doc.context,this.ref)]:[3,2];case 1:t.sent(),this.modified=!1,t.label=2;case 2:return[2]}})})},e.of=function(t,r,n){return new e(t,r,n)},e})();G7.default=put});var l3=U(j7=>{"use strict";Object.defineProperty(j7,"__esModule",{value:!0});var Y7=(ct(),ze(ut)),mut=Y7.__importDefault(UA()),V7=Xi(),qm=fr(),Eut=(function(){function e(t,r,n){qm.assertIs(t,"ref",[[V7.PDFRef,"PDFRef"]]),qm.assertIs(r,"doc",[[mut.default,"PDFDocument"]]),qm.assertIs(n,"embedder",[[V7.JpegEmbedder,"JpegEmbedder"],[V7.PngEmbedder,"PngEmbedder"]]),this.ref=t,this.doc=r,this.width=n.width,this.height=n.height,this.embedder=n}return e.prototype.scale=function(t){return qm.assertIs(t,"factor",["number"]),{width:this.width*t,height:this.height*t}},e.prototype.scaleToFit=function(t,r){qm.assertIs(t,"width",["number"]),qm.assertIs(r,"height",["number"]);var n=t/this.width,i=r/this.height,s=Math.min(n,i);return this.scale(s)},e.prototype.size=function(){return this.scale(1)},e.prototype.embed=function(){return Y7.__awaiter(this,void 0,void 0,function(){var t,r,n;return Y7.__generator(this,function(i){switch(i.label){case 0:return this.embedder?(this.embedTask||(t=this,r=t.doc,n=t.ref,this.embedTask=this.embedder.embedIntoContext(r.context,n)),[4,this.embedTask]):[2];case 1:return i.sent(),this.embedder=void 0,[2]}})})},e.of=function(t,r,n){return new e(t,r,n)},e})();j7.default=Eut});var A3=U(Jy=>{"use strict";Object.defineProperty(Jy,"__esModule",{value:!0});Jy.ImageAlignment=void 0;var but;(function(e){e[e.Left=0]="Left",e[e.Center=1]="Center",e[e.Right=2]="Right"})(but=Jy.ImageAlignment||(Jy.ImageAlignment={}))});var X7=U(J7=>{"use strict";Object.defineProperty(J7,"__esModule",{value:!0});var Cut=(ct(),ze(ut));Cut.__exportStar(A3(),J7)});var tl=U(Xy=>{"use strict";Object.defineProperty(Xy,"__esModule",{value:!0});Xy.assertFieldAppearanceOptions=void 0;var d3=(ct(),ze(ut)),yut=d3.__importDefault(UA()),K7=Gu(),ug=zo(),va=Xi(),Zo=fr(),kpe=X7(),Rpe=Lm();Xy.assertFieldAppearanceOptions=function(e){Zo.assertOrUndefined(e?.x,"options.x",["number"]),Zo.assertOrUndefined(e?.y,"options.y",["number"]),Zo.assertOrUndefined(e?.width,"options.width",["number"]),Zo.assertOrUndefined(e?.height,"options.height",["number"]),Zo.assertOrUndefined(e?.textColor,"options.textColor",[[Object,"Color"]]),Zo.assertOrUndefined(e?.backgroundColor,"options.backgroundColor",[[Object,"Color"]]),Zo.assertOrUndefined(e?.borderColor,"options.borderColor",[[Object,"Color"]]),Zo.assertOrUndefined(e?.borderWidth,"options.borderWidth",["number"]),Zo.assertOrUndefined(e?.rotate,"options.rotate",[[Object,"Rotation"]])};var xut=(function(){function e(t,r,n){Zo.assertIs(t,"acroField",[[va.PDFAcroTerminal,"PDFAcroTerminal"]]),Zo.assertIs(r,"ref",[[va.PDFRef,"PDFRef"]]),Zo.assertIs(n,"doc",[[yut.default,"PDFDocument"]]),this.acroField=t,this.ref=r,this.doc=n}return e.prototype.getName=function(){var t;return(t=this.acroField.getFullyQualifiedName())!==null&&t!==void 0?t:""},e.prototype.isReadOnly=function(){return this.acroField.hasFlag(va.AcroFieldFlags.ReadOnly)},e.prototype.enableReadOnly=function(){this.acroField.setFlagTo(va.AcroFieldFlags.ReadOnly,!0)},e.prototype.disableReadOnly=function(){this.acroField.setFlagTo(va.AcroFieldFlags.ReadOnly,!1)},e.prototype.isRequired=function(){return this.acroField.hasFlag(va.AcroFieldFlags.Required)},e.prototype.enableRequired=function(){this.acroField.setFlagTo(va.AcroFieldFlags.Required,!0)},e.prototype.disableRequired=function(){this.acroField.setFlagTo(va.AcroFieldFlags.Required,!1)},e.prototype.isExported=function(){return!this.acroField.hasFlag(va.AcroFieldFlags.NoExport)},e.prototype.enableExporting=function(){this.acroField.setFlagTo(va.AcroFieldFlags.NoExport,!1)},e.prototype.disableExporting=function(){this.acroField.setFlagTo(va.AcroFieldFlags.NoExport,!0)},e.prototype.needsAppearancesUpdate=function(){throw new va.MethodNotImplementedError(this.constructor.name,"needsAppearancesUpdate")},e.prototype.defaultUpdateAppearances=function(t){throw new va.MethodNotImplementedError(this.constructor.name,"defaultUpdateAppearances")},e.prototype.markAsDirty=function(){this.doc.getForm().markFieldAsDirty(this.ref)},e.prototype.markAsClean=function(){this.doc.getForm().markFieldAsClean(this.ref)},e.prototype.isDirty=function(){return this.doc.getForm().fieldIsDirty(this.ref)},e.prototype.createWidget=function(t){var r,n=t.textColor,i=t.backgroundColor,s=t.borderColor,u=t.borderWidth,f=ug.toDegrees(t.rotate),h=t.caption,g=t.x,p=t.y,C=t.width+u,y=t.height+u,x=!!t.hidden,v=t.page;Zo.assertMultiple(f,"degreesAngle",90);var T=va.PDFWidgetAnnotation.create(this.doc.context,this.ref),Q=ug.rotateRectangle({x:g,y:p,width:C,height:y},u,f);T.setRectangle(Q),v&&T.setP(v);var F=T.getOrCreateAppearanceCharacteristics();i&&F.setBackgroundColor(K7.colorToComponents(i)),F.setRotation(f),h&&F.setCaptions({normal:h}),s&&F.setBorderColor(K7.colorToComponents(s));var _=T.getOrCreateBorderStyle();if(u!==void 0&&_.setWidth(u),T.setFlagTo(va.AnnotationFlags.Print,!0),T.setFlagTo(va.AnnotationFlags.Hidden,x),T.setFlagTo(va.AnnotationFlags.Invisible,!1),n){var S=(r=this.acroField.getDefaultAppearance())!==null&&r!==void 0?r:"",N=S+`
|
|
541
|
-
`+K7.setFillingColor(n).toString();this.acroField.setDefaultAppearance(N)}return T},e.prototype.updateWidgetAppearanceWithFont=function(t,r,n){var i=n.normal,s=n.rollover,u=n.down;this.updateWidgetAppearances(t,{normal:this.createAppearanceStream(t,i,r),rollover:s&&this.createAppearanceStream(t,s,r),down:u&&this.createAppearanceStream(t,u,r)})},e.prototype.updateOnOffWidgetAppearance=function(t,r,n){var i=n.normal,s=n.rollover,u=n.down;this.updateWidgetAppearances(t,{normal:this.createAppearanceDict(t,i,r),rollover:s&&this.createAppearanceDict(t,s,r),down:u&&this.createAppearanceDict(t,u,r)})},e.prototype.updateWidgetAppearances=function(t,r){var n=r.normal,i=r.rollover,s=r.down;t.setNormalAppearance(n),i?t.setRolloverAppearance(i):t.removeRolloverAppearance(),s?t.setDownAppearance(s):t.removeDownAppearance()},e.prototype.createAppearanceStream=function(t,r,n){var i,s=this.acroField.dict.context,u=t.getRectangle(),f=u.width,h=u.height,g=n&&{Font:(i={},i[n.name]=n.ref,i)},p=s.formXObject(r,{Resources:g,BBox:s.obj([0,0,f,h]),Matrix:s.obj([1,0,0,1,0,0])}),C=s.register(p);return C},e.prototype.createImageAppearanceStream=function(t,r,n){var i,s,u=this.acroField.dict.context,f=t.getRectangle(),h=t.getAppearanceCharacteristics(),g=t.getBorderStyle(),p=(s=g?.getWidth())!==null&&s!==void 0?s:0,C=ug.reduceRotation(h?.getRotation()),y=Rpe.rotateInPlace(d3.__assign(d3.__assign({},f),{rotation:C})),x=ug.adjustDimsForRotation(f,C),v=r.scaleToFit(x.width-p*2,x.height-p*2),T={x:p,y:p,width:v.width,height:v.height,rotate:ug.degrees(0),xSkew:ug.degrees(0),ySkew:ug.degrees(0)};n===kpe.ImageAlignment.Center?(T.x+=(x.width-p*2)/2-v.width/2,T.y+=(x.height-p*2)/2-v.height/2):n===kpe.ImageAlignment.Right&&(T.x=x.width-p-v.width,T.y=x.height-p-v.height);var Q=this.doc.context.addRandomSuffix("Image",10),F=d3.__spreadArrays(y,Rpe.drawImage(Q,T)),_={XObject:(i={},i[Q]=r.ref,i)},S=u.formXObject(F,{Resources:_,BBox:u.obj([0,0,f.width,f.height]),Matrix:u.obj([1,0,0,1,0,0])});return u.register(S)},e.prototype.createAppearanceDict=function(t,r,n){var i=this.acroField.dict.context,s=this.createAppearanceStream(t,r.on),u=this.createAppearanceStream(t,r.off),f=i.obj({});return f.set(n,s),f.set(va.PDFName.of("Off"),u),f},e})();Xy.default=xut});var tP=U(eP=>{"use strict";Object.defineProperty(eP,"__esModule",{value:!0});var $7=(ct(),ze(ut)),vut=$7.__importDefault(rl()),Upe=RA(),z7=Gu(),Iut=zo(),Mpe=$7.__importStar(tl()),cg=Xi(),Z7=fr(),Dut=(function(e){$7.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return Z7.assertIs(r,"acroCheckBox",[[cg.PDFAcroCheckBox,"PDFAcroCheckBox"]]),s.acroField=r,s}return t.prototype.check=function(){var r,n=(r=this.acroField.getOnValue())!==null&&r!==void 0?r:cg.PDFName.of("Yes");this.markAsDirty(),this.acroField.setValue(n)},t.prototype.uncheck=function(){this.markAsDirty(),this.acroField.setValue(cg.PDFName.of("Off"))},t.prototype.isChecked=function(){var r=this.acroField.getOnValue();return!!r&&r===this.acroField.getValue()},t.prototype.addToPage=function(r,n){var i,s,u,f,h,g;Z7.assertIs(r,"page",[[vut.default,"PDFPage"]]),Mpe.assertFieldAppearanceOptions(n),n||(n={}),"textColor"in n||(n.textColor=z7.rgb(0,0,0)),"backgroundColor"in n||(n.backgroundColor=z7.rgb(1,1,1)),"borderColor"in n||(n.borderColor=z7.rgb(0,0,0)),"borderWidth"in n||(n.borderWidth=1);var p=this.createWidget({x:(i=n.x)!==null&&i!==void 0?i:0,y:(s=n.y)!==null&&s!==void 0?s:0,width:(u=n.width)!==null&&u!==void 0?u:50,height:(f=n.height)!==null&&f!==void 0?f:50,textColor:n.textColor,backgroundColor:n.backgroundColor,borderColor:n.borderColor,borderWidth:(h=n.borderWidth)!==null&&h!==void 0?h:0,rotate:(g=n.rotate)!==null&&g!==void 0?g:Iut.degrees(0),hidden:n.hidden,page:r.ref}),C=this.doc.context.register(p.dict);this.acroField.addWidget(C),p.setAppearanceState(cg.PDFName.of("Off")),this.updateWidgetAppearance(p,cg.PDFName.of("Yes")),r.node.addAnnot(C)},t.prototype.needsAppearancesUpdate=function(){for(var r,n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=u.getAppearanceState(),h=(r=u.getAppearances())===null||r===void 0?void 0:r.normal;if(!(h instanceof cg.PDFDict)||f&&!h.has(f))return!0}return!1},t.prototype.defaultUpdateAppearances=function(){this.updateAppearances()},t.prototype.updateAppearances=function(r){var n;Z7.assertOrUndefined(r,"provider",[Function]);for(var i=this.acroField.getWidgets(),s=0,u=i.length;s<u;s++){var f=i[s],h=(n=f.getOnValue())!==null&&n!==void 0?n:cg.PDFName.of("Yes");h&&this.updateWidgetAppearance(f,h,r)}this.markAsClean()},t.prototype.updateWidgetAppearance=function(r,n,i){var s=i??Upe.defaultCheckBoxAppearanceProvider,u=Upe.normalizeAppearance(s(this,r));this.updateOnOffWidgetAppearance(r,n,u)},t.of=function(r,n,i){return new t(r,n,i)},t})(Mpe.default);eP.default=Dut});var iP=U(nP=>{"use strict";Object.defineProperty(nP,"__esModule",{value:!0});var h3=(ct(),ze(ut)),But=h3.__importDefault(rl()),Ope=h3.__importDefault(el()),Lpe=h3.__importStar(tl()),Ppe=RA(),rP=Gu(),wut=zo(),Ki=Xi(),R0=fr(),Fut=(function(e){h3.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return R0.assertIs(r,"acroComboBox",[[Ki.PDFAcroComboBox,"PDFAcroComboBox"]]),s.acroField=r,s}return t.prototype.getOptions=function(){for(var r=this.acroField.getOptions(),n=new Array(r.length),i=0,s=n.length;i<s;i++){var u=r[i],f=u.display,h=u.value;n[i]=(f??h).decodeText()}return n},t.prototype.getSelected=function(){for(var r=this.acroField.getValues(),n=new Array(r.length),i=0,s=r.length;i<s;i++)n[i]=r[i].decodeText();return n},t.prototype.setOptions=function(r){R0.assertIs(r,"options",[Array]);for(var n=new Array(r.length),i=0,s=r.length;i<s;i++)n[i]={value:Ki.PDFHexString.fromText(r[i])};this.acroField.setOptions(n)},t.prototype.addOptions=function(r){R0.assertIs(r,"options",["string",Array]);for(var n=Array.isArray(r)?r:[r],i=this.acroField.getOptions(),s=new Array(n.length),u=0,f=n.length;u<f;u++)s[u]={value:Ki.PDFHexString.fromText(n[u])};this.acroField.setOptions(i.concat(s))},t.prototype.select=function(r,n){n===void 0&&(n=!1),R0.assertIs(r,"options",["string",Array]),R0.assertIs(n,"merge",["boolean"]);var i=Array.isArray(r)?r:[r],s=this.getOptions(),u=i.find(function(C){return!s.includes(C)});u&&this.enableEditing(),this.markAsDirty(),(i.length>1||i.length===1&&n)&&this.enableMultiselect();for(var f=new Array(i.length),h=0,g=i.length;h<g;h++)f[h]=Ki.PDFHexString.fromText(i[h]);if(n){var p=this.acroField.getValues();this.acroField.setValues(p.concat(f))}else this.acroField.setValues(f)},t.prototype.clear=function(){this.markAsDirty(),this.acroField.setValues([])},t.prototype.setFontSize=function(r){R0.assertPositive(r,"fontSize"),this.acroField.setFontSize(r),this.markAsDirty()},t.prototype.isEditable=function(){return this.acroField.hasFlag(Ki.AcroChoiceFlags.Edit)},t.prototype.enableEditing=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.Edit,!0)},t.prototype.disableEditing=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.Edit,!1)},t.prototype.isSorted=function(){return this.acroField.hasFlag(Ki.AcroChoiceFlags.Sort)},t.prototype.enableSorting=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.Sort,!0)},t.prototype.disableSorting=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.Sort,!1)},t.prototype.isMultiselect=function(){return this.acroField.hasFlag(Ki.AcroChoiceFlags.MultiSelect)},t.prototype.enableMultiselect=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.MultiSelect,!0)},t.prototype.disableMultiselect=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.MultiSelect,!1)},t.prototype.isSpellChecked=function(){return!this.acroField.hasFlag(Ki.AcroChoiceFlags.DoNotSpellCheck)},t.prototype.enableSpellChecking=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.DoNotSpellCheck,!1)},t.prototype.disableSpellChecking=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.DoNotSpellCheck,!0)},t.prototype.isSelectOnClick=function(){return this.acroField.hasFlag(Ki.AcroChoiceFlags.CommitOnSelChange)},t.prototype.enableSelectOnClick=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.CommitOnSelChange,!0)},t.prototype.disableSelectOnClick=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.CommitOnSelChange,!1)},t.prototype.addToPage=function(r,n){var i,s,u,f,h,g,p;R0.assertIs(r,"page",[[But.default,"PDFPage"]]),Lpe.assertFieldAppearanceOptions(n),n||(n={}),"textColor"in n||(n.textColor=rP.rgb(0,0,0)),"backgroundColor"in n||(n.backgroundColor=rP.rgb(1,1,1)),"borderColor"in n||(n.borderColor=rP.rgb(0,0,0)),"borderWidth"in n||(n.borderWidth=1);var C=this.createWidget({x:(i=n.x)!==null&&i!==void 0?i:0,y:(s=n.y)!==null&&s!==void 0?s:0,width:(u=n.width)!==null&&u!==void 0?u:200,height:(f=n.height)!==null&&f!==void 0?f:50,textColor:n.textColor,backgroundColor:n.backgroundColor,borderColor:n.borderColor,borderWidth:(h=n.borderWidth)!==null&&h!==void 0?h:0,rotate:(g=n.rotate)!==null&&g!==void 0?g:wut.degrees(0),hidden:n.hidden,page:r.ref}),y=this.doc.context.register(C.dict);this.acroField.addWidget(y);var x=(p=n.font)!==null&&p!==void 0?p:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(C,x),r.node.addAnnot(y)},t.prototype.needsAppearancesUpdate=function(){var r;if(this.isDirty())return!0;for(var n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=((r=u.getAppearances())===null||r===void 0?void 0:r.normal)instanceof Ki.PDFStream;if(!f)return!0}return!1},t.prototype.defaultUpdateAppearances=function(r){R0.assertIs(r,"font",[[Ope.default,"PDFFont"]]),this.updateAppearances(r)},t.prototype.updateAppearances=function(r,n){R0.assertIs(r,"font",[[Ope.default,"PDFFont"]]),R0.assertOrUndefined(n,"provider",[Function]);for(var i=this.acroField.getWidgets(),s=0,u=i.length;s<u;s++){var f=i[s];this.updateWidgetAppearance(f,r,n)}this.markAsClean()},t.prototype.updateWidgetAppearance=function(r,n,i){var s=i??Ppe.defaultDropdownAppearanceProvider,u=Ppe.normalizeAppearance(s(this,r,n));this.updateWidgetAppearanceWithFont(r,n,u)},t.of=function(r,n,i){return new t(r,n,i)},t})(Lpe.default);nP.default=Fut});var oP=U(sP=>{"use strict";Object.defineProperty(sP,"__esModule",{value:!0});var g3=(ct(),ze(ut)),Tut=g3.__importDefault(rl()),Hpe=g3.__importDefault(el()),qpe=g3.__importStar(tl()),Wpe=RA(),aP=Gu(),Sut=zo(),bo=Xi(),Nc=fr(),Qut=(function(e){g3.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return Nc.assertIs(r,"acroListBox",[[bo.PDFAcroListBox,"PDFAcroListBox"]]),s.acroField=r,s}return t.prototype.getOptions=function(){for(var r=this.acroField.getOptions(),n=new Array(r.length),i=0,s=n.length;i<s;i++){var u=r[i],f=u.display,h=u.value;n[i]=(f??h).decodeText()}return n},t.prototype.getSelected=function(){for(var r=this.acroField.getValues(),n=new Array(r.length),i=0,s=r.length;i<s;i++)n[i]=r[i].decodeText();return n},t.prototype.setOptions=function(r){Nc.assertIs(r,"options",[Array]),this.markAsDirty();for(var n=new Array(r.length),i=0,s=r.length;i<s;i++)n[i]={value:bo.PDFHexString.fromText(r[i])};this.acroField.setOptions(n)},t.prototype.addOptions=function(r){Nc.assertIs(r,"options",["string",Array]),this.markAsDirty();for(var n=Array.isArray(r)?r:[r],i=this.acroField.getOptions(),s=new Array(n.length),u=0,f=n.length;u<f;u++)s[u]={value:bo.PDFHexString.fromText(n[u])};this.acroField.setOptions(i.concat(s))},t.prototype.select=function(r,n){n===void 0&&(n=!1),Nc.assertIs(r,"options",["string",Array]),Nc.assertIs(n,"merge",["boolean"]);var i=Array.isArray(r)?r:[r],s=this.getOptions();Nc.assertIsSubset(i,"option",s),this.markAsDirty(),(i.length>1||i.length===1&&n)&&this.enableMultiselect();for(var u=new Array(i.length),f=0,h=i.length;f<h;f++)u[f]=bo.PDFHexString.fromText(i[f]);if(n){var g=this.acroField.getValues();this.acroField.setValues(g.concat(u))}else this.acroField.setValues(u)},t.prototype.clear=function(){this.markAsDirty(),this.acroField.setValues([])},t.prototype.setFontSize=function(r){Nc.assertPositive(r,"fontSize"),this.acroField.setFontSize(r),this.markAsDirty()},t.prototype.isSorted=function(){return this.acroField.hasFlag(bo.AcroChoiceFlags.Sort)},t.prototype.enableSorting=function(){this.acroField.setFlagTo(bo.AcroChoiceFlags.Sort,!0)},t.prototype.disableSorting=function(){this.acroField.setFlagTo(bo.AcroChoiceFlags.Sort,!1)},t.prototype.isMultiselect=function(){return this.acroField.hasFlag(bo.AcroChoiceFlags.MultiSelect)},t.prototype.enableMultiselect=function(){this.acroField.setFlagTo(bo.AcroChoiceFlags.MultiSelect,!0)},t.prototype.disableMultiselect=function(){this.acroField.setFlagTo(bo.AcroChoiceFlags.MultiSelect,!1)},t.prototype.isSelectOnClick=function(){return this.acroField.hasFlag(bo.AcroChoiceFlags.CommitOnSelChange)},t.prototype.enableSelectOnClick=function(){this.acroField.setFlagTo(bo.AcroChoiceFlags.CommitOnSelChange,!0)},t.prototype.disableSelectOnClick=function(){this.acroField.setFlagTo(bo.AcroChoiceFlags.CommitOnSelChange,!1)},t.prototype.addToPage=function(r,n){var i,s,u,f,h,g,p;Nc.assertIs(r,"page",[[Tut.default,"PDFPage"]]),qpe.assertFieldAppearanceOptions(n),n||(n={}),"textColor"in n||(n.textColor=aP.rgb(0,0,0)),"backgroundColor"in n||(n.backgroundColor=aP.rgb(1,1,1)),"borderColor"in n||(n.borderColor=aP.rgb(0,0,0)),"borderWidth"in n||(n.borderWidth=1);var C=this.createWidget({x:(i=n.x)!==null&&i!==void 0?i:0,y:(s=n.y)!==null&&s!==void 0?s:0,width:(u=n.width)!==null&&u!==void 0?u:200,height:(f=n.height)!==null&&f!==void 0?f:100,textColor:n.textColor,backgroundColor:n.backgroundColor,borderColor:n.borderColor,borderWidth:(h=n.borderWidth)!==null&&h!==void 0?h:0,rotate:(g=n.rotate)!==null&&g!==void 0?g:Sut.degrees(0),hidden:n.hidden,page:r.ref}),y=this.doc.context.register(C.dict);this.acroField.addWidget(y);var x=(p=n.font)!==null&&p!==void 0?p:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(C,x),r.node.addAnnot(y)},t.prototype.needsAppearancesUpdate=function(){var r;if(this.isDirty())return!0;for(var n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=((r=u.getAppearances())===null||r===void 0?void 0:r.normal)instanceof bo.PDFStream;if(!f)return!0}return!1},t.prototype.defaultUpdateAppearances=function(r){Nc.assertIs(r,"font",[[Hpe.default,"PDFFont"]]),this.updateAppearances(r)},t.prototype.updateAppearances=function(r,n){Nc.assertIs(r,"font",[[Hpe.default,"PDFFont"]]),Nc.assertOrUndefined(n,"provider",[Function]);for(var i=this.acroField.getWidgets(),s=0,u=i.length;s<u;s++){var f=i[s];this.updateWidgetAppearance(f,r,n)}this.markAsClean()},t.prototype.updateWidgetAppearance=function(r,n,i){var s=i??Wpe.defaultOptionListAppearanceProvider,u=Wpe.normalizeAppearance(s(this,r,n));this.updateWidgetAppearanceWithFont(r,n,u)},t.of=function(r,n,i){return new t(r,n,i)},t})(qpe.default);sP.default=Qut});var lP=U(fP=>{"use strict";Object.defineProperty(fP,"__esModule",{value:!0});var cP=(ct(),ze(ut)),_ut=cP.__importDefault(rl()),Gpe=cP.__importStar(tl()),Vpe=RA(),uP=Gu(),Nut=zo(),Ju=Xi(),Wm=fr(),kut=(function(e){cP.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return Wm.assertIs(r,"acroRadioButton",[[Ju.PDFAcroRadioButton,"PDFAcroRadioButton"]]),s.acroField=r,s}return t.prototype.getOptions=function(){var r=this.acroField.getExportValues();if(r){for(var n=new Array(r.length),i=0,s=r.length;i<s;i++)n[i]=r[i].decodeText();return n}for(var u=this.acroField.getOnValues(),f=new Array(u.length),i=0,s=f.length;i<s;i++)f[i]=u[i].decodeText();return f},t.prototype.getSelected=function(){var r=this.acroField.getValue();if(r!==Ju.PDFName.of("Off")){var n=this.acroField.getExportValues();if(n){for(var i=this.acroField.getOnValues(),s=0,u=i.length;s<u;s++)if(i[s]===r)return n[s].decodeText()}return r.decodeText()}},t.prototype.select=function(r){Wm.assertIs(r,"option",["string"]);var n=this.getOptions();Wm.assertIsOneOf(r,"option",n),this.markAsDirty();var i=this.acroField.getOnValues(),s=this.acroField.getExportValues();if(s)for(var u=0,f=s.length;u<f;u++)s[u].decodeText()===r&&this.acroField.setValue(i[u]);else for(var u=0,f=i.length;u<f;u++){var h=i[u];h.decodeText()===r&&this.acroField.setValue(h)}},t.prototype.clear=function(){this.markAsDirty(),this.acroField.setValue(Ju.PDFName.of("Off"))},t.prototype.isOffToggleable=function(){return!this.acroField.hasFlag(Ju.AcroButtonFlags.NoToggleToOff)},t.prototype.enableOffToggling=function(){this.acroField.setFlagTo(Ju.AcroButtonFlags.NoToggleToOff,!1)},t.prototype.disableOffToggling=function(){this.acroField.setFlagTo(Ju.AcroButtonFlags.NoToggleToOff,!0)},t.prototype.isMutuallyExclusive=function(){return!this.acroField.hasFlag(Ju.AcroButtonFlags.RadiosInUnison)},t.prototype.enableMutualExclusion=function(){this.acroField.setFlagTo(Ju.AcroButtonFlags.RadiosInUnison,!1)},t.prototype.disableMutualExclusion=function(){this.acroField.setFlagTo(Ju.AcroButtonFlags.RadiosInUnison,!0)},t.prototype.addOptionToPage=function(r,n,i){var s,u,f,h,g,p,C,y,x;Wm.assertIs(r,"option",["string"]),Wm.assertIs(n,"page",[[_ut.default,"PDFPage"]]),Gpe.assertFieldAppearanceOptions(i);var v=this.createWidget({x:(s=i?.x)!==null&&s!==void 0?s:0,y:(u=i?.y)!==null&&u!==void 0?u:0,width:(f=i?.width)!==null&&f!==void 0?f:50,height:(h=i?.height)!==null&&h!==void 0?h:50,textColor:(g=i?.textColor)!==null&&g!==void 0?g:uP.rgb(0,0,0),backgroundColor:(p=i?.backgroundColor)!==null&&p!==void 0?p:uP.rgb(1,1,1),borderColor:(C=i?.borderColor)!==null&&C!==void 0?C:uP.rgb(0,0,0),borderWidth:(y=i?.borderWidth)!==null&&y!==void 0?y:1,rotate:(x=i?.rotate)!==null&&x!==void 0?x:Nut.degrees(0),hidden:i?.hidden,page:n.ref}),T=this.doc.context.register(v.dict),Q=this.acroField.addWidgetWithOpt(T,Ju.PDFHexString.fromText(r),!this.isMutuallyExclusive());v.setAppearanceState(Ju.PDFName.of("Off")),this.updateWidgetAppearance(v,Q),n.node.addAnnot(T)},t.prototype.needsAppearancesUpdate=function(){for(var r,n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=u.getAppearanceState(),h=(r=u.getAppearances())===null||r===void 0?void 0:r.normal;if(!(h instanceof Ju.PDFDict)||f&&!h.has(f))return!0}return!1},t.prototype.defaultUpdateAppearances=function(){this.updateAppearances()},t.prototype.updateAppearances=function(r){Wm.assertOrUndefined(r,"provider",[Function]);for(var n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=u.getOnValue();f&&this.updateWidgetAppearance(u,f,r)}},t.prototype.updateWidgetAppearance=function(r,n,i){var s=i??Vpe.defaultRadioGroupAppearanceProvider,u=Vpe.normalizeAppearance(s(this,r));this.updateOnOffWidgetAppearance(r,n,u)},t.of=function(r,n,i){return new t(r,n,i)},t})(Gpe.default);fP.default=kut});var dP=U(AP=>{"use strict";Object.defineProperty(AP,"__esModule",{value:!0});var Ype=(ct(),ze(ut)),Rut=Ype.__importDefault(tl()),Uut=Xi(),Mut=fr(),Out=(function(e){Ype.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return Mut.assertIs(r,"acroSignature",[[Uut.PDFAcroSignature,"PDFAcroSignature"]]),s.acroField=r,s}return t.prototype.needsAppearancesUpdate=function(){return!1},t.of=function(r,n,i){return new t(r,n,i)},t})(Rut.default);AP.default=Out});var EP=U(mP=>{"use strict";Object.defineProperty(mP,"__esModule",{value:!0});var p3=(ct(),ze(ut)),Lut=p3.__importDefault(rl()),jpe=p3.__importDefault(el()),Jpe=p3.__importStar(tl()),Xpe=RA(),hP=Gu(),Put=zo(),gP=Pm(),pP=A3(),fg=jy(),si=Xi(),nl=fr(),Hut=(function(e){p3.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return nl.assertIs(r,"acroText",[[si.PDFAcroText,"PDFAcroText"]]),s.acroField=r,s}return t.prototype.getText=function(){var r=this.acroField.getValue();if(!r&&this.isRichFormatted())throw new gP.RichTextFieldReadError(this.getName());return r?.decodeText()},t.prototype.setText=function(r){nl.assertOrUndefined(r,"text",["string"]);var n=this.getMaxLength();if(n!==void 0&&r&&r.length>n)throw new gP.ExceededMaxLengthError(r.length,n,this.getName());this.markAsDirty(),this.disableRichFormatting(),r?this.acroField.setValue(si.PDFHexString.fromText(r)):this.acroField.removeValue()},t.prototype.getAlignment=function(){var r=this.acroField.getQuadding();return r===0?fg.TextAlignment.Left:r===1?fg.TextAlignment.Center:r===2?fg.TextAlignment.Right:fg.TextAlignment.Left},t.prototype.setAlignment=function(r){nl.assertIsOneOf(r,"alignment",fg.TextAlignment),this.markAsDirty(),this.acroField.setQuadding(r)},t.prototype.getMaxLength=function(){return this.acroField.getMaxLength()},t.prototype.setMaxLength=function(r){if(nl.assertRangeOrUndefined(r,"maxLength",0,Number.MAX_SAFE_INTEGER),this.markAsDirty(),r===void 0)this.acroField.removeMaxLength();else{var n=this.getText();if(n&&n.length>r)throw new gP.InvalidMaxLengthError(n.length,r,this.getName());this.acroField.setMaxLength(r)}},t.prototype.removeMaxLength=function(){this.markAsDirty(),this.acroField.removeMaxLength()},t.prototype.setImage=function(r){for(var n=this.getAlignment(),i=n===fg.TextAlignment.Center?pP.ImageAlignment.Center:n===fg.TextAlignment.Right?pP.ImageAlignment.Right:pP.ImageAlignment.Left,s=this.acroField.getWidgets(),u=0,f=s.length;u<f;u++){var h=s[u],g=this.createImageAppearanceStream(h,r,i);this.updateWidgetAppearances(h,{normal:g})}this.markAsClean()},t.prototype.setFontSize=function(r){nl.assertPositive(r,"fontSize"),this.acroField.setFontSize(r),this.markAsDirty()},t.prototype.isMultiline=function(){return this.acroField.hasFlag(si.AcroTextFlags.Multiline)},t.prototype.enableMultiline=function(){this.markAsDirty(),this.acroField.setFlagTo(si.AcroTextFlags.Multiline,!0)},t.prototype.disableMultiline=function(){this.markAsDirty(),this.acroField.setFlagTo(si.AcroTextFlags.Multiline,!1)},t.prototype.isPassword=function(){return this.acroField.hasFlag(si.AcroTextFlags.Password)},t.prototype.enablePassword=function(){this.acroField.setFlagTo(si.AcroTextFlags.Password,!0)},t.prototype.disablePassword=function(){this.acroField.setFlagTo(si.AcroTextFlags.Password,!1)},t.prototype.isFileSelector=function(){return this.acroField.hasFlag(si.AcroTextFlags.FileSelect)},t.prototype.enableFileSelection=function(){this.acroField.setFlagTo(si.AcroTextFlags.FileSelect,!0)},t.prototype.disableFileSelection=function(){this.acroField.setFlagTo(si.AcroTextFlags.FileSelect,!1)},t.prototype.isSpellChecked=function(){return!this.acroField.hasFlag(si.AcroTextFlags.DoNotSpellCheck)},t.prototype.enableSpellChecking=function(){this.acroField.setFlagTo(si.AcroTextFlags.DoNotSpellCheck,!1)},t.prototype.disableSpellChecking=function(){this.acroField.setFlagTo(si.AcroTextFlags.DoNotSpellCheck,!0)},t.prototype.isScrollable=function(){return!this.acroField.hasFlag(si.AcroTextFlags.DoNotScroll)},t.prototype.enableScrolling=function(){this.acroField.setFlagTo(si.AcroTextFlags.DoNotScroll,!1)},t.prototype.disableScrolling=function(){this.acroField.setFlagTo(si.AcroTextFlags.DoNotScroll,!0)},t.prototype.isCombed=function(){return this.acroField.hasFlag(si.AcroTextFlags.Comb)&&!this.isMultiline()&&!this.isPassword()&&!this.isFileSelector()&&this.getMaxLength()!==void 0},t.prototype.enableCombing=function(){if(this.getMaxLength()===void 0){var r="PDFTextFields must have a max length in order to be combed";console.warn(r)}this.markAsDirty(),this.disableMultiline(),this.disablePassword(),this.disableFileSelection(),this.acroField.setFlagTo(si.AcroTextFlags.Comb,!0)},t.prototype.disableCombing=function(){this.markAsDirty(),this.acroField.setFlagTo(si.AcroTextFlags.Comb,!1)},t.prototype.isRichFormatted=function(){return this.acroField.hasFlag(si.AcroTextFlags.RichText)},t.prototype.enableRichFormatting=function(){this.acroField.setFlagTo(si.AcroTextFlags.RichText,!0)},t.prototype.disableRichFormatting=function(){this.acroField.setFlagTo(si.AcroTextFlags.RichText,!1)},t.prototype.addToPage=function(r,n){var i,s,u,f,h,g,p;nl.assertIs(r,"page",[[Lut.default,"PDFPage"]]),Jpe.assertFieldAppearanceOptions(n),n||(n={}),"textColor"in n||(n.textColor=hP.rgb(0,0,0)),"backgroundColor"in n||(n.backgroundColor=hP.rgb(1,1,1)),"borderColor"in n||(n.borderColor=hP.rgb(0,0,0)),"borderWidth"in n||(n.borderWidth=1);var C=this.createWidget({x:(i=n.x)!==null&&i!==void 0?i:0,y:(s=n.y)!==null&&s!==void 0?s:0,width:(u=n.width)!==null&&u!==void 0?u:200,height:(f=n.height)!==null&&f!==void 0?f:50,textColor:n.textColor,backgroundColor:n.backgroundColor,borderColor:n.borderColor,borderWidth:(h=n.borderWidth)!==null&&h!==void 0?h:0,rotate:(g=n.rotate)!==null&&g!==void 0?g:Put.degrees(0),hidden:n.hidden,page:r.ref}),y=this.doc.context.register(C.dict);this.acroField.addWidget(y);var x=(p=n.font)!==null&&p!==void 0?p:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(C,x),r.node.addAnnot(y)},t.prototype.needsAppearancesUpdate=function(){var r;if(this.isDirty())return!0;for(var n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=((r=u.getAppearances())===null||r===void 0?void 0:r.normal)instanceof si.PDFStream;if(!f)return!0}return!1},t.prototype.defaultUpdateAppearances=function(r){nl.assertIs(r,"font",[[jpe.default,"PDFFont"]]),this.updateAppearances(r)},t.prototype.updateAppearances=function(r,n){nl.assertIs(r,"font",[[jpe.default,"PDFFont"]]),nl.assertOrUndefined(n,"provider",[Function]);for(var i=this.acroField.getWidgets(),s=0,u=i.length;s<u;s++){var f=i[s];this.updateWidgetAppearance(f,r,n)}this.markAsClean()},t.prototype.updateWidgetAppearance=function(r,n,i){var s=i??Xpe.defaultTextFieldAppearanceProvider,u=Xpe.normalizeAppearance(s(this,r,n));this.updateWidgetAppearanceWithFont(r,n,u)},t.of=function(r,n,i){return new t(r,n,i)},t})(Jpe.default);mP.default=Hut});var m3=U(Ky=>{"use strict";Object.defineProperty(Ky,"__esModule",{value:!0});Ky.StandardFonts=void 0;var qut;(function(e){e.Courier="Courier",e.CourierBold="Courier-Bold",e.CourierOblique="Courier-Oblique",e.CourierBoldOblique="Courier-BoldOblique",e.Helvetica="Helvetica",e.HelveticaBold="Helvetica-Bold",e.HelveticaOblique="Helvetica-Oblique",e.HelveticaBoldOblique="Helvetica-BoldOblique",e.TimesRoman="Times-Roman",e.TimesRomanBold="Times-Bold",e.TimesRomanItalic="Times-Italic",e.TimesRomanBoldItalic="Times-BoldItalic",e.Symbol="Symbol",e.ZapfDingbats="ZapfDingbats"})(qut=Ky.StandardFonts||(Ky.StandardFonts={}))});var yP=U(CP=>{"use strict";Object.defineProperty(CP,"__esModule",{value:!0});var Xu=(ct(),ze(ut)),Wut=Xu.__importDefault(UA()),b3=Xu.__importDefault(xP()),zy=Xu.__importDefault(tP()),C3=Xu.__importDefault(iP()),y3=Xu.__importDefault(oP()),Zy=Xu.__importDefault(lP()),bP=Xu.__importDefault(dP()),x3=Xu.__importDefault(EP()),kc=Pm(),Gut=Xu.__importDefault(el()),Vut=m3(),Yut=Lm(),E3=QA(),In=Xi(),Fi=fr(),jut=(function(){function e(t,r){var n=this;this.embedDefaultFont=function(){return n.doc.embedStandardFont(Vut.StandardFonts.Helvetica)},Fi.assertIs(t,"acroForm",[[In.PDFAcroForm,"PDFAcroForm"]]),Fi.assertIs(r,"doc",[[Wut.default,"PDFDocument"]]),this.acroForm=t,this.doc=r,this.dirtyFields=new Set,this.defaultFontCache=Fi.Cache.populatedBy(this.embedDefaultFont)}return e.prototype.hasXFA=function(){return this.acroForm.dict.has(In.PDFName.of("XFA"))},e.prototype.deleteXFA=function(){this.acroForm.dict.delete(In.PDFName.of("XFA"))},e.prototype.getFields=function(){for(var t=this.acroForm.getAllFields(),r=[],n=0,i=t.length;n<i;n++){var s=t[n],u=s[0],f=s[1],h=Jut(u,f,this.doc);h&&r.push(h)}return r},e.prototype.getFieldMaybe=function(t){Fi.assertIs(t,"name",["string"]);for(var r=this.getFields(),n=0,i=r.length;n<i;n++){var s=r[n];if(s.getName()===t)return s}},e.prototype.getField=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getFieldMaybe(t);if(r)return r;throw new kc.NoSuchFieldError(t)},e.prototype.getButton=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof b3.default)return r;throw new kc.UnexpectedFieldTypeError(t,b3.default,r)},e.prototype.getCheckBox=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof zy.default)return r;throw new kc.UnexpectedFieldTypeError(t,zy.default,r)},e.prototype.getDropdown=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof C3.default)return r;throw new kc.UnexpectedFieldTypeError(t,C3.default,r)},e.prototype.getOptionList=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof y3.default)return r;throw new kc.UnexpectedFieldTypeError(t,y3.default,r)},e.prototype.getRadioGroup=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof Zy.default)return r;throw new kc.UnexpectedFieldTypeError(t,Zy.default,r)},e.prototype.getSignature=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof bP.default)return r;throw new kc.UnexpectedFieldTypeError(t,bP.default,r)},e.prototype.getTextField=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof x3.default)return r;throw new kc.UnexpectedFieldTypeError(t,x3.default,r)},e.prototype.createButton=function(t){Fi.assertIs(t,"name",["string"]);var r=Gm(t),n=this.findOrCreateNonTerminals(r.nonTerminal),i=In.PDFAcroPushButton.create(this.doc.context);return i.setPartialName(r.terminal),Vm(n,[i,i.ref],r.terminal),b3.default.of(i,i.ref,this.doc)},e.prototype.createCheckBox=function(t){Fi.assertIs(t,"name",["string"]);var r=Gm(t),n=this.findOrCreateNonTerminals(r.nonTerminal),i=In.PDFAcroCheckBox.create(this.doc.context);return i.setPartialName(r.terminal),Vm(n,[i,i.ref],r.terminal),zy.default.of(i,i.ref,this.doc)},e.prototype.createDropdown=function(t){Fi.assertIs(t,"name",["string"]);var r=Gm(t),n=this.findOrCreateNonTerminals(r.nonTerminal),i=In.PDFAcroComboBox.create(this.doc.context);return i.setPartialName(r.terminal),Vm(n,[i,i.ref],r.terminal),C3.default.of(i,i.ref,this.doc)},e.prototype.createOptionList=function(t){Fi.assertIs(t,"name",["string"]);var r=Gm(t),n=this.findOrCreateNonTerminals(r.nonTerminal),i=In.PDFAcroListBox.create(this.doc.context);return i.setPartialName(r.terminal),Vm(n,[i,i.ref],r.terminal),y3.default.of(i,i.ref,this.doc)},e.prototype.createRadioGroup=function(t){Fi.assertIs(t,"name",["string"]);var r=Gm(t),n=this.findOrCreateNonTerminals(r.nonTerminal),i=In.PDFAcroRadioButton.create(this.doc.context);return i.setPartialName(r.terminal),Vm(n,[i,i.ref],r.terminal),Zy.default.of(i,i.ref,this.doc)},e.prototype.createTextField=function(t){Fi.assertIs(t,"name",["string"]);var r=Gm(t),n=this.findOrCreateNonTerminals(r.nonTerminal),i=In.PDFAcroText.create(this.doc.context);return i.setPartialName(r.terminal),Vm(n,[i,i.ref],r.terminal),x3.default.of(i,i.ref,this.doc)},e.prototype.flatten=function(t){t===void 0&&(t={updateFieldAppearances:!0}),t.updateFieldAppearances&&this.updateFieldAppearances();for(var r=this.getFields(),n=0,i=r.length;n<i;n++){for(var s=r[n],u=s.acroField.getWidgets(),f=0,h=u.length;f<h;f++){var g=u[f],p=this.findWidgetPage(g),C=this.findWidgetAppearanceRef(s,g),y=p.node.newXObject("FlatWidget",C),x=g.getRectangle(),v=Xu.__spreadArrays([E3.pushGraphicsState(),E3.translate(x.x,x.y)],Yut.rotateInPlace(Xu.__assign(Xu.__assign({},x),{rotation:0})),[E3.drawObject(y),E3.popGraphicsState()]).filter(Boolean);p.pushOperators.apply(p,v)}this.removeField(s)}},e.prototype.removeField=function(t){for(var r=t.acroField.getWidgets(),n=new Set,i=0,s=r.length;i<s;i++){var u=r[i],f=this.findWidgetAppearanceRef(t,u),h=this.findWidgetPage(u);n.add(h),h.node.removeAnnot(f)}n.forEach(function(x){return x.node.removeAnnot(t.ref)}),this.acroForm.removeField(t.acroField);for(var g=t.acroField.normalizedEntries().Kids,p=g.size(),C=0;C<p;C++){var y=g.get(C);y instanceof In.PDFRef&&this.doc.context.delete(y)}this.doc.context.delete(t.ref)},e.prototype.updateFieldAppearances=function(t){Fi.assertOrUndefined(t,"font",[[Gut.default,"PDFFont"]]),t=t??this.getDefaultFont();for(var r=this.getFields(),n=0,i=r.length;n<i;n++){var s=r[n];s.needsAppearancesUpdate()&&s.defaultUpdateAppearances(t)}},e.prototype.markFieldAsDirty=function(t){Fi.assertOrUndefined(t,"fieldRef",[[In.PDFRef,"PDFRef"]]),this.dirtyFields.add(t)},e.prototype.markFieldAsClean=function(t){Fi.assertOrUndefined(t,"fieldRef",[[In.PDFRef,"PDFRef"]]),this.dirtyFields.delete(t)},e.prototype.fieldIsDirty=function(t){return Fi.assertOrUndefined(t,"fieldRef",[[In.PDFRef,"PDFRef"]]),this.dirtyFields.has(t)},e.prototype.getDefaultFont=function(){return this.defaultFontCache.access()},e.prototype.findWidgetPage=function(t){var r=t.P(),n=this.doc.getPages().find(function(s){return s.ref===r});if(n===void 0){var i=this.doc.context.getObjectRef(t.dict);if(i===void 0)throw new Error("Could not find PDFRef for PDFObject");if(n=this.doc.findPageForAnnotationRef(i),n===void 0)throw new Error("Could not find page for PDFRef "+i)}return n},e.prototype.findWidgetAppearanceRef=function(t,r){var n,i=r.getNormalAppearance();if(i instanceof In.PDFDict&&(t instanceof zy.default||t instanceof Zy.default)){var s=t.acroField.getValue(),u=(n=i.get(s))!==null&&n!==void 0?n:i.get(In.PDFName.of("Off"));u instanceof In.PDFRef&&(i=u)}if(!(i instanceof In.PDFRef)){var f=t.getName();throw new Error("Failed to extract appearance ref for: "+f)}return i},e.prototype.findOrCreateNonTerminals=function(t){for(var r=[this.acroForm],n=0,i=t.length;n<i;n++){var s=t[n];if(!s)throw new kc.InvalidFieldNamePartError(s);var u=r[0],f=r[1],h=this.findNonTerminal(s,u);if(h)r=h;else{var g=In.PDFAcroNonTerminal.create(this.doc.context);g.setPartialName(s),g.setParent(f);var p=this.doc.context.register(g.dict);u.addField(p),r=[g,p]}}return r},e.prototype.findNonTerminal=function(t,r){for(var n=r instanceof In.PDFAcroForm?this.acroForm.getFields():In.createPDFAcroFields(r.Kids()),i=0,s=n.length;i<s;i++){var u=n[i],f=u[0],h=u[1];if(f.getPartialName()===t){if(f instanceof In.PDFAcroNonTerminal)return[f,h];throw new kc.FieldAlreadyExistsError(t)}}},e.of=function(t,r){return new e(t,r)},e})();CP.default=jut;var Jut=function(e,t,r){if(e instanceof In.PDFAcroPushButton)return b3.default.of(e,t,r);if(e instanceof In.PDFAcroCheckBox)return zy.default.of(e,t,r);if(e instanceof In.PDFAcroComboBox)return C3.default.of(e,t,r);if(e instanceof In.PDFAcroListBox)return y3.default.of(e,t,r);if(e instanceof In.PDFAcroText)return x3.default.of(e,t,r);if(e instanceof In.PDFAcroRadioButton)return Zy.default.of(e,t,r);if(e instanceof In.PDFAcroSignature)return bP.default.of(e,t,r)},Gm=function(e){if(e.length===0)throw new Error("PDF field names must not be empty strings");for(var t=e.split("."),r=0,n=t.length;r<n;r++)if(t[r]==="")throw new Error('Periods in PDF field names must be separated by at least one character: "'+e+'"');return t.length===1?{nonTerminal:[],terminal:t[0]}:{nonTerminal:t.slice(0,t.length-1),terminal:t[t.length-1]}},Vm=function(e,t,r){for(var n=e[0],i=e[1],s=t[0],u=t[1],f=n.normalizedEntries(),h=In.createPDFAcroFields("Kids"in f?f.Kids:f.Fields),g=0,p=h.length;g<p;g++)if(h[g][0].getPartialName()===r)throw new kc.FieldAlreadyExistsError(r);n.addField(u),s.setParent(i)}});var vP=U(v3=>{"use strict";Object.defineProperty(v3,"__esModule",{value:!0});v3.PageSizes=void 0;v3.PageSizes={"4A0":[4767.87,6740.79],"2A0":[3370.39,4767.87],A0:[2383.94,3370.39],A1:[1683.78,2383.94],A2:[1190.55,1683.78],A3:[841.89,1190.55],A4:[595.28,841.89],A5:[419.53,595.28],A6:[297.64,419.53],A7:[209.76,297.64],A8:[147.4,209.76],A9:[104.88,147.4],A10:[73.7,104.88],B0:[2834.65,4008.19],B1:[2004.09,2834.65],B2:[1417.32,2004.09],B3:[1000.63,1417.32],B4:[708.66,1000.63],B5:[498.9,708.66],B6:[354.33,498.9],B7:[249.45,354.33],B8:[175.75,249.45],B9:[124.72,175.75],B10:[87.87,124.72],C0:[2599.37,3676.54],C1:[1836.85,2599.37],C2:[1298.27,1836.85],C3:[918.43,1298.27],C4:[649.13,918.43],C5:[459.21,649.13],C6:[323.15,459.21],C7:[229.61,323.15],C8:[161.57,229.61],C9:[113.39,161.57],C10:[79.37,113.39],RA0:[2437.8,3458.27],RA1:[1729.13,2437.8],RA2:[1218.9,1729.13],RA3:[864.57,1218.9],RA4:[609.45,864.57],SRA0:[2551.18,3628.35],SRA1:[1814.17,2551.18],SRA2:[1275.59,1814.17],SRA3:[907.09,1275.59],SRA4:[637.8,907.09],Executive:[521.86,756],Folio:[612,936],Legal:[612,1008],Letter:[612,792],Tabloid:[792,1224]}});var IP=U($y=>{"use strict";Object.defineProperty($y,"__esModule",{value:!0});$y.ParseSpeeds=void 0;var Xut;(function(e){e[e.Fastest=1/0]="Fastest",e[e.Fast=1500]="Fast",e[e.Medium=500]="Medium",e[e.Slow=100]="Slow"})(Xut=$y.ParseSpeeds||($y.ParseSpeeds={}))});var zpe=U(DP=>{"use strict";Object.defineProperty(DP,"__esModule",{value:!0});var Kpe=(ct(),ze(ut)),Ha=Xi(),Kut=(function(){function e(t,r,n){this.alreadyEmbedded=!1,this.ref=t,this.doc=r,this.embedder=n}return e.prototype.embed=function(){return Kpe.__awaiter(this,void 0,void 0,function(){var t,r,n,i,s;return Kpe.__generator(this,function(u){switch(u.label){case 0:return this.alreadyEmbedded?[3,2]:[4,this.embedder.embedIntoContext(this.doc.context,this.ref)];case 1:t=u.sent(),this.doc.catalog.has(Ha.PDFName.of("Names"))||this.doc.catalog.set(Ha.PDFName.of("Names"),this.doc.context.obj({})),r=this.doc.catalog.lookup(Ha.PDFName.of("Names"),Ha.PDFDict),r.has(Ha.PDFName.of("EmbeddedFiles"))||r.set(Ha.PDFName.of("EmbeddedFiles"),this.doc.context.obj({})),n=r.lookup(Ha.PDFName.of("EmbeddedFiles"),Ha.PDFDict),n.has(Ha.PDFName.of("Names"))||n.set(Ha.PDFName.of("Names"),this.doc.context.obj([])),i=n.lookup(Ha.PDFName.of("Names"),Ha.PDFArray),i.push(Ha.PDFHexString.fromText(this.embedder.fileName)),i.push(t),this.doc.catalog.has(Ha.PDFName.of("AF"))||this.doc.catalog.set(Ha.PDFName.of("AF"),this.doc.context.obj([])),s=this.doc.catalog.lookup(Ha.PDFName.of("AF"),Ha.PDFArray),s.push(t),this.alreadyEmbedded=!0,u.label=2;case 2:return[2]}})})},e.of=function(t,r,n){return new e(t,r,n)},e})();DP.default=Kut});var wP=U(BP=>{"use strict";Object.defineProperty(BP,"__esModule",{value:!0});var Zpe=(ct(),ze(ut)),$o=Xi(),zut=(function(){function e(t,r,n){this.alreadyEmbedded=!1,this.ref=t,this.doc=r,this.embedder=n}return e.prototype.embed=function(){return Zpe.__awaiter(this,void 0,void 0,function(){var t,r,n,i,s,u,f;return Zpe.__generator(this,function(h){switch(h.label){case 0:return this.alreadyEmbedded?[3,2]:(t=this.doc,r=t.catalog,n=t.context,[4,this.embedder.embedIntoContext(this.doc.context,this.ref)]);case 1:i=h.sent(),r.has($o.PDFName.of("Names"))||r.set($o.PDFName.of("Names"),n.obj({})),s=r.lookup($o.PDFName.of("Names"),$o.PDFDict),s.has($o.PDFName.of("JavaScript"))||s.set($o.PDFName.of("JavaScript"),n.obj({})),u=s.lookup($o.PDFName.of("JavaScript"),$o.PDFDict),u.has($o.PDFName.of("Names"))||u.set($o.PDFName.of("Names"),n.obj([])),f=u.lookup($o.PDFName.of("Names"),$o.PDFArray),f.push($o.PDFHexString.fromText(this.embedder.scriptName)),f.push(i),this.alreadyEmbedded=!0,h.label=2;case 2:return[2]}})})},e.of=function(t,r,n){return new e(t,r,n)},e})();BP.default=zut});var $pe=U(TP=>{"use strict";Object.defineProperty(TP,"__esModule",{value:!0});var FP=(ct(),ze(ut)),Zut=FP.__importDefault(co()),$ut=(function(){function e(t,r){this.script=t,this.scriptName=r}return e.for=function(t,r){return new e(t,r)},e.prototype.embedIntoContext=function(t,r){return FP.__awaiter(this,void 0,void 0,function(){var n;return FP.__generator(this,function(i){return n=t.obj({Type:"Action",S:"JavaScript",JS:Zut.default.fromText(this.script)}),r?(t.assign(r,n),[2,r]):[2,t.register(n)]})})},e})();TP.default=$ut});var UA=U(SP=>{"use strict";Object.defineProperty(SP,"__esModule",{value:!0});var Fr=(ct(),ze(ut)),I3=Pm(),ect=Fr.__importDefault(c3()),eme=Fr.__importDefault(el()),tme=Fr.__importDefault(l3()),Ym=Fr.__importDefault(rl()),tct=Fr.__importDefault(yP()),rct=vP(),ar=Xi(),nct=IP(),zt=fr(),rme=Fr.__importStar(fL()),ict=Fr.__importDefault(zpe()),act=Fr.__importDefault(wP()),sct=Fr.__importDefault($pe()),oct=(function(){function e(t,r,n){var i=this;if(this.defaultWordBreaks=[" "],this.computePages=function(){var s=[];return i.catalog.Pages().traverse(function(u,f){if(u instanceof ar.PDFPageLeaf){var h=i.pageMap.get(u);h||(h=Ym.default.of(u,f,i),i.pageMap.set(u,h)),s.push(h)}}),s},this.getOrCreateForm=function(){var s=i.catalog.getOrCreateAcroForm();return tct.default.of(s,i)},zt.assertIs(t,"context",[[ar.PDFContext,"PDFContext"]]),zt.assertIs(r,"ignoreEncryption",["boolean"]),this.context=t,this.catalog=t.lookup(t.trailerInfo.Root),this.isEncrypted=!!t.lookup(t.trailerInfo.Encrypt),this.pageCache=zt.Cache.populatedBy(this.computePages),this.pageMap=new Map,this.formCache=zt.Cache.populatedBy(this.getOrCreateForm),this.fonts=[],this.images=[],this.embeddedPages=[],this.embeddedFiles=[],this.javaScripts=[],!r&&this.isEncrypted)throw new I3.EncryptedPDFError;n&&this.updateInfoDict()}return e.load=function(t,r){return r===void 0&&(r={}),Fr.__awaiter(this,void 0,void 0,function(){var n,i,s,u,f,h,g,p,C,y,x,v;return Fr.__generator(this,function(T){switch(T.label){case 0:return n=r.ignoreEncryption,i=n===void 0?!1:n,s=r.parseSpeed,u=s===void 0?nct.ParseSpeeds.Slow:s,f=r.throwOnInvalidObject,h=f===void 0?!1:f,g=r.updateMetadata,p=g===void 0?!0:g,C=r.capNumbers,y=C===void 0?!1:C,zt.assertIs(t,"pdf",["string",Uint8Array,ArrayBuffer]),zt.assertIs(i,"ignoreEncryption",["boolean"]),zt.assertIs(u,"parseSpeed",["number"]),zt.assertIs(h,"throwOnInvalidObject",["boolean"]),x=zt.toUint8Array(t),[4,ar.PDFParser.forBytesWithOptions(x,u,h,y).parseDocument()];case 1:return v=T.sent(),[2,new e(v,i,p)]}})})},e.create=function(t){return t===void 0&&(t={}),Fr.__awaiter(this,void 0,void 0,function(){var r,n,i,s,u,f;return Fr.__generator(this,function(h){return r=t.updateMetadata,n=r===void 0?!0:r,i=ar.PDFContext.create(),s=ar.PDFPageTree.withContext(i),u=i.register(s),f=ar.PDFCatalog.withContextAndPages(i,u),i.trailerInfo.Root=i.register(f),[2,new e(i,!1,n)]})})},e.prototype.registerFontkit=function(t){this.fontkit=t},e.prototype.getForm=function(){var t=this.formCache.access();return t.hasXFA()&&(console.warn("Removing XFA form data as pdf-lib does not support reading or writing XFA"),t.deleteXFA()),t},e.prototype.getTitle=function(){var t=this.getInfoDict().lookup(ar.PDFName.Title);if(t)return MA(t),t.decodeText()},e.prototype.getAuthor=function(){var t=this.getInfoDict().lookup(ar.PDFName.Author);if(t)return MA(t),t.decodeText()},e.prototype.getSubject=function(){var t=this.getInfoDict().lookup(ar.PDFName.Subject);if(t)return MA(t),t.decodeText()},e.prototype.getKeywords=function(){var t=this.getInfoDict().lookup(ar.PDFName.Keywords);if(t)return MA(t),t.decodeText()},e.prototype.getCreator=function(){var t=this.getInfoDict().lookup(ar.PDFName.Creator);if(t)return MA(t),t.decodeText()},e.prototype.getProducer=function(){var t=this.getInfoDict().lookup(ar.PDFName.Producer);if(t)return MA(t),t.decodeText()},e.prototype.getCreationDate=function(){var t=this.getInfoDict().lookup(ar.PDFName.CreationDate);if(t)return MA(t),t.decodeDate()},e.prototype.getModificationDate=function(){var t=this.getInfoDict().lookup(ar.PDFName.ModDate);if(t)return MA(t),t.decodeDate()},e.prototype.setTitle=function(t,r){zt.assertIs(t,"title",["string"]);var n=ar.PDFName.of("Title");if(this.getInfoDict().set(n,ar.PDFHexString.fromText(t)),r?.showInWindowTitleBar){var i=this.catalog.getOrCreateViewerPreferences();i.setDisplayDocTitle(!0)}},e.prototype.setAuthor=function(t){zt.assertIs(t,"author",["string"]);var r=ar.PDFName.of("Author");this.getInfoDict().set(r,ar.PDFHexString.fromText(t))},e.prototype.setSubject=function(t){zt.assertIs(t,"author",["string"]);var r=ar.PDFName.of("Subject");this.getInfoDict().set(r,ar.PDFHexString.fromText(t))},e.prototype.setKeywords=function(t){zt.assertIs(t,"keywords",[Array]);var r=ar.PDFName.of("Keywords");this.getInfoDict().set(r,ar.PDFHexString.fromText(t.join(" ")))},e.prototype.setCreator=function(t){zt.assertIs(t,"creator",["string"]);var r=ar.PDFName.of("Creator");this.getInfoDict().set(r,ar.PDFHexString.fromText(t))},e.prototype.setProducer=function(t){zt.assertIs(t,"creator",["string"]);var r=ar.PDFName.of("Producer");this.getInfoDict().set(r,ar.PDFHexString.fromText(t))},e.prototype.setLanguage=function(t){zt.assertIs(t,"language",["string"]);var r=ar.PDFName.of("Lang");this.catalog.set(r,ar.PDFString.of(t))},e.prototype.setCreationDate=function(t){zt.assertIs(t,"creationDate",[[Date,"Date"]]);var r=ar.PDFName.of("CreationDate");this.getInfoDict().set(r,ar.PDFString.fromDate(t))},e.prototype.setModificationDate=function(t){zt.assertIs(t,"modificationDate",[[Date,"Date"]]);var r=ar.PDFName.of("ModDate");this.getInfoDict().set(r,ar.PDFString.fromDate(t))},e.prototype.getPageCount=function(){return this.pageCount===void 0&&(this.pageCount=this.getPages().length),this.pageCount},e.prototype.getPages=function(){return this.pageCache.access()},e.prototype.getPage=function(t){var r=this.getPages();return zt.assertRange(t,"index",0,r.length-1),r[t]},e.prototype.getPageIndices=function(){return zt.range(0,this.getPageCount())},e.prototype.removePage=function(t){var r=this.getPageCount();if(this.pageCount===0)throw new I3.RemovePageFromEmptyDocumentError;zt.assertRange(t,"index",0,r-1),this.catalog.removeLeafNode(t),this.pageCount=r-1},e.prototype.addPage=function(t){return zt.assertIs(t,"page",["undefined",[Ym.default,"PDFPage"],Array]),this.insertPage(this.getPageCount(),t)},e.prototype.insertPage=function(t,r){var n=this.getPageCount();if(zt.assertRange(t,"index",0,n),zt.assertIs(r,"page",["undefined",[Ym.default,"PDFPage"],Array]),!r||Array.isArray(r)){var i=Array.isArray(r)?r:rct.PageSizes.A4;r=Ym.default.create(this),r.setSize.apply(r,i)}else if(r.doc!==this)throw new I3.ForeignPageError;var s=this.catalog.insertLeafNode(r.ref,t);return r.node.setParent(s),this.pageMap.set(r.node,r),this.pageCache.invalidate(),this.pageCount=n+1,r},e.prototype.copyPages=function(t,r){return Fr.__awaiter(this,void 0,void 0,function(){var n,i,s,u,f,h,g,p;return Fr.__generator(this,function(C){switch(C.label){case 0:return zt.assertIs(t,"srcDoc",[[e,"PDFDocument"]]),zt.assertIs(r,"indices",[Array]),[4,t.flush()];case 1:for(C.sent(),n=ar.PDFObjectCopier.for(t.context,this.context),i=t.getPages(),s=new Array(r.length),u=0,f=r.length;u<f;u++)h=i[r[u]],g=n.copy(h.node),p=this.context.register(g),s[u]=Ym.default.of(g,p,this);return[2,s]}})})},e.prototype.copy=function(){return Fr.__awaiter(this,void 0,void 0,function(){var t,r,n,i;return Fr.__generator(this,function(s){switch(s.label){case 0:return[4,e.create()];case 1:return t=s.sent(),[4,t.copyPages(this,this.getPageIndices())];case 2:for(r=s.sent(),n=0,i=r.length;n<i;n++)t.addPage(r[n]);return this.getAuthor()!==void 0&&t.setAuthor(this.getAuthor()),this.getCreationDate()!==void 0&&t.setCreationDate(this.getCreationDate()),this.getCreator()!==void 0&&t.setCreator(this.getCreator()),this.getModificationDate()!==void 0&&t.setModificationDate(this.getModificationDate()),this.getProducer()!==void 0&&t.setProducer(this.getProducer()),this.getSubject()!==void 0&&t.setSubject(this.getSubject()),this.getTitle()!==void 0&&t.setTitle(this.getTitle()),t.defaultWordBreaks=this.defaultWordBreaks,[2,t]}})})},e.prototype.addJavaScript=function(t,r){zt.assertIs(t,"name",["string"]),zt.assertIs(r,"script",["string"]);var n=sct.default.for(r,t),i=this.context.nextRef(),s=act.default.of(i,this,n);this.javaScripts.push(s)},e.prototype.attach=function(t,r,n){return n===void 0&&(n={}),Fr.__awaiter(this,void 0,void 0,function(){var i,s,u,f;return Fr.__generator(this,function(h){return zt.assertIs(t,"attachment",["string",Uint8Array,ArrayBuffer]),zt.assertIs(r,"name",["string"]),zt.assertOrUndefined(n.mimeType,"mimeType",["string"]),zt.assertOrUndefined(n.description,"description",["string"]),zt.assertOrUndefined(n.creationDate,"options.creationDate",[Date]),zt.assertOrUndefined(n.modificationDate,"options.modificationDate",[Date]),zt.assertIsOneOfOrUndefined(n.afRelationship,"options.afRelationship",rme.AFRelationship),i=zt.toUint8Array(t),s=rme.default.for(i,r,n),u=this.context.nextRef(),f=ict.default.of(u,this,s),this.embeddedFiles.push(f),[2]})})},e.prototype.embedFont=function(t,r){return r===void 0&&(r={}),Fr.__awaiter(this,void 0,void 0,function(){var n,i,s,u,f,h,g,p,C,y;return Fr.__generator(this,function(x){switch(x.label){case 0:return n=r.subset,i=n===void 0?!1:n,s=r.customName,u=r.features,zt.assertIs(t,"font",["string",Uint8Array,ArrayBuffer]),zt.assertIs(i,"subset",["boolean"]),zt.isStandardFont(t)?(f=ar.StandardFontEmbedder.for(t,s),[3,7]):[3,1];case 1:return zt.canBeConvertedToUint8Array(t)?(h=zt.toUint8Array(t),g=this.assertFontkit(),i?[4,ar.CustomFontSubsetEmbedder.for(g,h,s,u)]:[3,3]):[3,6];case 2:return p=x.sent(),[3,5];case 3:return[4,ar.CustomFontEmbedder.for(g,h,s,u)];case 4:p=x.sent(),x.label=5;case 5:return f=p,[3,7];case 6:throw new TypeError("`font` must be one of `StandardFonts | string | Uint8Array | ArrayBuffer`");case 7:return C=this.context.nextRef(),y=eme.default.of(C,this,f),this.fonts.push(y),[2,y]}})})},e.prototype.embedStandardFont=function(t,r){if(zt.assertIs(t,"font",["string"]),!zt.isStandardFont(t))throw new TypeError("`font` must be one of type `StandardFonts`");var n=ar.StandardFontEmbedder.for(t,r),i=this.context.nextRef(),s=eme.default.of(i,this,n);return this.fonts.push(s),s},e.prototype.embedJpg=function(t){return Fr.__awaiter(this,void 0,void 0,function(){var r,n,i,s;return Fr.__generator(this,function(u){switch(u.label){case 0:return zt.assertIs(t,"jpg",["string",Uint8Array,ArrayBuffer]),r=zt.toUint8Array(t),[4,ar.JpegEmbedder.for(r)];case 1:return n=u.sent(),i=this.context.nextRef(),s=tme.default.of(i,this,n),this.images.push(s),[2,s]}})})},e.prototype.embedPng=function(t){return Fr.__awaiter(this,void 0,void 0,function(){var r,n,i,s;return Fr.__generator(this,function(u){switch(u.label){case 0:return zt.assertIs(t,"png",["string",Uint8Array,ArrayBuffer]),r=zt.toUint8Array(t),[4,ar.PngEmbedder.for(r)];case 1:return n=u.sent(),i=this.context.nextRef(),s=tme.default.of(i,this,n),this.images.push(s),[2,s]}})})},e.prototype.embedPdf=function(t,r){return r===void 0&&(r=[0]),Fr.__awaiter(this,void 0,void 0,function(){var n,i,s;return Fr.__generator(this,function(u){switch(u.label){case 0:return zt.assertIs(t,"pdf",["string",Uint8Array,ArrayBuffer,[e,"PDFDocument"]]),zt.assertIs(r,"indices",[Array]),t instanceof e?(i=t,[3,3]):[3,1];case 1:return[4,e.load(t)];case 2:i=u.sent(),u.label=3;case 3:return n=i,s=zt.pluckIndices(n.getPages(),r),[2,this.embedPages(s)]}})})},e.prototype.embedPage=function(t,r,n){return Fr.__awaiter(this,void 0,void 0,function(){var i;return Fr.__generator(this,function(s){switch(s.label){case 0:return zt.assertIs(t,"page",[[Ym.default,"PDFPage"]]),[4,this.embedPages([t],[r],[n])];case 1:return i=s.sent()[0],[2,i]}})})},e.prototype.embedPages=function(t,r,n){return r===void 0&&(r=[]),n===void 0&&(n=[]),Fr.__awaiter(this,void 0,void 0,function(){var g,p,i,s,u,f,h,g,p,C,y,x,v,T,Q;return Fr.__generator(this,function(F){switch(F.label){case 0:if(t.length===0)return[2,[]];for(g=0,p=t.length-1;g<p;g++)if(i=t[g],s=t[g+1],i.node.context!==s.node.context)throw new ar.PageEmbeddingMismatchedContextError;u=t[0].node.context,f=u===this.context?function(_){return _}:ar.PDFObjectCopier.for(u,this.context).copy,h=new Array(t.length),g=0,p=t.length,F.label=1;case 1:return g<p?(C=f(t[g].node),y=r[g],x=n[g],[4,ar.PDFPageEmbedder.for(C,y,x)]):[3,4];case 2:v=F.sent(),T=this.context.nextRef(),h[g]=ect.default.of(T,this,v),F.label=3;case 3:return g++,[3,1];case 4:return(Q=this.embeddedPages).push.apply(Q,h),[2,h]}})})},e.prototype.flush=function(){return Fr.__awaiter(this,void 0,void 0,function(){return Fr.__generator(this,function(t){switch(t.label){case 0:return[4,this.embedAll(this.fonts)];case 1:return t.sent(),[4,this.embedAll(this.images)];case 2:return t.sent(),[4,this.embedAll(this.embeddedPages)];case 3:return t.sent(),[4,this.embedAll(this.embeddedFiles)];case 4:return t.sent(),[4,this.embedAll(this.javaScripts)];case 5:return t.sent(),[2]}})})},e.prototype.save=function(t){return t===void 0&&(t={}),Fr.__awaiter(this,void 0,void 0,function(){var r,n,i,s,u,f,h,g,p,C;return Fr.__generator(this,function(y){switch(y.label){case 0:return r=t.useObjectStreams,n=r===void 0?!0:r,i=t.addDefaultPage,s=i===void 0?!0:i,u=t.objectsPerTick,f=u===void 0?50:u,h=t.updateFieldAppearances,g=h===void 0?!0:h,zt.assertIs(n,"useObjectStreams",["boolean"]),zt.assertIs(s,"addDefaultPage",["boolean"]),zt.assertIs(f,"objectsPerTick",["number"]),zt.assertIs(g,"updateFieldAppearances",["boolean"]),s&&this.getPageCount()===0&&this.addPage(),g&&(p=this.formCache.getValue(),p&&p.updateFieldAppearances()),[4,this.flush()];case 1:return y.sent(),C=n?ar.PDFStreamWriter:ar.PDFWriter,[2,C.forContext(this.context,f).serializeToBuffer()]}})})},e.prototype.saveAsBase64=function(t){return t===void 0&&(t={}),Fr.__awaiter(this,void 0,void 0,function(){var r,n,i,s,u;return Fr.__generator(this,function(f){switch(f.label){case 0:return r=t.dataUri,n=r===void 0?!1:r,i=Fr.__rest(t,["dataUri"]),zt.assertIs(n,"dataUri",["boolean"]),[4,this.save(i)];case 1:return s=f.sent(),u=zt.encodeToBase64(s),[2,n?"data:application/pdf;base64,"+u:u]}})})},e.prototype.findPageForAnnotationRef=function(t){for(var r=this.getPages(),n=0,i=r.length;n<i;n++){var s=r[n],u=s.node.Annots();if(u?.indexOf(t)!==void 0)return s}},e.prototype.embedAll=function(t){return Fr.__awaiter(this,void 0,void 0,function(){var r,n;return Fr.__generator(this,function(i){switch(i.label){case 0:r=0,n=t.length,i.label=1;case 1:return r<n?[4,t[r].embed()]:[3,4];case 2:i.sent(),i.label=3;case 3:return r++,[3,1];case 4:return[2]}})})},e.prototype.updateInfoDict=function(){var t="pdf-lib (https://github.com/Hopding/pdf-lib)",r=new Date,n=this.getInfoDict();this.setProducer(t),this.setModificationDate(r),n.get(ar.PDFName.of("Creator"))||this.setCreator(t),n.get(ar.PDFName.of("CreationDate"))||this.setCreationDate(r)},e.prototype.getInfoDict=function(){var t=this.context.lookup(this.context.trailerInfo.Info);if(t instanceof ar.PDFDict)return t;var r=this.context.obj({});return this.context.trailerInfo.Info=this.context.register(r),r},e.prototype.assertFontkit=function(){if(!this.fontkit)throw new I3.FontkitNotRegisteredError;return this.fontkit},e})();SP.default=oct;function MA(e){if(!(e instanceof ar.PDFHexString)&&!(e instanceof ar.PDFString))throw new ar.UnexpectedObjectTypeError([ar.PDFHexString,ar.PDFString],e)}});var QP=U(ex=>{"use strict";Object.defineProperty(ex,"__esModule",{value:!0});ex.BlendMode=void 0;var uct;(function(e){e.Normal="Normal",e.Multiply="Multiply",e.Screen="Screen",e.Overlay="Overlay",e.Darken="Darken",e.Lighten="Lighten",e.ColorDodge="ColorDodge",e.ColorBurn="ColorBurn",e.HardLight="HardLight",e.SoftLight="SoftLight",e.Difference="Difference",e.Exclusion="Exclusion"})(uct=ex.BlendMode||(ex.BlendMode={}))});var rl=U(_P=>{"use strict";Object.defineProperty(_P,"__esModule",{value:!0});var OA=(ct(),ze(ut)),tx=Gu(),lg=Lm(),U0=QA(),nme=OA.__importDefault(UA()),cct=OA.__importDefault(c3()),ime=OA.__importDefault(el()),fct=OA.__importDefault(l3()),Ag=QP(),Rs=zo(),lct=m3(),Ia=Xi(),He=fr(),Act=(function(){function e(t,r,n){this.fontSize=24,this.fontColor=tx.rgb(0,0,0),this.lineHeight=24,this.x=0,this.y=0,He.assertIs(t,"leafNode",[[Ia.PDFPageLeaf,"PDFPageLeaf"]]),He.assertIs(r,"ref",[[Ia.PDFRef,"PDFRef"]]),He.assertIs(n,"doc",[[nme.default,"PDFDocument"]]),this.node=t,this.ref=r,this.doc=n}return e.prototype.setRotation=function(t){var r=Rs.toDegrees(t);He.assertMultiple(r,"degreesAngle",90),this.node.set(Ia.PDFName.of("Rotate"),this.doc.context.obj(r))},e.prototype.getRotation=function(){var t=this.node.Rotate();return Rs.degrees(t?t.asNumber():0)},e.prototype.setSize=function(t,r){He.assertIs(t,"width",["number"]),He.assertIs(r,"height",["number"]);var n=this.getMediaBox();this.setMediaBox(n.x,n.y,t,r);var i=this.getCropBox(),s=this.getBleedBox(),u=this.getTrimBox(),f=this.getArtBox(),h=this.node.CropBox(),g=this.node.BleedBox(),p=this.node.TrimBox(),C=this.node.ArtBox();h&&He.rectanglesAreEqual(i,n)&&this.setCropBox(n.x,n.y,t,r),g&&He.rectanglesAreEqual(s,n)&&this.setBleedBox(n.x,n.y,t,r),p&&He.rectanglesAreEqual(u,n)&&this.setTrimBox(n.x,n.y,t,r),C&&He.rectanglesAreEqual(f,n)&&this.setArtBox(n.x,n.y,t,r)},e.prototype.setWidth=function(t){He.assertIs(t,"width",["number"]),this.setSize(t,this.getSize().height)},e.prototype.setHeight=function(t){He.assertIs(t,"height",["number"]),this.setSize(this.getSize().width,t)},e.prototype.setMediaBox=function(t,r,n,i){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),He.assertIs(n,"width",["number"]),He.assertIs(i,"height",["number"]);var s=this.doc.context.obj([t,r,t+n,r+i]);this.node.set(Ia.PDFName.MediaBox,s)},e.prototype.setCropBox=function(t,r,n,i){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),He.assertIs(n,"width",["number"]),He.assertIs(i,"height",["number"]);var s=this.doc.context.obj([t,r,t+n,r+i]);this.node.set(Ia.PDFName.CropBox,s)},e.prototype.setBleedBox=function(t,r,n,i){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),He.assertIs(n,"width",["number"]),He.assertIs(i,"height",["number"]);var s=this.doc.context.obj([t,r,t+n,r+i]);this.node.set(Ia.PDFName.BleedBox,s)},e.prototype.setTrimBox=function(t,r,n,i){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),He.assertIs(n,"width",["number"]),He.assertIs(i,"height",["number"]);var s=this.doc.context.obj([t,r,t+n,r+i]);this.node.set(Ia.PDFName.TrimBox,s)},e.prototype.setArtBox=function(t,r,n,i){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),He.assertIs(n,"width",["number"]),He.assertIs(i,"height",["number"]);var s=this.doc.context.obj([t,r,t+n,r+i]);this.node.set(Ia.PDFName.ArtBox,s)},e.prototype.getSize=function(){var t=this.getMediaBox(),r=t.width,n=t.height;return{width:r,height:n}},e.prototype.getWidth=function(){return this.getSize().width},e.prototype.getHeight=function(){return this.getSize().height},e.prototype.getMediaBox=function(){var t=this.node.MediaBox();return t.asRectangle()},e.prototype.getCropBox=function(){var t,r=this.node.CropBox();return(t=r?.asRectangle())!==null&&t!==void 0?t:this.getMediaBox()},e.prototype.getBleedBox=function(){var t,r=this.node.BleedBox();return(t=r?.asRectangle())!==null&&t!==void 0?t:this.getCropBox()},e.prototype.getTrimBox=function(){var t,r=this.node.TrimBox();return(t=r?.asRectangle())!==null&&t!==void 0?t:this.getCropBox()},e.prototype.getArtBox=function(){var t,r=this.node.ArtBox();return(t=r?.asRectangle())!==null&&t!==void 0?t:this.getCropBox()},e.prototype.translateContent=function(t,r){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),this.node.normalize(),this.getContentStream();var n=this.createContentStream(U0.pushGraphicsState(),U0.translate(t,r)),i=this.doc.context.register(n),s=this.createContentStream(U0.popGraphicsState()),u=this.doc.context.register(s);this.node.wrapContentStreams(i,u)},e.prototype.scale=function(t,r){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),this.setSize(this.getWidth()*t,this.getHeight()*r),this.scaleContent(t,r),this.scaleAnnotations(t,r)},e.prototype.scaleContent=function(t,r){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),this.node.normalize(),this.getContentStream();var n=this.createContentStream(U0.pushGraphicsState(),U0.scale(t,r)),i=this.doc.context.register(n),s=this.createContentStream(U0.popGraphicsState()),u=this.doc.context.register(s);this.node.wrapContentStreams(i,u)},e.prototype.scaleAnnotations=function(t,r){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]);var n=this.node.Annots();if(n)for(var i=0;i<n.size();i++){var s=n.lookup(i);s instanceof Ia.PDFDict&&this.scaleAnnot(s,t,r)}},e.prototype.resetPosition=function(){this.getContentStream(!1),this.x=0,this.y=0},e.prototype.setFont=function(t){He.assertIs(t,"font",[[ime.default,"PDFFont"]]),this.font=t,this.fontKey=this.node.newFontDictionary(this.font.name,this.font.ref)},e.prototype.setFontSize=function(t){He.assertIs(t,"fontSize",["number"]),this.fontSize=t},e.prototype.setFontColor=function(t){He.assertIs(t,"fontColor",[[Object,"Color"]]),this.fontColor=t},e.prototype.setLineHeight=function(t){He.assertIs(t,"lineHeight",["number"]),this.lineHeight=t},e.prototype.getPosition=function(){return{x:this.x,y:this.y}},e.prototype.getX=function(){return this.x},e.prototype.getY=function(){return this.y},e.prototype.moveTo=function(t,r){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),this.x=t,this.y=r},e.prototype.moveDown=function(t){He.assertIs(t,"yDecrease",["number"]),this.y-=t},e.prototype.moveUp=function(t){He.assertIs(t,"yIncrease",["number"]),this.y+=t},e.prototype.moveLeft=function(t){He.assertIs(t,"xDecrease",["number"]),this.x-=t},e.prototype.moveRight=function(t){He.assertIs(t,"xIncrease",["number"]),this.x+=t},e.prototype.pushOperators=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];He.assertEachIs(t,"operator",[[Ia.PDFOperator,"PDFOperator"]]);var n=this.getContentStream();n.push.apply(n,t)},e.prototype.drawText=function(t,r){var n,i,s,u,f,h,g;r===void 0&&(r={}),He.assertIs(t,"text",["string"]),He.assertOrUndefined(r.color,"options.color",[[Object,"Color"]]),He.assertRangeOrUndefined(r.opacity,"opacity.opacity",0,1),He.assertOrUndefined(r.font,"options.font",[[ime.default,"PDFFont"]]),He.assertOrUndefined(r.size,"options.size",["number"]),He.assertOrUndefined(r.rotate,"options.rotate",[[Object,"Rotation"]]),He.assertOrUndefined(r.xSkew,"options.xSkew",[[Object,"Rotation"]]),He.assertOrUndefined(r.ySkew,"options.ySkew",[[Object,"Rotation"]]),He.assertOrUndefined(r.x,"options.x",["number"]),He.assertOrUndefined(r.y,"options.y",["number"]),He.assertOrUndefined(r.lineHeight,"options.lineHeight",["number"]),He.assertOrUndefined(r.maxWidth,"options.maxWidth",["number"]),He.assertOrUndefined(r.wordBreaks,"options.wordBreaks",[Array]),He.assertIsOneOfOrUndefined(r.blendMode,"options.blendMode",Ag.BlendMode);for(var p=this.setOrEmbedFont(r.font),C=p.oldFont,y=p.newFont,x=p.newFontKey,v=r.size||this.fontSize,T=r.wordBreaks||this.doc.defaultWordBreaks,Q=function(q){return y.widthOfTextAtSize(q,v)},F=r.maxWidth===void 0?He.lineSplit(He.cleanText(t)):He.breakTextIntoLines(t,T,r.maxWidth,Q),_=new Array(F.length),S=0,N=F.length;S<N;S++)_[S]=y.encodeText(F[S]);var O=this.maybeEmbedGraphicsState({opacity:r.opacity,blendMode:r.blendMode}),H=this.getContentStream();H.push.apply(H,lg.drawLinesOfText(_,{color:(n=r.color)!==null&&n!==void 0?n:this.fontColor,font:x,size:v,rotate:(i=r.rotate)!==null&&i!==void 0?i:Rs.degrees(0),xSkew:(s=r.xSkew)!==null&&s!==void 0?s:Rs.degrees(0),ySkew:(u=r.ySkew)!==null&&u!==void 0?u:Rs.degrees(0),x:(f=r.x)!==null&&f!==void 0?f:this.x,y:(h=r.y)!==null&&h!==void 0?h:this.y,lineHeight:(g=r.lineHeight)!==null&&g!==void 0?g:this.lineHeight,graphicsState:O})),r.font&&(C?this.setFont(C):this.resetFont())},e.prototype.drawImage=function(t,r){var n,i,s,u,f,h,g;r===void 0&&(r={}),He.assertIs(t,"image",[[fct.default,"PDFImage"]]),He.assertOrUndefined(r.x,"options.x",["number"]),He.assertOrUndefined(r.y,"options.y",["number"]),He.assertOrUndefined(r.width,"options.width",["number"]),He.assertOrUndefined(r.height,"options.height",["number"]),He.assertOrUndefined(r.rotate,"options.rotate",[[Object,"Rotation"]]),He.assertOrUndefined(r.xSkew,"options.xSkew",[[Object,"Rotation"]]),He.assertOrUndefined(r.ySkew,"options.ySkew",[[Object,"Rotation"]]),He.assertRangeOrUndefined(r.opacity,"opacity.opacity",0,1),He.assertIsOneOfOrUndefined(r.blendMode,"options.blendMode",Ag.BlendMode);var p=this.node.newXObject("Image",t.ref),C=this.maybeEmbedGraphicsState({opacity:r.opacity,blendMode:r.blendMode}),y=this.getContentStream();y.push.apply(y,lg.drawImage(p,{x:(n=r.x)!==null&&n!==void 0?n:this.x,y:(i=r.y)!==null&&i!==void 0?i:this.y,width:(s=r.width)!==null&&s!==void 0?s:t.size().width,height:(u=r.height)!==null&&u!==void 0?u:t.size().height,rotate:(f=r.rotate)!==null&&f!==void 0?f:Rs.degrees(0),xSkew:(h=r.xSkew)!==null&&h!==void 0?h:Rs.degrees(0),ySkew:(g=r.ySkew)!==null&&g!==void 0?g:Rs.degrees(0),graphicsState:C}))},e.prototype.drawPage=function(t,r){var n,i,s,u,f;r===void 0&&(r={}),He.assertIs(t,"embeddedPage",[[cct.default,"PDFEmbeddedPage"]]),He.assertOrUndefined(r.x,"options.x",["number"]),He.assertOrUndefined(r.y,"options.y",["number"]),He.assertOrUndefined(r.xScale,"options.xScale",["number"]),He.assertOrUndefined(r.yScale,"options.yScale",["number"]),He.assertOrUndefined(r.width,"options.width",["number"]),He.assertOrUndefined(r.height,"options.height",["number"]),He.assertOrUndefined(r.rotate,"options.rotate",[[Object,"Rotation"]]),He.assertOrUndefined(r.xSkew,"options.xSkew",[[Object,"Rotation"]]),He.assertOrUndefined(r.ySkew,"options.ySkew",[[Object,"Rotation"]]),He.assertRangeOrUndefined(r.opacity,"opacity.opacity",0,1),He.assertIsOneOfOrUndefined(r.blendMode,"options.blendMode",Ag.BlendMode);var h=this.node.newXObject("EmbeddedPdfPage",t.ref),g=this.maybeEmbedGraphicsState({opacity:r.opacity,blendMode:r.blendMode}),p=r.width!==void 0?r.width/t.width:r.xScale!==void 0?r.xScale:1,C=r.height!==void 0?r.height/t.height:r.yScale!==void 0?r.yScale:1,y=this.getContentStream();y.push.apply(y,lg.drawPage(h,{x:(n=r.x)!==null&&n!==void 0?n:this.x,y:(i=r.y)!==null&&i!==void 0?i:this.y,xScale:p,yScale:C,rotate:(s=r.rotate)!==null&&s!==void 0?s:Rs.degrees(0),xSkew:(u=r.xSkew)!==null&&u!==void 0?u:Rs.degrees(0),ySkew:(f=r.ySkew)!==null&&f!==void 0?f:Rs.degrees(0),graphicsState:g}))},e.prototype.drawSvgPath=function(t,r){var n,i,s,u,f,h,g,p,C;r===void 0&&(r={}),He.assertIs(t,"path",["string"]),He.assertOrUndefined(r.x,"options.x",["number"]),He.assertOrUndefined(r.y,"options.y",["number"]),He.assertOrUndefined(r.scale,"options.scale",["number"]),He.assertOrUndefined(r.rotate,"options.rotate",[[Object,"Rotation"]]),He.assertOrUndefined(r.borderWidth,"options.borderWidth",["number"]),He.assertOrUndefined(r.color,"options.color",[[Object,"Color"]]),He.assertRangeOrUndefined(r.opacity,"opacity.opacity",0,1),He.assertOrUndefined(r.borderColor,"options.borderColor",[[Object,"Color"]]),He.assertOrUndefined(r.borderDashArray,"options.borderDashArray",[Array]),He.assertOrUndefined(r.borderDashPhase,"options.borderDashPhase",["number"]),He.assertIsOneOfOrUndefined(r.borderLineCap,"options.borderLineCap",U0.LineCapStyle),He.assertRangeOrUndefined(r.borderOpacity,"options.borderOpacity",0,1),He.assertIsOneOfOrUndefined(r.blendMode,"options.blendMode",Ag.BlendMode);var y=this.maybeEmbedGraphicsState({opacity:r.opacity,borderOpacity:r.borderOpacity,blendMode:r.blendMode});!("color"in r)&&!("borderColor"in r)&&(r.borderColor=tx.rgb(0,0,0));var x=this.getContentStream();x.push.apply(x,lg.drawSvgPath(t,{x:(n=r.x)!==null&&n!==void 0?n:this.x,y:(i=r.y)!==null&&i!==void 0?i:this.y,scale:r.scale,rotate:(s=r.rotate)!==null&&s!==void 0?s:Rs.degrees(0),color:(u=r.color)!==null&&u!==void 0?u:void 0,borderColor:(f=r.borderColor)!==null&&f!==void 0?f:void 0,borderWidth:(h=r.borderWidth)!==null&&h!==void 0?h:0,borderDashArray:(g=r.borderDashArray)!==null&&g!==void 0?g:void 0,borderDashPhase:(p=r.borderDashPhase)!==null&&p!==void 0?p:void 0,borderLineCap:(C=r.borderLineCap)!==null&&C!==void 0?C:void 0,graphicsState:y}))},e.prototype.drawLine=function(t){var r,n,i,s,u;He.assertIs(t.start,"options.start",[[Object,"{ x: number, y: number }"]]),He.assertIs(t.end,"options.end",[[Object,"{ x: number, y: number }"]]),He.assertIs(t.start.x,"options.start.x",["number"]),He.assertIs(t.start.y,"options.start.y",["number"]),He.assertIs(t.end.x,"options.end.x",["number"]),He.assertIs(t.end.y,"options.end.y",["number"]),He.assertOrUndefined(t.thickness,"options.thickness",["number"]),He.assertOrUndefined(t.color,"options.color",[[Object,"Color"]]),He.assertOrUndefined(t.dashArray,"options.dashArray",[Array]),He.assertOrUndefined(t.dashPhase,"options.dashPhase",["number"]),He.assertIsOneOfOrUndefined(t.lineCap,"options.lineCap",U0.LineCapStyle),He.assertRangeOrUndefined(t.opacity,"opacity.opacity",0,1),He.assertIsOneOfOrUndefined(t.blendMode,"options.blendMode",Ag.BlendMode);var f=this.maybeEmbedGraphicsState({borderOpacity:t.opacity,blendMode:t.blendMode});"color"in t||(t.color=tx.rgb(0,0,0));var h=this.getContentStream();h.push.apply(h,lg.drawLine({start:t.start,end:t.end,thickness:(r=t.thickness)!==null&&r!==void 0?r:1,color:(n=t.color)!==null&&n!==void 0?n:void 0,dashArray:(i=t.dashArray)!==null&&i!==void 0?i:void 0,dashPhase:(s=t.dashPhase)!==null&&s!==void 0?s:void 0,lineCap:(u=t.lineCap)!==null&&u!==void 0?u:void 0,graphicsState:f}))},e.prototype.drawRectangle=function(t){var r,n,i,s,u,f,h,g,p,C,y,x,v;t===void 0&&(t={}),He.assertOrUndefined(t.x,"options.x",["number"]),He.assertOrUndefined(t.y,"options.y",["number"]),He.assertOrUndefined(t.width,"options.width",["number"]),He.assertOrUndefined(t.height,"options.height",["number"]),He.assertOrUndefined(t.rotate,"options.rotate",[[Object,"Rotation"]]),He.assertOrUndefined(t.xSkew,"options.xSkew",[[Object,"Rotation"]]),He.assertOrUndefined(t.ySkew,"options.ySkew",[[Object,"Rotation"]]),He.assertOrUndefined(t.borderWidth,"options.borderWidth",["number"]),He.assertOrUndefined(t.color,"options.color",[[Object,"Color"]]),He.assertRangeOrUndefined(t.opacity,"opacity.opacity",0,1),He.assertOrUndefined(t.borderColor,"options.borderColor",[[Object,"Color"]]),He.assertOrUndefined(t.borderDashArray,"options.borderDashArray",[Array]),He.assertOrUndefined(t.borderDashPhase,"options.borderDashPhase",["number"]),He.assertIsOneOfOrUndefined(t.borderLineCap,"options.borderLineCap",U0.LineCapStyle),He.assertRangeOrUndefined(t.borderOpacity,"options.borderOpacity",0,1),He.assertIsOneOfOrUndefined(t.blendMode,"options.blendMode",Ag.BlendMode);var T=this.maybeEmbedGraphicsState({opacity:t.opacity,borderOpacity:t.borderOpacity,blendMode:t.blendMode});!("color"in t)&&!("borderColor"in t)&&(t.color=tx.rgb(0,0,0));var Q=this.getContentStream();Q.push.apply(Q,lg.drawRectangle({x:(r=t.x)!==null&&r!==void 0?r:this.x,y:(n=t.y)!==null&&n!==void 0?n:this.y,width:(i=t.width)!==null&&i!==void 0?i:150,height:(s=t.height)!==null&&s!==void 0?s:100,rotate:(u=t.rotate)!==null&&u!==void 0?u:Rs.degrees(0),xSkew:(f=t.xSkew)!==null&&f!==void 0?f:Rs.degrees(0),ySkew:(h=t.ySkew)!==null&&h!==void 0?h:Rs.degrees(0),borderWidth:(g=t.borderWidth)!==null&&g!==void 0?g:0,color:(p=t.color)!==null&&p!==void 0?p:void 0,borderColor:(C=t.borderColor)!==null&&C!==void 0?C:void 0,borderDashArray:(y=t.borderDashArray)!==null&&y!==void 0?y:void 0,borderDashPhase:(x=t.borderDashPhase)!==null&&x!==void 0?x:void 0,graphicsState:T,borderLineCap:(v=t.borderLineCap)!==null&&v!==void 0?v:void 0}))},e.prototype.drawSquare=function(t){t===void 0&&(t={});var r=t.size;He.assertOrUndefined(r,"size",["number"]),this.drawRectangle(OA.__assign(OA.__assign({},t),{width:r,height:r}))},e.prototype.drawEllipse=function(t){var r,n,i,s,u,f,h,g,p,C,y;t===void 0&&(t={}),He.assertOrUndefined(t.x,"options.x",["number"]),He.assertOrUndefined(t.y,"options.y",["number"]),He.assertOrUndefined(t.xScale,"options.xScale",["number"]),He.assertOrUndefined(t.yScale,"options.yScale",["number"]),He.assertOrUndefined(t.rotate,"options.rotate",[[Object,"Rotation"]]),He.assertOrUndefined(t.color,"options.color",[[Object,"Color"]]),He.assertRangeOrUndefined(t.opacity,"opacity.opacity",0,1),He.assertOrUndefined(t.borderColor,"options.borderColor",[[Object,"Color"]]),He.assertRangeOrUndefined(t.borderOpacity,"options.borderOpacity",0,1),He.assertOrUndefined(t.borderWidth,"options.borderWidth",["number"]),He.assertOrUndefined(t.borderDashArray,"options.borderDashArray",[Array]),He.assertOrUndefined(t.borderDashPhase,"options.borderDashPhase",["number"]),He.assertIsOneOfOrUndefined(t.borderLineCap,"options.borderLineCap",U0.LineCapStyle),He.assertIsOneOfOrUndefined(t.blendMode,"options.blendMode",Ag.BlendMode);var x=this.maybeEmbedGraphicsState({opacity:t.opacity,borderOpacity:t.borderOpacity,blendMode:t.blendMode});!("color"in t)&&!("borderColor"in t)&&(t.color=tx.rgb(0,0,0));var v=this.getContentStream();v.push.apply(v,lg.drawEllipse({x:(r=t.x)!==null&&r!==void 0?r:this.x,y:(n=t.y)!==null&&n!==void 0?n:this.y,xScale:(i=t.xScale)!==null&&i!==void 0?i:100,yScale:(s=t.yScale)!==null&&s!==void 0?s:100,rotate:(u=t.rotate)!==null&&u!==void 0?u:void 0,color:(f=t.color)!==null&&f!==void 0?f:void 0,borderColor:(h=t.borderColor)!==null&&h!==void 0?h:void 0,borderWidth:(g=t.borderWidth)!==null&&g!==void 0?g:0,borderDashArray:(p=t.borderDashArray)!==null&&p!==void 0?p:void 0,borderDashPhase:(C=t.borderDashPhase)!==null&&C!==void 0?C:void 0,borderLineCap:(y=t.borderLineCap)!==null&&y!==void 0?y:void 0,graphicsState:x}))},e.prototype.drawCircle=function(t){t===void 0&&(t={});var r=t.size,n=r===void 0?100:r;He.assertOrUndefined(n,"size",["number"]),this.drawEllipse(OA.__assign(OA.__assign({},t),{xScale:n,yScale:n}))},e.prototype.setOrEmbedFont=function(t){var r=this.font,n=this.fontKey;t?this.setFont(t):this.getFont();var i=this.font,s=this.fontKey;return{oldFont:r,oldFontKey:n,newFont:i,newFontKey:s}},e.prototype.getFont=function(){if(!this.font||!this.fontKey){var t=this.doc.embedStandardFont(lct.StandardFonts.Helvetica);this.setFont(t)}return[this.font,this.fontKey]},e.prototype.resetFont=function(){this.font=void 0,this.fontKey=void 0},e.prototype.getContentStream=function(t){return t===void 0&&(t=!0),t&&this.contentStream?this.contentStream:(this.contentStream=this.createContentStream(),this.contentStreamRef=this.doc.context.register(this.contentStream),this.node.addContentStream(this.contentStreamRef),this.contentStream)},e.prototype.createContentStream=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=this.doc.context.obj({}),i=Ia.PDFContentStream.of(n,t);return i},e.prototype.maybeEmbedGraphicsState=function(t){var r=t.opacity,n=t.borderOpacity,i=t.blendMode;if(!(r===void 0&&n===void 0&&i===void 0)){var s=this.doc.context.obj({Type:"ExtGState",ca:r,CA:n,BM:i}),u=this.node.newExtGState("GS",s);return u}},e.prototype.scaleAnnot=function(t,r,n){for(var i=["RD","CL","Vertices","QuadPoints","L","Rect"],s=0,u=i.length;s<u;s++){var f=t.lookup(Ia.PDFName.of(i[s]));f instanceof Ia.PDFArray&&f.scalePDFNumbers(r,n)}var h=t.lookup(Ia.PDFName.of("InkList"));if(h instanceof Ia.PDFArray)for(var s=0,u=h.size();s<u;s++){var g=h.lookup(s);g instanceof Ia.PDFArray&&g.scalePDFNumbers(r,n)}},e.of=function(t,r,n){return new e(t,r,n)},e.create=function(t){He.assertIs(t,"doc",[[nme.default,"PDFDocument"]]);var r=Ia.PDFRef.of(-1),n=Ia.PDFPageLeaf.withContextAndParent(t.context,r),i=t.context.register(n);return new e(n,i,t)},e})();_P.default=Act});var xP=U(NP=>{"use strict";Object.defineProperty(NP,"__esModule",{value:!0});var D3=(ct(),ze(ut)),dct=D3.__importDefault(rl()),ame=D3.__importDefault(el()),hct=A3(),sme=RA(),ome=D3.__importStar(tl()),ume=Gu(),gct=zo(),cme=Xi(),dg=fr(),pct=(function(e){D3.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return dg.assertIs(r,"acroButton",[[cme.PDFAcroPushButton,"PDFAcroPushButton"]]),s.acroField=r,s}return t.prototype.setImage=function(r,n){n===void 0&&(n=hct.ImageAlignment.Center);for(var i=this.acroField.getWidgets(),s=0,u=i.length;s<u;s++){var f=i[s],h=this.createImageAppearanceStream(f,r,n);this.updateWidgetAppearances(f,{normal:h})}this.markAsClean()},t.prototype.setFontSize=function(r){dg.assertPositive(r,"fontSize"),this.acroField.setFontSize(r),this.markAsDirty()},t.prototype.addToPage=function(r,n,i){var s,u,f,h,g,p,C,y,x,v,T;dg.assertOrUndefined(r,"text",["string"]),dg.assertOrUndefined(n,"page",[[dct.default,"PDFPage"]]),ome.assertFieldAppearanceOptions(i);var Q=this.createWidget({x:((s=i?.x)!==null&&s!==void 0?s:0)-((u=i?.borderWidth)!==null&&u!==void 0?u:0)/2,y:((f=i?.y)!==null&&f!==void 0?f:0)-((h=i?.borderWidth)!==null&&h!==void 0?h:0)/2,width:(g=i?.width)!==null&&g!==void 0?g:100,height:(p=i?.height)!==null&&p!==void 0?p:50,textColor:(C=i?.textColor)!==null&&C!==void 0?C:ume.rgb(0,0,0),backgroundColor:(y=i?.backgroundColor)!==null&&y!==void 0?y:ume.rgb(.75,.75,.75),borderColor:i?.borderColor,borderWidth:(x=i?.borderWidth)!==null&&x!==void 0?x:0,rotate:(v=i?.rotate)!==null&&v!==void 0?v:gct.degrees(0),caption:r,hidden:i?.hidden,page:n.ref}),F=this.doc.context.register(Q.dict);this.acroField.addWidget(F);var _=(T=i?.font)!==null&&T!==void 0?T:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(Q,_),n.node.addAnnot(F)},t.prototype.needsAppearancesUpdate=function(){var r;if(this.isDirty())return!0;for(var n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=((r=u.getAppearances())===null||r===void 0?void 0:r.normal)instanceof cme.PDFStream;if(!f)return!0}return!1},t.prototype.defaultUpdateAppearances=function(r){dg.assertIs(r,"font",[[ame.default,"PDFFont"]]),this.updateAppearances(r)},t.prototype.updateAppearances=function(r,n){dg.assertIs(r,"font",[[ame.default,"PDFFont"]]),dg.assertOrUndefined(n,"provider",[Function]);for(var i=this.acroField.getWidgets(),s=0,u=i.length;s<u;s++){var f=i[s];this.updateWidgetAppearance(f,r,n)}},t.prototype.updateWidgetAppearance=function(r,n,i){var s=i??sme.defaultButtonAppearanceProvider,u=sme.normalizeAppearance(s(this,r,n));this.updateWidgetAppearanceWithFont(r,n,u)},t.of=function(r,n,i){return new t(r,n,i)},t})(ome.default);NP.default=pct});var fme=U(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});var mct=(ct(),ze(ut));mct.__exportStar(RA(),Ku);var Ect=xP();Object.defineProperty(Ku,"PDFButton",{enumerable:!0,get:function(){return Ect.default}});var bct=tP();Object.defineProperty(Ku,"PDFCheckBox",{enumerable:!0,get:function(){return bct.default}});var Cct=iP();Object.defineProperty(Ku,"PDFDropdown",{enumerable:!0,get:function(){return Cct.default}});var yct=tl();Object.defineProperty(Ku,"PDFField",{enumerable:!0,get:function(){return yct.default}});var xct=yP();Object.defineProperty(Ku,"PDFForm",{enumerable:!0,get:function(){return xct.default}});var vct=oP();Object.defineProperty(Ku,"PDFOptionList",{enumerable:!0,get:function(){return vct.default}});var Ict=lP();Object.defineProperty(Ku,"PDFRadioGroup",{enumerable:!0,get:function(){return Ict.default}});var Dct=dP();Object.defineProperty(Ku,"PDFSignature",{enumerable:!0,get:function(){return Dct.default}});var Bct=EP();Object.defineProperty(Ku,"PDFTextField",{enumerable:!0,get:function(){return Bct.default}})});var Ame=U(B3=>{"use strict";Object.defineProperty(B3,"__esModule",{value:!0});var lme=(ct(),ze(ut));lme.__exportStar(jy(),B3);lme.__exportStar(P7(),B3)});var dme=U(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});var eu=(ct(),ze(ut));eu.__exportStar(fme(),Ri);eu.__exportStar(Ame(),Ri);eu.__exportStar(Gu(),Ri);eu.__exportStar(Pm(),Ri);eu.__exportStar(X7(),Ri);eu.__exportStar(e3(),Ri);eu.__exportStar(Lm(),Ri);eu.__exportStar(QA(),Ri);eu.__exportStar(zo(),Ri);eu.__exportStar(vP(),Ri);eu.__exportStar(QP(),Ri);eu.__exportStar(IP(),Ri);eu.__exportStar(m3(),Ri);var wct=UA();Object.defineProperty(Ri,"PDFDocument",{enumerable:!0,get:function(){return wct.default}});var Fct=el();Object.defineProperty(Ri,"PDFFont",{enumerable:!0,get:function(){return Fct.default}});var Tct=l3();Object.defineProperty(Ri,"PDFImage",{enumerable:!0,get:function(){return Tct.default}});var Sct=rl();Object.defineProperty(Ri,"PDFPage",{enumerable:!0,get:function(){return Sct.default}});var Qct=c3();Object.defineProperty(Ri,"PDFEmbeddedPage",{enumerable:!0,get:function(){return Qct.default}});var _ct=wP();Object.defineProperty(Ri,"PDFJavaScript",{enumerable:!0,get:function(){return _ct.default}})});var gme=U(hme=>{"use strict";Object.defineProperty(hme,"__esModule",{value:!0})});var kP=U(jm=>{"use strict";Object.defineProperty(jm,"__esModule",{value:!0});var w3=(ct(),ze(ut));w3.__exportStar(dme(),jm);w3.__exportStar(Xi(),jm);w3.__exportStar(gme(),jm);w3.__exportStar(fr(),jm)});var Gct={};Ka(Gct,{DocuParse:()=>OP});module.exports=ze(Gct);var M0=require("n8n-workflow");async function rx(e){let t=await fetch(e,{headers:{"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",Accept:"*/*"},redirect:"follow"});if(!t.ok)throw new Error(`Failed to fetch URL: ${t.status} ${t.statusText}`);let r=Buffer.from(await t.arrayBuffer()),n=t.headers.get("content-type")||"",s=new URL(e).pathname.split("/").pop()||"document";return{buffer:r,mimeType:n,fileName:s}}var OP=class{constructor(){this.description={displayName:"DocuParse",name:"docuParse",icon:"file:icons/ener.png",group:["transform"],version:1,subtitle:'={{ $parameter["operation"] }}',description:"Full-featured document parsing \u2014 PDF, DOCX, XLSX, PPTX, images, OCR, markdown output. No native dependencies.",defaults:{name:"DocuParse"},inputs:["main"],outputs:["main"],properties:[{displayName:"Operation",name:"operation",type:"options",noDataExpression:!0,options:[{name:"Parse Document",value:"parse",description:"Extract text, tables, and structure from documents",action:"Parse a document"},{name:"OCR Image",value:"ocr",description:"Extract text from images using OCR",action:"OCR an image"},{name:"Extract Tables",value:"tables",description:"Extract tables as structured JSON",action:"Extract tables from document"},{name:"Convert to Markdown",value:"markdown",description:"Convert document to clean markdown",action:"Convert to markdown"},{name:"Merge PDFs",value:"merge",description:"Merge multiple PDF files into one",action:"Merge PDF files"},{name:"Split PDF",value:"split",description:"Split PDF into separate pages",action:"Split PDF into pages"},{name:"Extract Entities",value:"entities",description:"Extract emails, phones, URLs, dates from text",action:"Extract entities from document"}],default:"parse"},{displayName:"Input Type",name:"inputType",type:"options",options:[{name:"Binary Data",value:"binary",description:"Parse file from binary data in workflow"},{name:"URL",value:"url",description:"Fetch and parse file from a URL"}],default:"binary",description:"How to get the document to parse"},{displayName:"Input Binary Field",name:"binaryPropertyName",type:"string",default:"data",required:!0,description:"The name of the binary property containing the document file",displayOptions:{show:{inputType:["binary"]}}},{displayName:"URL",name:"inputUrl",type:"string",default:"",required:!0,placeholder:"https://example.com/document.pdf",description:"URL of the document to fetch and parse",displayOptions:{show:{inputType:["url"]}}},{displayName:"Output Format",name:"outputFormat",type:"options",options:[{name:"Markdown",value:"markdown",description:"Structured markdown with headings, tables, lists"},{name:"JSON",value:"json",description:"Structured JSON with text items and positions"},{name:"Text",value:"text",description:"Plain text with layout preserved"}],default:"markdown",description:"Output format for the parsed document",displayOptions:{show:{operation:["parse"]}}},{displayName:"OCR Language",name:"ocrLanguage",type:"options",options:[{name:"English",value:"eng"},{name:"Arabic",value:"ara"},{name:"Chinese (Simplified)",value:"chi_sim"},{name:"Chinese (Traditional)",value:"chi_tra"},{name:"French",value:"fra"},{name:"German",value:"deu"},{name:"Hindi",value:"hin"},{name:"Japanese",value:"jpn"},{name:"Korean",value:"kor"},{name:"Portuguese",value:"por"},{name:"Russian",value:"rus"},{name:"Spanish",value:"spa"},{name:"Urdu",value:"urd"}],default:"eng",description:"Language for OCR recognition",displayOptions:{show:{operation:["ocr","parse"]}}},{displayName:"Enable OCR for Scanned Pages",name:"enableOcr",type:"boolean",default:!1,description:"Whether to run OCR on pages with little or no text (scanned documents)",displayOptions:{show:{operation:["parse"]}}},{displayName:"Target Pages",name:"targetPages",type:"string",default:"",placeholder:"1-5,10,15-20",description:'Specific pages to process (e.g. "1-5,10,15-20"). Leave empty for all pages.',displayOptions:{show:{operation:["parse","markdown","tables","split"]}}},{displayName:"Entity Types",name:"entityTypes",type:"multiOptions",options:[{name:"Emails",value:"emails"},{name:"Phone Numbers",value:"phones"},{name:"URLs",value:"urls"},{name:"Dates",value:"dates"},{name:"IP Addresses",value:"ips"},{name:"Currency Amounts",value:"currency"}],default:["emails","phones","urls","dates"],description:"Types of entities to extract",displayOptions:{show:{operation:["entities"]}}},{displayName:"Additional PDF Fields",name:"additionalPdfFields",type:"string",default:"data1",placeholder:"data1,data2,data3",description:"Comma-separated binary field names for additional PDFs to merge",displayOptions:{show:{operation:["merge"]}}},{displayName:"Password",name:"password",type:"string",typeOptions:{password:!0},default:"",description:"Password for encrypted/protected documents",displayOptions:{show:{operation:["parse","markdown","tables","split"]}}},{displayName:"Extract Images",name:"extractImages",type:"boolean",default:!1,description:"Whether to extract images from the document as binary data",displayOptions:{show:{operation:["parse"]}}}]}}async execute(){let t=this.getInputData(),r=[],n=this.getNodeParameter("operation",0),i=this.getNodeParameter("inputType",0,"binary");if(n==="parse"){let s=this.getNodeParameter("outputFormat",0),u=this.getNodeParameter("enableOcr",0),f=this.getNodeParameter("ocrLanguage",0,"eng"),h=this.getNodeParameter("targetPages",0,""),g=this.getNodeParameter("password",0,"")||void 0;for(let p=0;p<t.length;p++)try{let C,y="",x="document";if(i==="url"){let Q=this.getNodeParameter("inputUrl",p);if(!Q)throw new M0.NodeOperationError(this.getNode(),"URL is required",{itemIndex:p});C=(await rx(Q)).buffer,y=response.headers.get("content-type")||"",x=new URL(Q).pathname.split("/").pop()||"document"}else{let Q=this.getNodeParameter("binaryPropertyName",0);C=await this.helpers.getBinaryDataBuffer(p,Q);let F=t[p].binary?.[Q];if(!F)throw new M0.NodeOperationError(this.getNode(),`Binary property "${Q}" not found on item ${p}`,{itemIndex:p});y=F.mimeType||"",x=F.fileName||"document"}let v=x.split(".").pop()?.toLowerCase()||"",T={};if(y==="application/pdf"||v==="pdf")T=await RP(C,s,h,u,f,g);else if(y.includes("wordprocessingml")||v==="docx"||v==="doc")T=await UP(C,s);else if(y.includes("spreadsheetml")||v==="xlsx"||v==="xls")T=await Nct(C,s);else if(y.includes("presentationml")||v==="pptx"||v==="ppt")T=await kct(C,s);else if(y.includes("text/html")||v==="html"||v==="htm")T=await pme(C,s);else if(y.includes("text/csv")||v==="csv")T=await Rct(C,s);else if(y.startsWith("image/")||["png","jpg","jpeg","tiff","bmp","webp"].includes(v))T=await LP(C,f);else if(y.startsWith("text/")||["txt","md","json","xml"].includes(v))T={text:C.toString("utf-8"),format:"text"};else throw new Error(`Unsupported file type: ${y} (.${v})`);r.push({json:{...T,fileName:x,mimeType:y,format:s},binary:t[p].binary})}catch(C){if(this.continueOnFail()){r.push({json:{error:C.message},pairedItem:{item:p}});continue}throw new M0.NodeOperationError(this.getNode(),C,{itemIndex:p})}}else if(n==="ocr"){let s=this.getNodeParameter("ocrLanguage",0,"eng");for(let u=0;u<t.length;u++)try{let f;if(i==="url"){let g=this.getNodeParameter("inputUrl",u);f=(await rx(g)).buffer}else{let g=this.getNodeParameter("binaryPropertyName",0);f=await this.helpers.getBinaryDataBuffer(u,g)}let h=await LP(f,s);r.push({json:{...h,format:"ocr"},binary:t[u].binary})}catch(f){if(this.continueOnFail()){r.push({json:{error:f.message},pairedItem:{item:u}});continue}throw new M0.NodeOperationError(this.getNode(),f,{itemIndex:u})}}else if(n==="tables"){let s=this.getNodeParameter("targetPages",0,"");for(let u=0;u<t.length;u++)try{let f,h;if(i==="url"){let C=this.getNodeParameter("inputUrl",u),y=await rx(C);f=y.buffer,h={fileName:y.fileName,mimeType:y.mimeType}}else{let C=this.getNodeParameter("binaryPropertyName",0);f=await this.helpers.getBinaryDataBuffer(u,C),h=t[u].binary?.[C]}let g=h?.fileName?.split(".").pop()?.toLowerCase()||"",p=[];if(h?.mimeType==="application/pdf"||g==="pdf")p=await Uct(f,s);else if(h?.mimeType?.includes("spreadsheetml")||g==="xlsx"||g==="xls")p=await Mct(f);else throw new Error("Table extraction supports PDF and XLSX files only");r.push({json:{tables:p,tableCount:p.length},binary:t[u].binary})}catch(f){if(this.continueOnFail()){r.push({json:{error:f.message},pairedItem:{item:u}});continue}throw new M0.NodeOperationError(this.getNode(),f,{itemIndex:u})}}else if(n==="markdown"){let s=this.getNodeParameter("targetPages",0,"");for(let u=0;u<t.length;u++)try{let f,h;if(i==="url"){let C=this.getNodeParameter("inputUrl",u);f=(await rx(C)).buffer,h={fileName:new URL(C).pathname.split("/").pop(),mimeType:response.headers.get("content-type")}}else{let C=this.getNodeParameter("binaryPropertyName",0);f=await this.helpers.getBinaryDataBuffer(u,C),h=t[u].binary?.[C]}let g=h?.fileName?.split(".").pop()?.toLowerCase()||"",p="";if(h?.mimeType==="application/pdf"||g==="pdf")p=(await RP(f,"markdown",s,!1,"eng")).text;else if(h?.mimeType?.includes("wordprocessingml")||g==="docx")p=(await UP(f,"markdown")).text;else if(h?.mimeType?.includes("text/html")||g==="html")p=(await pme(f,"markdown")).text;else throw new Error("Markdown conversion supports PDF, DOCX, and HTML files");r.push({json:{markdown:p,format:"markdown"},binary:t[u].binary})}catch(f){if(this.continueOnFail()){r.push({json:{error:f.message},pairedItem:{item:u}});continue}throw new M0.NodeOperationError(this.getNode(),f,{itemIndex:u})}}else if(n==="merge"){let s=this.getNodeParameter("additionalPdfFields",0,"").split(",").map(p=>p.trim()).filter(Boolean),u=[binaryPropertyName,...s],f=[];for(let p=0;p<t.length;p++)for(let C of u)try{let y=await this.helpers.getBinaryDataBuffer(p,C);f.push(y)}catch{}if(f.length<2)throw new M0.NodeOperationError(this.getNode(),"Need at least 2 PDFs to merge");let h=await Oct(f),g=await this.helpers.prepareBinaryData(h,"merged.pdf","application/pdf");r.push({json:{pageCount:f.length,status:"merged"},binary:{...t[0].binary,merged_pdf:g}})}else if(n==="split"){let s=this.getNodeParameter("targetPages",0,"");for(let u=0;u<t.length;u++)try{let f=await this.helpers.getBinaryDataBuffer(u,binaryPropertyName),h=await Lct(f,s);for(let g of h){let p=await this.helpers.prepareBinaryData(g.buffer,`page_${g.pageNum}.pdf`,"application/pdf");r.push({json:{pageNum:g.pageNum},binary:{...t[u].binary,[`page_${g.pageNum}`]:p},pairedItem:{item:u}})}}catch(f){if(this.continueOnFail()){r.push({json:{error:f.message},pairedItem:{item:u}});continue}throw new M0.NodeOperationError(this.getNode(),f,{itemIndex:u})}}else if(n==="entities"){let s=this.getNodeParameter("entityTypes",0);for(let u=0;u<t.length;u++)try{let f,h;if(i==="url"){let x=this.getNodeParameter("inputUrl",u);f=(await rx(x)).buffer,h={fileName:new URL(x).pathname.split("/").pop(),mimeType:response.headers.get("content-type")}}else{let x=this.getNodeParameter("binaryPropertyName",0);f=await this.helpers.getBinaryDataBuffer(u,x),h=t[u].binary?.[x]}let g=h?.mimeType||"",p=h?.fileName?.split(".").pop()?.toLowerCase()||"",C="";g==="application/pdf"||p==="pdf"?C=(await RP(f,"text","",!1,"eng")).text:g.includes("wordprocessingml")||p==="docx"?C=(await UP(f,"text")).text:C=f.toString("utf-8");let y=Pct(C,s);r.push({json:{entities:y,entityCounts:Object.fromEntries(s.map(x=>[x,y[x]?.length||0]))},binary:t[u].binary})}catch(f){if(this.continueOnFail()){r.push({json:{error:f.message},pairedItem:{item:u}});continue}throw new M0.NodeOperationError(this.getNode(),f,{itemIndex:u})}}return[r]}};async function RP(e,t,r,n,i,s){let h=await(await import("pdfjs-dist")).getDocument({data:new Uint8Array(e),password:s}).promise,g=h.numPages,p=r?PP(r,g):Array.from({length:g},(x,v)=>v+1),C=[];for(let x of p)try{let v=await h.getPage(x),T=await v.getTextContent(),Q=v.getViewport({scale:1}),F=T.items.map(ne=>({text:ne.str,x:Math.round(ne.transform[4]*10)/10,y:Math.round(ne.transform[5]*10)/10,width:ne.width||0,height:Math.abs(ne.transform[3])||12,fontName:ne.fontName||""})).filter(ne=>ne.text.trim().length>0),_=Q.height,S=_*.95,N=_*.05,O=F.filter(ne=>ne.y<S&&ne.y>N),H=3,q=[],G=[...O].sort((ne,Le)=>Le.y-ne.y);for(let ne of G){let Le=q.find(X=>Math.abs(X.y-ne.y)<H);Le?Le.items.push(ne):q.push({y:ne.y,items:[ne]})}for(let ne of q)ne.items.sort((Le,X)=>Le.x-X.x);let J=50,Ie=[];for(let ne of q){if(ne.items.length===0)continue;let Le=ne.items[0].text;for(let X=1;X<ne.items.length;X++)ne.items[X].x-(ne.items[X-1].x+ne.items[X-1].width)>J?Le+=" ":Le+=" ",Le+=ne.items[X].text;Ie.push(Le.trim())}let fe=Ie.join(`
|
|
541
|
+
`+K7.setFillingColor(n).toString();this.acroField.setDefaultAppearance(N)}return T},e.prototype.updateWidgetAppearanceWithFont=function(t,r,n){var i=n.normal,s=n.rollover,u=n.down;this.updateWidgetAppearances(t,{normal:this.createAppearanceStream(t,i,r),rollover:s&&this.createAppearanceStream(t,s,r),down:u&&this.createAppearanceStream(t,u,r)})},e.prototype.updateOnOffWidgetAppearance=function(t,r,n){var i=n.normal,s=n.rollover,u=n.down;this.updateWidgetAppearances(t,{normal:this.createAppearanceDict(t,i,r),rollover:s&&this.createAppearanceDict(t,s,r),down:u&&this.createAppearanceDict(t,u,r)})},e.prototype.updateWidgetAppearances=function(t,r){var n=r.normal,i=r.rollover,s=r.down;t.setNormalAppearance(n),i?t.setRolloverAppearance(i):t.removeRolloverAppearance(),s?t.setDownAppearance(s):t.removeDownAppearance()},e.prototype.createAppearanceStream=function(t,r,n){var i,s=this.acroField.dict.context,u=t.getRectangle(),f=u.width,h=u.height,g=n&&{Font:(i={},i[n.name]=n.ref,i)},p=s.formXObject(r,{Resources:g,BBox:s.obj([0,0,f,h]),Matrix:s.obj([1,0,0,1,0,0])}),C=s.register(p);return C},e.prototype.createImageAppearanceStream=function(t,r,n){var i,s,u=this.acroField.dict.context,f=t.getRectangle(),h=t.getAppearanceCharacteristics(),g=t.getBorderStyle(),p=(s=g?.getWidth())!==null&&s!==void 0?s:0,C=ug.reduceRotation(h?.getRotation()),y=Rpe.rotateInPlace(d3.__assign(d3.__assign({},f),{rotation:C})),x=ug.adjustDimsForRotation(f,C),v=r.scaleToFit(x.width-p*2,x.height-p*2),T={x:p,y:p,width:v.width,height:v.height,rotate:ug.degrees(0),xSkew:ug.degrees(0),ySkew:ug.degrees(0)};n===kpe.ImageAlignment.Center?(T.x+=(x.width-p*2)/2-v.width/2,T.y+=(x.height-p*2)/2-v.height/2):n===kpe.ImageAlignment.Right&&(T.x=x.width-p-v.width,T.y=x.height-p-v.height);var Q=this.doc.context.addRandomSuffix("Image",10),F=d3.__spreadArrays(y,Rpe.drawImage(Q,T)),_={XObject:(i={},i[Q]=r.ref,i)},S=u.formXObject(F,{Resources:_,BBox:u.obj([0,0,f.width,f.height]),Matrix:u.obj([1,0,0,1,0,0])});return u.register(S)},e.prototype.createAppearanceDict=function(t,r,n){var i=this.acroField.dict.context,s=this.createAppearanceStream(t,r.on),u=this.createAppearanceStream(t,r.off),f=i.obj({});return f.set(n,s),f.set(va.PDFName.of("Off"),u),f},e})();Xy.default=xut});var tP=U(eP=>{"use strict";Object.defineProperty(eP,"__esModule",{value:!0});var $7=(ct(),ze(ut)),vut=$7.__importDefault(rl()),Upe=RA(),z7=Gu(),Iut=zo(),Mpe=$7.__importStar(tl()),cg=Xi(),Z7=fr(),Dut=(function(e){$7.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return Z7.assertIs(r,"acroCheckBox",[[cg.PDFAcroCheckBox,"PDFAcroCheckBox"]]),s.acroField=r,s}return t.prototype.check=function(){var r,n=(r=this.acroField.getOnValue())!==null&&r!==void 0?r:cg.PDFName.of("Yes");this.markAsDirty(),this.acroField.setValue(n)},t.prototype.uncheck=function(){this.markAsDirty(),this.acroField.setValue(cg.PDFName.of("Off"))},t.prototype.isChecked=function(){var r=this.acroField.getOnValue();return!!r&&r===this.acroField.getValue()},t.prototype.addToPage=function(r,n){var i,s,u,f,h,g;Z7.assertIs(r,"page",[[vut.default,"PDFPage"]]),Mpe.assertFieldAppearanceOptions(n),n||(n={}),"textColor"in n||(n.textColor=z7.rgb(0,0,0)),"backgroundColor"in n||(n.backgroundColor=z7.rgb(1,1,1)),"borderColor"in n||(n.borderColor=z7.rgb(0,0,0)),"borderWidth"in n||(n.borderWidth=1);var p=this.createWidget({x:(i=n.x)!==null&&i!==void 0?i:0,y:(s=n.y)!==null&&s!==void 0?s:0,width:(u=n.width)!==null&&u!==void 0?u:50,height:(f=n.height)!==null&&f!==void 0?f:50,textColor:n.textColor,backgroundColor:n.backgroundColor,borderColor:n.borderColor,borderWidth:(h=n.borderWidth)!==null&&h!==void 0?h:0,rotate:(g=n.rotate)!==null&&g!==void 0?g:Iut.degrees(0),hidden:n.hidden,page:r.ref}),C=this.doc.context.register(p.dict);this.acroField.addWidget(C),p.setAppearanceState(cg.PDFName.of("Off")),this.updateWidgetAppearance(p,cg.PDFName.of("Yes")),r.node.addAnnot(C)},t.prototype.needsAppearancesUpdate=function(){for(var r,n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=u.getAppearanceState(),h=(r=u.getAppearances())===null||r===void 0?void 0:r.normal;if(!(h instanceof cg.PDFDict)||f&&!h.has(f))return!0}return!1},t.prototype.defaultUpdateAppearances=function(){this.updateAppearances()},t.prototype.updateAppearances=function(r){var n;Z7.assertOrUndefined(r,"provider",[Function]);for(var i=this.acroField.getWidgets(),s=0,u=i.length;s<u;s++){var f=i[s],h=(n=f.getOnValue())!==null&&n!==void 0?n:cg.PDFName.of("Yes");h&&this.updateWidgetAppearance(f,h,r)}this.markAsClean()},t.prototype.updateWidgetAppearance=function(r,n,i){var s=i??Upe.defaultCheckBoxAppearanceProvider,u=Upe.normalizeAppearance(s(this,r));this.updateOnOffWidgetAppearance(r,n,u)},t.of=function(r,n,i){return new t(r,n,i)},t})(Mpe.default);eP.default=Dut});var iP=U(nP=>{"use strict";Object.defineProperty(nP,"__esModule",{value:!0});var h3=(ct(),ze(ut)),But=h3.__importDefault(rl()),Ope=h3.__importDefault(el()),Lpe=h3.__importStar(tl()),Ppe=RA(),rP=Gu(),wut=zo(),Ki=Xi(),R0=fr(),Fut=(function(e){h3.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return R0.assertIs(r,"acroComboBox",[[Ki.PDFAcroComboBox,"PDFAcroComboBox"]]),s.acroField=r,s}return t.prototype.getOptions=function(){for(var r=this.acroField.getOptions(),n=new Array(r.length),i=0,s=n.length;i<s;i++){var u=r[i],f=u.display,h=u.value;n[i]=(f??h).decodeText()}return n},t.prototype.getSelected=function(){for(var r=this.acroField.getValues(),n=new Array(r.length),i=0,s=r.length;i<s;i++)n[i]=r[i].decodeText();return n},t.prototype.setOptions=function(r){R0.assertIs(r,"options",[Array]);for(var n=new Array(r.length),i=0,s=r.length;i<s;i++)n[i]={value:Ki.PDFHexString.fromText(r[i])};this.acroField.setOptions(n)},t.prototype.addOptions=function(r){R0.assertIs(r,"options",["string",Array]);for(var n=Array.isArray(r)?r:[r],i=this.acroField.getOptions(),s=new Array(n.length),u=0,f=n.length;u<f;u++)s[u]={value:Ki.PDFHexString.fromText(n[u])};this.acroField.setOptions(i.concat(s))},t.prototype.select=function(r,n){n===void 0&&(n=!1),R0.assertIs(r,"options",["string",Array]),R0.assertIs(n,"merge",["boolean"]);var i=Array.isArray(r)?r:[r],s=this.getOptions(),u=i.find(function(C){return!s.includes(C)});u&&this.enableEditing(),this.markAsDirty(),(i.length>1||i.length===1&&n)&&this.enableMultiselect();for(var f=new Array(i.length),h=0,g=i.length;h<g;h++)f[h]=Ki.PDFHexString.fromText(i[h]);if(n){var p=this.acroField.getValues();this.acroField.setValues(p.concat(f))}else this.acroField.setValues(f)},t.prototype.clear=function(){this.markAsDirty(),this.acroField.setValues([])},t.prototype.setFontSize=function(r){R0.assertPositive(r,"fontSize"),this.acroField.setFontSize(r),this.markAsDirty()},t.prototype.isEditable=function(){return this.acroField.hasFlag(Ki.AcroChoiceFlags.Edit)},t.prototype.enableEditing=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.Edit,!0)},t.prototype.disableEditing=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.Edit,!1)},t.prototype.isSorted=function(){return this.acroField.hasFlag(Ki.AcroChoiceFlags.Sort)},t.prototype.enableSorting=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.Sort,!0)},t.prototype.disableSorting=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.Sort,!1)},t.prototype.isMultiselect=function(){return this.acroField.hasFlag(Ki.AcroChoiceFlags.MultiSelect)},t.prototype.enableMultiselect=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.MultiSelect,!0)},t.prototype.disableMultiselect=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.MultiSelect,!1)},t.prototype.isSpellChecked=function(){return!this.acroField.hasFlag(Ki.AcroChoiceFlags.DoNotSpellCheck)},t.prototype.enableSpellChecking=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.DoNotSpellCheck,!1)},t.prototype.disableSpellChecking=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.DoNotSpellCheck,!0)},t.prototype.isSelectOnClick=function(){return this.acroField.hasFlag(Ki.AcroChoiceFlags.CommitOnSelChange)},t.prototype.enableSelectOnClick=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.CommitOnSelChange,!0)},t.prototype.disableSelectOnClick=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.CommitOnSelChange,!1)},t.prototype.addToPage=function(r,n){var i,s,u,f,h,g,p;R0.assertIs(r,"page",[[But.default,"PDFPage"]]),Lpe.assertFieldAppearanceOptions(n),n||(n={}),"textColor"in n||(n.textColor=rP.rgb(0,0,0)),"backgroundColor"in n||(n.backgroundColor=rP.rgb(1,1,1)),"borderColor"in n||(n.borderColor=rP.rgb(0,0,0)),"borderWidth"in n||(n.borderWidth=1);var C=this.createWidget({x:(i=n.x)!==null&&i!==void 0?i:0,y:(s=n.y)!==null&&s!==void 0?s:0,width:(u=n.width)!==null&&u!==void 0?u:200,height:(f=n.height)!==null&&f!==void 0?f:50,textColor:n.textColor,backgroundColor:n.backgroundColor,borderColor:n.borderColor,borderWidth:(h=n.borderWidth)!==null&&h!==void 0?h:0,rotate:(g=n.rotate)!==null&&g!==void 0?g:wut.degrees(0),hidden:n.hidden,page:r.ref}),y=this.doc.context.register(C.dict);this.acroField.addWidget(y);var x=(p=n.font)!==null&&p!==void 0?p:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(C,x),r.node.addAnnot(y)},t.prototype.needsAppearancesUpdate=function(){var r;if(this.isDirty())return!0;for(var n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=((r=u.getAppearances())===null||r===void 0?void 0:r.normal)instanceof Ki.PDFStream;if(!f)return!0}return!1},t.prototype.defaultUpdateAppearances=function(r){R0.assertIs(r,"font",[[Ope.default,"PDFFont"]]),this.updateAppearances(r)},t.prototype.updateAppearances=function(r,n){R0.assertIs(r,"font",[[Ope.default,"PDFFont"]]),R0.assertOrUndefined(n,"provider",[Function]);for(var i=this.acroField.getWidgets(),s=0,u=i.length;s<u;s++){var f=i[s];this.updateWidgetAppearance(f,r,n)}this.markAsClean()},t.prototype.updateWidgetAppearance=function(r,n,i){var s=i??Ppe.defaultDropdownAppearanceProvider,u=Ppe.normalizeAppearance(s(this,r,n));this.updateWidgetAppearanceWithFont(r,n,u)},t.of=function(r,n,i){return new t(r,n,i)},t})(Lpe.default);nP.default=Fut});var oP=U(sP=>{"use strict";Object.defineProperty(sP,"__esModule",{value:!0});var g3=(ct(),ze(ut)),Tut=g3.__importDefault(rl()),Hpe=g3.__importDefault(el()),qpe=g3.__importStar(tl()),Wpe=RA(),aP=Gu(),Sut=zo(),bo=Xi(),Nc=fr(),Qut=(function(e){g3.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return Nc.assertIs(r,"acroListBox",[[bo.PDFAcroListBox,"PDFAcroListBox"]]),s.acroField=r,s}return t.prototype.getOptions=function(){for(var r=this.acroField.getOptions(),n=new Array(r.length),i=0,s=n.length;i<s;i++){var u=r[i],f=u.display,h=u.value;n[i]=(f??h).decodeText()}return n},t.prototype.getSelected=function(){for(var r=this.acroField.getValues(),n=new Array(r.length),i=0,s=r.length;i<s;i++)n[i]=r[i].decodeText();return n},t.prototype.setOptions=function(r){Nc.assertIs(r,"options",[Array]),this.markAsDirty();for(var n=new Array(r.length),i=0,s=r.length;i<s;i++)n[i]={value:bo.PDFHexString.fromText(r[i])};this.acroField.setOptions(n)},t.prototype.addOptions=function(r){Nc.assertIs(r,"options",["string",Array]),this.markAsDirty();for(var n=Array.isArray(r)?r:[r],i=this.acroField.getOptions(),s=new Array(n.length),u=0,f=n.length;u<f;u++)s[u]={value:bo.PDFHexString.fromText(n[u])};this.acroField.setOptions(i.concat(s))},t.prototype.select=function(r,n){n===void 0&&(n=!1),Nc.assertIs(r,"options",["string",Array]),Nc.assertIs(n,"merge",["boolean"]);var i=Array.isArray(r)?r:[r],s=this.getOptions();Nc.assertIsSubset(i,"option",s),this.markAsDirty(),(i.length>1||i.length===1&&n)&&this.enableMultiselect();for(var u=new Array(i.length),f=0,h=i.length;f<h;f++)u[f]=bo.PDFHexString.fromText(i[f]);if(n){var g=this.acroField.getValues();this.acroField.setValues(g.concat(u))}else this.acroField.setValues(u)},t.prototype.clear=function(){this.markAsDirty(),this.acroField.setValues([])},t.prototype.setFontSize=function(r){Nc.assertPositive(r,"fontSize"),this.acroField.setFontSize(r),this.markAsDirty()},t.prototype.isSorted=function(){return this.acroField.hasFlag(bo.AcroChoiceFlags.Sort)},t.prototype.enableSorting=function(){this.acroField.setFlagTo(bo.AcroChoiceFlags.Sort,!0)},t.prototype.disableSorting=function(){this.acroField.setFlagTo(bo.AcroChoiceFlags.Sort,!1)},t.prototype.isMultiselect=function(){return this.acroField.hasFlag(bo.AcroChoiceFlags.MultiSelect)},t.prototype.enableMultiselect=function(){this.acroField.setFlagTo(bo.AcroChoiceFlags.MultiSelect,!0)},t.prototype.disableMultiselect=function(){this.acroField.setFlagTo(bo.AcroChoiceFlags.MultiSelect,!1)},t.prototype.isSelectOnClick=function(){return this.acroField.hasFlag(bo.AcroChoiceFlags.CommitOnSelChange)},t.prototype.enableSelectOnClick=function(){this.acroField.setFlagTo(bo.AcroChoiceFlags.CommitOnSelChange,!0)},t.prototype.disableSelectOnClick=function(){this.acroField.setFlagTo(bo.AcroChoiceFlags.CommitOnSelChange,!1)},t.prototype.addToPage=function(r,n){var i,s,u,f,h,g,p;Nc.assertIs(r,"page",[[Tut.default,"PDFPage"]]),qpe.assertFieldAppearanceOptions(n),n||(n={}),"textColor"in n||(n.textColor=aP.rgb(0,0,0)),"backgroundColor"in n||(n.backgroundColor=aP.rgb(1,1,1)),"borderColor"in n||(n.borderColor=aP.rgb(0,0,0)),"borderWidth"in n||(n.borderWidth=1);var C=this.createWidget({x:(i=n.x)!==null&&i!==void 0?i:0,y:(s=n.y)!==null&&s!==void 0?s:0,width:(u=n.width)!==null&&u!==void 0?u:200,height:(f=n.height)!==null&&f!==void 0?f:100,textColor:n.textColor,backgroundColor:n.backgroundColor,borderColor:n.borderColor,borderWidth:(h=n.borderWidth)!==null&&h!==void 0?h:0,rotate:(g=n.rotate)!==null&&g!==void 0?g:Sut.degrees(0),hidden:n.hidden,page:r.ref}),y=this.doc.context.register(C.dict);this.acroField.addWidget(y);var x=(p=n.font)!==null&&p!==void 0?p:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(C,x),r.node.addAnnot(y)},t.prototype.needsAppearancesUpdate=function(){var r;if(this.isDirty())return!0;for(var n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=((r=u.getAppearances())===null||r===void 0?void 0:r.normal)instanceof bo.PDFStream;if(!f)return!0}return!1},t.prototype.defaultUpdateAppearances=function(r){Nc.assertIs(r,"font",[[Hpe.default,"PDFFont"]]),this.updateAppearances(r)},t.prototype.updateAppearances=function(r,n){Nc.assertIs(r,"font",[[Hpe.default,"PDFFont"]]),Nc.assertOrUndefined(n,"provider",[Function]);for(var i=this.acroField.getWidgets(),s=0,u=i.length;s<u;s++){var f=i[s];this.updateWidgetAppearance(f,r,n)}this.markAsClean()},t.prototype.updateWidgetAppearance=function(r,n,i){var s=i??Wpe.defaultOptionListAppearanceProvider,u=Wpe.normalizeAppearance(s(this,r,n));this.updateWidgetAppearanceWithFont(r,n,u)},t.of=function(r,n,i){return new t(r,n,i)},t})(qpe.default);sP.default=Qut});var lP=U(fP=>{"use strict";Object.defineProperty(fP,"__esModule",{value:!0});var cP=(ct(),ze(ut)),_ut=cP.__importDefault(rl()),Gpe=cP.__importStar(tl()),Vpe=RA(),uP=Gu(),Nut=zo(),Ju=Xi(),Wm=fr(),kut=(function(e){cP.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return Wm.assertIs(r,"acroRadioButton",[[Ju.PDFAcroRadioButton,"PDFAcroRadioButton"]]),s.acroField=r,s}return t.prototype.getOptions=function(){var r=this.acroField.getExportValues();if(r){for(var n=new Array(r.length),i=0,s=r.length;i<s;i++)n[i]=r[i].decodeText();return n}for(var u=this.acroField.getOnValues(),f=new Array(u.length),i=0,s=f.length;i<s;i++)f[i]=u[i].decodeText();return f},t.prototype.getSelected=function(){var r=this.acroField.getValue();if(r!==Ju.PDFName.of("Off")){var n=this.acroField.getExportValues();if(n){for(var i=this.acroField.getOnValues(),s=0,u=i.length;s<u;s++)if(i[s]===r)return n[s].decodeText()}return r.decodeText()}},t.prototype.select=function(r){Wm.assertIs(r,"option",["string"]);var n=this.getOptions();Wm.assertIsOneOf(r,"option",n),this.markAsDirty();var i=this.acroField.getOnValues(),s=this.acroField.getExportValues();if(s)for(var u=0,f=s.length;u<f;u++)s[u].decodeText()===r&&this.acroField.setValue(i[u]);else for(var u=0,f=i.length;u<f;u++){var h=i[u];h.decodeText()===r&&this.acroField.setValue(h)}},t.prototype.clear=function(){this.markAsDirty(),this.acroField.setValue(Ju.PDFName.of("Off"))},t.prototype.isOffToggleable=function(){return!this.acroField.hasFlag(Ju.AcroButtonFlags.NoToggleToOff)},t.prototype.enableOffToggling=function(){this.acroField.setFlagTo(Ju.AcroButtonFlags.NoToggleToOff,!1)},t.prototype.disableOffToggling=function(){this.acroField.setFlagTo(Ju.AcroButtonFlags.NoToggleToOff,!0)},t.prototype.isMutuallyExclusive=function(){return!this.acroField.hasFlag(Ju.AcroButtonFlags.RadiosInUnison)},t.prototype.enableMutualExclusion=function(){this.acroField.setFlagTo(Ju.AcroButtonFlags.RadiosInUnison,!1)},t.prototype.disableMutualExclusion=function(){this.acroField.setFlagTo(Ju.AcroButtonFlags.RadiosInUnison,!0)},t.prototype.addOptionToPage=function(r,n,i){var s,u,f,h,g,p,C,y,x;Wm.assertIs(r,"option",["string"]),Wm.assertIs(n,"page",[[_ut.default,"PDFPage"]]),Gpe.assertFieldAppearanceOptions(i);var v=this.createWidget({x:(s=i?.x)!==null&&s!==void 0?s:0,y:(u=i?.y)!==null&&u!==void 0?u:0,width:(f=i?.width)!==null&&f!==void 0?f:50,height:(h=i?.height)!==null&&h!==void 0?h:50,textColor:(g=i?.textColor)!==null&&g!==void 0?g:uP.rgb(0,0,0),backgroundColor:(p=i?.backgroundColor)!==null&&p!==void 0?p:uP.rgb(1,1,1),borderColor:(C=i?.borderColor)!==null&&C!==void 0?C:uP.rgb(0,0,0),borderWidth:(y=i?.borderWidth)!==null&&y!==void 0?y:1,rotate:(x=i?.rotate)!==null&&x!==void 0?x:Nut.degrees(0),hidden:i?.hidden,page:n.ref}),T=this.doc.context.register(v.dict),Q=this.acroField.addWidgetWithOpt(T,Ju.PDFHexString.fromText(r),!this.isMutuallyExclusive());v.setAppearanceState(Ju.PDFName.of("Off")),this.updateWidgetAppearance(v,Q),n.node.addAnnot(T)},t.prototype.needsAppearancesUpdate=function(){for(var r,n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=u.getAppearanceState(),h=(r=u.getAppearances())===null||r===void 0?void 0:r.normal;if(!(h instanceof Ju.PDFDict)||f&&!h.has(f))return!0}return!1},t.prototype.defaultUpdateAppearances=function(){this.updateAppearances()},t.prototype.updateAppearances=function(r){Wm.assertOrUndefined(r,"provider",[Function]);for(var n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=u.getOnValue();f&&this.updateWidgetAppearance(u,f,r)}},t.prototype.updateWidgetAppearance=function(r,n,i){var s=i??Vpe.defaultRadioGroupAppearanceProvider,u=Vpe.normalizeAppearance(s(this,r));this.updateOnOffWidgetAppearance(r,n,u)},t.of=function(r,n,i){return new t(r,n,i)},t})(Gpe.default);fP.default=kut});var dP=U(AP=>{"use strict";Object.defineProperty(AP,"__esModule",{value:!0});var Ype=(ct(),ze(ut)),Rut=Ype.__importDefault(tl()),Uut=Xi(),Mut=fr(),Out=(function(e){Ype.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return Mut.assertIs(r,"acroSignature",[[Uut.PDFAcroSignature,"PDFAcroSignature"]]),s.acroField=r,s}return t.prototype.needsAppearancesUpdate=function(){return!1},t.of=function(r,n,i){return new t(r,n,i)},t})(Rut.default);AP.default=Out});var EP=U(mP=>{"use strict";Object.defineProperty(mP,"__esModule",{value:!0});var p3=(ct(),ze(ut)),Lut=p3.__importDefault(rl()),jpe=p3.__importDefault(el()),Jpe=p3.__importStar(tl()),Xpe=RA(),hP=Gu(),Put=zo(),gP=Pm(),pP=A3(),fg=jy(),si=Xi(),nl=fr(),Hut=(function(e){p3.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return nl.assertIs(r,"acroText",[[si.PDFAcroText,"PDFAcroText"]]),s.acroField=r,s}return t.prototype.getText=function(){var r=this.acroField.getValue();if(!r&&this.isRichFormatted())throw new gP.RichTextFieldReadError(this.getName());return r?.decodeText()},t.prototype.setText=function(r){nl.assertOrUndefined(r,"text",["string"]);var n=this.getMaxLength();if(n!==void 0&&r&&r.length>n)throw new gP.ExceededMaxLengthError(r.length,n,this.getName());this.markAsDirty(),this.disableRichFormatting(),r?this.acroField.setValue(si.PDFHexString.fromText(r)):this.acroField.removeValue()},t.prototype.getAlignment=function(){var r=this.acroField.getQuadding();return r===0?fg.TextAlignment.Left:r===1?fg.TextAlignment.Center:r===2?fg.TextAlignment.Right:fg.TextAlignment.Left},t.prototype.setAlignment=function(r){nl.assertIsOneOf(r,"alignment",fg.TextAlignment),this.markAsDirty(),this.acroField.setQuadding(r)},t.prototype.getMaxLength=function(){return this.acroField.getMaxLength()},t.prototype.setMaxLength=function(r){if(nl.assertRangeOrUndefined(r,"maxLength",0,Number.MAX_SAFE_INTEGER),this.markAsDirty(),r===void 0)this.acroField.removeMaxLength();else{var n=this.getText();if(n&&n.length>r)throw new gP.InvalidMaxLengthError(n.length,r,this.getName());this.acroField.setMaxLength(r)}},t.prototype.removeMaxLength=function(){this.markAsDirty(),this.acroField.removeMaxLength()},t.prototype.setImage=function(r){for(var n=this.getAlignment(),i=n===fg.TextAlignment.Center?pP.ImageAlignment.Center:n===fg.TextAlignment.Right?pP.ImageAlignment.Right:pP.ImageAlignment.Left,s=this.acroField.getWidgets(),u=0,f=s.length;u<f;u++){var h=s[u],g=this.createImageAppearanceStream(h,r,i);this.updateWidgetAppearances(h,{normal:g})}this.markAsClean()},t.prototype.setFontSize=function(r){nl.assertPositive(r,"fontSize"),this.acroField.setFontSize(r),this.markAsDirty()},t.prototype.isMultiline=function(){return this.acroField.hasFlag(si.AcroTextFlags.Multiline)},t.prototype.enableMultiline=function(){this.markAsDirty(),this.acroField.setFlagTo(si.AcroTextFlags.Multiline,!0)},t.prototype.disableMultiline=function(){this.markAsDirty(),this.acroField.setFlagTo(si.AcroTextFlags.Multiline,!1)},t.prototype.isPassword=function(){return this.acroField.hasFlag(si.AcroTextFlags.Password)},t.prototype.enablePassword=function(){this.acroField.setFlagTo(si.AcroTextFlags.Password,!0)},t.prototype.disablePassword=function(){this.acroField.setFlagTo(si.AcroTextFlags.Password,!1)},t.prototype.isFileSelector=function(){return this.acroField.hasFlag(si.AcroTextFlags.FileSelect)},t.prototype.enableFileSelection=function(){this.acroField.setFlagTo(si.AcroTextFlags.FileSelect,!0)},t.prototype.disableFileSelection=function(){this.acroField.setFlagTo(si.AcroTextFlags.FileSelect,!1)},t.prototype.isSpellChecked=function(){return!this.acroField.hasFlag(si.AcroTextFlags.DoNotSpellCheck)},t.prototype.enableSpellChecking=function(){this.acroField.setFlagTo(si.AcroTextFlags.DoNotSpellCheck,!1)},t.prototype.disableSpellChecking=function(){this.acroField.setFlagTo(si.AcroTextFlags.DoNotSpellCheck,!0)},t.prototype.isScrollable=function(){return!this.acroField.hasFlag(si.AcroTextFlags.DoNotScroll)},t.prototype.enableScrolling=function(){this.acroField.setFlagTo(si.AcroTextFlags.DoNotScroll,!1)},t.prototype.disableScrolling=function(){this.acroField.setFlagTo(si.AcroTextFlags.DoNotScroll,!0)},t.prototype.isCombed=function(){return this.acroField.hasFlag(si.AcroTextFlags.Comb)&&!this.isMultiline()&&!this.isPassword()&&!this.isFileSelector()&&this.getMaxLength()!==void 0},t.prototype.enableCombing=function(){if(this.getMaxLength()===void 0){var r="PDFTextFields must have a max length in order to be combed";console.warn(r)}this.markAsDirty(),this.disableMultiline(),this.disablePassword(),this.disableFileSelection(),this.acroField.setFlagTo(si.AcroTextFlags.Comb,!0)},t.prototype.disableCombing=function(){this.markAsDirty(),this.acroField.setFlagTo(si.AcroTextFlags.Comb,!1)},t.prototype.isRichFormatted=function(){return this.acroField.hasFlag(si.AcroTextFlags.RichText)},t.prototype.enableRichFormatting=function(){this.acroField.setFlagTo(si.AcroTextFlags.RichText,!0)},t.prototype.disableRichFormatting=function(){this.acroField.setFlagTo(si.AcroTextFlags.RichText,!1)},t.prototype.addToPage=function(r,n){var i,s,u,f,h,g,p;nl.assertIs(r,"page",[[Lut.default,"PDFPage"]]),Jpe.assertFieldAppearanceOptions(n),n||(n={}),"textColor"in n||(n.textColor=hP.rgb(0,0,0)),"backgroundColor"in n||(n.backgroundColor=hP.rgb(1,1,1)),"borderColor"in n||(n.borderColor=hP.rgb(0,0,0)),"borderWidth"in n||(n.borderWidth=1);var C=this.createWidget({x:(i=n.x)!==null&&i!==void 0?i:0,y:(s=n.y)!==null&&s!==void 0?s:0,width:(u=n.width)!==null&&u!==void 0?u:200,height:(f=n.height)!==null&&f!==void 0?f:50,textColor:n.textColor,backgroundColor:n.backgroundColor,borderColor:n.borderColor,borderWidth:(h=n.borderWidth)!==null&&h!==void 0?h:0,rotate:(g=n.rotate)!==null&&g!==void 0?g:Put.degrees(0),hidden:n.hidden,page:r.ref}),y=this.doc.context.register(C.dict);this.acroField.addWidget(y);var x=(p=n.font)!==null&&p!==void 0?p:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(C,x),r.node.addAnnot(y)},t.prototype.needsAppearancesUpdate=function(){var r;if(this.isDirty())return!0;for(var n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=((r=u.getAppearances())===null||r===void 0?void 0:r.normal)instanceof si.PDFStream;if(!f)return!0}return!1},t.prototype.defaultUpdateAppearances=function(r){nl.assertIs(r,"font",[[jpe.default,"PDFFont"]]),this.updateAppearances(r)},t.prototype.updateAppearances=function(r,n){nl.assertIs(r,"font",[[jpe.default,"PDFFont"]]),nl.assertOrUndefined(n,"provider",[Function]);for(var i=this.acroField.getWidgets(),s=0,u=i.length;s<u;s++){var f=i[s];this.updateWidgetAppearance(f,r,n)}this.markAsClean()},t.prototype.updateWidgetAppearance=function(r,n,i){var s=i??Xpe.defaultTextFieldAppearanceProvider,u=Xpe.normalizeAppearance(s(this,r,n));this.updateWidgetAppearanceWithFont(r,n,u)},t.of=function(r,n,i){return new t(r,n,i)},t})(Jpe.default);mP.default=Hut});var m3=U(Ky=>{"use strict";Object.defineProperty(Ky,"__esModule",{value:!0});Ky.StandardFonts=void 0;var qut;(function(e){e.Courier="Courier",e.CourierBold="Courier-Bold",e.CourierOblique="Courier-Oblique",e.CourierBoldOblique="Courier-BoldOblique",e.Helvetica="Helvetica",e.HelveticaBold="Helvetica-Bold",e.HelveticaOblique="Helvetica-Oblique",e.HelveticaBoldOblique="Helvetica-BoldOblique",e.TimesRoman="Times-Roman",e.TimesRomanBold="Times-Bold",e.TimesRomanItalic="Times-Italic",e.TimesRomanBoldItalic="Times-BoldItalic",e.Symbol="Symbol",e.ZapfDingbats="ZapfDingbats"})(qut=Ky.StandardFonts||(Ky.StandardFonts={}))});var yP=U(CP=>{"use strict";Object.defineProperty(CP,"__esModule",{value:!0});var Xu=(ct(),ze(ut)),Wut=Xu.__importDefault(UA()),b3=Xu.__importDefault(xP()),zy=Xu.__importDefault(tP()),C3=Xu.__importDefault(iP()),y3=Xu.__importDefault(oP()),Zy=Xu.__importDefault(lP()),bP=Xu.__importDefault(dP()),x3=Xu.__importDefault(EP()),kc=Pm(),Gut=Xu.__importDefault(el()),Vut=m3(),Yut=Lm(),E3=QA(),In=Xi(),Fi=fr(),jut=(function(){function e(t,r){var n=this;this.embedDefaultFont=function(){return n.doc.embedStandardFont(Vut.StandardFonts.Helvetica)},Fi.assertIs(t,"acroForm",[[In.PDFAcroForm,"PDFAcroForm"]]),Fi.assertIs(r,"doc",[[Wut.default,"PDFDocument"]]),this.acroForm=t,this.doc=r,this.dirtyFields=new Set,this.defaultFontCache=Fi.Cache.populatedBy(this.embedDefaultFont)}return e.prototype.hasXFA=function(){return this.acroForm.dict.has(In.PDFName.of("XFA"))},e.prototype.deleteXFA=function(){this.acroForm.dict.delete(In.PDFName.of("XFA"))},e.prototype.getFields=function(){for(var t=this.acroForm.getAllFields(),r=[],n=0,i=t.length;n<i;n++){var s=t[n],u=s[0],f=s[1],h=Jut(u,f,this.doc);h&&r.push(h)}return r},e.prototype.getFieldMaybe=function(t){Fi.assertIs(t,"name",["string"]);for(var r=this.getFields(),n=0,i=r.length;n<i;n++){var s=r[n];if(s.getName()===t)return s}},e.prototype.getField=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getFieldMaybe(t);if(r)return r;throw new kc.NoSuchFieldError(t)},e.prototype.getButton=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof b3.default)return r;throw new kc.UnexpectedFieldTypeError(t,b3.default,r)},e.prototype.getCheckBox=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof zy.default)return r;throw new kc.UnexpectedFieldTypeError(t,zy.default,r)},e.prototype.getDropdown=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof C3.default)return r;throw new kc.UnexpectedFieldTypeError(t,C3.default,r)},e.prototype.getOptionList=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof y3.default)return r;throw new kc.UnexpectedFieldTypeError(t,y3.default,r)},e.prototype.getRadioGroup=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof Zy.default)return r;throw new kc.UnexpectedFieldTypeError(t,Zy.default,r)},e.prototype.getSignature=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof bP.default)return r;throw new kc.UnexpectedFieldTypeError(t,bP.default,r)},e.prototype.getTextField=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof x3.default)return r;throw new kc.UnexpectedFieldTypeError(t,x3.default,r)},e.prototype.createButton=function(t){Fi.assertIs(t,"name",["string"]);var r=Gm(t),n=this.findOrCreateNonTerminals(r.nonTerminal),i=In.PDFAcroPushButton.create(this.doc.context);return i.setPartialName(r.terminal),Vm(n,[i,i.ref],r.terminal),b3.default.of(i,i.ref,this.doc)},e.prototype.createCheckBox=function(t){Fi.assertIs(t,"name",["string"]);var r=Gm(t),n=this.findOrCreateNonTerminals(r.nonTerminal),i=In.PDFAcroCheckBox.create(this.doc.context);return i.setPartialName(r.terminal),Vm(n,[i,i.ref],r.terminal),zy.default.of(i,i.ref,this.doc)},e.prototype.createDropdown=function(t){Fi.assertIs(t,"name",["string"]);var r=Gm(t),n=this.findOrCreateNonTerminals(r.nonTerminal),i=In.PDFAcroComboBox.create(this.doc.context);return i.setPartialName(r.terminal),Vm(n,[i,i.ref],r.terminal),C3.default.of(i,i.ref,this.doc)},e.prototype.createOptionList=function(t){Fi.assertIs(t,"name",["string"]);var r=Gm(t),n=this.findOrCreateNonTerminals(r.nonTerminal),i=In.PDFAcroListBox.create(this.doc.context);return i.setPartialName(r.terminal),Vm(n,[i,i.ref],r.terminal),y3.default.of(i,i.ref,this.doc)},e.prototype.createRadioGroup=function(t){Fi.assertIs(t,"name",["string"]);var r=Gm(t),n=this.findOrCreateNonTerminals(r.nonTerminal),i=In.PDFAcroRadioButton.create(this.doc.context);return i.setPartialName(r.terminal),Vm(n,[i,i.ref],r.terminal),Zy.default.of(i,i.ref,this.doc)},e.prototype.createTextField=function(t){Fi.assertIs(t,"name",["string"]);var r=Gm(t),n=this.findOrCreateNonTerminals(r.nonTerminal),i=In.PDFAcroText.create(this.doc.context);return i.setPartialName(r.terminal),Vm(n,[i,i.ref],r.terminal),x3.default.of(i,i.ref,this.doc)},e.prototype.flatten=function(t){t===void 0&&(t={updateFieldAppearances:!0}),t.updateFieldAppearances&&this.updateFieldAppearances();for(var r=this.getFields(),n=0,i=r.length;n<i;n++){for(var s=r[n],u=s.acroField.getWidgets(),f=0,h=u.length;f<h;f++){var g=u[f],p=this.findWidgetPage(g),C=this.findWidgetAppearanceRef(s,g),y=p.node.newXObject("FlatWidget",C),x=g.getRectangle(),v=Xu.__spreadArrays([E3.pushGraphicsState(),E3.translate(x.x,x.y)],Yut.rotateInPlace(Xu.__assign(Xu.__assign({},x),{rotation:0})),[E3.drawObject(y),E3.popGraphicsState()]).filter(Boolean);p.pushOperators.apply(p,v)}this.removeField(s)}},e.prototype.removeField=function(t){for(var r=t.acroField.getWidgets(),n=new Set,i=0,s=r.length;i<s;i++){var u=r[i],f=this.findWidgetAppearanceRef(t,u),h=this.findWidgetPage(u);n.add(h),h.node.removeAnnot(f)}n.forEach(function(x){return x.node.removeAnnot(t.ref)}),this.acroForm.removeField(t.acroField);for(var g=t.acroField.normalizedEntries().Kids,p=g.size(),C=0;C<p;C++){var y=g.get(C);y instanceof In.PDFRef&&this.doc.context.delete(y)}this.doc.context.delete(t.ref)},e.prototype.updateFieldAppearances=function(t){Fi.assertOrUndefined(t,"font",[[Gut.default,"PDFFont"]]),t=t??this.getDefaultFont();for(var r=this.getFields(),n=0,i=r.length;n<i;n++){var s=r[n];s.needsAppearancesUpdate()&&s.defaultUpdateAppearances(t)}},e.prototype.markFieldAsDirty=function(t){Fi.assertOrUndefined(t,"fieldRef",[[In.PDFRef,"PDFRef"]]),this.dirtyFields.add(t)},e.prototype.markFieldAsClean=function(t){Fi.assertOrUndefined(t,"fieldRef",[[In.PDFRef,"PDFRef"]]),this.dirtyFields.delete(t)},e.prototype.fieldIsDirty=function(t){return Fi.assertOrUndefined(t,"fieldRef",[[In.PDFRef,"PDFRef"]]),this.dirtyFields.has(t)},e.prototype.getDefaultFont=function(){return this.defaultFontCache.access()},e.prototype.findWidgetPage=function(t){var r=t.P(),n=this.doc.getPages().find(function(s){return s.ref===r});if(n===void 0){var i=this.doc.context.getObjectRef(t.dict);if(i===void 0)throw new Error("Could not find PDFRef for PDFObject");if(n=this.doc.findPageForAnnotationRef(i),n===void 0)throw new Error("Could not find page for PDFRef "+i)}return n},e.prototype.findWidgetAppearanceRef=function(t,r){var n,i=r.getNormalAppearance();if(i instanceof In.PDFDict&&(t instanceof zy.default||t instanceof Zy.default)){var s=t.acroField.getValue(),u=(n=i.get(s))!==null&&n!==void 0?n:i.get(In.PDFName.of("Off"));u instanceof In.PDFRef&&(i=u)}if(!(i instanceof In.PDFRef)){var f=t.getName();throw new Error("Failed to extract appearance ref for: "+f)}return i},e.prototype.findOrCreateNonTerminals=function(t){for(var r=[this.acroForm],n=0,i=t.length;n<i;n++){var s=t[n];if(!s)throw new kc.InvalidFieldNamePartError(s);var u=r[0],f=r[1],h=this.findNonTerminal(s,u);if(h)r=h;else{var g=In.PDFAcroNonTerminal.create(this.doc.context);g.setPartialName(s),g.setParent(f);var p=this.doc.context.register(g.dict);u.addField(p),r=[g,p]}}return r},e.prototype.findNonTerminal=function(t,r){for(var n=r instanceof In.PDFAcroForm?this.acroForm.getFields():In.createPDFAcroFields(r.Kids()),i=0,s=n.length;i<s;i++){var u=n[i],f=u[0],h=u[1];if(f.getPartialName()===t){if(f instanceof In.PDFAcroNonTerminal)return[f,h];throw new kc.FieldAlreadyExistsError(t)}}},e.of=function(t,r){return new e(t,r)},e})();CP.default=jut;var Jut=function(e,t,r){if(e instanceof In.PDFAcroPushButton)return b3.default.of(e,t,r);if(e instanceof In.PDFAcroCheckBox)return zy.default.of(e,t,r);if(e instanceof In.PDFAcroComboBox)return C3.default.of(e,t,r);if(e instanceof In.PDFAcroListBox)return y3.default.of(e,t,r);if(e instanceof In.PDFAcroText)return x3.default.of(e,t,r);if(e instanceof In.PDFAcroRadioButton)return Zy.default.of(e,t,r);if(e instanceof In.PDFAcroSignature)return bP.default.of(e,t,r)},Gm=function(e){if(e.length===0)throw new Error("PDF field names must not be empty strings");for(var t=e.split("."),r=0,n=t.length;r<n;r++)if(t[r]==="")throw new Error('Periods in PDF field names must be separated by at least one character: "'+e+'"');return t.length===1?{nonTerminal:[],terminal:t[0]}:{nonTerminal:t.slice(0,t.length-1),terminal:t[t.length-1]}},Vm=function(e,t,r){for(var n=e[0],i=e[1],s=t[0],u=t[1],f=n.normalizedEntries(),h=In.createPDFAcroFields("Kids"in f?f.Kids:f.Fields),g=0,p=h.length;g<p;g++)if(h[g][0].getPartialName()===r)throw new kc.FieldAlreadyExistsError(r);n.addField(u),s.setParent(i)}});var vP=U(v3=>{"use strict";Object.defineProperty(v3,"__esModule",{value:!0});v3.PageSizes=void 0;v3.PageSizes={"4A0":[4767.87,6740.79],"2A0":[3370.39,4767.87],A0:[2383.94,3370.39],A1:[1683.78,2383.94],A2:[1190.55,1683.78],A3:[841.89,1190.55],A4:[595.28,841.89],A5:[419.53,595.28],A6:[297.64,419.53],A7:[209.76,297.64],A8:[147.4,209.76],A9:[104.88,147.4],A10:[73.7,104.88],B0:[2834.65,4008.19],B1:[2004.09,2834.65],B2:[1417.32,2004.09],B3:[1000.63,1417.32],B4:[708.66,1000.63],B5:[498.9,708.66],B6:[354.33,498.9],B7:[249.45,354.33],B8:[175.75,249.45],B9:[124.72,175.75],B10:[87.87,124.72],C0:[2599.37,3676.54],C1:[1836.85,2599.37],C2:[1298.27,1836.85],C3:[918.43,1298.27],C4:[649.13,918.43],C5:[459.21,649.13],C6:[323.15,459.21],C7:[229.61,323.15],C8:[161.57,229.61],C9:[113.39,161.57],C10:[79.37,113.39],RA0:[2437.8,3458.27],RA1:[1729.13,2437.8],RA2:[1218.9,1729.13],RA3:[864.57,1218.9],RA4:[609.45,864.57],SRA0:[2551.18,3628.35],SRA1:[1814.17,2551.18],SRA2:[1275.59,1814.17],SRA3:[907.09,1275.59],SRA4:[637.8,907.09],Executive:[521.86,756],Folio:[612,936],Legal:[612,1008],Letter:[612,792],Tabloid:[792,1224]}});var IP=U($y=>{"use strict";Object.defineProperty($y,"__esModule",{value:!0});$y.ParseSpeeds=void 0;var Xut;(function(e){e[e.Fastest=1/0]="Fastest",e[e.Fast=1500]="Fast",e[e.Medium=500]="Medium",e[e.Slow=100]="Slow"})(Xut=$y.ParseSpeeds||($y.ParseSpeeds={}))});var zpe=U(DP=>{"use strict";Object.defineProperty(DP,"__esModule",{value:!0});var Kpe=(ct(),ze(ut)),Ha=Xi(),Kut=(function(){function e(t,r,n){this.alreadyEmbedded=!1,this.ref=t,this.doc=r,this.embedder=n}return e.prototype.embed=function(){return Kpe.__awaiter(this,void 0,void 0,function(){var t,r,n,i,s;return Kpe.__generator(this,function(u){switch(u.label){case 0:return this.alreadyEmbedded?[3,2]:[4,this.embedder.embedIntoContext(this.doc.context,this.ref)];case 1:t=u.sent(),this.doc.catalog.has(Ha.PDFName.of("Names"))||this.doc.catalog.set(Ha.PDFName.of("Names"),this.doc.context.obj({})),r=this.doc.catalog.lookup(Ha.PDFName.of("Names"),Ha.PDFDict),r.has(Ha.PDFName.of("EmbeddedFiles"))||r.set(Ha.PDFName.of("EmbeddedFiles"),this.doc.context.obj({})),n=r.lookup(Ha.PDFName.of("EmbeddedFiles"),Ha.PDFDict),n.has(Ha.PDFName.of("Names"))||n.set(Ha.PDFName.of("Names"),this.doc.context.obj([])),i=n.lookup(Ha.PDFName.of("Names"),Ha.PDFArray),i.push(Ha.PDFHexString.fromText(this.embedder.fileName)),i.push(t),this.doc.catalog.has(Ha.PDFName.of("AF"))||this.doc.catalog.set(Ha.PDFName.of("AF"),this.doc.context.obj([])),s=this.doc.catalog.lookup(Ha.PDFName.of("AF"),Ha.PDFArray),s.push(t),this.alreadyEmbedded=!0,u.label=2;case 2:return[2]}})})},e.of=function(t,r,n){return new e(t,r,n)},e})();DP.default=Kut});var wP=U(BP=>{"use strict";Object.defineProperty(BP,"__esModule",{value:!0});var Zpe=(ct(),ze(ut)),$o=Xi(),zut=(function(){function e(t,r,n){this.alreadyEmbedded=!1,this.ref=t,this.doc=r,this.embedder=n}return e.prototype.embed=function(){return Zpe.__awaiter(this,void 0,void 0,function(){var t,r,n,i,s,u,f;return Zpe.__generator(this,function(h){switch(h.label){case 0:return this.alreadyEmbedded?[3,2]:(t=this.doc,r=t.catalog,n=t.context,[4,this.embedder.embedIntoContext(this.doc.context,this.ref)]);case 1:i=h.sent(),r.has($o.PDFName.of("Names"))||r.set($o.PDFName.of("Names"),n.obj({})),s=r.lookup($o.PDFName.of("Names"),$o.PDFDict),s.has($o.PDFName.of("JavaScript"))||s.set($o.PDFName.of("JavaScript"),n.obj({})),u=s.lookup($o.PDFName.of("JavaScript"),$o.PDFDict),u.has($o.PDFName.of("Names"))||u.set($o.PDFName.of("Names"),n.obj([])),f=u.lookup($o.PDFName.of("Names"),$o.PDFArray),f.push($o.PDFHexString.fromText(this.embedder.scriptName)),f.push(i),this.alreadyEmbedded=!0,h.label=2;case 2:return[2]}})})},e.of=function(t,r,n){return new e(t,r,n)},e})();BP.default=zut});var $pe=U(TP=>{"use strict";Object.defineProperty(TP,"__esModule",{value:!0});var FP=(ct(),ze(ut)),Zut=FP.__importDefault(co()),$ut=(function(){function e(t,r){this.script=t,this.scriptName=r}return e.for=function(t,r){return new e(t,r)},e.prototype.embedIntoContext=function(t,r){return FP.__awaiter(this,void 0,void 0,function(){var n;return FP.__generator(this,function(i){return n=t.obj({Type:"Action",S:"JavaScript",JS:Zut.default.fromText(this.script)}),r?(t.assign(r,n),[2,r]):[2,t.register(n)]})})},e})();TP.default=$ut});var UA=U(SP=>{"use strict";Object.defineProperty(SP,"__esModule",{value:!0});var Fr=(ct(),ze(ut)),I3=Pm(),ect=Fr.__importDefault(c3()),eme=Fr.__importDefault(el()),tme=Fr.__importDefault(l3()),Ym=Fr.__importDefault(rl()),tct=Fr.__importDefault(yP()),rct=vP(),ar=Xi(),nct=IP(),zt=fr(),rme=Fr.__importStar(fL()),ict=Fr.__importDefault(zpe()),act=Fr.__importDefault(wP()),sct=Fr.__importDefault($pe()),oct=(function(){function e(t,r,n){var i=this;if(this.defaultWordBreaks=[" "],this.computePages=function(){var s=[];return i.catalog.Pages().traverse(function(u,f){if(u instanceof ar.PDFPageLeaf){var h=i.pageMap.get(u);h||(h=Ym.default.of(u,f,i),i.pageMap.set(u,h)),s.push(h)}}),s},this.getOrCreateForm=function(){var s=i.catalog.getOrCreateAcroForm();return tct.default.of(s,i)},zt.assertIs(t,"context",[[ar.PDFContext,"PDFContext"]]),zt.assertIs(r,"ignoreEncryption",["boolean"]),this.context=t,this.catalog=t.lookup(t.trailerInfo.Root),this.isEncrypted=!!t.lookup(t.trailerInfo.Encrypt),this.pageCache=zt.Cache.populatedBy(this.computePages),this.pageMap=new Map,this.formCache=zt.Cache.populatedBy(this.getOrCreateForm),this.fonts=[],this.images=[],this.embeddedPages=[],this.embeddedFiles=[],this.javaScripts=[],!r&&this.isEncrypted)throw new I3.EncryptedPDFError;n&&this.updateInfoDict()}return e.load=function(t,r){return r===void 0&&(r={}),Fr.__awaiter(this,void 0,void 0,function(){var n,i,s,u,f,h,g,p,C,y,x,v;return Fr.__generator(this,function(T){switch(T.label){case 0:return n=r.ignoreEncryption,i=n===void 0?!1:n,s=r.parseSpeed,u=s===void 0?nct.ParseSpeeds.Slow:s,f=r.throwOnInvalidObject,h=f===void 0?!1:f,g=r.updateMetadata,p=g===void 0?!0:g,C=r.capNumbers,y=C===void 0?!1:C,zt.assertIs(t,"pdf",["string",Uint8Array,ArrayBuffer]),zt.assertIs(i,"ignoreEncryption",["boolean"]),zt.assertIs(u,"parseSpeed",["number"]),zt.assertIs(h,"throwOnInvalidObject",["boolean"]),x=zt.toUint8Array(t),[4,ar.PDFParser.forBytesWithOptions(x,u,h,y).parseDocument()];case 1:return v=T.sent(),[2,new e(v,i,p)]}})})},e.create=function(t){return t===void 0&&(t={}),Fr.__awaiter(this,void 0,void 0,function(){var r,n,i,s,u,f;return Fr.__generator(this,function(h){return r=t.updateMetadata,n=r===void 0?!0:r,i=ar.PDFContext.create(),s=ar.PDFPageTree.withContext(i),u=i.register(s),f=ar.PDFCatalog.withContextAndPages(i,u),i.trailerInfo.Root=i.register(f),[2,new e(i,!1,n)]})})},e.prototype.registerFontkit=function(t){this.fontkit=t},e.prototype.getForm=function(){var t=this.formCache.access();return t.hasXFA()&&(console.warn("Removing XFA form data as pdf-lib does not support reading or writing XFA"),t.deleteXFA()),t},e.prototype.getTitle=function(){var t=this.getInfoDict().lookup(ar.PDFName.Title);if(t)return MA(t),t.decodeText()},e.prototype.getAuthor=function(){var t=this.getInfoDict().lookup(ar.PDFName.Author);if(t)return MA(t),t.decodeText()},e.prototype.getSubject=function(){var t=this.getInfoDict().lookup(ar.PDFName.Subject);if(t)return MA(t),t.decodeText()},e.prototype.getKeywords=function(){var t=this.getInfoDict().lookup(ar.PDFName.Keywords);if(t)return MA(t),t.decodeText()},e.prototype.getCreator=function(){var t=this.getInfoDict().lookup(ar.PDFName.Creator);if(t)return MA(t),t.decodeText()},e.prototype.getProducer=function(){var t=this.getInfoDict().lookup(ar.PDFName.Producer);if(t)return MA(t),t.decodeText()},e.prototype.getCreationDate=function(){var t=this.getInfoDict().lookup(ar.PDFName.CreationDate);if(t)return MA(t),t.decodeDate()},e.prototype.getModificationDate=function(){var t=this.getInfoDict().lookup(ar.PDFName.ModDate);if(t)return MA(t),t.decodeDate()},e.prototype.setTitle=function(t,r){zt.assertIs(t,"title",["string"]);var n=ar.PDFName.of("Title");if(this.getInfoDict().set(n,ar.PDFHexString.fromText(t)),r?.showInWindowTitleBar){var i=this.catalog.getOrCreateViewerPreferences();i.setDisplayDocTitle(!0)}},e.prototype.setAuthor=function(t){zt.assertIs(t,"author",["string"]);var r=ar.PDFName.of("Author");this.getInfoDict().set(r,ar.PDFHexString.fromText(t))},e.prototype.setSubject=function(t){zt.assertIs(t,"author",["string"]);var r=ar.PDFName.of("Subject");this.getInfoDict().set(r,ar.PDFHexString.fromText(t))},e.prototype.setKeywords=function(t){zt.assertIs(t,"keywords",[Array]);var r=ar.PDFName.of("Keywords");this.getInfoDict().set(r,ar.PDFHexString.fromText(t.join(" ")))},e.prototype.setCreator=function(t){zt.assertIs(t,"creator",["string"]);var r=ar.PDFName.of("Creator");this.getInfoDict().set(r,ar.PDFHexString.fromText(t))},e.prototype.setProducer=function(t){zt.assertIs(t,"creator",["string"]);var r=ar.PDFName.of("Producer");this.getInfoDict().set(r,ar.PDFHexString.fromText(t))},e.prototype.setLanguage=function(t){zt.assertIs(t,"language",["string"]);var r=ar.PDFName.of("Lang");this.catalog.set(r,ar.PDFString.of(t))},e.prototype.setCreationDate=function(t){zt.assertIs(t,"creationDate",[[Date,"Date"]]);var r=ar.PDFName.of("CreationDate");this.getInfoDict().set(r,ar.PDFString.fromDate(t))},e.prototype.setModificationDate=function(t){zt.assertIs(t,"modificationDate",[[Date,"Date"]]);var r=ar.PDFName.of("ModDate");this.getInfoDict().set(r,ar.PDFString.fromDate(t))},e.prototype.getPageCount=function(){return this.pageCount===void 0&&(this.pageCount=this.getPages().length),this.pageCount},e.prototype.getPages=function(){return this.pageCache.access()},e.prototype.getPage=function(t){var r=this.getPages();return zt.assertRange(t,"index",0,r.length-1),r[t]},e.prototype.getPageIndices=function(){return zt.range(0,this.getPageCount())},e.prototype.removePage=function(t){var r=this.getPageCount();if(this.pageCount===0)throw new I3.RemovePageFromEmptyDocumentError;zt.assertRange(t,"index",0,r-1),this.catalog.removeLeafNode(t),this.pageCount=r-1},e.prototype.addPage=function(t){return zt.assertIs(t,"page",["undefined",[Ym.default,"PDFPage"],Array]),this.insertPage(this.getPageCount(),t)},e.prototype.insertPage=function(t,r){var n=this.getPageCount();if(zt.assertRange(t,"index",0,n),zt.assertIs(r,"page",["undefined",[Ym.default,"PDFPage"],Array]),!r||Array.isArray(r)){var i=Array.isArray(r)?r:rct.PageSizes.A4;r=Ym.default.create(this),r.setSize.apply(r,i)}else if(r.doc!==this)throw new I3.ForeignPageError;var s=this.catalog.insertLeafNode(r.ref,t);return r.node.setParent(s),this.pageMap.set(r.node,r),this.pageCache.invalidate(),this.pageCount=n+1,r},e.prototype.copyPages=function(t,r){return Fr.__awaiter(this,void 0,void 0,function(){var n,i,s,u,f,h,g,p;return Fr.__generator(this,function(C){switch(C.label){case 0:return zt.assertIs(t,"srcDoc",[[e,"PDFDocument"]]),zt.assertIs(r,"indices",[Array]),[4,t.flush()];case 1:for(C.sent(),n=ar.PDFObjectCopier.for(t.context,this.context),i=t.getPages(),s=new Array(r.length),u=0,f=r.length;u<f;u++)h=i[r[u]],g=n.copy(h.node),p=this.context.register(g),s[u]=Ym.default.of(g,p,this);return[2,s]}})})},e.prototype.copy=function(){return Fr.__awaiter(this,void 0,void 0,function(){var t,r,n,i;return Fr.__generator(this,function(s){switch(s.label){case 0:return[4,e.create()];case 1:return t=s.sent(),[4,t.copyPages(this,this.getPageIndices())];case 2:for(r=s.sent(),n=0,i=r.length;n<i;n++)t.addPage(r[n]);return this.getAuthor()!==void 0&&t.setAuthor(this.getAuthor()),this.getCreationDate()!==void 0&&t.setCreationDate(this.getCreationDate()),this.getCreator()!==void 0&&t.setCreator(this.getCreator()),this.getModificationDate()!==void 0&&t.setModificationDate(this.getModificationDate()),this.getProducer()!==void 0&&t.setProducer(this.getProducer()),this.getSubject()!==void 0&&t.setSubject(this.getSubject()),this.getTitle()!==void 0&&t.setTitle(this.getTitle()),t.defaultWordBreaks=this.defaultWordBreaks,[2,t]}})})},e.prototype.addJavaScript=function(t,r){zt.assertIs(t,"name",["string"]),zt.assertIs(r,"script",["string"]);var n=sct.default.for(r,t),i=this.context.nextRef(),s=act.default.of(i,this,n);this.javaScripts.push(s)},e.prototype.attach=function(t,r,n){return n===void 0&&(n={}),Fr.__awaiter(this,void 0,void 0,function(){var i,s,u,f;return Fr.__generator(this,function(h){return zt.assertIs(t,"attachment",["string",Uint8Array,ArrayBuffer]),zt.assertIs(r,"name",["string"]),zt.assertOrUndefined(n.mimeType,"mimeType",["string"]),zt.assertOrUndefined(n.description,"description",["string"]),zt.assertOrUndefined(n.creationDate,"options.creationDate",[Date]),zt.assertOrUndefined(n.modificationDate,"options.modificationDate",[Date]),zt.assertIsOneOfOrUndefined(n.afRelationship,"options.afRelationship",rme.AFRelationship),i=zt.toUint8Array(t),s=rme.default.for(i,r,n),u=this.context.nextRef(),f=ict.default.of(u,this,s),this.embeddedFiles.push(f),[2]})})},e.prototype.embedFont=function(t,r){return r===void 0&&(r={}),Fr.__awaiter(this,void 0,void 0,function(){var n,i,s,u,f,h,g,p,C,y;return Fr.__generator(this,function(x){switch(x.label){case 0:return n=r.subset,i=n===void 0?!1:n,s=r.customName,u=r.features,zt.assertIs(t,"font",["string",Uint8Array,ArrayBuffer]),zt.assertIs(i,"subset",["boolean"]),zt.isStandardFont(t)?(f=ar.StandardFontEmbedder.for(t,s),[3,7]):[3,1];case 1:return zt.canBeConvertedToUint8Array(t)?(h=zt.toUint8Array(t),g=this.assertFontkit(),i?[4,ar.CustomFontSubsetEmbedder.for(g,h,s,u)]:[3,3]):[3,6];case 2:return p=x.sent(),[3,5];case 3:return[4,ar.CustomFontEmbedder.for(g,h,s,u)];case 4:p=x.sent(),x.label=5;case 5:return f=p,[3,7];case 6:throw new TypeError("`font` must be one of `StandardFonts | string | Uint8Array | ArrayBuffer`");case 7:return C=this.context.nextRef(),y=eme.default.of(C,this,f),this.fonts.push(y),[2,y]}})})},e.prototype.embedStandardFont=function(t,r){if(zt.assertIs(t,"font",["string"]),!zt.isStandardFont(t))throw new TypeError("`font` must be one of type `StandardFonts`");var n=ar.StandardFontEmbedder.for(t,r),i=this.context.nextRef(),s=eme.default.of(i,this,n);return this.fonts.push(s),s},e.prototype.embedJpg=function(t){return Fr.__awaiter(this,void 0,void 0,function(){var r,n,i,s;return Fr.__generator(this,function(u){switch(u.label){case 0:return zt.assertIs(t,"jpg",["string",Uint8Array,ArrayBuffer]),r=zt.toUint8Array(t),[4,ar.JpegEmbedder.for(r)];case 1:return n=u.sent(),i=this.context.nextRef(),s=tme.default.of(i,this,n),this.images.push(s),[2,s]}})})},e.prototype.embedPng=function(t){return Fr.__awaiter(this,void 0,void 0,function(){var r,n,i,s;return Fr.__generator(this,function(u){switch(u.label){case 0:return zt.assertIs(t,"png",["string",Uint8Array,ArrayBuffer]),r=zt.toUint8Array(t),[4,ar.PngEmbedder.for(r)];case 1:return n=u.sent(),i=this.context.nextRef(),s=tme.default.of(i,this,n),this.images.push(s),[2,s]}})})},e.prototype.embedPdf=function(t,r){return r===void 0&&(r=[0]),Fr.__awaiter(this,void 0,void 0,function(){var n,i,s;return Fr.__generator(this,function(u){switch(u.label){case 0:return zt.assertIs(t,"pdf",["string",Uint8Array,ArrayBuffer,[e,"PDFDocument"]]),zt.assertIs(r,"indices",[Array]),t instanceof e?(i=t,[3,3]):[3,1];case 1:return[4,e.load(t)];case 2:i=u.sent(),u.label=3;case 3:return n=i,s=zt.pluckIndices(n.getPages(),r),[2,this.embedPages(s)]}})})},e.prototype.embedPage=function(t,r,n){return Fr.__awaiter(this,void 0,void 0,function(){var i;return Fr.__generator(this,function(s){switch(s.label){case 0:return zt.assertIs(t,"page",[[Ym.default,"PDFPage"]]),[4,this.embedPages([t],[r],[n])];case 1:return i=s.sent()[0],[2,i]}})})},e.prototype.embedPages=function(t,r,n){return r===void 0&&(r=[]),n===void 0&&(n=[]),Fr.__awaiter(this,void 0,void 0,function(){var g,p,i,s,u,f,h,g,p,C,y,x,v,T,Q;return Fr.__generator(this,function(F){switch(F.label){case 0:if(t.length===0)return[2,[]];for(g=0,p=t.length-1;g<p;g++)if(i=t[g],s=t[g+1],i.node.context!==s.node.context)throw new ar.PageEmbeddingMismatchedContextError;u=t[0].node.context,f=u===this.context?function(_){return _}:ar.PDFObjectCopier.for(u,this.context).copy,h=new Array(t.length),g=0,p=t.length,F.label=1;case 1:return g<p?(C=f(t[g].node),y=r[g],x=n[g],[4,ar.PDFPageEmbedder.for(C,y,x)]):[3,4];case 2:v=F.sent(),T=this.context.nextRef(),h[g]=ect.default.of(T,this,v),F.label=3;case 3:return g++,[3,1];case 4:return(Q=this.embeddedPages).push.apply(Q,h),[2,h]}})})},e.prototype.flush=function(){return Fr.__awaiter(this,void 0,void 0,function(){return Fr.__generator(this,function(t){switch(t.label){case 0:return[4,this.embedAll(this.fonts)];case 1:return t.sent(),[4,this.embedAll(this.images)];case 2:return t.sent(),[4,this.embedAll(this.embeddedPages)];case 3:return t.sent(),[4,this.embedAll(this.embeddedFiles)];case 4:return t.sent(),[4,this.embedAll(this.javaScripts)];case 5:return t.sent(),[2]}})})},e.prototype.save=function(t){return t===void 0&&(t={}),Fr.__awaiter(this,void 0,void 0,function(){var r,n,i,s,u,f,h,g,p,C;return Fr.__generator(this,function(y){switch(y.label){case 0:return r=t.useObjectStreams,n=r===void 0?!0:r,i=t.addDefaultPage,s=i===void 0?!0:i,u=t.objectsPerTick,f=u===void 0?50:u,h=t.updateFieldAppearances,g=h===void 0?!0:h,zt.assertIs(n,"useObjectStreams",["boolean"]),zt.assertIs(s,"addDefaultPage",["boolean"]),zt.assertIs(f,"objectsPerTick",["number"]),zt.assertIs(g,"updateFieldAppearances",["boolean"]),s&&this.getPageCount()===0&&this.addPage(),g&&(p=this.formCache.getValue(),p&&p.updateFieldAppearances()),[4,this.flush()];case 1:return y.sent(),C=n?ar.PDFStreamWriter:ar.PDFWriter,[2,C.forContext(this.context,f).serializeToBuffer()]}})})},e.prototype.saveAsBase64=function(t){return t===void 0&&(t={}),Fr.__awaiter(this,void 0,void 0,function(){var r,n,i,s,u;return Fr.__generator(this,function(f){switch(f.label){case 0:return r=t.dataUri,n=r===void 0?!1:r,i=Fr.__rest(t,["dataUri"]),zt.assertIs(n,"dataUri",["boolean"]),[4,this.save(i)];case 1:return s=f.sent(),u=zt.encodeToBase64(s),[2,n?"data:application/pdf;base64,"+u:u]}})})},e.prototype.findPageForAnnotationRef=function(t){for(var r=this.getPages(),n=0,i=r.length;n<i;n++){var s=r[n],u=s.node.Annots();if(u?.indexOf(t)!==void 0)return s}},e.prototype.embedAll=function(t){return Fr.__awaiter(this,void 0,void 0,function(){var r,n;return Fr.__generator(this,function(i){switch(i.label){case 0:r=0,n=t.length,i.label=1;case 1:return r<n?[4,t[r].embed()]:[3,4];case 2:i.sent(),i.label=3;case 3:return r++,[3,1];case 4:return[2]}})})},e.prototype.updateInfoDict=function(){var t="pdf-lib (https://github.com/Hopding/pdf-lib)",r=new Date,n=this.getInfoDict();this.setProducer(t),this.setModificationDate(r),n.get(ar.PDFName.of("Creator"))||this.setCreator(t),n.get(ar.PDFName.of("CreationDate"))||this.setCreationDate(r)},e.prototype.getInfoDict=function(){var t=this.context.lookup(this.context.trailerInfo.Info);if(t instanceof ar.PDFDict)return t;var r=this.context.obj({});return this.context.trailerInfo.Info=this.context.register(r),r},e.prototype.assertFontkit=function(){if(!this.fontkit)throw new I3.FontkitNotRegisteredError;return this.fontkit},e})();SP.default=oct;function MA(e){if(!(e instanceof ar.PDFHexString)&&!(e instanceof ar.PDFString))throw new ar.UnexpectedObjectTypeError([ar.PDFHexString,ar.PDFString],e)}});var QP=U(ex=>{"use strict";Object.defineProperty(ex,"__esModule",{value:!0});ex.BlendMode=void 0;var uct;(function(e){e.Normal="Normal",e.Multiply="Multiply",e.Screen="Screen",e.Overlay="Overlay",e.Darken="Darken",e.Lighten="Lighten",e.ColorDodge="ColorDodge",e.ColorBurn="ColorBurn",e.HardLight="HardLight",e.SoftLight="SoftLight",e.Difference="Difference",e.Exclusion="Exclusion"})(uct=ex.BlendMode||(ex.BlendMode={}))});var rl=U(_P=>{"use strict";Object.defineProperty(_P,"__esModule",{value:!0});var OA=(ct(),ze(ut)),tx=Gu(),lg=Lm(),U0=QA(),nme=OA.__importDefault(UA()),cct=OA.__importDefault(c3()),ime=OA.__importDefault(el()),fct=OA.__importDefault(l3()),Ag=QP(),Rs=zo(),lct=m3(),Ia=Xi(),He=fr(),Act=(function(){function e(t,r,n){this.fontSize=24,this.fontColor=tx.rgb(0,0,0),this.lineHeight=24,this.x=0,this.y=0,He.assertIs(t,"leafNode",[[Ia.PDFPageLeaf,"PDFPageLeaf"]]),He.assertIs(r,"ref",[[Ia.PDFRef,"PDFRef"]]),He.assertIs(n,"doc",[[nme.default,"PDFDocument"]]),this.node=t,this.ref=r,this.doc=n}return e.prototype.setRotation=function(t){var r=Rs.toDegrees(t);He.assertMultiple(r,"degreesAngle",90),this.node.set(Ia.PDFName.of("Rotate"),this.doc.context.obj(r))},e.prototype.getRotation=function(){var t=this.node.Rotate();return Rs.degrees(t?t.asNumber():0)},e.prototype.setSize=function(t,r){He.assertIs(t,"width",["number"]),He.assertIs(r,"height",["number"]);var n=this.getMediaBox();this.setMediaBox(n.x,n.y,t,r);var i=this.getCropBox(),s=this.getBleedBox(),u=this.getTrimBox(),f=this.getArtBox(),h=this.node.CropBox(),g=this.node.BleedBox(),p=this.node.TrimBox(),C=this.node.ArtBox();h&&He.rectanglesAreEqual(i,n)&&this.setCropBox(n.x,n.y,t,r),g&&He.rectanglesAreEqual(s,n)&&this.setBleedBox(n.x,n.y,t,r),p&&He.rectanglesAreEqual(u,n)&&this.setTrimBox(n.x,n.y,t,r),C&&He.rectanglesAreEqual(f,n)&&this.setArtBox(n.x,n.y,t,r)},e.prototype.setWidth=function(t){He.assertIs(t,"width",["number"]),this.setSize(t,this.getSize().height)},e.prototype.setHeight=function(t){He.assertIs(t,"height",["number"]),this.setSize(this.getSize().width,t)},e.prototype.setMediaBox=function(t,r,n,i){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),He.assertIs(n,"width",["number"]),He.assertIs(i,"height",["number"]);var s=this.doc.context.obj([t,r,t+n,r+i]);this.node.set(Ia.PDFName.MediaBox,s)},e.prototype.setCropBox=function(t,r,n,i){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),He.assertIs(n,"width",["number"]),He.assertIs(i,"height",["number"]);var s=this.doc.context.obj([t,r,t+n,r+i]);this.node.set(Ia.PDFName.CropBox,s)},e.prototype.setBleedBox=function(t,r,n,i){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),He.assertIs(n,"width",["number"]),He.assertIs(i,"height",["number"]);var s=this.doc.context.obj([t,r,t+n,r+i]);this.node.set(Ia.PDFName.BleedBox,s)},e.prototype.setTrimBox=function(t,r,n,i){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),He.assertIs(n,"width",["number"]),He.assertIs(i,"height",["number"]);var s=this.doc.context.obj([t,r,t+n,r+i]);this.node.set(Ia.PDFName.TrimBox,s)},e.prototype.setArtBox=function(t,r,n,i){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),He.assertIs(n,"width",["number"]),He.assertIs(i,"height",["number"]);var s=this.doc.context.obj([t,r,t+n,r+i]);this.node.set(Ia.PDFName.ArtBox,s)},e.prototype.getSize=function(){var t=this.getMediaBox(),r=t.width,n=t.height;return{width:r,height:n}},e.prototype.getWidth=function(){return this.getSize().width},e.prototype.getHeight=function(){return this.getSize().height},e.prototype.getMediaBox=function(){var t=this.node.MediaBox();return t.asRectangle()},e.prototype.getCropBox=function(){var t,r=this.node.CropBox();return(t=r?.asRectangle())!==null&&t!==void 0?t:this.getMediaBox()},e.prototype.getBleedBox=function(){var t,r=this.node.BleedBox();return(t=r?.asRectangle())!==null&&t!==void 0?t:this.getCropBox()},e.prototype.getTrimBox=function(){var t,r=this.node.TrimBox();return(t=r?.asRectangle())!==null&&t!==void 0?t:this.getCropBox()},e.prototype.getArtBox=function(){var t,r=this.node.ArtBox();return(t=r?.asRectangle())!==null&&t!==void 0?t:this.getCropBox()},e.prototype.translateContent=function(t,r){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),this.node.normalize(),this.getContentStream();var n=this.createContentStream(U0.pushGraphicsState(),U0.translate(t,r)),i=this.doc.context.register(n),s=this.createContentStream(U0.popGraphicsState()),u=this.doc.context.register(s);this.node.wrapContentStreams(i,u)},e.prototype.scale=function(t,r){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),this.setSize(this.getWidth()*t,this.getHeight()*r),this.scaleContent(t,r),this.scaleAnnotations(t,r)},e.prototype.scaleContent=function(t,r){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),this.node.normalize(),this.getContentStream();var n=this.createContentStream(U0.pushGraphicsState(),U0.scale(t,r)),i=this.doc.context.register(n),s=this.createContentStream(U0.popGraphicsState()),u=this.doc.context.register(s);this.node.wrapContentStreams(i,u)},e.prototype.scaleAnnotations=function(t,r){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]);var n=this.node.Annots();if(n)for(var i=0;i<n.size();i++){var s=n.lookup(i);s instanceof Ia.PDFDict&&this.scaleAnnot(s,t,r)}},e.prototype.resetPosition=function(){this.getContentStream(!1),this.x=0,this.y=0},e.prototype.setFont=function(t){He.assertIs(t,"font",[[ime.default,"PDFFont"]]),this.font=t,this.fontKey=this.node.newFontDictionary(this.font.name,this.font.ref)},e.prototype.setFontSize=function(t){He.assertIs(t,"fontSize",["number"]),this.fontSize=t},e.prototype.setFontColor=function(t){He.assertIs(t,"fontColor",[[Object,"Color"]]),this.fontColor=t},e.prototype.setLineHeight=function(t){He.assertIs(t,"lineHeight",["number"]),this.lineHeight=t},e.prototype.getPosition=function(){return{x:this.x,y:this.y}},e.prototype.getX=function(){return this.x},e.prototype.getY=function(){return this.y},e.prototype.moveTo=function(t,r){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),this.x=t,this.y=r},e.prototype.moveDown=function(t){He.assertIs(t,"yDecrease",["number"]),this.y-=t},e.prototype.moveUp=function(t){He.assertIs(t,"yIncrease",["number"]),this.y+=t},e.prototype.moveLeft=function(t){He.assertIs(t,"xDecrease",["number"]),this.x-=t},e.prototype.moveRight=function(t){He.assertIs(t,"xIncrease",["number"]),this.x+=t},e.prototype.pushOperators=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];He.assertEachIs(t,"operator",[[Ia.PDFOperator,"PDFOperator"]]);var n=this.getContentStream();n.push.apply(n,t)},e.prototype.drawText=function(t,r){var n,i,s,u,f,h,g;r===void 0&&(r={}),He.assertIs(t,"text",["string"]),He.assertOrUndefined(r.color,"options.color",[[Object,"Color"]]),He.assertRangeOrUndefined(r.opacity,"opacity.opacity",0,1),He.assertOrUndefined(r.font,"options.font",[[ime.default,"PDFFont"]]),He.assertOrUndefined(r.size,"options.size",["number"]),He.assertOrUndefined(r.rotate,"options.rotate",[[Object,"Rotation"]]),He.assertOrUndefined(r.xSkew,"options.xSkew",[[Object,"Rotation"]]),He.assertOrUndefined(r.ySkew,"options.ySkew",[[Object,"Rotation"]]),He.assertOrUndefined(r.x,"options.x",["number"]),He.assertOrUndefined(r.y,"options.y",["number"]),He.assertOrUndefined(r.lineHeight,"options.lineHeight",["number"]),He.assertOrUndefined(r.maxWidth,"options.maxWidth",["number"]),He.assertOrUndefined(r.wordBreaks,"options.wordBreaks",[Array]),He.assertIsOneOfOrUndefined(r.blendMode,"options.blendMode",Ag.BlendMode);for(var p=this.setOrEmbedFont(r.font),C=p.oldFont,y=p.newFont,x=p.newFontKey,v=r.size||this.fontSize,T=r.wordBreaks||this.doc.defaultWordBreaks,Q=function(q){return y.widthOfTextAtSize(q,v)},F=r.maxWidth===void 0?He.lineSplit(He.cleanText(t)):He.breakTextIntoLines(t,T,r.maxWidth,Q),_=new Array(F.length),S=0,N=F.length;S<N;S++)_[S]=y.encodeText(F[S]);var O=this.maybeEmbedGraphicsState({opacity:r.opacity,blendMode:r.blendMode}),H=this.getContentStream();H.push.apply(H,lg.drawLinesOfText(_,{color:(n=r.color)!==null&&n!==void 0?n:this.fontColor,font:x,size:v,rotate:(i=r.rotate)!==null&&i!==void 0?i:Rs.degrees(0),xSkew:(s=r.xSkew)!==null&&s!==void 0?s:Rs.degrees(0),ySkew:(u=r.ySkew)!==null&&u!==void 0?u:Rs.degrees(0),x:(f=r.x)!==null&&f!==void 0?f:this.x,y:(h=r.y)!==null&&h!==void 0?h:this.y,lineHeight:(g=r.lineHeight)!==null&&g!==void 0?g:this.lineHeight,graphicsState:O})),r.font&&(C?this.setFont(C):this.resetFont())},e.prototype.drawImage=function(t,r){var n,i,s,u,f,h,g;r===void 0&&(r={}),He.assertIs(t,"image",[[fct.default,"PDFImage"]]),He.assertOrUndefined(r.x,"options.x",["number"]),He.assertOrUndefined(r.y,"options.y",["number"]),He.assertOrUndefined(r.width,"options.width",["number"]),He.assertOrUndefined(r.height,"options.height",["number"]),He.assertOrUndefined(r.rotate,"options.rotate",[[Object,"Rotation"]]),He.assertOrUndefined(r.xSkew,"options.xSkew",[[Object,"Rotation"]]),He.assertOrUndefined(r.ySkew,"options.ySkew",[[Object,"Rotation"]]),He.assertRangeOrUndefined(r.opacity,"opacity.opacity",0,1),He.assertIsOneOfOrUndefined(r.blendMode,"options.blendMode",Ag.BlendMode);var p=this.node.newXObject("Image",t.ref),C=this.maybeEmbedGraphicsState({opacity:r.opacity,blendMode:r.blendMode}),y=this.getContentStream();y.push.apply(y,lg.drawImage(p,{x:(n=r.x)!==null&&n!==void 0?n:this.x,y:(i=r.y)!==null&&i!==void 0?i:this.y,width:(s=r.width)!==null&&s!==void 0?s:t.size().width,height:(u=r.height)!==null&&u!==void 0?u:t.size().height,rotate:(f=r.rotate)!==null&&f!==void 0?f:Rs.degrees(0),xSkew:(h=r.xSkew)!==null&&h!==void 0?h:Rs.degrees(0),ySkew:(g=r.ySkew)!==null&&g!==void 0?g:Rs.degrees(0),graphicsState:C}))},e.prototype.drawPage=function(t,r){var n,i,s,u,f;r===void 0&&(r={}),He.assertIs(t,"embeddedPage",[[cct.default,"PDFEmbeddedPage"]]),He.assertOrUndefined(r.x,"options.x",["number"]),He.assertOrUndefined(r.y,"options.y",["number"]),He.assertOrUndefined(r.xScale,"options.xScale",["number"]),He.assertOrUndefined(r.yScale,"options.yScale",["number"]),He.assertOrUndefined(r.width,"options.width",["number"]),He.assertOrUndefined(r.height,"options.height",["number"]),He.assertOrUndefined(r.rotate,"options.rotate",[[Object,"Rotation"]]),He.assertOrUndefined(r.xSkew,"options.xSkew",[[Object,"Rotation"]]),He.assertOrUndefined(r.ySkew,"options.ySkew",[[Object,"Rotation"]]),He.assertRangeOrUndefined(r.opacity,"opacity.opacity",0,1),He.assertIsOneOfOrUndefined(r.blendMode,"options.blendMode",Ag.BlendMode);var h=this.node.newXObject("EmbeddedPdfPage",t.ref),g=this.maybeEmbedGraphicsState({opacity:r.opacity,blendMode:r.blendMode}),p=r.width!==void 0?r.width/t.width:r.xScale!==void 0?r.xScale:1,C=r.height!==void 0?r.height/t.height:r.yScale!==void 0?r.yScale:1,y=this.getContentStream();y.push.apply(y,lg.drawPage(h,{x:(n=r.x)!==null&&n!==void 0?n:this.x,y:(i=r.y)!==null&&i!==void 0?i:this.y,xScale:p,yScale:C,rotate:(s=r.rotate)!==null&&s!==void 0?s:Rs.degrees(0),xSkew:(u=r.xSkew)!==null&&u!==void 0?u:Rs.degrees(0),ySkew:(f=r.ySkew)!==null&&f!==void 0?f:Rs.degrees(0),graphicsState:g}))},e.prototype.drawSvgPath=function(t,r){var n,i,s,u,f,h,g,p,C;r===void 0&&(r={}),He.assertIs(t,"path",["string"]),He.assertOrUndefined(r.x,"options.x",["number"]),He.assertOrUndefined(r.y,"options.y",["number"]),He.assertOrUndefined(r.scale,"options.scale",["number"]),He.assertOrUndefined(r.rotate,"options.rotate",[[Object,"Rotation"]]),He.assertOrUndefined(r.borderWidth,"options.borderWidth",["number"]),He.assertOrUndefined(r.color,"options.color",[[Object,"Color"]]),He.assertRangeOrUndefined(r.opacity,"opacity.opacity",0,1),He.assertOrUndefined(r.borderColor,"options.borderColor",[[Object,"Color"]]),He.assertOrUndefined(r.borderDashArray,"options.borderDashArray",[Array]),He.assertOrUndefined(r.borderDashPhase,"options.borderDashPhase",["number"]),He.assertIsOneOfOrUndefined(r.borderLineCap,"options.borderLineCap",U0.LineCapStyle),He.assertRangeOrUndefined(r.borderOpacity,"options.borderOpacity",0,1),He.assertIsOneOfOrUndefined(r.blendMode,"options.blendMode",Ag.BlendMode);var y=this.maybeEmbedGraphicsState({opacity:r.opacity,borderOpacity:r.borderOpacity,blendMode:r.blendMode});!("color"in r)&&!("borderColor"in r)&&(r.borderColor=tx.rgb(0,0,0));var x=this.getContentStream();x.push.apply(x,lg.drawSvgPath(t,{x:(n=r.x)!==null&&n!==void 0?n:this.x,y:(i=r.y)!==null&&i!==void 0?i:this.y,scale:r.scale,rotate:(s=r.rotate)!==null&&s!==void 0?s:Rs.degrees(0),color:(u=r.color)!==null&&u!==void 0?u:void 0,borderColor:(f=r.borderColor)!==null&&f!==void 0?f:void 0,borderWidth:(h=r.borderWidth)!==null&&h!==void 0?h:0,borderDashArray:(g=r.borderDashArray)!==null&&g!==void 0?g:void 0,borderDashPhase:(p=r.borderDashPhase)!==null&&p!==void 0?p:void 0,borderLineCap:(C=r.borderLineCap)!==null&&C!==void 0?C:void 0,graphicsState:y}))},e.prototype.drawLine=function(t){var r,n,i,s,u;He.assertIs(t.start,"options.start",[[Object,"{ x: number, y: number }"]]),He.assertIs(t.end,"options.end",[[Object,"{ x: number, y: number }"]]),He.assertIs(t.start.x,"options.start.x",["number"]),He.assertIs(t.start.y,"options.start.y",["number"]),He.assertIs(t.end.x,"options.end.x",["number"]),He.assertIs(t.end.y,"options.end.y",["number"]),He.assertOrUndefined(t.thickness,"options.thickness",["number"]),He.assertOrUndefined(t.color,"options.color",[[Object,"Color"]]),He.assertOrUndefined(t.dashArray,"options.dashArray",[Array]),He.assertOrUndefined(t.dashPhase,"options.dashPhase",["number"]),He.assertIsOneOfOrUndefined(t.lineCap,"options.lineCap",U0.LineCapStyle),He.assertRangeOrUndefined(t.opacity,"opacity.opacity",0,1),He.assertIsOneOfOrUndefined(t.blendMode,"options.blendMode",Ag.BlendMode);var f=this.maybeEmbedGraphicsState({borderOpacity:t.opacity,blendMode:t.blendMode});"color"in t||(t.color=tx.rgb(0,0,0));var h=this.getContentStream();h.push.apply(h,lg.drawLine({start:t.start,end:t.end,thickness:(r=t.thickness)!==null&&r!==void 0?r:1,color:(n=t.color)!==null&&n!==void 0?n:void 0,dashArray:(i=t.dashArray)!==null&&i!==void 0?i:void 0,dashPhase:(s=t.dashPhase)!==null&&s!==void 0?s:void 0,lineCap:(u=t.lineCap)!==null&&u!==void 0?u:void 0,graphicsState:f}))},e.prototype.drawRectangle=function(t){var r,n,i,s,u,f,h,g,p,C,y,x,v;t===void 0&&(t={}),He.assertOrUndefined(t.x,"options.x",["number"]),He.assertOrUndefined(t.y,"options.y",["number"]),He.assertOrUndefined(t.width,"options.width",["number"]),He.assertOrUndefined(t.height,"options.height",["number"]),He.assertOrUndefined(t.rotate,"options.rotate",[[Object,"Rotation"]]),He.assertOrUndefined(t.xSkew,"options.xSkew",[[Object,"Rotation"]]),He.assertOrUndefined(t.ySkew,"options.ySkew",[[Object,"Rotation"]]),He.assertOrUndefined(t.borderWidth,"options.borderWidth",["number"]),He.assertOrUndefined(t.color,"options.color",[[Object,"Color"]]),He.assertRangeOrUndefined(t.opacity,"opacity.opacity",0,1),He.assertOrUndefined(t.borderColor,"options.borderColor",[[Object,"Color"]]),He.assertOrUndefined(t.borderDashArray,"options.borderDashArray",[Array]),He.assertOrUndefined(t.borderDashPhase,"options.borderDashPhase",["number"]),He.assertIsOneOfOrUndefined(t.borderLineCap,"options.borderLineCap",U0.LineCapStyle),He.assertRangeOrUndefined(t.borderOpacity,"options.borderOpacity",0,1),He.assertIsOneOfOrUndefined(t.blendMode,"options.blendMode",Ag.BlendMode);var T=this.maybeEmbedGraphicsState({opacity:t.opacity,borderOpacity:t.borderOpacity,blendMode:t.blendMode});!("color"in t)&&!("borderColor"in t)&&(t.color=tx.rgb(0,0,0));var Q=this.getContentStream();Q.push.apply(Q,lg.drawRectangle({x:(r=t.x)!==null&&r!==void 0?r:this.x,y:(n=t.y)!==null&&n!==void 0?n:this.y,width:(i=t.width)!==null&&i!==void 0?i:150,height:(s=t.height)!==null&&s!==void 0?s:100,rotate:(u=t.rotate)!==null&&u!==void 0?u:Rs.degrees(0),xSkew:(f=t.xSkew)!==null&&f!==void 0?f:Rs.degrees(0),ySkew:(h=t.ySkew)!==null&&h!==void 0?h:Rs.degrees(0),borderWidth:(g=t.borderWidth)!==null&&g!==void 0?g:0,color:(p=t.color)!==null&&p!==void 0?p:void 0,borderColor:(C=t.borderColor)!==null&&C!==void 0?C:void 0,borderDashArray:(y=t.borderDashArray)!==null&&y!==void 0?y:void 0,borderDashPhase:(x=t.borderDashPhase)!==null&&x!==void 0?x:void 0,graphicsState:T,borderLineCap:(v=t.borderLineCap)!==null&&v!==void 0?v:void 0}))},e.prototype.drawSquare=function(t){t===void 0&&(t={});var r=t.size;He.assertOrUndefined(r,"size",["number"]),this.drawRectangle(OA.__assign(OA.__assign({},t),{width:r,height:r}))},e.prototype.drawEllipse=function(t){var r,n,i,s,u,f,h,g,p,C,y;t===void 0&&(t={}),He.assertOrUndefined(t.x,"options.x",["number"]),He.assertOrUndefined(t.y,"options.y",["number"]),He.assertOrUndefined(t.xScale,"options.xScale",["number"]),He.assertOrUndefined(t.yScale,"options.yScale",["number"]),He.assertOrUndefined(t.rotate,"options.rotate",[[Object,"Rotation"]]),He.assertOrUndefined(t.color,"options.color",[[Object,"Color"]]),He.assertRangeOrUndefined(t.opacity,"opacity.opacity",0,1),He.assertOrUndefined(t.borderColor,"options.borderColor",[[Object,"Color"]]),He.assertRangeOrUndefined(t.borderOpacity,"options.borderOpacity",0,1),He.assertOrUndefined(t.borderWidth,"options.borderWidth",["number"]),He.assertOrUndefined(t.borderDashArray,"options.borderDashArray",[Array]),He.assertOrUndefined(t.borderDashPhase,"options.borderDashPhase",["number"]),He.assertIsOneOfOrUndefined(t.borderLineCap,"options.borderLineCap",U0.LineCapStyle),He.assertIsOneOfOrUndefined(t.blendMode,"options.blendMode",Ag.BlendMode);var x=this.maybeEmbedGraphicsState({opacity:t.opacity,borderOpacity:t.borderOpacity,blendMode:t.blendMode});!("color"in t)&&!("borderColor"in t)&&(t.color=tx.rgb(0,0,0));var v=this.getContentStream();v.push.apply(v,lg.drawEllipse({x:(r=t.x)!==null&&r!==void 0?r:this.x,y:(n=t.y)!==null&&n!==void 0?n:this.y,xScale:(i=t.xScale)!==null&&i!==void 0?i:100,yScale:(s=t.yScale)!==null&&s!==void 0?s:100,rotate:(u=t.rotate)!==null&&u!==void 0?u:void 0,color:(f=t.color)!==null&&f!==void 0?f:void 0,borderColor:(h=t.borderColor)!==null&&h!==void 0?h:void 0,borderWidth:(g=t.borderWidth)!==null&&g!==void 0?g:0,borderDashArray:(p=t.borderDashArray)!==null&&p!==void 0?p:void 0,borderDashPhase:(C=t.borderDashPhase)!==null&&C!==void 0?C:void 0,borderLineCap:(y=t.borderLineCap)!==null&&y!==void 0?y:void 0,graphicsState:x}))},e.prototype.drawCircle=function(t){t===void 0&&(t={});var r=t.size,n=r===void 0?100:r;He.assertOrUndefined(n,"size",["number"]),this.drawEllipse(OA.__assign(OA.__assign({},t),{xScale:n,yScale:n}))},e.prototype.setOrEmbedFont=function(t){var r=this.font,n=this.fontKey;t?this.setFont(t):this.getFont();var i=this.font,s=this.fontKey;return{oldFont:r,oldFontKey:n,newFont:i,newFontKey:s}},e.prototype.getFont=function(){if(!this.font||!this.fontKey){var t=this.doc.embedStandardFont(lct.StandardFonts.Helvetica);this.setFont(t)}return[this.font,this.fontKey]},e.prototype.resetFont=function(){this.font=void 0,this.fontKey=void 0},e.prototype.getContentStream=function(t){return t===void 0&&(t=!0),t&&this.contentStream?this.contentStream:(this.contentStream=this.createContentStream(),this.contentStreamRef=this.doc.context.register(this.contentStream),this.node.addContentStream(this.contentStreamRef),this.contentStream)},e.prototype.createContentStream=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=this.doc.context.obj({}),i=Ia.PDFContentStream.of(n,t);return i},e.prototype.maybeEmbedGraphicsState=function(t){var r=t.opacity,n=t.borderOpacity,i=t.blendMode;if(!(r===void 0&&n===void 0&&i===void 0)){var s=this.doc.context.obj({Type:"ExtGState",ca:r,CA:n,BM:i}),u=this.node.newExtGState("GS",s);return u}},e.prototype.scaleAnnot=function(t,r,n){for(var i=["RD","CL","Vertices","QuadPoints","L","Rect"],s=0,u=i.length;s<u;s++){var f=t.lookup(Ia.PDFName.of(i[s]));f instanceof Ia.PDFArray&&f.scalePDFNumbers(r,n)}var h=t.lookup(Ia.PDFName.of("InkList"));if(h instanceof Ia.PDFArray)for(var s=0,u=h.size();s<u;s++){var g=h.lookup(s);g instanceof Ia.PDFArray&&g.scalePDFNumbers(r,n)}},e.of=function(t,r,n){return new e(t,r,n)},e.create=function(t){He.assertIs(t,"doc",[[nme.default,"PDFDocument"]]);var r=Ia.PDFRef.of(-1),n=Ia.PDFPageLeaf.withContextAndParent(t.context,r),i=t.context.register(n);return new e(n,i,t)},e})();_P.default=Act});var xP=U(NP=>{"use strict";Object.defineProperty(NP,"__esModule",{value:!0});var D3=(ct(),ze(ut)),dct=D3.__importDefault(rl()),ame=D3.__importDefault(el()),hct=A3(),sme=RA(),ome=D3.__importStar(tl()),ume=Gu(),gct=zo(),cme=Xi(),dg=fr(),pct=(function(e){D3.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return dg.assertIs(r,"acroButton",[[cme.PDFAcroPushButton,"PDFAcroPushButton"]]),s.acroField=r,s}return t.prototype.setImage=function(r,n){n===void 0&&(n=hct.ImageAlignment.Center);for(var i=this.acroField.getWidgets(),s=0,u=i.length;s<u;s++){var f=i[s],h=this.createImageAppearanceStream(f,r,n);this.updateWidgetAppearances(f,{normal:h})}this.markAsClean()},t.prototype.setFontSize=function(r){dg.assertPositive(r,"fontSize"),this.acroField.setFontSize(r),this.markAsDirty()},t.prototype.addToPage=function(r,n,i){var s,u,f,h,g,p,C,y,x,v,T;dg.assertOrUndefined(r,"text",["string"]),dg.assertOrUndefined(n,"page",[[dct.default,"PDFPage"]]),ome.assertFieldAppearanceOptions(i);var Q=this.createWidget({x:((s=i?.x)!==null&&s!==void 0?s:0)-((u=i?.borderWidth)!==null&&u!==void 0?u:0)/2,y:((f=i?.y)!==null&&f!==void 0?f:0)-((h=i?.borderWidth)!==null&&h!==void 0?h:0)/2,width:(g=i?.width)!==null&&g!==void 0?g:100,height:(p=i?.height)!==null&&p!==void 0?p:50,textColor:(C=i?.textColor)!==null&&C!==void 0?C:ume.rgb(0,0,0),backgroundColor:(y=i?.backgroundColor)!==null&&y!==void 0?y:ume.rgb(.75,.75,.75),borderColor:i?.borderColor,borderWidth:(x=i?.borderWidth)!==null&&x!==void 0?x:0,rotate:(v=i?.rotate)!==null&&v!==void 0?v:gct.degrees(0),caption:r,hidden:i?.hidden,page:n.ref}),F=this.doc.context.register(Q.dict);this.acroField.addWidget(F);var _=(T=i?.font)!==null&&T!==void 0?T:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(Q,_),n.node.addAnnot(F)},t.prototype.needsAppearancesUpdate=function(){var r;if(this.isDirty())return!0;for(var n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=((r=u.getAppearances())===null||r===void 0?void 0:r.normal)instanceof cme.PDFStream;if(!f)return!0}return!1},t.prototype.defaultUpdateAppearances=function(r){dg.assertIs(r,"font",[[ame.default,"PDFFont"]]),this.updateAppearances(r)},t.prototype.updateAppearances=function(r,n){dg.assertIs(r,"font",[[ame.default,"PDFFont"]]),dg.assertOrUndefined(n,"provider",[Function]);for(var i=this.acroField.getWidgets(),s=0,u=i.length;s<u;s++){var f=i[s];this.updateWidgetAppearance(f,r,n)}},t.prototype.updateWidgetAppearance=function(r,n,i){var s=i??sme.defaultButtonAppearanceProvider,u=sme.normalizeAppearance(s(this,r,n));this.updateWidgetAppearanceWithFont(r,n,u)},t.of=function(r,n,i){return new t(r,n,i)},t})(ome.default);NP.default=pct});var fme=U(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});var mct=(ct(),ze(ut));mct.__exportStar(RA(),Ku);var Ect=xP();Object.defineProperty(Ku,"PDFButton",{enumerable:!0,get:function(){return Ect.default}});var bct=tP();Object.defineProperty(Ku,"PDFCheckBox",{enumerable:!0,get:function(){return bct.default}});var Cct=iP();Object.defineProperty(Ku,"PDFDropdown",{enumerable:!0,get:function(){return Cct.default}});var yct=tl();Object.defineProperty(Ku,"PDFField",{enumerable:!0,get:function(){return yct.default}});var xct=yP();Object.defineProperty(Ku,"PDFForm",{enumerable:!0,get:function(){return xct.default}});var vct=oP();Object.defineProperty(Ku,"PDFOptionList",{enumerable:!0,get:function(){return vct.default}});var Ict=lP();Object.defineProperty(Ku,"PDFRadioGroup",{enumerable:!0,get:function(){return Ict.default}});var Dct=dP();Object.defineProperty(Ku,"PDFSignature",{enumerable:!0,get:function(){return Dct.default}});var Bct=EP();Object.defineProperty(Ku,"PDFTextField",{enumerable:!0,get:function(){return Bct.default}})});var Ame=U(B3=>{"use strict";Object.defineProperty(B3,"__esModule",{value:!0});var lme=(ct(),ze(ut));lme.__exportStar(jy(),B3);lme.__exportStar(P7(),B3)});var dme=U(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});var eu=(ct(),ze(ut));eu.__exportStar(fme(),Ri);eu.__exportStar(Ame(),Ri);eu.__exportStar(Gu(),Ri);eu.__exportStar(Pm(),Ri);eu.__exportStar(X7(),Ri);eu.__exportStar(e3(),Ri);eu.__exportStar(Lm(),Ri);eu.__exportStar(QA(),Ri);eu.__exportStar(zo(),Ri);eu.__exportStar(vP(),Ri);eu.__exportStar(QP(),Ri);eu.__exportStar(IP(),Ri);eu.__exportStar(m3(),Ri);var wct=UA();Object.defineProperty(Ri,"PDFDocument",{enumerable:!0,get:function(){return wct.default}});var Fct=el();Object.defineProperty(Ri,"PDFFont",{enumerable:!0,get:function(){return Fct.default}});var Tct=l3();Object.defineProperty(Ri,"PDFImage",{enumerable:!0,get:function(){return Tct.default}});var Sct=rl();Object.defineProperty(Ri,"PDFPage",{enumerable:!0,get:function(){return Sct.default}});var Qct=c3();Object.defineProperty(Ri,"PDFEmbeddedPage",{enumerable:!0,get:function(){return Qct.default}});var _ct=wP();Object.defineProperty(Ri,"PDFJavaScript",{enumerable:!0,get:function(){return _ct.default}})});var gme=U(hme=>{"use strict";Object.defineProperty(hme,"__esModule",{value:!0})});var kP=U(jm=>{"use strict";Object.defineProperty(jm,"__esModule",{value:!0});var w3=(ct(),ze(ut));w3.__exportStar(dme(),jm);w3.__exportStar(Xi(),jm);w3.__exportStar(gme(),jm);w3.__exportStar(fr(),jm)});var Gct={};Ka(Gct,{DocuParse:()=>OP});module.exports=ze(Gct);var M0=require("n8n-workflow");async function rx(e){let t=new URL(e),r=await fetch(e,{headers:{"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8","Accept-Language":"en-US,en;q=0.9","Accept-Encoding":"gzip, deflate, br",Connection:"keep-alive","Upgrade-Insecure-Requests":"1","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Sec-Fetch-Site":"none","Sec-Fetch-User":"?1","Cache-Control":"max-age=0",Referer:t.origin},redirect:"follow"});if(!r.ok)throw new Error(`Failed to fetch URL: ${r.status} ${r.statusText} from ${e}`);let n=Buffer.from(await r.arrayBuffer()),i=r.headers.get("content-type")||"",s=r.headers.get("content-disposition")||"",u="",f=s.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/);return f&&(u=f[1].replace(/['"]/g,"")),u||(u=t.pathname.split("/").pop()||"document"),{buffer:n,mimeType:i,fileName:u}}var OP=class{constructor(){this.description={displayName:"DocuParse",name:"docuParse",icon:"file:icons/ener.png",group:["transform"],version:1,subtitle:'={{ $parameter["operation"] }}',description:"Full-featured document parsing \u2014 PDF, DOCX, XLSX, PPTX, images, OCR, markdown output. No native dependencies.",defaults:{name:"DocuParse"},inputs:["main"],outputs:["main"],properties:[{displayName:"Operation",name:"operation",type:"options",noDataExpression:!0,options:[{name:"Parse Document",value:"parse",description:"Extract text, tables, and structure from documents",action:"Parse a document"},{name:"OCR Image",value:"ocr",description:"Extract text from images using OCR",action:"OCR an image"},{name:"Extract Tables",value:"tables",description:"Extract tables as structured JSON",action:"Extract tables from document"},{name:"Convert to Markdown",value:"markdown",description:"Convert document to clean markdown",action:"Convert to markdown"},{name:"Merge PDFs",value:"merge",description:"Merge multiple PDF files into one",action:"Merge PDF files"},{name:"Split PDF",value:"split",description:"Split PDF into separate pages",action:"Split PDF into pages"},{name:"Extract Entities",value:"entities",description:"Extract emails, phones, URLs, dates from text",action:"Extract entities from document"}],default:"parse"},{displayName:"Input Type",name:"inputType",type:"options",options:[{name:"Binary Data",value:"binary",description:"Parse file from binary data in workflow"},{name:"URL",value:"url",description:"Fetch and parse file from a URL"}],default:"binary",description:"How to get the document to parse"},{displayName:"Input Binary Field",name:"binaryPropertyName",type:"string",default:"data",required:!0,description:"The name of the binary property containing the document file",displayOptions:{show:{inputType:["binary"]}}},{displayName:"URL",name:"inputUrl",type:"string",default:"",required:!0,placeholder:"https://example.com/document.pdf",description:"URL of the document to fetch and parse",displayOptions:{show:{inputType:["url"]}}},{displayName:"Skip SSL Verification",name:"skipSsl",type:"boolean",default:!1,description:"Enable this if the URL has SSL certificate issues (e.g., university or government sites with incomplete certificates). WARNING: Only use for trusted URLs.",displayOptions:{show:{inputType:["url"]}}},{displayName:"Output Format",name:"outputFormat",type:"options",options:[{name:"Markdown",value:"markdown",description:"Structured markdown with headings, tables, lists"},{name:"JSON",value:"json",description:"Structured JSON with text items and positions"},{name:"Text",value:"text",description:"Plain text with layout preserved"}],default:"markdown",description:"Output format for the parsed document",displayOptions:{show:{operation:["parse"]}}},{displayName:"OCR Language",name:"ocrLanguage",type:"options",options:[{name:"English",value:"eng"},{name:"Arabic",value:"ara"},{name:"Chinese (Simplified)",value:"chi_sim"},{name:"Chinese (Traditional)",value:"chi_tra"},{name:"French",value:"fra"},{name:"German",value:"deu"},{name:"Hindi",value:"hin"},{name:"Japanese",value:"jpn"},{name:"Korean",value:"kor"},{name:"Portuguese",value:"por"},{name:"Russian",value:"rus"},{name:"Spanish",value:"spa"},{name:"Urdu",value:"urd"}],default:"eng",description:"Language for OCR recognition",displayOptions:{show:{operation:["ocr","parse"]}}},{displayName:"Enable OCR for Scanned Pages",name:"enableOcr",type:"boolean",default:!1,description:"Whether to run OCR on pages with little or no text (scanned documents)",displayOptions:{show:{operation:["parse"]}}},{displayName:"Target Pages",name:"targetPages",type:"string",default:"",placeholder:"1-5,10,15-20",description:'Specific pages to process (e.g. "1-5,10,15-20"). Leave empty for all pages.',displayOptions:{show:{operation:["parse","markdown","tables","split"]}}},{displayName:"Entity Types",name:"entityTypes",type:"multiOptions",options:[{name:"Emails",value:"emails"},{name:"Phone Numbers",value:"phones"},{name:"URLs",value:"urls"},{name:"Dates",value:"dates"},{name:"IP Addresses",value:"ips"},{name:"Currency Amounts",value:"currency"}],default:["emails","phones","urls","dates"],description:"Types of entities to extract",displayOptions:{show:{operation:["entities"]}}},{displayName:"Additional PDF Fields",name:"additionalPdfFields",type:"string",default:"data1",placeholder:"data1,data2,data3",description:"Comma-separated binary field names for additional PDFs to merge",displayOptions:{show:{operation:["merge"]}}},{displayName:"Password",name:"password",type:"string",typeOptions:{password:!0},default:"",description:"Password for encrypted/protected documents",displayOptions:{show:{operation:["parse","markdown","tables","split"]}}},{displayName:"Extract Images",name:"extractImages",type:"boolean",default:!1,description:"Whether to extract images from the document as binary data",displayOptions:{show:{operation:["parse"]}}}]}}async execute(){let t=this.getInputData(),r=[],n=this.getNodeParameter("operation",0),i=this.getNodeParameter("inputType",0,"binary");if(n==="parse"){let s=this.getNodeParameter("outputFormat",0),u=this.getNodeParameter("enableOcr",0),f=this.getNodeParameter("ocrLanguage",0,"eng"),h=this.getNodeParameter("targetPages",0,""),g=this.getNodeParameter("password",0,"")||void 0;for(let p=0;p<t.length;p++)try{let C,y="",x="document";if(i==="url"){let Q=this.getNodeParameter("inputUrl",p);if(!Q)throw new M0.NodeOperationError(this.getNode(),"URL is required",{itemIndex:p});let F=this.getNodeParameter("skipSsl",p,!1);C=(await rx(Q,F)).buffer,y=response.headers.get("content-type")||"",x=new URL(Q).pathname.split("/").pop()||"document"}else{let Q=this.getNodeParameter("binaryPropertyName",0);C=await this.helpers.getBinaryDataBuffer(p,Q);let F=t[p].binary?.[Q];if(!F)throw new M0.NodeOperationError(this.getNode(),`Binary property "${Q}" not found on item ${p}`,{itemIndex:p});y=F.mimeType||"",x=F.fileName||"document"}let v=x.split(".").pop()?.toLowerCase()||"",T={};if(y==="application/pdf"||v==="pdf")T=await RP(C,s,h,u,f,g);else if(y.includes("wordprocessingml")||v==="docx"||v==="doc")T=await UP(C,s);else if(y.includes("spreadsheetml")||v==="xlsx"||v==="xls")T=await Nct(C,s);else if(y.includes("presentationml")||v==="pptx"||v==="ppt")T=await kct(C,s);else if(y.includes("text/html")||v==="html"||v==="htm")T=await pme(C,s);else if(y.includes("text/csv")||v==="csv")T=await Rct(C,s);else if(y.startsWith("image/")||["png","jpg","jpeg","tiff","bmp","webp"].includes(v))T=await LP(C,f);else if(y.startsWith("text/")||["txt","md","json","xml"].includes(v))T={text:C.toString("utf-8"),format:"text"};else throw new Error(`Unsupported file type: ${y} (.${v})`);r.push({json:{...T,fileName:x,mimeType:y,format:s},binary:t[p].binary})}catch(C){if(this.continueOnFail()){r.push({json:{error:C.message},pairedItem:{item:p}});continue}throw new M0.NodeOperationError(this.getNode(),C,{itemIndex:p})}}else if(n==="ocr"){let s=this.getNodeParameter("ocrLanguage",0,"eng");for(let u=0;u<t.length;u++)try{let f;if(i==="url"){let g=this.getNodeParameter("inputUrl",u),p=this.getNodeParameter("skipSsl",u,!1);f=(await rx(g,p)).buffer}else{let g=this.getNodeParameter("binaryPropertyName",0);f=await this.helpers.getBinaryDataBuffer(u,g)}let h=await LP(f,s);r.push({json:{...h,format:"ocr"},binary:t[u].binary})}catch(f){if(this.continueOnFail()){r.push({json:{error:f.message},pairedItem:{item:u}});continue}throw new M0.NodeOperationError(this.getNode(),f,{itemIndex:u})}}else if(n==="tables"){let s=this.getNodeParameter("targetPages",0,"");for(let u=0;u<t.length;u++)try{let f,h;if(i==="url"){let C=this.getNodeParameter("inputUrl",u),y=this.getNodeParameter("skipSsl",u,!1),x=await rx(C,y);f=x.buffer,h={fileName:x.fileName,mimeType:x.mimeType}}else{let C=this.getNodeParameter("binaryPropertyName",0);f=await this.helpers.getBinaryDataBuffer(u,C),h=t[u].binary?.[C]}let g=h?.fileName?.split(".").pop()?.toLowerCase()||"",p=[];if(h?.mimeType==="application/pdf"||g==="pdf")p=await Uct(f,s);else if(h?.mimeType?.includes("spreadsheetml")||g==="xlsx"||g==="xls")p=await Mct(f);else throw new Error("Table extraction supports PDF and XLSX files only");r.push({json:{tables:p,tableCount:p.length},binary:t[u].binary})}catch(f){if(this.continueOnFail()){r.push({json:{error:f.message},pairedItem:{item:u}});continue}throw new M0.NodeOperationError(this.getNode(),f,{itemIndex:u})}}else if(n==="markdown"){let s=this.getNodeParameter("targetPages",0,"");for(let u=0;u<t.length;u++)try{let f,h;if(i==="url"){let C=this.getNodeParameter("inputUrl",u),y=this.getNodeParameter("skipSsl",u,!1);f=(await rx(C,y)).buffer,h={fileName:new URL(C).pathname.split("/").pop(),mimeType:response.headers.get("content-type")}}else{let C=this.getNodeParameter("binaryPropertyName",0);f=await this.helpers.getBinaryDataBuffer(u,C),h=t[u].binary?.[C]}let g=h?.fileName?.split(".").pop()?.toLowerCase()||"",p="";if(h?.mimeType==="application/pdf"||g==="pdf")p=(await RP(f,"markdown",s,!1,"eng")).text;else if(h?.mimeType?.includes("wordprocessingml")||g==="docx")p=(await UP(f,"markdown")).text;else if(h?.mimeType?.includes("text/html")||g==="html")p=(await pme(f,"markdown")).text;else throw new Error("Markdown conversion supports PDF, DOCX, and HTML files");r.push({json:{markdown:p,format:"markdown"},binary:t[u].binary})}catch(f){if(this.continueOnFail()){r.push({json:{error:f.message},pairedItem:{item:u}});continue}throw new M0.NodeOperationError(this.getNode(),f,{itemIndex:u})}}else if(n==="merge"){let s=this.getNodeParameter("additionalPdfFields",0,"").split(",").map(p=>p.trim()).filter(Boolean),u=[binaryPropertyName,...s],f=[];for(let p=0;p<t.length;p++)for(let C of u)try{let y=await this.helpers.getBinaryDataBuffer(p,C);f.push(y)}catch{}if(f.length<2)throw new M0.NodeOperationError(this.getNode(),"Need at least 2 PDFs to merge");let h=await Oct(f),g=await this.helpers.prepareBinaryData(h,"merged.pdf","application/pdf");r.push({json:{pageCount:f.length,status:"merged"},binary:{...t[0].binary,merged_pdf:g}})}else if(n==="split"){let s=this.getNodeParameter("targetPages",0,"");for(let u=0;u<t.length;u++)try{let f=await this.helpers.getBinaryDataBuffer(u,binaryPropertyName),h=await Lct(f,s);for(let g of h){let p=await this.helpers.prepareBinaryData(g.buffer,`page_${g.pageNum}.pdf`,"application/pdf");r.push({json:{pageNum:g.pageNum},binary:{...t[u].binary,[`page_${g.pageNum}`]:p},pairedItem:{item:u}})}}catch(f){if(this.continueOnFail()){r.push({json:{error:f.message},pairedItem:{item:u}});continue}throw new M0.NodeOperationError(this.getNode(),f,{itemIndex:u})}}else if(n==="entities"){let s=this.getNodeParameter("entityTypes",0);for(let u=0;u<t.length;u++)try{let f,h;if(i==="url"){let x=this.getNodeParameter("inputUrl",u),v=this.getNodeParameter("skipSsl",u,!1);f=(await rx(x,v)).buffer,h={fileName:new URL(x).pathname.split("/").pop(),mimeType:response.headers.get("content-type")}}else{let x=this.getNodeParameter("binaryPropertyName",0);f=await this.helpers.getBinaryDataBuffer(u,x),h=t[u].binary?.[x]}let g=h?.mimeType||"",p=h?.fileName?.split(".").pop()?.toLowerCase()||"",C="";g==="application/pdf"||p==="pdf"?C=(await RP(f,"text","",!1,"eng")).text:g.includes("wordprocessingml")||p==="docx"?C=(await UP(f,"text")).text:C=f.toString("utf-8");let y=Pct(C,s);r.push({json:{entities:y,entityCounts:Object.fromEntries(s.map(x=>[x,y[x]?.length||0]))},binary:t[u].binary})}catch(f){if(this.continueOnFail()){r.push({json:{error:f.message},pairedItem:{item:u}});continue}throw new M0.NodeOperationError(this.getNode(),f,{itemIndex:u})}}return[r]}};async function RP(e,t,r,n,i,s){let h=await(await import("pdfjs-dist")).getDocument({data:new Uint8Array(e),password:s}).promise,g=h.numPages,p=r?PP(r,g):Array.from({length:g},(x,v)=>v+1),C=[];for(let x of p)try{let v=await h.getPage(x),T=await v.getTextContent(),Q=v.getViewport({scale:1}),F=T.items.map(ne=>({text:ne.str,x:Math.round(ne.transform[4]*10)/10,y:Math.round(ne.transform[5]*10)/10,width:ne.width||0,height:Math.abs(ne.transform[3])||12,fontName:ne.fontName||""})).filter(ne=>ne.text.trim().length>0),_=Q.height,S=_*.95,N=_*.05,O=F.filter(ne=>ne.y<S&&ne.y>N),H=3,q=[],G=[...O].sort((ne,Le)=>Le.y-ne.y);for(let ne of G){let Le=q.find(X=>Math.abs(X.y-ne.y)<H);Le?Le.items.push(ne):q.push({y:ne.y,items:[ne]})}for(let ne of q)ne.items.sort((Le,X)=>Le.x-X.x);let J=50,Ie=[];for(let ne of q){if(ne.items.length===0)continue;let Le=ne.items[0].text;for(let X=1;X<ne.items.length;X++)ne.items[X].x-(ne.items[X-1].x+ne.items[X-1].width)>J?Le+=" ":Le+=" ",Le+=ne.items[X].text;Ie.push(Le.trim())}let fe=Ie.join(`
|
|
542
542
|
`),z=!1;if(n)try{let ne=await Hct(v,Q),X=(await Wct(ne,i)).text?.trim()||"";if(X.length>0)if(fe.length>50){let se=new Set(fe.toLowerCase().split(/\s+/));X.toLowerCase().split(/\s+/).filter(me=>!se.has(me)&&me.length>2).length>10&&(fe=fe+`
|
|
543
543
|
|
|
544
544
|
[OCR Content from page images]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-docuparse",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Full-featured document parsing node for n8n — PDF, DOCX, XLSX, PPTX, images, OCR, markdown output. No native dependencies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|