@pdfme/ui 4.5.0 → 4.5.1-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +10 -8
- package/dist/index.umd.js +2 -2
- package/dist/types/class.d.ts +33 -0
- package/dist/types/helper.d.ts +5 -0
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
@@ -9318,7 +9318,9 @@ const Schema$1 = z.object({
|
|
9318
9318
|
rotate: z.number().optional(),
|
9319
9319
|
opacity: z.number().optional(),
|
9320
9320
|
readOnly: z.boolean().optional(),
|
9321
|
-
required: z.boolean().optional()
|
9321
|
+
required: z.boolean().optional(),
|
9322
|
+
__bodyRange: z.object({ start: z.number(), end: z.number().optional() }).optional(),
|
9323
|
+
__isSplit: z.boolean().optional()
|
9322
9324
|
}).passthrough(), SchemaForUIAdditionalInfo = z.object({
|
9323
9325
|
id: z.string(),
|
9324
9326
|
key: z.string()
|
@@ -9521,13 +9523,13 @@ function resortChildren(a, s) {
|
|
9521
9523
|
async function createOnePage(a) {
|
9522
9524
|
const { basePdf: s, schemaObj: $, orderMap: _, input: _e, options: tt, _cache: nt, getDynamicHeights: at } = a, ot = createPage(s), rt = [], st = Object.entries($).sort((it, ut) => it[1].position.y - ut[1].position.y), lt = /* @__PURE__ */ new Map();
|
9523
9525
|
for (const [it, ut] of st) {
|
9524
|
-
const { position: ft, width: ht } = ut, dt = { schema: ut, basePdf: s, options: tt, _cache: nt }, gt =
|
9525
|
-
|
9526
|
-
let
|
9527
|
-
for (const [
|
9528
|
-
|
9529
|
-
const
|
9530
|
-
rt.push(
|
9526
|
+
const { position: ft, width: ht } = ut, dt = { schema: ut, basePdf: s, options: tt, _cache: nt }, gt = (ut.readOnly ? ut.content : _e == null ? void 0 : _e[it]) || "", pt = await at(gt, dt), mt = pt.reduce((vt, At) => vt + At, 0), ct = ut.height;
|
9527
|
+
mt !== ct && lt.set(ft.y + ct, mt - ct), pt.forEach((vt, At) => {
|
9528
|
+
let xt = ut.position.y + pt.reduce((Et, St, Bt) => Bt < At ? Et + St : Et, 0);
|
9529
|
+
for (const [Et, St] of lt.entries())
|
9530
|
+
Et <= ut.position.y && (xt += St);
|
9531
|
+
const bt = createNode({ key: it, schema: ut, position: { ...ft, y: xt }, width: ht, height: vt });
|
9532
|
+
rt.push(xt + vt + s.padding[2]), ot.insertChild(bt);
|
9531
9533
|
});
|
9532
9534
|
}
|
9533
9535
|
const et = Math.max(...rt, s.height - s.padding[2]);
|
package/dist/index.umd.js
CHANGED
@@ -39,7 +39,7 @@ Add a <Suspense fallback=...> component higher in the tree to provide a loading
|
|
39
39
|
*
|
40
40
|
* @author Feross Aboukhadijeh <https://feross.org>
|
41
41
|
* @license MIT
|
42
|
-
*/(function(a){const s=base64Js,$=ieee754,_=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;a.Buffer=at,a.SlowBuffer=gt,a.INSPECT_MAX_BYTES=50;const _e=2147483647;a.kMaxLength=_e,at.TYPED_ARRAY_SUPPORT=tt(),!at.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function tt(){try{const Xt=new Uint8Array(1),Gt={foo:function(){return 42}};return Object.setPrototypeOf(Gt,Uint8Array.prototype),Object.setPrototypeOf(Xt,Gt),Xt.foo()===42}catch{return!1}}Object.defineProperty(at.prototype,"parent",{enumerable:!0,get:function(){if(at.isBuffer(this))return this.buffer}}),Object.defineProperty(at.prototype,"offset",{enumerable:!0,get:function(){if(at.isBuffer(this))return this.byteOffset}});function nt(Xt){if(Xt>_e)throw new RangeError('The value "'+Xt+'" is invalid for option "size"');const Gt=new Uint8Array(Xt);return Object.setPrototypeOf(Gt,at.prototype),Gt}function at(Xt,Gt,Wt){if(typeof Xt=="number"){if(typeof Gt=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return lt(Xt)}return ot(Xt,Gt,Wt)}at.poolSize=8192;function ot(Xt,Gt,Wt){if(typeof Xt=="string")return et(Xt,Gt);if(ArrayBuffer.isView(Xt))return ut(Xt);if(Xt==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Xt);if(tr(Xt,ArrayBuffer)||Xt&&tr(Xt.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(tr(Xt,SharedArrayBuffer)||Xt&&tr(Xt.buffer,SharedArrayBuffer)))return ft(Xt,Gt,Wt);if(typeof Xt=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const er=Xt.valueOf&&Xt.valueOf();if(er!=null&&er!==Xt)return at.from(er,Gt,Wt);const lr=ht(Xt);if(lr)return lr;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof Xt[Symbol.toPrimitive]=="function")return at.from(Xt[Symbol.toPrimitive]("string"),Gt,Wt);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Xt)}at.from=function(Xt,Gt,Wt){return ot(Xt,Gt,Wt)},Object.setPrototypeOf(at.prototype,Uint8Array.prototype),Object.setPrototypeOf(at,Uint8Array);function rt(Xt){if(typeof Xt!="number")throw new TypeError('"size" argument must be of type number');if(Xt<0)throw new RangeError('The value "'+Xt+'" is invalid for option "size"')}function st(Xt,Gt,Wt){return rt(Xt),Xt<=0?nt(Xt):Gt!==void 0?typeof Wt=="string"?nt(Xt).fill(Gt,Wt):nt(Xt).fill(Gt):nt(Xt)}at.alloc=function(Xt,Gt,Wt){return st(Xt,Gt,Wt)};function lt(Xt){return rt(Xt),nt(Xt<0?0:dt(Xt)|0)}at.allocUnsafe=function(Xt){return lt(Xt)},at.allocUnsafeSlow=function(Xt){return lt(Xt)};function et(Xt,Gt){if((typeof Gt!="string"||Gt==="")&&(Gt="utf8"),!at.isEncoding(Gt))throw new TypeError("Unknown encoding: "+Gt);const Wt=pt(Xt,Gt)|0;let er=nt(Wt);const lr=er.write(Xt,Gt);return lr!==Wt&&(er=er.slice(0,lr)),er}function it(Xt){const Gt=Xt.length<0?0:dt(Xt.length)|0,Wt=nt(Gt);for(let er=0;er<Gt;er+=1)Wt[er]=Xt[er]&255;return Wt}function ut(Xt){if(tr(Xt,Uint8Array)){const Gt=new Uint8Array(Xt);return ft(Gt.buffer,Gt.byteOffset,Gt.byteLength)}return it(Xt)}function ft(Xt,Gt,Wt){if(Gt<0||Xt.byteLength<Gt)throw new RangeError('"offset" is outside of buffer bounds');if(Xt.byteLength<Gt+(Wt||0))throw new RangeError('"length" is outside of buffer bounds');let er;return Gt===void 0&&Wt===void 0?er=new Uint8Array(Xt):Wt===void 0?er=new Uint8Array(Xt,Gt):er=new Uint8Array(Xt,Gt,Wt),Object.setPrototypeOf(er,at.prototype),er}function ht(Xt){if(at.isBuffer(Xt)){const Gt=dt(Xt.length)|0,Wt=nt(Gt);return Wt.length===0||Xt.copy(Wt,0,0,Gt),Wt}if(Xt.length!==void 0)return typeof Xt.length!="number"||ir(Xt.length)?nt(0):it(Xt);if(Xt.type==="Buffer"&&Array.isArray(Xt.data))return it(Xt.data)}function dt(Xt){if(Xt>=_e)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+_e.toString(16)+" bytes");return Xt|0}function gt(Xt){return+Xt!=Xt&&(Xt=0),at.alloc(+Xt)}at.isBuffer=function(Gt){return Gt!=null&&Gt._isBuffer===!0&&Gt!==at.prototype},at.compare=function(Gt,Wt){if(tr(Gt,Uint8Array)&&(Gt=at.from(Gt,Gt.offset,Gt.byteLength)),tr(Wt,Uint8Array)&&(Wt=at.from(Wt,Wt.offset,Wt.byteLength)),!at.isBuffer(Gt)||!at.isBuffer(Wt))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(Gt===Wt)return 0;let er=Gt.length,lr=Wt.length;for(let ur=0,pr=Math.min(er,lr);ur<pr;++ur)if(Gt[ur]!==Wt[ur]){er=Gt[ur],lr=Wt[ur];break}return er<lr?-1:lr<er?1:0},at.isEncoding=function(Gt){switch(String(Gt).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},at.concat=function(Gt,Wt){if(!Array.isArray(Gt))throw new TypeError('"list" argument must be an Array of Buffers');if(Gt.length===0)return at.alloc(0);let er;if(Wt===void 0)for(Wt=0,er=0;er<Gt.length;++er)Wt+=Gt[er].length;const lr=at.allocUnsafe(Wt);let ur=0;for(er=0;er<Gt.length;++er){let pr=Gt[er];if(tr(pr,Uint8Array))ur+pr.length>lr.length?(at.isBuffer(pr)||(pr=at.from(pr)),pr.copy(lr,ur)):Uint8Array.prototype.set.call(lr,pr,ur);else if(at.isBuffer(pr))pr.copy(lr,ur);else throw new TypeError('"list" argument must be an Array of Buffers');ur+=pr.length}return lr};function pt(Xt,Gt){if(at.isBuffer(Xt))return Xt.length;if(ArrayBuffer.isView(Xt)||tr(Xt,ArrayBuffer))return Xt.byteLength;if(typeof Xt!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof Xt);const Wt=Xt.length,er=arguments.length>2&&arguments[2]===!0;if(!er&&Wt===0)return 0;let lr=!1;for(;;)switch(Gt){case"ascii":case"latin1":case"binary":return Wt;case"utf8":case"utf-8":return Jt(Xt).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Wt*2;case"hex":return Wt>>>1;case"base64":return Kt(Xt).length;default:if(lr)return er?-1:Jt(Xt).length;Gt=(""+Gt).toLowerCase(),lr=!0}}at.byteLength=pt;function mt(Xt,Gt,Wt){let er=!1;if((Gt===void 0||Gt<0)&&(Gt=0),Gt>this.length||((Wt===void 0||Wt>this.length)&&(Wt=this.length),Wt<=0)||(Wt>>>=0,Gt>>>=0,Wt<=Gt))return"";for(Xt||(Xt="utf8");;)switch(Xt){case"hex":return Rt(this,Gt,Wt);case"utf8":case"utf-8":return Pt(this,Gt,Wt);case"ascii":return It(this,Gt,Wt);case"latin1":case"binary":return yt(this,Gt,Wt);case"base64":return Ot(this,Gt,Wt);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return kt(this,Gt,Wt);default:if(er)throw new TypeError("Unknown encoding: "+Xt);Xt=(Xt+"").toLowerCase(),er=!0}}at.prototype._isBuffer=!0;function ct(Xt,Gt,Wt){const er=Xt[Gt];Xt[Gt]=Xt[Wt],Xt[Wt]=er}at.prototype.swap16=function(){const Gt=this.length;if(Gt%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let Wt=0;Wt<Gt;Wt+=2)ct(this,Wt,Wt+1);return this},at.prototype.swap32=function(){const Gt=this.length;if(Gt%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let Wt=0;Wt<Gt;Wt+=4)ct(this,Wt,Wt+3),ct(this,Wt+1,Wt+2);return this},at.prototype.swap64=function(){const Gt=this.length;if(Gt%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let Wt=0;Wt<Gt;Wt+=8)ct(this,Wt,Wt+7),ct(this,Wt+1,Wt+6),ct(this,Wt+2,Wt+5),ct(this,Wt+3,Wt+4);return this},at.prototype.toString=function(){const Gt=this.length;return Gt===0?"":arguments.length===0?Pt(this,0,Gt):mt.apply(this,arguments)},at.prototype.toLocaleString=at.prototype.toString,at.prototype.equals=function(Gt){if(!at.isBuffer(Gt))throw new TypeError("Argument must be a Buffer");return this===Gt?!0:at.compare(this,Gt)===0},at.prototype.inspect=function(){let Gt="";const Wt=a.INSPECT_MAX_BYTES;return Gt=this.toString("hex",0,Wt).replace(/(.{2})/g,"$1 ").trim(),this.length>Wt&&(Gt+=" ... "),"<Buffer "+Gt+">"},_&&(at.prototype[_]=at.prototype.inspect),at.prototype.compare=function(Gt,Wt,er,lr,ur){if(tr(Gt,Uint8Array)&&(Gt=at.from(Gt,Gt.offset,Gt.byteLength)),!at.isBuffer(Gt))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof Gt);if(Wt===void 0&&(Wt=0),er===void 0&&(er=Gt?Gt.length:0),lr===void 0&&(lr=0),ur===void 0&&(ur=this.length),Wt<0||er>Gt.length||lr<0||ur>this.length)throw new RangeError("out of range index");if(lr>=ur&&Wt>=er)return 0;if(lr>=ur)return-1;if(Wt>=er)return 1;if(Wt>>>=0,er>>>=0,lr>>>=0,ur>>>=0,this===Gt)return 0;let pr=ur-lr,yr=er-Wt;const Er=Math.min(pr,yr),br=this.slice(lr,ur),gr=Gt.slice(Wt,er);for(let Ar=0;Ar<Er;++Ar)if(br[Ar]!==gr[Ar]){pr=br[Ar],yr=gr[Ar];break}return pr<yr?-1:yr<pr?1:0};function vt(Xt,Gt,Wt,er,lr){if(Xt.length===0)return-1;if(typeof Wt=="string"?(er=Wt,Wt=0):Wt>2147483647?Wt=2147483647:Wt<-2147483648&&(Wt=-2147483648),Wt=+Wt,ir(Wt)&&(Wt=lr?0:Xt.length-1),Wt<0&&(Wt=Xt.length+Wt),Wt>=Xt.length){if(lr)return-1;Wt=Xt.length-1}else if(Wt<0)if(lr)Wt=0;else return-1;if(typeof Gt=="string"&&(Gt=at.from(Gt,er)),at.isBuffer(Gt))return Gt.length===0?-1:At(Xt,Gt,Wt,er,lr);if(typeof Gt=="number")return Gt=Gt&255,typeof Uint8Array.prototype.indexOf=="function"?lr?Uint8Array.prototype.indexOf.call(Xt,Gt,Wt):Uint8Array.prototype.lastIndexOf.call(Xt,Gt,Wt):At(Xt,[Gt],Wt,er,lr);throw new TypeError("val must be string, number or Buffer")}function At(Xt,Gt,Wt,er,lr){let ur=1,pr=Xt.length,yr=Gt.length;if(er!==void 0&&(er=String(er).toLowerCase(),er==="ucs2"||er==="ucs-2"||er==="utf16le"||er==="utf-16le")){if(Xt.length<2||Gt.length<2)return-1;ur=2,pr/=2,yr/=2,Wt/=2}function Er(gr,Ar){return ur===1?gr[Ar]:gr.readUInt16BE(Ar*ur)}let br;if(lr){let gr=-1;for(br=Wt;br<pr;br++)if(Er(Xt,br)===Er(Gt,gr===-1?0:br-gr)){if(gr===-1&&(gr=br),br-gr+1===yr)return gr*ur}else gr!==-1&&(br-=br-gr),gr=-1}else for(Wt+yr>pr&&(Wt=pr-yr),br=Wt;br>=0;br--){let gr=!0;for(let Ar=0;Ar<yr;Ar++)if(Er(Xt,br+Ar)!==Er(Gt,Ar)){gr=!1;break}if(gr)return br}return-1}at.prototype.includes=function(Gt,Wt,er){return this.indexOf(Gt,Wt,er)!==-1},at.prototype.indexOf=function(Gt,Wt,er){return vt(this,Gt,Wt,er,!0)},at.prototype.lastIndexOf=function(Gt,Wt,er){return vt(this,Gt,Wt,er,!1)};function xt(Xt,Gt,Wt,er){Wt=Number(Wt)||0;const lr=Xt.length-Wt;er?(er=Number(er),er>lr&&(er=lr)):er=lr;const ur=Gt.length;er>ur/2&&(er=ur/2);let pr;for(pr=0;pr<er;++pr){const yr=parseInt(Gt.substr(pr*2,2),16);if(ir(yr))return pr;Xt[Wt+pr]=yr}return pr}function bt(Xt,Gt,Wt,er){return nr(Jt(Gt,Xt.length-Wt),Xt,Wt,er)}function Et(Xt,Gt,Wt,er){return nr(rr(Gt),Xt,Wt,er)}function St(Xt,Gt,Wt,er){return nr(Kt(Gt),Xt,Wt,er)}function Bt(Xt,Gt,Wt,er){return nr(Yt(Gt,Xt.length-Wt),Xt,Wt,er)}at.prototype.write=function(Gt,Wt,er,lr){if(Wt===void 0)lr="utf8",er=this.length,Wt=0;else if(er===void 0&&typeof Wt=="string")lr=Wt,er=this.length,Wt=0;else if(isFinite(Wt))Wt=Wt>>>0,isFinite(er)?(er=er>>>0,lr===void 0&&(lr="utf8")):(lr=er,er=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const ur=this.length-Wt;if((er===void 0||er>ur)&&(er=ur),Gt.length>0&&(er<0||Wt<0)||Wt>this.length)throw new RangeError("Attempt to write outside buffer bounds");lr||(lr="utf8");let pr=!1;for(;;)switch(lr){case"hex":return xt(this,Gt,Wt,er);case"utf8":case"utf-8":return bt(this,Gt,Wt,er);case"ascii":case"latin1":case"binary":return Et(this,Gt,Wt,er);case"base64":return St(this,Gt,Wt,er);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Bt(this,Gt,Wt,er);default:if(pr)throw new TypeError("Unknown encoding: "+lr);lr=(""+lr).toLowerCase(),pr=!0}},at.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ot(Xt,Gt,Wt){return Gt===0&&Wt===Xt.length?s.fromByteArray(Xt):s.fromByteArray(Xt.slice(Gt,Wt))}function Pt(Xt,Gt,Wt){Wt=Math.min(Xt.length,Wt);const er=[];let lr=Gt;for(;lr<Wt;){const ur=Xt[lr];let pr=null,yr=ur>239?4:ur>223?3:ur>191?2:1;if(lr+yr<=Wt){let Er,br,gr,Ar;switch(yr){case 1:ur<128&&(pr=ur);break;case 2:Er=Xt[lr+1],(Er&192)===128&&(Ar=(ur&31)<<6|Er&63,Ar>127&&(pr=Ar));break;case 3:Er=Xt[lr+1],br=Xt[lr+2],(Er&192)===128&&(br&192)===128&&(Ar=(ur&15)<<12|(Er&63)<<6|br&63,Ar>2047&&(Ar<55296||Ar>57343)&&(pr=Ar));break;case 4:Er=Xt[lr+1],br=Xt[lr+2],gr=Xt[lr+3],(Er&192)===128&&(br&192)===128&&(gr&192)===128&&(Ar=(ur&15)<<18|(Er&63)<<12|(br&63)<<6|gr&63,Ar>65535&&Ar<1114112&&(pr=Ar))}}pr===null?(pr=65533,yr=1):pr>65535&&(pr-=65536,er.push(pr>>>10&1023|55296),pr=56320|pr&1023),er.push(pr),lr+=yr}return Ct(er)}const wt=4096;function Ct(Xt){const Gt=Xt.length;if(Gt<=wt)return String.fromCharCode.apply(String,Xt);let Wt="",er=0;for(;er<Gt;)Wt+=String.fromCharCode.apply(String,Xt.slice(er,er+=wt));return Wt}function It(Xt,Gt,Wt){let er="";Wt=Math.min(Xt.length,Wt);for(let lr=Gt;lr<Wt;++lr)er+=String.fromCharCode(Xt[lr]&127);return er}function yt(Xt,Gt,Wt){let er="";Wt=Math.min(Xt.length,Wt);for(let lr=Gt;lr<Wt;++lr)er+=String.fromCharCode(Xt[lr]);return er}function Rt(Xt,Gt,Wt){const er=Xt.length;(!Gt||Gt<0)&&(Gt=0),(!Wt||Wt<0||Wt>er)&&(Wt=er);let lr="";for(let ur=Gt;ur<Wt;++ur)lr+=sr[Xt[ur]];return lr}function kt(Xt,Gt,Wt){const er=Xt.slice(Gt,Wt);let lr="";for(let ur=0;ur<er.length-1;ur+=2)lr+=String.fromCharCode(er[ur]+er[ur+1]*256);return lr}at.prototype.slice=function(Gt,Wt){const er=this.length;Gt=~~Gt,Wt=Wt===void 0?er:~~Wt,Gt<0?(Gt+=er,Gt<0&&(Gt=0)):Gt>er&&(Gt=er),Wt<0?(Wt+=er,Wt<0&&(Wt=0)):Wt>er&&(Wt=er),Wt<Gt&&(Wt=Gt);const lr=this.subarray(Gt,Wt);return Object.setPrototypeOf(lr,at.prototype),lr};function jt(Xt,Gt,Wt){if(Xt%1!==0||Xt<0)throw new RangeError("offset is not uint");if(Xt+Gt>Wt)throw new RangeError("Trying to access beyond buffer length")}at.prototype.readUintLE=at.prototype.readUIntLE=function(Gt,Wt,er){Gt=Gt>>>0,Wt=Wt>>>0,er||jt(Gt,Wt,this.length);let lr=this[Gt],ur=1,pr=0;for(;++pr<Wt&&(ur*=256);)lr+=this[Gt+pr]*ur;return lr},at.prototype.readUintBE=at.prototype.readUIntBE=function(Gt,Wt,er){Gt=Gt>>>0,Wt=Wt>>>0,er||jt(Gt,Wt,this.length);let lr=this[Gt+--Wt],ur=1;for(;Wt>0&&(ur*=256);)lr+=this[Gt+--Wt]*ur;return lr},at.prototype.readUint8=at.prototype.readUInt8=function(Gt,Wt){return Gt=Gt>>>0,Wt||jt(Gt,1,this.length),this[Gt]},at.prototype.readUint16LE=at.prototype.readUInt16LE=function(Gt,Wt){return Gt=Gt>>>0,Wt||jt(Gt,2,this.length),this[Gt]|this[Gt+1]<<8},at.prototype.readUint16BE=at.prototype.readUInt16BE=function(Gt,Wt){return Gt=Gt>>>0,Wt||jt(Gt,2,this.length),this[Gt]<<8|this[Gt+1]},at.prototype.readUint32LE=at.prototype.readUInt32LE=function(Gt,Wt){return Gt=Gt>>>0,Wt||jt(Gt,4,this.length),(this[Gt]|this[Gt+1]<<8|this[Gt+2]<<16)+this[Gt+3]*16777216},at.prototype.readUint32BE=at.prototype.readUInt32BE=function(Gt,Wt){return Gt=Gt>>>0,Wt||jt(Gt,4,this.length),this[Gt]*16777216+(this[Gt+1]<<16|this[Gt+2]<<8|this[Gt+3])},at.prototype.readBigUInt64LE=cr(function(Gt){Gt=Gt>>>0,Qt(Gt,"offset");const Wt=this[Gt],er=this[Gt+7];(Wt===void 0||er===void 0)&&qt(Gt,this.length-8);const lr=Wt+this[++Gt]*2**8+this[++Gt]*2**16+this[++Gt]*2**24,ur=this[++Gt]+this[++Gt]*2**8+this[++Gt]*2**16+er*2**24;return BigInt(lr)+(BigInt(ur)<<BigInt(32))}),at.prototype.readBigUInt64BE=cr(function(Gt){Gt=Gt>>>0,Qt(Gt,"offset");const Wt=this[Gt],er=this[Gt+7];(Wt===void 0||er===void 0)&&qt(Gt,this.length-8);const lr=Wt*2**24+this[++Gt]*2**16+this[++Gt]*2**8+this[++Gt],ur=this[++Gt]*2**24+this[++Gt]*2**16+this[++Gt]*2**8+er;return(BigInt(lr)<<BigInt(32))+BigInt(ur)}),at.prototype.readIntLE=function(Gt,Wt,er){Gt=Gt>>>0,Wt=Wt>>>0,er||jt(Gt,Wt,this.length);let lr=this[Gt],ur=1,pr=0;for(;++pr<Wt&&(ur*=256);)lr+=this[Gt+pr]*ur;return ur*=128,lr>=ur&&(lr-=Math.pow(2,8*Wt)),lr},at.prototype.readIntBE=function(Gt,Wt,er){Gt=Gt>>>0,Wt=Wt>>>0,er||jt(Gt,Wt,this.length);let lr=Wt,ur=1,pr=this[Gt+--lr];for(;lr>0&&(ur*=256);)pr+=this[Gt+--lr]*ur;return ur*=128,pr>=ur&&(pr-=Math.pow(2,8*Wt)),pr},at.prototype.readInt8=function(Gt,Wt){return Gt=Gt>>>0,Wt||jt(Gt,1,this.length),this[Gt]&128?(255-this[Gt]+1)*-1:this[Gt]},at.prototype.readInt16LE=function(Gt,Wt){Gt=Gt>>>0,Wt||jt(Gt,2,this.length);const er=this[Gt]|this[Gt+1]<<8;return er&32768?er|4294901760:er},at.prototype.readInt16BE=function(Gt,Wt){Gt=Gt>>>0,Wt||jt(Gt,2,this.length);const er=this[Gt+1]|this[Gt]<<8;return er&32768?er|4294901760:er},at.prototype.readInt32LE=function(Gt,Wt){return Gt=Gt>>>0,Wt||jt(Gt,4,this.length),this[Gt]|this[Gt+1]<<8|this[Gt+2]<<16|this[Gt+3]<<24},at.prototype.readInt32BE=function(Gt,Wt){return Gt=Gt>>>0,Wt||jt(Gt,4,this.length),this[Gt]<<24|this[Gt+1]<<16|this[Gt+2]<<8|this[Gt+3]},at.prototype.readBigInt64LE=cr(function(Gt){Gt=Gt>>>0,Qt(Gt,"offset");const Wt=this[Gt],er=this[Gt+7];(Wt===void 0||er===void 0)&&qt(Gt,this.length-8);const lr=this[Gt+4]+this[Gt+5]*2**8+this[Gt+6]*2**16+(er<<24);return(BigInt(lr)<<BigInt(32))+BigInt(Wt+this[++Gt]*2**8+this[++Gt]*2**16+this[++Gt]*2**24)}),at.prototype.readBigInt64BE=cr(function(Gt){Gt=Gt>>>0,Qt(Gt,"offset");const Wt=this[Gt],er=this[Gt+7];(Wt===void 0||er===void 0)&&qt(Gt,this.length-8);const lr=(Wt<<24)+this[++Gt]*2**16+this[++Gt]*2**8+this[++Gt];return(BigInt(lr)<<BigInt(32))+BigInt(this[++Gt]*2**24+this[++Gt]*2**16+this[++Gt]*2**8+er)}),at.prototype.readFloatLE=function(Gt,Wt){return Gt=Gt>>>0,Wt||jt(Gt,4,this.length),$.read(this,Gt,!0,23,4)},at.prototype.readFloatBE=function(Gt,Wt){return Gt=Gt>>>0,Wt||jt(Gt,4,this.length),$.read(this,Gt,!1,23,4)},at.prototype.readDoubleLE=function(Gt,Wt){return Gt=Gt>>>0,Wt||jt(Gt,8,this.length),$.read(this,Gt,!0,52,8)},at.prototype.readDoubleBE=function(Gt,Wt){return Gt=Gt>>>0,Wt||jt(Gt,8,this.length),$.read(this,Gt,!1,52,8)};function Ht(Xt,Gt,Wt,er,lr,ur){if(!at.isBuffer(Xt))throw new TypeError('"buffer" argument must be a Buffer instance');if(Gt>lr||Gt<ur)throw new RangeError('"value" argument is out of bounds');if(Wt+er>Xt.length)throw new RangeError("Index out of range")}at.prototype.writeUintLE=at.prototype.writeUIntLE=function(Gt,Wt,er,lr){if(Gt=+Gt,Wt=Wt>>>0,er=er>>>0,!lr){const yr=Math.pow(2,8*er)-1;Ht(this,Gt,Wt,er,yr,0)}let ur=1,pr=0;for(this[Wt]=Gt&255;++pr<er&&(ur*=256);)this[Wt+pr]=Gt/ur&255;return Wt+er},at.prototype.writeUintBE=at.prototype.writeUIntBE=function(Gt,Wt,er,lr){if(Gt=+Gt,Wt=Wt>>>0,er=er>>>0,!lr){const yr=Math.pow(2,8*er)-1;Ht(this,Gt,Wt,er,yr,0)}let ur=er-1,pr=1;for(this[Wt+ur]=Gt&255;--ur>=0&&(pr*=256);)this[Wt+ur]=Gt/pr&255;return Wt+er},at.prototype.writeUint8=at.prototype.writeUInt8=function(Gt,Wt,er){return Gt=+Gt,Wt=Wt>>>0,er||Ht(this,Gt,Wt,1,255,0),this[Wt]=Gt&255,Wt+1},at.prototype.writeUint16LE=at.prototype.writeUInt16LE=function(Gt,Wt,er){return Gt=+Gt,Wt=Wt>>>0,er||Ht(this,Gt,Wt,2,65535,0),this[Wt]=Gt&255,this[Wt+1]=Gt>>>8,Wt+2},at.prototype.writeUint16BE=at.prototype.writeUInt16BE=function(Gt,Wt,er){return Gt=+Gt,Wt=Wt>>>0,er||Ht(this,Gt,Wt,2,65535,0),this[Wt]=Gt>>>8,this[Wt+1]=Gt&255,Wt+2},at.prototype.writeUint32LE=at.prototype.writeUInt32LE=function(Gt,Wt,er){return Gt=+Gt,Wt=Wt>>>0,er||Ht(this,Gt,Wt,4,4294967295,0),this[Wt+3]=Gt>>>24,this[Wt+2]=Gt>>>16,this[Wt+1]=Gt>>>8,this[Wt]=Gt&255,Wt+4},at.prototype.writeUint32BE=at.prototype.writeUInt32BE=function(Gt,Wt,er){return Gt=+Gt,Wt=Wt>>>0,er||Ht(this,Gt,Wt,4,4294967295,0),this[Wt]=Gt>>>24,this[Wt+1]=Gt>>>16,this[Wt+2]=Gt>>>8,this[Wt+3]=Gt&255,Wt+4};function Ft(Xt,Gt,Wt,er,lr){Vt(Gt,er,lr,Xt,Wt,7);let ur=Number(Gt&BigInt(4294967295));Xt[Wt++]=ur,ur=ur>>8,Xt[Wt++]=ur,ur=ur>>8,Xt[Wt++]=ur,ur=ur>>8,Xt[Wt++]=ur;let pr=Number(Gt>>BigInt(32)&BigInt(4294967295));return Xt[Wt++]=pr,pr=pr>>8,Xt[Wt++]=pr,pr=pr>>8,Xt[Wt++]=pr,pr=pr>>8,Xt[Wt++]=pr,Wt}function _t(Xt,Gt,Wt,er,lr){Vt(Gt,er,lr,Xt,Wt,7);let ur=Number(Gt&BigInt(4294967295));Xt[Wt+7]=ur,ur=ur>>8,Xt[Wt+6]=ur,ur=ur>>8,Xt[Wt+5]=ur,ur=ur>>8,Xt[Wt+4]=ur;let pr=Number(Gt>>BigInt(32)&BigInt(4294967295));return Xt[Wt+3]=pr,pr=pr>>8,Xt[Wt+2]=pr,pr=pr>>8,Xt[Wt+1]=pr,pr=pr>>8,Xt[Wt]=pr,Wt+8}at.prototype.writeBigUInt64LE=cr(function(Gt,Wt=0){return Ft(this,Gt,Wt,BigInt(0),BigInt("0xffffffffffffffff"))}),at.prototype.writeBigUInt64BE=cr(function(Gt,Wt=0){return _t(this,Gt,Wt,BigInt(0),BigInt("0xffffffffffffffff"))}),at.prototype.writeIntLE=function(Gt,Wt,er,lr){if(Gt=+Gt,Wt=Wt>>>0,!lr){const Er=Math.pow(2,8*er-1);Ht(this,Gt,Wt,er,Er-1,-Er)}let ur=0,pr=1,yr=0;for(this[Wt]=Gt&255;++ur<er&&(pr*=256);)Gt<0&&yr===0&&this[Wt+ur-1]!==0&&(yr=1),this[Wt+ur]=(Gt/pr>>0)-yr&255;return Wt+er},at.prototype.writeIntBE=function(Gt,Wt,er,lr){if(Gt=+Gt,Wt=Wt>>>0,!lr){const Er=Math.pow(2,8*er-1);Ht(this,Gt,Wt,er,Er-1,-Er)}let ur=er-1,pr=1,yr=0;for(this[Wt+ur]=Gt&255;--ur>=0&&(pr*=256);)Gt<0&&yr===0&&this[Wt+ur+1]!==0&&(yr=1),this[Wt+ur]=(Gt/pr>>0)-yr&255;return Wt+er},at.prototype.writeInt8=function(Gt,Wt,er){return Gt=+Gt,Wt=Wt>>>0,er||Ht(this,Gt,Wt,1,127,-128),Gt<0&&(Gt=255+Gt+1),this[Wt]=Gt&255,Wt+1},at.prototype.writeInt16LE=function(Gt,Wt,er){return Gt=+Gt,Wt=Wt>>>0,er||Ht(this,Gt,Wt,2,32767,-32768),this[Wt]=Gt&255,this[Wt+1]=Gt>>>8,Wt+2},at.prototype.writeInt16BE=function(Gt,Wt,er){return Gt=+Gt,Wt=Wt>>>0,er||Ht(this,Gt,Wt,2,32767,-32768),this[Wt]=Gt>>>8,this[Wt+1]=Gt&255,Wt+2},at.prototype.writeInt32LE=function(Gt,Wt,er){return Gt=+Gt,Wt=Wt>>>0,er||Ht(this,Gt,Wt,4,2147483647,-2147483648),this[Wt]=Gt&255,this[Wt+1]=Gt>>>8,this[Wt+2]=Gt>>>16,this[Wt+3]=Gt>>>24,Wt+4},at.prototype.writeInt32BE=function(Gt,Wt,er){return Gt=+Gt,Wt=Wt>>>0,er||Ht(this,Gt,Wt,4,2147483647,-2147483648),Gt<0&&(Gt=4294967295+Gt+1),this[Wt]=Gt>>>24,this[Wt+1]=Gt>>>16,this[Wt+2]=Gt>>>8,this[Wt+3]=Gt&255,Wt+4},at.prototype.writeBigInt64LE=cr(function(Gt,Wt=0){return Ft(this,Gt,Wt,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),at.prototype.writeBigInt64BE=cr(function(Gt,Wt=0){return _t(this,Gt,Wt,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Nt(Xt,Gt,Wt,er,lr,ur){if(Wt+er>Xt.length)throw new RangeError("Index out of range");if(Wt<0)throw new RangeError("Index out of range")}function Mt(Xt,Gt,Wt,er,lr){return Gt=+Gt,Wt=Wt>>>0,lr||Nt(Xt,Gt,Wt,4),$.write(Xt,Gt,Wt,er,23,4),Wt+4}at.prototype.writeFloatLE=function(Gt,Wt,er){return Mt(this,Gt,Wt,!0,er)},at.prototype.writeFloatBE=function(Gt,Wt,er){return Mt(this,Gt,Wt,!1,er)};function Lt(Xt,Gt,Wt,er,lr){return Gt=+Gt,Wt=Wt>>>0,lr||Nt(Xt,Gt,Wt,8),$.write(Xt,Gt,Wt,er,52,8),Wt+8}at.prototype.writeDoubleLE=function(Gt,Wt,er){return Lt(this,Gt,Wt,!0,er)},at.prototype.writeDoubleBE=function(Gt,Wt,er){return Lt(this,Gt,Wt,!1,er)},at.prototype.copy=function(Gt,Wt,er,lr){if(!at.isBuffer(Gt))throw new TypeError("argument should be a Buffer");if(er||(er=0),!lr&&lr!==0&&(lr=this.length),Wt>=Gt.length&&(Wt=Gt.length),Wt||(Wt=0),lr>0&&lr<er&&(lr=er),lr===er||Gt.length===0||this.length===0)return 0;if(Wt<0)throw new RangeError("targetStart out of bounds");if(er<0||er>=this.length)throw new RangeError("Index out of range");if(lr<0)throw new RangeError("sourceEnd out of bounds");lr>this.length&&(lr=this.length),Gt.length-Wt<lr-er&&(lr=Gt.length-Wt+er);const ur=lr-er;return this===Gt&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(Wt,er,lr):Uint8Array.prototype.set.call(Gt,this.subarray(er,lr),Wt),ur},at.prototype.fill=function(Gt,Wt,er,lr){if(typeof Gt=="string"){if(typeof Wt=="string"?(lr=Wt,Wt=0,er=this.length):typeof er=="string"&&(lr=er,er=this.length),lr!==void 0&&typeof lr!="string")throw new TypeError("encoding must be a string");if(typeof lr=="string"&&!at.isEncoding(lr))throw new TypeError("Unknown encoding: "+lr);if(Gt.length===1){const pr=Gt.charCodeAt(0);(lr==="utf8"&&pr<128||lr==="latin1")&&(Gt=pr)}}else typeof Gt=="number"?Gt=Gt&255:typeof Gt=="boolean"&&(Gt=Number(Gt));if(Wt<0||this.length<Wt||this.length<er)throw new RangeError("Out of range index");if(er<=Wt)return this;Wt=Wt>>>0,er=er===void 0?this.length:er>>>0,Gt||(Gt=0);let ur;if(typeof Gt=="number")for(ur=Wt;ur<er;++ur)this[ur]=Gt;else{const pr=at.isBuffer(Gt)?Gt:at.from(Gt,lr),yr=pr.length;if(yr===0)throw new TypeError('The value "'+Gt+'" is invalid for argument "value"');for(ur=0;ur<er-Wt;++ur)this[ur+Wt]=pr[ur%yr]}return this};const $t={};function Tt(Xt,Gt,Wt){$t[Xt]=class extends Wt{constructor(){super(),Object.defineProperty(this,"message",{value:Gt.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${Xt}]`,this.stack,delete this.name}get code(){return Xt}set code(lr){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:lr,writable:!0})}toString(){return`${this.name} [${Xt}]: ${this.message}`}}}Tt("ERR_BUFFER_OUT_OF_BOUNDS",function(Xt){return Xt?`${Xt} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Tt("ERR_INVALID_ARG_TYPE",function(Xt,Gt){return`The "${Xt}" argument must be of type number. Received type ${typeof Gt}`},TypeError),Tt("ERR_OUT_OF_RANGE",function(Xt,Gt,Wt){let er=`The value of "${Xt}" is out of range.`,lr=Wt;return Number.isInteger(Wt)&&Math.abs(Wt)>2**32?lr=Dt(String(Wt)):typeof Wt=="bigint"&&(lr=String(Wt),(Wt>BigInt(2)**BigInt(32)||Wt<-(BigInt(2)**BigInt(32)))&&(lr=Dt(lr)),lr+="n"),er+=` It must be ${Gt}. Received ${lr}`,er},RangeError);function Dt(Xt){let Gt="",Wt=Xt.length;const er=Xt[0]==="-"?1:0;for(;Wt>=er+4;Wt-=3)Gt=`_${Xt.slice(Wt-3,Wt)}${Gt}`;return`${Xt.slice(0,Wt)}${Gt}`}function Ut(Xt,Gt,Wt){Qt(Gt,"offset"),(Xt[Gt]===void 0||Xt[Gt+Wt]===void 0)&&qt(Gt,Xt.length-(Wt+1))}function Vt(Xt,Gt,Wt,er,lr,ur){if(Xt>Wt||Xt<Gt){const pr=typeof Gt=="bigint"?"n":"";let yr;throw ur>3?Gt===0||Gt===BigInt(0)?yr=`>= 0${pr} and < 2${pr} ** ${(ur+1)*8}${pr}`:yr=`>= -(2${pr} ** ${(ur+1)*8-1}${pr}) and < 2 ** ${(ur+1)*8-1}${pr}`:yr=`>= ${Gt}${pr} and <= ${Wt}${pr}`,new $t.ERR_OUT_OF_RANGE("value",yr,Xt)}Ut(er,lr,ur)}function Qt(Xt,Gt){if(typeof Xt!="number")throw new $t.ERR_INVALID_ARG_TYPE(Gt,"number",Xt)}function qt(Xt,Gt,Wt){throw Math.floor(Xt)!==Xt?(Qt(Xt,Wt),new $t.ERR_OUT_OF_RANGE(Wt||"offset","an integer",Xt)):Gt<0?new $t.ERR_BUFFER_OUT_OF_BOUNDS:new $t.ERR_OUT_OF_RANGE(Wt||"offset",`>= ${Wt?1:0} and <= ${Gt}`,Xt)}const Zt=/[^+/0-9A-Za-z-_]/g;function ar(Xt){if(Xt=Xt.split("=")[0],Xt=Xt.trim().replace(Zt,""),Xt.length<2)return"";for(;Xt.length%4!==0;)Xt=Xt+"=";return Xt}function Jt(Xt,Gt){Gt=Gt||1/0;let Wt;const er=Xt.length;let lr=null;const ur=[];for(let pr=0;pr<er;++pr){if(Wt=Xt.charCodeAt(pr),Wt>55295&&Wt<57344){if(!lr){if(Wt>56319){(Gt-=3)>-1&&ur.push(239,191,189);continue}else if(pr+1===er){(Gt-=3)>-1&&ur.push(239,191,189);continue}lr=Wt;continue}if(Wt<56320){(Gt-=3)>-1&&ur.push(239,191,189),lr=Wt;continue}Wt=(lr-55296<<10|Wt-56320)+65536}else lr&&(Gt-=3)>-1&&ur.push(239,191,189);if(lr=null,Wt<128){if((Gt-=1)<0)break;ur.push(Wt)}else if(Wt<2048){if((Gt-=2)<0)break;ur.push(Wt>>6|192,Wt&63|128)}else if(Wt<65536){if((Gt-=3)<0)break;ur.push(Wt>>12|224,Wt>>6&63|128,Wt&63|128)}else if(Wt<1114112){if((Gt-=4)<0)break;ur.push(Wt>>18|240,Wt>>12&63|128,Wt>>6&63|128,Wt&63|128)}else throw new Error("Invalid code point")}return ur}function rr(Xt){const Gt=[];for(let Wt=0;Wt<Xt.length;++Wt)Gt.push(Xt.charCodeAt(Wt)&255);return Gt}function Yt(Xt,Gt){let Wt,er,lr;const ur=[];for(let pr=0;pr<Xt.length&&!((Gt-=2)<0);++pr)Wt=Xt.charCodeAt(pr),er=Wt>>8,lr=Wt%256,ur.push(lr),ur.push(er);return ur}function Kt(Xt){return s.toByteArray(ar(Xt))}function nr(Xt,Gt,Wt,er){let lr;for(lr=0;lr<er&&!(lr+Wt>=Gt.length||lr>=Xt.length);++lr)Gt[lr+Wt]=Xt[lr];return lr}function tr(Xt,Gt){return Xt instanceof Gt||Xt!=null&&Xt.constructor!=null&&Xt.constructor.name!=null&&Xt.constructor.name===Gt.name}function ir(Xt){return Xt!==Xt}const sr=function(){const Xt="0123456789abcdef",Gt=new Array(256);for(let Wt=0;Wt<16;++Wt){const er=Wt*16;for(let lr=0;lr<16;++lr)Gt[er+lr]=Xt[Wt]+Xt[lr]}return Gt}();function cr(Xt){return typeof BigInt>"u"?or:Xt}function or(){throw new Error("BigInt not supported")}})(buffer$1);const langs=["en","zh","ja","ko","ar","th","pl","it","de","es","fr"],Lang=z.enum(langs);z.object({cancel:z.string(),field:z.string(),fieldName:z.string(),align:z.string(),width:z.string(),opacity:z.string(),height:z.string(),rotate:z.string(),edit:z.string(),required:z.string(),editable:z.string(),plsInputName:z.string(),fieldMustUniq:z.string(),notUniq:z.string(),noKeyName:z.string(),fieldsList:z.string(),editField:z.string(),type:z.string(),errorOccurred:z.string(),errorBulkUpdateFieldName:z.string(),commitBulkUpdateFieldName:z.string(),bulkUpdateFieldName:z.string(),addPageAfter:z.string(),removePage:z.string(),removePageConfirm:z.string(),"validation.uniqueName":z.string(),"validation.hexColor":z.string(),"schemas.color":z.string(),"schemas.borderWidth":z.string(),"schemas.borderColor":z.string(),"schemas.backgroundColor":z.string(),"schemas.textColor":z.string(),"schemas.bgColor":z.string(),"schemas.horizontal":z.string(),"schemas.vertical":z.string(),"schemas.left":z.string(),"schemas.center":z.string(),"schemas.right":z.string(),"schemas.top":z.string(),"schemas.middle":z.string(),"schemas.bottom":z.string(),"schemas.padding":z.string(),"schemas.text.fontName":z.string(),"schemas.text.size":z.string(),"schemas.text.spacing":z.string(),"schemas.text.textAlign":z.string(),"schemas.text.verticalAlign":z.string(),"schemas.text.lineHeight":z.string(),"schemas.text.min":z.string(),"schemas.text.max":z.string(),"schemas.text.fit":z.string(),"schemas.text.dynamicFontSize":z.string(),"schemas.text.format":z.string(),"schemas.mvt.typingInstructions":z.string(),"schemas.mvt.sampleField":z.string(),"schemas.mvt.variablesSampleData":z.string(),"schemas.barcodes.barColor":z.string(),"schemas.barcodes.includetext":z.string(),"schemas.table.alternateBackgroundColor":z.string(),"schemas.table.tableStyle":z.string(),"schemas.table.headStyle":z.string(),"schemas.table.bodyStyle":z.string(),"schemas.table.columnStyle":z.string()}),z.enum(["viewer","form","designer"]);const ColorType=z.enum(["rgb","cmyk"]).optional();z.object({height:z.number(),width:z.number()});const Schema$1=z.object({type:z.string(),content:z.string().optional(),position:z.object({x:z.number(),y:z.number()}),width:z.number(),height:z.number(),rotate:z.number().optional(),opacity:z.number().optional(),readOnly:z.boolean().optional(),required:z.boolean().optional()}).passthrough(),SchemaForUIAdditionalInfo=z.object({id:z.string(),key:z.string()});Schema$1.merge(SchemaForUIAdditionalInfo);const ArrayBufferSchema=z.any().refine(a=>a instanceof ArrayBuffer),Uint8ArraySchema=z.any().refine(a=>a instanceof Uint8Array),BlankPdf=z.object({width:z.number(),height:z.number(),padding:z.tuple([z.number(),z.number(),z.number(),z.number()])}),CustomPdf=z.union([z.string(),ArrayBufferSchema,Uint8ArraySchema]),BasePdf=z.union([CustomPdf,BlankPdf]),Template=z.object({schemas:z.array(z.record(Schema$1)),basePdf:BasePdf,pdfmeVersion:z.string().optional()}).passthrough(),Inputs=z.array(z.record(z.any())).min(1),Font=z.record(z.object({data:z.union([z.string(),ArrayBufferSchema,Uint8ArraySchema]),fallback:z.boolean().optional(),subset:z.boolean().optional()})),CommonOptions=z.object({font:Font.optional()}).passthrough(),CommonProps=z.object({template:Template,options:CommonOptions.optional(),plugins:z.record(z.object({ui:z.any(),pdf:z.any(),propPanel:z.any()})).optional()}),GeneratorOptions=CommonOptions.extend({colorType:ColorType,author:z.string().optional(),creationDate:z.date().optional(),creator:z.string().optional(),keywords:z.array(z.string()).optional(),language:z.string().optional(),modificationDate:z.date().optional(),producer:z.string().optional(),subject:z.string().optional(),title:z.string().optional()});CommonProps.extend({inputs:Inputs,options:GeneratorOptions.optional()}).strict();const UIOptions=CommonOptions.extend({lang:Lang.optional(),labels:z.record(z.string(),z.string()).optional(),theme:z.record(z.string(),z.unknown()).optional(),icons:z.record(z.string(),z.string()).optional(),requiredByDefault:z.boolean().optional()}),HTMLElementSchema=z.any().refine(a=>a instanceof HTMLElement),UIProps=CommonProps.extend({domContainer:HTMLElementSchema,options:UIOptions.optional()}),PreviewProps=UIProps.extend({inputs:Inputs}).strict(),DesignerProps=UIProps.extend({}).strict(),cloneDeep$1=a=>JSON.parse(JSON.stringify(a)),uniq=a=>Array.from(new Set(a)),getFallbackFontName=a=>{const s="",$=Object.entries(a).reduce((_,_e)=>{const[tt,nt]=_e;return!_&&nt.fallback?tt:_},s);if($===s)throw Error("[@pdfme/common] fallback flag is not found in font. true fallback flag must be only one.");return $},getDefaultFont=()=>({[DEFAULT_FONT_NAME]:{data:b64toUint8Array(DEFAULT_FONT_VALUE),fallback:!0}}),mm2pt=a=>parseFloat(String(a))*MM_TO_PT_RATIO,pt2mm=a=>a*PT_TO_MM_RATIO,pt2px=a=>a*PT_TO_PX_RATIO,px2mm=a=>{const s=.26458333333333;return parseFloat(String(a))*s},blob2Base64Pdf=a=>new Promise((s,$)=>{const _=new FileReader;_.onloadend=()=>{_.result.startsWith("data:application/pdf;")?s(_.result):$(Error("[@pdfme/common] template.basePdf must be pdf data."))},_.readAsDataURL(a)}),isHexValid=a=>/^#(?:[A-Fa-f0-9]{3,4}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/i.test(a),getB64BasePdf=a=>typeof a=="string"&&!a.startsWith("data:application/pdf;")&&typeof window<"u"?fetch(a).then($=>$.blob()).then(blob2Base64Pdf).catch($=>{throw $}):a,isBlankPdf=a=>BlankPdf.safeParse(a).success,getByteString=a=>buffer$1.Buffer.from(a,"base64").toString("binary"),b64toUint8Array=a=>{const s=a.split(";base64,")[1]?a.split(";base64,")[1]:a,$=getByteString(s),_=new Uint8Array($.length);for(let _e=0;_e<$.length;_e+=1)_[_e]=$.charCodeAt(_e);return _},getFontNamesInSchemas=a=>uniq(a.map(s=>Object.values(s).map($=>$.fontName??"")).reduce((s,$)=>s.concat($),[]).filter(Boolean)),checkFont=a=>{const{font:s,template:{schemas:$}}=a,_e=Object.values(s).reduce((at,ot)=>ot.fallback?at+1:at,0);if(_e===0)throw Error(`[@pdfme/common] fallback flag is not found in font. true fallback flag must be only one.
|
42
|
+
*/(function(a){const s=base64Js,$=ieee754,_=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;a.Buffer=at,a.SlowBuffer=gt,a.INSPECT_MAX_BYTES=50;const _e=2147483647;a.kMaxLength=_e,at.TYPED_ARRAY_SUPPORT=tt(),!at.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function tt(){try{const Xt=new Uint8Array(1),Gt={foo:function(){return 42}};return Object.setPrototypeOf(Gt,Uint8Array.prototype),Object.setPrototypeOf(Xt,Gt),Xt.foo()===42}catch{return!1}}Object.defineProperty(at.prototype,"parent",{enumerable:!0,get:function(){if(at.isBuffer(this))return this.buffer}}),Object.defineProperty(at.prototype,"offset",{enumerable:!0,get:function(){if(at.isBuffer(this))return this.byteOffset}});function nt(Xt){if(Xt>_e)throw new RangeError('The value "'+Xt+'" is invalid for option "size"');const Gt=new Uint8Array(Xt);return Object.setPrototypeOf(Gt,at.prototype),Gt}function at(Xt,Gt,Wt){if(typeof Xt=="number"){if(typeof Gt=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return lt(Xt)}return ot(Xt,Gt,Wt)}at.poolSize=8192;function ot(Xt,Gt,Wt){if(typeof Xt=="string")return et(Xt,Gt);if(ArrayBuffer.isView(Xt))return ut(Xt);if(Xt==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Xt);if(tr(Xt,ArrayBuffer)||Xt&&tr(Xt.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(tr(Xt,SharedArrayBuffer)||Xt&&tr(Xt.buffer,SharedArrayBuffer)))return ft(Xt,Gt,Wt);if(typeof Xt=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const er=Xt.valueOf&&Xt.valueOf();if(er!=null&&er!==Xt)return at.from(er,Gt,Wt);const lr=ht(Xt);if(lr)return lr;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof Xt[Symbol.toPrimitive]=="function")return at.from(Xt[Symbol.toPrimitive]("string"),Gt,Wt);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Xt)}at.from=function(Xt,Gt,Wt){return ot(Xt,Gt,Wt)},Object.setPrototypeOf(at.prototype,Uint8Array.prototype),Object.setPrototypeOf(at,Uint8Array);function rt(Xt){if(typeof Xt!="number")throw new TypeError('"size" argument must be of type number');if(Xt<0)throw new RangeError('The value "'+Xt+'" is invalid for option "size"')}function st(Xt,Gt,Wt){return rt(Xt),Xt<=0?nt(Xt):Gt!==void 0?typeof Wt=="string"?nt(Xt).fill(Gt,Wt):nt(Xt).fill(Gt):nt(Xt)}at.alloc=function(Xt,Gt,Wt){return st(Xt,Gt,Wt)};function lt(Xt){return rt(Xt),nt(Xt<0?0:dt(Xt)|0)}at.allocUnsafe=function(Xt){return lt(Xt)},at.allocUnsafeSlow=function(Xt){return lt(Xt)};function et(Xt,Gt){if((typeof Gt!="string"||Gt==="")&&(Gt="utf8"),!at.isEncoding(Gt))throw new TypeError("Unknown encoding: "+Gt);const Wt=pt(Xt,Gt)|0;let er=nt(Wt);const lr=er.write(Xt,Gt);return lr!==Wt&&(er=er.slice(0,lr)),er}function it(Xt){const Gt=Xt.length<0?0:dt(Xt.length)|0,Wt=nt(Gt);for(let er=0;er<Gt;er+=1)Wt[er]=Xt[er]&255;return Wt}function ut(Xt){if(tr(Xt,Uint8Array)){const Gt=new Uint8Array(Xt);return ft(Gt.buffer,Gt.byteOffset,Gt.byteLength)}return it(Xt)}function ft(Xt,Gt,Wt){if(Gt<0||Xt.byteLength<Gt)throw new RangeError('"offset" is outside of buffer bounds');if(Xt.byteLength<Gt+(Wt||0))throw new RangeError('"length" is outside of buffer bounds');let er;return Gt===void 0&&Wt===void 0?er=new Uint8Array(Xt):Wt===void 0?er=new Uint8Array(Xt,Gt):er=new Uint8Array(Xt,Gt,Wt),Object.setPrototypeOf(er,at.prototype),er}function ht(Xt){if(at.isBuffer(Xt)){const Gt=dt(Xt.length)|0,Wt=nt(Gt);return Wt.length===0||Xt.copy(Wt,0,0,Gt),Wt}if(Xt.length!==void 0)return typeof Xt.length!="number"||ir(Xt.length)?nt(0):it(Xt);if(Xt.type==="Buffer"&&Array.isArray(Xt.data))return it(Xt.data)}function dt(Xt){if(Xt>=_e)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+_e.toString(16)+" bytes");return Xt|0}function gt(Xt){return+Xt!=Xt&&(Xt=0),at.alloc(+Xt)}at.isBuffer=function(Gt){return Gt!=null&&Gt._isBuffer===!0&&Gt!==at.prototype},at.compare=function(Gt,Wt){if(tr(Gt,Uint8Array)&&(Gt=at.from(Gt,Gt.offset,Gt.byteLength)),tr(Wt,Uint8Array)&&(Wt=at.from(Wt,Wt.offset,Wt.byteLength)),!at.isBuffer(Gt)||!at.isBuffer(Wt))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(Gt===Wt)return 0;let er=Gt.length,lr=Wt.length;for(let ur=0,pr=Math.min(er,lr);ur<pr;++ur)if(Gt[ur]!==Wt[ur]){er=Gt[ur],lr=Wt[ur];break}return er<lr?-1:lr<er?1:0},at.isEncoding=function(Gt){switch(String(Gt).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},at.concat=function(Gt,Wt){if(!Array.isArray(Gt))throw new TypeError('"list" argument must be an Array of Buffers');if(Gt.length===0)return at.alloc(0);let er;if(Wt===void 0)for(Wt=0,er=0;er<Gt.length;++er)Wt+=Gt[er].length;const lr=at.allocUnsafe(Wt);let ur=0;for(er=0;er<Gt.length;++er){let pr=Gt[er];if(tr(pr,Uint8Array))ur+pr.length>lr.length?(at.isBuffer(pr)||(pr=at.from(pr)),pr.copy(lr,ur)):Uint8Array.prototype.set.call(lr,pr,ur);else if(at.isBuffer(pr))pr.copy(lr,ur);else throw new TypeError('"list" argument must be an Array of Buffers');ur+=pr.length}return lr};function pt(Xt,Gt){if(at.isBuffer(Xt))return Xt.length;if(ArrayBuffer.isView(Xt)||tr(Xt,ArrayBuffer))return Xt.byteLength;if(typeof Xt!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof Xt);const Wt=Xt.length,er=arguments.length>2&&arguments[2]===!0;if(!er&&Wt===0)return 0;let lr=!1;for(;;)switch(Gt){case"ascii":case"latin1":case"binary":return Wt;case"utf8":case"utf-8":return Jt(Xt).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Wt*2;case"hex":return Wt>>>1;case"base64":return Kt(Xt).length;default:if(lr)return er?-1:Jt(Xt).length;Gt=(""+Gt).toLowerCase(),lr=!0}}at.byteLength=pt;function mt(Xt,Gt,Wt){let er=!1;if((Gt===void 0||Gt<0)&&(Gt=0),Gt>this.length||((Wt===void 0||Wt>this.length)&&(Wt=this.length),Wt<=0)||(Wt>>>=0,Gt>>>=0,Wt<=Gt))return"";for(Xt||(Xt="utf8");;)switch(Xt){case"hex":return Rt(this,Gt,Wt);case"utf8":case"utf-8":return Pt(this,Gt,Wt);case"ascii":return It(this,Gt,Wt);case"latin1":case"binary":return yt(this,Gt,Wt);case"base64":return Ot(this,Gt,Wt);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return kt(this,Gt,Wt);default:if(er)throw new TypeError("Unknown encoding: "+Xt);Xt=(Xt+"").toLowerCase(),er=!0}}at.prototype._isBuffer=!0;function ct(Xt,Gt,Wt){const er=Xt[Gt];Xt[Gt]=Xt[Wt],Xt[Wt]=er}at.prototype.swap16=function(){const Gt=this.length;if(Gt%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let Wt=0;Wt<Gt;Wt+=2)ct(this,Wt,Wt+1);return this},at.prototype.swap32=function(){const Gt=this.length;if(Gt%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let Wt=0;Wt<Gt;Wt+=4)ct(this,Wt,Wt+3),ct(this,Wt+1,Wt+2);return this},at.prototype.swap64=function(){const Gt=this.length;if(Gt%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let Wt=0;Wt<Gt;Wt+=8)ct(this,Wt,Wt+7),ct(this,Wt+1,Wt+6),ct(this,Wt+2,Wt+5),ct(this,Wt+3,Wt+4);return this},at.prototype.toString=function(){const Gt=this.length;return Gt===0?"":arguments.length===0?Pt(this,0,Gt):mt.apply(this,arguments)},at.prototype.toLocaleString=at.prototype.toString,at.prototype.equals=function(Gt){if(!at.isBuffer(Gt))throw new TypeError("Argument must be a Buffer");return this===Gt?!0:at.compare(this,Gt)===0},at.prototype.inspect=function(){let Gt="";const Wt=a.INSPECT_MAX_BYTES;return Gt=this.toString("hex",0,Wt).replace(/(.{2})/g,"$1 ").trim(),this.length>Wt&&(Gt+=" ... "),"<Buffer "+Gt+">"},_&&(at.prototype[_]=at.prototype.inspect),at.prototype.compare=function(Gt,Wt,er,lr,ur){if(tr(Gt,Uint8Array)&&(Gt=at.from(Gt,Gt.offset,Gt.byteLength)),!at.isBuffer(Gt))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof Gt);if(Wt===void 0&&(Wt=0),er===void 0&&(er=Gt?Gt.length:0),lr===void 0&&(lr=0),ur===void 0&&(ur=this.length),Wt<0||er>Gt.length||lr<0||ur>this.length)throw new RangeError("out of range index");if(lr>=ur&&Wt>=er)return 0;if(lr>=ur)return-1;if(Wt>=er)return 1;if(Wt>>>=0,er>>>=0,lr>>>=0,ur>>>=0,this===Gt)return 0;let pr=ur-lr,yr=er-Wt;const Er=Math.min(pr,yr),br=this.slice(lr,ur),gr=Gt.slice(Wt,er);for(let Ar=0;Ar<Er;++Ar)if(br[Ar]!==gr[Ar]){pr=br[Ar],yr=gr[Ar];break}return pr<yr?-1:yr<pr?1:0};function vt(Xt,Gt,Wt,er,lr){if(Xt.length===0)return-1;if(typeof Wt=="string"?(er=Wt,Wt=0):Wt>2147483647?Wt=2147483647:Wt<-2147483648&&(Wt=-2147483648),Wt=+Wt,ir(Wt)&&(Wt=lr?0:Xt.length-1),Wt<0&&(Wt=Xt.length+Wt),Wt>=Xt.length){if(lr)return-1;Wt=Xt.length-1}else if(Wt<0)if(lr)Wt=0;else return-1;if(typeof Gt=="string"&&(Gt=at.from(Gt,er)),at.isBuffer(Gt))return Gt.length===0?-1:At(Xt,Gt,Wt,er,lr);if(typeof Gt=="number")return Gt=Gt&255,typeof Uint8Array.prototype.indexOf=="function"?lr?Uint8Array.prototype.indexOf.call(Xt,Gt,Wt):Uint8Array.prototype.lastIndexOf.call(Xt,Gt,Wt):At(Xt,[Gt],Wt,er,lr);throw new TypeError("val must be string, number or Buffer")}function At(Xt,Gt,Wt,er,lr){let ur=1,pr=Xt.length,yr=Gt.length;if(er!==void 0&&(er=String(er).toLowerCase(),er==="ucs2"||er==="ucs-2"||er==="utf16le"||er==="utf-16le")){if(Xt.length<2||Gt.length<2)return-1;ur=2,pr/=2,yr/=2,Wt/=2}function Er(gr,Ar){return ur===1?gr[Ar]:gr.readUInt16BE(Ar*ur)}let br;if(lr){let gr=-1;for(br=Wt;br<pr;br++)if(Er(Xt,br)===Er(Gt,gr===-1?0:br-gr)){if(gr===-1&&(gr=br),br-gr+1===yr)return gr*ur}else gr!==-1&&(br-=br-gr),gr=-1}else for(Wt+yr>pr&&(Wt=pr-yr),br=Wt;br>=0;br--){let gr=!0;for(let Ar=0;Ar<yr;Ar++)if(Er(Xt,br+Ar)!==Er(Gt,Ar)){gr=!1;break}if(gr)return br}return-1}at.prototype.includes=function(Gt,Wt,er){return this.indexOf(Gt,Wt,er)!==-1},at.prototype.indexOf=function(Gt,Wt,er){return vt(this,Gt,Wt,er,!0)},at.prototype.lastIndexOf=function(Gt,Wt,er){return vt(this,Gt,Wt,er,!1)};function xt(Xt,Gt,Wt,er){Wt=Number(Wt)||0;const lr=Xt.length-Wt;er?(er=Number(er),er>lr&&(er=lr)):er=lr;const ur=Gt.length;er>ur/2&&(er=ur/2);let pr;for(pr=0;pr<er;++pr){const yr=parseInt(Gt.substr(pr*2,2),16);if(ir(yr))return pr;Xt[Wt+pr]=yr}return pr}function bt(Xt,Gt,Wt,er){return nr(Jt(Gt,Xt.length-Wt),Xt,Wt,er)}function Et(Xt,Gt,Wt,er){return nr(rr(Gt),Xt,Wt,er)}function St(Xt,Gt,Wt,er){return nr(Kt(Gt),Xt,Wt,er)}function Bt(Xt,Gt,Wt,er){return nr(Yt(Gt,Xt.length-Wt),Xt,Wt,er)}at.prototype.write=function(Gt,Wt,er,lr){if(Wt===void 0)lr="utf8",er=this.length,Wt=0;else if(er===void 0&&typeof Wt=="string")lr=Wt,er=this.length,Wt=0;else if(isFinite(Wt))Wt=Wt>>>0,isFinite(er)?(er=er>>>0,lr===void 0&&(lr="utf8")):(lr=er,er=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const ur=this.length-Wt;if((er===void 0||er>ur)&&(er=ur),Gt.length>0&&(er<0||Wt<0)||Wt>this.length)throw new RangeError("Attempt to write outside buffer bounds");lr||(lr="utf8");let pr=!1;for(;;)switch(lr){case"hex":return xt(this,Gt,Wt,er);case"utf8":case"utf-8":return bt(this,Gt,Wt,er);case"ascii":case"latin1":case"binary":return Et(this,Gt,Wt,er);case"base64":return St(this,Gt,Wt,er);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Bt(this,Gt,Wt,er);default:if(pr)throw new TypeError("Unknown encoding: "+lr);lr=(""+lr).toLowerCase(),pr=!0}},at.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ot(Xt,Gt,Wt){return Gt===0&&Wt===Xt.length?s.fromByteArray(Xt):s.fromByteArray(Xt.slice(Gt,Wt))}function Pt(Xt,Gt,Wt){Wt=Math.min(Xt.length,Wt);const er=[];let lr=Gt;for(;lr<Wt;){const ur=Xt[lr];let pr=null,yr=ur>239?4:ur>223?3:ur>191?2:1;if(lr+yr<=Wt){let Er,br,gr,Ar;switch(yr){case 1:ur<128&&(pr=ur);break;case 2:Er=Xt[lr+1],(Er&192)===128&&(Ar=(ur&31)<<6|Er&63,Ar>127&&(pr=Ar));break;case 3:Er=Xt[lr+1],br=Xt[lr+2],(Er&192)===128&&(br&192)===128&&(Ar=(ur&15)<<12|(Er&63)<<6|br&63,Ar>2047&&(Ar<55296||Ar>57343)&&(pr=Ar));break;case 4:Er=Xt[lr+1],br=Xt[lr+2],gr=Xt[lr+3],(Er&192)===128&&(br&192)===128&&(gr&192)===128&&(Ar=(ur&15)<<18|(Er&63)<<12|(br&63)<<6|gr&63,Ar>65535&&Ar<1114112&&(pr=Ar))}}pr===null?(pr=65533,yr=1):pr>65535&&(pr-=65536,er.push(pr>>>10&1023|55296),pr=56320|pr&1023),er.push(pr),lr+=yr}return Ct(er)}const wt=4096;function Ct(Xt){const Gt=Xt.length;if(Gt<=wt)return String.fromCharCode.apply(String,Xt);let Wt="",er=0;for(;er<Gt;)Wt+=String.fromCharCode.apply(String,Xt.slice(er,er+=wt));return Wt}function It(Xt,Gt,Wt){let er="";Wt=Math.min(Xt.length,Wt);for(let lr=Gt;lr<Wt;++lr)er+=String.fromCharCode(Xt[lr]&127);return er}function yt(Xt,Gt,Wt){let er="";Wt=Math.min(Xt.length,Wt);for(let lr=Gt;lr<Wt;++lr)er+=String.fromCharCode(Xt[lr]);return er}function Rt(Xt,Gt,Wt){const er=Xt.length;(!Gt||Gt<0)&&(Gt=0),(!Wt||Wt<0||Wt>er)&&(Wt=er);let lr="";for(let ur=Gt;ur<Wt;++ur)lr+=sr[Xt[ur]];return lr}function kt(Xt,Gt,Wt){const er=Xt.slice(Gt,Wt);let lr="";for(let ur=0;ur<er.length-1;ur+=2)lr+=String.fromCharCode(er[ur]+er[ur+1]*256);return lr}at.prototype.slice=function(Gt,Wt){const er=this.length;Gt=~~Gt,Wt=Wt===void 0?er:~~Wt,Gt<0?(Gt+=er,Gt<0&&(Gt=0)):Gt>er&&(Gt=er),Wt<0?(Wt+=er,Wt<0&&(Wt=0)):Wt>er&&(Wt=er),Wt<Gt&&(Wt=Gt);const lr=this.subarray(Gt,Wt);return Object.setPrototypeOf(lr,at.prototype),lr};function jt(Xt,Gt,Wt){if(Xt%1!==0||Xt<0)throw new RangeError("offset is not uint");if(Xt+Gt>Wt)throw new RangeError("Trying to access beyond buffer length")}at.prototype.readUintLE=at.prototype.readUIntLE=function(Gt,Wt,er){Gt=Gt>>>0,Wt=Wt>>>0,er||jt(Gt,Wt,this.length);let lr=this[Gt],ur=1,pr=0;for(;++pr<Wt&&(ur*=256);)lr+=this[Gt+pr]*ur;return lr},at.prototype.readUintBE=at.prototype.readUIntBE=function(Gt,Wt,er){Gt=Gt>>>0,Wt=Wt>>>0,er||jt(Gt,Wt,this.length);let lr=this[Gt+--Wt],ur=1;for(;Wt>0&&(ur*=256);)lr+=this[Gt+--Wt]*ur;return lr},at.prototype.readUint8=at.prototype.readUInt8=function(Gt,Wt){return Gt=Gt>>>0,Wt||jt(Gt,1,this.length),this[Gt]},at.prototype.readUint16LE=at.prototype.readUInt16LE=function(Gt,Wt){return Gt=Gt>>>0,Wt||jt(Gt,2,this.length),this[Gt]|this[Gt+1]<<8},at.prototype.readUint16BE=at.prototype.readUInt16BE=function(Gt,Wt){return Gt=Gt>>>0,Wt||jt(Gt,2,this.length),this[Gt]<<8|this[Gt+1]},at.prototype.readUint32LE=at.prototype.readUInt32LE=function(Gt,Wt){return Gt=Gt>>>0,Wt||jt(Gt,4,this.length),(this[Gt]|this[Gt+1]<<8|this[Gt+2]<<16)+this[Gt+3]*16777216},at.prototype.readUint32BE=at.prototype.readUInt32BE=function(Gt,Wt){return Gt=Gt>>>0,Wt||jt(Gt,4,this.length),this[Gt]*16777216+(this[Gt+1]<<16|this[Gt+2]<<8|this[Gt+3])},at.prototype.readBigUInt64LE=cr(function(Gt){Gt=Gt>>>0,Qt(Gt,"offset");const Wt=this[Gt],er=this[Gt+7];(Wt===void 0||er===void 0)&&qt(Gt,this.length-8);const lr=Wt+this[++Gt]*2**8+this[++Gt]*2**16+this[++Gt]*2**24,ur=this[++Gt]+this[++Gt]*2**8+this[++Gt]*2**16+er*2**24;return BigInt(lr)+(BigInt(ur)<<BigInt(32))}),at.prototype.readBigUInt64BE=cr(function(Gt){Gt=Gt>>>0,Qt(Gt,"offset");const Wt=this[Gt],er=this[Gt+7];(Wt===void 0||er===void 0)&&qt(Gt,this.length-8);const lr=Wt*2**24+this[++Gt]*2**16+this[++Gt]*2**8+this[++Gt],ur=this[++Gt]*2**24+this[++Gt]*2**16+this[++Gt]*2**8+er;return(BigInt(lr)<<BigInt(32))+BigInt(ur)}),at.prototype.readIntLE=function(Gt,Wt,er){Gt=Gt>>>0,Wt=Wt>>>0,er||jt(Gt,Wt,this.length);let lr=this[Gt],ur=1,pr=0;for(;++pr<Wt&&(ur*=256);)lr+=this[Gt+pr]*ur;return ur*=128,lr>=ur&&(lr-=Math.pow(2,8*Wt)),lr},at.prototype.readIntBE=function(Gt,Wt,er){Gt=Gt>>>0,Wt=Wt>>>0,er||jt(Gt,Wt,this.length);let lr=Wt,ur=1,pr=this[Gt+--lr];for(;lr>0&&(ur*=256);)pr+=this[Gt+--lr]*ur;return ur*=128,pr>=ur&&(pr-=Math.pow(2,8*Wt)),pr},at.prototype.readInt8=function(Gt,Wt){return Gt=Gt>>>0,Wt||jt(Gt,1,this.length),this[Gt]&128?(255-this[Gt]+1)*-1:this[Gt]},at.prototype.readInt16LE=function(Gt,Wt){Gt=Gt>>>0,Wt||jt(Gt,2,this.length);const er=this[Gt]|this[Gt+1]<<8;return er&32768?er|4294901760:er},at.prototype.readInt16BE=function(Gt,Wt){Gt=Gt>>>0,Wt||jt(Gt,2,this.length);const er=this[Gt+1]|this[Gt]<<8;return er&32768?er|4294901760:er},at.prototype.readInt32LE=function(Gt,Wt){return Gt=Gt>>>0,Wt||jt(Gt,4,this.length),this[Gt]|this[Gt+1]<<8|this[Gt+2]<<16|this[Gt+3]<<24},at.prototype.readInt32BE=function(Gt,Wt){return Gt=Gt>>>0,Wt||jt(Gt,4,this.length),this[Gt]<<24|this[Gt+1]<<16|this[Gt+2]<<8|this[Gt+3]},at.prototype.readBigInt64LE=cr(function(Gt){Gt=Gt>>>0,Qt(Gt,"offset");const Wt=this[Gt],er=this[Gt+7];(Wt===void 0||er===void 0)&&qt(Gt,this.length-8);const lr=this[Gt+4]+this[Gt+5]*2**8+this[Gt+6]*2**16+(er<<24);return(BigInt(lr)<<BigInt(32))+BigInt(Wt+this[++Gt]*2**8+this[++Gt]*2**16+this[++Gt]*2**24)}),at.prototype.readBigInt64BE=cr(function(Gt){Gt=Gt>>>0,Qt(Gt,"offset");const Wt=this[Gt],er=this[Gt+7];(Wt===void 0||er===void 0)&&qt(Gt,this.length-8);const lr=(Wt<<24)+this[++Gt]*2**16+this[++Gt]*2**8+this[++Gt];return(BigInt(lr)<<BigInt(32))+BigInt(this[++Gt]*2**24+this[++Gt]*2**16+this[++Gt]*2**8+er)}),at.prototype.readFloatLE=function(Gt,Wt){return Gt=Gt>>>0,Wt||jt(Gt,4,this.length),$.read(this,Gt,!0,23,4)},at.prototype.readFloatBE=function(Gt,Wt){return Gt=Gt>>>0,Wt||jt(Gt,4,this.length),$.read(this,Gt,!1,23,4)},at.prototype.readDoubleLE=function(Gt,Wt){return Gt=Gt>>>0,Wt||jt(Gt,8,this.length),$.read(this,Gt,!0,52,8)},at.prototype.readDoubleBE=function(Gt,Wt){return Gt=Gt>>>0,Wt||jt(Gt,8,this.length),$.read(this,Gt,!1,52,8)};function Ht(Xt,Gt,Wt,er,lr,ur){if(!at.isBuffer(Xt))throw new TypeError('"buffer" argument must be a Buffer instance');if(Gt>lr||Gt<ur)throw new RangeError('"value" argument is out of bounds');if(Wt+er>Xt.length)throw new RangeError("Index out of range")}at.prototype.writeUintLE=at.prototype.writeUIntLE=function(Gt,Wt,er,lr){if(Gt=+Gt,Wt=Wt>>>0,er=er>>>0,!lr){const yr=Math.pow(2,8*er)-1;Ht(this,Gt,Wt,er,yr,0)}let ur=1,pr=0;for(this[Wt]=Gt&255;++pr<er&&(ur*=256);)this[Wt+pr]=Gt/ur&255;return Wt+er},at.prototype.writeUintBE=at.prototype.writeUIntBE=function(Gt,Wt,er,lr){if(Gt=+Gt,Wt=Wt>>>0,er=er>>>0,!lr){const yr=Math.pow(2,8*er)-1;Ht(this,Gt,Wt,er,yr,0)}let ur=er-1,pr=1;for(this[Wt+ur]=Gt&255;--ur>=0&&(pr*=256);)this[Wt+ur]=Gt/pr&255;return Wt+er},at.prototype.writeUint8=at.prototype.writeUInt8=function(Gt,Wt,er){return Gt=+Gt,Wt=Wt>>>0,er||Ht(this,Gt,Wt,1,255,0),this[Wt]=Gt&255,Wt+1},at.prototype.writeUint16LE=at.prototype.writeUInt16LE=function(Gt,Wt,er){return Gt=+Gt,Wt=Wt>>>0,er||Ht(this,Gt,Wt,2,65535,0),this[Wt]=Gt&255,this[Wt+1]=Gt>>>8,Wt+2},at.prototype.writeUint16BE=at.prototype.writeUInt16BE=function(Gt,Wt,er){return Gt=+Gt,Wt=Wt>>>0,er||Ht(this,Gt,Wt,2,65535,0),this[Wt]=Gt>>>8,this[Wt+1]=Gt&255,Wt+2},at.prototype.writeUint32LE=at.prototype.writeUInt32LE=function(Gt,Wt,er){return Gt=+Gt,Wt=Wt>>>0,er||Ht(this,Gt,Wt,4,4294967295,0),this[Wt+3]=Gt>>>24,this[Wt+2]=Gt>>>16,this[Wt+1]=Gt>>>8,this[Wt]=Gt&255,Wt+4},at.prototype.writeUint32BE=at.prototype.writeUInt32BE=function(Gt,Wt,er){return Gt=+Gt,Wt=Wt>>>0,er||Ht(this,Gt,Wt,4,4294967295,0),this[Wt]=Gt>>>24,this[Wt+1]=Gt>>>16,this[Wt+2]=Gt>>>8,this[Wt+3]=Gt&255,Wt+4};function Ft(Xt,Gt,Wt,er,lr){Vt(Gt,er,lr,Xt,Wt,7);let ur=Number(Gt&BigInt(4294967295));Xt[Wt++]=ur,ur=ur>>8,Xt[Wt++]=ur,ur=ur>>8,Xt[Wt++]=ur,ur=ur>>8,Xt[Wt++]=ur;let pr=Number(Gt>>BigInt(32)&BigInt(4294967295));return Xt[Wt++]=pr,pr=pr>>8,Xt[Wt++]=pr,pr=pr>>8,Xt[Wt++]=pr,pr=pr>>8,Xt[Wt++]=pr,Wt}function _t(Xt,Gt,Wt,er,lr){Vt(Gt,er,lr,Xt,Wt,7);let ur=Number(Gt&BigInt(4294967295));Xt[Wt+7]=ur,ur=ur>>8,Xt[Wt+6]=ur,ur=ur>>8,Xt[Wt+5]=ur,ur=ur>>8,Xt[Wt+4]=ur;let pr=Number(Gt>>BigInt(32)&BigInt(4294967295));return Xt[Wt+3]=pr,pr=pr>>8,Xt[Wt+2]=pr,pr=pr>>8,Xt[Wt+1]=pr,pr=pr>>8,Xt[Wt]=pr,Wt+8}at.prototype.writeBigUInt64LE=cr(function(Gt,Wt=0){return Ft(this,Gt,Wt,BigInt(0),BigInt("0xffffffffffffffff"))}),at.prototype.writeBigUInt64BE=cr(function(Gt,Wt=0){return _t(this,Gt,Wt,BigInt(0),BigInt("0xffffffffffffffff"))}),at.prototype.writeIntLE=function(Gt,Wt,er,lr){if(Gt=+Gt,Wt=Wt>>>0,!lr){const Er=Math.pow(2,8*er-1);Ht(this,Gt,Wt,er,Er-1,-Er)}let ur=0,pr=1,yr=0;for(this[Wt]=Gt&255;++ur<er&&(pr*=256);)Gt<0&&yr===0&&this[Wt+ur-1]!==0&&(yr=1),this[Wt+ur]=(Gt/pr>>0)-yr&255;return Wt+er},at.prototype.writeIntBE=function(Gt,Wt,er,lr){if(Gt=+Gt,Wt=Wt>>>0,!lr){const Er=Math.pow(2,8*er-1);Ht(this,Gt,Wt,er,Er-1,-Er)}let ur=er-1,pr=1,yr=0;for(this[Wt+ur]=Gt&255;--ur>=0&&(pr*=256);)Gt<0&&yr===0&&this[Wt+ur+1]!==0&&(yr=1),this[Wt+ur]=(Gt/pr>>0)-yr&255;return Wt+er},at.prototype.writeInt8=function(Gt,Wt,er){return Gt=+Gt,Wt=Wt>>>0,er||Ht(this,Gt,Wt,1,127,-128),Gt<0&&(Gt=255+Gt+1),this[Wt]=Gt&255,Wt+1},at.prototype.writeInt16LE=function(Gt,Wt,er){return Gt=+Gt,Wt=Wt>>>0,er||Ht(this,Gt,Wt,2,32767,-32768),this[Wt]=Gt&255,this[Wt+1]=Gt>>>8,Wt+2},at.prototype.writeInt16BE=function(Gt,Wt,er){return Gt=+Gt,Wt=Wt>>>0,er||Ht(this,Gt,Wt,2,32767,-32768),this[Wt]=Gt>>>8,this[Wt+1]=Gt&255,Wt+2},at.prototype.writeInt32LE=function(Gt,Wt,er){return Gt=+Gt,Wt=Wt>>>0,er||Ht(this,Gt,Wt,4,2147483647,-2147483648),this[Wt]=Gt&255,this[Wt+1]=Gt>>>8,this[Wt+2]=Gt>>>16,this[Wt+3]=Gt>>>24,Wt+4},at.prototype.writeInt32BE=function(Gt,Wt,er){return Gt=+Gt,Wt=Wt>>>0,er||Ht(this,Gt,Wt,4,2147483647,-2147483648),Gt<0&&(Gt=4294967295+Gt+1),this[Wt]=Gt>>>24,this[Wt+1]=Gt>>>16,this[Wt+2]=Gt>>>8,this[Wt+3]=Gt&255,Wt+4},at.prototype.writeBigInt64LE=cr(function(Gt,Wt=0){return Ft(this,Gt,Wt,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),at.prototype.writeBigInt64BE=cr(function(Gt,Wt=0){return _t(this,Gt,Wt,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Nt(Xt,Gt,Wt,er,lr,ur){if(Wt+er>Xt.length)throw new RangeError("Index out of range");if(Wt<0)throw new RangeError("Index out of range")}function Mt(Xt,Gt,Wt,er,lr){return Gt=+Gt,Wt=Wt>>>0,lr||Nt(Xt,Gt,Wt,4),$.write(Xt,Gt,Wt,er,23,4),Wt+4}at.prototype.writeFloatLE=function(Gt,Wt,er){return Mt(this,Gt,Wt,!0,er)},at.prototype.writeFloatBE=function(Gt,Wt,er){return Mt(this,Gt,Wt,!1,er)};function Lt(Xt,Gt,Wt,er,lr){return Gt=+Gt,Wt=Wt>>>0,lr||Nt(Xt,Gt,Wt,8),$.write(Xt,Gt,Wt,er,52,8),Wt+8}at.prototype.writeDoubleLE=function(Gt,Wt,er){return Lt(this,Gt,Wt,!0,er)},at.prototype.writeDoubleBE=function(Gt,Wt,er){return Lt(this,Gt,Wt,!1,er)},at.prototype.copy=function(Gt,Wt,er,lr){if(!at.isBuffer(Gt))throw new TypeError("argument should be a Buffer");if(er||(er=0),!lr&&lr!==0&&(lr=this.length),Wt>=Gt.length&&(Wt=Gt.length),Wt||(Wt=0),lr>0&&lr<er&&(lr=er),lr===er||Gt.length===0||this.length===0)return 0;if(Wt<0)throw new RangeError("targetStart out of bounds");if(er<0||er>=this.length)throw new RangeError("Index out of range");if(lr<0)throw new RangeError("sourceEnd out of bounds");lr>this.length&&(lr=this.length),Gt.length-Wt<lr-er&&(lr=Gt.length-Wt+er);const ur=lr-er;return this===Gt&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(Wt,er,lr):Uint8Array.prototype.set.call(Gt,this.subarray(er,lr),Wt),ur},at.prototype.fill=function(Gt,Wt,er,lr){if(typeof Gt=="string"){if(typeof Wt=="string"?(lr=Wt,Wt=0,er=this.length):typeof er=="string"&&(lr=er,er=this.length),lr!==void 0&&typeof lr!="string")throw new TypeError("encoding must be a string");if(typeof lr=="string"&&!at.isEncoding(lr))throw new TypeError("Unknown encoding: "+lr);if(Gt.length===1){const pr=Gt.charCodeAt(0);(lr==="utf8"&&pr<128||lr==="latin1")&&(Gt=pr)}}else typeof Gt=="number"?Gt=Gt&255:typeof Gt=="boolean"&&(Gt=Number(Gt));if(Wt<0||this.length<Wt||this.length<er)throw new RangeError("Out of range index");if(er<=Wt)return this;Wt=Wt>>>0,er=er===void 0?this.length:er>>>0,Gt||(Gt=0);let ur;if(typeof Gt=="number")for(ur=Wt;ur<er;++ur)this[ur]=Gt;else{const pr=at.isBuffer(Gt)?Gt:at.from(Gt,lr),yr=pr.length;if(yr===0)throw new TypeError('The value "'+Gt+'" is invalid for argument "value"');for(ur=0;ur<er-Wt;++ur)this[ur+Wt]=pr[ur%yr]}return this};const $t={};function Tt(Xt,Gt,Wt){$t[Xt]=class extends Wt{constructor(){super(),Object.defineProperty(this,"message",{value:Gt.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${Xt}]`,this.stack,delete this.name}get code(){return Xt}set code(lr){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:lr,writable:!0})}toString(){return`${this.name} [${Xt}]: ${this.message}`}}}Tt("ERR_BUFFER_OUT_OF_BOUNDS",function(Xt){return Xt?`${Xt} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Tt("ERR_INVALID_ARG_TYPE",function(Xt,Gt){return`The "${Xt}" argument must be of type number. Received type ${typeof Gt}`},TypeError),Tt("ERR_OUT_OF_RANGE",function(Xt,Gt,Wt){let er=`The value of "${Xt}" is out of range.`,lr=Wt;return Number.isInteger(Wt)&&Math.abs(Wt)>2**32?lr=Dt(String(Wt)):typeof Wt=="bigint"&&(lr=String(Wt),(Wt>BigInt(2)**BigInt(32)||Wt<-(BigInt(2)**BigInt(32)))&&(lr=Dt(lr)),lr+="n"),er+=` It must be ${Gt}. Received ${lr}`,er},RangeError);function Dt(Xt){let Gt="",Wt=Xt.length;const er=Xt[0]==="-"?1:0;for(;Wt>=er+4;Wt-=3)Gt=`_${Xt.slice(Wt-3,Wt)}${Gt}`;return`${Xt.slice(0,Wt)}${Gt}`}function Ut(Xt,Gt,Wt){Qt(Gt,"offset"),(Xt[Gt]===void 0||Xt[Gt+Wt]===void 0)&&qt(Gt,Xt.length-(Wt+1))}function Vt(Xt,Gt,Wt,er,lr,ur){if(Xt>Wt||Xt<Gt){const pr=typeof Gt=="bigint"?"n":"";let yr;throw ur>3?Gt===0||Gt===BigInt(0)?yr=`>= 0${pr} and < 2${pr} ** ${(ur+1)*8}${pr}`:yr=`>= -(2${pr} ** ${(ur+1)*8-1}${pr}) and < 2 ** ${(ur+1)*8-1}${pr}`:yr=`>= ${Gt}${pr} and <= ${Wt}${pr}`,new $t.ERR_OUT_OF_RANGE("value",yr,Xt)}Ut(er,lr,ur)}function Qt(Xt,Gt){if(typeof Xt!="number")throw new $t.ERR_INVALID_ARG_TYPE(Gt,"number",Xt)}function qt(Xt,Gt,Wt){throw Math.floor(Xt)!==Xt?(Qt(Xt,Wt),new $t.ERR_OUT_OF_RANGE(Wt||"offset","an integer",Xt)):Gt<0?new $t.ERR_BUFFER_OUT_OF_BOUNDS:new $t.ERR_OUT_OF_RANGE(Wt||"offset",`>= ${Wt?1:0} and <= ${Gt}`,Xt)}const Zt=/[^+/0-9A-Za-z-_]/g;function ar(Xt){if(Xt=Xt.split("=")[0],Xt=Xt.trim().replace(Zt,""),Xt.length<2)return"";for(;Xt.length%4!==0;)Xt=Xt+"=";return Xt}function Jt(Xt,Gt){Gt=Gt||1/0;let Wt;const er=Xt.length;let lr=null;const ur=[];for(let pr=0;pr<er;++pr){if(Wt=Xt.charCodeAt(pr),Wt>55295&&Wt<57344){if(!lr){if(Wt>56319){(Gt-=3)>-1&&ur.push(239,191,189);continue}else if(pr+1===er){(Gt-=3)>-1&&ur.push(239,191,189);continue}lr=Wt;continue}if(Wt<56320){(Gt-=3)>-1&&ur.push(239,191,189),lr=Wt;continue}Wt=(lr-55296<<10|Wt-56320)+65536}else lr&&(Gt-=3)>-1&&ur.push(239,191,189);if(lr=null,Wt<128){if((Gt-=1)<0)break;ur.push(Wt)}else if(Wt<2048){if((Gt-=2)<0)break;ur.push(Wt>>6|192,Wt&63|128)}else if(Wt<65536){if((Gt-=3)<0)break;ur.push(Wt>>12|224,Wt>>6&63|128,Wt&63|128)}else if(Wt<1114112){if((Gt-=4)<0)break;ur.push(Wt>>18|240,Wt>>12&63|128,Wt>>6&63|128,Wt&63|128)}else throw new Error("Invalid code point")}return ur}function rr(Xt){const Gt=[];for(let Wt=0;Wt<Xt.length;++Wt)Gt.push(Xt.charCodeAt(Wt)&255);return Gt}function Yt(Xt,Gt){let Wt,er,lr;const ur=[];for(let pr=0;pr<Xt.length&&!((Gt-=2)<0);++pr)Wt=Xt.charCodeAt(pr),er=Wt>>8,lr=Wt%256,ur.push(lr),ur.push(er);return ur}function Kt(Xt){return s.toByteArray(ar(Xt))}function nr(Xt,Gt,Wt,er){let lr;for(lr=0;lr<er&&!(lr+Wt>=Gt.length||lr>=Xt.length);++lr)Gt[lr+Wt]=Xt[lr];return lr}function tr(Xt,Gt){return Xt instanceof Gt||Xt!=null&&Xt.constructor!=null&&Xt.constructor.name!=null&&Xt.constructor.name===Gt.name}function ir(Xt){return Xt!==Xt}const sr=function(){const Xt="0123456789abcdef",Gt=new Array(256);for(let Wt=0;Wt<16;++Wt){const er=Wt*16;for(let lr=0;lr<16;++lr)Gt[er+lr]=Xt[Wt]+Xt[lr]}return Gt}();function cr(Xt){return typeof BigInt>"u"?or:Xt}function or(){throw new Error("BigInt not supported")}})(buffer$1);const langs=["en","zh","ja","ko","ar","th","pl","it","de","es","fr"],Lang=z.enum(langs);z.object({cancel:z.string(),field:z.string(),fieldName:z.string(),align:z.string(),width:z.string(),opacity:z.string(),height:z.string(),rotate:z.string(),edit:z.string(),required:z.string(),editable:z.string(),plsInputName:z.string(),fieldMustUniq:z.string(),notUniq:z.string(),noKeyName:z.string(),fieldsList:z.string(),editField:z.string(),type:z.string(),errorOccurred:z.string(),errorBulkUpdateFieldName:z.string(),commitBulkUpdateFieldName:z.string(),bulkUpdateFieldName:z.string(),addPageAfter:z.string(),removePage:z.string(),removePageConfirm:z.string(),"validation.uniqueName":z.string(),"validation.hexColor":z.string(),"schemas.color":z.string(),"schemas.borderWidth":z.string(),"schemas.borderColor":z.string(),"schemas.backgroundColor":z.string(),"schemas.textColor":z.string(),"schemas.bgColor":z.string(),"schemas.horizontal":z.string(),"schemas.vertical":z.string(),"schemas.left":z.string(),"schemas.center":z.string(),"schemas.right":z.string(),"schemas.top":z.string(),"schemas.middle":z.string(),"schemas.bottom":z.string(),"schemas.padding":z.string(),"schemas.text.fontName":z.string(),"schemas.text.size":z.string(),"schemas.text.spacing":z.string(),"schemas.text.textAlign":z.string(),"schemas.text.verticalAlign":z.string(),"schemas.text.lineHeight":z.string(),"schemas.text.min":z.string(),"schemas.text.max":z.string(),"schemas.text.fit":z.string(),"schemas.text.dynamicFontSize":z.string(),"schemas.text.format":z.string(),"schemas.mvt.typingInstructions":z.string(),"schemas.mvt.sampleField":z.string(),"schemas.mvt.variablesSampleData":z.string(),"schemas.barcodes.barColor":z.string(),"schemas.barcodes.includetext":z.string(),"schemas.table.alternateBackgroundColor":z.string(),"schemas.table.tableStyle":z.string(),"schemas.table.headStyle":z.string(),"schemas.table.bodyStyle":z.string(),"schemas.table.columnStyle":z.string()}),z.enum(["viewer","form","designer"]);const ColorType=z.enum(["rgb","cmyk"]).optional();z.object({height:z.number(),width:z.number()});const Schema$1=z.object({type:z.string(),content:z.string().optional(),position:z.object({x:z.number(),y:z.number()}),width:z.number(),height:z.number(),rotate:z.number().optional(),opacity:z.number().optional(),readOnly:z.boolean().optional(),required:z.boolean().optional(),__bodyRange:z.object({start:z.number(),end:z.number().optional()}).optional(),__isSplit:z.boolean().optional()}).passthrough(),SchemaForUIAdditionalInfo=z.object({id:z.string(),key:z.string()});Schema$1.merge(SchemaForUIAdditionalInfo);const ArrayBufferSchema=z.any().refine(a=>a instanceof ArrayBuffer),Uint8ArraySchema=z.any().refine(a=>a instanceof Uint8Array),BlankPdf=z.object({width:z.number(),height:z.number(),padding:z.tuple([z.number(),z.number(),z.number(),z.number()])}),CustomPdf=z.union([z.string(),ArrayBufferSchema,Uint8ArraySchema]),BasePdf=z.union([CustomPdf,BlankPdf]),Template=z.object({schemas:z.array(z.record(Schema$1)),basePdf:BasePdf,pdfmeVersion:z.string().optional()}).passthrough(),Inputs=z.array(z.record(z.any())).min(1),Font=z.record(z.object({data:z.union([z.string(),ArrayBufferSchema,Uint8ArraySchema]),fallback:z.boolean().optional(),subset:z.boolean().optional()})),CommonOptions=z.object({font:Font.optional()}).passthrough(),CommonProps=z.object({template:Template,options:CommonOptions.optional(),plugins:z.record(z.object({ui:z.any(),pdf:z.any(),propPanel:z.any()})).optional()}),GeneratorOptions=CommonOptions.extend({colorType:ColorType,author:z.string().optional(),creationDate:z.date().optional(),creator:z.string().optional(),keywords:z.array(z.string()).optional(),language:z.string().optional(),modificationDate:z.date().optional(),producer:z.string().optional(),subject:z.string().optional(),title:z.string().optional()});CommonProps.extend({inputs:Inputs,options:GeneratorOptions.optional()}).strict();const UIOptions=CommonOptions.extend({lang:Lang.optional(),labels:z.record(z.string(),z.string()).optional(),theme:z.record(z.string(),z.unknown()).optional(),icons:z.record(z.string(),z.string()).optional(),requiredByDefault:z.boolean().optional()}),HTMLElementSchema=z.any().refine(a=>a instanceof HTMLElement),UIProps=CommonProps.extend({domContainer:HTMLElementSchema,options:UIOptions.optional()}),PreviewProps=UIProps.extend({inputs:Inputs}).strict(),DesignerProps=UIProps.extend({}).strict(),cloneDeep$1=a=>JSON.parse(JSON.stringify(a)),uniq=a=>Array.from(new Set(a)),getFallbackFontName=a=>{const s="",$=Object.entries(a).reduce((_,_e)=>{const[tt,nt]=_e;return!_&&nt.fallback?tt:_},s);if($===s)throw Error("[@pdfme/common] fallback flag is not found in font. true fallback flag must be only one.");return $},getDefaultFont=()=>({[DEFAULT_FONT_NAME]:{data:b64toUint8Array(DEFAULT_FONT_VALUE),fallback:!0}}),mm2pt=a=>parseFloat(String(a))*MM_TO_PT_RATIO,pt2mm=a=>a*PT_TO_MM_RATIO,pt2px=a=>a*PT_TO_PX_RATIO,px2mm=a=>{const s=.26458333333333;return parseFloat(String(a))*s},blob2Base64Pdf=a=>new Promise((s,$)=>{const _=new FileReader;_.onloadend=()=>{_.result.startsWith("data:application/pdf;")?s(_.result):$(Error("[@pdfme/common] template.basePdf must be pdf data."))},_.readAsDataURL(a)}),isHexValid=a=>/^#(?:[A-Fa-f0-9]{3,4}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/i.test(a),getB64BasePdf=a=>typeof a=="string"&&!a.startsWith("data:application/pdf;")&&typeof window<"u"?fetch(a).then($=>$.blob()).then(blob2Base64Pdf).catch($=>{throw $}):a,isBlankPdf=a=>BlankPdf.safeParse(a).success,getByteString=a=>buffer$1.Buffer.from(a,"base64").toString("binary"),b64toUint8Array=a=>{const s=a.split(";base64,")[1]?a.split(";base64,")[1]:a,$=getByteString(s),_=new Uint8Array($.length);for(let _e=0;_e<$.length;_e+=1)_[_e]=$.charCodeAt(_e);return _},getFontNamesInSchemas=a=>uniq(a.map(s=>Object.values(s).map($=>$.fontName??"")).reduce((s,$)=>s.concat($),[]).filter(Boolean)),checkFont=a=>{const{font:s,template:{schemas:$}}=a,_e=Object.values(s).reduce((at,ot)=>ot.fallback?at+1:at,0);if(_e===0)throw Error(`[@pdfme/common] fallback flag is not found in font. true fallback flag must be only one.
|
43
43
|
Check this document: https://pdfme.com/docs/custom-fonts#about-font-type`);if(_e>1)throw Error(`[@pdfme/common] ${_e} fallback flags found in font. true fallback flag must be only one.
|
44
44
|
Check this document: https://pdfme.com/docs/custom-fonts#about-font-type`);const tt=getFontNamesInSchemas($),nt=Object.keys(s);if(tt.some(at=>!nt.includes(at)))throw Error(`[@pdfme/common] ${tt.filter(at=>!nt.includes(at)).join()} of template.schemas is not found in font.
|
45
45
|
Check this document: https://pdfme.com/docs/custom-fonts`)},checkPlugins=a=>{const{plugins:s,template:{schemas:$}}=a,_=uniq($.map(tt=>Object.values(tt).map(nt=>nt.type)).flat()),_e=Object.values(s).map(tt=>tt==null?void 0:tt.propPanel.defaultSchema.type);if(_.some(tt=>!_e.includes(tt)))throw Error(`[@pdfme/common] ${_.filter(tt=>!_e.includes(tt)).join()} of template.schemas is not found in plugins.`)},checkProps=(a,s)=>{try{s.parse(a)}catch($){if($ instanceof z.ZodError){const _e=$.issues.map(tt=>`ERROR POSITION: ${tt.path.join(".")}
|
@@ -47,7 +47,7 @@ ERROR MESSAGE: ${tt.message}
|
|
47
47
|
--------------------------`).join(`
|
48
48
|
`);throw Error(`[@pdfme/common] Invalid argument:
|
49
49
|
--------------------------
|
50
|
-
${_e}`)}}if(a&&typeof a=="object"&&"template"in a&&"options"in a){const{template:$,options:_}=a;_&&_.font&&checkFont({font:_.font,template:$})}if(a&&typeof a=="object"&&"template"in a&&"plugins"in a){const{template:$,plugins:_}=a;_&&checkPlugins({plugins:_,template:$})}},checkInputs=a=>checkProps(a,Inputs),checkUIOptions=a=>checkProps(a,UIOptions),checkTemplate=a=>checkProps(a,Template),checkUIProps=a=>checkProps(a,UIProps),checkPreviewProps=a=>checkProps(a,PreviewProps),checkDesignerProps=a=>checkProps(a,DesignerProps);class Node{constructor({width:s=0,height:$=0}={}){Object.defineProperty(this,"index",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"children",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"padding",{enumerable:!0,configurable:!0,writable:!0,value:[0,0,0,0]}),Object.defineProperty(this,"position",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0}}),this.width=s,this.height=$}setIndex(s){this.index=s}setKeyAndSchema(s,$){this.key=s,this.schema=$}setWidth(s){this.width=s}setHeight(s){this.height=s}setPadding(s){this.padding=s}setPosition(s){this.position=s}insertChild(s){const $=this.getChildCount();s.setIndex($),this.children.splice($,0,s)}getChildCount(){return this.children.length}getChild(s){return this.children[s]}}function createPage(a){const s=new Node({...a});return s.setPadding(a.padding),s}function createNode(a){const{position:s,width:$,height:_,key:_e,schema:tt}=a,nt=new Node({width:$,height:_});return nt.setPosition(s),nt.setKeyAndSchema(_e,tt),nt}function resortChildren(a,s){a.children=a.children.sort(($,_)=>{const _e=s.get($.key),tt=s.get(_.key);if(_e===void 0||tt===void 0)throw new Error("[@pdfme/common] order is not defined");return _e-tt}).map(($,_)=>($.setIndex(_),$))}async function createOnePage(a){const{basePdf:s,schemaObj:$,orderMap:_,input:_e,options:tt,_cache:nt,getDynamicHeights:at}=a,ot=createPage(s),rt=[],st=Object.entries($).sort((it,ut)=>it[1].position.y-ut[1].position.y),lt=new Map;for(const[it,ut]of st){const{position:ft,width:ht}=ut,dt={schema:ut,basePdf:s,options:tt,_cache:nt},gt=await at((_e==null?void 0:_e[it])||"",dt),pt=gt.reduce((ct,vt)=>ct+vt,0),mt=ut.height;pt!==mt&<.set(ft.y+mt,pt-mt),gt.forEach((ct,vt)=>{let At=ut.position.y+gt.reduce((bt,Et,St)=>St<vt?bt+Et:bt,0);for(const[bt,Et]of lt.entries())bt<=ut.position.y&&(At+=Et);const xt=createNode({key:it,schema:ut,position:{...ft,y:At},width:ht,height:ct});rt.push(At+ct+s.padding[2]),ot.insertChild(xt)})}const et=Math.max(...rt,s.height-s.padding[2]);return ot.setHeight(et),resortChildren(ot,_),ot}function breakIntoPages(a){const{longPage:s,orderMap:$,basePdf:_}=a,_e=[createPage(_)],[tt,,nt]=_.padding,at=[],ot=lt=>_.height-nt-(lt>0?tt:0),rt=(lt,et)=>{var ut;const it=lt-et*(_.height-tt-nt);for(;_e.length<=et;)_e[et]||(_e.push(createPage(_)),at.push({page:et,value:(it-tt)*-1}));return it+(((ut=at.find(ft=>ft.page===et))==null?void 0:ut.value)||0)},st=s.children.sort((lt,et)=>lt.position.y-et.position.y);for(let lt=0;lt<st.length;lt++){const{key:et,schema:it,position:ut,height:ft,width:ht}=st[lt],{y:dt,x:gt}=ut;let pt=Math.floor(dt/ot(_e.length-1)),mt=rt(dt,pt);if(mt+ft>_.height-nt&&(pt++,mt=rt(dt,pt)),!et||!it)throw new Error("[@pdfme/common] key or schema is undefined");const ct=createNode({key:et,schema:it,position:{x:gt,y:mt},width:ht,height:ft});_e[pt].insertChild(ct)}return _e.forEach(lt=>resortChildren(lt,$)),_e}function createNewTemplate(a,s){const $={schemas:Array.from({length:a.length},()=>({})),basePdf:s},_=new Map;return cloneDeep$1(a).forEach((_e,tt)=>{_e.children.forEach(nt=>{const{key:at,schema:ot}=nt;if(!at||!ot)throw new Error("[@pdfme/common] key or schema is undefined");_.has(at)||_.set(at,[]),_.get(at).push(nt);const rt=_e.children.filter(lt=>lt.key===at),st=_.get(at).length-rt.length;if(rt.length>0){if(!rt[0].schema)throw new Error("[@pdfme/common] schema is undefined");const lt=rt[0].schema,et=rt.reduce((ut,ft)=>ut+ft.height,0),it=rt[0].position;lt.__bodyRange={start:Math.max(st-1,0),end:st+rt.length-1},lt.__isSplit=st>0,$.schemas[tt][at]=Object.assign({},lt,{position:it,height:et})}})}),$}const getDynamicTemplate=async a=>{const{template:s}=a;if(!isBlankPdf(s.basePdf))return s;const $=s.basePdf,_=[];for(const _e of s.schemas){const tt=new Map(Object.keys(_e).map((ot,rt)=>[ot,rt])),nt=await createOnePage({basePdf:$,schemaObj:_e,orderMap:tt,...a}),at=breakIntoPages({longPage:nt,basePdf:$,orderMap:tt});_.push(...at)}return createNewTemplate(_,s.basePdf)},DEFAULT_LANG="en",DESTROYED_ERR_MSG="[@pdfme/ui] this instance is already destroyed",SELECTABLE_CLASSNAME="selectable",RULER_HEIGHT=30,PAGE_GAP=10,RIGHT_SIDEBAR_WIDTH=400,BACKGROUND_COLOR="rgb(74, 74, 74)";var pdf_worker_entry={},pdf_worker={exports:{}};(function(a,s){(function(_,_e){a.exports=_.pdfjsWorker=_e()})(globalThis,()=>(()=>{var $=[,(nt,at,ot)=>{Object.defineProperty(at,"__esModule",{value:!0}),at.WorkerTask=at.WorkerMessageHandler=void 0,ot(2),ot(84),ot(93),ot(94),ot(97),ot(99),ot(101),ot(105),ot(108),ot(115),ot(116),ot(127),ot(129),ot(132),ot(134),ot(136),ot(138),ot(140),ot(144);var rt=ot(145),st=ot(150),lt=ot(151),et=ot(153),it=ot(157),ut=ot(219),ft=ot(224),ht=ot(258),dt=ot(259),gt=ot(223);class pt{constructor(At){this.name=At,this.terminated=!1,this._capability=new rt.PromiseCapability}get finished(){return this._capability.promise}finish(){this._capability.resolve()}terminate(){this.terminated=!0}ensureNotTerminated(){if(this.terminated)throw new Error("Worker task was terminated")}}at.WorkerTask=pt;class mt{static setup(At,xt){let bt=!1;At.on("test",function(Et){bt||(bt=!0,At.send("test",Et instanceof Uint8Array))}),At.on("configure",function(Et){(0,rt.setVerbosityLevel)(Et.verbosity)}),At.on("GetDocRequest",function(Et){return mt.createDocumentHandler(Et,xt)})}static createDocumentHandler(At,xt){let bt,Et=!1,St=null;const Bt=new Set,Ot=(0,rt.getVerbosityLevel)(),{docId:Pt,apiVersion:wt}=At,Ct="3.11.174";if(wt!==Ct)throw new Error(`The API version "${wt}" does not match the Worker version "${Ct}".`);const It=[];for(const Mt in[])It.push(Mt);if(It.length)throw new Error("The `Array.prototype` contains unexpected enumerable properties: "+It.join(", ")+"; thus breaking e.g. `for...in` iteration of `Array`s.");const yt=Pt+"_worker";let Rt=new ht.MessageHandler(yt,Pt,xt);function kt(){if(Et)throw new Error("Worker was terminated")}function jt(Mt){Bt.add(Mt)}function Ht(Mt){Mt.finish(),Bt.delete(Mt)}async function Ft(Mt){await bt.ensureDoc("checkHeader"),await bt.ensureDoc("parseStartXRef"),await bt.ensureDoc("parse",[Mt]),await bt.ensureDoc("checkFirstPage",[Mt]),await bt.ensureDoc("checkLastPage",[Mt]);const Lt=await bt.ensureDoc("isPureXfa");if(Lt){const Ut=new pt("loadXfaFonts");jt(Ut),await Promise.all([bt.loadXfaFonts(Rt,Ut).catch(Vt=>{}).then(()=>Ht(Ut)),bt.loadXfaImages()])}const[$t,Tt]=await Promise.all([bt.ensureDoc("numPages"),bt.ensureDoc("fingerprints")]),Dt=Lt?await bt.ensureDoc("htmlForXfa"):null;return{numPages:$t,fingerprints:Tt,htmlForXfa:Dt}}function _t(Mt){let{data:Lt,password:$t,disableAutoFetch:Tt,rangeChunkSize:Dt,length:Ut,docBaseUrl:Vt,enableXfa:Qt,evaluatorOptions:qt}=Mt;const Zt={source:null,disableAutoFetch:Tt,docBaseUrl:Vt,docId:Pt,enableXfa:Qt,evaluatorOptions:qt,handler:Rt,length:Ut,password:$t,rangeChunkSize:Dt},ar=new rt.PromiseCapability;let Jt;if(Lt){try{Zt.source=Lt,Jt=new et.LocalPdfManager(Zt),ar.resolve(Jt)}catch(ir){ar.reject(ir)}return ar.promise}let rr,Yt=[];try{rr=new dt.PDFWorkerStream(Rt)}catch(ir){return ar.reject(ir),ar.promise}const Kt=rr.getFullReader();Kt.headersReady.then(function(){if(Kt.isRangeSupported){Zt.source=rr,Zt.length=Kt.contentLength,Zt.disableAutoFetch||(Zt.disableAutoFetch=Kt.isStreamingSupported),Jt=new et.NetworkPdfManager(Zt);for(const ir of Yt)Jt.sendProgressiveData(ir);Yt=[],ar.resolve(Jt),St=null}}).catch(function(ir){ar.reject(ir),St=null});let nr=0;const tr=function(){const ir=(0,st.arrayBuffersToBytes)(Yt);Ut&&ir.length!==Ut&&(0,rt.warn)("reported HTTP length is different from actual");try{Zt.source=ir,Jt=new et.LocalPdfManager(Zt),ar.resolve(Jt)}catch(sr){ar.reject(sr)}Yt=[]};return new Promise(function(ir,sr){const cr=function(or){let{value:Xt,done:Gt}=or;try{if(kt(),Gt){Jt||tr(),St=null;return}nr+=Xt.byteLength,Kt.isStreamingSupported||Rt.send("DocProgress",{loaded:nr,total:Math.max(nr,Kt.contentLength||0)}),Jt?Jt.sendProgressiveData(Xt):Yt.push(Xt),Kt.read().then(cr,sr)}catch(Wt){sr(Wt)}};Kt.read().then(cr,sr)}).catch(function(ir){ar.reject(ir),St=null}),St=function(ir){rr.cancelAllRequests(ir)},ar.promise}function Nt(Mt){function Lt(Dt){kt(),Rt.send("GetDoc",{pdfInfo:Dt})}function $t(Dt){if(kt(),Dt instanceof rt.PasswordException){const Ut=new pt(`PasswordException: response ${Dt.code}`);jt(Ut),Rt.sendWithPromise("PasswordRequest",Dt).then(function(Vt){let{password:Qt}=Vt;Ht(Ut),bt.updatePassword(Qt),Tt()}).catch(function(){Ht(Ut),Rt.send("DocException",Dt)})}else Dt instanceof rt.InvalidPDFException||Dt instanceof rt.MissingPDFException||Dt instanceof rt.UnexpectedResponseException||Dt instanceof rt.UnknownErrorException?Rt.send("DocException",Dt):Rt.send("DocException",new rt.UnknownErrorException(Dt.message,Dt.toString()))}function Tt(){kt(),Ft(!1).then(Lt,function(Dt){if(kt(),!(Dt instanceof st.XRefParseException)){$t(Dt);return}bt.requestLoadedStream().then(function(){kt(),Ft(!0).then(Lt,$t)})})}kt(),_t(Mt).then(function(Dt){if(Et)throw Dt.terminate(new rt.AbortException("Worker was terminated.")),new Error("Worker was terminated");bt=Dt,bt.requestLoadedStream(!0).then(Ut=>{Rt.send("DataLoaded",{length:Ut.bytes.byteLength})})}).then(Tt,$t)}return Rt.on("GetPage",function(Mt){return bt.getPage(Mt.pageIndex).then(function(Lt){return Promise.all([bt.ensure(Lt,"rotate"),bt.ensure(Lt,"ref"),bt.ensure(Lt,"userUnit"),bt.ensure(Lt,"view")]).then(function($t){let[Tt,Dt,Ut,Vt]=$t;return{rotate:Tt,ref:Dt,userUnit:Ut,view:Vt}})})}),Rt.on("GetPageIndex",function(Mt){const Lt=lt.Ref.get(Mt.num,Mt.gen);return bt.ensureCatalog("getPageIndex",[Lt])}),Rt.on("GetDestinations",function(Mt){return bt.ensureCatalog("destinations")}),Rt.on("GetDestination",function(Mt){return bt.ensureCatalog("getDestination",[Mt.id])}),Rt.on("GetPageLabels",function(Mt){return bt.ensureCatalog("pageLabels")}),Rt.on("GetPageLayout",function(Mt){return bt.ensureCatalog("pageLayout")}),Rt.on("GetPageMode",function(Mt){return bt.ensureCatalog("pageMode")}),Rt.on("GetViewerPreferences",function(Mt){return bt.ensureCatalog("viewerPreferences")}),Rt.on("GetOpenAction",function(Mt){return bt.ensureCatalog("openAction")}),Rt.on("GetAttachments",function(Mt){return bt.ensureCatalog("attachments")}),Rt.on("GetDocJSActions",function(Mt){return bt.ensureCatalog("jsActions")}),Rt.on("GetPageJSActions",function(Mt){let{pageIndex:Lt}=Mt;return bt.getPage(Lt).then(function($t){return bt.ensure($t,"jsActions")})}),Rt.on("GetOutline",function(Mt){return bt.ensureCatalog("documentOutline")}),Rt.on("GetOptionalContentConfig",function(Mt){return bt.ensureCatalog("optionalContentConfig")}),Rt.on("GetPermissions",function(Mt){return bt.ensureCatalog("permissions")}),Rt.on("GetMetadata",function(Mt){return Promise.all([bt.ensureDoc("documentInfo"),bt.ensureCatalog("metadata")])}),Rt.on("GetMarkInfo",function(Mt){return bt.ensureCatalog("markInfo")}),Rt.on("GetData",function(Mt){return bt.requestLoadedStream().then(function(Lt){return Lt.bytes})}),Rt.on("GetAnnotations",function(Mt){let{pageIndex:Lt,intent:$t}=Mt;return bt.getPage(Lt).then(function(Tt){const Dt=new pt(`GetAnnotations: page ${Lt}`);return jt(Dt),Tt.getAnnotationsData(Rt,Dt,$t).then(Ut=>(Ht(Dt),Ut),Ut=>{throw Ht(Dt),Ut})})}),Rt.on("GetFieldObjects",function(Mt){return bt.ensureDoc("fieldObjects")}),Rt.on("HasJSActions",function(Mt){return bt.ensureDoc("hasJSActions")}),Rt.on("GetCalculationOrderIds",function(Mt){return bt.ensureDoc("calculationOrderIds")}),Rt.on("SaveDocument",async function(Mt){let{isPureXfa:Lt,numPages:$t,annotationStorage:Tt,filename:Dt}=Mt;const Ut=[bt.requestLoadedStream(),bt.ensureCatalog("acroForm"),bt.ensureCatalog("acroFormRef"),bt.ensureDoc("startXRef"),bt.ensureDoc("xref"),bt.ensureDoc("linearization"),bt.ensureCatalog("structTreeRoot")],Vt=[],Qt=Lt?null:(0,st.getNewAnnotationsMap)(Tt),[qt,Zt,ar,Jt,rr,Yt,Kt]=await Promise.all(Ut),nr=rr.trailer.getRaw("Root")||null;let tr;if(Qt){Kt?await Kt.canUpdateStructTree({pdfManager:bt,newAnnotationsByPage:Qt})&&(tr=Kt):await gt.StructTreeRoot.canCreateStructureTree({catalogRef:nr,pdfManager:bt,newAnnotationsByPage:Qt})&&(tr=null);const lr=it.AnnotationFactory.generateImages(Tt.values(),rr,bt.evaluatorOptions.isOffscreenCanvasSupported),ur=tr===void 0?Vt:[];for(const[pr,yr]of Qt)ur.push(bt.getPage(pr).then(Er=>{const br=new pt(`Save (editor): page ${pr}`);return Er.saveNewAnnotations(Rt,br,yr,lr).finally(function(){Ht(br)})}));tr===null?Vt.push(Promise.all(ur).then(async pr=>(await gt.StructTreeRoot.createStructureTree({newAnnotationsByPage:Qt,xref:rr,catalogRef:nr,pdfManager:bt,newRefs:pr}),pr))):tr&&Vt.push(Promise.all(ur).then(async pr=>(await tr.updateStructureTree({newAnnotationsByPage:Qt,pdfManager:bt,newRefs:pr}),pr)))}if(Lt)Vt.push(bt.serializeXfaData(Tt));else for(let lr=0;lr<$t;lr++)Vt.push(bt.getPage(lr).then(function(ur){const pr=new pt(`Save: page ${lr}`);return ur.save(Rt,pr,Tt).finally(function(){Ht(pr)})}));const ir=await Promise.all(Vt);let sr=[],cr=null;if(Lt){if(cr=ir[0],!cr)return qt.bytes}else if(sr=ir.flat(2),sr.length===0)return qt.bytes;const or=ar&&Zt instanceof lt.Dict&&sr.some(lr=>lr.needAppearances),Xt=Zt instanceof lt.Dict&&Zt.get("XFA")||null;let Gt=null,Wt=!1;if(Array.isArray(Xt)){for(let lr=0,ur=Xt.length;lr<ur;lr+=2)Xt[lr]==="datasets"&&(Gt=Xt[lr+1],Wt=!0);Gt===null&&(Gt=rr.getNewTemporaryRef())}else Xt&&(0,rt.warn)("Unsupported XFA type.");let er=Object.create(null);if(rr.trailer){const lr=Object.create(null),ur=rr.trailer.get("Info")||null;ur instanceof lt.Dict&&ur.forEach((pr,yr)=>{typeof yr=="string"&&(lr[pr]=(0,rt.stringToPDFString)(yr))}),er={rootRef:nr,encryptRef:rr.trailer.getRaw("Encrypt")||null,newRef:rr.getNewTemporaryRef(),infoRef:rr.trailer.getRaw("Info")||null,info:lr,fileIds:rr.trailer.get("ID")||null,startXRef:Yt?Jt:rr.lastXRefStreamPos??Jt,filename:Dt}}return(0,ft.incrementalUpdate)({originalData:qt.bytes,xrefInfo:er,newRefs:sr,xref:rr,hasXfa:!!Xt,xfaDatasetsRef:Gt,hasXfaDatasetsEntry:Wt,needAppearances:or,acroFormRef:ar,acroForm:Zt,xfaData:cr}).finally(()=>{rr.resetNewTemporaryRef()})}),Rt.on("GetOperatorList",function(Mt,Lt){const $t=Mt.pageIndex;bt.getPage($t).then(function(Tt){const Dt=new pt(`GetOperatorList: page ${$t}`);jt(Dt);const Ut=Ot>=rt.VerbosityLevel.INFOS?Date.now():0;Tt.getOperatorList({handler:Rt,sink:Lt,task:Dt,intent:Mt.intent,cacheKey:Mt.cacheKey,annotationStorage:Mt.annotationStorage}).then(function(Vt){Ht(Dt),Ut&&(0,rt.info)(`page=${$t+1} - getOperatorList: time=${Date.now()-Ut}ms, len=${Vt.length}`),Lt.close()},function(Vt){Ht(Dt),!Dt.terminated&&Lt.error(Vt)})})}),Rt.on("GetTextContent",function(Mt,Lt){const{pageIndex:$t,includeMarkedContent:Tt,disableNormalization:Dt}=Mt;bt.getPage($t).then(function(Ut){const Vt=new pt("GetTextContent: page "+$t);jt(Vt);const Qt=Ot>=rt.VerbosityLevel.INFOS?Date.now():0;Ut.extractTextContent({handler:Rt,task:Vt,sink:Lt,includeMarkedContent:Tt,disableNormalization:Dt}).then(function(){Ht(Vt),Qt&&(0,rt.info)(`page=${$t+1} - getTextContent: time=${Date.now()-Qt}ms`),Lt.close()},function(qt){Ht(Vt),!Vt.terminated&&Lt.error(qt)})})}),Rt.on("GetStructTree",function(Mt){return bt.getPage(Mt.pageIndex).then(function(Lt){return bt.ensure(Lt,"getStructTree")})}),Rt.on("FontFallback",function(Mt){return bt.fontFallback(Mt.id,Rt)}),Rt.on("Cleanup",function(Mt){return bt.cleanup(!0)}),Rt.on("Terminate",function(Mt){Et=!0;const Lt=[];if(bt){bt.terminate(new rt.AbortException("Worker was terminated."));const $t=bt.cleanup();Lt.push($t),bt=null}else(0,ut.clearGlobalCaches)();St&&St(new rt.AbortException("Worker was terminated."));for(const $t of Bt)Lt.push($t.finished),$t.terminate();return Promise.all(Lt).then(function(){Rt.destroy(),Rt=null})}),Rt.on("Ready",function(Mt){Nt(At),At=null}),yt}static initializeFromPort(At){const xt=new ht.MessageHandler("worker","main",At);mt.setup(xt,At),xt.send("ready",null)}}at.WorkerMessageHandler=mt;function ct(vt){return typeof vt.postMessage=="function"&&"onmessage"in vt}typeof window>"u"&&!rt.isNodeJS&&typeof self<"u"&&ct(self)&&mt.initializeFromPort(self)},(nt,at,ot)=>{var rt=ot(3),st=ot(4),lt=ot(69),et=ot(70),it="WebAssembly",ut=st[it],ft=Error("e",{cause:7}).cause!==7,ht=function(gt,pt){var mt={};mt[gt]=et(gt,pt,ft),rt({global:!0,constructor:!0,arity:1,forced:ft},mt)},dt=function(gt,pt){if(ut&&ut[gt]){var mt={};mt[gt]=et(it+"."+gt,pt,ft),rt({target:it,stat:!0,constructor:!0,arity:1,forced:ft},mt)}};ht("Error",function(gt){return function(mt){return lt(gt,this,arguments)}}),ht("EvalError",function(gt){return function(mt){return lt(gt,this,arguments)}}),ht("RangeError",function(gt){return function(mt){return lt(gt,this,arguments)}}),ht("ReferenceError",function(gt){return function(mt){return lt(gt,this,arguments)}}),ht("SyntaxError",function(gt){return function(mt){return lt(gt,this,arguments)}}),ht("TypeError",function(gt){return function(mt){return lt(gt,this,arguments)}}),ht("URIError",function(gt){return function(mt){return lt(gt,this,arguments)}}),dt("CompileError",function(gt){return function(mt){return lt(gt,this,arguments)}}),dt("LinkError",function(gt){return function(mt){return lt(gt,this,arguments)}}),dt("RuntimeError",function(gt){return function(mt){return lt(gt,this,arguments)}})},(nt,at,ot)=>{var rt=ot(4),st=ot(5).f,lt=ot(44),et=ot(48),it=ot(38),ut=ot(56),ft=ot(68);nt.exports=function(ht,dt){var gt=ht.target,pt=ht.global,mt=ht.stat,ct,vt,At,xt,bt,Et;if(pt?vt=rt:mt?vt=rt[gt]||it(gt,{}):vt=(rt[gt]||{}).prototype,vt)for(At in dt){if(bt=dt[At],ht.dontCallGetSet?(Et=st(vt,At),xt=Et&&Et.value):xt=vt[At],ct=ft(pt?At:gt+(mt?".":"#")+At,ht.forced),!ct&&xt!==void 0){if(typeof bt==typeof xt)continue;ut(bt,xt)}(ht.sham||xt&&xt.sham)&<(bt,"sham",!0),et(vt,At,bt,ht)}}},function(nt){var at=function(ot){return ot&&ot.Math===Math&&ot};nt.exports=at(typeof globalThis=="object"&&globalThis)||at(typeof window=="object"&&window)||at(typeof self=="object"&&self)||at(typeof commonjsGlobal=="object"&&commonjsGlobal)||function(){return this}()||this||Function("return this")()},(nt,at,ot)=>{var rt=ot(6),st=ot(8),lt=ot(10),et=ot(11),it=ot(12),ut=ot(18),ft=ot(39),ht=ot(42),dt=Object.getOwnPropertyDescriptor;at.f=rt?dt:function(pt,mt){if(pt=it(pt),mt=ut(mt),ht)try{return dt(pt,mt)}catch{}if(ft(pt,mt))return et(!st(lt.f,pt,mt),pt[mt])}},(nt,at,ot)=>{var rt=ot(7);nt.exports=!rt(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})},nt=>{nt.exports=function(at){try{return!!at()}catch{return!0}}},(nt,at,ot)=>{var rt=ot(9),st=Function.prototype.call;nt.exports=rt?st.bind(st):function(){return st.apply(st,arguments)}},(nt,at,ot)=>{var rt=ot(7);nt.exports=!rt(function(){var st=(function(){}).bind();return typeof st!="function"||st.hasOwnProperty("prototype")})},(nt,at)=>{var ot={}.propertyIsEnumerable,rt=Object.getOwnPropertyDescriptor,st=rt&&!ot.call({1:2},1);at.f=st?function(et){var it=rt(this,et);return!!it&&it.enumerable}:ot},nt=>{nt.exports=function(at,ot){return{enumerable:!(at&1),configurable:!(at&2),writable:!(at&4),value:ot}}},(nt,at,ot)=>{var rt=ot(13),st=ot(16);nt.exports=function(lt){return rt(st(lt))}},(nt,at,ot)=>{var rt=ot(14),st=ot(7),lt=ot(15),et=Object,it=rt("".split);nt.exports=st(function(){return!et("z").propertyIsEnumerable(0)})?function(ut){return lt(ut)==="String"?it(ut,""):et(ut)}:et},(nt,at,ot)=>{var rt=ot(9),st=Function.prototype,lt=st.call,et=rt&&st.bind.bind(lt,lt);nt.exports=rt?et:function(it){return function(){return lt.apply(it,arguments)}}},(nt,at,ot)=>{var rt=ot(14),st=rt({}.toString),lt=rt("".slice);nt.exports=function(et){return lt(st(et),8,-1)}},(nt,at,ot)=>{var rt=ot(17),st=TypeError;nt.exports=function(lt){if(rt(lt))throw st("Can't call method on "+lt);return lt}},nt=>{nt.exports=function(at){return at==null}},(nt,at,ot)=>{var rt=ot(19),st=ot(23);nt.exports=function(lt){var et=rt(lt,"string");return st(et)?et:et+""}},(nt,at,ot)=>{var rt=ot(8),st=ot(20),lt=ot(23),et=ot(30),it=ot(33),ut=ot(34),ft=TypeError,ht=ut("toPrimitive");nt.exports=function(dt,gt){if(!st(dt)||lt(dt))return dt;var pt=et(dt,ht),mt;if(pt){if(gt===void 0&&(gt="default"),mt=rt(pt,dt,gt),!st(mt)||lt(mt))return mt;throw ft("Can't convert object to primitive value")}return gt===void 0&&(gt="number"),it(dt,gt)}},(nt,at,ot)=>{var rt=ot(21),st=ot(22),lt=st.all;nt.exports=st.IS_HTMLDDA?function(et){return typeof et=="object"?et!==null:rt(et)||et===lt}:function(et){return typeof et=="object"?et!==null:rt(et)}},(nt,at,ot)=>{var rt=ot(22),st=rt.all;nt.exports=rt.IS_HTMLDDA?function(lt){return typeof lt=="function"||lt===st}:function(lt){return typeof lt=="function"}},nt=>{var at=typeof document=="object"&&document.all,ot=typeof at>"u"&&at!==void 0;nt.exports={all:at,IS_HTMLDDA:ot}},(nt,at,ot)=>{var rt=ot(24),st=ot(21),lt=ot(25),et=ot(26),it=Object;nt.exports=et?function(ut){return typeof ut=="symbol"}:function(ut){var ft=rt("Symbol");return st(ft)&<(ft.prototype,it(ut))}},(nt,at,ot)=>{var rt=ot(4),st=ot(21),lt=function(et){return st(et)?et:void 0};nt.exports=function(et,it){return arguments.length<2?lt(rt[et]):rt[et]&&rt[et][it]}},(nt,at,ot)=>{var rt=ot(14);nt.exports=rt({}.isPrototypeOf)},(nt,at,ot)=>{var rt=ot(27);nt.exports=rt&&!Symbol.sham&&typeof Symbol.iterator=="symbol"},(nt,at,ot)=>{var rt=ot(28),st=ot(7),lt=ot(4),et=lt.String;nt.exports=!!Object.getOwnPropertySymbols&&!st(function(){var it=Symbol("symbol detection");return!et(it)||!(Object(it)instanceof Symbol)||!Symbol.sham&&rt&&rt<41})},(nt,at,ot)=>{var rt=ot(4),st=ot(29),lt=rt.process,et=rt.Deno,it=lt&<.versions||et&&et.version,ut=it&&it.v8,ft,ht;ut&&(ft=ut.split("."),ht=ft[0]>0&&ft[0]<4?1:+(ft[0]+ft[1])),!ht&&st&&(ft=st.match(/Edge\/(\d+)/),(!ft||ft[1]>=74)&&(ft=st.match(/Chrome\/(\d+)/),ft&&(ht=+ft[1]))),nt.exports=ht},nt=>{nt.exports=typeof navigator<"u"&&String(navigator.userAgent)||""},(nt,at,ot)=>{var rt=ot(31),st=ot(17);nt.exports=function(lt,et){var it=lt[et];return st(it)?void 0:rt(it)}},(nt,at,ot)=>{var rt=ot(21),st=ot(32),lt=TypeError;nt.exports=function(et){if(rt(et))return et;throw lt(st(et)+" is not a function")}},nt=>{var at=String;nt.exports=function(ot){try{return at(ot)}catch{return"Object"}}},(nt,at,ot)=>{var rt=ot(8),st=ot(21),lt=ot(20),et=TypeError;nt.exports=function(it,ut){var ft,ht;if(ut==="string"&&st(ft=it.toString)&&!lt(ht=rt(ft,it))||st(ft=it.valueOf)&&!lt(ht=rt(ft,it))||ut!=="string"&&st(ft=it.toString)&&!lt(ht=rt(ft,it)))return ht;throw et("Can't convert object to primitive value")}},(nt,at,ot)=>{var rt=ot(4),st=ot(35),lt=ot(39),et=ot(41),it=ot(27),ut=ot(26),ft=rt.Symbol,ht=st("wks"),dt=ut?ft.for||ft:ft&&ft.withoutSetter||et;nt.exports=function(gt){return lt(ht,gt)||(ht[gt]=it&<(ft,gt)?ft[gt]:dt("Symbol."+gt)),ht[gt]}},(nt,at,ot)=>{var rt=ot(36),st=ot(37);(nt.exports=function(lt,et){return st[lt]||(st[lt]=et!==void 0?et:{})})("versions",[]).push({version:"3.32.2",mode:rt?"pure":"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.32.2/LICENSE",source:"https://github.com/zloirock/core-js"})},nt=>{nt.exports=!1},(nt,at,ot)=>{var rt=ot(4),st=ot(38),lt="__core-js_shared__",et=rt[lt]||st(lt,{});nt.exports=et},(nt,at,ot)=>{var rt=ot(4),st=Object.defineProperty;nt.exports=function(lt,et){try{st(rt,lt,{value:et,configurable:!0,writable:!0})}catch{rt[lt]=et}return et}},(nt,at,ot)=>{var rt=ot(14),st=ot(40),lt=rt({}.hasOwnProperty);nt.exports=Object.hasOwn||function(it,ut){return lt(st(it),ut)}},(nt,at,ot)=>{var rt=ot(16),st=Object;nt.exports=function(lt){return st(rt(lt))}},(nt,at,ot)=>{var rt=ot(14),st=0,lt=Math.random(),et=rt(1 .toString);nt.exports=function(it){return"Symbol("+(it===void 0?"":it)+")_"+et(++st+lt,36)}},(nt,at,ot)=>{var rt=ot(6),st=ot(7),lt=ot(43);nt.exports=!rt&&!st(function(){return Object.defineProperty(lt("div"),"a",{get:function(){return 7}}).a!==7})},(nt,at,ot)=>{var rt=ot(4),st=ot(20),lt=rt.document,et=st(lt)&&st(lt.createElement);nt.exports=function(it){return et?lt.createElement(it):{}}},(nt,at,ot)=>{var rt=ot(6),st=ot(45),lt=ot(11);nt.exports=rt?function(et,it,ut){return st.f(et,it,lt(1,ut))}:function(et,it,ut){return et[it]=ut,et}},(nt,at,ot)=>{var rt=ot(6),st=ot(42),lt=ot(46),et=ot(47),it=ot(18),ut=TypeError,ft=Object.defineProperty,ht=Object.getOwnPropertyDescriptor,dt="enumerable",gt="configurable",pt="writable";at.f=rt?lt?function(ct,vt,At){if(et(ct),vt=it(vt),et(At),typeof ct=="function"&&vt==="prototype"&&"value"in At&&pt in At&&!At[pt]){var xt=ht(ct,vt);xt&&xt[pt]&&(ct[vt]=At.value,At={configurable:gt in At?At[gt]:xt[gt],enumerable:dt in At?At[dt]:xt[dt],writable:!1})}return ft(ct,vt,At)}:ft:function(ct,vt,At){if(et(ct),vt=it(vt),et(At),st)try{return ft(ct,vt,At)}catch{}if("get"in At||"set"in At)throw ut("Accessors not supported");return"value"in At&&(ct[vt]=At.value),ct}},(nt,at,ot)=>{var rt=ot(6),st=ot(7);nt.exports=rt&&st(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})},(nt,at,ot)=>{var rt=ot(20),st=String,lt=TypeError;nt.exports=function(et){if(rt(et))return et;throw lt(st(et)+" is not an object")}},(nt,at,ot)=>{var rt=ot(21),st=ot(45),lt=ot(49),et=ot(38);nt.exports=function(it,ut,ft,ht){ht||(ht={});var dt=ht.enumerable,gt=ht.name!==void 0?ht.name:ut;if(rt(ft)&<(ft,gt,ht),ht.global)dt?it[ut]=ft:et(ut,ft);else{try{ht.unsafe?it[ut]&&(dt=!0):delete it[ut]}catch{}dt?it[ut]=ft:st.f(it,ut,{value:ft,enumerable:!1,configurable:!ht.nonConfigurable,writable:!ht.nonWritable})}return it}},(nt,at,ot)=>{var rt=ot(14),st=ot(7),lt=ot(21),et=ot(39),it=ot(6),ut=ot(50).CONFIGURABLE,ft=ot(51),ht=ot(52),dt=ht.enforce,gt=ht.get,pt=String,mt=Object.defineProperty,ct=rt("".slice),vt=rt("".replace),At=rt([].join),xt=it&&!st(function(){return mt(function(){},"length",{value:8}).length!==8}),bt=String(String).split("String"),Et=nt.exports=function(St,Bt,Ot){ct(pt(Bt),0,7)==="Symbol("&&(Bt="["+vt(pt(Bt),/^Symbol\(([^)]*)\)/,"$1")+"]"),Ot&&Ot.getter&&(Bt="get "+Bt),Ot&&Ot.setter&&(Bt="set "+Bt),(!et(St,"name")||ut&&St.name!==Bt)&&(it?mt(St,"name",{value:Bt,configurable:!0}):St.name=Bt),xt&&Ot&&et(Ot,"arity")&&St.length!==Ot.arity&&mt(St,"length",{value:Ot.arity});try{Ot&&et(Ot,"constructor")&&Ot.constructor?it&&mt(St,"prototype",{writable:!1}):St.prototype&&(St.prototype=void 0)}catch{}var Pt=dt(St);return et(Pt,"source")||(Pt.source=At(bt,typeof Bt=="string"?Bt:"")),St};Function.prototype.toString=Et(function(){return lt(this)&>(this).source||ft(this)},"toString")},(nt,at,ot)=>{var rt=ot(6),st=ot(39),lt=Function.prototype,et=rt&&Object.getOwnPropertyDescriptor,it=st(lt,"name"),ut=it&&(function(){}).name==="something",ft=it&&(!rt||rt&&et(lt,"name").configurable);nt.exports={EXISTS:it,PROPER:ut,CONFIGURABLE:ft}},(nt,at,ot)=>{var rt=ot(14),st=ot(21),lt=ot(37),et=rt(Function.toString);st(lt.inspectSource)||(lt.inspectSource=function(it){return et(it)}),nt.exports=lt.inspectSource},(nt,at,ot)=>{var rt=ot(53),st=ot(4),lt=ot(20),et=ot(44),it=ot(39),ut=ot(37),ft=ot(54),ht=ot(55),dt="Object already initialized",gt=st.TypeError,pt=st.WeakMap,mt,ct,vt,At=function(St){return vt(St)?ct(St):mt(St,{})},xt=function(St){return function(Bt){var Ot;if(!lt(Bt)||(Ot=ct(Bt)).type!==St)throw gt("Incompatible receiver, "+St+" required");return Ot}};if(rt||ut.state){var bt=ut.state||(ut.state=new pt);bt.get=bt.get,bt.has=bt.has,bt.set=bt.set,mt=function(St,Bt){if(bt.has(St))throw gt(dt);return Bt.facade=St,bt.set(St,Bt),Bt},ct=function(St){return bt.get(St)||{}},vt=function(St){return bt.has(St)}}else{var Et=ft("state");ht[Et]=!0,mt=function(St,Bt){if(it(St,Et))throw gt(dt);return Bt.facade=St,et(St,Et,Bt),Bt},ct=function(St){return it(St,Et)?St[Et]:{}},vt=function(St){return it(St,Et)}}nt.exports={set:mt,get:ct,has:vt,enforce:At,getterFor:xt}},(nt,at,ot)=>{var rt=ot(4),st=ot(21),lt=rt.WeakMap;nt.exports=st(lt)&&/native code/.test(String(lt))},(nt,at,ot)=>{var rt=ot(35),st=ot(41),lt=rt("keys");nt.exports=function(et){return lt[et]||(lt[et]=st(et))}},nt=>{nt.exports={}},(nt,at,ot)=>{var rt=ot(39),st=ot(57),lt=ot(5),et=ot(45);nt.exports=function(it,ut,ft){for(var ht=st(ut),dt=et.f,gt=lt.f,pt=0;pt<ht.length;pt++){var mt=ht[pt];!rt(it,mt)&&!(ft&&rt(ft,mt))&&dt(it,mt,gt(ut,mt))}}},(nt,at,ot)=>{var rt=ot(24),st=ot(14),lt=ot(58),et=ot(67),it=ot(47),ut=st([].concat);nt.exports=rt("Reflect","ownKeys")||function(ht){var dt=lt.f(it(ht)),gt=et.f;return gt?ut(dt,gt(ht)):dt}},(nt,at,ot)=>{var rt=ot(59),st=ot(66),lt=st.concat("length","prototype");at.f=Object.getOwnPropertyNames||function(it){return rt(it,lt)}},(nt,at,ot)=>{var rt=ot(14),st=ot(39),lt=ot(12),et=ot(60).indexOf,it=ot(55),ut=rt([].push);nt.exports=function(ft,ht){var dt=lt(ft),gt=0,pt=[],mt;for(mt in dt)!st(it,mt)&&st(dt,mt)&&ut(pt,mt);for(;ht.length>gt;)st(dt,mt=ht[gt++])&&(~et(pt,mt)||ut(pt,mt));return pt}},(nt,at,ot)=>{var rt=ot(12),st=ot(61),lt=ot(64),et=function(it){return function(ut,ft,ht){var dt=rt(ut),gt=lt(dt),pt=st(ht,gt),mt;if(it&&ft!==ft){for(;gt>pt;)if(mt=dt[pt++],mt!==mt)return!0}else for(;gt>pt;pt++)if((it||pt in dt)&&dt[pt]===ft)return it||pt||0;return!it&&-1}};nt.exports={includes:et(!0),indexOf:et(!1)}},(nt,at,ot)=>{var rt=ot(62),st=Math.max,lt=Math.min;nt.exports=function(et,it){var ut=rt(et);return ut<0?st(ut+it,0):lt(ut,it)}},(nt,at,ot)=>{var rt=ot(63);nt.exports=function(st){var lt=+st;return lt!==lt||lt===0?0:rt(lt)}},nt=>{var at=Math.ceil,ot=Math.floor;nt.exports=Math.trunc||function(st){var lt=+st;return(lt>0?ot:at)(lt)}},(nt,at,ot)=>{var rt=ot(65);nt.exports=function(st){return rt(st.length)}},(nt,at,ot)=>{var rt=ot(62),st=Math.min;nt.exports=function(lt){return lt>0?st(rt(lt),9007199254740991):0}},nt=>{nt.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},(nt,at)=>{at.f=Object.getOwnPropertySymbols},(nt,at,ot)=>{var rt=ot(7),st=ot(21),lt=/#|\.prototype\./,et=function(dt,gt){var pt=ut[it(dt)];return pt===ht?!0:pt===ft?!1:st(gt)?rt(gt):!!gt},it=et.normalize=function(dt){return String(dt).replace(lt,".").toLowerCase()},ut=et.data={},ft=et.NATIVE="N",ht=et.POLYFILL="P";nt.exports=et},(nt,at,ot)=>{var rt=ot(9),st=Function.prototype,lt=st.apply,et=st.call;nt.exports=typeof Reflect=="object"&&Reflect.apply||(rt?et.bind(lt):function(){return et.apply(lt,arguments)})},(nt,at,ot)=>{var rt=ot(24),st=ot(39),lt=ot(44),et=ot(25),it=ot(71),ut=ot(56),ft=ot(74),ht=ot(75),dt=ot(76),gt=ot(80),pt=ot(81),mt=ot(6),ct=ot(36);nt.exports=function(vt,At,xt,bt){var Et="stackTraceLimit",St=bt?2:1,Bt=vt.split("."),Ot=Bt[Bt.length-1],Pt=rt.apply(null,Bt);if(Pt){var wt=Pt.prototype;if(!ct&&st(wt,"cause")&&delete wt.cause,!xt)return Pt;var Ct=rt("Error"),It=At(function(yt,Rt){var kt=dt(bt?Rt:yt,void 0),jt=bt?new Pt(yt):new Pt;return kt!==void 0&<(jt,"message",kt),pt(jt,It,jt.stack,2),this&&et(wt,this)&&ht(jt,this,It),arguments.length>St&>(jt,arguments[St]),jt});if(It.prototype=wt,Ot!=="Error"?it?it(It,Ct):ut(It,Ct,{name:!0}):mt&&Et in Pt&&(ft(It,Pt,Et),ft(It,Pt,"prepareStackTrace")),ut(It,Pt),!ct)try{wt.name!==Ot&<(wt,"name",Ot),wt.constructor=It}catch{}return It}}},(nt,at,ot)=>{var rt=ot(72),st=ot(47),lt=ot(73);nt.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var et=!1,it={},ut;try{ut=rt(Object.prototype,"__proto__","set"),ut(it,[]),et=it instanceof Array}catch{}return function(ht,dt){return st(ht),lt(dt),et?ut(ht,dt):ht.__proto__=dt,ht}}():void 0)},(nt,at,ot)=>{var rt=ot(14),st=ot(31);nt.exports=function(lt,et,it){try{return rt(st(Object.getOwnPropertyDescriptor(lt,et)[it]))}catch{}}},(nt,at,ot)=>{var rt=ot(21),st=String,lt=TypeError;nt.exports=function(et){if(typeof et=="object"||rt(et))return et;throw lt("Can't set "+st(et)+" as a prototype")}},(nt,at,ot)=>{var rt=ot(45).f;nt.exports=function(st,lt,et){et in st||rt(st,et,{configurable:!0,get:function(){return lt[et]},set:function(it){lt[et]=it}})}},(nt,at,ot)=>{var rt=ot(21),st=ot(20),lt=ot(71);nt.exports=function(et,it,ut){var ft,ht;return lt&&rt(ft=it.constructor)&&ft!==ut&&st(ht=ft.prototype)&&ht!==ut.prototype&<(et,ht),et}},(nt,at,ot)=>{var rt=ot(77);nt.exports=function(st,lt){return st===void 0?arguments.length<2?"":lt:rt(st)}},(nt,at,ot)=>{var rt=ot(78),st=String;nt.exports=function(lt){if(rt(lt)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return st(lt)}},(nt,at,ot)=>{var rt=ot(79),st=ot(21),lt=ot(15),et=ot(34),it=et("toStringTag"),ut=Object,ft=lt(function(){return arguments}())==="Arguments",ht=function(dt,gt){try{return dt[gt]}catch{}};nt.exports=rt?lt:function(dt){var gt,pt,mt;return dt===void 0?"Undefined":dt===null?"Null":typeof(pt=ht(gt=ut(dt),it))=="string"?pt:ft?lt(gt):(mt=lt(gt))==="Object"&&st(gt.callee)?"Arguments":mt}},(nt,at,ot)=>{var rt=ot(34),st=rt("toStringTag"),lt={};lt[st]="z",nt.exports=String(lt)==="[object z]"},(nt,at,ot)=>{var rt=ot(20),st=ot(44);nt.exports=function(lt,et){rt(et)&&"cause"in et&&st(lt,"cause",et.cause)}},(nt,at,ot)=>{var rt=ot(44),st=ot(82),lt=ot(83),et=Error.captureStackTrace;nt.exports=function(it,ut,ft,ht){lt&&(et?et(it,ut):rt(it,"stack",st(ft,ht)))}},(nt,at,ot)=>{var rt=ot(14),st=Error,lt=rt("".replace),et=function(ft){return String(st(ft).stack)}("zxcasd"),it=/\n\s*at [^:]*:[^\n]*/,ut=it.test(et);nt.exports=function(ft,ht){if(ut&&typeof ft=="string"&&!st.prepareStackTrace)for(;ht--;)ft=lt(ft,it,"");return ft}},(nt,at,ot)=>{var rt=ot(7),st=ot(11);nt.exports=!rt(function(){var lt=Error("a");return"stack"in lt?(Object.defineProperty(lt,"stack",st(1,7)),lt.stack!==7):!0})},(nt,at,ot)=>{var rt=ot(85),st=ot(90).findLast,lt=rt.aTypedArray,et=rt.exportTypedArrayMethod;et("findLast",function(ut){return st(lt(this),ut,arguments.length>1?arguments[1]:void 0)})},(nt,at,ot)=>{var rt=ot(86),st=ot(6),lt=ot(4),et=ot(21),it=ot(20),ut=ot(39),ft=ot(78),ht=ot(32),dt=ot(44),gt=ot(48),pt=ot(87),mt=ot(25),ct=ot(88),vt=ot(71),At=ot(34),xt=ot(41),bt=ot(52),Et=bt.enforce,St=bt.get,Bt=lt.Int8Array,Ot=Bt&&Bt.prototype,Pt=lt.Uint8ClampedArray,wt=Pt&&Pt.prototype,Ct=Bt&&ct(Bt),It=Ot&&ct(Ot),yt=Object.prototype,Rt=lt.TypeError,kt=At("toStringTag"),jt=xt("TYPED_ARRAY_TAG"),Ht="TypedArrayConstructor",Ft=rt&&!!vt&&ft(lt.opera)!=="Opera",_t=!1,Nt,Mt,Lt,$t={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},Tt={BigInt64Array:8,BigUint64Array:8},Dt=function(rr){if(!it(rr))return!1;var Yt=ft(rr);return Yt==="DataView"||ut($t,Yt)||ut(Tt,Yt)},Ut=function(Jt){var rr=ct(Jt);if(it(rr)){var Yt=St(rr);return Yt&&ut(Yt,Ht)?Yt[Ht]:Ut(rr)}},Vt=function(Jt){if(!it(Jt))return!1;var rr=ft(Jt);return ut($t,rr)||ut(Tt,rr)},Qt=function(Jt){if(Vt(Jt))return Jt;throw Rt("Target is not a typed array")},qt=function(Jt){if(et(Jt)&&(!vt||mt(Ct,Jt)))return Jt;throw Rt(ht(Jt)+" is not a typed array constructor")},Zt=function(Jt,rr,Yt,Kt){if(st){if(Yt)for(var nr in $t){var tr=lt[nr];if(tr&&ut(tr.prototype,Jt))try{delete tr.prototype[Jt]}catch{try{tr.prototype[Jt]=rr}catch{}}}(!It[Jt]||Yt)&>(It,Jt,Yt?rr:Ft&&Ot[Jt]||rr,Kt)}},ar=function(Jt,rr,Yt){var Kt,nr;if(st){if(vt){if(Yt){for(Kt in $t)if(nr=lt[Kt],nr&&ut(nr,Jt))try{delete nr[Jt]}catch{}}if(!Ct[Jt]||Yt)try{return gt(Ct,Jt,Yt?rr:Ft&&Ct[Jt]||rr)}catch{}else return}for(Kt in $t)nr=lt[Kt],nr&&(!nr[Jt]||Yt)&>(nr,Jt,rr)}};for(Nt in $t)Mt=lt[Nt],Lt=Mt&&Mt.prototype,Lt?Et(Lt)[Ht]=Mt:Ft=!1;for(Nt in Tt)Mt=lt[Nt],Lt=Mt&&Mt.prototype,Lt&&(Et(Lt)[Ht]=Mt);if((!Ft||!et(Ct)||Ct===Function.prototype)&&(Ct=function(){throw Rt("Incorrect invocation")},Ft))for(Nt in $t)lt[Nt]&&vt(lt[Nt],Ct);if((!Ft||!It||It===yt)&&(It=Ct.prototype,Ft))for(Nt in $t)lt[Nt]&&vt(lt[Nt].prototype,It);if(Ft&&ct(wt)!==It&&vt(wt,It),st&&!ut(It,kt)){_t=!0,pt(It,kt,{configurable:!0,get:function(){return it(this)?this[jt]:void 0}});for(Nt in $t)lt[Nt]&&dt(lt[Nt],jt,Nt)}nt.exports={NATIVE_ARRAY_BUFFER_VIEWS:Ft,TYPED_ARRAY_TAG:_t&&jt,aTypedArray:Qt,aTypedArrayConstructor:qt,exportTypedArrayMethod:Zt,exportTypedArrayStaticMethod:ar,getTypedArrayConstructor:Ut,isView:Dt,isTypedArray:Vt,TypedArray:Ct,TypedArrayPrototype:It}},nt=>{nt.exports=typeof ArrayBuffer<"u"&&typeof DataView<"u"},(nt,at,ot)=>{var rt=ot(49),st=ot(45);nt.exports=function(lt,et,it){return it.get&&rt(it.get,et,{getter:!0}),it.set&&rt(it.set,et,{setter:!0}),st.f(lt,et,it)}},(nt,at,ot)=>{var rt=ot(39),st=ot(21),lt=ot(40),et=ot(54),it=ot(89),ut=et("IE_PROTO"),ft=Object,ht=ft.prototype;nt.exports=it?ft.getPrototypeOf:function(dt){var gt=lt(dt);if(rt(gt,ut))return gt[ut];var pt=gt.constructor;return st(pt)&> instanceof pt?pt.prototype:gt instanceof ft?ht:null}},(nt,at,ot)=>{var rt=ot(7);nt.exports=!rt(function(){function st(){}return st.prototype.constructor=null,Object.getPrototypeOf(new st)!==st.prototype})},(nt,at,ot)=>{var rt=ot(91),st=ot(13),lt=ot(40),et=ot(64),it=function(ut){var ft=ut===1;return function(ht,dt,gt){for(var pt=lt(ht),mt=st(pt),ct=rt(dt,gt),vt=et(mt),At,xt;vt-- >0;)if(At=mt[vt],xt=ct(At,vt,pt),xt)switch(ut){case 0:return At;case 1:return vt}return ft?-1:void 0}};nt.exports={findLast:it(0),findLastIndex:it(1)}},(nt,at,ot)=>{var rt=ot(92),st=ot(31),lt=ot(9),et=rt(rt.bind);nt.exports=function(it,ut){return st(it),ut===void 0?it:lt?et(it,ut):function(){return it.apply(ut,arguments)}}},(nt,at,ot)=>{var rt=ot(15),st=ot(14);nt.exports=function(lt){if(rt(lt)==="Function")return st(lt)}},(nt,at,ot)=>{var rt=ot(85),st=ot(90).findLastIndex,lt=rt.aTypedArray,et=rt.exportTypedArrayMethod;et("findLastIndex",function(ut){return st(lt(this),ut,arguments.length>1?arguments[1]:void 0)})},(nt,at,ot)=>{var rt=ot(4),st=ot(8),lt=ot(85),et=ot(64),it=ot(95),ut=ot(40),ft=ot(7),ht=rt.RangeError,dt=rt.Int8Array,gt=dt&&dt.prototype,pt=gt&>.set,mt=lt.aTypedArray,ct=lt.exportTypedArrayMethod,vt=!ft(function(){var xt=new Uint8ClampedArray(2);return st(pt,xt,{length:1,0:3},1),xt[1]!==3}),At=vt&<.NATIVE_ARRAY_BUFFER_VIEWS&&ft(function(){var xt=new dt(2);return xt.set(1),xt.set("2",1),xt[0]!==0||xt[1]!==2});ct("set",function(bt){mt(this);var Et=it(arguments.length>1?arguments[1]:void 0,1),St=ut(bt);if(vt)return st(pt,this,St,Et);var Bt=this.length,Ot=et(St),Pt=0;if(Ot+Et>Bt)throw ht("Wrong length");for(;Pt<Ot;)this[Et+Pt]=St[Pt++]},!vt||At)},(nt,at,ot)=>{var rt=ot(96),st=RangeError;nt.exports=function(lt,et){var it=rt(lt);if(it%et)throw st("Wrong offset");return it}},(nt,at,ot)=>{var rt=ot(62),st=RangeError;nt.exports=function(lt){var et=rt(lt);if(et<0)throw st("The argument can't be less than 0");return et}},(nt,at,ot)=>{var rt=ot(98),st=ot(85),lt=st.aTypedArray,et=st.exportTypedArrayMethod,it=st.getTypedArrayConstructor;et("toReversed",function(){return rt(lt(this),it(this))})},(nt,at,ot)=>{var rt=ot(64);nt.exports=function(st,lt){for(var et=rt(st),it=new lt(et),ut=0;ut<et;ut++)it[ut]=st[et-ut-1];return it}},(nt,at,ot)=>{var rt=ot(85),st=ot(14),lt=ot(31),et=ot(100),it=rt.aTypedArray,ut=rt.getTypedArrayConstructor,ft=rt.exportTypedArrayMethod,ht=st(rt.TypedArrayPrototype.sort);ft("toSorted",function(gt){gt!==void 0&<(gt);var pt=it(this),mt=et(ut(pt),pt);return ht(mt,gt)})},(nt,at,ot)=>{var rt=ot(64);nt.exports=function(st,lt){for(var et=0,it=rt(lt),ut=new st(it);it>et;)ut[et]=lt[et++];return ut}},(nt,at,ot)=>{var rt=ot(102),st=ot(85),lt=ot(103),et=ot(62),it=ot(104),ut=st.aTypedArray,ft=st.getTypedArrayConstructor,ht=st.exportTypedArrayMethod,dt=!!function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(gt){return gt===8}}();ht("with",function(gt,pt){var mt=ut(this),ct=et(gt),vt=lt(mt)?it(pt):+pt;return rt(mt,ft(mt),ct,vt)},!dt)},(nt,at,ot)=>{var rt=ot(64),st=ot(62),lt=RangeError;nt.exports=function(et,it,ut,ft){var ht=rt(et),dt=st(ut),gt=dt<0?ht+dt:dt;if(gt>=ht||gt<0)throw lt("Incorrect index");for(var pt=new it(ht),mt=0;mt<ht;mt++)pt[mt]=mt===gt?ft:et[mt];return pt}},(nt,at,ot)=>{var rt=ot(78);nt.exports=function(st){var lt=rt(st);return lt==="BigInt64Array"||lt==="BigUint64Array"}},(nt,at,ot)=>{var rt=ot(19),st=TypeError;nt.exports=function(lt){var et=rt(lt,"number");if(typeof et=="number")throw st("Can't convert number to bigint");return BigInt(et)}},(nt,at,ot)=>{var rt=ot(6),st=ot(87),lt=ot(106),et=ArrayBuffer.prototype;rt&&!("detached"in et)&&st(et,"detached",{configurable:!0,get:function(){return lt(this)}})},(nt,at,ot)=>{var rt=ot(14),st=ot(107),lt=rt(ArrayBuffer.prototype.slice);nt.exports=function(et){if(st(et)!==0)return!1;try{return lt(et,0,0),!1}catch{return!0}}},(nt,at,ot)=>{var rt=ot(72),st=ot(15),lt=TypeError;nt.exports=rt(ArrayBuffer.prototype,"byteLength","get")||function(et){if(st(et)!=="ArrayBuffer")throw lt("ArrayBuffer expected");return et.byteLength}},(nt,at,ot)=>{var rt=ot(3),st=ot(109);st&&rt({target:"ArrayBuffer",proto:!0},{transfer:function(){return st(this,arguments.length?arguments[0]:void 0,!0)}})},(nt,at,ot)=>{var rt=ot(4),st=ot(14),lt=ot(72),et=ot(110),it=ot(106),ut=ot(107),ft=ot(111),ht=rt.TypeError,dt=rt.structuredClone,gt=rt.ArrayBuffer,pt=rt.DataView,mt=Math.min,ct=gt.prototype,vt=pt.prototype,At=st(ct.slice),xt=lt(ct,"resizable","get"),bt=lt(ct,"maxByteLength","get"),Et=st(vt.getInt8),St=st(vt.setInt8);nt.exports=ft&&function(Bt,Ot,Pt){var wt=ut(Bt),Ct=Ot===void 0?wt:et(Ot),It=!xt||!xt(Bt);if(it(Bt))throw ht("ArrayBuffer is detached");var yt=dt(Bt,{transfer:[Bt]});if(wt===Ct&&(Pt||It))return yt;if(wt>=Ct&&(!Pt||It))return At(yt,0,Ct);for(var Rt=Pt&&!It&&bt?{maxByteLength:bt(yt)}:void 0,kt=new gt(Ct,Rt),jt=new pt(yt),Ht=new pt(kt),Ft=mt(Ct,wt),_t=0;_t<Ft;_t++)St(Ht,_t,Et(jt,_t));return kt}},(nt,at,ot)=>{var rt=ot(62),st=ot(65),lt=RangeError;nt.exports=function(et){if(et===void 0)return 0;var it=rt(et),ut=st(it);if(it!==ut)throw lt("Wrong length or index");return ut}},(nt,at,ot)=>{var rt=ot(4),st=ot(7),lt=ot(28),et=ot(112),it=ot(113),ut=ot(114),ft=rt.structuredClone;nt.exports=!!ft&&!st(function(){if(it&<>92||ut&<>94||et&<>97)return!1;var ht=new ArrayBuffer(8),dt=ft(ht,{transfer:[ht]});return ht.byteLength!==0||dt.byteLength!==8})},(nt,at,ot)=>{var rt=ot(113),st=ot(114);nt.exports=!rt&&!st&&typeof window=="object"&&typeof document=="object"},nt=>{nt.exports=typeof Deno=="object"&&Deno&&typeof Deno.version=="object"},(nt,at,ot)=>{var rt=ot(4),st=ot(15);nt.exports=st(rt.process)==="process"},(nt,at,ot)=>{var rt=ot(3),st=ot(109);st&&rt({target:"ArrayBuffer",proto:!0},{transferToFixedLength:function(){return st(this,arguments.length?arguments[0]:void 0,!1)}})},(nt,at,ot)=>{var rt=ot(3),st=ot(117),lt=ot(126);rt({target:"Set",proto:!0,real:!0,forced:!lt("difference")},{difference:st})},(nt,at,ot)=>{var rt=ot(118),st=ot(119),lt=ot(120),et=ot(123),it=ot(124),ut=ot(121),ft=ot(122),ht=st.has,dt=st.remove;nt.exports=function(pt){var mt=rt(this),ct=it(pt),vt=lt(mt);return et(mt)<=ct.size?ut(mt,function(At){ct.includes(At)&&dt(vt,At)}):ft(ct.getIterator(),function(At){ht(mt,At)&&dt(vt,At)}),vt}},(nt,at,ot)=>{var rt=ot(119).has;nt.exports=function(st){return rt(st),st}},(nt,at,ot)=>{var rt=ot(14),st=Set.prototype;nt.exports={Set,add:rt(st.add),has:rt(st.has),remove:rt(st.delete),proto:st}},(nt,at,ot)=>{var rt=ot(119),st=ot(121),lt=rt.Set,et=rt.add;nt.exports=function(it){var ut=new lt;return st(it,function(ft){et(ut,ft)}),ut}},(nt,at,ot)=>{var rt=ot(14),st=ot(122),lt=ot(119),et=lt.Set,it=lt.proto,ut=rt(it.forEach),ft=rt(it.keys),ht=ft(new et).next;nt.exports=function(dt,gt,pt){return pt?st({iterator:ft(dt),next:ht},gt):ut(dt,gt)}},(nt,at,ot)=>{var rt=ot(8);nt.exports=function(st,lt,et){for(var it=et?st:st.iterator,ut=st.next,ft,ht;!(ft=rt(ut,it)).done;)if(ht=lt(ft.value),ht!==void 0)return ht}},(nt,at,ot)=>{var rt=ot(72),st=ot(119);nt.exports=rt(st.proto,"size","get")||function(lt){return lt.size}},(nt,at,ot)=>{var rt=ot(31),st=ot(47),lt=ot(8),et=ot(62),it=ot(125),ut="Invalid size",ft=RangeError,ht=TypeError,dt=Math.max,gt=function(pt,mt,ct,vt){this.set=pt,this.size=mt,this.has=ct,this.keys=vt};gt.prototype={getIterator:function(){return it(st(lt(this.keys,this.set)))},includes:function(pt){return lt(this.has,this.set,pt)}},nt.exports=function(pt){st(pt);var mt=+pt.size;if(mt!==mt)throw ht(ut);var ct=et(mt);if(ct<0)throw ft(ut);return new gt(pt,dt(ct,0),rt(pt.has),rt(pt.keys))}},nt=>{nt.exports=function(at){return{iterator:at,next:at.next,done:!1}}},(nt,at,ot)=>{var rt=ot(24),st=function(lt){return{size:lt,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}};nt.exports=function(lt){var et=rt("Set");try{new et()[lt](st(0));try{return new et()[lt](st(-1)),!1}catch{return!0}}catch{return!1}}},(nt,at,ot)=>{var rt=ot(3),st=ot(7),lt=ot(128),et=ot(126),it=!et("intersection")||st(function(){return Array.from(new Set([1,2,3]).intersection(new Set([3,2])))!=="3,2"});rt({target:"Set",proto:!0,real:!0,forced:it},{intersection:lt})},(nt,at,ot)=>{var rt=ot(118),st=ot(119),lt=ot(123),et=ot(124),it=ot(121),ut=ot(122),ft=st.Set,ht=st.add,dt=st.has;nt.exports=function(pt){var mt=rt(this),ct=et(pt),vt=new ft;return lt(mt)>ct.size?ut(ct.getIterator(),function(At){dt(mt,At)&&ht(vt,At)}):it(mt,function(At){ct.includes(At)&&ht(vt,At)}),vt}},(nt,at,ot)=>{var rt=ot(3),st=ot(130),lt=ot(126);rt({target:"Set",proto:!0,real:!0,forced:!lt("isDisjointFrom")},{isDisjointFrom:st})},(nt,at,ot)=>{var rt=ot(118),st=ot(119).has,lt=ot(123),et=ot(124),it=ot(121),ut=ot(122),ft=ot(131);nt.exports=function(dt){var gt=rt(this),pt=et(dt);if(lt(gt)<=pt.size)return it(gt,function(ct){if(pt.includes(ct))return!1},!0)!==!1;var mt=pt.getIterator();return ut(mt,function(ct){if(st(gt,ct))return ft(mt,"normal",!1)})!==!1}},(nt,at,ot)=>{var rt=ot(8),st=ot(47),lt=ot(30);nt.exports=function(et,it,ut){var ft,ht;st(et);try{if(ft=lt(et,"return"),!ft){if(it==="throw")throw ut;return ut}ft=rt(ft,et)}catch(dt){ht=!0,ft=dt}if(it==="throw")throw ut;if(ht)throw ft;return st(ft),ut}},(nt,at,ot)=>{var rt=ot(3),st=ot(133),lt=ot(126);rt({target:"Set",proto:!0,real:!0,forced:!lt("isSubsetOf")},{isSubsetOf:st})},(nt,at,ot)=>{var rt=ot(118),st=ot(123),lt=ot(121),et=ot(124);nt.exports=function(ut){var ft=rt(this),ht=et(ut);return st(ft)>ht.size?!1:lt(ft,function(dt){if(!ht.includes(dt))return!1},!0)!==!1}},(nt,at,ot)=>{var rt=ot(3),st=ot(135),lt=ot(126);rt({target:"Set",proto:!0,real:!0,forced:!lt("isSupersetOf")},{isSupersetOf:st})},(nt,at,ot)=>{var rt=ot(118),st=ot(119).has,lt=ot(123),et=ot(124),it=ot(122),ut=ot(131);nt.exports=function(ht){var dt=rt(this),gt=et(ht);if(lt(dt)<gt.size)return!1;var pt=gt.getIterator();return it(pt,function(mt){if(!st(dt,mt))return ut(pt,"normal",!1)})!==!1}},(nt,at,ot)=>{var rt=ot(3),st=ot(137),lt=ot(126);rt({target:"Set",proto:!0,real:!0,forced:!lt("symmetricDifference")},{symmetricDifference:st})},(nt,at,ot)=>{var rt=ot(118),st=ot(119),lt=ot(120),et=ot(124),it=ot(122),ut=st.add,ft=st.has,ht=st.remove;nt.exports=function(gt){var pt=rt(this),mt=et(gt).getIterator(),ct=lt(pt);return it(mt,function(vt){ft(pt,vt)?ht(ct,vt):ut(ct,vt)}),ct}},(nt,at,ot)=>{var rt=ot(3),st=ot(139),lt=ot(126);rt({target:"Set",proto:!0,real:!0,forced:!lt("union")},{union:st})},(nt,at,ot)=>{var rt=ot(118),st=ot(119).add,lt=ot(120),et=ot(124),it=ot(122);nt.exports=function(ft){var ht=rt(this),dt=et(ft).getIterator(),gt=lt(ht);return it(dt,function(pt){st(gt,pt)}),gt}},(nt,at,ot)=>{var rt=ot(3),st=ot(40),lt=ot(64),et=ot(141),it=ot(143),ut=ot(7),ft=ut(function(){return[].push.call({length:4294967296},1)!==4294967297}),ht=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(gt){return gt instanceof TypeError}},dt=ft||!ht();rt({target:"Array",proto:!0,arity:1,forced:dt},{push:function(pt){var mt=st(this),ct=lt(mt),vt=arguments.length;it(ct+vt);for(var At=0;At<vt;At++)mt[ct]=arguments[At],ct++;return et(mt,ct),ct}})},(nt,at,ot)=>{var rt=ot(6),st=ot(142),lt=TypeError,et=Object.getOwnPropertyDescriptor,it=rt&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(ut){return ut instanceof TypeError}}();nt.exports=it?function(ut,ft){if(st(ut)&&!et(ut,"length").writable)throw lt("Cannot set read only .length");return ut.length=ft}:function(ut,ft){return ut.length=ft}},(nt,at,ot)=>{var rt=ot(15);nt.exports=Array.isArray||function(lt){return rt(lt)==="Array"}},nt=>{var at=TypeError,ot=9007199254740991;nt.exports=function(rt){if(rt>ot)throw at("Maximum allowed index exceeded");return rt}},(nt,at,ot)=>{var rt=ot(3),st=ot(4),lt=ot(87),et=ot(6),it=TypeError,ut=Object.defineProperty,ft=st.self!==st;try{if(et){var ht=Object.getOwnPropertyDescriptor(st,"self");(ft||!ht||!ht.get||!ht.enumerable)&<(st,"self",{get:function(){return st},set:function(gt){if(this!==st)throw it("Illegal invocation");ut(st,"self",{value:gt,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}else rt({global:!0,simple:!0,forced:ft},{self:st})}catch{}},(nt,at,ot)=>{var Ir;Object.defineProperty(at,"__esModule",{value:!0}),at.VerbosityLevel=at.Util=at.UnknownErrorException=at.UnexpectedResponseException=at.TextRenderingMode=at.RenderingIntentFlag=at.PromiseCapability=at.PermissionFlag=at.PasswordResponses=at.PasswordException=at.PageActionEventType=at.OPS=at.MissingPDFException=at.MAX_IMAGE_SIZE_TO_CACHE=at.LINE_FACTOR=at.LINE_DESCENT_FACTOR=at.InvalidPDFException=at.ImageKind=at.IDENTITY_MATRIX=at.FormatError=at.FeatureTest=at.FONT_IDENTITY_MATRIX=at.DocumentActionEventType=at.CMapCompressionType=at.BaseException=at.BASELINE_FACTOR=at.AnnotationType=at.AnnotationReplyType=at.AnnotationPrefix=at.AnnotationMode=at.AnnotationFlag=at.AnnotationFieldFlag=at.AnnotationEditorType=at.AnnotationEditorPrefix=at.AnnotationEditorParamsType=at.AnnotationBorderStyleType=at.AnnotationActionEventType=at.AbortException=void 0,at.assert=Mt,at.bytesToString=rr,at.createValidAbsoluteUrl=$t,at.getModificationDate=yr,at.getUuid=Sr,at.getVerbosityLevel=Ht,at.info=Ft,at.isArrayBuffer=ur,at.isArrayEqual=pr,at.isNodeJS=void 0,at.normalizeUnicode=Ar,at.objectFromMap=tr,at.objectSize=nr,at.setVerbosityLevel=jt,at.shadow=Tt,at.string32=Kt,at.stringToBytes=Yt,at.stringToPDFString=Wt,at.stringToUTF8String=er,at.unreachable=Nt,at.utf8StringToString=lr,at.warn=_t,ot(2),ot(146),ot(148),ot(149),ot(140),ot(84),ot(93),ot(94),ot(97),ot(99),ot(101),ot(105),ot(108),ot(115);const rt=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser");at.isNodeJS=rt;const st=[1,0,0,1,0,0];at.IDENTITY_MATRIX=st;const lt=[.001,0,0,.001,0,0];at.FONT_IDENTITY_MATRIX=lt;const et=1e7;at.MAX_IMAGE_SIZE_TO_CACHE=et;const it=1.35;at.LINE_FACTOR=it;const ut=.35;at.LINE_DESCENT_FACTOR=ut;const ft=ut/it;at.BASELINE_FACTOR=ft;const ht={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256};at.RenderingIntentFlag=ht;const dt={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};at.AnnotationMode=dt;const gt="pdfjs_internal_editor_";at.AnnotationEditorPrefix=gt;const pt={DISABLE:-1,NONE:0,FREETEXT:3,STAMP:13,INK:15};at.AnnotationEditorType=pt;const mt={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23};at.AnnotationEditorParamsType=mt;const ct={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};at.PermissionFlag=ct;const vt={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4};at.TextRenderingMode=vt;const At={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};at.ImageKind=At;const xt={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26};at.AnnotationType=xt;const bt={GROUP:"Group",REPLY:"R"};at.AnnotationReplyType=bt;const Et={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};at.AnnotationFlag=Et;const St={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864};at.AnnotationFieldFlag=St;const Bt={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};at.AnnotationBorderStyleType=Bt;const Ot={E:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"};at.AnnotationActionEventType=Ot;const Pt={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};at.DocumentActionEventType=Pt;const wt={O:"PageOpen",C:"PageClose"};at.PageActionEventType=wt;const Ct={ERRORS:0,WARNINGS:1,INFOS:5};at.VerbosityLevel=Ct;const It={NONE:0,BINARY:1};at.CMapCompressionType=It;const yt={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91};at.OPS=yt;const Rt={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};at.PasswordResponses=Rt;let kt=Ct.WARNINGS;function jt(hr){Number.isInteger(hr)&&(kt=hr)}function Ht(){return kt}function Ft(hr){kt>=Ct.INFOS&&console.log(`Info: ${hr}`)}function _t(hr){kt>=Ct.WARNINGS&&console.log(`Warning: ${hr}`)}function Nt(hr){throw new Error(hr)}function Mt(hr,vr){hr||Nt(vr)}function Lt(hr){switch(hr==null?void 0:hr.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function $t(hr){let vr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,xr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(!hr)return null;try{if(xr&&typeof hr=="string"){if(xr.addDefaultProtocol&&hr.startsWith("www.")){const Rr=hr.match(/\./g);(Rr==null?void 0:Rr.length)>=2&&(hr=`http://${hr}`)}if(xr.tryConvertEncoding)try{hr=er(hr)}catch{}}const Pr=vr?new URL(hr,vr):new URL(hr);if(Lt(Pr))return Pr}catch{}return null}function Tt(hr,vr,xr){let Pr=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return Object.defineProperty(hr,vr,{value:xr,enumerable:!Pr,configurable:!0,writable:!1}),xr}const Dt=function(){function vr(xr,Pr){this.constructor===vr&&Nt("Cannot initialize BaseException."),this.message=xr,this.name=Pr}return vr.prototype=new Error,vr.constructor=vr,vr}();at.BaseException=Dt;class Ut extends Dt{constructor(vr,xr){super(vr,"PasswordException"),this.code=xr}}at.PasswordException=Ut;class Vt extends Dt{constructor(vr,xr){super(vr,"UnknownErrorException"),this.details=xr}}at.UnknownErrorException=Vt;class Qt extends Dt{constructor(vr){super(vr,"InvalidPDFException")}}at.InvalidPDFException=Qt;class qt extends Dt{constructor(vr){super(vr,"MissingPDFException")}}at.MissingPDFException=qt;class Zt extends Dt{constructor(vr,xr){super(vr,"UnexpectedResponseException"),this.status=xr}}at.UnexpectedResponseException=Zt;class ar extends Dt{constructor(vr){super(vr,"FormatError")}}at.FormatError=ar;class Jt extends Dt{constructor(vr){super(vr,"AbortException")}}at.AbortException=Jt;function rr(hr){(typeof hr!="object"||(hr==null?void 0:hr.length)===void 0)&&Nt("Invalid argument for bytesToString");const vr=hr.length,xr=8192;if(vr<xr)return String.fromCharCode.apply(null,hr);const Pr=[];for(let Rr=0;Rr<vr;Rr+=xr){const Dr=Math.min(Rr+xr,vr),Gr=hr.subarray(Rr,Dr);Pr.push(String.fromCharCode.apply(null,Gr))}return Pr.join("")}function Yt(hr){typeof hr!="string"&&Nt("Invalid argument for stringToBytes");const vr=hr.length,xr=new Uint8Array(vr);for(let Pr=0;Pr<vr;++Pr)xr[Pr]=hr.charCodeAt(Pr)&255;return xr}function Kt(hr){return String.fromCharCode(hr>>24&255,hr>>16&255,hr>>8&255,hr&255)}function nr(hr){return Object.keys(hr).length}function tr(hr){const vr=Object.create(null);for(const[xr,Pr]of hr)vr[xr]=Pr;return vr}function ir(){const hr=new Uint8Array(4);return hr[0]=1,new Uint32Array(hr.buffer,0,1)[0]===1}function sr(){try{return new Function(""),!0}catch{return!1}}class cr{static get isLittleEndian(){return Tt(this,"isLittleEndian",ir())}static get isEvalSupported(){return Tt(this,"isEvalSupported",sr())}static get isOffscreenCanvasSupported(){return Tt(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator>"u"?Tt(this,"platform",{isWin:!1,isMac:!1}):Tt(this,"platform",{isWin:navigator.platform.includes("Win"),isMac:navigator.platform.includes("Mac")})}static get isCSSRoundSupported(){var vr,xr;return Tt(this,"isCSSRoundSupported",(xr=(vr=globalThis.CSS)==null?void 0:vr.supports)==null?void 0:xr.call(vr,"width: round(1.5px, 1px)"))}}at.FeatureTest=cr;const or=[...Array(256).keys()].map(hr=>hr.toString(16).padStart(2,"0"));class Xt{static makeHexColor(vr,xr,Pr){return`#${or[vr]}${or[xr]}${or[Pr]}`}static scaleMinMax(vr,xr){let Pr;vr[0]?(vr[0]<0&&(Pr=xr[0],xr[0]=xr[1],xr[1]=Pr),xr[0]*=vr[0],xr[1]*=vr[0],vr[3]<0&&(Pr=xr[2],xr[2]=xr[3],xr[3]=Pr),xr[2]*=vr[3],xr[3]*=vr[3]):(Pr=xr[0],xr[0]=xr[2],xr[2]=Pr,Pr=xr[1],xr[1]=xr[3],xr[3]=Pr,vr[1]<0&&(Pr=xr[2],xr[2]=xr[3],xr[3]=Pr),xr[2]*=vr[1],xr[3]*=vr[1],vr[2]<0&&(Pr=xr[0],xr[0]=xr[1],xr[1]=Pr),xr[0]*=vr[2],xr[1]*=vr[2]),xr[0]+=vr[4],xr[1]+=vr[4],xr[2]+=vr[5],xr[3]+=vr[5]}static transform(vr,xr){return[vr[0]*xr[0]+vr[2]*xr[1],vr[1]*xr[0]+vr[3]*xr[1],vr[0]*xr[2]+vr[2]*xr[3],vr[1]*xr[2]+vr[3]*xr[3],vr[0]*xr[4]+vr[2]*xr[5]+vr[4],vr[1]*xr[4]+vr[3]*xr[5]+vr[5]]}static applyTransform(vr,xr){const Pr=vr[0]*xr[0]+vr[1]*xr[2]+xr[4],Rr=vr[0]*xr[1]+vr[1]*xr[3]+xr[5];return[Pr,Rr]}static applyInverseTransform(vr,xr){const Pr=xr[0]*xr[3]-xr[1]*xr[2],Rr=(vr[0]*xr[3]-vr[1]*xr[2]+xr[2]*xr[5]-xr[4]*xr[3])/Pr,Dr=(-vr[0]*xr[1]+vr[1]*xr[0]+xr[4]*xr[1]-xr[5]*xr[0])/Pr;return[Rr,Dr]}static getAxialAlignedBoundingBox(vr,xr){const Pr=this.applyTransform(vr,xr),Rr=this.applyTransform(vr.slice(2,4),xr),Dr=this.applyTransform([vr[0],vr[3]],xr),Gr=this.applyTransform([vr[2],vr[1]],xr);return[Math.min(Pr[0],Rr[0],Dr[0],Gr[0]),Math.min(Pr[1],Rr[1],Dr[1],Gr[1]),Math.max(Pr[0],Rr[0],Dr[0],Gr[0]),Math.max(Pr[1],Rr[1],Dr[1],Gr[1])]}static inverseTransform(vr){const xr=vr[0]*vr[3]-vr[1]*vr[2];return[vr[3]/xr,-vr[1]/xr,-vr[2]/xr,vr[0]/xr,(vr[2]*vr[5]-vr[4]*vr[3])/xr,(vr[4]*vr[1]-vr[5]*vr[0])/xr]}static singularValueDecompose2dScale(vr){const xr=[vr[0],vr[2],vr[1],vr[3]],Pr=vr[0]*xr[0]+vr[1]*xr[2],Rr=vr[0]*xr[1]+vr[1]*xr[3],Dr=vr[2]*xr[0]+vr[3]*xr[2],Gr=vr[2]*xr[1]+vr[3]*xr[3],Or=(Pr+Gr)/2,Hr=Math.sqrt((Pr+Gr)**2-4*(Pr*Gr-Dr*Rr))/2,jr=Or+Hr||1,Tr=Or-Hr||1;return[Math.sqrt(jr),Math.sqrt(Tr)]}static normalizeRect(vr){const xr=vr.slice(0);return vr[0]>vr[2]&&(xr[0]=vr[2],xr[2]=vr[0]),vr[1]>vr[3]&&(xr[1]=vr[3],xr[3]=vr[1]),xr}static intersect(vr,xr){const Pr=Math.max(Math.min(vr[0],vr[2]),Math.min(xr[0],xr[2])),Rr=Math.min(Math.max(vr[0],vr[2]),Math.max(xr[0],xr[2]));if(Pr>Rr)return null;const Dr=Math.max(Math.min(vr[1],vr[3]),Math.min(xr[1],xr[3])),Gr=Math.min(Math.max(vr[1],vr[3]),Math.max(xr[1],xr[3]));return Dr>Gr?null:[Pr,Dr,Rr,Gr]}static bezierBoundingBox(vr,xr,Pr,Rr,Dr,Gr,Or,Hr){const jr=[],Tr=[[],[]];let fr,Cr,$r,wr,Mr,Fr,Qr,Yr;for(let zr=0;zr<2;++zr){if(zr===0?(Cr=6*vr-12*Pr+6*Dr,fr=-3*vr+9*Pr-9*Dr+3*Or,$r=3*Pr-3*vr):(Cr=6*xr-12*Rr+6*Gr,fr=-3*xr+9*Rr-9*Gr+3*Hr,$r=3*Rr-3*xr),Math.abs(fr)<1e-12){if(Math.abs(Cr)<1e-12)continue;wr=-$r/Cr,0<wr&&wr<1&&jr.push(wr);continue}Qr=Cr*Cr-4*$r*fr,Yr=Math.sqrt(Qr),!(Qr<0)&&(Mr=(-Cr+Yr)/(2*fr),0<Mr&&Mr<1&&jr.push(Mr),Fr=(-Cr-Yr)/(2*fr),0<Fr&&Fr<1&&jr.push(Fr))}let kr=jr.length,Nr;const Lr=kr;for(;kr--;)wr=jr[kr],Nr=1-wr,Tr[0][kr]=Nr*Nr*Nr*vr+3*Nr*Nr*wr*Pr+3*Nr*wr*wr*Dr+wr*wr*wr*Or,Tr[1][kr]=Nr*Nr*Nr*xr+3*Nr*Nr*wr*Rr+3*Nr*wr*wr*Gr+wr*wr*wr*Hr;return Tr[0][Lr]=vr,Tr[1][Lr]=xr,Tr[0][Lr+1]=Or,Tr[1][Lr+1]=Hr,Tr[0].length=Tr[1].length=Lr+2,[Math.min(...Tr[0]),Math.min(...Tr[1]),Math.max(...Tr[0]),Math.max(...Tr[1])]}}at.Util=Xt;const Gt=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function Wt(hr){if(hr[0]>="ï"){let xr;if(hr[0]==="þ"&&hr[1]==="ÿ"?xr="utf-16be":hr[0]==="ÿ"&&hr[1]==="þ"?xr="utf-16le":hr[0]==="ï"&&hr[1]==="»"&&hr[2]==="¿"&&(xr="utf-8"),xr)try{const Pr=new TextDecoder(xr,{fatal:!0}),Rr=Yt(hr);return Pr.decode(Rr)}catch(Pr){_t(`stringToPDFString: "${Pr}".`)}}const vr=[];for(let xr=0,Pr=hr.length;xr<Pr;xr++){const Rr=Gt[hr.charCodeAt(xr)];vr.push(Rr?String.fromCharCode(Rr):hr.charAt(xr))}return vr.join("")}function er(hr){return decodeURIComponent(escape(hr))}function lr(hr){return unescape(encodeURIComponent(hr))}function ur(hr){return typeof hr=="object"&&(hr==null?void 0:hr.byteLength)!==void 0}function pr(hr,vr){if(hr.length!==vr.length)return!1;for(let xr=0,Pr=hr.length;xr<Pr;xr++)if(hr[xr]!==vr[xr])return!1;return!0}function yr(){let hr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Date;return[hr.getUTCFullYear().toString(),(hr.getUTCMonth()+1).toString().padStart(2,"0"),hr.getUTCDate().toString().padStart(2,"0"),hr.getUTCHours().toString().padStart(2,"0"),hr.getUTCMinutes().toString().padStart(2,"0"),hr.getUTCSeconds().toString().padStart(2,"0")].join("")}class Er{constructor(){_r(this,Ir,!1);this.promise=new Promise((vr,xr)=>{this.resolve=Pr=>{tn(this,Ir,!0),vr(Pr)},this.reject=Pr=>{tn(this,Ir,!0),xr(Pr)}})}get settled(){return mr(this,Ir)}}Ir=new WeakMap,at.PromiseCapability=Er;let br=null,gr=null;function Ar(hr){return br||(br=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,gr=new Map([["ſt","ſt"]])),hr.replaceAll(br,(vr,xr,Pr)=>xr?xr.normalize("NFKC"):gr.get(Pr))}function Sr(){if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.randomUUID)=="function")return crypto.randomUUID();const hr=new Uint8Array(32);if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.getRandomValues)=="function")crypto.getRandomValues(hr);else for(let vr=0;vr<32;vr++)hr[vr]=Math.floor(Math.random()*255);return rr(hr)}const Br="pdfjs_internal_id_";at.AnnotationPrefix=Br},(nt,at,ot)=>{var rt=ot(48),st=ot(14),lt=ot(77),et=ot(147),it=URLSearchParams,ut=it.prototype,ft=st(ut.append),ht=st(ut.delete),dt=st(ut.forEach),gt=st([].push),pt=new it("a=1&a=2&b=3");pt.delete("a",1),pt.delete("b",void 0),pt+""!="a=2"&&rt(ut,"delete",function(mt){var ct=arguments.length,vt=ct<2?void 0:arguments[1];if(ct&&vt===void 0)return ht(this,mt);var At=[];dt(this,function(wt,Ct){gt(At,{key:Ct,value:wt})}),et(ct,1);for(var xt=lt(mt),bt=lt(vt),Et=0,St=0,Bt=!1,Ot=At.length,Pt;Et<Ot;)Pt=At[Et++],Bt||Pt.key===xt?(Bt=!0,ht(this,Pt.key)):St++;for(;St<Ot;)Pt=At[St++],Pt.key===xt&&Pt.value===bt||ft(this,Pt.key,Pt.value)},{enumerable:!0,unsafe:!0})},nt=>{var at=TypeError;nt.exports=function(ot,rt){if(ot<rt)throw at("Not enough arguments");return ot}},(nt,at,ot)=>{var rt=ot(48),st=ot(14),lt=ot(77),et=ot(147),it=URLSearchParams,ut=it.prototype,ft=st(ut.getAll),ht=st(ut.has),dt=new it("a=1");(dt.has("a",2)||!dt.has("a",void 0))&&rt(ut,"has",function(pt){var mt=arguments.length,ct=mt<2?void 0:arguments[1];if(mt&&ct===void 0)return ht(this,pt);var vt=ft(this,pt);et(mt,1);for(var At=lt(ct),xt=0;xt<vt.length;)if(vt[xt++]===At)return!0;return!1},{enumerable:!0,unsafe:!0})},(nt,at,ot)=>{var rt=ot(6),st=ot(14),lt=ot(87),et=URLSearchParams.prototype,it=st(et.forEach);rt&&!("size"in et)&<(et,"size",{get:function(){var ft=0;return it(this,function(){ft++}),ft},configurable:!0,enumerable:!0})},(nt,at,ot)=>{Object.defineProperty(at,"__esModule",{value:!0}),at.XRefParseException=at.XRefEntryException=at.ParserEOFException=at.PDF_VERSION_REGEXP=at.MissingDataException=void 0,at.arrayBuffersToBytes=gt,at.collectActions=wt,at.encodeToXmlString=It,at.escapePDFName=Bt,at.escapeString=Ot,at.getInheritableProperty=pt,at.getLookupTableFactory=it,at.getNewAnnotationsMap=Ht,at.getRotationMatrix=Mt,at.isAscii=Ft,at.isWhiteSpace=Et,at.log2=vt,at.numberToString=jt,at.parseXFAPath=St,at.readInt8=At,at.readUint16=xt,at.readUint32=bt,at.recoverJsURL=kt,at.stringToUTF16HexString=_t,at.stringToUTF16String=Nt,at.toRomanNumerals=ct,at.validateCSSFont=Rt,at.validateFontName=yt,ot(84),ot(93),ot(94),ot(97),ot(99),ot(101),ot(105),ot(108),ot(115),ot(140),ot(116),ot(127),ot(129),ot(132),ot(134),ot(136),ot(138),ot(2);var rt=ot(145),st=ot(151),lt=ot(152);const et=/^[1-9]\.\d$/;at.PDF_VERSION_REGEXP=et;function it(Lt){let $t;return function(){return Lt&&($t=Object.create(null),Lt($t),Lt=null),$t}}class ut extends rt.BaseException{constructor($t,Tt){super(`Missing data [${$t}, ${Tt})`,"MissingDataException"),this.begin=$t,this.end=Tt}}at.MissingDataException=ut;class ft extends rt.BaseException{constructor($t){super($t,"ParserEOFException")}}at.ParserEOFException=ft;class ht extends rt.BaseException{constructor($t){super($t,"XRefEntryException")}}at.XRefEntryException=ht;class dt extends rt.BaseException{constructor($t){super($t,"XRefParseException")}}at.XRefParseException=dt;function gt(Lt){const $t=Lt.length;if($t===0)return new Uint8Array(0);if($t===1)return new Uint8Array(Lt[0]);let Tt=0;for(let Vt=0;Vt<$t;Vt++)Tt+=Lt[Vt].byteLength;const Dt=new Uint8Array(Tt);let Ut=0;for(let Vt=0;Vt<$t;Vt++){const Qt=new Uint8Array(Lt[Vt]);Dt.set(Qt,Ut),Ut+=Qt.byteLength}return Dt}function pt(Lt){let{dict:$t,key:Tt,getArray:Dt=!1,stopWhenFound:Ut=!0}=Lt,Vt;const Qt=new st.RefSet;for(;$t instanceof st.Dict&&!($t.objId&&Qt.has($t.objId));){$t.objId&&Qt.put($t.objId);const qt=Dt?$t.getArray(Tt):$t.get(Tt);if(qt!==void 0){if(Ut)return qt;(Vt||(Vt=[])).push(qt)}$t=$t.get("Parent")}return Vt}const mt=["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM","","X","XX","XXX","XL","L","LX","LXX","LXXX","XC","","I","II","III","IV","V","VI","VII","VIII","IX"];function ct(Lt){let $t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;(0,rt.assert)(Number.isInteger(Lt)&&Lt>0,"The number should be a positive integer.");const Tt=[];let Dt;for(;Lt>=1e3;)Lt-=1e3,Tt.push("M");Dt=Lt/100|0,Lt%=100,Tt.push(mt[Dt]),Dt=Lt/10|0,Lt%=10,Tt.push(mt[10+Dt]),Tt.push(mt[20+Lt]);const Ut=Tt.join("");return $t?Ut.toLowerCase():Ut}function vt(Lt){return Lt<=0?0:Math.ceil(Math.log2(Lt))}function At(Lt,$t){return Lt[$t]<<24>>24}function xt(Lt,$t){return Lt[$t]<<8|Lt[$t+1]}function bt(Lt,$t){return(Lt[$t]<<24|Lt[$t+1]<<16|Lt[$t+2]<<8|Lt[$t+3])>>>0}function Et(Lt){return Lt===32||Lt===9||Lt===13||Lt===10}function St(Lt){const $t=/(.+)\[(\d+)\]$/;return Lt.split(".").map(Tt=>{const Dt=Tt.match($t);return Dt?{name:Dt[1],pos:parseInt(Dt[2],10)}:{name:Tt,pos:0}})}function Bt(Lt){const $t=[];let Tt=0;for(let Dt=0,Ut=Lt.length;Dt<Ut;Dt++){const Vt=Lt.charCodeAt(Dt);(Vt<33||Vt>126||Vt===35||Vt===40||Vt===41||Vt===60||Vt===62||Vt===91||Vt===93||Vt===123||Vt===125||Vt===47||Vt===37)&&(Tt<Dt&&$t.push(Lt.substring(Tt,Dt)),$t.push(`#${Vt.toString(16)}`),Tt=Dt+1)}return $t.length===0?Lt:(Tt<Lt.length&&$t.push(Lt.substring(Tt,Lt.length)),$t.join(""))}function Ot(Lt){return Lt.replaceAll(/([()\\\n\r])/g,$t=>$t===`
|
50
|
+
${_e}`)}}if(a&&typeof a=="object"&&"template"in a&&"options"in a){const{template:$,options:_}=a;_&&_.font&&checkFont({font:_.font,template:$})}if(a&&typeof a=="object"&&"template"in a&&"plugins"in a){const{template:$,plugins:_}=a;_&&checkPlugins({plugins:_,template:$})}},checkInputs=a=>checkProps(a,Inputs),checkUIOptions=a=>checkProps(a,UIOptions),checkTemplate=a=>checkProps(a,Template),checkUIProps=a=>checkProps(a,UIProps),checkPreviewProps=a=>checkProps(a,PreviewProps),checkDesignerProps=a=>checkProps(a,DesignerProps);class Node{constructor({width:s=0,height:$=0}={}){Object.defineProperty(this,"index",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"children",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"padding",{enumerable:!0,configurable:!0,writable:!0,value:[0,0,0,0]}),Object.defineProperty(this,"position",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0}}),this.width=s,this.height=$}setIndex(s){this.index=s}setKeyAndSchema(s,$){this.key=s,this.schema=$}setWidth(s){this.width=s}setHeight(s){this.height=s}setPadding(s){this.padding=s}setPosition(s){this.position=s}insertChild(s){const $=this.getChildCount();s.setIndex($),this.children.splice($,0,s)}getChildCount(){return this.children.length}getChild(s){return this.children[s]}}function createPage(a){const s=new Node({...a});return s.setPadding(a.padding),s}function createNode(a){const{position:s,width:$,height:_,key:_e,schema:tt}=a,nt=new Node({width:$,height:_});return nt.setPosition(s),nt.setKeyAndSchema(_e,tt),nt}function resortChildren(a,s){a.children=a.children.sort(($,_)=>{const _e=s.get($.key),tt=s.get(_.key);if(_e===void 0||tt===void 0)throw new Error("[@pdfme/common] order is not defined");return _e-tt}).map(($,_)=>($.setIndex(_),$))}async function createOnePage(a){const{basePdf:s,schemaObj:$,orderMap:_,input:_e,options:tt,_cache:nt,getDynamicHeights:at}=a,ot=createPage(s),rt=[],st=Object.entries($).sort((it,ut)=>it[1].position.y-ut[1].position.y),lt=new Map;for(const[it,ut]of st){const{position:ft,width:ht}=ut,dt={schema:ut,basePdf:s,options:tt,_cache:nt},gt=(ut.readOnly?ut.content:_e==null?void 0:_e[it])||"",pt=await at(gt,dt),mt=pt.reduce((vt,At)=>vt+At,0),ct=ut.height;mt!==ct&<.set(ft.y+ct,mt-ct),pt.forEach((vt,At)=>{let xt=ut.position.y+pt.reduce((Et,St,Bt)=>Bt<At?Et+St:Et,0);for(const[Et,St]of lt.entries())Et<=ut.position.y&&(xt+=St);const bt=createNode({key:it,schema:ut,position:{...ft,y:xt},width:ht,height:vt});rt.push(xt+vt+s.padding[2]),ot.insertChild(bt)})}const et=Math.max(...rt,s.height-s.padding[2]);return ot.setHeight(et),resortChildren(ot,_),ot}function breakIntoPages(a){const{longPage:s,orderMap:$,basePdf:_}=a,_e=[createPage(_)],[tt,,nt]=_.padding,at=[],ot=lt=>_.height-nt-(lt>0?tt:0),rt=(lt,et)=>{var ut;const it=lt-et*(_.height-tt-nt);for(;_e.length<=et;)_e[et]||(_e.push(createPage(_)),at.push({page:et,value:(it-tt)*-1}));return it+(((ut=at.find(ft=>ft.page===et))==null?void 0:ut.value)||0)},st=s.children.sort((lt,et)=>lt.position.y-et.position.y);for(let lt=0;lt<st.length;lt++){const{key:et,schema:it,position:ut,height:ft,width:ht}=st[lt],{y:dt,x:gt}=ut;let pt=Math.floor(dt/ot(_e.length-1)),mt=rt(dt,pt);if(mt+ft>_.height-nt&&(pt++,mt=rt(dt,pt)),!et||!it)throw new Error("[@pdfme/common] key or schema is undefined");const ct=createNode({key:et,schema:it,position:{x:gt,y:mt},width:ht,height:ft});_e[pt].insertChild(ct)}return _e.forEach(lt=>resortChildren(lt,$)),_e}function createNewTemplate(a,s){const $={schemas:Array.from({length:a.length},()=>({})),basePdf:s},_=new Map;return cloneDeep$1(a).forEach((_e,tt)=>{_e.children.forEach(nt=>{const{key:at,schema:ot}=nt;if(!at||!ot)throw new Error("[@pdfme/common] key or schema is undefined");_.has(at)||_.set(at,[]),_.get(at).push(nt);const rt=_e.children.filter(lt=>lt.key===at),st=_.get(at).length-rt.length;if(rt.length>0){if(!rt[0].schema)throw new Error("[@pdfme/common] schema is undefined");const lt=rt[0].schema,et=rt.reduce((ut,ft)=>ut+ft.height,0),it=rt[0].position;lt.__bodyRange={start:Math.max(st-1,0),end:st+rt.length-1},lt.__isSplit=st>0,$.schemas[tt][at]=Object.assign({},lt,{position:it,height:et})}})}),$}const getDynamicTemplate=async a=>{const{template:s}=a;if(!isBlankPdf(s.basePdf))return s;const $=s.basePdf,_=[];for(const _e of s.schemas){const tt=new Map(Object.keys(_e).map((ot,rt)=>[ot,rt])),nt=await createOnePage({basePdf:$,schemaObj:_e,orderMap:tt,...a}),at=breakIntoPages({longPage:nt,basePdf:$,orderMap:tt});_.push(...at)}return createNewTemplate(_,s.basePdf)},DEFAULT_LANG="en",DESTROYED_ERR_MSG="[@pdfme/ui] this instance is already destroyed",SELECTABLE_CLASSNAME="selectable",RULER_HEIGHT=30,PAGE_GAP=10,RIGHT_SIDEBAR_WIDTH=400,BACKGROUND_COLOR="rgb(74, 74, 74)";var pdf_worker_entry={},pdf_worker={exports:{}};(function(a,s){(function(_,_e){a.exports=_.pdfjsWorker=_e()})(globalThis,()=>(()=>{var $=[,(nt,at,ot)=>{Object.defineProperty(at,"__esModule",{value:!0}),at.WorkerTask=at.WorkerMessageHandler=void 0,ot(2),ot(84),ot(93),ot(94),ot(97),ot(99),ot(101),ot(105),ot(108),ot(115),ot(116),ot(127),ot(129),ot(132),ot(134),ot(136),ot(138),ot(140),ot(144);var rt=ot(145),st=ot(150),lt=ot(151),et=ot(153),it=ot(157),ut=ot(219),ft=ot(224),ht=ot(258),dt=ot(259),gt=ot(223);class pt{constructor(At){this.name=At,this.terminated=!1,this._capability=new rt.PromiseCapability}get finished(){return this._capability.promise}finish(){this._capability.resolve()}terminate(){this.terminated=!0}ensureNotTerminated(){if(this.terminated)throw new Error("Worker task was terminated")}}at.WorkerTask=pt;class mt{static setup(At,xt){let bt=!1;At.on("test",function(Et){bt||(bt=!0,At.send("test",Et instanceof Uint8Array))}),At.on("configure",function(Et){(0,rt.setVerbosityLevel)(Et.verbosity)}),At.on("GetDocRequest",function(Et){return mt.createDocumentHandler(Et,xt)})}static createDocumentHandler(At,xt){let bt,Et=!1,St=null;const Bt=new Set,Ot=(0,rt.getVerbosityLevel)(),{docId:Pt,apiVersion:wt}=At,Ct="3.11.174";if(wt!==Ct)throw new Error(`The API version "${wt}" does not match the Worker version "${Ct}".`);const It=[];for(const Mt in[])It.push(Mt);if(It.length)throw new Error("The `Array.prototype` contains unexpected enumerable properties: "+It.join(", ")+"; thus breaking e.g. `for...in` iteration of `Array`s.");const yt=Pt+"_worker";let Rt=new ht.MessageHandler(yt,Pt,xt);function kt(){if(Et)throw new Error("Worker was terminated")}function jt(Mt){Bt.add(Mt)}function Ht(Mt){Mt.finish(),Bt.delete(Mt)}async function Ft(Mt){await bt.ensureDoc("checkHeader"),await bt.ensureDoc("parseStartXRef"),await bt.ensureDoc("parse",[Mt]),await bt.ensureDoc("checkFirstPage",[Mt]),await bt.ensureDoc("checkLastPage",[Mt]);const Lt=await bt.ensureDoc("isPureXfa");if(Lt){const Ut=new pt("loadXfaFonts");jt(Ut),await Promise.all([bt.loadXfaFonts(Rt,Ut).catch(Vt=>{}).then(()=>Ht(Ut)),bt.loadXfaImages()])}const[$t,Tt]=await Promise.all([bt.ensureDoc("numPages"),bt.ensureDoc("fingerprints")]),Dt=Lt?await bt.ensureDoc("htmlForXfa"):null;return{numPages:$t,fingerprints:Tt,htmlForXfa:Dt}}function _t(Mt){let{data:Lt,password:$t,disableAutoFetch:Tt,rangeChunkSize:Dt,length:Ut,docBaseUrl:Vt,enableXfa:Qt,evaluatorOptions:qt}=Mt;const Zt={source:null,disableAutoFetch:Tt,docBaseUrl:Vt,docId:Pt,enableXfa:Qt,evaluatorOptions:qt,handler:Rt,length:Ut,password:$t,rangeChunkSize:Dt},ar=new rt.PromiseCapability;let Jt;if(Lt){try{Zt.source=Lt,Jt=new et.LocalPdfManager(Zt),ar.resolve(Jt)}catch(ir){ar.reject(ir)}return ar.promise}let rr,Yt=[];try{rr=new dt.PDFWorkerStream(Rt)}catch(ir){return ar.reject(ir),ar.promise}const Kt=rr.getFullReader();Kt.headersReady.then(function(){if(Kt.isRangeSupported){Zt.source=rr,Zt.length=Kt.contentLength,Zt.disableAutoFetch||(Zt.disableAutoFetch=Kt.isStreamingSupported),Jt=new et.NetworkPdfManager(Zt);for(const ir of Yt)Jt.sendProgressiveData(ir);Yt=[],ar.resolve(Jt),St=null}}).catch(function(ir){ar.reject(ir),St=null});let nr=0;const tr=function(){const ir=(0,st.arrayBuffersToBytes)(Yt);Ut&&ir.length!==Ut&&(0,rt.warn)("reported HTTP length is different from actual");try{Zt.source=ir,Jt=new et.LocalPdfManager(Zt),ar.resolve(Jt)}catch(sr){ar.reject(sr)}Yt=[]};return new Promise(function(ir,sr){const cr=function(or){let{value:Xt,done:Gt}=or;try{if(kt(),Gt){Jt||tr(),St=null;return}nr+=Xt.byteLength,Kt.isStreamingSupported||Rt.send("DocProgress",{loaded:nr,total:Math.max(nr,Kt.contentLength||0)}),Jt?Jt.sendProgressiveData(Xt):Yt.push(Xt),Kt.read().then(cr,sr)}catch(Wt){sr(Wt)}};Kt.read().then(cr,sr)}).catch(function(ir){ar.reject(ir),St=null}),St=function(ir){rr.cancelAllRequests(ir)},ar.promise}function Nt(Mt){function Lt(Dt){kt(),Rt.send("GetDoc",{pdfInfo:Dt})}function $t(Dt){if(kt(),Dt instanceof rt.PasswordException){const Ut=new pt(`PasswordException: response ${Dt.code}`);jt(Ut),Rt.sendWithPromise("PasswordRequest",Dt).then(function(Vt){let{password:Qt}=Vt;Ht(Ut),bt.updatePassword(Qt),Tt()}).catch(function(){Ht(Ut),Rt.send("DocException",Dt)})}else Dt instanceof rt.InvalidPDFException||Dt instanceof rt.MissingPDFException||Dt instanceof rt.UnexpectedResponseException||Dt instanceof rt.UnknownErrorException?Rt.send("DocException",Dt):Rt.send("DocException",new rt.UnknownErrorException(Dt.message,Dt.toString()))}function Tt(){kt(),Ft(!1).then(Lt,function(Dt){if(kt(),!(Dt instanceof st.XRefParseException)){$t(Dt);return}bt.requestLoadedStream().then(function(){kt(),Ft(!0).then(Lt,$t)})})}kt(),_t(Mt).then(function(Dt){if(Et)throw Dt.terminate(new rt.AbortException("Worker was terminated.")),new Error("Worker was terminated");bt=Dt,bt.requestLoadedStream(!0).then(Ut=>{Rt.send("DataLoaded",{length:Ut.bytes.byteLength})})}).then(Tt,$t)}return Rt.on("GetPage",function(Mt){return bt.getPage(Mt.pageIndex).then(function(Lt){return Promise.all([bt.ensure(Lt,"rotate"),bt.ensure(Lt,"ref"),bt.ensure(Lt,"userUnit"),bt.ensure(Lt,"view")]).then(function($t){let[Tt,Dt,Ut,Vt]=$t;return{rotate:Tt,ref:Dt,userUnit:Ut,view:Vt}})})}),Rt.on("GetPageIndex",function(Mt){const Lt=lt.Ref.get(Mt.num,Mt.gen);return bt.ensureCatalog("getPageIndex",[Lt])}),Rt.on("GetDestinations",function(Mt){return bt.ensureCatalog("destinations")}),Rt.on("GetDestination",function(Mt){return bt.ensureCatalog("getDestination",[Mt.id])}),Rt.on("GetPageLabels",function(Mt){return bt.ensureCatalog("pageLabels")}),Rt.on("GetPageLayout",function(Mt){return bt.ensureCatalog("pageLayout")}),Rt.on("GetPageMode",function(Mt){return bt.ensureCatalog("pageMode")}),Rt.on("GetViewerPreferences",function(Mt){return bt.ensureCatalog("viewerPreferences")}),Rt.on("GetOpenAction",function(Mt){return bt.ensureCatalog("openAction")}),Rt.on("GetAttachments",function(Mt){return bt.ensureCatalog("attachments")}),Rt.on("GetDocJSActions",function(Mt){return bt.ensureCatalog("jsActions")}),Rt.on("GetPageJSActions",function(Mt){let{pageIndex:Lt}=Mt;return bt.getPage(Lt).then(function($t){return bt.ensure($t,"jsActions")})}),Rt.on("GetOutline",function(Mt){return bt.ensureCatalog("documentOutline")}),Rt.on("GetOptionalContentConfig",function(Mt){return bt.ensureCatalog("optionalContentConfig")}),Rt.on("GetPermissions",function(Mt){return bt.ensureCatalog("permissions")}),Rt.on("GetMetadata",function(Mt){return Promise.all([bt.ensureDoc("documentInfo"),bt.ensureCatalog("metadata")])}),Rt.on("GetMarkInfo",function(Mt){return bt.ensureCatalog("markInfo")}),Rt.on("GetData",function(Mt){return bt.requestLoadedStream().then(function(Lt){return Lt.bytes})}),Rt.on("GetAnnotations",function(Mt){let{pageIndex:Lt,intent:$t}=Mt;return bt.getPage(Lt).then(function(Tt){const Dt=new pt(`GetAnnotations: page ${Lt}`);return jt(Dt),Tt.getAnnotationsData(Rt,Dt,$t).then(Ut=>(Ht(Dt),Ut),Ut=>{throw Ht(Dt),Ut})})}),Rt.on("GetFieldObjects",function(Mt){return bt.ensureDoc("fieldObjects")}),Rt.on("HasJSActions",function(Mt){return bt.ensureDoc("hasJSActions")}),Rt.on("GetCalculationOrderIds",function(Mt){return bt.ensureDoc("calculationOrderIds")}),Rt.on("SaveDocument",async function(Mt){let{isPureXfa:Lt,numPages:$t,annotationStorage:Tt,filename:Dt}=Mt;const Ut=[bt.requestLoadedStream(),bt.ensureCatalog("acroForm"),bt.ensureCatalog("acroFormRef"),bt.ensureDoc("startXRef"),bt.ensureDoc("xref"),bt.ensureDoc("linearization"),bt.ensureCatalog("structTreeRoot")],Vt=[],Qt=Lt?null:(0,st.getNewAnnotationsMap)(Tt),[qt,Zt,ar,Jt,rr,Yt,Kt]=await Promise.all(Ut),nr=rr.trailer.getRaw("Root")||null;let tr;if(Qt){Kt?await Kt.canUpdateStructTree({pdfManager:bt,newAnnotationsByPage:Qt})&&(tr=Kt):await gt.StructTreeRoot.canCreateStructureTree({catalogRef:nr,pdfManager:bt,newAnnotationsByPage:Qt})&&(tr=null);const lr=it.AnnotationFactory.generateImages(Tt.values(),rr,bt.evaluatorOptions.isOffscreenCanvasSupported),ur=tr===void 0?Vt:[];for(const[pr,yr]of Qt)ur.push(bt.getPage(pr).then(Er=>{const br=new pt(`Save (editor): page ${pr}`);return Er.saveNewAnnotations(Rt,br,yr,lr).finally(function(){Ht(br)})}));tr===null?Vt.push(Promise.all(ur).then(async pr=>(await gt.StructTreeRoot.createStructureTree({newAnnotationsByPage:Qt,xref:rr,catalogRef:nr,pdfManager:bt,newRefs:pr}),pr))):tr&&Vt.push(Promise.all(ur).then(async pr=>(await tr.updateStructureTree({newAnnotationsByPage:Qt,pdfManager:bt,newRefs:pr}),pr)))}if(Lt)Vt.push(bt.serializeXfaData(Tt));else for(let lr=0;lr<$t;lr++)Vt.push(bt.getPage(lr).then(function(ur){const pr=new pt(`Save: page ${lr}`);return ur.save(Rt,pr,Tt).finally(function(){Ht(pr)})}));const ir=await Promise.all(Vt);let sr=[],cr=null;if(Lt){if(cr=ir[0],!cr)return qt.bytes}else if(sr=ir.flat(2),sr.length===0)return qt.bytes;const or=ar&&Zt instanceof lt.Dict&&sr.some(lr=>lr.needAppearances),Xt=Zt instanceof lt.Dict&&Zt.get("XFA")||null;let Gt=null,Wt=!1;if(Array.isArray(Xt)){for(let lr=0,ur=Xt.length;lr<ur;lr+=2)Xt[lr]==="datasets"&&(Gt=Xt[lr+1],Wt=!0);Gt===null&&(Gt=rr.getNewTemporaryRef())}else Xt&&(0,rt.warn)("Unsupported XFA type.");let er=Object.create(null);if(rr.trailer){const lr=Object.create(null),ur=rr.trailer.get("Info")||null;ur instanceof lt.Dict&&ur.forEach((pr,yr)=>{typeof yr=="string"&&(lr[pr]=(0,rt.stringToPDFString)(yr))}),er={rootRef:nr,encryptRef:rr.trailer.getRaw("Encrypt")||null,newRef:rr.getNewTemporaryRef(),infoRef:rr.trailer.getRaw("Info")||null,info:lr,fileIds:rr.trailer.get("ID")||null,startXRef:Yt?Jt:rr.lastXRefStreamPos??Jt,filename:Dt}}return(0,ft.incrementalUpdate)({originalData:qt.bytes,xrefInfo:er,newRefs:sr,xref:rr,hasXfa:!!Xt,xfaDatasetsRef:Gt,hasXfaDatasetsEntry:Wt,needAppearances:or,acroFormRef:ar,acroForm:Zt,xfaData:cr}).finally(()=>{rr.resetNewTemporaryRef()})}),Rt.on("GetOperatorList",function(Mt,Lt){const $t=Mt.pageIndex;bt.getPage($t).then(function(Tt){const Dt=new pt(`GetOperatorList: page ${$t}`);jt(Dt);const Ut=Ot>=rt.VerbosityLevel.INFOS?Date.now():0;Tt.getOperatorList({handler:Rt,sink:Lt,task:Dt,intent:Mt.intent,cacheKey:Mt.cacheKey,annotationStorage:Mt.annotationStorage}).then(function(Vt){Ht(Dt),Ut&&(0,rt.info)(`page=${$t+1} - getOperatorList: time=${Date.now()-Ut}ms, len=${Vt.length}`),Lt.close()},function(Vt){Ht(Dt),!Dt.terminated&&Lt.error(Vt)})})}),Rt.on("GetTextContent",function(Mt,Lt){const{pageIndex:$t,includeMarkedContent:Tt,disableNormalization:Dt}=Mt;bt.getPage($t).then(function(Ut){const Vt=new pt("GetTextContent: page "+$t);jt(Vt);const Qt=Ot>=rt.VerbosityLevel.INFOS?Date.now():0;Ut.extractTextContent({handler:Rt,task:Vt,sink:Lt,includeMarkedContent:Tt,disableNormalization:Dt}).then(function(){Ht(Vt),Qt&&(0,rt.info)(`page=${$t+1} - getTextContent: time=${Date.now()-Qt}ms`),Lt.close()},function(qt){Ht(Vt),!Vt.terminated&&Lt.error(qt)})})}),Rt.on("GetStructTree",function(Mt){return bt.getPage(Mt.pageIndex).then(function(Lt){return bt.ensure(Lt,"getStructTree")})}),Rt.on("FontFallback",function(Mt){return bt.fontFallback(Mt.id,Rt)}),Rt.on("Cleanup",function(Mt){return bt.cleanup(!0)}),Rt.on("Terminate",function(Mt){Et=!0;const Lt=[];if(bt){bt.terminate(new rt.AbortException("Worker was terminated."));const $t=bt.cleanup();Lt.push($t),bt=null}else(0,ut.clearGlobalCaches)();St&&St(new rt.AbortException("Worker was terminated."));for(const $t of Bt)Lt.push($t.finished),$t.terminate();return Promise.all(Lt).then(function(){Rt.destroy(),Rt=null})}),Rt.on("Ready",function(Mt){Nt(At),At=null}),yt}static initializeFromPort(At){const xt=new ht.MessageHandler("worker","main",At);mt.setup(xt,At),xt.send("ready",null)}}at.WorkerMessageHandler=mt;function ct(vt){return typeof vt.postMessage=="function"&&"onmessage"in vt}typeof window>"u"&&!rt.isNodeJS&&typeof self<"u"&&ct(self)&&mt.initializeFromPort(self)},(nt,at,ot)=>{var rt=ot(3),st=ot(4),lt=ot(69),et=ot(70),it="WebAssembly",ut=st[it],ft=Error("e",{cause:7}).cause!==7,ht=function(gt,pt){var mt={};mt[gt]=et(gt,pt,ft),rt({global:!0,constructor:!0,arity:1,forced:ft},mt)},dt=function(gt,pt){if(ut&&ut[gt]){var mt={};mt[gt]=et(it+"."+gt,pt,ft),rt({target:it,stat:!0,constructor:!0,arity:1,forced:ft},mt)}};ht("Error",function(gt){return function(mt){return lt(gt,this,arguments)}}),ht("EvalError",function(gt){return function(mt){return lt(gt,this,arguments)}}),ht("RangeError",function(gt){return function(mt){return lt(gt,this,arguments)}}),ht("ReferenceError",function(gt){return function(mt){return lt(gt,this,arguments)}}),ht("SyntaxError",function(gt){return function(mt){return lt(gt,this,arguments)}}),ht("TypeError",function(gt){return function(mt){return lt(gt,this,arguments)}}),ht("URIError",function(gt){return function(mt){return lt(gt,this,arguments)}}),dt("CompileError",function(gt){return function(mt){return lt(gt,this,arguments)}}),dt("LinkError",function(gt){return function(mt){return lt(gt,this,arguments)}}),dt("RuntimeError",function(gt){return function(mt){return lt(gt,this,arguments)}})},(nt,at,ot)=>{var rt=ot(4),st=ot(5).f,lt=ot(44),et=ot(48),it=ot(38),ut=ot(56),ft=ot(68);nt.exports=function(ht,dt){var gt=ht.target,pt=ht.global,mt=ht.stat,ct,vt,At,xt,bt,Et;if(pt?vt=rt:mt?vt=rt[gt]||it(gt,{}):vt=(rt[gt]||{}).prototype,vt)for(At in dt){if(bt=dt[At],ht.dontCallGetSet?(Et=st(vt,At),xt=Et&&Et.value):xt=vt[At],ct=ft(pt?At:gt+(mt?".":"#")+At,ht.forced),!ct&&xt!==void 0){if(typeof bt==typeof xt)continue;ut(bt,xt)}(ht.sham||xt&&xt.sham)&<(bt,"sham",!0),et(vt,At,bt,ht)}}},function(nt){var at=function(ot){return ot&&ot.Math===Math&&ot};nt.exports=at(typeof globalThis=="object"&&globalThis)||at(typeof window=="object"&&window)||at(typeof self=="object"&&self)||at(typeof commonjsGlobal=="object"&&commonjsGlobal)||function(){return this}()||this||Function("return this")()},(nt,at,ot)=>{var rt=ot(6),st=ot(8),lt=ot(10),et=ot(11),it=ot(12),ut=ot(18),ft=ot(39),ht=ot(42),dt=Object.getOwnPropertyDescriptor;at.f=rt?dt:function(pt,mt){if(pt=it(pt),mt=ut(mt),ht)try{return dt(pt,mt)}catch{}if(ft(pt,mt))return et(!st(lt.f,pt,mt),pt[mt])}},(nt,at,ot)=>{var rt=ot(7);nt.exports=!rt(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})},nt=>{nt.exports=function(at){try{return!!at()}catch{return!0}}},(nt,at,ot)=>{var rt=ot(9),st=Function.prototype.call;nt.exports=rt?st.bind(st):function(){return st.apply(st,arguments)}},(nt,at,ot)=>{var rt=ot(7);nt.exports=!rt(function(){var st=(function(){}).bind();return typeof st!="function"||st.hasOwnProperty("prototype")})},(nt,at)=>{var ot={}.propertyIsEnumerable,rt=Object.getOwnPropertyDescriptor,st=rt&&!ot.call({1:2},1);at.f=st?function(et){var it=rt(this,et);return!!it&&it.enumerable}:ot},nt=>{nt.exports=function(at,ot){return{enumerable:!(at&1),configurable:!(at&2),writable:!(at&4),value:ot}}},(nt,at,ot)=>{var rt=ot(13),st=ot(16);nt.exports=function(lt){return rt(st(lt))}},(nt,at,ot)=>{var rt=ot(14),st=ot(7),lt=ot(15),et=Object,it=rt("".split);nt.exports=st(function(){return!et("z").propertyIsEnumerable(0)})?function(ut){return lt(ut)==="String"?it(ut,""):et(ut)}:et},(nt,at,ot)=>{var rt=ot(9),st=Function.prototype,lt=st.call,et=rt&&st.bind.bind(lt,lt);nt.exports=rt?et:function(it){return function(){return lt.apply(it,arguments)}}},(nt,at,ot)=>{var rt=ot(14),st=rt({}.toString),lt=rt("".slice);nt.exports=function(et){return lt(st(et),8,-1)}},(nt,at,ot)=>{var rt=ot(17),st=TypeError;nt.exports=function(lt){if(rt(lt))throw st("Can't call method on "+lt);return lt}},nt=>{nt.exports=function(at){return at==null}},(nt,at,ot)=>{var rt=ot(19),st=ot(23);nt.exports=function(lt){var et=rt(lt,"string");return st(et)?et:et+""}},(nt,at,ot)=>{var rt=ot(8),st=ot(20),lt=ot(23),et=ot(30),it=ot(33),ut=ot(34),ft=TypeError,ht=ut("toPrimitive");nt.exports=function(dt,gt){if(!st(dt)||lt(dt))return dt;var pt=et(dt,ht),mt;if(pt){if(gt===void 0&&(gt="default"),mt=rt(pt,dt,gt),!st(mt)||lt(mt))return mt;throw ft("Can't convert object to primitive value")}return gt===void 0&&(gt="number"),it(dt,gt)}},(nt,at,ot)=>{var rt=ot(21),st=ot(22),lt=st.all;nt.exports=st.IS_HTMLDDA?function(et){return typeof et=="object"?et!==null:rt(et)||et===lt}:function(et){return typeof et=="object"?et!==null:rt(et)}},(nt,at,ot)=>{var rt=ot(22),st=rt.all;nt.exports=rt.IS_HTMLDDA?function(lt){return typeof lt=="function"||lt===st}:function(lt){return typeof lt=="function"}},nt=>{var at=typeof document=="object"&&document.all,ot=typeof at>"u"&&at!==void 0;nt.exports={all:at,IS_HTMLDDA:ot}},(nt,at,ot)=>{var rt=ot(24),st=ot(21),lt=ot(25),et=ot(26),it=Object;nt.exports=et?function(ut){return typeof ut=="symbol"}:function(ut){var ft=rt("Symbol");return st(ft)&<(ft.prototype,it(ut))}},(nt,at,ot)=>{var rt=ot(4),st=ot(21),lt=function(et){return st(et)?et:void 0};nt.exports=function(et,it){return arguments.length<2?lt(rt[et]):rt[et]&&rt[et][it]}},(nt,at,ot)=>{var rt=ot(14);nt.exports=rt({}.isPrototypeOf)},(nt,at,ot)=>{var rt=ot(27);nt.exports=rt&&!Symbol.sham&&typeof Symbol.iterator=="symbol"},(nt,at,ot)=>{var rt=ot(28),st=ot(7),lt=ot(4),et=lt.String;nt.exports=!!Object.getOwnPropertySymbols&&!st(function(){var it=Symbol("symbol detection");return!et(it)||!(Object(it)instanceof Symbol)||!Symbol.sham&&rt&&rt<41})},(nt,at,ot)=>{var rt=ot(4),st=ot(29),lt=rt.process,et=rt.Deno,it=lt&<.versions||et&&et.version,ut=it&&it.v8,ft,ht;ut&&(ft=ut.split("."),ht=ft[0]>0&&ft[0]<4?1:+(ft[0]+ft[1])),!ht&&st&&(ft=st.match(/Edge\/(\d+)/),(!ft||ft[1]>=74)&&(ft=st.match(/Chrome\/(\d+)/),ft&&(ht=+ft[1]))),nt.exports=ht},nt=>{nt.exports=typeof navigator<"u"&&String(navigator.userAgent)||""},(nt,at,ot)=>{var rt=ot(31),st=ot(17);nt.exports=function(lt,et){var it=lt[et];return st(it)?void 0:rt(it)}},(nt,at,ot)=>{var rt=ot(21),st=ot(32),lt=TypeError;nt.exports=function(et){if(rt(et))return et;throw lt(st(et)+" is not a function")}},nt=>{var at=String;nt.exports=function(ot){try{return at(ot)}catch{return"Object"}}},(nt,at,ot)=>{var rt=ot(8),st=ot(21),lt=ot(20),et=TypeError;nt.exports=function(it,ut){var ft,ht;if(ut==="string"&&st(ft=it.toString)&&!lt(ht=rt(ft,it))||st(ft=it.valueOf)&&!lt(ht=rt(ft,it))||ut!=="string"&&st(ft=it.toString)&&!lt(ht=rt(ft,it)))return ht;throw et("Can't convert object to primitive value")}},(nt,at,ot)=>{var rt=ot(4),st=ot(35),lt=ot(39),et=ot(41),it=ot(27),ut=ot(26),ft=rt.Symbol,ht=st("wks"),dt=ut?ft.for||ft:ft&&ft.withoutSetter||et;nt.exports=function(gt){return lt(ht,gt)||(ht[gt]=it&<(ft,gt)?ft[gt]:dt("Symbol."+gt)),ht[gt]}},(nt,at,ot)=>{var rt=ot(36),st=ot(37);(nt.exports=function(lt,et){return st[lt]||(st[lt]=et!==void 0?et:{})})("versions",[]).push({version:"3.32.2",mode:rt?"pure":"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.32.2/LICENSE",source:"https://github.com/zloirock/core-js"})},nt=>{nt.exports=!1},(nt,at,ot)=>{var rt=ot(4),st=ot(38),lt="__core-js_shared__",et=rt[lt]||st(lt,{});nt.exports=et},(nt,at,ot)=>{var rt=ot(4),st=Object.defineProperty;nt.exports=function(lt,et){try{st(rt,lt,{value:et,configurable:!0,writable:!0})}catch{rt[lt]=et}return et}},(nt,at,ot)=>{var rt=ot(14),st=ot(40),lt=rt({}.hasOwnProperty);nt.exports=Object.hasOwn||function(it,ut){return lt(st(it),ut)}},(nt,at,ot)=>{var rt=ot(16),st=Object;nt.exports=function(lt){return st(rt(lt))}},(nt,at,ot)=>{var rt=ot(14),st=0,lt=Math.random(),et=rt(1 .toString);nt.exports=function(it){return"Symbol("+(it===void 0?"":it)+")_"+et(++st+lt,36)}},(nt,at,ot)=>{var rt=ot(6),st=ot(7),lt=ot(43);nt.exports=!rt&&!st(function(){return Object.defineProperty(lt("div"),"a",{get:function(){return 7}}).a!==7})},(nt,at,ot)=>{var rt=ot(4),st=ot(20),lt=rt.document,et=st(lt)&&st(lt.createElement);nt.exports=function(it){return et?lt.createElement(it):{}}},(nt,at,ot)=>{var rt=ot(6),st=ot(45),lt=ot(11);nt.exports=rt?function(et,it,ut){return st.f(et,it,lt(1,ut))}:function(et,it,ut){return et[it]=ut,et}},(nt,at,ot)=>{var rt=ot(6),st=ot(42),lt=ot(46),et=ot(47),it=ot(18),ut=TypeError,ft=Object.defineProperty,ht=Object.getOwnPropertyDescriptor,dt="enumerable",gt="configurable",pt="writable";at.f=rt?lt?function(ct,vt,At){if(et(ct),vt=it(vt),et(At),typeof ct=="function"&&vt==="prototype"&&"value"in At&&pt in At&&!At[pt]){var xt=ht(ct,vt);xt&&xt[pt]&&(ct[vt]=At.value,At={configurable:gt in At?At[gt]:xt[gt],enumerable:dt in At?At[dt]:xt[dt],writable:!1})}return ft(ct,vt,At)}:ft:function(ct,vt,At){if(et(ct),vt=it(vt),et(At),st)try{return ft(ct,vt,At)}catch{}if("get"in At||"set"in At)throw ut("Accessors not supported");return"value"in At&&(ct[vt]=At.value),ct}},(nt,at,ot)=>{var rt=ot(6),st=ot(7);nt.exports=rt&&st(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})},(nt,at,ot)=>{var rt=ot(20),st=String,lt=TypeError;nt.exports=function(et){if(rt(et))return et;throw lt(st(et)+" is not an object")}},(nt,at,ot)=>{var rt=ot(21),st=ot(45),lt=ot(49),et=ot(38);nt.exports=function(it,ut,ft,ht){ht||(ht={});var dt=ht.enumerable,gt=ht.name!==void 0?ht.name:ut;if(rt(ft)&<(ft,gt,ht),ht.global)dt?it[ut]=ft:et(ut,ft);else{try{ht.unsafe?it[ut]&&(dt=!0):delete it[ut]}catch{}dt?it[ut]=ft:st.f(it,ut,{value:ft,enumerable:!1,configurable:!ht.nonConfigurable,writable:!ht.nonWritable})}return it}},(nt,at,ot)=>{var rt=ot(14),st=ot(7),lt=ot(21),et=ot(39),it=ot(6),ut=ot(50).CONFIGURABLE,ft=ot(51),ht=ot(52),dt=ht.enforce,gt=ht.get,pt=String,mt=Object.defineProperty,ct=rt("".slice),vt=rt("".replace),At=rt([].join),xt=it&&!st(function(){return mt(function(){},"length",{value:8}).length!==8}),bt=String(String).split("String"),Et=nt.exports=function(St,Bt,Ot){ct(pt(Bt),0,7)==="Symbol("&&(Bt="["+vt(pt(Bt),/^Symbol\(([^)]*)\)/,"$1")+"]"),Ot&&Ot.getter&&(Bt="get "+Bt),Ot&&Ot.setter&&(Bt="set "+Bt),(!et(St,"name")||ut&&St.name!==Bt)&&(it?mt(St,"name",{value:Bt,configurable:!0}):St.name=Bt),xt&&Ot&&et(Ot,"arity")&&St.length!==Ot.arity&&mt(St,"length",{value:Ot.arity});try{Ot&&et(Ot,"constructor")&&Ot.constructor?it&&mt(St,"prototype",{writable:!1}):St.prototype&&(St.prototype=void 0)}catch{}var Pt=dt(St);return et(Pt,"source")||(Pt.source=At(bt,typeof Bt=="string"?Bt:"")),St};Function.prototype.toString=Et(function(){return lt(this)&>(this).source||ft(this)},"toString")},(nt,at,ot)=>{var rt=ot(6),st=ot(39),lt=Function.prototype,et=rt&&Object.getOwnPropertyDescriptor,it=st(lt,"name"),ut=it&&(function(){}).name==="something",ft=it&&(!rt||rt&&et(lt,"name").configurable);nt.exports={EXISTS:it,PROPER:ut,CONFIGURABLE:ft}},(nt,at,ot)=>{var rt=ot(14),st=ot(21),lt=ot(37),et=rt(Function.toString);st(lt.inspectSource)||(lt.inspectSource=function(it){return et(it)}),nt.exports=lt.inspectSource},(nt,at,ot)=>{var rt=ot(53),st=ot(4),lt=ot(20),et=ot(44),it=ot(39),ut=ot(37),ft=ot(54),ht=ot(55),dt="Object already initialized",gt=st.TypeError,pt=st.WeakMap,mt,ct,vt,At=function(St){return vt(St)?ct(St):mt(St,{})},xt=function(St){return function(Bt){var Ot;if(!lt(Bt)||(Ot=ct(Bt)).type!==St)throw gt("Incompatible receiver, "+St+" required");return Ot}};if(rt||ut.state){var bt=ut.state||(ut.state=new pt);bt.get=bt.get,bt.has=bt.has,bt.set=bt.set,mt=function(St,Bt){if(bt.has(St))throw gt(dt);return Bt.facade=St,bt.set(St,Bt),Bt},ct=function(St){return bt.get(St)||{}},vt=function(St){return bt.has(St)}}else{var Et=ft("state");ht[Et]=!0,mt=function(St,Bt){if(it(St,Et))throw gt(dt);return Bt.facade=St,et(St,Et,Bt),Bt},ct=function(St){return it(St,Et)?St[Et]:{}},vt=function(St){return it(St,Et)}}nt.exports={set:mt,get:ct,has:vt,enforce:At,getterFor:xt}},(nt,at,ot)=>{var rt=ot(4),st=ot(21),lt=rt.WeakMap;nt.exports=st(lt)&&/native code/.test(String(lt))},(nt,at,ot)=>{var rt=ot(35),st=ot(41),lt=rt("keys");nt.exports=function(et){return lt[et]||(lt[et]=st(et))}},nt=>{nt.exports={}},(nt,at,ot)=>{var rt=ot(39),st=ot(57),lt=ot(5),et=ot(45);nt.exports=function(it,ut,ft){for(var ht=st(ut),dt=et.f,gt=lt.f,pt=0;pt<ht.length;pt++){var mt=ht[pt];!rt(it,mt)&&!(ft&&rt(ft,mt))&&dt(it,mt,gt(ut,mt))}}},(nt,at,ot)=>{var rt=ot(24),st=ot(14),lt=ot(58),et=ot(67),it=ot(47),ut=st([].concat);nt.exports=rt("Reflect","ownKeys")||function(ht){var dt=lt.f(it(ht)),gt=et.f;return gt?ut(dt,gt(ht)):dt}},(nt,at,ot)=>{var rt=ot(59),st=ot(66),lt=st.concat("length","prototype");at.f=Object.getOwnPropertyNames||function(it){return rt(it,lt)}},(nt,at,ot)=>{var rt=ot(14),st=ot(39),lt=ot(12),et=ot(60).indexOf,it=ot(55),ut=rt([].push);nt.exports=function(ft,ht){var dt=lt(ft),gt=0,pt=[],mt;for(mt in dt)!st(it,mt)&&st(dt,mt)&&ut(pt,mt);for(;ht.length>gt;)st(dt,mt=ht[gt++])&&(~et(pt,mt)||ut(pt,mt));return pt}},(nt,at,ot)=>{var rt=ot(12),st=ot(61),lt=ot(64),et=function(it){return function(ut,ft,ht){var dt=rt(ut),gt=lt(dt),pt=st(ht,gt),mt;if(it&&ft!==ft){for(;gt>pt;)if(mt=dt[pt++],mt!==mt)return!0}else for(;gt>pt;pt++)if((it||pt in dt)&&dt[pt]===ft)return it||pt||0;return!it&&-1}};nt.exports={includes:et(!0),indexOf:et(!1)}},(nt,at,ot)=>{var rt=ot(62),st=Math.max,lt=Math.min;nt.exports=function(et,it){var ut=rt(et);return ut<0?st(ut+it,0):lt(ut,it)}},(nt,at,ot)=>{var rt=ot(63);nt.exports=function(st){var lt=+st;return lt!==lt||lt===0?0:rt(lt)}},nt=>{var at=Math.ceil,ot=Math.floor;nt.exports=Math.trunc||function(st){var lt=+st;return(lt>0?ot:at)(lt)}},(nt,at,ot)=>{var rt=ot(65);nt.exports=function(st){return rt(st.length)}},(nt,at,ot)=>{var rt=ot(62),st=Math.min;nt.exports=function(lt){return lt>0?st(rt(lt),9007199254740991):0}},nt=>{nt.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},(nt,at)=>{at.f=Object.getOwnPropertySymbols},(nt,at,ot)=>{var rt=ot(7),st=ot(21),lt=/#|\.prototype\./,et=function(dt,gt){var pt=ut[it(dt)];return pt===ht?!0:pt===ft?!1:st(gt)?rt(gt):!!gt},it=et.normalize=function(dt){return String(dt).replace(lt,".").toLowerCase()},ut=et.data={},ft=et.NATIVE="N",ht=et.POLYFILL="P";nt.exports=et},(nt,at,ot)=>{var rt=ot(9),st=Function.prototype,lt=st.apply,et=st.call;nt.exports=typeof Reflect=="object"&&Reflect.apply||(rt?et.bind(lt):function(){return et.apply(lt,arguments)})},(nt,at,ot)=>{var rt=ot(24),st=ot(39),lt=ot(44),et=ot(25),it=ot(71),ut=ot(56),ft=ot(74),ht=ot(75),dt=ot(76),gt=ot(80),pt=ot(81),mt=ot(6),ct=ot(36);nt.exports=function(vt,At,xt,bt){var Et="stackTraceLimit",St=bt?2:1,Bt=vt.split("."),Ot=Bt[Bt.length-1],Pt=rt.apply(null,Bt);if(Pt){var wt=Pt.prototype;if(!ct&&st(wt,"cause")&&delete wt.cause,!xt)return Pt;var Ct=rt("Error"),It=At(function(yt,Rt){var kt=dt(bt?Rt:yt,void 0),jt=bt?new Pt(yt):new Pt;return kt!==void 0&<(jt,"message",kt),pt(jt,It,jt.stack,2),this&&et(wt,this)&&ht(jt,this,It),arguments.length>St&>(jt,arguments[St]),jt});if(It.prototype=wt,Ot!=="Error"?it?it(It,Ct):ut(It,Ct,{name:!0}):mt&&Et in Pt&&(ft(It,Pt,Et),ft(It,Pt,"prepareStackTrace")),ut(It,Pt),!ct)try{wt.name!==Ot&<(wt,"name",Ot),wt.constructor=It}catch{}return It}}},(nt,at,ot)=>{var rt=ot(72),st=ot(47),lt=ot(73);nt.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var et=!1,it={},ut;try{ut=rt(Object.prototype,"__proto__","set"),ut(it,[]),et=it instanceof Array}catch{}return function(ht,dt){return st(ht),lt(dt),et?ut(ht,dt):ht.__proto__=dt,ht}}():void 0)},(nt,at,ot)=>{var rt=ot(14),st=ot(31);nt.exports=function(lt,et,it){try{return rt(st(Object.getOwnPropertyDescriptor(lt,et)[it]))}catch{}}},(nt,at,ot)=>{var rt=ot(21),st=String,lt=TypeError;nt.exports=function(et){if(typeof et=="object"||rt(et))return et;throw lt("Can't set "+st(et)+" as a prototype")}},(nt,at,ot)=>{var rt=ot(45).f;nt.exports=function(st,lt,et){et in st||rt(st,et,{configurable:!0,get:function(){return lt[et]},set:function(it){lt[et]=it}})}},(nt,at,ot)=>{var rt=ot(21),st=ot(20),lt=ot(71);nt.exports=function(et,it,ut){var ft,ht;return lt&&rt(ft=it.constructor)&&ft!==ut&&st(ht=ft.prototype)&&ht!==ut.prototype&<(et,ht),et}},(nt,at,ot)=>{var rt=ot(77);nt.exports=function(st,lt){return st===void 0?arguments.length<2?"":lt:rt(st)}},(nt,at,ot)=>{var rt=ot(78),st=String;nt.exports=function(lt){if(rt(lt)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return st(lt)}},(nt,at,ot)=>{var rt=ot(79),st=ot(21),lt=ot(15),et=ot(34),it=et("toStringTag"),ut=Object,ft=lt(function(){return arguments}())==="Arguments",ht=function(dt,gt){try{return dt[gt]}catch{}};nt.exports=rt?lt:function(dt){var gt,pt,mt;return dt===void 0?"Undefined":dt===null?"Null":typeof(pt=ht(gt=ut(dt),it))=="string"?pt:ft?lt(gt):(mt=lt(gt))==="Object"&&st(gt.callee)?"Arguments":mt}},(nt,at,ot)=>{var rt=ot(34),st=rt("toStringTag"),lt={};lt[st]="z",nt.exports=String(lt)==="[object z]"},(nt,at,ot)=>{var rt=ot(20),st=ot(44);nt.exports=function(lt,et){rt(et)&&"cause"in et&&st(lt,"cause",et.cause)}},(nt,at,ot)=>{var rt=ot(44),st=ot(82),lt=ot(83),et=Error.captureStackTrace;nt.exports=function(it,ut,ft,ht){lt&&(et?et(it,ut):rt(it,"stack",st(ft,ht)))}},(nt,at,ot)=>{var rt=ot(14),st=Error,lt=rt("".replace),et=function(ft){return String(st(ft).stack)}("zxcasd"),it=/\n\s*at [^:]*:[^\n]*/,ut=it.test(et);nt.exports=function(ft,ht){if(ut&&typeof ft=="string"&&!st.prepareStackTrace)for(;ht--;)ft=lt(ft,it,"");return ft}},(nt,at,ot)=>{var rt=ot(7),st=ot(11);nt.exports=!rt(function(){var lt=Error("a");return"stack"in lt?(Object.defineProperty(lt,"stack",st(1,7)),lt.stack!==7):!0})},(nt,at,ot)=>{var rt=ot(85),st=ot(90).findLast,lt=rt.aTypedArray,et=rt.exportTypedArrayMethod;et("findLast",function(ut){return st(lt(this),ut,arguments.length>1?arguments[1]:void 0)})},(nt,at,ot)=>{var rt=ot(86),st=ot(6),lt=ot(4),et=ot(21),it=ot(20),ut=ot(39),ft=ot(78),ht=ot(32),dt=ot(44),gt=ot(48),pt=ot(87),mt=ot(25),ct=ot(88),vt=ot(71),At=ot(34),xt=ot(41),bt=ot(52),Et=bt.enforce,St=bt.get,Bt=lt.Int8Array,Ot=Bt&&Bt.prototype,Pt=lt.Uint8ClampedArray,wt=Pt&&Pt.prototype,Ct=Bt&&ct(Bt),It=Ot&&ct(Ot),yt=Object.prototype,Rt=lt.TypeError,kt=At("toStringTag"),jt=xt("TYPED_ARRAY_TAG"),Ht="TypedArrayConstructor",Ft=rt&&!!vt&&ft(lt.opera)!=="Opera",_t=!1,Nt,Mt,Lt,$t={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},Tt={BigInt64Array:8,BigUint64Array:8},Dt=function(rr){if(!it(rr))return!1;var Yt=ft(rr);return Yt==="DataView"||ut($t,Yt)||ut(Tt,Yt)},Ut=function(Jt){var rr=ct(Jt);if(it(rr)){var Yt=St(rr);return Yt&&ut(Yt,Ht)?Yt[Ht]:Ut(rr)}},Vt=function(Jt){if(!it(Jt))return!1;var rr=ft(Jt);return ut($t,rr)||ut(Tt,rr)},Qt=function(Jt){if(Vt(Jt))return Jt;throw Rt("Target is not a typed array")},qt=function(Jt){if(et(Jt)&&(!vt||mt(Ct,Jt)))return Jt;throw Rt(ht(Jt)+" is not a typed array constructor")},Zt=function(Jt,rr,Yt,Kt){if(st){if(Yt)for(var nr in $t){var tr=lt[nr];if(tr&&ut(tr.prototype,Jt))try{delete tr.prototype[Jt]}catch{try{tr.prototype[Jt]=rr}catch{}}}(!It[Jt]||Yt)&>(It,Jt,Yt?rr:Ft&&Ot[Jt]||rr,Kt)}},ar=function(Jt,rr,Yt){var Kt,nr;if(st){if(vt){if(Yt){for(Kt in $t)if(nr=lt[Kt],nr&&ut(nr,Jt))try{delete nr[Jt]}catch{}}if(!Ct[Jt]||Yt)try{return gt(Ct,Jt,Yt?rr:Ft&&Ct[Jt]||rr)}catch{}else return}for(Kt in $t)nr=lt[Kt],nr&&(!nr[Jt]||Yt)&>(nr,Jt,rr)}};for(Nt in $t)Mt=lt[Nt],Lt=Mt&&Mt.prototype,Lt?Et(Lt)[Ht]=Mt:Ft=!1;for(Nt in Tt)Mt=lt[Nt],Lt=Mt&&Mt.prototype,Lt&&(Et(Lt)[Ht]=Mt);if((!Ft||!et(Ct)||Ct===Function.prototype)&&(Ct=function(){throw Rt("Incorrect invocation")},Ft))for(Nt in $t)lt[Nt]&&vt(lt[Nt],Ct);if((!Ft||!It||It===yt)&&(It=Ct.prototype,Ft))for(Nt in $t)lt[Nt]&&vt(lt[Nt].prototype,It);if(Ft&&ct(wt)!==It&&vt(wt,It),st&&!ut(It,kt)){_t=!0,pt(It,kt,{configurable:!0,get:function(){return it(this)?this[jt]:void 0}});for(Nt in $t)lt[Nt]&&dt(lt[Nt],jt,Nt)}nt.exports={NATIVE_ARRAY_BUFFER_VIEWS:Ft,TYPED_ARRAY_TAG:_t&&jt,aTypedArray:Qt,aTypedArrayConstructor:qt,exportTypedArrayMethod:Zt,exportTypedArrayStaticMethod:ar,getTypedArrayConstructor:Ut,isView:Dt,isTypedArray:Vt,TypedArray:Ct,TypedArrayPrototype:It}},nt=>{nt.exports=typeof ArrayBuffer<"u"&&typeof DataView<"u"},(nt,at,ot)=>{var rt=ot(49),st=ot(45);nt.exports=function(lt,et,it){return it.get&&rt(it.get,et,{getter:!0}),it.set&&rt(it.set,et,{setter:!0}),st.f(lt,et,it)}},(nt,at,ot)=>{var rt=ot(39),st=ot(21),lt=ot(40),et=ot(54),it=ot(89),ut=et("IE_PROTO"),ft=Object,ht=ft.prototype;nt.exports=it?ft.getPrototypeOf:function(dt){var gt=lt(dt);if(rt(gt,ut))return gt[ut];var pt=gt.constructor;return st(pt)&> instanceof pt?pt.prototype:gt instanceof ft?ht:null}},(nt,at,ot)=>{var rt=ot(7);nt.exports=!rt(function(){function st(){}return st.prototype.constructor=null,Object.getPrototypeOf(new st)!==st.prototype})},(nt,at,ot)=>{var rt=ot(91),st=ot(13),lt=ot(40),et=ot(64),it=function(ut){var ft=ut===1;return function(ht,dt,gt){for(var pt=lt(ht),mt=st(pt),ct=rt(dt,gt),vt=et(mt),At,xt;vt-- >0;)if(At=mt[vt],xt=ct(At,vt,pt),xt)switch(ut){case 0:return At;case 1:return vt}return ft?-1:void 0}};nt.exports={findLast:it(0),findLastIndex:it(1)}},(nt,at,ot)=>{var rt=ot(92),st=ot(31),lt=ot(9),et=rt(rt.bind);nt.exports=function(it,ut){return st(it),ut===void 0?it:lt?et(it,ut):function(){return it.apply(ut,arguments)}}},(nt,at,ot)=>{var rt=ot(15),st=ot(14);nt.exports=function(lt){if(rt(lt)==="Function")return st(lt)}},(nt,at,ot)=>{var rt=ot(85),st=ot(90).findLastIndex,lt=rt.aTypedArray,et=rt.exportTypedArrayMethod;et("findLastIndex",function(ut){return st(lt(this),ut,arguments.length>1?arguments[1]:void 0)})},(nt,at,ot)=>{var rt=ot(4),st=ot(8),lt=ot(85),et=ot(64),it=ot(95),ut=ot(40),ft=ot(7),ht=rt.RangeError,dt=rt.Int8Array,gt=dt&&dt.prototype,pt=gt&>.set,mt=lt.aTypedArray,ct=lt.exportTypedArrayMethod,vt=!ft(function(){var xt=new Uint8ClampedArray(2);return st(pt,xt,{length:1,0:3},1),xt[1]!==3}),At=vt&<.NATIVE_ARRAY_BUFFER_VIEWS&&ft(function(){var xt=new dt(2);return xt.set(1),xt.set("2",1),xt[0]!==0||xt[1]!==2});ct("set",function(bt){mt(this);var Et=it(arguments.length>1?arguments[1]:void 0,1),St=ut(bt);if(vt)return st(pt,this,St,Et);var Bt=this.length,Ot=et(St),Pt=0;if(Ot+Et>Bt)throw ht("Wrong length");for(;Pt<Ot;)this[Et+Pt]=St[Pt++]},!vt||At)},(nt,at,ot)=>{var rt=ot(96),st=RangeError;nt.exports=function(lt,et){var it=rt(lt);if(it%et)throw st("Wrong offset");return it}},(nt,at,ot)=>{var rt=ot(62),st=RangeError;nt.exports=function(lt){var et=rt(lt);if(et<0)throw st("The argument can't be less than 0");return et}},(nt,at,ot)=>{var rt=ot(98),st=ot(85),lt=st.aTypedArray,et=st.exportTypedArrayMethod,it=st.getTypedArrayConstructor;et("toReversed",function(){return rt(lt(this),it(this))})},(nt,at,ot)=>{var rt=ot(64);nt.exports=function(st,lt){for(var et=rt(st),it=new lt(et),ut=0;ut<et;ut++)it[ut]=st[et-ut-1];return it}},(nt,at,ot)=>{var rt=ot(85),st=ot(14),lt=ot(31),et=ot(100),it=rt.aTypedArray,ut=rt.getTypedArrayConstructor,ft=rt.exportTypedArrayMethod,ht=st(rt.TypedArrayPrototype.sort);ft("toSorted",function(gt){gt!==void 0&<(gt);var pt=it(this),mt=et(ut(pt),pt);return ht(mt,gt)})},(nt,at,ot)=>{var rt=ot(64);nt.exports=function(st,lt){for(var et=0,it=rt(lt),ut=new st(it);it>et;)ut[et]=lt[et++];return ut}},(nt,at,ot)=>{var rt=ot(102),st=ot(85),lt=ot(103),et=ot(62),it=ot(104),ut=st.aTypedArray,ft=st.getTypedArrayConstructor,ht=st.exportTypedArrayMethod,dt=!!function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(gt){return gt===8}}();ht("with",function(gt,pt){var mt=ut(this),ct=et(gt),vt=lt(mt)?it(pt):+pt;return rt(mt,ft(mt),ct,vt)},!dt)},(nt,at,ot)=>{var rt=ot(64),st=ot(62),lt=RangeError;nt.exports=function(et,it,ut,ft){var ht=rt(et),dt=st(ut),gt=dt<0?ht+dt:dt;if(gt>=ht||gt<0)throw lt("Incorrect index");for(var pt=new it(ht),mt=0;mt<ht;mt++)pt[mt]=mt===gt?ft:et[mt];return pt}},(nt,at,ot)=>{var rt=ot(78);nt.exports=function(st){var lt=rt(st);return lt==="BigInt64Array"||lt==="BigUint64Array"}},(nt,at,ot)=>{var rt=ot(19),st=TypeError;nt.exports=function(lt){var et=rt(lt,"number");if(typeof et=="number")throw st("Can't convert number to bigint");return BigInt(et)}},(nt,at,ot)=>{var rt=ot(6),st=ot(87),lt=ot(106),et=ArrayBuffer.prototype;rt&&!("detached"in et)&&st(et,"detached",{configurable:!0,get:function(){return lt(this)}})},(nt,at,ot)=>{var rt=ot(14),st=ot(107),lt=rt(ArrayBuffer.prototype.slice);nt.exports=function(et){if(st(et)!==0)return!1;try{return lt(et,0,0),!1}catch{return!0}}},(nt,at,ot)=>{var rt=ot(72),st=ot(15),lt=TypeError;nt.exports=rt(ArrayBuffer.prototype,"byteLength","get")||function(et){if(st(et)!=="ArrayBuffer")throw lt("ArrayBuffer expected");return et.byteLength}},(nt,at,ot)=>{var rt=ot(3),st=ot(109);st&&rt({target:"ArrayBuffer",proto:!0},{transfer:function(){return st(this,arguments.length?arguments[0]:void 0,!0)}})},(nt,at,ot)=>{var rt=ot(4),st=ot(14),lt=ot(72),et=ot(110),it=ot(106),ut=ot(107),ft=ot(111),ht=rt.TypeError,dt=rt.structuredClone,gt=rt.ArrayBuffer,pt=rt.DataView,mt=Math.min,ct=gt.prototype,vt=pt.prototype,At=st(ct.slice),xt=lt(ct,"resizable","get"),bt=lt(ct,"maxByteLength","get"),Et=st(vt.getInt8),St=st(vt.setInt8);nt.exports=ft&&function(Bt,Ot,Pt){var wt=ut(Bt),Ct=Ot===void 0?wt:et(Ot),It=!xt||!xt(Bt);if(it(Bt))throw ht("ArrayBuffer is detached");var yt=dt(Bt,{transfer:[Bt]});if(wt===Ct&&(Pt||It))return yt;if(wt>=Ct&&(!Pt||It))return At(yt,0,Ct);for(var Rt=Pt&&!It&&bt?{maxByteLength:bt(yt)}:void 0,kt=new gt(Ct,Rt),jt=new pt(yt),Ht=new pt(kt),Ft=mt(Ct,wt),_t=0;_t<Ft;_t++)St(Ht,_t,Et(jt,_t));return kt}},(nt,at,ot)=>{var rt=ot(62),st=ot(65),lt=RangeError;nt.exports=function(et){if(et===void 0)return 0;var it=rt(et),ut=st(it);if(it!==ut)throw lt("Wrong length or index");return ut}},(nt,at,ot)=>{var rt=ot(4),st=ot(7),lt=ot(28),et=ot(112),it=ot(113),ut=ot(114),ft=rt.structuredClone;nt.exports=!!ft&&!st(function(){if(it&<>92||ut&<>94||et&<>97)return!1;var ht=new ArrayBuffer(8),dt=ft(ht,{transfer:[ht]});return ht.byteLength!==0||dt.byteLength!==8})},(nt,at,ot)=>{var rt=ot(113),st=ot(114);nt.exports=!rt&&!st&&typeof window=="object"&&typeof document=="object"},nt=>{nt.exports=typeof Deno=="object"&&Deno&&typeof Deno.version=="object"},(nt,at,ot)=>{var rt=ot(4),st=ot(15);nt.exports=st(rt.process)==="process"},(nt,at,ot)=>{var rt=ot(3),st=ot(109);st&&rt({target:"ArrayBuffer",proto:!0},{transferToFixedLength:function(){return st(this,arguments.length?arguments[0]:void 0,!1)}})},(nt,at,ot)=>{var rt=ot(3),st=ot(117),lt=ot(126);rt({target:"Set",proto:!0,real:!0,forced:!lt("difference")},{difference:st})},(nt,at,ot)=>{var rt=ot(118),st=ot(119),lt=ot(120),et=ot(123),it=ot(124),ut=ot(121),ft=ot(122),ht=st.has,dt=st.remove;nt.exports=function(pt){var mt=rt(this),ct=it(pt),vt=lt(mt);return et(mt)<=ct.size?ut(mt,function(At){ct.includes(At)&&dt(vt,At)}):ft(ct.getIterator(),function(At){ht(mt,At)&&dt(vt,At)}),vt}},(nt,at,ot)=>{var rt=ot(119).has;nt.exports=function(st){return rt(st),st}},(nt,at,ot)=>{var rt=ot(14),st=Set.prototype;nt.exports={Set,add:rt(st.add),has:rt(st.has),remove:rt(st.delete),proto:st}},(nt,at,ot)=>{var rt=ot(119),st=ot(121),lt=rt.Set,et=rt.add;nt.exports=function(it){var ut=new lt;return st(it,function(ft){et(ut,ft)}),ut}},(nt,at,ot)=>{var rt=ot(14),st=ot(122),lt=ot(119),et=lt.Set,it=lt.proto,ut=rt(it.forEach),ft=rt(it.keys),ht=ft(new et).next;nt.exports=function(dt,gt,pt){return pt?st({iterator:ft(dt),next:ht},gt):ut(dt,gt)}},(nt,at,ot)=>{var rt=ot(8);nt.exports=function(st,lt,et){for(var it=et?st:st.iterator,ut=st.next,ft,ht;!(ft=rt(ut,it)).done;)if(ht=lt(ft.value),ht!==void 0)return ht}},(nt,at,ot)=>{var rt=ot(72),st=ot(119);nt.exports=rt(st.proto,"size","get")||function(lt){return lt.size}},(nt,at,ot)=>{var rt=ot(31),st=ot(47),lt=ot(8),et=ot(62),it=ot(125),ut="Invalid size",ft=RangeError,ht=TypeError,dt=Math.max,gt=function(pt,mt,ct,vt){this.set=pt,this.size=mt,this.has=ct,this.keys=vt};gt.prototype={getIterator:function(){return it(st(lt(this.keys,this.set)))},includes:function(pt){return lt(this.has,this.set,pt)}},nt.exports=function(pt){st(pt);var mt=+pt.size;if(mt!==mt)throw ht(ut);var ct=et(mt);if(ct<0)throw ft(ut);return new gt(pt,dt(ct,0),rt(pt.has),rt(pt.keys))}},nt=>{nt.exports=function(at){return{iterator:at,next:at.next,done:!1}}},(nt,at,ot)=>{var rt=ot(24),st=function(lt){return{size:lt,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}};nt.exports=function(lt){var et=rt("Set");try{new et()[lt](st(0));try{return new et()[lt](st(-1)),!1}catch{return!0}}catch{return!1}}},(nt,at,ot)=>{var rt=ot(3),st=ot(7),lt=ot(128),et=ot(126),it=!et("intersection")||st(function(){return Array.from(new Set([1,2,3]).intersection(new Set([3,2])))!=="3,2"});rt({target:"Set",proto:!0,real:!0,forced:it},{intersection:lt})},(nt,at,ot)=>{var rt=ot(118),st=ot(119),lt=ot(123),et=ot(124),it=ot(121),ut=ot(122),ft=st.Set,ht=st.add,dt=st.has;nt.exports=function(pt){var mt=rt(this),ct=et(pt),vt=new ft;return lt(mt)>ct.size?ut(ct.getIterator(),function(At){dt(mt,At)&&ht(vt,At)}):it(mt,function(At){ct.includes(At)&&ht(vt,At)}),vt}},(nt,at,ot)=>{var rt=ot(3),st=ot(130),lt=ot(126);rt({target:"Set",proto:!0,real:!0,forced:!lt("isDisjointFrom")},{isDisjointFrom:st})},(nt,at,ot)=>{var rt=ot(118),st=ot(119).has,lt=ot(123),et=ot(124),it=ot(121),ut=ot(122),ft=ot(131);nt.exports=function(dt){var gt=rt(this),pt=et(dt);if(lt(gt)<=pt.size)return it(gt,function(ct){if(pt.includes(ct))return!1},!0)!==!1;var mt=pt.getIterator();return ut(mt,function(ct){if(st(gt,ct))return ft(mt,"normal",!1)})!==!1}},(nt,at,ot)=>{var rt=ot(8),st=ot(47),lt=ot(30);nt.exports=function(et,it,ut){var ft,ht;st(et);try{if(ft=lt(et,"return"),!ft){if(it==="throw")throw ut;return ut}ft=rt(ft,et)}catch(dt){ht=!0,ft=dt}if(it==="throw")throw ut;if(ht)throw ft;return st(ft),ut}},(nt,at,ot)=>{var rt=ot(3),st=ot(133),lt=ot(126);rt({target:"Set",proto:!0,real:!0,forced:!lt("isSubsetOf")},{isSubsetOf:st})},(nt,at,ot)=>{var rt=ot(118),st=ot(123),lt=ot(121),et=ot(124);nt.exports=function(ut){var ft=rt(this),ht=et(ut);return st(ft)>ht.size?!1:lt(ft,function(dt){if(!ht.includes(dt))return!1},!0)!==!1}},(nt,at,ot)=>{var rt=ot(3),st=ot(135),lt=ot(126);rt({target:"Set",proto:!0,real:!0,forced:!lt("isSupersetOf")},{isSupersetOf:st})},(nt,at,ot)=>{var rt=ot(118),st=ot(119).has,lt=ot(123),et=ot(124),it=ot(122),ut=ot(131);nt.exports=function(ht){var dt=rt(this),gt=et(ht);if(lt(dt)<gt.size)return!1;var pt=gt.getIterator();return it(pt,function(mt){if(!st(dt,mt))return ut(pt,"normal",!1)})!==!1}},(nt,at,ot)=>{var rt=ot(3),st=ot(137),lt=ot(126);rt({target:"Set",proto:!0,real:!0,forced:!lt("symmetricDifference")},{symmetricDifference:st})},(nt,at,ot)=>{var rt=ot(118),st=ot(119),lt=ot(120),et=ot(124),it=ot(122),ut=st.add,ft=st.has,ht=st.remove;nt.exports=function(gt){var pt=rt(this),mt=et(gt).getIterator(),ct=lt(pt);return it(mt,function(vt){ft(pt,vt)?ht(ct,vt):ut(ct,vt)}),ct}},(nt,at,ot)=>{var rt=ot(3),st=ot(139),lt=ot(126);rt({target:"Set",proto:!0,real:!0,forced:!lt("union")},{union:st})},(nt,at,ot)=>{var rt=ot(118),st=ot(119).add,lt=ot(120),et=ot(124),it=ot(122);nt.exports=function(ft){var ht=rt(this),dt=et(ft).getIterator(),gt=lt(ht);return it(dt,function(pt){st(gt,pt)}),gt}},(nt,at,ot)=>{var rt=ot(3),st=ot(40),lt=ot(64),et=ot(141),it=ot(143),ut=ot(7),ft=ut(function(){return[].push.call({length:4294967296},1)!==4294967297}),ht=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(gt){return gt instanceof TypeError}},dt=ft||!ht();rt({target:"Array",proto:!0,arity:1,forced:dt},{push:function(pt){var mt=st(this),ct=lt(mt),vt=arguments.length;it(ct+vt);for(var At=0;At<vt;At++)mt[ct]=arguments[At],ct++;return et(mt,ct),ct}})},(nt,at,ot)=>{var rt=ot(6),st=ot(142),lt=TypeError,et=Object.getOwnPropertyDescriptor,it=rt&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(ut){return ut instanceof TypeError}}();nt.exports=it?function(ut,ft){if(st(ut)&&!et(ut,"length").writable)throw lt("Cannot set read only .length");return ut.length=ft}:function(ut,ft){return ut.length=ft}},(nt,at,ot)=>{var rt=ot(15);nt.exports=Array.isArray||function(lt){return rt(lt)==="Array"}},nt=>{var at=TypeError,ot=9007199254740991;nt.exports=function(rt){if(rt>ot)throw at("Maximum allowed index exceeded");return rt}},(nt,at,ot)=>{var rt=ot(3),st=ot(4),lt=ot(87),et=ot(6),it=TypeError,ut=Object.defineProperty,ft=st.self!==st;try{if(et){var ht=Object.getOwnPropertyDescriptor(st,"self");(ft||!ht||!ht.get||!ht.enumerable)&<(st,"self",{get:function(){return st},set:function(gt){if(this!==st)throw it("Illegal invocation");ut(st,"self",{value:gt,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}else rt({global:!0,simple:!0,forced:ft},{self:st})}catch{}},(nt,at,ot)=>{var Ir;Object.defineProperty(at,"__esModule",{value:!0}),at.VerbosityLevel=at.Util=at.UnknownErrorException=at.UnexpectedResponseException=at.TextRenderingMode=at.RenderingIntentFlag=at.PromiseCapability=at.PermissionFlag=at.PasswordResponses=at.PasswordException=at.PageActionEventType=at.OPS=at.MissingPDFException=at.MAX_IMAGE_SIZE_TO_CACHE=at.LINE_FACTOR=at.LINE_DESCENT_FACTOR=at.InvalidPDFException=at.ImageKind=at.IDENTITY_MATRIX=at.FormatError=at.FeatureTest=at.FONT_IDENTITY_MATRIX=at.DocumentActionEventType=at.CMapCompressionType=at.BaseException=at.BASELINE_FACTOR=at.AnnotationType=at.AnnotationReplyType=at.AnnotationPrefix=at.AnnotationMode=at.AnnotationFlag=at.AnnotationFieldFlag=at.AnnotationEditorType=at.AnnotationEditorPrefix=at.AnnotationEditorParamsType=at.AnnotationBorderStyleType=at.AnnotationActionEventType=at.AbortException=void 0,at.assert=Mt,at.bytesToString=rr,at.createValidAbsoluteUrl=$t,at.getModificationDate=yr,at.getUuid=Sr,at.getVerbosityLevel=Ht,at.info=Ft,at.isArrayBuffer=ur,at.isArrayEqual=pr,at.isNodeJS=void 0,at.normalizeUnicode=Ar,at.objectFromMap=tr,at.objectSize=nr,at.setVerbosityLevel=jt,at.shadow=Tt,at.string32=Kt,at.stringToBytes=Yt,at.stringToPDFString=Wt,at.stringToUTF8String=er,at.unreachable=Nt,at.utf8StringToString=lr,at.warn=_t,ot(2),ot(146),ot(148),ot(149),ot(140),ot(84),ot(93),ot(94),ot(97),ot(99),ot(101),ot(105),ot(108),ot(115);const rt=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser");at.isNodeJS=rt;const st=[1,0,0,1,0,0];at.IDENTITY_MATRIX=st;const lt=[.001,0,0,.001,0,0];at.FONT_IDENTITY_MATRIX=lt;const et=1e7;at.MAX_IMAGE_SIZE_TO_CACHE=et;const it=1.35;at.LINE_FACTOR=it;const ut=.35;at.LINE_DESCENT_FACTOR=ut;const ft=ut/it;at.BASELINE_FACTOR=ft;const ht={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256};at.RenderingIntentFlag=ht;const dt={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};at.AnnotationMode=dt;const gt="pdfjs_internal_editor_";at.AnnotationEditorPrefix=gt;const pt={DISABLE:-1,NONE:0,FREETEXT:3,STAMP:13,INK:15};at.AnnotationEditorType=pt;const mt={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23};at.AnnotationEditorParamsType=mt;const ct={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};at.PermissionFlag=ct;const vt={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4};at.TextRenderingMode=vt;const At={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};at.ImageKind=At;const xt={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26};at.AnnotationType=xt;const bt={GROUP:"Group",REPLY:"R"};at.AnnotationReplyType=bt;const Et={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};at.AnnotationFlag=Et;const St={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864};at.AnnotationFieldFlag=St;const Bt={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};at.AnnotationBorderStyleType=Bt;const Ot={E:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"};at.AnnotationActionEventType=Ot;const Pt={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};at.DocumentActionEventType=Pt;const wt={O:"PageOpen",C:"PageClose"};at.PageActionEventType=wt;const Ct={ERRORS:0,WARNINGS:1,INFOS:5};at.VerbosityLevel=Ct;const It={NONE:0,BINARY:1};at.CMapCompressionType=It;const yt={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91};at.OPS=yt;const Rt={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};at.PasswordResponses=Rt;let kt=Ct.WARNINGS;function jt(hr){Number.isInteger(hr)&&(kt=hr)}function Ht(){return kt}function Ft(hr){kt>=Ct.INFOS&&console.log(`Info: ${hr}`)}function _t(hr){kt>=Ct.WARNINGS&&console.log(`Warning: ${hr}`)}function Nt(hr){throw new Error(hr)}function Mt(hr,vr){hr||Nt(vr)}function Lt(hr){switch(hr==null?void 0:hr.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function $t(hr){let vr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,xr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(!hr)return null;try{if(xr&&typeof hr=="string"){if(xr.addDefaultProtocol&&hr.startsWith("www.")){const Rr=hr.match(/\./g);(Rr==null?void 0:Rr.length)>=2&&(hr=`http://${hr}`)}if(xr.tryConvertEncoding)try{hr=er(hr)}catch{}}const Pr=vr?new URL(hr,vr):new URL(hr);if(Lt(Pr))return Pr}catch{}return null}function Tt(hr,vr,xr){let Pr=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return Object.defineProperty(hr,vr,{value:xr,enumerable:!Pr,configurable:!0,writable:!1}),xr}const Dt=function(){function vr(xr,Pr){this.constructor===vr&&Nt("Cannot initialize BaseException."),this.message=xr,this.name=Pr}return vr.prototype=new Error,vr.constructor=vr,vr}();at.BaseException=Dt;class Ut extends Dt{constructor(vr,xr){super(vr,"PasswordException"),this.code=xr}}at.PasswordException=Ut;class Vt extends Dt{constructor(vr,xr){super(vr,"UnknownErrorException"),this.details=xr}}at.UnknownErrorException=Vt;class Qt extends Dt{constructor(vr){super(vr,"InvalidPDFException")}}at.InvalidPDFException=Qt;class qt extends Dt{constructor(vr){super(vr,"MissingPDFException")}}at.MissingPDFException=qt;class Zt extends Dt{constructor(vr,xr){super(vr,"UnexpectedResponseException"),this.status=xr}}at.UnexpectedResponseException=Zt;class ar extends Dt{constructor(vr){super(vr,"FormatError")}}at.FormatError=ar;class Jt extends Dt{constructor(vr){super(vr,"AbortException")}}at.AbortException=Jt;function rr(hr){(typeof hr!="object"||(hr==null?void 0:hr.length)===void 0)&&Nt("Invalid argument for bytesToString");const vr=hr.length,xr=8192;if(vr<xr)return String.fromCharCode.apply(null,hr);const Pr=[];for(let Rr=0;Rr<vr;Rr+=xr){const Dr=Math.min(Rr+xr,vr),Gr=hr.subarray(Rr,Dr);Pr.push(String.fromCharCode.apply(null,Gr))}return Pr.join("")}function Yt(hr){typeof hr!="string"&&Nt("Invalid argument for stringToBytes");const vr=hr.length,xr=new Uint8Array(vr);for(let Pr=0;Pr<vr;++Pr)xr[Pr]=hr.charCodeAt(Pr)&255;return xr}function Kt(hr){return String.fromCharCode(hr>>24&255,hr>>16&255,hr>>8&255,hr&255)}function nr(hr){return Object.keys(hr).length}function tr(hr){const vr=Object.create(null);for(const[xr,Pr]of hr)vr[xr]=Pr;return vr}function ir(){const hr=new Uint8Array(4);return hr[0]=1,new Uint32Array(hr.buffer,0,1)[0]===1}function sr(){try{return new Function(""),!0}catch{return!1}}class cr{static get isLittleEndian(){return Tt(this,"isLittleEndian",ir())}static get isEvalSupported(){return Tt(this,"isEvalSupported",sr())}static get isOffscreenCanvasSupported(){return Tt(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator>"u"?Tt(this,"platform",{isWin:!1,isMac:!1}):Tt(this,"platform",{isWin:navigator.platform.includes("Win"),isMac:navigator.platform.includes("Mac")})}static get isCSSRoundSupported(){var vr,xr;return Tt(this,"isCSSRoundSupported",(xr=(vr=globalThis.CSS)==null?void 0:vr.supports)==null?void 0:xr.call(vr,"width: round(1.5px, 1px)"))}}at.FeatureTest=cr;const or=[...Array(256).keys()].map(hr=>hr.toString(16).padStart(2,"0"));class Xt{static makeHexColor(vr,xr,Pr){return`#${or[vr]}${or[xr]}${or[Pr]}`}static scaleMinMax(vr,xr){let Pr;vr[0]?(vr[0]<0&&(Pr=xr[0],xr[0]=xr[1],xr[1]=Pr),xr[0]*=vr[0],xr[1]*=vr[0],vr[3]<0&&(Pr=xr[2],xr[2]=xr[3],xr[3]=Pr),xr[2]*=vr[3],xr[3]*=vr[3]):(Pr=xr[0],xr[0]=xr[2],xr[2]=Pr,Pr=xr[1],xr[1]=xr[3],xr[3]=Pr,vr[1]<0&&(Pr=xr[2],xr[2]=xr[3],xr[3]=Pr),xr[2]*=vr[1],xr[3]*=vr[1],vr[2]<0&&(Pr=xr[0],xr[0]=xr[1],xr[1]=Pr),xr[0]*=vr[2],xr[1]*=vr[2]),xr[0]+=vr[4],xr[1]+=vr[4],xr[2]+=vr[5],xr[3]+=vr[5]}static transform(vr,xr){return[vr[0]*xr[0]+vr[2]*xr[1],vr[1]*xr[0]+vr[3]*xr[1],vr[0]*xr[2]+vr[2]*xr[3],vr[1]*xr[2]+vr[3]*xr[3],vr[0]*xr[4]+vr[2]*xr[5]+vr[4],vr[1]*xr[4]+vr[3]*xr[5]+vr[5]]}static applyTransform(vr,xr){const Pr=vr[0]*xr[0]+vr[1]*xr[2]+xr[4],Rr=vr[0]*xr[1]+vr[1]*xr[3]+xr[5];return[Pr,Rr]}static applyInverseTransform(vr,xr){const Pr=xr[0]*xr[3]-xr[1]*xr[2],Rr=(vr[0]*xr[3]-vr[1]*xr[2]+xr[2]*xr[5]-xr[4]*xr[3])/Pr,Dr=(-vr[0]*xr[1]+vr[1]*xr[0]+xr[4]*xr[1]-xr[5]*xr[0])/Pr;return[Rr,Dr]}static getAxialAlignedBoundingBox(vr,xr){const Pr=this.applyTransform(vr,xr),Rr=this.applyTransform(vr.slice(2,4),xr),Dr=this.applyTransform([vr[0],vr[3]],xr),Gr=this.applyTransform([vr[2],vr[1]],xr);return[Math.min(Pr[0],Rr[0],Dr[0],Gr[0]),Math.min(Pr[1],Rr[1],Dr[1],Gr[1]),Math.max(Pr[0],Rr[0],Dr[0],Gr[0]),Math.max(Pr[1],Rr[1],Dr[1],Gr[1])]}static inverseTransform(vr){const xr=vr[0]*vr[3]-vr[1]*vr[2];return[vr[3]/xr,-vr[1]/xr,-vr[2]/xr,vr[0]/xr,(vr[2]*vr[5]-vr[4]*vr[3])/xr,(vr[4]*vr[1]-vr[5]*vr[0])/xr]}static singularValueDecompose2dScale(vr){const xr=[vr[0],vr[2],vr[1],vr[3]],Pr=vr[0]*xr[0]+vr[1]*xr[2],Rr=vr[0]*xr[1]+vr[1]*xr[3],Dr=vr[2]*xr[0]+vr[3]*xr[2],Gr=vr[2]*xr[1]+vr[3]*xr[3],Or=(Pr+Gr)/2,Hr=Math.sqrt((Pr+Gr)**2-4*(Pr*Gr-Dr*Rr))/2,jr=Or+Hr||1,Tr=Or-Hr||1;return[Math.sqrt(jr),Math.sqrt(Tr)]}static normalizeRect(vr){const xr=vr.slice(0);return vr[0]>vr[2]&&(xr[0]=vr[2],xr[2]=vr[0]),vr[1]>vr[3]&&(xr[1]=vr[3],xr[3]=vr[1]),xr}static intersect(vr,xr){const Pr=Math.max(Math.min(vr[0],vr[2]),Math.min(xr[0],xr[2])),Rr=Math.min(Math.max(vr[0],vr[2]),Math.max(xr[0],xr[2]));if(Pr>Rr)return null;const Dr=Math.max(Math.min(vr[1],vr[3]),Math.min(xr[1],xr[3])),Gr=Math.min(Math.max(vr[1],vr[3]),Math.max(xr[1],xr[3]));return Dr>Gr?null:[Pr,Dr,Rr,Gr]}static bezierBoundingBox(vr,xr,Pr,Rr,Dr,Gr,Or,Hr){const jr=[],Tr=[[],[]];let fr,Cr,$r,wr,Mr,Fr,Qr,Yr;for(let zr=0;zr<2;++zr){if(zr===0?(Cr=6*vr-12*Pr+6*Dr,fr=-3*vr+9*Pr-9*Dr+3*Or,$r=3*Pr-3*vr):(Cr=6*xr-12*Rr+6*Gr,fr=-3*xr+9*Rr-9*Gr+3*Hr,$r=3*Rr-3*xr),Math.abs(fr)<1e-12){if(Math.abs(Cr)<1e-12)continue;wr=-$r/Cr,0<wr&&wr<1&&jr.push(wr);continue}Qr=Cr*Cr-4*$r*fr,Yr=Math.sqrt(Qr),!(Qr<0)&&(Mr=(-Cr+Yr)/(2*fr),0<Mr&&Mr<1&&jr.push(Mr),Fr=(-Cr-Yr)/(2*fr),0<Fr&&Fr<1&&jr.push(Fr))}let kr=jr.length,Nr;const Lr=kr;for(;kr--;)wr=jr[kr],Nr=1-wr,Tr[0][kr]=Nr*Nr*Nr*vr+3*Nr*Nr*wr*Pr+3*Nr*wr*wr*Dr+wr*wr*wr*Or,Tr[1][kr]=Nr*Nr*Nr*xr+3*Nr*Nr*wr*Rr+3*Nr*wr*wr*Gr+wr*wr*wr*Hr;return Tr[0][Lr]=vr,Tr[1][Lr]=xr,Tr[0][Lr+1]=Or,Tr[1][Lr+1]=Hr,Tr[0].length=Tr[1].length=Lr+2,[Math.min(...Tr[0]),Math.min(...Tr[1]),Math.max(...Tr[0]),Math.max(...Tr[1])]}}at.Util=Xt;const Gt=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function Wt(hr){if(hr[0]>="ï"){let xr;if(hr[0]==="þ"&&hr[1]==="ÿ"?xr="utf-16be":hr[0]==="ÿ"&&hr[1]==="þ"?xr="utf-16le":hr[0]==="ï"&&hr[1]==="»"&&hr[2]==="¿"&&(xr="utf-8"),xr)try{const Pr=new TextDecoder(xr,{fatal:!0}),Rr=Yt(hr);return Pr.decode(Rr)}catch(Pr){_t(`stringToPDFString: "${Pr}".`)}}const vr=[];for(let xr=0,Pr=hr.length;xr<Pr;xr++){const Rr=Gt[hr.charCodeAt(xr)];vr.push(Rr?String.fromCharCode(Rr):hr.charAt(xr))}return vr.join("")}function er(hr){return decodeURIComponent(escape(hr))}function lr(hr){return unescape(encodeURIComponent(hr))}function ur(hr){return typeof hr=="object"&&(hr==null?void 0:hr.byteLength)!==void 0}function pr(hr,vr){if(hr.length!==vr.length)return!1;for(let xr=0,Pr=hr.length;xr<Pr;xr++)if(hr[xr]!==vr[xr])return!1;return!0}function yr(){let hr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Date;return[hr.getUTCFullYear().toString(),(hr.getUTCMonth()+1).toString().padStart(2,"0"),hr.getUTCDate().toString().padStart(2,"0"),hr.getUTCHours().toString().padStart(2,"0"),hr.getUTCMinutes().toString().padStart(2,"0"),hr.getUTCSeconds().toString().padStart(2,"0")].join("")}class Er{constructor(){_r(this,Ir,!1);this.promise=new Promise((vr,xr)=>{this.resolve=Pr=>{tn(this,Ir,!0),vr(Pr)},this.reject=Pr=>{tn(this,Ir,!0),xr(Pr)}})}get settled(){return mr(this,Ir)}}Ir=new WeakMap,at.PromiseCapability=Er;let br=null,gr=null;function Ar(hr){return br||(br=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,gr=new Map([["ſt","ſt"]])),hr.replaceAll(br,(vr,xr,Pr)=>xr?xr.normalize("NFKC"):gr.get(Pr))}function Sr(){if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.randomUUID)=="function")return crypto.randomUUID();const hr=new Uint8Array(32);if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.getRandomValues)=="function")crypto.getRandomValues(hr);else for(let vr=0;vr<32;vr++)hr[vr]=Math.floor(Math.random()*255);return rr(hr)}const Br="pdfjs_internal_id_";at.AnnotationPrefix=Br},(nt,at,ot)=>{var rt=ot(48),st=ot(14),lt=ot(77),et=ot(147),it=URLSearchParams,ut=it.prototype,ft=st(ut.append),ht=st(ut.delete),dt=st(ut.forEach),gt=st([].push),pt=new it("a=1&a=2&b=3");pt.delete("a",1),pt.delete("b",void 0),pt+""!="a=2"&&rt(ut,"delete",function(mt){var ct=arguments.length,vt=ct<2?void 0:arguments[1];if(ct&&vt===void 0)return ht(this,mt);var At=[];dt(this,function(wt,Ct){gt(At,{key:Ct,value:wt})}),et(ct,1);for(var xt=lt(mt),bt=lt(vt),Et=0,St=0,Bt=!1,Ot=At.length,Pt;Et<Ot;)Pt=At[Et++],Bt||Pt.key===xt?(Bt=!0,ht(this,Pt.key)):St++;for(;St<Ot;)Pt=At[St++],Pt.key===xt&&Pt.value===bt||ft(this,Pt.key,Pt.value)},{enumerable:!0,unsafe:!0})},nt=>{var at=TypeError;nt.exports=function(ot,rt){if(ot<rt)throw at("Not enough arguments");return ot}},(nt,at,ot)=>{var rt=ot(48),st=ot(14),lt=ot(77),et=ot(147),it=URLSearchParams,ut=it.prototype,ft=st(ut.getAll),ht=st(ut.has),dt=new it("a=1");(dt.has("a",2)||!dt.has("a",void 0))&&rt(ut,"has",function(pt){var mt=arguments.length,ct=mt<2?void 0:arguments[1];if(mt&&ct===void 0)return ht(this,pt);var vt=ft(this,pt);et(mt,1);for(var At=lt(ct),xt=0;xt<vt.length;)if(vt[xt++]===At)return!0;return!1},{enumerable:!0,unsafe:!0})},(nt,at,ot)=>{var rt=ot(6),st=ot(14),lt=ot(87),et=URLSearchParams.prototype,it=st(et.forEach);rt&&!("size"in et)&<(et,"size",{get:function(){var ft=0;return it(this,function(){ft++}),ft},configurable:!0,enumerable:!0})},(nt,at,ot)=>{Object.defineProperty(at,"__esModule",{value:!0}),at.XRefParseException=at.XRefEntryException=at.ParserEOFException=at.PDF_VERSION_REGEXP=at.MissingDataException=void 0,at.arrayBuffersToBytes=gt,at.collectActions=wt,at.encodeToXmlString=It,at.escapePDFName=Bt,at.escapeString=Ot,at.getInheritableProperty=pt,at.getLookupTableFactory=it,at.getNewAnnotationsMap=Ht,at.getRotationMatrix=Mt,at.isAscii=Ft,at.isWhiteSpace=Et,at.log2=vt,at.numberToString=jt,at.parseXFAPath=St,at.readInt8=At,at.readUint16=xt,at.readUint32=bt,at.recoverJsURL=kt,at.stringToUTF16HexString=_t,at.stringToUTF16String=Nt,at.toRomanNumerals=ct,at.validateCSSFont=Rt,at.validateFontName=yt,ot(84),ot(93),ot(94),ot(97),ot(99),ot(101),ot(105),ot(108),ot(115),ot(140),ot(116),ot(127),ot(129),ot(132),ot(134),ot(136),ot(138),ot(2);var rt=ot(145),st=ot(151),lt=ot(152);const et=/^[1-9]\.\d$/;at.PDF_VERSION_REGEXP=et;function it(Lt){let $t;return function(){return Lt&&($t=Object.create(null),Lt($t),Lt=null),$t}}class ut extends rt.BaseException{constructor($t,Tt){super(`Missing data [${$t}, ${Tt})`,"MissingDataException"),this.begin=$t,this.end=Tt}}at.MissingDataException=ut;class ft extends rt.BaseException{constructor($t){super($t,"ParserEOFException")}}at.ParserEOFException=ft;class ht extends rt.BaseException{constructor($t){super($t,"XRefEntryException")}}at.XRefEntryException=ht;class dt extends rt.BaseException{constructor($t){super($t,"XRefParseException")}}at.XRefParseException=dt;function gt(Lt){const $t=Lt.length;if($t===0)return new Uint8Array(0);if($t===1)return new Uint8Array(Lt[0]);let Tt=0;for(let Vt=0;Vt<$t;Vt++)Tt+=Lt[Vt].byteLength;const Dt=new Uint8Array(Tt);let Ut=0;for(let Vt=0;Vt<$t;Vt++){const Qt=new Uint8Array(Lt[Vt]);Dt.set(Qt,Ut),Ut+=Qt.byteLength}return Dt}function pt(Lt){let{dict:$t,key:Tt,getArray:Dt=!1,stopWhenFound:Ut=!0}=Lt,Vt;const Qt=new st.RefSet;for(;$t instanceof st.Dict&&!($t.objId&&Qt.has($t.objId));){$t.objId&&Qt.put($t.objId);const qt=Dt?$t.getArray(Tt):$t.get(Tt);if(qt!==void 0){if(Ut)return qt;(Vt||(Vt=[])).push(qt)}$t=$t.get("Parent")}return Vt}const mt=["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM","","X","XX","XXX","XL","L","LX","LXX","LXXX","XC","","I","II","III","IV","V","VI","VII","VIII","IX"];function ct(Lt){let $t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;(0,rt.assert)(Number.isInteger(Lt)&&Lt>0,"The number should be a positive integer.");const Tt=[];let Dt;for(;Lt>=1e3;)Lt-=1e3,Tt.push("M");Dt=Lt/100|0,Lt%=100,Tt.push(mt[Dt]),Dt=Lt/10|0,Lt%=10,Tt.push(mt[10+Dt]),Tt.push(mt[20+Lt]);const Ut=Tt.join("");return $t?Ut.toLowerCase():Ut}function vt(Lt){return Lt<=0?0:Math.ceil(Math.log2(Lt))}function At(Lt,$t){return Lt[$t]<<24>>24}function xt(Lt,$t){return Lt[$t]<<8|Lt[$t+1]}function bt(Lt,$t){return(Lt[$t]<<24|Lt[$t+1]<<16|Lt[$t+2]<<8|Lt[$t+3])>>>0}function Et(Lt){return Lt===32||Lt===9||Lt===13||Lt===10}function St(Lt){const $t=/(.+)\[(\d+)\]$/;return Lt.split(".").map(Tt=>{const Dt=Tt.match($t);return Dt?{name:Dt[1],pos:parseInt(Dt[2],10)}:{name:Tt,pos:0}})}function Bt(Lt){const $t=[];let Tt=0;for(let Dt=0,Ut=Lt.length;Dt<Ut;Dt++){const Vt=Lt.charCodeAt(Dt);(Vt<33||Vt>126||Vt===35||Vt===40||Vt===41||Vt===60||Vt===62||Vt===91||Vt===93||Vt===123||Vt===125||Vt===47||Vt===37)&&(Tt<Dt&&$t.push(Lt.substring(Tt,Dt)),$t.push(`#${Vt.toString(16)}`),Tt=Dt+1)}return $t.length===0?Lt:(Tt<Lt.length&&$t.push(Lt.substring(Tt,Lt.length)),$t.join(""))}function Ot(Lt){return Lt.replaceAll(/([()\\\n\r])/g,$t=>$t===`
|
51
51
|
`?"\\n":$t==="\r"?"\\r":`\\${$t}`)}function Pt(Lt,$t,Tt,Dt){if(!Lt)return;let Ut=null;if(Lt instanceof st.Ref){if(Dt.has(Lt))return;Ut=Lt,Dt.put(Ut),Lt=$t.fetch(Lt)}if(Array.isArray(Lt))for(const Vt of Lt)Pt(Vt,$t,Tt,Dt);else if(Lt instanceof st.Dict){if((0,st.isName)(Lt.get("S"),"JavaScript")){const Vt=Lt.get("JS");let Qt;Vt instanceof lt.BaseStream?Qt=Vt.getString():typeof Vt=="string"&&(Qt=Vt),Qt&&(Qt=(0,rt.stringToPDFString)(Qt).replaceAll("\0","")),Qt&&Tt.push(Qt)}Pt(Lt.getRaw("Next"),$t,Tt,Dt)}Ut&&Dt.remove(Ut)}function wt(Lt,$t,Tt){const Dt=Object.create(null),Ut=pt({dict:$t,key:"AA",stopWhenFound:!1});if(Ut)for(let Vt=Ut.length-1;Vt>=0;Vt--){const Qt=Ut[Vt];if(Qt instanceof st.Dict)for(const qt of Qt.getKeys()){const Zt=Tt[qt];if(!Zt)continue;const ar=Qt.getRaw(qt),Jt=new st.RefSet,rr=[];Pt(ar,Lt,rr,Jt),rr.length>0&&(Dt[Zt]=rr)}}if($t.has("A")){const Vt=$t.get("A"),Qt=new st.RefSet,qt=[];Pt(Vt,Lt,qt,Qt),qt.length>0&&(Dt.Action=qt)}return(0,rt.objectSize)(Dt)>0?Dt:null}const Ct={60:"<",62:">",38:"&",34:""",39:"'"};function It(Lt){const $t=[];let Tt=0;for(let Dt=0,Ut=Lt.length;Dt<Ut;Dt++){const Vt=Lt.codePointAt(Dt);if(32<=Vt&&Vt<=126){const Qt=Ct[Vt];Qt&&(Tt<Dt&&$t.push(Lt.substring(Tt,Dt)),$t.push(Qt),Tt=Dt+1)}else Tt<Dt&&$t.push(Lt.substring(Tt,Dt)),$t.push(`&#x${Vt.toString(16).toUpperCase()};`),Vt>55295&&(Vt<57344||Vt>65533)&&Dt++,Tt=Dt+1}return $t.length===0?Lt:(Tt<Lt.length&&$t.push(Lt.substring(Tt,Lt.length)),$t.join(""))}function yt(Lt){let $t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const Tt=/^("|').*("|')$/.exec(Lt);if(Tt&&Tt[1]===Tt[2]){if(new RegExp(`[^\\\\]${Tt[1]}`).test(Lt.slice(1,-1)))return $t&&(0,rt.warn)(`FontFamily contains unescaped ${Tt[1]}: ${Lt}.`),!1}else for(const Dt of Lt.split(/[ \t]+/))if(/^(\d|(-(\d|-)))/.test(Dt)||!/^[\w-\\]+$/.test(Dt))return $t&&(0,rt.warn)(`FontFamily contains invalid <custom-ident>: ${Lt}.`),!1;return!0}function Rt(Lt){const $t="14",Tt="400",Dt=new Set(["100","200","300","400","500","600","700","800","900","1000","normal","bold","bolder","lighter"]),{fontFamily:Ut,fontWeight:Vt,italicAngle:Qt}=Lt;if(!yt(Ut,!0))return!1;const qt=Vt?Vt.toString():"";Lt.fontWeight=Dt.has(qt)?qt:Tt;const Zt=parseFloat(Qt);return Lt.italicAngle=isNaN(Zt)||Zt<-90||Zt>90?$t:Qt.toString(),!0}function kt(Lt){const $t=["app.launchURL","window.open","xfa.host.gotoURL"],Dt=new RegExp("^\\s*("+$t.join("|").replaceAll(".","\\.")+`)\\((?:'|")([^'"]*)(?:'|")(?:,\\s*(\\w+)\\)|\\))`,"i").exec(Lt);if(Dt!=null&&Dt[2]){const Ut=Dt[2];let Vt=!1;return Dt[3]==="true"&&Dt[1]==="app.launchURL"&&(Vt=!0),{url:Ut,newWindow:Vt}}return null}function jt(Lt){if(Number.isInteger(Lt))return Lt.toString();const $t=Math.round(Lt*100);return $t%100===0?($t/100).toString():$t%10===0?Lt.toFixed(1):Lt.toFixed(2)}function Ht(Lt){if(!Lt)return null;const $t=new Map;for(const[Tt,Dt]of Lt){if(!Tt.startsWith(rt.AnnotationEditorPrefix))continue;let Ut=$t.get(Dt.pageIndex);Ut||(Ut=[],$t.set(Dt.pageIndex,Ut)),Ut.push(Dt)}return $t.size>0?$t:null}function Ft(Lt){return/^[\x00-\x7F]*$/.test(Lt)}function _t(Lt){const $t=[];for(let Tt=0,Dt=Lt.length;Tt<Dt;Tt++){const Ut=Lt.charCodeAt(Tt);$t.push((Ut>>8&255).toString(16).padStart(2,"0"),(Ut&255).toString(16).padStart(2,"0"))}return $t.join("")}function Nt(Lt){let $t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const Tt=[];$t&&Tt.push("þÿ");for(let Dt=0,Ut=Lt.length;Dt<Ut;Dt++){const Vt=Lt.charCodeAt(Dt);Tt.push(String.fromCharCode(Vt>>8&255),String.fromCharCode(Vt&255))}return Tt.join("")}function Mt(Lt,$t,Tt){switch(Lt){case 90:return[0,1,-1,0,$t,0];case 180:return[-1,0,0,-1,$t,Tt];case 270:return[0,-1,1,0,0,Tt];default:throw new Error("Invalid rotation")}}},(nt,at,ot)=>{Object.defineProperty(at,"__esModule",{value:!0}),at.RefSetCache=at.RefSet=at.Ref=at.Name=at.EOF=at.Dict=at.Cmd=at.CIRCULAR_REF=void 0,at.clearPrimitiveCaches=ft,at.isCmd=xt,at.isDict=bt,at.isName=At,at.isRefsEqual=Et,ot(140),ot(116),ot(127),ot(129),ot(132),ot(134),ot(136),ot(138);var rt=ot(145);const st=Symbol("CIRCULAR_REF");at.CIRCULAR_REF=st;const lt=Symbol("EOF");at.EOF=lt;let et=Object.create(null),it=Object.create(null),ut=Object.create(null);function ft(){et=Object.create(null),it=Object.create(null),ut=Object.create(null)}class ht{constructor(Bt){this.name=Bt}static get(Bt){return it[Bt]||(it[Bt]=new ht(Bt))}}at.Name=ht;class dt{constructor(Bt){this.cmd=Bt}static get(Bt){return et[Bt]||(et[Bt]=new dt(Bt))}}at.Cmd=dt;const gt=function(){return gt};class pt{constructor(){let Bt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;this._map=Object.create(null),this.xref=Bt,this.objId=null,this.suppressEncryption=!1,this.__nonSerializable__=gt}assignXref(Bt){this.xref=Bt}get size(){return Object.keys(this._map).length}get(Bt,Ot,Pt){let wt=this._map[Bt];return wt===void 0&&Ot!==void 0&&(wt=this._map[Ot],wt===void 0&&Pt!==void 0&&(wt=this._map[Pt])),wt instanceof mt&&this.xref?this.xref.fetch(wt,this.suppressEncryption):wt}async getAsync(Bt,Ot,Pt){let wt=this._map[Bt];return wt===void 0&&Ot!==void 0&&(wt=this._map[Ot],wt===void 0&&Pt!==void 0&&(wt=this._map[Pt])),wt instanceof mt&&this.xref?this.xref.fetchAsync(wt,this.suppressEncryption):wt}getArray(Bt,Ot,Pt){let wt=this._map[Bt];if(wt===void 0&&Ot!==void 0&&(wt=this._map[Ot],wt===void 0&&Pt!==void 0&&(wt=this._map[Pt])),wt instanceof mt&&this.xref&&(wt=this.xref.fetch(wt,this.suppressEncryption)),Array.isArray(wt)){wt=wt.slice();for(let Ct=0,It=wt.length;Ct<It;Ct++)wt[Ct]instanceof mt&&this.xref&&(wt[Ct]=this.xref.fetch(wt[Ct],this.suppressEncryption))}return wt}getRaw(Bt){return this._map[Bt]}getKeys(){return Object.keys(this._map)}getRawValues(){return Object.values(this._map)}set(Bt,Ot){this._map[Bt]=Ot}has(Bt){return this._map[Bt]!==void 0}forEach(Bt){for(const Ot in this._map)Bt(Ot,this.get(Ot))}static get empty(){const Bt=new pt(null);return Bt.set=(Ot,Pt)=>{(0,rt.unreachable)("Should not call `set` on the empty dictionary.")},(0,rt.shadow)(this,"empty",Bt)}static merge(Bt){let{xref:Ot,dictArray:Pt,mergeSubDicts:wt=!1}=Bt;const Ct=new pt(Ot),It=new Map;for(const yt of Pt)if(yt instanceof pt)for(const[Rt,kt]of Object.entries(yt._map)){let jt=It.get(Rt);if(jt===void 0)jt=[],It.set(Rt,jt);else if(!wt||!(kt instanceof pt))continue;jt.push(kt)}for(const[yt,Rt]of It){if(Rt.length===1||!(Rt[0]instanceof pt)){Ct._map[yt]=Rt[0];continue}const kt=new pt(Ot);for(const jt of Rt)for(const[Ht,Ft]of Object.entries(jt._map))kt._map[Ht]===void 0&&(kt._map[Ht]=Ft);kt.size>0&&(Ct._map[yt]=kt)}return It.clear(),Ct.size>0?Ct:pt.empty}clone(){const Bt=new pt(this.xref);for(const Ot of this.getKeys())Bt.set(Ot,this.getRaw(Ot));return Bt}}at.Dict=pt;class mt{constructor(Bt,Ot){this.num=Bt,this.gen=Ot}toString(){return this.gen===0?`${this.num}R`:`${this.num}R${this.gen}`}static fromString(Bt){const Ot=ut[Bt];if(Ot)return Ot;const Pt=/^(\d+)R(\d*)$/.exec(Bt);return!Pt||Pt[1]==="0"?null:ut[Bt]=new mt(parseInt(Pt[1]),Pt[2]?parseInt(Pt[2]):0)}static get(Bt,Ot){const Pt=Ot===0?`${Bt}R`:`${Bt}R${Ot}`;return ut[Pt]||(ut[Pt]=new mt(Bt,Ot))}}at.Ref=mt;class ct{constructor(){let Bt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;this._set=new Set(Bt==null?void 0:Bt._set)}has(Bt){return this._set.has(Bt.toString())}put(Bt){this._set.add(Bt.toString())}remove(Bt){this._set.delete(Bt.toString())}[Symbol.iterator](){return this._set.values()}clear(){this._set.clear()}}at.RefSet=ct;class vt{constructor(){this._map=new Map}get size(){return this._map.size}get(Bt){return this._map.get(Bt.toString())}has(Bt){return this._map.has(Bt.toString())}put(Bt,Ot){this._map.set(Bt.toString(),Ot)}putAlias(Bt,Ot){this._map.set(Bt.toString(),this.get(Ot))}[Symbol.iterator](){return this._map.values()}clear(){this._map.clear()}}at.RefSetCache=vt;function At(St,Bt){return St instanceof ht&&(Bt===void 0||St.name===Bt)}function xt(St,Bt){return St instanceof dt&&(Bt===void 0||St.cmd===Bt)}function bt(St,Bt){return St instanceof pt&&(Bt===void 0||At(St.get("Type"),Bt))}function Et(St,Bt){return St.num===Bt.num&&St.gen===Bt.gen}},(nt,at,ot)=>{Object.defineProperty(at,"__esModule",{value:!0}),at.BaseStream=void 0;var rt=ot(145);class st{constructor(){this.constructor===st&&(0,rt.unreachable)("Cannot initialize BaseStream.")}get length(){(0,rt.unreachable)("Abstract getter `length` accessed")}get isEmpty(){(0,rt.unreachable)("Abstract getter `isEmpty` accessed")}get isDataLoaded(){return(0,rt.shadow)(this,"isDataLoaded",!0)}getByte(){(0,rt.unreachable)("Abstract method `getByte` called")}getBytes(et){(0,rt.unreachable)("Abstract method `getBytes` called")}peekByte(){const et=this.getByte();return et!==-1&&this.pos--,et}peekBytes(et){const it=this.getBytes(et);return this.pos-=it.length,it}getUint16(){const et=this.getByte(),it=this.getByte();return et===-1||it===-1?-1:(et<<8)+it}getInt32(){const et=this.getByte(),it=this.getByte(),ut=this.getByte(),ft=this.getByte();return(et<<24)+(it<<16)+(ut<<8)+ft}getByteRange(et,it){(0,rt.unreachable)("Abstract method `getByteRange` called")}getString(et){return(0,rt.bytesToString)(this.getBytes(et))}skip(et){this.pos+=et||1}reset(){(0,rt.unreachable)("Abstract method `reset` called")}moveStart(){(0,rt.unreachable)("Abstract method `moveStart` called")}makeSubStream(et,it){(0,rt.unreachable)("Abstract method `makeSubStream` called")}getBaseStreams(){return null}}at.BaseStream=st},(nt,at,ot)=>{Object.defineProperty(at,"__esModule",{value:!0}),at.NetworkPdfManager=at.LocalPdfManager=void 0;var rt=ot(145),st=ot(154),lt=ot(150),et=ot(156),it=ot(155);function ut(gt){if(gt){const pt=(0,rt.createValidAbsoluteUrl)(gt);if(pt)return pt.href;(0,rt.warn)(`Invalid absolute docBaseUrl: "${gt}".`)}return null}class ft{constructor(pt){var mt;this.constructor===ft&&(0,rt.unreachable)("Cannot initialize BasePdfManager."),this._docBaseUrl=ut(pt.docBaseUrl),this._docId=pt.docId,this._password=pt.password,this.enableXfa=pt.enableXfa,(mt=pt.evaluatorOptions).isOffscreenCanvasSupported&&(mt.isOffscreenCanvasSupported=rt.FeatureTest.isOffscreenCanvasSupported),this.evaluatorOptions=pt.evaluatorOptions}get docId(){return this._docId}get password(){return this._password}get docBaseUrl(){return this._docBaseUrl}get catalog(){return this.pdfDocument.catalog}ensureDoc(pt,mt){return this.ensure(this.pdfDocument,pt,mt)}ensureXRef(pt,mt){return this.ensure(this.pdfDocument.xref,pt,mt)}ensureCatalog(pt,mt){return this.ensure(this.pdfDocument.catalog,pt,mt)}getPage(pt){return this.pdfDocument.getPage(pt)}fontFallback(pt,mt){return this.pdfDocument.fontFallback(pt,mt)}loadXfaFonts(pt,mt){return this.pdfDocument.loadXfaFonts(pt,mt)}loadXfaImages(){return this.pdfDocument.loadXfaImages()}serializeXfaData(pt){return this.pdfDocument.serializeXfaData(pt)}cleanup(){let pt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return this.pdfDocument.cleanup(pt)}async ensure(pt,mt,ct){(0,rt.unreachable)("Abstract method `ensure` called")}requestRange(pt,mt){(0,rt.unreachable)("Abstract method `requestRange` called")}requestLoadedStream(){(0,rt.unreachable)("Abstract method `requestLoadedStream` called")}sendProgressiveData(pt){(0,rt.unreachable)("Abstract method `sendProgressiveData` called")}updatePassword(pt){this._password=pt}terminate(pt){(0,rt.unreachable)("Abstract method `terminate` called")}}class ht extends ft{constructor(pt){super(pt);const mt=new it.Stream(pt.source);this.pdfDocument=new et.PDFDocument(this,mt),this._loadedStreamPromise=Promise.resolve(mt)}async ensure(pt,mt,ct){const vt=pt[mt];return typeof vt=="function"?vt.apply(pt,ct):vt}requestRange(pt,mt){return Promise.resolve()}requestLoadedStream(){return this._loadedStreamPromise}terminate(pt){}}at.LocalPdfManager=ht;class dt extends ft{constructor(pt){super(pt),this.streamManager=new st.ChunkedStreamManager(pt.source,{msgHandler:pt.handler,length:pt.length,disableAutoFetch:pt.disableAutoFetch,rangeChunkSize:pt.rangeChunkSize}),this.pdfDocument=new et.PDFDocument(this,this.streamManager.getStream())}async ensure(pt,mt,ct){try{const vt=pt[mt];return typeof vt=="function"?vt.apply(pt,ct):vt}catch(vt){if(!(vt instanceof lt.MissingDataException))throw vt;return await this.requestRange(vt.begin,vt.end),this.ensure(pt,mt,ct)}}requestRange(pt,mt){return this.streamManager.requestRange(pt,mt)}requestLoadedStream(){let pt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return this.streamManager.requestAllChunks(pt)}sendProgressiveData(pt){this.streamManager.onReceiveData({chunk:pt})}terminate(pt){this.streamManager.abort(pt)}}at.NetworkPdfManager=dt},(nt,at,ot)=>{Object.defineProperty(at,"__esModule",{value:!0}),at.ChunkedStreamManager=at.ChunkedStream=void 0,ot(84),ot(93),ot(94),ot(97),ot(99),ot(101),ot(105),ot(108),ot(115),ot(116),ot(127),ot(129),ot(132),ot(134),ot(136),ot(138),ot(140),ot(2);var rt=ot(150),st=ot(145),lt=ot(155);class et extends lt.Stream{constructor(ft,ht,dt){super(new Uint8Array(ft),0,ft,null),this.chunkSize=ht,this._loadedChunks=new Set,this.numChunks=Math.ceil(ft/ht),this.manager=dt,this.progressiveDataLength=0,this.lastSuccessfulEnsureByteChunk=-1}getMissingChunks(){const ft=[];for(let ht=0,dt=this.numChunks;ht<dt;++ht)this._loadedChunks.has(ht)||ft.push(ht);return ft}get numChunksLoaded(){return this._loadedChunks.size}get isDataLoaded(){return this.numChunksLoaded===this.numChunks}onReceiveData(ft,ht){const dt=this.chunkSize;if(ft%dt!==0)throw new Error(`Bad begin offset: ${ft}`);const gt=ft+ht.byteLength;if(gt%dt!==0&>!==this.bytes.length)throw new Error(`Bad end offset: ${gt}`);this.bytes.set(new Uint8Array(ht),ft);const pt=Math.floor(ft/dt),mt=Math.floor((gt-1)/dt)+1;for(let ct=pt;ct<mt;++ct)this._loadedChunks.add(ct)}onReceiveProgressiveData(ft){let ht=this.progressiveDataLength;const dt=Math.floor(ht/this.chunkSize);this.bytes.set(new Uint8Array(ft),ht),ht+=ft.byteLength,this.progressiveDataLength=ht;const gt=ht>=this.end?this.numChunks:Math.floor(ht/this.chunkSize);for(let pt=dt;pt<gt;++pt)this._loadedChunks.add(pt)}ensureByte(ft){if(ft<this.progressiveDataLength)return;const ht=Math.floor(ft/this.chunkSize);if(!(ht>this.numChunks)&&ht!==this.lastSuccessfulEnsureByteChunk){if(!this._loadedChunks.has(ht))throw new rt.MissingDataException(ft,ft+1);this.lastSuccessfulEnsureByteChunk=ht}}ensureRange(ft,ht){if(ft>=ht||ht<=this.progressiveDataLength)return;const dt=Math.floor(ft/this.chunkSize);if(dt>this.numChunks)return;const gt=Math.min(Math.floor((ht-1)/this.chunkSize)+1,this.numChunks);for(let pt=dt;pt<gt;++pt)if(!this._loadedChunks.has(pt))throw new rt.MissingDataException(ft,ht)}nextEmptyChunk(ft){const ht=this.numChunks;for(let dt=0;dt<ht;++dt){const gt=(ft+dt)%ht;if(!this._loadedChunks.has(gt))return gt}return null}hasChunk(ft){return this._loadedChunks.has(ft)}getByte(){const ft=this.pos;return ft>=this.end?-1:(ft>=this.progressiveDataLength&&this.ensureByte(ft),this.bytes[this.pos++])}getBytes(ft){const ht=this.bytes,dt=this.pos,gt=this.end;if(!ft)return gt>this.progressiveDataLength&&this.ensureRange(dt,gt),ht.subarray(dt,gt);let pt=dt+ft;return pt>gt&&(pt=gt),pt>this.progressiveDataLength&&this.ensureRange(dt,pt),this.pos=pt,ht.subarray(dt,pt)}getByteRange(ft,ht){return ft<0&&(ft=0),ht>this.end&&(ht=this.end),ht>this.progressiveDataLength&&this.ensureRange(ft,ht),this.bytes.subarray(ft,ht)}makeSubStream(ft,ht){let dt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;ht?ft+ht>this.progressiveDataLength&&this.ensureRange(ft,ft+ht):ft>=this.progressiveDataLength&&this.ensureByte(ft);function gt(){}gt.prototype=Object.create(this),gt.prototype.getMissingChunks=function(){const mt=this.chunkSize,ct=Math.floor(this.start/mt),vt=Math.floor((this.end-1)/mt)+1,At=[];for(let xt=ct;xt<vt;++xt)this._loadedChunks.has(xt)||At.push(xt);return At},Object.defineProperty(gt.prototype,"isDataLoaded",{get(){return this.numChunksLoaded===this.numChunks?!0:this.getMissingChunks().length===0},configurable:!0});const pt=new gt;return pt.pos=pt.start=ft,pt.end=ft+ht||this.end,pt.dict=dt,pt}getBaseStreams(){return[this]}}at.ChunkedStream=et;class it{constructor(ft,ht){this.length=ht.length,this.chunkSize=ht.rangeChunkSize,this.stream=new et(this.length,this.chunkSize,this),this.pdfNetworkStream=ft,this.disableAutoFetch=ht.disableAutoFetch,this.msgHandler=ht.msgHandler,this.currRequestId=0,this._chunksNeededByRequest=new Map,this._requestsByChunk=new Map,this._promisesByRequest=new Map,this.progressiveDataLength=0,this.aborted=!1,this._loadedStreamCapability=new st.PromiseCapability}sendRequest(ft,ht){const dt=this.pdfNetworkStream.getRangeReader(ft,ht);dt.isStreamingSupported||(dt.onProgress=this.onProgress.bind(this));let gt=[],pt=0;return new Promise((mt,ct)=>{const vt=At=>{let{value:xt,done:bt}=At;try{if(bt){const Et=(0,rt.arrayBuffersToBytes)(gt);gt=null,mt(Et);return}pt+=xt.byteLength,dt.isStreamingSupported&&this.onProgress({loaded:pt}),gt.push(xt),dt.read().then(vt,ct)}catch(Et){ct(Et)}};dt.read().then(vt,ct)}).then(mt=>{this.aborted||this.onReceiveData({chunk:mt,begin:ft})})}requestAllChunks(){if(!(arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1)){const ht=this.stream.getMissingChunks();this._requestChunks(ht)}return this._loadedStreamCapability.promise}_requestChunks(ft){const ht=this.currRequestId++,dt=new Set;this._chunksNeededByRequest.set(ht,dt);for(const mt of ft)this.stream.hasChunk(mt)||dt.add(mt);if(dt.size===0)return Promise.resolve();const gt=new st.PromiseCapability;this._promisesByRequest.set(ht,gt);const pt=[];for(const mt of dt){let ct=this._requestsByChunk.get(mt);ct||(ct=[],this._requestsByChunk.set(mt,ct),pt.push(mt)),ct.push(ht)}if(pt.length>0){const mt=this.groupChunks(pt);for(const ct of mt){const vt=ct.beginChunk*this.chunkSize,At=Math.min(ct.endChunk*this.chunkSize,this.length);this.sendRequest(vt,At).catch(gt.reject)}}return gt.promise.catch(mt=>{if(!this.aborted)throw mt})}getStream(){return this.stream}requestRange(ft,ht){ht=Math.min(ht,this.length);const dt=this.getBeginChunk(ft),gt=this.getEndChunk(ht),pt=[];for(let mt=dt;mt<gt;++mt)pt.push(mt);return this._requestChunks(pt)}requestRanges(){let ft=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];const ht=[];for(const dt of ft){const gt=this.getBeginChunk(dt.begin),pt=this.getEndChunk(dt.end);for(let mt=gt;mt<pt;++mt)ht.includes(mt)||ht.push(mt)}return ht.sort(function(dt,gt){return dt-gt}),this._requestChunks(ht)}groupChunks(ft){const ht=[];let dt=-1,gt=-1;for(let pt=0,mt=ft.length;pt<mt;++pt){const ct=ft[pt];dt<0&&(dt=ct),gt>=0&>+1!==ct&&(ht.push({beginChunk:dt,endChunk:gt+1}),dt=ct),pt+1===ft.length&&ht.push({beginChunk:dt,endChunk:ct+1}),gt=ct}return ht}onProgress(ft){this.msgHandler.send("DocProgress",{loaded:this.stream.numChunksLoaded*this.chunkSize+ft.loaded,total:this.length})}onReceiveData(ft){const ht=ft.chunk,dt=ft.begin===void 0,gt=dt?this.progressiveDataLength:ft.begin,pt=gt+ht.byteLength,mt=Math.floor(gt/this.chunkSize),ct=pt<this.length?Math.floor(pt/this.chunkSize):Math.ceil(pt/this.chunkSize);dt?(this.stream.onReceiveProgressiveData(ht),this.progressiveDataLength=pt):this.stream.onReceiveData(gt,ht),this.stream.isDataLoaded&&this._loadedStreamCapability.resolve(this.stream);const vt=[];for(let At=mt;At<ct;++At){const xt=this._requestsByChunk.get(At);if(xt){this._requestsByChunk.delete(At);for(const bt of xt){const Et=this._chunksNeededByRequest.get(bt);Et.has(At)&&Et.delete(At),!(Et.size>0)&&vt.push(bt)}}}if(!this.disableAutoFetch&&this._requestsByChunk.size===0){let At;if(this.stream.numChunksLoaded===1){const xt=this.stream.numChunks-1;this.stream.hasChunk(xt)||(At=xt)}else At=this.stream.nextEmptyChunk(ct);Number.isInteger(At)&&this._requestChunks([At])}for(const At of vt){const xt=this._promisesByRequest.get(At);this._promisesByRequest.delete(At),xt.resolve()}this.msgHandler.send("DocProgress",{loaded:this.stream.numChunksLoaded*this.chunkSize,total:this.length})}onError(ft){this._loadedStreamCapability.reject(ft)}getBeginChunk(ft){return Math.floor(ft/this.chunkSize)}getEndChunk(ft){return Math.floor((ft-1)/this.chunkSize)+1}abort(ft){var ht;this.aborted=!0,(ht=this.pdfNetworkStream)==null||ht.cancelAllRequests(ft);for(const dt of this._promisesByRequest.values())dt.reject(ft)}}at.ChunkedStreamManager=it},(nt,at,ot)=>{Object.defineProperty(at,"__esModule",{value:!0}),at.StringStream=at.Stream=at.NullStream=void 0,ot(84),ot(93),ot(94),ot(97),ot(99),ot(101),ot(105),ot(108),ot(115);var rt=ot(152),st=ot(145);class lt extends rt.BaseStream{constructor(ft,ht,dt,gt){super(),this.bytes=ft instanceof Uint8Array?ft:new Uint8Array(ft),this.start=ht||0,this.pos=this.start,this.end=ht+dt||this.bytes.length,this.dict=gt}get length(){return this.end-this.start}get isEmpty(){return this.length===0}getByte(){return this.pos>=this.end?-1:this.bytes[this.pos++]}getBytes(ft){const ht=this.bytes,dt=this.pos,gt=this.end;if(!ft)return ht.subarray(dt,gt);let pt=dt+ft;return pt>gt&&(pt=gt),this.pos=pt,ht.subarray(dt,pt)}getByteRange(ft,ht){return ft<0&&(ft=0),ht>this.end&&(ht=this.end),this.bytes.subarray(ft,ht)}reset(){this.pos=this.start}moveStart(){this.start=this.pos}makeSubStream(ft,ht){let dt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;return new lt(this.bytes.buffer,ft,ht,dt)}}at.Stream=lt;class et extends lt{constructor(ft){super((0,st.stringToBytes)(ft))}}at.StringStream=et;class it extends lt{constructor(){super(new Uint8Array(0))}}at.NullStream=it},(nt,at,ot)=>{var Ft,Es,Nt,Cs;Object.defineProperty(at,"__esModule",{value:!0}),at.Page=at.PDFDocument=void 0,ot(2),ot(140),ot(116),ot(127),ot(129),ot(132),ot(134),ot(136),ot(138),ot(84),ot(93),ot(94),ot(97),ot(99),ot(101),ot(105),ot(108),ot(115);var rt=ot(145),st=ot(157),lt=ot(150),et=ot(151),it=ot(202),ut=ot(152),ft=ot(225),ht=ot(217),dt=ot(219),gt=ot(256),pt=ot(167),mt=ot(155),ct=ot(227),vt=ot(215),At=ot(164),xt=ot(169),bt=ot(223),Et=ot(224),St=ot(228),Bt=ot(257);const Ot=1,Pt=[0,0,612,792];class wt{constructor($t){_r(this,Ft);let{pdfManager:Tt,xref:Dt,pageIndex:Ut,pageDict:Vt,ref:Qt,globalIdFactory:qt,fontCache:Zt,builtInCMapCache:ar,standardFontDataCache:Jt,globalImageCache:rr,systemFontCache:Yt,nonBlendModesSet:Kt,xfaFactory:nr}=$t;this.pdfManager=Tt,this.pageIndex=Ut,this.pageDict=Vt,this.xref=Dt,this.ref=Qt,this.fontCache=Zt,this.builtInCMapCache=ar,this.standardFontDataCache=Jt,this.globalImageCache=rr,this.systemFontCache=Yt,this.nonBlendModesSet=Kt,this.evaluatorOptions=Tt.evaluatorOptions,this.resourcesPromise=null,this.xfaFactory=nr;const tr={obj:0};this._localIdFactory=class extends qt{static createObjId(){return`p${Ut}_${++tr.obj}`}static getPageObjId(){return`p${Qt.toString()}`}}}_getInheritableProperty($t){let Tt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const Dt=(0,lt.getInheritableProperty)({dict:this.pageDict,key:$t,getArray:Tt,stopWhenFound:!1});return Array.isArray(Dt)?Dt.length===1||!(Dt[0]instanceof et.Dict)?Dt[0]:et.Dict.merge({xref:this.xref,dictArray:Dt}):Dt}get content(){return this.pageDict.getArray("Contents")}get resources(){const $t=this._getInheritableProperty("Resources");return(0,rt.shadow)(this,"resources",$t instanceof et.Dict?$t:et.Dict.empty)}_getBoundingBox($t){if(this.xfaData)return this.xfaData.bbox;let Tt=this._getInheritableProperty($t,!0);if(Array.isArray(Tt)&&Tt.length===4){if(Tt=rt.Util.normalizeRect(Tt),Tt[2]-Tt[0]>0&&Tt[3]-Tt[1]>0)return Tt;(0,rt.warn)(`Empty, or invalid, /${$t} entry.`)}return null}get mediaBox(){return(0,rt.shadow)(this,"mediaBox",this._getBoundingBox("MediaBox")||Pt)}get cropBox(){return(0,rt.shadow)(this,"cropBox",this._getBoundingBox("CropBox")||this.mediaBox)}get userUnit(){let $t=this.pageDict.get("UserUnit");return(typeof $t!="number"||$t<=0)&&($t=Ot),(0,rt.shadow)(this,"userUnit",$t)}get view(){const{cropBox:$t,mediaBox:Tt}=this;if($t!==Tt&&!(0,rt.isArrayEqual)($t,Tt)){const Dt=rt.Util.intersect($t,Tt);if(Dt&&Dt[2]-Dt[0]>0&&Dt[3]-Dt[1]>0)return(0,rt.shadow)(this,"view",Dt);(0,rt.warn)("Empty /CropBox and /MediaBox intersection.")}return(0,rt.shadow)(this,"view",Tt)}get rotate(){let $t=this._getInheritableProperty("Rotate")||0;return $t%90!==0?$t=0:$t>=360?$t%=360:$t<0&&($t=($t%360+360)%360),(0,rt.shadow)(this,"rotate",$t)}_onSubStreamError($t,Tt){if(this.evaluatorOptions.ignoreErrors){(0,rt.warn)(`getContentStream - ignoring sub-stream (${Tt}): "${$t}".`);return}throw $t}getContentStream(){return this.pdfManager.ensure(this,"content").then($t=>$t instanceof ut.BaseStream?$t:Array.isArray($t)?new xt.StreamsSequenceStream($t,this._onSubStreamError.bind(this)):new mt.NullStream)}get xfaData(){return(0,rt.shadow)(this,"xfaData",this.xfaFactory?{bbox:this.xfaFactory.getBoundingBox(this.pageIndex)}:null)}async saveNewAnnotations($t,Tt,Dt,Ut){if(this.xfaFactory)throw new Error("XFA: Cannot save new annotations.");const Vt=new At.PartialEvaluator({xref:this.xref,handler:$t,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}),Qt=new et.RefSet,qt=new et.RefSet;Ur(this,Ft,Es).call(this,Dt,Qt,qt);const Zt=this.pageDict,ar=this.annotations.filter(nr=>!(nr instanceof et.Ref&&Qt.has(nr))),Jt=await st.AnnotationFactory.saveNewAnnotations(Vt,Tt,Dt,Ut);for(const{ref:nr}of Jt.annotations)nr instanceof et.Ref&&!qt.has(nr)&&ar.push(nr);const rr=Zt.get("Annots");Zt.set("Annots",ar);const Yt=[];await(0,Et.writeObject)(this.ref,Zt,Yt,this.xref),rr&&Zt.set("Annots",rr);const Kt=Jt.dependencies;return Kt.push({ref:this.ref,data:Yt.join("")},...Jt.annotations),Kt}save($t,Tt,Dt){const Ut=new At.PartialEvaluator({xref:this.xref,handler:$t,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions});return this._parsedAnnotations.then(function(Vt){const Qt=[];for(const qt of Vt)qt.mustBePrinted(Dt)&&Qt.push(qt.save(Ut,Tt,Dt).catch(function(Zt){return(0,rt.warn)(`save - ignoring annotation data during "${Tt.name}" task: "${Zt}".`),null}));return Promise.all(Qt).then(function(qt){return qt.filter(Zt=>!!Zt)})})}loadResources($t){return this.resourcesPromise||(this.resourcesPromise=this.pdfManager.ensure(this,"resources")),this.resourcesPromise.then(()=>new ct.ObjectLoader(this.resources,$t,this.xref).load())}getOperatorList($t){let{handler:Tt,sink:Dt,task:Ut,intent:Vt,cacheKey:Qt,annotationStorage:qt=null}=$t;const Zt=this.getContentStream(),ar=this.loadResources(["ColorSpace","ExtGState","Font","Pattern","Properties","Shading","XObject"]),Jt=new At.PartialEvaluator({xref:this.xref,handler:Tt,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}),rr=this.xfaFactory?null:(0,lt.getNewAnnotationsMap)(qt);let Yt=null,Kt=Promise.resolve(null);if(rr){const ir=rr.get(this.pageIndex);if(ir){const sr=this.pdfManager.ensureDoc("annotationGlobals");let cr;const or=new Set;for(const{bitmapId:Gt,bitmap:Wt}of ir)Gt&&!Wt&&!or.has(Gt)&&or.add(Gt);const{isOffscreenCanvasSupported:Xt}=this.evaluatorOptions;if(or.size>0){const Gt=ir.slice();for(const[Wt,er]of qt)Wt.startsWith(rt.AnnotationEditorPrefix)&&er.bitmap&&or.has(er.bitmapId)&&Gt.push(er);cr=st.AnnotationFactory.generateImages(Gt,this.xref,Xt)}else cr=st.AnnotationFactory.generateImages(ir,this.xref,Xt);Yt=new et.RefSet,Ur(this,Ft,Es).call(this,ir,Yt,null),Kt=sr.then(Gt=>Gt?st.AnnotationFactory.printNewAnnotations(Gt,Jt,Ut,ir,cr):null)}}const tr=Promise.all([Zt,ar]).then(ir=>{let[sr]=ir;const cr=new vt.OperatorList(Vt,Dt);return Tt.send("StartRenderPage",{transparency:Jt.hasBlendModes(this.resources,this.nonBlendModesSet),pageIndex:this.pageIndex,cacheKey:Qt}),Jt.getOperatorList({stream:sr,task:Ut,resources:this.resources,operatorList:cr}).then(function(){return cr})});return Promise.all([tr,this._parsedAnnotations,Kt]).then(function(ir){let[sr,cr,or]=ir;if(or){cr=cr.filter(ur=>!(ur.ref&&Yt.has(ur.ref)));for(let ur=0,pr=or.length;ur<pr;ur++){const yr=or[ur];if(yr.refToReplace){const Er=cr.findIndex(br=>br.ref&&(0,et.isRefsEqual)(br.ref,yr.refToReplace));Er>=0&&(cr.splice(Er,1,yr),or.splice(ur--,1),pr--)}}cr=cr.concat(or)}if(cr.length===0||Vt&rt.RenderingIntentFlag.ANNOTATIONS_DISABLE)return sr.flush(!0),{length:sr.totalLength};const Xt=!!(Vt&rt.RenderingIntentFlag.ANNOTATIONS_FORMS),Gt=!!(Vt&rt.RenderingIntentFlag.ANY),Wt=!!(Vt&rt.RenderingIntentFlag.DISPLAY),er=!!(Vt&rt.RenderingIntentFlag.PRINT),lr=[];for(const ur of cr)(Gt||Wt&&ur.mustBeViewed(qt,Xt)||er&&ur.mustBePrinted(qt))&&lr.push(ur.getOperatorList(Jt,Ut,Vt,Xt,qt).catch(function(pr){return(0,rt.warn)(`getOperatorList - ignoring annotation data during "${Ut.name}" task: "${pr}".`),{opList:null,separateForm:!1,separateCanvas:!1}}));return Promise.all(lr).then(function(ur){let pr=!1,yr=!1;for(const{opList:Er,separateForm:br,separateCanvas:gr}of ur)sr.addOpList(Er),pr||(pr=br),yr||(yr=gr);return sr.flush(!0,{form:pr,canvas:yr}),{length:sr.totalLength}})})}extractTextContent($t){let{handler:Tt,task:Dt,includeMarkedContent:Ut,disableNormalization:Vt,sink:Qt}=$t;const qt=this.getContentStream(),Zt=this.loadResources(["ExtGState","Font","Properties","XObject"]);return Promise.all([qt,Zt]).then(Jt=>{let[rr]=Jt;return new At.PartialEvaluator({xref:this.xref,handler:Tt,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}).getTextContent({stream:rr,task:Dt,resources:this.resources,includeMarkedContent:Ut,disableNormalization:Vt,sink:Qt,viewBox:this.view})})}async getStructTree(){const $t=await this.pdfManager.ensureCatalog("structTreeRoot");return $t?(await this._parsedAnnotations,(await this.pdfManager.ensure(this,"_parseStructTree",[$t])).serializable):null}_parseStructTree($t){const Tt=new bt.StructTreePage($t,this.pageDict);return Tt.parse(this.ref),Tt}async getAnnotationsData($t,Tt,Dt){const Ut=await this._parsedAnnotations;if(Ut.length===0)return Ut;const Vt=[],Qt=[];let qt;const Zt=!!(Dt&rt.RenderingIntentFlag.ANY),ar=!!(Dt&rt.RenderingIntentFlag.DISPLAY),Jt=!!(Dt&rt.RenderingIntentFlag.PRINT);for(const rr of Ut){const Yt=Zt||ar&&rr.viewable;(Yt||Jt&&rr.printable)&&Vt.push(rr.data),rr.hasTextContent&&Yt&&(qt||(qt=new At.PartialEvaluator({xref:this.xref,handler:$t,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions})),Qt.push(rr.extractTextContent(qt,Tt,[-1/0,-1/0,1/0,1/0]).catch(function(Kt){(0,rt.warn)(`getAnnotationsData - ignoring textContent during "${Tt.name}" task: "${Kt}".`)})))}return await Promise.all(Qt),Vt}get annotations(){const $t=this._getInheritableProperty("Annots");return(0,rt.shadow)(this,"annotations",Array.isArray($t)?$t:[])}get _parsedAnnotations(){const $t=this.pdfManager.ensure(this,"annotations").then(async Tt=>{if(Tt.length===0)return Tt;const Dt=await this.pdfManager.ensureDoc("annotationGlobals");if(!Dt)return[];const Ut=[];for(const qt of Tt)Ut.push(st.AnnotationFactory.create(this.xref,qt,Dt,this._localIdFactory,!1,this.ref).catch(function(Zt){return(0,rt.warn)(`_parsedAnnotations: "${Zt}".`),null}));const Vt=[];let Qt;for(const qt of await Promise.all(Ut))if(qt){if(qt instanceof st.PopupAnnotation){(Qt||(Qt=[])).push(qt);continue}Vt.push(qt)}return Qt&&Vt.push(...Qt),Vt});return(0,rt.shadow)(this,"_parsedAnnotations",$t)}get jsActions(){const $t=(0,lt.collectActions)(this.xref,this.pageDict,rt.PageActionEventType);return(0,rt.shadow)(this,"jsActions",$t)}}Ft=new WeakSet,Es=function($t,Tt,Dt){for(const Ut of $t)if(Ut.id){const Vt=et.Ref.fromString(Ut.id);if(!Vt){(0,rt.warn)(`A non-linked annotation cannot be modified: ${Ut.id}`);continue}if(Ut.deleted){Tt.put(Vt);continue}Dt==null||Dt.put(Vt),Ut.ref=Vt,delete Ut.id}},at.Page=wt;const Ct=new Uint8Array([37,80,68,70,45]),It=new Uint8Array([115,116,97,114,116,120,114,101,102]),yt=new Uint8Array([101,110,100,111,98,106]),Rt=1024,kt="\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";function jt(Lt,$t){let Tt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1024,Dt=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;const Ut=$t.length,Vt=Lt.peekBytes(Tt),Qt=Vt.length-Ut;if(Qt<=0)return!1;if(Dt){const qt=Ut-1;let Zt=Vt.length-1;for(;Zt>=qt;){let ar=0;for(;ar<Ut&&Vt[Zt-ar]===$t[qt-ar];)ar++;if(ar>=Ut)return Lt.pos+=Zt-qt,!0;Zt--}}else{let qt=0;for(;qt<=Qt;){let Zt=0;for(;Zt<Ut&&Vt[qt+Zt]===$t[Zt];)Zt++;if(Zt>=Ut)return Lt.pos+=qt,!0;qt++}}return!1}class Ht{constructor($t,Tt){_r(this,Nt);if(Tt.length<=0)throw new rt.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");this.pdfManager=$t,this.stream=Tt,this.xref=new Bt.XRef(Tt,$t),this._pagePromises=new Map,this._version=null;const Dt={font:0};this._globalIdFactory=class{static getDocId(){return`g_${$t.docId}`}static createFontId(){return`f${++Dt.font}`}static createObjId(){(0,rt.unreachable)("Abstract method `createObjId` called.")}static getPageObjId(){(0,rt.unreachable)("Abstract method `getPageObjId` called.")}}}parse($t){this.xref.parse($t),this.catalog=new ht.Catalog(this.pdfManager,this.xref)}get linearization(){let $t=null;try{$t=pt.Linearization.create(this.stream)}catch(Tt){if(Tt instanceof lt.MissingDataException)throw Tt;(0,rt.info)(Tt)}return(0,rt.shadow)(this,"linearization",$t)}get startXRef(){const $t=this.stream;let Tt=0;if(this.linearization)$t.reset(),jt($t,yt)&&(Tt=$t.pos+6-$t.start);else{const Ut=It.length;let Vt=!1,Qt=$t.end;for(;!Vt&&Qt>0;)Qt-=1024-Ut,Qt<0&&(Qt=0),$t.pos=Qt,Vt=jt($t,It,1024,!0);if(Vt){$t.skip(9);let qt;do qt=$t.getByte();while((0,lt.isWhiteSpace)(qt));let Zt="";for(;qt>=32&&qt<=57;)Zt+=String.fromCharCode(qt),qt=$t.getByte();Tt=parseInt(Zt,10),isNaN(Tt)&&(Tt=0)}}return(0,rt.shadow)(this,"startXRef",Tt)}checkHeader(){const $t=this.stream;if($t.reset(),!jt($t,Ct))return;$t.moveStart(),$t.skip(Ct.length);let Tt="",Dt;for(;(Dt=$t.getByte())>32&&Tt.length<7;)Tt+=String.fromCharCode(Dt);lt.PDF_VERSION_REGEXP.test(Tt)?this._version=Tt:(0,rt.warn)(`Invalid PDF header version: ${Tt}`)}parseStartXRef(){this.xref.setStartXRef(this.startXRef)}get numPages(){let $t=0;return this.catalog.hasActualNumPages?$t=this.catalog.numPages:this.xfaFactory?$t=this.xfaFactory.getNumPages():this.linearization?$t=this.linearization.numPages:$t=this.catalog.numPages,(0,rt.shadow)(this,"numPages",$t)}_hasOnlyDocumentSignatures($t){let Tt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;const Dt=10;return Array.isArray($t)?$t.every(Ut=>{if(Ut=this.xref.fetchIfRef(Ut),!(Ut instanceof et.Dict))return!1;if(Ut.has("Kids"))return++Tt>Dt?((0,rt.warn)("_hasOnlyDocumentSignatures: maximum recursion depth reached"),!1):this._hasOnlyDocumentSignatures(Ut.get("Kids"),Tt);const Vt=(0,et.isName)(Ut.get("FT"),"Sig"),Qt=Ut.get("Rect"),qt=Array.isArray(Qt)&&Qt.every(Zt=>Zt===0);return Vt&&qt}):!1}get _xfaStreams(){const $t=this.catalog.acroForm;if(!$t)return null;const Tt=$t.get("XFA"),Dt={"xdp:xdp":"",template:"",datasets:"",config:"",connectionSet:"",localeSet:"",stylesheet:"","/xdp:xdp":""};if(Tt instanceof ut.BaseStream&&!Tt.isEmpty)return Dt["xdp:xdp"]=Tt,Dt;if(!Array.isArray(Tt)||Tt.length===0)return null;for(let Ut=0,Vt=Tt.length;Ut<Vt;Ut+=2){let Qt;if(Ut===0?Qt="xdp:xdp":Ut===Vt-2?Qt="/xdp:xdp":Qt=Tt[Ut],!Dt.hasOwnProperty(Qt))continue;const qt=this.xref.fetchIfRef(Tt[Ut+1]);!(qt instanceof ut.BaseStream)||qt.isEmpty||(Dt[Qt]=qt)}return Dt}get xfaDatasets(){const $t=this._xfaStreams;if(!$t)return(0,rt.shadow)(this,"xfaDatasets",null);for(const Tt of["datasets","xdp:xdp"]){const Dt=$t[Tt];if(Dt)try{const Ut=(0,rt.stringToUTF8String)(Dt.getString()),Vt={[Tt]:Ut};return(0,rt.shadow)(this,"xfaDatasets",new gt.DatasetReader(Vt))}catch{(0,rt.warn)("XFA - Invalid utf-8 string.");break}}return(0,rt.shadow)(this,"xfaDatasets",null)}get xfaData(){const $t=this._xfaStreams;if(!$t)return null;const Tt=Object.create(null);for(const[Dt,Ut]of Object.entries($t))if(Ut)try{Tt[Dt]=(0,rt.stringToUTF8String)(Ut.getString())}catch{return(0,rt.warn)("XFA - Invalid utf-8 string."),null}return Tt}get xfaFactory(){let $t;return this.pdfManager.enableXfa&&this.catalog.needsRendering&&this.formInfo.hasXfa&&!this.formInfo.hasAcroForm&&($t=this.xfaData),(0,rt.shadow)(this,"xfaFactory",$t?new St.XFAFactory($t):null)}get isPureXfa(){return this.xfaFactory?this.xfaFactory.isValid():!1}get htmlForXfa(){return this.xfaFactory?this.xfaFactory.getPages():null}async loadXfaImages(){const $t=await this.pdfManager.ensureCatalog("xfaImages");if(!$t)return;const Tt=$t.getKeys();await new ct.ObjectLoader($t,Tt,this.xref).load();const Ut=new Map;for(const Vt of Tt){const Qt=$t.get(Vt);Qt instanceof ut.BaseStream&&Ut.set(Vt,Qt.getBytes())}this.xfaFactory.setImages(Ut)}async loadXfaFonts($t,Tt){const Dt=await this.pdfManager.ensureCatalog("acroForm");if(!Dt)return;const Ut=await Dt.getAsync("DR");if(!(Ut instanceof et.Dict))return;await new ct.ObjectLoader(Ut,["Font"],this.xref).load();const Qt=Ut.get("Font");if(!(Qt instanceof et.Dict))return;const qt=Object.assign(Object.create(null),this.pdfManager.evaluatorOptions);qt.useSystemFonts=!1;const Zt=new At.PartialEvaluator({xref:this.xref,handler:$t,pageIndex:-1,idFactory:this._globalIdFactory,fontCache:this.catalog.fontCache,builtInCMapCache:this.catalog.builtInCMapCache,standardFontDataCache:this.catalog.standardFontDataCache,options:qt}),ar=new vt.OperatorList,Jt=[],rr={get font(){return Jt.at(-1)},set font(ir){Jt.push(ir)},clone(){return this}},Yt=new Map;Qt.forEach((ir,sr)=>{Yt.set(ir,sr)});const Kt=[];for(const[ir,sr]of Yt){const cr=sr.get("FontDescriptor");if(!(cr instanceof et.Dict))continue;let or=cr.get("FontFamily");or=or.replaceAll(/[ ]+(\d)/g,"$1");const Xt=cr.get("FontWeight"),Gt=-cr.get("ItalicAngle"),Wt={fontFamily:or,fontWeight:Xt,italicAngle:Gt};(0,lt.validateCSSFont)(Wt)&&Kt.push(Zt.handleSetFont(Ut,[et.Name.get(ir),1],null,ar,Tt,rr,null,Wt).catch(function(er){return(0,rt.warn)(`loadXfaFonts: "${er}".`),null}))}await Promise.all(Kt);const nr=this.xfaFactory.setFonts(Jt);if(!nr)return;qt.ignoreErrors=!0,Kt.length=0,Jt.length=0;const tr=new Set;for(const ir of nr)(0,it.getXfaFontName)(`${ir}-Regular`)||tr.add(ir);tr.size&&nr.push("PdfJS-Fallback");for(const ir of nr)if(!tr.has(ir))for(const sr of[{name:"Regular",fontWeight:400,italicAngle:0},{name:"Bold",fontWeight:700,italicAngle:0},{name:"Italic",fontWeight:400,italicAngle:12},{name:"BoldItalic",fontWeight:700,italicAngle:12}]){const cr=`${ir}-${sr.name}`,or=(0,it.getXfaFontDict)(cr);Kt.push(Zt.handleSetFont(Ut,[et.Name.get(cr),1],null,ar,Tt,rr,or,{fontFamily:ir,fontWeight:sr.fontWeight,italicAngle:sr.italicAngle}).catch(function(Xt){return(0,rt.warn)(`loadXfaFonts: "${Xt}".`),null}))}await Promise.all(Kt),this.xfaFactory.appendFonts(Jt,tr)}async serializeXfaData($t){return this.xfaFactory?this.xfaFactory.serializeData($t):null}get version(){return this.catalog.version||this._version}get formInfo(){const $t={hasFields:!1,hasAcroForm:!1,hasXfa:!1,hasSignatures:!1},Tt=this.catalog.acroForm;if(!Tt)return(0,rt.shadow)(this,"formInfo",$t);try{const Dt=Tt.get("Fields"),Ut=Array.isArray(Dt)&&Dt.length>0;$t.hasFields=Ut;const Vt=Tt.get("XFA");$t.hasXfa=Array.isArray(Vt)&&Vt.length>0||Vt instanceof ut.BaseStream&&!Vt.isEmpty;const qt=!!(Tt.get("SigFlags")&1),Zt=qt&&this._hasOnlyDocumentSignatures(Dt);$t.hasAcroForm=Ut&&!Zt,$t.hasSignatures=qt}catch(Dt){if(Dt instanceof lt.MissingDataException)throw Dt;(0,rt.warn)(`Cannot fetch form information: "${Dt}".`)}return(0,rt.shadow)(this,"formInfo",$t)}get documentInfo(){const $t={PDFFormatVersion:this.version,Language:this.catalog.lang,EncryptFilterName:this.xref.encrypt?this.xref.encrypt.filterName:null,IsLinearized:!!this.linearization,IsAcroFormPresent:this.formInfo.hasAcroForm,IsXFAPresent:this.formInfo.hasXfa,IsCollectionPresent:!!this.catalog.collection,IsSignaturesPresent:this.formInfo.hasSignatures};let Tt;try{Tt=this.xref.trailer.get("Info")}catch(Dt){if(Dt instanceof lt.MissingDataException)throw Dt;(0,rt.info)("The document information dictionary is invalid.")}if(!(Tt instanceof et.Dict))return(0,rt.shadow)(this,"documentInfo",$t);for(const Dt of Tt.getKeys()){const Ut=Tt.get(Dt);switch(Dt){case"Title":case"Author":case"Subject":case"Keywords":case"Creator":case"Producer":case"CreationDate":case"ModDate":if(typeof Ut=="string"){$t[Dt]=(0,rt.stringToPDFString)(Ut);continue}break;case"Trapped":if(Ut instanceof et.Name){$t[Dt]=Ut;continue}break;default:let Vt;switch(typeof Ut){case"string":Vt=(0,rt.stringToPDFString)(Ut);break;case"number":case"boolean":Vt=Ut;break;default:Ut instanceof et.Name&&(Vt=Ut);break}if(Vt===void 0){(0,rt.warn)(`Bad value, for custom key "${Dt}", in Info: ${Ut}.`);continue}$t.Custom||($t.Custom=Object.create(null)),$t.Custom[Dt]=Vt;continue}(0,rt.warn)(`Bad value, for key "${Dt}", in Info: ${Ut}.`)}return(0,rt.shadow)(this,"documentInfo",$t)}get fingerprints(){function $t(Qt){return typeof Qt=="string"&&Qt.length>0&&Qt!==kt}function Tt(Qt){const qt=[];for(const Zt of Qt){const ar=Zt.toString(16);qt.push(ar.padStart(2,"0"))}return qt.join("")}const Dt=this.xref.trailer.get("ID");let Ut,Vt;return Array.isArray(Dt)&&$t(Dt[0])?(Ut=(0,rt.stringToBytes)(Dt[0]),Dt[1]!==Dt[0]&&$t(Dt[1])&&(Vt=(0,rt.stringToBytes)(Dt[1]))):Ut=(0,ft.calculateMD5)(this.stream.getByteRange(0,Rt),0,Rt),(0,rt.shadow)(this,"fingerprints",[Tt(Ut),Vt?Tt(Vt):null])}async _getLinearizationPage($t){const{catalog:Tt,linearization:Dt,xref:Ut}=this,Vt=et.Ref.get(Dt.objectNumberFirst,0);try{const Qt=await Ut.fetchAsync(Vt);if(Qt instanceof et.Dict){let qt=Qt.getRaw("Type");if(qt instanceof et.Ref&&(qt=await Ut.fetchAsync(qt)),(0,et.isName)(qt,"Page")||!Qt.has("Type")&&!Qt.has("Kids"))return Tt.pageKidsCountCache.has(Vt)||Tt.pageKidsCountCache.put(Vt,1),Tt.pageIndexCache.has(Vt)||Tt.pageIndexCache.put(Vt,0),[Qt,Vt]}throw new rt.FormatError("The Linearization dictionary doesn't point to a valid Page dictionary.")}catch(Qt){return(0,rt.warn)(`_getLinearizationPage: "${Qt.message}".`),Tt.getPageDict($t)}}getPage($t){const Tt=this._pagePromises.get($t);if(Tt)return Tt;const{catalog:Dt,linearization:Ut,xfaFactory:Vt}=this;let Qt;return Vt?Qt=Promise.resolve([et.Dict.empty,null]):(Ut==null?void 0:Ut.pageFirst)===$t?Qt=this._getLinearizationPage($t):Qt=Dt.getPageDict($t),Qt=Qt.then(qt=>{let[Zt,ar]=qt;return new wt({pdfManager:this.pdfManager,xref:this.xref,pageIndex:$t,pageDict:Zt,ref:ar,globalIdFactory:this._globalIdFactory,fontCache:Dt.fontCache,builtInCMapCache:Dt.builtInCMapCache,standardFontDataCache:Dt.standardFontDataCache,globalImageCache:Dt.globalImageCache,systemFontCache:Dt.systemFontCache,nonBlendModesSet:Dt.nonBlendModesSet,xfaFactory:Vt})}),this._pagePromises.set($t,Qt),Qt}async checkFirstPage(){if(!(arguments.length>0&&arguments[0]!==void 0&&arguments[0]))try{await this.getPage(0)}catch(Tt){if(Tt instanceof lt.XRefEntryException)throw this._pagePromises.delete(0),await this.cleanup(),new lt.XRefParseException}}async checkLastPage(){let $t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;const{catalog:Tt,pdfManager:Dt}=this;Tt.setActualNumPages();let Ut;try{if(await Promise.all([Dt.ensureDoc("xfaFactory"),Dt.ensureDoc("linearization"),Dt.ensureCatalog("numPages")]),this.xfaFactory)return;if(this.linearization?Ut=this.linearization.numPages:Ut=Tt.numPages,Number.isInteger(Ut)){if(Ut<=1)return}else throw new rt.FormatError("Page count is not an integer.");await this.getPage(Ut-1)}catch(Vt){if(this._pagePromises.delete(Ut-1),await this.cleanup(),Vt instanceof lt.XRefEntryException&&!$t)throw new lt.XRefParseException;(0,rt.warn)(`checkLastPage - invalid /Pages tree /Count: ${Ut}.`);let Qt;try{Qt=await Tt.getAllPageDicts($t)}catch(qt){if(qt instanceof lt.XRefEntryException&&!$t)throw new lt.XRefParseException;Tt.setActualNumPages(1);return}for(const[qt,[Zt,ar]]of Qt){let Jt;Zt instanceof Error?(Jt=Promise.reject(Zt),Jt.catch(()=>{})):Jt=Promise.resolve(new wt({pdfManager:Dt,xref:this.xref,pageIndex:qt,pageDict:Zt,ref:ar,globalIdFactory:this._globalIdFactory,fontCache:Tt.fontCache,builtInCMapCache:Tt.builtInCMapCache,standardFontDataCache:Tt.standardFontDataCache,globalImageCache:Tt.globalImageCache,systemFontCache:Tt.systemFontCache,nonBlendModesSet:Tt.nonBlendModesSet,xfaFactory:null})),this._pagePromises.set(qt,Jt)}Tt.setActualNumPages(Qt.size)}}fontFallback($t,Tt){return this.catalog.fontFallback($t,Tt)}async cleanup(){let $t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return this.catalog?this.catalog.cleanup($t):(0,dt.clearGlobalCaches)()}get fieldObjects(){if(!this.formInfo.hasFields)return(0,rt.shadow)(this,"fieldObjects",Promise.resolve(null));const $t=this.pdfManager.ensureDoc("annotationGlobals").then(async Tt=>{if(!Tt)return null;const Dt=Object.create(null),Ut=new Map;for(const Qt of this.catalog.acroForm.get("Fields"))Ur(this,Nt,Cs).call(this,"",Qt,Ut,Tt);const Vt=[];for(const[Qt,qt]of Ut)Vt.push(Promise.all(qt).then(Zt=>{Zt=Zt.filter(ar=>!!ar),Zt.length>0&&(Dt[Qt]=Zt)}));return await Promise.all(Vt),Dt});return(0,rt.shadow)(this,"fieldObjects",$t)}get hasJSActions(){const $t=this.pdfManager.ensureDoc("_parseHasJSActions");return(0,rt.shadow)(this,"hasJSActions",$t)}async _parseHasJSActions(){const[$t,Tt]=await Promise.all([this.pdfManager.ensureCatalog("jsActions"),this.pdfManager.ensureDoc("fieldObjects")]);return $t?!0:Tt?Object.values(Tt).some(Dt=>Dt.some(Ut=>Ut.actions!==null)):!1}get calculationOrderIds(){const $t=this.catalog.acroForm;if(!($t!=null&&$t.has("CO")))return(0,rt.shadow)(this,"calculationOrderIds",null);const Tt=$t.get("CO");if(!Array.isArray(Tt)||Tt.length===0)return(0,rt.shadow)(this,"calculationOrderIds",null);const Dt=[];for(const Ut of Tt)Ut instanceof et.Ref&&Dt.push(Ut.toString());return Dt.length===0?(0,rt.shadow)(this,"calculationOrderIds",null):(0,rt.shadow)(this,"calculationOrderIds",Dt)}get annotationGlobals(){return(0,rt.shadow)(this,"annotationGlobals",st.AnnotationFactory.createGlobals(this.pdfManager))}}Nt=new WeakSet,Cs=function($t,Tt,Dt,Ut){const Vt=this.xref.fetchIfRef(Tt);if(Vt.has("T")){const Qt=(0,rt.stringToPDFString)(Vt.get("T"));$t=$t===""?Qt:`${$t}.${Qt}`}if(Dt.has($t)||Dt.set($t,[]),Dt.get($t).push(st.AnnotationFactory.create(this.xref,Tt,Ut,this._localIdFactory,!0,null).then(Qt=>Qt==null?void 0:Qt.getFieldObject()).catch(function(Qt){return(0,rt.warn)(`#collectFieldObjects: "${Qt}".`),null})),Vt.has("Kids"))for(const Qt of Vt.get("Kids"))Ur(this,Nt,Cs).call(this,$t,Qt,Dt,Ut)},at.PDFDocument=Ht},(nt,at,ot)=>{Object.defineProperty(at,"__esModule",{value:!0}),at.PopupAnnotation=at.MarkupAnnotation=at.AnnotationFactory=at.AnnotationBorderStyle=at.Annotation=void 0,at.getQuadPoints=St,ot(140),ot(84),ot(93),ot(94),ot(97),ot(99),ot(101),ot(105),ot(108),ot(115),ot(158),ot(160);var rt=ot(145),st=ot(150),lt=ot(162),et=ot(151),it=ot(155),ut=ot(152),ft=ot(211),ht=ot(217),dt=ot(163),gt=ot(220),pt=ot(177),mt=ot(227),ct=ot(215),vt=ot(224),At=ot(228);class xt{static createGlobals(Yt){return Promise.all([Yt.ensureCatalog("acroForm"),Yt.ensureDoc("xfaDatasets"),Yt.ensureCatalog("structTreeRoot"),Yt.ensureCatalog("baseUrl"),Yt.ensureCatalog("attachments")]).then(Kt=>{let[nr,tr,ir,sr,cr]=Kt;return{pdfManager:Yt,acroForm:nr instanceof et.Dict?nr:et.Dict.empty,xfaDatasets:tr,structTreeRoot:ir,baseUrl:sr,attachments:cr}},Kt=>((0,rt.warn)(`createGlobals: "${Kt}".`),null))}static async create(Yt,Kt,nr,tr,ir,sr){const cr=ir?await this._getPageIndex(Yt,Kt,nr.pdfManager):null;return nr.pdfManager.ensure(this,"_create",[Yt,Kt,nr,tr,ir,cr,sr])}static _create(Yt,Kt,nr,tr){let ir=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,sr=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,cr=arguments.length>6&&arguments[6]!==void 0?arguments[6]:null;const or=Yt.fetchIfRef(Kt);if(!(or instanceof et.Dict))return;const{acroForm:Xt,pdfManager:Gt}=nr,Wt=Kt instanceof et.Ref?Kt.toString():`annot_${tr.createObjId()}`;let er=or.get("Subtype");er=er instanceof et.Name?er.name:null;const lr={xref:Yt,ref:Kt,dict:or,subtype:er,id:Wt,annotationGlobals:nr,collectFields:ir,needAppearances:!ir&&Xt.get("NeedAppearances")===!0,pageIndex:sr,evaluatorOptions:Gt.evaluatorOptions,pageRef:cr};switch(er){case"Link":return new Ht(lr);case"Text":return new jt(lr);case"Widget":let ur=(0,st.getInheritableProperty)({dict:or,key:"FT"});switch(ur=ur instanceof et.Name?ur.name:null,ur){case"Tx":return new It(lr);case"Btn":return new yt(lr);case"Ch":return new Rt(lr);case"Sig":return new kt(lr)}return(0,rt.warn)(`Unimplemented widget field type "${ur}", falling back to base field type.`),new Ct(lr);case"Popup":return new Ft(lr);case"FreeText":return new _t(lr);case"Line":return new Nt(lr);case"Square":return new Mt(lr);case"Circle":return new Lt(lr);case"PolyLine":return new $t(lr);case"Polygon":return new Tt(lr);case"Caret":return new Dt(lr);case"Ink":return new Ut(lr);case"Highlight":return new Vt(lr);case"Underline":return new Qt(lr);case"Squiggly":return new qt(lr);case"StrikeOut":return new Zt(lr);case"Stamp":return new ar(lr);case"FileAttachment":return new Jt(lr);default:return ir||(er?(0,rt.warn)(`Unimplemented annotation type "${er}", falling back to base annotation.`):(0,rt.warn)("Annotation is missing the required /Subtype.")),new Ot(lr)}}static async _getPageIndex(Yt,Kt,nr){try{const tr=await Yt.fetchIfRefAsync(Kt);if(!(tr instanceof et.Dict))return-1;const ir=tr.getRaw("P");if(ir instanceof et.Ref)try{return await nr.ensureCatalog("getPageIndex",[ir])}catch(cr){(0,rt.info)(`_getPageIndex -- not a valid page reference: "${cr}".`)}if(tr.has("Kids"))return-1;const sr=await nr.ensureDoc("numPages");for(let cr=0;cr<sr;cr++){const or=await nr.getPage(cr),Xt=await nr.ensure(or,"annotations");for(const Gt of Xt)if(Gt instanceof et.Ref&&(0,et.isRefsEqual)(Gt,Kt))return cr}}catch(tr){(0,rt.warn)(`_getPageIndex: "${tr}".`)}return-1}static generateImages(Yt,Kt,nr){if(!nr)return(0,rt.warn)("generateImages: OffscreenCanvas is not supported, cannot save or print some annotations with images."),null;let tr;for(const{bitmapId:ir,bitmap:sr}of Yt)sr&&(tr||(tr=new Map),tr.set(ir,ar.createImage(sr,Kt)));return tr}static async saveNewAnnotations(Yt,Kt,nr,tr){const ir=Yt.xref;let sr;const cr=[],or=[],{isOffscreenCanvasSupported:Xt}=Yt.options;for(const Gt of nr)if(!Gt.deleted)switch(Gt.annotationType){case rt.AnnotationEditorType.FREETEXT:if(!sr){const er=new et.Dict(ir);er.set("BaseFont",et.Name.get("Helvetica")),er.set("Type",et.Name.get("Font")),er.set("Subtype",et.Name.get("Type1")),er.set("Encoding",et.Name.get("WinAnsiEncoding"));const lr=[];sr=ir.getNewTemporaryRef(),await(0,vt.writeObject)(sr,er,lr,ir),cr.push({ref:sr,data:lr.join("")})}or.push(_t.createNewAnnotation(ir,Gt,cr,{evaluator:Yt,task:Kt,baseFontRef:sr}));break;case rt.AnnotationEditorType.INK:or.push(Ut.createNewAnnotation(ir,Gt,cr));break;case rt.AnnotationEditorType.STAMP:if(!Xt)break;const Wt=await tr.get(Gt.bitmapId);if(Wt.imageStream){const{imageStream:er,smaskStream:lr}=Wt,ur=[];if(lr){const yr=ir.getNewTemporaryRef();await(0,vt.writeObject)(yr,lr,ur,ir),cr.push({ref:yr,data:ur.join("")}),er.dict.set("SMask",yr),ur.length=0}const pr=Wt.imageRef=ir.getNewTemporaryRef();await(0,vt.writeObject)(pr,er,ur,ir),cr.push({ref:pr,data:ur.join("")}),Wt.imageStream=Wt.smaskStream=null}or.push(ar.createNewAnnotation(ir,Gt,cr,{image:Wt}));break}return{annotations:await Promise.all(or),dependencies:cr}}static async printNewAnnotations(Yt,Kt,nr,tr,ir){if(!tr)return null;const{options:sr,xref:cr}=Kt,or=[];for(const Xt of tr)if(!Xt.deleted)switch(Xt.annotationType){case rt.AnnotationEditorType.FREETEXT:or.push(_t.createNewPrintAnnotation(Yt,cr,Xt,{evaluator:Kt,task:nr,evaluatorOptions:sr}));break;case rt.AnnotationEditorType.INK:or.push(Ut.createNewPrintAnnotation(Yt,cr,Xt,{evaluatorOptions:sr}));break;case rt.AnnotationEditorType.STAMP:if(!sr.isOffscreenCanvasSupported)break;const Gt=await ir.get(Xt.bitmapId);if(Gt.imageStream){const{imageStream:Wt,smaskStream:er}=Gt;er&&Wt.dict.set("SMask",er),Gt.imageRef=new pt.JpegStream(Wt,Wt.length),Gt.imageStream=Gt.smaskStream=null}or.push(ar.createNewPrintAnnotation(Yt,cr,Xt,{image:Gt,evaluatorOptions:sr}));break}return Promise.all(or)}}at.AnnotationFactory=xt;function bt(rr){let Yt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:new Uint8ClampedArray(3);if(!Array.isArray(rr))return Yt;const Kt=Yt||new Uint8ClampedArray(3);switch(rr.length){case 0:return null;case 1:return dt.ColorSpace.singletons.gray.getRgbItem(rr,0,Kt,0),Kt;case 3:return dt.ColorSpace.singletons.rgb.getRgbItem(rr,0,Kt,0),Kt;case 4:return dt.ColorSpace.singletons.cmyk.getRgbItem(rr,0,Kt,0),Kt;default:return Yt}}function Et(rr){return Array.from(rr,Yt=>Yt/255)}function St(rr,Yt){const Kt=rr.getArray("QuadPoints");if(!Array.isArray(Kt)||Kt.length===0||Kt.length%8>0)return null;const nr=[];for(let tr=0,ir=Kt.length/8;tr<ir;tr++){let sr=1/0,cr=-1/0,or=1/0,Xt=-1/0;for(let Gt=tr*8,Wt=tr*8+8;Gt<Wt;Gt+=2){const er=Kt[Gt],lr=Kt[Gt+1];sr=Math.min(er,sr),cr=Math.max(er,cr),or=Math.min(lr,or),Xt=Math.max(lr,Xt)}if(Yt!==null&&(sr<Yt[0]||cr>Yt[2]||or<Yt[1]||Xt>Yt[3]))return null;nr.push([{x:sr,y:Xt},{x:cr,y:Xt},{x:sr,y:or},{x:cr,y:or}])}return nr}function Bt(rr,Yt,Kt){const[nr,tr,ir,sr]=rt.Util.getAxialAlignedBoundingBox(Yt,Kt);if(nr===ir||tr===sr)return[1,0,0,1,rr[0],rr[1]];const cr=(rr[2]-rr[0])/(ir-nr),or=(rr[3]-rr[1])/(sr-tr);return[cr,0,0,or,rr[0]-nr*cr,rr[1]-tr*or]}class Ot{constructor(Yt){const{dict:Kt,xref:nr,annotationGlobals:tr}=Yt;this.setTitle(Kt.get("T")),this.setContents(Kt.get("Contents")),this.setModificationDate(Kt.get("M")),this.setFlags(Kt.get("F")),this.setRectangle(Kt.getArray("Rect")),this.setColor(Kt.getArray("C")),this.setBorderStyle(Kt),this.setAppearance(Kt),this.setOptionalContent(Kt);const ir=Kt.get("MK");this.setBorderAndBackgroundColors(ir),this.setRotation(ir,Kt),this.ref=Yt.ref instanceof et.Ref?Yt.ref:null,this._streams=[],this.appearance&&this._streams.push(this.appearance);const sr=!!(this.flags&rt.AnnotationFlag.LOCKED),cr=!!(this.flags&rt.AnnotationFlag.LOCKEDCONTENTS);if(tr.structTreeRoot){let or=Kt.get("StructParent");or=Number.isInteger(or)&&or>=0?or:-1,tr.structTreeRoot.addAnnotationIdToPage(Yt.pageRef,or)}if(this.data={annotationFlags:this.flags,borderStyle:this.borderStyle,color:this.color,backgroundColor:this.backgroundColor,borderColor:this.borderColor,rotation:this.rotation,contentsObj:this._contents,hasAppearance:!!this.appearance,id:Yt.id,modificationDate:this.modificationDate,rect:this.rectangle,subtype:Yt.subtype,hasOwnCanvas:!1,noRotate:!!(this.flags&rt.AnnotationFlag.NOROTATE),noHTML:sr&&cr},Yt.collectFields){const or=Kt.get("Kids");if(Array.isArray(or)){const Xt=[];for(const Gt of or)Gt instanceof et.Ref&&Xt.push(Gt.toString());Xt.length!==0&&(this.data.kidIds=Xt)}this.data.actions=(0,st.collectActions)(nr,Kt,rt.AnnotationActionEventType),this.data.fieldName=this._constructFieldName(Kt),this.data.pageIndex=Yt.pageIndex}this._isOffscreenCanvasSupported=Yt.evaluatorOptions.isOffscreenCanvasSupported,this._fallbackFontDict=null,this._needAppearances=!1}_hasFlag(Yt,Kt){return!!(Yt&Kt)}_isViewable(Yt){return!this._hasFlag(Yt,rt.AnnotationFlag.INVISIBLE)&&!this._hasFlag(Yt,rt.AnnotationFlag.NOVIEW)}_isPrintable(Yt){return this._hasFlag(Yt,rt.AnnotationFlag.PRINT)&&!this._hasFlag(Yt,rt.AnnotationFlag.HIDDEN)&&!this._hasFlag(Yt,rt.AnnotationFlag.INVISIBLE)}mustBeViewed(Yt,Kt){var tr;const nr=(tr=Yt==null?void 0:Yt.get(this.data.id))==null?void 0:tr.noView;return nr!==void 0?!nr:this.viewable&&!this._hasFlag(this.flags,rt.AnnotationFlag.HIDDEN)}mustBePrinted(Yt){var nr;const Kt=(nr=Yt==null?void 0:Yt.get(this.data.id))==null?void 0:nr.noPrint;return Kt!==void 0?!Kt:this.printable}get viewable(){return this.data.quadPoints===null?!1:this.flags===0?!0:this._isViewable(this.flags)}get printable(){return this.data.quadPoints===null||this.flags===0?!1:this._isPrintable(this.flags)}_parseStringHelper(Yt){const Kt=typeof Yt=="string"?(0,rt.stringToPDFString)(Yt):"",nr=Kt&&(0,ft.bidi)(Kt).dir==="rtl"?"rtl":"ltr";return{str:Kt,dir:nr}}setDefaultAppearance(Yt){const{dict:Kt,annotationGlobals:nr}=Yt,tr=(0,st.getInheritableProperty)({dict:Kt,key:"DA"})||nr.acroForm.get("DA");this._defaultAppearance=typeof tr=="string"?tr:"",this.data.defaultAppearanceData=(0,lt.parseDefaultAppearance)(this._defaultAppearance)}setTitle(Yt){this._title=this._parseStringHelper(Yt)}setContents(Yt){this._contents=this._parseStringHelper(Yt)}setModificationDate(Yt){this.modificationDate=typeof Yt=="string"?Yt:null}setFlags(Yt){this.flags=Number.isInteger(Yt)&&Yt>0?Yt:0}hasFlag(Yt){return this._hasFlag(this.flags,Yt)}setRectangle(Yt){this.rectangle=Array.isArray(Yt)&&Yt.length===4?rt.Util.normalizeRect(Yt):[0,0,0,0]}setColor(Yt){this.color=bt(Yt)}setLineEndings(Yt){if(this.lineEndings=["None","None"],Array.isArray(Yt)&&Yt.length===2)for(let Kt=0;Kt<2;Kt++){const nr=Yt[Kt];if(nr instanceof et.Name)switch(nr.name){case"None":continue;case"Square":case"Circle":case"Diamond":case"OpenArrow":case"ClosedArrow":case"Butt":case"ROpenArrow":case"RClosedArrow":case"Slash":this.lineEndings[Kt]=nr.name;continue}(0,rt.warn)(`Ignoring invalid lineEnding: ${nr}`)}}setRotation(Yt,Kt){this.rotation=0;let nr=Yt instanceof et.Dict?Yt.get("R")||0:Kt.get("Rotate")||0;Number.isInteger(nr)&&nr!==0&&(nr%=360,nr<0&&(nr+=360),nr%90===0&&(this.rotation=nr))}setBorderAndBackgroundColors(Yt){Yt instanceof et.Dict?(this.borderColor=bt(Yt.getArray("BC"),null),this.backgroundColor=bt(Yt.getArray("BG"),null)):this.borderColor=this.backgroundColor=null}setBorderStyle(Yt){if(this.borderStyle=new Pt,Yt instanceof et.Dict)if(Yt.has("BS")){const Kt=Yt.get("BS"),nr=Kt.get("Type");(!nr||(0,et.isName)(nr,"Border"))&&(this.borderStyle.setWidth(Kt.get("W"),this.rectangle),this.borderStyle.setStyle(Kt.get("S")),this.borderStyle.setDashArray(Kt.getArray("D")))}else if(Yt.has("Border")){const Kt=Yt.getArray("Border");Array.isArray(Kt)&&Kt.length>=3&&(this.borderStyle.setHorizontalCornerRadius(Kt[0]),this.borderStyle.setVerticalCornerRadius(Kt[1]),this.borderStyle.setWidth(Kt[2],this.rectangle),Kt.length===4&&this.borderStyle.setDashArray(Kt[3],!0))}else this.borderStyle.setWidth(0)}setAppearance(Yt){this.appearance=null;const Kt=Yt.get("AP");if(!(Kt instanceof et.Dict))return;const nr=Kt.get("N");if(nr instanceof ut.BaseStream){this.appearance=nr;return}if(!(nr instanceof et.Dict))return;const tr=Yt.get("AS");if(!(tr instanceof et.Name)||!nr.has(tr.name))return;const ir=nr.get(tr.name);ir instanceof ut.BaseStream&&(this.appearance=ir)}setOptionalContent(Yt){this.oc=null;const Kt=Yt.get("OC");Kt instanceof et.Name?(0,rt.warn)("setOptionalContent: Support for /Name-entry is not implemented."):Kt instanceof et.Dict&&(this.oc=Kt)}loadResources(Yt,Kt){return Kt.dict.getAsync("Resources").then(nr=>nr?new mt.ObjectLoader(nr,Yt,nr.xref).load().then(function(){return nr}):void 0)}async getOperatorList(Yt,Kt,nr,tr,ir){const sr=this.data;let cr=this.appearance;const or=!!(this.data.hasOwnCanvas&&nr&rt.RenderingIntentFlag.DISPLAY);if(!cr){if(!or)return{opList:new ct.OperatorList,separateForm:!1,separateCanvas:!1};cr=new it.StringStream(""),cr.dict=new et.Dict}const Xt=cr.dict,Gt=await this.loadResources(["ExtGState","ColorSpace","Pattern","Shading","XObject","Font"],cr),Wt=Xt.getArray("BBox")||[0,0,1,1],er=Xt.getArray("Matrix")||[1,0,0,1,0,0],lr=Bt(sr.rect,Wt,er),ur=new ct.OperatorList;let pr;return this.oc&&(pr=await Yt.parseMarkedContentProps(this.oc,null)),pr!==void 0&&ur.addOp(rt.OPS.beginMarkedContentProps,["OC",pr]),ur.addOp(rt.OPS.beginAnnotation,[sr.id,sr.rect,lr,er,or]),await Yt.getOperatorList({stream:cr,task:Kt,resources:Gt,operatorList:ur,fallbackFontDict:this._fallbackFontDict}),ur.addOp(rt.OPS.endAnnotation,[]),pr!==void 0&&ur.addOp(rt.OPS.endMarkedContent,[]),this.reset(),{opList:ur,separateForm:!1,separateCanvas:or}}async save(Yt,Kt,nr){return null}get hasTextContent(){return!1}async extractTextContent(Yt,Kt,nr){if(!this.appearance)return;const tr=await this.loadResources(["ExtGState","Font","Properties","XObject"],this.appearance),ir=[],sr=[];let cr=null;const or={desiredSize:Math.Infinity,ready:!0,enqueue(Xt,Gt){for(const Wt of Xt.items)Wt.str!==void 0&&(cr||(cr=Wt.transform.slice(-2)),sr.push(Wt.str),Wt.hasEOL&&(ir.push(sr.join("")),sr.length=0))}};if(await Yt.getTextContent({stream:this.appearance,task:Kt,resources:tr,includeMarkedContent:!0,sink:or,viewBox:nr}),this.reset(),sr.length&&ir.push(sr.join("")),ir.length>1||ir[0]){const Xt=this.appearance.dict,Gt=Xt.getArray("BBox")||[0,0,1,1],Wt=Xt.getArray("Matrix")||[1,0,0,1,0,0],er=this.data.rect,lr=Bt(er,Gt,Wt);lr[4]-=er[0],lr[5]-=er[1],cr=rt.Util.applyTransform(cr,lr),cr=rt.Util.applyTransform(cr,Wt),this.data.textPosition=cr,this.data.textContent=ir}}getFieldObject(){return this.data.kidIds?{id:this.data.id,actions:this.data.actions,name:this.data.fieldName,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,type:"",kidIds:this.data.kidIds,page:this.data.pageIndex,rotation:this.rotation}:null}reset(){for(const Yt of this._streams)Yt.reset()}_constructFieldName(Yt){if(!Yt.has("T")&&!Yt.has("Parent"))return(0,rt.warn)("Unknown field name, falling back to empty field name."),"";if(!Yt.has("Parent"))return(0,rt.stringToPDFString)(Yt.get("T"));const Kt=[];Yt.has("T")&&Kt.unshift((0,rt.stringToPDFString)(Yt.get("T")));let nr=Yt;const tr=new et.RefSet;for(Yt.objId&&tr.put(Yt.objId);nr.has("Parent")&&(nr=nr.get("Parent"),!(!(nr instanceof et.Dict)||nr.objId&&tr.has(nr.objId)));)nr.objId&&tr.put(nr.objId),nr.has("T")&&Kt.unshift((0,rt.stringToPDFString)(nr.get("T")));return Kt.join(".")}}at.Annotation=Ot;class Pt{constructor(){this.width=1,this.style=rt.AnnotationBorderStyleType.SOLID,this.dashArray=[3],this.horizontalCornerRadius=0,this.verticalCornerRadius=0}setWidth(Yt){let Kt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,0,0,0];if(Yt instanceof et.Name){this.width=0;return}if(typeof Yt=="number"){if(Yt>0){const nr=(Kt[2]-Kt[0])/2,tr=(Kt[3]-Kt[1])/2;nr>0&&tr>0&&(Yt>nr||Yt>tr)&&((0,rt.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${Yt}`),Yt=1)}this.width=Yt}}setStyle(Yt){if(Yt instanceof et.Name)switch(Yt.name){case"S":this.style=rt.AnnotationBorderStyleType.SOLID;break;case"D":this.style=rt.AnnotationBorderStyleType.DASHED;break;case"B":this.style=rt.AnnotationBorderStyleType.BEVELED;break;case"I":this.style=rt.AnnotationBorderStyleType.INSET;break;case"U":this.style=rt.AnnotationBorderStyleType.UNDERLINE;break}}setDashArray(Yt){let Kt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(Array.isArray(Yt)&&Yt.length>0){let nr=!0,tr=!0;for(const ir of Yt)if(+ir>=0)ir>0&&(tr=!1);else{nr=!1;break}nr&&!tr?(this.dashArray=Yt,Kt&&this.setStyle(et.Name.get("D"))):this.width=0}else Yt&&(this.width=0)}setHorizontalCornerRadius(Yt){Number.isInteger(Yt)&&(this.horizontalCornerRadius=Yt)}setVerticalCornerRadius(Yt){Number.isInteger(Yt)&&(this.verticalCornerRadius=Yt)}}at.AnnotationBorderStyle=Pt;class wt extends Ot{constructor(Yt){super(Yt);const{dict:Kt}=Yt;if(Kt.has("IRT")){const tr=Kt.getRaw("IRT");this.data.inReplyTo=tr instanceof et.Ref?tr.toString():null;const ir=Kt.get("RT");this.data.replyType=ir instanceof et.Name?ir.name:rt.AnnotationReplyType.REPLY}let nr=null;if(this.data.replyType===rt.AnnotationReplyType.GROUP){const tr=Kt.get("IRT");this.setTitle(tr.get("T")),this.data.titleObj=this._title,this.setContents(tr.get("Contents")),this.data.contentsObj=this._contents,tr.has("CreationDate")?(this.setCreationDate(tr.get("CreationDate")),this.data.creationDate=this.creationDate):this.data.creationDate=null,tr.has("M")?(this.setModificationDate(tr.get("M")),this.data.modificationDate=this.modificationDate):this.data.modificationDate=null,nr=tr.getRaw("Popup"),tr.has("C")?(this.setColor(tr.getArray("C")),this.data.color=this.color):this.data.color=null}else this.data.titleObj=this._title,this.setCreationDate(Kt.get("CreationDate")),this.data.creationDate=this.creationDate,nr=Kt.getRaw("Popup"),Kt.has("C")||(this.data.color=null);this.data.popupRef=nr instanceof et.Ref?nr.toString():null,Kt.has("RC")&&(this.data.richText=At.XFAFactory.getRichTextAsHtml(Kt.get("RC")))}setCreationDate(Yt){this.creationDate=typeof Yt=="string"?Yt:null}_setDefaultAppearance(Yt){let{xref:Kt,extra:nr,strokeColor:tr,fillColor:ir,blendMode:sr,strokeAlpha:cr,fillAlpha:or,pointsCallback:Xt}=Yt,Gt=Number.MAX_VALUE,Wt=Number.MAX_VALUE,er=Number.MIN_VALUE,lr=Number.MIN_VALUE;const ur=["q"];nr&&ur.push(nr),tr&&ur.push(`${tr[0]} ${tr[1]} ${tr[2]} RG`),ir&&ur.push(`${ir[0]} ${ir[1]} ${ir[2]} rg`);let pr=this.data.quadPoints;pr||(pr=[[{x:this.rectangle[0],y:this.rectangle[3]},{x:this.rectangle[2],y:this.rectangle[3]},{x:this.rectangle[0],y:this.rectangle[1]},{x:this.rectangle[2],y:this.rectangle[1]}]]);for(const hr of pr){const[vr,xr,Pr,Rr]=Xt(ur,hr);Gt=Math.min(Gt,vr),er=Math.max(er,xr),Wt=Math.min(Wt,Pr),lr=Math.max(lr,Rr)}ur.push("Q");const yr=new et.Dict(Kt),Er=new et.Dict(Kt);Er.set("Subtype",et.Name.get("Form"));const br=new it.StringStream(ur.join(" "));br.dict=Er,yr.set("Fm0",br);const gr=new et.Dict(Kt);sr&&gr.set("BM",et.Name.get(sr)),typeof cr=="number"&&gr.set("CA",cr),typeof or=="number"&&gr.set("ca",or);const Ar=new et.Dict(Kt);Ar.set("GS0",gr);const Sr=new et.Dict(Kt);Sr.set("ExtGState",Ar),Sr.set("XObject",yr);const Br=new et.Dict(Kt);Br.set("Resources",Sr);const Ir=this.data.rect=[Gt,Wt,er,lr];Br.set("BBox",Ir),this.appearance=new it.StringStream("/GS0 gs /Fm0 Do"),this.appearance.dict=Br,this._streams.push(this.appearance,br)}static async createNewAnnotation(Yt,Kt,nr,tr){const ir=Kt.ref||(Kt.ref=Yt.getNewTemporaryRef()),sr=await this.createNewAppearanceStream(Kt,Yt,tr),cr=[];let or;if(sr){const Xt=Yt.getNewTemporaryRef();or=this.createNewDict(Kt,Yt,{apRef:Xt}),await(0,vt.writeObject)(Xt,sr,cr,Yt),nr.push({ref:Xt,data:cr.join("")})}else or=this.createNewDict(Kt,Yt,{});return Number.isInteger(Kt.parentTreeId)&&or.set("StructParent",Kt.parentTreeId),cr.length=0,await(0,vt.writeObject)(ir,or,cr,Yt),{ref:ir,data:cr.join("")}}static async createNewPrintAnnotation(Yt,Kt,nr,tr){const ir=await this.createNewAppearanceStream(nr,Kt,tr),sr=this.createNewDict(nr,Kt,{ap:ir}),cr=new this.prototype.constructor({dict:sr,xref:Kt,annotationGlobals:Yt,evaluatorOptions:tr.evaluatorOptions});return nr.ref&&(cr.ref=cr.refToReplace=nr.ref),cr}}at.MarkupAnnotation=wt;class Ct extends Ot{constructor(Yt){var er;super(Yt);const{dict:Kt,xref:nr,annotationGlobals:tr}=Yt,ir=this.data;this._needAppearances=Yt.needAppearances,ir.annotationType=rt.AnnotationType.WIDGET,ir.fieldName===void 0&&(ir.fieldName=this._constructFieldName(Kt)),ir.actions===void 0&&(ir.actions=(0,st.collectActions)(nr,Kt,rt.AnnotationActionEventType));let sr=(0,st.getInheritableProperty)({dict:Kt,key:"V",getArray:!0});ir.fieldValue=this._decodeFormValue(sr);const cr=(0,st.getInheritableProperty)({dict:Kt,key:"DV",getArray:!0});if(ir.defaultFieldValue=this._decodeFormValue(cr),sr===void 0&&tr.xfaDatasets){const lr=this._title.str;lr&&(this._hasValueFromXFA=!0,ir.fieldValue=sr=tr.xfaDatasets.getValue(lr))}sr===void 0&&ir.defaultFieldValue!==null&&(ir.fieldValue=ir.defaultFieldValue),ir.alternativeText=(0,rt.stringToPDFString)(Kt.get("TU")||""),this.setDefaultAppearance(Yt),ir.hasAppearance||(ir.hasAppearance=this._needAppearances&&ir.fieldValue!==void 0&&ir.fieldValue!==null);const or=(0,st.getInheritableProperty)({dict:Kt,key:"FT"});ir.fieldType=or instanceof et.Name?or.name:null;const Xt=(0,st.getInheritableProperty)({dict:Kt,key:"DR"}),Gt=tr.acroForm.get("DR"),Wt=(er=this.appearance)==null?void 0:er.dict.get("Resources");this._fieldResources={localResources:Xt,acroFormResources:Gt,appearanceResources:Wt,mergedResources:et.Dict.merge({xref:nr,dictArray:[Xt,Wt,Gt],mergeSubDicts:!0})},ir.fieldFlags=(0,st.getInheritableProperty)({dict:Kt,key:"Ff"}),(!Number.isInteger(ir.fieldFlags)||ir.fieldFlags<0)&&(ir.fieldFlags=0),ir.readOnly=this.hasFieldFlag(rt.AnnotationFieldFlag.READONLY),ir.required=this.hasFieldFlag(rt.AnnotationFieldFlag.REQUIRED),ir.hidden=this._hasFlag(ir.annotationFlags,rt.AnnotationFlag.HIDDEN)||this._hasFlag(ir.annotationFlags,rt.AnnotationFlag.NOVIEW)}_decodeFormValue(Yt){return Array.isArray(Yt)?Yt.filter(Kt=>typeof Kt=="string").map(Kt=>(0,rt.stringToPDFString)(Kt)):Yt instanceof et.Name?(0,rt.stringToPDFString)(Yt.name):typeof Yt=="string"?(0,rt.stringToPDFString)(Yt):null}hasFieldFlag(Yt){return!!(this.data.fieldFlags&Yt)}_isViewable(Yt){return!this._hasFlag(Yt,rt.AnnotationFlag.INVISIBLE)}mustBeViewed(Yt,Kt){return Kt?this.viewable:super.mustBeViewed(Yt,Kt)&&!this._hasFlag(this.flags,rt.AnnotationFlag.NOVIEW)}getRotationMatrix(Yt){var ir;let Kt=(ir=Yt==null?void 0:Yt.get(this.data.id))==null?void 0:ir.rotation;if(Kt===void 0&&(Kt=this.rotation),Kt===0)return rt.IDENTITY_MATRIX;const nr=this.data.rect[2]-this.data.rect[0],tr=this.data.rect[3]-this.data.rect[1];return(0,st.getRotationMatrix)(Kt,nr,tr)}getBorderAndBackgroundAppearances(Yt){var cr;let Kt=(cr=Yt==null?void 0:Yt.get(this.data.id))==null?void 0:cr.rotation;if(Kt===void 0&&(Kt=this.rotation),!this.backgroundColor&&!this.borderColor)return"";const nr=this.data.rect[2]-this.data.rect[0],tr=this.data.rect[3]-this.data.rect[1],ir=Kt===0||Kt===180?`0 0 ${nr} ${tr} re`:`0 0 ${tr} ${nr} re`;let sr="";if(this.backgroundColor&&(sr=`${(0,lt.getPdfColor)(this.backgroundColor,!0)} ${ir} f `),this.borderColor){const or=this.borderStyle.width||1;sr+=`${or} w ${(0,lt.getPdfColor)(this.borderColor,!1)} ${ir} S `}return sr}async getOperatorList(Yt,Kt,nr,tr,ir){if(tr&&!(this instanceof kt)&&!this.data.noHTML&&!this.data.hasOwnCanvas)return{opList:new ct.OperatorList,separateForm:!0,separateCanvas:!1};if(!this._hasText)return super.getOperatorList(Yt,Kt,nr,tr,ir);const sr=await this._getAppearance(Yt,Kt,nr,ir);if(this.appearance&&sr===null)return super.getOperatorList(Yt,Kt,nr,tr,ir);const cr=new ct.OperatorList;if(!this._defaultAppearance||sr===null)return{opList:cr,separateForm:!1,separateCanvas:!1};const or=!!(this.data.hasOwnCanvas&&nr&rt.RenderingIntentFlag.DISPLAY),Xt=[1,0,0,1,0,0],Gt=[0,0,this.data.rect[2]-this.data.rect[0],this.data.rect[3]-this.data.rect[1]],Wt=Bt(this.data.rect,Gt,Xt);let er;this.oc&&(er=await Yt.parseMarkedContentProps(this.oc,null)),er!==void 0&&cr.addOp(rt.OPS.beginMarkedContentProps,["OC",er]),cr.addOp(rt.OPS.beginAnnotation,[this.data.id,this.data.rect,Wt,this.getRotationMatrix(ir),or]);const lr=new it.StringStream(sr);return await Yt.getOperatorList({stream:lr,task:Kt,resources:this._fieldResources.mergedResources,operatorList:cr}),cr.addOp(rt.OPS.endAnnotation,[]),er!==void 0&&cr.addOp(rt.OPS.endMarkedContent,[]),{opList:cr,separateForm:!1,separateCanvas:or}}_getMKDict(Yt){const Kt=new et.Dict(null);return Yt&&Kt.set("R",Yt),this.borderColor&&Kt.set("BC",Et(this.borderColor)),this.backgroundColor&&Kt.set("BG",Et(this.backgroundColor)),Kt.size>0?Kt:null}amendSavedDict(Yt,Kt){}async save(Yt,Kt,nr){const tr=nr==null?void 0:nr.get(this.data.id);let ir=tr==null?void 0:tr.value,sr=tr==null?void 0:tr.rotation;if(ir===this.data.fieldValue||ir===void 0){if(!this._hasValueFromXFA&&sr===void 0)return null;ir||(ir=this.data.fieldValue)}if(sr===void 0&&!this._hasValueFromXFA&&Array.isArray(ir)&&Array.isArray(this.data.fieldValue)&&ir.length===this.data.fieldValue.length&&ir.every((Er,br)=>Er===this.data.fieldValue[br]))return null;sr===void 0&&(sr=this.rotation);let cr=null;if(!this._needAppearances&&(cr=await this._getAppearance(Yt,Kt,rt.RenderingIntentFlag.SAVE,nr),cr===null))return null;let or=!1;cr!=null&&cr.needAppearances&&(or=!0,cr=null);const{xref:Xt}=Yt,Gt=Xt.fetchIfRef(this.ref);if(!(Gt instanceof et.Dict))return null;const Wt=new et.Dict(Xt);for(const Er of Gt.getKeys())Er!=="AP"&&Wt.set(Er,Gt.getRaw(Er));const er={path:this.data.fieldName,value:ir},lr=Er=>(0,st.isAscii)(Er)?Er:(0,st.stringToUTF16String)(Er,!0);Wt.set("V",Array.isArray(ir)?ir.map(lr):lr(ir)),this.amendSavedDict(nr,Wt);const ur=this._getMKDict(sr);ur&&Wt.set("MK",ur);const pr=[],yr=[{ref:this.ref,data:"",xfa:er,needAppearances:or}];if(cr!==null){const Er=Xt.getNewTemporaryRef(),br=new et.Dict(Xt);Wt.set("AP",br),br.set("N",Er);const gr=this._getSaveFieldResources(Xt),Ar=new it.StringStream(cr),Sr=Ar.dict=new et.Dict(Xt);Sr.set("Subtype",et.Name.get("Form")),Sr.set("Resources",gr),Sr.set("BBox",[0,0,this.data.rect[2]-this.data.rect[0],this.data.rect[3]-this.data.rect[1]]);const Br=this.getRotationMatrix(nr);Br!==rt.IDENTITY_MATRIX&&Sr.set("Matrix",Br),await(0,vt.writeObject)(Er,Ar,pr,Xt),yr.push({ref:Er,data:pr.join(""),xfa:null,needAppearances:!1}),pr.length=0}return Wt.set("M",`D:${(0,rt.getModificationDate)()}`),await(0,vt.writeObject)(this.ref,Wt,pr,Xt),yr[0].data=pr.join(""),yr}async _getAppearance(Yt,Kt,nr,tr){if(this.hasFieldFlag(rt.AnnotationFieldFlag.PASSWORD))return null;const sr=tr==null?void 0:tr.get(this.data.id);let cr,or;if(sr&&(cr=sr.formattedValue||sr.value,or=sr.rotation),or===void 0&&cr===void 0&&!this._needAppearances&&(!this._hasValueFromXFA||this.appearance))return null;const Xt=this.getBorderAndBackgroundAppearances(tr);if(cr===void 0&&(cr=this.data.fieldValue,!cr))return`/Tx BMC q ${Xt}Q EMC`;if(Array.isArray(cr)&&cr.length===1&&(cr=cr[0]),(0,rt.assert)(typeof cr=="string","Expected `value` to be a string."),cr=cr.trim(),this.data.combo){const Rr=this.data.options.find(Dr=>{let{exportValue:Gr}=Dr;return cr===Gr});cr=(Rr==null?void 0:Rr.displayValue)||cr}if(cr==="")return`/Tx BMC q ${Xt}Q EMC`;or===void 0&&(or=this.rotation);let Gt=-1,Wt;this.data.multiLine?(Wt=cr.split(/\r\n?|\n/).map(Rr=>Rr.normalize("NFC")),Gt=Wt.length):Wt=[cr.replace(/\r\n?|\n/,"").normalize("NFC")];const er=1,lr=2;let ur=this.data.rect[3]-this.data.rect[1],pr=this.data.rect[2]-this.data.rect[0];(or===90||or===270)&&([pr,ur]=[ur,pr]),this._defaultAppearance||(this.data.defaultAppearanceData=(0,lt.parseDefaultAppearance)(this._defaultAppearance="/Helvetica 0 Tf 0 g"));let yr=await Ct._getFontData(Yt,Kt,this.data.defaultAppearanceData,this._fieldResources.mergedResources),Er,br,gr;const Ar=[];let Sr=!1;for(const Rr of Wt){const Dr=yr.encodeString(Rr);Dr.length>1&&(Sr=!0),Ar.push(Dr.join(""))}if(Sr&&nr&rt.RenderingIntentFlag.SAVE)return{needAppearances:!0};if(Sr&&this._isOffscreenCanvasSupported){const Rr=this.data.comb?"monospace":"sans-serif",Dr=new lt.FakeUnicodeFont(Yt.xref,Rr),Gr=Dr.createFontResources(Wt.join("")),Or=Gr.getRaw("Font");if(this._fieldResources.mergedResources.has("Font")){const Tr=this._fieldResources.mergedResources.get("Font");for(const fr of Or.getKeys())Tr.set(fr,Or.getRaw(fr))}else this._fieldResources.mergedResources.set("Font",Or);const Hr=Dr.fontName.name;yr=await Ct._getFontData(Yt,Kt,{fontName:Hr,fontSize:0},Gr);for(let Tr=0,fr=Ar.length;Tr<fr;Tr++)Ar[Tr]=(0,st.stringToUTF16String)(Wt[Tr]);const jr=Object.assign(Object.create(null),this.data.defaultAppearanceData);this.data.defaultAppearanceData.fontSize=0,this.data.defaultAppearanceData.fontName=Hr,[Er,br,gr]=this._computeFontSize(ur-2*er,pr-2*lr,cr,yr,Gt),this.data.defaultAppearanceData=jr}else this._isOffscreenCanvasSupported||(0,rt.warn)("_getAppearance: OffscreenCanvas is not supported, annotation may not render correctly."),[Er,br,gr]=this._computeFontSize(ur-2*er,pr-2*lr,cr,yr,Gt);let Br=yr.descent;isNaN(Br)?Br=rt.BASELINE_FACTOR*gr:Br=Math.max(rt.BASELINE_FACTOR*gr,Math.abs(Br)*br);const Ir=Math.min(Math.floor((ur-br)/2),er),hr=this.data.textAlignment;if(this.data.multiLine)return this._getMultilineAppearance(Er,Ar,yr,br,pr,ur,hr,lr,Ir,Br,gr,tr);if(this.data.comb)return this._getCombAppearance(Er,yr,Ar[0],br,pr,ur,lr,Ir,Br,gr,tr);const vr=Ir+Br;if(hr===0||hr>2)return`/Tx BMC q ${Xt}BT `+Er+` 1 0 0 1 ${(0,st.numberToString)(lr)} ${(0,st.numberToString)(vr)} Tm (${(0,st.escapeString)(Ar[0])}) Tj ET Q EMC`;const xr={shift:0},Pr=this._renderText(Ar[0],yr,br,pr,hr,xr,lr,vr);return`/Tx BMC q ${Xt}BT `+Er+` 1 0 0 1 0 0 Tm ${Pr} ET Q EMC`}static async _getFontData(Yt,Kt,nr,tr){const ir=new ct.OperatorList,sr={font:null,clone(){return this}},{fontName:cr,fontSize:or}=nr;return await Yt.handleSetFont(tr,[cr&&et.Name.get(cr),or],null,ir,Kt,sr,null),sr.font}_getTextWidth(Yt,Kt){return Kt.charsToGlyphs(Yt).reduce((nr,tr)=>nr+tr.width,0)/1e3}_computeFontSize(Yt,Kt,nr,tr,ir){let{fontSize:sr}=this.data.defaultAppearanceData,cr=(sr||12)*rt.LINE_FACTOR,or=Math.round(Yt/cr);if(!sr){const Xt=er=>Math.floor(er*100)/100;if(ir===-1){const er=this._getTextWidth(nr,tr);sr=Xt(Math.min(Yt/rt.LINE_FACTOR,er>Kt?Kt/er:1/0)),or=1}else{const er=nr.split(/\r\n?|\n/),lr=[];for(const pr of er){const yr=tr.encodeString(pr).join(""),Er=tr.charsToGlyphs(yr),br=tr.getCharPositions(yr);lr.push({line:yr,glyphs:Er,positions:br})}const ur=pr=>{let yr=0;for(const Er of lr){const br=this._splitLine(null,tr,pr,Kt,Er);if(yr+=br.length*pr,yr>Yt)return!0}return!1};for(or=Math.max(or,ir);;){if(cr=Yt/or,sr=Xt(cr/rt.LINE_FACTOR),ur(sr)){or++;continue}break}}const{fontName:Gt,fontColor:Wt}=this.data.defaultAppearanceData;this._defaultAppearance=(0,lt.createDefaultAppearance)({fontSize:sr,fontName:Gt,fontColor:Wt})}return[this._defaultAppearance,sr,Yt/or]}_renderText(Yt,Kt,nr,tr,ir,sr,cr,or){let Xt;if(ir===1){const Wt=this._getTextWidth(Yt,Kt)*nr;Xt=(tr-Wt)/2}else if(ir===2){const Wt=this._getTextWidth(Yt,Kt)*nr;Xt=tr-Wt-cr}else Xt=cr;const Gt=(0,st.numberToString)(Xt-sr.shift);return sr.shift=Xt,or=(0,st.numberToString)(or),`${Gt} ${or} Td (${(0,st.escapeString)(Yt)}) Tj`}_getSaveFieldResources(Yt){var sr;const{localResources:Kt,appearanceResources:nr,acroFormResources:tr}=this._fieldResources,ir=(sr=this.data.defaultAppearanceData)==null?void 0:sr.fontName;if(!ir)return Kt||et.Dict.empty;for(const cr of[Kt,nr])if(cr instanceof et.Dict){const or=cr.get("Font");if(or instanceof et.Dict&&or.has(ir))return cr}if(tr instanceof et.Dict){const cr=tr.get("Font");if(cr instanceof et.Dict&&cr.has(ir)){const or=new et.Dict(Yt);or.set(ir,cr.getRaw(ir));const Xt=new et.Dict(Yt);return Xt.set("Font",or),et.Dict.merge({xref:Yt,dictArray:[Xt,Kt],mergeSubDicts:!0})}}return Kt||et.Dict.empty}getFieldObject(){return null}}class It extends Ct{constructor(Yt){super(Yt),this.data.hasOwnCanvas=this.data.readOnly&&!this.data.noHTML,this._hasText=!0;const Kt=Yt.dict;typeof this.data.fieldValue!="string"&&(this.data.fieldValue="");let nr=(0,st.getInheritableProperty)({dict:Kt,key:"Q"});(!Number.isInteger(nr)||nr<0||nr>2)&&(nr=null),this.data.textAlignment=nr;let tr=(0,st.getInheritableProperty)({dict:Kt,key:"MaxLen"});(!Number.isInteger(tr)||tr<0)&&(tr=0),this.data.maxLen=tr,this.data.multiLine=this.hasFieldFlag(rt.AnnotationFieldFlag.MULTILINE),this.data.comb=this.hasFieldFlag(rt.AnnotationFieldFlag.COMB)&&!this.hasFieldFlag(rt.AnnotationFieldFlag.MULTILINE)&&!this.hasFieldFlag(rt.AnnotationFieldFlag.PASSWORD)&&!this.hasFieldFlag(rt.AnnotationFieldFlag.FILESELECT)&&this.data.maxLen!==0,this.data.doNotScroll=this.hasFieldFlag(rt.AnnotationFieldFlag.DONOTSCROLL)}get hasTextContent(){return!!this.appearance&&!this._needAppearances}_getCombAppearance(Yt,Kt,nr,tr,ir,sr,cr,or,Xt,Gt,Wt){const er=ir/this.data.maxLen,lr=this.getBorderAndBackgroundAppearances(Wt),ur=[],pr=Kt.getCharPositions(nr);for(const[Er,br]of pr)ur.push(`(${(0,st.escapeString)(nr.substring(Er,br))}) Tj`);const yr=ur.join(` ${(0,st.numberToString)(er)} 0 Td `);return`/Tx BMC q ${lr}BT `+Yt+` 1 0 0 1 ${(0,st.numberToString)(cr)} ${(0,st.numberToString)(or+Xt)} Tm ${yr} ET Q EMC`}_getMultilineAppearance(Yt,Kt,nr,tr,ir,sr,cr,or,Xt,Gt,Wt,er){const lr=[],ur=ir-2*or,pr={shift:0};for(let br=0,gr=Kt.length;br<gr;br++){const Ar=Kt[br],Sr=this._splitLine(Ar,nr,tr,ur);for(let Br=0,Ir=Sr.length;Br<Ir;Br++){const hr=Sr[Br],vr=br===0&&Br===0?-Xt-(Wt-Gt):-Wt;lr.push(this._renderText(hr,nr,tr,ir,cr,pr,or,vr))}}const yr=this.getBorderAndBackgroundAppearances(er),Er=lr.join(`
|
52
52
|
`);return`/Tx BMC q ${yr}BT `+Yt+` 1 0 0 1 0 ${(0,st.numberToString)(sr)} Tm ${Er} ET Q EMC`}_splitLine(Yt,Kt,nr,tr){let ir=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{};Yt=ir.line||Yt;const sr=ir.glyphs||Kt.charsToGlyphs(Yt);if(sr.length<=1)return[Yt];const cr=ir.positions||Kt.getCharPositions(Yt),or=nr/1e3,Xt=[];let Gt=-1,Wt=-1,er=-1,lr=0,ur=0;for(let pr=0,yr=sr.length;pr<yr;pr++){const[Er,br]=cr[pr],gr=sr[pr],Ar=gr.width*or;gr.unicode===" "?ur+Ar>tr?(Xt.push(Yt.substring(lr,Er)),lr=Er,ur=Ar,Gt=-1,er=-1):(ur+=Ar,Gt=Er,Wt=br,er=pr):ur+Ar>tr?Gt!==-1?(Xt.push(Yt.substring(lr,Wt)),lr=Wt,pr=er+1,Gt=-1,ur=0):(Xt.push(Yt.substring(lr,Er)),lr=Er,ur=Ar):ur+=Ar}return lr<Yt.length&&Xt.push(Yt.substring(lr,Yt.length)),Xt}getFieldObject(){return{id:this.data.id,value:this.data.fieldValue,defaultValue:this.data.defaultFieldValue||"",multiline:this.data.multiLine,password:this.hasFieldFlag(rt.AnnotationFieldFlag.PASSWORD),charLimit:this.data.maxLen,comb:this.data.comb,editable:!this.data.readOnly,hidden:this.data.hidden,name:this.data.fieldName,rect:this.data.rect,actions:this.data.actions,page:this.data.pageIndex,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,rotation:this.rotation,type:"text"}}}class yt extends Ct{constructor(Yt){super(Yt),this.checkedAppearance=null,this.uncheckedAppearance=null,this.data.checkBox=!this.hasFieldFlag(rt.AnnotationFieldFlag.RADIO)&&!this.hasFieldFlag(rt.AnnotationFieldFlag.PUSHBUTTON),this.data.radioButton=this.hasFieldFlag(rt.AnnotationFieldFlag.RADIO)&&!this.hasFieldFlag(rt.AnnotationFieldFlag.PUSHBUTTON),this.data.pushButton=this.hasFieldFlag(rt.AnnotationFieldFlag.PUSHBUTTON),this.data.isTooltipOnly=!1,this.data.checkBox?this._processCheckBox(Yt):this.data.radioButton?this._processRadioButton(Yt):this.data.pushButton?(this.data.hasOwnCanvas=!0,this._processPushButton(Yt)):(0,rt.warn)("Invalid field flags for button widget annotation")}async getOperatorList(Yt,Kt,nr,tr,ir){if(this.data.pushButton)return super.getOperatorList(Yt,Kt,nr,!1,ir);let sr=null,cr=null;if(ir){const Xt=ir.get(this.data.id);sr=Xt?Xt.value:null,cr=Xt?Xt.rotation:null}if(sr===null&&this.appearance)return super.getOperatorList(Yt,Kt,nr,tr,ir);sr==null&&(sr=this.data.checkBox?this.data.fieldValue===this.data.exportValue:this.data.fieldValue===this.data.buttonValue);const or=sr?this.checkedAppearance:this.uncheckedAppearance;if(or){const Xt=this.appearance,Gt=or.dict.getArray("Matrix")||rt.IDENTITY_MATRIX;cr&&or.dict.set("Matrix",this.getRotationMatrix(ir)),this.appearance=or;const Wt=super.getOperatorList(Yt,Kt,nr,tr,ir);return this.appearance=Xt,or.dict.set("Matrix",Gt),Wt}return{opList:new ct.OperatorList,separateForm:!1,separateCanvas:!1}}async save(Yt,Kt,nr){return this.data.checkBox?this._saveCheckbox(Yt,Kt,nr):this.data.radioButton?this._saveRadioButton(Yt,Kt,nr):null}async _saveCheckbox(Yt,Kt,nr){if(!nr)return null;const tr=nr.get(this.data.id);let ir=tr==null?void 0:tr.rotation,sr=tr==null?void 0:tr.value;if(ir===void 0&&(sr===void 0||this.data.fieldValue===this.data.exportValue===sr))return null;const cr=Yt.xref.fetchIfRef(this.ref);if(!(cr instanceof et.Dict))return null;ir===void 0&&(ir=this.rotation),sr===void 0&&(sr=this.data.fieldValue===this.data.exportValue);const or={path:this.data.fieldName,value:sr?this.data.exportValue:""},Xt=et.Name.get(sr?this.data.exportValue:"Off");cr.set("V",Xt),cr.set("AS",Xt),cr.set("M",`D:${(0,rt.getModificationDate)()}`);const Gt=this._getMKDict(ir);Gt&&cr.set("MK",Gt);const Wt=[];return await(0,vt.writeObject)(this.ref,cr,Wt,Yt.xref),[{ref:this.ref,data:Wt.join(""),xfa:or}]}async _saveRadioButton(Yt,Kt,nr){if(!nr)return null;const tr=nr.get(this.data.id);let ir=tr==null?void 0:tr.rotation,sr=tr==null?void 0:tr.value;if(ir===void 0&&(sr===void 0||this.data.fieldValue===this.data.buttonValue===sr))return null;const cr=Yt.xref.fetchIfRef(this.ref);if(!(cr instanceof et.Dict))return null;sr===void 0&&(sr=this.data.fieldValue===this.data.buttonValue),ir===void 0&&(ir=this.rotation);const or={path:this.data.fieldName,value:sr?this.data.buttonValue:""},Xt=et.Name.get(sr?this.data.buttonValue:"Off"),Gt=[];let Wt=null;if(sr)if(this.parent instanceof et.Ref){const ur=Yt.xref.fetch(this.parent);ur.set("V",Xt),await(0,vt.writeObject)(this.parent,ur,Gt,Yt.xref),Wt=Gt.join(""),Gt.length=0}else this.parent instanceof et.Dict&&this.parent.set("V",Xt);cr.set("AS",Xt),cr.set("M",`D:${(0,rt.getModificationDate)()}`);const er=this._getMKDict(ir);er&&cr.set("MK",er),await(0,vt.writeObject)(this.ref,cr,Gt,Yt.xref);const lr=[{ref:this.ref,data:Gt.join(""),xfa:or}];return Wt&&lr.push({ref:this.parent,data:Wt,xfa:null}),lr}_getDefaultCheckedAppearance(Yt,Kt){const nr=this.data.rect[2]-this.data.rect[0],tr=this.data.rect[3]-this.data.rect[1],ir=[0,0,nr,tr],sr=.8,cr=Math.min(nr,tr)*sr;let or,Xt;Kt==="check"?(or={width:.755*cr,height:.705*cr},Xt="3"):Kt==="disc"?(or={width:.791*cr,height:.705*cr},Xt="l"):(0,rt.unreachable)(`_getDefaultCheckedAppearance - unsupported type: ${Kt}`);const Gt=(0,st.numberToString)((nr-or.width)/2),Wt=(0,st.numberToString)((tr-or.height)/2),er=`q BT /PdfJsZaDb ${cr} Tf 0 g ${Gt} ${Wt} Td (${Xt}) Tj ET Q`,lr=new et.Dict(Yt.xref);lr.set("FormType",1),lr.set("Subtype",et.Name.get("Form")),lr.set("Type",et.Name.get("XObject")),lr.set("BBox",ir),lr.set("Matrix",[1,0,0,1,0,0]),lr.set("Length",er.length);const ur=new et.Dict(Yt.xref),pr=new et.Dict(Yt.xref);pr.set("PdfJsZaDb",this.fallbackFontDict),ur.set("Font",pr),lr.set("Resources",ur),this.checkedAppearance=new it.StringStream(er),this.checkedAppearance.dict=lr,this._streams.push(this.checkedAppearance)}_processCheckBox(Yt){const Kt=Yt.dict.get("AP");if(!(Kt instanceof et.Dict))return;const nr=Kt.get("N");if(!(nr instanceof et.Dict))return;const tr=this._decodeFormValue(Yt.dict.get("AS"));typeof tr=="string"&&(this.data.fieldValue=tr);const ir=this.data.fieldValue!==null&&this.data.fieldValue!=="Off"?this.data.fieldValue:"Yes",sr=nr.getKeys();if(sr.length===0)sr.push("Off",ir);else if(sr.length===1)sr[0]==="Off"?sr.push(ir):sr.unshift("Off");else if(sr.includes(ir))sr.length=0,sr.push("Off",ir);else{const Xt=sr.find(Gt=>Gt!=="Off");sr.length=0,sr.push("Off",Xt)}sr.includes(this.data.fieldValue)||(this.data.fieldValue="Off"),this.data.exportValue=sr[1];const cr=nr.get(this.data.exportValue);this.checkedAppearance=cr instanceof ut.BaseStream?cr:null;const or=nr.get("Off");this.uncheckedAppearance=or instanceof ut.BaseStream?or:null,this.checkedAppearance?this._streams.push(this.checkedAppearance):this._getDefaultCheckedAppearance(Yt,"check"),this.uncheckedAppearance&&this._streams.push(this.uncheckedAppearance),this._fallbackFontDict=this.fallbackFontDict,this.data.defaultFieldValue===null&&(this.data.defaultFieldValue="Off")}_processRadioButton(Yt){this.data.fieldValue=this.data.buttonValue=null;const Kt=Yt.dict.get("Parent");if(Kt instanceof et.Dict){this.parent=Yt.dict.getRaw("Parent");const cr=Kt.get("V");cr instanceof et.Name&&(this.data.fieldValue=this._decodeFormValue(cr))}const nr=Yt.dict.get("AP");if(!(nr instanceof et.Dict))return;const tr=nr.get("N");if(!(tr instanceof et.Dict))return;for(const cr of tr.getKeys())if(cr!=="Off"){this.data.buttonValue=this._decodeFormValue(cr);break}const ir=tr.get(this.data.buttonValue);this.checkedAppearance=ir instanceof ut.BaseStream?ir:null;const sr=tr.get("Off");this.uncheckedAppearance=sr instanceof ut.BaseStream?sr:null,this.checkedAppearance?this._streams.push(this.checkedAppearance):this._getDefaultCheckedAppearance(Yt,"disc"),this.uncheckedAppearance&&this._streams.push(this.uncheckedAppearance),this._fallbackFontDict=this.fallbackFontDict,this.data.defaultFieldValue===null&&(this.data.defaultFieldValue="Off")}_processPushButton(Yt){const{dict:Kt,annotationGlobals:nr}=Yt;if(!Kt.has("A")&&!Kt.has("AA")&&!this.data.alternativeText){(0,rt.warn)("Push buttons without action dictionaries are not supported");return}this.data.isTooltipOnly=!Kt.has("A")&&!Kt.has("AA"),ht.Catalog.parseDestDictionary({destDict:Kt,resultObj:this.data,docBaseUrl:nr.baseUrl,docAttachments:nr.attachments})}getFieldObject(){let Yt="button",Kt;return this.data.checkBox?(Yt="checkbox",Kt=this.data.exportValue):this.data.radioButton&&(Yt="radiobutton",Kt=this.data.buttonValue),{id:this.data.id,value:this.data.fieldValue||"Off",defaultValue:this.data.defaultFieldValue,exportValues:Kt,editable:!this.data.readOnly,name:this.data.fieldName,rect:this.data.rect,hidden:this.data.hidden,actions:this.data.actions,page:this.data.pageIndex,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,rotation:this.rotation,type:Yt}}get fallbackFontDict(){const Yt=new et.Dict;return Yt.set("BaseFont",et.Name.get("ZapfDingbats")),Yt.set("Type",et.Name.get("FallbackType")),Yt.set("Subtype",et.Name.get("FallbackType")),Yt.set("Encoding",et.Name.get("ZapfDingbatsEncoding")),(0,rt.shadow)(this,"fallbackFontDict",Yt)}}class Rt extends Ct{constructor(Yt){super(Yt);const{dict:Kt,xref:nr}=Yt;this.indices=Kt.getArray("I"),this.hasIndices=Array.isArray(this.indices)&&this.indices.length>0,this.data.options=[];const tr=(0,st.getInheritableProperty)({dict:Kt,key:"Opt"});if(Array.isArray(tr))for(let ir=0,sr=tr.length;ir<sr;ir++){const cr=nr.fetchIfRef(tr[ir]),or=Array.isArray(cr);this.data.options[ir]={exportValue:this._decodeFormValue(or?nr.fetchIfRef(cr[0]):cr),displayValue:this._decodeFormValue(or?nr.fetchIfRef(cr[1]):cr)}}if(!this.hasIndices)typeof this.data.fieldValue=="string"?this.data.fieldValue=[this.data.fieldValue]:this.data.fieldValue||(this.data.fieldValue=[]);else{this.data.fieldValue=[];const ir=this.data.options.length;for(const sr of this.indices)Number.isInteger(sr)&&sr>=0&&sr<ir&&this.data.fieldValue.push(this.data.options[sr].exportValue)}this.data.combo=this.hasFieldFlag(rt.AnnotationFieldFlag.COMBO),this.data.multiSelect=this.hasFieldFlag(rt.AnnotationFieldFlag.MULTISELECT),this._hasText=!0}getFieldObject(){const Yt=this.data.combo?"combobox":"listbox",Kt=this.data.fieldValue.length>0?this.data.fieldValue[0]:null;return{id:this.data.id,value:Kt,defaultValue:this.data.defaultFieldValue,editable:!this.data.readOnly,name:this.data.fieldName,rect:this.data.rect,numItems:this.data.fieldValue.length,multipleSelection:this.data.multiSelect,hidden:this.data.hidden,actions:this.data.actions,items:this.data.options,page:this.data.pageIndex,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,rotation:this.rotation,type:Yt}}amendSavedDict(Yt,Kt){var sr;if(!this.hasIndices)return;let nr=(sr=Yt==null?void 0:Yt.get(this.data.id))==null?void 0:sr.value;Array.isArray(nr)||(nr=[nr]);const tr=[],{options:ir}=this.data;for(let cr=0,or=0,Xt=ir.length;cr<Xt;cr++)ir[cr].exportValue===nr[or]&&(tr.push(cr),or+=1);Kt.set("I",tr)}async _getAppearance(Yt,Kt,nr,tr){if(this.data.combo)return super._getAppearance(Yt,Kt,nr,tr);let ir,sr;const cr=tr==null?void 0:tr.get(this.data.id);if(cr&&(sr=cr.rotation,ir=cr.value),sr===void 0&&ir===void 0&&!this._needAppearances)return null;ir===void 0?ir=this.data.fieldValue:Array.isArray(ir)||(ir=[ir]);const or=1,Xt=2;let Gt=this.data.rect[3]-this.data.rect[1],Wt=this.data.rect[2]-this.data.rect[0];(sr===90||sr===270)&&([Wt,Gt]=[Gt,Wt]);const er=this.data.options.length,lr=[];for(let hr=0;hr<er;hr++){const{exportValue:vr}=this.data.options[hr];ir.includes(vr)&&lr.push(hr)}this._defaultAppearance||(this.data.defaultAppearanceData=(0,lt.parseDefaultAppearance)(this._defaultAppearance="/Helvetica 0 Tf 0 g"));const ur=await Ct._getFontData(Yt,Kt,this.data.defaultAppearanceData,this._fieldResources.mergedResources);let pr,{fontSize:yr}=this.data.defaultAppearanceData;if(yr)pr=this._defaultAppearance;else{const hr=(Gt-or)/er;let vr=-1,xr;for(const{displayValue:Pr}of this.data.options){const Rr=this._getTextWidth(Pr,ur);Rr>vr&&(vr=Rr,xr=Pr)}[pr,yr]=this._computeFontSize(hr,Wt-2*Xt,xr,ur,-1)}const Er=yr*rt.LINE_FACTOR,br=(Er-yr)/2,gr=Math.floor(Gt/Er);let Ar=0;if(lr.length>0){const hr=Math.min(...lr),vr=Math.max(...lr);Ar=Math.max(0,vr-gr+1),Ar>hr&&(Ar=hr)}const Sr=Math.min(Ar+gr+1,er),Br=["/Tx BMC q",`1 1 ${Wt} ${Gt} re W n`];if(lr.length){Br.push("0.600006 0.756866 0.854904 rg");for(const hr of lr)Ar<=hr&&hr<Sr&&Br.push(`1 ${Gt-(hr-Ar+1)*Er} ${Wt} ${Er} re f`)}Br.push("BT",pr,`1 0 0 1 0 ${Gt} Tm`);const Ir={shift:0};for(let hr=Ar;hr<Sr;hr++){const{displayValue:vr}=this.data.options[hr],xr=hr===Ar?br:0;Br.push(this._renderText(vr,ur,yr,Wt,0,Ir,Xt,-Er+xr))}return Br.push("ET Q EMC"),Br.join(`
|
53
53
|
`)}}class kt extends Ct{constructor(Yt){super(Yt),this.data.fieldValue=null,this.data.hasOwnCanvas=this.data.noRotate}getFieldObject(){return{id:this.data.id,value:null,page:this.data.pageIndex,type:"signature"}}}class jt extends wt{constructor(Yt){super(Yt),this.data.noRotate=!0,this.data.hasOwnCanvas=this.data.noRotate;const{dict:nr}=Yt;this.data.annotationType=rt.AnnotationType.TEXT,this.data.hasAppearance?this.data.name="NoIcon":(this.data.rect[1]=this.data.rect[3]-22,this.data.rect[2]=this.data.rect[0]+22,this.data.name=nr.has("Name")?nr.get("Name").name:"Note"),nr.has("State")?(this.data.state=nr.get("State")||null,this.data.stateModel=nr.get("StateModel")||null):(this.data.state=null,this.data.stateModel=null)}}class Ht extends Ot{constructor(Yt){var ir;super(Yt);const{dict:Kt,annotationGlobals:nr}=Yt;this.data.annotationType=rt.AnnotationType.LINK;const tr=St(Kt,this.rectangle);tr&&(this.data.quadPoints=tr),(ir=this.data).borderColor||(ir.borderColor=this.data.color),ht.Catalog.parseDestDictionary({destDict:Kt,resultObj:this.data,docBaseUrl:nr.baseUrl,docAttachments:nr.attachments})}}class Ft extends Ot{constructor(Yt){super(Yt);const{dict:Kt}=Yt;this.data.annotationType=rt.AnnotationType.POPUP,(this.data.rect[0]===this.data.rect[2]||this.data.rect[1]===this.data.rect[3])&&(this.data.rect=null);let nr=Kt.get("Parent");if(!nr){(0,rt.warn)("Popup annotation has a missing or invalid parent annotation.");return}const tr=nr.getArray("Rect");this.data.parentRect=Array.isArray(tr)&&tr.length===4?rt.Util.normalizeRect(tr):null;const ir=nr.get("RT");if((0,et.isName)(ir,rt.AnnotationReplyType.GROUP)&&(nr=nr.get("IRT")),nr.has("M")?(this.setModificationDate(nr.get("M")),this.data.modificationDate=this.modificationDate):this.data.modificationDate=null,nr.has("C")?(this.setColor(nr.getArray("C")),this.data.color=this.color):this.data.color=null,!this.viewable){const sr=nr.get("F");this._isViewable(sr)&&this.setFlags(sr)}this.setTitle(nr.get("T")),this.data.titleObj=this._title,this.setContents(nr.get("Contents")),this.data.contentsObj=this._contents,nr.has("RC")&&(this.data.richText=At.XFAFactory.getRichTextAsHtml(nr.get("RC"))),this.data.open=!!Kt.get("Open")}}at.PopupAnnotation=Ft;class _t extends wt{constructor(Yt){var tr;super(Yt),this.data.hasOwnCanvas=!0;const{evaluatorOptions:Kt,xref:nr}=Yt;if(this.data.annotationType=rt.AnnotationType.FREETEXT,this.setDefaultAppearance(Yt),this.appearance){const{fontColor:ir,fontSize:sr}=(0,lt.parseAppearanceStream)(this.appearance,Kt,nr);this.data.defaultAppearanceData.fontColor=ir,this.data.defaultAppearanceData.fontSize=sr||10}else if(this._isOffscreenCanvasSupported){const ir=Yt.dict.get("CA"),sr=new lt.FakeUnicodeFont(nr,"sans-serif");(tr=this.data.defaultAppearanceData).fontSize||(tr.fontSize=10);const{fontColor:cr,fontSize:or}=this.data.defaultAppearanceData;this.appearance=sr.createAppearance(this._contents.str,this.rectangle,this.rotation,or,cr,ir),this._streams.push(this.appearance,lt.FakeUnicodeFont.toUnicodeStream)}else(0,rt.warn)("FreeTextAnnotation: OffscreenCanvas is not supported, annotation may not render correctly.")}get hasTextContent(){return!!this.appearance}static createNewDict(Yt,Kt,nr){let{apRef:tr,ap:ir}=nr;const{color:sr,fontSize:cr,rect:or,rotation:Xt,user:Gt,value:Wt}=Yt,er=new et.Dict(Kt);er.set("Type",et.Name.get("Annot")),er.set("Subtype",et.Name.get("FreeText")),er.set("CreationDate",`D:${(0,rt.getModificationDate)()}`),er.set("Rect",or);const lr=`/Helv ${cr} Tf ${(0,lt.getPdfColor)(sr,!0)}`;if(er.set("DA",lr),er.set("Contents",(0,st.isAscii)(Wt)?Wt:(0,st.stringToUTF16String)(Wt,!0)),er.set("F",4),er.set("Border",[0,0,0]),er.set("Rotate",Xt),Gt&&er.set("T",(0,st.isAscii)(Gt)?Gt:(0,st.stringToUTF16String)(Gt,!0)),tr||ir){const ur=new et.Dict(Kt);er.set("AP",ur),tr?ur.set("N",tr):ur.set("N",ir)}return er}static async createNewAppearanceStream(Yt,Kt,nr){const{baseFontRef:tr,evaluator:ir,task:sr}=nr,{color:cr,fontSize:or,rect:Xt,rotation:Gt,value:Wt}=Yt,er=new et.Dict(Kt),lr=new et.Dict(Kt);if(tr)lr.set("Helv",tr);else{const Fr=new et.Dict(Kt);Fr.set("BaseFont",et.Name.get("Helvetica")),Fr.set("Type",et.Name.get("Font")),Fr.set("Subtype",et.Name.get("Type1")),Fr.set("Encoding",et.Name.get("WinAnsiEncoding")),lr.set("Helv",Fr)}er.set("Font",lr);const ur=await Ct._getFontData(ir,sr,{fontName:"Helv",fontSize:or},er),[pr,yr,Er,br]=Xt;let gr=Er-pr,Ar=br-yr;Gt%180!==0&&([gr,Ar]=[Ar,gr]);const Sr=Wt.split(`
|
package/dist/types/class.d.ts
CHANGED
@@ -38,6 +38,17 @@ export declare abstract class BaseUIClass {
|
|
38
38
|
opacity: import("zod").ZodOptional<import("zod").ZodNumber>;
|
39
39
|
readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
40
40
|
required: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
41
|
+
__bodyRange: import("zod").ZodOptional<import("zod").ZodObject<{
|
42
|
+
start: import("zod").ZodNumber;
|
43
|
+
end: import("zod").ZodOptional<import("zod").ZodNumber>;
|
44
|
+
}, "strip", import("zod").ZodTypeAny, {
|
45
|
+
start: number;
|
46
|
+
end?: number | undefined;
|
47
|
+
}, {
|
48
|
+
start: number;
|
49
|
+
end?: number | undefined;
|
50
|
+
}>>;
|
51
|
+
__isSplit: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
41
52
|
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
42
53
|
type: import("zod").ZodString;
|
43
54
|
content: import("zod").ZodOptional<import("zod").ZodString>;
|
@@ -57,6 +68,17 @@ export declare abstract class BaseUIClass {
|
|
57
68
|
opacity: import("zod").ZodOptional<import("zod").ZodNumber>;
|
58
69
|
readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
59
70
|
required: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
71
|
+
__bodyRange: import("zod").ZodOptional<import("zod").ZodObject<{
|
72
|
+
start: import("zod").ZodNumber;
|
73
|
+
end: import("zod").ZodOptional<import("zod").ZodNumber>;
|
74
|
+
}, "strip", import("zod").ZodTypeAny, {
|
75
|
+
start: number;
|
76
|
+
end?: number | undefined;
|
77
|
+
}, {
|
78
|
+
start: number;
|
79
|
+
end?: number | undefined;
|
80
|
+
}>>;
|
81
|
+
__isSplit: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
60
82
|
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
61
83
|
type: import("zod").ZodString;
|
62
84
|
content: import("zod").ZodOptional<import("zod").ZodString>;
|
@@ -76,6 +98,17 @@ export declare abstract class BaseUIClass {
|
|
76
98
|
opacity: import("zod").ZodOptional<import("zod").ZodNumber>;
|
77
99
|
readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
78
100
|
required: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
101
|
+
__bodyRange: import("zod").ZodOptional<import("zod").ZodObject<{
|
102
|
+
start: import("zod").ZodNumber;
|
103
|
+
end: import("zod").ZodOptional<import("zod").ZodNumber>;
|
104
|
+
}, "strip", import("zod").ZodTypeAny, {
|
105
|
+
start: number;
|
106
|
+
end?: number | undefined;
|
107
|
+
}, {
|
108
|
+
start: number;
|
109
|
+
end?: number | undefined;
|
110
|
+
}>>;
|
111
|
+
__isSplit: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
79
112
|
}, import("zod").ZodTypeAny, "passthrough">>>, "many">;
|
80
113
|
basePdf: import("zod").ZodUnion<[import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodType<ArrayBuffer, import("zod").ZodTypeDef, ArrayBuffer>, import("zod").ZodType<Uint8Array, import("zod").ZodTypeDef, Uint8Array>]>, import("zod").ZodObject<{
|
81
114
|
width: import("zod").ZodNumber;
|
package/dist/types/helper.d.ts
CHANGED
@@ -38,6 +38,11 @@ export declare const template2SchemasList: (_template: Template) => Promise<{
|
|
38
38
|
required?: boolean | undefined;
|
39
39
|
content?: string | undefined;
|
40
40
|
readOnly?: boolean | undefined;
|
41
|
+
__bodyRange?: {
|
42
|
+
start: number;
|
43
|
+
end?: number | undefined;
|
44
|
+
} | undefined;
|
45
|
+
__isSplit?: boolean | undefined;
|
41
46
|
}[][]>;
|
42
47
|
export declare const schemasList2template: (schemasList: SchemaForUI[][], basePdf: BasePdf) => Template;
|
43
48
|
export declare const getUniqSchemaKey: (arg: {
|