@pdfme/ui 5.0.0-dev.3 → 5.0.0-dev.5

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.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({name:z.string(),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()});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]);z.array(z.record(Schema$1));const SchemaPageArray=z.array(z.array(Schema$1)),Template=z.object({schemas:SchemaPageArray,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),migrateTemplate=a=>{a.schemas&&Array.isArray(a.schemas)&&a.schemas.length>0&&!Array.isArray(a.schemas[0])&&(a.schemas=a.schemas.map(s=>Object.entries(s).map(([$,_])=>({..._,name:$}))))},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=>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(),"schemas.date.format":z.string(),"schemas.select.options":z.string(),"schemas.select.optionPlaceholder":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({name:z.string(),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()});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]);z.array(z.record(Schema$1));const SchemaPageArray=z.array(z.array(Schema$1)),Template=z.object({schemas:SchemaPageArray,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),migrateTemplate=a=>{a.schemas&&Array.isArray(a.schemas)&&a.schemas.length>0&&!Array.isArray(a.schemas[0])&&(a.schemas=a.schemas.map(s=>Object.entries(s).map(([$,_])=>({..._,name:$}))))},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=>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=>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(".")}
@@ -127,7 +127,7 @@ endstream`,s}copyBytesInto(s,$){this.updateDict();const _=$;$+=this.dict.copyByt
127
127
  `).replace(/\s+$/,"")},enumerable:!1,configurable:!0}),xt.prototype.toString=function(){var bt=this.tagName;if(bt){var Et=/^(img|br|hr|area|base|input|doctype|link|meta)$/i.test(bt),St=this.rawAttrs?" "+this.rawAttrs:"";return Et?"<".concat(bt).concat(St," />"):"<".concat(bt).concat(St,">").concat(this.innerHTML,"</").concat(bt,">")}else return this.innerHTML},Object.defineProperty(xt.prototype,"innerHTML",{get:function(){return this.childNodes.map(function(bt){return bt.toString()}).join("")},set:function(bt){var Et=this,St=mt(bt);this.childNodes.forEach(function(Bt){return Bt.remove()}),St.childNodes.forEach(function(Bt){return Et.appendChild(Bt)})},enumerable:!1,configurable:!0}),xt.prototype.set_content=function(bt){if(bt instanceof _e)bt=[bt];else if(typeof bt=="string"){var Et=mt(bt);bt=Et.childNodes.length?Et.childNodes:[new tt(bt)]}this.childNodes=bt},Object.defineProperty(xt.prototype,"outerHTML",{get:function(){return this.toString()},enumerable:!1,configurable:!0}),xt.prototype.trimRight=function(bt){for(var Et=0;Et<this.childNodes.length;Et++){var St=this.childNodes[Et];if(St.nodeType===_.ELEMENT_NODE)St.trimRight(bt);else{var Bt=St.rawText.search(bt);Bt>-1&&(St.value=St.rawText.substr(0,Bt),this.childNodes.length=Et+1)}}return this},Object.defineProperty(xt.prototype,"structure",{get:function(){var bt=[],Et=0;function St(Ot){bt.push(" ".repeat(Et)+Ot)}function Bt(Ot){var Pt=Ot.id?"#"+Ot.id:"",wt=Ot.classNames.length?"."+Ot.classNames.join("."):"";St(Ot.tagName+Pt+wt),Et++;for(var Ct=0;Ct<Ot.childNodes.length;Ct++){var It=Ot.childNodes[Ct];It.nodeType===_.ELEMENT_NODE?Bt(It):It.nodeType===_.TEXT_NODE&&(It.isWhitespace||St("#text"))}Et--}return Bt(this),bt.join(`
128
128
  `)},enumerable:!1,configurable:!0}),xt.prototype.removeWhitespace=function(){for(var bt=0,Et=0;Et<this.childNodes.length;Et++){var St=this.childNodes[Et];if(St.nodeType===_.TEXT_NODE){if(St.isWhitespace)continue;St.value=St.rawText.trim()}else St.nodeType===_.ELEMENT_NODE&&St.removeWhitespace();this.childNodes[bt++]=St}return this.childNodes.length=bt,this},xt.prototype.querySelectorAll=function(bt){var Et=this,St;if(bt instanceof et)St=bt,St.reset();else{if(bt.includes(",")){var Bt=bt.split(",");return Array.from(Bt.reduce(function(yt,Rt){var kt=Et.querySelectorAll(Rt.trim());return kt.reduce(function(jt,Ht){return jt.add(Ht)},yt)},new Set))}St=new et(bt)}for(var Ot=[],Pt=[],wt=0;wt<this.childNodes.length;wt++)for(Pt.push([this.childNodes[wt],0,!1]);Pt.length;){var Ct=ot(Pt),It=Ct[0];if(Ct[1]===0){if(It.nodeType!==_.ELEMENT_NODE){Pt.pop();continue}if((Ct[2]=St.advance(It))&&St.matched){Ot.push(It),St.rewind(),Pt.pop();continue}}Ct[1]<It.childNodes.length?Pt.push([It.childNodes[Ct[1]++],0,!1]):(Ct[2]&&St.rewind(),Pt.pop())}return Ot},xt.prototype.querySelector=function(bt){var Et;bt instanceof et?(Et=bt,Et.reset()):Et=new et(bt);for(var St=[],Bt=0;Bt<this.childNodes.length;Bt++)for(St.push([this.childNodes[Bt],0,!1]);St.length;){var Ot=ot(St),Pt=Ot[0];if(Ot[1]===0){if(Pt.nodeType!==_.ELEMENT_NODE){St.pop();continue}if((Ot[2]=Et.advance(Pt))&&Et.matched)return Pt}Ot[1]<Pt.childNodes.length?St.push([Pt.childNodes[Ot[1]++],0,!1]):(Ot[2]&&Et.rewind(),St.pop())}return null},xt.prototype.appendChild=function(bt){return this.childNodes.push(bt),bt instanceof xt&&(bt.parentNode=this),bt},xt.prototype.prependChild=function(bt){return this.childNodes.unshift(bt),bt instanceof xt&&(bt.parentNode=this),bt},Object.defineProperty(xt.prototype,"firstChild",{get:function(){return this.childNodes[0]},enumerable:!1,configurable:!0}),Object.defineProperty(xt.prototype,"lastChild",{get:function(){return ot(this.childNodes)},enumerable:!1,configurable:!0}),Object.defineProperty(xt.prototype,"attributes",{get:function(){if(this._attrs)return this._attrs;this._attrs={};var bt=this.rawAttributes;for(var Et in bt)this._attrs[Et]=(0,$.decode)(bt[Et]);return this._attrs},enumerable:!1,configurable:!0}),Object.defineProperty(xt.prototype,"rawAttributes",{get:function(){if(this._rawAttrs)return this._rawAttrs;var bt={};if(this.rawAttrs)for(var Et=void 0;Et=ft.exec(this.rawAttrs);)bt[Et[1]]=Et[4]||Et[5]||Et[6]||"";return this._rawAttrs=bt,bt},enumerable:!1,configurable:!0}),xt.prototype.setAttribute=function(bt,Et){bt==="id"?this.id=Et:bt==="class"&&(this.classNames=Et.split(/\s+/));var St=this.attributes;Et===void 0?delete St[bt]:St[bt]=Et+"",this._rawAttrs&&(Et===void 0?delete this._rawAttrs[bt]:this._rawAttrs[bt]=(0,$.encode)(Et+"")),this.rawAttrs=Object.keys(St).map(function(Bt){return Bt+(St[Bt]===""?"":'="'+(0,$.encode)(St[Bt])+'"')}).join(" ")},xt.prototype.removeAttribute=function(bt){this.setAttribute(bt,void 0)},xt.prototype.setAttributes=function(bt){var Et=this;bt.id?this.id=bt.id:bt.class&&(this.classNames=bt.class.split(/\s+/)),this.attributes&&(Object.keys(this.attributes).forEach(function(St){return delete Et.attributes[St]}),Object.keys(bt).forEach(function(St){return Et.attributes[St]=bt[St]+""})),this.rawAttributes&&(Object.keys(this.rawAttributes).forEach(function(St){return delete Et.rawAttributes[St]}),Object.keys(bt).forEach(function(St){return Et.rawAttributes[St]=(0,$.encode)(bt[St]+"")})),this.rawAttrs=Object.keys(bt).map(function(St){return St+(bt[St]===""?"":'="'+(0,$.encode)(bt[St]+"")+'"')}).join(" ")},xt}(_e);a.HTMLElement=rt;var st={},lt={f145:function(At,xt,bt,Et,St){if(xt=xt||"",bt=bt||[],At.id!=xt.substr(1))return!1;for(var Bt=bt,Ot=0;Ot<Bt.length;Ot++)if(At.classNames.indexOf(Bt[Ot])===-1)return!1;return!0},f45:function(At,xt,bt,Et,St){bt=bt||[];for(var Bt=bt,Ot=0;Ot<Bt.length;Ot++)if(At.classNames.indexOf(Bt[Ot])===-1)return!1;return!0},f15:function(At,xt,bt,Et,St){return xt=xt||"",At.id==xt.substr(1)},f1:function(At,xt,bt,Et,St){if(xt=xt||"",At.id!=xt.substr(1))return!1},f5:function(At,xt,bt,Et,St){return!0},f245:function(At,xt,bt,Et,St){Et=Et||"",St=St||"";var Bt=At.attributes;for(var Ot in Bt){var Pt=Bt[Ot];if(Ot==Et&&Pt==St)return!0}return!1},f25:function(At,xt,bt,Et,St){Et=Et||"",St=St||"";var Bt=At.attributes;for(var Ot in Bt){var Pt=Bt[Ot];if(Ot==Et&&Pt==St)return!0}return!1},f2:function(At,xt,bt,Et,St){Et=Et||"",St=St||"";var Bt=At.attributes;for(var Ot in Bt){var Pt=Bt[Ot];if(Ot==Et&&Pt==St)return!0}return!1},f345:function(At,xt,bt,Et,St){if(xt=xt||"",bt=bt||[],At.tagName!=xt)return!1;for(var Bt=bt,Ot=0;Ot<Bt.length;Ot++)if(At.classNames.indexOf(Bt[Ot])===-1)return!1;return!0},f35:function(At,xt,bt,Et,St){return xt=xt||"",At.tagName==xt},f3:function(At,xt,bt,Et,St){if(xt=xt||"",At.tagName!=xt)return!1}},et=function(){function At(xt){this.nextMatch=0,lt.f5=lt.f5,this.matchers=xt.split(" ").map(function(bt){if(st[bt])return st[bt];var Et=bt.split("."),St=Et[0],Bt=Et.slice(1).sort(),Ot='"use strict";',Pt="f",wt="",Ct="";if(St&&St!="*"){var It;if(St[0]=="#")Ot+="if (el.id != "+JSON.stringify(St.substr(1))+") return false;",Pt+="1";else if(It=St.match(/^\[\s*(\S+)\s*(=|!=)\s*((((["'])([^\6]*)\6))|(\S*?))\]\s*/)){wt=It[1];var yt=It[2];if(yt!=="="&&yt!=="!=")throw new Error("Selector not supported, Expect [key${op}value].op must be =,!=");yt==="="&&(yt="=="),Ct=It[7]||It[8],Ot+='let attrs = el.attributes;for (let key in attrs){const val = attrs[key]; if (key == "'.concat(wt,'" && val == "').concat(Ct,'"){return true;}} return false;'),Pt+="2"}else Ot+="if (el.tagName != "+JSON.stringify(St)+") return false;",Pt+="3"}Bt.length>0&&(Ot+="for (let cls = "+JSON.stringify(Bt)+", i = 0; i < cls.length; i++) if (el.classNames.indexOf(cls[i]) === -1) return false;",Pt+="4"),Ot+="return true;",Pt+="5";var Rt={func:lt[Pt],tagName:St||"",classes:Bt||"",attr_key:wt||"",value:Ct||""};return Ot=Ot||"",st[bt]=Rt})}return At.prototype.advance=function(xt){return this.nextMatch<this.matchers.length&&this.matchers[this.nextMatch].func(xt,this.matchers[this.nextMatch].tagName,this.matchers[this.nextMatch].classes,this.matchers[this.nextMatch].attr_key,this.matchers[this.nextMatch].value)?(this.nextMatch++,!0):!1},At.prototype.rewind=function(){this.nextMatch--},Object.defineProperty(At.prototype,"matched",{get:function(){return this.nextMatch==this.matchers.length},enumerable:!1,configurable:!0}),At.prototype.reset=function(){this.nextMatch=0},At.prototype.flushCache=function(){st={}},At}();a.Matcher=et;var it=/<!--[^]*?(?=-->)-->|<(\/?)([a-z][-.:0-9_a-z]*)((\s+[a-z][-.:0-9_a-z]*(\s*=\s*("[^"]*"|'([^']*')|([^\s\/>]+)))?)*)\s*(\/?)>/ig,ut=/(^|\s)(id|class)\s*=\s*("([^"]+)"|'([^']+)'|(\S+))/ig,ft=/([a-z][-.:0-9_a-z]*)(\s*=\s*("([^"]*)"|'([^']*)'|(\S+)))?/ig,ht={area:!0,base:!0,br:!0,col:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,source:!0},dt={li:{li:!0},p:{p:!0,div:!0},b:{div:!0},td:{td:!0,th:!0},th:{td:!0,th:!0},h1:{h1:!0},h2:{h2:!0},h3:{h3:!0},h4:{h4:!0},h5:{h5:!0},h6:{h6:!0}},gt={li:{ul:!0,ol:!0},a:{div:!0},b:{div:!0},i:{div:!0},p:{div:!0},td:{tr:!0,table:!0},th:{tr:!0,table:!0}},pt={script:!0,noscript:!0,style:!0,pre:!0};function mt(At,xt){var bt=new rt(null),Et=bt,St=[bt],Bt=0;xt=xt||{};for(var Ot;Ot=it.exec(At);){if(Bt+Ot[0].length<it.lastIndex){var Pt=At.substring(Bt,it.lastIndex-Ot[0].length);Et.appendChild(new tt(Pt))}if(Bt=it.lastIndex,Ot[0][1]=="!"){if(xt.comment){var Pt=At.substring(Bt-3,Bt-Ot[0].length+4);Et.appendChild(new nt(Pt))}continue}if(xt.lowerCaseTagName&&(Ot[2]=Ot[2].toLowerCase()),!Ot[1]&&(!Ot[9]&&dt[Et.tagName]&&dt[Et.tagName][Ot[2]]&&(St.pop(),Et=ot(St)),Et=Et.appendChild(new rt(Ot[2],Ot[3].trim())),St.push(Et),pt[Ot[2]])){var wt="</"+Ot[2]+">",Ct=At.indexOf(wt,it.lastIndex);if(xt[Ot[2]]){var Pt=void 0;Ct==-1?Pt=At.substr(it.lastIndex):Pt=At.substring(it.lastIndex,Ct),Pt.length>0&&Et.appendChild(new tt(Pt))}Ct==-1?Bt=it.lastIndex=At.length+1:(Bt=it.lastIndex=Ct+wt.length,Ot[1]="true")}if(Ot[1]||Ot[9]||ht[Ot[2]])for(;;)if(Et.tagName==Ot[2]){St.pop(),Et=ot(St);break}else{if(gt[Et.tagName]&&gt[Et.tagName][Ot[2]]){St.pop(),Et=ot(St);continue}break}}Bt<At.length&&bt.appendChild(new tt(At.substring(Bt))),bt.valid=St.length===1;for(var It=function(){var yt=St.pop(),Rt=ot(St);yt.parentNode&&yt.parentNode instanceof rt&&yt.parentNode.parentNode&&(yt.parentNode===Rt&&yt.tagName===Rt.tagName?(Rt.removeChild(yt),yt.childNodes.forEach(function(kt){Rt.parentNode.appendChild(kt)}),St.pop()):(Rt.removeChild(yt),yt.childNodes.forEach(function(kt){Rt.appendChild(kt)})))};St.length>1;)It();return bt}a.parse=mt;var ct=["html","body","address","article","aside","blockquote","canvas","dd","div","dl","dt","fieldset","figcaption","figure","footer","form","header","hr","li","main","nav","noscript","ol","p","pre","section","tfoot","table","tbody","ul","video","th","td","tr","h1","h2","h3","h4","h5","h6"];function vt(At){return At.nodeType===_.ELEMENT_NODE&&At.tagName&&ct.includes(At.tagName.toLowerCase())}a.isBlock=vt}(dist),LineCapStyle.Butt,LineCapStyle.Round,LineCapStyle.Projecting,FillRule.EvenOdd,FillRule.NonZero,LineJoinStyle.Bevel,LineJoinStyle.Miter,LineJoinStyle.Round;let Cell$2=class{constructor(s,$,_){Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"text",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"styles",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"section",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contentHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"contentWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"wrappedWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"minReadableWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"minWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),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,"x",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,writable:!0,value:0}),this.styles=$,this.section=_,this.raw=s;const _e=/\r\n|\r|\n/g;this.text=s.split(_e)}getContentHeight(){const s=Array.isArray(this.text)?this.text.length:1,$=pt2mm(this.styles.fontSize)*this.styles.lineHeight,_=this.padding("top")+this.padding("bottom"),_e=s*$+_;return Math.max(_e,this.styles.minCellHeight)}padding(s){return this.styles.cellPadding[s]}},Column$2=class{constructor(s){Object.defineProperty(this,"index",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"wrappedWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"minReadableWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"minWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,writable:!0,value:0}),this.index=s}getMaxCustomCellWidth(s){let $=0;for(const _ of s.allRows()){const _e=_.cells[this.index];$=Math.max($,_e.styles.cellWidth)}return $}},Row$2=class{constructor(s,$,_,_e){Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"index",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"section",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cells",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,writable:!0,value:0}),this.raw=s,this.index=$,this.section=_,this.cells=_e}getMaxCellHeight(s){return s.reduce(($,_)=>{var _e;return Math.max($,((_e=this.cells[_.index])==null?void 0:_e.height)||0)},0)}getMinimumRowHeight(s){return s.reduce(($,_)=>{const _e=this.cells[_.index];if(!_e)return 0;const nt=_e.padding("top")+_e.padding("bottom")+_e.styles.lineHeight;return nt>$?nt:$},0)}},Table$3=class ou{constructor(s,$){Object.defineProperty(this,"settings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"styles",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"columns",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"head",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.settings=s.settings,this.styles=s.styles,this.columns=$.columns,this.head=$.head,this.body=$.body}static async create(s){const{input:$,content:_,font:_e,_cache:tt}=s,nt=new ou($,_);return await calculateWidths({table:nt,font:_e,_cache:tt}),nt}getHeadHeight(){return this.head.reduce((s,$)=>s+$.getMaxCellHeight(this.columns),0)}getBodyHeight(){return this.body.reduce((s,$)=>s+$.getMaxCellHeight(this.columns),0)}allRows(){return this.head.concat(this.body)}getWidth(){return this.settings.tableWidth}getHeight(){return(this.settings.showHead?this.getHeadHeight():0)+this.getBodyHeight()}};async function calculateWidths(a){const{table:s,font:$,_cache:_}=a,_e=ot=>getFontKitFont(ot,$,_);await calculate$1(s,_e);const tt=[];let nt=0;s.columns.forEach(ot=>{const rt=ot.getMaxCustomCellWidth(s);rt?ot.width=rt:(ot.width=ot.wrappedWidth,tt.push(ot)),nt+=ot.width});let at=s.getWidth()-nt;at&&(at=resizeColumns(tt,at,ot=>Math.max(ot.minReadableWidth,ot.minWidth))),at&&(at=resizeColumns(tt,at,ot=>ot.minWidth)),at=Math.abs(at),applyColSpans(s),await fitContent(s,_e),applyRowSpans(s)}function applyRowSpans(a){const s={};let $=1;const _=a.allRows();for(let _e=0;_e<_.length;_e++){const tt=_[_e];for(const nt of a.columns){const at=s[nt.index];if($>1)$--,delete tt.cells[nt.index];else if(at)at.cell.height+=tt.height,$=1,delete tt.cells[nt.index],at.left--,at.left<=1&&delete s[nt.index];else{const ot=tt.cells[nt.index];if(!ot)continue;ot.height=tt.height}}}}function applyColSpans(a){const s=a.allRows();for(let $=0;$<s.length;$++){const _=s[$];let _e=0,tt=0;for(let nt=0;nt<a.columns.length;nt++){const at=a.columns[nt];if(tt-=1,tt>1&&a.columns[nt+1])_e+=at.width,delete _.cells[at.index];else{const ot=_.cells[at.index];if(!ot)continue;tt=1,_e=0,ot.width=at.width+_e}}}}async function fitContent(a,s){const $={count:0,height:0};for(const _ of a.allRows()){for(const _e of a.columns){const tt=_.cells[_e.index];if(!tt)continue;const nt=await s(tt.styles.fontName);tt.text=splitTextToSize({value:tt.raw,characterSpacing:tt.styles.characterSpacing,boxWidthInPt:mm2pt(tt.width),fontSize:tt.styles.fontSize,fontKitFont:nt}),tt.contentHeight=tt.getContentHeight();let at=tt.contentHeight;$&&$.count>0&&$.height>at&&(at=$.height),at>_.height&&(_.height=at)}$.count--}}function resizeColumns(a,s,$){const _=s,_e=a.reduce((tt,nt)=>tt+nt.wrappedWidth,0);for(let tt=0;tt<a.length;tt++){const nt=a[tt],at=nt.wrappedWidth/_e,ot=_*at,rt=nt.width+ot,st=$(nt),lt=rt<st?st:rt;s-=lt-nt.width,nt.width=lt}if(s=Math.round(s*1e10)/1e10,s){const tt=a.filter(nt=>s<0?nt.width>$(nt):!0);tt.length&&(s=resizeColumns(tt,s,$))}return s}async function calculate$1(a,s){for(const $ of a.allRows())for(const _ of a.columns){const _e=$.cells[_.index];if(!_e)continue;const tt=_e.padding("right")+_e.padding("left"),nt=await s(_e.styles.fontName);_e.contentWidth=getStringWidth(_e,nt)+tt;const at=getStringWidth(Object.assign(_e,{text:_e.text.join(" ").split(/\s+/)}),nt);_e.minReadableWidth=at+tt,_e.minWidth=_e.styles.cellWidth,_e.wrappedWidth=_e.styles.cellWidth}for(const $ of a.allRows())for(const _ of a.columns){const _e=$.cells[_.index];if(_e)_.wrappedWidth=Math.max(_.wrappedWidth,_e.wrappedWidth),_.minWidth=Math.max(_.minWidth,_e.minWidth),_.minReadableWidth=Math.max(_.minReadableWidth,_e.minReadableWidth);else{const tt=a.styles.columnStyles[_.index]||{},nt=tt.cellWidth||tt.minCellWidth;nt&&(_.minWidth=nt,_.wrappedWidth=nt)}}}function getStringWidth(a,s){const $=a.text,_=Array.isArray($)?$:[$],_e=a.styles.fontSize,tt=a.styles.characterSpacing;return _.map(at=>widthOfTextAtSize(at,s,_e,tt)).reduce((at,ot)=>Math.max(at,ot),0)}function parseSection(a,s,$,_,_e){const tt={};return s.map((at,ot)=>{let rt=0;const st={};let lt=0,et=0;for(const it of $)if(tt[it.index]==null||tt[it.index].left===0)if(et===0){let ut;Array.isArray(at)?ut=at[it.index-lt-rt]:ut=at[it.index];const ft=cellStyles(a,it,ot,_,_e),ht=new Cell$2(ut,ft,a);st[it.index]=ht,et=0,tt[it.index]={left:0,times:et}}else et--,lt++;else tt[it.index].left--,et=tt[it.index].times,rt++;return new Row$2(at,ot,a,st)})}function parseContent4Table(a,s){const $=a.content,_=$.columns.map(tt=>new Column$2(tt)),_e=a.styles;return{columns:_,head:parseSection("head",$.head,_,_e,s),body:parseSection("body",$.body,_,_e,s)}}function cellStyles(a,s,$,_,_e){let tt;a==="head"?tt=_.headStyles:a==="body"&&(tt=_.bodyStyles);const nt=Object.assign({},_.styles,tt),at=_.columnStyles[s.index]||_.columnStyles[s.index]||{},ot=a==="body"&&$%2===0?Object.assign({},_.alternateRowStyles):{};return Object.assign({fontName:_e,backgroundColor:"",textColor:"#000000",lineHeight:1,characterSpacing:0,alignment:"left",verticalAlignment:"middle",fontSize:10,cellPadding:5,lineColor:"#000000",lineWidth:0,minCellHeight:0,minCellWidth:0},nt,ot,at)}function mapCellStyle(a){return{fontName:a.fontName,alignment:a.alignment,verticalAlignment:a.verticalAlignment,fontSize:a.fontSize,lineHeight:a.lineHeight,characterSpacing:a.characterSpacing,backgroundColor:a.backgroundColor,textColor:a.fontColor,lineColor:a.borderColor,lineWidth:a.borderWidth,cellPadding:a.padding}}function getTableOptions(a,s){const $=a.headWidthPercentages.reduce((nt,at,ot)=>({...nt,[ot]:{cellWidth:a.width*(at/100)}}),{}),_=Object.entries(a.columnStyles.alignment||{}).reduce((nt,[at,ot])=>({...nt,[at]:{alignment:ot}}),{}),_e=new Set([...Object.keys($).map(Number),...Object.keys(_).map(Number)]),tt=Array.from(_e).reduce((nt,at)=>{const ot=$[at]||{},rt=_[at]||{};return{...nt,[at]:{...ot,...rt}}},{});return{head:[a.head],body:s,showHead:a.showHead,startY:a.position.y,tableWidth:a.width,tableLineColor:a.tableStyles.borderColor,tableLineWidth:a.tableStyles.borderWidth,headStyles:mapCellStyle(a.headStyles),bodyStyles:mapCellStyle(a.bodyStyles),alternateRowStyles:{backgroundColor:a.bodyStyles.alternateBackgroundColor},columnStyles:tt,margin:{top:0,right:0,left:a.position.x,bottom:0}}}function parseStyles(a){const s={styles:{},headStyles:{},bodyStyles:{},alternateRowStyles:{},columnStyles:{}};for(const $ of Object.keys(s))if($==="columnStyles"){const _=a[$];s.columnStyles=Object.assign({},_)}else{const _e=[a].map(tt=>tt[$]||{});s[$]=Object.assign({},_e[0],_e[1],_e[2])}return s}function parseContent4Input(a){const s=a.head||[],$=a.body||[];return{columns:(s[0]||$[0]||[]).map((_e,tt)=>tt),head:s,body:$}}function parseInput(a,s){const $=getTableOptions(a,s),_=parseStyles($),_e={startY:$.startY,margin:$.margin,tableWidth:$.tableWidth,showHead:$.showHead,tableLineWidth:$.tableLineWidth??0,tableLineColor:$.tableLineColor??""};return{content:parseContent4Input($),styles:_,settings:_e}}function createSingleTable(a,s){const{options:$,_cache:_,basePdf:_e}=s;isBlankPdf(_e)||console.warn(`[@pdfme/schema/table]When specifying a custom PDF for basePdf, you cannot use features such as page breaks or re-layout of other elements.To utilize these features, please define basePdf as follows:
129
129
  { width: number; height: number; padding: [number, number, number, number]; }`);const tt=cloneDeep$1(s.schema),{start:nt}=tt.__bodyRange||{start:0};if(nt%2===1){const lt=tt.bodyStyles.alternateBackgroundColor;tt.bodyStyles.alternateBackgroundColor=tt.bodyStyles.backgroundColor,tt.bodyStyles.backgroundColor=lt}tt.showHead=tt.showHead===!1?!1:!tt.__isSplit;const at=parseInput(tt,a),ot=$.font||getDefaultFont(),rt=getFallbackFontName(ot),st=parseContent4Table(at,rt);return Table$3.create({input:at,content:st,font:ot,_cache:_})}const DEFAULT_OPACITY=1,HEX_COLOR_PATTERN="^#(?:[A-Fa-f0-9]{6})$",getBody$1=a=>typeof a=="string"?JSON.parse(a||"[]"):a||[],getBodyWithRange=(a,s)=>{const $=getBody$1(a);return s?$.slice(s.start,s.end):$},getDynamicHeightsForTable$1=async(a,s)=>{var tt;if(s.schema.type!=="table")return Promise.resolve([s.schema.height]);const $=s.schema,_=((tt=$.__bodyRange)==null?void 0:tt.start)===0?getBody$1(a):getBodyWithRange(a,$.__bodyRange);return(await createSingleTable(_,s)).allRows().map(nt=>nt.height)},convertForPdfLayoutProps=({schema:a,pageHeight:s,applyRotateTranslate:$=!0})=>{const{width:_,height:_e,position:tt,rotate:nt,opacity:at}=a,{x:ot,y:rt}=tt,st=nt?-nt:0,lt=mm2pt(_),et=mm2pt(_e);let it=mm2pt(ot),ut=s-mm2pt(rt)-et;if(st&&$){const ft={x:it+lt/2,y:s-mm2pt(rt)-et/2},ht=rotatePoint({x:it,y:ut},ft,st);it=ht.x,ut=ht.y}return{position:{x:it,y:ut},height:et,width:lt,rotate:degrees(st),opacity:at}},rotatePoint=(a,s,$)=>{const _=degreesToRadians($),_e=Math.cos(_)*(a.x-s.x)-Math.sin(_)*(a.y-s.y)+s.x,tt=Math.sin(_)*(a.x-s.x)+Math.cos(_)*(a.y-s.y)+s.y;return{x:_e,y:tt}},getDynamicHeightsForTable=getDynamicHeightsForTable$1,isEditable=(a,s)=>a==="designer"||a==="form"&&s.readOnly!==!0,hex2rgb=a=>(a.slice(0,1)==="#"&&(a=a.slice(1)),a.length===3&&(a=a.slice(0,1)+a.slice(0,1)+a.slice(1,2)+a.slice(1,2)+a.slice(2,3)+a.slice(2,3)),[a.slice(0,2),a.slice(2,4),a.slice(4,6)].map(s=>parseInt(s,16))),hex2RgbColor=a=>{if(a){if(!isHexValid(a))throw new Error(`Invalid hex color value ${a}`);const[$,_,_e]=hex2rgb(a);return rgb($/255,_/255,_e/255)}},hex2CmykColor=a=>{if(a){if(!isHexValid(a))throw new Error(`Invalid hex color value ${a}`);a=a.replace("#","");const $=a.substring(0,6),_=a.substring(6,8),_e=_?parseInt(_,16)/255:1;let tt=parseInt($.substring(0,2),16)/255,nt=parseInt($.substring(2,4),16)/255,at=parseInt($.substring(4,6),16)/255;tt=tt*_e+(1-_e),nt=nt*_e+(1-_e),at=at*_e+(1-_e);const ot=1-Math.max(tt,nt,at),rt=tt===0?0:(1-tt-ot)/(1-ot),st=nt===0?0:(1-nt-ot)/(1-ot),lt=at===0?0:(1-at-ot)/(1-ot);return cmyk(rt,st,lt,ot)}},hex2PrintingColor=(a,s)=>(s==null?void 0:s.toLocaleLowerCase())=="cmyk"?hex2CmykColor(a):hex2RgbColor(a),embedAndGetFontObj=async a=>{const{pdfDoc:s,font:$,_cache:_}=a;if(_.has(s))return _.get(s);const _e=await Promise.all(Object.values($).map(async nt=>{let at=nt.data;return typeof at=="string"&&at.startsWith("http")&&(at=await fetch(at).then(ot=>ot.arrayBuffer())),s.embedFont(at,{subset:typeof nt.subset>"u"?!0:nt.subset})})),tt=Object.keys($).reduce((nt,at,ot)=>Object.assign(nt,{[at]:_e[ot]}),{});return _.set(s,tt),tt},getFontProp=async({value:a,font:s,schema:$,colorType:_,_cache:_e})=>{const tt=$.dynamicFontSize?await calculateDynamicFontSize({textSchema:$,font:s,value:a,_cache:_e}):$.fontSize??DEFAULT_FONT_SIZE,nt=hex2PrintingColor($.fontColor||DEFAULT_FONT_COLOR,_);return{alignment:$.alignment??DEFAULT_ALIGNMENT,verticalAlignment:$.verticalAlignment??DEFAULT_VERTICAL_ALIGNMENT,lineHeight:$.lineHeight??DEFAULT_LINE_HEIGHT,characterSpacing:$.characterSpacing??DEFAULT_CHARACTER_SPACING,fontSize:tt,color:nt}},pdfRender=async a=>{const{value:s,pdfDoc:$,pdfLib:_,page:_e,options:tt,schema:nt,_cache:at}=a;if(!s)return;const{font:ot=getDefaultFont(),colorType:rt}=tt,[st,lt,et]=await Promise.all([embedAndGetFontObj({pdfDoc:$,font:ot,_cache:at}),getFontKitFont(nt.fontName,ot,at),getFontProp({value:s,font:ot,schema:nt,_cache:at,colorType:rt})]),{fontSize:it,color:ut,alignment:ft,verticalAlignment:ht,lineHeight:dt,characterSpacing:gt}=et,pt=nt.fontName?nt.fontName:getFallbackFontName(ot),mt=st&&st[pt],ct=_e.getHeight(),{width:vt,height:At,rotate:xt,position:{x:bt,y:Et},opacity:St}=convertForPdfLayoutProps({schema:nt,pageHeight:ct,applyRotateTranslate:!1});if(nt.backgroundColor){const yt=hex2PrintingColor(nt.backgroundColor,rt);_e.drawRectangle({x:bt,y:Et,width:vt,height:At,rotate:xt,color:yt})}_e.pushOperators(_.setCharacterSpacing(gt??DEFAULT_CHARACTER_SPACING));const Bt=heightOfFontAtSize(lt,it),Ot=getFontDescentInPt(lt,it),Pt=dt===0?0:(dt-1)*it/2,wt=splitTextToSize({value:s,characterSpacing:gt,fontSize:it,fontKitFont:lt,boxWidthInPt:vt});let Ct=0;if(ht===VERTICAL_ALIGN_TOP)Ct=Bt+Pt;else{const yt=dt*it*(wt.length-1);ht===VERTICAL_ALIGN_BOTTOM?Ct=At-yt+Ot-Pt:ht===VERTICAL_ALIGN_MIDDLE&&(Ct=(At-yt-Bt+Ot)/2+Bt)}const It={x:bt+vt/2,y:ct-mm2pt(nt.position.y)-At/2};wt.forEach((yt,Rt)=>{const kt=widthOfTextAtSize(yt,lt,it,gt),jt=heightOfFontAtSize(lt,it),Ht=dt*it*Rt;let Ft=bt;ft==="center"?Ft+=(vt-kt)/2:ft==="right"&&(Ft+=vt-kt);let _t=ct-mm2pt(nt.position.y)-Ct-Ht;if(nt.strikethrough&&kt>0){const Nt=Ft+kt+1,Mt=_t+jt/3;_e.drawLine({start:rotatePoint({x:Ft,y:Mt},It,xt.angle),end:rotatePoint({x:Nt,y:Mt},It,xt.angle),thickness:1/12*it,color:ut,opacity:St})}if(nt.underline&&kt>0){const Nt=Ft+kt+1,Mt=_t-jt/12;_e.drawLine({start:rotatePoint({x:Ft,y:Mt},It,xt.angle),end:rotatePoint({x:Nt,y:Mt},It,xt.angle),thickness:1/12*it,color:ut,opacity:St})}if(xt.angle!==0){const Nt=rotatePoint({x:Ft,y:_t},It,xt.angle);Ft=Nt.x,_t=Nt.y}_e.drawText(yt,{x:Ft,y:_t,rotate:xt,size:it,color:ut,lineHeight:dt*it,font:mt,opacity:St})})},TextStrikethroughIcon='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><path d="M6.85 7.08C6.85 4.37 9.45 3 12.24 3c1.64 0 3 .49 3.9 1.28c.77.65 1.46 1.73 1.46 3.24h-3.01c0-.31-.05-.59-.15-.85c-.29-.86-1.2-1.28-2.25-1.28c-1.86 0-2.34 1.02-2.34 1.7c0 .48.25.88.74 1.21c.38.25.77.48 1.41.7H7.39c-.21-.34-.54-.89-.54-1.92zM21 12v-2H3v2h9.62c1.15.45 1.96.75 1.96 1.97c0 1-.81 1.67-2.28 1.67c-1.54 0-2.93-.54-2.93-2.51H6.4c0 .55.08 1.13.24 1.58c.81 2.29 3.29 3.3 5.67 3.3c2.27 0 5.3-.89 5.3-4.05c0-.3-.01-1.16-.48-1.94H21V12z" fill="currentColor"></path></svg>',TextUnderlineIcon='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><path d="M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6zm-7 2v2h14v-2H5z" fill="currentColor"></path></svg>',TextAlignLeftIcon='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><path d="M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z" fill="currentColor"></path></svg>',TextAlignCenterIcon='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><path d="M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z" fill="currentColor"></path></svg>',TextAlignRightIcon='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><path d="M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z" fill="currentColor"></path></svg>',TextVerticalAlignTopIcon='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><path d="M8 11h3v10h2V11h3l-4-4l-4 4zM4 3v2h16V3H4z" fill="currentColor"></path></svg>',TextVerticalAlignMiddleIcon='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><path d="M8 19h3v4h2v-4h3l-4-4l-4 4zm8-14h-3V1h-2v4H8l4 4l4-4zM4 11v2h16v-2H4z" fill="currentColor"></path></svg>',TextVerticalAlignBottomIcon='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><path d="M16 13h-3V3h-2v10H8l4 4l4-4zM4 19v2h16v-2H4z" fill="currentColor"></path></svg>';var Formatter;(function(a){a.STRIKETHROUGH="strikethrough",a.UNDERLINE="underline",a.ALIGNMENT="alignment",a.VERTICAL_ALIGNMENT="verticalAlignment"})(Formatter||(Formatter={}));function getExtraFormatterSchema(a){const s=[{key:Formatter.STRIKETHROUGH,icon:TextStrikethroughIcon,type:"boolean"},{key:Formatter.UNDERLINE,icon:TextUnderlineIcon,type:"boolean"},{key:Formatter.ALIGNMENT,icon:TextAlignLeftIcon,type:"select",value:DEFAULT_ALIGNMENT},{key:Formatter.ALIGNMENT,icon:TextAlignCenterIcon,type:"select",value:ALIGN_CENTER},{key:Formatter.ALIGNMENT,icon:TextAlignRightIcon,type:"select",value:ALIGN_RIGHT},{key:Formatter.VERTICAL_ALIGNMENT,icon:TextVerticalAlignTopIcon,type:"select",value:DEFAULT_VERTICAL_ALIGNMENT},{key:Formatter.VERTICAL_ALIGNMENT,icon:TextVerticalAlignMiddleIcon,type:"select",value:VERTICAL_ALIGN_MIDDLE},{key:Formatter.VERTICAL_ALIGNMENT,icon:TextVerticalAlignBottomIcon,type:"select",value:VERTICAL_ALIGN_BOTTOM}];return{title:a("schemas.text.format"),widget:"ButtonGroup",buttons:s,span:17}}const UseDynamicFontSize=a=>{const{rootElement:s,changeSchemas:$,activeSchema:_,i18n:_e}=a,tt=document.createElement("input");tt.type="checkbox",tt.checked=!!(_!=null&&_.dynamicFontSize),tt.onchange=ot=>{const rt=ot.target.checked?{min:DEFAULT_DYNAMIC_MIN_FONT_SIZE,max:DEFAULT_DYNAMIC_MAX_FONT_SIZE,fit:DEFAULT_DYNAMIC_FIT}:void 0;$([{key:"dynamicFontSize",value:rt,schemaId:_.id}])};const nt=document.createElement("label"),at=document.createElement("span");at.innerText=_e("schemas.text.dynamicFontSize")||"",at.style.cssText="margin-left: 0.5rem",nt.style.cssText="display: flex; width: 100%;",nt.appendChild(tt),nt.appendChild(at),s.appendChild(nt)},propPanel={schema:({options:a,activeSchema:s,i18n:$})=>{const _=a.font||{[DEFAULT_FONT_NAME]:{data:"",fallback:!0}},_e=Object.keys(_),tt=getFallbackFontName(_),nt=!!(s!=null&&s.dynamicFontSize);return{fontName:{title:$("schemas.text.fontName"),type:"string",widget:"select",default:tt,props:{options:_e.map(ot=>({label:ot,value:ot}))},span:12},fontSize:{title:$("schemas.text.size"),type:"number",widget:"inputNumber",span:6,disabled:nt,props:{min:0}},characterSpacing:{title:$("schemas.text.spacing"),type:"number",widget:"inputNumber",span:6,props:{min:0}},formatter:getExtraFormatterSchema($),lineHeight:{title:$("schemas.text.lineHeight"),type:"number",widget:"inputNumber",props:{step:.1,min:0},span:7},useDynamicFontSize:{type:"boolean",widget:"UseDynamicFontSize",bind:!1,span:16},dynamicFontSize:{type:"object",widget:"card",column:3,properties:{min:{title:$("schemas.text.min"),type:"number",widget:"inputNumber",hidden:!nt,props:{min:0}},max:{title:$("schemas.text.max"),type:"number",widget:"inputNumber",hidden:!nt,props:{min:0}},fit:{title:$("schemas.text.fit"),type:"string",widget:"select",hidden:!nt,props:{options:[{label:$("schemas.horizontal"),value:DYNAMIC_FIT_HORIZONTAL},{label:$("schemas.vertical"),value:DYNAMIC_FIT_VERTICAL}]}}}},fontColor:{title:$("schemas.textColor"),type:"string",widget:"color",rules:[{pattern:HEX_COLOR_PATTERN,message:$("validation.hexColor")}]},backgroundColor:{title:$("schemas.bgColor"),type:"string",widget:"color",rules:[{pattern:HEX_COLOR_PATTERN,message:$("validation.hexColor")}]}}},widgets:{UseDynamicFontSize},defaultSchema:{name:"",type:"text",content:"Type Something...",position:{x:0,y:0},width:45,height:10,rotate:0,alignment:DEFAULT_ALIGNMENT,verticalAlignment:DEFAULT_VERTICAL_ALIGNMENT,fontSize:DEFAULT_FONT_SIZE,lineHeight:DEFAULT_LINE_HEIGHT,characterSpacing:DEFAULT_CHARACTER_SPACING,dynamicFontSize:void 0,fontColor:DEFAULT_FONT_COLOR,fontName:void 0,backgroundColor:"",opacity:DEFAULT_OPACITY,strikethrough:!1,underline:!1}},replaceUnsupportedChars=(a,s)=>{const $={},_=tt=>{if(tt in $)return $[tt];const nt=s.hasGlyphForCodePoint(tt.codePointAt(0)||0);return $[tt]=nt,nt};return a.split(/(\r\n|\n|\r)/).map(tt=>/\r\n|\n|\r/.test(tt)?tt:tt.split("").map(nt=>/\s/.test(nt)||nt.charCodeAt(0)<32||_(nt)?nt:"〿").join("")).join("")},uiRender=async a=>{const{value:s,schema:$,mode:_,onChange:_e,stopEditing:tt,tabIndex:nt,placeholder:at,options:ot,_cache:rt}=a,st=isEditable(_,$)&&at&&!s,lt=ht=>{let dt=ht.innerText;return dt.endsWith(`
130
- `)&&(dt=dt.slice(0,-1)),dt},et=(ot==null?void 0:ot.font)||getDefaultFont(),[it,ut]=await Promise.all([getFontKitFont($.fontName,et,rt),buildStyledTextContainer(a,st?at:s)]),ft=replaceUnsupportedChars(s,it);if(!isEditable(_,$)){ut.innerHTML=ft.split("").map((ht,dt)=>`<span style="letter-spacing:${String(s).length===dt+1?0:"inherit"};">${ht}</span>`).join("");return}if(makeElementPlainTextContentEditable(ut),ut.tabIndex=nt||0,ut.innerText=_==="designer"?s:ft,ut.addEventListener("blur",ht=>{_e&&_e({key:"content",value:lt(ht.target)}),tt&&tt()}),$.dynamicFontSize){let ht;const dt=(ot==null?void 0:ot.font)||getDefaultFont(),gt=await getFontKitFont($.fontName,dt,rt);ut.addEventListener("keyup",()=>{setTimeout(()=>{(async()=>{if(!ut.textContent)return;ht=await calculateDynamicFontSize({textSchema:$,font:dt,value:lt(ut),startingFontSize:ht,_cache:rt}),ut.style.fontSize=`${ht}pt`;const{topAdj:pt,bottomAdj:mt}=getBrowserVerticalFontAdjustments(gt,ht??$.fontSize??DEFAULT_FONT_SIZE,$.lineHeight??DEFAULT_LINE_HEIGHT,$.verticalAlignment??DEFAULT_VERTICAL_ALIGNMENT);ut.style.paddingTop=`${pt}px`,ut.style.marginBottom=`${mt}px`})()},0)})}st&&(ut.style.color=PLACEHOLDER_FONT_COLOR,ut.addEventListener("focus",()=>{ut.innerText===at&&(ut.innerText="",ut.style.color=$.fontColor??DEFAULT_FONT_COLOR)})),_==="designer"&&setTimeout(()=>{ut.focus();const ht=window.getSelection(),dt=document.createRange();ht&&dt&&(dt.selectNodeContents(ut),dt.collapse(!1),ht==null||ht.removeAllRanges(),ht==null||ht.addRange(dt))})},buildStyledTextContainer=async(a,s)=>{const{schema:$,rootElement:_,mode:_e,options:tt,_cache:nt}=a,at=(tt==null?void 0:tt.font)||getDefaultFont();let ot;$.dynamicFontSize&&s&&(ot=await calculateDynamicFontSize({textSchema:$,font:at,value:s,startingFontSize:ot,_cache:nt}));const rt=await getFontKitFont($.fontName,at,nt),{topAdj:st,bottomAdj:lt}=getBrowserVerticalFontAdjustments(rt,ot??$.fontSize??DEFAULT_FONT_SIZE,$.lineHeight??DEFAULT_LINE_HEIGHT,$.verticalAlignment??DEFAULT_VERTICAL_ALIGNMENT),et=st.toString(),it=lt.toString(),ut=document.createElement("div"),ft={padding:0,resize:"none",backgroundColor:getBackgroundColor(s,$),border:"none",display:"flex",flexDirection:"column",justifyContent:mapVerticalAlignToFlex($.verticalAlignment),width:"100%",height:"100%",cursor:isEditable(_e,$)?"text":"default"};Object.assign(ut.style,ft),_.innerHTML="",_.appendChild(ut);const ht=[];$.strikethrough&&ht.push("line-through"),$.underline&&ht.push("underline");const dt={fontFamily:$.fontName?`'${$.fontName}'`:"inherit",color:$.fontColor?$.fontColor:DEFAULT_FONT_COLOR,fontSize:`${ot??$.fontSize??DEFAULT_FONT_SIZE}pt`,letterSpacing:`${$.characterSpacing??DEFAULT_CHARACTER_SPACING}pt`,lineHeight:`${$.lineHeight??DEFAULT_LINE_HEIGHT}em`,textAlign:$.alignment??DEFAULT_ALIGNMENT,whiteSpace:"pre-wrap",wordBreak:"break-word",resize:"none",border:"none",outline:"none",marginBottom:`${it}px`,paddingTop:`${et}px`,backgroundColor:"transparent",textDecoration:ht.join(" ")},gt=document.createElement("div");return gt.id="text-"+$.id,Object.assign(gt.style,dt),ut.appendChild(gt),gt},makeElementPlainTextContentEditable=a=>{if(!isFirefox()){a.contentEditable="plaintext-only";return}a.contentEditable="true",a.addEventListener("keydown",s=>{s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),document.execCommand("insertLineBreak",!1,void 0))}),a.addEventListener("paste",s=>{var _e;s.preventDefault();const $=(_e=s.clipboardData)==null?void 0:_e.getData("text"),_=window.getSelection();_!=null&&_.rangeCount&&(_.deleteFromDocument(),_.getRangeAt(0).insertNode(document.createTextNode($||"")),_.collapseToEnd())})},mapVerticalAlignToFlex=a=>{switch(a){case VERTICAL_ALIGN_TOP:return"flex-start";case VERTICAL_ALIGN_MIDDLE:return"center";case VERTICAL_ALIGN_BOTTOM:return"flex-end"}return"flex-start"},getBackgroundColor=(a,s)=>!a||!s.backgroundColor?"transparent":s.backgroundColor,textSchema={pdf:pdfRender,ui:uiRender,propPanel,icon:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-text-cursor-input"><path d="M5 4h1a3 3 0 0 1 3 3 3 3 0 0 1 3-3h1"/><path d="M13 20h-1a3 3 0 0 1-3-3 3 3 0 0 1-3 3H5"/><path d="M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1"/><path d="M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7"/><path d="M9 7v10"/></svg>'},text=textSchema,builtInPlugins={Text:text};class BaseUIClass{constructor(s){this.lang=DEFAULT_LANG,this.font=getDefaultFont(),this.pluginsRegistry=builtInPlugins,this.options={},this.setSize=debounce$1(()=>{if(!this.domContainer)throw Error(DESTROYED_ERR_MSG);this.size={height:this.domContainer.clientHeight||window.innerHeight,width:this.domContainer.clientWidth||window.innerWidth},this.render()},100),this.resizeObserver=new ResizeObserver(this.setSize),checkUIProps(s);const{domContainer:$,template:_,options:_e={},plugins:tt={}}=s;this.domContainer=$,this.template=cloneDeep$1(_),this.options=_e,this.size={height:this.domContainer.clientHeight||window.innerHeight,width:this.domContainer.clientWidth||window.innerWidth},this.resizeObserver.observe(this.domContainer);const{lang:nt,font:at}=_e;nt&&(this.lang=nt),at&&(this.font=at),Object.values(tt).length>0&&(this.pluginsRegistry=tt)}getLang(){return this.lang}getFont(){return this.font}getPluginsRegistry(){return this.pluginsRegistry}getOptions(){return this.options}getTemplate(){if(!this.domContainer)throw Error(DESTROYED_ERR_MSG);return this.template}updateTemplate(s){if(checkTemplate(s),!this.domContainer)throw Error(DESTROYED_ERR_MSG);this.template=cloneDeep$1(s),this.render()}updateOptions(s){checkUIOptions(s);const{lang:$,font:_}=s||{};$&&(this.lang=$),_&&(this.font=_),this.options=Object.assign(this.options,s),this.render()}destroy(){if(!this.domContainer)throw Error(DESTROYED_ERR_MSG);ReactDOM.unmountComponentAtNode(this.domContainer),this.resizeObserver.unobserve(this.domContainer),this.domContainer=null}}class PreviewUI extends BaseUIClass{constructor(s){super(s),checkPreviewProps(s),this.inputs=convertToStingObjectArray(cloneDeep$1(s.inputs))}getInputs(){if(!this.domContainer)throw Error(DESTROYED_ERR_MSG);return this.inputs}setInputs(s){if(!this.domContainer)throw Error(DESTROYED_ERR_MSG);checkInputs(s),this.inputs=convertToStingObjectArray(s),this.render()}}function convertToStingObjectArray(a){return a.map(s=>{const $={};return Object.keys(s).forEach(_=>{const _e=s[_];Array.isArray(_e)?$[_]=JSON.stringify(_e):$[_]=_e}),$})}function useCombinedRefs(){for(var a=arguments.length,s=new Array(a),$=0;$<a;$++)s[$]=arguments[$];return reactExports.useMemo(()=>_=>{s.forEach(_e=>_e(_))},s)}const canUseDOM=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function isWindow$4(a){const s=Object.prototype.toString.call(a);return s==="[object Window]"||s==="[object global]"}function isNode$1(a){return"nodeType"in a}function getWindow$1(a){var s,$;return a?isWindow$4(a)?a:isNode$1(a)&&(s=($=a.ownerDocument)==null?void 0:$.defaultView)!=null?s:window:window}function isDocument(a){const{Document:s}=getWindow$1(a);return a instanceof s}function isHTMLElement(a){return isWindow$4(a)?!1:a instanceof getWindow$1(a).HTMLElement}function isSVGElement(a){return a instanceof getWindow$1(a).SVGElement}function getOwnerDocument(a){return a?isWindow$4(a)?a.document:isNode$1(a)?isDocument(a)?a:isHTMLElement(a)||isSVGElement(a)?a.ownerDocument:document:document:document}const useIsomorphicLayoutEffect$1=canUseDOM?reactExports.useLayoutEffect:reactExports.useEffect;function useEvent$1(a){const s=reactExports.useRef(a);return useIsomorphicLayoutEffect$1(()=>{s.current=a}),reactExports.useCallback(function(){for(var $=arguments.length,_=new Array($),_e=0;_e<$;_e++)_[_e]=arguments[_e];return s.current==null?void 0:s.current(..._)},[])}function useInterval(){const a=reactExports.useRef(null),s=reactExports.useCallback((_,_e)=>{a.current=setInterval(_,_e)},[]),$=reactExports.useCallback(()=>{a.current!==null&&(clearInterval(a.current),a.current=null)},[]);return[s,$]}function useLatestValue(a,s){s===void 0&&(s=[a]);const $=reactExports.useRef(a);return useIsomorphicLayoutEffect$1(()=>{$.current!==a&&($.current=a)},s),$}function useLazyMemo(a,s){const $=reactExports.useRef();return reactExports.useMemo(()=>{const _=a($.current);return $.current=_,_},[...s])}function useNodeRef(a){const s=useEvent$1(a),$=reactExports.useRef(null),_=reactExports.useCallback(_e=>{_e!==$.current&&(s==null||s(_e,$.current)),$.current=_e},[]);return[$,_]}function usePrevious$1(a){const s=reactExports.useRef();return reactExports.useEffect(()=>{s.current=a},[a]),s.current}let ids={};function useUniqueId(a,s){return reactExports.useMemo(()=>{if(s)return s;const $=ids[a]==null?0:ids[a]+1;return ids[a]=$,a+"-"+$},[a,s])}function createAdjustmentFn(a){return function(s){for(var $=arguments.length,_=new Array($>1?$-1:0),_e=1;_e<$;_e++)_[_e-1]=arguments[_e];return _.reduce((tt,nt)=>{const at=Object.entries(nt);for(const[ot,rt]of at){const st=tt[ot];st!=null&&(tt[ot]=st+a*rt)}return tt},{...s})}}const add$1=createAdjustmentFn(1),subtract=createAdjustmentFn(-1);function hasViewportRelativeCoordinates(a){return"clientX"in a&&"clientY"in a}function isKeyboardEvent(a){if(!a)return!1;const{KeyboardEvent:s}=getWindow$1(a.target);return s&&a instanceof s}function isTouchEvent(a){if(!a)return!1;const{TouchEvent:s}=getWindow$1(a.target);return s&&a instanceof s}function getEventCoordinates(a){if(isTouchEvent(a)){if(a.touches&&a.touches.length){const{clientX:s,clientY:$}=a.touches[0];return{x:s,y:$}}else if(a.changedTouches&&a.changedTouches.length){const{clientX:s,clientY:$}=a.changedTouches[0];return{x:s,y:$}}}return hasViewportRelativeCoordinates(a)?{x:a.clientX,y:a.clientY}:null}const CSS$1=Object.freeze({Translate:{toString(a){if(!a)return;const{x:s,y:$}=a;return"translate3d("+(s?Math.round(s):0)+"px, "+($?Math.round($):0)+"px, 0)"}},Scale:{toString(a){if(!a)return;const{scaleX:s,scaleY:$}=a;return"scaleX("+s+") scaleY("+$+")"}},Transform:{toString(a){if(a)return[CSS$1.Translate.toString(a),CSS$1.Scale.toString(a)].join(" ")}},Transition:{toString(a){let{property:s,duration:$,easing:_}=a;return s+" "+$+"ms "+_}}}),SELECTOR="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function findFirstFocusableNode(a){return a.matches(SELECTOR)?a:a.querySelector(SELECTOR)}const hiddenStyles={display:"none"};function HiddenText(a){let{id:s,value:$}=a;return React$a.createElement("div",{id:s,style:hiddenStyles},$)}function LiveRegion(a){let{id:s,announcement:$,ariaLiveType:_="assertive"}=a;const _e={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return React$a.createElement("div",{id:s,style:_e,role:"status","aria-live":_,"aria-atomic":!0},$)}function useAnnouncement(){const[a,s]=reactExports.useState("");return{announce:reactExports.useCallback(_=>{_!=null&&s(_)},[]),announcement:a}}const DndMonitorContext=reactExports.createContext(null);function useDndMonitor(a){const s=reactExports.useContext(DndMonitorContext);reactExports.useEffect(()=>{if(!s)throw new Error("useDndMonitor must be used within a children of <DndContext>");return s(a)},[a,s])}function useDndMonitorProvider(){const[a]=reactExports.useState(()=>new Set),s=reactExports.useCallback(_=>(a.add(_),()=>a.delete(_)),[a]);return[reactExports.useCallback(_=>{let{type:_e,event:tt}=_;a.forEach(nt=>{var at;return(at=nt[_e])==null?void 0:at.call(nt,tt)})},[a]),s]}const defaultScreenReaderInstructions={draggable:`
130
+ `)&&(dt=dt.slice(0,-1)),dt},et=(ot==null?void 0:ot.font)||getDefaultFont(),[it,ut]=await Promise.all([getFontKitFont($.fontName,et,rt),buildStyledTextContainer(a,st?at:s)]),ft=replaceUnsupportedChars(s,it);if(!isEditable(_,$)){ut.innerHTML=ft.split("").map((ht,dt)=>`<span style="letter-spacing:${String(s).length===dt+1?0:"inherit"};">${ht}</span>`).join("");return}if(makeElementPlainTextContentEditable(ut),ut.tabIndex=nt||0,ut.innerText=_==="designer"?s:ft,ut.addEventListener("blur",ht=>{_e&&_e({key:"content",value:lt(ht.target)}),tt&&tt()}),$.dynamicFontSize){let ht;const dt=(ot==null?void 0:ot.font)||getDefaultFont(),gt=await getFontKitFont($.fontName,dt,rt);ut.addEventListener("keyup",()=>{setTimeout(()=>{(async()=>{if(!ut.textContent)return;ht=await calculateDynamicFontSize({textSchema:$,font:dt,value:lt(ut),startingFontSize:ht,_cache:rt}),ut.style.fontSize=`${ht}pt`;const{topAdj:pt,bottomAdj:mt}=getBrowserVerticalFontAdjustments(gt,ht??$.fontSize??DEFAULT_FONT_SIZE,$.lineHeight??DEFAULT_LINE_HEIGHT,$.verticalAlignment??DEFAULT_VERTICAL_ALIGNMENT);ut.style.paddingTop=`${pt}px`,ut.style.marginBottom=`${mt}px`})()},0)})}st&&(ut.style.color=PLACEHOLDER_FONT_COLOR,ut.addEventListener("focus",()=>{ut.innerText===at&&(ut.innerText="",ut.style.color=$.fontColor??DEFAULT_FONT_COLOR)})),_==="designer"&&setTimeout(()=>{ut.focus();const ht=window.getSelection(),dt=document.createRange();ht&&dt&&(dt.selectNodeContents(ut),dt.collapse(!1),ht==null||ht.removeAllRanges(),ht==null||ht.addRange(dt))})},buildStyledTextContainer=async(a,s)=>{const{schema:$,rootElement:_,mode:_e,options:tt,_cache:nt}=a,at=(tt==null?void 0:tt.font)||getDefaultFont();let ot;$.dynamicFontSize&&s&&(ot=await calculateDynamicFontSize({textSchema:$,font:at,value:s,startingFontSize:ot,_cache:nt}));const rt=await getFontKitFont($.fontName,at,nt),{topAdj:st,bottomAdj:lt}=getBrowserVerticalFontAdjustments(rt,ot??$.fontSize??DEFAULT_FONT_SIZE,$.lineHeight??DEFAULT_LINE_HEIGHT,$.verticalAlignment??DEFAULT_VERTICAL_ALIGNMENT),et=st.toString(),it=lt.toString(),ut=document.createElement("div"),ft={padding:0,resize:"none",backgroundColor:getBackgroundColor(s,$),border:"none",display:"flex",flexDirection:"column",justifyContent:mapVerticalAlignToFlex($.verticalAlignment),width:"100%",height:"100%",cursor:isEditable(_e,$)?"text":"default"};Object.assign(ut.style,ft),_.innerHTML="",_.appendChild(ut);const ht=[];$.strikethrough&&ht.push("line-through"),$.underline&&ht.push("underline");const dt={fontFamily:$.fontName?`'${$.fontName}'`:"inherit",color:$.fontColor?$.fontColor:DEFAULT_FONT_COLOR,fontSize:`${ot??$.fontSize??DEFAULT_FONT_SIZE}pt`,letterSpacing:`${$.characterSpacing??DEFAULT_CHARACTER_SPACING}pt`,lineHeight:`${$.lineHeight??DEFAULT_LINE_HEIGHT}em`,textAlign:$.alignment??DEFAULT_ALIGNMENT,whiteSpace:"pre-wrap",wordBreak:"break-word",resize:"none",border:"none",outline:"none",marginBottom:`${it}px`,paddingTop:`${et}px`,backgroundColor:"transparent",textDecoration:ht.join(" ")},gt=document.createElement("div");return gt.id="text-"+String($.id),Object.assign(gt.style,dt),ut.appendChild(gt),gt},makeElementPlainTextContentEditable=a=>{if(!isFirefox()){a.contentEditable="plaintext-only";return}a.contentEditable="true",a.addEventListener("keydown",s=>{s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),document.execCommand("insertLineBreak",!1,void 0))}),a.addEventListener("paste",s=>{var _e;s.preventDefault();const $=(_e=s.clipboardData)==null?void 0:_e.getData("text"),_=window.getSelection();_!=null&&_.rangeCount&&(_.deleteFromDocument(),_.getRangeAt(0).insertNode(document.createTextNode($||"")),_.collapseToEnd())})},mapVerticalAlignToFlex=a=>{switch(a){case VERTICAL_ALIGN_TOP:return"flex-start";case VERTICAL_ALIGN_MIDDLE:return"center";case VERTICAL_ALIGN_BOTTOM:return"flex-end"}return"flex-start"},getBackgroundColor=(a,s)=>!a||!s.backgroundColor?"transparent":s.backgroundColor,textSchema={pdf:pdfRender,ui:uiRender,propPanel,icon:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-text-cursor-input"><path d="M5 4h1a3 3 0 0 1 3 3 3 3 0 0 1 3-3h1"/><path d="M13 20h-1a3 3 0 0 1-3-3 3 3 0 0 1-3 3H5"/><path d="M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1"/><path d="M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7"/><path d="M9 7v10"/></svg>'},text=textSchema,builtInPlugins={Text:text};class BaseUIClass{constructor(s){this.lang=DEFAULT_LANG,this.font=getDefaultFont(),this.pluginsRegistry=builtInPlugins,this.options={},this.setSize=debounce$1(()=>{if(!this.domContainer)throw Error(DESTROYED_ERR_MSG);this.size={height:this.domContainer.clientHeight||window.innerHeight,width:this.domContainer.clientWidth||window.innerWidth},this.render()},100),this.resizeObserver=new ResizeObserver(this.setSize),checkUIProps(s);const{domContainer:$,template:_,options:_e={},plugins:tt={}}=s;this.domContainer=$,this.template=cloneDeep$1(_),this.options=_e,this.size={height:this.domContainer.clientHeight||window.innerHeight,width:this.domContainer.clientWidth||window.innerWidth},this.resizeObserver.observe(this.domContainer);const{lang:nt,font:at}=_e;nt&&(this.lang=nt),at&&(this.font=at),Object.values(tt).length>0&&(this.pluginsRegistry=tt)}getLang(){return this.lang}getFont(){return this.font}getPluginsRegistry(){return this.pluginsRegistry}getOptions(){return this.options}getTemplate(){if(!this.domContainer)throw Error(DESTROYED_ERR_MSG);return this.template}updateTemplate(s){if(checkTemplate(s),!this.domContainer)throw Error(DESTROYED_ERR_MSG);this.template=cloneDeep$1(s),this.render()}updateOptions(s){checkUIOptions(s);const{lang:$,font:_}=s||{};$&&(this.lang=$),_&&(this.font=_),this.options=Object.assign(this.options,s),this.render()}destroy(){if(!this.domContainer)throw Error(DESTROYED_ERR_MSG);ReactDOM.unmountComponentAtNode(this.domContainer),this.resizeObserver.unobserve(this.domContainer),this.domContainer=null}}class PreviewUI extends BaseUIClass{constructor(s){super(s),checkPreviewProps(s),this.inputs=convertToStingObjectArray(cloneDeep$1(s.inputs))}getInputs(){if(!this.domContainer)throw Error(DESTROYED_ERR_MSG);return this.inputs}setInputs(s){if(!this.domContainer)throw Error(DESTROYED_ERR_MSG);checkInputs(s),this.inputs=convertToStingObjectArray(s),this.render()}}function convertToStingObjectArray(a){return a.map(s=>{const $={};return Object.keys(s).forEach(_=>{const _e=s[_];Array.isArray(_e)?$[_]=JSON.stringify(_e):$[_]=_e}),$})}function useCombinedRefs(){for(var a=arguments.length,s=new Array(a),$=0;$<a;$++)s[$]=arguments[$];return reactExports.useMemo(()=>_=>{s.forEach(_e=>_e(_))},s)}const canUseDOM=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function isWindow$4(a){const s=Object.prototype.toString.call(a);return s==="[object Window]"||s==="[object global]"}function isNode$1(a){return"nodeType"in a}function getWindow$1(a){var s,$;return a?isWindow$4(a)?a:isNode$1(a)&&(s=($=a.ownerDocument)==null?void 0:$.defaultView)!=null?s:window:window}function isDocument(a){const{Document:s}=getWindow$1(a);return a instanceof s}function isHTMLElement(a){return isWindow$4(a)?!1:a instanceof getWindow$1(a).HTMLElement}function isSVGElement(a){return a instanceof getWindow$1(a).SVGElement}function getOwnerDocument(a){return a?isWindow$4(a)?a.document:isNode$1(a)?isDocument(a)?a:isHTMLElement(a)||isSVGElement(a)?a.ownerDocument:document:document:document}const useIsomorphicLayoutEffect$1=canUseDOM?reactExports.useLayoutEffect:reactExports.useEffect;function useEvent$1(a){const s=reactExports.useRef(a);return useIsomorphicLayoutEffect$1(()=>{s.current=a}),reactExports.useCallback(function(){for(var $=arguments.length,_=new Array($),_e=0;_e<$;_e++)_[_e]=arguments[_e];return s.current==null?void 0:s.current(..._)},[])}function useInterval(){const a=reactExports.useRef(null),s=reactExports.useCallback((_,_e)=>{a.current=setInterval(_,_e)},[]),$=reactExports.useCallback(()=>{a.current!==null&&(clearInterval(a.current),a.current=null)},[]);return[s,$]}function useLatestValue(a,s){s===void 0&&(s=[a]);const $=reactExports.useRef(a);return useIsomorphicLayoutEffect$1(()=>{$.current!==a&&($.current=a)},s),$}function useLazyMemo(a,s){const $=reactExports.useRef();return reactExports.useMemo(()=>{const _=a($.current);return $.current=_,_},[...s])}function useNodeRef(a){const s=useEvent$1(a),$=reactExports.useRef(null),_=reactExports.useCallback(_e=>{_e!==$.current&&(s==null||s(_e,$.current)),$.current=_e},[]);return[$,_]}function usePrevious$1(a){const s=reactExports.useRef();return reactExports.useEffect(()=>{s.current=a},[a]),s.current}let ids={};function useUniqueId(a,s){return reactExports.useMemo(()=>{if(s)return s;const $=ids[a]==null?0:ids[a]+1;return ids[a]=$,a+"-"+$},[a,s])}function createAdjustmentFn(a){return function(s){for(var $=arguments.length,_=new Array($>1?$-1:0),_e=1;_e<$;_e++)_[_e-1]=arguments[_e];return _.reduce((tt,nt)=>{const at=Object.entries(nt);for(const[ot,rt]of at){const st=tt[ot];st!=null&&(tt[ot]=st+a*rt)}return tt},{...s})}}const add$1=createAdjustmentFn(1),subtract=createAdjustmentFn(-1);function hasViewportRelativeCoordinates(a){return"clientX"in a&&"clientY"in a}function isKeyboardEvent(a){if(!a)return!1;const{KeyboardEvent:s}=getWindow$1(a.target);return s&&a instanceof s}function isTouchEvent(a){if(!a)return!1;const{TouchEvent:s}=getWindow$1(a.target);return s&&a instanceof s}function getEventCoordinates(a){if(isTouchEvent(a)){if(a.touches&&a.touches.length){const{clientX:s,clientY:$}=a.touches[0];return{x:s,y:$}}else if(a.changedTouches&&a.changedTouches.length){const{clientX:s,clientY:$}=a.changedTouches[0];return{x:s,y:$}}}return hasViewportRelativeCoordinates(a)?{x:a.clientX,y:a.clientY}:null}const CSS$1=Object.freeze({Translate:{toString(a){if(!a)return;const{x:s,y:$}=a;return"translate3d("+(s?Math.round(s):0)+"px, "+($?Math.round($):0)+"px, 0)"}},Scale:{toString(a){if(!a)return;const{scaleX:s,scaleY:$}=a;return"scaleX("+s+") scaleY("+$+")"}},Transform:{toString(a){if(a)return[CSS$1.Translate.toString(a),CSS$1.Scale.toString(a)].join(" ")}},Transition:{toString(a){let{property:s,duration:$,easing:_}=a;return s+" "+$+"ms "+_}}}),SELECTOR="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function findFirstFocusableNode(a){return a.matches(SELECTOR)?a:a.querySelector(SELECTOR)}const hiddenStyles={display:"none"};function HiddenText(a){let{id:s,value:$}=a;return React$a.createElement("div",{id:s,style:hiddenStyles},$)}function LiveRegion(a){let{id:s,announcement:$,ariaLiveType:_="assertive"}=a;const _e={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return React$a.createElement("div",{id:s,style:_e,role:"status","aria-live":_,"aria-atomic":!0},$)}function useAnnouncement(){const[a,s]=reactExports.useState("");return{announce:reactExports.useCallback(_=>{_!=null&&s(_)},[]),announcement:a}}const DndMonitorContext=reactExports.createContext(null);function useDndMonitor(a){const s=reactExports.useContext(DndMonitorContext);reactExports.useEffect(()=>{if(!s)throw new Error("useDndMonitor must be used within a children of <DndContext>");return s(a)},[a,s])}function useDndMonitorProvider(){const[a]=reactExports.useState(()=>new Set),s=reactExports.useCallback(_=>(a.add(_),()=>a.delete(_)),[a]);return[reactExports.useCallback(_=>{let{type:_e,event:tt}=_;a.forEach(nt=>{var at;return(at=nt[_e])==null?void 0:at.call(nt,tt)})},[a]),s]}const defaultScreenReaderInstructions={draggable:`
131
131
  To pick up a draggable item, press the space bar.
132
132
  While dragging, use the arrow keys to move the item.
133
133
  Press space again to drop the item in its new position, or press escape to cancel.
@@ -588,7 +588,7 @@ html body {
588
588
  ${$}-eye,
589
589
  ${$}-download,
590
590
  ${$}-delete
591
- `]:{zIndex:10,width:_,margin:`0 ${unit$1(a.marginXXS)}`,fontSize:_,cursor:"pointer",transition:`all ${a.motionDurationSlow}`,color:_e,"&:hover":{color:_e},svg:{verticalAlign:"baseline"}}},[`${at}-thumbnail, ${at}-thumbnail img`]:{position:"static",display:"block",width:"100%",height:"100%",objectFit:"contain"},[`${at}-name`]:{display:"none",textAlign:"center"},[`${at}-file + ${at}-name`]:{position:"absolute",bottom:a.margin,display:"block",width:`calc(100% - ${unit$1(tt(a.paddingXS).mul(2).equal())})`},[`${at}-uploading`]:{[`&${at}`]:{backgroundColor:a.colorFillAlter},[`&::before, ${$}-eye, ${$}-download, ${$}-delete`]:{display:"none"}},[`${at}-progress`]:{bottom:a.marginXL,width:`calc(100% - ${unit$1(tt(a.paddingXS).mul(2).equal())})`,paddingInlineStart:0}}}),[`${s}-wrapper${s}-picture-circle-wrapper`]:{[`${s}${s}-select`]:{borderRadius:"50%"}}}},genRtlStyle=a=>{const{componentCls:s}=a;return{[`${s}-rtl`]:{direction:"rtl"}}},genRtlStyle$1=genRtlStyle,genBaseStyle=a=>{const{componentCls:s,colorTextDisabled:$}=a;return{[`${s}-wrapper`]:Object.assign(Object.assign({},resetComponent(a)),{[s]:{outline:0,"input[type='file']":{cursor:"pointer"}},[`${s}-select`]:{display:"inline-block"},[`${s}-disabled`]:{color:$,cursor:"not-allowed"}})}},prepareComponentToken=a=>({actionsColor:a.colorTextDescription}),useStyle=genStyleHooks("Upload",a=>{const{fontSizeHeading3:s,fontHeight:$,lineWidth:_,controlHeightLG:_e,calc:tt}=a,nt=merge(a,{uploadThumbnailSize:tt(s).mul(2).equal(),uploadProgressOffset:tt(tt($).div(2)).add(_).equal(),uploadPicCardSize:tt(_e).mul(2.55).equal()});return[genBaseStyle(nt),genDraggerStyle$1(nt),genPictureStyle(nt),genPictureCardStyle(nt),genListStyle$1(nt),genMotionStyle$1(nt),genRtlStyle$1(nt),genCollapseMotion$1(nt)]},prepareComponentToken);var FileTwoTone$2={icon:function a(s,$){return{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M534 352V136H232v752h560V394H576a42 42 0 01-42-42z",fill:$}},{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM602 137.8L790.2 326H602V137.8zM792 888H232V136h302v216a42 42 0 0042 42h216v494z",fill:s}}]}},name:"file",theme:"twotone"};const FileTwoToneSvg=FileTwoTone$2;var FileTwoTone=function a(s,$){return reactExports.createElement(AntdIcon$1,_extends$2({},s,{ref:$,icon:FileTwoToneSvg}))};const FileTwoTone$1=reactExports.forwardRef(FileTwoTone);var PaperClipOutlined$2={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M779.3 196.6c-94.2-94.2-247.6-94.2-341.7 0l-261 260.8c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l261-260.8c32.4-32.4 75.5-50.2 121.3-50.2s88.9 17.8 121.2 50.2c32.4 32.4 50.2 75.5 50.2 121.2 0 45.8-17.8 88.8-50.2 121.2l-266 265.9-43.1 43.1c-40.3 40.3-105.8 40.3-146.1 0-19.5-19.5-30.2-45.4-30.2-73s10.7-53.5 30.2-73l263.9-263.8c6.7-6.6 15.5-10.3 24.9-10.3h.1c9.4 0 18.1 3.7 24.7 10.3 6.7 6.7 10.3 15.5 10.3 24.9 0 9.3-3.7 18.1-10.3 24.7L372.4 653c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l215.6-215.6c19.9-19.9 30.8-46.3 30.8-74.4s-11-54.6-30.8-74.4c-41.1-41.1-107.9-41-149 0L463 364 224.8 602.1A172.22 172.22 0 00174 724.8c0 46.3 18.1 89.8 50.8 122.5 33.9 33.8 78.3 50.7 122.7 50.7 44.4 0 88.8-16.9 122.6-50.7l309.2-309C824.8 492.7 850 432 850 367.5c.1-64.6-25.1-125.3-70.7-170.9z"}}]},name:"paper-clip",theme:"outlined"};const PaperClipOutlinedSvg=PaperClipOutlined$2;var PaperClipOutlined=function a(s,$){return reactExports.createElement(AntdIcon$1,_extends$2({},s,{ref:$,icon:PaperClipOutlinedSvg}))};const PaperClipOutlined$1=reactExports.forwardRef(PaperClipOutlined);var PictureTwoTone$2={icon:function a(s,$){return{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136v-39.9l138.5-164.3 150.1 178L658.1 489 888 761.6V792zm0-129.8L664.2 396.8c-3.2-3.8-9-3.8-12.2 0L424.6 666.4l-144-170.7c-3.2-3.8-9-3.8-12.2 0L136 652.7V232h752v430.2z",fill:s}},{tag:"path",attrs:{d:"M424.6 765.8l-150.1-178L136 752.1V792h752v-30.4L658.1 489z",fill:$}},{tag:"path",attrs:{d:"M136 652.7l132.4-157c3.2-3.8 9-3.8 12.2 0l144 170.7L652 396.8c3.2-3.8 9-3.8 12.2 0L888 662.2V232H136v420.7zM304 280a88 88 0 110 176 88 88 0 010-176z",fill:$}},{tag:"path",attrs:{d:"M276 368a28 28 0 1056 0 28 28 0 10-56 0z",fill:$}},{tag:"path",attrs:{d:"M304 456a88 88 0 100-176 88 88 0 000 176zm0-116c15.5 0 28 12.5 28 28s-12.5 28-28 28-28-12.5-28-28 12.5-28 28-28z",fill:s}}]}},name:"picture",theme:"twotone"};const PictureTwoToneSvg=PictureTwoTone$2;var PictureTwoTone=function a(s,$){return reactExports.createElement(AntdIcon$1,_extends$2({},s,{ref:$,icon:PictureTwoToneSvg}))};const PictureTwoTone$1=reactExports.forwardRef(PictureTwoTone);function file2Obj(a){return Object.assign(Object.assign({},a),{lastModified:a.lastModified,lastModifiedDate:a.lastModifiedDate,name:a.name,size:a.size,type:a.type,uid:a.uid,percent:0,originFileObj:a})}function updateFileList(a,s){const $=_toConsumableArray$d(s),_=$.findIndex(_e=>{let{uid:tt}=_e;return tt===a.uid});return _===-1?$.push(a):$[_]=a,$}function getFileItem(a,s){const $=a.uid!==void 0?"uid":"name";return s.filter(_=>_[$]===a[$])[0]}function removeFileItem(a,s){const $=a.uid!==void 0?"uid":"name",_=s.filter(_e=>_e[$]!==a[$]);return _.length===s.length?null:_}const extname=function(){const s=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:"").split("/"),_=s[s.length-1].split(/#|\?/)[0];return(/\.[^./\\]*$/.exec(_)||[""])[0]},isImageFileType=a=>a.indexOf("image/")===0,isImageUrl=a=>{if(a.type&&!a.thumbUrl)return isImageFileType(a.type);const s=a.thumbUrl||a.url||"",$=extname(s);return/^data:image\//.test(s)||/(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico|heic|heif)$/i.test($)?!0:!(/^data:/.test(s)||$)},MEASURE_SIZE=200;function previewImage(a){return new Promise(s=>{if(!a.type||!isImageFileType(a.type)){s("");return}const $=document.createElement("canvas");$.width=MEASURE_SIZE,$.height=MEASURE_SIZE,$.style.cssText=`position: fixed; left: 0; top: 0; width: ${MEASURE_SIZE}px; height: ${MEASURE_SIZE}px; z-index: 9999; display: none;`,document.body.appendChild($);const _=$.getContext("2d"),_e=new Image;if(_e.onload=()=>{const{width:tt,height:nt}=_e;let at=MEASURE_SIZE,ot=MEASURE_SIZE,rt=0,st=0;tt>nt?(ot=nt*(MEASURE_SIZE/tt),st=-(ot-at)/2):(at=tt*(MEASURE_SIZE/nt),rt=-(at-ot)/2),_.drawImage(_e,rt,st,at,ot);const lt=$.toDataURL();document.body.removeChild($),window.URL.revokeObjectURL(_e.src),s(lt)},_e.crossOrigin="anonymous",a.type.startsWith("image/svg+xml")){const tt=new FileReader;tt.onload=()=>{tt.result&&(_e.src=tt.result)},tt.readAsDataURL(a)}else if(a.type.startsWith("image/gif")){const tt=new FileReader;tt.onload=()=>{tt.result&&s(tt.result)},tt.readAsDataURL(a)}else _e.src=window.URL.createObjectURL(a)})}var DownloadOutlined$2={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"download",theme:"outlined"};const DownloadOutlinedSvg=DownloadOutlined$2;var DownloadOutlined=function a(s,$){return reactExports.createElement(AntdIcon$1,_extends$2({},s,{ref:$,icon:DownloadOutlinedSvg}))};const DownloadOutlined$1=reactExports.forwardRef(DownloadOutlined),ListItem=reactExports.forwardRef((a,s)=>{let{prefixCls:$,className:_,style:_e,locale:tt,listType:nt,file:at,items:ot,progress:rt,iconRender:st,actionIconRender:lt,itemRender:et,isImgUrl:it,showPreviewIcon:ut,showRemoveIcon:ft,showDownloadIcon:ht,previewIcon:dt,removeIcon:gt,downloadIcon:pt,onPreview:mt,onDownload:ct,onClose:vt}=a;var At,xt;const{status:bt}=at,[Et,St]=reactExports.useState(bt);reactExports.useEffect(()=>{bt!=="removed"&&St(bt)},[bt]);const[Bt,Ot]=reactExports.useState(!1);reactExports.useEffect(()=>{const Dt=setTimeout(()=>{Ot(!0)},300);return()=>{clearTimeout(Dt)}},[]);const Pt=st(at);let wt=reactExports.createElement("div",{className:`${$}-icon`},Pt);if(nt==="picture"||nt==="picture-card"||nt==="picture-circle")if(Et==="uploading"||!at.thumbUrl&&!at.url){const Dt=classnames(`${$}-list-item-thumbnail`,{[`${$}-list-item-file`]:Et!=="uploading"});wt=reactExports.createElement("div",{className:Dt},Pt)}else{const Dt=it!=null&&it(at)?reactExports.createElement("img",{src:at.thumbUrl||at.url,alt:at.name,className:`${$}-list-item-image`,crossOrigin:at.crossOrigin}):Pt,Ut=classnames(`${$}-list-item-thumbnail`,{[`${$}-list-item-file`]:it&&!it(at)});wt=reactExports.createElement("a",{className:Ut,onClick:Vt=>mt(at,Vt),href:at.url||at.thumbUrl,target:"_blank",rel:"noopener noreferrer"},Dt)}const Ct=classnames(`${$}-list-item`,`${$}-list-item-${Et}`),It=typeof at.linkProps=="string"?JSON.parse(at.linkProps):at.linkProps,yt=ft?lt((typeof gt=="function"?gt(at):gt)||reactExports.createElement(DeleteOutlined$1,null),()=>vt(at),$,tt.removeFile,!0):null,Rt=ht&&Et==="done"?lt((typeof pt=="function"?pt(at):pt)||reactExports.createElement(DownloadOutlined$1,null),()=>ct(at),$,tt.downloadFile):null,kt=nt!=="picture-card"&&nt!=="picture-circle"&&reactExports.createElement("span",{key:"download-delete",className:classnames(`${$}-list-item-actions`,{picture:nt==="picture"})},Rt,yt),jt=classnames(`${$}-list-item-name`),Ht=at.url?[reactExports.createElement("a",Object.assign({key:"view",target:"_blank",rel:"noopener noreferrer",className:jt,title:at.name},It,{href:at.url,onClick:Dt=>mt(at,Dt)}),at.name),kt]:[reactExports.createElement("span",{key:"view",className:jt,onClick:Dt=>mt(at,Dt),title:at.name},at.name),kt],Ft=ut&&(at.url||at.thumbUrl)?reactExports.createElement("a",{href:at.url||at.thumbUrl,target:"_blank",rel:"noopener noreferrer",onClick:Dt=>mt(at,Dt),title:tt.previewFile},typeof dt=="function"?dt(at):dt||reactExports.createElement(EyeOutlined$1,null)):null,_t=(nt==="picture-card"||nt==="picture-circle")&&Et!=="uploading"&&reactExports.createElement("span",{className:`${$}-list-item-actions`},Ft,Et==="done"&&Rt,yt),{getPrefixCls:Nt}=reactExports.useContext(ConfigContext$1),Mt=Nt(),Lt=reactExports.createElement("div",{className:Ct},wt,Ht,_t,Bt&&reactExports.createElement(CSSMotion,{motionName:`${Mt}-fade`,visible:Et==="uploading",motionDeadline:2e3},Dt=>{let{className:Ut}=Dt;const Vt="percent"in at?reactExports.createElement(Progress$1,Object.assign({},rt,{type:"line",percent:at.percent,"aria-label":at["aria-label"],"aria-labelledby":at["aria-labelledby"]})):null;return reactExports.createElement("div",{className:classnames(`${$}-list-item-progress`,Ut)},Vt)})),$t=at.response&&typeof at.response=="string"?at.response:((At=at.error)===null||At===void 0?void 0:At.statusText)||((xt=at.error)===null||xt===void 0?void 0:xt.message)||tt.uploadError,Tt=Et==="error"?reactExports.createElement(_Tooltip,{title:$t,getPopupContainer:Dt=>Dt.parentNode},Lt):Lt;return reactExports.createElement("div",{className:classnames(`${$}-list-item-container`,_),style:_e,ref:s},et?et(Tt,at,ot,{download:ct.bind(null,at),preview:mt.bind(null,at),remove:vt.bind(null,at)}):Tt)}),ListItem$1=ListItem,InternalUploadList=(a,s)=>{const{listType:$="text",previewFile:_=previewImage,onPreview:_e,onDownload:tt,onRemove:nt,locale:at,iconRender:ot,isImageUrl:rt=isImageUrl,prefixCls:st,items:lt=[],showPreviewIcon:et=!0,showRemoveIcon:it=!0,showDownloadIcon:ut=!1,removeIcon:ft,previewIcon:ht,downloadIcon:dt,progress:gt={size:[-1,2],showInfo:!1},appendAction:pt,appendActionVisible:mt=!0,itemRender:ct,disabled:vt}=a,At=useForceUpdate(),[xt,bt]=reactExports.useState(!1);reactExports.useEffect(()=>{$!=="picture"&&$!=="picture-card"&&$!=="picture-circle"||(lt||[]).forEach(Ft=>{typeof document>"u"||typeof window>"u"||!window.FileReader||!window.File||!(Ft.originFileObj instanceof File||Ft.originFileObj instanceof Blob)||Ft.thumbUrl!==void 0||(Ft.thumbUrl="",_&&_(Ft.originFileObj).then(_t=>{Ft.thumbUrl=_t||"",At()}))})},[$,lt,_]),reactExports.useEffect(()=>{bt(!0)},[]);const Et=(Ft,_t)=>{if(_e)return _t==null||_t.preventDefault(),_e(Ft)},St=Ft=>{typeof tt=="function"?tt(Ft):Ft.url&&window.open(Ft.url)},Bt=Ft=>{nt==null||nt(Ft)},Ot=Ft=>{if(ot)return ot(Ft,$);const _t=Ft.status==="uploading",Nt=rt&&rt(Ft)?reactExports.createElement(PictureTwoTone$1,null):reactExports.createElement(FileTwoTone$1,null);let Mt=_t?reactExports.createElement(LoadingOutlined$1,null):reactExports.createElement(PaperClipOutlined$1,null);return $==="picture"?Mt=_t?reactExports.createElement(LoadingOutlined$1,null):Nt:($==="picture-card"||$==="picture-circle")&&(Mt=_t?at.uploading:Nt),Mt},Pt=(Ft,_t,Nt,Mt,Lt)=>{const $t={type:"text",size:"small",title:Mt,onClick:Tt=>{_t(),isValidElement(Ft)&&Ft.props.onClick&&Ft.props.onClick(Tt)},className:`${Nt}-list-item-action`};if(Lt&&($t.disabled=vt),isValidElement(Ft)){const Tt=cloneElement(Ft,Object.assign(Object.assign({},Ft.props),{onClick:()=>{}}));return reactExports.createElement(Button$2,Object.assign({},$t,{icon:Tt}))}return reactExports.createElement(Button$2,Object.assign({},$t),reactExports.createElement("span",null,Ft))};reactExports.useImperativeHandle(s,()=>({handlePreview:Et,handleDownload:St}));const{getPrefixCls:wt}=reactExports.useContext(ConfigContext$1),Ct=wt("upload",st),It=wt(),yt=classnames(`${Ct}-list`,`${Ct}-list-${$}`),Rt=_toConsumableArray$d(lt.map(Ft=>({key:Ft.uid,file:Ft})));let jt={motionDeadline:2e3,motionName:`${Ct}-${$==="picture-card"||$==="picture-circle"?"animate-inline":"animate"}`,keys:Rt,motionAppear:xt};const Ht=reactExports.useMemo(()=>{const Ft=Object.assign({},initCollapseMotion$1(It));return delete Ft.onAppearEnd,delete Ft.onEnterEnd,delete Ft.onLeaveEnd,Ft},[It]);return $!=="picture-card"&&$!=="picture-circle"&&(jt=Object.assign(Object.assign({},Ht),jt)),reactExports.createElement("div",{className:yt},reactExports.createElement(CSSMotionList,Object.assign({},jt,{component:!1}),Ft=>{let{key:_t,file:Nt,className:Mt,style:Lt}=Ft;return reactExports.createElement(ListItem$1,{key:_t,locale:at,prefixCls:Ct,className:Mt,style:Lt,file:Nt,items:lt,progress:gt,listType:$,isImgUrl:rt,showPreviewIcon:et,showRemoveIcon:it,showDownloadIcon:ut,removeIcon:ft,previewIcon:ht,downloadIcon:dt,iconRender:Ot,actionIconRender:Pt,itemRender:ct,onPreview:Et,onDownload:St,onClose:Bt})}),pt&&reactExports.createElement(CSSMotion,Object.assign({},jt,{visible:mt,forceRender:!0}),Ft=>{let{className:_t,style:Nt}=Ft;return cloneElement(pt,Mt=>({className:classnames(Mt.className,_t),style:Object.assign(Object.assign(Object.assign({},Nt),{pointerEvents:_t?"none":void 0}),Mt.style)}))}))},UploadList=reactExports.forwardRef(InternalUploadList),UploadList$1=UploadList;var __awaiter$1=function(a,s,$,_){function _e(tt){return tt instanceof $?tt:new $(function(nt){nt(tt)})}return new($||($=Promise))(function(tt,nt){function at(st){try{rt(_.next(st))}catch(lt){nt(lt)}}function ot(st){try{rt(_.throw(st))}catch(lt){nt(lt)}}function rt(st){st.done?tt(st.value):_e(st.value).then(at,ot)}rt((_=_.apply(a,s||[])).next())})};const LIST_IGNORE=`__LIST_IGNORE_${Date.now()}__`,InternalUpload=(a,s)=>{const{fileList:$,defaultFileList:_,onRemove:_e,showUploadList:tt=!0,listType:nt="text",onPreview:at,onDownload:ot,onChange:rt,onDrop:st,previewFile:lt,disabled:et,locale:it,iconRender:ut,isImageUrl:ft,progress:ht,prefixCls:dt,className:gt,type:pt="select",children:mt,style:ct,itemRender:vt,maxCount:At,data:xt={},multiple:bt=!1,action:Et="",accept:St="",supportServerRender:Bt=!0,rootClassName:Ot}=a,Pt=reactExports.useContext(DisabledContext$1),wt=et??Pt,[Ct,It]=useMergedState(_||[],{value:$,postState:ur=>ur??[]}),[yt,Rt]=reactExports.useState("drop"),kt=reactExports.useRef(null);reactExports.useMemo(()=>{const ur=Date.now();($||[]).forEach((pr,yr)=>{!pr.uid&&!Object.isFrozen(pr)&&(pr.uid=`__AUTO__${ur}_${yr}__`)})},[$]);const jt=(ur,pr,yr)=>{let Er=_toConsumableArray$d(pr),br=!1;At===1?Er=Er.slice(-1):At&&(br=Er.length>At,Er=Er.slice(0,At)),reactDomExports.flushSync(()=>{It(Er)});const gr={file:ur,fileList:Er};yr&&(gr.event=yr),(!br||Er.some(Ar=>Ar.uid===ur.uid))&&reactDomExports.flushSync(()=>{rt==null||rt(gr)})},Ht=(ur,pr)=>__awaiter$1(void 0,void 0,void 0,function*(){const{beforeUpload:yr,transformFile:Er}=a;let br=ur;if(yr){const gr=yield yr(ur,pr);if(gr===!1)return!1;if(delete ur[LIST_IGNORE],gr===LIST_IGNORE)return Object.defineProperty(ur,LIST_IGNORE,{value:!0,configurable:!0}),!1;typeof gr=="object"&&gr&&(br=gr)}return Er&&(br=yield Er(br)),br}),Ft=ur=>{const pr=ur.filter(br=>!br.file[LIST_IGNORE]);if(!pr.length)return;const yr=pr.map(br=>file2Obj(br.file));let Er=_toConsumableArray$d(Ct);yr.forEach(br=>{Er=updateFileList(br,Er)}),yr.forEach((br,gr)=>{let Ar=br;if(pr[gr].parsedFile)br.status="uploading";else{const{originFileObj:Sr}=br;let Br;try{Br=new File([Sr],Sr.name,{type:Sr.type})}catch{Br=new Blob([Sr],{type:Sr.type}),Br.name=Sr.name,Br.lastModifiedDate=new Date,Br.lastModified=new Date().getTime()}Br.uid=br.uid,Ar=Br}jt(Ar,Er)})},_t=(ur,pr,yr)=>{try{typeof ur=="string"&&(ur=JSON.parse(ur))}catch{}if(!getFileItem(pr,Ct))return;const Er=file2Obj(pr);Er.status="done",Er.percent=100,Er.response=ur,Er.xhr=yr;const br=updateFileList(Er,Ct);jt(Er,br)},Nt=(ur,pr)=>{if(!getFileItem(pr,Ct))return;const yr=file2Obj(pr);yr.status="uploading",yr.percent=ur.percent;const Er=updateFileList(yr,Ct);jt(yr,Er,ur)},Mt=(ur,pr,yr)=>{if(!getFileItem(yr,Ct))return;const Er=file2Obj(yr);Er.error=ur,Er.response=pr,Er.status="error";const br=updateFileList(Er,Ct);jt(Er,br)},Lt=ur=>{let pr;Promise.resolve(typeof _e=="function"?_e(ur):_e).then(yr=>{var Er;if(yr===!1)return;const br=removeFileItem(ur,Ct);br&&(pr=Object.assign(Object.assign({},ur),{status:"removed"}),Ct==null||Ct.forEach(gr=>{const Ar=pr.uid!==void 0?"uid":"name";gr[Ar]===pr[Ar]&&!Object.isFrozen(gr)&&(gr.status="removed")}),(Er=kt.current)===null||Er===void 0||Er.abort(pr),jt(pr,br))})},$t=ur=>{Rt(ur.type),ur.type==="drop"&&(st==null||st(ur))};reactExports.useImperativeHandle(s,()=>({onBatchStart:Ft,onSuccess:_t,onProgress:Nt,onError:Mt,fileList:Ct,upload:kt.current}));const{getPrefixCls:Tt,direction:Dt,upload:Ut}=reactExports.useContext(ConfigContext$1),Vt=Tt("upload",dt),Qt=Object.assign(Object.assign({onBatchStart:Ft,onError:Mt,onProgress:Nt,onSuccess:_t},a),{data:xt,multiple:bt,action:Et,accept:St,supportServerRender:Bt,prefixCls:Vt,disabled:wt,beforeUpload:Ht,onChange:void 0});delete Qt.className,delete Qt.style,(!mt||wt)&&delete Qt.id;const qt=`${Vt}-wrapper`,[Zt,ar,Jt]=useStyle(Vt,qt),[rr]=useLocale$1("Upload",defaultLocale.Upload),{showRemoveIcon:Yt,showPreviewIcon:Kt,showDownloadIcon:nr,removeIcon:tr,previewIcon:ir,downloadIcon:sr}=typeof tt=="boolean"?{}:tt,cr=typeof Yt>"u"?!wt:!!Yt,or=(ur,pr)=>tt?reactExports.createElement(UploadList$1,{prefixCls:Vt,listType:nt,items:Ct,previewFile:lt,onPreview:at,onDownload:ot,onRemove:Lt,showRemoveIcon:cr,showPreviewIcon:Kt,showDownloadIcon:nr,removeIcon:tr,previewIcon:ir,downloadIcon:sr,iconRender:ut,locale:Object.assign(Object.assign({},rr),it),isImageUrl:ft,progress:ht,appendAction:ur,appendActionVisible:pr,itemRender:vt,disabled:wt}):ur,Xt=classnames(qt,gt,Ot,ar,Jt,Ut==null?void 0:Ut.className,{[`${Vt}-rtl`]:Dt==="rtl",[`${Vt}-picture-card-wrapper`]:nt==="picture-card",[`${Vt}-picture-circle-wrapper`]:nt==="picture-circle"}),Gt=Object.assign(Object.assign({},Ut==null?void 0:Ut.style),ct);if(pt==="drag"){const ur=classnames(ar,Vt,`${Vt}-drag`,{[`${Vt}-drag-uploading`]:Ct.some(pr=>pr.status==="uploading"),[`${Vt}-drag-hover`]:yt==="dragover",[`${Vt}-disabled`]:wt,[`${Vt}-rtl`]:Dt==="rtl"});return Zt(reactExports.createElement("span",{className:Xt},reactExports.createElement("div",{className:ur,style:Gt,onDrop:$t,onDragOver:$t,onDragLeave:$t},reactExports.createElement(Upload$2,Object.assign({},Qt,{ref:kt,className:`${Vt}-btn`}),reactExports.createElement("div",{className:`${Vt}-drag-container`},mt))),or()))}const Wt=classnames(Vt,`${Vt}-select`,{[`${Vt}-disabled`]:wt}),lr=(ur=>reactExports.createElement("div",{className:Wt,style:ur},reactExports.createElement(Upload$2,Object.assign({},Qt,{ref:kt}))))(mt?void 0:{display:"none"});return Zt(nt==="picture-card"||nt==="picture-circle"?reactExports.createElement("span",{className:Xt},or(lr,!!mt)):reactExports.createElement("span",{className:Xt},lr,or()))},Upload$1=reactExports.forwardRef(InternalUpload),InternalUpload$1=Upload$1;var __rest$4=function(a,s){var $={};for(var _ in a)Object.prototype.hasOwnProperty.call(a,_)&&s.indexOf(_)<0&&($[_]=a[_]);if(a!=null&&typeof Object.getOwnPropertySymbols=="function")for(var _e=0,_=Object.getOwnPropertySymbols(a);_e<_.length;_e++)s.indexOf(_[_e])<0&&Object.prototype.propertyIsEnumerable.call(a,_[_e])&&($[_[_e]]=a[_[_e]]);return $};const Dragger=reactExports.forwardRef((a,s)=>{var{style:$,height:_}=a,_e=__rest$4(a,["style","height"]);return reactExports.createElement(InternalUpload$1,Object.assign({ref:s},_e,{type:"drag",style:Object.assign(Object.assign({},$),{height:_})}))}),Dragger$1=Dragger,Upload=InternalUpload$1;Upload.Dragger=Dragger$1,Upload.LIST_IGNORE=LIST_IGNORE;const _Upload=Upload;var ArrowLeftOutlined$2={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"arrow-left",theme:"outlined"};const ArrowLeftOutlinedSvg=ArrowLeftOutlined$2;var ArrowLeftOutlined=function a(s,$){return reactExports.createElement(AntdIcon$1,_extends$2({},s,{ref:$,icon:ArrowLeftOutlinedSvg}))};const ArrowLeftOutlined$1=reactExports.forwardRef(ArrowLeftOutlined);var ArrowRightOutlined$2={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M869 487.8L491.2 159.9c-2.9-2.5-6.6-3.9-10.5-3.9h-88.5c-7.4 0-10.8 9.2-5.2 14l350.2 304H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h585.1L386.9 854c-5.6 4.9-2.2 14 5.2 14h91.5c1.9 0 3.8-.7 5.2-2L869 536.2a32.07 32.07 0 000-48.4z"}}]},name:"arrow-right",theme:"outlined"};const ArrowRightOutlinedSvg=ArrowRightOutlined$2;var ArrowRightOutlined=function a(s,$){return reactExports.createElement(AntdIcon$1,_extends$2({},s,{ref:$,icon:ArrowRightOutlinedSvg}))};const ArrowRightOutlined$1=reactExports.forwardRef(ArrowRightOutlined);var ExclamationCircleOutlined$2={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z"}}]},name:"exclamation-circle",theme:"outlined"};const ExclamationCircleOutlinedSvg=ExclamationCircleOutlined$2;var ExclamationCircleOutlined=function a(s,$){return reactExports.createElement(AntdIcon$1,_extends$2({},s,{ref:$,icon:ExclamationCircleOutlinedSvg}))};const ExclamationCircleOutlined$1=reactExports.forwardRef(ExclamationCircleOutlined);var LockOutlined$2={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 464h-68V240c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM332 240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v224H332V240zm460 600H232V536h560v304zM484 701v53c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-53a48.01 48.01 0 10-56 0z"}}]},name:"lock",theme:"outlined"};const LockOutlinedSvg=LockOutlined$2;var LockOutlined=function a(s,$){return reactExports.createElement(AntdIcon$1,_extends$2({},s,{ref:$,icon:LockOutlinedSvg}))};const LockOutlined$1=reactExports.forwardRef(LockOutlined);var MenuOutlined$2={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M904 160H120c-4.4 0-8 3.6-8 8v64c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-64c0-4.4-3.6-8-8-8zm0 624H120c-4.4 0-8 3.6-8 8v64c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-64c0-4.4-3.6-8-8-8zm0-312H120c-4.4 0-8 3.6-8 8v64c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-64c0-4.4-3.6-8-8-8z"}}]},name:"menu",theme:"outlined"};const MenuOutlinedSvg=MenuOutlined$2;var MenuOutlined=function a(s,$){return reactExports.createElement(AntdIcon$1,_extends$2({},s,{ref:$,icon:MenuOutlinedSvg}))};const MenuOutlined$1=reactExports.forwardRef(MenuOutlined);var MinusOutlined$2={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M872 474H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h720c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"minus",theme:"outlined"};const MinusOutlinedSvg=MinusOutlined$2;var MinusOutlined=function a(s,$){return reactExports.createElement(AntdIcon$1,_extends$2({},s,{ref:$,icon:MinusOutlinedSvg}))};const MinusOutlined$1=reactExports.forwardRef(MinusOutlined),dictEn={cancel:"Cancel",field:"field",fieldName:"Name",align:"Align",width:"Width",height:"Height",opacity:"Opacity",rotate:"Rotate",required:"Required",editable:"Editable",edit:"Edit",plsInputName:"Please input name",fieldMustUniq:"Name of field is not unique",notUniq:"(Not unique name)",noKeyName:"No name",fieldsList:"Field List",editField:"Edit Field",type:"Type",errorOccurred:"An error occurred",errorBulkUpdateFieldName:"Cannot commit the change because the number of items has been changed.",commitBulkUpdateFieldName:"Commit Changes",bulkUpdateFieldName:"Bulk update field names",addPageAfter:"Add Page After",removePage:"Remove Current Page",removePageConfirm:"Are you sure you want to delete this page? This action cannot be undone.","validation.hexColor":"Please enter a valid hex color code.","validation.uniqueName":"Please enter a unique name.","schemas.color":"Color","schemas.borderWidth":"Border Width","schemas.borderColor":"Border Color","schemas.backgroundColor":"Background Color","schemas.textColor":"Text Color","schemas.bgColor":"Background Color","schemas.horizontal":"Horizontal","schemas.vertical":"Vertical","schemas.left":"Left","schemas.center":"Center","schemas.right":"Right","schemas.top":"Top","schemas.middle":"Middle","schemas.bottom":"Bottom","schemas.padding":"Padding","schemas.text.fontName":"Font Name","schemas.text.size":"Size","schemas.text.spacing":"Spacing","schemas.text.textAlign":"Text Align","schemas.text.verticalAlign":"Vertical Align","schemas.text.lineHeight":"Line Height","schemas.text.min":"Min","schemas.text.max":"Max","schemas.text.fit":"Fit","schemas.text.dynamicFontSize":"Dynamic Font Size","schemas.text.format":"Format","schemas.mvt.typingInstructions":"Add variables by typing words surrounded by curly brackets, e.g.","schemas.mvt.sampleField":"name","schemas.mvt.variablesSampleData":"Variables Sample Data","schemas.barcodes.barColor":"Bar Color","schemas.barcodes.includetext":"Include Text","schemas.table.alternateBackgroundColor":"Alternate Background Color","schemas.table.tableStyle":"Table Style","schemas.table.headStyle":"Header Style","schemas.table.bodyStyle":"Body Style","schemas.table.columnStyle":"Column Style"},dictZh={cancel:"取消",field:"字段",fieldName:"名称",align:"对齐",width:"宽度",height:"高度",opacity:"透明度",rotate:"旋转",required:"必需的",editable:"可编辑的",edit:"编辑",plsInputName:"请输入名称",fieldMustUniq:"字段名称必须唯一",notUniq:"(名称不唯一)",noKeyName:"无名称",fieldsList:"字段列表",editField:"编辑字段",type:"类型",errorOccurred:"发生错误",errorBulkUpdateFieldName:"由于项目数量已更改,无法提交更改。",commitBulkUpdateFieldName:"提交更改",bulkUpdateFieldName:"批量更新字段名称",addPageAfter:"在之后添加页面",removePage:"删除当前页面",removePageConfirm:"您确定要删除此页面吗?此操作无法撤销。","validation.hexColor":"请输入有效的十六进制颜色代码。","validation.uniqueName":"请输入一个唯一的名称。","schemas.color":"颜色","schemas.borderWidth":"边框宽度","schemas.borderColor":"边框颜色","schemas.backgroundColor":"背景颜色","schemas.textColor":"文字颜色","schemas.bgColor":"背景颜色","schemas.horizontal":"水平","schemas.vertical":"垂直","schemas.left":"左","schemas.center":"中","schemas.right":"右","schemas.top":"顶","schemas.middle":"中间","schemas.bottom":"底","schemas.padding":"填充","schemas.text.fontName":"字体名称","schemas.text.size":"大小","schemas.text.spacing":"间距","schemas.text.textAlign":"文本对齐","schemas.text.verticalAlign":"垂直对齐","schemas.text.lineHeight":"行高","schemas.text.min":"最小","schemas.text.max":"最大","schemas.text.fit":"适应","schemas.text.dynamicFontSize":"动态字体大小","schemas.text.format":"格式","schemas.mvt.typingInstructions":"通过输入用花括号括起来的单词来添加变量,例如","schemas.mvt.sampleField":"姓名","schemas.mvt.variablesSampleData":"变量样本数据","schemas.barcodes.barColor":"条码颜色","schemas.barcodes.includetext":"包括文本","schemas.table.alternateBackgroundColor":"交替背景颜色","schemas.table.tableStyle":"表格样式","schemas.table.headStyle":"表头样式","schemas.table.bodyStyle":"表体样式","schemas.table.columnStyle":"列样式"},dictJa={cancel:"キャンセル",field:"入力項目",fieldName:"項目名",align:"整列",width:"幅",height:"高さ",opacity:"不透明度",rotate:"回転",required:"必須",editable:"編集可能",edit:"編集する",plsInputName:"項目名を入力してください",fieldMustUniq:"他の入力項目名と被っています",notUniq:"(他の項目名と重複しています)",noKeyName:"項目名なし",fieldsList:"入力項目一覧",editField:"入力項目を編集",type:"タイプ",errorOccurred:"エラーが発生しました",errorBulkUpdateFieldName:"項目数が変更されているため変更をコミットできません。",commitBulkUpdateFieldName:"変更を反映",bulkUpdateFieldName:"項目名を一括変更",addPageAfter:"次にページを追加",removePage:"現在のページを削除",removePageConfirm:"ページを削除してもよろしいですか?この操作は元に戻せません。","validation.hexColor":"有効な16進数のカラーコードを入力してください。","validation.uniqueName":"一意の名前を入力してください。","schemas.color":"色","schemas.borderWidth":"枠線の太さ","schemas.borderColor":"枠線の色","schemas.backgroundColor":"背景色","schemas.textColor":"テキストの色","schemas.bgColor":"背景色","schemas.horizontal":"水平","schemas.vertical":"垂直","schemas.left":"左","schemas.center":"中央","schemas.right":"右","schemas.top":"上","schemas.middle":"中間","schemas.bottom":"下","schemas.padding":"パディング","schemas.text.fontName":"フォント名","schemas.text.size":"サイズ","schemas.text.spacing":"間隔","schemas.text.textAlign":"テキストの揃え","schemas.text.verticalAlign":"垂直方向の揃え","schemas.text.lineHeight":"行の高さ","schemas.text.min":"最小","schemas.text.max":"最大","schemas.text.fit":"フィット","schemas.text.dynamicFontSize":"動的フォントサイズ","schemas.text.format":"書式","schemas.mvt.typingInstructions":"中括弧で囲まれた単語を入力して変数を追加します。例:","schemas.mvt.sampleField":"名前","schemas.mvt.variablesSampleData":"変数サンプルデータ","schemas.barcodes.barColor":"バーの色","schemas.barcodes.includetext":"テキストを含める","schemas.table.alternateBackgroundColor":"交互の背景色","schemas.table.tableStyle":"テーブルスタイル","schemas.table.headStyle":"ヘッダースタイル","schemas.table.bodyStyle":"ボディスタイル","schemas.table.columnStyle":"カラムスタイル"},dictKo={cancel:"취소",field:"필드",fieldName:"이름",align:"정렬",width:"너비",height:"높이",opacity:"투명도",rotate:"회전",required:"필수의",editable:"편집 가능한",edit:"편집",plsInputName:"이름을 입력하세요",fieldMustUniq:"필드 이름은 유일해야 합니다",notUniq:"(유일하지 않은 이름)",noKeyName:"이름 없음",fieldsList:"필드 목록",editField:"필드 편집",type:"유형",errorOccurred:"오류 발생",errorBulkUpdateFieldName:"항목 수가 변경되어 변경을 커밋할 수 없습니다.",commitBulkUpdateFieldName:"변경 사항 커밋",bulkUpdateFieldName:"필드 이름 일괄 업데이트",addPageAfter:"다음에 페이지 추가",removePage:"현재 페이지 제거",removePageConfirm:"이 페이지를 삭제하시겠습니까? 이 작업은 취소할 수 없습니다.","validation.hexColor":"유효한 16진수 색상 코드를 입력하세요.","validation.uniqueName":"고유한 이름을 입력하세요.","schemas.color":"색상","schemas.borderWidth":"테두리 너비","schemas.borderColor":"테두리 색상","schemas.backgroundColor":"배경색","schemas.textColor":"텍스트 색상","schemas.bgColor":"배경색","schemas.horizontal":"수평","schemas.vertical":"수직","schemas.left":"왼쪽","schemas.center":"중앙","schemas.right":"오른쪽","schemas.top":"상단","schemas.middle":"중간","schemas.bottom":"하단","schemas.padding":"패딩","schemas.text.fontName":"글꼴 이름","schemas.text.size":"크기","schemas.text.spacing":"간격","schemas.text.textAlign":"텍스트 정렬","schemas.text.verticalAlign":"수직 정렬","schemas.text.lineHeight":"줄 높이","schemas.text.min":"최소","schemas.text.max":"최대","schemas.text.fit":"맞춤","schemas.text.dynamicFontSize":"동적 폰트 크기","schemas.text.format":"형식","schemas.mvt.typingInstructions":"중괄호로 묶인 단어를 입력하여 변수를 추가하세요.","schemas.mvt.sampleField":"이름","schemas.mvt.variablesSampleData":"변수 샘플 데이터","schemas.barcodes.barColor":"바코드 색상","schemas.barcodes.includetext":"텍스트 포함","schemas.table.alternateBackgroundColor":"대체 배경색","schemas.table.tableStyle":"테이블 스타일","schemas.table.headStyle":"헤더 스타일","schemas.table.bodyStyle":"본문 스타일","schemas.table.columnStyle":"열 스타일"},dictAr={cancel:"إلغاء",field:"الحقل",fieldName:"اسم الحقل",align:"محاذاة",width:"العرض",height:"الارتفاع",opacity:"الشفافية",rotate:"تدوير",required:"مطلوب",editable:"قابل للتحرير",edit:"تعديل",plsInputName:"الرجاء إدخال الاسم",fieldMustUniq:"يجب أن يكون الحقل فريداً",notUniq:"(غير فريد)",noKeyName:"لا يوجد اسم للحقل",fieldsList:"قائمة الحقول",editField:"تعديل الحقل",type:"النوع",errorOccurred:"حدث خطأ",errorBulkUpdateFieldName:"لا يمكن تنفيذ التغيير لأنه تم تغيير عدد العناصر.",commitBulkUpdateFieldName:"تنفيذ التغييرات",bulkUpdateFieldName:"تغيير الأسماء",addPageAfter:"إضافة صفحة بعد",removePage:"احذف الصفحة الحالية",removePageConfirm:"هل أنت متأكد من رغبتك في حذف هذه الصفحة؟ لا يمكن التراجع عن هذا الإجراء.","validation.hexColor":"الرجاء إدخال رمز لون سداسي عشري صالح.","validation.uniqueName":"الرجاء إدخال اسم فريد.","schemas.color":"اللون","schemas.borderWidth":"عرض الحدود","schemas.borderColor":"لون الحدود","schemas.backgroundColor":"لون الخلفية","schemas.textColor":"لون الخط","schemas.bgColor":"لون الخلفية","schemas.horizontal":"أفقي","schemas.vertical":"عمودي","schemas.left":"يسار","schemas.center":"مركز","schemas.right":"يمين","schemas.top":"أعلى","schemas.middle":"وسط","schemas.bottom":"أسفل","schemas.padding":"التبطين","schemas.text.fontName":"اسم الخط","schemas.text.size":"الحجم","schemas.text.spacing":"التباعد","schemas.text.textAlign":"محاذاة النص","schemas.text.verticalAlign":"محاذاة عمودية","schemas.text.lineHeight":"ارتفاع السطر","schemas.text.min":"الحد الأدنى","schemas.text.max":"الحد الأقصى","schemas.text.fit":"ملاءمة","schemas.text.dynamicFontSize":"حجم الخط الديناميكي","schemas.text.format":"تنسيق","schemas.mvt.typingInstructions":"قم بإضافة المتغيرات عن طريق كتابة الكلمات المحاطة بأقواس متعرجة، على سبيل المثال:","schemas.mvt.sampleField":"اسم","schemas.mvt.variablesSampleData":"بيانات عينة المتغيرات","schemas.barcodes.barColor":"لون الشريط","schemas.barcodes.includetext":"تضمين النص","schemas.table.alternateBackgroundColor":"لون الخلفية البديل","schemas.table.tableStyle":"أسلوب الجدول","schemas.table.headStyle":"أسلوب الرأس","schemas.table.bodyStyle":"أسلوب الجسم","schemas.table.columnStyle":"أسلوب العمود"},dictTh={cancel:"ยกเลิก",field:"ฟิลด์",fieldName:"ชื่อฟิลด์",align:"จัดเรียง",width:"ความกว้าง",height:"ความสูง",opacity:"ความทึบ",rotate:"หมุน",required:"ที่จำเป็น",editable:"แก้ไขได้",edit:"แก้ไข",plsInputName:"กรุณาใส่ชื่อ",fieldMustUniq:"ชื่อฟิลด์ต้องไม่ซ้ำกัน",notUniq:"(ชื่อฟิลด์ซ้ำกัน)",noKeyName:"ไม่มีชื่อ",fieldsList:"รายการฟิลด์ทั้งหมด",editField:"แก้ไขฟิลด์",type:"ประเภท",errorOccurred:"เกิดข้อผิดพลาด",errorBulkUpdateFieldName:"ไม่สามารถยืนยันการแก้ไขได้เนื่องจากจำนวนรายการมีการเปลี่ยนแปลง",commitBulkUpdateFieldName:"ยืนยันการแก้ไข",bulkUpdateFieldName:"แก้ไขชื่อฟิลด์เป็นชุด",addPageAfter:"เพิ่มหน้าถัดไป",removePage:"ลบหน้าปัจจุบัน",removePageConfirm:"คุณแน่ใจหรือไม่ว่าต้องการลบหน้านี้? การกระทำนี้ไม่สามารถย้อนกลับได้","validation.hexColor":"กรุณาใส่รหัสสีแบบฐานสิบหกที่ถูกต้อง","validation.uniqueName":"กรุณาระบุชื่อที่ไม่ซ้ำ","schemas.color":"สี","schemas.borderWidth":"ความกว้างของเส้นขอบ","schemas.borderColor":"สีขอบ","schemas.backgroundColor":"สีพื้นหลัง","schemas.textColor":"สีข้อความ","schemas.bgColor":"สีพื้นหลัง","schemas.horizontal":"แนวนอน","schemas.vertical":"แนวตั้ง","schemas.left":"ซ้าย","schemas.center":"ตรงกลาง","schemas.right":"ขวา","schemas.top":"ด้านบน","schemas.middle":"ตรงกลาง","schemas.bottom":"ด้านล่าง","schemas.padding":"การเพิ่มพื้นที่","schemas.text.fontName":"ชื่อแบบอักษร","schemas.text.size":"ขนาด","schemas.text.spacing":"ระยะห่าง","schemas.text.textAlign":"จัดแนวข้อความ","schemas.text.verticalAlign":"จัดแนวแนวตั้ง","schemas.text.lineHeight":"ความสูงของบรรทัด","schemas.text.min":"ต่ำสุด","schemas.text.max":"สูงสุด","schemas.text.fit":"พอดี","schemas.text.dynamicFontSize":"ขนาดตัวอักษรแบบไดนามิก","schemas.text.format":"รูปแบบ","schemas.mvt.typingInstructions":"เพิ่มตัวแปรโดยพิมพ์คำที่ล้อมรอบด้วยวงเล็บปีกกา เช่น","schemas.mvt.sampleField":"ชื่อ","schemas.mvt.variablesSampleData":"ข้อมูลตัวอย่างตัวแปร","schemas.barcodes.barColor":"สีบาร์","schemas.barcodes.includetext":"รวมข้อความ","schemas.table.alternateBackgroundColor":"สีพื้นหลังสลับกัน","schemas.table.tableStyle":"สไตล์ตาราง","schemas.table.headStyle":"สไตล์หัวข้อ","schemas.table.bodyStyle":"สไตล์เนื้อหา","schemas.table.columnStyle":"สไตล์คอลัมน์"},dictIt={cancel:"Annulla",field:"Campo",fieldName:"Nome",align:"Allinea",width:"Larghezza",height:"Altezza",opacity:"Opacità",rotate:"Ruota",required:"Necessaria",editable:"Modificabile",edit:"Modifica",plsInputName:"Inserisci il nome per favore",fieldMustUniq:"Il nome del campo non è univoco",notUniq:"(Nome non univoco)",noKeyName:"Nessun nome",fieldsList:"Lista campi",editField:"Modifica campo",type:"Tipo",errorOccurred:"Riscontrato errore",errorBulkUpdateFieldName:"Non è possibile salvare le modifiche perché il numero di elementi è cambiato.",commitBulkUpdateFieldName:"Salva cambiamenti",bulkUpdateFieldName:"Modifica nomi campi in blocco",addPageAfter:"Aggiungi pagina dopo",removePage:"Rimuovi la Pagina Corrente",removePageConfirm:"Sei sicuro di voler eliminare questa pagina? Questa azione non può essere annullata.","validation.hexColor":"Inserisci un codice colore esadecimale valido.","validation.uniqueName":"Inserisci un nome univoco.","schemas.color":"Colore","schemas.borderWidth":"Spessore bordo","schemas.borderColor":"Colore bordo","schemas.backgroundColor":"Colore di Sfondo","schemas.textColor":"Colore testo","schemas.bgColor":"Colore sfondo","schemas.horizontal":"Orizzontale","schemas.vertical":"Verticale","schemas.left":"Sinistra","schemas.center":"Centro","schemas.right":"Destra","schemas.top":"Sopra","schemas.middle":"Medio","schemas.bottom":"Sotto","schemas.padding":"Padding","schemas.text.fontName":"Nome del font","schemas.text.size":"Dimensione","schemas.text.spacing":"Spaziatura","schemas.text.textAlign":"Allineamento testo","schemas.text.verticalAlign":"Allineamento verticale","schemas.text.lineHeight":"Altezza della linea","schemas.text.min":"Minimo","schemas.text.max":"Massimo","schemas.text.fit":"Adatta","schemas.text.dynamicFontSize":"Dimensione font dinamica","schemas.text.format":"Formato","schemas.mvt.typingInstructions":"Aggiungi variabili digitando parole circondate da parentesi graffe, ad es.","schemas.mvt.sampleField":"nome","schemas.mvt.variablesSampleData":"Dati di esempio variabili","schemas.barcodes.barColor":"Colore barra","schemas.barcodes.includetext":"Includi testo","schemas.table.alternateBackgroundColor":"Colore di Sfondo Alternato","schemas.table.tableStyle":"Stile della Tabella","schemas.table.headStyle":"Stile dell'Intestazione","schemas.table.bodyStyle":"Stile del Corpo","schemas.table.columnStyle":"Stile della Colonna"},dictPl={cancel:"Anuluj",field:"pole",fieldName:"Klucz pola",align:"Wyrównanie",width:"Szerokość",height:"Wysokość",opacity:"przezroczystość",rotate:"Obrót",required:"Wymagany",editable:"Edytowalny",edit:"Edytuj",plsInputName:"Wymagane wprowadzenie klucza pola",fieldMustUniq:"Klucz pola nie jest unikalny",notUniq:"(Klucz pola nie jest unikalny)",noKeyName:"Brak nazwy klucza pola",fieldsList:"Lista pól",editField:"Edytuj pole",type:"Typ pola",errorOccurred:"Wystąpił błąd",errorBulkUpdateFieldName:"Nie można wprowadzić zmian ponieważ liczba elementów uległa zmianie.",commitBulkUpdateFieldName:"Zaakceptuj zmiany",bulkUpdateFieldName:"Masowo aktualizuj klucze pól",addPageAfter:"Dodaj stronę po",removePage:"Usuń Bieżącą Stronę",removePageConfirm:"Czy na pewno chcesz usunąć tę stronę? Tej operacji nie można cofnąć.","validation.hexColor":"Wprowadź poprawny kod koloru szesnastkowego.","validation.uniqueName":"Proszę wpisać unikalną nazwę.","schemas.color":"Kolor","schemas.borderWidth":"Szerokość obramowania","schemas.borderColor":"Kolor obramowania","schemas.backgroundColor":"Kolor tła","schemas.textColor":"Kolor tekstu","schemas.bgColor":"Kolor tła","schemas.horizontal":"Poziomo","schemas.vertical":"Pionowo","schemas.left":"Lewo","schemas.center":"Centrum","schemas.right":"Prawo","schemas.top":"Góra","schemas.middle":"Środek","schemas.bottom":"Dół","schemas.padding":"Odsadzenie","schemas.text.fontName":"Nazwa czcionki","schemas.text.size":"Rozmiar","schemas.text.spacing":"Odstępy","schemas.text.textAlign":"Wyrównanie tekstu","schemas.text.verticalAlign":"Wyrównanie pionowe","schemas.text.lineHeight":"Wysokość linii","schemas.text.min":"Minimum","schemas.text.max":"Maksimum","schemas.text.fit":"Dopasowanie","schemas.text.dynamicFontSize":"Dynamiczny rozmiar czcionki","schemas.text.format":"Format","schemas.mvt.typingInstructions":"Dodaj zmienne, wpisując słowa ujęte w nawiasy klamrowe, np.","schemas.mvt.sampleField":"nazwa","schemas.mvt.variablesSampleData":"Zmienne Przykładowe dane","schemas.barcodes.barColor":"Kolor paska","schemas.barcodes.includetext":"Dołącz tekst","schemas.table.alternateBackgroundColor":"Alternatywny kolor tła","schemas.table.tableStyle":"Styl tabeli","schemas.table.headStyle":"Styl nagłówka","schemas.table.bodyStyle":"Styl ciała","schemas.table.columnStyle":"Styl kolumny"},dictDe={cancel:"Abbrechen",field:"Feld",fieldName:"Name",align:"Ausrichten",width:"Breite",height:"Höhe",opacity:"Opazität",rotate:"Drehen",required:"Erforderlich",editable:"Bearbeitbar",edit:"Bearbeiten",plsInputName:"Bitte geben Sie einen Namen ein",fieldMustUniq:"Feldname ist nicht eindeutig",notUniq:"(Nicht eindeutiger Name)",noKeyName:"Kein Name",fieldsList:"Feldliste",editField:"Feld bearbeiten",type:"Typ",errorOccurred:"Ein Fehler ist aufgetreten",errorBulkUpdateFieldName:"Die Änderung kann nicht übernommen werden, weil die Anzahl der Elemente geändert wurde.",commitBulkUpdateFieldName:"Änderungen übernehmen",bulkUpdateFieldName:"Mehrfachaktualisierung der Feldnamen",addPageAfter:"Seite danach hinzufügen",removePage:"Aktuelle Seite entfernen",removePageConfirm:"Sind Sie sicher, dass Sie diese Seite löschen möchten? Diese Aktion kann nicht rückgängig gemacht werden.","validation.hexColor":"Bitte geben Sie einen gültigen Hex-Farbcode ein.","validation.uniqueName":"Bitte geben Sie einen eindeutigen Namen ein.","schemas.color":"Farbe","schemas.borderWidth":"Rahmenbreite","schemas.borderColor":"Rahmenfarbe","schemas.backgroundColor":"Hintergrundfarbe","schemas.textColor":"Textfarbe","schemas.bgColor":"Hintergrundfarbe","schemas.horizontal":"Horizontal","schemas.vertical":"Vertikal","schemas.left":"Links","schemas.center":"Zentriert","schemas.right":"Rechts","schemas.top":"Oben","schemas.middle":"Mitte","schemas.bottom":"Unten","schemas.padding":"Polsterung","schemas.text.fontName":"Schriftart","schemas.text.size":"Größe","schemas.text.spacing":"Abstand","schemas.text.textAlign":"Ausrichtung","schemas.text.verticalAlign":"vert. Ausr.","schemas.text.lineHeight":"Zeilenhöhe","schemas.text.min":"Min","schemas.text.max":"Max","schemas.text.fit":"Anpassen","schemas.text.dynamicFontSize":"Dynamische Schriftgröße","schemas.text.format":"Format","schemas.mvt.typingInstructions":"Fügen Sie Variablen hinzu, indem Sie Wörter in geschweiften Klammern eingeben, z. B.","schemas.mvt.sampleField":"Name","schemas.mvt.variablesSampleData":"Variablen Beispieldaten","schemas.barcodes.barColor":"Strichcodefarbe","schemas.barcodes.includetext":"Text anzeigen","schemas.table.alternateBackgroundColor":"Wechselnde Hintergrundfarbe","schemas.table.tableStyle":"Tabellenstil","schemas.table.headStyle":"Kopfzeilenstil","schemas.table.bodyStyle":"Körperstil","schemas.table.columnStyle":"Spaltenstil"},dictEs={cancel:"Cancelar",field:"campo",fieldName:"Nombre",align:"Alinear",width:"Anchura",height:"Altura",opacity:"Opacidad",rotate:"Rotar",required:"Requerido",editable:"Editable",edit:"Editar",plsInputName:"Introduce el nombre",fieldMustUniq:"El nombre del campo no es único",notUniq:"(Nombre no único)",noKeyName:"Sin nombre",fieldsList:"Lista de campos",editField:"Editar campo",type:"Tipo",errorOccurred:"Ocurrió un error",errorBulkUpdateFieldName:"No se puede confirmar el cambio porque el número de elementos ha cambiado.",commitBulkUpdateFieldName:"Confirmar cambios",bulkUpdateFieldName:"Actualizar en bloque el nombre de los campos",addPageAfter:"Insertar página",removePage:"Eliminar página actual",removePageConfirm:"¿Estás seguro de que quieres eliminar esta página? Esta acción no se puede deshacer.","validation.hexColor":"Introduce un código de color hexadecimal válido.","validation.uniqueName":"Por favor, introduzca un nombre único.","schemas.color":"Color","schemas.borderWidth":"Ancho del borde","schemas.borderColor":"Color del borde","schemas.backgroundColor":"Color de fondo","schemas.textColor":"Color del texto","schemas.bgColor":"Color del fondo","schemas.horizontal":"Horizontal","schemas.vertical":"Vertical","schemas.left":"Izquierda","schemas.center":"Centro","schemas.right":"Derecha","schemas.top":"Arriba","schemas.middle":"Medio","schemas.bottom":"Abajo","schemas.padding":"Relleno","schemas.text.fontName":"Nombre de la fuente","schemas.text.size":"Tamaño","schemas.text.spacing":"Espaciado","schemas.text.textAlign":"Alineación del texto","schemas.text.verticalAlign":"Alineación vertical","schemas.text.lineHeight":"Altura de línea","schemas.text.min":"Mín","schemas.text.max":"Máx","schemas.text.fit":"Ajustar","schemas.text.dynamicFontSize":"Tamaño de fuente dinámico","schemas.text.format":"Formato","schemas.mvt.typingInstructions":"Agregue variables escribiendo palabras entre llaves, p.","schemas.mvt.sampleField":"nombre","schemas.mvt.variablesSampleData":"Variables Datos de muestra","schemas.barcodes.barColor":"Color de la barra","schemas.barcodes.includetext":"Incluir texto","schemas.table.alternateBackgroundColor":"Color de fondo alternativo","schemas.table.tableStyle":"Estilo de tabla","schemas.table.headStyle":"Estilo de cabecera","schemas.table.bodyStyle":"Estilo de cuerpo","schemas.table.columnStyle":"Estilo de columna"},dictFr={cancel:"Annuler",field:"Champ",fieldName:"Nom",align:"Aligner",width:"Largeur",height:"Hauteur",opacity:"Opacité",rotate:"Rotation",required:"Requis",editable:"Modifiable",edit:"Éditer",plsInputName:"Veuillez saisir le nom",fieldMustUniq:"Le nom du champ n'est pas unique",notUniq:"(Nombre non unique)",noKeyName:"Pas de nom",fieldsList:"Liste des champs",editField:"Éditer le champ",type:"Type",errorOccurred:"Une erreur est survenue",errorBulkUpdateFieldName:"Impossible de confirmer le changement car le nombre d'éléments a changé.",commitBulkUpdateFieldName:"Confirmer les changements",bulkUpdateFieldName:"Modifier les noms de champs en masse",addPageAfter:"Ajouter une page après",removePage:"Supprimer la page actuelle",removePageConfirm:"Êtes-vous sûr de vouloir supprimer cette page ? Cette action est irréversible.","validation.hexColor":"Veuillez entrer un code couleur hexadécimal valide.","validation.uniqueName":"Veuillez saisir un nom unique.","schemas.color":"Couleur","schemas.borderWidth":"Largeur de la bordure","schemas.borderColor":"Couleur de la bordure","schemas.backgroundColor":"Couleur de fond","schemas.textColor":"Couleur du texte","schemas.bgColor":"Couleur de fond","schemas.horizontal":"Horizontal","schemas.vertical":"Vertical","schemas.left":"Gauche","schemas.center":"Centre","schemas.right":"Droite","schemas.top":"Haut","schemas.middle":"Milieu","schemas.bottom":"Bas","schemas.padding":"Zone de remplissage","schemas.text.fontName":"Nom de la police","schemas.text.size":"Taille","schemas.text.spacing":"Espacement","schemas.text.textAlign":"Alignement du texte","schemas.text.verticalAlign":"Alignement vertical","schemas.text.lineHeight":"Hauteur de ligne","schemas.text.min":"Min","schemas.text.max":"Max","schemas.text.fit":"Ajustement","schemas.text.dynamicFontSize":"Taille de police dynamique","schemas.text.format":"Format","schemas.mvt.typingInstructions":"Ajoutez des variables en tapant des mots entourés d'accolades, par ex.","schemas.mvt.sampleField":"nom","schemas.mvt.variablesSampleData":"Variables Exemples de données","schemas.barcodes.barColor":"Couleur de la barre","schemas.barcodes.includetext":"Inclure le texte","schemas.table.alternateBackgroundColor":"Couleur de fond alternative","schemas.table.tableStyle":"Style de tableau","schemas.table.headStyle":"Style d'en-tête","schemas.table.bodyStyle":"Style de corps","schemas.table.columnStyle":"Style de colonne"},dictionaries={en:dictEn,zh:dictZh,ja:dictJa,ko:dictKo,ar:dictAr,th:dictTh,it:dictIt,pl:dictPl,de:dictDe,es:dictEs,fr:dictFr},getDict=a=>dictionaries[a]||dictionaries[DEFAULT_LANG],i18n=(a,s)=>(s||getDict(DEFAULT_LANG))[a],I18nContext=reactExports.createContext(i18n),FontContext=reactExports.createContext(getDefaultFont()),PluginsRegistry=reactExports.createContext(builtInPlugins),OptionsContext=reactExports.createContext({});function arrayMove(a,s,$){const _=a.slice();return _.splice($<0?_.length+$:$,0,_.splice(s,1)[0]),_}function getSortedRects(a,s){return a.reduce(($,_,_e)=>{const tt=s.get(_);return tt&&($[_e]=tt),$},Array(a.length))}function isValidIndex(a){return a!==null&&a>=0}function itemsEqual(a,s){if(a===s)return!0;if(a.length!==s.length)return!1;for(let $=0;$<a.length;$++)if(a[$]!==s[$])return!1;return!0}function normalizeDisabled(a){return typeof a=="boolean"?{draggable:a,droppable:a}:a}const rectSortingStrategy=a=>{let{rects:s,activeIndex:$,overIndex:_,index:_e}=a;const tt=arrayMove(s,_,$),nt=s[_e],at=tt[_e];return!at||!nt?null:{x:at.left-nt.left,y:at.top-nt.top,scaleX:at.width/nt.width,scaleY:at.height/nt.height}},defaultScale$1={scaleX:1,scaleY:1},verticalListSortingStrategy=a=>{var s;let{activeIndex:$,activeNodeRect:_,index:_e,rects:tt,overIndex:nt}=a;const at=(s=tt[$])!=null?s:_;if(!at)return null;if(_e===$){const rt=tt[nt];return rt?{x:0,y:$<nt?rt.top+rt.height-(at.top+at.height):rt.top-at.top,...defaultScale$1}:null}const ot=getItemGap$1(tt,_e,$);return _e>$&&_e<=nt?{x:0,y:-at.height-ot,...defaultScale$1}:_e<$&&_e>=nt?{x:0,y:at.height+ot,...defaultScale$1}:{x:0,y:0,...defaultScale$1}};function getItemGap$1(a,s,$){const _=a[s],_e=a[s-1],tt=a[s+1];return _?$<s?_e?_.top-(_e.top+_e.height):tt?tt.top-(_.top+_.height):0:tt?tt.top-(_.top+_.height):_e?_.top-(_e.top+_e.height):0:0}const ID_PREFIX="Sortable",Context$1=React$a.createContext({activeIndex:-1,containerId:ID_PREFIX,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:rectSortingStrategy,disabled:{draggable:!1,droppable:!1}});function SortableContext(a){let{children:s,id:$,items:_,strategy:_e=rectSortingStrategy,disabled:tt=!1}=a;const{active:nt,dragOverlay:at,droppableRects:ot,over:rt,measureDroppableContainers:st}=useDndContext(),lt=useUniqueId(ID_PREFIX,$),et=at.rect!==null,it=reactExports.useMemo(()=>_.map(vt=>typeof vt=="object"&&"id"in vt?vt.id:vt),[_]),ut=nt!=null,ft=nt?it.indexOf(nt.id):-1,ht=rt?it.indexOf(rt.id):-1,dt=reactExports.useRef(it),gt=!itemsEqual(it,dt.current),pt=ht!==-1&&ft===-1||gt,mt=normalizeDisabled(tt);useIsomorphicLayoutEffect$1(()=>{gt&&ut&&st(it)},[gt,it,ut,st]),reactExports.useEffect(()=>{dt.current=it},[it]);const ct=reactExports.useMemo(()=>({activeIndex:ft,containerId:lt,disabled:mt,disableTransforms:pt,items:it,overIndex:ht,useDragOverlay:et,sortedRects:getSortedRects(it,ot),strategy:_e}),[ft,lt,mt.draggable,mt.droppable,pt,it,ht,ot,et,_e]);return React$a.createElement(Context$1.Provider,{value:ct},s)}const defaultNewIndexGetter=a=>{let{id:s,items:$,activeIndex:_,overIndex:_e}=a;return arrayMove($,_,_e).indexOf(s)},defaultAnimateLayoutChanges=a=>{let{containerId:s,isSorting:$,wasDragging:_,index:_e,items:tt,newIndex:nt,previousItems:at,previousContainerId:ot,transition:rt}=a;return!rt||!_||at!==tt&&_e===nt?!1:$?!0:nt!==_e&&s===ot},defaultTransition={duration:200,easing:"ease"},transitionProperty="transform",disabledTransition=CSS$1.Transition.toString({property:transitionProperty,duration:0,easing:"linear"}),defaultAttributes={roleDescription:"sortable"};function useDerivedTransform(a){let{disabled:s,index:$,node:_,rect:_e}=a;const[tt,nt]=reactExports.useState(null),at=reactExports.useRef($);return useIsomorphicLayoutEffect$1(()=>{if(!s&&$!==at.current&&_.current){const ot=_e.current;if(ot){const rt=getClientRect$1(_.current,{ignoreTransform:!0}),st={x:ot.left-rt.left,y:ot.top-rt.top,scaleX:ot.width/rt.width,scaleY:ot.height/rt.height};(st.x||st.y)&&nt(st)}}$!==at.current&&(at.current=$)},[s,$,_,_e]),reactExports.useEffect(()=>{tt&&nt(null)},[tt]),tt}function useSortable(a){let{animateLayoutChanges:s=defaultAnimateLayoutChanges,attributes:$,disabled:_,data:_e,getNewIndex:tt=defaultNewIndexGetter,id:nt,strategy:at,resizeObserverConfig:ot,transition:rt=defaultTransition}=a;const{items:st,containerId:lt,activeIndex:et,disabled:it,disableTransforms:ut,sortedRects:ft,overIndex:ht,useDragOverlay:dt,strategy:gt}=reactExports.useContext(Context$1),pt=normalizeLocalDisabled(_,it),mt=st.indexOf(nt),ct=reactExports.useMemo(()=>({sortable:{containerId:lt,index:mt,items:st},..._e}),[lt,_e,mt,st]),vt=reactExports.useMemo(()=>st.slice(st.indexOf(nt)),[st,nt]),{rect:At,node:xt,isOver:bt,setNodeRef:Et}=useDroppable({id:nt,data:ct,disabled:pt.droppable,resizeObserverConfig:{updateMeasurementsFor:vt,...ot}}),{active:St,activatorEvent:Bt,activeNodeRect:Ot,attributes:Pt,setNodeRef:wt,listeners:Ct,isDragging:It,over:yt,setActivatorNodeRef:Rt,transform:kt}=useDraggable({id:nt,data:ct,attributes:{...defaultAttributes,...$},disabled:pt.draggable}),jt=useCombinedRefs(Et,wt),Ht=!!St,Ft=Ht&&!ut&&isValidIndex(et)&&isValidIndex(ht),_t=!dt&&It,Nt=_t&&Ft?kt:null,Lt=Ft?Nt??(at??gt)({rects:ft,activeNodeRect:Ot,activeIndex:et,overIndex:ht,index:mt}):null,$t=isValidIndex(et)&&isValidIndex(ht)?tt({id:nt,items:st,activeIndex:et,overIndex:ht}):mt,Tt=St==null?void 0:St.id,Dt=reactExports.useRef({activeId:Tt,items:st,newIndex:$t,containerId:lt}),Ut=st!==Dt.current.items,Vt=s({active:St,containerId:lt,isDragging:It,isSorting:Ht,id:nt,index:mt,items:st,newIndex:Dt.current.newIndex,previousItems:Dt.current.items,previousContainerId:Dt.current.containerId,transition:rt,wasDragging:Dt.current.activeId!=null}),Qt=useDerivedTransform({disabled:!Vt,index:mt,node:xt,rect:At});return reactExports.useEffect(()=>{Ht&&Dt.current.newIndex!==$t&&(Dt.current.newIndex=$t),lt!==Dt.current.containerId&&(Dt.current.containerId=lt),st!==Dt.current.items&&(Dt.current.items=st)},[Ht,$t,lt,st]),reactExports.useEffect(()=>{if(Tt===Dt.current.activeId)return;if(Tt&&!Dt.current.activeId){Dt.current.activeId=Tt;return}const Zt=setTimeout(()=>{Dt.current.activeId=Tt},50);return()=>clearTimeout(Zt)},[Tt]),{active:St,activeIndex:et,attributes:Pt,data:ct,rect:At,index:mt,newIndex:$t,items:st,isOver:bt,isSorting:Ht,isDragging:It,listeners:Ct,node:xt,overIndex:ht,over:yt,setNodeRef:jt,setActivatorNodeRef:Rt,setDroppableNodeRef:Et,setDraggableNodeRef:wt,transform:Qt??Lt,transition:qt()};function qt(){if(Qt||Ut&&Dt.current.newIndex===mt)return disabledTransition;if(!(_t&&!isKeyboardEvent(Bt)||!rt)&&(Ht||Vt))return CSS$1.Transition.toString({...rt,property:transitionProperty})}}function normalizeLocalDisabled(a,s){var $,_;return typeof a=="boolean"?{draggable:a,droppable:!1}:{draggable:($=a==null?void 0:a.draggable)!=null?$:s.draggable,droppable:(_=a==null?void 0:a.droppable)!=null?_:s.droppable}}function hasSortableData(a){if(!a)return!1;const s=a.data.current;return!!(s&&"sortable"in s&&typeof s.sortable=="object"&&"containerId"in s.sortable&&"items"in s.sortable&&"index"in s.sortable)}const directions=[KeyboardCode.Down,KeyboardCode.Right,KeyboardCode.Up,KeyboardCode.Left],sortableKeyboardCoordinates=(a,s)=>{let{context:{active:$,collisionRect:_,droppableRects:_e,droppableContainers:tt,over:nt,scrollableAncestors:at}}=s;if(directions.includes(a.code)){if(a.preventDefault(),!$||!_)return;const ot=[];tt.getEnabled().forEach(lt=>{if(!lt||lt!=null&&lt.disabled)return;const et=_e.get(lt.id);if(et)switch(a.code){case KeyboardCode.Down:_.top<et.top&&ot.push(lt);break;case KeyboardCode.Up:_.top>et.top&&ot.push(lt);break;case KeyboardCode.Left:_.left>et.left&&ot.push(lt);break;case KeyboardCode.Right:_.left<et.left&&ot.push(lt);break}});const rt=closestCorners({active:$,collisionRect:_,droppableRects:_e,droppableContainers:ot,pointerCoordinates:null});let st=getFirstCollision(rt,"id");if(st===(nt==null?void 0:nt.id)&&rt.length>1&&(st=rt[1].id),st!=null){const lt=tt.get($.id),et=tt.get(st),it=et?_e.get(et.id):null,ut=et==null?void 0:et.node.current;if(ut&&it&&lt&&et){const ht=getScrollableAncestors(ut).some((vt,At)=>at[At]!==vt),dt=isSameContainer(lt,et),gt=isAfter(lt,et),pt=ht||!dt?{x:0,y:0}:{x:gt?_.width-it.width:0,y:gt?_.height-it.height:0},mt={x:it.left,y:it.top};return pt.x&&pt.y?mt:subtract(mt,pt)}}}};function isSameContainer(a,s){return!hasSortableData(a)||!hasSortableData(s)?!1:a.data.current.sortable.containerId===s.data.current.sortable.containerId}function isAfter(a,s){return!hasSortableData(a)||!hasSortableData(s)||!isSameContainer(a,s)?!1:a.data.current.sortable.index<s.data.current.sortable.index}const{Text:Text$4}=Typography$1,Item=React$a.memo(React$a.forwardRef(({icon:a,value:s,status:$,title:_,required:_e,readOnly:tt,style:nt,dragOverlay:at,onClick:ot,onMouseEnter:rt,onMouseLeave:st,dragging:lt,fadeIn:et,listeners:it,sorting:ut,transition:ft,transform:ht,...dt},gt)=>{const pt=reactExports.useContext(I18nContext);reactExports.useEffect(()=>{if(at)return document.body.style.cursor="grabbing",()=>{document.body.style.cursor=""}},[at]);const{x:mt,y:ct,scaleX:vt,scaleY:At}=ht||{x:0,y:0,scaleX:1,scaleY:1};return jsxRuntimeExports.jsx("li",{style:{marginTop:10,transition:ft,transform:`translate(${mt}px, ${ct}px) scale(${vt}, ${At})`},onMouseEnter:rt,onMouseLeave:st,ref:gt,children:jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",...nt},...dt,onClick:()=>ot&&ot(),children:[jsxRuntimeExports.jsx(Button$2,{...it,style:{display:"flex",alignItems:"center",background:"none",boxShadow:"none",border:"none",paddingLeft:"0.25rem"},icon:jsxRuntimeExports.jsx(HolderOutlined$1,{style:{cursor:"grab"}})}),a,jsxRuntimeExports.jsxs(Text$4,{style:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",width:"100%"},title:_||"",children:[$===void 0?s:jsxRuntimeExports.jsxs("span",{children:[jsxRuntimeExports.jsx(ExclamationCircleOutlined$1,{width:15,style:{marginRight:"0.5rem"}}),$==="is-warning"?pt("noKeyName"):s,$==="is-danger"?pt("notUniq"):""]}),tt&&jsxRuntimeExports.jsx(LockOutlined$1,{style:{marginLeft:"0.5rem"}}),_e&&jsxRuntimeExports.jsx("span",{style:{color:"red",marginLeft:"0.5rem"},children:"*"})]})]})})})),Item$1=Item,usePrevious=a=>{const s=reactExports.useRef(null);return reactExports.useEffect(()=>{s.current=a}),s.current},getScale=(a,s)=>Math.floor((a/s>1?1:a/s)*100)/100,useUIPreProcessor=({template:a,size:s,zoomLevel:$})=>{const[_,_e]=reactExports.useState([]),[tt,nt]=reactExports.useState([]),[at,ot]=reactExports.useState(0),[rt,st]=reactExports.useState(null),lt=async et=>{const{template:{basePdf:it,schemas:ut},size:ft}=et;let ht,dt,gt,pt;if(isBlankPdf(it)){const{width:ct,height:vt}=it;ht=ct*ZOOM,dt=vt*ZOOM,gt=ut.map(()=>"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUGFdj+P///38ACfsD/QVDRcoAAAAASUVORK5CYII="),pt=ut.map(()=>({width:ct,height:vt}))}else{const ct=await getB64BasePdf(it),vt=b64toBlob(ct);pt=await getPdfPageSizes(vt),ht=pt[0].width*ZOOM,dt=pt[0].height*ZOOM,gt=await pdf2Pngs(vt,ht)}const mt=Math.min(getScale(ft.width,ht),getScale(ft.height-RULER_HEIGHT,dt));return{backgrounds:gt,pageSizes:pt,scale:mt}};return reactExports.useEffect(()=>{lt({template:a,size:s}).then(({pageSizes:et,scale:it,backgrounds:ut})=>{nt(et),ot(it),_e(ut)}).catch(et=>{st(et),console.error(`[@pdfme/ui] ${et}`)})},[a,s]),{backgrounds:_,pageSizes:tt,scale:at*$,error:rt,refresh:et=>lt({template:et,size:s}).then(({pageSizes:it,scale:ut,backgrounds:ft})=>{nt(it),ot(ut),_e(ft)})}},useScrollPageCursor=({ref:a,pageSizes:s,scale:$,pageCursor:_,onChangePageCursor:_e})=>{const tt=reactExports.useCallback(()=>{if(!s[0]||!a.current)return;const nt=a.current.scrollTop,{top:at}=a.current.getBoundingClientRect(),ot=s.reduce((st,lt,et)=>{let it=(lt.height*ZOOM+RULER_HEIGHT)*$;return et===0?it+=at-it/2:it+=st[et-1],st.concat(it)},[]);let rt=0;ot.forEach((st,lt)=>{nt>st&&(rt=lt+1>=ot.length?ot.length-1:lt+1)}),rt!==_&&_e(rt)},[_e,_,s,a,$]);reactExports.useEffect(()=>{var nt;return(nt=a.current)==null||nt.addEventListener("scroll",tt),()=>{var at;(at=a.current)==null||at.removeEventListener("scroll",tt)}},[a,tt])},useMountStatus=()=>{const[a,s]=reactExports.useState(!1);return reactExports.useEffect(()=>{const $=setTimeout(()=>s(!0),500);return()=>clearTimeout($)},[]),a},useInitEvents=({pageCursor:a,pageSizes:s,activeElements:$,template:_,schemasList:_e,changeSchemas:tt,commitSchemas:nt,removeSchemas:at,onSaveTemplate:ot,past:rt,future:st,setSchemasList:lt,onEdit:et,onEditEnd:it})=>{const ut=reactExports.useRef(null),ft=reactExports.useCallback(()=>{const dt=()=>{const pt=$.map(mt=>mt.id);return _e[a].filter(mt=>pt.includes(mt.id))},gt=pt=>{const mt=pt==="undo",ct=mt?rt:st;if(ct.current.length<=0)return;(mt?st:rt).current.push(cloneDeep$1(_e[a]));const vt=cloneDeep$1(_e);vt[a]=ct.current.pop(),lt(vt)};initShortCuts({move:(pt,mt)=>{const ct=s[a],vt=dt(),At=moveCommandToChangeSchemasArg({command:pt,activeSchemas:vt,pageSize:ct,isShift:mt});tt(At)},copy:()=>{const pt=dt();pt.length!==0&&(ut.current=pt)},paste:()=>{if(!ut.current||ut.current.length===0)return;const pt=_e[a],mt=[],ct=ut.current.map(vt=>{const At=uuid$6(),xt=getUniqueSchemaName({copiedSchemaName:vt.name,schema:pt,stackUniqueSchemaNames:mt}),{height:bt,width:Et,position:St}=vt,Bt=s[a],Ot={x:St.x+10>Bt.width-Et?Bt.width-Et:St.x+10,y:St.y+10>Bt.height-bt?Bt.height-bt:St.y+10};return Object.assign(cloneDeep$1(vt),{id:At,name:xt,position:Ot})});nt(_e[a].concat(ct)),et(ct.map(vt=>document.getElementById(vt.id))),ut.current=ct},redo:()=>gt("redo"),undo:()=>gt("undo"),save:()=>ot&&ot(schemasList2template(_e,_.basePdf)),remove:()=>at(dt().map(pt=>pt.id)),esc:it,selectAll:()=>et(_e[a].map(pt=>document.getElementById(pt.id)))})},[_,$,a,s,tt,nt,_e,ot,at,rt,st,lt,ut,et,it]),ht=reactExports.useCallback(()=>{destroyShortCuts()},[]);reactExports.useEffect(()=>(ft(),ht),[ft,ht])},getWithModifiedSize=(a,s,$,_)=>{const tt=new DOMParser().parseFromString(a,"text/html"),nt=at=>{(at.tagName==="SVG"||at.tagName==="svg")&&(at.setAttribute("width",$.toString()),at.setAttribute("height",$.toString())),Array.from(at.children).forEach(ot=>nt(ot))};return Array.from(tt.body.children).forEach(at=>nt(at)),jsxRuntimeExports.jsx("div",{style:_,title:s,dangerouslySetInnerHTML:{__html:tt.body.innerHTML}})},PluginIcon=a=>{var rt;const{plugin:s,label:$,size:_,styles:_e}=a,{token:tt}=theme.useToken(),at=((rt=reactExports.useContext(OptionsContext).icons)==null?void 0:rt[s.propPanel.defaultSchema.type])??s.icon,ot={..._e,color:tt.colorText,display:"flex",justifyContent:"center"};return at?_?getWithModifiedSize(at,$,_,ot):jsxRuntimeExports.jsx("div",{style:ot,title:$,dangerouslySetInnerHTML:{__html:at}}):jsxRuntimeExports.jsx("div",{style:{..._e,overflow:"hidden",fontSize:10},title:$,children:$})},PluginIcon$1=PluginIcon,SelectableSortableItem=({isSelected:a,style:s,onSelect:$,onEdit:_,schema:_e,schemas:tt,onMouseEnter:nt,onMouseLeave:at})=>{const{token:ot}=theme.useToken(),rt=reactExports.useContext(I18nContext),st=reactExports.useContext(PluginsRegistry),{setNodeRef:lt,listeners:et,isDragging:it,isSorting:ut,transform:ft,transition:ht}=useSortable({id:_e.id}),dt=useMountStatus(),gt=it&&!dt,pt={...et,onClick:Et=>$(_e.id,Et.shiftKey)},[mt,ct]=Object.entries(st).find(([Et,St])=>(St==null?void 0:St.propPanel.defaultSchema.type)===_e.type),vt={width:20,marginRight:"0.5rem"};let At;_e.name?tt.find(Et=>_e.name&&Et.name===_e.name&&Et.id!==_e.id)&&(At="is-danger"):At="is-warning";let xt=rt("edit");At==="is-warning"?xt=rt("plsInputName"):At==="is-danger"&&(xt=rt("fieldMustUniq"));const bt=a?{background:ot.colorPrimary,opacity:ut||it?.5:1}:{};return jsxRuntimeExports.jsx(Item$1,{ref:lt,onMouseEnter:nt,onMouseLeave:at,onClick:()=>_(_e.id),icon:ct&&jsxRuntimeExports.jsx(PluginIcon$1,{plugin:ct,label:mt,size:20,styles:vt}),value:_e.name,status:At,title:xt,required:_e.required,readOnly:_e.readOnly,style:{...bt,...s},dragging:it,sorting:ut,transition:ht,transform:ft,fadeIn:gt,listeners:pt})},SelectableSortableItem$1=SelectableSortableItem,SelectableSortableContainer=a=>{const{token:s}=theme.useToken(),{schemas:$,onEdit:_,onSortEnd:_e,hoveringSchemaId:tt,onChangeHoveringSchemaId:nt}=a,[at,ot]=reactExports.useState([]),[rt,st]=reactExports.useState(null),[lt,et]=reactExports.useState(null),it=reactExports.useContext(PluginsRegistry),ut=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:15}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),ft=gt=>at.map(pt=>pt.id).includes(gt),ht=(gt,pt)=>{if(pt)if(ft(gt)){const mt=at.filter(ct=>ct.id!==gt);ot(mt)}else{const mt=$.find(vt=>vt.id===gt),ct=at.concat(mt);ot(ct)}else ot([])},dt=gt=>{const pt=typeof gt=="string"?$.find(vt=>vt.id===gt):gt,[mt,ct]=Object.entries(it).find(([vt,At])=>(At==null?void 0:At.propPanel.defaultSchema.type)===(pt==null?void 0:pt.type));return ct?jsxRuntimeExports.jsx(PluginIcon$1,{plugin:ct,label:mt,size:20,styles:{marginRight:"0.5rem"}}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})};return jsxRuntimeExports.jsx(DndContext,{sensors:ut,collisionDetection:closestCorners,onDragStart:({active:gt})=>{et(String(gt.id)),st($),ft(String(gt.id))?at.length>0&&_e(at.reduce((pt,mt)=>mt.id===String(gt.id)?pt:pt.filter(ct=>ct!==mt),$)):ot([])},onDragEnd:({active:gt,over:pt})=>{const mt=(pt==null?void 0:pt.id)||"",ct=$.map(At=>At.id).indexOf(String(gt.id)),vt=$.map(At=>At.id).indexOf(String(mt));if(at.length){let At=[...$];At=arrayMove(At,ct,vt),At.splice(vt+1,0,...at.filter(xt=>xt.id!==lt)),_e(At),ot([])}else ct!==vt&&_e(arrayMove($,ct,vt));et(null)},onDragCancel:()=>{rt&&_e(rt),et(null),st(null)},children:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{style:{height:"100%",overflowY:"auto"},children:jsxRuntimeExports.jsx(SortableContext,{items:$,strategy:verticalListSortingStrategy,children:jsxRuntimeExports.jsx("ul",{style:{margin:0,padding:0,listStyle:"none",borderRadius:5},children:$.map(gt=>jsxRuntimeExports.jsx(SelectableSortableItem$1,{style:{border:`1px solid ${gt.id===tt?s.colorPrimary:"transparent"}`},schema:gt,schemas:$,isSelected:ft(gt.id)||lt===gt.id,onEdit:_,onSelect:ht,onMouseEnter:()=>nt(gt.id),onMouseLeave:()=>nt(null)},gt.id))})})}),reactDomExports.createPortal(jsxRuntimeExports.jsx(DragOverlay,{adjustScale:!0,children:lt?(()=>{const gt=$.find(pt=>pt.id===lt);return gt?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("ul",{style:{margin:0,padding:0,listStyle:"none"},children:jsxRuntimeExports.jsx(Item$1,{icon:dt(lt),value:gt.name,required:gt.required,readOnly:gt.readOnly,style:{background:s.colorPrimary},dragOverlay:!0})}),jsxRuntimeExports.jsx("ul",{style:{margin:0,padding:0,listStyle:"none"},children:at.filter(pt=>pt.id!==lt).map(pt=>jsxRuntimeExports.jsx(Item$1,{icon:dt(pt),value:pt.name,required:pt.required,readOnly:pt.readOnly,style:{background:s.colorPrimary},dragOverlay:!0},pt.id))})]}):null})():null}),document.body)]})})},SelectableSortableContainer$1=SelectableSortableContainer,{Text:Text$3}=Typography$1,{TextArea:TextArea$2}=_Input,headHeight=40,ListView=a=>{const{schemas:s,onSortEnd:$,onEdit:_,size:_e,hoveringSchemaId:tt,onChangeHoveringSchemaId:nt,changeSchemas:at}=a,{token:ot}=theme.useToken(),rt=reactExports.useContext(I18nContext),[st,lt]=reactExports.useState(!1),[et,it]=reactExports.useState(""),ut=getSidebarContentHeight(_e.height),ft=()=>{const dt=et.split(`
591
+ `]:{zIndex:10,width:_,margin:`0 ${unit$1(a.marginXXS)}`,fontSize:_,cursor:"pointer",transition:`all ${a.motionDurationSlow}`,color:_e,"&:hover":{color:_e},svg:{verticalAlign:"baseline"}}},[`${at}-thumbnail, ${at}-thumbnail img`]:{position:"static",display:"block",width:"100%",height:"100%",objectFit:"contain"},[`${at}-name`]:{display:"none",textAlign:"center"},[`${at}-file + ${at}-name`]:{position:"absolute",bottom:a.margin,display:"block",width:`calc(100% - ${unit$1(tt(a.paddingXS).mul(2).equal())})`},[`${at}-uploading`]:{[`&${at}`]:{backgroundColor:a.colorFillAlter},[`&::before, ${$}-eye, ${$}-download, ${$}-delete`]:{display:"none"}},[`${at}-progress`]:{bottom:a.marginXL,width:`calc(100% - ${unit$1(tt(a.paddingXS).mul(2).equal())})`,paddingInlineStart:0}}}),[`${s}-wrapper${s}-picture-circle-wrapper`]:{[`${s}${s}-select`]:{borderRadius:"50%"}}}},genRtlStyle=a=>{const{componentCls:s}=a;return{[`${s}-rtl`]:{direction:"rtl"}}},genRtlStyle$1=genRtlStyle,genBaseStyle=a=>{const{componentCls:s,colorTextDisabled:$}=a;return{[`${s}-wrapper`]:Object.assign(Object.assign({},resetComponent(a)),{[s]:{outline:0,"input[type='file']":{cursor:"pointer"}},[`${s}-select`]:{display:"inline-block"},[`${s}-disabled`]:{color:$,cursor:"not-allowed"}})}},prepareComponentToken=a=>({actionsColor:a.colorTextDescription}),useStyle=genStyleHooks("Upload",a=>{const{fontSizeHeading3:s,fontHeight:$,lineWidth:_,controlHeightLG:_e,calc:tt}=a,nt=merge(a,{uploadThumbnailSize:tt(s).mul(2).equal(),uploadProgressOffset:tt(tt($).div(2)).add(_).equal(),uploadPicCardSize:tt(_e).mul(2.55).equal()});return[genBaseStyle(nt),genDraggerStyle$1(nt),genPictureStyle(nt),genPictureCardStyle(nt),genListStyle$1(nt),genMotionStyle$1(nt),genRtlStyle$1(nt),genCollapseMotion$1(nt)]},prepareComponentToken);var FileTwoTone$2={icon:function a(s,$){return{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M534 352V136H232v752h560V394H576a42 42 0 01-42-42z",fill:$}},{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM602 137.8L790.2 326H602V137.8zM792 888H232V136h302v216a42 42 0 0042 42h216v494z",fill:s}}]}},name:"file",theme:"twotone"};const FileTwoToneSvg=FileTwoTone$2;var FileTwoTone=function a(s,$){return reactExports.createElement(AntdIcon$1,_extends$2({},s,{ref:$,icon:FileTwoToneSvg}))};const FileTwoTone$1=reactExports.forwardRef(FileTwoTone);var PaperClipOutlined$2={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M779.3 196.6c-94.2-94.2-247.6-94.2-341.7 0l-261 260.8c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l261-260.8c32.4-32.4 75.5-50.2 121.3-50.2s88.9 17.8 121.2 50.2c32.4 32.4 50.2 75.5 50.2 121.2 0 45.8-17.8 88.8-50.2 121.2l-266 265.9-43.1 43.1c-40.3 40.3-105.8 40.3-146.1 0-19.5-19.5-30.2-45.4-30.2-73s10.7-53.5 30.2-73l263.9-263.8c6.7-6.6 15.5-10.3 24.9-10.3h.1c9.4 0 18.1 3.7 24.7 10.3 6.7 6.7 10.3 15.5 10.3 24.9 0 9.3-3.7 18.1-10.3 24.7L372.4 653c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l215.6-215.6c19.9-19.9 30.8-46.3 30.8-74.4s-11-54.6-30.8-74.4c-41.1-41.1-107.9-41-149 0L463 364 224.8 602.1A172.22 172.22 0 00174 724.8c0 46.3 18.1 89.8 50.8 122.5 33.9 33.8 78.3 50.7 122.7 50.7 44.4 0 88.8-16.9 122.6-50.7l309.2-309C824.8 492.7 850 432 850 367.5c.1-64.6-25.1-125.3-70.7-170.9z"}}]},name:"paper-clip",theme:"outlined"};const PaperClipOutlinedSvg=PaperClipOutlined$2;var PaperClipOutlined=function a(s,$){return reactExports.createElement(AntdIcon$1,_extends$2({},s,{ref:$,icon:PaperClipOutlinedSvg}))};const PaperClipOutlined$1=reactExports.forwardRef(PaperClipOutlined);var PictureTwoTone$2={icon:function a(s,$){return{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136v-39.9l138.5-164.3 150.1 178L658.1 489 888 761.6V792zm0-129.8L664.2 396.8c-3.2-3.8-9-3.8-12.2 0L424.6 666.4l-144-170.7c-3.2-3.8-9-3.8-12.2 0L136 652.7V232h752v430.2z",fill:s}},{tag:"path",attrs:{d:"M424.6 765.8l-150.1-178L136 752.1V792h752v-30.4L658.1 489z",fill:$}},{tag:"path",attrs:{d:"M136 652.7l132.4-157c3.2-3.8 9-3.8 12.2 0l144 170.7L652 396.8c3.2-3.8 9-3.8 12.2 0L888 662.2V232H136v420.7zM304 280a88 88 0 110 176 88 88 0 010-176z",fill:$}},{tag:"path",attrs:{d:"M276 368a28 28 0 1056 0 28 28 0 10-56 0z",fill:$}},{tag:"path",attrs:{d:"M304 456a88 88 0 100-176 88 88 0 000 176zm0-116c15.5 0 28 12.5 28 28s-12.5 28-28 28-28-12.5-28-28 12.5-28 28-28z",fill:s}}]}},name:"picture",theme:"twotone"};const PictureTwoToneSvg=PictureTwoTone$2;var PictureTwoTone=function a(s,$){return reactExports.createElement(AntdIcon$1,_extends$2({},s,{ref:$,icon:PictureTwoToneSvg}))};const PictureTwoTone$1=reactExports.forwardRef(PictureTwoTone);function file2Obj(a){return Object.assign(Object.assign({},a),{lastModified:a.lastModified,lastModifiedDate:a.lastModifiedDate,name:a.name,size:a.size,type:a.type,uid:a.uid,percent:0,originFileObj:a})}function updateFileList(a,s){const $=_toConsumableArray$d(s),_=$.findIndex(_e=>{let{uid:tt}=_e;return tt===a.uid});return _===-1?$.push(a):$[_]=a,$}function getFileItem(a,s){const $=a.uid!==void 0?"uid":"name";return s.filter(_=>_[$]===a[$])[0]}function removeFileItem(a,s){const $=a.uid!==void 0?"uid":"name",_=s.filter(_e=>_e[$]!==a[$]);return _.length===s.length?null:_}const extname=function(){const s=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:"").split("/"),_=s[s.length-1].split(/#|\?/)[0];return(/\.[^./\\]*$/.exec(_)||[""])[0]},isImageFileType=a=>a.indexOf("image/")===0,isImageUrl=a=>{if(a.type&&!a.thumbUrl)return isImageFileType(a.type);const s=a.thumbUrl||a.url||"",$=extname(s);return/^data:image\//.test(s)||/(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico|heic|heif)$/i.test($)?!0:!(/^data:/.test(s)||$)},MEASURE_SIZE=200;function previewImage(a){return new Promise(s=>{if(!a.type||!isImageFileType(a.type)){s("");return}const $=document.createElement("canvas");$.width=MEASURE_SIZE,$.height=MEASURE_SIZE,$.style.cssText=`position: fixed; left: 0; top: 0; width: ${MEASURE_SIZE}px; height: ${MEASURE_SIZE}px; z-index: 9999; display: none;`,document.body.appendChild($);const _=$.getContext("2d"),_e=new Image;if(_e.onload=()=>{const{width:tt,height:nt}=_e;let at=MEASURE_SIZE,ot=MEASURE_SIZE,rt=0,st=0;tt>nt?(ot=nt*(MEASURE_SIZE/tt),st=-(ot-at)/2):(at=tt*(MEASURE_SIZE/nt),rt=-(at-ot)/2),_.drawImage(_e,rt,st,at,ot);const lt=$.toDataURL();document.body.removeChild($),window.URL.revokeObjectURL(_e.src),s(lt)},_e.crossOrigin="anonymous",a.type.startsWith("image/svg+xml")){const tt=new FileReader;tt.onload=()=>{tt.result&&(_e.src=tt.result)},tt.readAsDataURL(a)}else if(a.type.startsWith("image/gif")){const tt=new FileReader;tt.onload=()=>{tt.result&&s(tt.result)},tt.readAsDataURL(a)}else _e.src=window.URL.createObjectURL(a)})}var DownloadOutlined$2={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"download",theme:"outlined"};const DownloadOutlinedSvg=DownloadOutlined$2;var DownloadOutlined=function a(s,$){return reactExports.createElement(AntdIcon$1,_extends$2({},s,{ref:$,icon:DownloadOutlinedSvg}))};const DownloadOutlined$1=reactExports.forwardRef(DownloadOutlined),ListItem=reactExports.forwardRef((a,s)=>{let{prefixCls:$,className:_,style:_e,locale:tt,listType:nt,file:at,items:ot,progress:rt,iconRender:st,actionIconRender:lt,itemRender:et,isImgUrl:it,showPreviewIcon:ut,showRemoveIcon:ft,showDownloadIcon:ht,previewIcon:dt,removeIcon:gt,downloadIcon:pt,onPreview:mt,onDownload:ct,onClose:vt}=a;var At,xt;const{status:bt}=at,[Et,St]=reactExports.useState(bt);reactExports.useEffect(()=>{bt!=="removed"&&St(bt)},[bt]);const[Bt,Ot]=reactExports.useState(!1);reactExports.useEffect(()=>{const Dt=setTimeout(()=>{Ot(!0)},300);return()=>{clearTimeout(Dt)}},[]);const Pt=st(at);let wt=reactExports.createElement("div",{className:`${$}-icon`},Pt);if(nt==="picture"||nt==="picture-card"||nt==="picture-circle")if(Et==="uploading"||!at.thumbUrl&&!at.url){const Dt=classnames(`${$}-list-item-thumbnail`,{[`${$}-list-item-file`]:Et!=="uploading"});wt=reactExports.createElement("div",{className:Dt},Pt)}else{const Dt=it!=null&&it(at)?reactExports.createElement("img",{src:at.thumbUrl||at.url,alt:at.name,className:`${$}-list-item-image`,crossOrigin:at.crossOrigin}):Pt,Ut=classnames(`${$}-list-item-thumbnail`,{[`${$}-list-item-file`]:it&&!it(at)});wt=reactExports.createElement("a",{className:Ut,onClick:Vt=>mt(at,Vt),href:at.url||at.thumbUrl,target:"_blank",rel:"noopener noreferrer"},Dt)}const Ct=classnames(`${$}-list-item`,`${$}-list-item-${Et}`),It=typeof at.linkProps=="string"?JSON.parse(at.linkProps):at.linkProps,yt=ft?lt((typeof gt=="function"?gt(at):gt)||reactExports.createElement(DeleteOutlined$1,null),()=>vt(at),$,tt.removeFile,!0):null,Rt=ht&&Et==="done"?lt((typeof pt=="function"?pt(at):pt)||reactExports.createElement(DownloadOutlined$1,null),()=>ct(at),$,tt.downloadFile):null,kt=nt!=="picture-card"&&nt!=="picture-circle"&&reactExports.createElement("span",{key:"download-delete",className:classnames(`${$}-list-item-actions`,{picture:nt==="picture"})},Rt,yt),jt=classnames(`${$}-list-item-name`),Ht=at.url?[reactExports.createElement("a",Object.assign({key:"view",target:"_blank",rel:"noopener noreferrer",className:jt,title:at.name},It,{href:at.url,onClick:Dt=>mt(at,Dt)}),at.name),kt]:[reactExports.createElement("span",{key:"view",className:jt,onClick:Dt=>mt(at,Dt),title:at.name},at.name),kt],Ft=ut&&(at.url||at.thumbUrl)?reactExports.createElement("a",{href:at.url||at.thumbUrl,target:"_blank",rel:"noopener noreferrer",onClick:Dt=>mt(at,Dt),title:tt.previewFile},typeof dt=="function"?dt(at):dt||reactExports.createElement(EyeOutlined$1,null)):null,_t=(nt==="picture-card"||nt==="picture-circle")&&Et!=="uploading"&&reactExports.createElement("span",{className:`${$}-list-item-actions`},Ft,Et==="done"&&Rt,yt),{getPrefixCls:Nt}=reactExports.useContext(ConfigContext$1),Mt=Nt(),Lt=reactExports.createElement("div",{className:Ct},wt,Ht,_t,Bt&&reactExports.createElement(CSSMotion,{motionName:`${Mt}-fade`,visible:Et==="uploading",motionDeadline:2e3},Dt=>{let{className:Ut}=Dt;const Vt="percent"in at?reactExports.createElement(Progress$1,Object.assign({},rt,{type:"line",percent:at.percent,"aria-label":at["aria-label"],"aria-labelledby":at["aria-labelledby"]})):null;return reactExports.createElement("div",{className:classnames(`${$}-list-item-progress`,Ut)},Vt)})),$t=at.response&&typeof at.response=="string"?at.response:((At=at.error)===null||At===void 0?void 0:At.statusText)||((xt=at.error)===null||xt===void 0?void 0:xt.message)||tt.uploadError,Tt=Et==="error"?reactExports.createElement(_Tooltip,{title:$t,getPopupContainer:Dt=>Dt.parentNode},Lt):Lt;return reactExports.createElement("div",{className:classnames(`${$}-list-item-container`,_),style:_e,ref:s},et?et(Tt,at,ot,{download:ct.bind(null,at),preview:mt.bind(null,at),remove:vt.bind(null,at)}):Tt)}),ListItem$1=ListItem,InternalUploadList=(a,s)=>{const{listType:$="text",previewFile:_=previewImage,onPreview:_e,onDownload:tt,onRemove:nt,locale:at,iconRender:ot,isImageUrl:rt=isImageUrl,prefixCls:st,items:lt=[],showPreviewIcon:et=!0,showRemoveIcon:it=!0,showDownloadIcon:ut=!1,removeIcon:ft,previewIcon:ht,downloadIcon:dt,progress:gt={size:[-1,2],showInfo:!1},appendAction:pt,appendActionVisible:mt=!0,itemRender:ct,disabled:vt}=a,At=useForceUpdate(),[xt,bt]=reactExports.useState(!1);reactExports.useEffect(()=>{$!=="picture"&&$!=="picture-card"&&$!=="picture-circle"||(lt||[]).forEach(Ft=>{typeof document>"u"||typeof window>"u"||!window.FileReader||!window.File||!(Ft.originFileObj instanceof File||Ft.originFileObj instanceof Blob)||Ft.thumbUrl!==void 0||(Ft.thumbUrl="",_&&_(Ft.originFileObj).then(_t=>{Ft.thumbUrl=_t||"",At()}))})},[$,lt,_]),reactExports.useEffect(()=>{bt(!0)},[]);const Et=(Ft,_t)=>{if(_e)return _t==null||_t.preventDefault(),_e(Ft)},St=Ft=>{typeof tt=="function"?tt(Ft):Ft.url&&window.open(Ft.url)},Bt=Ft=>{nt==null||nt(Ft)},Ot=Ft=>{if(ot)return ot(Ft,$);const _t=Ft.status==="uploading",Nt=rt&&rt(Ft)?reactExports.createElement(PictureTwoTone$1,null):reactExports.createElement(FileTwoTone$1,null);let Mt=_t?reactExports.createElement(LoadingOutlined$1,null):reactExports.createElement(PaperClipOutlined$1,null);return $==="picture"?Mt=_t?reactExports.createElement(LoadingOutlined$1,null):Nt:($==="picture-card"||$==="picture-circle")&&(Mt=_t?at.uploading:Nt),Mt},Pt=(Ft,_t,Nt,Mt,Lt)=>{const $t={type:"text",size:"small",title:Mt,onClick:Tt=>{_t(),isValidElement(Ft)&&Ft.props.onClick&&Ft.props.onClick(Tt)},className:`${Nt}-list-item-action`};if(Lt&&($t.disabled=vt),isValidElement(Ft)){const Tt=cloneElement(Ft,Object.assign(Object.assign({},Ft.props),{onClick:()=>{}}));return reactExports.createElement(Button$2,Object.assign({},$t,{icon:Tt}))}return reactExports.createElement(Button$2,Object.assign({},$t),reactExports.createElement("span",null,Ft))};reactExports.useImperativeHandle(s,()=>({handlePreview:Et,handleDownload:St}));const{getPrefixCls:wt}=reactExports.useContext(ConfigContext$1),Ct=wt("upload",st),It=wt(),yt=classnames(`${Ct}-list`,`${Ct}-list-${$}`),Rt=_toConsumableArray$d(lt.map(Ft=>({key:Ft.uid,file:Ft})));let jt={motionDeadline:2e3,motionName:`${Ct}-${$==="picture-card"||$==="picture-circle"?"animate-inline":"animate"}`,keys:Rt,motionAppear:xt};const Ht=reactExports.useMemo(()=>{const Ft=Object.assign({},initCollapseMotion$1(It));return delete Ft.onAppearEnd,delete Ft.onEnterEnd,delete Ft.onLeaveEnd,Ft},[It]);return $!=="picture-card"&&$!=="picture-circle"&&(jt=Object.assign(Object.assign({},Ht),jt)),reactExports.createElement("div",{className:yt},reactExports.createElement(CSSMotionList,Object.assign({},jt,{component:!1}),Ft=>{let{key:_t,file:Nt,className:Mt,style:Lt}=Ft;return reactExports.createElement(ListItem$1,{key:_t,locale:at,prefixCls:Ct,className:Mt,style:Lt,file:Nt,items:lt,progress:gt,listType:$,isImgUrl:rt,showPreviewIcon:et,showRemoveIcon:it,showDownloadIcon:ut,removeIcon:ft,previewIcon:ht,downloadIcon:dt,iconRender:Ot,actionIconRender:Pt,itemRender:ct,onPreview:Et,onDownload:St,onClose:Bt})}),pt&&reactExports.createElement(CSSMotion,Object.assign({},jt,{visible:mt,forceRender:!0}),Ft=>{let{className:_t,style:Nt}=Ft;return cloneElement(pt,Mt=>({className:classnames(Mt.className,_t),style:Object.assign(Object.assign(Object.assign({},Nt),{pointerEvents:_t?"none":void 0}),Mt.style)}))}))},UploadList=reactExports.forwardRef(InternalUploadList),UploadList$1=UploadList;var __awaiter$1=function(a,s,$,_){function _e(tt){return tt instanceof $?tt:new $(function(nt){nt(tt)})}return new($||($=Promise))(function(tt,nt){function at(st){try{rt(_.next(st))}catch(lt){nt(lt)}}function ot(st){try{rt(_.throw(st))}catch(lt){nt(lt)}}function rt(st){st.done?tt(st.value):_e(st.value).then(at,ot)}rt((_=_.apply(a,s||[])).next())})};const LIST_IGNORE=`__LIST_IGNORE_${Date.now()}__`,InternalUpload=(a,s)=>{const{fileList:$,defaultFileList:_,onRemove:_e,showUploadList:tt=!0,listType:nt="text",onPreview:at,onDownload:ot,onChange:rt,onDrop:st,previewFile:lt,disabled:et,locale:it,iconRender:ut,isImageUrl:ft,progress:ht,prefixCls:dt,className:gt,type:pt="select",children:mt,style:ct,itemRender:vt,maxCount:At,data:xt={},multiple:bt=!1,action:Et="",accept:St="",supportServerRender:Bt=!0,rootClassName:Ot}=a,Pt=reactExports.useContext(DisabledContext$1),wt=et??Pt,[Ct,It]=useMergedState(_||[],{value:$,postState:ur=>ur??[]}),[yt,Rt]=reactExports.useState("drop"),kt=reactExports.useRef(null);reactExports.useMemo(()=>{const ur=Date.now();($||[]).forEach((pr,yr)=>{!pr.uid&&!Object.isFrozen(pr)&&(pr.uid=`__AUTO__${ur}_${yr}__`)})},[$]);const jt=(ur,pr,yr)=>{let Er=_toConsumableArray$d(pr),br=!1;At===1?Er=Er.slice(-1):At&&(br=Er.length>At,Er=Er.slice(0,At)),reactDomExports.flushSync(()=>{It(Er)});const gr={file:ur,fileList:Er};yr&&(gr.event=yr),(!br||Er.some(Ar=>Ar.uid===ur.uid))&&reactDomExports.flushSync(()=>{rt==null||rt(gr)})},Ht=(ur,pr)=>__awaiter$1(void 0,void 0,void 0,function*(){const{beforeUpload:yr,transformFile:Er}=a;let br=ur;if(yr){const gr=yield yr(ur,pr);if(gr===!1)return!1;if(delete ur[LIST_IGNORE],gr===LIST_IGNORE)return Object.defineProperty(ur,LIST_IGNORE,{value:!0,configurable:!0}),!1;typeof gr=="object"&&gr&&(br=gr)}return Er&&(br=yield Er(br)),br}),Ft=ur=>{const pr=ur.filter(br=>!br.file[LIST_IGNORE]);if(!pr.length)return;const yr=pr.map(br=>file2Obj(br.file));let Er=_toConsumableArray$d(Ct);yr.forEach(br=>{Er=updateFileList(br,Er)}),yr.forEach((br,gr)=>{let Ar=br;if(pr[gr].parsedFile)br.status="uploading";else{const{originFileObj:Sr}=br;let Br;try{Br=new File([Sr],Sr.name,{type:Sr.type})}catch{Br=new Blob([Sr],{type:Sr.type}),Br.name=Sr.name,Br.lastModifiedDate=new Date,Br.lastModified=new Date().getTime()}Br.uid=br.uid,Ar=Br}jt(Ar,Er)})},_t=(ur,pr,yr)=>{try{typeof ur=="string"&&(ur=JSON.parse(ur))}catch{}if(!getFileItem(pr,Ct))return;const Er=file2Obj(pr);Er.status="done",Er.percent=100,Er.response=ur,Er.xhr=yr;const br=updateFileList(Er,Ct);jt(Er,br)},Nt=(ur,pr)=>{if(!getFileItem(pr,Ct))return;const yr=file2Obj(pr);yr.status="uploading",yr.percent=ur.percent;const Er=updateFileList(yr,Ct);jt(yr,Er,ur)},Mt=(ur,pr,yr)=>{if(!getFileItem(yr,Ct))return;const Er=file2Obj(yr);Er.error=ur,Er.response=pr,Er.status="error";const br=updateFileList(Er,Ct);jt(Er,br)},Lt=ur=>{let pr;Promise.resolve(typeof _e=="function"?_e(ur):_e).then(yr=>{var Er;if(yr===!1)return;const br=removeFileItem(ur,Ct);br&&(pr=Object.assign(Object.assign({},ur),{status:"removed"}),Ct==null||Ct.forEach(gr=>{const Ar=pr.uid!==void 0?"uid":"name";gr[Ar]===pr[Ar]&&!Object.isFrozen(gr)&&(gr.status="removed")}),(Er=kt.current)===null||Er===void 0||Er.abort(pr),jt(pr,br))})},$t=ur=>{Rt(ur.type),ur.type==="drop"&&(st==null||st(ur))};reactExports.useImperativeHandle(s,()=>({onBatchStart:Ft,onSuccess:_t,onProgress:Nt,onError:Mt,fileList:Ct,upload:kt.current}));const{getPrefixCls:Tt,direction:Dt,upload:Ut}=reactExports.useContext(ConfigContext$1),Vt=Tt("upload",dt),Qt=Object.assign(Object.assign({onBatchStart:Ft,onError:Mt,onProgress:Nt,onSuccess:_t},a),{data:xt,multiple:bt,action:Et,accept:St,supportServerRender:Bt,prefixCls:Vt,disabled:wt,beforeUpload:Ht,onChange:void 0});delete Qt.className,delete Qt.style,(!mt||wt)&&delete Qt.id;const qt=`${Vt}-wrapper`,[Zt,ar,Jt]=useStyle(Vt,qt),[rr]=useLocale$1("Upload",defaultLocale.Upload),{showRemoveIcon:Yt,showPreviewIcon:Kt,showDownloadIcon:nr,removeIcon:tr,previewIcon:ir,downloadIcon:sr}=typeof tt=="boolean"?{}:tt,cr=typeof Yt>"u"?!wt:!!Yt,or=(ur,pr)=>tt?reactExports.createElement(UploadList$1,{prefixCls:Vt,listType:nt,items:Ct,previewFile:lt,onPreview:at,onDownload:ot,onRemove:Lt,showRemoveIcon:cr,showPreviewIcon:Kt,showDownloadIcon:nr,removeIcon:tr,previewIcon:ir,downloadIcon:sr,iconRender:ut,locale:Object.assign(Object.assign({},rr),it),isImageUrl:ft,progress:ht,appendAction:ur,appendActionVisible:pr,itemRender:vt,disabled:wt}):ur,Xt=classnames(qt,gt,Ot,ar,Jt,Ut==null?void 0:Ut.className,{[`${Vt}-rtl`]:Dt==="rtl",[`${Vt}-picture-card-wrapper`]:nt==="picture-card",[`${Vt}-picture-circle-wrapper`]:nt==="picture-circle"}),Gt=Object.assign(Object.assign({},Ut==null?void 0:Ut.style),ct);if(pt==="drag"){const ur=classnames(ar,Vt,`${Vt}-drag`,{[`${Vt}-drag-uploading`]:Ct.some(pr=>pr.status==="uploading"),[`${Vt}-drag-hover`]:yt==="dragover",[`${Vt}-disabled`]:wt,[`${Vt}-rtl`]:Dt==="rtl"});return Zt(reactExports.createElement("span",{className:Xt},reactExports.createElement("div",{className:ur,style:Gt,onDrop:$t,onDragOver:$t,onDragLeave:$t},reactExports.createElement(Upload$2,Object.assign({},Qt,{ref:kt,className:`${Vt}-btn`}),reactExports.createElement("div",{className:`${Vt}-drag-container`},mt))),or()))}const Wt=classnames(Vt,`${Vt}-select`,{[`${Vt}-disabled`]:wt}),lr=(ur=>reactExports.createElement("div",{className:Wt,style:ur},reactExports.createElement(Upload$2,Object.assign({},Qt,{ref:kt}))))(mt?void 0:{display:"none"});return Zt(nt==="picture-card"||nt==="picture-circle"?reactExports.createElement("span",{className:Xt},or(lr,!!mt)):reactExports.createElement("span",{className:Xt},lr,or()))},Upload$1=reactExports.forwardRef(InternalUpload),InternalUpload$1=Upload$1;var __rest$4=function(a,s){var $={};for(var _ in a)Object.prototype.hasOwnProperty.call(a,_)&&s.indexOf(_)<0&&($[_]=a[_]);if(a!=null&&typeof Object.getOwnPropertySymbols=="function")for(var _e=0,_=Object.getOwnPropertySymbols(a);_e<_.length;_e++)s.indexOf(_[_e])<0&&Object.prototype.propertyIsEnumerable.call(a,_[_e])&&($[_[_e]]=a[_[_e]]);return $};const Dragger=reactExports.forwardRef((a,s)=>{var{style:$,height:_}=a,_e=__rest$4(a,["style","height"]);return reactExports.createElement(InternalUpload$1,Object.assign({ref:s},_e,{type:"drag",style:Object.assign(Object.assign({},$),{height:_})}))}),Dragger$1=Dragger,Upload=InternalUpload$1;Upload.Dragger=Dragger$1,Upload.LIST_IGNORE=LIST_IGNORE;const _Upload=Upload;var ArrowLeftOutlined$2={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"arrow-left",theme:"outlined"};const ArrowLeftOutlinedSvg=ArrowLeftOutlined$2;var ArrowLeftOutlined=function a(s,$){return reactExports.createElement(AntdIcon$1,_extends$2({},s,{ref:$,icon:ArrowLeftOutlinedSvg}))};const ArrowLeftOutlined$1=reactExports.forwardRef(ArrowLeftOutlined);var ArrowRightOutlined$2={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M869 487.8L491.2 159.9c-2.9-2.5-6.6-3.9-10.5-3.9h-88.5c-7.4 0-10.8 9.2-5.2 14l350.2 304H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h585.1L386.9 854c-5.6 4.9-2.2 14 5.2 14h91.5c1.9 0 3.8-.7 5.2-2L869 536.2a32.07 32.07 0 000-48.4z"}}]},name:"arrow-right",theme:"outlined"};const ArrowRightOutlinedSvg=ArrowRightOutlined$2;var ArrowRightOutlined=function a(s,$){return reactExports.createElement(AntdIcon$1,_extends$2({},s,{ref:$,icon:ArrowRightOutlinedSvg}))};const ArrowRightOutlined$1=reactExports.forwardRef(ArrowRightOutlined);var ExclamationCircleOutlined$2={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z"}}]},name:"exclamation-circle",theme:"outlined"};const ExclamationCircleOutlinedSvg=ExclamationCircleOutlined$2;var ExclamationCircleOutlined=function a(s,$){return reactExports.createElement(AntdIcon$1,_extends$2({},s,{ref:$,icon:ExclamationCircleOutlinedSvg}))};const ExclamationCircleOutlined$1=reactExports.forwardRef(ExclamationCircleOutlined);var LockOutlined$2={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 464h-68V240c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM332 240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v224H332V240zm460 600H232V536h560v304zM484 701v53c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-53a48.01 48.01 0 10-56 0z"}}]},name:"lock",theme:"outlined"};const LockOutlinedSvg=LockOutlined$2;var LockOutlined=function a(s,$){return reactExports.createElement(AntdIcon$1,_extends$2({},s,{ref:$,icon:LockOutlinedSvg}))};const LockOutlined$1=reactExports.forwardRef(LockOutlined);var MenuOutlined$2={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M904 160H120c-4.4 0-8 3.6-8 8v64c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-64c0-4.4-3.6-8-8-8zm0 624H120c-4.4 0-8 3.6-8 8v64c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-64c0-4.4-3.6-8-8-8zm0-312H120c-4.4 0-8 3.6-8 8v64c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-64c0-4.4-3.6-8-8-8z"}}]},name:"menu",theme:"outlined"};const MenuOutlinedSvg=MenuOutlined$2;var MenuOutlined=function a(s,$){return reactExports.createElement(AntdIcon$1,_extends$2({},s,{ref:$,icon:MenuOutlinedSvg}))};const MenuOutlined$1=reactExports.forwardRef(MenuOutlined);var MinusOutlined$2={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M872 474H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h720c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"minus",theme:"outlined"};const MinusOutlinedSvg=MinusOutlined$2;var MinusOutlined=function a(s,$){return reactExports.createElement(AntdIcon$1,_extends$2({},s,{ref:$,icon:MinusOutlinedSvg}))};const MinusOutlined$1=reactExports.forwardRef(MinusOutlined),dictEn={cancel:"Cancel",field:"field",fieldName:"Name",align:"Align",width:"Width",height:"Height",opacity:"Opacity",rotate:"Rotate",required:"Required",editable:"Editable",edit:"Edit",plsInputName:"Please input name",fieldMustUniq:"Name of field is not unique",notUniq:"(Not unique name)",noKeyName:"No name",fieldsList:"Field List",editField:"Edit Field",type:"Type",errorOccurred:"An error occurred",errorBulkUpdateFieldName:"Cannot commit the change because the number of items has been changed.",commitBulkUpdateFieldName:"Commit Changes",bulkUpdateFieldName:"Bulk update field names",addPageAfter:"Add Page After",removePage:"Remove Current Page",removePageConfirm:"Are you sure you want to delete this page? This action cannot be undone.","validation.hexColor":"Please enter a valid hex color code.","validation.uniqueName":"Please enter a unique name.","schemas.color":"Color","schemas.borderWidth":"Border Width","schemas.borderColor":"Border Color","schemas.backgroundColor":"Background Color","schemas.textColor":"Text Color","schemas.bgColor":"Background Color","schemas.horizontal":"Horizontal","schemas.vertical":"Vertical","schemas.left":"Left","schemas.center":"Center","schemas.right":"Right","schemas.top":"Top","schemas.middle":"Middle","schemas.bottom":"Bottom","schemas.padding":"Padding","schemas.text.fontName":"Font Name","schemas.text.size":"Size","schemas.text.spacing":"Spacing","schemas.text.textAlign":"Text Align","schemas.text.verticalAlign":"Vertical Align","schemas.text.lineHeight":"Line Height","schemas.text.min":"Min","schemas.text.max":"Max","schemas.text.fit":"Fit","schemas.text.dynamicFontSize":"Dynamic Font Size","schemas.text.format":"Format","schemas.mvt.typingInstructions":"Add variables by typing words surrounded by curly brackets, e.g.","schemas.mvt.sampleField":"name","schemas.mvt.variablesSampleData":"Variables Sample Data","schemas.barcodes.barColor":"Bar Color","schemas.barcodes.includetext":"Include Text","schemas.table.alternateBackgroundColor":"Alternate Background Color","schemas.table.tableStyle":"Table Style","schemas.table.headStyle":"Header Style","schemas.table.bodyStyle":"Body Style","schemas.table.columnStyle":"Column Style","schemas.date.format":"Date Format","schemas.select.options":"Options","schemas.select.optionPlaceholder":"Enter an option"},dictZh={cancel:"取消",field:"字段",fieldName:"名称",align:"对齐",width:"宽度",height:"高度",opacity:"透明度",rotate:"旋转",required:"必需的",editable:"可编辑的",edit:"编辑",plsInputName:"请输入名称",fieldMustUniq:"字段名称必须唯一",notUniq:"(名称不唯一)",noKeyName:"无名称",fieldsList:"字段列表",editField:"编辑字段",type:"类型",errorOccurred:"发生错误",errorBulkUpdateFieldName:"由于项目数量已更改,无法提交更改。",commitBulkUpdateFieldName:"提交更改",bulkUpdateFieldName:"批量更新字段名称",addPageAfter:"在之后添加页面",removePage:"删除当前页面",removePageConfirm:"您确定要删除此页面吗?此操作无法撤销。","validation.hexColor":"请输入有效的十六进制颜色代码。","validation.uniqueName":"请输入一个唯一的名称。","schemas.color":"颜色","schemas.borderWidth":"边框宽度","schemas.borderColor":"边框颜色","schemas.backgroundColor":"背景颜色","schemas.textColor":"文字颜色","schemas.bgColor":"背景颜色","schemas.horizontal":"水平","schemas.vertical":"垂直","schemas.left":"左","schemas.center":"中","schemas.right":"右","schemas.top":"顶","schemas.middle":"中间","schemas.bottom":"底","schemas.padding":"填充","schemas.text.fontName":"字体名称","schemas.text.size":"大小","schemas.text.spacing":"间距","schemas.text.textAlign":"文本对齐","schemas.text.verticalAlign":"垂直对齐","schemas.text.lineHeight":"行高","schemas.text.min":"最小","schemas.text.max":"最大","schemas.text.fit":"适应","schemas.text.dynamicFontSize":"动态字体大小","schemas.text.format":"格式","schemas.mvt.typingInstructions":"通过输入用花括号括起来的单词来添加变量,例如","schemas.mvt.sampleField":"姓名","schemas.mvt.variablesSampleData":"变量样本数据","schemas.barcodes.barColor":"条码颜色","schemas.barcodes.includetext":"包括文本","schemas.table.alternateBackgroundColor":"交替背景颜色","schemas.table.tableStyle":"表格样式","schemas.table.headStyle":"表头样式","schemas.table.bodyStyle":"表体样式","schemas.table.columnStyle":"列样式","schemas.date.format":"日期格式","schemas.select.options":"选项","schemas.select.optionPlaceholder":"请输入选项"},dictJa={cancel:"キャンセル",field:"入力項目",fieldName:"項目名",align:"整列",width:"幅",height:"高さ",opacity:"不透明度",rotate:"回転",required:"必須",editable:"編集可能",edit:"編集する",plsInputName:"項目名を入力してください",fieldMustUniq:"他の入力項目名と被っています",notUniq:"(他の項目名と重複しています)",noKeyName:"項目名なし",fieldsList:"入力項目一覧",editField:"入力項目を編集",type:"タイプ",errorOccurred:"エラーが発生しました",errorBulkUpdateFieldName:"項目数が変更されているため変更をコミットできません。",commitBulkUpdateFieldName:"変更を反映",bulkUpdateFieldName:"項目名を一括変更",addPageAfter:"次にページを追加",removePage:"現在のページを削除",removePageConfirm:"ページを削除してもよろしいですか?この操作は元に戻せません。","validation.hexColor":"有効な16進数のカラーコードを入力してください。","validation.uniqueName":"一意の名前を入力してください。","schemas.color":"色","schemas.borderWidth":"枠線の太さ","schemas.borderColor":"枠線の色","schemas.backgroundColor":"背景色","schemas.textColor":"テキストの色","schemas.bgColor":"背景色","schemas.horizontal":"水平","schemas.vertical":"垂直","schemas.left":"左","schemas.center":"中央","schemas.right":"右","schemas.top":"上","schemas.middle":"中間","schemas.bottom":"下","schemas.padding":"パディング","schemas.text.fontName":"フォント名","schemas.text.size":"サイズ","schemas.text.spacing":"間隔","schemas.text.textAlign":"テキストの揃え","schemas.text.verticalAlign":"垂直方向の揃え","schemas.text.lineHeight":"行の高さ","schemas.text.min":"最小","schemas.text.max":"最大","schemas.text.fit":"フィット","schemas.text.dynamicFontSize":"動的フォントサイズ","schemas.text.format":"書式","schemas.mvt.typingInstructions":"中括弧で囲まれた単語を入力して変数を追加します。例:","schemas.mvt.sampleField":"名前","schemas.mvt.variablesSampleData":"変数サンプルデータ","schemas.barcodes.barColor":"バーの色","schemas.barcodes.includetext":"テキストを含める","schemas.table.alternateBackgroundColor":"交互の背景色","schemas.table.tableStyle":"テーブルスタイル","schemas.table.headStyle":"ヘッダースタイル","schemas.table.bodyStyle":"ボディスタイル","schemas.table.columnStyle":"カラムスタイル","schemas.date.format":"日付形式","schemas.select.options":"オプション","schemas.select.optionPlaceholder":"オプションを入力してください"},dictKo={cancel:"취소",field:"필드",fieldName:"이름",align:"정렬",width:"너비",height:"높이",opacity:"투명도",rotate:"회전",required:"필수의",editable:"편집 가능한",edit:"편집",plsInputName:"이름을 입력하세요",fieldMustUniq:"필드 이름은 유일해야 합니다",notUniq:"(유일하지 않은 이름)",noKeyName:"이름 없음",fieldsList:"필드 목록",editField:"필드 편집",type:"유형",errorOccurred:"오류 발생",errorBulkUpdateFieldName:"항목 수가 변경되어 변경을 커밋할 수 없습니다.",commitBulkUpdateFieldName:"변경 사항 커밋",bulkUpdateFieldName:"필드 이름 일괄 업데이트",addPageAfter:"다음에 페이지 추가",removePage:"현재 페이지 제거",removePageConfirm:"이 페이지를 삭제하시겠습니까? 이 작업은 취소할 수 없습니다.","validation.hexColor":"유효한 16진수 색상 코드를 입력하세요.","validation.uniqueName":"고유한 이름을 입력하세요.","schemas.color":"색상","schemas.borderWidth":"테두리 너비","schemas.borderColor":"테두리 색상","schemas.backgroundColor":"배경색","schemas.textColor":"텍스트 색상","schemas.bgColor":"배경색","schemas.horizontal":"수평","schemas.vertical":"수직","schemas.left":"왼쪽","schemas.center":"중앙","schemas.right":"오른쪽","schemas.top":"상단","schemas.middle":"중간","schemas.bottom":"하단","schemas.padding":"패딩","schemas.text.fontName":"글꼴 이름","schemas.text.size":"크기","schemas.text.spacing":"간격","schemas.text.textAlign":"텍스트 정렬","schemas.text.verticalAlign":"수직 정렬","schemas.text.lineHeight":"줄 높이","schemas.text.min":"최소","schemas.text.max":"최대","schemas.text.fit":"맞춤","schemas.text.dynamicFontSize":"동적 폰트 크기","schemas.text.format":"형식","schemas.mvt.typingInstructions":"중괄호로 묶인 단어를 입력하여 변수를 추가하세요.","schemas.mvt.sampleField":"이름","schemas.mvt.variablesSampleData":"변수 샘플 데이터","schemas.barcodes.barColor":"바코드 색상","schemas.barcodes.includetext":"텍스트 포함","schemas.table.alternateBackgroundColor":"대체 배경색","schemas.table.tableStyle":"테이블 스타일","schemas.table.headStyle":"헤더 스타일","schemas.table.bodyStyle":"본문 스타일","schemas.table.columnStyle":"열 스타일","schemas.date.format":"날짜 형식","schemas.select.options":"옵션","schemas.select.optionPlaceholder":"옵션을 입력하세요"},dictAr={cancel:"إلغاء",field:"الحقل",fieldName:"اسم الحقل",align:"محاذاة",width:"العرض",height:"الارتفاع",opacity:"الشفافية",rotate:"تدوير",required:"مطلوب",editable:"قابل للتحرير",edit:"تعديل",plsInputName:"الرجاء إدخال الاسم",fieldMustUniq:"يجب أن يكون الحقل فريداً",notUniq:"(غير فريد)",noKeyName:"لا يوجد اسم للحقل",fieldsList:"قائمة الحقول",editField:"تعديل الحقل",type:"النوع",errorOccurred:"حدث خطأ",errorBulkUpdateFieldName:"لا يمكن تنفيذ التغيير لأنه تم تغيير عدد العناصر.",commitBulkUpdateFieldName:"تنفيذ التغييرات",bulkUpdateFieldName:"تغيير الأسماء",addPageAfter:"إضافة صفحة بعد",removePage:"احذف الصفحة الحالية",removePageConfirm:"هل أنت متأكد من رغبتك في حذف هذه الصفحة؟ لا يمكن التراجع عن هذا الإجراء.","validation.hexColor":"الرجاء إدخال رمز لون سداسي عشري صالح.","validation.uniqueName":"الرجاء إدخال اسم فريد.","schemas.color":"اللون","schemas.borderWidth":"عرض الحدود","schemas.borderColor":"لون الحدود","schemas.backgroundColor":"لون الخلفية","schemas.textColor":"لون الخط","schemas.bgColor":"لون الخلفية","schemas.horizontal":"أفقي","schemas.vertical":"عمودي","schemas.left":"يسار","schemas.center":"مركز","schemas.right":"يمين","schemas.top":"أعلى","schemas.middle":"وسط","schemas.bottom":"أسفل","schemas.padding":"التبطين","schemas.text.fontName":"اسم الخط","schemas.text.size":"الحجم","schemas.text.spacing":"التباعد","schemas.text.textAlign":"محاذاة النص","schemas.text.verticalAlign":"محاذاة عمودية","schemas.text.lineHeight":"ارتفاع السطر","schemas.text.min":"الحد الأدنى","schemas.text.max":"الحد الأقصى","schemas.text.fit":"ملاءمة","schemas.text.dynamicFontSize":"حجم الخط الديناميكي","schemas.text.format":"تنسيق","schemas.mvt.typingInstructions":"قم بإضافة المتغيرات عن طريق كتابة الكلمات المحاطة بأقواس متعرجة، على سبيل المثال:","schemas.mvt.sampleField":"اسم","schemas.mvt.variablesSampleData":"بيانات عينة المتغيرات","schemas.barcodes.barColor":"لون الشريط","schemas.barcodes.includetext":"تضمين النص","schemas.table.alternateBackgroundColor":"لون الخلفية البديل","schemas.table.tableStyle":"أسلوب الجدول","schemas.table.headStyle":"أسلوب الرأس","schemas.table.bodyStyle":"أسلوب الجسم","schemas.table.columnStyle":"أسلوب العمود","schemas.date.format":"تنسيق التاريخ","schemas.select.options":"خيارات","schemas.select.optionPlaceholder":"أدخل خيارًا"},dictTh={cancel:"ยกเลิก",field:"ฟิลด์",fieldName:"ชื่อฟิลด์",align:"จัดเรียง",width:"ความกว้าง",height:"ความสูง",opacity:"ความทึบ",rotate:"หมุน",required:"ที่จำเป็น",editable:"แก้ไขได้",edit:"แก้ไข",plsInputName:"กรุณาใส่ชื่อ",fieldMustUniq:"ชื่อฟิลด์ต้องไม่ซ้ำกัน",notUniq:"(ชื่อฟิลด์ซ้ำกัน)",noKeyName:"ไม่มีชื่อ",fieldsList:"รายการฟิลด์ทั้งหมด",editField:"แก้ไขฟิลด์",type:"ประเภท",errorOccurred:"เกิดข้อผิดพลาด",errorBulkUpdateFieldName:"ไม่สามารถยืนยันการแก้ไขได้เนื่องจากจำนวนรายการมีการเปลี่ยนแปลง",commitBulkUpdateFieldName:"ยืนยันการแก้ไข",bulkUpdateFieldName:"แก้ไขชื่อฟิลด์เป็นชุด",addPageAfter:"เพิ่มหน้าถัดไป",removePage:"ลบหน้าปัจจุบัน",removePageConfirm:"คุณแน่ใจหรือไม่ว่าต้องการลบหน้านี้? การกระทำนี้ไม่สามารถย้อนกลับได้","validation.hexColor":"กรุณาใส่รหัสสีแบบฐานสิบหกที่ถูกต้อง","validation.uniqueName":"กรุณาระบุชื่อที่ไม่ซ้ำ","schemas.color":"สี","schemas.borderWidth":"ความกว้างของเส้นขอบ","schemas.borderColor":"สีขอบ","schemas.backgroundColor":"สีพื้นหลัง","schemas.textColor":"สีข้อความ","schemas.bgColor":"สีพื้นหลัง","schemas.horizontal":"แนวนอน","schemas.vertical":"แนวตั้ง","schemas.left":"ซ้าย","schemas.center":"ตรงกลาง","schemas.right":"ขวา","schemas.top":"ด้านบน","schemas.middle":"ตรงกลาง","schemas.bottom":"ด้านล่าง","schemas.padding":"การเพิ่มพื้นที่","schemas.text.fontName":"ชื่อแบบอักษร","schemas.text.size":"ขนาด","schemas.text.spacing":"ระยะห่าง","schemas.text.textAlign":"จัดแนวข้อความ","schemas.text.verticalAlign":"จัดแนวแนวตั้ง","schemas.text.lineHeight":"ความสูงของบรรทัด","schemas.text.min":"ต่ำสุด","schemas.text.max":"สูงสุด","schemas.text.fit":"พอดี","schemas.text.dynamicFontSize":"ขนาดตัวอักษรแบบไดนามิก","schemas.text.format":"รูปแบบ","schemas.mvt.typingInstructions":"เพิ่มตัวแปรโดยพิมพ์คำที่ล้อมรอบด้วยวงเล็บปีกกา เช่น","schemas.mvt.sampleField":"ชื่อ","schemas.mvt.variablesSampleData":"ข้อมูลตัวอย่างตัวแปร","schemas.barcodes.barColor":"สีบาร์","schemas.barcodes.includetext":"รวมข้อความ","schemas.table.alternateBackgroundColor":"สีพื้นหลังสลับกัน","schemas.table.tableStyle":"สไตล์ตาราง","schemas.table.headStyle":"สไตล์หัวข้อ","schemas.table.bodyStyle":"สไตล์เนื้อหา","schemas.table.columnStyle":"สไตล์คอลัมน์","schemas.date.format":"รูปแบบวันที่","schemas.select.options":"ตัวเลือก","schemas.select.optionPlaceholder":"กรอกตัวเลือก"},dictIt={cancel:"Annulla",field:"Campo",fieldName:"Nome",align:"Allinea",width:"Larghezza",height:"Altezza",opacity:"Opacità",rotate:"Ruota",required:"Necessaria",editable:"Modificabile",edit:"Modifica",plsInputName:"Inserisci il nome per favore",fieldMustUniq:"Il nome del campo non è univoco",notUniq:"(Nome non univoco)",noKeyName:"Nessun nome",fieldsList:"Lista campi",editField:"Modifica campo",type:"Tipo",errorOccurred:"Riscontrato errore",errorBulkUpdateFieldName:"Non è possibile salvare le modifiche perché il numero di elementi è cambiato.",commitBulkUpdateFieldName:"Salva cambiamenti",bulkUpdateFieldName:"Modifica nomi campi in blocco",addPageAfter:"Aggiungi pagina dopo",removePage:"Rimuovi la Pagina Corrente",removePageConfirm:"Sei sicuro di voler eliminare questa pagina? Questa azione non può essere annullata.","validation.hexColor":"Inserisci un codice colore esadecimale valido.","validation.uniqueName":"Inserisci un nome univoco.","schemas.color":"Colore","schemas.borderWidth":"Spessore bordo","schemas.borderColor":"Colore bordo","schemas.backgroundColor":"Colore di Sfondo","schemas.textColor":"Colore testo","schemas.bgColor":"Colore sfondo","schemas.horizontal":"Orizzontale","schemas.vertical":"Verticale","schemas.left":"Sinistra","schemas.center":"Centro","schemas.right":"Destra","schemas.top":"Sopra","schemas.middle":"Medio","schemas.bottom":"Sotto","schemas.padding":"Padding","schemas.text.fontName":"Nome del font","schemas.text.size":"Dimensione","schemas.text.spacing":"Spaziatura","schemas.text.textAlign":"Allineamento testo","schemas.text.verticalAlign":"Allineamento verticale","schemas.text.lineHeight":"Altezza della linea","schemas.text.min":"Minimo","schemas.text.max":"Massimo","schemas.text.fit":"Adatta","schemas.text.dynamicFontSize":"Dimensione font dinamica","schemas.text.format":"Formato","schemas.mvt.typingInstructions":"Aggiungi variabili digitando parole circondate da parentesi graffe, ad es.","schemas.mvt.sampleField":"nome","schemas.mvt.variablesSampleData":"Dati di esempio variabili","schemas.barcodes.barColor":"Colore barra","schemas.barcodes.includetext":"Includi testo","schemas.table.alternateBackgroundColor":"Colore di Sfondo Alternato","schemas.table.tableStyle":"Stile della Tabella","schemas.table.headStyle":"Stile dell'Intestazione","schemas.table.bodyStyle":"Stile del Corpo","schemas.table.columnStyle":"Stile della Colonna","schemas.date.format":"Formato data","schemas.select.options":"Opzioni","schemas.select.optionPlaceholder":"Inserisci un'opzione"},dictPl={cancel:"Anuluj",field:"pole",fieldName:"Klucz pola",align:"Wyrównanie",width:"Szerokość",height:"Wysokość",opacity:"przezroczystość",rotate:"Obrót",required:"Wymagany",editable:"Edytowalny",edit:"Edytuj",plsInputName:"Wymagane wprowadzenie klucza pola",fieldMustUniq:"Klucz pola nie jest unikalny",notUniq:"(Klucz pola nie jest unikalny)",noKeyName:"Brak nazwy klucza pola",fieldsList:"Lista pól",editField:"Edytuj pole",type:"Typ pola",errorOccurred:"Wystąpił błąd",errorBulkUpdateFieldName:"Nie można wprowadzić zmian ponieważ liczba elementów uległa zmianie.",commitBulkUpdateFieldName:"Zaakceptuj zmiany",bulkUpdateFieldName:"Masowo aktualizuj klucze pól",addPageAfter:"Dodaj stronę po",removePage:"Usuń Bieżącą Stronę",removePageConfirm:"Czy na pewno chcesz usunąć tę stronę? Tej operacji nie można cofnąć.","validation.hexColor":"Wprowadź poprawny kod koloru szesnastkowego.","validation.uniqueName":"Proszę wpisać unikalną nazwę.","schemas.color":"Kolor","schemas.borderWidth":"Szerokość obramowania","schemas.borderColor":"Kolor obramowania","schemas.backgroundColor":"Kolor tła","schemas.textColor":"Kolor tekstu","schemas.bgColor":"Kolor tła","schemas.horizontal":"Poziomo","schemas.vertical":"Pionowo","schemas.left":"Lewo","schemas.center":"Centrum","schemas.right":"Prawo","schemas.top":"Góra","schemas.middle":"Środek","schemas.bottom":"Dół","schemas.padding":"Odsadzenie","schemas.text.fontName":"Nazwa czcionki","schemas.text.size":"Rozmiar","schemas.text.spacing":"Odstępy","schemas.text.textAlign":"Wyrównanie tekstu","schemas.text.verticalAlign":"Wyrównanie pionowe","schemas.text.lineHeight":"Wysokość linii","schemas.text.min":"Minimum","schemas.text.max":"Maksimum","schemas.text.fit":"Dopasowanie","schemas.text.dynamicFontSize":"Dynamiczny rozmiar czcionki","schemas.text.format":"Format","schemas.mvt.typingInstructions":"Dodaj zmienne, wpisując słowa ujęte w nawiasy klamrowe, np.","schemas.mvt.sampleField":"nazwa","schemas.mvt.variablesSampleData":"Zmienne Przykładowe dane","schemas.barcodes.barColor":"Kolor paska","schemas.barcodes.includetext":"Dołącz tekst","schemas.table.alternateBackgroundColor":"Alternatywny kolor tła","schemas.table.tableStyle":"Styl tabeli","schemas.table.headStyle":"Styl nagłówka","schemas.table.bodyStyle":"Styl ciała","schemas.table.columnStyle":"Styl kolumny","schemas.date.format":"Format daty","schemas.select.options":"Opcje","schemas.select.optionPlaceholder":"Wpisz opcję"},dictDe={cancel:"Abbrechen",field:"Feld",fieldName:"Name",align:"Ausrichten",width:"Breite",height:"Höhe",opacity:"Opazität",rotate:"Drehen",required:"Erforderlich",editable:"Bearbeitbar",edit:"Bearbeiten",plsInputName:"Bitte geben Sie einen Namen ein",fieldMustUniq:"Feldname ist nicht eindeutig",notUniq:"(Nicht eindeutiger Name)",noKeyName:"Kein Name",fieldsList:"Feldliste",editField:"Feld bearbeiten",type:"Typ",errorOccurred:"Ein Fehler ist aufgetreten",errorBulkUpdateFieldName:"Die Änderung kann nicht übernommen werden, weil die Anzahl der Elemente geändert wurde.",commitBulkUpdateFieldName:"Änderungen übernehmen",bulkUpdateFieldName:"Mehrfachaktualisierung der Feldnamen",addPageAfter:"Seite danach hinzufügen",removePage:"Aktuelle Seite entfernen",removePageConfirm:"Sind Sie sicher, dass Sie diese Seite löschen möchten? Diese Aktion kann nicht rückgängig gemacht werden.","validation.hexColor":"Bitte geben Sie einen gültigen Hex-Farbcode ein.","validation.uniqueName":"Bitte geben Sie einen eindeutigen Namen ein.","schemas.color":"Farbe","schemas.borderWidth":"Rahmenbreite","schemas.borderColor":"Rahmenfarbe","schemas.backgroundColor":"Hintergrundfarbe","schemas.textColor":"Textfarbe","schemas.bgColor":"Hintergrundfarbe","schemas.horizontal":"Horizontal","schemas.vertical":"Vertikal","schemas.left":"Links","schemas.center":"Zentriert","schemas.right":"Rechts","schemas.top":"Oben","schemas.middle":"Mitte","schemas.bottom":"Unten","schemas.padding":"Polsterung","schemas.text.fontName":"Schriftart","schemas.text.size":"Größe","schemas.text.spacing":"Abstand","schemas.text.textAlign":"Ausrichtung","schemas.text.verticalAlign":"vert. Ausr.","schemas.text.lineHeight":"Zeilenhöhe","schemas.text.min":"Min","schemas.text.max":"Max","schemas.text.fit":"Anpassen","schemas.text.dynamicFontSize":"Dynamische Schriftgröße","schemas.text.format":"Format","schemas.mvt.typingInstructions":"Fügen Sie Variablen hinzu, indem Sie Wörter in geschweiften Klammern eingeben, z. B.","schemas.mvt.sampleField":"Name","schemas.mvt.variablesSampleData":"Variablen Beispieldaten","schemas.barcodes.barColor":"Strichcodefarbe","schemas.barcodes.includetext":"Text anzeigen","schemas.table.alternateBackgroundColor":"Wechselnde Hintergrundfarbe","schemas.table.tableStyle":"Tabellenstil","schemas.table.headStyle":"Kopfzeilenstil","schemas.table.bodyStyle":"Körperstil","schemas.table.columnStyle":"Spaltenstil","schemas.date.format":"Datumsformat","schemas.select.options":"Optionen","schemas.select.optionPlaceholder":"Geben Sie eine Option ein"},dictEs={cancel:"Cancelar",field:"campo",fieldName:"Nombre",align:"Alinear",width:"Anchura",height:"Altura",opacity:"Opacidad",rotate:"Rotar",required:"Requerido",editable:"Editable",edit:"Editar",plsInputName:"Introduce el nombre",fieldMustUniq:"El nombre del campo no es único",notUniq:"(Nombre no único)",noKeyName:"Sin nombre",fieldsList:"Lista de campos",editField:"Editar campo",type:"Tipo",errorOccurred:"Ocurrió un error",errorBulkUpdateFieldName:"No se puede confirmar el cambio porque el número de elementos ha cambiado.",commitBulkUpdateFieldName:"Confirmar cambios",bulkUpdateFieldName:"Actualizar en bloque el nombre de los campos",addPageAfter:"Insertar página",removePage:"Eliminar página actual",removePageConfirm:"¿Estás seguro de que quieres eliminar esta página? Esta acción no se puede deshacer.","validation.hexColor":"Introduce un código de color hexadecimal válido.","validation.uniqueName":"Por favor, introduzca un nombre único.","schemas.color":"Color","schemas.borderWidth":"Ancho del borde","schemas.borderColor":"Color del borde","schemas.backgroundColor":"Color de fondo","schemas.textColor":"Color del texto","schemas.bgColor":"Color del fondo","schemas.horizontal":"Horizontal","schemas.vertical":"Vertical","schemas.left":"Izquierda","schemas.center":"Centro","schemas.right":"Derecha","schemas.top":"Arriba","schemas.middle":"Medio","schemas.bottom":"Abajo","schemas.padding":"Relleno","schemas.text.fontName":"Nombre de la fuente","schemas.text.size":"Tamaño","schemas.text.spacing":"Espaciado","schemas.text.textAlign":"Alineación del texto","schemas.text.verticalAlign":"Alineación vertical","schemas.text.lineHeight":"Altura de línea","schemas.text.min":"Mín","schemas.text.max":"Máx","schemas.text.fit":"Ajustar","schemas.text.dynamicFontSize":"Tamaño de fuente dinámico","schemas.text.format":"Formato","schemas.mvt.typingInstructions":"Agregue variables escribiendo palabras entre llaves, p.","schemas.mvt.sampleField":"nombre","schemas.mvt.variablesSampleData":"Variables Datos de muestra","schemas.barcodes.barColor":"Color de la barra","schemas.barcodes.includetext":"Incluir texto","schemas.table.alternateBackgroundColor":"Color de fondo alternativo","schemas.table.tableStyle":"Estilo de tabla","schemas.table.headStyle":"Estilo de cabecera","schemas.table.bodyStyle":"Estilo de cuerpo","schemas.table.columnStyle":"Estilo de columna","schemas.date.format":"Formato de fecha","schemas.select.options":"Opciones","schemas.select.optionPlaceholder":"Ingrese una opción"},dictFr={cancel:"Annuler",field:"Champ",fieldName:"Nom",align:"Aligner",width:"Largeur",height:"Hauteur",opacity:"Opacité",rotate:"Rotation",required:"Requis",editable:"Modifiable",edit:"Éditer",plsInputName:"Veuillez saisir le nom",fieldMustUniq:"Le nom du champ n'est pas unique",notUniq:"(Nombre non unique)",noKeyName:"Pas de nom",fieldsList:"Liste des champs",editField:"Éditer le champ",type:"Type",errorOccurred:"Une erreur est survenue",errorBulkUpdateFieldName:"Impossible de confirmer le changement car le nombre d'éléments a changé.",commitBulkUpdateFieldName:"Confirmer les changements",bulkUpdateFieldName:"Modifier les noms de champs en masse",addPageAfter:"Ajouter une page après",removePage:"Supprimer la page actuelle",removePageConfirm:"Êtes-vous sûr de vouloir supprimer cette page ? Cette action est irréversible.","validation.hexColor":"Veuillez entrer un code couleur hexadécimal valide.","validation.uniqueName":"Veuillez saisir un nom unique.","schemas.color":"Couleur","schemas.borderWidth":"Largeur de la bordure","schemas.borderColor":"Couleur de la bordure","schemas.backgroundColor":"Couleur de fond","schemas.textColor":"Couleur du texte","schemas.bgColor":"Couleur de fond","schemas.horizontal":"Horizontal","schemas.vertical":"Vertical","schemas.left":"Gauche","schemas.center":"Centre","schemas.right":"Droite","schemas.top":"Haut","schemas.middle":"Milieu","schemas.bottom":"Bas","schemas.padding":"Zone de remplissage","schemas.text.fontName":"Nom de la police","schemas.text.size":"Taille","schemas.text.spacing":"Espacement","schemas.text.textAlign":"Alignement du texte","schemas.text.verticalAlign":"Alignement vertical","schemas.text.lineHeight":"Hauteur de ligne","schemas.text.min":"Min","schemas.text.max":"Max","schemas.text.fit":"Ajustement","schemas.text.dynamicFontSize":"Taille de police dynamique","schemas.text.format":"Format","schemas.mvt.typingInstructions":"Ajoutez des variables en tapant des mots entourés d'accolades, par ex.","schemas.mvt.sampleField":"nom","schemas.mvt.variablesSampleData":"Variables Exemples de données","schemas.barcodes.barColor":"Couleur de la barre","schemas.barcodes.includetext":"Inclure le texte","schemas.table.alternateBackgroundColor":"Couleur de fond alternative","schemas.table.tableStyle":"Style de tableau","schemas.table.headStyle":"Style d'en-tête","schemas.table.bodyStyle":"Style de corps","schemas.table.columnStyle":"Style de colonne","schemas.date.format":"Format de date","schemas.select.options":"Options","schemas.select.optionPlaceholder":"Entrez une option"},dictionaries={en:dictEn,zh:dictZh,ja:dictJa,ko:dictKo,ar:dictAr,th:dictTh,it:dictIt,pl:dictPl,de:dictDe,es:dictEs,fr:dictFr},getDict=a=>dictionaries[a]||dictionaries[DEFAULT_LANG],i18n=(a,s)=>(s||getDict(DEFAULT_LANG))[a],I18nContext=reactExports.createContext(i18n),FontContext=reactExports.createContext(getDefaultFont()),PluginsRegistry=reactExports.createContext(builtInPlugins),OptionsContext=reactExports.createContext({});function arrayMove(a,s,$){const _=a.slice();return _.splice($<0?_.length+$:$,0,_.splice(s,1)[0]),_}function getSortedRects(a,s){return a.reduce(($,_,_e)=>{const tt=s.get(_);return tt&&($[_e]=tt),$},Array(a.length))}function isValidIndex(a){return a!==null&&a>=0}function itemsEqual(a,s){if(a===s)return!0;if(a.length!==s.length)return!1;for(let $=0;$<a.length;$++)if(a[$]!==s[$])return!1;return!0}function normalizeDisabled(a){return typeof a=="boolean"?{draggable:a,droppable:a}:a}const rectSortingStrategy=a=>{let{rects:s,activeIndex:$,overIndex:_,index:_e}=a;const tt=arrayMove(s,_,$),nt=s[_e],at=tt[_e];return!at||!nt?null:{x:at.left-nt.left,y:at.top-nt.top,scaleX:at.width/nt.width,scaleY:at.height/nt.height}},defaultScale$1={scaleX:1,scaleY:1},verticalListSortingStrategy=a=>{var s;let{activeIndex:$,activeNodeRect:_,index:_e,rects:tt,overIndex:nt}=a;const at=(s=tt[$])!=null?s:_;if(!at)return null;if(_e===$){const rt=tt[nt];return rt?{x:0,y:$<nt?rt.top+rt.height-(at.top+at.height):rt.top-at.top,...defaultScale$1}:null}const ot=getItemGap$1(tt,_e,$);return _e>$&&_e<=nt?{x:0,y:-at.height-ot,...defaultScale$1}:_e<$&&_e>=nt?{x:0,y:at.height+ot,...defaultScale$1}:{x:0,y:0,...defaultScale$1}};function getItemGap$1(a,s,$){const _=a[s],_e=a[s-1],tt=a[s+1];return _?$<s?_e?_.top-(_e.top+_e.height):tt?tt.top-(_.top+_.height):0:tt?tt.top-(_.top+_.height):_e?_.top-(_e.top+_e.height):0:0}const ID_PREFIX="Sortable",Context$1=React$a.createContext({activeIndex:-1,containerId:ID_PREFIX,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:rectSortingStrategy,disabled:{draggable:!1,droppable:!1}});function SortableContext(a){let{children:s,id:$,items:_,strategy:_e=rectSortingStrategy,disabled:tt=!1}=a;const{active:nt,dragOverlay:at,droppableRects:ot,over:rt,measureDroppableContainers:st}=useDndContext(),lt=useUniqueId(ID_PREFIX,$),et=at.rect!==null,it=reactExports.useMemo(()=>_.map(vt=>typeof vt=="object"&&"id"in vt?vt.id:vt),[_]),ut=nt!=null,ft=nt?it.indexOf(nt.id):-1,ht=rt?it.indexOf(rt.id):-1,dt=reactExports.useRef(it),gt=!itemsEqual(it,dt.current),pt=ht!==-1&&ft===-1||gt,mt=normalizeDisabled(tt);useIsomorphicLayoutEffect$1(()=>{gt&&ut&&st(it)},[gt,it,ut,st]),reactExports.useEffect(()=>{dt.current=it},[it]);const ct=reactExports.useMemo(()=>({activeIndex:ft,containerId:lt,disabled:mt,disableTransforms:pt,items:it,overIndex:ht,useDragOverlay:et,sortedRects:getSortedRects(it,ot),strategy:_e}),[ft,lt,mt.draggable,mt.droppable,pt,it,ht,ot,et,_e]);return React$a.createElement(Context$1.Provider,{value:ct},s)}const defaultNewIndexGetter=a=>{let{id:s,items:$,activeIndex:_,overIndex:_e}=a;return arrayMove($,_,_e).indexOf(s)},defaultAnimateLayoutChanges=a=>{let{containerId:s,isSorting:$,wasDragging:_,index:_e,items:tt,newIndex:nt,previousItems:at,previousContainerId:ot,transition:rt}=a;return!rt||!_||at!==tt&&_e===nt?!1:$?!0:nt!==_e&&s===ot},defaultTransition={duration:200,easing:"ease"},transitionProperty="transform",disabledTransition=CSS$1.Transition.toString({property:transitionProperty,duration:0,easing:"linear"}),defaultAttributes={roleDescription:"sortable"};function useDerivedTransform(a){let{disabled:s,index:$,node:_,rect:_e}=a;const[tt,nt]=reactExports.useState(null),at=reactExports.useRef($);return useIsomorphicLayoutEffect$1(()=>{if(!s&&$!==at.current&&_.current){const ot=_e.current;if(ot){const rt=getClientRect$1(_.current,{ignoreTransform:!0}),st={x:ot.left-rt.left,y:ot.top-rt.top,scaleX:ot.width/rt.width,scaleY:ot.height/rt.height};(st.x||st.y)&&nt(st)}}$!==at.current&&(at.current=$)},[s,$,_,_e]),reactExports.useEffect(()=>{tt&&nt(null)},[tt]),tt}function useSortable(a){let{animateLayoutChanges:s=defaultAnimateLayoutChanges,attributes:$,disabled:_,data:_e,getNewIndex:tt=defaultNewIndexGetter,id:nt,strategy:at,resizeObserverConfig:ot,transition:rt=defaultTransition}=a;const{items:st,containerId:lt,activeIndex:et,disabled:it,disableTransforms:ut,sortedRects:ft,overIndex:ht,useDragOverlay:dt,strategy:gt}=reactExports.useContext(Context$1),pt=normalizeLocalDisabled(_,it),mt=st.indexOf(nt),ct=reactExports.useMemo(()=>({sortable:{containerId:lt,index:mt,items:st},..._e}),[lt,_e,mt,st]),vt=reactExports.useMemo(()=>st.slice(st.indexOf(nt)),[st,nt]),{rect:At,node:xt,isOver:bt,setNodeRef:Et}=useDroppable({id:nt,data:ct,disabled:pt.droppable,resizeObserverConfig:{updateMeasurementsFor:vt,...ot}}),{active:St,activatorEvent:Bt,activeNodeRect:Ot,attributes:Pt,setNodeRef:wt,listeners:Ct,isDragging:It,over:yt,setActivatorNodeRef:Rt,transform:kt}=useDraggable({id:nt,data:ct,attributes:{...defaultAttributes,...$},disabled:pt.draggable}),jt=useCombinedRefs(Et,wt),Ht=!!St,Ft=Ht&&!ut&&isValidIndex(et)&&isValidIndex(ht),_t=!dt&&It,Nt=_t&&Ft?kt:null,Lt=Ft?Nt??(at??gt)({rects:ft,activeNodeRect:Ot,activeIndex:et,overIndex:ht,index:mt}):null,$t=isValidIndex(et)&&isValidIndex(ht)?tt({id:nt,items:st,activeIndex:et,overIndex:ht}):mt,Tt=St==null?void 0:St.id,Dt=reactExports.useRef({activeId:Tt,items:st,newIndex:$t,containerId:lt}),Ut=st!==Dt.current.items,Vt=s({active:St,containerId:lt,isDragging:It,isSorting:Ht,id:nt,index:mt,items:st,newIndex:Dt.current.newIndex,previousItems:Dt.current.items,previousContainerId:Dt.current.containerId,transition:rt,wasDragging:Dt.current.activeId!=null}),Qt=useDerivedTransform({disabled:!Vt,index:mt,node:xt,rect:At});return reactExports.useEffect(()=>{Ht&&Dt.current.newIndex!==$t&&(Dt.current.newIndex=$t),lt!==Dt.current.containerId&&(Dt.current.containerId=lt),st!==Dt.current.items&&(Dt.current.items=st)},[Ht,$t,lt,st]),reactExports.useEffect(()=>{if(Tt===Dt.current.activeId)return;if(Tt&&!Dt.current.activeId){Dt.current.activeId=Tt;return}const Zt=setTimeout(()=>{Dt.current.activeId=Tt},50);return()=>clearTimeout(Zt)},[Tt]),{active:St,activeIndex:et,attributes:Pt,data:ct,rect:At,index:mt,newIndex:$t,items:st,isOver:bt,isSorting:Ht,isDragging:It,listeners:Ct,node:xt,overIndex:ht,over:yt,setNodeRef:jt,setActivatorNodeRef:Rt,setDroppableNodeRef:Et,setDraggableNodeRef:wt,transform:Qt??Lt,transition:qt()};function qt(){if(Qt||Ut&&Dt.current.newIndex===mt)return disabledTransition;if(!(_t&&!isKeyboardEvent(Bt)||!rt)&&(Ht||Vt))return CSS$1.Transition.toString({...rt,property:transitionProperty})}}function normalizeLocalDisabled(a,s){var $,_;return typeof a=="boolean"?{draggable:a,droppable:!1}:{draggable:($=a==null?void 0:a.draggable)!=null?$:s.draggable,droppable:(_=a==null?void 0:a.droppable)!=null?_:s.droppable}}function hasSortableData(a){if(!a)return!1;const s=a.data.current;return!!(s&&"sortable"in s&&typeof s.sortable=="object"&&"containerId"in s.sortable&&"items"in s.sortable&&"index"in s.sortable)}const directions=[KeyboardCode.Down,KeyboardCode.Right,KeyboardCode.Up,KeyboardCode.Left],sortableKeyboardCoordinates=(a,s)=>{let{context:{active:$,collisionRect:_,droppableRects:_e,droppableContainers:tt,over:nt,scrollableAncestors:at}}=s;if(directions.includes(a.code)){if(a.preventDefault(),!$||!_)return;const ot=[];tt.getEnabled().forEach(lt=>{if(!lt||lt!=null&&lt.disabled)return;const et=_e.get(lt.id);if(et)switch(a.code){case KeyboardCode.Down:_.top<et.top&&ot.push(lt);break;case KeyboardCode.Up:_.top>et.top&&ot.push(lt);break;case KeyboardCode.Left:_.left>et.left&&ot.push(lt);break;case KeyboardCode.Right:_.left<et.left&&ot.push(lt);break}});const rt=closestCorners({active:$,collisionRect:_,droppableRects:_e,droppableContainers:ot,pointerCoordinates:null});let st=getFirstCollision(rt,"id");if(st===(nt==null?void 0:nt.id)&&rt.length>1&&(st=rt[1].id),st!=null){const lt=tt.get($.id),et=tt.get(st),it=et?_e.get(et.id):null,ut=et==null?void 0:et.node.current;if(ut&&it&&lt&&et){const ht=getScrollableAncestors(ut).some((vt,At)=>at[At]!==vt),dt=isSameContainer(lt,et),gt=isAfter(lt,et),pt=ht||!dt?{x:0,y:0}:{x:gt?_.width-it.width:0,y:gt?_.height-it.height:0},mt={x:it.left,y:it.top};return pt.x&&pt.y?mt:subtract(mt,pt)}}}};function isSameContainer(a,s){return!hasSortableData(a)||!hasSortableData(s)?!1:a.data.current.sortable.containerId===s.data.current.sortable.containerId}function isAfter(a,s){return!hasSortableData(a)||!hasSortableData(s)||!isSameContainer(a,s)?!1:a.data.current.sortable.index<s.data.current.sortable.index}const{Text:Text$4}=Typography$1,Item=React$a.memo(React$a.forwardRef(({icon:a,value:s,status:$,title:_,required:_e,readOnly:tt,style:nt,dragOverlay:at,onClick:ot,onMouseEnter:rt,onMouseLeave:st,dragging:lt,fadeIn:et,listeners:it,sorting:ut,transition:ft,transform:ht,...dt},gt)=>{const pt=reactExports.useContext(I18nContext);reactExports.useEffect(()=>{if(at)return document.body.style.cursor="grabbing",()=>{document.body.style.cursor=""}},[at]);const{x:mt,y:ct,scaleX:vt,scaleY:At}=ht||{x:0,y:0,scaleX:1,scaleY:1};return jsxRuntimeExports.jsx("li",{style:{marginTop:10,transition:ft,transform:`translate(${mt}px, ${ct}px) scale(${vt}, ${At})`},onMouseEnter:rt,onMouseLeave:st,ref:gt,children:jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",...nt},...dt,onClick:()=>ot&&ot(),children:[jsxRuntimeExports.jsx(Button$2,{...it,style:{display:"flex",alignItems:"center",background:"none",boxShadow:"none",border:"none",paddingLeft:"0.25rem"},icon:jsxRuntimeExports.jsx(HolderOutlined$1,{style:{cursor:"grab"}})}),a,jsxRuntimeExports.jsxs(Text$4,{style:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",width:"100%"},title:_||"",children:[$===void 0?s:jsxRuntimeExports.jsxs("span",{children:[jsxRuntimeExports.jsx(ExclamationCircleOutlined$1,{width:15,style:{marginRight:"0.5rem"}}),$==="is-warning"?pt("noKeyName"):s,$==="is-danger"?pt("notUniq"):""]}),tt&&jsxRuntimeExports.jsx(LockOutlined$1,{style:{marginLeft:"0.5rem"}}),_e&&jsxRuntimeExports.jsx("span",{style:{color:"red",marginLeft:"0.5rem"},children:"*"})]})]})})})),Item$1=Item,usePrevious=a=>{const s=reactExports.useRef(null);return reactExports.useEffect(()=>{s.current=a}),s.current},getScale=(a,s)=>Math.floor((a/s>1?1:a/s)*100)/100,useUIPreProcessor=({template:a,size:s,zoomLevel:$})=>{const[_,_e]=reactExports.useState([]),[tt,nt]=reactExports.useState([]),[at,ot]=reactExports.useState(0),[rt,st]=reactExports.useState(null),lt=async et=>{const{template:{basePdf:it,schemas:ut},size:ft}=et;let ht,dt,gt,pt;if(isBlankPdf(it)){const{width:ct,height:vt}=it;ht=ct*ZOOM,dt=vt*ZOOM,gt=ut.map(()=>"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUGFdj+P///38ACfsD/QVDRcoAAAAASUVORK5CYII="),pt=ut.map(()=>({width:ct,height:vt}))}else{const ct=await getB64BasePdf(it),vt=b64toBlob(ct);pt=await getPdfPageSizes(vt),ht=pt[0].width*ZOOM,dt=pt[0].height*ZOOM,gt=await pdf2Pngs(vt,ht)}const mt=Math.min(getScale(ft.width,ht),getScale(ft.height-RULER_HEIGHT,dt));return{backgrounds:gt,pageSizes:pt,scale:mt}};return reactExports.useEffect(()=>{lt({template:a,size:s}).then(({pageSizes:et,scale:it,backgrounds:ut})=>{nt(et),ot(it),_e(ut)}).catch(et=>{st(et),console.error(`[@pdfme/ui] ${et}`)})},[a,s]),{backgrounds:_,pageSizes:tt,scale:at*$,error:rt,refresh:et=>lt({template:et,size:s}).then(({pageSizes:it,scale:ut,backgrounds:ft})=>{nt(it),ot(ut),_e(ft)})}},useScrollPageCursor=({ref:a,pageSizes:s,scale:$,pageCursor:_,onChangePageCursor:_e})=>{const tt=reactExports.useCallback(()=>{if(!s[0]||!a.current)return;const nt=a.current.scrollTop,{top:at}=a.current.getBoundingClientRect(),ot=s.reduce((st,lt,et)=>{let it=(lt.height*ZOOM+RULER_HEIGHT)*$;return et===0?it+=at-it/2:it+=st[et-1],st.concat(it)},[]);let rt=0;ot.forEach((st,lt)=>{nt>st&&(rt=lt+1>=ot.length?ot.length-1:lt+1)}),rt!==_&&_e(rt)},[_e,_,s,a,$]);reactExports.useEffect(()=>{var nt;return(nt=a.current)==null||nt.addEventListener("scroll",tt),()=>{var at;(at=a.current)==null||at.removeEventListener("scroll",tt)}},[a,tt])},useMountStatus=()=>{const[a,s]=reactExports.useState(!1);return reactExports.useEffect(()=>{const $=setTimeout(()=>s(!0),500);return()=>clearTimeout($)},[]),a},useInitEvents=({pageCursor:a,pageSizes:s,activeElements:$,template:_,schemasList:_e,changeSchemas:tt,commitSchemas:nt,removeSchemas:at,onSaveTemplate:ot,past:rt,future:st,setSchemasList:lt,onEdit:et,onEditEnd:it})=>{const ut=reactExports.useRef(null),ft=reactExports.useCallback(()=>{const dt=()=>{const pt=$.map(mt=>mt.id);return _e[a].filter(mt=>pt.includes(mt.id))},gt=pt=>{const mt=pt==="undo",ct=mt?rt:st;if(ct.current.length<=0)return;(mt?st:rt).current.push(cloneDeep$1(_e[a]));const vt=cloneDeep$1(_e);vt[a]=ct.current.pop(),lt(vt)};initShortCuts({move:(pt,mt)=>{const ct=s[a],vt=dt(),At=moveCommandToChangeSchemasArg({command:pt,activeSchemas:vt,pageSize:ct,isShift:mt});tt(At)},copy:()=>{const pt=dt();pt.length!==0&&(ut.current=pt)},paste:()=>{if(!ut.current||ut.current.length===0)return;const pt=_e[a],mt=[],ct=ut.current.map(vt=>{const At=uuid$6(),xt=getUniqueSchemaName({copiedSchemaName:vt.name,schema:pt,stackUniqueSchemaNames:mt}),{height:bt,width:Et,position:St}=vt,Bt=s[a],Ot={x:St.x+10>Bt.width-Et?Bt.width-Et:St.x+10,y:St.y+10>Bt.height-bt?Bt.height-bt:St.y+10};return Object.assign(cloneDeep$1(vt),{id:At,name:xt,position:Ot})});nt(_e[a].concat(ct)),et(ct.map(vt=>document.getElementById(vt.id))),ut.current=ct},redo:()=>gt("redo"),undo:()=>gt("undo"),save:()=>ot&&ot(schemasList2template(_e,_.basePdf)),remove:()=>at(dt().map(pt=>pt.id)),esc:it,selectAll:()=>et(_e[a].map(pt=>document.getElementById(pt.id)))})},[_,$,a,s,tt,nt,_e,ot,at,rt,st,lt,ut,et,it]),ht=reactExports.useCallback(()=>{destroyShortCuts()},[]);reactExports.useEffect(()=>(ft(),ht),[ft,ht])},getWithModifiedSize=(a,s,$,_)=>{const tt=new DOMParser().parseFromString(a,"text/html"),nt=at=>{(at.tagName==="SVG"||at.tagName==="svg")&&(at.setAttribute("width",$.toString()),at.setAttribute("height",$.toString())),Array.from(at.children).forEach(ot=>nt(ot))};return Array.from(tt.body.children).forEach(at=>nt(at)),jsxRuntimeExports.jsx("div",{style:_,title:s,dangerouslySetInnerHTML:{__html:tt.body.innerHTML}})},PluginIcon=a=>{var rt;const{plugin:s,label:$,size:_,styles:_e}=a,{token:tt}=theme.useToken(),at=((rt=reactExports.useContext(OptionsContext).icons)==null?void 0:rt[s.propPanel.defaultSchema.type])??s.icon,ot={..._e,color:tt.colorText,display:"flex",justifyContent:"center"};return at?_?getWithModifiedSize(at,$,_,ot):jsxRuntimeExports.jsx("div",{style:ot,title:$,dangerouslySetInnerHTML:{__html:at}}):jsxRuntimeExports.jsx("div",{style:{..._e,overflow:"hidden",fontSize:10},title:$,children:$})},PluginIcon$1=PluginIcon,SelectableSortableItem=({isSelected:a,style:s,onSelect:$,onEdit:_,schema:_e,schemas:tt,onMouseEnter:nt,onMouseLeave:at})=>{const{token:ot}=theme.useToken(),rt=reactExports.useContext(I18nContext),st=reactExports.useContext(PluginsRegistry),{setNodeRef:lt,listeners:et,isDragging:it,isSorting:ut,transform:ft,transition:ht}=useSortable({id:_e.id}),dt=useMountStatus(),gt=it&&!dt,pt={...et,onClick:Et=>$(_e.id,Et.shiftKey)},[mt,ct]=Object.entries(st).find(([Et,St])=>(St==null?void 0:St.propPanel.defaultSchema.type)===_e.type),vt={width:20,marginRight:"0.5rem"};let At;_e.name?tt.find(Et=>_e.name&&Et.name===_e.name&&Et.id!==_e.id)&&(At="is-danger"):At="is-warning";let xt=rt("edit");At==="is-warning"?xt=rt("plsInputName"):At==="is-danger"&&(xt=rt("fieldMustUniq"));const bt=a?{background:ot.colorPrimary,opacity:ut||it?.5:1}:{};return jsxRuntimeExports.jsx(Item$1,{ref:lt,onMouseEnter:nt,onMouseLeave:at,onClick:()=>_(_e.id),icon:ct&&jsxRuntimeExports.jsx(PluginIcon$1,{plugin:ct,label:mt,size:20,styles:vt}),value:_e.name,status:At,title:xt,required:_e.required,readOnly:_e.readOnly,style:{...bt,...s},dragging:it,sorting:ut,transition:ht,transform:ft,fadeIn:gt,listeners:pt})},SelectableSortableItem$1=SelectableSortableItem,SelectableSortableContainer=a=>{const{token:s}=theme.useToken(),{schemas:$,onEdit:_,onSortEnd:_e,hoveringSchemaId:tt,onChangeHoveringSchemaId:nt}=a,[at,ot]=reactExports.useState([]),[rt,st]=reactExports.useState(null),[lt,et]=reactExports.useState(null),it=reactExports.useContext(PluginsRegistry),ut=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:15}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),ft=gt=>at.map(pt=>pt.id).includes(gt),ht=(gt,pt)=>{if(pt)if(ft(gt)){const mt=at.filter(ct=>ct.id!==gt);ot(mt)}else{const mt=$.find(vt=>vt.id===gt),ct=at.concat(mt);ot(ct)}else ot([])},dt=gt=>{const pt=typeof gt=="string"?$.find(vt=>vt.id===gt):gt,[mt,ct]=Object.entries(it).find(([vt,At])=>(At==null?void 0:At.propPanel.defaultSchema.type)===(pt==null?void 0:pt.type));return ct?jsxRuntimeExports.jsx(PluginIcon$1,{plugin:ct,label:mt,size:20,styles:{marginRight:"0.5rem"}}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})};return jsxRuntimeExports.jsx(DndContext,{sensors:ut,collisionDetection:closestCorners,onDragStart:({active:gt})=>{et(String(gt.id)),st($),ft(String(gt.id))?at.length>0&&_e(at.reduce((pt,mt)=>mt.id===String(gt.id)?pt:pt.filter(ct=>ct!==mt),$)):ot([])},onDragEnd:({active:gt,over:pt})=>{const mt=(pt==null?void 0:pt.id)||"",ct=$.map(At=>At.id).indexOf(String(gt.id)),vt=$.map(At=>At.id).indexOf(String(mt));if(at.length){let At=[...$];At=arrayMove(At,ct,vt),At.splice(vt+1,0,...at.filter(xt=>xt.id!==lt)),_e(At),ot([])}else ct!==vt&&_e(arrayMove($,ct,vt));et(null)},onDragCancel:()=>{rt&&_e(rt),et(null),st(null)},children:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{style:{height:"100%",overflowY:"auto"},children:jsxRuntimeExports.jsx(SortableContext,{items:$,strategy:verticalListSortingStrategy,children:jsxRuntimeExports.jsx("ul",{style:{margin:0,padding:0,listStyle:"none",borderRadius:5},children:$.map(gt=>jsxRuntimeExports.jsx(SelectableSortableItem$1,{style:{border:`1px solid ${gt.id===tt?s.colorPrimary:"transparent"}`},schema:gt,schemas:$,isSelected:ft(gt.id)||lt===gt.id,onEdit:_,onSelect:ht,onMouseEnter:()=>nt(gt.id),onMouseLeave:()=>nt(null)},gt.id))})})}),reactDomExports.createPortal(jsxRuntimeExports.jsx(DragOverlay,{adjustScale:!0,children:lt?(()=>{const gt=$.find(pt=>pt.id===lt);return gt?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("ul",{style:{margin:0,padding:0,listStyle:"none"},children:jsxRuntimeExports.jsx(Item$1,{icon:dt(lt),value:gt.name,required:gt.required,readOnly:gt.readOnly,style:{background:s.colorPrimary},dragOverlay:!0})}),jsxRuntimeExports.jsx("ul",{style:{margin:0,padding:0,listStyle:"none"},children:at.filter(pt=>pt.id!==lt).map(pt=>jsxRuntimeExports.jsx(Item$1,{icon:dt(pt),value:pt.name,required:pt.required,readOnly:pt.readOnly,style:{background:s.colorPrimary},dragOverlay:!0},pt.id))})]}):null})():null}),document.body)]})})},SelectableSortableContainer$1=SelectableSortableContainer,{Text:Text$3}=Typography$1,{TextArea:TextArea$2}=_Input,headHeight=40,ListView=a=>{const{schemas:s,onSortEnd:$,onEdit:_,size:_e,hoveringSchemaId:tt,onChangeHoveringSchemaId:nt,changeSchemas:at}=a,{token:ot}=theme.useToken(),rt=reactExports.useContext(I18nContext),[st,lt]=reactExports.useState(!1),[et,it]=reactExports.useState(""),ut=getSidebarContentHeight(_e.height),ft=()=>{const dt=et.split(`
592
592
  `);dt.length!==s.length?alert(rt("errorBulkUpdateFieldName")):(at(dt.map((gt,pt)=>({key:"name",value:gt,schemaId:s[pt].id}))),lt(!1))},ht=()=>{it(s.map(dt=>dt.name).join(`
593
593
  `)),lt(!0)};return jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("div",{style:{height:headHeight,display:"flex",alignItems:"center"},children:jsxRuntimeExports.jsx(Text$3,{strong:!0,style:{textAlign:"center",width:"100%"},children:rt("fieldsList")})}),jsxRuntimeExports.jsx(Divider$1,{style:{marginTop:ot.marginXS,marginBottom:ot.marginXS}}),jsxRuntimeExports.jsxs("div",{style:{height:ut-headHeight},children:[st?jsxRuntimeExports.jsx(TextArea$2,{wrap:"off",value:et,onChange:dt=>it(dt.target.value),style:{paddingLeft:30,height:ut-headHeight,width:RIGHT_SIDEBAR_WIDTH-35,lineHeight:"2.75rem"}}):jsxRuntimeExports.jsx(SelectableSortableContainer$1,{schemas:s,hoveringSchemaId:tt,onChangeHoveringSchemaId:nt,onSortEnd:$,onEdit:_}),jsxRuntimeExports.jsx("div",{style:{paddingTop:"0.5rem",display:"flex",alignItems:"center",justifyContent:"flex-end"},children:st?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Button$2,{size:"small",type:"text",onClick:ft,children:jsxRuntimeExports.jsxs("u",{children:[" ",rt("commitBulkUpdateFieldName")]})}),jsxRuntimeExports.jsx("span",{style:{margin:"0 1rem"},children:"/"}),jsxRuntimeExports.jsx(Button$2,{size:"small",type:"text",onClick:()=>lt(!1),children:jsxRuntimeExports.jsxs("u",{children:[" ",rt("cancel")]})})]}):jsxRuntimeExports.jsx(Button$2,{size:"small",type:"text",onClick:ht,children:jsxRuntimeExports.jsxs("u",{children:[" ",rt("bulkUpdateFieldName")]})})})]})]})},ListView$1=ListView;/*! *****************************************************************************
594
594
  Copyright (c) Microsoft Corporation.
@@ -1144,4 +1144,4 @@ canvas {
1144
1144
  .adder.dragging {
1145
1145
  display: block;
1146
1146
  }
1147
- `),GuidesElement=defaultStyled("div",GUIDES_CSS),Guides$1=function(a){__extends(s,a);function s(){var _=a!==null&&a.apply(this,arguments)||this;return _.state={guides:[]},_.scrollPos=0,_.guideElements=[],_.onDragStart=function(_e){var tt=_e.datas,nt=_e.inputEvent,at=_.props.onDragStart;addClass(tt.target,DRAGGING),_.onDrag(_e),at(__assign({},_e,{dragElement:tt.target})),nt.stopPropagation(),nt.preventDefault()},_.onDrag=function(_e){var tt=_.movePos(_e);return _.props.onDrag(__assign({},_e,{dragElement:_e.datas.target})),tt},_.onDragEnd=function(_e){var tt=_e.datas,nt=_e.isDouble,at=_e.distX,ot=_e.distY,rt=_.movePos(_e),st=_.state.guides,lt=_.props,et=lt.onChangeGuides,it=lt.zoom,ut=lt.displayDragPos,ft=lt.digit,ht=lt.lockGuides,dt=parseFloat((rt/it).toFixed(ft||0));if(ut&&(_.displayElement.style.cssText+="display: none;"),removeClass(tt.target,DRAGGING),_.props.onDragEnd(__assign({},_e,{dragElement:tt.target})),tt.fromRuler)rt>=_.scrollPos&&st.indexOf(dt)<0&&_.setState({guides:st.concat([dt])},function(){et({guides:_.state.guides,distX:at,distY:ot,isAdd:!0,isRemove:!1,isChange:!1})});else{var gt=tt.target.getAttribute("data-index"),pt=!1,mt=!1;if(st=st.slice(),nt||dt<_.scrollPos){if(ht&&(ht===!0||ht.indexOf("remove")>-1))return;st.splice(gt,1),pt=!0}else{if(st.indexOf(dt)>-1)return;if(ht&&(ht===!0||ht.indexOf("change")>-1))return;st[gt]=dt,mt=!0}_.setState({guides:st},function(){var ct=_.state.guides;et({distX:at,distY:ot,guides:ct,isAdd:!1,isChange:mt,isRemove:pt})})}},_}var $=s.prototype;return $.render=function(){var _=this.props,_e=_.className,tt=_.type,nt=_.zoom,at=_.style,ot=_.rulerStyle,rt=_.displayDragPos,st=_.cspNonce,lt=_.dragGuideStyle,et=_.portalContainer,it=this.props,ut=this.getTranslateName(),ft={};return PROPERTIES.forEach(function(ht){ht!=="style"&&(ft[ht]=it[ht])}),reactExports.createElement(GuidesElement,{ref:ref(this,"manager"),cspNonce:st,className:prefix("manager",tt)+" "+_e,portalContainer:et,style:at},reactExports.createElement("div",{className:prefix("guide-origin"),ref:ref(this,"originElement")}),reactExports.createElement(Ruler$1,__assign({ref:ref(this,"ruler"),style:ot},ft)),reactExports.createElement("div",{className:GUIDES,ref:ref(this,"guidesElement"),style:{transform:ut+"("+-this.scrollPos*nt+"px)"}},rt&&reactExports.createElement("div",{className:DISPLAY_DRAG,ref:ref(this,"displayElement"),style:lt}),reactExports.createElement("div",{className:ADDER,ref:ref(this,"adderElement")}),this.renderGuides()))},$.renderGuides=function(){var _=this,_e=this.props,tt=_e.type,nt=_e.zoom,at=_e.showGuides,ot=_e.guideStyle,rt=this.getTranslateName(),st=this.state.guides;if(this.guideElements=[],at)return st.map(function(lt,et){return reactExports.createElement("div",{className:prefix("guide",tt),ref:refs(_,"guideElements",et),key:et,"data-index":et,"data-pos":lt,style:__assign({},ot,{transform:rt+"("+lt*nt+"px) translateZ(0px)"})})})},$.componentDidMount=function(){var _=this;this.gesto=new Gesto(this.manager.getElement(),{container:document.body}).on("dragStart",function(_e){var tt=_.props,nt=tt.type,at=tt.zoom,ot=tt.lockGuides;if(ot===!0){_e.stop();return}var rt=_e.inputEvent,st=rt.target,lt=_e.datas,et=_.ruler.canvasElement,it=_.guidesElement,ut=nt==="horizontal",ft=_.originElement.getBoundingClientRect(),ht=getDistElementMatrix(_.manager.getElement()),dt=calculateMatrixDist(ht,[_e.clientX-ft.left,_e.clientY-ft.top]);dt[0]-=it.offsetLeft,dt[1]-=it.offsetTop,dt[ut?1:0]+=_.scrollPos*at,lt.offsetPos=dt,lt.matrix=ht;var gt=ot&&ot.indexOf("add")>-1,pt=ot&&ot.indexOf("remove")>-1,mt=ot&&ot.indexOf("change")>-1;if(st===et){if(gt){_e.stop();return}lt.fromRuler=!0,lt.target=_.adderElement}else if(hasClass(st,GUIDE)){if(pt&&mt){_e.stop();return}lt.target=st}else return _e.stop(),!1;_.onDragStart(_e)}).on("drag",this.onDrag).on("dragEnd",this.onDragEnd),this.setState({guides:this.props.defaultGuides||[]})},$.componentWillUnmount=function(){this.gesto.unset()},$.componentDidUpdate=function(_){_.defaultGuides!==this.props.defaultGuides&&this.setState({guides:this.props.defaultGuides||[]})},$.loadGuides=function(_){this.setState({guides:_})},$.getGuides=function(){return this.state.guides},$.scrollGuides=function(_){var _e=this.props.zoom,tt=this.guidesElement;this.scrollPos=_,tt.style.transform=this.getTranslateName()+"("+-_*_e+"px)";var nt=this.state.guides;this.guideElements.forEach(function(at,ot){at&&(at.style.display=-_+nt[ot]<0?"none":"block")})},$.resize=function(){this.ruler.resize()},$.scroll=function(_){this.ruler.scroll(_)},$.movePos=function(_){var _e=_.datas,tt=_.distX,nt=_.distY,at=this.props,ot=at.type,rt=at.zoom,st=at.snaps,lt=at.snapThreshold,et=at.displayDragPos,it=at.digit,ut=at.dragPosFormat||function(xt){return xt},ft=ot==="horizontal",ht=calculateMatrixDist(_e.matrix,[tt,nt]),dt=_e.offsetPos,gt=ht[0]+dt[0],pt=ht[1]+dt[1],mt=Math.round(ft?pt:gt),ct=parseFloat((mt/rt).toFixed(it||0)),vt=st.slice().sort(function(xt,bt){return Math.abs(ct-xt)-Math.abs(ct-bt)});if(vt.length&&Math.abs(vt[0]*rt-mt)<lt&&(ct=vt[0],mt=ct*rt),et){var At=ot==="horizontal"?[gt,mt]:[mt,pt];this.displayElement.style.cssText+="display: block;transform: translate(-50%, -50%) "+("translate("+At.map(function(xt){return xt+"px"}).join(", ")+")"),this.displayElement.innerHTML=""+ut(ct)}return _e.target.setAttribute("data-pos",ct),_e.target.style.transform=this.getTranslateName()+"("+mt+"px)",mt},$.getTranslateName=function(){return this.props.type==="horizontal"?"translateY":"translateX"},s.defaultProps={className:"",type:"horizontal",zoom:1,style:{},snapThreshold:5,snaps:[],digit:0,onChangeGuides:function(){},onDragStart:function(){},onDrag:function(){},onDragEnd:function(){},displayDragPos:!1,dragPosFormat:function(_){return _},defaultGuides:[],lockGuides:!1,showGuides:!0,guideStyle:{},dragGuideStyle:{},portalContainer:null},s}(reactExports.PureComponent);const Guides$2=Guides$1,guideStyle=(a,s,$,_)=>({position:"absolute",top:a,left:s,height:$,width:_,background:"#333333"}),_Guides=({paperSize:a,horizontalRef:s,verticalRef:$})=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"ruler-container",style:guideStyle(-RULER_HEIGHT,-RULER_HEIGHT,RULER_HEIGHT,RULER_HEIGHT)}),jsxRuntimeExports.jsx(Guides$2,{zoom:ZOOM,style:guideStyle(-RULER_HEIGHT,0,RULER_HEIGHT,a.width),type:"horizontal",ref:s}),jsxRuntimeExports.jsx(Guides$2,{zoom:ZOOM,style:guideStyle(0,-RULER_HEIGHT,a.height,RULER_HEIGHT),type:"vertical",ref:$})]}),Guides=_Guides,Mask=({width:a,height:s})=>jsxRuntimeExports.jsx("div",{style:{position:"absolute",top:-RULER_HEIGHT,left:-RULER_HEIGHT,zIndex:100,width:a,height:s,background:theme.useToken().token.colorBgMask}}),Mask$1=Mask,getPaddingStyle=(a,s,$)=>{const _={position:"absolute",background:$,opacity:.25,pointerEvents:"none"};switch(a){case 0:_.top=0,_.height=`${s*ZOOM}px`,_.left=0,_.right=0;break;case 1:_.right=0,_.width=`${s*ZOOM}px`,_.top=0,_.bottom=0;break;case 2:_.bottom=0,_.height=`${s*ZOOM}px`,_.left=0,_.right=0;break;case 3:_.left=0,_.width=`${s*ZOOM}px`,_.top=0,_.bottom=0;break}return _},Padding=({basePdf:a})=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:isBlankPdf(a)&&a.padding.map((s,$)=>jsxRuntimeExports.jsx("div",{style:getPaddingStyle($,s,theme.useToken().token.colorError)},String($)))}),Padding$1=Padding,mm2px=a=>a*3.7795275591,DELETE_BTN_ID=uuid$6(),fmt4Num=a=>Number(a.replace("px","")),fmt=a=>round(fmt4Num(a)/ZOOM,2),isTopLeftResize=a=>a==="-1,-1"||a==="-1,0"||a==="0,-1",normalizeRotate=a=>(a%360+360)%360,DeleteButton=({activeElements:a})=>{const{token:s}=theme.useToken(),$=26,_=Math.min(...a.map(({style:tt})=>fmt4Num(tt.top))),_e=Math.max(...a.map(({style:tt})=>fmt4Num(tt.left)+fmt4Num(tt.width)))+10;return jsxRuntimeExports.jsx(Button$2,{id:DELETE_BTN_ID,style:{position:"absolute",zIndex:1,top:_,left:_e,width:$,height:$,padding:2,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:s.borderRadius,color:s.colorWhite,background:s.colorPrimary},children:jsxRuntimeExports.jsx(CloseOutlined$4,{style:{pointerEvents:"none"}})})},Canvas=(a,s)=>{const{basePdf:$,pageCursor:_,scale:_e,backgrounds:tt,pageSizes:nt,size:at,activeElements:ot,schemasList:rt,hoveringSchemaId:st,onEdit:lt,changeSchemas:et,removeSchemas:it,onChangeHoveringSchemaId:ut,paperRefs:ft,sidebarOpen:ht}=a,{token:dt}=theme.useToken(),gt=reactExports.useContext(PluginsRegistry),pt=reactExports.useRef([]),mt=reactExports.useRef([]),ct=reactExports.useRef(null),[vt,At]=reactExports.useState(!1),[xt,bt]=reactExports.useState(!1),Et=usePrevious(rt[_]),St=Lt=>{Lt.shiftKey&&At(!0)},Bt=Lt=>{(Lt.key==="Shift"||!Lt.shiftKey)&&At(!1),(Lt.key==="Escape"||Lt.key==="Esc")&&bt(!1)},Ot=reactExports.useCallback(()=>{window.addEventListener("keydown",St),window.addEventListener("keyup",Bt)},[]),Pt=reactExports.useCallback(()=>{window.removeEventListener("keydown",St),window.removeEventListener("keyup",Bt)},[]);reactExports.useEffect(()=>(Ot(),Pt),[Ot,Pt]),reactExports.useEffect(()=>{var Tt,Dt;if((Tt=ct.current)==null||Tt.updateRect(),!Et)return;const Lt=JSON.stringify(Et[_]||{}),$t=JSON.stringify(rt[_]||{});Lt===$t&&((Dt=ct.current)==null||Dt.updateRect())},[_,rt,Et]);const wt=({target:Lt,top:$t,left:Tt})=>{const{width:Dt,height:Ut}=Lt.style,Vt=fmt(Dt),Qt=fmt(Ut),qt=$t/ZOOM,Zt=Tt/ZOOM,{width:ar,height:Jt}=nt[_];let rr=0,Yt=0,Kt=0,nr=0;if(isBlankPdf($)){const[tr,ir,sr,cr]=$.padding;rr=tr*ZOOM,Yt=ir,Kt=sr,nr=cr*ZOOM}qt+Qt>Jt-Kt?Lt.style.top=`${(Jt-Qt-Kt)*ZOOM}px`:Lt.style.top=`${$t<rr?rr:$t}px`,Zt+Vt>ar-Yt?Lt.style.left=`${(ar-Vt-Yt)*ZOOM}px`:Lt.style.left=`${Tt<nr?nr:Tt}px`},Ct=({target:Lt})=>{const{top:$t,left:Tt}=Lt.style;et([{key:"position.y",value:fmt($t),schemaId:Lt.id},{key:"position.x",value:fmt(Tt),schemaId:Lt.id}])},It=({targets:Lt})=>{const $t=Lt.map(({style:{top:Tt,left:Dt},id:Ut})=>[{key:"position.y",value:fmt(Tt),schemaId:Ut},{key:"position.x",value:fmt(Dt),schemaId:Ut}]);et(flatten($t))},yt=({target:Lt,rotate:$t})=>{Lt.style.transform=`rotate(${$t}deg)`},Rt=({target:Lt})=>{const{transform:$t}=Lt.style,Tt=Number($t.replace("rotate(","").replace("deg)","")),Dt=normalizeRotate(Tt);et([{key:"rotate",value:Dt,schemaId:Lt.id}])},kt=({targets:Lt})=>{const $t=Lt.map(({style:{transform:Tt},id:Dt})=>{const Ut=Number(Tt.replace("rotate(","").replace("deg)",""));return[{key:"rotate",value:normalizeRotate(Ut),schemaId:Dt}]});et(flatten($t))},jt=({target:Lt})=>{const{id:$t,style:Tt}=Lt,{width:Dt,height:Ut,top:Vt,left:Qt}=Tt;et([{key:"position.x",value:fmt(Qt),schemaId:$t},{key:"position.y",value:fmt(Vt),schemaId:$t},{key:"width",value:fmt(Dt),schemaId:$t},{key:"height",value:fmt(Ut),schemaId:$t}]);const qt=rt[_].find(Zt=>Zt.id===$t);qt&&(qt.position.x=fmt(Qt),qt.position.y=fmt(Vt),qt.width=fmt(Dt),qt.height=fmt(Ut))},Ht=({targets:Lt})=>{const $t=Lt.map(({style:{width:Tt,height:Dt,top:Ut,left:Vt},id:Qt})=>[{key:"width",value:fmt(Tt),schemaId:Qt},{key:"height",value:fmt(Dt),schemaId:Qt},{key:"position.y",value:fmt(Ut),schemaId:Qt},{key:"position.x",value:fmt(Vt),schemaId:Qt}]);et(flatten($t))},Ft=({target:Lt,width:$t,height:Tt,direction:Dt})=>{if(!Lt)return;let Ut=0,Vt=0,Qt=0,qt=0;if(isBlankPdf($)){const[tr,ir,sr,cr]=$.padding;Ut=tr*ZOOM,Vt=mm2px(ir),Qt=mm2px(sr),qt=cr*ZOOM}const Zt=mm2px(nt[_].width),ar=mm2px(nt[_].height),Jt={width:`${$t}px`,height:`${Tt}px`},rr=Lt.style;let Yt=fmt4Num(rr.left)+(fmt4Num(rr.width)-$t),Kt=fmt4Num(rr.top)+(fmt4Num(rr.height)-Tt);Yt<qt&&(Yt=qt),Kt<Ut&&(Kt=Ut),Yt+$t>Zt-Vt&&(Jt.width=`${Zt-Vt-Yt}px`),Kt+Tt>ar-Qt&&(Jt.height=`${ar-Qt-Kt}px`);const nr=Dt.toString();isTopLeftResize(nr)?(Jt.top=`${Kt}px`,Jt.left=`${Yt}px`):nr==="1,-1"?Jt.top=`${Kt}px`:nr==="-1,1"&&(Jt.left=`${Yt}px`),Object.assign(rr,Jt)},_t=(Lt,$t)=>Lt[$t]&&Lt[$t].getGuides().map(Tt=>Tt*ZOOM),Nt=Lt=>{Lt.inputEvent.stopPropagation(),bt(!0)},Mt=reactExports.useMemo(()=>{const $t=(rt[_]||[]).filter(Ut=>ot.map(Vt=>Vt.id).includes(Ut.id)).map(Ut=>Ut.type),Tt=[...new Set($t)],Dt=Object.values(gt).map(Ut=>Ut==null?void 0:Ut.propPanel.defaultSchema);return Tt.every(Ut=>{var Vt;return((Vt=Dt.find(Qt=>Qt.type===Ut))==null?void 0:Vt.rotate)!==void 0})},[ot,_,rt,gt]);return jsxRuntimeExports.jsxs("div",{style:{position:"relative",overflow:"auto",marginRight:ht?RIGHT_SIDEBAR_WIDTH:0,...at},ref:s,children:[jsxRuntimeExports.jsx(Selecto,{container:ft.current[_],continueSelect:vt,onDragStart:Lt=>{var Dt,Ut;const{inputEvent:$t}=Lt,Tt=(Dt=ct.current)==null?void 0:Dt.isMoveableElement($t.target);($t.type==="touchstart"&&Lt.isTrusted||Tt)&&Lt.stop(),ft.current[_]===$t.target&&lt([]),((Ut=$t.target)==null?void 0:Ut.id)===DELETE_BTN_ID&&it(ot.map(Vt=>Vt.id))},onSelect:({added:Lt,removed:$t,selected:Tt,inputEvent:Dt})=>{const Ut=Dt.type==="mousedown";let Vt=Ut?Tt:[];!Ut&&Lt.length>0&&(Vt=ot.concat(Lt)),!Ut&&$t.length>0&&(Vt=ot.filter(Qt=>!$t.includes(Qt))),lt(Vt),Vt!=ot&&bt(!1),Dt.shiftKey||At(!1)}}),jsxRuntimeExports.jsx(Paper$1,{paperRefs:ft,scale:_e,size:at,schemasList:rt,pageSizes:nt,backgrounds:tt,hasRulers:!0,renderPaper:({index:Lt,paperSize:$t})=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!xt&&ot.length>0&&_===Lt&&jsxRuntimeExports.jsx(DeleteButton,{activeElements:ot}),jsxRuntimeExports.jsx(Padding$1,{basePdf:$}),jsxRuntimeExports.jsx(Guides,{paperSize:$t,horizontalRef:Tt=>{Tt&&(mt.current[Lt]=Tt)},verticalRef:Tt=>{Tt&&(pt.current[Lt]=Tt)}}),_!==Lt?jsxRuntimeExports.jsx(Mask$1,{width:$t.width+RULER_HEIGHT,height:$t.height+RULER_HEIGHT}):!xt&&jsxRuntimeExports.jsx(Moveable,{ref:ct,target:ot,bounds:{left:0,top:0,bottom:$t.height,right:$t.width},horizontalGuidelines:_t(mt.current,Lt),verticalGuidelines:_t(pt.current,Lt),keepRatio:vt,rotatable:Mt,onDrag:wt,onDragEnd:Ct,onDragGroupEnd:It,onRotate:yt,onRotateEnd:Rt,onRotateGroupEnd:kt,onResize:Ft,onResizeEnd:jt,onResizeGroupEnd:Ht,onClick:Nt})]}),renderSchema:({schema:Lt})=>jsxRuntimeExports.jsx(Renderer$1,{schema:Lt,basePdf:$,value:Lt.content||"",onChangeHoveringSchemaId:ut,mode:xt&&ot.map($t=>$t.id).includes(Lt.id)?"designer":"viewer",onChange:$t=>{const Tt=Array.isArray($t)?$t:[$t];et(Tt.map(({key:Dt,value:Ut})=>({key:Dt,value:Ut,schemaId:Lt.id})))},stopEditing:()=>bt(!1),outline:`1px ${st===Lt.id?"solid":"dashed"} ${Lt.readOnly&&st!==Lt.id?"transparent":dt.colorPrimary}`,scale:_e},Lt.id)})]})},Canvas$1=reactExports.forwardRef(Canvas),Spinner=()=>jsxRuntimeExports.jsx(Spin$1,{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},indicator:jsxRuntimeExports.jsx(LoadingOutlined$1,{style:{fontSize:50},spin:!0})}),Spinner$1=Spinner,Root=({size:a,scale:s,children:$},_)=>{const _e=reactExports.useContext(FontContext);return reactExports.useEffect(()=>{if(!document||!document.fonts)return;const nt=Object.entries(_e).map(([at,{data:ot}])=>new FontFace(at,typeof ot=="string"?`url(${ot})`:ot,{display:"swap"})).filter(at=>!document.fonts.has(at));Promise.allSettled(nt.map(at=>at.load())).then(at=>{at.forEach(ot=>{ot.status==="fulfilled"&&document.fonts.add(ot.value)})})},[_e]),jsxRuntimeExports.jsx("div",{ref:_,style:{position:"relative",background:BACKGROUND_COLOR,...a},children:jsxRuntimeExports.jsx("div",{style:{margin:"0 auto",...a},children:s===0?jsxRuntimeExports.jsx(Spinner$1,{}):$})})},Root$1=reactExports.forwardRef(Root),ErrorScreen=({size:a,error:s})=>{const $=reactExports.useContext(I18nContext),{token:_}=theme.useToken();return jsxRuntimeExports.jsx("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",background:BACKGROUND_COLOR,...a},children:jsxRuntimeExports.jsx("div",{style:{width:300,margin:"0 auto",background:_.colorBgLayout},children:jsxRuntimeExports.jsx(Result$2,{icon:null,title:"ERROR",subTitle:$("errorOccurred"),extra:jsxRuntimeExports.jsx("span",{children:s.message})})})})},ErrorScreen$1=ErrorScreen,{Text:Text$1}=Typography$1,Zoom=({zoomLevel:a,setZoomLevel:s,style:$})=>{const nt=a-.25,at=a+.25;return jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[jsxRuntimeExports.jsx(Button$2,{type:"text",disabled:.25>=nt,onClick:()=>s(nt),icon:jsxRuntimeExports.jsx(MinusOutlined$1,{style:{color:$.textStyle.color}})}),jsxRuntimeExports.jsxs(Text$1,{strong:!0,style:$.textStyle,children:[Math.round(a*100),"%"]}),jsxRuntimeExports.jsx(Button$2,{type:"text",disabled:2<at,onClick:()=>s(at),icon:jsxRuntimeExports.jsx(PlusOutlined$4,{style:{color:$.textStyle.color}})})]})},Pager=({pageCursor:a,pageNum:s,setPageCursor:$,style:_})=>jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[jsxRuntimeExports.jsx(Button$2,{type:"text",disabled:a<=0,onClick:()=>$(a-1),children:jsxRuntimeExports.jsx(LeftOutlined$1,{style:{color:_.textStyle.color}})}),jsxRuntimeExports.jsxs(Text$1,{strong:!0,style:_.textStyle,children:[a+1,"/",s]}),jsxRuntimeExports.jsx(Button$2,{type:"text",disabled:a+1>=s,onClick:()=>$(a+1),children:jsxRuntimeExports.jsx(RightOutlined$1,{style:{color:_.textStyle.color}})})]}),ContextMenu=({items:a,style:s})=>jsxRuntimeExports.jsx(Dropdown$1,{menu:{items:a},placement:"top",arrow:!0,trigger:["click"],children:jsxRuntimeExports.jsx(Button$2,{type:"text",children:jsxRuntimeExports.jsx(EllipsisOutlined$1,{style:{color:s.textStyle.color}})})}),CtlBar=a=>{const{token:s}=theme.useToken(),$=reactExports.useContext(I18nContext),{size:_,pageCursor:_e,pageNum:tt,setPageCursor:nt,zoomLevel:at,setZoomLevel:ot,addPageAfter:rt,removePage:st}=a,lt=[];rt&&lt.push({key:"1",label:jsxRuntimeExports.jsx("div",{onClick:rt,children:$("addPageAfter")})}),st&&tt>1&&_e!==0&&lt.push({key:"2",label:jsxRuntimeExports.jsx("div",{onClick:st,children:$("removePage")})});const et=300,it=lt.length>0?50:0,ut=(tt>1?et:et/2)+it,ft={color:s.colorWhite,fontSize:s.fontSize,margin:s.marginXS};return jsxRuntimeExports.jsx("div",{style:{position:"absolute",top:"auto",bottom:"6%",width:_.width},children:jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-evenly",position:"relative",zIndex:1,left:`calc(50% - ${ut/2}px)`,width:ut,height:40,boxSizing:"border-box",padding:s.paddingSM,borderRadius:s.borderRadius,backgroundColor:s.colorBgMask},children:[tt>1&&jsxRuntimeExports.jsx(Pager,{style:{textStyle:ft},pageCursor:_e,pageNum:tt,setPageCursor:nt}),jsxRuntimeExports.jsx(Zoom,{style:{textStyle:ft},zoomLevel:at,setZoomLevel:ot}),lt.length>0&&jsxRuntimeExports.jsx(ContextMenu,{items:lt,style:{textStyle:ft}})]})})},CtlBar$1=CtlBar,scaleDragPosAdjustment=(a,s)=>s>1?a*(s-1):s<1?a*-(1-s):0,TemplateEditor=({template:a,size:s,onSaveTemplate:$,onChangeTemplate:_,onPageCursorChange:_e})=>{const tt=reactExports.useRef([]),nt=reactExports.useRef([]),at=reactExports.useRef(null),ot=reactExports.useRef([]),rt=reactExports.useContext(I18nContext),st=reactExports.useContext(PluginsRegistry),lt=reactExports.useContext(OptionsContext),[et,it]=reactExports.useState(null),[ut,ft]=reactExports.useState([]),[ht,dt]=reactExports.useState([[]]),[gt,pt]=reactExports.useState(0),[mt,ct]=reactExports.useState(1),[vt,At]=reactExports.useState(!0),[xt,bt]=reactExports.useState(null),{backgrounds:Et,pageSizes:St,scale:Bt,error:Ot,refresh:Pt}=useUIPreProcessor({template:a,size:s,zoomLevel:mt}),wt=Tt=>{ft(Tt),it(null)},Ct=()=>{ft([]),it(null)};useScrollPageCursor({ref:at,pageSizes:St,scale:Bt,pageCursor:gt,onChangePageCursor:Tt=>{pt(Tt),_e(Tt),Ct()}});const It=reactExports.useCallback(Tt=>{nt.current=[],tt.current.push(cloneDeep$1(ht[gt]));const Dt=cloneDeep$1(ht);Dt[gt]=Tt,dt(Dt),_(schemasList2template(Dt,a.basePdf))},[a,ht,gt,_]),yt=reactExports.useCallback(Tt=>{It(ht[gt].filter(Dt=>!Tt.includes(Dt.id))),Ct()},[ht,gt,It]),Rt=reactExports.useCallback(Tt=>{changeSchemas({objs:Tt,schemas:ht[gt],basePdf:a.basePdf,pluginsRegistry:st,pageSize:St[gt],commitSchemas:It})},[It,gt,ht,st,St,a.basePdf]);useInitEvents({pageCursor:gt,pageSizes:St,activeElements:ut,template:a,schemasList:ht,changeSchemas:Rt,commitSchemas:It,removeSchemas:yt,onSaveTemplate:$,past:tt,future:nt,setSchemasList:dt,onEdit:wt,onEditEnd:Ct});const kt=reactExports.useCallback(async Tt=>{var Ut;const Dt=await template2SchemasList(Tt);dt(Dt),Ct(),pt(0),(Ut=at.current)!=null&&Ut.scroll&&at.current.scroll({top:0,behavior:"smooth"})},[]),jt=Tt=>{const[Dt,Ut,Vt,Qt]=isBlankPdf(a.basePdf)?a.basePdf.padding:[0,0,0,0],qt=St[gt],Zt=rr=>{let Yt=ht.reduce((nr,tr)=>nr+tr.length,1),Kt=rr+Yt;for(;ht.some(nr=>nr.find(tr=>tr.name===Kt));)Yt++,Kt=rr+Yt;return Kt},ar=(rr,Yt,Kt)=>Math.min(Math.max(rr,Yt),Kt),Jt={id:uuid$6(),...Tt,name:Zt(rt("field")),position:{x:ar(Qt,Tt.position.x,qt.width-Ut-Tt.width),y:ar(Dt,Tt.position.y,qt.height-Vt-Tt.height)},required:Tt.readOnly?!1:lt.requiredByDefault||Tt.required||!1};if(Tt.position.y===0){const rr=ot.current[gt],Yt=rr?rr.getBoundingClientRect().top:0;Jt.position.y=Yt>0?Dt:St[gt].height/2}It(ht[gt].concat(Jt)),setTimeout(()=>wt([document.getElementById(Jt.id)]))},Ht=Tt=>{It(Tt)},Ft=Tt=>{it(Tt)},_t=async(Tt,Dt)=>{pt(Dt);const Ut=schemasList2template(Tt,a.basePdf);_(Ut),await kt(Ut),Pt(Ut),setTimeout(()=>at.current&&(at.current.scrollTop=getPagesScrollTopByIndex(St,Dt,Bt),0))},Nt=()=>{if(gt===0||!window.confirm(rt("removePageConfirm")))return;const Tt=cloneDeep$1(ht);Tt.splice(gt,1),_t(Tt,gt-1)},Mt=()=>{const Tt=cloneDeep$1(ht);Tt.splice(gt+1,0,[]),_t(Tt,gt+1)};xt!==a&&(bt(a),kt(a));const Lt={width:vt?s.width-RIGHT_SIDEBAR_WIDTH:s.width,height:s.height};if(Ot)return jsxRuntimeExports.jsx(ErrorScreen$1,{size:s,error:Ot});const $t=isBlankPdf(a.basePdf)?{addPageAfter:Mt,removePage:Nt}:{};return jsxRuntimeExports.jsx(Root$1,{size:s,scale:Bt,children:jsxRuntimeExports.jsxs(DndContext,{onDragEnd:Tt=>{var Yt,Kt;if(!Tt.active)return;const Dt=Tt.active,Ut=ot.current[gt].getBoundingClientRect(),Vt=((Yt=Dt.rect.current.initial)==null?void 0:Yt.left)||0,Qt=((Kt=Dt.rect.current.initial)==null?void 0:Kt.top)||0,qt=Ut.left-Vt+scaleDragPosAdjustment(20,Bt),Zt=Ut.top-Qt,ar=(Tt.delta.y-Zt)/Bt,Jt=(Tt.delta.x-qt)/Bt,rr={x:round(px2mm(Math.max(0,Jt)),2),y:round(px2mm(Math.max(0,ar)),2)};jt({...Dt.data.current,position:rr})},onDragStart:Ct,children:[jsxRuntimeExports.jsx(CtlBar$1,{size:Lt,pageCursor:gt,pageNum:ht.length,setPageCursor:Tt=>{at.current&&(at.current.scrollTop=getPagesScrollTopByIndex(St,Tt,Bt),pt(Tt),Ct())},zoomLevel:mt,setZoomLevel:ct,...$t}),jsxRuntimeExports.jsx(LeftSidebar$1,{height:at.current?at.current.clientHeight:0,scale:Bt,basePdf:a.basePdf}),jsxRuntimeExports.jsx(RightSidebar,{hoveringSchemaId:et,onChangeHoveringSchemaId:Ft,height:at.current?at.current.clientHeight:0,size:s,pageSize:St[gt]??[],activeElements:ut,schemasList:ht,schemas:ht[gt]??[],changeSchemas:Rt,onSortEnd:Ht,onEdit:Tt=>{const Dt=document.getElementById(Tt);Dt&&wt([Dt])},onEditEnd:Ct,deselectSchema:Ct,sidebarOpen:vt,setSidebarOpen:At}),jsxRuntimeExports.jsx(Canvas$1,{ref:at,paperRefs:ot,basePdf:a.basePdf,hoveringSchemaId:et,onChangeHoveringSchemaId:Ft,height:s.height-RULER_HEIGHT*ZOOM,pageCursor:gt,scale:Bt,size:Lt,pageSizes:St,backgrounds:Et,activeElements:ut,schemasList:ht,changeSchemas:Rt,removeSchemas:yt,sidebarOpen:vt,onEdit:wt})]})})},DesignerComponent=TemplateEditor,defaultTheme={token:{colorPrimary:"#38a0ff"},components:{Form:{fontSize:12,margin:8,marginLG:12,marginXS:4,padding:8,paddingLG:12,paddingXS:4,itemMarginBottom:4,verticalLabelPadding:"0 0 2px"}}},isObject=a=>a&&typeof a=="object"&&!Array.isArray(a),deepMerge=(a,s)=>{let $={...a};return isObject(a)&&isObject(s)&&Object.keys(s).forEach(_=>{isObject(s[_])?_ in a?$[_]=deepMerge(a[_],s[_]):Object.assign($,{[_]:s[_]}):Object.assign($,{[_]:s[_]})}),$},AppContextProvider=({children:a,lang:s,font:$,plugins:_,options:_e})=>{let tt=defaultTheme;_e.theme&&(tt=deepMerge(tt,_e.theme));let nt=getDict(s);return _e.labels&&(nt=deepMerge(nt,_e.labels)),jsxRuntimeExports.jsx(ThemeConfigProvider,{theme:tt,children:jsxRuntimeExports.jsx(I18nContext.Provider,{value:at=>i18n(at,nt),children:jsxRuntimeExports.jsx(FontContext.Provider,{value:$,children:jsxRuntimeExports.jsx(PluginsRegistry.Provider,{value:_,children:jsxRuntimeExports.jsx(OptionsContext.Provider,{value:_e,children:a})})})})})},AppContextProvider$1=AppContextProvider;class Designer extends BaseUIClass{constructor(s){super(s),this.pageCursor=0,checkDesignerProps(s)}saveTemplate(){if(!this.domContainer)throw Error(DESTROYED_ERR_MSG);this.onSaveTemplateCallback&&this.onSaveTemplateCallback(this.template)}updateTemplate(s){if(checkTemplate(s),!this.domContainer)throw Error(DESTROYED_ERR_MSG);this.template=cloneDeep$1(s),this.onChangeTemplateCallback&&this.onChangeTemplateCallback(s),this.render()}onSaveTemplate(s){this.onSaveTemplateCallback=s}onChangeTemplate(s){this.onChangeTemplateCallback=s}getPageCursor(){return this.pageCursor}render(){if(!this.domContainer)throw Error(DESTROYED_ERR_MSG);ReactDOM.render(jsxRuntimeExports.jsx(AppContextProvider$1,{lang:this.getLang(),font:this.getFont(),plugins:this.getPluginsRegistry(),options:this.getOptions(),children:jsxRuntimeExports.jsx(DesignerComponent,{template:this.template,onSaveTemplate:s=>{this.template=s,this.template.pdfmeVersion=PDFME_VERSION,this.onSaveTemplateCallback&&this.onSaveTemplateCallback(s)},onChangeTemplate:s=>{this.template=s,this.template.pdfmeVersion=PDFME_VERSION,this.onChangeTemplateCallback&&this.onChangeTemplateCallback(s)},onPageCursorChange:s=>{this.pageCursor=s},size:this.size})}),this.domContainer)}}const Designer$1=Designer,{Text}=Typography$1,icons={left:LeftOutlined$1,right:RightOutlined$1,doubleLeft:DoubleLeftOutlined$1,doubleRight:DoubleRightOutlined$1},UnitButton=({type:a,onClick:s,disabled:$,textStyle:_})=>{const _e=icons[a];return jsxRuntimeExports.jsx(Button$2,{type:"text",onClick:s,disabled:$,children:jsxRuntimeExports.jsx(_e,{style:{color:_.color}})})},UnitPager=({size:a,unitCursor:s,unitNum:$,setUnitCursor:_})=>{if($<=1)return null;const{token:_e}=theme.useToken(),tt={pointerEvents:"initial",position:"sticky",zIndex:1,display:"flex",alignItems:"center",boxSizing:"border-box",height:40,padding:_e.paddingSM,borderRadius:_e.borderRadius,backgroundColor:_e.colorBgMask},nt={color:_e.colorWhite,fontSize:_e.fontSize,margin:_e.marginXS};return jsxRuntimeExports.jsx("div",{style:{position:"absolute",...a},children:jsxRuntimeExports.jsxs("div",{style:{position:"sticky",width:"100%",zIndex:1,top:`calc(50% - ${tt.height/2}px)`,display:"flex",alignItems:"center"},children:[s>0&&jsxRuntimeExports.jsxs("div",{style:{left:"1rem",marginLeft:"1rem",...tt},children:[jsxRuntimeExports.jsx(UnitButton,{type:"doubleLeft",onClick:()=>_(0),disabled:s<=0,textStyle:nt}),jsxRuntimeExports.jsx(UnitButton,{type:"left",onClick:()=>_(s-1),disabled:s<=0,textStyle:nt}),jsxRuntimeExports.jsxs(Text,{strong:!0,style:nt,children:[s+1,"/",$]})]}),s+1<$&&jsxRuntimeExports.jsxs("div",{style:{right:"1rem",marginLeft:"auto",marginRight:"1rem",...tt},children:[jsxRuntimeExports.jsxs(Text,{strong:!0,style:nt,children:[s+1,"/",$]}),jsxRuntimeExports.jsx(UnitButton,{type:"right",onClick:()=>_(s+1),disabled:s+1>=$,textStyle:nt}),jsxRuntimeExports.jsx(UnitButton,{type:"doubleRight",onClick:()=>_($-1),disabled:s+1>=$,textStyle:nt})]})]})})},UnitPager$1=UnitPager,_cache=new Map,Preview=({template:a,inputs:s,size:$,onChangeInput:_})=>{const{token:_e}=theme.useToken(),tt=reactExports.useContext(FontContext),nt=reactExports.useRef(null),at=reactExports.useRef([]),[ot,rt]=reactExports.useState(0),[st,lt]=reactExports.useState(0),[et,it]=reactExports.useState(1),[ut,ft]=reactExports.useState([[]]),{backgrounds:ht,pageSizes:dt,scale:gt,error:pt,refresh:mt}=useUIPreProcessor({template:a,size:$,zoomLevel:et}),ct=!!_,vt=s[ot],At=bt=>{getDynamicTemplate({template:bt,input:vt,options:{font:tt},_cache,getDynamicHeights:(St,Bt)=>{switch(Bt.schema.type){case"table":return getDynamicHeightsForTable(St,Bt);default:return Promise.resolve([Bt.schema.height])}}}).then(async St=>{const Bt=await template2SchemasList(St);ft(Bt),await mt(St)}).catch(St=>console.error("[@pdfme/ui] ",St))};reactExports.useEffect(()=>{ot>s.length-1&&rt(s.length-1),At(a)},[a,s,$]),useScrollPageCursor({ref:nt,pageSizes:dt,scale:gt,pageCursor:st,onChangePageCursor:lt});const xt=({name:bt,value:Et})=>_&&_({index:ot,name:bt,value:Et});return pt?jsxRuntimeExports.jsx(ErrorScreen$1,{size:$,error:pt}):jsxRuntimeExports.jsxs(Root$1,{size:$,scale:gt,children:[jsxRuntimeExports.jsx(CtlBar$1,{size:$,pageCursor:st,pageNum:ut.length,setPageCursor:bt=>{nt.current&&(nt.current.scrollTop=getPagesScrollTopByIndex(dt,bt,gt),lt(bt))},zoomLevel:et,setZoomLevel:it}),jsxRuntimeExports.jsx(UnitPager$1,{size:$,unitCursor:ot,unitNum:s.length,setUnitCursor:rt}),jsxRuntimeExports.jsx("div",{ref:nt,style:{...$,position:"relative",overflow:"auto"},children:jsxRuntimeExports.jsx(Paper$1,{paperRefs:at,scale:gt,size:$,schemasList:ut,pageSizes:dt,backgrounds:ht,renderSchema:({schema:bt,index:Et})=>{const{name:St,readOnly:Bt}=bt,Ot=Bt?String(bt.content)||"":String(vt&&vt[St]||"");return jsxRuntimeExports.jsx(Renderer$1,{schema:bt,basePdf:a.basePdf,value:Ot,mode:ct?"form":"viewer",placeholder:bt.content,tabIndex:Et+100,onChange:Pt=>{const wt=Array.isArray(Pt)?Pt:[Pt];let Ct=!1;wt.forEach(({key:It,value:yt})=>{if(It==="content"){const Rt=yt,kt=(vt==null?void 0:vt[St])||"";if(Rt===kt)return;xt({name:St,value:Rt}),bt.type==="table"&&(Ct=!0)}else{const Rt=ut[st].find(kt=>kt.id===bt.id);if(!Rt)return;Rt[It]=yt}}),Ct&&At(a),ft([...ut])},outline:ct&&!bt.readOnly?`1px dashed ${_e.colorPrimary}`:"transparent",scale:gt},bt.id)}})})]})},Preview$1=Preview;class Form extends PreviewUI{constructor(s){super(s)}onChangeInput(s){this.onChangeInputCallback=s}setInputs(s){super.setInputs(s),s.map((_,_e)=>Object.keys(_).map(tt=>({index:_e,name:tt,value:_[tt]}))).flat().forEach(_=>{this.onChangeInputCallback&&this.onChangeInputCallback(_)})}render(){if(!this.domContainer)throw Error(DESTROYED_ERR_MSG);ReactDOM.render(jsxRuntimeExports.jsx(AppContextProvider$1,{lang:this.getLang(),font:this.getFont(),plugins:this.getPluginsRegistry(),options:this.getOptions(),children:jsxRuntimeExports.jsx(Preview$1,{template:this.template,size:this.size,inputs:this.inputs,onChangeInput:s=>{const{index:$,value:_,name:_e}=s;this.onChangeInputCallback&&this.onChangeInputCallback({index:$,value:_,name:_e}),this.inputs&&this.inputs[$]&&this.inputs[$][_e]!==_&&(this.inputs[$][_e]=_,this.render())}})}),this.domContainer)}}const Form$1=Form;class Viewer extends PreviewUI{constructor(s){super(s)}render(){if(!this.domContainer)throw Error(DESTROYED_ERR_MSG);ReactDOM.render(jsxRuntimeExports.jsx(AppContextProvider$1,{lang:this.getLang(),font:this.getFont(),plugins:this.getPluginsRegistry(),options:this.getOptions(),children:jsxRuntimeExports.jsx(Preview$1,{template:this.template,size:this.size,inputs:this.inputs})}),this.domContainer)}}const Viewer$1=Viewer;exports.Designer=Designer$1,exports.Form=Form$1,exports.Viewer=Viewer$1,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
1147
+ `),GuidesElement=defaultStyled("div",GUIDES_CSS),Guides$1=function(a){__extends(s,a);function s(){var _=a!==null&&a.apply(this,arguments)||this;return _.state={guides:[]},_.scrollPos=0,_.guideElements=[],_.onDragStart=function(_e){var tt=_e.datas,nt=_e.inputEvent,at=_.props.onDragStart;addClass(tt.target,DRAGGING),_.onDrag(_e),at(__assign({},_e,{dragElement:tt.target})),nt.stopPropagation(),nt.preventDefault()},_.onDrag=function(_e){var tt=_.movePos(_e);return _.props.onDrag(__assign({},_e,{dragElement:_e.datas.target})),tt},_.onDragEnd=function(_e){var tt=_e.datas,nt=_e.isDouble,at=_e.distX,ot=_e.distY,rt=_.movePos(_e),st=_.state.guides,lt=_.props,et=lt.onChangeGuides,it=lt.zoom,ut=lt.displayDragPos,ft=lt.digit,ht=lt.lockGuides,dt=parseFloat((rt/it).toFixed(ft||0));if(ut&&(_.displayElement.style.cssText+="display: none;"),removeClass(tt.target,DRAGGING),_.props.onDragEnd(__assign({},_e,{dragElement:tt.target})),tt.fromRuler)rt>=_.scrollPos&&st.indexOf(dt)<0&&_.setState({guides:st.concat([dt])},function(){et({guides:_.state.guides,distX:at,distY:ot,isAdd:!0,isRemove:!1,isChange:!1})});else{var gt=tt.target.getAttribute("data-index"),pt=!1,mt=!1;if(st=st.slice(),nt||dt<_.scrollPos){if(ht&&(ht===!0||ht.indexOf("remove")>-1))return;st.splice(gt,1),pt=!0}else{if(st.indexOf(dt)>-1)return;if(ht&&(ht===!0||ht.indexOf("change")>-1))return;st[gt]=dt,mt=!0}_.setState({guides:st},function(){var ct=_.state.guides;et({distX:at,distY:ot,guides:ct,isAdd:!1,isChange:mt,isRemove:pt})})}},_}var $=s.prototype;return $.render=function(){var _=this.props,_e=_.className,tt=_.type,nt=_.zoom,at=_.style,ot=_.rulerStyle,rt=_.displayDragPos,st=_.cspNonce,lt=_.dragGuideStyle,et=_.portalContainer,it=this.props,ut=this.getTranslateName(),ft={};return PROPERTIES.forEach(function(ht){ht!=="style"&&(ft[ht]=it[ht])}),reactExports.createElement(GuidesElement,{ref:ref(this,"manager"),cspNonce:st,className:prefix("manager",tt)+" "+_e,portalContainer:et,style:at},reactExports.createElement("div",{className:prefix("guide-origin"),ref:ref(this,"originElement")}),reactExports.createElement(Ruler$1,__assign({ref:ref(this,"ruler"),style:ot},ft)),reactExports.createElement("div",{className:GUIDES,ref:ref(this,"guidesElement"),style:{transform:ut+"("+-this.scrollPos*nt+"px)"}},rt&&reactExports.createElement("div",{className:DISPLAY_DRAG,ref:ref(this,"displayElement"),style:lt}),reactExports.createElement("div",{className:ADDER,ref:ref(this,"adderElement")}),this.renderGuides()))},$.renderGuides=function(){var _=this,_e=this.props,tt=_e.type,nt=_e.zoom,at=_e.showGuides,ot=_e.guideStyle,rt=this.getTranslateName(),st=this.state.guides;if(this.guideElements=[],at)return st.map(function(lt,et){return reactExports.createElement("div",{className:prefix("guide",tt),ref:refs(_,"guideElements",et),key:et,"data-index":et,"data-pos":lt,style:__assign({},ot,{transform:rt+"("+lt*nt+"px) translateZ(0px)"})})})},$.componentDidMount=function(){var _=this;this.gesto=new Gesto(this.manager.getElement(),{container:document.body}).on("dragStart",function(_e){var tt=_.props,nt=tt.type,at=tt.zoom,ot=tt.lockGuides;if(ot===!0){_e.stop();return}var rt=_e.inputEvent,st=rt.target,lt=_e.datas,et=_.ruler.canvasElement,it=_.guidesElement,ut=nt==="horizontal",ft=_.originElement.getBoundingClientRect(),ht=getDistElementMatrix(_.manager.getElement()),dt=calculateMatrixDist(ht,[_e.clientX-ft.left,_e.clientY-ft.top]);dt[0]-=it.offsetLeft,dt[1]-=it.offsetTop,dt[ut?1:0]+=_.scrollPos*at,lt.offsetPos=dt,lt.matrix=ht;var gt=ot&&ot.indexOf("add")>-1,pt=ot&&ot.indexOf("remove")>-1,mt=ot&&ot.indexOf("change")>-1;if(st===et){if(gt){_e.stop();return}lt.fromRuler=!0,lt.target=_.adderElement}else if(hasClass(st,GUIDE)){if(pt&&mt){_e.stop();return}lt.target=st}else return _e.stop(),!1;_.onDragStart(_e)}).on("drag",this.onDrag).on("dragEnd",this.onDragEnd),this.setState({guides:this.props.defaultGuides||[]})},$.componentWillUnmount=function(){this.gesto.unset()},$.componentDidUpdate=function(_){_.defaultGuides!==this.props.defaultGuides&&this.setState({guides:this.props.defaultGuides||[]})},$.loadGuides=function(_){this.setState({guides:_})},$.getGuides=function(){return this.state.guides},$.scrollGuides=function(_){var _e=this.props.zoom,tt=this.guidesElement;this.scrollPos=_,tt.style.transform=this.getTranslateName()+"("+-_*_e+"px)";var nt=this.state.guides;this.guideElements.forEach(function(at,ot){at&&(at.style.display=-_+nt[ot]<0?"none":"block")})},$.resize=function(){this.ruler.resize()},$.scroll=function(_){this.ruler.scroll(_)},$.movePos=function(_){var _e=_.datas,tt=_.distX,nt=_.distY,at=this.props,ot=at.type,rt=at.zoom,st=at.snaps,lt=at.snapThreshold,et=at.displayDragPos,it=at.digit,ut=at.dragPosFormat||function(xt){return xt},ft=ot==="horizontal",ht=calculateMatrixDist(_e.matrix,[tt,nt]),dt=_e.offsetPos,gt=ht[0]+dt[0],pt=ht[1]+dt[1],mt=Math.round(ft?pt:gt),ct=parseFloat((mt/rt).toFixed(it||0)),vt=st.slice().sort(function(xt,bt){return Math.abs(ct-xt)-Math.abs(ct-bt)});if(vt.length&&Math.abs(vt[0]*rt-mt)<lt&&(ct=vt[0],mt=ct*rt),et){var At=ot==="horizontal"?[gt,mt]:[mt,pt];this.displayElement.style.cssText+="display: block;transform: translate(-50%, -50%) "+("translate("+At.map(function(xt){return xt+"px"}).join(", ")+")"),this.displayElement.innerHTML=""+ut(ct)}return _e.target.setAttribute("data-pos",ct),_e.target.style.transform=this.getTranslateName()+"("+mt+"px)",mt},$.getTranslateName=function(){return this.props.type==="horizontal"?"translateY":"translateX"},s.defaultProps={className:"",type:"horizontal",zoom:1,style:{},snapThreshold:5,snaps:[],digit:0,onChangeGuides:function(){},onDragStart:function(){},onDrag:function(){},onDragEnd:function(){},displayDragPos:!1,dragPosFormat:function(_){return _},defaultGuides:[],lockGuides:!1,showGuides:!0,guideStyle:{},dragGuideStyle:{},portalContainer:null},s}(reactExports.PureComponent);const Guides$2=Guides$1,guideStyle=(a,s,$,_)=>({position:"absolute",top:a,left:s,height:$,width:_,background:"#333333"}),_Guides=({paperSize:a,horizontalRef:s,verticalRef:$})=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"ruler-container",style:guideStyle(-RULER_HEIGHT,-RULER_HEIGHT,RULER_HEIGHT,RULER_HEIGHT)}),jsxRuntimeExports.jsx(Guides$2,{zoom:ZOOM,style:guideStyle(-RULER_HEIGHT,0,RULER_HEIGHT,a.width),type:"horizontal",ref:s}),jsxRuntimeExports.jsx(Guides$2,{zoom:ZOOM,style:guideStyle(0,-RULER_HEIGHT,a.height,RULER_HEIGHT),type:"vertical",ref:$})]}),Guides=_Guides,Mask=({width:a,height:s})=>jsxRuntimeExports.jsx("div",{style:{position:"absolute",top:-RULER_HEIGHT,left:-RULER_HEIGHT,zIndex:100,width:a,height:s,background:theme.useToken().token.colorBgMask}}),Mask$1=Mask,getPaddingStyle=(a,s,$)=>{const _={position:"absolute",background:$,opacity:.25,pointerEvents:"none"};switch(a){case 0:_.top=0,_.height=`${s*ZOOM}px`,_.left=0,_.right=0;break;case 1:_.right=0,_.width=`${s*ZOOM}px`,_.top=0,_.bottom=0;break;case 2:_.bottom=0,_.height=`${s*ZOOM}px`,_.left=0,_.right=0;break;case 3:_.left=0,_.width=`${s*ZOOM}px`,_.top=0,_.bottom=0;break}return _},Padding=({basePdf:a})=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:isBlankPdf(a)&&a.padding.map((s,$)=>jsxRuntimeExports.jsx("div",{style:getPaddingStyle($,s,theme.useToken().token.colorError)},String($)))}),Padding$1=Padding,mm2px=a=>a*3.7795275591,DELETE_BTN_ID=uuid$6(),fmt4Num=a=>Number(a.replace("px","")),fmt=a=>round(fmt4Num(a)/ZOOM,2),isTopLeftResize=a=>a==="-1,-1"||a==="-1,0"||a==="0,-1",normalizeRotate=a=>(a%360+360)%360,DeleteButton=({activeElements:a})=>{const{token:s}=theme.useToken(),$=26,_=Math.min(...a.map(({style:tt})=>fmt4Num(tt.top))),_e=Math.max(...a.map(({style:tt})=>fmt4Num(tt.left)+fmt4Num(tt.width)))+10;return jsxRuntimeExports.jsx(Button$2,{id:DELETE_BTN_ID,style:{position:"absolute",zIndex:1,top:_,left:_e,width:$,height:$,padding:2,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:s.borderRadius,color:s.colorWhite,background:s.colorPrimary},children:jsxRuntimeExports.jsx(CloseOutlined$4,{style:{pointerEvents:"none"}})})},Canvas=(a,s)=>{const{basePdf:$,pageCursor:_,scale:_e,backgrounds:tt,pageSizes:nt,size:at,activeElements:ot,schemasList:rt,hoveringSchemaId:st,onEdit:lt,changeSchemas:et,removeSchemas:it,onChangeHoveringSchemaId:ut,paperRefs:ft,sidebarOpen:ht}=a,{token:dt}=theme.useToken(),gt=reactExports.useContext(PluginsRegistry),pt=reactExports.useRef([]),mt=reactExports.useRef([]),ct=reactExports.useRef(null),[vt,At]=reactExports.useState(!1),[xt,bt]=reactExports.useState(!1),Et=usePrevious(rt[_]),St=Lt=>{Lt.shiftKey&&At(!0)},Bt=Lt=>{(Lt.key==="Shift"||!Lt.shiftKey)&&At(!1),(Lt.key==="Escape"||Lt.key==="Esc")&&bt(!1)},Ot=reactExports.useCallback(()=>{window.addEventListener("keydown",St),window.addEventListener("keyup",Bt)},[]),Pt=reactExports.useCallback(()=>{window.removeEventListener("keydown",St),window.removeEventListener("keyup",Bt)},[]);reactExports.useEffect(()=>(Ot(),Pt),[Ot,Pt]),reactExports.useEffect(()=>{var Tt,Dt;if((Tt=ct.current)==null||Tt.updateRect(),!Et)return;const Lt=JSON.stringify(Et[_]||{}),$t=JSON.stringify(rt[_]||{});Lt===$t&&((Dt=ct.current)==null||Dt.updateRect())},[_,rt,Et]);const wt=({target:Lt,top:$t,left:Tt})=>{const{width:Dt,height:Ut}=Lt.style,Vt=fmt(Dt),Qt=fmt(Ut),qt=$t/ZOOM,Zt=Tt/ZOOM,{width:ar,height:Jt}=nt[_];let rr=0,Yt=0,Kt=0,nr=0;if(isBlankPdf($)){const[tr,ir,sr,cr]=$.padding;rr=tr*ZOOM,Yt=ir,Kt=sr,nr=cr*ZOOM}qt+Qt>Jt-Kt?Lt.style.top=`${(Jt-Qt-Kt)*ZOOM}px`:Lt.style.top=`${$t<rr?rr:$t}px`,Zt+Vt>ar-Yt?Lt.style.left=`${(ar-Vt-Yt)*ZOOM}px`:Lt.style.left=`${Tt<nr?nr:Tt}px`},Ct=({target:Lt})=>{const{top:$t,left:Tt}=Lt.style;et([{key:"position.y",value:fmt($t),schemaId:Lt.id},{key:"position.x",value:fmt(Tt),schemaId:Lt.id}])},It=({targets:Lt})=>{const $t=Lt.map(({style:{top:Tt,left:Dt},id:Ut})=>[{key:"position.y",value:fmt(Tt),schemaId:Ut},{key:"position.x",value:fmt(Dt),schemaId:Ut}]);et(flatten($t))},yt=({target:Lt,rotate:$t})=>{Lt.style.transform=`rotate(${$t}deg)`},Rt=({target:Lt})=>{const{transform:$t}=Lt.style,Tt=Number($t.replace("rotate(","").replace("deg)","")),Dt=normalizeRotate(Tt);et([{key:"rotate",value:Dt,schemaId:Lt.id}])},kt=({targets:Lt})=>{const $t=Lt.map(({style:{transform:Tt},id:Dt})=>{const Ut=Number(Tt.replace("rotate(","").replace("deg)",""));return[{key:"rotate",value:normalizeRotate(Ut),schemaId:Dt}]});et(flatten($t))},jt=({target:Lt})=>{const{id:$t,style:Tt}=Lt,{width:Dt,height:Ut,top:Vt,left:Qt}=Tt;et([{key:"position.x",value:fmt(Qt),schemaId:$t},{key:"position.y",value:fmt(Vt),schemaId:$t},{key:"width",value:fmt(Dt),schemaId:$t},{key:"height",value:fmt(Ut),schemaId:$t}]);const qt=rt[_].find(Zt=>Zt.id===$t);qt&&(qt.position.x=fmt(Qt),qt.position.y=fmt(Vt),qt.width=fmt(Dt),qt.height=fmt(Ut))},Ht=({targets:Lt})=>{const $t=Lt.map(({style:{width:Tt,height:Dt,top:Ut,left:Vt},id:Qt})=>[{key:"width",value:fmt(Tt),schemaId:Qt},{key:"height",value:fmt(Dt),schemaId:Qt},{key:"position.y",value:fmt(Ut),schemaId:Qt},{key:"position.x",value:fmt(Vt),schemaId:Qt}]);et(flatten($t))},Ft=({target:Lt,width:$t,height:Tt,direction:Dt})=>{if(!Lt)return;let Ut=0,Vt=0,Qt=0,qt=0;if(isBlankPdf($)){const[tr,ir,sr,cr]=$.padding;Ut=tr*ZOOM,Vt=mm2px(ir),Qt=mm2px(sr),qt=cr*ZOOM}const Zt=mm2px(nt[_].width),ar=mm2px(nt[_].height),Jt={width:`${$t}px`,height:`${Tt}px`},rr=Lt.style;let Yt=fmt4Num(rr.left)+(fmt4Num(rr.width)-$t),Kt=fmt4Num(rr.top)+(fmt4Num(rr.height)-Tt);Yt<qt&&(Yt=qt),Kt<Ut&&(Kt=Ut),Yt+$t>Zt-Vt&&(Jt.width=`${Zt-Vt-Yt}px`),Kt+Tt>ar-Qt&&(Jt.height=`${ar-Qt-Kt}px`);const nr=Dt.toString();isTopLeftResize(nr)?(Jt.top=`${Kt}px`,Jt.left=`${Yt}px`):nr==="1,-1"?Jt.top=`${Kt}px`:nr==="-1,1"&&(Jt.left=`${Yt}px`),Object.assign(rr,Jt)},_t=(Lt,$t)=>Lt[$t]&&Lt[$t].getGuides().map(Tt=>Tt*ZOOM),Nt=Lt=>{Lt.inputEvent.stopPropagation(),bt(!0)},Mt=reactExports.useMemo(()=>{const $t=(rt[_]||[]).filter(Ut=>ot.map(Vt=>Vt.id).includes(Ut.id)).map(Ut=>Ut.type),Tt=[...new Set($t)],Dt=Object.values(gt).map(Ut=>Ut==null?void 0:Ut.propPanel.defaultSchema);return Tt.every(Ut=>{var Vt;return((Vt=Dt.find(Qt=>Qt.type===Ut))==null?void 0:Vt.rotate)!==void 0})},[ot,_,rt,gt]);return jsxRuntimeExports.jsxs("div",{style:{position:"relative",overflow:"auto",marginRight:ht?RIGHT_SIDEBAR_WIDTH:0,...at},ref:s,children:[jsxRuntimeExports.jsx(Selecto,{container:ft.current[_],continueSelect:vt,onDragStart:Lt=>{var Dt,Ut;const{inputEvent:$t}=Lt,Tt=(Dt=ct.current)==null?void 0:Dt.isMoveableElement($t.target);($t.type==="touchstart"&&Lt.isTrusted||Tt)&&Lt.stop(),ft.current[_]===$t.target&&lt([]),((Ut=$t.target)==null?void 0:Ut.id)===DELETE_BTN_ID&&it(ot.map(Vt=>Vt.id))},onSelect:({added:Lt,removed:$t,selected:Tt,inputEvent:Dt})=>{const Ut=Dt.type==="mousedown";let Vt=Ut?Tt:[];!Ut&&Lt.length>0&&(Vt=ot.concat(Lt)),!Ut&&$t.length>0&&(Vt=ot.filter(Qt=>!$t.includes(Qt))),lt(Vt),Vt!=ot&&bt(!1),Dt.shiftKey||At(!1)}}),jsxRuntimeExports.jsx(Paper$1,{paperRefs:ft,scale:_e,size:at,schemasList:rt,pageSizes:nt,backgrounds:tt,hasRulers:!0,renderPaper:({index:Lt,paperSize:$t})=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!xt&&ot.length>0&&_===Lt&&jsxRuntimeExports.jsx(DeleteButton,{activeElements:ot}),jsxRuntimeExports.jsx(Padding$1,{basePdf:$}),jsxRuntimeExports.jsx(Guides,{paperSize:$t,horizontalRef:Tt=>{Tt&&(mt.current[Lt]=Tt)},verticalRef:Tt=>{Tt&&(pt.current[Lt]=Tt)}}),_!==Lt?jsxRuntimeExports.jsx(Mask$1,{width:$t.width+RULER_HEIGHT,height:$t.height+RULER_HEIGHT}):!xt&&jsxRuntimeExports.jsx(Moveable,{ref:ct,target:ot,bounds:{left:0,top:0,bottom:$t.height,right:$t.width},horizontalGuidelines:_t(mt.current,Lt),verticalGuidelines:_t(pt.current,Lt),keepRatio:vt,rotatable:Mt,onDrag:wt,onDragEnd:Ct,onDragGroupEnd:It,onRotate:yt,onRotateEnd:Rt,onRotateGroupEnd:kt,onResize:Ft,onResizeEnd:jt,onResizeGroupEnd:Ht,onClick:Nt})]}),renderSchema:({schema:Lt})=>jsxRuntimeExports.jsx(Renderer$1,{schema:Lt,basePdf:$,value:Lt.content||"",onChangeHoveringSchemaId:ut,mode:xt&&ot.map($t=>$t.id).includes(Lt.id)?"designer":"viewer",onChange:$t=>{const Tt=Array.isArray($t)?$t:[$t];et(Tt.map(({key:Dt,value:Ut})=>({key:Dt,value:Ut,schemaId:Lt.id})))},stopEditing:()=>bt(!1),outline:`1px ${st===Lt.id?"solid":"dashed"} ${Lt.readOnly&&st!==Lt.id?"transparent":dt.colorPrimary}`,scale:_e},Lt.id)})]})},Canvas$1=reactExports.forwardRef(Canvas),Spinner=()=>jsxRuntimeExports.jsx(Spin$1,{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},indicator:jsxRuntimeExports.jsx(LoadingOutlined$1,{style:{fontSize:50},spin:!0})}),Spinner$1=Spinner,Root=({size:a,scale:s,children:$},_)=>{const _e=reactExports.useContext(FontContext);return reactExports.useEffect(()=>{if(!document||!document.fonts)return;const nt=Object.entries(_e).map(([at,{data:ot}])=>new FontFace(at,typeof ot=="string"?`url(${ot})`:ot,{display:"swap"})).filter(at=>!document.fonts.has(at));Promise.allSettled(nt.map(at=>at.load())).then(at=>{at.forEach(ot=>{ot.status==="fulfilled"&&document.fonts.add(ot.value)})})},[_e]),jsxRuntimeExports.jsx("div",{ref:_,style:{position:"relative",background:BACKGROUND_COLOR,...a},children:jsxRuntimeExports.jsx("div",{style:{margin:"0 auto",...a},children:s===0?jsxRuntimeExports.jsx(Spinner$1,{}):$})})},Root$1=reactExports.forwardRef(Root),ErrorScreen=({size:a,error:s})=>{const $=reactExports.useContext(I18nContext),{token:_}=theme.useToken();return jsxRuntimeExports.jsx("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",background:BACKGROUND_COLOR,...a},children:jsxRuntimeExports.jsx("div",{style:{width:300,margin:"0 auto",background:_.colorBgLayout},children:jsxRuntimeExports.jsx(Result$2,{icon:null,title:"ERROR",subTitle:$("errorOccurred"),extra:jsxRuntimeExports.jsx("span",{children:s.message})})})})},ErrorScreen$1=ErrorScreen,{Text:Text$1}=Typography$1,Zoom=({zoomLevel:a,setZoomLevel:s,style:$})=>{const nt=a-.25,at=a+.25;return jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[jsxRuntimeExports.jsx(Button$2,{type:"text",disabled:.25>=nt,onClick:()=>s(nt),icon:jsxRuntimeExports.jsx(MinusOutlined$1,{style:{color:$.textStyle.color}})}),jsxRuntimeExports.jsxs(Text$1,{strong:!0,style:$.textStyle,children:[Math.round(a*100),"%"]}),jsxRuntimeExports.jsx(Button$2,{type:"text",disabled:2<at,onClick:()=>s(at),icon:jsxRuntimeExports.jsx(PlusOutlined$4,{style:{color:$.textStyle.color}})})]})},Pager=({pageCursor:a,pageNum:s,setPageCursor:$,style:_})=>jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[jsxRuntimeExports.jsx(Button$2,{type:"text",disabled:a<=0,onClick:()=>$(a-1),children:jsxRuntimeExports.jsx(LeftOutlined$1,{style:{color:_.textStyle.color}})}),jsxRuntimeExports.jsxs(Text$1,{strong:!0,style:_.textStyle,children:[a+1,"/",s]}),jsxRuntimeExports.jsx(Button$2,{type:"text",disabled:a+1>=s,onClick:()=>$(a+1),children:jsxRuntimeExports.jsx(RightOutlined$1,{style:{color:_.textStyle.color}})})]}),ContextMenu=({items:a,style:s})=>jsxRuntimeExports.jsx(Dropdown$1,{menu:{items:a},placement:"top",arrow:!0,trigger:["click"],children:jsxRuntimeExports.jsx(Button$2,{type:"text",children:jsxRuntimeExports.jsx(EllipsisOutlined$1,{style:{color:s.textStyle.color}})})}),CtlBar=a=>{const{token:s}=theme.useToken(),$=reactExports.useContext(I18nContext),{size:_,pageCursor:_e,pageNum:tt,setPageCursor:nt,zoomLevel:at,setZoomLevel:ot,addPageAfter:rt,removePage:st}=a,lt=[];rt&&lt.push({key:"1",label:jsxRuntimeExports.jsx("div",{onClick:rt,children:$("addPageAfter")})}),st&&tt>1&&_e!==0&&lt.push({key:"2",label:jsxRuntimeExports.jsx("div",{onClick:st,children:$("removePage")})});const et=300,it=lt.length>0?50:0,ut=(tt>1?et:et/2)+it,ft={color:s.colorWhite,fontSize:s.fontSize,margin:s.marginXS};return jsxRuntimeExports.jsx("div",{style:{position:"absolute",top:"auto",bottom:"6%",width:_.width},children:jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-evenly",position:"relative",zIndex:1,left:`calc(50% - ${ut/2}px)`,width:ut,height:40,boxSizing:"border-box",padding:s.paddingSM,borderRadius:s.borderRadius,backgroundColor:s.colorBgMask},children:[tt>1&&jsxRuntimeExports.jsx(Pager,{style:{textStyle:ft},pageCursor:_e,pageNum:tt,setPageCursor:nt}),jsxRuntimeExports.jsx(Zoom,{style:{textStyle:ft},zoomLevel:at,setZoomLevel:ot}),lt.length>0&&jsxRuntimeExports.jsx(ContextMenu,{items:lt,style:{textStyle:ft}})]})})},CtlBar$1=CtlBar,scaleDragPosAdjustment=(a,s)=>s>1?a*(s-1):s<1?a*-(1-s):0,TemplateEditor=({template:a,size:s,onSaveTemplate:$,onChangeTemplate:_,onPageCursorChange:_e})=>{const tt=reactExports.useRef([]),nt=reactExports.useRef([]),at=reactExports.useRef(null),ot=reactExports.useRef([]),rt=reactExports.useContext(I18nContext),st=reactExports.useContext(PluginsRegistry),lt=reactExports.useContext(OptionsContext),[et,it]=reactExports.useState(null),[ut,ft]=reactExports.useState([]),[ht,dt]=reactExports.useState([[]]),[gt,pt]=reactExports.useState(0),[mt,ct]=reactExports.useState(1),[vt,At]=reactExports.useState(!0),[xt,bt]=reactExports.useState(null),{backgrounds:Et,pageSizes:St,scale:Bt,error:Ot,refresh:Pt}=useUIPreProcessor({template:a,size:s,zoomLevel:mt}),wt=Tt=>{ft(Tt),it(null)},Ct=()=>{ft([]),it(null)};useScrollPageCursor({ref:at,pageSizes:St,scale:Bt,pageCursor:gt,onChangePageCursor:Tt=>{pt(Tt),_e(Tt),Ct()}});const It=reactExports.useCallback(Tt=>{nt.current=[],tt.current.push(cloneDeep$1(ht[gt]));const Dt=cloneDeep$1(ht);Dt[gt]=Tt,dt(Dt),_(schemasList2template(Dt,a.basePdf))},[a,ht,gt,_]),yt=reactExports.useCallback(Tt=>{It(ht[gt].filter(Dt=>!Tt.includes(Dt.id))),Ct()},[ht,gt,It]),Rt=reactExports.useCallback(Tt=>{changeSchemas({objs:Tt,schemas:ht[gt],basePdf:a.basePdf,pluginsRegistry:st,pageSize:St[gt],commitSchemas:It})},[It,gt,ht,st,St,a.basePdf]);useInitEvents({pageCursor:gt,pageSizes:St,activeElements:ut,template:a,schemasList:ht,changeSchemas:Rt,commitSchemas:It,removeSchemas:yt,onSaveTemplate:$,past:tt,future:nt,setSchemasList:dt,onEdit:wt,onEditEnd:Ct});const kt=reactExports.useCallback(async Tt=>{var Ut;const Dt=await template2SchemasList(Tt);dt(Dt),Ct(),pt(0),(Ut=at.current)!=null&&Ut.scroll&&at.current.scroll({top:0,behavior:"smooth"})},[]),jt=Tt=>{const[Dt,Ut,Vt,Qt]=isBlankPdf(a.basePdf)?a.basePdf.padding:[0,0,0,0],qt=St[gt],Zt=rr=>{let Yt=ht.reduce((nr,tr)=>nr+tr.length,1),Kt=rr+Yt;for(;ht.some(nr=>nr.find(tr=>tr.name===Kt));)Yt++,Kt=rr+Yt;return Kt},ar=(rr,Yt,Kt)=>Math.min(Math.max(rr,Yt),Kt),Jt={id:uuid$6(),...Tt,name:Zt(rt("field")),position:{x:ar(Qt,Tt.position.x,qt.width-Ut-Tt.width),y:ar(Dt,Tt.position.y,qt.height-Vt-Tt.height)},required:Tt.readOnly?!1:lt.requiredByDefault||Tt.required||!1};if(Tt.position.y===0){const rr=ot.current[gt],Yt=rr?rr.getBoundingClientRect().top:0;Jt.position.y=Yt>0?Dt:St[gt].height/2}It(ht[gt].concat(Jt)),setTimeout(()=>wt([document.getElementById(Jt.id)]))},Ht=Tt=>{It(Tt)},Ft=Tt=>{it(Tt)},_t=async(Tt,Dt)=>{pt(Dt);const Ut=schemasList2template(Tt,a.basePdf);_(Ut),await kt(Ut),Pt(Ut),setTimeout(()=>at.current&&(at.current.scrollTop=getPagesScrollTopByIndex(St,Dt,Bt),0))},Nt=()=>{if(gt===0||!window.confirm(rt("removePageConfirm")))return;const Tt=cloneDeep$1(ht);Tt.splice(gt,1),_t(Tt,gt-1)},Mt=()=>{const Tt=cloneDeep$1(ht);Tt.splice(gt+1,0,[]),_t(Tt,gt+1)};xt!==a&&(bt(a),kt(a));const Lt={width:vt?s.width-RIGHT_SIDEBAR_WIDTH:s.width,height:s.height};if(Ot)return jsxRuntimeExports.jsx(ErrorScreen$1,{size:s,error:Ot});const $t=isBlankPdf(a.basePdf)?{addPageAfter:Mt,removePage:Nt}:{};return jsxRuntimeExports.jsx(Root$1,{size:s,scale:Bt,children:jsxRuntimeExports.jsxs(DndContext,{onDragEnd:Tt=>{var Yt,Kt;if(!Tt.active)return;const Dt=Tt.active,Ut=ot.current[gt].getBoundingClientRect(),Vt=((Yt=Dt.rect.current.initial)==null?void 0:Yt.left)||0,Qt=((Kt=Dt.rect.current.initial)==null?void 0:Kt.top)||0,qt=Ut.left-Vt+scaleDragPosAdjustment(20,Bt),Zt=Ut.top-Qt,ar=(Tt.delta.y-Zt)/Bt,Jt=(Tt.delta.x-qt)/Bt,rr={x:round(px2mm(Math.max(0,Jt)),2),y:round(px2mm(Math.max(0,ar)),2)};jt({...Dt.data.current,position:rr})},onDragStart:Ct,children:[jsxRuntimeExports.jsx(CtlBar$1,{size:Lt,pageCursor:gt,pageNum:ht.length,setPageCursor:Tt=>{at.current&&(at.current.scrollTop=getPagesScrollTopByIndex(St,Tt,Bt),pt(Tt),Ct())},zoomLevel:mt,setZoomLevel:ct,...$t}),jsxRuntimeExports.jsx(LeftSidebar$1,{height:at.current?at.current.clientHeight:0,scale:Bt,basePdf:a.basePdf}),jsxRuntimeExports.jsx(RightSidebar,{hoveringSchemaId:et,onChangeHoveringSchemaId:Ft,height:at.current?at.current.clientHeight:0,size:s,pageSize:St[gt]??[],activeElements:ut,schemasList:ht,schemas:ht[gt]??[],changeSchemas:Rt,onSortEnd:Ht,onEdit:Tt=>{const Dt=document.getElementById(Tt);Dt&&wt([Dt])},onEditEnd:Ct,deselectSchema:Ct,sidebarOpen:vt,setSidebarOpen:At}),jsxRuntimeExports.jsx(Canvas$1,{ref:at,paperRefs:ot,basePdf:a.basePdf,hoveringSchemaId:et,onChangeHoveringSchemaId:Ft,height:s.height-RULER_HEIGHT*ZOOM,pageCursor:gt,scale:Bt,size:Lt,pageSizes:St,backgrounds:Et,activeElements:ut,schemasList:ht,changeSchemas:Rt,removeSchemas:yt,sidebarOpen:vt,onEdit:wt})]})})},DesignerComponent=TemplateEditor,defaultTheme={token:{colorPrimary:"#38a0ff"},components:{Form:{fontSize:12,margin:8,marginLG:12,marginXS:4,padding:8,paddingLG:12,paddingXS:4,itemMarginBottom:4,verticalLabelPadding:"0 0 2px"}}},isObject=a=>a&&typeof a=="object"&&!Array.isArray(a),deepMerge=(a,s)=>{let $={...a};return isObject(a)&&isObject(s)&&Object.keys(s).forEach(_=>{isObject(s[_])?_ in a?$[_]=deepMerge(a[_],s[_]):Object.assign($,{[_]:s[_]}):Object.assign($,{[_]:s[_]})}),$},AppContextProvider=({children:a,lang:s,font:$,plugins:_,options:_e})=>{let tt=defaultTheme;_e.theme&&(tt=deepMerge(tt,_e.theme));let nt=getDict(s);return _e.labels&&(nt=deepMerge(nt,_e.labels)),jsxRuntimeExports.jsx(ThemeConfigProvider,{theme:tt,children:jsxRuntimeExports.jsx(I18nContext.Provider,{value:at=>i18n(at,nt),children:jsxRuntimeExports.jsx(FontContext.Provider,{value:$,children:jsxRuntimeExports.jsx(PluginsRegistry.Provider,{value:_,children:jsxRuntimeExports.jsx(OptionsContext.Provider,{value:_e,children:a})})})})})},AppContextProvider$1=AppContextProvider;class Designer extends BaseUIClass{constructor(s){super(s),this.pageCursor=0,checkDesignerProps(s)}saveTemplate(){if(!this.domContainer)throw Error(DESTROYED_ERR_MSG);this.onSaveTemplateCallback&&this.onSaveTemplateCallback(this.template)}updateTemplate(s){if(checkTemplate(s),!this.domContainer)throw Error(DESTROYED_ERR_MSG);this.template=cloneDeep$1(s),this.onChangeTemplateCallback&&this.onChangeTemplateCallback(s),this.render()}onSaveTemplate(s){this.onSaveTemplateCallback=s}onChangeTemplate(s){this.onChangeTemplateCallback=s}getPageCursor(){return this.pageCursor}render(){if(!this.domContainer)throw Error(DESTROYED_ERR_MSG);ReactDOM.render(jsxRuntimeExports.jsx(AppContextProvider$1,{lang:this.getLang(),font:this.getFont(),plugins:this.getPluginsRegistry(),options:this.getOptions(),children:jsxRuntimeExports.jsx(DesignerComponent,{template:this.template,onSaveTemplate:s=>{this.template=s,this.template.pdfmeVersion=PDFME_VERSION,this.onSaveTemplateCallback&&this.onSaveTemplateCallback(s)},onChangeTemplate:s=>{this.template=s,this.template.pdfmeVersion=PDFME_VERSION,this.onChangeTemplateCallback&&this.onChangeTemplateCallback(s)},onPageCursorChange:s=>{this.pageCursor=s},size:this.size})}),this.domContainer)}}const Designer$1=Designer,{Text}=Typography$1,icons={left:LeftOutlined$1,right:RightOutlined$1,doubleLeft:DoubleLeftOutlined$1,doubleRight:DoubleRightOutlined$1},UnitButton=({type:a,onClick:s,disabled:$,textStyle:_})=>{const _e=icons[a];return jsxRuntimeExports.jsx(Button$2,{type:"text",onClick:s,disabled:$,children:jsxRuntimeExports.jsx(_e,{style:{color:_.color}})})},UnitPager=({size:a,unitCursor:s,unitNum:$,setUnitCursor:_})=>{if($<=1)return null;const{token:_e}=theme.useToken(),tt={pointerEvents:"initial",position:"sticky",zIndex:1,display:"flex",alignItems:"center",boxSizing:"border-box",height:40,padding:_e.paddingSM,borderRadius:_e.borderRadius,backgroundColor:_e.colorBgMask},nt={color:_e.colorWhite,fontSize:_e.fontSize,margin:_e.marginXS};return jsxRuntimeExports.jsx("div",{style:{position:"absolute",...a},children:jsxRuntimeExports.jsxs("div",{style:{position:"sticky",width:"100%",zIndex:1,top:`calc(50% - ${tt.height/2}px)`,display:"flex",alignItems:"center"},children:[s>0&&jsxRuntimeExports.jsxs("div",{style:{left:"1rem",marginLeft:"1rem",...tt},children:[jsxRuntimeExports.jsx(UnitButton,{type:"doubleLeft",onClick:()=>_(0),disabled:s<=0,textStyle:nt}),jsxRuntimeExports.jsx(UnitButton,{type:"left",onClick:()=>_(s-1),disabled:s<=0,textStyle:nt}),jsxRuntimeExports.jsxs(Text,{strong:!0,style:nt,children:[s+1,"/",$]})]}),s+1<$&&jsxRuntimeExports.jsxs("div",{style:{right:"1rem",marginLeft:"auto",marginRight:"1rem",...tt},children:[jsxRuntimeExports.jsxs(Text,{strong:!0,style:nt,children:[s+1,"/",$]}),jsxRuntimeExports.jsx(UnitButton,{type:"right",onClick:()=>_(s+1),disabled:s+1>=$,textStyle:nt}),jsxRuntimeExports.jsx(UnitButton,{type:"doubleRight",onClick:()=>_($-1),disabled:s+1>=$,textStyle:nt})]})]})})},UnitPager$1=UnitPager,_cache=new Map,Preview=({template:a,inputs:s,size:$,onChangeInput:_})=>{const{token:_e}=theme.useToken(),tt=reactExports.useContext(FontContext),nt=reactExports.useRef(null),at=reactExports.useRef([]),[ot,rt]=reactExports.useState(0),[st,lt]=reactExports.useState(0),[et,it]=reactExports.useState(1),[ut,ft]=reactExports.useState([[]]),{backgrounds:ht,pageSizes:dt,scale:gt,error:pt,refresh:mt}=useUIPreProcessor({template:a,size:$,zoomLevel:et}),ct=!!_,vt=s[ot],At=bt=>{getDynamicTemplate({template:bt,input:vt,options:{font:tt},_cache,getDynamicHeights:(St,Bt)=>{switch(Bt.schema.type){case"table":return getDynamicHeightsForTable(St,Bt);default:return Promise.resolve([Bt.schema.height])}}}).then(async St=>{const Bt=await template2SchemasList(St);ft(Bt),await mt(St)}).catch(St=>console.error("[@pdfme/ui] ",St))};reactExports.useEffect(()=>{ot>s.length-1&&rt(s.length-1),At(a)},[a,s,$]),useScrollPageCursor({ref:nt,pageSizes:dt,scale:gt,pageCursor:st,onChangePageCursor:lt});const xt=({name:bt,value:Et})=>_&&_({index:ot,name:bt,value:Et});return pt?jsxRuntimeExports.jsx(ErrorScreen$1,{size:$,error:pt}):jsxRuntimeExports.jsxs(Root$1,{size:$,scale:gt,children:[jsxRuntimeExports.jsx(CtlBar$1,{size:$,pageCursor:st,pageNum:ut.length,setPageCursor:bt=>{nt.current&&(nt.current.scrollTop=getPagesScrollTopByIndex(dt,bt,gt),lt(bt))},zoomLevel:et,setZoomLevel:it}),jsxRuntimeExports.jsx(UnitPager$1,{size:$,unitCursor:ot,unitNum:s.length,setUnitCursor:rt}),jsxRuntimeExports.jsx("div",{ref:nt,style:{...$,position:"relative",overflow:"auto"},children:jsxRuntimeExports.jsx(Paper$1,{paperRefs:at,scale:gt,size:$,schemasList:ut,pageSizes:dt,backgrounds:ht,renderSchema:({schema:bt,index:Et})=>{const{name:St,readOnly:Bt}=bt,Ot=Bt?String(bt.content)||"":String(vt&&vt[St]||"");return jsxRuntimeExports.jsx(Renderer$1,{schema:bt,basePdf:a.basePdf,value:Ot,mode:ct?"form":"viewer",placeholder:bt.content,tabIndex:Et+100,onChange:Pt=>{const wt=Array.isArray(Pt)?Pt:[Pt];let Ct=!1;wt.forEach(({key:It,value:yt})=>{if(It==="content"){const Rt=yt,kt=(vt==null?void 0:vt[St])||"";if(Rt===kt)return;xt({name:St,value:Rt}),bt.type==="table"&&(Ct=!0)}else{const Rt=ut[st].find(kt=>kt.id===bt.id);if(!Rt)return;Rt[It]=yt}}),Ct&&At(a),ft([...ut])},outline:ct&&!bt.readOnly?`1px dashed ${_e.colorPrimary}`:"transparent",scale:gt},bt.id)}})})]})},Preview$1=Preview;class Form extends PreviewUI{constructor(s){super(s)}onChangeInput(s){this.onChangeInputCallback=s}setInputs(s){const $=this.getInputs();super.setInputs(s);const _=[];s.forEach((_e,tt)=>{const nt=$[tt]||{};new Set([...Object.keys(_e),...Object.keys(nt)]).forEach(ot=>{const rt=_e[ot],st=nt[ot];rt!==st&&_.push({index:tt,name:ot,value:rt})})}),_.forEach(_e=>{this.onChangeInputCallback&&this.onChangeInputCallback(_e)})}render(){if(!this.domContainer)throw Error(DESTROYED_ERR_MSG);ReactDOM.render(jsxRuntimeExports.jsx(AppContextProvider$1,{lang:this.getLang(),font:this.getFont(),plugins:this.getPluginsRegistry(),options:this.getOptions(),children:jsxRuntimeExports.jsx(Preview$1,{template:this.template,size:this.size,inputs:this.inputs,onChangeInput:s=>{const{index:$,value:_,name:_e}=s;this.onChangeInputCallback&&this.onChangeInputCallback({index:$,value:_,name:_e}),this.inputs&&this.inputs[$]&&this.inputs[$][_e]!==_&&(this.inputs[$][_e]=_,this.render())}})}),this.domContainer)}}const Form$1=Form;class Viewer extends PreviewUI{constructor(s){super(s)}render(){if(!this.domContainer)throw Error(DESTROYED_ERR_MSG);ReactDOM.render(jsxRuntimeExports.jsx(AppContextProvider$1,{lang:this.getLang(),font:this.getFont(),plugins:this.getPluginsRegistry(),options:this.getOptions(),children:jsxRuntimeExports.jsx(Preview$1,{template:this.template,size:this.size,inputs:this.inputs})}),this.domContainer)}}const Viewer$1=Viewer;exports.Designer=Designer$1,exports.Form=Form$1,exports.Viewer=Viewer$1,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});