dascom-le-editor 0.0.13 → 0.0.14
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/editor.js +47573 -51683
- package/dist/editor.umd.cjs +1 -1
- package/package.json +9 -10
- package/dist/pdf.worker-D7Ag4Z1H.js +0 -4
package/dist/editor.umd.cjs
CHANGED
|
@@ -903,7 +903,7 @@ void main() {
|
|
|
903
903
|
`+(cg.length?"<defs>"+cg.join("")+"</defs>":"")+(/^[0-9A-Fa-f]{6}$/.test(""+yg)?'<rect width="100%" height="100%" fill="#'+yg+`" />
|
|
904
904
|
`:"")+fg+Cg+`</svg>
|
|
905
905
|
`}};function hg(fg,wg){fg+=Zg,wg+=Gg;var yg=tg*fg+eg*wg+gg*(bg-1)+ig*(pg-1),Bg=Ig*fg+og*wg+ng*(bg-1)+sg*(pg-1);return""+((yg|0)==yg?yg:yg.toFixed(2))+" "+((Bg|0)==Bg?Bg:Bg.toFixed(2))}}var FontLib=(function(){var tg=[],eg={},gg={},ig={},Ig=0;return ig.next=ig,ig.prev=ig,{lookup:ng,monochrome:sg,getglyph:ag,getpaths:Cg,loadFont:og};function og(lg){var Ag=100,cg=100,rg=null;if(arguments.length==2)rg=arguments[1];else if(arguments.length==3)Ag=cg=+arguments[1]||100,rg=arguments[2];else if(arguments.length==4)cg=+arguments[1]||100,Ag=+arguments[2]||100,rg=arguments[3];else throw new Error("bwipjs: loadFont: invalid number of arguments");var ug=STBTT.InitFont(toUint8Array(rg));ug.bwipjs_name=lg,ug.bwipjs_multx=Ag,ug.bwipjs_multy=cg;var dg=tg.push(ug)-1;return eg[lg.toUpperCase()]=dg,dg}function ng(lg){var Ag=eg[lg.toUpperCase()];return Ag===void 0?1:Ag}function sg(lg){if(lg)throw new Error("bwipjs: monochrome fonts not implemented")}function ag(lg,Ag,cg,rg){lg=lg|0,Ag=Ag|0,cg=+cg,rg=+rg,(!cg||cg<8)&&(cg=8),(!rg||rg<8)&&(rg=cg),(lg<0||lg>=tg.length)&&(lg=1),(!Ag||Ag<32)&&(Ag=32);var ug=""+lg+"c"+Ag+"w"+cg+"h"+rg,mg=gg[ug];if(mg){mg.prev.next=mg.next,mg.next.prev=mg.prev;var pg=ig;return pg.next.prev=mg,mg.next=pg.next,mg.prev=pg,pg.next=mg,mg}var dg=tg[lg],mg=STBTT.GetGlyph(dg,Ag,cg*dg.bwipjs_multx/100,rg*dg.bwipjs_multy/100)||STBTT.GetGlyph(dg,0,cg*dg.bwipjs_multx/100,rg*dg.bwipjs_multy/100);if(mg.bytes=mg.pixels,mg.cachekey=ug,mg.offset=0,Ig>250){var pg=ig,bg=pg.prev;bg.prev.next=pg,pg.prev=bg.prev,bg.next=bg.prev=null,delete gg[bg.cachekey]}else Ig++;gg[ug]=mg;var pg=ig;return pg.next.prev=mg,mg.next=pg.next,mg.prev=pg,pg.next=mg,mg}function Cg(lg,Ag,cg,rg){lg=lg|0,Ag=Ag|0,cg=+cg,rg=+rg,(!cg||cg<8)&&(cg=8),(!rg||rg<8)&&(rg=cg),(lg<0||lg>=tg.length)&&(lg=1),(!Ag||Ag<32)&&(Ag=32);var ug=tg[lg];return STBTT.GetPaths(ug,Ag,cg*ug.bwipjs_multx/100,rg*ug.bwipjs_multy/100)}})();function LoadFont(){return FontLib.loadFont.apply(FontLib,Array.prototype.slice.call(arguments))}var STBTT=(function(){var tg=1,eg=2,gg=3,ig=4,Ig=0,og=3,ng=1,sg=10,ag=Math.floor,Cg=Math.ceil,lg=Math.sqrt,Ag=Math.abs;function cg(Fg){for(var Dg=[],lI=0;lI<Fg;lI++)Dg.push({});return Dg}function rg(Fg){return Fg[Fg.cursor++]||0}function ug(Fg){return Fg[Fg.cursor]}function dg(Fg,Dg){Fg.cursor=Dg>Fg.length||Dg<0?Fg.length:Dg}function mg(Fg,Dg){dg(Fg,Fg.cursor+Dg)}function bg(Fg,Dg){for(var lI=0,fI=0;fI<Dg;fI++)lI=lI<<8|rg(Fg);return lI}function pg(){return{length:0}}function Zg(Fg,Dg,lI){if(Dg<0||lI<0||Dg>Fg.length||lI>Fg.length-Dg)return pg();var fI=Fg.subarray(Dg,Dg+lI);return fI.cursor=0,fI}function Gg(Fg){var Dg=Fg.cursor,lI=bg(Fg,2);if(lI){var fI=rg(Fg);mg(Fg,fI*lI),mg(Fg,bg(Fg,fI)-1)}return Zg(Fg,Dg,Fg.cursor-Dg)}function hg(Fg){var Dg=rg(Fg);return Dg>=32&&Dg<=246?Dg-139:Dg>=247&&Dg<=250?(Dg-247)*256+rg(Fg)+108:Dg>=251&&Dg<=254?-(Dg-251)*256-rg(Fg)-108:Dg==28?bg(Fg,2):Dg==29?bg(Fg,4):0}function fg(Fg){var Dg=ug(Fg);if(Dg==30)for(mg(Fg,1);Fg.cursor<Fg.length;){var lI=rg(Fg);if((lI&15)==15||lI>>4==15)break}else hg(Fg)}function wg(Fg,Dg){for(dg(Fg,0);Fg.cursor<Fg.length;){for(var lI=Fg.cursor,fI,Hg;ug(Fg)>=28;)fg(Fg);if(fI=Fg.cursor,Hg=rg(Fg),Hg==12&&(Hg=rg(Fg)|256),Hg==Dg)return Zg(Fg,lI,fI-lI)}return Zg(Fg,0,0)}function yg(Fg,Dg,lI,fI){for(var Hg=wg(Fg,Dg),Pg=0;Pg<lI&&Hg.cursor<Hg.length;Pg++)fI[Pg]=hg(Hg)}function Bg(Fg,Dg,lI){var fI=wg(Fg,Dg);return fI.cursor<fI.length&&(lI=hg(fI)),lI}function Wg(Fg){return dg(Fg,0),bg(Fg,2)}function $g(Fg,Dg){var lI,fI,Hg,Pg;return dg(Fg,0),lI=bg(Fg,2),fI=rg(Fg),mg(Fg,Dg*fI),Hg=bg(Fg,fI),Pg=bg(Fg,fI),Zg(Fg,2+(lI+1)*fI+Hg,Pg-Hg)}function Ng(Fg){return Fg&32768?(4294901760|Fg)>>0:Fg}function Vg(Fg,Dg){return Fg[Dg]*256+Fg[Dg+1]}function Mg(Fg,Dg){var lI=Fg[Dg]*256+Fg[Dg+1];return lI&32768?(4294901760|lI)>>0:lI}function Yg(Fg,Dg){return(Fg[Dg]<<24)+(Fg[Dg+1]<<16)+(Fg[Dg+2]<<8)+Fg[Dg+3]}function Sg(Fg,Dg,lI){for(var fI=Vg(Fg,Dg+4),Hg=Dg+12,Pg=0;Pg<fI;++Pg){var nI=Hg+16*Pg;if(Fg[nI]==lI[0]&&Fg[nI+1]==lI[1]&&Fg[nI+2]==lI[2]&&Fg[nI+3]==lI[3])return Yg(Fg,nI+8)}return 0}function vg(Fg,Dg){var lI=[0,0];if(yg(Dg,18,2,lI),!lI[1]||!lI[0])return pg();var fI=Zg(Fg,lI[1],lI[0]),Hg=Bg(fI,19,0);return Hg?(dg(Fg,lI[1]+Hg),Gg(Fg)):pg()}function Rg(Fg,Dg,lI){var fI,Hg,Pg,nI;if(Fg.data=Dg,Fg.fontstart=lI,Fg.cff=pg(),fI=Sg(Dg,lI,[99,109,97,112]),Fg.loca=Sg(Dg,lI,[108,111,99,97]),Fg.head=Sg(Dg,lI,[104,101,97,100]),Fg.glyf=Sg(Dg,lI,[103,108,121,102]),Fg.hhea=Sg(Dg,lI,[104,104,101,97]),Fg.hmtx=Sg(Dg,lI,[104,109,116,120]),Fg.kern=Sg(Dg,lI,[107,101,114,110]),!fI||!Fg.head||!Fg.hhea||!Fg.hmtx)return 0;if(Fg.glyf){if(!Fg.loca)return 0}else{var Qg,tI,bI,vI,II=2,Og=0,ZI=0,VI=0;if(vI=Sg(Dg,lI,[67,70,70,32]),!vI||(Fg.fontdicts=pg(),Fg.fdselect=pg(),Fg.cff=Dg.subarray(vI),Fg.cff.cursor=0,Qg=Fg.cff,mg(Qg,2),dg(Qg,rg(Qg)),Gg(Qg),bI=Gg(Qg),tI=$g(bI,0),Gg(Qg),Fg.gsubrs=Gg(Qg),Og=Bg(tI,17,Og),II=Bg(tI,262,II),ZI=Bg(tI,292,ZI),VI=Bg(tI,293,VI),Fg.subrs=vg(Qg,tI),II!=2)||Og==0)return 0;if(ZI){if(!VI)return 0;dg(Qg,ZI),Fg.fontdicts=Gg(Qg),Fg.fdselect=Zg(Qg,VI,Qg.length-VI)}dg(Qg,Og),Fg.charstrings=Gg(Qg)}for(Hg=Sg(Dg,lI,[109,97,120,112]),Hg?Fg.numGlyphs=Vg(Dg,Hg+4):Fg.numGlyphs=65535,nI=Vg(Dg,fI+2),Fg.index_map=0,Pg=0;Pg<nI;++Pg){var yI=fI+4+8*Pg;switch(Vg(Dg,yI)){case og:switch(Vg(Dg,yI+2)){case ng:case sg:Fg.index_map=fI+Yg(Dg,yI+4);break}break;case Ig:Fg.index_map=fI+Yg(Dg,yI+4);break}}return Fg.index_map==0?0:(Fg.indexToLocFormat=Vg(Dg,Fg.head+50),1)}function kg(Fg,Dg){var lI=Fg.data,fI=Fg.index_map,Hg=Vg(lI,fI+0);if(Hg==0){var Pg=Vg(lI,fI+2);return Dg<Pg-6?lI[fI+6+Dg]:0}else if(Hg==6){var nI=Vg(lI,fI+6),Qg=Vg(lI,fI+8);return Dg>=nI&&Dg<nI+Qg?Vg(lI,fI+10+(Dg-nI)*2):0}else{if(Hg==2)return 0;if(Hg==4){var tI=Vg(lI,fI+6)>>1,bI=Vg(lI,fI+8)>>1,vI=Vg(lI,fI+10),II=Vg(lI,fI+12)>>1,Og=fI+14,ZI=Og;if(Dg>65535)return 0;for(Dg>=Vg(lI,ZI+II*2)&&(ZI+=II*2),ZI-=2;vI;){bI>>=1;var VI=Vg(lI,ZI+bI*2);Dg>VI&&(ZI+=bI*2),--vI}ZI+=2;var yI,NI,SI=ZI-Og>>>1;return NI=Vg(lI,fI+14+tI*2+2+2*SI),Dg<NI?0:(yI=Vg(lI,fI+14+tI*6+2+2*SI),yI==0?Dg+Mg(lI,fI+14+tI*4+2+2*SI):Vg(lI,yI+(Dg-NI)*2+fI+14+tI*6+2+2*SI))}else if(Hg==12||Hg==13){for(var XI=Yg(lI,fI+12),xI=0,FI=XI;xI<FI;){var EI=xI+(FI-xI>>1),KI=Yg(lI,fI+16+EI*12),LI=Yg(lI,fI+16+EI*12+4);if(Dg<KI)FI=EI;else if(Dg>LI)xI=EI+1;else{var JI=Yg(lI,fI+16+EI*12+8);return Hg==12?JI+Dg-KI:JI}}return 0}}return 0}function Kg(Fg,Dg,lI,fI,Hg,Pg){Fg.type=Dg,Fg.x=lI,Fg.y=fI,Fg.cx=Hg,Fg.cy=Pg}function Tg(Fg,Dg){var lI,fI;return Dg>=Fg.numGlyphs||Fg.indexToLocFormat>=2?-1:(Fg.indexToLocFormat==0?(lI=Fg.glyf+Vg(Fg.data,Fg.loca+Dg*2)*2,fI=Fg.glyf+Vg(Fg.data,Fg.loca+Dg*2+2)*2):(lI=Fg.glyf+Yg(Fg.data,Fg.loca+Dg*4),fI=Fg.glyf+Yg(Fg.data,Fg.loca+Dg*4+4)),lI==fI?-1:lI)}function xg(Fg,Dg,lI){if(Fg.cff.length)CI(Fg,Dg,lI);else{var fI=Tg(Fg,Dg);if(fI<0)return 0;lI.x0=Mg(Fg.data,fI+2),lI.y0=Mg(Fg.data,fI+4),lI.x1=Mg(Fg.data,fI+6),lI.y1=Mg(Fg.data,fI+8)}return 1}function Xg(Fg,Dg,lI,fI,Hg,Pg,nI,Qg,tI,bI){return fI?(lI&&Kg(Fg[Dg++],gg,tI+nI>>1,bI+Qg>>1,tI,bI),Kg(Fg[Dg++],gg,Hg,Pg,nI,Qg)):lI?Kg(Fg[Dg++],gg,Hg,Pg,tI,bI):Kg(Fg[Dg++],eg,Hg,Pg,0,0),Dg}function jg(Fg,Dg){var lI=Fg.data,fI=Tg(Fg,Dg);if(fI<0)return null;var Hg=[],Pg=Mg(lI,fI);if(Pg>0){var nI=0,Qg,tI,bI=0,vI,II,Og,ZI=0,VI,yI=0,NI,SI,XI,xI,FI,EI,KI,LI,JI=fI+10,PI=Vg(lI,fI+10+Pg*2),UI=lI.subarray(fI+10+Pg*2+2+PI),eo=0;for(II=1+Vg(lI,JI+Pg*2-2),vI=II+2*Pg,Hg=cg(vI),Og=0,Qg=0,VI=vI-II,tI=0;tI<II;++tI)Qg==0?(nI=UI[eo++],nI&8&&(Qg=UI[eo++])):--Qg,Hg[VI+tI].type=nI;for(NI=0,tI=0;tI<II;++tI){if(nI=Hg[VI+tI].type,nI&2){var cs=UI[eo++];NI+=nI&16?cs:-cs}else nI&16||(NI=NI+Ng(UI[eo]*256+UI[eo+1]),eo+=2);Hg[VI+tI].x=NI}for(SI=0,tI=0;tI<II;++tI){if(nI=Hg[VI+tI].type,nI&4){var us=UI[eo++];SI+=nI&32?us:-us}else nI&32||(SI=SI+Ng(UI[eo]*256+UI[eo+1]),eo+=2);Hg[VI+tI].y=SI}var hs=0;for(FI=EI=XI=xI=KI=LI=0,tI=0;tI<II;++tI)nI=Hg[VI+tI].type,NI=Hg[VI+tI].x,SI=Hg[VI+tI].y,Og==tI?(tI!=0&&(hs=Xg(Hg,hs,ZI,yI,FI,EI,KI,LI,XI,xI)),yI=!(nI&1),yI?(KI=NI,LI=SI,Hg[VI+tI+1].type&1?(FI=Hg[VI+tI+1].x,EI=Hg[VI+tI+1].y,++tI):(FI=NI+Hg[VI+tI+1].x>>1,EI=SI+Hg[VI+tI+1].y>>1)):(FI=NI,EI=SI),Kg(Hg[hs++],tg,FI,EI,0,0),ZI=0,Og=1+Vg(lI,JI+bI*2),++bI):nI&1?(ZI?Kg(Hg[hs++],gg,NI,SI,XI,xI):Kg(Hg[hs++],eg,NI,SI,0,0),ZI=0):(ZI&&Kg(Hg[hs++],gg,XI+NI>>1,xI+SI>>1,XI,xI),XI=NI,xI=SI,ZI=1);Hg.length=Xg(Hg,hs,ZI,yI,FI,EI,KI,LI,XI,xI)}else if(Pg==-1)for(var DI=1,kI=fI+10;DI;){var nI,_I,zI=[1,0,0,1,0,0];nI=Mg(lI,kI),kI+=2,_I=Mg(lI,kI),kI+=2,nI&2&&(nI&1?(zI[4]=Mg(lI,kI),kI+=2,zI[5]=Mg(lI,kI),kI+=2):(zI[4]=rg(lI),kI+=1,zI[5]=rg(lI),kI+=1)),nI&8?(zI[0]=zI[3]=Mg(lI,kI)/16384,kI+=2,zI[1]=zI[2]=0):nI&64?(zI[0]=Mg(lI,kI)/16384,kI+=2,zI[1]=zI[2]=0,zI[3]=Mg(lI,kI)/16384,kI+=2):nI&128&&(zI[0]=Mg(lI,kI)/16384,kI+=2,zI[1]=Mg(lI,kI)/16384,kI+=2,zI[2]=Mg(lI,kI)/16384,kI+=2,zI[3]=Mg(lI,kI)/16384,kI+=2);var vI=lg(zI[0]*zI[0]+zI[1]*zI[1]),II=lg(zI[2]*zI[2]+zI[3]*zI[3]),no=aI(Fg,_I);if(no.length>0){for(var tI=0,is=no.length;tI<is;++tI){var ga=no[tI],NI,SI;NI=ga.x,SI=ga.y,ga.x=ag(vI*(zI[0]*NI+zI[2]*SI+zI[4])),ga.y=ag(II*(zI[1]*NI+zI[3]*SI+zI[5])),NI=ga.cx,SI=ga.cy,ga.cx=ag(vI*(zI[0]*NI+zI[2]*SI+zI[4])),ga.cy=ag(II*(zI[1]*NI+zI[3]*SI+zI[5]))}Hg=Hg.concat(no)}DI=nI&32}return Hg}function zg(Fg,Dg,lI){(Dg>Fg.max_x||!Fg.started)&&(Fg.max_x=Dg),(lI>Fg.max_y||!Fg.started)&&(Fg.max_y=lI),(Dg<Fg.min_x||!Fg.started)&&(Fg.min_x=Dg),(lI<Fg.min_y||!Fg.started)&&(Fg.min_y=lI),Fg.started=1}function Eg(Fg,Dg,lI,fI,Hg,Pg,nI,Qg){zg(Fg,lI,fI),Dg==ig&&(zg(Fg,Hg,Pg),zg(Fg,nI,Qg));var tI={};Kg(tI,Dg,lI,fI,Hg,Pg),tI.cx1=nI,tI.cy1=Qg,Fg.vertices.push(tI)}function Ug(Fg){(Fg.first_x!=Fg.x||Fg.first_y!=Fg.y)&&Eg(Fg,eg,Fg.first_x,Fg.first_y,0,0,0,0)}function iI(Fg,Dg,lI){Ug(Fg),Fg.first_x=Fg.x=Fg.x+Dg,Fg.first_y=Fg.y=Fg.y+lI,Eg(Fg,tg,Fg.x,Fg.y,0,0,0,0)}function qg(Fg,Dg,lI){Fg.x+=Dg,Fg.y+=lI,Eg(Fg,eg,Fg.x,Fg.y,0,0,0,0)}function gI(Fg,Dg,lI,fI,Hg,Pg,nI){var Qg=Fg.x+Dg,tI=Fg.y+lI,bI=Qg+fI,vI=tI+Hg;Fg.x=bI+Pg,Fg.y=vI+nI,Eg(Fg,ig,Fg.x,Fg.y,Qg,tI,bI,vI)}function _g(Fg,Dg){var lI=Wg(Fg),fI=107;return lI>=33900?fI=32768:lI>=1240&&(fI=1131),Dg+=fI,Dg<0||Dg>=lI?pg():$g(Fg,Dg)}function mI(Fg,Dg){var lI=Fg.fdselect,fI,Hg,Pg,nI,Qg,tI=-1,bI;if(dg(lI,0),Qg=rg(lI),Qg==0)mg(lI,Dg),tI=rg(lI);else if(Qg==3)for(fI=bg(lI,2),Hg=bg(lI,2),bI=0;bI<fI;bI++){if(nI=rg(lI),Pg=bg(lI,2),Dg>=Hg&&Dg<Pg){tI=nI;break}Hg=Pg}return vg(Fg.cff,$g(Fg.fontdicts,tI))}function Jg(Fg,Dg,lI){var fI=1,Hg=0,Pg=0,nI=0,Qg,tI,bI,vI=0,II,Og=[],ZI=[],VI=Fg.subrs,yI,NI;for(yI=$g(Fg.charstrings,Dg);yI.cursor<yI.length;){switch(tI=0,II=1,bI=rg(yI),bI){case 19:case 20:fI&&(Hg+=nI/2|0),fI=0,mg(yI,(Hg+7)/8|0);break;case 1:case 3:case 18:case 23:Hg+=nI/2|0;break;case 21:if(fI=0,nI<2)return 0;iI(lI,Og[nI-2],Og[nI-1]);break;case 4:if(fI=0,nI<1)return 0;iI(lI,0,Og[nI-1]);break;case 22:if(fI=0,nI<1)return 0;iI(lI,Og[nI-1],0);break;case 5:if(nI<2)return 0;for(;tI+1<nI;tI+=2)qg(lI,Og[tI],Og[tI+1]);break;case 7:if(nI<1)return 0;for(;!(tI>=nI||(qg(lI,0,Og[tI]),tI++,tI>=nI));)qg(lI,Og[tI],0),tI++;break;case 6:if(nI<1)return 0;for(;!(tI>=nI||(qg(lI,Og[tI],0),tI++,tI>=nI));)qg(lI,0,Og[tI]),tI++;break;case 31:if(nI<4)return 0;for(;!(tI+3>=nI||(gI(lI,Og[tI],0,Og[tI+1],Og[tI+2],nI-tI==5?Og[tI+4]:0,Og[tI+3]),tI+=4,tI+3>=nI));)gI(lI,0,Og[tI],Og[tI+1],Og[tI+2],Og[tI+3],nI-tI==5?Og[tI+4]:0),tI+=4;break;case 30:if(nI<4)return 0;for(;!(tI+3>=nI||(gI(lI,0,Og[tI],Og[tI+1],Og[tI+2],Og[tI+3],nI-tI==5?Og[tI+4]:0),tI+=4,tI+3>=nI));)gI(lI,Og[tI],0,Og[tI+1],Og[tI+2],nI-tI==5?Og[tI+4]:0,Og[tI+3]),tI+=4;break;case 8:if(nI<6)return 0;for(;tI+5<nI;tI+=6)gI(lI,Og[tI],Og[tI+1],Og[tI+2],Og[tI+3],Og[tI+4],Og[tI+5]);break;case 24:if(nI<8)return 0;for(;tI+5<nI-2;tI+=6)gI(lI,Og[tI],Og[tI+1],Og[tI+2],Og[tI+3],Og[tI+4],Og[tI+5]);if(tI+1>=nI)return 0;qg(lI,Og[tI],Og[tI+1]);break;case 25:if(nI<8)return 0;for(;tI+1<nI-6;tI+=2)qg(lI,Og[tI],Og[tI+1]);if(tI+5>=nI)return 0;gI(lI,Og[tI],Og[tI+1],Og[tI+2],Og[tI+3],Og[tI+4],Og[tI+5]);break;case 26:case 27:if(nI<4)return 0;for(NI=0,nI&1&&(NI=Og[tI],tI++);tI+3<nI;tI+=4)bI==27?gI(lI,Og[tI],NI,Og[tI+1],Og[tI+2],Og[tI+3],0):gI(lI,NI,Og[tI],Og[tI+1],Og[tI+2],0,Og[tI+3]),NI=0;break;case 10:vI||(Fg.fdselect.length&&(VI=mI(Fg,Dg)),vI=1);case 29:if(nI<1||(Qg=Og[--nI]|0,Pg>=10)||(ZI[Pg++]=yI,yI=_g(bI==10?VI:Fg.gsubrs,Qg),yI.length==0))return 0;yI.cursor=0,II=0;break;case 11:if(Pg<=0)return 0;yI=ZI[--Pg],II=0;break;case 14:return Ug(lI),1;case 12:var SI,XI,xI,FI,EI,KI,LI,JI,PI,UI,eo,cs,us,hs,DI=rg(yI);switch(DI){case 34:if(nI<7)return 0;SI=Og[0],XI=Og[1],JI=Og[2],xI=Og[3],FI=Og[4],EI=Og[5],KI=Og[6],gI(lI,SI,0,XI,JI,xI,0),gI(lI,FI,0,EI,-JI,KI,0);break;case 35:if(nI<13)return 0;SI=Og[0],LI=Og[1],XI=Og[2],JI=Og[3],xI=Og[4],PI=Og[5],FI=Og[6],UI=Og[7],EI=Og[8],eo=Og[9],KI=Og[10],cs=Og[11],gI(lI,SI,LI,XI,JI,xI,PI),gI(lI,FI,UI,EI,eo,KI,cs);break;case 36:if(nI<9)return 0;SI=Og[0],LI=Og[1],XI=Og[2],JI=Og[3],xI=Og[4],FI=Og[5],EI=Og[6],eo=Og[7],KI=Og[8],gI(lI,SI,LI,XI,JI,xI,0),gI(lI,FI,0,EI,eo,KI,-(LI+JI+eo));break;case 37:if(nI<11)return 0;SI=Og[0],LI=Og[1],XI=Og[2],JI=Og[3],xI=Og[4],PI=Og[5],FI=Og[6],UI=Og[7],EI=Og[8],eo=Og[9],KI=cs=Og[10],us=SI+XI+xI+FI+EI,hs=LI+JI+PI+UI+eo,Ag(us)>Ag(hs)?cs=-hs:KI=-us,gI(lI,SI,LI,XI,JI,xI,PI),gI(lI,FI,UI,EI,eo,KI,cs);break;default:return 0}break;default:if(bI!=255&&bI!=28&&(bI<32||bI>254)||(bI==255?NI=(bg(yI,4)|0)/65536:(mg(yI,-1),NI=(hg(yI)<<16|0)>>16),nI>=48))return 0;Og[nI++]=NI,II=0;break}II&&(nI=0)}return 0}function AI(){return{started:0,first_x:0,first_y:0,x:0,y:0,min_x:0,max_x:0,min_y:0,max_y:0,vertices:[]}}function cI(Fg,Dg){var lI=AI();return Jg(Fg,Dg,lI)?lI.vertices:null}function CI(Fg,Dg,lI){var fI=AI(),Hg=Jg(Fg,Dg,fI);return lI.x0=Hg?fI.min_x:0,lI.y0=Hg?fI.min_y:0,lI.x1=Hg?fI.max_x:0,lI.y1=Hg?fI.max_y:0,Hg&&fI.vertices?fI.vertices.length:0}function aI(Fg,Dg){return Fg.cff.length?cI(Fg,Dg):jg(Fg,Dg)}function Lg(Fg,Dg){var lI=Vg(Fg.data,Fg.hhea+34);return Dg<lI?{advanceWidth:Mg(Fg.data,Fg.hmtx+4*Dg),leftSideBearing:Mg(Fg.data,Fg.hmtx+4*Dg+2)}:{advanceWidth:Mg(Fg.data,Fg.hmtx+4*(lI-1)),leftSideBearing:Mg(Fg.data,Fg.hmtx+4*lI+2*(Dg-lI))}}function eI(Fg){return{ascent:Mg(Fg.data,Fg.hhea+4),descent:Mg(Fg.data,Fg.hhea+6),linegap:Mg(Fg.data,Fg.hhea+8)}}function rI(Fg,Dg,lI,fI,Hg,Pg){var nI={};return xg(Fg,Dg,nI)?{x0:ag(nI.x0*lI+Hg),y0:ag(-nI.y1*fI+Pg),x1:Cg(nI.x1*lI+Hg),y1:Cg(-nI.y0*fI+Pg)}:{x0:0,y0:0,x1:0,y1:0}}function pI(Fg,Dg,lI){var fI=(Fg.x1-Fg.x0)/(Fg.y1-Fg.y0);return{fdx:fI,fdy:fI!=0?1/fI:0,fx:Fg.x0+fI*(lI-Fg.y0)-(Dg|0),direction:Fg.invert?1:-1,sy:Fg.y0,ey:Fg.y1,next:0}}function hI(Fg,Dg,lI,fI,Hg,Pg,nI){Dg=Dg|0,Hg!=nI&&(Hg>lI.ey||nI<lI.sy||(Hg<lI.sy&&(fI+=(Pg-fI)*(lI.sy-Hg)/(nI-Hg),Hg=lI.sy),nI>lI.ey&&(Pg+=(Pg-fI)*(lI.ey-nI)/(nI-Hg),nI=lI.ey),fI<=Dg&&Pg<=Dg?Fg[Dg]+=lI.direction*(nI-Hg):fI>=Dg+1&&Pg>=Dg+1||(Fg[Dg]+=lI.direction*(nI-Hg)*(1-(fI-Dg+(Pg-Dg))/2))))}function BI(Fg,Dg,lI,fI,Hg){for(var Pg=Hg+1;fI;){if(fI.fdx==0){var nI=fI.fx;nI<lI&&(nI>=0?(hI(Fg,nI,fI,nI,Hg,nI,Pg),hI(Dg,nI+1,fI,nI,Hg,nI,Pg)):hI(Dg,0,fI,nI,Hg,nI,Pg))}else{var nI=fI.fx,Qg=fI.fdx,tI=nI+Qg,bI,vI,II,Og,ZI=fI.fdy;if(fI.sy>Hg?(bI=nI+Qg*(fI.sy-Hg),II=fI.sy):(bI=nI,II=Hg),fI.ey<Pg?(vI=nI+Qg*(fI.ey-Hg),Og=fI.ey):(vI=tI,Og=Pg),bI>=0&&vI>=0&&bI<lI&&vI<lI)if((bI|0)==(vI|0)){var VI=Og-II,yI=bI|0;Fg[yI]+=fI.direction*(1-(bI-yI+(vI-yI))/2)*VI,Dg[yI+1]+=fI.direction*VI}else{var NI,yI,SI,XI,xI,FI,EI,KI;for(bI>vI&&(II=Pg-(II-Hg),Og=Pg-(Og-Hg),NI=II,II=Og,Og=NI,NI=vI,vI=bI,bI=NI,Qg=-Qg,ZI=-ZI,NI=nI,nI=tI,tI=NI),SI=bI|0,XI=vI|0,xI=(SI+1-nI)*ZI+Hg,EI=fI.direction,KI=EI*(xI-II),Fg[SI]+=KI*(1-(bI-SI+(SI+1-SI))/2),FI=EI*ZI,yI=SI+1;yI<XI;++yI)Fg[yI]+=KI+FI/2,KI+=FI;xI+=ZI*(XI-(SI+1)),Fg[XI]+=KI+EI*(1-(XI-XI+(vI-XI))/2)*(Og-xI),Dg[XI+1]+=EI*(Og-II)}else for(var yI=0;yI<lI;++yI){var LI=Hg,SI=yI,XI=yI+1,JI=tI,PI=Pg,UI=(yI-nI)/Qg+Hg,eo=(yI+1-nI)/Qg+Hg;nI<SI&&JI>XI?(hI(Fg,yI,fI,nI,LI,SI,UI),hI(Fg,yI,fI,SI,UI,XI,eo),hI(Fg,yI,fI,XI,eo,JI,PI)):JI<SI&&nI>XI?(hI(Fg,yI,fI,nI,LI,XI,eo),hI(Fg,yI,fI,XI,eo,SI,UI),hI(Fg,yI,fI,SI,UI,JI,PI)):nI<SI&&JI>SI||JI<SI&&nI>SI?(hI(Fg,yI,fI,nI,LI,SI,UI),hI(Fg,yI,fI,SI,UI,JI,PI)):nI<XI&&JI>XI||JI<XI&&nI>XI?(hI(Fg,yI,fI,nI,LI,XI,eo),hI(Fg,yI,fI,XI,eo,JI,PI)):hI(Fg,yI,fI,nI,LI,JI,PI)}}fI=fI.next}}function YI(Fg,Dg,lI,fI,Hg,Pg){Hg|=0,Pg|=0;var nI=null,Qg,tI=Pg,bI=0,vI,II=new Float32Array(Fg.w*2+1),Og=II.subarray(Fg.w),ZI=0;for(Dg[lI].y0=Pg+Fg.h+1;bI<Fg.h;){var VI=tI+0,yI=tI+1,NI=nI;if(II.fill)II.fill(0);else for(var SI=0,XI=II.length;SI<XI;SI++)II[SI]=0;for(;NI;)Qg=NI,NI=Qg.next,Qg.ey<=VI&&(Qg.direction=0);for(;Dg[ZI].y0<=yI;)Dg[ZI].y0!=Dg[ZI].y1&&(Qg=pI(Dg[ZI],Hg,VI),Qg.next=nI,nI=Qg),++ZI;nI&&BI(II,Og,Fg.w,nI,VI);for(var vI=0,xI=0;vI<Fg.w;++vI){var FI,EI;xI+=Og[vI],FI=II[vI]+xI,FI=Ag(FI)*255+.5,EI=FI>>>0,EI>255&&(EI=255),Fg.pixels[bI*Fg.stride+vI]=EI}for(NI=nI;NI;)Qg=NI,Qg.fx+=Qg.fdx,NI=Qg.next;++tI,++bI}}function uI(Fg,Dg){for(var lI=1;lI<Dg;++lI){for(var fI=Fg[lI],Hg=lI;Hg>0&&fI.y0<Fg[Hg-1].y0;)Fg[Hg]=Fg[Hg-1],--Hg;lI!=Hg&&(Fg[Hg]=fI)}}function GI(Fg,Dg,lI){for(;lI>12;){var fI,Hg,Pg,nI,Qg,tI=lI>>1,bI=Fg[Dg].y0<Fg[Dg+tI].y0,vI=Fg[Dg+tI].y0<Fg[Dg+lI-1].y0;for(bI!=vI&&(Hg=Fg[Dg].y0<Fg[Dg+lI-11].y0,Qg=Hg==vI?0:lI-1,fI=Fg[Dg+Qg],Fg[Dg+Qg]=Fg[Dg+tI],Fg[Dg+tI]=fI),fI=Fg[Dg],Fg[Dg]=Fg[Dg+tI],Fg[Dg+tI]=fI,Pg=1,nI=lI-1;;){for(;Fg[Dg+Pg].y0<Fg[Dg].y0;++Pg);for(;Fg[Dg].y0<Fg[Dg+nI].y0;--nI);if(Pg>=nI)break;fI=Fg[Dg+Pg],Fg[Dg+Pg]=Fg[Dg+nI],Fg[Dg+nI]=fI,++Pg,--nI}nI<lI-Pg?(GI(Fg,Dg,nI),Dg+=Pg,lI-=Pg):(GI(Fg,Dg+Pg,lI-Pg),lI=nI)}}function WI(Fg,Dg){GI(Fg,0,Dg),uI(Fg,Dg)}function MI(Fg,Dg,lI,fI,Hg,Pg,nI,Qg,tI,bI){var vI=-Hg,II,Og,ZI,VI,yI,NI,SI=1;for(Og=0,ZI=0;ZI<lI.length;++ZI)Og+=lI[ZI];for(II=cg(Og+1),Og=0,NI=0,ZI=0;ZI<lI.length;++ZI){var XI=NI;for(NI+=lI[ZI],VI=lI[ZI]-1,yI=0;yI<lI[ZI];VI=yI++){var xI=yI,FI=VI;Dg[XI+VI].y!=Dg[XI+yI].y&&(II[Og].invert=0,Dg[XI+VI].y>Dg[XI+yI].y&&(II[Og].invert=1,xI=VI,FI=yI),II[Og].x0=Dg[XI+xI].x*fI+Pg,II[Og].y0=(Dg[XI+xI].y*vI+nI)*SI,II[Og].x1=Dg[XI+FI].x*fI+Pg,II[Og].y1=(Dg[XI+FI].y*vI+nI)*SI,++Og)}}WI(II,Og),YI(Fg,II,Og,SI,Qg,tI)}function jI(Fg,Dg,lI,fI,Hg,Pg,nI,Qg,tI){var bI=(Dg+2*fI+Pg)/4,vI=(lI+2*Hg+nI)/4,II=(Dg+Pg)/2-bI,Og=(lI+nI)/2-vI;return tI>16||(II*II+Og*Og>Qg?(jI(Fg,Dg,lI,(Dg+fI)/2,(lI+Hg)/2,bI,vI,Qg,tI+1),jI(Fg,bI,vI,(fI+Pg)/2,(Hg+nI)/2,Pg,nI,Qg,tI+1)):Fg.push({x:Pg,y:nI})),1}function HI(Fg,Dg,lI,fI,Hg,Pg,nI,Qg,tI,bI,vI){var II=fI-Dg,Og=Hg-lI,ZI=Pg-fI,VI=nI-Hg,yI=Qg-Pg,NI=tI-nI,SI=Qg-Dg,XI=tI-lI,xI=lg(II*II+Og*Og)+lg(ZI*ZI+VI*VI)+lg(yI*yI+NI*NI),FI=lg(SI*SI+XI*XI),EI=xI*xI-FI*FI;if(!(vI>16))if(EI>bI){var KI=(Dg+fI)/2,LI=(lI+Hg)/2,JI=(fI+Pg)/2,PI=(Hg+nI)/2,UI=(Pg+Qg)/2,eo=(nI+tI)/2,cs=(KI+JI)/2,us=(LI+PI)/2,hs=(JI+UI)/2,DI=(PI+eo)/2,kI=(cs+hs)/2,_I=(us+DI)/2;HI(Fg,Dg,lI,KI,LI,cs,us,kI,_I,bI,vI+1),HI(Fg,kI,_I,hs,DI,UI,eo,Qg,tI,bI,vI+1)}else Fg.push({x:Qg,y:tI})}function oI(Fg,Dg,lI){for(var fI=[],Hg=Dg*Dg,Pg=-1,nI=0,Qg=0,tI=0,bI=0,vI=Fg.length;bI<vI;++bI)switch(Fg[bI].type){case tg:Pg>=0&&(lI[Pg]=fI.length-nI),++Pg,nI=fI.length,Qg=Fg[bI].x,tI=Fg[bI].y,fI.push({x:Qg,y:tI});break;case eg:Qg=Fg[bI].x,tI=Fg[bI].y,fI.push({x:Qg,y:tI});break;case gg:jI(fI,Qg,tI,Fg[bI].cx,Fg[bI].cy,Fg[bI].x,Fg[bI].y,Hg,0),Qg=Fg[bI].x,tI=Fg[bI].y;break;case ig:HI(fI,Qg,tI,Fg[bI].cx,Fg[bI].cy,Fg[bI].cx1,Fg[bI].cy1,Fg[bI].x,Fg[bI].y,Hg,0),Qg=Fg[bI].x,tI=Fg[bI].y;break}return lI[Pg]=fI.length-nI,fI}function wI(Fg,Dg,lI,fI,Hg,Pg,nI,Qg,tI,bI){Qg|=0,tI|=0;var vI=fI>Hg?Hg:fI,II=[],Og=oI(lI,Dg/vI,II);Og&&MI(Fg,Og,II,fI,Hg,Pg,nI,Qg,tI)}function $I(Fg){var Dg={};if(!Rg(Dg,Fg,0))return null;var lI=eI(Dg);return Dg.ascent=lI.ascent,Dg.descent=lI.descent,Dg.linegap=lI.linegap,Dg}function RI(Fg,Dg,lI,fI){fI=fI||lI;var Hg=lI/Fg.ascent,Pg=fI/Fg.ascent,nI=kg(Fg,Dg);if(!nI&&Dg)return null;var Qg=aI(Fg,nI),tI=rI(Fg,nI,Hg,Pg,0,0),bI=tI.x1-tI.x0,vI=tI.y1-tI.y0,II=null;if(bI&&vI){var Og={pixels:II=new Uint8Array(bI*vI),w:bI,h:vI,stride:bI};wI(Og,.35,Qg,Hg,Pg,0,0,tI.x0,tI.y0)}var ZI=Lg(Fg,nI);return{glyph:nI,pixels:II,width:bI,height:vI,top:-tI.y0,left:tI.x0,advance:ag(ZI.advanceWidth*Hg)}}function dI(Fg,Dg,lI,fI){fI=fI||lI;var Hg=lI/Fg.ascent,Pg=fI/Fg.ascent,nI=kg(Fg,Dg);if(!nI&&Dg)return null;var Qg=aI(Fg,nI),tI=Lg(Fg,nI),bI=0,vI=0,II=[];if(Qg)for(var Og=0,ZI=Qg.length;Og<ZI;Og++){var VI=Qg[Og],yI;if(VI.type==tg)yI={type:"M",x:VI.x*Hg,y:VI.y*Pg};else if(VI.type==eg)yI={type:"L",x:VI.x*Hg,y:VI.y*Pg};else if(VI.type==gg)yI={type:"Q",x:VI.x*Hg,y:VI.y*Pg,cx:VI.cx*Hg,cy:VI.cy*Pg};else if(VI.type==ig)yI={type:"C",x:VI.x*Hg,y:VI.y*Pg,cx1:VI.cx*Hg,cy1:VI.cy*Pg,cx2:VI.cx1*Hg,cy2:VI.cy1*Pg};else continue;yI.y>bI&&(bI=yI.y),yI.y<vI&&(vI=yI.y),II.push(yI)}return II.advance=tI.advanceWidth*Hg,II.ascent=bI,II.descent=vI,II}return{InitFont:$I,GetGlyph:RI,GetPaths:dI}})();function toUint8Array(tg){if(typeof tg=="string"){for(var eg=/[^A-Za-z0-9+\/=\s]/.test(tg),gg=eg?tg:atob(tg),ig=gg.length,Ig=new Uint8Array(ig),og=0;og<ig;og++)Ig[og]=gg.charCodeAt(og);return Ig}else{if(tg instanceof Uint8Array)return tg;if(tg instanceof ArrayBuffer)return new Uint8Array(tg)}throw new ReferenceError("data must be a binary or base64 encoded string or Uint8Array")}FontLib.loadFont("OCR-A",100,100,"AAEAAAAPAIAAAwBwRkZUTXxHoksAADPIAAAAHEdERUYAmQAGAAAyIAAAACBHUE9TuP+4/gAAM5gAAAAwR1NVQuq3l/0AADJAAAABWE9TLzKDm4kvAAABeAAAAGBjbWFwO6GiGgAAArgAAAFaZ2FzcP//AAMAADIYAAAACGdseWYfHUemAAAE8AAAKUBoZWFkFeCL3QAAAPwAAAA2aGhlYQcqAgQAAAE0AAAAJGhtdHgagBVHAAAB2AAAAOBsb2NhH+IWRAAABBQAAADabWF4cACxAF0AAAFYAAAAIG5hbWUIp3NfAAAuMAAAAoJwb3N0oJoboAAAMLQAAAFkAAEAAAACAAAhYPsHXw889QALA+gAAAAA2gMjvQAAAADaAyO9AD7/LAJ8BFIAAAAIAAIAAAAAAAAAAQAABFL/LABaAtMAAAAAAnwAAQAAAAAAAAAAAAAAAAAAAAQAAQAAAGwAWgADAAAAAAACAAAAAQABAAAAQAAAAAAAAAACAtMBkAAFAAACigK8AAAAjAKKArwAAAHgADEBAgAAAgAFCQAAAAAAAAAAACMAACoAAAAAAAAAAABQZkVkAEAAICWgAyD/OABaBFIA1AAAAAEAAAAAAjgDDAAAACAAAQLTAAAAAAAAAtMAAALTAAAA9gBJAEkASQBJAEkA3QDdAKwASQBJAKwASQDdAEkASQBJAEkASQBhAEkASQBJAEkASQDdAKwASQBJAEkASQBJAEYASQBJAEkASQBJAEkASQBJAHoASQBJAEkASQBJAEkASQBJAEkASQBJAEkASQBJAEkASABJAEkASQBIAEkAegBJAEkASQBJAEkAYQBJAEkAegB6AEkAegBBAEkASQBJAEkASQBJAEkASQBJAD4ASQBJAEkASQEPAEkASQBxAHEAcQE3AFcA7QBxAQMA1ABxAAAAAwAAAAMAAAAcAAEAAAAAAFQAAwABAAAAHAAEADgAAAAKAAgAAgACAH4kQiUCJaD//wAAACAkQCUCJaD////j3CLbY9rGAAEAAAAAAAAAAAAAAAABBgAAAQAAAAAAAAABAgAAAAIAAAAAAAAAAAAAAAAAAAABAAADBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyAhIiMkJSYnKCkqKywtLi8wMTIzNDU2Nzg5Ojs8PT4/QEFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaW1xdXl9gYQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAFIApgDoAS4BigGqAdYCAgJKAnQCkAKsAsYC5AMIAzIDYAOcA8gD+gQmBFIEggSuBNwFDAU0BVwFhAXEBhIGPgZwBqgG5AcKBy4HageWB8QH7gggCDoIZgiICMoI8glMCYIJwAnmChAKNAp0Cq4K1gr6CyYLRAtwC5QLrgvODBYMdAysDRANag2eDhYOSA6EDsYO+A8iD2YPmA/yEFgQvBDqETQRbhGgEcwSDhJEEnoSqBLiEwITPBNyE5ITthPeE+wT+hQUFEYUaBSIFKAAAAACAPYAAAGNAwwADwAfAAA3NTQ2OwEyFh0BFAYrASImETQ2OwEyFh0BAxQGIyImJ/YeFTEVHh4VMRUeHhUxFB8ZHhQVHAIzKhUdHRUqFR4eArwUHhwTA/6BFR0dFQAAAAABAEkBqAI7AwwAEwAAEychFQYHBiMiJjUnIwcOASMiJidKAQHyJgsMKBQgKHIqAxwSExwDAsJKSrkvMhoS09YRGBgRAAIASQB/AjsDDAA9AEEAABM0NjsBNSMiJjQ2OwE1NDYyFh0BMzU0NjIWHQEzMhYUBisBFTMyFhUUBisBFRQGIiY9ASMVFAYiJj0BIyImNzM1I0kdFTExFR0dFTEdKh5hHiodMRUeHhUxMRUeHhUxHSoeYR4qHTEVHchhYQFcFB5vHiodeBQeHhR4eBQeHhR4HSoebx4UFR53FR4eFXd3FR4eFXceR28AAAEASQAAAjsDDAAxAAA2NDYzITUhIiY9ATQ2OwE1NDYzMhYdATMyFhQGIyEVITIWHQEUBisBFRQGIyImPQEjIkkdFQFb/qUVHR0VlB4VFB6UFR4eFf6lAVsVHh4VlB4UFR6UFccqHkQeFaoVHXgUHh4UeB0qHkQeFaoVHXcVHh4VdwAAAAMASQAAAjsDDAAPAB8ALwAANzQ3ATYzMhYVFAcBBiMiJhE1NDY7ATIWHQEUBisBIiYBNTQ2OwEyFh0BFAYrASImSQoBjQ4aFR4L/nMOGhUdHRVjFR4eFWMVHQEpHhVjFR4eFWMVHocUCwH+Ex0VEg3+AhMdAhNVFB4eFFUVHh79w1QVHh4VVBUeHgAAAwBJAAACOwK3AC4ANgBBAAA3NTQ/AScmPQE0NjsBMhYdARQPARc3NjMyFhUUDgIHFxYVFAYjIi8BBwYrASImNxQWOwE3JwcRFzc1NCYrASIGFUkRXGANWT5gPlkRfWszDxIVHhAPIQI0Dh4VFw43Sg8RYj5ZZR4UTzhrTlVvHhRgFB6XRRgPT2YPFEU+WVk+RRkOa3IsDB4VDRoOGAI4EBIVHhA7PwxZPhUdMHJCASpbXi4UHh0VAAEA3QFUAaYDDAARAAATETQ2OwEyFhcUBg8BDgEjIibdHhVjFRwCMhoZBRoSFR4BhgFUFB4dFQawVVURFR0AAAABAN0AAAHZAwwAGwAAEzU0PwE2MzIWFRQPAQYdARQfARYVFAYjIi8BJt0rdRAYFR8MdRYWdQodFRgQdSsBJsBFOJYTHhQOEpUdIsAiHZUPEBUeE5Y4AAAAAQCsAAABpgMMABsAADc0PwE2PQE0LwEmNTQ2MzIfARYdARQPAQYjIiasCnUWFnUKHRUYEHUrK3UQGBUdMxAPlR0iwCIdlQ8RFB4TljhFwEU4lhMeAAAAAAEASQBVAjsCtwAzAAA3ND8BJyY1NDYzMh8BNTQ2MzIWHQE3NjMyFhUUDwEXFhUUBiMiLwEVFAYjIiY9AQcGIyImSRGZmREdFRMOcx4VFB5zDRQVHhKZmRIeFRQNcx4UFR5zDhMVHdwYD4ODDxgVHQxikRUdHRWRYgwdFRcQg4MQFxUdDGKRFR0dFZFiDB0AAAEASQCNAjsCfwAdAAASNDY7ATU0NjMyFh0BMzIWFAYrARUUBiMiJj0BIyJJHRWUHhUUHpQVHh4VlB4UFR6UFQFxKh6UFB4eFJQeKh2UFR4eFZQAAAEArAAAAdcBZAAQAAASNDY7ATIWHQEUBiImPQEjIqwdFccVHR0qHpQVARwqHh4V/hUeHhXMAAAAAQBJASkCOwG5AA8AABM1NDYzITIWHQEUBiMhIiZJHRUBjRUeHhX+cxUdAVwqFR4eFSoVHh4AAAABAN0AfwGmATkADwAANzU0NjsBMhYdARQGKwEiJt0eFWMVHh4VYxUeslUVHR0VVRUeHgAAAQBJAAACOwMMAA8AADc0NwE2MzIWFRQHAQYjIiZJBgGNDx0VHgf+cw8dFR0zDQwCpxkeFAwO/VkZHgAAAgBJAAACOwMMAA8AEwAANxE0NjMhMhYVERQGIyEiJjchESFJPCkBKCg9PSj+2Ck8ZQEo/thlAkIpPDwp/b4pPDwpAkIAAAAAAQBJAAACOwMMABwAADc0NjsBESMiJjU0NjsBETM1NDYyFh0BFAYjISImSR0VlJQVHR0V+WIdKh4eFf5zFR0zFB4CQh4VFB79WcwVHh4V/hUeHgAAAQBJAAACOwMMAB4AADMRNDYzITUhIiY1NDYzITIWHQEUBiMhFSEyFhUUBiNJPCkBKP6lFR0dFQFbKD08Kf7YAVoVHh4VAVQpO+8eFRQePCnvKDzvHhQVHgAAAAABAEkAAAI7AwwAKgAANzQ2MyE1NCYrASImNDY7ATI2PQEhIiY1NDYzITIWHQEUBxYdARQGIyEiJkkdFQFbHxTFFR0dFcUVHv6lFR0dFQFbKD0oKD0o/qUVHTMUHrwUHx0qHh4UvB4VFB48Kbw6Kys6vCk8HgAAAAABAGEAAAIiAwwAHQAAExE0NjIWFREzETQ2MzIWFREyFhQGIxUUBiMiJj0BYR4qHcUeFRQeFR0dFR4UFR4A/wHbFB4eFP6KASEVHR0V/t8eKh3MFR4eFcwAAQBJAAACOwMMACIAADc0NjMyHwEzNSERITIWFRQGKwEVMzIWHQEUBisBIi4CJyZJHRUMCFrt/tYBXBUeHhX3xSg9PSjjFCkaLAkeXRUdBCbvAbgeFBUe7j0o7yk8CgsVBA0AAAIASQAAAjsDDAAXABsAADcRNDY7ATIWFRQGIxEhMhYdARQGIyEiJjchNSFJHRUyFR0dFQFbFR4eFf5zFR1kASn+1zMCpxQeHhQVHv69HhX+FR4eR5oAAAABAEkAAAI7AwwAGwAAEzU0NjMhERQPARUUBiMiJj0BND8BNSEOASMiJkkdFQHAErUeFBUeErX+1wMcExUdAq8rFB7+zxcQmucVHh4V/hcQmrUSGB0AAAAAAwBJAAACOwMMABcAGwAfAAA3NTQ2MxE0NjsBMhYVETIWHQEUBiMhIiY3ITUhNzM1I0k7KRwVxxUcKD09KP7XKTtkASn+12RhYWXvKTwBIRUdHRX+3z0o7yk8PCnvZe4AAgBJAAACOwMMABcAGwAAExE0NjMhMhYVERQGKwEiJjU0NjMRISImNyE1IUkdFQGNFR4eFTIVHR0V/qUVHWQBKf7XAdsA/xQeHhT9WRUeHhUUHgFDHkeaAAIA3QB/AaYCjQAPAB8AADc1NDY7ATIWHQEUBisBIiYRNTQ2OwEyFh0BFAYrASIm3R4VYxUeHhVjFR4eFWMVHh4VYxUeslUVHR0VVRUeHgFoVRUeHhVVFR0dAAAAAgCsAAAB1wK3ABAAIAAAEjQ2OwEyFh0BFAYiJj0BIyIDNTQ2OwEyFh0BFAYrASImrB0VxxUdHSoelBUdHRVkFB4eFGQVHQEcKh4eFf4VHh4VzAExVRUdHRVVFR4eAAAAAQBJAFUCOwK3ABYAABM1NDclNjMyFhUUBw0BFhUUBiMiJyUmSRgBjQsPFR4Z/pkBZxkeFQ8L/nMYAXArHQ/pBx0VHBDT0xAcFR0H6Q8AAAACAEkA/wI7AjgACwAXAAASNDYzITIWFAYjISImNDYzITIWFAYjISJJHRUBjRUeHhX+cxUdHRUBjRUeHhX+cxUBHCoeHiod8SoeHiodAAAAAAEASQBVAjsCtwAWAAA3NDctASY1NDYzMhcFFh0BFAcFBiMiJkkYAWj+mBgdFQ8LAY0ZFP5uCw8VHYcdD9PTDx0VHQfpEBwqHQzsBx0AAAAAAgBJAAACOwMMAB4AKAAAEzQ3ATYyHwEWHQEUBwUVFAYiJj0BNDclNScFBiMiJhM0NjIWFRQGIiZJEQEqDyQPYxIS/ugeKh0RARkx/vcPEhUdYx0qHh4qHQHbGA4A/wwMVQ8XVRcQ7z4VHR0VVRkO7yYq4wwe/m0UHh4UFR4eAAACAEkAAAI7AwwALQA4AAA3NTQ2OwEyFhURFBYyNjURNCYrASIGBwYjIiY1NDc2OwEyFhURFAYjIicGIyImNxQWMjY9ASMiBhVJWD1kFB4dKB0uH48ZLQwOHxUdNjdEj0lpWT05Kiw4PVhlHCgdMRQclrc+WB4V/uYUHR0UAcQgLSMXGx4VJDEyakj+PD1ZJydYPhQdHRToHRQAAAACAEYAAAI8AwwAFQAYAAA3Ez4BMhYXExQGIyImLwEjBw4BIyImNzMDRssFGiIcBMofFREaBSffJwUbERUfqqNSMwK1EBQUEP1LFR4UEIaGEBQe8QEWAAAAAwBJAAACOwMMAA4AGAAiAAAzESEyFh0BFAcWHQEUBiMnMzI2PQE0JisBNTMyNj0BNCYrAUkBKFJ4RkZ4UsPDKTw8KcPDKTw8KcMDDHhSJVk+PlklUnhlPSglKTxlPCglKD0AAAEASQAAAjsDDAAlAAATND8BPgE7ATIWFRQGKwEiDwEGFB8BFjsBMhYVFAYrASImJyYnJkkYZRBLLboVHh4Vuh8NZw0NZw0fuhUeHhW6LEkSShwYAYY1MswkLx4UFR4cyxw8HMscHhQVHjAkjT4zAAACAEkAAAI7AwwAGwAoAAA3NDY7AREjIiY1NDY7ATIWHwEWFA8BDgErASImNzMyPwE2NTQvASYrAUkdFTExFR0dFbosSRJmGRllEEstuhUdyCQfDWcODmcNHyQzFB4CQh4VFB4wJMs0ZjTMJC8eRxzLIhgeHMscAAABAEkAAAI7AwwAGQAAMxEhMhYVFAYjIRUzMhYUBisBFSEyFhUUBiNJAb8VHh4V/qaUFB4eFJQBWhUeHhUDDB4UFR7uHiod7x4UFR4AAQBJAAACOwMMABYAADcRITIWFRQGIyEVMzIWFAYrAREUBiImSQG/FR4eFf6m9xUdHRX3HiodMwLZHhQVHpodKh7+ixUeHgAAAQBJAAACOwMMACoAADcRND8BNjsBMhYVFAYrASIPAQYVERQWOwEyNj0BIyImNDY7ARUUBisBIiZJKogtS5UVHh4VlRkPiBUeFMMUH2MVHR0VyFo+wz9YmAEPRTawOh4UFR4Urhwi/vEVHh4VZx0qHsw+WlkAAAAAAQBJAAACOwMMABsAADcRNDYyFhURIRE0NjIWFREUBiImNREhERQGIiZJHSoeASgdKh4eKh3+2B4qHTMCpxQeHhT+3wEhFB4eFP1ZFR4eFQEh/t8VHh4AAAEASQAAAjsDDAAfAAA3NDY7AREjIiY1NDYzITIWFRQGKwERMzIWFRQGIyEiJkkdFZSUFR0dFQGNFR4eFZSUFR4eFf5zFR0zFB4CQh4VFB4eFBUe/b4eFBUeHgAAAQB6AAACCQMMABsAADc1NDYyFh0BFBY7ATI2NRE0NjIWFREUBisBIiZ6HiodHhVfFR4dKh5aPl8+WpeaFR4eFZoVHR4UAkMUHh4U/b0+WVkAAAAAAQBJAAACOwMMAB4AADcRNDYyFh0BATYzMhYVFAcJARYVFAYjIicBFRQGIiZJHSoeATkPEhUeEv6gAWASHhUSD/7HHiodMwKnFB4eFOYBDAweFBgP/tP+0w8XFR4MAQzlFR4eAAEASQAAAjsDDAAOAAAzETQ2MhYVESEyFhUUBiNJHSoeAVoVHh4VAtoUHh4U/YseFBUeAAABAEkAAAI7AwwAGwAANxEzFzczERQGIiY1EQcVFAYjIiY9AScRFAYiJkl+e3p/HiodYh4UFR5hHiodMwLZr6/9JxUeHhUCTowaFR4eFRqK/bQVHh4AAAAAAQBJAAACOwMMABEAADcRMwERNDYyFhURIwERFAYiJkmFAQgdKh6G/vkeKh0zAtn9pgIoFB4eFP0mAlj92xUeHgAAAAACAEkAAAI7AwwAFgApAAATND8BPgEzMhYfARYUDwEOASMiJi8BJjcGFB8BFjMyPwE2NTQvASYjIgdJGGsQPyYnPxBrGRlrED8nJj8QaxhyDQ1sCBIUCGsODmwIExEJAYY1MtcfKSkf1zRmNNcfKSkf1y5zHDwc1hEQ1yIYHhzVEhIAAAACAEkAAAI7AwwADwAZAAA3ESEyFh0BFAYrARUUBiImEzMyNj0BNCYrAUkBWj5aWj71HiodZfUUHx8U9TMC2Vk+tD5a9hUeHgFwHhW0FB4AAAIASQAAAjsDDAAhAEAAADcRND8BNjMyFhURFA4FBxczMhYVFAYrAScHBiMiJjcUOwE3JyY1NDYzMh4DFz4ENRE0JisBBwYVSUbhIC8ySggUDiMOLAUYQRUeHhWGJUsiLTJIZRUIbCUDHhUNFA8IDAIEHw4UCQ0KB+giewEaXj2+Hkky/uYXKSUZIg0kBD0eFBUeXkAeSTIWXF4HCxUeCxoRJAQEGQ0aHBEBGgkMwx4wAAAAAAIASQAAAjsDDAAZACMAADcRITIWHQEUBisBExYVFAYjIicDIxEUBiImEzMyNj0BNCYrAUkBWj5aWz06ywceFR0P6UUeKh1l9RQfHxT1MwLZWj40Plr+pA4LFR4ZAY/+ixUeHgHvHxQ0FR4AAAEASQAAAjsDDAAsAAA3NDYyFhUUFjsBMjUBJj0BNDY7ATIWFRQGIiY1NCYrASIdAgEWFQ4BKwEiJkkdKh4UDvkN/ooXQy75N1EeKh0VDvkMAXQZAkEv+TdQhxUeHhUOFA0B4iAmAy1CUDcVHh4VDRUKAwT+Ih4oL0NQAAABAEkAAAI7AwwAGAAAEzUhFRQGIiY9ASMRFAYjIiY1ESMVFAYiJkkB8h4qHWIeFBUeYR4qHQKFh4cVHh4VIv2MFR4eFQJ0IhUeHgAAAQBJAAACOwMMABsAADcRNDYyFhURFBY7ATI2NRE0NjIWFREUBisBIiZJHSoeHhTDFB8dKh5aPsM+WZcCQxQeHhT9vRUdHhQCQxQeHhT9vT5ZWQAAAQBJAAACOwMMABUAABM1NDYyFh0BGwE1NDYyFh0BAwYjIidJHSoelJQdKh7KDSIjDQIltRQeHhSh/oYBeqEUHh4UtP36ICAAAQBJAAACOwMMACsAADcRNDYyFhURFzM+ATcRNDYzMhYVER4BFzM3ETQ2MhYVEQcGKwEiJwYrASInSR0qHhwpAhQGHhUUHgYUAikdHSoeOQ8dYiASFR5hHg96AmAUHh4U/bswAyYKAUMVHR0V/r0KJgMwAkUUHh4U/aBhGSMjGQABAEkAAAI7AwwAIwAANzQ3EwMmNTQ2MzIXGwE2MzIWFRQHAxMWFRQGIyInCwEGIyImSQa4uAYdFR0Pm5oPHRUeB7i4Bx4VHQ+amw8dFR0zDQwBOgE6DA4UHhn++AEIGR4UDA7+xv7GDgsVHhkBCP74GR4AAAEASQAAAjsDDAAZAAATNTQ2MhYdARc3NTQ2MhYdAQcRFAYjIiY1EUkdKh6Ukx4qHsceFBUeAnNnFB4eFES+vkQUHh4UZ/7+vhUeHhUBQgAAAQBIAAACOwMMABMAADcBISImNTQ2MyEVASEyFhUUBiMhSAFo/ssVHR0VAcD+mAE1FR4eFf5BQAJnHhUUHkD9mR4UFR4AAAAAAgBJAAACOwMMABcAGwAANxE0NjMhMhYVFAYrAREzMhYVFAYjISImNzMRI0kdFQGNFR4eFcbGFR4eFf5zFR1kMDAzAqcUHh4UFR79vh4UFR4eRwJCAAAAAAEASQAAAjsDDAAPAAATNDYzMhcBFhUUBiMiJwEmSR0VHQ8BjQceFR0P/nMGAtoUHhn9WQ4LFR4ZAqcMAAIASQAAAjsDDAAXABsAADc0NjsBESMiJjU0NjMhMhYVERQGIyEiJiUzESNJHRXGxhUdHRUBjRUeHhX+cxUdAV0wMDMUHgJCHhUUHh4U/VkVHh5HAkIAAAABAEgAfwI7AmIAFAAANxM2MzIXExYVFAYjIi8BBwYjIiY1SM0NIB4OyAUeFRsOnZ4OGxUdvgGJGxv+gAwJFR4V7OwVHhUAAAABAEn/mwI7AAAADQAAFzQ2MyEyFhUUBiMhIiZJHRUBjRUeHhX+cxUdMhQeHhQVHh4AAAAAAQB6AagCCQMMABAAABM0NjsBMhcTFhUUBiMiJwEmeh4VYxoOywYeFRAQ/tYSAtoUHhP++gsNFR4MAP8PAAAAAAIASQAAAjsCOAAmADQAADc1NDY7ATIXNC4FKwEiJjQ2OwEyFhcTFAYjIiY1BwYrASImNxQWOwE3NTQmKwEiBhVJWD3BGBQBAQMGCxEMuhUdHRW6PVcCDR8VFB1KCg+VPVhlHBSHax8SwRMdljg+WAcHIQ8cDRAGHSoeVTz+ixUdHhQrB1g+FB0/LBIdHRQAAAIASQAAAjsDDAApAEMAADcRNDYyFh0BNjsBMh4FFxYdARQOBA8BBisBIi4BJxUUBiImNxQfARY7ATI+ATc2PQE0LgEnJisBIg8BBhVJHSoeRENLDRgYDhgHGwE1BA4HGgURESk4Sx02HRceKh1lEVYMFEsOFh4CEg0fARUUSxQMVhEzAqcUHh4U4kADCwUTBRcBLkTOEBsaDxoGDw4kFhcVDxUeHsIXDkoMDB4BDhfODhQaARMMSgsaAAAAAQBJAAACOwI4ACYAADc1NDc+AzsBMhYUBisBIg8BBh0BFB8BFjsBMhYVFAYrASIvASZJNAszITof0xUeHhXTFAxWERFWDBTTFR4eFdM5KVY04HhFLQkxGxkeKh0MSgsaeBcPSQweFBUeJEotAAAAAAIASQAAAjsDDAAtAEgAADc1NDY3Njc2OwEyHgQXNTQ2MhYVERQGIiY9AQ4CKwEiLgcnJjcUHgIXFjsBMj8BNj0BNC8BJisBIg4BBwYVSSonBQMpOEsQHhMeCB8CHSoeHiodFx02HksLExMOEQoRBhMCNGUMDRgEDxFLEg5WEhJWDBRLDhcaBBK1zjA7IAQCJAcHFAYcAecUHh4U/VkVHh4VEBYXFgIGBQoGDgURAitHDBYMEwMMDEoNGHgVEEoMDRoDEBYAAAAAAgBJAAACOwI4ADQAQQAANzU0PgE3NjsBMh4GHwEWHQEUBiMhFRQeAhcWMyEyFhUUBiMhIi4HJyY3ITU0JisBIg4BBwYVSSAaHyk4fQoTFAwUBxQECws1HhX+pgwNGAQPEQEFFR4eFf77CxMTDhEKEQYTAjRlASg8Gn0OFh4CEbXOIzwYGiQCBgQMBBECCgouRHwVHh8MFgwTAwweFBUeAgYFCgYOBRECK8tKGjYMHgEOFwAAAQBhAAACIQMMACQAABI0NjsBNTQ2OwEyFhUUBisBIgYdATMyFhQGKwERFAYiJjURIyJhHRUxaEp5FR0dFXkgLWMUHh4UYx0qHjEVAfAqHiJKaB4UFR4tICIeKh3+YBUeHhUBoAAAAAACAEn/LAI7AjgAQgBZAAA3NTQ+CDc2OwEyHgQXNTQ2MhYVERQOBA8BBisBIiY0NjsBMj4BNzY9AQ4CKwEiLgMvASY3FBY7ATI/ATY9ATQvASYrASIOAQcGFUkDAwsEEAQVAxcBKThLEB4THggfAh0qHgQOBxoFEREpONMVHh4V0w4XHAMSFx42HUsPHxIeBxARNGQ7G0sUDFYSElYMFEsPFxgGEuCjCxYQFAoTBhIDEwEkBwcUBhwBEhUeHhX93BAbGg8aBg8OJB0qHg4aAw4XjRUYFwcGFQUPDi1FGzYMSg4XThUQSgwOGAQSFAAAAAABAEkAAAI6AwwAIAAANxE0NjIWHQE3NjsBMhYXExQGIyImNQMuASsBBxEUBiImSR0qHmAmKzk9VwIMHRUUHg0CGxRHox4qHTMCpxQeHhT3PRhVPP6MFR4dFAFzExxp/skVHh4AAgB6AAACCQM2ABoAKgAANzQ2OwERIyImNDY7ATIWFREzMhYVFAYjISImEzU0NjsBMhYdARQGKwEiJnoeFWNjFR4eFZUUHmIVHh4V/tcVHmMeFTIUHh4UMhUeMxQeAW4dKh4eFf5gHhQVHh4CvCoVHR0VKhUeHgAAAgB6/ywCCQM2AB8ALwAAFzQ2MzIeAjsBMjY1ESMiJjQ2OwEyFhURFAYrASImJxM1NDY7ATIWHQEUBisBIiZ6HhUUGAkZFWIUH5UVHh4VxhUeWT5iOFYI+B4VMRUeHhUxFR5NFR4bHxsdFAIRHSoeHhX9vT5YSjUDLyoVHR0VKhUeHgAAAQBJAAACOwMMAB8AADcRNDYyFhURJTYzMhYVFA8BFxYVFAYjIiclBxUUBiImSR0qHgEIDhIVHhLL/RIdFRMP/vcwHiodMwKnFB4eFP5x4QweFRcPrtgPFxUeDOMqkhUeHgAAAAEAegAAAgkDDAAbAAA3NDY7AREjIiY1NDY7ATIWFREzMhYVFAYjISImeh4VYmIVHh4VlRQeYhUeHhX+1xUeMxQeAkIeFRQeHhT9ix4UFR4eAAAAAAEAQQAAAkICOAAuAAA3ETQ2MzIWFzYzMhc3NjMyFhcTFAYjIiYnAyYrAQcRFAYjIiY1ETQrAQcRFAYiJkEdFRAbBSktPSQWISovSAEPHRUUHgEOAg8GRB4UFR4WCEseKh0zAdIVHhQPIzASG0Iv/m8VHh0UAY8TOv6aFR4eFQGKFkH+oRUeHgABAEkAAAI6AjgAIAAANxE0NjIWHQE3NjsBMhYXExQGIyImNQMuASsBBxEUBiImSR0qHmAmKzk9VwIMHRUUHg0CGxRHox4qHTMB0hUeHhUiPRhVPP6MFR4dFAFzExxp/skVHh4AAgBJAAACOwI4ACYAQAAANzU0PgE3NjsBMh4FFxYdARQOBA8BBisBIi4EJyY3FB4CFxY7ATI+ATc2PQE0JisBIg4BBwYVSSAaHyk4fQ0YGA4YBxsBNQQOBxoFEREpOH0QHRQbCxsENGUMDRgEDxF9DhYeAhI8Gn0OFh4CEbXOIzwYGiQDCwUTBRcBLkTOEBsaDxoGDw4kBwcSCBgDK0cMFgwTAwwMHgEOF84aNgweAQ4XAAAAAgBJ/ywCOwJNACwASgAAFxE0NjIWHQE+CDsBMh4BFx4EHQEUDwEGKwEiLgEnFRQGIiYTFB4CFx4CFxY7ATI/ATY9ATQvASYrASIPAQYVSR0qHgITBhIKEg8TFQsVHTcbGQIwDB0KNVYpORUfNyAVHiodZQoKFQMHGBQJDhUVFAxXERFXDBQVFQ5aDqICvRQeHhQbAhQFEQYNBQcCGBUXAikPJiYXoUQuSiQYHBfYFR0dAZIMFQsSAwcZFAgODEoNGKEYDUsMDlsLFwAAAgBJ/ywCOwI4AC0ASAAANzU0Njc2NzY7ATIeBBc1NDYyFhURFAYiJj0BDgIrASIuBycmNxQeAhcWOwEyPwE2PQE0LwEmKwEiDgEHBhVJKicFAyk4SxAeEx4IHwIdKh4eKh0XHTYeSwsTEw4RChEGEwI0ZQwNGAQPEUsSDlYSElYMFEsOFxoEErXOMDsgBAIkBwcUBhwBEhUeHhX9WRUdHRXlFhcWAgYFCgYOBRECK0cMFgwTAwwMSg0YeBUQSgwNGgMQFgAAAAABAEkAAAI7AjgAHwAANxE0NjIWHQE3NjsBMhYdARQGIiY9ATQmKwEHERQGIiZJHSoedwsSYz1ZHiodHRRRph4qHTMB0hUeHhU7ZghZPRwVHR0VHBQdj/7vFR4eAAEASQAAAjoCOAA0AAA3NDYzMhYXHgE7ATI2NTQnJS4BNTQ3NjsBMhcWFRQGIyImKwEiBhUUFwUeAR0BDgErASInJkkcFRImCQIUBMsYGx3+6yIqJSY11kswCh4VEi0T1g0PEAEWJjUBWj+9ST4TXRUdHQMBCSAWIg14D0MnMyQmPw0RFR4rEgsSBngRTS4CP1k1EAABAEkAAAI7AuIAKgAAEjQ2OwE1NDYyFh0BMzIWFAYrAREUFjsBMj4CMzIWHQEOASsBIiY1ESMiSR0VMR0qHsUVHR0VxRwUZBQZCRkUFR4KVTdkPVgxFQHwKh53FR4eFXceKh3+wxQdGx8bHhUINEtZPQE9AAEASQAAAjsCOAAgAAATNDYzMhYVEx4BOwE3ETQ2MhYVERQGIiY9AQcGKwEiJidJHRUUHg0CGxRHpB0qHh4qHWEmKzk8WAICBRUeHRT+jRQbaAE4FR4eFf4uFR4eFSM+GFU7AAABAEkAAAI7AjgAGgAAEzU0NjIWHQEbATU0NjIWHQEUBwMGKwEiJwMmSR0qHpOVHSoeBacNIT8hDacEAbBVFR4eFUr+rQFTShUeHhVVCgr+gh4eAX4IAAAAAQA+AAACRQI4ACsAABM0NjMyFhcTFzc1NDYzMhYdARc3Ez4BMhYdAQMHDgErASIvAQcGKwEiJi8BPh4VFB0BCiBCHhUUHkIgCgEdKB8LMwUbETEdDzc4Dx0xERsFNAIEFR8dFP7dbHJyFB4eFHJybAEjFB0eFAL+yqoQFBlfXxkUELYAAQBJAAACOwI4ACMAADc0PwEnJjU0NjMyHwE3NjMyFhUUDwEXFhUUBiMiLwEHBiMiJkkKraEMHhUXEJWUEBcVHgyhrQseFRgPn6APGBUdMxMN0MIPERUeE7OzEx4VEQ/C0A4SFR4SwcESHgAAAQBJ/ywCOwI4ACMAABY0NjsBNyMiJwMmPQE0NjIWHQETMxM1NDYyFh0BFAcBBisBIkkdFWdDFSIMlQQdKh6DIIQeKh4F/vwNIogVtyoemR8BUwgMVRUeHhVK/tQBLEoVHh4VVQoK/a4eAAAAAQBJAAACOwI4ABwAADc1NDcBISImNDYzITIWHQEUBwEhMhYVFAYjISImSQ8BYP7bFR0dFQF1FR4Q/qEBPBUeHhX+cxUdMyoXDQFSHSoeHhUqFRD+rx4UFR4eAAABAEkAAAI7AwwAKgAAEjQ2OwEyNj0BNDY7ATIWFRQGKwEVFAcWHQEzMhYVFAYrASImPQE0JisBIkkdFWEWHT0olBUeHhWUJyeUFR4eFZQoPR4VYRUBcSoeHRW8KTweFBUevDksLDm8HhQVHjwpvBQfAAAAAAIBDwAAAXQDDAAIABEAACURMxEUBiMiJhkBNDYzMhYVEQEPZR4UFR4eFRQeMwEh/t8VHh4BmwEhFB4eFP7fAAABAEkAAAI7AwwAKgAANzQ2OwE1NDcmPQEjIiY1NDY7ATIWHQEUFjsBMhYUBisBIgYdARQGKwEiJkkdFZQnJ5QVHR0VlCk8HRViFR4eFWIVHTwplBUdMxQevDksLDm8HhUUHjwpvBQeHiodHxS8KTweAAAAAAEASQGqAjsDCwAmAAATNTQ2MzIWHQEUFjI2PQE0NjIWHQEUBiMiJyY9ATQmIgYdARQGIiZJXTw6WB0oHR0qHlw9PCssHSgcHiodAgVvQVZYPzQUHx8UbxUeHhVvQVUrLj00FB4eFG8VHR0AAAEAcQAAAmMDDAATAAAzETQ2MhYdATMRIREUBiImPQEjEXEdKh5hASweKh1iATEVHh4VzAKn/s8VHh4VzP1ZAAABAHEAAAJjAwwAFQAANxEhETQ2MhYVERQGIiY1ESERFAYiJnEBjR0qHh4qHf7YHiodMwGGASEUHh4U/VkVHh4VASH+3xUeHgABAHEAAAJjAwwAGAAAExE0NjIWFREhETQ2MhYVESMRFAYjIiY1EXEdKh4BKB0qHsceFBUeAVQBhhQeHhT+3wEhFB4eFP56/t8VHh4VASEAAAEBN/+bAZwEUgADAAAFETMRATdlZQS3+0kAAAABAFf/5wJ8AyUAAwAAFxEhEVcCJRkDPvzCAAAAAQDtAAAB5gD6AA8AADc1NDY7ATIWHQEUBisBIibtHRWVFR0dFZUVHTOUFR4eFZQVHh4AAAEAcQAAAmMDDAAeAAATNDcBNjIfARYdARQHBRUUBiImPQE0NyU1JwUGIyImcREBKg8kD2MSEv7oHiodEQEZMf73DxIVHQHbGA4A/wwMVQ8XVRcQ7+cVHh4V/hkO7yYq4wweAAABAQMBqAHRAwwAEwAAATQ2OwEyFhUUBhUDFAYiJjU0NjUBAyAVYxQiATMfKCEBAtoUHhoSAQQB/wAUHhoSAQQBAAAAAAEA1AAAAf8BZAAUAAATNTQ2OwEyFh0BFAYrASImPQEjIibUHRXHFR0dFTIVHWMVHQEHKhUeHhX+FR4eFaEeAAABAHEBVAJjAbkACwAAEjQ2MyEyFhQGIyEicR0VAY0VHh4V/nMVAXEqHh4qHQAAAAAAAA4ArgABAAAAAAAAAFYArgABAAAAAAABAAQBDwABAAAAAAACAAcBJAABAAAAAAADACEBcAABAAAAAAAEAAUBngABAAAAAAAFAAoBugABAAAAAAAGAAQBzwADAAEECQAAAKwAAAADAAEECQABAAgBBQADAAEECQACAA4BFAADAAEECQADAEIBLAADAAEECQAEAAoBkgADAAEECQAFABQBpAADAAEECQAGAAgBxQBNAGEAdAB0AGgAZQB3ACAAUwBrAGEAbABhACAAKAAyADAAMQAxAC0AMQAyACkAOwAgAGIAYQBzAGUAZAAgAG8AbgAgAGMAbwBkAGUAIABiAHkAIABSAGkAYwBoAGEAcgBkACAAQgAuACAAVwBhAGwAZQBzACAAKAAxADkAOAA4AC0AOAA5ACkAIABhAG4AZAAgAFQAbwByACAATABpAGwAbABxAHYAaQBzAHQAAE1hdHRoZXcgU2thbGEgKDIwMTEtMTIpOyBiYXNlZCBvbiBjb2RlIGJ5IFJpY2hhcmQgQi4gV2FsZXMgKDE5ODgtODkpIGFuZCBUb3IgTGlsbHF2aXN0AABPAEMAUgBBAABPQ1JBAABSAGUAZwB1AGwAYQByAABSZWd1bGFyAABGAG8AbgB0AEYAbwByAGcAZQAgADIALgAwACAAOgAgAE8AQwBSACAAQQAgADoAIAAyADcALQA5AC0AMgAwADEAMgAARm9udEZvcmdlIDIuMCA6IE9DUiBBIDogMjctOS0yMDEyAABPAEMAUgAgAEEAAE9DUiBBAABWAGUAcgBzAGkAbwBuACAAMgAgAABWZXJzaW9uIDIgAABPAEMAUgBBAABPQ1JBAAAAAAIAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAbAAAAAEAAgADAAQABQAGAAcACAAJALcACwAMAA0ADgAPABAAEQASABMAFAAVABYAFwAYABkAGgAbABwAHQAeAB8AIAAhACIAIwAkACUAJgAnACgAKQAqACsALAAtAC4ALwAwADEAMgAzADQANQA2ADcAOAA5ADoAOwA8AD0APgA/AEAAQQBCALYARABFAEYARwBIAEkASgBLAEwATQBOAE8AUABRAFIAUwBUAFUAVgBXAFgAWQBaAFsAXABdAF4AXwBgAGEBAgEDAQQBBQEGAQcBCAEJAQoBCwd1bmkyNDQwB3VuaTI0NDEHdW5pMjQ0MghTRjExMDAwMAtibGFja3NxdWFyZQpwZXJpb2QuYWx0DHF1ZXN0aW9uLmFsdA9xdW90ZXNpbmdsZS5hbHQJY29tbWEuYWx0Cmh5cGhlbi5hbHQAAAAB//8AAgABAAAADgAAABgAAAAAAAIAAQADAGsAAQAEAAAAAgAAAAEAAAAKAEQAogACREZMVAAObGF0bgAkAAQAAAAA//8ABgAAAAEAAgADAAQABQAEAAAAAP//AAYAAAABAAIAAwAEAAUABmFhbHQAJnNzMDEALHNzMDIAMnNzMDMAOHNzMDQAPnNzMDUARAAAAAEAAAAeAAEAAQAcAAEAAgAaAAEAAwAYAAEABAAWAAEABQAAAQAAAAEBAAABAgAAAQMAAAEEAAYADgAWAB4AJgAuADYAAwAAAAEAMAABAAAAAQBkAAEAAAABAGgAAQAAAAEAbAABAAAAAQBwAAEAAAABAHQAAQAuAAUAEAAWABwAIgAoAAIACgBpAAIADwBqAAIAEABrAAIAEQBnAAIAIgBoAAEABQAKAA8AEAARACIAAQAGAFYAAQABABEAAQAGAEYAAQABACIAAQAGAF8AAQABAAoAAQAGAFsAAQABAA8AAQAGAFsAAQABABAAAQAAAAoALAAuAAJERkxUAA5sYXRuABgABAAAAAD//wAAAAQAAAAA//8AAAAAAAAAAAABAAAAAMw9os8AAAAA1gbbzAAAAADaAyOv"),FontLib.loadFont("OCR-B",96,100,"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");const BwipJs={toCanvas:ToCanvas,toSVG:ToSVG,render:Render,raw:ToRaw,drawingCanvas:DrawingCanvas,drawingSVG:DrawingSVG,fixupOptions:FixupOptions,loadFont:LoadFont,FontLib,BWIPJS_VERSION,BWIPP_VERSION};let customBcid=["ean13","upca","upce","ean8"];function generateCanvas(tg){var Ig;if(tg.barcolor&&(tg.barcolor.charAt(0)==="#"?tg.barcolor.length>7&&(tg.barcolor=tg.barcolor.substring(0,7)):tg.barcolor.length>6&&(tg.barcolor=tg.barcolor.substring(0,6))),tg.extra&&(tg.bcid.startsWith("aztec")&&(Ig=tg.extra)!=null&&Ig.version&&(tg.extra.layers=tg.extra.version),tg.extra.version&&tg.bcid==="micropdf417")){const og=tg.extra.version.split("x");og.length==2&&(tg.extra.version=og[1]+"x"+og[0])}const eg=document.createElement("canvas");tg.width&&tg.height&&(eg.width=tg.width,eg.height=tg.height);let gg=tg.extra||{};const ig={...tg,...gg,textcolor:""};return customBcid.includes(ig.bcid)&&(ig.textsize=1),BwipJs.toCanvas(eg,ig),eg}const mixMultCode={LPMixQrCode:[{label:"龙贝码",value:""},{label:"QR Code",value:""}]},OBJECT_NAME_MAP={text:"文本",textname:"名字",image:"图片",rect:"矩形",triangle:"三角形",table:"表格",circle:"圆形",line:"直线",barcode:"条码",barcode2d:"二维码",counter:"日期计数器",group:"组合"},canvasNameMap=new WeakMap;function initCountObjsName(tg,eg){let gg=tg.filter(ig=>ig.id!=="workspace");deepTraverse(gg,ig=>{addObjName(eg,ig,"init")})}function deepTraverse(tg,eg){const gg=[...tg];let ig=gg.length;for(;gg.length>0;){const Ig=gg.shift();let og=!1;ig>0&&(ig--,og=!0),Ig.type==="group"?(eg&&eg(Ig,og),gg.push(...Ig.getObjects())):eg&&eg(Ig,og)}}function addObjName(tg,eg,gg="add"){canvasNameMap.has(tg)||canvasNameMap.set(tg,{});let ig=canvasNameMap.get(tg);ig[eg.type]?ig[eg.type]++:ig[eg.type]=1,gg==="add"&&(eg.name=OBJECT_NAME_MAP[eg.type]+ig[eg.type])}const cloneCommonField=["id","name","locked","databaseSheet","databaseColumn","outsideInput","hasControls","hasBorders","fromJson","jsonFieldKey","databaseTid","increaseCount","fromBarCode","fromBarCode2d","fromBarCode2dID","increaseDate","barcodeDateFormatType","addCombObject","databaseMixConcat","rows","columns","tableTexts","tableCellStyles","tableCellBorders","tableCellSpans","columnWidths","rowHeights","fontSize","fontFamily","fontWeight","fontStyle","underline","linethrough","charSpacing","lineHeight","textAlign","verticalType"];let targetDPI=203;const setTargetDpi=tg=>{targetDPI=tg||203},getTargetDpi=()=>targetDPI||203;function anyRgbToHex(tg){const eg=tg.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)/i);if(!eg)return tg;const gg=ig=>Math.min(255,Math.max(0,parseInt(ig))).toString(16).padStart(2,"0").toUpperCase();return`#${gg(eg[1])}${gg(eg[2])}${gg(eg[3])}`}function expandHexColor(tg){const eg=tg.startsWith("#")?tg.slice(1):tg;if(eg.length!==3)throw new Error("请输入一个有效的3位16进制颜色代码");return"#"+eg.split("").map(ig=>ig+ig).join("")}function addAlphaToHex(tg,eg){let gg=tg.replace("#","").toUpperCase();return typeof eg=="number"&&(gg=gg+Math.round(eg/100*255).toString(16).padStart(2,"0")),"#"+gg}function hexToHex6_blend(tg,eg="#FFFFFF"){if(!tg)return tg;let gg=tg.replace("#","").toUpperCase();if(gg.length===3&&(gg=gg.split("").map(cg=>cg+cg).join("")),gg.length===4&&(gg=gg.split("").map(cg=>cg+cg).join("")),gg.length===6)return`#${gg}`;if(gg.length!==8)return tg;const ig=parseInt(gg.slice(0,2),16),Ig=parseInt(gg.slice(2,4),16),og=parseInt(gg.slice(4,6),16),ng=parseInt(gg.slice(6,8),16)/255,sg=eg.replace("#",""),ag=parseInt(sg.slice(0,2),16),Cg=parseInt(sg.slice(2,4),16),lg=parseInt(sg.slice(4,6),16),Ag=(cg,rg)=>Math.round(cg*ng+rg*(1-ng));return"#"+[Ag(ig,ag),Ag(Ig,Cg),Ag(og,lg)].map(cg=>cg.toString(16).padStart(2,"0")).join("")}function rgbaStringToHex8(tg){const eg=tg.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);if(!eg)return tg;const[,gg,ig,Ig,og=1]=eg,ng=ag=>Number(ag).toString(16).padStart(2,"0"),sg=Math.round(og*255);return`#${ng(gg)}${ng(ig)}${ng(Ig)}${ng(sg)}`}function splitLongWord(tg,eg,gg){const ig=[];let Ig="";for(const og of eg){const ng=Ig+og;tg.measureText(ng).width>gg?(ig.push(Ig),Ig=og):Ig=ng}return Ig&&ig.push(Ig),ig}function wrapText(tg,eg,gg,ig){return ig&&(tg.font=ig),eg.split(`
|
|
906
|
-
`).flatMap(Ig=>{let og="";const ng=Ig.split(/\s+/).filter(sg=>sg);return ng.reduce((sg,ag,Cg)=>{const lg=og?`${og} ${ag}`:ag;return tg.measureText(lg).width<=gg?og=lg:(og&&sg.push(og),og=ag,(Cg===ng.length-1||tg.measureText(ag).width>gg)&&(sg.push(...splitLongWord(tg,ag,gg)),og="")),Cg===ng.length-1&&og&&sg.push(og),sg},[])})}function getLineHeight(tg){const eg=tg.font.match(/\d+/),gg=10;return eg?parseInt(eg[0],gg):gg}function generateThumbnail(tg,eg,gg){let{width:ig,height:Ig}=tg;const og=Math.min(eg/ig,gg/Ig);ig*=og,Ig*=og;const ng=document.createElement("canvas"),sg=ng.getContext("2d");if(!sg)throw new Error("Canvas context not available");return ng.width=ig,ng.height=Ig,sg.drawImage(tg,0,0,ig,Ig),ng.toDataURL("image/png",.85)}class LuxonError extends Error{}class InvalidDateTimeError extends LuxonError{constructor(eg){super(`Invalid DateTime: ${eg.toMessage()}`)}}class InvalidIntervalError extends LuxonError{constructor(eg){super(`Invalid Interval: ${eg.toMessage()}`)}}class InvalidDurationError extends LuxonError{constructor(eg){super(`Invalid Duration: ${eg.toMessage()}`)}}class ConflictingSpecificationError extends LuxonError{}class InvalidUnitError extends LuxonError{constructor(eg){super(`Invalid unit ${eg}`)}}class InvalidArgumentError extends LuxonError{}class ZoneIsAbstractError extends LuxonError{constructor(){super("Zone is an abstract class")}}const n="numeric",s="short",l="long",DATE_SHORT={year:n,month:n,day:n},DATE_MED={year:n,month:s,day:n},DATE_MED_WITH_WEEKDAY={year:n,month:s,day:n,weekday:s},DATE_FULL={year:n,month:l,day:n},DATE_HUGE={year:n,month:l,day:n,weekday:l},TIME_SIMPLE={hour:n,minute:n},TIME_WITH_SECONDS={hour:n,minute:n,second:n},TIME_WITH_SHORT_OFFSET={hour:n,minute:n,second:n,timeZoneName:s},TIME_WITH_LONG_OFFSET={hour:n,minute:n,second:n,timeZoneName:l},TIME_24_SIMPLE={hour:n,minute:n,hourCycle:"h23"},TIME_24_WITH_SECONDS={hour:n,minute:n,second:n,hourCycle:"h23"},TIME_24_WITH_SHORT_OFFSET={hour:n,minute:n,second:n,hourCycle:"h23",timeZoneName:s},TIME_24_WITH_LONG_OFFSET={hour:n,minute:n,second:n,hourCycle:"h23",timeZoneName:l},DATETIME_SHORT={year:n,month:n,day:n,hour:n,minute:n},DATETIME_SHORT_WITH_SECONDS={year:n,month:n,day:n,hour:n,minute:n,second:n},DATETIME_MED={year:n,month:s,day:n,hour:n,minute:n},DATETIME_MED_WITH_SECONDS={year:n,month:s,day:n,hour:n,minute:n,second:n},DATETIME_MED_WITH_WEEKDAY={year:n,month:s,day:n,weekday:s,hour:n,minute:n},DATETIME_FULL={year:n,month:l,day:n,hour:n,minute:n,timeZoneName:s},DATETIME_FULL_WITH_SECONDS={year:n,month:l,day:n,hour:n,minute:n,second:n,timeZoneName:s},DATETIME_HUGE={year:n,month:l,day:n,weekday:l,hour:n,minute:n,timeZoneName:l},DATETIME_HUGE_WITH_SECONDS={year:n,month:l,day:n,weekday:l,hour:n,minute:n,second:n,timeZoneName:l};class Zone{get type(){throw new ZoneIsAbstractError}get name(){throw new ZoneIsAbstractError}get ianaName(){return this.name}get isUniversal(){throw new ZoneIsAbstractError}offsetName(eg,gg){throw new ZoneIsAbstractError}formatOffset(eg,gg){throw new ZoneIsAbstractError}offset(eg){throw new ZoneIsAbstractError}equals(eg){throw new ZoneIsAbstractError}get isValid(){throw new ZoneIsAbstractError}}let singleton$1=null;class SystemZone extends Zone{static get instance(){return singleton$1===null&&(singleton$1=new SystemZone),singleton$1}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(eg,{format:gg,locale:ig}){return parseZoneInfo(eg,gg,ig)}formatOffset(eg,gg){return formatOffset(this.offset(eg),gg)}offset(eg){return-new Date(eg).getTimezoneOffset()}equals(eg){return eg.type==="system"}get isValid(){return!0}}const dtfCache=new Map;function makeDTF(tg){let eg=dtfCache.get(tg);return eg===void 0&&(eg=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:tg,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),dtfCache.set(tg,eg)),eg}const typeToPos={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function hackyOffset(tg,eg){const gg=tg.format(eg).replace(/\u200E/g,""),ig=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(gg),[,Ig,og,ng,sg,ag,Cg,lg]=ig;return[ng,Ig,og,sg,ag,Cg,lg]}function partsOffset(tg,eg){const gg=tg.formatToParts(eg),ig=[];for(let Ig=0;Ig<gg.length;Ig++){const{type:og,value:ng}=gg[Ig],sg=typeToPos[og];og==="era"?ig[sg]=ng:isUndefined$1(sg)||(ig[sg]=parseInt(ng,10))}return ig}const ianaZoneCache=new Map;class IANAZone extends Zone{static create(eg){let gg=ianaZoneCache.get(eg);return gg===void 0&&ianaZoneCache.set(eg,gg=new IANAZone(eg)),gg}static resetCache(){ianaZoneCache.clear(),dtfCache.clear()}static isValidSpecifier(eg){return this.isValidZone(eg)}static isValidZone(eg){if(!eg)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:eg}).format(),!0}catch{return!1}}constructor(eg){super(),this.zoneName=eg,this.valid=IANAZone.isValidZone(eg)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(eg,{format:gg,locale:ig}){return parseZoneInfo(eg,gg,ig,this.name)}formatOffset(eg,gg){return formatOffset(this.offset(eg),gg)}offset(eg){if(!this.valid)return NaN;const gg=new Date(eg);if(isNaN(gg))return NaN;const ig=makeDTF(this.name);let[Ig,og,ng,sg,ag,Cg,lg]=ig.formatToParts?partsOffset(ig,gg):hackyOffset(ig,gg);sg==="BC"&&(Ig=-Math.abs(Ig)+1);const cg=objToLocalTS({year:Ig,month:og,day:ng,hour:ag===24?0:ag,minute:Cg,second:lg,millisecond:0});let rg=+gg;const ug=rg%1e3;return rg-=ug>=0?ug:1e3+ug,(cg-rg)/(60*1e3)}equals(eg){return eg.type==="iana"&&eg.name===this.name}get isValid(){return this.valid}}let intlLFCache={};function getCachedLF(tg,eg={}){const gg=JSON.stringify([tg,eg]);let ig=intlLFCache[gg];return ig||(ig=new Intl.ListFormat(tg,eg),intlLFCache[gg]=ig),ig}const intlDTCache=new Map;function getCachedDTF(tg,eg={}){const gg=JSON.stringify([tg,eg]);let ig=intlDTCache.get(gg);return ig===void 0&&(ig=new Intl.DateTimeFormat(tg,eg),intlDTCache.set(gg,ig)),ig}const intlNumCache=new Map;function getCachedINF(tg,eg={}){const gg=JSON.stringify([tg,eg]);let ig=intlNumCache.get(gg);return ig===void 0&&(ig=new Intl.NumberFormat(tg,eg),intlNumCache.set(gg,ig)),ig}const intlRelCache=new Map;function getCachedRTF(tg,eg={}){const{base:gg,...ig}=eg,Ig=JSON.stringify([tg,ig]);let og=intlRelCache.get(Ig);return og===void 0&&(og=new Intl.RelativeTimeFormat(tg,eg),intlRelCache.set(Ig,og)),og}let sysLocaleCache=null;function systemLocale(){return sysLocaleCache||(sysLocaleCache=new Intl.DateTimeFormat().resolvedOptions().locale,sysLocaleCache)}const intlResolvedOptionsCache=new Map;function getCachedIntResolvedOptions(tg){let eg=intlResolvedOptionsCache.get(tg);return eg===void 0&&(eg=new Intl.DateTimeFormat(tg).resolvedOptions(),intlResolvedOptionsCache.set(tg,eg)),eg}const weekInfoCache=new Map;function getCachedWeekInfo(tg){let eg=weekInfoCache.get(tg);if(!eg){const gg=new Intl.Locale(tg);eg="getWeekInfo"in gg?gg.getWeekInfo():gg.weekInfo,"minimalDays"in eg||(eg={...fallbackWeekSettings,...eg}),weekInfoCache.set(tg,eg)}return eg}function parseLocaleString(tg){const eg=tg.indexOf("-x-");eg!==-1&&(tg=tg.substring(0,eg));const gg=tg.indexOf("-u-");if(gg===-1)return[tg];{let ig,Ig;try{ig=getCachedDTF(tg).resolvedOptions(),Ig=tg}catch{const ag=tg.substring(0,gg);ig=getCachedDTF(ag).resolvedOptions(),Ig=ag}const{numberingSystem:og,calendar:ng}=ig;return[Ig,og,ng]}}function intlConfigString(tg,eg,gg){return(gg||eg)&&(tg.includes("-u-")||(tg+="-u"),gg&&(tg+=`-ca-${gg}`),eg&&(tg+=`-nu-${eg}`)),tg}function mapMonths(tg){const eg=[];for(let gg=1;gg<=12;gg++){const ig=DateTime.utc(2009,gg,1);eg.push(tg(ig))}return eg}function mapWeekdays(tg){const eg=[];for(let gg=1;gg<=7;gg++){const ig=DateTime.utc(2016,11,13+gg);eg.push(tg(ig))}return eg}function listStuff(tg,eg,gg,ig){const Ig=tg.listingMode();return Ig==="error"?null:Ig==="en"?gg(eg):ig(eg)}function supportsFastNumbers(tg){return tg.numberingSystem&&tg.numberingSystem!=="latn"?!1:tg.numberingSystem==="latn"||!tg.locale||tg.locale.startsWith("en")||getCachedIntResolvedOptions(tg.locale).numberingSystem==="latn"}class PolyNumberFormatter{constructor(eg,gg,ig){this.padTo=ig.padTo||0,this.floor=ig.floor||!1;const{padTo:Ig,floor:og,...ng}=ig;if(!gg||Object.keys(ng).length>0){const sg={useGrouping:!1,...ig};ig.padTo>0&&(sg.minimumIntegerDigits=ig.padTo),this.inf=getCachedINF(eg,sg)}}format(eg){if(this.inf){const gg=this.floor?Math.floor(eg):eg;return this.inf.format(gg)}else{const gg=this.floor?Math.floor(eg):roundTo(eg,3);return padStart(gg,this.padTo)}}}class PolyDateFormatter{constructor(eg,gg,ig){this.opts=ig,this.originalZone=void 0;let Ig;if(this.opts.timeZone)this.dt=eg;else if(eg.zone.type==="fixed"){const ng=-1*(eg.offset/60),sg=ng>=0?`Etc/GMT+${ng}`:`Etc/GMT${ng}`;eg.offset!==0&&IANAZone.create(sg).valid?(Ig=sg,this.dt=eg):(Ig="UTC",this.dt=eg.offset===0?eg:eg.setZone("UTC").plus({minutes:eg.offset}),this.originalZone=eg.zone)}else eg.zone.type==="system"?this.dt=eg:eg.zone.type==="iana"?(this.dt=eg,Ig=eg.zone.name):(Ig="UTC",this.dt=eg.setZone("UTC").plus({minutes:eg.offset}),this.originalZone=eg.zone);const og={...this.opts};og.timeZone=og.timeZone||Ig,this.dtf=getCachedDTF(gg,og)}format(){return this.originalZone?this.formatToParts().map(({value:eg})=>eg).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const eg=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?eg.map(gg=>{if(gg.type==="timeZoneName"){const ig=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...gg,value:ig}}else return gg}):eg}resolvedOptions(){return this.dtf.resolvedOptions()}}class PolyRelFormatter{constructor(eg,gg,ig){this.opts={style:"long",...ig},!gg&&hasRelative()&&(this.rtf=getCachedRTF(eg,ig))}format(eg,gg){return this.rtf?this.rtf.format(eg,gg):formatRelativeTime(gg,eg,this.opts.numeric,this.opts.style!=="long")}formatToParts(eg,gg){return this.rtf?this.rtf.formatToParts(eg,gg):[]}}const fallbackWeekSettings={firstDay:1,minimalDays:4,weekend:[6,7]};class Locale{static fromOpts(eg){return Locale.create(eg.locale,eg.numberingSystem,eg.outputCalendar,eg.weekSettings,eg.defaultToEN)}static create(eg,gg,ig,Ig,og=!1){const ng=eg||Settings.defaultLocale,sg=ng||(og?"en-US":systemLocale()),ag=gg||Settings.defaultNumberingSystem,Cg=ig||Settings.defaultOutputCalendar,lg=validateWeekSettings(Ig)||Settings.defaultWeekSettings;return new Locale(sg,ag,Cg,lg,ng)}static resetCache(){sysLocaleCache=null,intlDTCache.clear(),intlNumCache.clear(),intlRelCache.clear(),intlResolvedOptionsCache.clear(),weekInfoCache.clear()}static fromObject({locale:eg,numberingSystem:gg,outputCalendar:ig,weekSettings:Ig}={}){return Locale.create(eg,gg,ig,Ig)}constructor(eg,gg,ig,Ig,og){const[ng,sg,ag]=parseLocaleString(eg);this.locale=ng,this.numberingSystem=gg||sg||null,this.outputCalendar=ig||ag||null,this.weekSettings=Ig,this.intl=intlConfigString(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=og,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=supportsFastNumbers(this)),this.fastNumbersCached}listingMode(){const eg=this.isEnglish(),gg=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return eg&&gg?"en":"intl"}clone(eg){return!eg||Object.getOwnPropertyNames(eg).length===0?this:Locale.create(eg.locale||this.specifiedLocale,eg.numberingSystem||this.numberingSystem,eg.outputCalendar||this.outputCalendar,validateWeekSettings(eg.weekSettings)||this.weekSettings,eg.defaultToEN||!1)}redefaultToEN(eg={}){return this.clone({...eg,defaultToEN:!0})}redefaultToSystem(eg={}){return this.clone({...eg,defaultToEN:!1})}months(eg,gg=!1){return listStuff(this,eg,months,()=>{const ig=this.intl==="ja"||this.intl.startsWith("ja-");gg&=!ig;const Ig=gg?{month:eg,day:"numeric"}:{month:eg},og=gg?"format":"standalone";if(!this.monthsCache[og][eg]){const ng=ig?sg=>this.dtFormatter(sg,Ig).format():sg=>this.extract(sg,Ig,"month");this.monthsCache[og][eg]=mapMonths(ng)}return this.monthsCache[og][eg]})}weekdays(eg,gg=!1){return listStuff(this,eg,weekdays,()=>{const ig=gg?{weekday:eg,year:"numeric",month:"long",day:"numeric"}:{weekday:eg},Ig=gg?"format":"standalone";return this.weekdaysCache[Ig][eg]||(this.weekdaysCache[Ig][eg]=mapWeekdays(og=>this.extract(og,ig,"weekday"))),this.weekdaysCache[Ig][eg]})}meridiems(){return listStuff(this,void 0,()=>meridiems,()=>{if(!this.meridiemCache){const eg={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[DateTime.utc(2016,11,13,9),DateTime.utc(2016,11,13,19)].map(gg=>this.extract(gg,eg,"dayperiod"))}return this.meridiemCache})}eras(eg){return listStuff(this,eg,eras,()=>{const gg={era:eg};return this.eraCache[eg]||(this.eraCache[eg]=[DateTime.utc(-40,1,1),DateTime.utc(2017,1,1)].map(ig=>this.extract(ig,gg,"era"))),this.eraCache[eg]})}extract(eg,gg,ig){const Ig=this.dtFormatter(eg,gg),og=Ig.formatToParts(),ng=og.find(sg=>sg.type.toLowerCase()===ig);return ng?ng.value:null}numberFormatter(eg={}){return new PolyNumberFormatter(this.intl,eg.forceSimple||this.fastNumbers,eg)}dtFormatter(eg,gg={}){return new PolyDateFormatter(eg,this.intl,gg)}relFormatter(eg={}){return new PolyRelFormatter(this.intl,this.isEnglish(),eg)}listFormatter(eg={}){return getCachedLF(this.intl,eg)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||getCachedIntResolvedOptions(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:hasLocaleWeekInfo()?getCachedWeekInfo(this.locale):fallbackWeekSettings}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(eg){return this.locale===eg.locale&&this.numberingSystem===eg.numberingSystem&&this.outputCalendar===eg.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let singleton=null;class FixedOffsetZone extends Zone{static get utcInstance(){return singleton===null&&(singleton=new FixedOffsetZone(0)),singleton}static instance(eg){return eg===0?FixedOffsetZone.utcInstance:new FixedOffsetZone(eg)}static parseSpecifier(eg){if(eg){const gg=eg.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(gg)return new FixedOffsetZone(signedOffset(gg[1],gg[2]))}return null}constructor(eg){super(),this.fixed=eg}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${formatOffset(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${formatOffset(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(eg,gg){return formatOffset(this.fixed,gg)}get isUniversal(){return!0}offset(){return this.fixed}equals(eg){return eg.type==="fixed"&&eg.fixed===this.fixed}get isValid(){return!0}}class InvalidZone extends Zone{constructor(eg){super(),this.zoneName=eg}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function normalizeZone(tg,eg){if(isUndefined$1(tg)||tg===null)return eg;if(tg instanceof Zone)return tg;if(isString$1(tg)){const gg=tg.toLowerCase();return gg==="default"?eg:gg==="local"||gg==="system"?SystemZone.instance:gg==="utc"||gg==="gmt"?FixedOffsetZone.utcInstance:FixedOffsetZone.parseSpecifier(gg)||IANAZone.create(tg)}else return isNumber$1(tg)?FixedOffsetZone.instance(tg):typeof tg=="object"&&"offset"in tg&&typeof tg.offset=="function"?tg:new InvalidZone(tg)}const numberingSystems={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},numberingSystemsUTF16={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},hanidecChars=numberingSystems.hanidec.replace(/[\[|\]]/g,"").split("");function parseDigits(tg){let eg=parseInt(tg,10);if(isNaN(eg)){eg="";for(let gg=0;gg<tg.length;gg++){const ig=tg.charCodeAt(gg);if(tg[gg].search(numberingSystems.hanidec)!==-1)eg+=hanidecChars.indexOf(tg[gg]);else for(const Ig in numberingSystemsUTF16){const[og,ng]=numberingSystemsUTF16[Ig];ig>=og&&ig<=ng&&(eg+=ig-og)}}return parseInt(eg,10)}else return eg}const digitRegexCache=new Map;function resetDigitRegexCache(){digitRegexCache.clear()}function digitRegex({numberingSystem:tg},eg=""){const gg=tg||"latn";let ig=digitRegexCache.get(gg);ig===void 0&&(ig=new Map,digitRegexCache.set(gg,ig));let Ig=ig.get(eg);return Ig===void 0&&(Ig=new RegExp(`${numberingSystems[gg]}${eg}`),ig.set(eg,Ig)),Ig}let now=()=>Date.now(),defaultZone="system",defaultLocale=null,defaultNumberingSystem=null,defaultOutputCalendar=null,twoDigitCutoffYear=60,throwOnInvalid,defaultWeekSettings=null;class Settings{static get now(){return now}static set now(eg){now=eg}static set defaultZone(eg){defaultZone=eg}static get defaultZone(){return normalizeZone(defaultZone,SystemZone.instance)}static get defaultLocale(){return defaultLocale}static set defaultLocale(eg){defaultLocale=eg}static get defaultNumberingSystem(){return defaultNumberingSystem}static set defaultNumberingSystem(eg){defaultNumberingSystem=eg}static get defaultOutputCalendar(){return defaultOutputCalendar}static set defaultOutputCalendar(eg){defaultOutputCalendar=eg}static get defaultWeekSettings(){return defaultWeekSettings}static set defaultWeekSettings(eg){defaultWeekSettings=validateWeekSettings(eg)}static get twoDigitCutoffYear(){return twoDigitCutoffYear}static set twoDigitCutoffYear(eg){twoDigitCutoffYear=eg%100}static get throwOnInvalid(){return throwOnInvalid}static set throwOnInvalid(eg){throwOnInvalid=eg}static resetCaches(){Locale.resetCache(),IANAZone.resetCache(),DateTime.resetCache(),resetDigitRegexCache()}}class Invalid{constructor(eg,gg){this.reason=eg,this.explanation=gg}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const nonLeapLadder=[0,31,59,90,120,151,181,212,243,273,304,334],leapLadder=[0,31,60,91,121,152,182,213,244,274,305,335];function unitOutOfRange(tg,eg){return new Invalid("unit out of range",`you specified ${eg} (of type ${typeof eg}) as a ${tg}, which is invalid`)}function dayOfWeek(tg,eg,gg){const ig=new Date(Date.UTC(tg,eg-1,gg));tg<100&&tg>=0&&ig.setUTCFullYear(ig.getUTCFullYear()-1900);const Ig=ig.getUTCDay();return Ig===0?7:Ig}function computeOrdinal(tg,eg,gg){return gg+(isLeapYear(tg)?leapLadder:nonLeapLadder)[eg-1]}function uncomputeOrdinal(tg,eg){const gg=isLeapYear(tg)?leapLadder:nonLeapLadder,ig=gg.findIndex(og=>og<eg),Ig=eg-gg[ig];return{month:ig+1,day:Ig}}function isoWeekdayToLocal(tg,eg){return(tg-eg+7)%7+1}function gregorianToWeek(tg,eg=4,gg=1){const{year:ig,month:Ig,day:og}=tg,ng=computeOrdinal(ig,Ig,og),sg=isoWeekdayToLocal(dayOfWeek(ig,Ig,og),gg);let ag=Math.floor((ng-sg+14-eg)/7),Cg;return ag<1?(Cg=ig-1,ag=weeksInWeekYear(Cg,eg,gg)):ag>weeksInWeekYear(ig,eg,gg)?(Cg=ig+1,ag=1):Cg=ig,{weekYear:Cg,weekNumber:ag,weekday:sg,...timeObject(tg)}}function weekToGregorian(tg,eg=4,gg=1){const{weekYear:ig,weekNumber:Ig,weekday:og}=tg,ng=isoWeekdayToLocal(dayOfWeek(ig,1,eg),gg),sg=daysInYear(ig);let ag=Ig*7+og-ng-7+eg,Cg;ag<1?(Cg=ig-1,ag+=daysInYear(Cg)):ag>sg?(Cg=ig+1,ag-=daysInYear(ig)):Cg=ig;const{month:lg,day:Ag}=uncomputeOrdinal(Cg,ag);return{year:Cg,month:lg,day:Ag,...timeObject(tg)}}function gregorianToOrdinal(tg){const{year:eg,month:gg,day:ig}=tg,Ig=computeOrdinal(eg,gg,ig);return{year:eg,ordinal:Ig,...timeObject(tg)}}function ordinalToGregorian(tg){const{year:eg,ordinal:gg}=tg,{month:ig,day:Ig}=uncomputeOrdinal(eg,gg);return{year:eg,month:ig,day:Ig,...timeObject(tg)}}function usesLocalWeekValues(tg,eg){if(!isUndefined$1(tg.localWeekday)||!isUndefined$1(tg.localWeekNumber)||!isUndefined$1(tg.localWeekYear)){if(!isUndefined$1(tg.weekday)||!isUndefined$1(tg.weekNumber)||!isUndefined$1(tg.weekYear))throw new ConflictingSpecificationError("Cannot mix locale-based week fields with ISO-based week fields");return isUndefined$1(tg.localWeekday)||(tg.weekday=tg.localWeekday),isUndefined$1(tg.localWeekNumber)||(tg.weekNumber=tg.localWeekNumber),isUndefined$1(tg.localWeekYear)||(tg.weekYear=tg.localWeekYear),delete tg.localWeekday,delete tg.localWeekNumber,delete tg.localWeekYear,{minDaysInFirstWeek:eg.getMinDaysInFirstWeek(),startOfWeek:eg.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function hasInvalidWeekData(tg,eg=4,gg=1){const ig=isInteger(tg.weekYear),Ig=integerBetween(tg.weekNumber,1,weeksInWeekYear(tg.weekYear,eg,gg)),og=integerBetween(tg.weekday,1,7);return ig?Ig?og?!1:unitOutOfRange("weekday",tg.weekday):unitOutOfRange("week",tg.weekNumber):unitOutOfRange("weekYear",tg.weekYear)}function hasInvalidOrdinalData(tg){const eg=isInteger(tg.year),gg=integerBetween(tg.ordinal,1,daysInYear(tg.year));return eg?gg?!1:unitOutOfRange("ordinal",tg.ordinal):unitOutOfRange("year",tg.year)}function hasInvalidGregorianData(tg){const eg=isInteger(tg.year),gg=integerBetween(tg.month,1,12),ig=integerBetween(tg.day,1,daysInMonth(tg.year,tg.month));return eg?gg?ig?!1:unitOutOfRange("day",tg.day):unitOutOfRange("month",tg.month):unitOutOfRange("year",tg.year)}function hasInvalidTimeData(tg){const{hour:eg,minute:gg,second:ig,millisecond:Ig}=tg,og=integerBetween(eg,0,23)||eg===24&&gg===0&&ig===0&&Ig===0,ng=integerBetween(gg,0,59),sg=integerBetween(ig,0,59),ag=integerBetween(Ig,0,999);return og?ng?sg?ag?!1:unitOutOfRange("millisecond",Ig):unitOutOfRange("second",ig):unitOutOfRange("minute",gg):unitOutOfRange("hour",eg)}function isUndefined$1(tg){return typeof tg>"u"}function isNumber$1(tg){return typeof tg=="number"}function isInteger(tg){return typeof tg=="number"&&tg%1===0}function isString$1(tg){return typeof tg=="string"}function isDate$1(tg){return Object.prototype.toString.call(tg)==="[object Date]"}function hasRelative(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function hasLocaleWeekInfo(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function maybeArray(tg){return Array.isArray(tg)?tg:[tg]}function bestBy(tg,eg,gg){if(tg.length!==0)return tg.reduce((ig,Ig)=>{const og=[eg(Ig),Ig];return ig&&gg(ig[0],og[0])===ig[0]?ig:og},null)[1]}function pick(tg,eg){return eg.reduce((gg,ig)=>(gg[ig]=tg[ig],gg),{})}function hasOwnProperty(tg,eg){return Object.prototype.hasOwnProperty.call(tg,eg)}function validateWeekSettings(tg){if(tg==null)return null;if(typeof tg!="object")throw new InvalidArgumentError("Week settings must be an object");if(!integerBetween(tg.firstDay,1,7)||!integerBetween(tg.minimalDays,1,7)||!Array.isArray(tg.weekend)||tg.weekend.some(eg=>!integerBetween(eg,1,7)))throw new InvalidArgumentError("Invalid week settings");return{firstDay:tg.firstDay,minimalDays:tg.minimalDays,weekend:Array.from(tg.weekend)}}function integerBetween(tg,eg,gg){return isInteger(tg)&&tg>=eg&&tg<=gg}function floorMod(tg,eg){return tg-eg*Math.floor(tg/eg)}function padStart(tg,eg=2){const gg=tg<0;let ig;return gg?ig="-"+(""+-tg).padStart(eg,"0"):ig=(""+tg).padStart(eg,"0"),ig}function parseInteger(tg){if(!(isUndefined$1(tg)||tg===null||tg===""))return parseInt(tg,10)}function parseFloating(tg){if(!(isUndefined$1(tg)||tg===null||tg===""))return parseFloat(tg)}function parseMillis(tg){if(!(isUndefined$1(tg)||tg===null||tg==="")){const eg=parseFloat("0."+tg)*1e3;return Math.floor(eg)}}function roundTo(tg,eg,gg="round"){const ig=10**eg;switch(gg){case"expand":return tg>0?Math.ceil(tg*ig)/ig:Math.floor(tg*ig)/ig;case"trunc":return Math.trunc(tg*ig)/ig;case"round":return Math.round(tg*ig)/ig;case"floor":return Math.floor(tg*ig)/ig;case"ceil":return Math.ceil(tg*ig)/ig;default:throw new RangeError(`Value rounding ${gg} is out of range`)}}function isLeapYear(tg){return tg%4===0&&(tg%100!==0||tg%400===0)}function daysInYear(tg){return isLeapYear(tg)?366:365}function daysInMonth(tg,eg){const gg=floorMod(eg-1,12)+1,ig=tg+(eg-gg)/12;return gg===2?isLeapYear(ig)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][gg-1]}function objToLocalTS(tg){let eg=Date.UTC(tg.year,tg.month-1,tg.day,tg.hour,tg.minute,tg.second,tg.millisecond);return tg.year<100&&tg.year>=0&&(eg=new Date(eg),eg.setUTCFullYear(tg.year,tg.month-1,tg.day)),+eg}function firstWeekOffset(tg,eg,gg){return-isoWeekdayToLocal(dayOfWeek(tg,1,eg),gg)+eg-1}function weeksInWeekYear(tg,eg=4,gg=1){const ig=firstWeekOffset(tg,eg,gg),Ig=firstWeekOffset(tg+1,eg,gg);return(daysInYear(tg)-ig+Ig)/7}function untruncateYear(tg){return tg>99?tg:tg>Settings.twoDigitCutoffYear?1900+tg:2e3+tg}function parseZoneInfo(tg,eg,gg,ig=null){const Ig=new Date(tg),og={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};ig&&(og.timeZone=ig);const ng={timeZoneName:eg,...og},sg=new Intl.DateTimeFormat(gg,ng).formatToParts(Ig).find(ag=>ag.type.toLowerCase()==="timezonename");return sg?sg.value:null}function signedOffset(tg,eg){let gg=parseInt(tg,10);Number.isNaN(gg)&&(gg=0);const ig=parseInt(eg,10)||0,Ig=gg<0||Object.is(gg,-0)?-ig:ig;return gg*60+Ig}function asNumber(tg){const eg=Number(tg);if(typeof tg=="boolean"||tg===""||!Number.isFinite(eg))throw new InvalidArgumentError(`Invalid unit value ${tg}`);return eg}function normalizeObject(tg,eg){const gg={};for(const ig in tg)if(hasOwnProperty(tg,ig)){const Ig=tg[ig];if(Ig==null)continue;gg[eg(ig)]=asNumber(Ig)}return gg}function formatOffset(tg,eg){const gg=Math.trunc(Math.abs(tg/60)),ig=Math.trunc(Math.abs(tg%60)),Ig=tg>=0?"+":"-";switch(eg){case"short":return`${Ig}${padStart(gg,2)}:${padStart(ig,2)}`;case"narrow":return`${Ig}${gg}${ig>0?`:${ig}`:""}`;case"techie":return`${Ig}${padStart(gg,2)}${padStart(ig,2)}`;default:throw new RangeError(`Value format ${eg} is out of range for property format`)}}function timeObject(tg){return pick(tg,["hour","minute","second","millisecond"])}const monthsLong=["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],monthsNarrow=["J","F","M","A","M","J","J","A","S","O","N","D"];function months(tg){switch(tg){case"narrow":return[...monthsNarrow];case"short":return[...monthsShort];case"long":return[...monthsLong];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const weekdaysLong=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],weekdaysShort=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],weekdaysNarrow=["M","T","W","T","F","S","S"];function weekdays(tg){switch(tg){case"narrow":return[...weekdaysNarrow];case"short":return[...weekdaysShort];case"long":return[...weekdaysLong];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const meridiems=["AM","PM"],erasLong=["Before Christ","Anno Domini"],erasShort=["BC","AD"],erasNarrow=["B","A"];function eras(tg){switch(tg){case"narrow":return[...erasNarrow];case"short":return[...erasShort];case"long":return[...erasLong];default:return null}}function meridiemForDateTime(tg){return meridiems[tg.hour<12?0:1]}function weekdayForDateTime(tg,eg){return weekdays(eg)[tg.weekday-1]}function monthForDateTime(tg,eg){return months(eg)[tg.month-1]}function eraForDateTime(tg,eg){return eras(eg)[tg.year<0?0:1]}function formatRelativeTime(tg,eg,gg="always",ig=!1){const Ig={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},og=["hours","minutes","seconds"].indexOf(tg)===-1;if(gg==="auto"&&og){const Ag=tg==="days";switch(eg){case 1:return Ag?"tomorrow":`next ${Ig[tg][0]}`;case-1:return Ag?"yesterday":`last ${Ig[tg][0]}`;case 0:return Ag?"today":`this ${Ig[tg][0]}`}}const ng=Object.is(eg,-0)||eg<0,sg=Math.abs(eg),ag=sg===1,Cg=Ig[tg],lg=ig?ag?Cg[1]:Cg[2]||Cg[1]:ag?Ig[tg][0]:tg;return ng?`${sg} ${lg} ago`:`in ${sg} ${lg}`}function stringifyTokens(tg,eg){let gg="";for(const ig of tg)ig.literal?gg+=ig.val:gg+=eg(ig.val);return gg}const macroTokenToFormatOpts={D:DATE_SHORT,DD:DATE_MED,DDD:DATE_FULL,DDDD:DATE_HUGE,t:TIME_SIMPLE,tt:TIME_WITH_SECONDS,ttt:TIME_WITH_SHORT_OFFSET,tttt:TIME_WITH_LONG_OFFSET,T:TIME_24_SIMPLE,TT:TIME_24_WITH_SECONDS,TTT:TIME_24_WITH_SHORT_OFFSET,TTTT:TIME_24_WITH_LONG_OFFSET,f:DATETIME_SHORT,ff:DATETIME_MED,fff:DATETIME_FULL,ffff:DATETIME_HUGE,F:DATETIME_SHORT_WITH_SECONDS,FF:DATETIME_MED_WITH_SECONDS,FFF:DATETIME_FULL_WITH_SECONDS,FFFF:DATETIME_HUGE_WITH_SECONDS};class Formatter{static create(eg,gg={}){return new Formatter(eg,gg)}static parseFormat(eg){let gg=null,ig="",Ig=!1;const og=[];for(let ng=0;ng<eg.length;ng++){const sg=eg.charAt(ng);sg==="'"?((ig.length>0||Ig)&&og.push({literal:Ig||/^\s+$/.test(ig),val:ig===""?"'":ig}),gg=null,ig="",Ig=!Ig):Ig||sg===gg?ig+=sg:(ig.length>0&&og.push({literal:/^\s+$/.test(ig),val:ig}),ig=sg,gg=sg)}return ig.length>0&&og.push({literal:Ig||/^\s+$/.test(ig),val:ig}),og}static macroTokenToFormatOpts(eg){return macroTokenToFormatOpts[eg]}constructor(eg,gg){this.opts=gg,this.loc=eg,this.systemLoc=null}formatWithSystemDefault(eg,gg){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(eg,{...this.opts,...gg}).format()}dtFormatter(eg,gg={}){return this.loc.dtFormatter(eg,{...this.opts,...gg})}formatDateTime(eg,gg){return this.dtFormatter(eg,gg).format()}formatDateTimeParts(eg,gg){return this.dtFormatter(eg,gg).formatToParts()}formatInterval(eg,gg){return this.dtFormatter(eg.start,gg).dtf.formatRange(eg.start.toJSDate(),eg.end.toJSDate())}resolvedOptions(eg,gg){return this.dtFormatter(eg,gg).resolvedOptions()}num(eg,gg=0,ig=void 0){if(this.opts.forceSimple)return padStart(eg,gg);const Ig={...this.opts};return gg>0&&(Ig.padTo=gg),ig&&(Ig.signDisplay=ig),this.loc.numberFormatter(Ig).format(eg)}formatDateTimeFromString(eg,gg){const ig=this.loc.listingMode()==="en",Ig=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",og=(rg,ug)=>this.loc.extract(eg,rg,ug),ng=rg=>eg.isOffsetFixed&&eg.offset===0&&rg.allowZ?"Z":eg.isValid?eg.zone.formatOffset(eg.ts,rg.format):"",sg=()=>ig?meridiemForDateTime(eg):og({hour:"numeric",hourCycle:"h12"},"dayperiod"),ag=(rg,ug)=>ig?monthForDateTime(eg,rg):og(ug?{month:rg}:{month:rg,day:"numeric"},"month"),Cg=(rg,ug)=>ig?weekdayForDateTime(eg,rg):og(ug?{weekday:rg}:{weekday:rg,month:"long",day:"numeric"},"weekday"),lg=rg=>{const ug=Formatter.macroTokenToFormatOpts(rg);return ug?this.formatWithSystemDefault(eg,ug):rg},Ag=rg=>ig?eraForDateTime(eg,rg):og({era:rg},"era"),cg=rg=>{switch(rg){case"S":return this.num(eg.millisecond);case"u":case"SSS":return this.num(eg.millisecond,3);case"s":return this.num(eg.second);case"ss":return this.num(eg.second,2);case"uu":return this.num(Math.floor(eg.millisecond/10),2);case"uuu":return this.num(Math.floor(eg.millisecond/100));case"m":return this.num(eg.minute);case"mm":return this.num(eg.minute,2);case"h":return this.num(eg.hour%12===0?12:eg.hour%12);case"hh":return this.num(eg.hour%12===0?12:eg.hour%12,2);case"H":return this.num(eg.hour);case"HH":return this.num(eg.hour,2);case"Z":return ng({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return ng({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return ng({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return eg.zone.offsetName(eg.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return eg.zone.offsetName(eg.ts,{format:"long",locale:this.loc.locale});case"z":return eg.zoneName;case"a":return sg();case"d":return Ig?og({day:"numeric"},"day"):this.num(eg.day);case"dd":return Ig?og({day:"2-digit"},"day"):this.num(eg.day,2);case"c":return this.num(eg.weekday);case"ccc":return Cg("short",!0);case"cccc":return Cg("long",!0);case"ccccc":return Cg("narrow",!0);case"E":return this.num(eg.weekday);case"EEE":return Cg("short",!1);case"EEEE":return Cg("long",!1);case"EEEEE":return Cg("narrow",!1);case"L":return Ig?og({month:"numeric",day:"numeric"},"month"):this.num(eg.month);case"LL":return Ig?og({month:"2-digit",day:"numeric"},"month"):this.num(eg.month,2);case"LLL":return ag("short",!0);case"LLLL":return ag("long",!0);case"LLLLL":return ag("narrow",!0);case"M":return Ig?og({month:"numeric"},"month"):this.num(eg.month);case"MM":return Ig?og({month:"2-digit"},"month"):this.num(eg.month,2);case"MMM":return ag("short",!1);case"MMMM":return ag("long",!1);case"MMMMM":return ag("narrow",!1);case"y":return Ig?og({year:"numeric"},"year"):this.num(eg.year);case"yy":return Ig?og({year:"2-digit"},"year"):this.num(eg.year.toString().slice(-2),2);case"yyyy":return Ig?og({year:"numeric"},"year"):this.num(eg.year,4);case"yyyyyy":return Ig?og({year:"numeric"},"year"):this.num(eg.year,6);case"G":return Ag("short");case"GG":return Ag("long");case"GGGGG":return Ag("narrow");case"kk":return this.num(eg.weekYear.toString().slice(-2),2);case"kkkk":return this.num(eg.weekYear,4);case"W":return this.num(eg.weekNumber);case"WW":return this.num(eg.weekNumber,2);case"n":return this.num(eg.localWeekNumber);case"nn":return this.num(eg.localWeekNumber,2);case"ii":return this.num(eg.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(eg.localWeekYear,4);case"o":return this.num(eg.ordinal);case"ooo":return this.num(eg.ordinal,3);case"q":return this.num(eg.quarter);case"qq":return this.num(eg.quarter,2);case"X":return this.num(Math.floor(eg.ts/1e3));case"x":return this.num(eg.ts);default:return lg(rg)}};return stringifyTokens(Formatter.parseFormat(gg),cg)}formatDurationFromString(eg,gg){const ig=this.opts.signMode==="negativeLargestOnly"?-1:1,Ig=lg=>{switch(lg[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},og=(lg,Ag)=>cg=>{const rg=Ig(cg);if(rg){const ug=Ag.isNegativeDuration&&rg!==Ag.largestUnit?ig:1;let dg;return this.opts.signMode==="negativeLargestOnly"&&rg!==Ag.largestUnit?dg="never":this.opts.signMode==="all"?dg="always":dg="auto",this.num(lg.get(rg)*ug,cg.length,dg)}else return cg},ng=Formatter.parseFormat(gg),sg=ng.reduce((lg,{literal:Ag,val:cg})=>Ag?lg:lg.concat(cg),[]),ag=eg.shiftTo(...sg.map(Ig).filter(lg=>lg)),Cg={isNegativeDuration:ag<0,largestUnit:Object.keys(ag.values)[0]};return stringifyTokens(ng,og(ag,Cg))}}const ianaRegex=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function combineRegexes(...tg){const eg=tg.reduce((gg,ig)=>gg+ig.source,"");return RegExp(`^${eg}$`)}function combineExtractors(...tg){return eg=>tg.reduce(([gg,ig,Ig],og)=>{const[ng,sg,ag]=og(eg,Ig);return[{...gg,...ng},sg||ig,ag]},[{},null,1]).slice(0,2)}function parse(tg,...eg){if(tg==null)return[null,null];for(const[gg,ig]of eg){const Ig=gg.exec(tg);if(Ig)return ig(Ig)}return[null,null]}function simpleParse(...tg){return(eg,gg)=>{const ig={};let Ig;for(Ig=0;Ig<tg.length;Ig++)ig[tg[Ig]]=parseInteger(eg[gg+Ig]);return[ig,null,gg+Ig]}}const offsetRegex=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,isoExtendedZone=`(?:${offsetRegex.source}?(?:\\[(${ianaRegex.source})\\])?)?`,isoTimeBaseRegex=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,isoTimeRegex=RegExp(`${isoTimeBaseRegex.source}${isoExtendedZone}`),isoTimeExtensionRegex=RegExp(`(?:[Tt]${isoTimeRegex.source})?`),isoYmdRegex=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,isoWeekRegex=/(\d{4})-?W(\d\d)(?:-?(\d))?/,isoOrdinalRegex=/(\d{4})-?(\d{3})/,extractISOWeekData=simpleParse("weekYear","weekNumber","weekDay"),extractISOOrdinalData=simpleParse("year","ordinal"),sqlYmdRegex=/(\d{4})-(\d\d)-(\d\d)/,sqlTimeRegex=RegExp(`${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?`),sqlTimeExtensionRegex=RegExp(`(?: ${sqlTimeRegex.source})?`);function int(tg,eg,gg){const ig=tg[eg];return isUndefined$1(ig)?gg:parseInteger(ig)}function extractISOYmd(tg,eg){return[{year:int(tg,eg),month:int(tg,eg+1,1),day:int(tg,eg+2,1)},null,eg+3]}function extractISOTime(tg,eg){return[{hours:int(tg,eg,0),minutes:int(tg,eg+1,0),seconds:int(tg,eg+2,0),milliseconds:parseMillis(tg[eg+3])},null,eg+4]}function extractISOOffset(tg,eg){const gg=!tg[eg]&&!tg[eg+1],ig=signedOffset(tg[eg+1],tg[eg+2]),Ig=gg?null:FixedOffsetZone.instance(ig);return[{},Ig,eg+3]}function extractIANAZone(tg,eg){const gg=tg[eg]?IANAZone.create(tg[eg]):null;return[{},gg,eg+1]}const isoTimeOnly=RegExp(`^T?${isoTimeBaseRegex.source}$`),isoDuration=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function extractISODuration(tg){const[eg,gg,ig,Ig,og,ng,sg,ag,Cg]=tg,lg=eg[0]==="-",Ag=ag&&ag[0]==="-",cg=(rg,ug=!1)=>rg!==void 0&&(ug||rg&&lg)?-rg:rg;return[{years:cg(parseFloating(gg)),months:cg(parseFloating(ig)),weeks:cg(parseFloating(Ig)),days:cg(parseFloating(og)),hours:cg(parseFloating(ng)),minutes:cg(parseFloating(sg)),seconds:cg(parseFloating(ag),ag==="-0"),milliseconds:cg(parseMillis(Cg),Ag)}]}const obsOffsets={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function fromStrings(tg,eg,gg,ig,Ig,og,ng){const sg={year:eg.length===2?untruncateYear(parseInteger(eg)):parseInteger(eg),month:monthsShort.indexOf(gg)+1,day:parseInteger(ig),hour:parseInteger(Ig),minute:parseInteger(og)};return ng&&(sg.second=parseInteger(ng)),tg&&(sg.weekday=tg.length>3?weekdaysLong.indexOf(tg)+1:weekdaysShort.indexOf(tg)+1),sg}const rfc2822=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function extractRFC2822(tg){const[,eg,gg,ig,Ig,og,ng,sg,ag,Cg,lg,Ag]=tg,cg=fromStrings(eg,Ig,ig,gg,og,ng,sg);let rg;return ag?rg=obsOffsets[ag]:Cg?rg=0:rg=signedOffset(lg,Ag),[cg,new FixedOffsetZone(rg)]}function preprocessRFC2822(tg){return tg.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const rfc1123=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,rfc850=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,ascii=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function extractRFC1123Or850(tg){const[,eg,gg,ig,Ig,og,ng,sg]=tg;return[fromStrings(eg,Ig,ig,gg,og,ng,sg),FixedOffsetZone.utcInstance]}function extractASCII(tg){const[,eg,gg,ig,Ig,og,ng,sg]=tg;return[fromStrings(eg,sg,gg,ig,Ig,og,ng),FixedOffsetZone.utcInstance]}const isoYmdWithTimeExtensionRegex=combineRegexes(isoYmdRegex,isoTimeExtensionRegex),isoWeekWithTimeExtensionRegex=combineRegexes(isoWeekRegex,isoTimeExtensionRegex),isoOrdinalWithTimeExtensionRegex=combineRegexes(isoOrdinalRegex,isoTimeExtensionRegex),isoTimeCombinedRegex=combineRegexes(isoTimeRegex),extractISOYmdTimeAndOffset=combineExtractors(extractISOYmd,extractISOTime,extractISOOffset,extractIANAZone),extractISOWeekTimeAndOffset=combineExtractors(extractISOWeekData,extractISOTime,extractISOOffset,extractIANAZone),extractISOOrdinalDateAndTime=combineExtractors(extractISOOrdinalData,extractISOTime,extractISOOffset,extractIANAZone),extractISOTimeAndOffset=combineExtractors(extractISOTime,extractISOOffset,extractIANAZone);function parseISODate(tg){return parse(tg,[isoYmdWithTimeExtensionRegex,extractISOYmdTimeAndOffset],[isoWeekWithTimeExtensionRegex,extractISOWeekTimeAndOffset],[isoOrdinalWithTimeExtensionRegex,extractISOOrdinalDateAndTime],[isoTimeCombinedRegex,extractISOTimeAndOffset])}function parseRFC2822Date(tg){return parse(preprocessRFC2822(tg),[rfc2822,extractRFC2822])}function parseHTTPDate(tg){return parse(tg,[rfc1123,extractRFC1123Or850],[rfc850,extractRFC1123Or850],[ascii,extractASCII])}function parseISODuration(tg){return parse(tg,[isoDuration,extractISODuration])}const extractISOTimeOnly=combineExtractors(extractISOTime);function parseISOTimeOnly(tg){return parse(tg,[isoTimeOnly,extractISOTimeOnly])}const sqlYmdWithTimeExtensionRegex=combineRegexes(sqlYmdRegex,sqlTimeExtensionRegex),sqlTimeCombinedRegex=combineRegexes(sqlTimeRegex),extractISOTimeOffsetAndIANAZone=combineExtractors(extractISOTime,extractISOOffset,extractIANAZone);function parseSQL(tg){return parse(tg,[sqlYmdWithTimeExtensionRegex,extractISOYmdTimeAndOffset],[sqlTimeCombinedRegex,extractISOTimeOffsetAndIANAZone])}const INVALID$2="Invalid Duration",lowOrderMatrix={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},casualMatrix={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...lowOrderMatrix},daysInYearAccurate=146097/400,daysInMonthAccurate=146097/4800,accurateMatrix={years:{quarters:4,months:12,weeks:daysInYearAccurate/7,days:daysInYearAccurate,hours:daysInYearAccurate*24,minutes:daysInYearAccurate*24*60,seconds:daysInYearAccurate*24*60*60,milliseconds:daysInYearAccurate*24*60*60*1e3},quarters:{months:3,weeks:daysInYearAccurate/28,days:daysInYearAccurate/4,hours:daysInYearAccurate*24/4,minutes:daysInYearAccurate*24*60/4,seconds:daysInYearAccurate*24*60*60/4,milliseconds:daysInYearAccurate*24*60*60*1e3/4},months:{weeks:daysInMonthAccurate/7,days:daysInMonthAccurate,hours:daysInMonthAccurate*24,minutes:daysInMonthAccurate*24*60,seconds:daysInMonthAccurate*24*60*60,milliseconds:daysInMonthAccurate*24*60*60*1e3},...lowOrderMatrix},orderedUnits$1=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],reverseUnits=orderedUnits$1.slice(0).reverse();function clone$1(tg,eg,gg=!1){const ig={values:gg?eg.values:{...tg.values,...eg.values||{}},loc:tg.loc.clone(eg.loc),conversionAccuracy:eg.conversionAccuracy||tg.conversionAccuracy,matrix:eg.matrix||tg.matrix};return new Duration(ig)}function durationToMillis(tg,eg){let gg=eg.milliseconds??0;for(const ig of reverseUnits.slice(1))eg[ig]&&(gg+=eg[ig]*tg[ig].milliseconds);return gg}function normalizeValues(tg,eg){const gg=durationToMillis(tg,eg)<0?-1:1;orderedUnits$1.reduceRight((ig,Ig)=>{if(isUndefined$1(eg[Ig]))return ig;if(ig){const og=eg[ig]*gg,ng=tg[Ig][ig],sg=Math.floor(og/ng);eg[Ig]+=sg*gg,eg[ig]-=sg*ng*gg}return Ig},null),orderedUnits$1.reduce((ig,Ig)=>{if(isUndefined$1(eg[Ig]))return ig;if(ig){const og=eg[ig]%1;eg[ig]-=og,eg[Ig]+=og*tg[ig][Ig]}return Ig},null)}function removeZeroes(tg){const eg={};for(const[gg,ig]of Object.entries(tg))ig!==0&&(eg[gg]=ig);return eg}class Duration{constructor(eg){const gg=eg.conversionAccuracy==="longterm"||!1;let ig=gg?accurateMatrix:casualMatrix;eg.matrix&&(ig=eg.matrix),this.values=eg.values,this.loc=eg.loc||Locale.create(),this.conversionAccuracy=gg?"longterm":"casual",this.invalid=eg.invalid||null,this.matrix=ig,this.isLuxonDuration=!0}static fromMillis(eg,gg){return Duration.fromObject({milliseconds:eg},gg)}static fromObject(eg,gg={}){if(eg==null||typeof eg!="object")throw new InvalidArgumentError(`Duration.fromObject: argument expected to be an object, got ${eg===null?"null":typeof eg}`);return new Duration({values:normalizeObject(eg,Duration.normalizeUnit),loc:Locale.fromObject(gg),conversionAccuracy:gg.conversionAccuracy,matrix:gg.matrix})}static fromDurationLike(eg){if(isNumber$1(eg))return Duration.fromMillis(eg);if(Duration.isDuration(eg))return eg;if(typeof eg=="object")return Duration.fromObject(eg);throw new InvalidArgumentError(`Unknown duration argument ${eg} of type ${typeof eg}`)}static fromISO(eg,gg){const[ig]=parseISODuration(eg);return ig?Duration.fromObject(ig,gg):Duration.invalid("unparsable",`the input "${eg}" can't be parsed as ISO 8601`)}static fromISOTime(eg,gg){const[ig]=parseISOTimeOnly(eg);return ig?Duration.fromObject(ig,gg):Duration.invalid("unparsable",`the input "${eg}" can't be parsed as ISO 8601`)}static invalid(eg,gg=null){if(!eg)throw new InvalidArgumentError("need to specify a reason the Duration is invalid");const ig=eg instanceof Invalid?eg:new Invalid(eg,gg);if(Settings.throwOnInvalid)throw new InvalidDurationError(ig);return new Duration({invalid:ig})}static normalizeUnit(eg){const gg={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[eg&&eg.toLowerCase()];if(!gg)throw new InvalidUnitError(eg);return gg}static isDuration(eg){return eg&&eg.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(eg,gg={}){const ig={...gg,floor:gg.round!==!1&&gg.floor!==!1};return this.isValid?Formatter.create(this.loc,ig).formatDurationFromString(this,eg):INVALID$2}toHuman(eg={}){if(!this.isValid)return INVALID$2;const gg=eg.showZeros!==!1,ig=orderedUnits$1.map(Ig=>{const og=this.values[Ig];return isUndefined$1(og)||og===0&&!gg?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...eg,unit:Ig.slice(0,-1)}).format(og)}).filter(Ig=>Ig);return this.loc.listFormatter({type:"conjunction",style:eg.listStyle||"narrow",...eg}).format(ig)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let eg="P";return this.years!==0&&(eg+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(eg+=this.months+this.quarters*3+"M"),this.weeks!==0&&(eg+=this.weeks+"W"),this.days!==0&&(eg+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(eg+="T"),this.hours!==0&&(eg+=this.hours+"H"),this.minutes!==0&&(eg+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(eg+=roundTo(this.seconds+this.milliseconds/1e3,3)+"S"),eg==="P"&&(eg+="T0S"),eg}toISOTime(eg={}){if(!this.isValid)return null;const gg=this.toMillis();return gg<0||gg>=864e5?null:(eg={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...eg,includeOffset:!1},DateTime.fromMillis(gg,{zone:"UTC"}).toISOTime(eg))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?durationToMillis(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(eg){if(!this.isValid)return this;const gg=Duration.fromDurationLike(eg),ig={};for(const Ig of orderedUnits$1)(hasOwnProperty(gg.values,Ig)||hasOwnProperty(this.values,Ig))&&(ig[Ig]=gg.get(Ig)+this.get(Ig));return clone$1(this,{values:ig},!0)}minus(eg){if(!this.isValid)return this;const gg=Duration.fromDurationLike(eg);return this.plus(gg.negate())}mapUnits(eg){if(!this.isValid)return this;const gg={};for(const ig of Object.keys(this.values))gg[ig]=asNumber(eg(this.values[ig],ig));return clone$1(this,{values:gg},!0)}get(eg){return this[Duration.normalizeUnit(eg)]}set(eg){if(!this.isValid)return this;const gg={...this.values,...normalizeObject(eg,Duration.normalizeUnit)};return clone$1(this,{values:gg})}reconfigure({locale:eg,numberingSystem:gg,conversionAccuracy:ig,matrix:Ig}={}){const ng={loc:this.loc.clone({locale:eg,numberingSystem:gg}),matrix:Ig,conversionAccuracy:ig};return clone$1(this,ng)}as(eg){return this.isValid?this.shiftTo(eg).get(eg):NaN}normalize(){if(!this.isValid)return this;const eg=this.toObject();return normalizeValues(this.matrix,eg),clone$1(this,{values:eg},!0)}rescale(){if(!this.isValid)return this;const eg=removeZeroes(this.normalize().shiftToAll().toObject());return clone$1(this,{values:eg},!0)}shiftTo(...eg){if(!this.isValid)return this;if(eg.length===0)return this;eg=eg.map(ng=>Duration.normalizeUnit(ng));const gg={},ig={},Ig=this.toObject();let og;for(const ng of orderedUnits$1)if(eg.indexOf(ng)>=0){og=ng;let sg=0;for(const Cg in ig)sg+=this.matrix[Cg][ng]*ig[Cg],ig[Cg]=0;isNumber$1(Ig[ng])&&(sg+=Ig[ng]);const ag=Math.trunc(sg);gg[ng]=ag,ig[ng]=(sg*1e3-ag*1e3)/1e3}else isNumber$1(Ig[ng])&&(ig[ng]=Ig[ng]);for(const ng in ig)ig[ng]!==0&&(gg[og]+=ng===og?ig[ng]:ig[ng]/this.matrix[og][ng]);return normalizeValues(this.matrix,gg),clone$1(this,{values:gg},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const eg={};for(const gg of Object.keys(this.values))eg[gg]=this.values[gg]===0?0:-this.values[gg];return clone$1(this,{values:eg},!0)}removeZeros(){if(!this.isValid)return this;const eg=removeZeroes(this.values);return clone$1(this,{values:eg},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(eg){if(!this.isValid||!eg.isValid||!this.loc.equals(eg.loc))return!1;function gg(ig,Ig){return ig===void 0||ig===0?Ig===void 0||Ig===0:ig===Ig}for(const ig of orderedUnits$1)if(!gg(this.values[ig],eg.values[ig]))return!1;return!0}}const INVALID$1="Invalid Interval";function validateStartEnd(tg,eg){return!tg||!tg.isValid?Interval.invalid("missing or invalid start"):!eg||!eg.isValid?Interval.invalid("missing or invalid end"):eg<tg?Interval.invalid("end before start",`The end of an interval must be after its start, but you had start=${tg.toISO()} and end=${eg.toISO()}`):null}class Interval{constructor(eg){this.s=eg.start,this.e=eg.end,this.invalid=eg.invalid||null,this.isLuxonInterval=!0}static invalid(eg,gg=null){if(!eg)throw new InvalidArgumentError("need to specify a reason the Interval is invalid");const ig=eg instanceof Invalid?eg:new Invalid(eg,gg);if(Settings.throwOnInvalid)throw new InvalidIntervalError(ig);return new Interval({invalid:ig})}static fromDateTimes(eg,gg){const ig=friendlyDateTime(eg),Ig=friendlyDateTime(gg),og=validateStartEnd(ig,Ig);return og??new Interval({start:ig,end:Ig})}static after(eg,gg){const ig=Duration.fromDurationLike(gg),Ig=friendlyDateTime(eg);return Interval.fromDateTimes(Ig,Ig.plus(ig))}static before(eg,gg){const ig=Duration.fromDurationLike(gg),Ig=friendlyDateTime(eg);return Interval.fromDateTimes(Ig.minus(ig),Ig)}static fromISO(eg,gg){const[ig,Ig]=(eg||"").split("/",2);if(ig&&Ig){let og,ng;try{og=DateTime.fromISO(ig,gg),ng=og.isValid}catch{ng=!1}let sg,ag;try{sg=DateTime.fromISO(Ig,gg),ag=sg.isValid}catch{ag=!1}if(ng&&ag)return Interval.fromDateTimes(og,sg);if(ng){const Cg=Duration.fromISO(Ig,gg);if(Cg.isValid)return Interval.after(og,Cg)}else if(ag){const Cg=Duration.fromISO(ig,gg);if(Cg.isValid)return Interval.before(sg,Cg)}}return Interval.invalid("unparsable",`the input "${eg}" can't be parsed as ISO 8601`)}static isInterval(eg){return eg&&eg.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(eg="milliseconds"){return this.isValid?this.toDuration(eg).get(eg):NaN}count(eg="milliseconds",gg){if(!this.isValid)return NaN;const ig=this.start.startOf(eg,gg);let Ig;return gg!=null&&gg.useLocaleWeeks?Ig=this.end.reconfigure({locale:ig.locale}):Ig=this.end,Ig=Ig.startOf(eg,gg),Math.floor(Ig.diff(ig,eg).get(eg))+(Ig.valueOf()!==this.end.valueOf())}hasSame(eg){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,eg):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(eg){return this.isValid?this.s>eg:!1}isBefore(eg){return this.isValid?this.e<=eg:!1}contains(eg){return this.isValid?this.s<=eg&&this.e>eg:!1}set({start:eg,end:gg}={}){return this.isValid?Interval.fromDateTimes(eg||this.s,gg||this.e):this}splitAt(...eg){if(!this.isValid)return[];const gg=eg.map(friendlyDateTime).filter(ng=>this.contains(ng)).sort((ng,sg)=>ng.toMillis()-sg.toMillis()),ig=[];let{s:Ig}=this,og=0;for(;Ig<this.e;){const ng=gg[og]||this.e,sg=+ng>+this.e?this.e:ng;ig.push(Interval.fromDateTimes(Ig,sg)),Ig=sg,og+=1}return ig}splitBy(eg){const gg=Duration.fromDurationLike(eg);if(!this.isValid||!gg.isValid||gg.as("milliseconds")===0)return[];let{s:ig}=this,Ig=1,og;const ng=[];for(;ig<this.e;){const sg=this.start.plus(gg.mapUnits(ag=>ag*Ig));og=+sg>+this.e?this.e:sg,ng.push(Interval.fromDateTimes(ig,og)),ig=og,Ig+=1}return ng}divideEqually(eg){return this.isValid?this.splitBy(this.length()/eg).slice(0,eg):[]}overlaps(eg){return this.e>eg.s&&this.s<eg.e}abutsStart(eg){return this.isValid?+this.e==+eg.s:!1}abutsEnd(eg){return this.isValid?+eg.e==+this.s:!1}engulfs(eg){return this.isValid?this.s<=eg.s&&this.e>=eg.e:!1}equals(eg){return!this.isValid||!eg.isValid?!1:this.s.equals(eg.s)&&this.e.equals(eg.e)}intersection(eg){if(!this.isValid)return this;const gg=this.s>eg.s?this.s:eg.s,ig=this.e<eg.e?this.e:eg.e;return gg>=ig?null:Interval.fromDateTimes(gg,ig)}union(eg){if(!this.isValid)return this;const gg=this.s<eg.s?this.s:eg.s,ig=this.e>eg.e?this.e:eg.e;return Interval.fromDateTimes(gg,ig)}static merge(eg){const[gg,ig]=eg.sort((Ig,og)=>Ig.s-og.s).reduce(([Ig,og],ng)=>og?og.overlaps(ng)||og.abutsStart(ng)?[Ig,og.union(ng)]:[Ig.concat([og]),ng]:[Ig,ng],[[],null]);return ig&&gg.push(ig),gg}static xor(eg){let gg=null,ig=0;const Ig=[],og=eg.map(ag=>[{time:ag.s,type:"s"},{time:ag.e,type:"e"}]),ng=Array.prototype.concat(...og),sg=ng.sort((ag,Cg)=>ag.time-Cg.time);for(const ag of sg)ig+=ag.type==="s"?1:-1,ig===1?gg=ag.time:(gg&&+gg!=+ag.time&&Ig.push(Interval.fromDateTimes(gg,ag.time)),gg=null);return Interval.merge(Ig)}difference(...eg){return Interval.xor([this].concat(eg)).map(gg=>this.intersection(gg)).filter(gg=>gg&&!gg.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:INVALID$1}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(eg=DATE_SHORT,gg={}){return this.isValid?Formatter.create(this.s.loc.clone(gg),eg).formatInterval(this):INVALID$1}toISO(eg){return this.isValid?`${this.s.toISO(eg)}/${this.e.toISO(eg)}`:INVALID$1}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:INVALID$1}toISOTime(eg){return this.isValid?`${this.s.toISOTime(eg)}/${this.e.toISOTime(eg)}`:INVALID$1}toFormat(eg,{separator:gg=" – "}={}){return this.isValid?`${this.s.toFormat(eg)}${gg}${this.e.toFormat(eg)}`:INVALID$1}toDuration(eg,gg){return this.isValid?this.e.diff(this.s,eg,gg):Duration.invalid(this.invalidReason)}mapEndpoints(eg){return Interval.fromDateTimes(eg(this.s),eg(this.e))}}class Info{static hasDST(eg=Settings.defaultZone){const gg=DateTime.now().setZone(eg).set({month:12});return!eg.isUniversal&&gg.offset!==gg.set({month:6}).offset}static isValidIANAZone(eg){return IANAZone.isValidZone(eg)}static normalizeZone(eg){return normalizeZone(eg,Settings.defaultZone)}static getStartOfWeek({locale:eg=null,locObj:gg=null}={}){return(gg||Locale.create(eg)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:eg=null,locObj:gg=null}={}){return(gg||Locale.create(eg)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:eg=null,locObj:gg=null}={}){return(gg||Locale.create(eg)).getWeekendDays().slice()}static months(eg="long",{locale:gg=null,numberingSystem:ig=null,locObj:Ig=null,outputCalendar:og="gregory"}={}){return(Ig||Locale.create(gg,ig,og)).months(eg)}static monthsFormat(eg="long",{locale:gg=null,numberingSystem:ig=null,locObj:Ig=null,outputCalendar:og="gregory"}={}){return(Ig||Locale.create(gg,ig,og)).months(eg,!0)}static weekdays(eg="long",{locale:gg=null,numberingSystem:ig=null,locObj:Ig=null}={}){return(Ig||Locale.create(gg,ig,null)).weekdays(eg)}static weekdaysFormat(eg="long",{locale:gg=null,numberingSystem:ig=null,locObj:Ig=null}={}){return(Ig||Locale.create(gg,ig,null)).weekdays(eg,!0)}static meridiems({locale:eg=null}={}){return Locale.create(eg).meridiems()}static eras(eg="short",{locale:gg=null}={}){return Locale.create(gg,null,"gregory").eras(eg)}static features(){return{relative:hasRelative(),localeWeek:hasLocaleWeekInfo()}}}function dayDiff(tg,eg){const gg=Ig=>Ig.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),ig=gg(eg)-gg(tg);return Math.floor(Duration.fromMillis(ig).as("days"))}function highOrderDiffs(tg,eg,gg){const ig=[["years",(ag,Cg)=>Cg.year-ag.year],["quarters",(ag,Cg)=>Cg.quarter-ag.quarter+(Cg.year-ag.year)*4],["months",(ag,Cg)=>Cg.month-ag.month+(Cg.year-ag.year)*12],["weeks",(ag,Cg)=>{const lg=dayDiff(ag,Cg);return(lg-lg%7)/7}],["days",dayDiff]],Ig={},og=tg;let ng,sg;for(const[ag,Cg]of ig)gg.indexOf(ag)>=0&&(ng=ag,Ig[ag]=Cg(tg,eg),sg=og.plus(Ig),sg>eg?(Ig[ag]--,tg=og.plus(Ig),tg>eg&&(sg=tg,Ig[ag]--,tg=og.plus(Ig))):tg=sg);return[tg,Ig,sg,ng]}function diff(tg,eg,gg,ig){let[Ig,og,ng,sg]=highOrderDiffs(tg,eg,gg);const ag=eg-Ig,Cg=gg.filter(Ag=>["hours","minutes","seconds","milliseconds"].indexOf(Ag)>=0);Cg.length===0&&(ng<eg&&(ng=Ig.plus({[sg]:1})),ng!==Ig&&(og[sg]=(og[sg]||0)+ag/(ng-Ig)));const lg=Duration.fromObject(og,ig);return Cg.length>0?Duration.fromMillis(ag,ig).shiftTo(...Cg).plus(lg):lg}const MISSING_FTP="missing Intl.DateTimeFormat.formatToParts support";function intUnit(tg,eg=gg=>gg){return{regex:tg,deser:([gg])=>eg(parseDigits(gg))}}const NBSP=" ",spaceOrNBSP=`[ ${NBSP}]`,spaceOrNBSPRegExp=new RegExp(spaceOrNBSP,"g");function fixListRegex(tg){return tg.replace(/\./g,"\\.?").replace(spaceOrNBSPRegExp,spaceOrNBSP)}function stripInsensitivities(tg){return tg.replace(/\./g,"").replace(spaceOrNBSPRegExp," ").toLowerCase()}function oneOf(tg,eg){return tg===null?null:{regex:RegExp(tg.map(fixListRegex).join("|")),deser:([gg])=>tg.findIndex(ig=>stripInsensitivities(gg)===stripInsensitivities(ig))+eg}}function offset(tg,eg){return{regex:tg,deser:([,gg,ig])=>signedOffset(gg,ig),groups:eg}}function simple(tg){return{regex:tg,deser:([eg])=>eg}}function escapeToken(tg){return tg.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function unitForToken(tg,eg){const gg=digitRegex(eg),ig=digitRegex(eg,"{2}"),Ig=digitRegex(eg,"{3}"),og=digitRegex(eg,"{4}"),ng=digitRegex(eg,"{6}"),sg=digitRegex(eg,"{1,2}"),ag=digitRegex(eg,"{1,3}"),Cg=digitRegex(eg,"{1,6}"),lg=digitRegex(eg,"{1,9}"),Ag=digitRegex(eg,"{2,4}"),cg=digitRegex(eg,"{4,6}"),rg=mg=>({regex:RegExp(escapeToken(mg.val)),deser:([bg])=>bg,literal:!0}),dg=(mg=>{if(tg.literal)return rg(mg);switch(mg.val){case"G":return oneOf(eg.eras("short"),0);case"GG":return oneOf(eg.eras("long"),0);case"y":return intUnit(Cg);case"yy":return intUnit(Ag,untruncateYear);case"yyyy":return intUnit(og);case"yyyyy":return intUnit(cg);case"yyyyyy":return intUnit(ng);case"M":return intUnit(sg);case"MM":return intUnit(ig);case"MMM":return oneOf(eg.months("short",!0),1);case"MMMM":return oneOf(eg.months("long",!0),1);case"L":return intUnit(sg);case"LL":return intUnit(ig);case"LLL":return oneOf(eg.months("short",!1),1);case"LLLL":return oneOf(eg.months("long",!1),1);case"d":return intUnit(sg);case"dd":return intUnit(ig);case"o":return intUnit(ag);case"ooo":return intUnit(Ig);case"HH":return intUnit(ig);case"H":return intUnit(sg);case"hh":return intUnit(ig);case"h":return intUnit(sg);case"mm":return intUnit(ig);case"m":return intUnit(sg);case"q":return intUnit(sg);case"qq":return intUnit(ig);case"s":return intUnit(sg);case"ss":return intUnit(ig);case"S":return intUnit(ag);case"SSS":return intUnit(Ig);case"u":return simple(lg);case"uu":return simple(sg);case"uuu":return intUnit(gg);case"a":return oneOf(eg.meridiems(),0);case"kkkk":return intUnit(og);case"kk":return intUnit(Ag,untruncateYear);case"W":return intUnit(sg);case"WW":return intUnit(ig);case"E":case"c":return intUnit(gg);case"EEE":return oneOf(eg.weekdays("short",!1),1);case"EEEE":return oneOf(eg.weekdays("long",!1),1);case"ccc":return oneOf(eg.weekdays("short",!0),1);case"cccc":return oneOf(eg.weekdays("long",!0),1);case"Z":case"ZZ":return offset(new RegExp(`([+-]${sg.source})(?::(${ig.source}))?`),2);case"ZZZ":return offset(new RegExp(`([+-]${sg.source})(${ig.source})?`),2);case"z":return simple(/[a-z_+-/]{1,256}?/i);case" ":return simple(/[^\S\n\r]/);default:return rg(mg)}})(tg)||{invalidReason:MISSING_FTP};return dg.token=tg,dg}const partTypeStyleToTokenVal={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function tokenForPart(tg,eg,gg){const{type:ig,value:Ig}=tg;if(ig==="literal"){const ag=/^\s+$/.test(Ig);return{literal:!ag,val:ag?" ":Ig}}const og=eg[ig];let ng=ig;ig==="hour"&&(eg.hour12!=null?ng=eg.hour12?"hour12":"hour24":eg.hourCycle!=null?eg.hourCycle==="h11"||eg.hourCycle==="h12"?ng="hour12":ng="hour24":ng=gg.hour12?"hour12":"hour24");let sg=partTypeStyleToTokenVal[ng];if(typeof sg=="object"&&(sg=sg[og]),sg)return{literal:!1,val:sg}}function buildRegex(tg){return[`^${tg.map(gg=>gg.regex).reduce((gg,ig)=>`${gg}(${ig.source})`,"")}$`,tg]}function match(tg,eg,gg){const ig=tg.match(eg);if(ig){const Ig={};let og=1;for(const ng in gg)if(hasOwnProperty(gg,ng)){const sg=gg[ng],ag=sg.groups?sg.groups+1:1;!sg.literal&&sg.token&&(Ig[sg.token.val[0]]=sg.deser(ig.slice(og,og+ag))),og+=ag}return[ig,Ig]}else return[ig,{}]}function dateTimeFromMatches(tg){const eg=og=>{switch(og){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let gg=null,ig;return isUndefined$1(tg.z)||(gg=IANAZone.create(tg.z)),isUndefined$1(tg.Z)||(gg||(gg=new FixedOffsetZone(tg.Z)),ig=tg.Z),isUndefined$1(tg.q)||(tg.M=(tg.q-1)*3+1),isUndefined$1(tg.h)||(tg.h<12&&tg.a===1?tg.h+=12:tg.h===12&&tg.a===0&&(tg.h=0)),tg.G===0&&tg.y&&(tg.y=-tg.y),isUndefined$1(tg.u)||(tg.S=parseMillis(tg.u)),[Object.keys(tg).reduce((og,ng)=>{const sg=eg(ng);return sg&&(og[sg]=tg[ng]),og},{}),gg,ig]}let dummyDateTimeCache=null;function getDummyDateTime(){return dummyDateTimeCache||(dummyDateTimeCache=DateTime.fromMillis(1555555555555)),dummyDateTimeCache}function maybeExpandMacroToken(tg,eg){if(tg.literal)return tg;const gg=Formatter.macroTokenToFormatOpts(tg.val),ig=formatOptsToTokens(gg,eg);return ig==null||ig.includes(void 0)?tg:ig}function expandMacroTokens(tg,eg){return Array.prototype.concat(...tg.map(gg=>maybeExpandMacroToken(gg,eg)))}class TokenParser{constructor(eg,gg){if(this.locale=eg,this.format=gg,this.tokens=expandMacroTokens(Formatter.parseFormat(gg),eg),this.units=this.tokens.map(ig=>unitForToken(ig,eg)),this.disqualifyingUnit=this.units.find(ig=>ig.invalidReason),!this.disqualifyingUnit){const[ig,Ig]=buildRegex(this.units);this.regex=RegExp(ig,"i"),this.handlers=Ig}}explainFromTokens(eg){if(this.isValid){const[gg,ig]=match(eg,this.regex,this.handlers),[Ig,og,ng]=ig?dateTimeFromMatches(ig):[null,null,void 0];if(hasOwnProperty(ig,"a")&&hasOwnProperty(ig,"H"))throw new ConflictingSpecificationError("Can't include meridiem when specifying 24-hour format");return{input:eg,tokens:this.tokens,regex:this.regex,rawMatches:gg,matches:ig,result:Ig,zone:og,specificOffset:ng}}else return{input:eg,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function explainFromTokens(tg,eg,gg){return new TokenParser(tg,gg).explainFromTokens(eg)}function parseFromTokens(tg,eg,gg){const{result:ig,zone:Ig,specificOffset:og,invalidReason:ng}=explainFromTokens(tg,eg,gg);return[ig,Ig,og,ng]}function formatOptsToTokens(tg,eg){if(!tg)return null;const ig=Formatter.create(eg,tg).dtFormatter(getDummyDateTime()),Ig=ig.formatToParts(),og=ig.resolvedOptions();return Ig.map(ng=>tokenForPart(ng,tg,og))}const INVALID="Invalid DateTime",MAX_DATE=864e13;function unsupportedZone(tg){return new Invalid("unsupported zone",`the zone "${tg.name}" is not supported`)}function possiblyCachedWeekData(tg){return tg.weekData===null&&(tg.weekData=gregorianToWeek(tg.c)),tg.weekData}function possiblyCachedLocalWeekData(tg){return tg.localWeekData===null&&(tg.localWeekData=gregorianToWeek(tg.c,tg.loc.getMinDaysInFirstWeek(),tg.loc.getStartOfWeek())),tg.localWeekData}function clone(tg,eg){const gg={ts:tg.ts,zone:tg.zone,c:tg.c,o:tg.o,loc:tg.loc,invalid:tg.invalid};return new DateTime({...gg,...eg,old:gg})}function fixOffset(tg,eg,gg){let ig=tg-eg*60*1e3;const Ig=gg.offset(ig);if(eg===Ig)return[ig,eg];ig-=(Ig-eg)*60*1e3;const og=gg.offset(ig);return Ig===og?[ig,Ig]:[tg-Math.min(Ig,og)*60*1e3,Math.max(Ig,og)]}function tsToObj(tg,eg){tg+=eg*60*1e3;const gg=new Date(tg);return{year:gg.getUTCFullYear(),month:gg.getUTCMonth()+1,day:gg.getUTCDate(),hour:gg.getUTCHours(),minute:gg.getUTCMinutes(),second:gg.getUTCSeconds(),millisecond:gg.getUTCMilliseconds()}}function objToTS(tg,eg,gg){return fixOffset(objToLocalTS(tg),eg,gg)}function adjustTime(tg,eg){const gg=tg.o,ig=tg.c.year+Math.trunc(eg.years),Ig=tg.c.month+Math.trunc(eg.months)+Math.trunc(eg.quarters)*3,og={...tg.c,year:ig,month:Ig,day:Math.min(tg.c.day,daysInMonth(ig,Ig))+Math.trunc(eg.days)+Math.trunc(eg.weeks)*7},ng=Duration.fromObject({years:eg.years-Math.trunc(eg.years),quarters:eg.quarters-Math.trunc(eg.quarters),months:eg.months-Math.trunc(eg.months),weeks:eg.weeks-Math.trunc(eg.weeks),days:eg.days-Math.trunc(eg.days),hours:eg.hours,minutes:eg.minutes,seconds:eg.seconds,milliseconds:eg.milliseconds}).as("milliseconds"),sg=objToLocalTS(og);let[ag,Cg]=fixOffset(sg,gg,tg.zone);return ng!==0&&(ag+=ng,Cg=tg.zone.offset(ag)),{ts:ag,o:Cg}}function parseDataToDateTime(tg,eg,gg,ig,Ig,og){const{setZone:ng,zone:sg}=gg;if(tg&&Object.keys(tg).length!==0||eg){const ag=eg||sg,Cg=DateTime.fromObject(tg,{...gg,zone:ag,specificOffset:og});return ng?Cg:Cg.setZone(sg)}else return DateTime.invalid(new Invalid("unparsable",`the input "${Ig}" can't be parsed as ${ig}`))}function toTechFormat(tg,eg,gg=!0){return tg.isValid?Formatter.create(Locale.create("en-US"),{allowZ:gg,forceSimple:!0}).formatDateTimeFromString(tg,eg):null}function toISODate(tg,eg,gg){const ig=tg.c.year>9999||tg.c.year<0;let Ig="";if(ig&&tg.c.year>=0&&(Ig+="+"),Ig+=padStart(tg.c.year,ig?6:4),gg==="year")return Ig;if(eg){if(Ig+="-",Ig+=padStart(tg.c.month),gg==="month")return Ig;Ig+="-"}else if(Ig+=padStart(tg.c.month),gg==="month")return Ig;return Ig+=padStart(tg.c.day),Ig}function toISOTime(tg,eg,gg,ig,Ig,og,ng){let sg=!gg||tg.c.millisecond!==0||tg.c.second!==0,ag="";switch(ng){case"day":case"month":case"year":break;default:if(ag+=padStart(tg.c.hour),ng==="hour")break;if(eg){if(ag+=":",ag+=padStart(tg.c.minute),ng==="minute")break;sg&&(ag+=":",ag+=padStart(tg.c.second))}else{if(ag+=padStart(tg.c.minute),ng==="minute")break;sg&&(ag+=padStart(tg.c.second))}if(ng==="second")break;sg&&(!ig||tg.c.millisecond!==0)&&(ag+=".",ag+=padStart(tg.c.millisecond,3))}return Ig&&(tg.isOffsetFixed&&tg.offset===0&&!og?ag+="Z":tg.o<0?(ag+="-",ag+=padStart(Math.trunc(-tg.o/60)),ag+=":",ag+=padStart(Math.trunc(-tg.o%60))):(ag+="+",ag+=padStart(Math.trunc(tg.o/60)),ag+=":",ag+=padStart(Math.trunc(tg.o%60)))),og&&(ag+="["+tg.zone.ianaName+"]"),ag}const defaultUnitValues={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},defaultWeekUnitValues={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},defaultOrdinalUnitValues={ordinal:1,hour:0,minute:0,second:0,millisecond:0},orderedUnits=["year","month","day","hour","minute","second","millisecond"],orderedWeekUnits=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],orderedOrdinalUnits=["year","ordinal","hour","minute","second","millisecond"];function normalizeUnit(tg){const eg={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[tg.toLowerCase()];if(!eg)throw new InvalidUnitError(tg);return eg}function normalizeUnitWithLocalWeeks(tg){switch(tg.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return normalizeUnit(tg)}}function guessOffsetForZone(tg){if(zoneOffsetTs===void 0&&(zoneOffsetTs=Settings.now()),tg.type!=="iana")return tg.offset(zoneOffsetTs);const eg=tg.name;let gg=zoneOffsetGuessCache.get(eg);return gg===void 0&&(gg=tg.offset(zoneOffsetTs),zoneOffsetGuessCache.set(eg,gg)),gg}function quickDT(tg,eg){const gg=normalizeZone(eg.zone,Settings.defaultZone);if(!gg.isValid)return DateTime.invalid(unsupportedZone(gg));const ig=Locale.fromObject(eg);let Ig,og;if(isUndefined$1(tg.year))Ig=Settings.now();else{for(const ag of orderedUnits)isUndefined$1(tg[ag])&&(tg[ag]=defaultUnitValues[ag]);const ng=hasInvalidGregorianData(tg)||hasInvalidTimeData(tg);if(ng)return DateTime.invalid(ng);const sg=guessOffsetForZone(gg);[Ig,og]=objToTS(tg,sg,gg)}return new DateTime({ts:Ig,zone:gg,loc:ig,o:og})}function diffRelative(tg,eg,gg){const ig=isUndefined$1(gg.round)?!0:gg.round,Ig=isUndefined$1(gg.rounding)?"trunc":gg.rounding,og=(sg,ag)=>(sg=roundTo(sg,ig||gg.calendary?0:2,gg.calendary?"round":Ig),eg.loc.clone(gg).relFormatter(gg).format(sg,ag)),ng=sg=>gg.calendary?eg.hasSame(tg,sg)?0:eg.startOf(sg).diff(tg.startOf(sg),sg).get(sg):eg.diff(tg,sg).get(sg);if(gg.unit)return og(ng(gg.unit),gg.unit);for(const sg of gg.units){const ag=ng(sg);if(Math.abs(ag)>=1)return og(ag,sg)}return og(tg>eg?-0:0,gg.units[gg.units.length-1])}function lastOpts(tg){let eg={},gg;return tg.length>0&&typeof tg[tg.length-1]=="object"?(eg=tg[tg.length-1],gg=Array.from(tg).slice(0,tg.length-1)):gg=Array.from(tg),[eg,gg]}let zoneOffsetTs;const zoneOffsetGuessCache=new Map;class DateTime{constructor(eg){const gg=eg.zone||Settings.defaultZone;let ig=eg.invalid||(Number.isNaN(eg.ts)?new Invalid("invalid input"):null)||(gg.isValid?null:unsupportedZone(gg));this.ts=isUndefined$1(eg.ts)?Settings.now():eg.ts;let Ig=null,og=null;if(!ig)if(eg.old&&eg.old.ts===this.ts&&eg.old.zone.equals(gg))[Ig,og]=[eg.old.c,eg.old.o];else{const sg=isNumber$1(eg.o)&&!eg.old?eg.o:gg.offset(this.ts);Ig=tsToObj(this.ts,sg),ig=Number.isNaN(Ig.year)?new Invalid("invalid input"):null,Ig=ig?null:Ig,og=ig?null:sg}this._zone=gg,this.loc=eg.loc||Locale.create(),this.invalid=ig,this.weekData=null,this.localWeekData=null,this.c=Ig,this.o=og,this.isLuxonDateTime=!0}static now(){return new DateTime({})}static local(){const[eg,gg]=lastOpts(arguments),[ig,Ig,og,ng,sg,ag,Cg]=gg;return quickDT({year:ig,month:Ig,day:og,hour:ng,minute:sg,second:ag,millisecond:Cg},eg)}static utc(){const[eg,gg]=lastOpts(arguments),[ig,Ig,og,ng,sg,ag,Cg]=gg;return eg.zone=FixedOffsetZone.utcInstance,quickDT({year:ig,month:Ig,day:og,hour:ng,minute:sg,second:ag,millisecond:Cg},eg)}static fromJSDate(eg,gg={}){const ig=isDate$1(eg)?eg.valueOf():NaN;if(Number.isNaN(ig))return DateTime.invalid("invalid input");const Ig=normalizeZone(gg.zone,Settings.defaultZone);return Ig.isValid?new DateTime({ts:ig,zone:Ig,loc:Locale.fromObject(gg)}):DateTime.invalid(unsupportedZone(Ig))}static fromMillis(eg,gg={}){if(isNumber$1(eg))return eg<-MAX_DATE||eg>MAX_DATE?DateTime.invalid("Timestamp out of range"):new DateTime({ts:eg,zone:normalizeZone(gg.zone,Settings.defaultZone),loc:Locale.fromObject(gg)});throw new InvalidArgumentError(`fromMillis requires a numerical input, but received a ${typeof eg} with value ${eg}`)}static fromSeconds(eg,gg={}){if(isNumber$1(eg))return new DateTime({ts:eg*1e3,zone:normalizeZone(gg.zone,Settings.defaultZone),loc:Locale.fromObject(gg)});throw new InvalidArgumentError("fromSeconds requires a numerical input")}static fromObject(eg,gg={}){eg=eg||{};const ig=normalizeZone(gg.zone,Settings.defaultZone);if(!ig.isValid)return DateTime.invalid(unsupportedZone(ig));const Ig=Locale.fromObject(gg),og=normalizeObject(eg,normalizeUnitWithLocalWeeks),{minDaysInFirstWeek:ng,startOfWeek:sg}=usesLocalWeekValues(og,Ig),ag=Settings.now(),Cg=isUndefined$1(gg.specificOffset)?ig.offset(ag):gg.specificOffset,lg=!isUndefined$1(og.ordinal),Ag=!isUndefined$1(og.year),cg=!isUndefined$1(og.month)||!isUndefined$1(og.day),rg=Ag||cg,ug=og.weekYear||og.weekNumber;if((rg||lg)&&ug)throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(cg&&lg)throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");const dg=ug||og.weekday&&!rg;let mg,bg,pg=tsToObj(ag,Cg);dg?(mg=orderedWeekUnits,bg=defaultWeekUnitValues,pg=gregorianToWeek(pg,ng,sg)):lg?(mg=orderedOrdinalUnits,bg=defaultOrdinalUnitValues,pg=gregorianToOrdinal(pg)):(mg=orderedUnits,bg=defaultUnitValues);let Zg=!1;for(const Wg of mg){const $g=og[Wg];isUndefined$1($g)?Zg?og[Wg]=bg[Wg]:og[Wg]=pg[Wg]:Zg=!0}const Gg=dg?hasInvalidWeekData(og,ng,sg):lg?hasInvalidOrdinalData(og):hasInvalidGregorianData(og),hg=Gg||hasInvalidTimeData(og);if(hg)return DateTime.invalid(hg);const fg=dg?weekToGregorian(og,ng,sg):lg?ordinalToGregorian(og):og,[wg,yg]=objToTS(fg,Cg,ig),Bg=new DateTime({ts:wg,zone:ig,o:yg,loc:Ig});return og.weekday&&rg&&eg.weekday!==Bg.weekday?DateTime.invalid("mismatched weekday",`you can't specify both a weekday of ${og.weekday} and a date of ${Bg.toISO()}`):Bg.isValid?Bg:DateTime.invalid(Bg.invalid)}static fromISO(eg,gg={}){const[ig,Ig]=parseISODate(eg);return parseDataToDateTime(ig,Ig,gg,"ISO 8601",eg)}static fromRFC2822(eg,gg={}){const[ig,Ig]=parseRFC2822Date(eg);return parseDataToDateTime(ig,Ig,gg,"RFC 2822",eg)}static fromHTTP(eg,gg={}){const[ig,Ig]=parseHTTPDate(eg);return parseDataToDateTime(ig,Ig,gg,"HTTP",gg)}static fromFormat(eg,gg,ig={}){if(isUndefined$1(eg)||isUndefined$1(gg))throw new InvalidArgumentError("fromFormat requires an input string and a format");const{locale:Ig=null,numberingSystem:og=null}=ig,ng=Locale.fromOpts({locale:Ig,numberingSystem:og,defaultToEN:!0}),[sg,ag,Cg,lg]=parseFromTokens(ng,eg,gg);return lg?DateTime.invalid(lg):parseDataToDateTime(sg,ag,ig,`format ${gg}`,eg,Cg)}static fromString(eg,gg,ig={}){return DateTime.fromFormat(eg,gg,ig)}static fromSQL(eg,gg={}){const[ig,Ig]=parseSQL(eg);return parseDataToDateTime(ig,Ig,gg,"SQL",eg)}static invalid(eg,gg=null){if(!eg)throw new InvalidArgumentError("need to specify a reason the DateTime is invalid");const ig=eg instanceof Invalid?eg:new Invalid(eg,gg);if(Settings.throwOnInvalid)throw new InvalidDateTimeError(ig);return new DateTime({invalid:ig})}static isDateTime(eg){return eg&&eg.isLuxonDateTime||!1}static parseFormatForOpts(eg,gg={}){const ig=formatOptsToTokens(eg,Locale.fromObject(gg));return ig?ig.map(Ig=>Ig?Ig.val:null).join(""):null}static expandFormat(eg,gg={}){return expandMacroTokens(Formatter.parseFormat(eg),Locale.fromObject(gg)).map(Ig=>Ig.val).join("")}static resetCache(){zoneOffsetTs=void 0,zoneOffsetGuessCache.clear()}get(eg){return this[eg]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?possiblyCachedWeekData(this).weekYear:NaN}get weekNumber(){return this.isValid?possiblyCachedWeekData(this).weekNumber:NaN}get weekday(){return this.isValid?possiblyCachedWeekData(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?possiblyCachedLocalWeekData(this).weekday:NaN}get localWeekNumber(){return this.isValid?possiblyCachedLocalWeekData(this).weekNumber:NaN}get localWeekYear(){return this.isValid?possiblyCachedLocalWeekData(this).weekYear:NaN}get ordinal(){return this.isValid?gregorianToOrdinal(this.c).ordinal:NaN}get monthShort(){return this.isValid?Info.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Info.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Info.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Info.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const eg=864e5,gg=6e4,ig=objToLocalTS(this.c),Ig=this.zone.offset(ig-eg),og=this.zone.offset(ig+eg),ng=this.zone.offset(ig-Ig*gg),sg=this.zone.offset(ig-og*gg);if(ng===sg)return[this];const ag=ig-ng*gg,Cg=ig-sg*gg,lg=tsToObj(ag,ng),Ag=tsToObj(Cg,sg);return lg.hour===Ag.hour&&lg.minute===Ag.minute&&lg.second===Ag.second&&lg.millisecond===Ag.millisecond?[clone(this,{ts:ag}),clone(this,{ts:Cg})]:[this]}get isInLeapYear(){return isLeapYear(this.year)}get daysInMonth(){return daysInMonth(this.year,this.month)}get daysInYear(){return this.isValid?daysInYear(this.year):NaN}get weeksInWeekYear(){return this.isValid?weeksInWeekYear(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?weeksInWeekYear(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(eg={}){const{locale:gg,numberingSystem:ig,calendar:Ig}=Formatter.create(this.loc.clone(eg),eg).resolvedOptions(this);return{locale:gg,numberingSystem:ig,outputCalendar:Ig}}toUTC(eg=0,gg={}){return this.setZone(FixedOffsetZone.instance(eg),gg)}toLocal(){return this.setZone(Settings.defaultZone)}setZone(eg,{keepLocalTime:gg=!1,keepCalendarTime:ig=!1}={}){if(eg=normalizeZone(eg,Settings.defaultZone),eg.equals(this.zone))return this;if(eg.isValid){let Ig=this.ts;if(gg||ig){const og=eg.offset(this.ts),ng=this.toObject();[Ig]=objToTS(ng,og,eg)}return clone(this,{ts:Ig,zone:eg})}else return DateTime.invalid(unsupportedZone(eg))}reconfigure({locale:eg,numberingSystem:gg,outputCalendar:ig}={}){const Ig=this.loc.clone({locale:eg,numberingSystem:gg,outputCalendar:ig});return clone(this,{loc:Ig})}setLocale(eg){return this.reconfigure({locale:eg})}set(eg){if(!this.isValid)return this;const gg=normalizeObject(eg,normalizeUnitWithLocalWeeks),{minDaysInFirstWeek:ig,startOfWeek:Ig}=usesLocalWeekValues(gg,this.loc),og=!isUndefined$1(gg.weekYear)||!isUndefined$1(gg.weekNumber)||!isUndefined$1(gg.weekday),ng=!isUndefined$1(gg.ordinal),sg=!isUndefined$1(gg.year),ag=!isUndefined$1(gg.month)||!isUndefined$1(gg.day),Cg=sg||ag,lg=gg.weekYear||gg.weekNumber;if((Cg||ng)&&lg)throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(ag&&ng)throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");let Ag;og?Ag=weekToGregorian({...gregorianToWeek(this.c,ig,Ig),...gg},ig,Ig):isUndefined$1(gg.ordinal)?(Ag={...this.toObject(),...gg},isUndefined$1(gg.day)&&(Ag.day=Math.min(daysInMonth(Ag.year,Ag.month),Ag.day))):Ag=ordinalToGregorian({...gregorianToOrdinal(this.c),...gg});const[cg,rg]=objToTS(Ag,this.o,this.zone);return clone(this,{ts:cg,o:rg})}plus(eg){if(!this.isValid)return this;const gg=Duration.fromDurationLike(eg);return clone(this,adjustTime(this,gg))}minus(eg){if(!this.isValid)return this;const gg=Duration.fromDurationLike(eg).negate();return clone(this,adjustTime(this,gg))}startOf(eg,{useLocaleWeeks:gg=!1}={}){if(!this.isValid)return this;const ig={},Ig=Duration.normalizeUnit(eg);switch(Ig){case"years":ig.month=1;case"quarters":case"months":ig.day=1;case"weeks":case"days":ig.hour=0;case"hours":ig.minute=0;case"minutes":ig.second=0;case"seconds":ig.millisecond=0;break}if(Ig==="weeks")if(gg){const og=this.loc.getStartOfWeek(),{weekday:ng}=this;ng<og&&(ig.weekNumber=this.weekNumber-1),ig.weekday=og}else ig.weekday=1;if(Ig==="quarters"){const og=Math.ceil(this.month/3);ig.month=(og-1)*3+1}return this.set(ig)}endOf(eg,gg){return this.isValid?this.plus({[eg]:1}).startOf(eg,gg).minus(1):this}toFormat(eg,gg={}){return this.isValid?Formatter.create(this.loc.redefaultToEN(gg)).formatDateTimeFromString(this,eg):INVALID}toLocaleString(eg=DATE_SHORT,gg={}){return this.isValid?Formatter.create(this.loc.clone(gg),eg).formatDateTime(this):INVALID}toLocaleParts(eg={}){return this.isValid?Formatter.create(this.loc.clone(eg),eg).formatDateTimeParts(this):[]}toISO({format:eg="extended",suppressSeconds:gg=!1,suppressMilliseconds:ig=!1,includeOffset:Ig=!0,extendedZone:og=!1,precision:ng="milliseconds"}={}){if(!this.isValid)return null;ng=normalizeUnit(ng);const sg=eg==="extended";let ag=toISODate(this,sg,ng);return orderedUnits.indexOf(ng)>=3&&(ag+="T"),ag+=toISOTime(this,sg,gg,ig,Ig,og,ng),ag}toISODate({format:eg="extended",precision:gg="day"}={}){return this.isValid?toISODate(this,eg==="extended",normalizeUnit(gg)):null}toISOWeekDate(){return toTechFormat(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:eg=!1,suppressSeconds:gg=!1,includeOffset:ig=!0,includePrefix:Ig=!1,extendedZone:og=!1,format:ng="extended",precision:sg="milliseconds"}={}){return this.isValid?(sg=normalizeUnit(sg),(Ig&&orderedUnits.indexOf(sg)>=3?"T":"")+toISOTime(this,ng==="extended",gg,eg,ig,og,sg)):null}toRFC2822(){return toTechFormat(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return toTechFormat(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?toISODate(this,!0):null}toSQLTime({includeOffset:eg=!0,includeZone:gg=!1,includeOffsetSpace:ig=!0}={}){let Ig="HH:mm:ss.SSS";return(gg||eg)&&(ig&&(Ig+=" "),gg?Ig+="z":eg&&(Ig+="ZZ")),toTechFormat(this,Ig,!0)}toSQL(eg={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(eg)}`:null}toString(){return this.isValid?this.toISO():INVALID}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(eg={}){if(!this.isValid)return{};const gg={...this.c};return eg.includeConfig&&(gg.outputCalendar=this.outputCalendar,gg.numberingSystem=this.loc.numberingSystem,gg.locale=this.loc.locale),gg}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(eg,gg="milliseconds",ig={}){if(!this.isValid||!eg.isValid)return Duration.invalid("created by diffing an invalid DateTime");const Ig={locale:this.locale,numberingSystem:this.numberingSystem,...ig},og=maybeArray(gg).map(Duration.normalizeUnit),ng=eg.valueOf()>this.valueOf(),sg=ng?this:eg,ag=ng?eg:this,Cg=diff(sg,ag,og,Ig);return ng?Cg.negate():Cg}diffNow(eg="milliseconds",gg={}){return this.diff(DateTime.now(),eg,gg)}until(eg){return this.isValid?Interval.fromDateTimes(this,eg):this}hasSame(eg,gg,ig){if(!this.isValid)return!1;const Ig=eg.valueOf(),og=this.setZone(eg.zone,{keepLocalTime:!0});return og.startOf(gg,ig)<=Ig&&Ig<=og.endOf(gg,ig)}equals(eg){return this.isValid&&eg.isValid&&this.valueOf()===eg.valueOf()&&this.zone.equals(eg.zone)&&this.loc.equals(eg.loc)}toRelative(eg={}){if(!this.isValid)return null;const gg=eg.base||DateTime.fromObject({},{zone:this.zone}),ig=eg.padding?this<gg?-eg.padding:eg.padding:0;let Ig=["years","months","days","hours","minutes","seconds"],og=eg.unit;return Array.isArray(eg.unit)&&(Ig=eg.unit,og=void 0),diffRelative(gg,this.plus(ig),{...eg,numeric:"always",units:Ig,unit:og})}toRelativeCalendar(eg={}){return this.isValid?diffRelative(eg.base||DateTime.fromObject({},{zone:this.zone}),this,{...eg,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...eg){if(!eg.every(DateTime.isDateTime))throw new InvalidArgumentError("min requires all arguments be DateTimes");return bestBy(eg,gg=>gg.valueOf(),Math.min)}static max(...eg){if(!eg.every(DateTime.isDateTime))throw new InvalidArgumentError("max requires all arguments be DateTimes");return bestBy(eg,gg=>gg.valueOf(),Math.max)}static fromFormatExplain(eg,gg,ig={}){const{locale:Ig=null,numberingSystem:og=null}=ig,ng=Locale.fromOpts({locale:Ig,numberingSystem:og,defaultToEN:!0});return explainFromTokens(ng,eg,gg)}static fromStringExplain(eg,gg,ig={}){return DateTime.fromFormatExplain(eg,gg,ig)}static buildFormatParser(eg,gg={}){const{locale:ig=null,numberingSystem:Ig=null}=gg,og=Locale.fromOpts({locale:ig,numberingSystem:Ig,defaultToEN:!0});return new TokenParser(og,eg)}static fromFormatParser(eg,gg,ig={}){if(isUndefined$1(eg)||isUndefined$1(gg))throw new InvalidArgumentError("fromFormatParser requires an input string and a format parser");const{locale:Ig=null,numberingSystem:og=null}=ig,ng=Locale.fromOpts({locale:Ig,numberingSystem:og,defaultToEN:!0});if(!ng.equals(gg.locale))throw new InvalidArgumentError(`fromFormatParser called with a locale of ${ng}, but the format parser was created for ${gg.locale}`);const{result:sg,zone:ag,specificOffset:Cg,invalidReason:lg}=gg.explainFromTokens(eg);return lg?DateTime.invalid(lg):parseDataToDateTime(sg,ag,ig,`format ${gg.format}`,eg,Cg)}static get DATE_SHORT(){return DATE_SHORT}static get DATE_MED(){return DATE_MED}static get DATE_MED_WITH_WEEKDAY(){return DATE_MED_WITH_WEEKDAY}static get DATE_FULL(){return DATE_FULL}static get DATE_HUGE(){return DATE_HUGE}static get TIME_SIMPLE(){return TIME_SIMPLE}static get TIME_WITH_SECONDS(){return TIME_WITH_SECONDS}static get TIME_WITH_SHORT_OFFSET(){return TIME_WITH_SHORT_OFFSET}static get TIME_WITH_LONG_OFFSET(){return TIME_WITH_LONG_OFFSET}static get TIME_24_SIMPLE(){return TIME_24_SIMPLE}static get TIME_24_WITH_SECONDS(){return TIME_24_WITH_SECONDS}static get TIME_24_WITH_SHORT_OFFSET(){return TIME_24_WITH_SHORT_OFFSET}static get TIME_24_WITH_LONG_OFFSET(){return TIME_24_WITH_LONG_OFFSET}static get DATETIME_SHORT(){return DATETIME_SHORT}static get DATETIME_SHORT_WITH_SECONDS(){return DATETIME_SHORT_WITH_SECONDS}static get DATETIME_MED(){return DATETIME_MED}static get DATETIME_MED_WITH_SECONDS(){return DATETIME_MED_WITH_SECONDS}static get DATETIME_MED_WITH_WEEKDAY(){return DATETIME_MED_WITH_WEEKDAY}static get DATETIME_FULL(){return DATETIME_FULL}static get DATETIME_FULL_WITH_SECONDS(){return DATETIME_FULL_WITH_SECONDS}static get DATETIME_HUGE(){return DATETIME_HUGE}static get DATETIME_HUGE_WITH_SECONDS(){return DATETIME_HUGE_WITH_SECONDS}}function friendlyDateTime(tg){if(DateTime.isDateTime(tg))return tg;if(tg&&tg.valueOf&&isNumber$1(tg.valueOf()))return DateTime.fromJSDate(tg);if(tg&&typeof tg=="object")return DateTime.fromObject(tg);throw new InvalidArgumentError(`Unknown datetime argument: ${tg}, of type ${typeof tg}`)}const WEEK_ZH=["一","二","三","四","五","六","日"],MONTH_ZH_NUM=["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],MONTH_ZH_CN=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"];function formatDate(tg,{years:eg=0,months:gg=0,days:ig=0}={}){const Ig=DateTime.now().plus({years:eg,months:gg,days:ig}).setLocale("zh-CN");let og=formatWithZhMonth(Ig,tg),ng=Ig.toFormat(og);return ng=formatWithZhWeekday(Ig,ng),ng}function formatWithZhWeekday(tg,eg){const gg=WEEK_ZH[tg.weekday-1];return eg.replace(/dddd/g,`星期${gg}`).replace(/ddd/g,`周${gg}`)}function formatWithZhMonth(tg,eg){const gg=tg.month-1;return eg.replace(/MMMM/g,MONTH_ZH_CN[gg]).replace(/MMM/g,MONTH_ZH_NUM[gg])}function throttle$1(tg,eg=300){let gg=0;return function(...ig){const Ig=Date.now();Ig-gg>=eg&&(tg.apply(this,ig),gg=Ig)}}function ptToPx$1(tg,eg=o.DPI){return tg*eg/72}function mitt(tg){return{all:tg=tg||new Map,on:function(eg,gg){var ig=tg.get(eg);ig?ig.push(gg):tg.set(eg,[gg])},off:function(eg,gg){var ig=tg.get(eg);ig&&(gg?ig.splice(ig.indexOf(gg)>>>0,1):tg.set(eg,[]))},emit:function(eg,gg){var ig=tg.get(eg);ig&&ig.slice().map(function(Ig){Ig(gg)}),(ig=tg.get("*"))&&ig.slice().map(function(Ig){Ig(eg,gg)})}}}const canvasEventBus=mitt();let allObjMap=new Proxy({},{get(tg,eg){return eg in tg?tg[eg]:[]},set(tg,eg,gg){return tg[eg]=gg,!0}});function clearObjectMap(){allObjMap=new Proxy({},{get(tg,eg){return eg in tg?tg[eg]:[]},set(tg,eg,gg){return tg[eg]=gg,!0}})}function updateObjectMap(tg){tg.type!=="group"&&tg.id!=="workspace"?!allObjMap[tg.type]||allObjMap[tg.type]&&allObjMap[tg.type].length===0?allObjMap[tg.type]=[tg]:allObjMap[tg.type].push(tg):tg._objects.forEach(eg=>updateObjectMap(eg))}function getAllObjectMap(tg=null,eg="get"){if(eg==="get"&&Object.keys(allObjMap).length)return allObjMap;{if(!tg)return allObjMap;clearObjectMap();const gg=ig=>{ig.type==="group"&&ig._objects?ig._objects.forEach(Ig=>gg(Ig)):ig.id!=="workspace"&&(!allObjMap[ig.type]||allObjMap[ig.type]&&allObjMap[ig.type].length===0?allObjMap[ig.type]=[ig]:allObjMap[ig.type].push(ig))};tg==null||tg.getObjects().forEach(ig=>gg(ig))}return allObjMap}function getObjectList(tg,eg){tg.type!=="group"&&tg.type!=="activeselection"?eg&&eg(tg):tg._objects.forEach(gg=>getObjectList(gg,eg))}function getCounterValueType(tg){return tg.valueType==="letter"?"letter":"number"}function normalizeLetterValue(tg){return String(tg??"").toUpperCase().replace(/[^A-Z]/g,"")||"A"}function letterValueToNumber(tg){return normalizeLetterValue(tg).split("").reduce((eg,gg)=>eg*26+gg.charCodeAt(0)-64,0)}function numberToLetterValue(tg){let eg=Math.max(1,Math.trunc(tg)),gg="";for(;eg>0;)eg--,gg=String.fromCharCode(65+eg%26)+gg,eg=Math.floor(eg/26);return gg}function formatCounterValue(tg){if(getCounterValueType(tg)==="letter")return normalizeLetterValue(tg.value);let eg=String(tg.value??"");if(!tg.zeroPadding)return eg;let gg=Number(eg);return gg<0?(gg=Math.abs(gg),`-${gg.toString().padStart(tg.length,"0")}`):eg.padStart(tg.length,"0")}function getNextCounterValue(tg){const eg=Math.trunc(Number(tg.incremental))||0;if(getCounterValueType(tg)==="letter"){const Ig=letterValueToNumber(normalizeLetterValue(tg.value))+eg;if(Ig<1)return null;const og=numberToLetterValue(Ig);return og.length<=tg.length?og:null}const gg=Number(tg.value);if(!Number.isFinite(gg))return null;const ig=gg+Number(tg.incremental);return Math.abs(ig).toString().length<=tg.length?ig:null}const Pl=class Pl extends ji{constructor(eg,gg){super(gg),this.hasFireChange=!1,this.minScaleLimit=.1,this.orginTextWidth=0,this.orginTextgaps=2,this.orginTextSize=0,this.orginTextHeight=0,this.lockScalingFlip=!0,this.objectCaching=!1,this._scaleAnchor=void 0,this.counterProps=null,this.reviewValueArgs=null,this.barcodeDateFormatType="",this.increaseDate=!1,this.concatTextIdListObj=null,this.connectObjIds=[],this._cache={canvas:void 0,error:void 0,update:!0},this.increaseDate=gg&&gg.increaseDate?gg.increaseDate:this.increaseDate,this.barcodeDateFormatType=gg&&gg.barcodeDateFormatType?gg.barcodeDateFormatType:this.barcodeDateFormatType,this.counterProps=gg&&gg.counterProps?gg.counterProps:this.counterProps,this.barcodeOptions=cloneDeep(eg),this.barcodeOptions.textsize=eg.textsize||14,this.barcodeOptions.textposition=eg.includetext?eg.textposition||"bottom":void 0,this.barcodeOptions.textfontname=eg.textfontname||"Arial",this.set({width:this.width||1,height:this.height||80}),this.on("scaling",ig=>{const Ig=ig.transform;if(!Ig)return;const og=Ig.corner,ng=["ml","tl","bl"].includes(og),sg=["mr","tr","br"].includes(og),ag=["mt","tl","tr"].includes(og),Cg=["mb","bl","br"].includes(og);if(!this._scaleAnchor){const dg=ng?"right":sg?"left":"center",mg=ag?"bottom":Cg?"top":"center",bg=this.getPointByOrigin(dg,mg);this._scaleAnchor={p:bg,ox:dg,oy:mg}}const lg=Math.max(1,this.width*this.scaleX),Ag=Math.max(1,this.height*this.scaleY);this.width=lg,this.height=Ag,this.scaleX=1,this.scaleY=1;const{p:cg,ox:rg,oy:ug}=this._scaleAnchor;if(this.group){const dg=kn.invertTransform(this.group.calcTransformMatrix()),mg=kn.transformPoint(cg,dg);this.setPositionByOrigin(mg,rg,ug)}else this.setPositionByOrigin(cg,rg,ug);this.setCoords()}),this.on("modified",()=>{this._scaleAnchor=void 0}),this.concatTextIdListObj=gg.concatTextIdListObj??this.concatTextIdListObj,this.connectObjIds=gg.connectObjIds??this.connectObjIds,canvasEventBus.off(`update:barcode:${this.id}`),canvasEventBus.on(`update:barcode:${this.id}`,async({list:ig,callback:Ig=function(){}}={})=>{let og=await this.updateBarCode2d(ig);Ig&&Ig(og)})}measureText(eg,gg,ig){if(gg.textposition&&gg.textposition!=="none"&&gg.textsize){eg.font=`${gg.textsize}px ${gg.textfontname}`,gg.textgaps&&(eg.letterSpacing=gg.textgaps+"px");const Ig=eg.measureText(gg.text);ig.textWidth=Ig.actualBoundingBoxRight-Ig.actualBoundingBoxLeft,ig.textHeight=Ig.fontBoundingBoxAscent+Ig.fontBoundingBoxDescent}}drawText(eg,gg,ig){if(gg.textposition&&gg.textposition!=="none"&&gg.textsize){gg.textcolor&&(eg.fillStyle=gg.textcolor);const Ig=(ag,Cg)=>{let lg=(ag==null?void 0:ag.textWidth)||0;return Cg.textxalign==="left"?-this.width/2+this.strokeWidth/2:Cg.textxalign==="center"?-lg/2:Cg.textxalign==="right"&&this._cache.canvas?this.width/2-this.strokeWidth/2-lg:0},og=(ag,Cg)=>{let lg=(ag==null?void 0:ag.textHeight)||0;if(Cg.textposition==="top"){if(this._cache.canvas){const Ag=-this.height/2+lg+this.strokeWidth/2;return ag.y+=ag.textHeight,Ag}}else if(Cg.textposition==="bottom"&&this._cache.canvas)return this.height/2-this.strokeWidth/2;return 0},ng=Ig(ig,gg),sg=og(ig,gg);eg.save(),eg.fillText(gg.text,ng*this.scaleX,sg*this.scaleY),eg.restore()}}countDate(){if(this.barcodeDateFormatType&&this.increaseDate){const eg=formatDate(this.barcodeDateFormatType);return console.log("formatted",eg),this.dirty=!0,this.setBarcodeOption({bcid:this.barcodeOptions.bcid,text:eg}),eg}}countCurrent(eg){let gg=this.counterProps||eg;if(gg){let ig=gg;if(!ig.value&&ig.value!==0)return"";const Ig=formatCounterValue(ig);return(ig.prefix&&ig.prefix.length>0?ig.prefix:"")+Ig+(ig.suffix&&ig.suffix.length>0?ig.suffix:"")}return""}countNext(eg="print"){if(this.counterProps){let gg=this.counterProps;if(!gg.value&&gg.value!==0)return;eg==="review"&&!this.reviewValueArgs&&(this.reviewValueArgs={...gg});const ig=formatCounterValue(gg);let Ig=(gg.prefix&&gg.prefix.length>0?gg.prefix:"")+ig+(gg.suffix&&gg.suffix.length>0?gg.suffix:"");const og=getNextCounterValue(gg);return og!==null&&(gg.value=og,this.counterProps.value=og),this.dirty=!0,this._cache.update=!0,Ig}else return""}reviewRecover(){if(this.reviewValueArgs){const eg=this.reviewValueArgs;this.counterProps=eg,this.reviewValueArgs=null;const gg=formatCounterValue(eg);let ig=(eg.prefix&&eg.prefix.length>0?eg.prefix:"")+gg+(eg.suffix&&eg.suffix.length>0?eg.suffix:"");this.setBarcodeOption({bcid:this.barcodeOptions.bcid,text:ig})}}calculateCheckDigit(eg){if(!/^\d{13}$/.test(eg))return"";let gg=0;for(let ig=0;ig<13;ig++){const Ig=parseInt(eg[ig]);gg+=Ig*(ig%2===0?3:1)}return(10-gg%10)%10}_render(eg){var dg,mg;let gg=cloneDeep(this.barcodeOptions);console.log("_render======",gg);let ig=gg.bcid==="ean13",Ig=gg.bcid==="upca",og=gg.bcid==="upce",ng=gg.bcid==="ean8";this.scaleX!==1&&(this.scaleX=1),this.scaleY!==1&&(this.scaleY=1);let sg=!1;if(this.orginTextgaps>Number(gg.textgaps)&&(sg=!0),this.orginTextSize>Number(gg.textsize)&&(sg=!0),gg.bcid==="gs1-128"){let bg=gg.text;if(bg.match(/\((\d){2}\)/)&&(bg=((dg=gg.text.match(/\(01\)(\d+)/))==null?void 0:dg[1])||""),bg.length<13&&(bg=bg.padStart(13,"0")),bg.length===13){let pg=this.calculateCheckDigit(bg);bg=bg+pg}gg.text="(01)"+bg}gg.textgaps=gg.textgaps||1,this.orginTextgaps=gg.textgaps||1,this.orginTextSize=gg.textsize||0,eg.font=`${gg.textsize}px ${gg.textfontname}`,gg.textgaps&&(eg.letterSpacing=gg.textgaps+"px");const ag=eg.measureText(gg.text);let Cg=ag.width/this.scaleX,lg=(ag.actualBoundingBoxAscent+ag.actualBoundingBoxDescent)/this.scaleY,Ag=0,cg=0;sg&&Cg<this.orginTextWidth&&(Ag=this.orginTextWidth-Cg),sg&&lg<this.orginTextHeight&&(cg=this.orginTextHeight-lg),sg&&Ag&&(this.height=this.height-cg),this.orginTextWidth=Cg,this.orginTextHeight=lg,this.height<lg+30&&(this.height=lg+30);let rg={w:this.width,h:this.height,x:-this.width/2,y:-this.height/2};rg.textWidth=Cg,rg.textHeight=lg,gg.includetext=!1,gg.scale=1,gg.paddingleft=0,gg.paddingright=0;let ug=["ean13","upca","upce","ean8"];if(ug.includes(gg.bcid)&&(gg={...gg,includetext:!0,textyoffset:-10},gg.bcid==="upca"&&(gg.textyoffset=-15),delete gg.paddingtop,delete gg.paddingbottom,delete gg.paddingleft,delete gg.paddingright,delete gg.textposition,delete gg.textxalign),typeof this.fill=="string"){let bg=rgbaStringToHex8(this.fill);gg.barcolor=hexToHex6_blend(bg)}if(this._cache.update){console.log("this._cache.update=====",this._cache.update);try{this._cache.canvas=generateCanvas(gg);let bg=this._cache.canvas.width;if(!ug.includes(gg.bcid)){let pg=getTargetDpi();this.canvas&&pg===300&&(bg=bg*1.32)}if(bg>this.width)this.width=bg;else{let pg=Math.round(this.width/bg)||1;this.width=bg*pg}rg.w=this.width,rg.x=-this.width/2,this._cache.error&&(this._cache.error=void 0),this.setCoords(),(mg=this.canvas)==null||mg.requestRenderAll(),this._cache.update=!1}catch(bg){console.warn("draw barcode",bg),this.dirty=!0,bg instanceof Error&&(console.log("error",bg.message),this._cache.error="条码内容错误:"+bg.message),this._cache.canvas=void 0}}if(eg.imageSmoothingEnabled=!1,this.strokeWidth>0&&typeof this.stroke=="string"&&(eg.lineWidth=this.strokeWidth,eg.strokeStyle=this.stroke,eg.strokeRect(rg.x,rg.y,rg.w,rg.h)),rg.barcodeCanvas=this._cache.canvas,!this._cache.error&&rg.barcodeCanvas){this.strokeWidth>0&&(rg.x+=this.strokeWidth/2,rg.y+=this.strokeWidth/2);let bg=rg.h-(rg.textHeight||0)-this.strokeWidth/2,pg=rg.y;gg.textposition==="top"?(bg=bg-5,pg=pg+rg.textHeight/this.scaleY+5):gg.textposition==="bottom"?bg=bg-5/this.scaleY:bg=rg.h-this.strokeWidth/2;let Gg=rg.w-this.strokeWidth/2,hg=bg;ug.includes(gg.bcid)&&(hg=rg.h-this.strokeWidth/2),eg.drawImage(rg.barcodeCanvas,0,0,rg.barcodeCanvas.width,rg.barcodeCanvas.height,rg.x,pg,Gg,hg);let fg=this.barcodeOptions.text;const wg=this.width;if(ig){let yg=this.calcEAN13CheckDigit(fg);fg=fg+""+yg,eg.save(),eg.fillStyle="#fff";let Bg=hg/8;eg.fillRect(rg.x,-rg.y-Bg,Gg,Bg);const Wg=Math.trunc(wg/95),$g=-rg.y-Math.trunc(hg/6);let Ng=rg.x+Math.trunc(Gg/13);eg.font=`${gg.textsize}px ${gg.textfontname}`,eg.fillStyle=gg.textcolor||"#000",eg.textAlign="center",eg.textBaseline="top";let Vg=rg.barcodeCanvas.width;this.width/Vg===1&&(eg.letterSpacing="-2px"),eg.fillText(fg[0],-Wg*2+Ng,$g),eg.fillText(fg.slice(1,7),Wg*(3+42/2)+rg.x+Math.trunc(Gg/10),$g),eg.fillText(fg.slice(7),Wg*(50+42/2)+rg.x+Math.trunc(Gg/10),$g),eg.restore()}else if(ng){let yg=this.calcEAN8CheckDigit(fg);fg=fg+""+yg,eg.save(),eg.fillStyle="#fff";let Bg=hg/8;eg.fillRect(rg.x,-rg.y-Bg,Gg,Bg);const Wg=Math.trunc(wg/67),$g=-rg.y-Math.trunc(hg/6);rg.x+Math.trunc(Gg/13),eg.font=`${gg.textsize}px ${gg.textfontname}`,eg.fillStyle=gg.textcolor||"#000",eg.textAlign="center",eg.textBaseline="top";let Ng=rg.barcodeCanvas.width;this.width/Ng===1&&(eg.letterSpacing="-1px");const Mg=Wg*12+rg.x+4,Yg=Wg*55+rg.x-4;eg.fillText(fg.slice(0,4),Mg,$g),eg.fillText(fg.slice(4),Yg,$g),eg.restore()}else if(Ig){eg.save(),eg.fillStyle="#fff";let yg=hg/8;eg.fillRect(rg.x,-rg.y-yg,Gg,yg);const Bg=-rg.y-Math.trunc(hg/6),Wg=rg.x;let $g=this.calcUPCACheckDigit(fg);fg=fg+""+$g,eg.font=`${gg.textsize}px ${gg.textfontname}`,eg.fillStyle=gg.textcolor||"#000",eg.textAlign="center",eg.textBaseline="top";let Ng=rg.barcodeCanvas.width;this.width/Ng===1&&(eg.letterSpacing="-1px"),this.drawUPCAText(eg,fg,wg,Bg,Wg),eg.restore()}else if(og){eg.save(),eg.fillStyle="#fff";let yg=hg/8;eg.fillRect(rg.x,-rg.y-yg,Gg,yg);const Bg=-rg.y-Math.trunc(hg/8),Wg=rg.x;let $g=this.calcUPCECheckDigit(fg);fg=fg+""+$g,console.log("digits========",fg),eg.font=`${gg.textsize}px ${gg.textfontname}`,eg.fillStyle=gg.textcolor||"#000",eg.textAlign="center",eg.textBaseline="top",this.drawUPCEText(eg,fg,wg,Bg,Wg),eg.restore()}else this.drawText(eg,gg,rg)}if(eg.save(),this._cache.error){const bg=wrapText(eg,this._cache.error,rg.w),pg=getLineHeight(eg);let Zg=rg.y+pg;const Gg=eg.fillStyle;eg.fillStyle="red";for(const hg of bg)if(eg.fillText(hg,rg.x,Zg),Zg+=pg,Zg>rg.y+this.height)break;eg.fillStyle=Gg}eg.restore(),console.log("_render barcode")}calcEAN13CheckDigit(eg){if(!/^\d{12}$/.test(eg))return"";let gg=0,ig=0;for(let ng=0;ng<12;ng++){const sg=Number(eg[11-ng]);(ng+1)%2===1?gg+=sg:ig+=sg}const og=(gg+ig*3)%10;return og===0?0:10-og}calcEAN8CheckDigit(eg){if(!/^\d{7}$/.test(eg))return"";let gg=0,ig=0;for(let ng=0;ng<7;ng++){const sg=Number(eg[6-ng]);(ng+1)%2===1?ig+=sg:gg+=sg}const og=(gg*3+ig)%10;return og===0?0:10-og}calcUPCACheckDigit(eg){if(!/^\d{11}$/.test(eg))return"";let gg=0,ig=0;for(let sg=0;sg<11;sg++){const ag=parseInt(eg[sg],10);(sg+1)%2===1?gg+=ag:ig+=ag}const og=(gg*3+ig)%10;return(og===0?0:10-og).toString()}calcUPCECheckDigit(eg){if(!/^\d{7}$/.test(eg))return"";const gg=eg.split("").map(Number),ig=gg[0],[Ig,og,ng,sg,ag,Cg]=gg.slice(1);let lg="";switch(Cg){case 0:case 1:case 2:lg=`${ig}${Ig}${og}${Cg}0000${ng}${sg}${ag}`;break;case 3:lg=`${ig}${Ig}${og}${ng}00000${sg}${ag}`;break;case 4:lg=`${ig}${Ig}${og}${ng}${sg}00000${ag}`;break;default:lg=`${ig}${Ig}${og}${ng}${sg}${ag}0000${Cg}`}const Ag=lg.split("").map(Number);let cg=0;for(let rg=0;rg<Ag.length;rg++)rg%2===0?cg+=Ag[rg]*3:cg+=Ag[rg];return(10-cg%10)%10}drawUPCAText(eg,gg,ig,Ig,og){const ng=gg[0],sg=gg.substring(1,6),ag=gg.substring(6,11),Cg=gg[11],lg=Ig,Ag=ig/95;[{text:ng,x:og+Ag*3.5},{text:sg,x:og+Ag*28+10},{text:ag,x:og+Ag*67},{text:Cg,x:og+Ag*91.5+10}].forEach(rg=>{rg.text&&eg.fillText(rg.text,rg.x,lg)})}drawUPCEText(eg,gg,ig,Ig,og){[{i:0,x:og+4},{i:1,x:og+ig*.25},{i:2,x:og+ig*.33},{i:3,x:og+ig*.44},{i:4,x:og+ig*.56},{i:5,x:og+ig*.68},{i:6,x:og+ig*.78},{i:7,x:og+ig+4}].forEach(sg=>{gg[sg.i]&&eg.fillText(gg[sg.i],sg.x,Ig)})}set(eg,gg){return this._cache&&(this._cache.update=!0),super.set(eg,gg)}setBarcodeOption(eg){eg.bcid!==this.barcodeOptions.bcid&&(this.barcodeBaseWidth=void 0),merge(this.barcodeOptions,eg),this.dirty=!0,this._cache.update=!0;let gg=this.group;for(;gg;)gg.dirty=!0,gg=gg.group;let ig=getAllObjectMap();this.updateBarCode2d([...ig.text,...ig.counter])}updateInGroup(){this.dirty=!0,this.setCoords();let eg=this.group;for(;eg;)eg.dirty=!0,eg==null||eg.triggerLayout("childUpdate"),eg.setCoords(),eg=eg.group}getBarcodeOption(){return cloneDeep(this.barcodeOptions)}async updateBarCode2d(eg=[],gg=""){var ig;if(this.concatTextIdListObj||this.connectObjIds&&this.connectObjIds.length>0){let Ig=!1,og="",ng=[],sg=[];const ag=lg=>{if(this.connectObjIds){let Ag=0;for(let cg of this.connectObjIds){if(cg.index=Ag,cg.id&&cg.id===lg.id){Ig=!0;let rg=lg.text+"";if(lg.type==="counter"&&(lg._props.mode==="1"?rg=lg.countCurrent():lg._props.mode==="2"&&(lg.updateText({isUpdateBarCodeDate:!1}),rg=lg.text+"")),cg.maxEnd=rg.length,cg.isSplit){cg.start=Math.min(cg.start,cg.maxEnd);let ug=rg.slice(cg.start,cg.end);ng[Ag]=ug}else ng[Ag]=rg}Ag++}}},Cg=lg=>{lg.type==="text"&&this.concatTextIdListObj&&this.concatTextIdListObj[lg.id]&&(Ig||(lg==null||lg.set("text",this.barcodeOptions.text),lg.updateInGroup()),sg.push(lg))};if(eg.length>0)eg.forEach(lg=>{ag(lg),Cg(lg)});else{const lg=Ag=>{Ag.type==="group"&&Ag._objects?Ag._objects.forEach(cg=>lg(cg)):(ag(Ag),Cg(Ag))};(ig=this.canvas)==null||ig.getObjects().forEach(Ag=>lg(Ag))}return Ig?(og=ng.join(""),this.barcodeOptions.text=og,this.dirty=!0,this._cache.update=!0,gg&&this.updateInGroup(),sg.forEach(lg=>{lg.updateInGroup(),lg==null||lg.set("text",og)}),setTimeout(()=>{var lg;(lg=this.canvas)==null||lg.requestRenderAll()},0),og):""}else return""}toObject(eg){let gg=["barcodeOptions","connectObjIds","concatTextIdListObj","counterProps","increaseDate","barcodeDateFormatType"];return super.toObject(eg?[...eg,...gg]:gg)}};Pl.type="Barcode";let ABarcode=Pl;ABarcode.fromObject=(tg,eg)=>ABarcode._fromObject(tg,{...eg,extraParam:"barcodeOptions"}),tt.setClass(ABarcode),tt.setSVGClass(ABarcode);function getBase64Data({x:tg=0,y:eg=0,Content:gg="",ErrLevel:ig=1,Width:Ig=0,Height:og=0,id:ng="",rWidth:sg=0,rHeight:ag=0,CellSize:Cg="8"}={},lg=""){let Ag=Ig/(og||1),cg=`${gg}-${ig}-${Ig+og}-${Ag}-${Cg}`;if(lpCodeMap.has(cg)){let rg=lpCodeMap.get(cg);return lg!=="noSaveCache"&&setCacheLpCode({sKey:cg,img:rg,rWidth:sg,rHeight:ag,x:tg,y:eg}),rg}return new Promise(async(rg,ug)=>{console.log("getLongbeiBase64Data=====");let dg=[JSON.stringify({Content:gg,ErrLevel:ig,Width:Ig,Height:og,CellSize:Cg})],mg=await window.dsapi.driverAction.DSLE_Custom_LPCodeCreate(dg);if(mg=JSON.parse(mg),mg.code===0){let bg=mg.payload;if(bg){let pg=await loadBase64ToPic(bg);lpCodeMap.set(cg,pg),lg!=="noSaveCache"&&setCacheLpCode({sKey:cg,img:pg,rWidth:sg,rHeight:ag,x:tg,y:eg}),rg(pg)}else ug("")}else ug(mg)})}function getMixBase64Data({x:tg=0,y:eg=0,Content:gg="",ErrLevel:ig="",Width:Ig=0,Height:og=0,id:ng="",DPI:sg=203,rWidth:ag=0,rHeight:Cg=0,CellSize:lg="8"}={},Ag=""){let cg=Ig/(og||1),rg=`${gg}-${ig}-${Ig+og}-${cg}-${lg}`;if(lpCodeMap.has(rg)){let ug=lpCodeMap.get(rg);return Ag!=="noSaveCache"&&setCacheMixLpCode({sKey:rg,img:ug,rWidth:ag,rHeight:Cg,x:tg,y:eg}),ug}return new Promise(async(ug,dg)=>{console.log("getMixLongbeiBase64Data=====");let mg=ig.split("-"),bg=mg[0]||"0",pg=mg[1]||"0",Zg=gg.split("|&&&|"),Gg=Zg.shift(),hg=Zg.join("")||Gg,fg=[JSON.stringify({LPContent:Gg||"",LPErrLevel:bg,QRContent:hg,QRErrLevel:pg,Width:Ig,Height:og,DPI:sg+"",CellSize:lg})],wg=await window.dsapi.driverAction.DSLE_Custom_LPMixCreate(fg);if(wg=JSON.parse(wg),wg.code===0){let yg=wg.payload;if(yg){let Bg=await loadBase64ToPic(yg);lpCodeMap.set(rg,Bg),Ag!=="noSaveCache"&&setCacheMixLpCode({sKey:rg,img:Bg,rWidth:ag,rHeight:Cg,x:tg,y:eg}),ug(Bg)}else dg("")}else dg(wg)})}function loadBase64ToPic(tg){return new Promise(async(eg,gg)=>{let ig=new Image;ig.onload=()=>{eg(ig)},ig.src=tg})}let maxCacheLength=2e3;function setCacheLpCode({x:tg=0,y:eg=0,id:gg="",sKey:ig="",img:Ig=null,rWidth:og=0,rHeight:ng=0}={}){if(!ig||!Ig||!gg)return;let sg={sKey:ig,img:Ig,rWidth:og,rHeight:ng,x:tg,y:eg};if(!cacheLpCodeMap.has(gg))cacheLpCodeMap.set(gg,[sg]);else{let ag=cacheLpCodeMap.get(gg);ag.length>maxCacheLength&&ag.splice(0,500),ag.push(sg),cacheLpCodeMap.set(gg,ag)}}function setCacheMixLpCode({x:tg=0,y:eg=0,id:gg="",sKey:ig="",img:Ig=null,rWidth:og=0,rHeight:ng=0}={}){if(!ig||!Ig||!gg)return;let sg={sKey:ig,img:Ig,rWidth:og,rHeight:ng,x:tg,y:eg};if(!cacheMixLpCodeMap.has(gg))cacheMixLpCodeMap.set(gg,[sg]);else{let ag=cacheMixLpCodeMap.get(gg);ag.length>maxCacheLength&&ag.splice(0,500),ag.push(sg),cacheMixLpCodeMap.set(gg,ag)}console.log("cacheMixLpCodeMap========",cacheMixLpCodeMap)}class cappedMap extends Map{constructor(eg=60){super(),this.limit=eg}set(eg,gg){if(!this.has(eg)&&this.size>=this.limit){const ig=this.keys().next().value;this.delete(ig)}return super.set(eg,gg)}}class fastMap extends Map{constructor(eg=60){super(),this.lastKey=null,this.limit=eg}set(eg,gg){if(!this.has(eg)&&this.size>=this.limit){const ig=this.keys().next().value;this.delete(ig)}return this.lastKey=eg,super.set(eg,gg)}getLast(){return super.get(this.lastKey)||null}}let cacheMixLpCodeMap=new fastMap(2e3),cacheLpCodeMap=new fastMap(2e3),errorLpCodeMap=new cappedMap(5555),lpCodeMap=new cappedMap(5555),lpBcid=["LPCode","LPMixQrCode"];function clearLpAndMixCacheById(tg){cacheMixLpCodeMap.has(tg)&&cacheMixLpCodeMap.delete(tg),cacheLpCodeMap.has(tg)&&cacheLpCodeMap.delete(tg)}function getLastCacheLpcode(tg){let eg=cacheLpCodeMap.get(tg);return eg?eg[eg.length-1]:null}function getLastMixCacheLpcode(tg){let eg=cacheMixLpCodeMap.get(tg);return eg?eg[eg.length-1]:null}const isff=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function addEvent(tg,eg,gg,ig){tg.addEventListener?tg.addEventListener(eg,gg,ig):tg.attachEvent&&tg.attachEvent("on".concat(eg),gg)}function removeEvent(tg,eg,gg,ig){tg.removeEventListener?tg.removeEventListener(eg,gg,ig):tg.detachEvent&&tg.detachEvent("on".concat(eg),gg)}function getMods(tg,eg){const gg=eg.slice(0,eg.length-1);for(let ig=0;ig<gg.length;ig++)gg[ig]=tg[gg[ig].toLowerCase()];return gg}function getKeys(tg){typeof tg!="string"&&(tg=""),tg=tg.replace(/\s/g,"");const eg=tg.split(",");let gg=eg.lastIndexOf("");for(;gg>=0;)eg[gg-1]+=",",eg.splice(gg,1),gg=eg.lastIndexOf("");return eg}function compareArray(tg,eg){const gg=tg.length>=eg.length?tg:eg,ig=tg.length>=eg.length?eg:tg;let Ig=!0;for(let og=0;og<gg.length;og++)ig.indexOf(gg[og])===-1&&(Ig=!1);return Ig}const _keyMap={backspace:8,"⌫":8,tab:9,clear:12,enter:13,"↩":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,arrowup:38,arrowdown:40,arrowleft:37,arrowright:39,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"⇪":20,",":188,".":190,"/":191,"`":192,"-":isff?173:189,"=":isff?61:187,";":isff?59:186,"'":222,"{":219,"}":221,"[":219,"]":221,"\\":220},_modifier={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,meta:91,command:91},modifierMap={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},_mods={16:!1,18:!1,17:!1,91:!1},_handlers={};for(let tg=1;tg<20;tg++)_keyMap["f".concat(tg)]=111+tg;let _downKeys=[],winListendFocus=null,_scope="all";const elementEventMap=new Map,code=tg=>_keyMap[tg.toLowerCase()]||_modifier[tg.toLowerCase()]||tg.toUpperCase().charCodeAt(0),getKey=tg=>Object.keys(_keyMap).find(eg=>_keyMap[eg]===tg),getModifier=tg=>Object.keys(_modifier).find(eg=>_modifier[eg]===tg);function setScope(tg){_scope=tg||"all"}function getScope(){return _scope||"all"}function getPressedKeyCodes(){return _downKeys.slice(0)}function getPressedKeyString(){return _downKeys.map(tg=>getKey(tg)||getModifier(tg)||String.fromCharCode(tg))}function getAllKeyCodes(){const tg=[];return Object.keys(_handlers).forEach(eg=>{_handlers[eg].forEach(gg=>{let{key:ig,scope:Ig,mods:og,shortcut:ng}=gg;tg.push({scope:Ig,shortcut:ng,mods:og,keys:ig.split("+").map(sg=>code(sg))})})}),tg}function filter(tg){const eg=tg.target||tg.srcElement,{tagName:gg}=eg;let ig=!0;const Ig=gg==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(eg.type);return(eg.isContentEditable||(Ig||gg==="TEXTAREA"||gg==="SELECT")&&!eg.readOnly)&&(ig=!1),ig}function isPressed(tg){return typeof tg=="string"&&(tg=code(tg)),_downKeys.indexOf(tg)!==-1}function deleteScope(tg,eg){let gg,ig;tg||(tg=getScope());for(const Ig in _handlers)if(Object.prototype.hasOwnProperty.call(_handlers,Ig))for(gg=_handlers[Ig],ig=0;ig<gg.length;)gg[ig].scope===tg?gg.splice(ig,1).forEach(ng=>{let{element:sg}=ng;return removeKeyEvent(sg)}):ig++;getScope()===tg&&setScope(eg||"all")}function clearModifier(tg){let eg=tg.keyCode||tg.which||tg.charCode;tg.key&&tg.key.toLowerCase()==="capslock"&&(eg=code(tg.key));const gg=_downKeys.indexOf(eg);if(gg>=0&&_downKeys.splice(gg,1),tg.key&&tg.key.toLowerCase()==="meta"&&_downKeys.splice(0,_downKeys.length),(eg===93||eg===224)&&(eg=91),eg in _mods){_mods[eg]=!1;for(const ig in _modifier)_modifier[ig]===eg&&(hotkeys[ig]=!1)}}function unbind(tg){if(typeof tg>"u")Object.keys(_handlers).forEach(Ig=>{Array.isArray(_handlers[Ig])&&_handlers[Ig].forEach(og=>eachUnbind(og)),delete _handlers[Ig]}),removeKeyEvent(null);else if(Array.isArray(tg))tg.forEach(Ig=>{Ig.key&&eachUnbind(Ig)});else if(typeof tg=="object")tg.key&&eachUnbind(tg);else if(typeof tg=="string"){for(var eg=arguments.length,gg=new Array(eg>1?eg-1:0),ig=1;ig<eg;ig++)gg[ig-1]=arguments[ig];let[Ig,og]=gg;typeof Ig=="function"&&(og=Ig,Ig=""),eachUnbind({key:tg,scope:Ig,method:og,splitKey:"+"})}}const eachUnbind=tg=>{let{key:eg,scope:gg,method:ig,splitKey:Ig="+"}=tg;getKeys(eg).forEach(ng=>{const sg=ng.split(Ig),ag=sg.length,Cg=sg[ag-1],lg=Cg==="*"?"*":code(Cg);if(!_handlers[lg])return;gg||(gg=getScope());const Ag=ag>1?getMods(_modifier,sg):[],cg=[];_handlers[lg]=_handlers[lg].filter(rg=>{const dg=(ig?rg.method===ig:!0)&&rg.scope===gg&&compareArray(rg.mods,Ag);return dg&&cg.push(rg.element),!dg}),cg.forEach(rg=>removeKeyEvent(rg))})};function eventHandler(tg,eg,gg,ig){if(eg.element!==ig)return;let Ig;if(eg.scope===gg||eg.scope==="all"){Ig=eg.mods.length>0;for(const og in _mods)Object.prototype.hasOwnProperty.call(_mods,og)&&(!_mods[og]&&eg.mods.indexOf(+og)>-1||_mods[og]&&eg.mods.indexOf(+og)===-1)&&(Ig=!1);(eg.mods.length===0&&!_mods[16]&&!_mods[18]&&!_mods[17]&&!_mods[91]||Ig||eg.shortcut==="*")&&(eg.keys=[],eg.keys=eg.keys.concat(_downKeys),eg.method(tg,eg)===!1&&(tg.preventDefault?tg.preventDefault():tg.returnValue=!1,tg.stopPropagation&&tg.stopPropagation(),tg.cancelBubble&&(tg.cancelBubble=!0)))}}function dispatch(tg,eg){const gg=_handlers["*"];let ig=tg.keyCode||tg.which||tg.charCode;if(tg.key&&tg.key.toLowerCase()==="capslock"||!hotkeys.filter.call(this,tg))return;if((ig===93||ig===224)&&(ig=91),_downKeys.indexOf(ig)===-1&&ig!==229&&_downKeys.push(ig),["metaKey","ctrlKey","altKey","shiftKey"].forEach(sg=>{const ag=modifierMap[sg];tg[sg]&&_downKeys.indexOf(ag)===-1?_downKeys.push(ag):!tg[sg]&&_downKeys.indexOf(ag)>-1?_downKeys.splice(_downKeys.indexOf(ag),1):sg==="metaKey"&&tg[sg]&&(_downKeys=_downKeys.filter(Cg=>Cg in modifierMap||Cg===ig))}),ig in _mods){_mods[ig]=!0;for(const sg in _modifier)if(Object.prototype.hasOwnProperty.call(_modifier,sg)){const ag=modifierMap[_modifier[sg]];hotkeys[sg]=tg[ag]}if(!gg)return}for(const sg in _mods)Object.prototype.hasOwnProperty.call(_mods,sg)&&(_mods[sg]=tg[modifierMap[sg]]);tg.getModifierState&&!(tg.altKey&&!tg.ctrlKey)&&tg.getModifierState("AltGraph")&&(_downKeys.indexOf(17)===-1&&_downKeys.push(17),_downKeys.indexOf(18)===-1&&_downKeys.push(18),_mods[17]=!0,_mods[18]=!0);const Ig=getScope();if(gg)for(let sg=0;sg<gg.length;sg++)gg[sg].scope===Ig&&(tg.type==="keydown"&&gg[sg].keydown||tg.type==="keyup"&&gg[sg].keyup)&&eventHandler(tg,gg[sg],Ig,eg);if(!(ig in _handlers))return;const og=_handlers[ig],ng=og.length;for(let sg=0;sg<ng;sg++)if((tg.type==="keydown"&&og[sg].keydown||tg.type==="keyup"&&og[sg].keyup)&&og[sg].key){const ag=og[sg],{splitKey:Cg}=ag,lg=ag.key.split(Cg),Ag=[];for(let cg=0;cg<lg.length;cg++)Ag.push(code(lg[cg]));Ag.sort().join("")===_downKeys.sort().join("")&&eventHandler(tg,ag,Ig,eg)}}function hotkeys(tg,eg,gg){_downKeys=[];const ig=getKeys(tg);let Ig=[],og="all",ng=document,sg=0,ag=!1,Cg=!0,lg="+",Ag=!1,cg=!1;for(gg===void 0&&typeof eg=="function"&&(gg=eg),Object.prototype.toString.call(eg)==="[object Object]"&&(eg.scope&&(og=eg.scope),eg.element&&(ng=eg.element),eg.keyup&&(ag=eg.keyup),eg.keydown!==void 0&&(Cg=eg.keydown),eg.capture!==void 0&&(Ag=eg.capture),typeof eg.splitKey=="string"&&(lg=eg.splitKey),eg.single===!0&&(cg=!0)),typeof eg=="string"&&(og=eg),cg&&unbind(tg,og);sg<ig.length;sg++)tg=ig[sg].split(lg),Ig=[],tg.length>1&&(Ig=getMods(_modifier,tg)),tg=tg[tg.length-1],tg=tg==="*"?"*":code(tg),tg in _handlers||(_handlers[tg]=[]),_handlers[tg].push({keyup:ag,keydown:Cg,scope:og,mods:Ig,shortcut:ig[sg],method:gg,key:ig[sg],splitKey:lg,element:ng});if(typeof ng<"u"&&window){if(!elementEventMap.has(ng)){const rg=function(){let dg=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;return dispatch(dg,ng)},ug=function(){let dg=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;dispatch(dg,ng),clearModifier(dg)};elementEventMap.set(ng,{keydownListener:rg,keyupListenr:ug,capture:Ag}),addEvent(ng,"keydown",rg,Ag),addEvent(ng,"keyup",ug,Ag)}if(!winListendFocus){const rg=()=>{_downKeys=[]};winListendFocus={listener:rg,capture:Ag},addEvent(window,"focus",rg,Ag)}}}function trigger(tg){let eg=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"all";Object.keys(_handlers).forEach(gg=>{_handlers[gg].filter(Ig=>Ig.scope===eg&&Ig.shortcut===tg).forEach(Ig=>{Ig&&Ig.method&&Ig.method()})})}function removeKeyEvent(tg){const eg=Object.values(_handlers).flat();if(eg.findIndex(ig=>{let{element:Ig}=ig;return Ig===tg})<0){const{keydownListener:ig,keyupListenr:Ig,capture:og}=elementEventMap.get(tg)||{};ig&&Ig&&(removeEvent(tg,"keyup",Ig,og),removeEvent(tg,"keydown",ig,og),elementEventMap.delete(tg))}if((eg.length<=0||elementEventMap.size<=0)&&(Object.keys(elementEventMap).forEach(Ig=>{const{keydownListener:og,keyupListenr:ng,capture:sg}=elementEventMap.get(Ig)||{};og&&ng&&(removeEvent(Ig,"keyup",ng,sg),removeEvent(Ig,"keydown",og,sg),elementEventMap.delete(Ig))}),elementEventMap.clear(),Object.keys(_handlers).forEach(Ig=>delete _handlers[Ig]),winListendFocus)){const{listener:Ig,capture:og}=winListendFocus;removeEvent(window,"focus",Ig,og),winListendFocus=null}}const _api={getPressedKeyString,setScope,getScope,deleteScope,getPressedKeyCodes,getAllKeyCodes,isPressed,filter,trigger,unbind,keyMap:_keyMap,modifier:_modifier,modifierMap};for(const tg in _api)Object.prototype.hasOwnProperty.call(_api,tg)&&(hotkeys[tg]=_api[tg]);if(typeof window<"u"){const tg=window.hotkeys;hotkeys.noConflict=eg=>(eg&&window.hotkeys===hotkeys&&(window.hotkeys=tg),hotkeys),window.hotkeys=hotkeys}class EditorData{constructor(){this.enabled=!0,this.dirty=!1,this.originState="",this.hasSetActiveSelection=!1,this.handle={selectionHandles:new Set,modifyHandles:new Set,mouseDownHandles:new Set,mouseUpHandles:new Set,doubleClickHandles:new Set,objectUpdateHandles:new Set,mouseOverHandles:new Set,mouseOutHandles:new Set,checkDirtyHandles:new Set},this.selectHandle=eg=>{if(this.enabled)for(const gg of this.handle.selectionHandles)if(eg.selected){const ig=this.canvas.getActiveObject();gg(eg.e,ig?[ig]:[]),this.canvas&&this.canvas.elements.container.focus({preventScroll:!0})}else gg(eg.e,[])},this.modifyHandle=throttle$3(eg=>{if(!(!this.enabled||this.isWorkspace(eg.target))){if(eg.target)for(const gg of this.handle.modifyHandles)gg(eg.e,eg.target);this.checkDirty(eg)}},200),this.doubleClickHandle=eg=>{var gg,ig;if(!(!this.enabled||this.isWorkspace(eg.target))&&eg.target){eg.target.type==="table"&&eg.scenePoint&&((ig=(gg=eg.target).handleCellDoubleClick)==null||ig.call(gg,eg.scenePoint));for(const Ig of this.handle.doubleClickHandles)Ig(eg.e,eg.target)}},this.mouseDownHandle=eg=>{if(!(!this.enabled||this.isWorkspace(eg.target))&&eg.target)for(const gg of this.handle.mouseDownHandles)gg(eg.e,eg.target)},this.mouseUpHandle=eg=>{if(!(!this.enabled||this.isWorkspace(eg.target))&&eg.target)for(const gg of this.handle.mouseUpHandles)gg(eg.e,eg.target)},this.checkDirty=debounce$2(eg=>{if(!this.canvas)return!1;const gg=this.canvas.toJSON(),ig=JSON.stringify(gg);this.originState||(this.originState=ig),this.dirty=this.originState!==ig,eg.isToDirty&&(this.dirty=!0),console.log("this.dirty=========",this.dirty);for(const Ig of this.handle.checkDirtyHandles)Ig();return this.dirty},100),this.objectUpdateHandle=debounce$2(eg=>{if(!(!this.enabled||this.isWorkspace(eg.target))){for(const gg of this.handle.objectUpdateHandles)gg(eg.target);this.checkDirty(eg)}},100),this.mouseOver=eg=>{for(const gg of this.handle.mouseOverHandles)gg()},this.mouseOut=eg=>{for(const gg of this.handle.mouseOutHandles)gg()}}init(eg){this.editor=eg,this.canvas=eg.getCanvas(),this.bind(),this.originState=JSON.stringify(this.canvas.toJSON())}getActiveObject(){return this.canvas.getActiveObject()}getActiveObjects(){return this.canvas.getActiveObjects()}getObjects(){return this.canvas.getObjects()||[]}getAllObjects(){if(!this.canvas)return[];const eg=[];function gg(ig){ig.type==="group"&&ig._objects?ig._objects.forEach(Ig=>gg(Ig)):ig.id!=="workspace"&&eg.push(ig)}return this.canvas.getObjects().forEach(ig=>gg(ig)),eg}clearActiveSelection(){this.canvas&&this.hasSetActiveSelection&&(this.canvas.discardActiveObject(),this.canvas.requestRenderAll(),this.hasSetActiveSelection=!1)}setObjectsActive(eg){if(!(!this.canvas||eg.length===0)){if(eg.length===1)this.canvas.setActiveObject(eg[0]);else{this.hasSetActiveSelection=!0;const gg=new Jo(eg,{canvas:this.canvas});this.canvas.setActiveObject(gg)}this.canvas.requestRenderAll()}}getObjectsList(){if(!this.canvas)return[];const eg=this.canvas.getObjects(),gg=[];for(const ig of eg)if(ig.id!=="workspace"&&ig.drawObjectType!=="ignoreObject"){if(ig instanceof Jo)continue;ig.parent?ig.parent instanceof Jo?gg.push(ig):console.log("obj.parent isn't ActiveSelection",ig.parent,ig.parent.type):gg.push(ig)}return gg}setActiveObjectProps(eg,gg=!0){if(this.canvas){const ig=this.canvas.getActiveObject();if(ig){for(const Ig in eg)console.error("objet set",Ig,eg[Ig]),ig.type==="text"?(Ig==="fontStyle"&&eg[Ig]==="italic"?ig.set("hasSetItalic",!0):Ig==="fontStyle"&&eg[Ig]==="normal"?ig.set("hasSetItalic",!1):ig.set(Ig,eg[Ig]),ig.splitByGrapheme&&ig.verticalTypeChange()):ig.set(Ig,eg[Ig]);return gg&&this.canvas.fire("custom:object:history",{target:ig,action:"history:update"}),!0}}return!1}setActiveObjectPos(eg){var gg;this.setActiveObjectProps(eg)&&((gg=this.canvas)==null||gg.getActiveObject().setCoords())}updateCanvas(){this.canvas.renderAll()}addModifyHandle(eg){this.handle.modifyHandles.add(eg)}addSelectionHandle(eg){this.handle.selectionHandles.add(eg)}addMouseDownHandle(eg){this.handle.mouseDownHandles.add(eg)}addMouseUpHandle(eg){this.handle.mouseUpHandles.add(eg)}addDoubleClickHandle(eg){this.handle.doubleClickHandles.add(eg)}addObjectUpdateHandle(eg){this.handle.objectUpdateHandles.add(eg)}addMouseOverHandle(eg){this.handle.mouseOverHandles.add(eg)}addMouseOutHandle(eg){this.handle.mouseOutHandles.add(eg)}removeMouseOverHandle(eg){this.handle.mouseOverHandles.delete(eg)}removeMouseOutHandle(eg){this.handle.mouseOutHandles.delete(eg)}removeModifyHandle(eg){this.handle.modifyHandles.delete(eg)}removeSelectionHandle(eg){this.handle.selectionHandles.delete(eg)}removeMouseDownHandle(eg){this.handle.mouseDownHandles.delete(eg)}removeMouseUpHandle(eg){this.handle.mouseUpHandles.delete(eg)}removeDoubleClickHandle(eg){this.handle.doubleClickHandles.delete(eg)}remvoeObjectUpdateHandle(eg){this.handle.objectUpdateHandles.delete(eg)}addCheckDirtyHandles(eg){this.handle.checkDirtyHandles.add(eg)}removeCheckDirtyHandles(eg){this.handle.checkDirtyHandles.delete(eg)}setOriginState(){if(!this.canvas)return!1;const eg=this.canvas.toJSON(),gg=JSON.stringify(eg);this.originState=gg}isWorkspace(eg){return eg&&eg.id==="workspace"}setEnabled(eg){this.enabled=eg}bind(){if(!this.canvas)return;const eg=this.canvas;eg.on("selection:created",this.selectHandle),eg.on("selection:updated",this.selectHandle),eg.on("selection:cleared",this.selectHandle),eg.on("object:modified",this.modifyHandle),eg.on("object:scaling",this.modifyHandle),eg.on("object:rotating",this.modifyHandle),eg.on("object:moving",this.modifyHandle),eg.on("object:skewing",this.modifyHandle),eg.on("custom:object:changed",this.modifyHandle),eg.on("custom:object:basechanged",this.modifyHandle),eg.on("mouse:dblclick",this.doubleClickHandle),eg.on("mouse:down",this.mouseDownHandle),eg.on("mouse:up",this.mouseUpHandle),eg.on("object:added",this.objectUpdateHandle),eg.on("object:removed",this.objectUpdateHandle),eg.on("custom:object:checkdirty",this.checkDirty),this.editor.on("group",this.objectUpdateHandle),this.editor.on("ungroup",this.objectUpdateHandle)}unbind(){if(!this.canvas)return;const eg=this.canvas;eg.off("selection:created",this.selectHandle),eg.off("selection:updated",this.selectHandle),eg.off("selection:cleared",this.selectHandle),eg.off("object:modified",this.modifyHandle),eg.off("object:scaling",this.modifyHandle),eg.off("object:rotating",this.modifyHandle),eg.off("object:moving",this.modifyHandle),eg.off("object:skewing",this.modifyHandle),eg.off("custom:object:changed",this.modifyHandle),eg.off("custom:object:basechanged",this.modifyHandle),eg.off("mouse:dblclick",this.doubleClickHandle),eg.off("mouse:down",this.mouseDownHandle),eg.off("mouse:up",this.mouseUpHandle),eg.off("object:added",this.objectUpdateHandle),eg.off("object:removed",this.objectUpdateHandle),eg.off("custom:object:checkdirty",this.checkDirty),this.editor.off("group",this.objectUpdateHandle),this.editor.off("ungroup",this.objectUpdateHandle)}}const byteToHex=[];for(let tg=0;tg<256;++tg)byteToHex.push((tg+256).toString(16).slice(1));function unsafeStringify(tg,eg=0){return(byteToHex[tg[eg+0]]+byteToHex[tg[eg+1]]+byteToHex[tg[eg+2]]+byteToHex[tg[eg+3]]+"-"+byteToHex[tg[eg+4]]+byteToHex[tg[eg+5]]+"-"+byteToHex[tg[eg+6]]+byteToHex[tg[eg+7]]+"-"+byteToHex[tg[eg+8]]+byteToHex[tg[eg+9]]+"-"+byteToHex[tg[eg+10]]+byteToHex[tg[eg+11]]+byteToHex[tg[eg+12]]+byteToHex[tg[eg+13]]+byteToHex[tg[eg+14]]+byteToHex[tg[eg+15]]).toLowerCase()}let getRandomValues;const rnds8=new Uint8Array(16);function rng(){if(!getRandomValues){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");getRandomValues=crypto.getRandomValues.bind(crypto)}return getRandomValues(rnds8)}const randomUUID=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),native={randomUUID};function v4(tg,eg,gg){var Ig;if(native.randomUUID&&!tg)return native.randomUUID();tg=tg||{};const ig=tg.random??((Ig=tg.rng)==null?void 0:Ig.call(tg))??rng();if(ig.length<16)throw new Error("Random bytes length must be >= 16");return ig[6]=ig[6]&15|64,ig[8]=ig[8]&63|128,unsafeStringify(ig)}function handleConcatBarcode2d(tg,eg,gg=!0,ig=null){if(tg){let Ig=[],og=getAllObjectMap(eg);Ig=[...og.text,...og.counter];let ng=[...og.barcode2d],sg=[...og.barcode],ag={};ng.forEach(lg=>{ag[lg.id]=lg});let Cg={};sg.forEach(lg=>{Cg[lg.id]=lg});for(let lg of Object.keys(tg)){if(ng.length){let Ag=ag[lg];if(!Ag)return;let cg=!0;if(ig&&ig.type==="counter"&&ig.data==="2"&&(Ag.barcode2dOptions.bcid==="LPCode"?(cg=!Ag.hasLpemit,Ag.hasLpemit=!0):Ag.barcode2dOptions.bcid==="LPMixQrCode"&&(cg=!Ag.hasLpMixemit,Ag.hasLpMixemit=!0)),!cg)return;canvasEventBus.emit(`update:barcode2d:${lg}`,{list:Ig,callback:rg=>{Ag.dirty=!0,Ag.barcode2dOptions.text=rg||Ag.barcode2dOptions.text,Ag.updateInGroup(),gg&&setTimeout(()=>{eg==null||eg.requestRenderAll()},30)}})}if(sg.length){let Ag=Cg[lg];if(!Ag)return;canvasEventBus.emit(`update:barcode:${lg}`,{list:Ig,callback:cg=>{Ag.dirty=!0,Ag.barcodeOptions.text=cg||Ag.barcodeOptions.text,Ag.updateInGroup(),gg&&setTimeout(()=>{eg==null||eg.requestRenderAll(),Ag.group&&setTimeout(()=>{Ag.updateInGroup(),eg==null||eg.requestRenderAll()},0)},30)}})}}}}function addHandle(tg,eg,gg){if(tg){let ig={},Ig=getAllObjectMap(eg);[...Ig.barcode2d,...Ig.barcode].forEach(ng=>{ig[ng.id]=ng});for(let ng of Object.keys(tg)){let sg=ig[ng];if(sg){let ag=sg.connectObjIds||[],Cg=cacheObj[gg];Cg&&(ag.some(lg=>lg.id===Cg.id)||(ag.splice(Cg.index,0,Cg),sg.set("connectObjIds",ag)))}}}}let cacheObj={};function deleteHandle(tg,eg,gg){if(tg){let ig={},Ig=getAllObjectMap(eg);[...Ig.barcode2d,...Ig.barcode].forEach(ng=>{ig[ng.id]=ng});for(let ng of Object.keys(tg)){let sg=ig[ng];if(sg){let ag=sg.connectObjIds||[];ag=ag.filter(Cg=>(Cg.id===gg&&(cacheObj[gg]=Cg),Cg.id!==gg)),sg.set("connectObjIds",ag)}}}}const eC=class eC extends No{constructor(eg,gg){if(super(eg,gg),this.hasSetSplit=!1,this.objectCaching=!0,this.hasSetItalic=!1,this.isClearCopyTextStyle=!1,this.propsMinHeight=0,this.strokeUniform=!0,this.isBgBlackColor=!1,this.customExportFields={varnish:"none"},this.backgroundColor="",this.connectBar2dMap=null,this.__canvasRef=null,this.verticalType="top",this.arcEnable=!1,this.arcRadius=100,this._originGetTopOffset=this._getTopOffset?this._getTopOffset.bind(this):()=>0,gg.hasSetItalic&&(this.hasSetItalic=gg.hasSetItalic),gg.propsMinHeight){this.propsMinHeight=gg.propsMinHeight;let ig=Math.max(this.height,this.propsMinHeight);this.height=ig}gg.verticalType&&(this.verticalType=gg.verticalType),gg.backgroundColor&&(this.backgroundColor=gg.backgroundColor),this.isBgBlackColor=gg.isBgBlackColor??this.isBgBlackColor,this.connectBar2dMap=gg.connectBar2dMap??this.connectBar2dMap,gg.arcEnable!==void 0&&(this.arcEnable=gg.arcEnable),gg.arcRadius!==void 0&&(this.arcRadius=gg.arcRadius),this.on("removed",ig=>{if(ig.target.type!=="activeselection"){if(this.inGroupRemove){this.inGroupRemove=!1;return}deleteHandle(this.connectBar2dMap,this.__canvasRef,this.id)}}),this.on("added",()=>{this.__canvasRef=this.canvas,addHandle(this.connectBar2dMap,this.__canvasRef,this.id)}),this.on("modified",ig=>{(ig==null?void 0:ig.action)!=="drag"&&this.type==="text"&&(this.verticalTypeChange(),this.tiggerHandleConcatBarcode2d())}),this.on("changed",()=>{this.type==="text"&&this.verticalTypeChange()}),this.verticalTypeChange()}tiggerHandleConcatBarcode2d(){this.connectBar2dMap&&handleConcatBarcode2d(this.connectBar2dMap,this.canvas)}updateInGroup(){this.dirty=!0,this.setCoords();let eg=this.group;for(;eg;)eg.dirty=!0,eg==null||eg.triggerLayout("childUpdate"),eg.setCoords(),eg=eg.group}_calcTextHeight(){const eg=this._textLines&&this._textLines.length||0,gg=this.fontSize*this.lineHeight,ig=(this.padding||0)*2;return eg*gg+ig}verticalTypeChange(){var gg;if(!this.splitByGrapheme||!this.propsMinHeight)return;const eg=Math.max(this._calcTextHeight(),this.propsMinHeight);this.height!==eg&&(this.height=eg),this.verticalType==="top"?this._getTopOffset=this._originGetTopOffset:this.verticalType==="vcenter"?this._getTopOffset=()=>{let ig=this._calcTextHeight();return(this.fontSize*this.lineHeight-this.fontSize)/2-ig/2}:this.verticalType==="bottom"&&(this._getTopOffset=()=>{const ig=this._calcTextHeight(),og=Math.max(ig,this.propsMinHeight)-ig;return this._originGetTopOffset()+og}),this.setCoords(),(gg=this.canvas)==null||gg.requestRenderAll()}set(eg,gg){return(eg==="fill"||eg==="stroke"||eg==="underline"||eg==="overline"||eg==="linethrough"||eg==="fontWeight"||eg==="fontStyle")&&(this.styles={}),super.set(eg,gg)}set locked(eg){super.locked=eg,this.editable=!eg}get locked(){return super.locked}_measureLine(eg){let gg=this._textLines[eg];return Array.isArray(gg)&&(gg=gg.map(ig=>ig.replace(" "," "))),this._textLines[eg]=gg,super._measureLine(eg)}getStandardSpaceWidth(eg=" ",gg="Arial"){const Ig=kn.createCanvasElement().getContext("2d");let og=0;return Ig&&(Ig.font=`${this.fontSize}px ${gg}`,og=Ig.measureText(eg).width),og}getTextWidth(eg="",gg=0,ig="Arial"){const og=kn.createCanvasElement().getContext("2d");let ng=0;return og&&(og.font=`${gg}px ${ig}`,ng=og.measureText(eg).width),ng}getTextHeight(eg="测",gg=!0){const Ig=kn.createCanvasElement().getContext("2d");let og=0;if(Ig){Ig.font=`${this.fontSize}px ${this.fontFamily}`;let ng=Ig.measureText(eg);og=ng.fontBoundingBoxAscent+ng.fontBoundingBoxDescent+(gg?Math.trunc(this.fontSize/3):0)}return og*this._textLines.length}_measureChar(eg,gg,ig,Ig){if(eg!==" "&&eg!==" ")return super._measureChar(eg,gg,ig,Ig);{const og=this.getStandardSpaceWidth(" ",this.fontFamily);return{width:og,kernedWidth:og}}}parseColor(eg){if(!eg)return null;if(eg.startsWith("#")){let ig=eg.slice(1);ig.length===3&&(ig=ig.split("").map(og=>og+og).join(""));const Ig=parseInt(ig,16);return{r:Ig>>16&255,g:Ig>>8&255,b:Ig&255,a:1}}const gg=eg.match(/rgba?\(([^)]+)\)/);if(gg){const[ig,Ig,og,ng=1]=gg[1].split(",").map(sg=>Number(sg.trim()));return{r:ig,g:Ig,b:og,a:ng}}return null}luminance({r:eg,g:gg,b:ig}){return .2126*eg+.7152*gg+.0722*ig}isDark(eg,gg=40){const ig=this.parseColor(eg);return ig?this.luminance(ig)<=gg:!1}_renderArcText(eg){const gg=this.text.replace(/\u00A0/g," "),ig=this.fontSize,Ig=Math.abs(this.arcRadius),og=this.arcRadius>=0;eg.save(),eg.font=`${this.fontStyle==="italic"||this.hasSetItalic?"italic ":""}${this.fontWeight==="bold"?"bold ":""}${ig}px ${this.fontFamily}`,eg.fillStyle=this.fill||"#000000",eg.textAlign="center",eg.textBaseline="middle";const ng=(this.charSpacing||0)/1e3*ig,sg=[];let ag=0;for(const ug of gg){const dg=eg.measureText(ug).width+ng;sg.push(dg),ag+=dg}const Cg=ag/Ig,lg=Ig-Ig*Math.cos(Cg/2),Ag=og?Ig-lg/2:-(Ig-lg/2);let rg=(og?-Math.PI/2:Math.PI/2)-Cg/2;for(let ug=0;ug<gg.length;ug++){const dg=gg[ug],mg=sg[ug]/2,bg=rg+mg/Ig,pg=Math.cos(bg)*Ig,Zg=Math.sin(bg)*Ig;eg.save(),eg.translate(pg,Ag+Zg),og?eg.rotate(bg+Math.PI/2):eg.rotate(bg-Math.PI/2),eg.fillText(dg,0,0),eg.restore(),rg+=sg[ug]/Ig}eg.restore()}_getArcParams(){const eg=this.text.replace(/\u00A0/g," "),gg=this.fontSize,ig=Math.abs(this.arcRadius),Ig=this.arcRadius>=0,ng=kn.createCanvasElement().getContext("2d");ng.font=`${this.fontStyle==="italic"||this.hasSetItalic?"italic ":""}${this.fontWeight==="bold"?"bold ":""}${gg}px ${this.fontFamily}`;const sg=(this.charSpacing||0)/1e3*gg,ag=[];let Cg=0;for(const ug of eg){const dg=ng.measureText(ug).width+sg;ag.push(dg),Cg+=dg}const lg=Cg/ig,Ag=ig-ig*Math.cos(lg/2),cg=Ig?ig-Ag/2:-(ig-Ag/2),rg=Ig?-Math.PI/2:Math.PI/2;return{text:eg,fontSize:gg,r:ig,bendUp:Ig,charWidths:ag,totalWidth:Cg,totalAngle:lg,sagitta:Ag,circleCenterOffsetY:cg,baseAngle:rg}}_getArcCursorInfo(eg){const{text:gg,r:ig,bendUp:Ig,charWidths:og,totalAngle:ng,circleCenterOffsetY:sg,baseAngle:ag}=this._getArcParams();let Cg=0;for(let mg=0;mg<Math.min(eg,gg.length);mg++)Cg+=og[mg]/ig;const lg=ag-ng/2+Cg,Ag=Math.cos(lg)*ig,cg=Math.sin(lg)*ig,rg=Ag,ug=sg+cg,dg=Ig?lg+Math.PI/2:lg-Math.PI/2;return{x:rg,y:ug,angle:dg}}_calcArcBoundingBox(){const{text:eg,r:gg,bendUp:ig,charWidths:Ig,totalAngle:og,circleCenterOffsetY:ng,baseAngle:sg}=this._getArcParams(),ag=this.fontSize,Cg=ag/2+4;if(!eg.length)return{w:ag+Cg*2,h:ag*1.2+Cg*2};let lg=1/0,Ag=-1/0,cg=1/0,rg=-1/0,ug=sg-og/2;for(let bg=0;bg<eg.length;bg++){const pg=ug,Zg=ug+Ig[bg]/gg,Gg=(pg+Zg)/2,hg=Math.cos(Gg)*gg,fg=Math.sin(Gg)*gg,wg=hg,yg=ng+fg,Bg=ig?Gg+Math.PI/2:Gg-Math.PI/2,Wg=Math.cos(Bg),$g=Math.sin(Bg),Ng=Ig[bg]/2+Cg,Vg=ag/2+Cg,Mg=[{dx:-Ng,dy:-Vg},{dx:Ng,dy:-Vg},{dx:Ng,dy:Vg},{dx:-Ng,dy:Vg}];for(const{dx:Yg,dy:Sg}of Mg){const vg=wg+Yg*Wg-Sg*$g,Rg=yg+Yg*$g+Sg*Wg;vg<lg&&(lg=vg),vg>Ag&&(Ag=vg),Rg<cg&&(cg=Rg),Rg>rg&&(rg=Rg)}ug=Zg}const dg=Ag-lg,mg=rg-cg;return{w:Math.max(dg,1),h:Math.max(mg,1)}}initDimensions(){if(this.arcEnable&&!this.splitByGrapheme){this._splitText(),this._clearCache(),this.dirty=!0;const eg=this._calcArcBoundingBox();this.width=eg.w,this.height=eg.h}else super.initDimensions()}_render(eg){this.arcEnable&&!this.splitByGrapheme?this._renderArcText(eg):super._render(eg)}__getCursorBoundariesOffsets(eg){if(this.arcEnable&&!this.splitByGrapheme){const{charIndex:gg}=this.get2DCursorLocation(eg),ig=this._getArcCursorInfo(gg);return{left:ig.x+this.width/2,top:ig.y+this.height/2}}return super.__getCursorBoundariesOffsets(eg)}_renderCursor(eg,gg,ig){if(this.arcEnable&&!this.splitByGrapheme){const{charIndex:Ig}=this.get2DCursorLocation(ig),og=this._getArcCursorInfo(Ig),ng=this.fontSize,sg=this.getObjectScaling().x*this.canvas.getZoom(),ag=this.cursorWidth/sg;eg.save(),eg.fillStyle=this.cursorColor||this.fill||"#000000",eg.globalAlpha=this._currentCursorOpacity,eg.translate(og.x,og.y),eg.rotate(og.angle),eg.fillRect(-ag/2,-ng/2,ag,ng),eg.restore()}else super._renderCursor(eg,gg,ig)}getSelectionStartFromPointer(eg){if(this.arcEnable&&!this.splitByGrapheme){const gg=this.canvas.getScenePoint(eg).transform(kn.invertTransform(this.calcTransformMatrix())),{text:ig,r:Ig,bendUp:og,charWidths:ng,totalAngle:sg,circleCenterOffsetY:ag,baseAngle:Cg}=this._getArcParams();let lg=1/0,Ag=0,cg=Cg-sg/2;for(let rg=0;rg<=ig.length;rg++){const ug=cg,dg=Math.cos(ug)*Ig,mg=Math.sin(ug)*Ig,bg=dg,pg=ag+mg,Zg=gg.x-bg,Gg=gg.y-pg,hg=Zg*Zg+Gg*Gg;hg<lg&&(lg=hg,Ag=rg),rg<ig.length&&(cg+=ng[rg]/Ig)}return Math.min(Ag,this._text.length)}return super.getSelectionStartFromPointer(eg)}_renderSelection(eg,gg,ig){if(this.arcEnable&&!this.splitByGrapheme){const{text:Ig,r:og,bendUp:ng,charWidths:sg,totalAngle:ag,circleCenterOffsetY:Cg,baseAngle:lg}=this._getArcParams(),Ag=this.fontSize,cg=Math.min(gg.selectionStart,gg.selectionEnd),rg=Math.max(gg.selectionStart,gg.selectionEnd);eg.save(),eg.fillStyle=this.selectionColor||"rgba(0,0,255,0.3)";let ug=lg-ag/2;for(let dg=0;dg<Ig.length;dg++){const mg=ug,bg=ug+sg[dg]/og,pg=(mg+bg)/2;if(dg>=cg&&dg<rg){const Zg=Math.cos(pg)*og,Gg=Math.sin(pg)*og,hg=Zg,fg=Cg+Gg,wg=ng?pg+Math.PI/2:pg-Math.PI/2;eg.save(),eg.translate(hg,fg),eg.rotate(wg),eg.fillRect(-sg[dg]/2,-Ag/2,sg[dg],Ag),eg.restore()}ug=bg}eg.restore()}else super._renderSelection(eg,gg,ig)}render(eg){if(eg.shadowBlur=0,eg.shadowColor="transparent",eg.imageSmoothingEnabled=!1,eg.textRendering="geometricPrecision",this.isClearCopyTextStyle&&(this.styles={},this.isClearCopyTextStyle=!1),this.splitByGrapheme){let ig=this.width*this.scaleX,Ig=this.height*this.scaleY,og=this.getTextHeight();Ig<og&&(Ig=og),this.hasSetSplit=!0,(ig!==this.width||Ig!==this.height||this.scaleY!==1)&&(this.set({width:ig,height:Ig,scaleX:1,scaleY:1}),this.height=Ig,this.propsMinHeight=this.height,this.setCoords())}else if(this.arcEnable){this.propsMinHeight=0,this.hasSetSplit&&(this.hasSetSplit=!1);const ig=this._calcArcBoundingBox();(this.width!==ig.w||this.height!==ig.h||this.scaleX!==1||this.scaleY!==1)&&(this.set({width:ig.w,height:ig.h,scaleX:1,scaleY:1}),this.setCoords()),this._forceClearCache=!0}else{this.propsMinHeight=0,this.hasSetSplit&&(this.hasSetSplit=!1);const ig=this.text.replace(/ /g," ");ig!==this.text&&(this.text=ig);let Ig=eg.measureText(this.text);Ig.width!==this.width&&this.set({width:Ig.width}),this._forceClearCache=!0}let gg=this.skewX;this.skewX=this.hasSetItalic?-15:0,gg!==this.skewX&&this.setCoords(),this.objectCaching=this.charSpacing<=1e5&&this.text.length<=800,this.dirty=!0,super.render(eg)}toObject(eg){let gg=["hasSetItalic","propsMinHeight","verticalType","backgroundColor","isBgBlackColor","fromBarCodeID","fromBarCode2dID","connectBar2dMap","arcEnable","arcRadius"];return super.toObject(eg?[...eg,...gg]:gg)}};eC.type="Text";let AText=eC;tt.setClass(AText);const nC=class nC extends AText{constructor(eg,gg){super("",gg),this.update=!0,this.reviewValueArgs=null,this.toStopDateUpdateBarcode=!1,this.fontSize=ptToPx$1(12),this.increaseYearVal=0,this.increaseMonthVal=0,this.increaseDayVal=0,this.charSpacing=1,this.fontFamily="微软雅黑",console.log("ACounter",eg),this.props=eg,this._props.mode==="3"&&this.updateText(),nC.isMode1Args(this._props.args)&&(this._props.args.nextValue=void 0),this.fontSize=gg.fontSize??this.fontSize,this.charSpacing=gg.charSpacing??this.charSpacing,this.fontFamily=gg.fontFamily??this.fontFamily,this.increaseYearVal=gg.increaseYearVal??this.increaseYearVal,this.increaseMonthVal=gg.increaseMonthVal??this.increaseMonthVal,this.increaseDayVal=gg.increaseDayVal??this.increaseDayVal}render(eg){console.log("_render======"),this.updateText(),super.render(eg)}reviewRecover(){if(this._props.mode==="1"&&nC.isMode1Args(this._props.args)&&this.reviewValueArgs){this._props.args=this.reviewValueArgs,this.reviewValueArgs=null;const eg=this._props.args,gg=formatCounterValue(eg);this.text=(eg.prefix&&eg.prefix.length>0?eg.prefix:"")+gg+(eg.suffix&&eg.suffix.length>0?eg.suffix:""),this.dirty=!1,this.update=!1,this._forceClearCache=!0}}countCurrent(){if(this._props.mode==="1"){const eg=this._props.args;if(!eg.value&&eg.value!==0)return"";const gg=formatCounterValue(eg);return(eg.prefix&&eg.prefix.length>0?eg.prefix:"")+gg+(eg.suffix&&eg.suffix.length>0?eg.suffix:"")}return""}countNext(eg="print"){if(this._props.mode==="1"&&nC.isMode1Args(this._props.args)){const gg=this._props.args;if(!gg.value&&gg.value!==0)return;eg==="review"&&!this.reviewValueArgs&&(this.reviewValueArgs={...gg});const ig=formatCounterValue(gg);this.text=(gg.prefix&&gg.prefix.length>0?gg.prefix:"")+ig+(gg.suffix&&gg.suffix.length>0?gg.suffix:"");const Ig=getNextCounterValue(gg);Ig!==null&&(gg.value=Ig,console.log("update value f",gg.value)),this.update=!0,this.dirty=!0,this._forceClearCache=!0}}updateText({isUpdateBarCodeDate:eg=!0}={}){if(this.update&&this._props.mode==="1")if(nC.isMode1Args(this._props.args)){const gg=this._props.args;if(!gg.value&&gg.value!==0)return;const ig=formatCounterValue(gg);this.text=(gg.prefix&&gg.prefix.length>0?gg.prefix:"")+ig+(gg.suffix&&gg.suffix.length>0?gg.suffix:""),this.dirty=!0,this._forceClearCache=!0,console.log("updateText",this.text,gg)}else return;else if(this._props.mode==="2")if(nC.isMode2Args(this._props.args)){if(!this.toStopDateUpdateBarcode){const gg=formatDate(this._props.args.format,{years:this.increaseYearVal,months:this.increaseMonthVal,days:this.increaseDayVal});console.log("formatted",this._props.args.format,gg),this.text=gg,this.dirty=!0,this._forceClearCache=!0,eg&&handleConcatBarcode2d(this.connectBar2dMap,this.canvas,!1,{type:this.type,data:this._props.mode})}}else return;else this.update&&this._props.mode==="3"&&nC.isMode3Args(this._props.args)&&(this.text=this._props.args.text,this.dirty=!0,this._forceClearCache=!0);this.set("dirty",!0),this.update&&(this.initDimensions(),this.setCoords(),this.update=!1,this.canvas&&this._props.mode!=="2"&&(handleConcatBarcode2d(this.connectBar2dMap,this.canvas),this.canvas.fire("custom:object:changed",{target:this})))}set(eg,gg){return super.set(eg,gg)}set props(eg){this.editable=eg.mode==="3",this._props=eg,this.dirty=!0,this.update=!0}get props(){return this._props}static isMode1Args(eg){return"value"in eg}static isMode2Args(eg){return"format"in eg}static isMode3Args(eg){return"text"in eg}toObject(eg){nC.isMode3Args(this._props.args)&&(this._props.args.text=this.text);let gg=["connectBar2dMap","increaseYearVal","increaseMonthVal","increaseDayVal"];return super.toObject(eg?[...eg,"_props",...gg]:["_props",...gg])}};nC.type="Counter";let ACounter=nC;ACounter.fromObject=tg=>ACounter._fromObject(tg,{extraParam:"_props"}),tt.setClass(ACounter),tt.setSVGClass(ACounter);const Yc=class Yc extends na{constructor(eg,gg){super(eg,gg),this.imgScaleType="1",this.originRatio=0,this.setGrayFilter=!1,this.isScaleOtherSidedys=!1,this.isSetSharpen=!1,this.imageAlign="leftTop",this.customExportFields={varnish:"none"},this.prevCoordsPoints=null,this.gasolineLayer="none",this.noSetOtherPrevCoordsPoints=!1,gg.imgScaleType&&(this.imgScaleType=gg.imgScaleType),gg.setGrayFilter&&(this.setGrayFilter=gg.setGrayFilter),this.isScaleOtherSidedys=gg.isScaleOtherSidedys??this.isScaleOtherSidedys,this.isSetSharpen=gg.isSetSharpen??this.isSetSharpen,this.imageAlign=gg.imageAlign??this.imageAlign,this.prevCoordsPoints=gg.prevCoordsPoints??this.prevCoordsPoints,this.gasolineLayer=gg.gasolineLayer??this.gasolineLayer}refreshAlignCoords(eg=203){var gg;if(this.prevCoordsPoints){this.setCoords();let ig=o.DPI/eg;const{bl:Ig,br:og,tl:ng,tr:sg}=this.aCoords,{bl:ag,br:Cg,tl:lg,tr:Ag}=this.prevCoordsPoints;ag.x=ag.x*ig,ag.y=ag.y*ig,Cg.x=Cg.x*ig,Cg.y=Cg.y*ig,lg.x=lg.x*ig,lg.y=lg.y*ig,Ag.x=Ag.x*ig,Ag.y=Ag.y*ig;const cg={x:0,y:0};switch(this.imageAlign){case"leftTop":break;case"leftBottom":cg.x=ag.x-Ig.x,cg.y=ag.y-Ig.y;break;case"leftCenter":let rg={x:Ig.x,y:(Ig.y-ng.y)/2},ug={x:ag.x,y:(ag.y-lg.y)/2};cg.x=ug.x-rg.x,cg.y=ug.y-rg.y;break;case"topCenter":let dg={x:(sg.x-ng.x)/2,y:sg.y},mg={x:(Ag.x-lg.x)/2,y:Ag.y};cg.x=mg.x-dg.x,cg.y=mg.y-dg.y;break;case"rightCenter":let bg={x:sg.x,y:(og.y-sg.y)/2},pg={x:Ag.x,y:(Cg.y-Ag.y)/2};cg.x=pg.x-bg.x,cg.y=pg.y-bg.y;break;case"bottomCenter":let Zg={x:(og.x-Ig.x)/2,y:og.y},Gg={x:(Cg.x-ag.x)/2,y:Cg.y};cg.x=Gg.x-Zg.x,cg.y=Gg.y-Zg.y;break;case"center":let hg={x:(sg.x-ng.x)/2,y:(Ig.y-ng.y)/2},fg={x:(Ag.x-lg.x)/2,y:(ag.y-lg.y)/2};cg.x=fg.x-hg.x,cg.y=fg.y-hg.y;break;case"rightTop":cg.x=Ag.x-sg.x,cg.y=Ag.y-sg.y;break;case"rightBottom":cg.x=Cg.x-og.x,cg.y=Cg.y-og.y;break}this.set({left:this.left+cg.x,top:this.top+cg.y}),this.setCoords(),(gg=this.canvas)==null||gg.requestRenderAll()}}_render(eg){const gg=this._element;if(!gg)return;let ig=this._filterScalingX,Ig=this._filterScalingY,og=this.width,ng=this.height,sg=Math.max(this.cropX,0),ag=Math.max(this.cropY,0),Cg=gg.naturalWidth||gg.width,lg=gg.naturalHeight||gg.height,Ag=sg*ig,cg=ag*Ig,rg=-og/2,ug=-ng/2;this.originRatio=Cg/lg;let dg=this.originRatio;this.imgScaleType==="2"?(og=this.height*dg,rg=-og/2,this.isScaleOtherSidedys&&this.width!==og&&(this.width=og,!this.noSetOtherPrevCoordsPoints&&this.setCoords())):this.imgScaleType==="3"&&(ng=this.width/dg,ug=-ng/2,this.isScaleOtherSidedys&&this.height!==ng&&(this.height=ng,!this.noSetOtherPrevCoordsPoints&&this.setCoords())),eg.save(),eg.beginPath(),eg.rect(-this.width/2,-this.height/2,this.width,this.height),eg.clip(),this.fill&&(eg.fillStyle=this.fill,eg.fillRect(-this.width/2,-this.height/2,this.width,this.height)),this.stroke&&this.strokeWidth&&(eg.strokeStyle=this.stroke,eg.lineWidth=this.strokeWidth,eg.strokeRect(-this.width/2,-this.height/2,this.width,this.height)),eg.imageSmoothingEnabled=!0,eg.imageSmoothingQuality="high",eg.drawImage(gg,Ag,cg,Cg,lg,rg,ug,og,ng),eg.restore();const mg=this.filters.findIndex(bg=>bg.type==="Grayscale");if(this.setGrayFilter&&mg<0){const bg=new bh.Grayscale;this.filters.push(bg)}else!this.setGrayFilter&&mg>=0&&this.filters.splice(mg,1);this.applyFilters(),this.canvas.leRenderEnv!=="transform"&&!this.noSetOtherPrevCoordsPoints&&(this.prevCoordsPoints=this.aCoords)}set(eg,gg){return super.set(eg,gg)}toObject(eg){let gg=["imgScaleType","setGrayFilter","isScaleOtherSidedys","isSetSharpen","imageAlign","prevCoordsPoints","gasolineLayer"];return super.toObject(eg?[...eg,...gg]:gg)}fromObject(eg){return Yc._fromObject(eg)}};Yc.type="Image";let AImage=Yc;tt.setClass(AImage),tt.setSVGClass(AImage);const rd=class rd extends ho{constructor(){super(...arguments),this.perPixelTargetFind=!0}_render(eg){eg.beginPath();const{width:gg,height:ig}=this,Ig=gg/2,og=ig/2;eg.ellipse(0,0,Ig,og,0,0,Math.PI*2),this._renderPaintInOrder(eg)}set(eg,gg){return super.set(eg,gg)}};rd.type="Circle";let ACircle=rd;tt.setClass(ACircle);class ARect extends Er{constructor(eg){super(eg),this.perPixelTargetFind=!0}set(eg,gg){return super.set(eg,gg)}}tt.setClass(ARect);class ATriangle extends vo{constructor(eg={}){super(eg),this.perPixelTargetFind=!0}set(eg,gg){return super.set(eg,gg)}}tt.setClass(ATriangle),tt.setSVGClass(ATriangle);class ALine extends mo{constructor(eg,gg={}){super(eg,gg),this.perPixelTargetFind=!0}set(eg,gg){return super.set(eg,gg)}}tt.setClass(ALine);const s0=class s0 extends na{constructor(){super(...arguments),this.hasControls=!1,this.selectable=!1,this.evented=!0,this.hoverCursor="pointer"}_renderFill(eg){const gg=this._element;if(!gg)return;const ig=this._filterScalingX,Ig=this._filterScalingY,og=this.width,ng=this.height,sg=Math.max(this.cropX,0),ag=Math.max(this.cropY,0),Cg=gg.naturalWidth||gg.width,lg=gg.naturalHeight||gg.height,Ag=sg*ig,cg=ag*Ig,rg=-og/2,ug=-ng/2;gg&&eg.drawImage(gg,Ag,cg,Cg,lg,rg,ug,og,ng)}};s0.type="Rfid";let RfidIcon=s0;tt.setClass(RfidIcon),tt.setSVGClass(RfidIcon);const a0=class a0 extends No{constructor(eg,gg){if(super(eg,gg),this.hasSetSplit=!1,this.objectCaching=!0,this.hasSetItalic=!1,this.isClearCopyTextStyle=!1,this.propsMinHeight=0,this.splitByGrapheme=!0,this.customExportFields={varnish:"none"},this._renderTimer=null,this.verticalType="top",this.currentFontLevel=0,this.baseFontSize=118,this.splitByGrapheme=!0,this._originGetTopOffset=this._getTopOffset?this._getTopOffset.bind(this):()=>0,gg.hasSetItalic&&(this.hasSetItalic=gg.hasSetItalic),gg.propsMinHeight){this.propsMinHeight=gg.propsMinHeight;let ig=Math.max(this.height,this.propsMinHeight);this.height=ig}gg.verticalType&&(this.verticalType=gg.verticalType),this.customExportFields=gg.customExportFields??this.customExportFields,this.on("modified",()=>{this.verticalTypeChange()}),this.on("changed",()=>{this.verticalTypeChange()}),this.verticalTypeChange()}_calcTextHeight(){const eg=this._textLines&&this._textLines.length||0,gg=this.fontSize*this.lineHeight,ig=(this.padding||0)*2;return eg*gg+ig}_handleDotLineBreak(eg,gg){var ig;if(eg.includes("·")){const Ig=eg.indexOf("·"),og=/[\u4e00-\u9fa5]/g,ng=((ig=eg.substring(Ig+1).match(og))==null?void 0:ig.length)||0;if(this.charSpacing=1,Ig==2&&(ng==2||ng==1))return[eg];let sg=0;if(ng>=11||Ig>=10?sg=5:ng>=10||Ig>=9?sg=4:ng>=9||Ig>=8?sg=3:ng>=8||Ig>=7?sg=2:ng>=7||Ig>=6?sg=1:sg=0,sg!==this.currentFontLevel){switch(sg){case 5:this.fontSize=64;break;case 4:this.fontSize=70;break;case 3:this.fontSize=78;break;case 2:this.fontSize=88;break;case 1:this.fontSize=100;break;case 0:this.fontSize=this.baseFontSize??118;break}this.currentFontLevel=sg}const ag=eg.substring(0,Ig+1),Cg=eg.substring(Ig+1).trim();return Cg?[ag,Cg]:[eg]}else eg.length<=4?(this.fontSize=this.baseFontSize??118,this.currentFontLevel=0,eg.length===2?this.charSpacing=800:eg.length===3?this.charSpacing=300:eg.length===4&&(this.charSpacing=300)):(this.charSpacing=1,this.fontSize=this.baseFontSize,this.currentFontLevel=0);return[...gg]}_wrapText(eg,gg){if(this.isClearCopyTextStyle&&(this.styles={},this.verticalTypeChange()),this.splitByGrapheme){const ig=o.DPI??96,ng=3*.393701*ig,sg=this.text;let ag=[...eg];return ag=this._handleDotLineBreak(sg,eg),this.width!==ng&&(this.width=ng,this.setCoords(),this._renderTimer&&clearTimeout(this._renderTimer),this._renderTimer=setTimeout(()=>{var Cg;(Cg=this.canvas)==null||Cg.requestRenderAll()},0)),super._wrapText(ag,ng)}else return super._wrapText(eg,gg)}verticalTypeChange(){var gg;if(!this.splitByGrapheme||!this.propsMinHeight)return;const eg=Math.max(this._calcTextHeight(),this.propsMinHeight);this.height!==eg&&(this.height=eg),this.verticalType==="top"?this._getTopOffset=this._originGetTopOffset:this.verticalType==="vcenter"?this._getTopOffset=()=>{let ig=this._calcTextHeight();return(this.fontSize*this.lineHeight-this.fontSize)/2-ig/2}:this.verticalType==="bottom"&&(this._getTopOffset=()=>{const ig=this._calcTextHeight(),og=Math.max(ig,this.propsMinHeight)-ig;return this._originGetTopOffset()+og}),this.setCoords(),(gg=this.canvas)==null||gg.requestRenderAll()}set(eg,gg){return(eg==="fill"||eg==="stroke"||eg==="underline"||eg==="overline"||eg==="linethrough"||eg==="fontWeight"||eg==="fontStyle")&&(this.styles={}),super.set(eg,gg)}set locked(eg){super.locked=eg,this.editable=!eg}get locked(){return super.locked}_measureLine(eg){let gg=this._textLines[eg];return Array.isArray(gg)&&(gg=gg.map(ig=>ig.replace(" "," "))),this._textLines[eg]=gg,super._measureLine(eg)}getStandardSpaceWidth(eg=" ",gg="Arial"){const Ig=kn.createCanvasElement().getContext("2d");let og=0;return Ig&&(Ig.font=`${this.fontSize}px ${gg}`,og=Ig.measureText(eg).width),og}getTextWidth(eg="",gg=0,ig="Arial"){const og=kn.createCanvasElement().getContext("2d");let ng=0;return og&&(og.font=`${gg}px ${ig}`,ng=og.measureText(eg).width),ng}getTextHeight(eg="测",gg=!0){const Ig=kn.createCanvasElement().getContext("2d");let og=0;if(Ig){Ig.font=`${this.fontSize}px ${this.fontFamily}`;let ng=Ig.measureText(eg);og=ng.fontBoundingBoxAscent+ng.fontBoundingBoxDescent+(gg?Math.trunc(this.fontSize/3):0)}return og*this._textLines.length}_measureChar(eg,gg,ig,Ig){if(eg!==" "&&eg!==" ")return super._measureChar(eg,gg,ig,Ig);{const og=this.getStandardSpaceWidth(" ",this.fontFamily);return{width:og,kernedWidth:og}}}render(eg){if(eg.shadowBlur=0,eg.shadowColor="transparent",eg.imageSmoothingEnabled=!1,this.isClearCopyTextStyle&&(this.styles={}),this.splitByGrapheme){let ig=this.width*this.scaleX,Ig=this.height*this.scaleY,og=this.getTextHeight();Ig<og&&(Ig=og),this.hasSetSplit=!0,(ig!==this.width||Ig!==this.height||this.scaleY!==1)&&(this.set({width:ig,height:Ig,scaleX:1,scaleY:1}),this.height=Ig,this.propsMinHeight=this.height,this.setCoords())}else{this.propsMinHeight=0,this.hasSetSplit&&(this.hasSetSplit=!1);const ig=this.text.replace(/ /g," ");ig!==this.text&&(this.text=ig);let Ig=eg.measureText(this.text);Ig.width!==this.width&&this.set({width:Ig.width}),this._forceClearCache=!0}let gg=this.skewX;this.skewX=this.hasSetItalic?-15:0,gg!==this.skewX&&this.setCoords(),this.charSpacing>1e5?this.objectCaching=!1:this.objectCaching=!0,this.dirty=!0,super.render(eg)}toObject(eg){let gg=["hasSetItalic","propsMinHeight","verticalType","customExportFields"];return super.toObject(eg?[...eg,...gg]:gg)}};a0.type="TextName";let ATextName=a0;tt.setClass(ATextName);const l0=class l0 extends Er{constructor(eg={}){const{rows:gg,columns:ig,tableTexts:Ig,tableCellStyles:og,tableCellBorders:ng,tableCellSpans:sg,columnWidths:ag,rowHeights:Cg,fontSize:lg,fontFamily:Ag,fontWeight:cg,fontStyle:rg,underline:ug,linethrough:dg,charSpacing:mg,lineHeight:bg,textAlign:pg,verticalType:Zg,...Gg}=eg;super({fill:"#000000FF",backgroundColor:"#FFFFFF00",stroke:"#000000",strokeWidth:1,...Gg}),this.perPixelTargetFind=!1,this.rows=2,this.columns=2,this.tableTexts=[],this.tableCellStyles=[],this.tableCellBorders=[],this.tableCellSpans=[],this.columnWidths=[],this.rowHeights=[],this.fontSize=24,this.fontFamily="微软雅黑",this.fontWeight="normal",this.fontStyle="normal",this.underline=!1,this.linethrough=!1,this.charSpacing=0,this.lineHeight=1.2,this.textAlign="center",this.verticalType="vcenter",this.strokeUniform=!0,this.selectedCellIndex=null,this.editingTextarea=null,this.keepEditingOnNextBlur=!1,this.editingPointerDownHandler=null,this.rows=this.normalizeCount(gg,2),this.columns=this.normalizeCount(ig,2),this.tableTexts=[...Ig||[]],this.tableCellStyles=[...og||[]],this.tableCellBorders=[...ng||[]],this.tableCellSpans=[...sg||[]],this.columnWidths=[...ag||[]],this.rowHeights=[...Cg||[]],this.syncTextCount(),this.applyTextOptions({fontSize:lg,fontFamily:Ag,fontWeight:cg,fontStyle:rg,underline:ug,linethrough:dg,charSpacing:mg,lineHeight:bg,textAlign:pg,verticalType:Zg}),this.on("scaling",hg=>this.resizeDuringScaling(hg)),this.on("modified",()=>{this.scaleAnchor=void 0}),this.on("removed",()=>this.removeEditingTextarea(!1))}set(eg,gg){var Ig,og,ng,sg,ag,Cg,lg;if(typeof eg=="object"&&eg)return Object.keys(eg).forEach(Ag=>this.set(Ag,eg[Ag])),this;if(eg==="rows"||eg==="columns"){this.removeEditingTextarea(!0);const Ag=this.normalizeCount(gg,eg==="rows"?this.rows:this.columns),cg=this.rows,rg=this.columns,ug=eg==="rows"?Ag:this.rows,dg=eg==="columns"?Ag:this.columns;return this.resizeByCountChange(eg,Ag),this.remapCellData(cg,rg,ug,dg),this[eg]=Ag,this.syncTextCount(),this.selectedCellIndex!==null&&this.selectedCellIndex>=this.rows*this.columns&&(this.selectedCellIndex=null),this.dirty=!0,this.setCoords(),(Ig=this.canvas)==null||Ig.requestRenderAll(),this}if(eg==="tableTexts")return this.tableTexts=Array.isArray(gg)?[...gg]:[],this.syncTextCount(),this.dirty=!0,(og=this.canvas)==null||og.requestRenderAll(),this;if(eg==="tableCellStyles")return this.tableCellStyles=Array.isArray(gg)?[...gg]:[],this.syncTextCount(),this.dirty=!0,(ng=this.canvas)==null||ng.requestRenderAll(),this;if(eg==="tableCellBorders")return this.tableCellBorders=Array.isArray(gg)?[...gg]:[],this.syncTextCount(),this.dirty=!0,(sg=this.canvas)==null||sg.requestRenderAll(),this;if(eg==="tableCellSpans")return this.tableCellSpans=Array.isArray(gg)?[...gg]:[],this.syncTextCount(),this.dirty=!0,(ag=this.canvas)==null||ag.requestRenderAll(),this;if(eg==="columnWidths"||eg==="rowHeights")return this[eg]=Array.isArray(gg)?[...gg]:[],this.syncTextCount(),this.dirty=!0,(Cg=this.canvas)==null||Cg.requestRenderAll(),this;const ig=super.set(eg,gg);return this.isTextStyleKey(eg)&&(this.dirty=!0,(lg=this.canvas)==null||lg.requestRenderAll(),this.updateEditingTextarea()),ig}toObject(eg){const gg=["rows","columns","tableTexts","tableCellStyles","tableCellBorders","tableCellSpans","columnWidths","rowHeights","fontSize","fontFamily","fontWeight","fontStyle","underline","linethrough","charSpacing","lineHeight","textAlign","verticalType","backgroundColor"];return super.toObject(eg?[...eg,...gg]:gg)}normalizeCount(eg,gg){const ig=Math.floor(Number(eg));return Number.isFinite(ig)?Math.min(Math.max(ig,1),50):gg}resizeDuringScaling(eg){const gg=eg==null?void 0:eg.transform;if(!gg)return;const ig=gg.corner,Ig=["ml","tl","bl"].includes(ig),og=["mr","tr","br"].includes(ig),ng=["mt","tl","tr"].includes(ig),sg=["mb","bl","br"].includes(ig);if(!this.scaleAnchor){const Ag=Ig?"right":og?"left":"center",cg=ng?"bottom":sg?"top":"center";this.scaleAnchor={point:this.getPointByOrigin(Ag,cg),originX:Ag,originY:cg}}this.width=Math.max(1,(this.width||1)*Math.abs(this.scaleX||1)),this.height=Math.max(1,(this.height||1)*Math.abs(this.scaleY||1)),this.scaleX=1,this.scaleY=1;const{point:ag,originX:Cg,originY:lg}=this.scaleAnchor;if(this.group){const Ag=kn.invertTransform(this.group.calcTransformMatrix()),cg=kn.transformPoint(ag,Ag);this.setPositionByOrigin(cg,Cg,lg)}else this.setPositionByOrigin(ag,Cg,lg);this.updateEditingTextarea(),this.dirty=!0,this.setCoords()}resizeByCountChange(eg,gg){if(eg==="columns"){const ig=this.width||0,Ig=Array.from({length:this.columns},(Cg,lg)=>(this.columnWidths[lg]||1/this.columns)*ig),og=Ig.reduce((Cg,lg)=>Cg+lg,0)/(Ig.length||1)||ig/(this.columns||1)||1,ng=Array.from({length:gg},(Cg,lg)=>lg<Ig.length?Ig[lg]:og),sg=ng.reduce((Cg,lg)=>Cg+lg,0);this.width=sg;const ag=sg||1;this.columnWidths=ng.map(Cg=>Cg/ag)}if(eg==="rows"){const ig=this.height||0,Ig=Array.from({length:this.rows},(Cg,lg)=>(this.rowHeights[lg]||1/this.rows)*ig),og=Ig.reduce((Cg,lg)=>Cg+lg,0)/(Ig.length||1)||ig/(this.rows||1)||1,ng=Array.from({length:gg},(Cg,lg)=>lg<Ig.length?Ig[lg]:og),sg=ng.reduce((Cg,lg)=>Cg+lg,0);this.height=sg;const ag=sg||1;this.rowHeights=ng.map(Cg=>Cg/ag)}}remapCellData(eg,gg,ig,Ig){if(eg===ig&&gg===Ig)return;const og=Array.isArray(this.tableTexts)?[...this.tableTexts]:[],ng=Array.isArray(this.tableCellStyles)?[...this.tableCellStyles]:[],sg=Array.isArray(this.tableCellBorders)?[...this.tableCellBorders]:[],ag=Array.isArray(this.tableCellSpans)?[...this.tableCellSpans]:[],Cg=ig*Ig;this.tableTexts=Array.from({length:Cg},(lg,Ag)=>{const cg=Math.floor(Ag/Ig),rg=Ag%Ig;return cg>=eg||rg>=gg?"":og[cg*gg+rg]||""}),this.tableCellStyles=Array.from({length:Cg},(lg,Ag)=>{const cg=Math.floor(Ag/Ig),rg=Ag%Ig;return cg>=eg||rg>=gg?{}:{...ng[cg*gg+rg]||{}}}),this.tableCellBorders=Array.from({length:Cg},(lg,Ag)=>{const cg=Math.floor(Ag/Ig),rg=Ag%Ig;return cg>=eg||rg>=gg?{}:{...sg[cg*gg+rg]||{}}}),this.tableCellSpans=Array.from({length:Cg},(lg,Ag)=>{const cg=Math.floor(Ag/Ig),rg=Ag%Ig;if(cg>=eg||rg>=gg)return this.createDefaultCellSpan();const ug=ag[cg*gg+rg]||{},dg=Number(ug.masterIndex),mg=Number.isFinite(dg)&&dg>=0?this.mapOldCellIndex(dg,gg,ig,Ig):null;return{...this.createDefaultCellSpan(),...ug,masterIndex:mg}}),this.selectedCellIndex!==null&&(this.selectedCellIndex=this.mapOldCellIndex(this.selectedCellIndex,gg,ig,Ig))}mapOldCellIndex(eg,gg,ig,Ig){const og=Math.floor(eg/gg),ng=eg%gg;return og>=ig||ng>=Ig?null:og*Ig+ng}createDefaultCellSpan(){return{rowSpan:1,colSpan:1,hidden:!1,masterIndex:null}}syncTextCount(){Array.isArray(this.tableTexts)||(this.tableTexts=[]);const eg=this.rows*this.columns;for(this.tableTexts.length>eg&&(this.tableTexts=this.tableTexts.slice(0,eg));this.tableTexts.length<eg;)this.tableTexts.push("");for(Array.isArray(this.tableCellStyles)||(this.tableCellStyles=[]),this.tableCellStyles.length>eg&&(this.tableCellStyles=this.tableCellStyles.slice(0,eg));this.tableCellStyles.length<eg;)this.tableCellStyles.push({});for(Array.isArray(this.tableCellBorders)||(this.tableCellBorders=[]),this.tableCellBorders.length>eg&&(this.tableCellBorders=this.tableCellBorders.slice(0,eg));this.tableCellBorders.length<eg;)this.tableCellBorders.push({});for(Array.isArray(this.tableCellSpans)||(this.tableCellSpans=[]),this.tableCellSpans.length>eg&&(this.tableCellSpans=this.tableCellSpans.slice(0,eg));this.tableCellSpans.length<eg;)this.tableCellSpans.push(this.createDefaultCellSpan());this.syncDimensionRatios(),this.selectedCellIndex!==null&&this.selectedCellIndex>=eg&&(this.selectedCellIndex=null)}syncDimensionRatios(){this.columnWidths=this.normalizeRatios(this.columnWidths,this.columns),this.rowHeights=this.normalizeRatios(this.rowHeights,this.rows)}normalizeRatios(eg,gg){const ig=Array.from({length:gg},(og,ng)=>{const sg=Number(eg[ng]);return Number.isFinite(sg)&&sg>0?sg:1}),Ig=ig.reduce((og,ng)=>og+ng,0)||gg||1;return ig.map(og=>og/Ig)}applyTextOptions(eg){["fontSize","fontFamily","fontWeight","fontStyle","underline","linethrough","charSpacing","lineHeight","textAlign","verticalType"].forEach(ig=>{eg[ig]!==void 0&&(this[ig]=eg[ig])})}isTextStyleKey(eg){return["fontSize","fontFamily","fontWeight","fontStyle","underline","linethrough","charSpacing","lineHeight","textAlign","verticalType","fill"].includes(eg)}getTextX(eg,gg,ig){return this.getTextXByAlign(eg,gg,ig,this.textAlign)}getTextXByAlign(eg,gg,ig,Ig="center"){return Ig==="left"?eg+ig:Ig==="right"?eg+gg-ig:eg+gg/2}getTextStartYByVertical(eg,gg,ig,Ig,og,ng="vcenter"){return ng==="top"?eg+ig+og/2:ng==="bottom"?eg+gg-ig-Ig+og/2:eg+gg/2-Ig/2+og/2}getTextareaVerticalPadding(eg,gg,ig){if(eg.verticalType==="top")return{top:0,bottom:0};const Ig=Math.max(gg-ig,0);return eg.verticalType==="bottom"?{top:Ig,bottom:0}:{top:Ig/2,bottom:0}}getDefaultCellStyle(){return{fontSize:Number(this.fontSize)||12,fontFamily:this.fontFamily||"微软雅黑",fill:this.fill||"#000000",fontWeight:this.fontWeight||"normal",fontStyle:this.fontStyle||"normal",underline:!!this.underline,linethrough:!!this.linethrough,charSpacing:Number(this.charSpacing)||0,lineHeight:Number(this.lineHeight)||1.2,textAlign:this.textAlign||"center",verticalType:this.verticalType||"vcenter"}}getCellStyle(eg){return this.syncTextCount(),{...this.getDefaultCellStyle(),...this.tableCellStyles[eg]||{}}}setCellStyle(eg,gg){var ig,Ig;this.syncTextCount(),!(eg<0||eg>=this.rows*this.columns)&&(this.tableCellStyles[eg]={...this.tableCellStyles[eg]||{},...gg},this.updateEditingTextarea(eg),this.dirty=!0,(ig=this.canvas)==null||ig.requestRenderAll(),(Ig=this.canvas)==null||Ig.fire("object:modified",{target:this}))}getCellBorderStyle(eg){return this.syncTextCount(),{top:"solid",right:"solid",bottom:"solid",left:"solid",...this.tableCellBorders[eg]||{}}}setCellBorderStyle(eg,gg){var ig,Ig;this.syncTextCount(),!(eg<0||eg>=this.rows*this.columns)&&(this.tableCellBorders[eg]={...this.tableCellBorders[eg]||{},...gg},this.dirty=!0,(ig=this.canvas)==null||ig.requestRenderAll(),(Ig=this.canvas)==null||Ig.fire("object:modified",{target:this}))}setAllCellBorderStyle(eg){var gg,ig;this.syncTextCount(),this.tableCellBorders=Array.from({length:this.rows*this.columns},()=>({top:eg,right:eg,bottom:eg,left:eg})),this.dirty=!0,(gg=this.canvas)==null||gg.requestRenderAll(),(ig=this.canvas)==null||ig.fire("object:modified",{target:this,action:"modifyprops"})}getCellLayout(eg){return{...this.getCellRect(eg),row:Math.floor(eg/this.columns),col:eg%this.columns}}setColumnWidth(eg,gg){var Cg,lg;const ig=this.width||0;if(eg<0||eg>=this.columns||!ig)return;const Ig=Math.min(8/ig,.9/this.columns),og=this.columns>1?1-Ig*(this.columns-1):1,ng=Math.min(Math.max(Number(gg)/ig,Ig),og),sg=this.columnWidths.reduce((Ag,cg,rg)=>Ag+(rg===eg?0:cg),0),ag=Math.max(1-ng,Ig*(this.columns-1));this.columnWidths=this.columnWidths.map((Ag,cg)=>cg===eg?ng:sg?Ag/sg*ag:ag/(this.columns-1)),this.syncDimensionRatios(),this.updateEditingTextarea(),this.dirty=!0,(Cg=this.canvas)==null||Cg.requestRenderAll(),(lg=this.canvas)==null||lg.fire("object:modified",{target:this})}setRowHeight(eg,gg){var Cg,lg;const ig=this.height||0;if(eg<0||eg>=this.rows||!ig)return;const Ig=Math.min(8/ig,.9/this.rows),og=this.rows>1?1-Ig*(this.rows-1):1,ng=Math.min(Math.max(Number(gg)/ig,Ig),og),sg=this.rowHeights.reduce((Ag,cg,rg)=>Ag+(rg===eg?0:cg),0),ag=Math.max(1-ng,Ig*(this.rows-1));this.rowHeights=this.rowHeights.map((Ag,cg)=>cg===eg?ng:sg?Ag/sg*ag:ag/(this.rows-1)),this.syncDimensionRatios(),this.updateEditingTextarea(),this.dirty=!0,(Cg=this.canvas)==null||Cg.requestRenderAll(),(lg=this.canvas)==null||lg.fire("object:modified",{target:this})}getColumnOffset(eg){const gg=this.width||0;return-gg/2+this.columnWidths.slice(0,eg).reduce((ig,Ig)=>ig+Ig*gg,0)}getRowOffset(eg){const gg=this.height||0;return-gg/2+this.rowHeights.slice(0,eg).reduce((ig,Ig)=>ig+Ig*gg,0)}getCellRect(eg){const gg=this.width||0,ig=this.height||0,Ig=Math.floor(eg/this.columns),og=eg%this.columns,ng=(this.columnWidths[og]||0)*gg,sg=(this.rowHeights[Ig]||0)*ig;return{left:this.getColumnOffset(og),top:this.getRowOffset(Ig),width:ng,height:sg}}getCellIndexByPoint(eg){const gg=this.width||0,ig=this.height||0;if(!gg||!ig||!this.rows||!this.columns)return-1;const Ig=kn.invertTransform(this.calcTransformMatrix()),og=kn.transformPoint(new ot(eg.x,eg.y),Ig),ng=og.x+gg/2,sg=og.y+ig/2;if(ng<0||sg<0||ng>gg||sg>ig)return-1;let ag=0,Cg=this.columns-1;for(let cg=0;cg<this.columns;cg++)if(ag+=this.columnWidths[cg]*gg,ng<=ag){Cg=cg;break}let lg=0,Ag=this.rows-1;for(let cg=0;cg<this.rows;cg++)if(lg+=this.rowHeights[cg]*ig,sg<=lg){Ag=cg;break}return Ag*this.columns+Cg}getViewportCellRect(eg){if(!this.canvas)return null;const gg=this.getCellRect(eg),ig=this.calcTransformMatrix(),Ig=this.canvas.viewportTransform,og=[new ot(gg.left,gg.top),new ot(gg.left+gg.width,gg.top),new ot(gg.left+gg.width,gg.top+gg.height),new ot(gg.left,gg.top+gg.height)].map(ag=>{const Cg=kn.transformPoint(ag,ig);return Ig?kn.transformPoint(Cg,Ig):Cg}),ng=og.map(ag=>ag.x),sg=og.map(ag=>ag.y);return{left:Math.min(...ng),top:Math.min(...sg),width:Math.max(...ng)-Math.min(...ng),height:Math.max(...sg)-Math.min(...sg)}}getCanvasElementRect(){var gg,ig;return this.canvas?(((ig=(gg=this.canvas.elements)==null?void 0:gg.upper)==null?void 0:ig.el)||this.canvas.upperCanvasEl||this.canvas.getElement()).getBoundingClientRect():null}removeEditingTextarea(eg=!0){var Ig,og,ng;if(!this.editingTextarea)return;const gg=this.editingTextarea;this.editingTextarea=null;const ig=Number(gg.dataset.cellIndex);this.editingPointerDownHandler&&(document.removeEventListener("pointerdown",this.editingPointerDownHandler,!0),this.editingPointerDownHandler=null),eg&&Number.isFinite(ig)&&(this.tableTexts[ig]=gg.value,this.dirty=!0,(Ig=this.canvas)==null||Ig.fire("object:modified",{target:this})),(og=gg.parentNode)==null||og.removeChild(gg),this.selectedCellIndex=null,this.dirty=!0,(ng=this.canvas)==null||ng.requestRenderAll()}isEditingAssistantTarget(eg){return!!eg.closest([".right-side-bar",".ant-select-dropdown",".ant-select-item",".ant-select-selector",".ant-select-selection-search-input",".ant-input-number",".ant-input-number-dropdown",".ant-dropdown",".ant-tooltip",".ant-popover"].join(","))}bindEditingPointerDown(eg){this.editingPointerDownHandler&&document.removeEventListener("pointerdown",this.editingPointerDownHandler,!0),this.editingPointerDownHandler=gg=>{const ig=gg.target;if(!(!ig||ig===eg||eg.contains(ig))){if(this.isEditingAssistantTarget(ig)){this.keepEditingOnNextBlur=!0;return}this.removeEditingTextarea(!0)}},document.addEventListener("pointerdown",this.editingPointerDownHandler,!0)}updateEditingTextarea(eg){if(!this.editingTextarea)return;const gg=this.editingTextarea,ig=Number(gg.dataset.cellIndex);if(!Number.isFinite(ig)||eg!==void 0&&eg!==ig)return;const Ig=this.getViewportCellRect(ig),og=this.getCanvasElementRect();if(!Ig||!og)return;const ng=this.getCellStyle(ig),sg=this.getCellEditFontSize(ig,Ig.height),ag=Math.max(2,Math.min(sg*.18,8)),Cg=Math.max(Ig.width-ag*2,12),lg=Math.max(Ig.height-ag*2,12),Ag=sg*(Number(ng.lineHeight)||1.2),cg=Math.max(gg.value.split(/\r?\n/).length,1),rg=this.getTextareaVerticalPadding(ng,lg,Ag*cg);gg.style.left=`${og.left+Ig.left+ag}px`,gg.style.top=`${og.top+Ig.top+ag}px`,gg.style.width=`${Cg}px`,gg.style.height=`${lg}px`,gg.style.color=ng.fill,gg.style.font=this.getFont(sg,ng),gg.style.lineHeight=`${Ag}px`,gg.style.textAlign=ng.textAlign,gg.style.letterSpacing=`${this.getSpacingPx(ng,sg)}px`,gg.style.padding=`${rg.top}px 0 ${rg.bottom}px 0`}startCellEditing(eg){if(!this.canvas)return;this.removeEditingTextarea(!0);const gg=this.getViewportCellRect(eg);if(!gg)return;const ig=this.getCanvasElementRect();if(!ig)return;const Ig=this.getCellEditFontSize(eg,gg.height),og=Math.max(2,Math.min(Ig*.18,8)),ng=document.createElement("textarea");ng.value=this.tableTexts[eg]||"",ng.dataset.cellIndex=`${eg}`,ng.spellcheck=!1,ng.style.position="fixed",ng.style.left=`${ig.left+gg.left+og}px`,ng.style.top=`${ig.top+gg.top+og}px`,ng.style.width=`${Math.max(gg.width-og*2,12)}px`,ng.style.height=`${Math.max(gg.height-og*2,12)}px`,ng.style.zIndex="9999",ng.style.padding="0",ng.style.margin="0",ng.style.border="1px solid #2F54EB",ng.style.outline="none",ng.style.resize="none",ng.style.overflow="hidden",ng.style.background="rgba(255, 255, 255, 0.92)";const sg=this.getCellStyle(eg);ng.style.color=sg.fill,ng.style.font=this.getFont(Ig,sg),ng.style.lineHeight=`${sg.lineHeight}`,ng.style.textAlign=sg.textAlign,ng.style.letterSpacing=`${this.getSpacingPx(sg,Ig)}px`,ng.style.boxSizing="border-box",ng.style.transformOrigin="left top";const ag=Cg=>Cg.stopPropagation();ng.addEventListener("mousedown",ag),ng.addEventListener("pointerdown",ag),ng.addEventListener("dblclick",ag),ng.addEventListener("keydown",Cg=>{Cg.stopPropagation(),Cg.key==="Escape"?(Cg.preventDefault(),this.removeEditingTextarea(!1)):Cg.key==="Enter"&&!Cg.shiftKey&&(Cg.preventDefault(),this.removeEditingTextarea(!0))}),ng.addEventListener("input",()=>this.updateEditingTextarea(eg)),ng.addEventListener("blur",()=>{if(this.keepEditingOnNextBlur){this.keepEditingOnNextBlur=!1;return}this.removeEditingTextarea(!0)}),document.body.appendChild(ng),this.editingTextarea=ng,this.bindEditingPointerDown(ng),this.updateEditingTextarea(eg),ng.focus(),ng.select()}selectCell(eg){var gg;this.selectedCellIndex=eg,this.dirty=!0,(gg=this.canvas)==null||gg.requestRenderAll()}handleCellDoubleClick(eg){const gg=this.getCellIndexByPoint(eg);gg<0||(this.selectCell(gg),this.startCellEditing(gg))}getFont(eg,gg){const ig=gg.fontStyle==="italic"?"italic ":"",Ig=gg.fontWeight==="bold"?"bold ":"";return`${ig}${Ig}${eg}px ${gg.fontFamily}`}getViewportZoom(){var ig,Ig;const eg=this.canvas,gg=(ig=this.canvas)==null?void 0:ig.viewportTransform;return((Ig=eg==null?void 0:eg.getZoom)==null?void 0:Ig.call(eg))||(gg?Math.hypot(gg[0],gg[1]):1)||1}getCellEditFontSize(eg,gg){const ig=this.getCellStyle(eg).fontSize||12;return Math.max(ig*this.getViewportZoom(),8)}getSpacingPx(eg,gg){return(Number(eg.charSpacing)||0)/1e3*gg}measureTextWidth(eg,gg,ig,Ig){const og=this.getSpacingPx(ig,Ig);return!gg||!og?eg.measureText(gg).width:Array.from(gg).reduce((ng,sg)=>ng+eg.measureText(sg).width,0)+Math.max(Array.from(gg).length-1,0)*og}drawTextLine(eg,gg,ig,Ig,og,ng){const sg=this.getSpacingPx(ig,ng);if(!sg){eg.fillText(gg,Ig,og);return}const ag=Array.from(gg);let Cg=Ig;const lg=this.measureTextWidth(eg,gg,ig,ng);ig.textAlign==="center"&&(Cg=Ig-lg/2),ig.textAlign==="right"&&(Cg=Ig-lg),eg.textAlign="left",ag.forEach(Ag=>{eg.fillText(Ag,Cg,og),Cg+=eg.measureText(Ag).width+sg})}drawTextDecoration(eg,gg,ig,Ig,og,ng,sg){if(!sg.underline&&!sg.linethrough)return;const ag=Math.min(this.measureTextWidth(eg,gg,sg,ng),og);let Cg=ig-ag/2;if(sg.textAlign==="left"&&(Cg=ig),sg.textAlign==="right"&&(Cg=ig-ag),eg.strokeStyle=sg.fill||"#000000",eg.lineWidth=Math.max(ng/16,1),sg.underline){const lg=Ig+ng*.38;eg.beginPath(),eg.moveTo(Cg,lg),eg.lineTo(Cg+ag,lg),eg.stroke()}sg.linethrough&&(eg.beginPath(),eg.moveTo(Cg,Ig),eg.lineTo(Cg+ag,Ig),eg.stroke())}drawCellText(eg,gg,ig,Ig,og,ng,sg){if(!gg)return;const ag=Math.min(4,og/6,ng/6),Cg=Math.max(og-ag*2,1),lg=this.getCellStyle(sg),Ag=this.getTextXByAlign(ig,og,ag,lg.textAlign),cg=this.scaleX||1,rg=this.scaleY||1,ug=Math.max(Number(lg.fontSize)||12,1),dg=String(gg).split(/\r?\n/),mg=ug*(Number(lg.lineHeight)||1.2),bg=dg.length*mg,pg=this.getTextStartYByVertical(Ig,ng,ag,bg,mg,lg.verticalType);eg.save(),eg.beginPath(),eg.rect(ig+.5,Ig+.5,Math.max(og-1,1),Math.max(ng-1,1)),eg.clip(),eg.translate(Ag,pg),eg.scale(1/cg,1/rg),eg.fillStyle=lg.fill||"#000000",eg.font=this.getFont(ug,lg),eg.textAlign=lg.textAlign,eg.textBaseline="middle",dg.forEach((Zg,Gg)=>{const hg=Gg*mg*rg;this.drawTextLine(eg,Zg,lg,0,hg,ug),this.drawTextDecoration(eg,Zg,0,hg,Cg*cg,ug,lg)}),eg.restore()}drawSelectedCell(eg){if(this.selectedCellIndex===null)return;const gg=this.selectedCellIndex;if(gg<0||gg>=this.rows*this.columns)return;const ig=this.getCellRect(gg);eg.save(),eg.fillStyle="rgba(47, 84, 235, 0.14)",eg.strokeStyle="#2F54EB",eg.lineWidth=1,eg.fillRect(ig.left,ig.top,ig.width,ig.height),eg.strokeRect(ig.left+.5,ig.top+.5,Math.max(ig.width-1,1),Math.max(ig.height-1,1)),eg.restore()}resolveBorderStyle(eg,gg){return eg==="none"||gg==="none"?"none":eg==="dashed"||gg==="dashed"?"dashed":"solid"}getDefaultBorderStyle(){return Array.isArray(this.strokeDashArray)&&this.strokeDashArray.length?"dashed":"solid"}getBorderSideStyle(eg,gg){var ig;return((ig=this.tableCellBorders[eg])==null?void 0:ig[gg])||this.getDefaultBorderStyle()}drawBorderSegment(eg,gg,ig,Ig,og,ng){gg!=="none"&&(eg.save(),eg.strokeStyle=this.stroke||"#000000",eg.lineWidth=this.strokeWidth||1,eg.setLineDash(gg==="dashed"&&Array.isArray(this.strokeDashArray)?this.strokeDashArray:gg==="dashed"?[6,4]:[]),eg.beginPath(),eg.moveTo(ig,Ig),eg.lineTo(og,ng),eg.stroke(),eg.restore())}drawTableBorders(eg){for(let gg=0;gg<=this.rows;gg++){const ig=this.getRowOffset(gg);for(let Ig=0;Ig<this.columns;Ig++){const og=this.getColumnOffset(Ig),ng=this.getColumnOffset(Ig+1),sg=gg>0?(gg-1)*this.columns+Ig:-1,ag=gg<this.rows?gg*this.columns+Ig:-1,Cg=sg>=0?this.getBorderSideStyle(sg,"bottom"):void 0,lg=ag>=0?this.getBorderSideStyle(ag,"top"):void 0,Ag=this.resolveBorderStyle(Cg||lg||"solid",Cg&&lg?lg:void 0);this.drawBorderSegment(eg,Ag,og,ig,ng,ig)}}for(let gg=0;gg<=this.columns;gg++){const ig=this.getColumnOffset(gg);for(let Ig=0;Ig<this.rows;Ig++){const og=this.getRowOffset(Ig),ng=this.getRowOffset(Ig+1),sg=gg>0?Ig*this.columns+gg-1:-1,ag=gg<this.columns?Ig*this.columns+gg:-1,Cg=sg>=0?this.getBorderSideStyle(sg,"right"):void 0,lg=ag>=0?this.getBorderSideStyle(ag,"left"):void 0,Ag=this.resolveBorderStyle(Cg||lg||"solid",Cg&&lg?lg:void 0);this.drawBorderSegment(eg,Ag,ig,og,ig,ng)}}}_render(eg){const gg=this.width||0,ig=this.height||0;if(!gg||!ig||!this.rows||!this.columns)return;const Ig=-gg/2,og=-ig/2;eg.save(),eg.fillStyle=this.backgroundColor||"#FFFFFF00",eg.fillRect(Ig,og,gg,ig),eg.restore(),this.drawSelectedCell(eg),this.drawTableBorders(eg),this.syncTextCount();for(let ng=0;ng<this.rows;ng++)for(let sg=0;sg<this.columns;sg++){const ag=ng*this.columns+sg,Cg=this.getCellRect(ag);this.drawCellText(eg,this.tableTexts[ag]||"",Cg.left,Cg.top,Cg.width,Cg.height,ag)}}};l0.type="table";let ATable=l0;tt.setClass(ATable);const RIBBON_BORDER_PATTERN_OPTIONS=[{label:"无描边",value:"none",source:{x:57,y:29,width:169,height:169}},{label:"图案 1",value:"ribbon-01",source:{x:293,y:29,width:169,height:169}},{label:"图案 2",value:"ribbon-02",source:{x:546,y:29,width:169,height:169}},{label:"图案 3",value:"ribbon-03",source:{x:781,y:29,width:169,height:169}},{label:"图案 4",value:"ribbon-04",source:{x:1005,y:29,width:169,height:169}},{label:"图案 5",value:"ribbon-05",source:{x:1230,y:29,width:169,height:169}},{label:"图案 6",value:"ribbon-06",source:{x:1436,y:29,width:169,height:169}},{label:"图案 7",value:"ribbon-07",source:{x:1660,y:29,width:169,height:169}},{label:"图案 8",value:"ribbon-08",source:{x:57,y:255,width:169,height:169}},{label:"图案 9",value:"ribbon-09",source:{x:296,y:255,width:169,height:169}},{label:"图案 10",value:"ribbon-10",source:{x:550,y:254,width:168,height:169}},{label:"图案 11",value:"ribbon-11",source:{x:781,y:255,width:169,height:169}},{label:"图案 12",value:"ribbon-12",source:{x:1003,y:254,width:169,height:169}},{label:"图案 13",value:"ribbon-13",source:{x:1230,y:255,width:169,height:169}},{label:"图案 14",value:"ribbon-14",source:{x:1436,y:255,width:169,height:169}},{label:"图案 15",value:"ribbon-15",source:{x:1660,y:254,width:169,height:169}},{label:"图案 16",value:"ribbon-16",source:{x:57,y:629,width:169,height:169}},{label:"图案 17",value:"ribbon-17",source:{x:550,y:480,width:168,height:169}},{label:"图案 18",value:"ribbon-18",source:{x:781,y:483,width:169,height:169}},{label:"图案 19",value:"ribbon-19",source:{x:1003,y:483,width:169,height:169}},{label:"图案 20",value:"ribbon-20",source:{x:1230,y:471,width:169,height:169}},{label:"图案 21",value:"ribbon-21",source:{x:1436,y:473,width:169,height:169}},{label:"图案 22",value:"ribbon-22",source:{x:1660,y:473,width:169,height:169}},{label:"图案 23",value:"ribbon-23",source:{x:781,y:693,width:169,height:169}},{label:"图案 24",value:"ribbon-24",source:{x:1003,y:686,width:169,height:169}},{label:"图案 25",value:"ribbon-25",source:{x:1230,y:683,width:169,height:169}},{label:"图案 26",value:"ribbon-26",source:{x:1436,y:683,width:169,height:169}},{label:"图案 27",value:"ribbon-27",source:{x:1660,y:683,width:169,height:169}}];RIBBON_BORDER_PATTERN_OPTIONS.map(tg=>tg.value);function drawRibbonBorder(tg,eg,gg,ig){if(eg==="none"||!(ig!=null&&ig.left)||!(ig!=null&&ig.right))return;const{width:Ig,height:og}=gg,ng=gg.left??0,sg=gg.top??0,ag=getRibbonBorderBandWidth(Ig);drawTextureSide(tg,ig.left,ng,sg,ag,og,"left"),drawTextureSide(tg,ig.right,ng+Ig-ag,sg,ag,og,"right")}function getRibbonBorderBandWidth(tg){return Math.max(16,Math.min(56,Math.round(tg*.11)))}function drawTextureSide(tg,eg,gg,ig,Ig,og,ng){const sg=getImageSourceWidth(eg),ag=Number(eg.naturalHeight||eg.height);if(!sg||!ag)return;const Cg=Math.max(1,Math.min(Ig,Math.round(sg))),lg=ng==="right"?gg+Ig-Cg:gg,Ag=Math.max(1,Math.round(ag*(Cg/sg)));let cg=ig;for(;cg<ig+og;){const rg=Math.min(Ag,ig+og-cg),ug=Math.max(1,Math.round(ag*(rg/Ag)));tg.drawImage(eg,0,0,sg,ug,lg,cg,Cg,rg),cg+=Ag}}function getImageSourceWidth(tg){return tg?Number(tg.naturalWidth||tg.width||0):0}const objectMap={line:(tg,eg)=>new ALine([0,0,0,0],{...tg}),rect:(tg,eg)=>new ARect(tg),triangle:(tg,eg)=>new ATriangle(tg),table:(tg,eg)=>new ATable(tg),circle:(tg,eg)=>new ACircle(tg),barcode:(tg,eg)=>new ABarcode(eg,tg),barcode2d:(tg,eg)=>new ABarcode2D(eg,tg),text:(tg,eg)=>new AText(eg??"",tg),textname:(tg,eg)=>new ATextName(eg??"",tg),counter:(tg,eg)=>new ACounter(eg,tg),image:(tg,eg)=>new AImage(eg,tg),rfid:(tg,eg)=>new RfidIcon(eg,tg)};o.DPI=203;class BaseEditor{constructor(){this.bindData=new EditorData,this.ribbonBorderPattern="none",this.ribbonBorderTextures=null}get width(){var eg;return(eg=this.canvas)==null?void 0:eg.elements.lower.el.offsetWidth}get height(){var eg;return(eg=this.canvas)==null?void 0:eg.elements.lower.el.offsetHeight}init(eg,gg){this.canvas=new In(eg,{...gg,imageSmoothingEnabled:!1,fireMiddleClick:!0,fireRightClick:!0,stopContextMenu:!1,controlsAboveOverlay:!0,preserveObjectStacking:!0,selectionKey:"ctrlKey"}),this.bindData.init(this);const ig=Ig=>{if(!this.canvas)return;const og=this.canvas.getActiveObject();if(!og||og.type!=="textname")return;const ng=og;ng.isEditing===!0&&(Ig.key==="Enter"||Ig.keyCode===13||Ig.key===" "||Ig.key==="Space"||Ig.keyCode===32)&&(Ig.preventDefault(),Ig.stopImmediatePropagation(),ng.selectionStart!==void 0&&(ng.selectionStart=ng.selectionEnd=ng.selectionStart))};document.addEventListener("keydown",ig),this.canvas.on("dispose",()=>{document.removeEventListener("keydown",ig)})}removeObject(eg){var gg;eg&&((gg=this.canvas)==null||gg.remove(eg))}addObject(eg,gg,ig,Ig){if(this.canvas)if(eg==="image")kn.loadImage(ig,{crossOrigin:"anonymous"}).then(og=>{let ng=og.width/og.height;gg.imgScaleType=ng>1?"3":ng<1?"2":"1";const sg=new AImage(og,gg);sg.id=v4(),sg.canvas=this.canvas,sg.padding=3,addObjName(this.canvas,sg),this.canvas.add(sg),this.canvas.setActiveObject(sg)});else{const og=objectMap[eg](gg,ig);og.id=v4(),og.canvas=this.canvas,og.padding=3,addObjName(this.canvas,og),this.canvas.add(og),this.canvas.setActiveObject(og)}}getActiveObjects(){return this.canvas.getActiveObjects()}getActiveObject(){return this.canvas.getActiveObject()}getObjects(){return this.canvas.getObjects()}getAllObjects(){const eg=this.getCanvas(),gg=[];function ig(Ig){Ig.type==="group"&&Ig._objects?Ig._objects.forEach(og=>ig(og)):Ig.id!=="workspace"&&gg.push(Ig)}return eg.getObjects().forEach(Ig=>ig(Ig)),gg}getBind(){return this.bindData}setRibbonBorderTextures(eg){var gg;this.ribbonBorderTextures=eg,(gg=this.canvas)==null||gg.requestRenderAll()}_toDataUrl(eg,gg,{exclude:ig=[],targetDPI:Ig=203,type:og="",ribbonBorderPattern:ng=this.ribbonBorderPattern}={},sg=null){let ag=sg;if(gg&&ag){const{left:wg,top:yg,right:Bg,bottom:Wg}=gg;ag.width=ag.width+wg+Bg,ag.height=ag.height+yg+Wg}const{left:Cg,top:lg,width:Ag,height:cg}=ag,rg=eg.viewportTransform,ug=new ot(Cg,lg).transform(rg),dg=new ot(Ag,cg).transform(rg),mg=dg.x-ug.x,bg=dg.y-ug.y;let pg=Ag/mg*(Math.trunc(Ig/o.DPI*100)/100);const Zg={format:"png",quality:1,width:mg,height:bg,left:ug.x,top:ug.y,multiplier:pg};eg.set("flagToDataURL",!0),(ag&&ag.type==="ellipse"||ag.type==="rect"&&ag.rx&&ag.ry)&&(eg.clipPath=ag);let Gg="",hg="",fg="";if(og==="print"){let wg=["text","counter","rect","circle","barcode","group"],yg=["line","ellipse","image","barcode2d"];hg=eg.toCanvasElement(pg,{...Zg,filter:Yg=>!ig.includes(Yg.id)&&(wg.includes(Yg.type)||Yg.id==="workspace")}),fg=eg.toCanvasElement(pg,{...Zg,filter:Yg=>!ig.includes(Yg.id)&&Yg.id!=="workspace"&&yg.includes(Yg.type)});let Bg=hg.getContext("2d"),Wg=Bg.getImageData(0,0,hg.width,hg.height),$g=Wg.data;const Ng=$g.length,Vg=Ng-Ng%16;let Mg=window.myThreshold||200;for(let Yg=0;Yg<Vg;Yg+=16){let Sg=$g[Yg],vg=$g[Yg+1],Rg=$g[Yg+2],kg=.299*Sg+.587*vg+.114*Rg;kg=kg>Mg?255:0,$g[Yg]=$g[Yg+1]=$g[Yg+2]=kg,Sg=$g[Yg+4],vg=$g[Yg+5],Rg=$g[Yg+6],kg=.299*Sg+.587*vg+.114*Rg,kg=kg>Mg?255:0,$g[Yg+4]=$g[Yg+5]=$g[Yg+6]=kg,Sg=$g[Yg+8],vg=$g[Yg+9],Rg=$g[Yg+10],kg=.299*Sg+.587*vg+.114*Rg,kg=kg>Mg?255:0,$g[Yg+8]=$g[Yg+9]=$g[Yg+10]=kg,Sg=$g[Yg+12],vg=$g[Yg+13],Rg=$g[Yg+14],kg=.299*Sg+.587*vg+.114*Rg,kg=kg>Mg?255:0,$g[Yg+12]=$g[Yg+13]=$g[Yg+14]=kg}for(let Yg=Vg;Yg<Ng;Yg+=4){const Sg=$g[Yg],vg=$g[Yg+1],Rg=$g[Yg+2];let kg=.299*Sg+.587*vg+.114*Rg;kg=kg>Mg?255:0,$g[Yg]=$g[Yg+1]=$g[Yg+2]=kg}Bg.save(),Bg.putImageData(Wg,0,0),Bg.globalCompositeOperation="multiply",Bg.fillStyle="rgba(255, 255, 255, 1)",Bg==null||Bg.fillRect(0,0,hg.width,hg.height),Bg.drawImage(fg,0,0,fg.width,fg.height),fg.width=0,fg.height=0,Bg.restore(),Gg=hg}else og==="review"?Gg=eg.toCanvasElement(pg,{...Zg,filter:wg=>!ig.includes(wg.id)}):ng!=="none"?Gg=eg.toCanvasElement(pg,{...Zg,filter:wg=>!ig.includes(wg.id)}):Gg=eg.toDataURL({...Zg,filter:wg=>!ig.includes(wg.id)});if(ng!=="none"&&Gg instanceof HTMLCanvasElement){const wg=Gg.getContext("2d");wg&&drawRibbonBorder(wg,ng,{width:Gg.width,height:Gg.height},this.ribbonBorderTextures),og!=="print"&&og!=="review"&&(Gg=Gg.toDataURL("image/png",1))}return eg.clipPath&&(eg.clipPath=void 0),eg.set("flagToDataURL",!1),Gg}storeStatus(){var eg;this.activeObjects=(eg=this.canvas)==null?void 0:eg.getActiveObject()}restoreStatus(eg=!1){var gg,ig,Ig;this.activeObjects?(console.log("restoreStatus"),(gg=this.canvas)==null||gg.setActiveObject(this.activeObjects),(ig=this.canvas)==null||ig.requestRenderAll(),this.activeObjects=void 0):eg&&((Ig=this.canvas)==null||Ig.requestRenderAll())}getCanvas(){if(!this.canvas)throw new Error("Editor uninit!!!");return this.canvas}static set DPI(eg){o.DPI=eg}static get DPI(){return o.DPI}dispose(){this.canvas&&this.canvas.dispose()}}Object.defineProperty(ji.prototype,"locked",{configurable:!0,enumerable:!0,get:function(){return this.lockMovementX&&this.lockMovementY&&this.lockRotation&&this.lockScalingX&&this.lockScalingY&&this.lockSkewingX&&this.lockSkewingY&&this.lockScalingFlip},set:function(tg){this.lockMovementX=this.lockMovementY=this.lockRotation=this.lockScalingX=this.lockScalingY=this.lockSkewingX=this.lockSkewingY=this.lockScalingFlip=tg,this.canvas&&this.canvas.fire("custom:object:locked",{target:this})}});class Editor extends BaseEditor{constructor(){super(...arguments),this.plugins=new Map,this.hooks=new Map,this.events=new Map,this.id=v4(),this._isShown=!1,this._isHasRfid=!1}get filePath(){return this._filePath}set filePath(eg){this._filePath=eg}get labelConfig(){return this._labelConfig}set labelConfig(eg){this._labelConfig=eg}get rfidConfig(){return this._rfidConfig}set rfidConfig(eg){this._rfidConfig=eg}get databaseConfig(){return this._databaseConfig}set databaseConfig(eg){this._databaseConfig=eg}init(eg,gg){super.init(eg,gg),this.canvas&&(this.canvas.on("custom:object:locked",ig=>{this.emit("custom:object:locked",ig)}),this.canvas.on("custom:object:refreshList",ig=>{this.emit("custom:object:refreshList",ig)}))}dispose(){this.canvas&&(this.canvas.off("custom:object:locked"),this.canvas.off("custom:object:refreshList")),this.plugins.forEach(eg=>eg.uninstall&&eg.uninstall())}addHotKey(eg,gg){hotkeys(eg,{single:!0},(ig,Ig)=>{ig.preventDefault(),gg({kbe:ig,hke:Ig})})}removeHotKey(eg){hotkeys.unbind(eg)}editActivated(){for(let eg of this.plugins.values())eg.enabled&&eg.enabled()}editDeactivated(){for(let eg of this.plugins.values())eg.disabled&&eg.disabled()}use(eg,gg){const ig=typeof eg=="function"?new eg(gg):eg;return this.checkDependencies(ig),this.runLifecycleHooks(ig,gg),ig.name&&this.plugins.set(ig.name,ig),this}checkDependencies(eg){eg.dependencies&&eg.dependencies.forEach(gg=>{if(!this.plugins.has(gg))throw new Error(`Plugin ${eg.name} requires ${gg} to be installed first`)})}runLifecycleHooks(eg,gg){eg.install&&eg.install(this,gg)}addHook(eg,gg){this.hooks.set(eg,gg)}triggerHook(eg,...gg){const ig=this.hooks.get(eg);if(ig)return ig(...gg)}getPlugin(eg){return this.plugins.get(eg)}on(eg,gg){this.events.has(eg)||this.events.set(eg,[]),this.events.get(eg).push(gg)}emit(eg,...gg){this.events.has(eg)&&this.events.get(eg).forEach(ig=>ig(...gg))}off(eg,gg){this.events.has(eg)&&(gg?this.events.set(eg,this.events.get(eg).filter(ig=>ig!==gg)):this.events.delete(eg))}toDataUrl({padding:eg,type:gg="",exclude:ig=[],targetDPI:Ig=203,isJudgeGrid:og=!1,ribbonBorderPattern:ng=this.ribbonBorderPattern}={}){if(!this.canvas)return;this.canvas.discardActiveObject();const sg=this.getPlugin("RulerPlugin"),ag=this.getPlugin("HistoryPlugin"),Cg=this.getPlugin("WorkspacePlugin"),lg=Cg.workspace;let Ag=!1;og&&(Ag=(lg==null?void 0:lg.isHasGrid)||!1,Ag&&(Cg==null||Cg.hideGrid())),sg&&sg.disabled(),ag&&ag.disabled();const cg=this._toDataUrl(this.canvas,eg,{exclude:ig,targetDPI:Ig,type:gg,ribbonBorderPattern:ng},lg);return this.canvas.renderAll(),sg&&sg.enabled(),ag&&ag.enabled(),og&&Ag&&(Cg==null||Cg.showGrid()),cg}toTemplateJson(){const eg={};eg.Version="1.0.0-alpha.1";let gg=this.canvas.toObject(cloneCommonField);if(eg.canvas=JSON.stringify(gg),this._labelConfig){const ig=this._labelConfig;ig.fileId.length===0&&(ig.fileId=v4()),eg.labelConfig=ig}return this._databaseConfig&&(eg.databaseConfig=this._databaseConfig),this._rfidConfig&&(eg.rfidConfig=this._rfidConfig),this._filePath&&(eg.filePath=this._filePath),JSON.stringify(eg)}toJSON(){return JSON.stringify(this.canvas.toObject(cloneCommonField))}fromTemplateJson(eg,gg){this.canvas&&this.canvas.loadFromJSON(eg).then(ig=>{ig.renderAll(),gg(),this.bindData&&this.canvas&&(this.bindData.originState=JSON.stringify(this.canvas.toJSON()))})}}const state$2=reactive({barcode2dSizeRatio:""});let sRatio=Math.trunc(4/3*100)/100,longbeiClearCode=["10000502","10002500","10000503"];const C0=class C0 extends ji{constructor(eg,gg){var og,ng;super(gg),this.lastCtx=null,this.lastDrawOption=null,this.hasToDataUrl=!1,this.counterProps=null,this.reviewValueArgs=null,this.barcodeDateFormatType="",this.increaseDate=!1,this.concatTextIdListObj=null,this.connectObjIds=[],this.isFirstLoad=!1,this.canModified=!0,this.useLongbeiCache=!0,this.inWorkerRender=!1,this.workerOtherImgData="",this.emitErrorMessage=throttle$1(sg=>{canvasEventBus.emit("canvasShowError",sg)},800),this._cache={canvas:void 0,error:void 0},this.counterProps=gg&&gg.counterProps?gg.counterProps:this.counterProps,this.increaseDate=gg&&gg.increaseDate?gg.increaseDate:this.increaseDate,this.barcodeDateFormatType=gg&&gg.barcodeDateFormatType?gg.barcodeDateFormatType:this.barcodeDateFormatType,((og=eg.extra)==null?void 0:og.version)==="0"&&(eg.extra=omit(eg.extra,["version"])),((ng=eg.extra)==null?void 0:ng.eclevel)==="0"&&(eg.extra=omit(eg.extra,["eclevel"])),eg.custom||(eg.custom={}),this.barcode2dOptions=cloneDeep(eg),this.concatTextIdListObj=gg&&gg.concatTextIdListObj?gg.concatTextIdListObj:this.concatTextIdListObj,this.connectObjIds=gg.connectObjIds??this.connectObjIds,this.barcode2dOptions.includetext=eg.includetext??!1,this.barcode2dOptions.textposition=this.barcode2dOptions.includetext?this.barcode2dOptions.textposition||"bottom":"none",this.barcode2dOptions.textsize=this.barcode2dOptions.textsize||14,this.barcode2dOptions.textfontname=this.barcode2dOptions.textfontname||"Arial",this.barcode2dOptions.textxalign=this.barcode2dOptions.textxalign||"center",this.barcode2dOptions.textgaps=this.barcode2dOptions.textgaps||0,this.set({width:this.width,height:this.height}),this.on("modified",sg=>{console.log("eee=======",sg),lpBcid.includes(this.barcode2dOptions.bcid)&&(sg==null?void 0:sg.action)!=="drag"&&(this.canModified=!0,setTimeout(()=>{let ag=this.barcode2dOptions.custom,Cg=this.width*this.scaleX,lg=this.height*this.scaleY,Ag=Math.max(Cg/lg,lg/Cg);Ag=Math.trunc(Ag*100)/100,[1,2,sRatio].includes(Ag)?(ag.sizeRatio=Ag===1?"1x1":Ag===2?"2x1":"4x3",state$2.barcode2dSizeRatio=ag.sizeRatio):(ag.sizeRatio="auto",state$2.barcode2dSizeRatio=ag.sizeRatio),console.log("state.barcode2dSizeRatio========",state$2.barcode2dSizeRatio)},30)),lpBcid.includes(this.barcode2dOptions.bcid)&&(sg==null?void 0:sg.action)==="drag"&&this.updateLpCodePosition()}),this.on("scaling",()=>{lpBcid.includes(this.barcode2dOptions.bcid)&&(this.canModified=!1,this.clearErrorLpCodeMap())}),canvasEventBus.off(`update:barcode2d:${this.id}`),canvasEventBus.on(`update:barcode2d:${this.id}`,async({list:sg,callback:ag=function(){}}={})=>{let Cg=await this.updateBarCode2d(sg);ag&&ag(Cg)})}updateLpCodePosition(){let eg=this.getLpCache();eg&&(eg.x=this.left,eg.y=this.top)}clearErrorLpCodeMap(){errorLpCodeMap.delete(this.id)}getLpCache(){let eg="",gg=this.id;return this.barcode2dOptions.bcid==="LPCode"?eg=getLastCacheLpcode(gg):this.barcode2dOptions.bcid==="LPMixQrCode"&&(eg=getLastMixCacheLpcode(gg)),eg}drawLpCode(eg,gg,ig,Ig,og,ng="",sg=null){var lg;let ag=eg||this.lastCtx;if(this._cache.error=void 0,ng==="cache"&&(this.width=Ig,this.height=og,this.scaleX=1,this.scaleY=1,sg&&(this.left=sg.x,this.top=sg.y),this.lastDrawOption={w:this.width,h:this.height,x:-this.width/2,y:-this.height/2},ig.w=this.lastDrawOption.w,ig.h=this.lastDrawOption.h,ig.x=this.lastDrawOption.x,ig.y=this.lastDrawOption.y,this.strokeWidth>0&&(ig.x+=this.strokeWidth,ig.y+=this.strokeWidth),this.setCoords()),this.inWorkerRender||(this.workerOtherImgData=gg),ag.drawImage(gg,ig.x,ig.y,Ig,og),this.strokeWidth>0){let Ag=this.stroke||"#fff";ag.lineWidth=this.strokeWidth,ag.strokeStyle=Ag,ag.strokeRect(-this.width/2,-this.height/2,Ig+this.strokeWidth*2,og+this.strokeWidth*2)}this.dirty=!0;let Cg=this.group;for(;Cg;)Cg.dirty=!0,Cg=Cg.group;this.isFirstLoad||(this.objectCaching=!1,this.isFirstLoad=!0),(lg=this.canvas)==null||lg.requestRenderAll(),this.objectCaching||setTimeout(()=>{this.objectCaching=!0},60)}getTextLayout(eg,gg,ig){if(!(gg.includetext&&gg.textposition!=="none"&&!!gg.text))return{showText:!1,textGap:0,textLineHeight:0,textAreaHeight:0,barcodeHeight:ig.h};const{scaleY:og}=this.getRenderScale(),ng=Number(gg.textsize)||14;eg.save(),eg.font=`${ng}px ${gg.textfontname||"Arial"}`;const sg=eg.measureText(gg.text||""),ag=sg.actualBoundingBoxAscent+sg.actualBoundingBoxDescent||ng*1.2;eg.restore();const Cg=14/og,lg=6/og,Ag=Math.min(ig.h-1,Math.ceil(ag/og+Cg+lg));return{showText:!0,textGap:Cg,textLineHeight:ag,textAreaHeight:Ag,barcodeHeight:Math.max(1,ig.h-Ag)}}getRenderScale(){var Ig;const eg=(Ig=this.getObjectScaling)==null?void 0:Ig.call(this),gg=Math.abs((eg==null?void 0:eg.x)||this.scaleX||1)||1,ig=Math.abs((eg==null?void 0:eg.y)||this.scaleY||1)||1;return{scaleX:gg,scaleY:ig}}renderText(eg,gg,ig,Ig,og){if(!gg.includetext||gg.textposition==="none"||!gg.text)return;const ng=gg.textxalign||"center";let sg=ig.x;ng==="center"?sg=ig.x+ig.w/2:ng==="right"&&(sg=ig.x+ig.w),eg.save();const{scaleX:ag,scaleY:Cg}=this.getRenderScale();eg.scale(1/ag,1/Cg),eg.font=`${gg.textsize||14}px ${gg.textfontname||"Arial"}`,eg.fillStyle=gg.textcolor||"#000",eg.textAlign=ng,eg.textBaseline="top",gg.textgaps&&(eg.letterSpacing=gg.textgaps+"px"),eg.fillText(gg.text,sg*ag,(ig.y+Ig+og)*Cg),eg.restore()}async _render(eg){var og,ng,sg,ag,Cg;const gg=cloneDeep(this.barcode2dOptions);this.lastCtx=eg;const ig={w:this.width,h:this.height,x:-this.width/2,y:-this.height/2},Ig=this.getTextLayout(eg,gg,ig);if(eg.save(),eg.imageSmoothingEnabled=!1,this.dirty){if(gg.width=ig.w,gg.height=Ig.barcodeHeight,typeof this.fill=="string"){let lg=rgbaStringToHex8(this.fill);gg.barcolor=hexToHex6_blend(lg)}this.strokeWidth>0&&(gg.width-=this.strokeWidth*2,gg.height-=this.strokeWidth*2);try{lpBcid.includes(gg.bcid)||(this._cache.canvas=generateCanvas(gg),this.dirty=!1,this._cache.error&&(this._cache.error=void 0))}catch(lg){this.dirty=!0,lg instanceof Error&&(console.log("error",lg.message),this._cache.error=lg.message),this._cache.canvas=void 0}}if(this.strokeWidth>0&&(ig.x+=this.strokeWidth,ig.y+=this.strokeWidth),this.lastDrawOption=ig,lpBcid.includes(gg.bcid)){let lg=this.lastDrawOption;const Ag=this.strokeWidth>0?lg.w-this.strokeWidth*2:lg.w,cg=Math.max(1,this.strokeWidth>0?Ig.barcodeHeight-this.strokeWidth*2:Ig.barcodeHeight);let rg=Ag*this.scaleX,ug=cg*this.scaleY,dg=gg.text,mg=Number((og=gg.extra)==null?void 0:og.eclevel)||1;mg=mg+"";let bg=Math.trunc(rg/Editor.DPI*25.4*100)/100,pg=Math.trunc(ug/Editor.DPI*25.4*100)/100,Zg=bg/(pg||1),Gg=((ng=gg.custom)==null?void 0:ng.CellSize)||"8",hg=`${dg}-${mg}-${bg+pg}-${Zg}-${Gg}`,fg=`${this.id}`,wg=null;if(gg.bcid==="LPMixQrCode"){let yg=((sg=gg.custom)==null?void 0:sg.LPErrLevel)||"0",Bg=((ag=gg.custom)==null?void 0:ag.QRErrLevel)||"0";mg=`${yg}-${Bg}`,hg=`${dg}-${mg}-${bg+pg}-${Zg}-${Gg}`}try{if(errorLpCodeMap.has(fg)){errorLpCodeMap.set(fg,this._cache.error||"龙贝码生成错误");let yg=this.getLpCache();if(yg&&this.useLongbeiCache){let Bg=yg||{};wg=Bg.img,this.drawLpCode(eg,wg,lg,Bg.rWidth,Bg.rHeight,"cache",Bg),this._cache.error=void 0}else this._cache.error=errorLpCodeMap.get(fg)||"龙贝码生成错误"}else{if(lpCodeMap.has(hg)&&this.useLongbeiCache){wg=lpCodeMap.get(hg);let yg={id:this.id,sKey:hg,img:wg,rWidth:rg,rHeight:ug,x:this.left,y:this.top};this.barcode2dOptions.bcid==="LPCode"?setCacheLpCode(yg):setCacheMixLpCode(yg)}else if(this.canModified){let yg={Content:dg,ErrLevel:mg,Width:bg,Height:pg,id:this.id,rWidth:rg,rHeight:ug,CellSize:Gg,x:this.left,y:this.top,DPI:Editor.DPI};this.useLongbeiCache||lpCodeMap.delete(hg),this.barcode2dOptions.bcid==="LPCode"?wg=await getBase64Data(yg):wg=await getMixBase64Data(yg),this.useLongbeiCache=!0}if(lpCodeMap.has(hg)&&this.useLongbeiCache)this._cache.error=void 0,this.drawLpCode(eg,wg,lg,Ag,cg);else if(this.useLongbeiCache){let yg=this.getLpCache();yg&&(wg=(yg||{}).img,this.drawLpCode(eg,wg,lg,Ag,cg),this._cache.error=void 0)}}}catch(yg){let Bg=yg&&yg.code,Wg=this.getLpCache();if(errorLpCodeMap.set(fg,this._cache.error||"龙贝码生成错误"),Bg&&(longbeiClearCode.includes(Bg+"")&&(this.useLongbeiCache=!1,clearLpAndMixCacheById(this.id),this._cache.error=`龙贝码: ${yg.payload}`),this.emitErrorMessage(yg.payload)),Wg&&this.useLongbeiCache){let $g=Wg||{};wg=$g.img,this.drawLpCode(eg,wg,lg,$g.rWidth,$g.rHeight,"cache",$g),this._cache.error=void 0}else Bg&&(this._cache.error=`龙贝码: ${yg.payload}`,this.dirty=!0,(Cg=this.canvas)==null||Cg.requestRenderAll())}}else this.objectCaching=!0;if(!this._cache.error&&!lpBcid.includes(gg.bcid)){if(this._cache.canvas){const lg=this.strokeWidth>0?ig.w-this.strokeWidth*2:ig.w,Ag=Math.max(1,this.strokeWidth>0?Ig.barcodeHeight-this.strokeWidth*2:Ig.barcodeHeight),cg=this._cache.canvas;if(eg.drawImage(cg,0,0,cg.width,cg.height,ig.x,ig.y,lg,Ag),this.strokeWidth>0){let rg=this.stroke||"#fff";eg.lineWidth=this.strokeWidth,eg.strokeStyle=rg,eg.strokeRect(-this.width/2,-this.height/2,ig.w,ig.h)}}}if(!this._cache.error&&Ig.showText&&this.renderText(eg,gg,ig,Ig.barcodeHeight,Ig.textGap),eg.translate(.5,.5),this._cache.error){const lg=wrapText(eg,this._cache.error,ig.w,"bold 18px 宋体"),Ag=getLineHeight(eg);let cg=ig.y+Ag;const rg=eg.fillStyle;eg.fillStyle="red";for(const ug of lg)eg.fillText(ug,ig.x,cg),cg+=Ag;eg.fillStyle=rg}eg.restore()}async getLongBeiImg(eg){var dg,mg,bg,pg;if(!lpBcid.includes(eg.bcid))return;let gg=this.lastDrawOption;const ig=this.strokeWidth>0?gg.w-this.strokeWidth*2:gg.w,Ig=this.strokeWidth>0?gg.h-this.strokeWidth*2:gg.h;let og=eg.text,ng=Number((dg=eg.extra)==null?void 0:dg.eclevel)||1,sg=ig*this.scaleX,ag=Ig*this.scaleY,Cg=Math.trunc(sg/Editor.DPI*25.4*100)/100,lg=Math.trunc(ag/Editor.DPI*25.4*100)/100,Ag=Cg/(lg||1),cg=((mg=eg.custom)==null?void 0:mg.CellSize)||"8",rg=`${og}-${ng}-${Cg+lg}-${Ag}-${cg}`,ug=null;if(eg.bcid==="LPMixQrCode"){let Zg=((bg=eg.custom)==null?void 0:bg.LPErrLevel)||"0",Gg=((pg=eg.custom)==null?void 0:pg.QRErrLevel)||"0";ng=`${Zg}-${Gg}`,rg=`${og}-${ng}-${Cg+lg}-${Ag}-${cg}`}this.clearErrorLpCodeMap();try{if(lpCodeMap.has(rg)&&this.useLongbeiCache)ug=lpCodeMap.get(rg);else{let Zg={Content:og,ErrLevel:ng,Width:Cg,Height:lg,id:this.id,rWidth:sg,rHeight:ag,CellSize:cg,x:this.left,y:this.top,DPI:Editor.DPI};this.barcode2dOptions.bcid==="LPCode"?ug=await getBase64Data(Zg,"noSaveCache"):ug=await getMixBase64Data(Zg,"noSaveCache"),this.useLongbeiCache=!0}return this.workerOtherImgData=ug,this._cache.error=void 0,ug}catch(Zg){console.error(Zg)}}dispose(){super.dispose()}set(eg,gg){return super.set(eg,gg)}countDate(eg=""){if(this.barcodeDateFormatType&&this.increaseDate){const gg=formatDate(this.barcodeDateFormatType);return console.log("formatted",gg),this.dirty=!0,eg!=="print"&&this.setBarcode2DOption({bcid:this.barcode2dOptions.bcid,text:gg}),gg}}countCurrent(eg){let gg=this.counterProps||eg;if(gg){let ig=gg;if(!ig.value&&ig.value!==0)return"";const Ig=formatCounterValue(ig);return(ig.prefix&&ig.prefix.length>0?ig.prefix:"")+Ig+(ig.suffix&&ig.suffix.length>0?ig.suffix:"")}return""}countNext(eg="print"){if(this.counterProps){let gg=this.counterProps;if(!gg.value&&gg.value!==0)return;eg==="review"&&!this.reviewValueArgs&&(this.reviewValueArgs={...gg});const ig=formatCounterValue(gg);let Ig=(gg.prefix&&gg.prefix.length>0?gg.prefix:"")+ig+(gg.suffix&&gg.suffix.length>0?gg.suffix:"");const og=getNextCounterValue(gg);return og!==null&&(gg.value=og,this.counterProps.value=og),this.dirty=!0,Ig}else return""}reviewRecover(){if(this.reviewValueArgs){const eg=this.reviewValueArgs;this.counterProps=eg,this.reviewValueArgs=null;const gg=formatCounterValue(eg);let ig=(eg.prefix&&eg.prefix.length>0?eg.prefix:"")+gg+(eg.suffix&&eg.suffix.length>0?eg.suffix:"");this.setBarcode2DOption({bcid:this.barcode2dOptions.bcid,text:ig})}}updateInGroup(){this.setCoords(),this.dirty=!0;let eg=this.group;for(;eg;)eg.dirty=!0,eg==null||eg.triggerLayout("childUpdate"),eg.setCoords(),eg=eg.group}async updateBarCode2d(eg=[],gg=""){var ig;if(this.concatTextIdListObj||this.connectObjIds&&this.connectObjIds.length>0){let Ig=!1,og="",ng=[],sg=[];const ag=lg=>{if(this.connectObjIds){let Ag=0;for(let cg of this.connectObjIds){if(cg.index=Ag,cg.id&&cg.id===lg.id){Ig=!0;let rg=lg.text+"";if(lg.type==="counter"&&(lg._props.mode==="1"?rg=lg.countCurrent():lg._props.mode==="2"&&(lg.updateText({isUpdateBarCodeDate:!1}),rg=lg.text+"")),cg.maxEnd=rg.length,cg.isSplit){cg.start=Math.min(cg.start,cg.maxEnd);let ug=rg.slice(cg.start,cg.end);ng[Ag]=ug}else ng[Ag]=rg}Ag++}}},Cg=lg=>{lg.type==="text"&&this.concatTextIdListObj&&this.concatTextIdListObj[lg.id]&&(Ig||(this.barcode2dOptions.bcid==="LPMixQrCode"?lg==null||lg.set("text",this.barcode2dOptions.text.replace(/\|&&&\|/g,"")):lg==null||lg.set("text",this.barcode2dOptions.text),lg.updateInGroup()),sg.push(lg))};if(eg.length>0)eg.forEach(lg=>{ag(lg),Cg(lg)});else{const lg=Ag=>{Ag.type==="group"&&Ag._objects?Ag._objects.forEach(cg=>lg(cg)):(ag(Ag),Cg(Ag))};(ig=this.canvas)==null||ig.getObjects().forEach(Ag=>lg(Ag))}return Ig?(og=ng.join(""),this.barcode2dOptions.text=og,lpBcid.includes(this.barcode2dOptions.bcid)&&gg&&await this.getLongBeiImg(this.barcode2dOptions),this.dirty=!0,gg&&this.updateInGroup(),setTimeout(()=>{var lg;(lg=this.canvas)==null||lg.requestRenderAll()},0),sg.forEach(lg=>{lg==null||lg.set("text",og),lg.updateInGroup()}),og):""}else return""}setBarcode2DOption(eg){if(this.barcode2dOptions.bcid!==eg.bcid&&(eg.extra={},this.barcode2dOptions.extra={}),merge(this.barcode2dOptions,eg),eg.extra&&(typeof+eg.extra.version=="number"&&eg.extra.version==="0"&&(this.barcode2dOptions.extra=omit(this.barcode2dOptions.extra,["version"])),eg.extra.eclevel==="0"&&(this.barcode2dOptions.extra=omit(this.barcode2dOptions.extra,["eclevel"]))),this.dirty=!0,!lpBcid.includes(this.barcode2dOptions.bcid)){let ig=this.group;for(;ig;)ig.dirty=!0,ig=ig.group}let gg=getAllObjectMap();this.updateBarCode2d([...gg.text,...gg.counter])}getBarcode2DOption(){return cloneDeep(this.barcode2dOptions)}toObject(eg){let gg=["barcode2dOptions","counterProps","concatTextIdListObj","increaseDate","barcodeDateFormatType","connectObjIds"];return super.toObject(eg?[...eg,...gg]:gg)}};C0.type="Barcode2D";let ABarcode2D=C0;ABarcode2D.fromObject=(tg,eg)=>ABarcode2D._fromObject(tg,{...eg,extraParam:"barcode2dOptions"}),tt.setClass(ABarcode2D),tt.setSVGClass(ABarcode2D);class ContextMenu{constructor(eg,gg){this.container=eg,this.menuItems=gg,this.activeSubmenus=[],this.shown=!1,this.disableTop=!1,this.disableBottom=!1,this.activeSubmenuHandler=this._activeSubmenuHandler.bind(this),this.menuItems=gg,this.menuElement=this.createMenuElement(),eg.appendChild(this.menuElement),this.setupEventListeners()}setTargetObj(eg){this.targetObj=eg}createMenuElement(){const eg=document.createElement("div");return eg.id="custom-context-menu",eg}createMenuItemElement(eg){const gg={itemText:eg.text??""};if(eg.isShow&&!eg.isShow(this.targetObj,gg))return document.createElement("div");if(eg.isSeparator){const ng=document.createElement("div");return ng.classList.add("item-separator"),ng}if(eg.isGroupTitle){const ng=document.createElement("div");return ng.textContent=gg.itemText,ng.classList.add("item-group"),ng}const ig=document.createElement("div");ig.className="menu-item",ig.dataset.id=eg.id,eg.disabled&&ig.classList.add("canvas-contextmenu-disabled"),eg.subItems&&eg.subItems.length>0&&ig.classList.add("has-submenu");const Ig=document.createElement("div");Ig.textContent=gg.itemText;const og=document.createElement("div");if(og.classList.add("menu-item-content"),og.appendChild(Ig),!eg.subItems||eg.subItems.length===0){const ng=document.createElement("div");ng.style.marginLeft="20px",ng.style.color="#999",ng.textContent=eg.hotKey||"",og.appendChild(ng)}if(ig.appendChild(og),eg.subItems&&eg.subItems.length>0){const ng=document.createElement("span");ng.className="arrow",ng.textContent="›",ig.appendChild(ng)}if(eg.subItems&&!eg.disabled){if(eg.subItems.length>0){const ng=this.activeSubmenus.length+1,sg=document.createElement("div");sg.className="submenu",sg.style.zIndex=ng+"",eg.subItems.forEach(ag=>{const Cg=this.createMenuItemElement(ag);Cg&&sg.appendChild(Cg)}),ig.appendChild(sg),ig.addEventListener("mouseenter",ag=>{this.activeSubmenuHandler(ag)||(sg.style.display="block",this.positionSubmenu(ig,sg),this.activeSubmenus.push(ig,sg))})}}else eg.disabled||(ig.addEventListener("click",ng=>{if(eg.handler){const sg=eg.handler(eg,ng);this.canvasContainer&&this.canvasContainer.focus({preventScroll:!0}),sg!==!1&&this.hide()}else this.hide();ng.stopPropagation()}),ig.addEventListener("mouseenter",this.activeSubmenuHandler));return ig}_activeSubmenuHandler(eg){if(this.activeSubmenus.length>0){const gg=eg.target;for(let ig=this.activeSubmenus.length-1;ig>0;ig-=2){const Ig=this.activeSubmenus[ig-1],og=this.activeSubmenus[ig];if(Ig.parentElement===gg.parentElement){if(Ig===gg)return!0;og.style.display="none"}else{if(og.contains(gg))return!1;og.style.display="none"}this.activeSubmenus.pop(),this.activeSubmenus.pop()}}return!1}setupEventListeners(){document.addEventListener("click",eg=>{!this.menuElement.contains(eg.target)&&this.shown&&this.hide()}),document.addEventListener("keydown",eg=>{eg.key==="Escape"&&this.shown&&this.hide()})}positionMenu(eg,gg){const ig=window.innerWidth,Ig=window.innerHeight,og=this.menuElement.offsetWidth,ng=this.menuElement.offsetHeight;eg+og>ig&&(eg=ig-og-5),gg+ng>Ig&&(gg=Ig-ng-5),this.menuElement.style.left=`${eg}px`,this.menuElement.style.top=`${gg}px`}positionSubmenu(eg,gg){const ig=eg.getBoundingClientRect(),Ig=gg.offsetWidth,og=window.innerWidth,ng=getComputedStyle(gg);let sg=0,ag=0;ig.right+Ig>og?(sg=-Ig-parseInt(ng.paddingLeft),gg.classList.add("left")):sg=ig.width+parseInt(ng.paddingLeft);const Cg=gg.offsetHeight,lg=window.innerHeight;ig.top+Cg>lg?ag=ig.height-Cg+parseInt(ng.paddingBottom):ag=-parseInt(ng.paddingTop),gg.style.left=`${sg}px`,gg.style.top=`${ag}px`}show(eg,gg){console.time("show"),this.shown&&this.hide(),this.menuElement.innerHTML="",this.menuItems.forEach(ig=>{const Ig=this.createMenuItemElement(ig);Ig&&this.menuElement.appendChild(Ig)}),this.menuElement.style.display="block",this.positionMenu(eg,gg),this.shown=!0,console.timeEnd("show")}hide(){this.shown&&(this.menuElement.style.display="none",this.menuElement.innerHTML="",this.shown=!1)}addItems(eg,gg){gg?this.addItemsToSubmenu(eg,gg,this.menuItems):this.menuItems.push(...eg)}addItemsToSubmenu(eg,gg,ig){for(const Ig of ig){if(Ig.id===gg)return Ig.subItems||(Ig.subItems=[]),Ig.subItems.push(...eg),!0;if(Ig.subItems&&this.addItemsToSubmenu(eg,gg,Ig.subItems))return!0}return!1}updateItem(eg,gg){return this.updateItemRecursive(eg,gg,this.menuItems)}updateItemRecursive(eg,gg,ig){for(const Ig of ig){if(Ig.id===eg)return Object.assign(Ig,gg),!0;if(Ig.subItems&&this.updateItemRecursive(eg,gg,Ig.subItems))return!0}return!1}removeItem(eg){return this.removeItemRecursive(eg,this.menuItems)}removeItemRecursive(eg,gg){const ig=gg.findIndex(Ig=>Ig.id===eg);if(ig!==-1)return gg.splice(ig,1),!0;for(const Ig of gg)if(Ig.subItems&&this.removeItemRecursive(eg,Ig.subItems))return!0;return!1}getItems(){return this.menuItems}setItems(eg){this.menuItems=eg}}class ContextMenuPlugin{constructor(){this.name="ContextMenuPlugin",this.eventHandler={contextmenu:this.contextMenuHandler.bind(this)}}addItem(eg){var ig;const gg=Array.isArray(eg)?eg:[eg];(ig=this.contextMenu)==null||ig.addItems(gg),gg.forEach(Ig=>{!Ig.isGroupTitle&&!Ig.isSeparator&&Ig.hotKey&&Ig.hotKeyHandler&&this.editor.addHotKey(Ig.hotKey,Ig.hotKeyHandler)})}removeItem(eg){var gg;(gg=this.contextMenu)==null||gg.removeItem(eg)}updateItem(eg,gg){if(this.contextMenu&&(this.contextMenu.updateItem(eg,gg),gg.hotKey&&gg.hotKeyHandler)){const ig=this.contextMenu.getItems().find(Ig=>Ig.id===eg);ig&&(ig.hotKey&&this.editor.removeHotKey(ig.hotKey),ig.hotKey=gg.hotKey,ig.hotKeyHandler=gg.hotKeyHandler,this.editor.addHotKey(ig.hotKey,ig.hotKeyHandler))}}disabled(){this.contextMenu&&this.container&&(this.editor.getCanvas().off("contextmenu",this.eventHandler.contextmenu),this.contextMenu.hide(),this.contextMenu.getItems().forEach(eg=>{!eg.isGroupTitle&&!eg.isSeparator&&eg.hotKey&&eg.hotKeyHandler&&this.editor.removeHotKey(eg.hotKey)}))}contextMenuHandler(eg){var gg;if(eg.e){const ig=eg.e;if(ig.button===2&&eg.target&&this.contextMenu){if(eg.target.id==="workspace")return;let Ig=((gg=this.canvas)==null?void 0:gg.getObjects())||[];Ig=Ig.filter(ag=>ag.id!=="workspace");let og=Ig==null?void 0:Ig.indexOf(eg.target);const ng=og===(Ig==null?void 0:Ig.length)-1,sg=og===0;this.contextMenu.disableTop=ng,this.contextMenu.disableBottom=sg,eg.target.type==="activeselection"?eg.target.getObjects().length>1?(this.contextMenu.updateItem("lock",{disabled:!0}),this.contextMenu.updateItem("layer",{disabled:!0})):(this.contextMenu.updateItem("lock",{disabled:!1}),this.contextMenu.updateItem("layer",{disabled:!1})):(this.contextMenu.updateItem("lock",{disabled:!1}),this.contextMenu.updateItem("layer",{disabled:!1})),this.contextMenu.updateItem("layer-top",{disabled:!1}),this.contextMenu.updateItem("layer-up",{disabled:!1}),this.contextMenu.updateItem("layer-bottom",{disabled:!1}),this.contextMenu.updateItem("layer-down",{disabled:!1}),ng&&(this.contextMenu.updateItem("layer-top",{disabled:!0}),this.contextMenu.updateItem("layer-up",{disabled:!0})),sg&&(this.contextMenu.updateItem("layer-bottom",{disabled:!0}),this.contextMenu.updateItem("layer-down",{disabled:!0})),ig.preventDefault(),this.canvas.setActiveObject(eg.target),this.contextMenu.setTargetObj(eg.target),this.contextMenu.show(ig.clientX,ig.clientY)}}}install(eg,gg){this.editor=eg,this.canvas=eg.getCanvas(),this.container=document.getElementById("app"),this.contextMenu=new ContextMenu(this.container,[]),this.contextMenu.canvasContainer=this.canvas.elements.container,this.enabled()}enabled(){this.contextMenu&&this.container&&(this.editor.getCanvas().on("contextmenu",this.eventHandler.contextmenu),this.contextMenu.getItems().forEach(eg=>{!eg.isGroupTitle&&!eg.isSeparator&&eg.hotKey&&eg.hotKeyHandler&&this.editor.addHotKey(eg.hotKey,eg.hotKeyHandler)}))}}class Ruler{constructor(eg,gg){this.ctx=eg,this.dpi=96,this.isShown=!1,this.gapValue=0,this.getGapMM=ig=>{const Ig=[.02,.05,.1,.2,.5,1,2,5,10],og=[500,200,100,50,25,10,5,2,1];let ng=0;for(;ng<Ig.length&&Ig[ng]<ig;)ng++;return og[ng-1]||1e3},this.options=gg}show(){this.isShown=!0}hide(){this.isShown=!1}drawLine(eg,gg,ig,Ig,og,ng){this.ctx.save(),this.ctx.beginPath(),og&&(this.ctx.strokeStyle=og),this.ctx.lineWidth=ng??1,this.ctx.moveTo(eg+.5,gg+.5),this.ctx.lineTo(eg+ig+.5,gg+Ig+.5),this.ctx.stroke(),this.ctx.restore()}drawText({text:eg="",left:gg=0,top:ig=0,fillStyle:Ig,align:og,angle:ng,fontSize:sg=this.options.fontSize}){this.ctx.save(),Ig&&(this.ctx.fillStyle=Ig),this.ctx.textAlign=og??"left",this.ctx.textBaseline="top",this.ctx.font=`${sg??10}px sans-serif, Noto Sans, SourceHanSansCN`,ng&&(this.ctx.translate(gg,ig),this.ctx.rotate(Math.PI/180*ng),this.ctx.translate(-gg,-ig)),this.ctx.fillText(eg,gg,ig),this.ctx.restore()}darwRect({left:eg=0,top:gg=0,width:ig,height:Ig,fillStyle:og,stroke:ng,strokeWidth:sg}){this.ctx.save(),this.ctx.beginPath(),og&&(this.ctx.fillStyle=og),this.ctx.rect(eg,gg,ig,Ig),this.ctx.fill(),ng&&(this.ctx.strokeStyle=ng,this.ctx.lineWidth=sg??1,this.ctx.stroke()),this.ctx.restore()}drawMask(eg,gg,ig,Ig,og,ng){this.ctx.save();const sg=eg?this.ctx.createLinearGradient(gg,og/2,gg+Ig,og/2):this.ctx.createLinearGradient(Ig/2,ig,Ig/2,og+ig),ag=new Le(ng);ag.setAlpha(0),sg.addColorStop(0,ag.toRgba()),sg.addColorStop(.33,ng),sg.addColorStop(.67,ng),sg.addColorStop(1,ag.toRgba()),this.darwRect({left:gg,top:ig,width:Ig,height:og,fillStyle:sg}),this.ctx.restore()}drawBackground(eg,gg,ig){const Ig=this.options.rulerSize,og=this.options.canvasWidth,ng=this.options.canvasHeight;eg?this.darwRect({left:0,top:0,width:og,height:Ig,fillStyle:this.options.backgroundColor}):this.darwRect({left:0,top:0,width:Ig,height:ng,fillStyle:this.options.backgroundColor})}drawMM(eg,gg,ig){const Ig=this.options.rulerSize,og=this.options.canvasWidth,ng=this.options.canvasHeight,sg=this.getGapMM(ig);this.gapValue=sg;const ag=this.dpi/25.4*ig*sg,Cg=Ig*.2,lg=Ig*.8,Ag=new Le(this.options.textColor).toRgb();eg?(this.drawLine(0,0,og,0,this.options.borderColor),this.drawLine(0,Ig,og,0,Ag)):(this.drawLine(0,0,0,ng,this.options.borderColor),this.drawLine(Ig,0,0,ng,Ag)),this.ctx.save(),this.ctx.beginPath();let cg=sg>2,rg=sg>10?10:sg>=5?5:1;if(eg){if(this.ctx.rect(Ig,0,og-Ig,Ig),this.ctx.clip(),gg<0){let mg=-gg*ig-ag,bg=1;for(;mg>Ig;){if(cg&&bg===1)for(let hg=1;hg<10;hg++){const fg=mg+ag/rg*hg;fg>Ig&&this.drawLine(fg,Cg+13,0,lg*.3,Ag,1)}if(this.drawLine(mg,Cg+10,0,lg*.6,Ag),cg)for(let hg=1;hg<10;hg++){const fg=mg-ag/rg*hg;fg>Ig&&this.drawLine(fg,Cg+13,0,lg*.3,Ag,1)}const pg=-bg*sg+"",Zg=10*pg.length/4,Gg=Ig-this.options.fontSize-2;this.drawText({text:pg,left:mg-Zg,top:Gg-7,fillStyle:Ag,align:void 0,angle:0}),mg-=ag,bg++}}let ug=-gg*ig,dg=0;for(;ug<og;){if(Math.ceil(ug)>=Ig){if(this.drawLine(ug,Cg+10,0,lg*.6,Ag),cg)for(let Zg=1;Zg<10;Zg++){const Gg=ug+ag/rg*Zg;Gg<og&&this.drawLine(Gg,Cg+13,0,lg*.3,Ag,1)}const mg=dg*sg+"",bg=10*mg.length/4,pg=Ig-this.options.fontSize-2;this.drawText({text:mg,left:ug-bg,top:pg-7,fillStyle:Ag,align:void 0,angle:0})}ug+=ag,dg++}}else{if(this.ctx.rect(0,Ig,Ig,ng-Ig),this.ctx.clip(),gg<0){let mg=-gg*ig-ag,bg=1;for(;mg>Ig;){if(cg&&bg===1)for(let hg=1;hg<10;hg++){const fg=mg+ag/rg*hg;fg>Ig&&this.drawLine(Cg+13,fg,lg*.3,0,Ag,1)}if(this.drawLine(Cg+10,mg,lg*.6,0,Ag),cg)for(let hg=1;hg<10;hg++){const fg=mg-ag/rg*hg;fg>Ig&&this.drawLine(Cg+13,fg,lg*.3,0,Ag,1)}const pg=-bg*sg+"",Zg=10*pg.length/4,Gg=Ig-this.options.fontSize-2;this.drawText({text:pg,left:Gg-7,top:mg+Zg,fillStyle:Ag,align:void 0,angle:-90}),mg-=ag,bg++}}let ug=-gg*ig,dg=0;for(;ug<ng;){if(ug>Ig){if(this.drawLine(Cg+10,ug,lg*.6,0,Ag),cg)for(let Zg=1;Zg<10;Zg++){const Gg=ug+ag/rg*Zg;Gg<ng&&this.drawLine(Cg+13,Gg,lg*.3,0,Ag,1)}const mg=dg*sg+"",bg=10*mg.length/4,pg=Ig-this.options.fontSize-2;this.drawText({text:mg,left:pg-7,top:ug+bg,fillStyle:Ag,align:void 0,angle:-90})}ug+=ag,dg++}}this.ctx.restore()}drawActiveLine(eg,gg,ig){if(!this.objectRect)return;const Ig=this.options.rulerSize,og=eg?"x":"y",ng=new Le(this.options.maskColor);this.objectRect[og].forEach(sg=>{if(ng.setAlpha(.5),sg.skip===og)return;let ag=eg?sg.left:sg.top,Cg=eg?sg.width:sg.height,lg=(ag-gg)*ig,Ag=Cg*ig;const cg={width:eg?Ag:Ig-8,height:eg?Ig-8:Ag,backgroundColor:this.options.backgroundColor};this.drawMask(eg,eg?lg:0,eg?2:lg,cg.width,cg.height,cg.backgroundColor),this.darwRect({left:eg?lg:Ig-8,top:eg?Ig-8:lg,width:eg?Ag:8,height:eg?8:Ag,fillStyle:ng.toRgba()});const rg=Ig/2-(this.options.fontSize??12)/2-4,ug=Zg=>Math.round(Zg*(25.4/Editor.DPI)*100)/100+"",dg=ug(ag),mg=ug(ag+Cg),bg={fill:ng.toRgba(),angle:eg?0:-90};this.drawText({text:dg,left:eg?lg-2:rg,top:eg?rg:lg-15,fillStyle:bg.fill,align:eg?"right":"center",angle:bg.angle}),dg!==mg&&this.drawText({text:mg,left:eg?lg+Ag+2:rg,top:eg?rg:lg+Ag+17,fillStyle:bg.fill,align:eg?"left":"center",angle:bg.angle});const pg=dg===mg?8:14;ng.setAlpha(1),this.drawLine(eg?lg:Ig-pg,eg?Ig-pg:lg,eg?0:pg,eg?pg:0,ng.toRgba()),dg!==mg&&this.drawLine(eg?lg+Ag:Ig-pg,eg?Ig-pg:lg+Ag,eg?0:pg,eg?pg:0,ng.toRgba())})}}class RulerPlugin{constructor(){this.name="RulerPlugin",this.eventHandler={calcObjectRect:throttle$3(this.calcObjectRect.bind(this),15),selectinClear:throttle$3(this.selectionClear.bind(this),15),renderRuler:eg=>{eg.ctx&&this.renderRuler()},canvasMouseDown:throttle$3(this.canvasMouseDown.bind(this),15),canvasMouseMove:throttle$3(this.canvasMouseMove.bind(this),15),canvasMouseUp:throttle$3(this.canvasMouseUp.bind(this),15)}}uninstall(){}install(eg,gg){this.editor=eg;const ig=Object.assign({rulerSize:25,fontSize:12,canvasWidth:this.editor.getCanvas().width,canvasHeight:this.editor.getCanvas().height,backgroundColor:"#fff",borderColor:"#ddd",maskColor:"#007fff",textColor:"#888"},gg);this.ruler=new Ruler(eg.getCanvas().elements.lower.ctx,ig),eg.getPlugin("ContextMenuPlugin")}enabled(){if(this.editor&&this.ruler&&!this.ruler.isShown){const eg=this.editor.getCanvas();eg.on("after:render",this.eventHandler.calcObjectRect),eg.on("after:render",this.eventHandler.renderRuler),eg.on("mouse:down",this.eventHandler.canvasMouseDown),eg.on("mouse:move",this.eventHandler.canvasMouseMove),eg.on("mouse:up",this.eventHandler.canvasMouseUp),eg.on("selection:cleared",this.eventHandler.selectinClear),this.ruler.dpi=Editor.DPI,this.ruler.show(),this.renderRuler()}}disabled(){if(this.editor&&this.ruler&&this.ruler.isShown){this.ruler.hide();const eg=this.editor.getCanvas();eg.off("after:render",this.eventHandler.calcObjectRect),eg.off("after:render",this.eventHandler.renderRuler),eg.off("mouse:down",this.eventHandler.canvasMouseDown),eg.off("mouse:move",this.eventHandler.canvasMouseMove),eg.off("mouse:up",this.eventHandler.canvasMouseUp),eg.off("selection:cleared",this.eventHandler.selectinClear),this.editor.getCanvas().renderAll()}}setCanvasSize(eg,gg){this.ruler&&(this.ruler.options.canvasWidth=eg,this.ruler.options.canvasHeight=gg)}calcObjectRect(){if(!this.editor)return;const gg=this.editor.getCanvas().getActiveObjects();if(gg.length===0)return;const ig=gg.reduce((Ig,og)=>{const ng=og.getBoundingRect();return Ig.push(ng),Ig},[]);ig.length!==0&&(this.ruler.objectRect={x:mergeLines(ig,!0),y:mergeLines(ig,!1)})}renderRuler(){if(!this.editor||!this.ruler||!this.ruler.isShown)return;const eg=this.editor.getCanvas(),gg=eg.viewportTransform;gg&&(this.ruler.drawBackground(!0,-(gg[4]/gg[0]),eg.getZoom()),this.ruler.drawBackground(!1,-(gg[5]/gg[3]),eg.getZoom()),this.ruler.drawMM(!0,-(gg[4]/gg[0]),eg.getZoom()),this.ruler.drawMM(!1,-(gg[5]/gg[3]),eg.getZoom()),this.ruler.drawActiveLine(!0,-(gg[4]/gg[0]),eg.getZoom()),this.ruler.drawActiveLine(!1,-(gg[5]/gg[3]),eg.getZoom()),this.ruler.options.callback&&this.ruler.options.callback(this.ruler.gapValue))}canvasMouseDown(){}canvasMouseUp(){}canvasMouseMove(){}selectionClear(){this.ruler&&(this.ruler.objectRect=void 0)}}const mergeLines=(tg,eg)=>{const gg=eg?"left":"top",ig=eg?"width":"height",Ig=1e-6;if(!tg||tg.length===0)return[];if(tg.length===1)return[Object.assign({},tg[0])];tg.sort((sg,ag)=>sg[gg]-ag[gg]);const og=[];let ng=Object.assign({},tg[0]);for(let sg=1;sg<tg.length;sg++){const ag=tg[sg],Cg=ng[gg]+ng[ig],lg=ag[gg];if(Cg>=lg-Ig){const Ag=Math.max(Cg,ag[gg]+ag[ig]);ng[ig]=Ag-ng[gg]}else og.push(ng),ng=Object.assign({},ag)}return og.push(ng),og};class WorkspacePlugin{constructor(){this.name="WorkspacePlugin",this.gapVal=20,this.backgroundColor="#FFFFFFFF",this.backgroundImage="",this.backgroundImageCover=!0,this.backgroundImageElement=null,this.backgroundImageLoadId=0,this.resizeObserver=new ResizeObserver(eg=>{for(let gg of eg){if(gg.target!==this.workspaceEl||!this.canvas)continue;const ig=Math.round(gg.contentRect.width),Ig=Math.round(gg.contentRect.height);if(!(ig<=0||Ig<=0||this.canvas.getWidth()===ig&&this.canvas.getHeight()===Ig)){if(this.editor){const og=this.editor.getPlugin("RulerPlugin");og&&og.setCanvasSize(ig,Ig)}this.canvas.setDimensions({width:ig,height:Ig})}}}),this.initWorkspace=()=>{const eg=this.canvas,gg=this.option.type;let ig;gg==="Rectangle"||gg==="RoundedRectangle"?ig=new Er({fill:this.option.backgroundColor??"yellow",width:this.option.width,height:this.option.height,rx:this.option.rx,ry:this.option.ry,strokeWidth:0}):ig=new _o({fill:this.option.backgroundColor??"yellow",width:this.option.width,height:this.option.height,rx:this.option.rx,ry:this.option.ry,strokeWidth:0}),ig.set("id","workspace"),ig.set("workspaceBackgroundColor",this.backgroundColor),ig.set("workspaceBackgroundImage",this.backgroundImage),ig.set("workspaceBackgroundImageCover",this.backgroundImageCover),this.bindRibbonBorderRender(ig),ig.set("selectable",!1),ig.set("hasControls",!1),ig.excludeFromExport=!0,ig.moveCursor="default",ig.hoverCursor="default",eg.insertAt(0,ig),this.workspace=ig,this.refreshWorkspaceBackground(),eg.renderAll();const Ig=this.workspaceEl.offsetWidth,og=this.workspaceEl.offsetHeight;eg.setDimensions({width:Ig,height:og}),this.resizeObserver.observe(this.workspaceEl),eg.on("mouse:wheel",this.onWheel);const sg=eg.lowerCanvasEl.width*.7,ag=eg.height*.7,Cg=sg/this.option.width,lg=ag/this.option.height;this.setZoomAuto(Math.min(Cg,lg))}}findParent(eg){for(;eg;){if(eg.id==="workspace")return eg;eg=eg.parentElement}return null}install(eg,gg){const ig=this.findParent(eg.getCanvas().elements.container);if(!ig)throw new Error("element #workspace is missing, plz check!");this.editor=eg,this.workspaceEl=ig,this.workspace=void 0,this.option=gg,this.backgroundColor=(gg==null?void 0:gg.backgroundColor)||"#FFFFFFFF",this.backgroundImage=(gg==null?void 0:gg.backgroundImage)||"",this.backgroundImageCover=(gg==null?void 0:gg.backgroundImageCover)!==!1,this.loadBackgroundImageElement(this.backgroundImage),this.editor.addHook("setSize",this.initWorkspace);const Ig=eg.getCanvas();Ig.backgroundImage=void 0,this.canvas=Ig,this.initWorkspace()}uninstall(){var eg;this.workspaceEl&&this.resizeObserver.unobserve(this.workspaceEl),this.workspace&&((eg=this.canvas)==null||eg.remove(this.workspace))}bindRibbonBorderRender(eg){const gg=eg._render.bind(eg);eg._render=ig=>{var sg,ag,Cg;if(gg(ig),this.drawBackgroundImage(ig,eg),this.drawGrid(ig,eg),(sg=this.editor)!=null&&sg.getCanvas().get("flagToDataURL"))return;const Ig=(ag=this.editor)==null?void 0:ag.ribbonBorderPattern;if(!Ig||Ig==="none")return;const og=eg.width||this.option.width,ng=eg.height||this.option.height;drawRibbonBorder(ig,Ig,{left:-og/2,top:-ng/2,width:og,height:ng},(Cg=this.editor)==null?void 0:Cg.ribbonBorderTextures)}}createWorkspacePath(eg,gg){const ig=gg.width||this.option.width,Ig=gg.height||this.option.height,og=-ig/2,ng=-Ig/2;if(eg.beginPath(),gg.type==="ellipse"){eg.ellipse(0,0,ig/2,Ig/2,0,0,Math.PI*2);return}const sg=Math.min(Math.abs(gg.rx||0),ig/2),ag=Math.min(Math.abs(gg.ry||0),Ig/2);if(!sg&&!ag){eg.rect(og,ng,ig,Ig);return}eg.moveTo(og+sg,ng),eg.lineTo(og+ig-sg,ng),eg.quadraticCurveTo(og+ig,ng,og+ig,ng+ag),eg.lineTo(og+ig,ng+Ig-ag),eg.quadraticCurveTo(og+ig,ng+Ig,og+ig-sg,ng+Ig),eg.lineTo(og+sg,ng+Ig),eg.quadraticCurveTo(og,ng+Ig,og,ng+Ig-ag),eg.lineTo(og,ng+ag),eg.quadraticCurveTo(og,ng,og+sg,ng)}drawBackgroundImage(eg,gg){const ig=this.backgroundImageElement;if(!ig||!this.backgroundImage)return;const Ig=gg.width||this.option.width,og=gg.height||this.option.height,ng=ig.naturalWidth||ig.width,sg=ig.naturalHeight||ig.height;if(!ng||!sg)return;const ag=this.backgroundImageCover?Ig:ng,Cg=this.backgroundImageCover?og:sg,lg=-ag/2,Ag=-Cg/2;eg.save(),this.createWorkspacePath(eg,gg),eg.clip(),eg.drawImage(ig,lg,Ag,ag,Cg),eg.restore()}drawGrid(eg,gg){var ag;if(!gg.isHasGrid||(ag=this.editor)!=null&&ag.getCanvas().get("flagToDataURL"))return;const ig=gg.width||this.option.width,Ig=gg.height||this.option.height,og=-ig/2,ng=-Ig/2,sg=20;eg.save(),this.createWorkspacePath(eg,gg),eg.clip(),eg.strokeStyle="#888",eg.lineWidth=1,eg.globalAlpha=1;for(let Cg=og+sg;Cg<og+ig;Cg+=sg)eg.beginPath(),eg.moveTo(Cg,ng),eg.lineTo(Cg,ng+Ig),eg.stroke();for(let Cg=ng+sg;Cg<ng+Ig;Cg+=sg)eg.beginPath(),eg.moveTo(og,Cg),eg.lineTo(og+ig,Cg),eg.stroke();eg.restore()}setZoomAuto(eg){this.workspaceEl;const gg=this.editor.getCanvas(),ig=gg.getCenterPoint();gg.setViewportTransform(T$1),gg.zoomToPoint(new ot(ig.x,ig.y),eg),this.workspace&&this.setCenterFromObject(this.workspace)}setCenterFromObject(eg){const gg=this.editor.getCanvas(),ig=eg.getCenterPoint(),Ig=gg.viewportTransform;gg.width===void 0||gg.height===void 0||!Ig||(Ig[4]=gg.width/2-ig.x*Ig[0],Ig[5]=gg.height/2-ig.y*Ig[3],gg.setViewportTransform(Ig),gg.renderAll())}showGrid(){this.createGridBackground()}hideGrid(){this.createGridBackground(!1)}async setBackground({color:eg,image:gg,cover:ig}){eg!==void 0&&(this.backgroundColor=eg||"#FFFFFFFF"),gg!==void 0&&(this.backgroundImage=gg||""),ig!==void 0&&(this.backgroundImageCover=ig),this.workspace&&(this.workspace.set("workspaceBackgroundColor",this.backgroundColor),this.workspace.set("workspaceBackgroundImage",this.backgroundImage),this.workspace.set("workspaceBackgroundImageCover",this.backgroundImageCover)),gg!==void 0&&await this.loadBackgroundImageElement(this.backgroundImage),this.refreshWorkspaceBackground()}refreshWorkspaceBackground(){!this.workspace||!this.canvas||(this.workspace.set("fill",this.backgroundColor||"#FFFFFFFF"),this.workspace.dirty=!0,this.canvas.requestRenderAll())}async loadBackgroundImageElement(eg){var ig;const gg=++this.backgroundImageLoadId;if(!eg){this.backgroundImageElement=null;return}try{const Ig=await new Promise((og,ng)=>{const sg=new Image;sg.onload=()=>og(sg),sg.onerror=ng,sg.src=eg});if(gg!==this.backgroundImageLoadId)return;this.backgroundImageElement=Ig,this.workspace&&(this.workspace.dirty=!0),(ig=this.canvas)==null||ig.requestRenderAll()}catch(Ig){if(gg!==this.backgroundImageLoadId)return;this.backgroundImageElement=null,console.log("load background image error",Ig)}}createGridBackground(eg=!0){!this.canvas||!this.workspace||(this.workspace.set("isHasGrid",eg),this.workspace.dirty=!0,this.canvas.renderAll())}onWheel(eg){const gg=eg.e.deltaY;let ig=this.getZoom();ig*=.999**gg,ig>12&&(ig=12),ig<.2&&(ig=.2);const Ig=this.getCenter();this.zoomToPoint(new ot(Ig.left,Ig.top),ig),eg.e.preventDefault(),eg.e.stopPropagation()}big(){let eg=this.canvas.getZoom();eg+=.05;const gg=this.canvas.getCenter();this.canvas.zoomToPoint(new ot(gg.left,gg.top),eg)}small(){let eg=this.canvas.getZoom();eg-=.05;const gg=this.canvas.getCenter();this.canvas.zoomToPoint(new ot(gg.left,gg.top),eg<0?.01:eg)}auto(){const gg=this.canvas.lowerCanvasEl.width*.7,ig=this.canvas.height*.7,Ig=gg/this.option.width,og=ig/this.option.height;this.setZoomAuto(Math.min(Ig,og))}one(){this.setZoomAuto(1)}enabled(){}disabled(){}}const aligningLineConfig={margin:4,width:1,color:"rgb(255,0,0,0.9)"};function getDistance(tg,eg){return Math.abs(tg-eg)}function setPositionDir(tg,eg,gg){const ig=tg.translateToCenterPoint(eg,"center","center"),Ig=tg.translateToOriginPoint(ig,tg.originX,tg.originY);gg=="x"?tg.setX(Ig.x):tg.setY(Ig.y)}const originXArr=["left","center","right"],originYArr=["top","center","bottom"];function collectVerticalPoint(tg){var eg,gg;const ig=aligningLineConfig.margin,{activeObject:Ig,isScale:og,index:ng,point:sg,list:ag}=tg,{dis:Cg,arr:lg}=getDistanceList(sg,ag,"x"),Ag=ig/((eg=(gg=Ig.canvas)===null||gg===void 0?void 0:gg.getZoom())!==null&&eg!==void 0?eg:1);if(Cg>Ag)return[];let cg=lg[lg.length-1].x-sg.x;const rg=ng==0||ng==3?-1:1;cg*=rg;const{width:ug,scaleX:dg,left:mg}=Ig,bg=Ig._getTransformedDimensions(),pg=(cg+bg.x)/bg.x;og?Ig.set("scaleX",dg*pg):Ig.set("width",ug*pg);const Zg=[0,cg/2*rg,cg*rg];rg<0&&Zg.reverse();const Gg=Zg[originXArr.indexOf(Ig.originX)];return Ig.set("left",mg+Gg),Ig.setCoords(),lg.map(hg=>({x:hg.x,y1:hg.y,y2:sg.y}))}function collectHorizontalPoint(tg){var eg,gg;const ig=aligningLineConfig.margin,{activeObject:Ig,isScale:og,index:ng,point:sg,list:ag}=tg,{dis:Cg,arr:lg}=getDistanceList(sg,ag,"y"),Ag=ig/((eg=(gg=Ig.canvas)===null||gg===void 0?void 0:gg.getZoom())!==null&&eg!==void 0?eg:1);if(Cg>Ag)return[];let cg=lg[lg.length-1].y-sg.y;const rg=ng<2?-1:1;cg*=rg;const{height:ug,scaleY:dg,top:mg}=Ig,bg=Ig._getTransformedDimensions(),pg=(cg+bg.y)/bg.y;og?Ig.set("scaleY",dg*pg):Ig.set("height",ug*pg);const Zg=[0,cg/2*rg,cg*rg];rg<0&&Zg.reverse();const Gg=Zg[originYArr.indexOf(Ig.originY)];return Ig.set("top",mg+Gg),Ig.setCoords(),lg.map(hg=>({y:hg.y,x1:hg.x,x2:sg.x}))}function getDistanceList(tg,eg,gg){let ig=1/0,Ig=[];for(const og of eg){const ng=getDistance(tg[gg],og[gg]);ig>ng&&(Ig=[],ig=ng),ig==ng&&Ig.push(og)}return{dis:ig,arr:Ig}}function drawLine(tg,eg,gg){const{width:ig,color:Ig}=aligningLineConfig,og=tg.getSelectionContext(),ng=tg.viewportTransform,sg=tg.getZoom();og.save(),og.transform(...ng),og.lineWidth=ig/sg,og.strokeStyle=Ig,og.beginPath(),og.moveTo(eg.x,eg.y),og.lineTo(gg.x,gg.y),og.stroke(),drawX(og,sg,eg),drawX(og,sg,gg),og.restore()}const xSize=2.4;function drawX(tg,eg,gg){const ig=xSize/eg;tg.save(),tg.translate(gg.x,gg.y),tg.beginPath(),tg.moveTo(-ig,-ig),tg.lineTo(ig,ig),tg.moveTo(ig,-ig),tg.lineTo(-ig,ig),tg.stroke(),tg.restore()}function drawPoint(tg,eg){const{width:gg,color:ig}=aligningLineConfig,Ig=tg.getSelectionContext(),og=tg.viewportTransform,ng=tg.getZoom();Ig.save(),Ig.transform(...og),Ig.lineWidth=gg/ng,Ig.strokeStyle=ig;for(const sg of eg)drawX(Ig,ng,sg);Ig.restore()}function drawPointList(tg,eg){const gg=eg.map(ig=>{const Ig="y2"in ig,og=Ig?ig.x:ig.x1,ng=Ig?ig.y1:ig.y;return new ot(og,ng)});drawPoint(tg,gg)}function drawVerticalLine(tg,eg){const gg=eg.x,ig=new ot(gg,eg.y1),Ig=new ot(gg,eg.y2);drawLine(tg,ig,Ig)}function drawHorizontalLine(tg,eg){const gg=eg.y,ig=new ot(eg.x1,gg),Ig=new ot(eg.x2,gg);drawLine(tg,ig,Ig)}function getObjectsByTarget(tg){const eg=new Set,gg=tg.canvas;if(!gg)return eg;const ig=tg instanceof Jo?tg.getObjects():[tg];return gg.forEachObject(Ig=>{if(Ig.isOnScreen()&&Ig.visible){if(Ig.constructor==Hr){collectObjectsByGroup(eg,Ig);return}eg.add(Ig)}}),deleteObjectsByList(eg,ig),eg}function deleteObjectsByList(tg,eg){for(const gg of eg)gg.constructor==Hr?deleteObjectsByList(tg,gg.getObjects()):tg.delete(gg)}function collectObjectsByGroup(tg,eg){const gg=eg.getObjects();for(const ig of gg)if(ig.visible){if(ig.constructor==Hr){collectObjectsByGroup(tg,ig);continue}tg.add(ig)}}function collectLine(tg){var eg,gg;const ig=aligningLineConfig.margin,{activeObject:Ig,activeObjectRect:og,objectRect:ng}=tg,sg=makeLineByRect(ng),ag=makeLineByRect(og),Cg=ig/((eg=(gg=Ig.canvas)===null||gg===void 0?void 0:gg.getZoom())!==null&&eg!==void 0?eg:1),lg={target:Ig,list:sg,aList:ag,margin:Cg},Ag=collectVerticalLine(lg),cg=collectHorizontalLine(lg);return{vLines:Ag,hLines:cg}}function collectVerticalLine(tg){const{target:eg,list:gg,aList:ig,margin:Ig}=tg,og=ig.map(Ag=>getDistanceLine(Ag,gg,"x")),ng=Math.min(...og.map(Ag=>Ag.dis));if(ng>Ig)return[];const sg=[],ag=ig[0].x2-ig[0].x,Cg=ig[0].y2-ig[0].y;let lg=!1;for(let Ag=0;Ag<og.length;Ag++){const cg=og[Ag];if(ng==cg.dis){const rg=gg[cg.index],ug=ig[cg.index],dg=rg.x,mg=ug.y,bg=Math.min(rg.y,rg.y2,mg,ug.y2),pg=Math.max(rg.y,rg.y2,mg,ug.y2);if(sg.push({x:dg,y1:bg,y2:pg}),lg)continue;lg=!0,setPos({target:eg,x:dg,y:mg,centerX:Ag-1,centerY:cg.index-1,width:ag,height:Cg,dir:"x"});const Zg=ng*cg.dir;ig.forEach(Gg=>Gg.x-=Zg)}}return sg}function collectHorizontalLine(tg){const{target:eg,list:gg,aList:ig,margin:Ig}=tg,og=ig.map(Ag=>getDistanceLine(Ag,gg,"y")),ng=Math.min(...og.map(Ag=>Ag.dis));if(ng>Ig)return[];const sg=[],ag=ig[0].x2-ig[0].x,Cg=ig[0].y2-ig[0].y;let lg=!1;for(let Ag=0;Ag<og.length;Ag++){const cg=og[Ag];if(ng==cg.dis){const rg=gg[cg.index],ug=ig[cg.index],dg=rg.y,mg=ug.x,bg=Math.min(rg.x,rg.x2,mg,ug.x2),pg=Math.max(rg.x,rg.x2,mg,ug.x2);if(sg.push({y:dg,x1:bg,x2:pg}),lg)continue;lg=!0,setPos({target:eg,x:mg,y:dg,centerX:cg.index-1,centerY:Ag-1,width:ag,height:Cg,dir:"y"});const Zg=ng*cg.dir;ig.forEach(Gg=>Gg.y-=Zg)}}return sg}function getDistanceLine(tg,eg,gg){let ig=1/0,Ig=-1,og=1;for(let ng=0;ng<eg.length;ng++){const sg=getDistance(tg[gg],eg[ng][gg]);ig>sg&&(Ig=ng,ig=sg,og=tg[gg]>eg[ng][gg]?1:-1)}return{dis:ig,index:Ig,dir:og}}function makeLineByRect(tg){const{left:eg,top:gg,width:ig,height:Ig}=tg,og={x:eg,y:gg,x2:eg+ig,y2:gg+Ig},ng=eg+ig/2,sg=gg+Ig/2,ag={x:ng,y:sg,x2:ng,y2:sg},Cg={x:eg+ig,x2:eg,y:gg+Ig,y2:gg};return[og,ag,Cg]}function setPos(tg){const{target:eg,centerX:gg,centerY:ig,width:Ig,height:og,dir:ng}=tg;let{x:sg,y:ag}=tg;sg-=gg*Ig/2,ag-=ig*og/2,setPositionDir(eg,new ot(sg,ag),ng),eg.setCoords()}function initAligningGuidelines(tg){let eg=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Object.assign(aligningLineConfig,eg);const gg=new Set,ig=new Set;let Ig=!1;const og=new Map,ng=cg=>{const rg=[cg.calcTransformMatrix().toString(),cg.width,cg.height].join(),ug=og.get(rg);if(ug)return ug;const dg=cg.getCoords(),bg=[kn.makeBoundingBoxFromPoints(dg),dg];return og.set(rg,bg),bg};function sg(cg){const rg=cg.target;rg.setCoords(),Ig=!1,ig.clear(),gg.clear();const ug=getObjectsByTarget(rg),dg=rg.getBoundingRect();for(const mg of ug){const bg=ng(mg)[0],{vLines:pg,hLines:Zg}=collectLine({activeObject:rg,activeObjectRect:dg,objectRect:bg});pg.forEach(Gg=>{ig.add(JSON.stringify(Gg))}),Zg.forEach(Gg=>{gg.add(JSON.stringify(Gg))})}}function ag(cg){const rg=cg.target;rg.setCoords();const ug=String(cg.transform.action).startsWith("scale");ig.clear(),gg.clear();const dg=getObjectsByTarget(rg);let mg=cg.transform.corner;rg.flipX&&(mg=mg.replace("l","r").replace("r","l")),rg.flipY&&(mg=mg.replace("t","b").replace("b","t"));let bg=["tl","tr","br","bl","mt","mr","mb","ml"].indexOf(mg);if(bg==-1)return;if(Ig=bg>3,Ig){if(rg.getTotalAngle()%90!=0)return;bg-=4}let pg=rg.getCoords()[bg];for(const Zg of dg){const[Gg,hg]=ng(Zg),fg=new ot(Gg.left+Gg.width/2,Gg.top+Gg.height/2),wg=[...hg,fg],yg={activeObject:rg,point:pg,list:wg,isScale:ug,index:bg},Bg=collectVerticalPoint(yg),Wg=collectHorizontalPoint(yg);Bg.forEach($g=>{ig.add(JSON.stringify($g))}),Wg.forEach($g=>{gg.add(JSON.stringify($g))}),(Bg.length||Wg.length)&&(pg=rg.getCoords()[bg])}}function Cg(){tg.clearContext(tg.contextTop)}function lg(){if(Ig){const cg=[];for(const rg of ig)cg.push(JSON.parse(rg));for(const rg of gg)cg.push(JSON.parse(rg));drawPointList(tg,cg)}else{for(const cg of ig)drawVerticalLine(tg,JSON.parse(cg));for(const cg of gg)drawHorizontalLine(tg,JSON.parse(cg))}}function Ag(){ig.clear(),gg.clear(),og.clear(),tg.requestRenderAll()}return tg.on("object:resizing",ag),tg.on("object:scaling",ag),tg.on("object:moving",sg),tg.on("before:render",Cg),tg.on("after:render",lg),tg.on("mouse:up",Ag),()=>{tg.off("object:resizing",ag),tg.off("object:scaling",ag),tg.off("object:moving",sg),tg.off("before:render",Cg),tg.off("after:render",lg),tg.off("mouse:up",Ag)}}class GuidelinesPlugin{constructor(){this.name="GuidelinesPlugin"}install(eg,gg={}){this.editor=eg,this.options=gg,this.enabled()}enabled(){this.editor&&(this.deactivate=initAligningGuidelines(this.editor.getCanvas(),this.options))}disabled(){this.deactivate&&this.deactivate()}}class DringPlugin{constructor(){this.name="DringPlugin",this.isDraging=!1,this.lastPosX=0,this.lastPosY=0,this.dispose=[]}install(eg,gg){this.editor=eg,this.canvas=eg.getCanvas(),this.enabled()}enabled(){this.editor.addHotKey("space",eg=>{}),this.dispose.length&&(this.dispose.length=0),this.dispose.push(this.canvas.on("mouse:down",this.mouseDown.bind(this))),this.dispose.push(this.canvas.on("mouse:move",this.mouseMove.bind(this))),this.dispose.push(this.canvas.on("mouse:up",this.mouseUP.bind(this)))}disabled(){this.editor.removeHotKey("space");for(const eg of this.dispose)eg()}mouseDown(eg){const gg=eg.e;(gg.altKey||this.isDraging||gg.button===1)&&(gg.preventDefault(),this.canvas.setCursor("grabbing"),this.canvas.discardActiveObject(),this.isDraging=!0,this.canvas.selection=!1,this.canvas.getObjects().forEach(ig=>{ig.selectable=!1}),this.lastPosX=gg.clientX,this.lastPosY=gg.clientY,this.canvas.requestRenderAll())}mouseMove(eg){if(this.isDraging){if(this.canvas.setCursor("grabbing"),!this.canvas.viewportTransform)return;const gg=this.canvas.viewportTransform,ig=eg.e;gg[4]+=ig.clientX-this.lastPosX,gg[5]+=ig.clientY-this.lastPosY,this.lastPosX=ig.clientX,this.lastPosY=ig.clientY,this.canvas.requestRenderAll()}}mouseUP(eg){this.canvas.viewportTransform&&this.isDraging&&(this.isDraging=!1,this.canvas.selection=!0,this.canvas.getObjects().forEach(gg=>{gg.id!=="workspace"&&gg.hasControls&&(gg.selectable=!0)}),this.canvas.setCursor("default"),this.canvas.requestRenderAll())}}class LockPlugin{constructor(){this.name="LockPlugin"}install(eg,gg){this.editor=eg,this.enabled()}switchLock(){const eg=this.editor;if(eg){const gg=eg.getCanvas(),ig=gg.getActiveObject();ig&&(ig.locked=!ig.locked,gg.fire("custom:object:history",{target:ig,action:"history:update"}))}}enabled(){if(this.editor){const gg=this.editor.getPlugin("ContextMenuPlugin");gg&&gg.addItem([{id:"lock",text:"锁定/解锁对象",hotKey:"Ctrl+L",hotKeyHandler:ig=>{this.switchLock()},handler:(ig,Ig)=>(this.switchLock(),!0),isShow:(ig,Ig)=>(Ig&&(Ig.itemText=(ig!=null&&ig.locked?"解锁":"锁定")+"对象"),!!ig)}])}}disabled(){if(this.editor){const gg=this.editor.getPlugin("ContextMenuPlugin");gg&&gg.removeItem("lock")}}}class LayerPlugin{constructor(){this.name="LayerPlugin"}workspaceSendToBack(){const eg=this.canvas,gg=eg.getObjects().find(ig=>ig.id==="workspace");gg&&eg.sendObjectToBack(gg)}layerChangeRefresh(){this.canvas.fire("custom:object:refreshList")}up(){const eg=this.canvas,gg=eg.getActiveObjects();if(gg&&gg.length===1){const ig=eg.getActiveObjects()[0];ig&&eg.bringObjectForward(ig),eg.renderAll(),this.workspaceSendToBack(),this.layerChangeRefresh()}}down(){const eg=this.canvas,gg=eg.getActiveObjects();if(gg&&gg.length===1){const ig=eg.getActiveObjects()[0];ig&&eg.sendObjectBackwards(ig),eg.renderAll(),this.workspaceSendToBack(),this.layerChangeRefresh()}}toFront(){const eg=this.canvas,gg=eg.getActiveObjects();if(gg&&gg.length===1){const ig=gg[0];ig&&eg.bringObjectToFront(ig),eg.renderAll(),this.workspaceSendToBack(),this.layerChangeRefresh()}}toBack(){const eg=this.canvas,gg=eg.getActiveObjects();if(gg&&gg.length===1){const ig=gg[0];ig&&eg.sendObjectToBack(ig),eg.renderAll(),this.workspaceSendToBack(),this.layerChangeRefresh()}}install(eg,gg){this.editor=eg;const ig=eg.getCanvas();this.canvas=ig;const Ig=eg.getPlugin("ContextMenuPlugin");Ig&&Ig.addItem({id:"layer",text:"图层管理",subItems:[{id:"layer-up",text:"上一个",handler:(og,ng)=>(this.up(),!0)},{id:"layer-down",text:"下一个",handler:(og,ng)=>(this.down(),!0)},{id:"layer-top",text:"置顶",handler:(og,ng)=>(this.toFront(),!0)},{id:"layer-bottom",text:"置底",handler:(og,ng)=>(this.toBack(),!0)}]})}enabled(){}disabled(){}}class ControlsPlugin{constructor(){this.name="ControlsPlugin"}drawImg(eg,gg,ig,Ig,og,ng,sg){sg!==void 0&&(eg.save(),eg.translate(gg,ig),eg.rotate(kn.degreesToRadians(sg)),eg.drawImage(Ig,-og/2,-ng/2,og,ng),eg.restore())}intervalControl(){const eg=document.createElement("img");eg.src=this.option.verticalImg;const gg=document.createElement("img");gg.src=this.option.horizontalImg;const ig=(og,ng,sg,ag,Cg)=>{this.drawImg(og,ng,sg,eg,20,25,Cg.angle)},Ig=(og,ng,sg,ag,Cg)=>{this.drawImg(og,ng,sg,gg,25,20,Cg.angle)};return{ml:new ni({x:-.5,y:0,offsetX:-1,cursorStyleHandler:ja.scaleSkewCursorStyleHandler,actionHandler:ja.scalingXOrSkewingY,getActionName:ja.scaleOrSkewActionName,render:ig}),mr:new ni({x:.5,y:0,offsetX:1,cursorStyleHandler:ja.scaleSkewCursorStyleHandler,actionHandler:ja.scalingXOrSkewingY,getActionName:ja.scaleOrSkewActionName,render:ig}),mb:new ni({x:0,y:.5,offsetY:1,cursorStyleHandler:ja.scaleSkewCursorStyleHandler,actionHandler:ja.scalingYOrSkewingX,getActionName:ja.scaleOrSkewActionName,render:Ig}),mt:new ni({x:0,y:-.5,offsetY:-1,cursorStyleHandler:ja.scaleSkewCursorStyleHandler,actionHandler:ja.scalingYOrSkewingX,getActionName:ja.scaleOrSkewActionName,render:Ig})}}peakControl(){const eg=document.createElement("img");eg.src=this.option.edgeImg;const gg=(ig,Ig,og,ng,sg)=>{this.drawImg(ig,Ig,og,eg,25,25,sg.angle)};return{tl:new ni({x:-.5,y:-.5,cursorStyleHandler:ja.scaleCursorStyleHandler,actionHandler:ja.scalingEqually,render:gg}),bl:new ni({x:-.5,y:.5,cursorStyleHandler:ja.scaleCursorStyleHandler,actionHandler:ja.scalingEqually,render:gg}),tr:new ni({x:.5,y:-.5,cursorStyleHandler:ja.scaleCursorStyleHandler,actionHandler:ja.scalingEqually,render:gg}),br:new ni({x:.5,y:.5,cursorStyleHandler:ja.scaleCursorStyleHandler,actionHandler:ja.scalingEqually,render:gg})}}rotationControl(){const eg=document.createElement("img");eg.src=this.option.rotateImg;const gg=(ig,Ig,og,ng,sg)=>{this.drawImg(ig,Ig,og,eg,40,40,sg.angle)};return{mtr:new ni({x:0,y:.5,cursorStyleHandler:ja.rotationStyleHandler,actionHandler:ja.rotationWithSnapping,offsetY:30,actionName:"rotate",render:gg})}}install(eg,gg){if(!gg||!gg.verticalImg||!gg.horizontalImg||!gg.edgeImg)throw new Error("ControlsPluginOption参数必需");this.option=gg,this.eidtor=eg,this.canvas=eg.getCanvas(),Ei.createControls=()=>({controls:{}}),Ei.ownDefaults.controls={...this.peakControl(),...this.intervalControl(),...this.rotationControl()},Ei.ownDefaults.snapAngle=15,Ei.ownDefaults.snapThreshold=5}enabled(){}disabled(){}}class AlignPlugin{constructor(){this.name="AlignPlugin",this.left=(...eg)=>{if(!this.canvas)return;const gg=this.canvas,ig=gg.getActiveObject(),Ig=gg.getActiveObjects();if(ig&&Ig.length>1){const{left:og=0}=ig;gg.discardActiveObject(),Ig.forEach(sg=>{const ag=sg.getBoundingRect();console.log("getBoundingRect",ag),console.log("item",sg.left,sg.width),sg.set({left:og-ag.left+Number(sg.left)}),sg.setCoords()}),console.log("align-left",Ig),gg.fire("custom:object:history",{action:"align-left"});const ng=new Jo(Ig,{canvas:gg});gg.setActiveObject(ng),gg.requestRenderAll()}else ig&&Ig.length===1&&this.alignSingleToWorkspace(ig,"left")},this.right=(...eg)=>{if(!this.canvas)return;const gg=this.canvas,ig=gg.getActiveObject(),Ig=gg.getActiveObjects();if(ig&&Ig.length>1){const{left:og=0,width:ng=0}=ig;gg.discardActiveObject(),Ig.forEach(ag=>{const Cg=ag.getBoundingRect();ag.set({left:og+ng-(Cg.left+Cg.width)+Number(ag.left)})}),gg.fire("custom:object:history",{action:"align-right"});const sg=new Jo(Ig,{canvas:gg});gg.setActiveObject(sg),gg.requestRenderAll()}else ig&&Ig.length===1&&this.alignSingleToWorkspace(ig,"right")},this.xcenter=(...eg)=>{if(!this.canvas)return;const gg=this.canvas,ig=gg.getActiveObject(),Ig=gg.getActiveObjects();if(ig&&Ig.length>1){const{left:og=0,width:ng=0}=ig;gg.discardActiveObject(),Ig.forEach(ag=>{const Cg=ag.getBoundingRect();ag.set({left:og+ng/2-(Cg.left+Cg.width/2)+Number(ag.left)})}),gg.fire("custom:object:history",{action:"align-xcenter"});const sg=new Jo(Ig,{canvas:gg});gg.setActiveObject(sg),gg.requestRenderAll()}},this.ycenter=(...eg)=>{if(!this.canvas)return;const gg=this.canvas,ig=gg.getActiveObject(),Ig=gg.getActiveObjects();if(ig&&Ig.length>1){const{top:og=0,height:ng=0}=ig;gg.discardActiveObject(),Ig.forEach(ag=>{const Cg=ag.getBoundingRect();ag.set({top:og+ng/2-(Cg.top+Cg.height/2)+Number(ag.top)})}),gg.fire("custom:object:history",{action:"align-ycenter"});const sg=new Jo(Ig,{canvas:gg});gg.setActiveObject(sg),gg.requestRenderAll()}},this.top=(...eg)=>{if(!this.canvas)return;const gg=this.canvas,ig=gg.getActiveObject(),Ig=gg.getActiveObjects();if(ig&&Ig.length>1){const{top:og=0}=ig;gg.discardActiveObject(),Ig.forEach(sg=>{const ag=sg.getBoundingRect();sg.set({top:og-ag.top+Number(sg.top)})}),gg.fire("custom:object:history",{action:"align-top"});const ng=new Jo(Ig,{canvas:gg});gg.setActiveObject(ng),gg.requestRenderAll()}else ig&&Ig.length===1&&this.alignSingleToWorkspace(ig,"top")},this.bottom=(...eg)=>{if(!this.canvas)return;const gg=this.canvas,ig=gg.getActiveObject(),Ig=gg.getActiveObjects();if(ig&&Ig.length>1){const{top:og=0,height:ng=0}=ig;gg.discardActiveObject(),Ig.forEach(ag=>{const Cg=ag.getBoundingRect();ag.set({top:og+ng-(Cg.top+Cg.height)+Number(ag.top)})}),gg.fire("custom:object:history",{action:"align-bottom"});const sg=new Jo(Ig,{canvas:gg});gg.setActiveObject(sg),gg.requestRenderAll()}else ig&&Ig.length===1&&this.alignSingleToWorkspace(ig,"bottom")},this.xequation=(...eg)=>{if(!this.canvas)return;const gg=this.canvas,ig=gg.getActiveObject();function Ig(lg){let Ag=1/0,cg=-1/0;for(const rg in lg.aCoords){const ug=rg;lg.aCoords[ug].x<Ag&&(Ag=lg.aCoords[ug].x),lg.aCoords[ug].x>cg&&(cg=lg.aCoords[ug].x)}return cg-Ag}function og(){let lg=0;return ig&&ig.forEachObject(Ag=>{lg+=Ig(Ag)}),lg}function ng(){const lg=og();if(ig)return(Number(ig.width)-lg)/(ig._objects.length-1)}function sg(lg){if(lg===0)return 0;let Ag=0;if(ig)for(let cg=0;cg<lg;cg++)Ag+=Ig(ig._objects[cg]);return Ag}if(ig&&ig.type==="activeselection"){const lg=ig;if(lg.getObjects().length<2)return;lg._objects.sort((rg,ug)=>rg.left-ug.left);const Ag=ng(),cg=Number(ig.width)/2;ig.forEachObject((rg,ug)=>{const dg=sg(ug),mg=Ag*ug+dg-cg;rg.set("left",mg)})}const ag=gg.getActiveObjects();if(ag.length<2)return;gg.discardActiveObject(),ag.forEach(lg=>{let Ag=1/0;for(const cg in lg.aCoords){const rg=cg;lg.aCoords[rg].x<Ag&&(Ag=lg.aCoords[rg].x)}lg.set("left",2*lg.left-Ag)}),gg.fire("custom:object:history",{action:"align-xequation"});const Cg=new Jo(ag,{canvas:gg});gg.setActiveObject(Cg),gg.requestRenderAll()},this.yequation=(...eg)=>{if(!this.canvas)return;const gg=this.canvas,ig=gg.getActiveObject()||{top:0,height:0};function Ig(lg){let Ag=1/0,cg=-1/0;for(const rg in lg.aCoords){const ug=rg;lg.aCoords[ug].y<Ag&&(Ag=lg.aCoords[ug].y),lg.aCoords[ug].y>cg&&(cg=lg.aCoords[ug].y)}return cg-Ag}function og(){let lg=0;return ig.forEachObject(Ag=>{lg+=Ig(Ag)}),lg}function ng(){const lg=og();return(ig.height-lg)/(ig._objects.length-1)}function sg(lg){if(lg===0)return 0;let Ag=0;for(let cg=0;cg<lg;cg++)Ag+=Ig(ig._objects[cg]);return Ag}if(console.log("activeObject",ig.type),ig&&ig.type==="activeselection"){const lg=ig;if(lg.getObjects().length<2)return;lg._objects.sort((rg,ug)=>rg.top-ug.top);const Ag=ng(),cg=Number(ig.height)/2;ig.forEachObject((rg,ug)=>{const dg=sg(ug),mg=Ag*ug+dg-cg;rg.set("top",mg)})}const ag=gg.getActiveObjects();if(ag.length<2)return;gg.discardActiveObject(),ag.forEach(lg=>{let Ag=1/0;for(const cg in lg.aCoords){const rg=cg;lg.aCoords[rg].y<Ag&&(Ag=lg.aCoords[rg].y)}lg.set("top",2*lg.top-Ag)}),gg.fire("custom:object:history",{action:"align-yequation"});const Cg=new Jo(ag,{canvas:gg});gg.setActiveObject(Cg),gg.requestRenderAll()}}install(eg,gg){this.editor=eg,this.canvas=eg.getCanvas(),this.enabled()}enabled(){this.editor&&(this.editor.addHook("left",this.left),this.editor.addHook("right",this.right),this.editor.addHook("top",this.top),this.editor.addHook("bottom",this.bottom),this.editor.addHook("xcenter",this.xcenter),this.editor.addHook("ycenter",this.ycenter),this.editor.addHook("x-equidistant",this.xequation),this.editor.addHook("y-equidistant",this.yequation))}disabled(){}alignSingleToWorkspace(eg,gg){var Cg;if(!this.canvas)return;const ig=this.canvas.getObjects().find(lg=>lg.id==="workspace");if(!ig)return;const Ig=eg.getBoundingRect(),og=ig.getBoundingRect(),ng={};let ag=((Cg=this.editor)==null?void 0:Cg.ribbonBorderPattern)&&this.editor.ribbonBorderPattern!=="none"?30:0;gg==="left"?ng.left=Number(eg.left||0)+og.left+ag-Ig.left:gg==="right"?ng.left=Number(eg.left||0)+og.left+og.width-ag-Ig.left-Ig.width:gg==="top"?ng.top=Number(eg.top||0)+og.top-Ig.top:gg==="bottom"&&(ng.top=Number(eg.top||0)+og.top+og.height-Ig.top-Ig.height),eg.set(ng),eg.setCoords(),this.canvas.fire("custom:object:history",{action:`align-${gg}`}),this.canvas.fire("custom:object:checkdirty",{isToDirty:!0}),this.canvas.requestRenderAll()}}class GroupPlugin{constructor(){this.name="GroupPlugin"}group(){if(!this.editor)return;const eg=this.editor.getCanvas();if(!eg.getActiveObject())return;const gg=this.editor.getPlugin("HistoryPlugin");gg&&(gg.pause=!0);const ig=eg.getActiveObject();console.log("group",ig.type),getObjectList(ig,og=>{(og.type==="text"||og.type==="counter")&&(og.inGroupRemove=!0)});let Ig;if(ig.type!=="activeSelection"&&ig.type!=="activeselection"){const og=eg.remove(ig);console.log("rmobj",og),Ig=new Hr(og)}else{const og=ig.removeAll();eg.remove(...og),Ig=new Hr(og)}console.log("group====1111",Ig),Ig.id=v4(),addObjName(eg,Ig),Ig.subTargetCheck=!0,gg&&(gg.pause=!1),eg.add(Ig),eg.setActiveObject(Ig),eg.requestRenderAll(),this.editor.emit("group",{target:Ig}),console.log("group",eg.getObjects())}ungroup(){if(!this.editor)return;const eg=this.editor.getCanvas(),gg=eg.getActiveObject();if(!gg||gg.type!=="group")return;const ig=this.editor.getPlugin("HistoryPlugin");ig&&(ig.pause=!0),eg.remove(gg);const Ig=gg.removeAll();eg.add(...Ig);var og=new Jo(Ig,{canvas:eg});ig&&(ig.pause=!1),eg.setActiveObject(og),eg.requestRenderAll(),this.editor.emit("ungroup",{target:og})}install(eg,gg){this.editor=eg,this.enabled()}enabled(){if(this.editor){const gg=this.editor.getPlugin("ContextMenuPlugin");gg&&gg.addItem([{id:"group1",text:"成组",isShow:(ig,Ig)=>!ig||ig.type!=="group",handler:(ig,Ig)=>(this.group(),!0)},{id:"group2",text:"拆分",isShow:(ig,Ig)=>!!(ig&&ig.type==="group"),handler:(ig,Ig)=>(this.ungroup(),!0)}])}}disabled(){if(this.editor){const eg=this.editor.getPlugin("ContextMenuPlugin");eg&&(eg.removeItem("group1"),eg.removeItem("group2"))}}}class HistoryList{constructor(eg){this.canvas=eg,this.history=[],this.historyRedo=[],this.customProp={id:"id",locked:!1,name:"name"},this.isProcess=!1,this.flagClearing=!1,this.undoTimer=void 0,this.extraKeys=Object.keys(this.customProp),this.updateList()}async updateList(){if(this.flagClearing||this.isProcess)return;let eg=null;const gg=this.canvas.getObjects();let ig=[...cloneCommonField,"hasSetHistory"];const Ig=gg.filter(ng=>ng.id!=="workspace"&&!ng.parent&&ng.drawObjectType!=="ignoreObject").map(async ng=>{if(ng.group&&ng.group.type==="activeselection"){eg||(eg=cloneDeep(ng.group));const sg=eg._objects.find(Cg=>Cg.id===ng.id);eg.remove(sg);let ag=await sg.clone(ig);return ag.set("flagActive",!0),ag.canvas=void 0,ag.evented=!0,ag}else{const sg=await ng.clone(ig);return sg.canvas=void 0,sg.evented=!0,sg}}),og=await Promise.all(Ig);this.history.push(og),console.log("history======",this.history),this.historyRedo=[]}clearCanvas(){this.flagClearing=!0;const eg=this.canvas.getObjects().filter(gg=>gg.id!=="workspace");this.canvas.remove(...eg),this.flagClearing=!1}async canvasRestore(eg){this.canvas.discardActiveObject();let gg;clearObjectMap();for(const ig of eg){const Ig=await ig.clone([...cloneCommonField,"flagActive"]);this.canvas.add(Ig),Ig.get("flagActive")&&(gg||(gg=[]),gg.push(Ig)),updateObjectMap(Ig)}gg&&this.canvas.setActiveObject(new Jo(gg)),this.canvas.requestRenderAll()}undo(){if(this.isProcess||this.history.length<=1)return;clearTimeout(this.undoTimer);let eg=this.history.pop();this.historyRedo.push(eg);const gg=this.history[this.history.length-1];console.log("history========",this.history,gg),this.isProcess=!0,this.clearCanvas(),this.canvasRestore(gg).then(()=>{this.isProcess=!1})}redo(){if(this.isProcess||this.historyRedo.length===0)return;const eg=this.historyRedo.pop();this.history.push(eg),this.isProcess=!0,this.clearCanvas(),this.canvasRestore(eg).then(()=>{this.isProcess=!1})}}class HistoryPlugin{constructor(){this.name="HistoryPlugin",this.historyScopeId="default",this.historyScopeMap=new Map,this.pause=!1,this.isMouseDown=!1,this.isObjectModify=!1,this.objectAddedTimer=null,this.hotKeyHandle=eg=>{this.pause||(eg.hke.key==="ctrl+z"||eg.hke.key==="⌘+z"?this.toUndo():(eg.hke.key==="ctrl+shift+z"||eg.hke.key==="⌘+shift+z")&&this.toRedo())},this.objectAdded=({target:eg})=>{var gg;clearTimeout(this.objectAddedTimer),!(this.pause||this.isMouseDown||(gg=this.historyList)!=null&&gg.isProcess)&&(eg.drawObjectType&&eg.drawObjectType==="ignoreObject"||(this.objectAddedTimer=setTimeout(()=>{var ig;this.pause||(ig=this.historyList)!=null&&ig.isProcess||this.historyList&&this.historyList.updateList()},10)))},this.objectRemoved=({target:eg})=>{var gg;this.pause||(gg=this.historyList)!=null&&gg.isProcess||eg.drawObjectType&&eg.drawObjectType==="ignoreObject"||(this.historyList&&this.historyList.updateList(),this.canvas&&this.canvas.discardActiveObject())},this.objectModified=({})=>{if(!this.pause){if(this.isMouseDown){this.isObjectModify=!0;return}this.historyList&&this.historyList.updateList()}},this.objectSkewing=()=>{if(!this.pause){if(this.isMouseDown){this.isObjectModify=!0;return}this.historyList&&this.historyList.updateList()}},this.historyUpdate=eg=>{if(!this.pause){if(this.isMouseDown){this.isObjectModify=!0;return}this.historyList&&this.historyList.updateList()}},this.mouseDown=()=>{this.isMouseDown=!0},this.mouseUp=eg=>{var gg;this.isObjectModify?(this.isObjectModify=!1,this.isMouseDown=!1,(gg=this.canvas)==null||gg.fire("custom:object:history",{action:"mouse:up:clear"})):this.isMouseDown=!1}}toUndo(){var eg;(eg=this.historyList)==null||eg.undo()}toRedo(){var eg;(eg=this.historyList)==null||eg.redo()}switchScope(eg="default"){if(!this.canvas)return;clearTimeout(this.objectAddedTimer),this.historyScopeId=eg||"default";let gg=this.historyScopeMap.get(this.historyScopeId);gg||(gg=new HistoryList(this.canvas),this.historyScopeMap.set(this.historyScopeId,gg)),this.historyList=gg,this.isMouseDown=!1,this.isObjectModify=!1}clearScope(eg){if(!eg){if(this.historyScopeMap.clear(),this.canvas){const gg=new HistoryList(this.canvas);this.historyScopeMap.set(this.historyScopeId,gg),this.historyList=gg}return}this.historyScopeMap.delete(eg),this.historyScopeId===eg&&this.switchScope("default")}install(eg,gg){this.editor=eg,this.canvas=eg.getCanvas(),this.historyScopeId=(gg==null?void 0:gg.scopeId)||"default",this.historyList=new HistoryList(this.canvas),this.historyScopeMap.set(this.historyScopeId,this.historyList),this.enabled()}enabled(){this.editor&&(this.editor.addHotKey("ctrl+z",this.hotKeyHandle),this.editor.addHotKey("⌘+z",this.hotKeyHandle),this.editor.addHotKey("ctrl+shift+z",this.hotKeyHandle),this.editor.addHotKey("⌘+shift+z",this.hotKeyHandle)),this.canvas&&(this.canvas.on("mouse:down",this.mouseDown),this.canvas.on("mouse:up",this.mouseUp),this.canvas.on("object:added",this.objectAdded),this.canvas.on("object:removed",this.objectRemoved),this.canvas.on("object:modified",this.objectModified),this.canvas.on("object:skewing",this.objectSkewing),this.canvas.on("custom:object:history",this.historyUpdate))}disabled(){this.editor&&(this.editor.removeHotKey("ctrl+z"),this.editor.removeHotKey("⌘+z"),this.editor.removeHotKey("ctrl+shift+z"),this.editor.removeHotKey("⌘+shift+z")),this.canvas&&(this.canvas.off("mouse:down",this.mouseDown),this.canvas.off("mouse:up",this.mouseUp),this.canvas.off("object:added",this.objectAdded),this.canvas.off("object:removed",this.objectRemoved),this.canvas.off("object:modified",this.objectModified),this.canvas.off("object:skewing",this.objectSkewing),this.canvas.off("custom:object:history",this.historyUpdate))}}class MoveHotKeyPlugin{constructor(){this.name="MoveHotKeyPlugin",this.keys={},this.holder=new Map}install(eg,gg){this.editor=eg,this.canvas=eg.getCanvas(),this.holder.set("keydown",this.keyDown.bind(this)),this.holder.set("keyup",this.keyUp.bind(this)),this.enabled()}move(){const eg=this.canvas.getActiveObject();if(eg!=null&&eg.locked)return;let gg=!0;if(eg&&eg.top!==void 0&&(this.keys.ArrowUp&&(eg.set("top",eg.top-1),gg=!1),this.keys.ArrowDown&&(eg.set("top",eg.top+1),gg=!1),this.keys.ArrowLeft&&(eg.set("left",eg.left-1),gg=!1),this.keys.ArrowRight&&(eg.set("left",eg.left+1),gg=!1),!gg&&(eg.setCoords(),this.canvas))){this.canvas.renderAll(),this.canvas.fire("custom:object:changed",{target:eg});return}this.intervalHolder,clearInterval(this.intervalHolder),this.intervalHolder=void 0,console.log("clearInterval")}keyDown(eg){if(this.keys[eg.code]=!0,["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(eg.code))eg.preventDefault();else return;this.move(),this.intervalHolder===void 0&&(this.intervalHolder=setInterval(this.move.bind(this),96))}keyUp(eg){this.keys[eg.code]=!1}enabled(){var eg;if((eg=this.canvas)!=null&&eg.elements.container){const gg=this.canvas.elements.container;gg.tabIndex=-1,this.holder.forEach((ig,Ig)=>{gg.addEventListener(Ig,ig)})}}disabled(){var eg;if((eg=this.canvas)!=null&&eg.elements.container){const gg=this.canvas.elements.container;this.holder.forEach((ig,Ig)=>{gg.removeEventListener(Ig,ig)})}}}class DeletePlugin{constructor(){this.name="DeletePlugin"}install(eg,gg){this.editor=eg,this.canvas=eg.getCanvas(),this.enabled()}flat(eg,gg){if(gg.push(eg),eg instanceof Hr){const ig=eg.getObjects();if(ig.length>0)for(const Ig of ig)Ig.locked||(gg.push(Ig),Ig instanceof Hr&&this.flat(Ig,gg))}}enabled(){if(this.editor){const eg=this.editor.getPlugin("ContextMenuPlugin");eg&&eg.addItem({id:"delete",text:"删除",hotKey:"delete,backspace",hotKeyHandler:gg=>this.toDelete(),handler:(gg,ig)=>this.toDelete()})}}toDelete(){var og;const gg=this.editor.getPlugin("HistoryPlugin");gg&&(gg.pause=!0);let ig=this.canvas.getActiveObjects();const Ig=[];for(const ng of ig)this.flat(ng,Ig);return Ig.length>0&&(this.canvas.remove(...Ig),this.canvas.requestRenderAll(),ig=ig.filter(ng=>{Ig.includes(ng)}),ig.length>0?this.canvas.setActiveObject(new Jo(ig)):this.canvas.discardActiveObject()),gg&&(gg.pause=!1),(og=this.canvas)==null||og.fire("custom:object:history",{target:null,action:"delete"}),!0}disabled(){if(this.editor){const eg=this.editor.getPlugin("ContextMenuPlugin");eg&&eg.removeItem("delete")}}}let isDrawing=!1;class AddObjectPlugin{constructor(){this.name="AddObjectPlugin",this.startPoint={},this.isMoverUp=!1,this.mouseDown=eg=>{if(!this.canvas)return;this.isMoverUp=!1;const gg=this.canvas,ig=eg.scenePoint;this.startPoint=ig,this.canvas.off("mouse:move",this.mouseMove),this.canvas.off("mouse:up",this.mouseUp),gg.on("mouse:move",this.mouseMove),gg.on("mouse:up",this.mouseUp)},this.mouseMove=eg=>{if(!this.canvas||this.isMoverUp)return;const gg=this.canvas,ig=eg.scenePoint;this.object||(this.object=new ALine([this.startPoint.x,this.startPoint.y,ig.x,ig.y],{...this.objectProps,id:v4(),evented:!1,strokeUniform:!0,hasControls:!1}),addObjName(this.canvas,this.object),this.object.strokeWidth=3,gg.add(this.object)),this.object.set({x2:ig.x,y2:ig.y}),this.object.setCoords(),gg.renderAll()},this.mouseUp=eg=>{!this.canvas||!this.object||(this.isMoverUp=!0,console.log("end",this.object),this.canvas.fire("object:modified",{target:this.object}),this.object=void 0,this.canvas.off("mouse:move",this.mouseMove),this.canvas.off("mouse:up",this.mouseUp),this.end())},this.start=eg=>{if(!this.canvas||isDrawing)return;isDrawing=!0,this.objectProps=eg;const gg=this.canvas;gg.defaultCursor="crosshair",gg.selection=!1,gg.forEachObject(ig=>{ig.set({evented:!1})}),this.canvas.on("mouse:down",this.mouseDown)},this.end=()=>{if(!this.canvas)return;const eg=this.canvas;eg.defaultCursor="default",eg.selection=!0,eg.forEachObject(gg=>{gg.set({evented:!0})}),eg.off("mouse:down",this.mouseDown),isDrawing=!1}}install(eg,gg){this.editor=eg,this.canvas=this.editor.getCanvas(),this.enabled()}enabled(){var eg,gg;this.canvas&&((eg=this.editor)==null||eg.addHook("addLine",this.start),(gg=this.editor)==null||gg.addHook("cancelAdd",this.end))}disabled(){this.canvas&&this.canvas.off("mouse:down",this.mouseDown)}}let _clipboard=null,isInCut=!1;class CopyPaste{constructor(eg){this.canvas=eg,this.copyId="",this.pasteId="",this.cloneField=[...cloneCommonField,"hasSetHistory"]}getObjData(eg="copy"){return new Promise(async(gg,ig)=>{let Ig=this.canvas.getActiveObject();if(Ig){let og=null;try{await navigator.clipboard.writeText(JSON.stringify({type:"fabric",data:""}))}catch(ng){console.error(ng)}if(eg==="copy"){let ng=this.cloneField.filter(sg=>sg!=="locked");og=await Ig.clone(ng)}else Ig instanceof Jo?(og=this.canvas.remove(...Ig._objects),og=new Jo(og)):og=this.canvas.remove(Ig)[0],this.canvas.discardActiveObject(),this.canvas.requestRenderAll();_clipboard=og,gg(og)}else gg(null)})}async copy(){this.getObjData()}handleObject(eg,gg=!1){var ig;if(!gg){if(eg.counterProps&&typeof eg.counterProps=="object"&&(eg.counterProps={...eg.counterProps}),eg._props&&typeof eg._props=="object"&&(eg._props=JSON.parse(JSON.stringify(eg._props))),eg.databaseMixConcat&&typeof eg.databaseMixConcat=="object"&&(eg.databaseMixConcat=JSON.parse(JSON.stringify(eg.databaseMixConcat))),eg.connectObjIds&&typeof eg.connectObjIds=="object"&&(eg.connectObjIds=JSON.parse(JSON.stringify(eg.connectObjIds))),(eg.type==="text"||eg.type==="counter")&&delete eg.connectBar2dMap,eg.type==="barcode2d"||eg.type==="barcode")delete eg.concatTextIdListObj;else if(eg.type==="text"&&eg.fromBarCode2dID){const og=ng=>{if(ng.type==="group"&&ng._objects)return ng._objects.some(sg=>og(sg));if((ng.type==="barcode2d"||ng.type==="barcode")&&ng.id===eg.fromBarCode2dID){let sg=ng.concatTextIdListObj;return sg&&(sg[eg.id]=!0,ng.set("concatTextIdListObj",sg)),!0}};(ig=this.canvas)==null||ig.getObjects().some(ng=>og(ng))}}}async paste(){if(!_clipboard)return"no-data";let eg=this.cloneField;this.copyId!==this.pasteId&&(eg=eg.filter(og=>!["databaseSheet","databaseColumn","databaseTid","outsideInput","increaseCount","fromBarCode2d","fromBarCode2dID","increaseDate","barcodeDateFormatType"].includes(og)));let ig=await _clipboard.clone(eg);if(!ig)return"no-data";let Ig=isInCut;if(isInCut?isInCut=!1:(ig.set({left:ig.left+10,top:ig.top+10,evented:!0}),_clipboard&&(_clipboard.left+=10,_clipboard.top+=10)),ig.type==="activeselection")ig.canvas=this.canvas,deepTraverse(ig.getObjects(),(og,ng)=>{addObjName(this.canvas,og),ng&&(Ig||(og.id=v4()),this.handleObject(og,Ig),this.canvas.add(og))});else if(ig.type==="group"){ig.canvas=this.canvas;const og=new Hr;og.id=v4(),addObjName(this.canvas,og),deepTraverse(ig.getObjects(),(ng,sg)=>{addObjName(this.canvas,ng),sg&&(Ig||(ng.id=v4()),this.handleObject(ng,Ig),og.add(ng))}),this.canvas.add(og),ig=og}else Ig||(ig.id=v4()),this.handleObject(ig,Ig),addObjName(this.canvas,ig),this.canvas.add(ig);this.canvas.setActiveObject(ig),this.canvas.requestRenderAll()}async cut(){if(isInCut=!0,!await this.getObjData("cut"))return"no-data"}}class CopyPlugin{constructor(){this.name="CopyPlugin",this.pause=!1,this.pasteHandleFn=function(){},this.hotKeyHandle=eg=>{this.pause||(eg.hke.key==="ctrl+c"||eg.hke.key==="⌘+c"?this.toCopy():eg.hke.key==="ctrl+v"||eg.hke.key==="⌘+v"?this.toPaste():(eg.hke.key==="ctrl+x"||eg.hke.key==="⌘+x")&&this.toCut())},this.pasteHandle=eg=>{var sg;const gg=(sg=this.canvas)==null?void 0:sg.getActiveObject();let ig=eg.target,Ig=window.isInElectron?(ig==null?void 0:ig.tagName)!=="BODY":(ig==null?void 0:ig.tagName)!=="DIV";if(gg&&gg.isEditing||Ig)return;let og=eg.clipboardData,ng=(og==null?void 0:og.items)||[];for(let ag of ng){if(ag.type.startsWith("image")){console.log("粘贴图片");let Cg=ag.getAsFile();canvasEventBus.emit("copyAddImageObj",Cg),console.log("file=====",Cg)}ag.type==="text/plain"&&ag.kind==="string"&&ag.getAsString(Cg=>{console.log("粘贴文本=====",Cg);let lg=Cg;try{lg=JSON.parse(Cg)}catch{lg=Cg}typeof lg=="string"?canvasEventBus.emit("copyAddTextObj",lg):lg.type&&lg.type==="fabric"&&this.toPaste(lg)})}},this.pasteHandleFn=throttle$1(this.pasteHandle,80)}toCopy(){var gg;const eg=this.editor;this.CopyPaste.copyId=eg.id||"",(gg=this.CopyPaste)==null||gg.copy()}async toPaste(eg=null){var og;const gg=this.editor;this.CopyPaste.pasteId=gg.id||"";const ig=gg.getPlugin("HistoryPlugin");ig&&(ig.pause=!0);let Ig={};if(window.isInElectron)try{Ig=await window.dsapi.systemApi.readClipboard(),Ig=JSON.parse(Ig)}catch{}else eg?Ig.text=eg:Ig.text=await navigator.clipboard.readText();if(Ig.text){let ng=Ig.text;try{ng=JSON.parse(Ig.text)}catch{ng=Ig.text}typeof ng=="string"?(ig&&(ig.pause=!1),canvasEventBus.emit("copyAddTextObj",ng)):ng.type&&ng.type==="fabric"&&((og=this.CopyPaste)==null||og.paste().then(sg=>{var ag;ig&&(ig.pause=!1),sg!=="no-data"&&((ag=this.canvas)==null||ag.fire("custom:object:history",{action:"paste"}))}))}else Ig.imageData&&Ig.imageData.length&&Ig.imageData.forEach(ng=>{canvasEventBus.emit("copyAddImageObj",ng)})}toCut(){var ig;const eg=this.editor;this.CopyPaste.copyId=eg.id||"";const gg=eg.getPlugin("HistoryPlugin");gg&&(gg.pause=!0),(ig=this.CopyPaste)==null||ig.cut().then(Ig=>{var og;gg&&(gg.pause=!1),Ig!=="no-data"&&((og=this.canvas)==null||og.fire("custom:object:history",{target:null,action:"cut"}))})}install(eg,gg){this.editor=eg,this.canvas=eg.getCanvas(),this.CopyPaste=new CopyPaste(this.canvas),this.enabled()}enabled(){this.editor&&(this.editor.addHotKey("ctrl+c",this.hotKeyHandle),this.editor.addHotKey("⌘+c",this.hotKeyHandle),this.editor.addHotKey("ctrl+x",this.hotKeyHandle),this.editor.addHotKey("⌘+x",this.hotKeyHandle),document.removeEventListener("paste",this.pasteHandleFn),document.addEventListener("paste",this.pasteHandleFn))}disabled(){this.editor&&(this.editor.removeHotKey("ctrl+c"),this.editor.removeHotKey("⌘+c"),this.editor.removeHotKey("ctrl+x"),this.editor.removeHotKey("⌘+x"),document.removeEventListener("paste",this.pasteHandleFn))}}class SelectPlugin{constructor(){this.name="SelectPlugin",this.selectAll=()=>{if(this.canvas){const eg=this.canvas.getObjects().filter(ig=>ig.id!=="workspace"),gg=new Jo(eg);this.canvas.setActiveObject(gg),this.canvas.requestRenderAll()}}}install(eg,gg){this.canvas=eg.getCanvas(),this.enabled()}uninstall(){this.disabled()}enabled(){hotkeys("ctrl+a",this.selectAll)}disabled(){hotkeys.unbind("ctrl+a",this.selectAll)}}class LineContorlPlugin{constructor(){this.name="LineContorlPlugin",this._lastLeft=0,this._lastTop=0,this.moveTimer=null}install(eg,gg){this.canvas=eg.getCanvas(),this.enabled()}uninstall(){this.disabled()}_createHandle(eg,gg){return new ho({drawObjectType:"ignoreObject",idType:"lineHandle",left:eg,top:gg,radius:6,fill:"#fff",stroke:"#1976d2",strokeWidth:2,originX:"center",originY:"center",hasControls:!1,hasBorders:!1,selectable:!0,hoverCursor:"pointer",objectCaching:!1})}_bindEvents(){this.canvas&&(canvasEventBus.off("positionChange"),canvasEventBus.on("positionChange",eg=>{eg.type==="line"&&setTimeout(()=>{this._onSelection({selected:[eg]})},0)}),this.canvas.on("selection:created",eg=>this._onSelection(eg)),this.canvas.on("selection:updated",eg=>this._onSelection(eg)),this.canvas.on("custom:object:basechanged",eg=>{let gg=eg.type,ig=eg.activeObj,Ig=eg.val,og=eg.oldVal,ng=Ig-og;gg==="x"?(ig.x1=ig.x1+ng,ig.x2=ig.x2+ng):gg==="y"?(ig.y1=ig.y1+ng,ig.y2=ig.y2+ng):gg==="w"?ig.x2>ig.x1?ig.x2=ig.x2+ng:ig.x1=ig.x1+ng:gg==="h"&&(ig.y2>ig.y1?ig.y2=ig.y2+ng:ig.y1=ig.y1+ng),this._onSelection({selected:[ig]})}),this.canvas.on("selection:cleared",()=>this._hideHandles()))}_updateLineFromHandles(){var eg;this.lineObject&&this.handle1&&this.handle2&&(this.lineObject.set({x1:this.handle1.left,y1:this.handle1.top,x2:this.handle2.left,y2:this.handle2.top}),this.lineObject.setCoords(),(eg=this.canvas)==null||eg.requestRenderAll())}_updateHandlesFromLine(){var ig,Ig,og;if(!this.lineObject||!this.handle1||!this.handle2)return;const eg=this.lineObject.left-(this._lastLeft??this.lineObject.left),gg=this.lineObject.top-(this._lastTop??this.lineObject.top);(eg!==0||gg!==0)&&((ig=this.handle1)==null||ig.set({left:this.handle1.left+eg,top:this.handle1.top+gg}),(Ig=this.handle2)==null||Ig.set({left:this.handle2.left+eg,top:this.handle2.top+gg}),this.lineObject.set({x1:this.handle1.left,y1:this.handle1.top,x2:this.handle2.left,y2:this.handle2.top}),this.handle1.setCoords(),this.handle2.setCoords(),this.lineObject.setCoords()),this._lastLeft=this.lineObject.left,this._lastTop=this.lineObject.top,(og=this.canvas)==null||og.requestRenderAll()}_onSelection(eg){var ig,Ig,og,ng,sg,ag,Cg,lg;let gg=(eg==null?void 0:eg.selected[0])||{};if(eg.selected.length===1&&gg.type==="line"){if(this.lineObject=eg.selected[0],!this.lineObject||(this.handle1&&this.handle2&&((ig=this.canvas)==null||ig.remove(this.handle1,this.handle2)),this.lineObject.group))return;this._lastLeft=this.lineObject.left,this._lastTop=this.lineObject.top;let Ag=0,cg=0,rg=0,ug=0;this.lineObject.x1<=this.lineObject.x2?(this._lastLeft=this.lineObject.left,this._lastTop=this.lineObject.top,Ag=this._lastLeft,cg=this._lastLeft+this.lineObject.width):this.lineObject.x1>this.lineObject.x2&&(this._lastLeft=this.lineObject.left+this.lineObject.width,this._lastTop=this.lineObject.top,Ag=this._lastLeft,cg=this._lastLeft-this.lineObject.width),this.lineObject.y1>=this.lineObject.y2?(this._lastLeft=this.lineObject.left,this._lastTop=this.lineObject.top,rg=this._lastTop+this.lineObject.height,ug=this._lastTop):this.lineObject.y1<this.lineObject.y2&&(rg=this._lastTop,ug=this._lastTop+this.lineObject.height),this.handle1=this._createHandle(Ag,rg),this.handle2=this._createHandle(cg,ug),(Ig=this.handle1)==null||Ig.on("moving",()=>this._updateLineFromHandles()),(og=this.handle2)==null||og.on("moving",()=>this._updateLineFromHandles()),(ng=this.handle2)==null||ng.on("mouseup",()=>{var dg;(dg=this.canvas)==null||dg.discardActiveObject(),setTimeout(()=>{var mg,bg;this.lineObject&&((mg=this.canvas)==null||mg.setActiveObject(this.lineObject)),(bg=this.canvas)==null||bg.requestRenderAll()},220)}),(sg=this.handle1)==null||sg.on("mouseup",()=>{var dg;(dg=this.canvas)==null||dg.discardActiveObject(),setTimeout(()=>{var mg;this.lineObject&&((mg=this.canvas)==null||mg.setActiveObject(this.lineObject))},220)}),(ag=this.lineObject)==null||ag.on("moving",()=>this._updateHandlesFromLine()),(Cg=this.canvas)==null||Cg.add(this.handle1,this.handle2),(lg=this.canvas)==null||lg.requestRenderAll()}else gg&&gg.drawObjectType!=="ignoreObject"&&this._hideHandles()}_showHandles(){}_hideHandles(){var eg,gg;this.handle1&&this.handle2&&((eg=this.canvas)==null||eg.remove(this.handle1,this.handle2),(gg=this.canvas)==null||gg.requestRenderAll())}enabled(){this._bindEvents()}disabled(){canvasEventBus.off("positionChange")}}ji.customProperties=["customExportFields"];const _hoisted_1$11={class:"nest-menu"},_sfc_main$14=defineComponent({__name:"nest-menu",props:{items:{type:Array,required:!0}},setup(tg){const eg=useSlots(),gg=(ig,Ig="")=>ig.map((og,ng)=>{if(og.children&&og.children.length){let sg=(Ig?Ig+"-":"")+(ng+1);return h$2(Menu.SubMenu,{key:sg,title:og.label,popupClassName:"le-target-menu"},{default:()=>gg(og.children,sg)})}else return h$2(Menu.Item,{key:(Ig?Ig+"-":"")+(ng+1)},{default:()=>eg.item({data:og})})});return(ig,Ig)=>(openBlock(),createElementBlock("div",_hoisted_1$11,[createVNode(unref(Menu),mergeProps({mode:"horizontal"},ig.$attrs),{default:withCtx(()=>[(openBlock(!0),createElementBlock(Fragment,null,renderList(gg(tg.items),og=>(openBlock(),createBlock(resolveDynamicComponent(og),{key:og.key}))),128))]),_:1},16)]))}}),_export_sfc=(tg,eg)=>{const gg=tg.__vccOpts||tg;for(const[ig,Ig]of eg)gg[ig]=Ig;return gg},nestedMenu=_export_sfc(_sfc_main$14,[["__scopeId","data-v-ebd540f8"]]),emitter=mitt(),IconClose$1="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='21'%20height='20.5078125'%20viewBox='0%200%2021%2020.5078125'%3e%3cg%3e%3cg%3e%3cellipse%20cx='10.5'%20cy='10.25390625'%20rx='10.5'%20ry='10.25390625'%20fill='%23EAEAEA'%20fill-opacity='1'%20/%3e%3c/g%3e%3cg%20transform='matrix(0,1,-1,0,21.315007209777832,-11.299349784851074)'%3e%3cpath%20d='M26.872478497314454,5.368129712463379L26.872478497314454,5.368129712463379Q26.914278497314456,5.410926712463379,26.951778497314454,5.457711712463379Q26.98927849731445,5.504496712463379,27.022078497314453,5.554820712463379Q27.054878497314455,5.605143712463379,27.082778497314454,5.658520712463379Q27.110678497314453,5.7118977124633785,27.133278497314453,5.767813712463379Q27.155878497314454,5.823730712463379,27.173078497314453,5.881647712463379Q27.190178497314452,5.939565712463379,27.201778497314454,5.998925712463379Q27.213278497314455,6.058288712463379,27.219078497314452,6.118518712463379Q27.224878497314453,6.178748712463379,27.224878497314453,6.239278712463379Q27.224878497314453,6.299798712463379,27.219078497314452,6.360028712463379Q27.213278497314455,6.420258712463379,27.201778497314454,6.479618712463379Q27.190178497314452,6.538978712463379,27.173078497314453,6.5968987124633784Q27.155878497314454,6.654818712463379,27.133278497314453,6.7107287124633785Q27.110678497314453,6.766648712463379,27.082778497314454,6.820028712463379Q27.054878497314455,6.8734087124633785,27.022078497314453,6.923728712463379Q26.98927849731445,6.974048712463379,26.951778497314454,7.020838712463378Q26.914278497314456,7.0676187124633785,26.872478497314454,7.110418712463379L18.361158497314452,15.826028712463378Q18.319358497314454,15.86882871246338,18.273668497314453,15.907228712463379Q18.227988497314453,15.945628712463378,18.17883849731445,15.979228712463378Q18.129698497314454,16.01282871246338,18.077568497314452,16.04132871246338Q18.025448497314454,16.06992871246338,17.970838497314453,16.09302871246338Q17.916228497314453,16.11622871246338,17.859668497314452,16.133828712463377Q17.803108497314454,16.15132871246338,17.745148497314453,16.16312871246338Q17.687178497314452,16.174928712463377,17.62835849731445,16.180928712463377Q17.569538497314454,16.18682871246338,17.510428497314454,16.18682871246338Q17.451328497314453,16.18682871246338,17.392508497314452,16.180928712463377Q17.333688497314455,16.174928712463377,17.275714497314453,16.16312871246338Q17.217745497314453,16.15132871246338,17.161185497314452,16.133828712463377Q17.10462549731445,16.11622871246338,17.05001949731445,16.09302871246338Q16.995413497314452,16.06992871246338,16.943287497314454,16.04132871246338Q16.891162497314454,16.01282871246338,16.842018497314452,15.979228712463378Q16.792874497314454,15.945628712463378,16.747185497314454,15.907228712463379Q16.70149649731445,15.86882871246338,16.659703497314453,15.826028712463378L16.659703497314453,15.826028712463378Q16.617909497314454,15.783228712463378,16.580413497314453,15.736428712463379Q16.542918497314453,15.68962871246338,16.510081497314452,15.63932871246338Q16.47724449731445,15.58902871246338,16.449382497314453,15.535628712463378Q16.421520497314454,15.482228712463378,16.398901797314455,15.426328712463379Q16.376283297314455,15.37042871246338,16.359125997314454,15.31252871246338Q16.341968697314453,15.25452871246338,16.330437797314453,15.19522871246338Q16.318906997314453,15.135828712463379,16.313113657314453,15.075628712463379Q16.307320322314453,15.015428712463379,16.307320289314454,14.954858712463379Q16.307320256314455,14.894338712463378,16.313113517314452,14.834098712463378Q16.318906797314455,14.77386871246338,16.330437597314454,14.71450871246338Q16.34196829731445,14.65514871246338,16.359125597314453,14.597228712463378Q16.376282797314452,14.539308712463379,16.398901297314453,14.483398712463378Q16.421519497314453,14.42747871246338,16.44938149731445,14.374098712463379Q16.477243497314454,14.32072871246338,16.510080497314455,14.270398712463379Q16.542917497314452,14.220078712463378,16.580413497314453,14.173298712463378Q16.617908497314453,14.126508712463378,16.659702497314452,14.083708712463379L25.171018497314453,5.368129712463379Q25.212808497314455,5.325333712463379,25.258498497314456,5.286937712463379Q25.304188497314453,5.248541712463379,25.353328497314454,5.214916712463379Q25.40246849731445,5.181291712463379,25.454598497314453,5.152761712463379Q25.506728497314455,5.124230712463379,25.561328497314452,5.101069512463379Q25.615938497314453,5.077908212463379,25.672498497314454,5.060339212463379Q25.729058497314455,5.042770112463379,25.787028497314452,5.030962612463379Q25.844998497314453,5.019155012463379,25.903818497314454,5.013222702463379Q25.96263849731445,5.007290366463379,26.021738497314452,5.007290366463379Q26.080848497314452,5.007290366463379,26.139668497314453,5.013222702463379Q26.198488497314454,5.019155012463379,26.256458497314455,5.030962612463379Q26.31437849731445,5.042770112463379,26.370978497314454,5.060339212463379Q26.427578497314453,5.077908212463379,26.482178497314454,5.101069512463379Q26.53677849731445,5.124230712463379,26.588878497314454,5.152761712463379Q26.640978497314453,5.181291712463379,26.690178497314452,5.214916712463379Q26.73927849731445,5.248541712463379,26.784978497314455,5.286937712463379Q26.83067849731445,5.325333712463379,26.872478497314454,5.368129712463379Z'%20fill='%238C8C8C'%20fill-opacity='1'%20/%3e%3c/g%3e%3cg%20transform='rotate(90%2010.5%2010.5)%20matrix(0,1,-1,0,21.315007209777832,-11.299349784851074)'%3e%3cpath%20d='M26.872478497314454,5.368129712463379L26.872478497314454,5.368129712463379Q26.914278497314456,5.410926712463379,26.951778497314454,5.457711712463379Q26.98927849731445,5.504496712463379,27.022078497314453,5.554820712463379Q27.054878497314455,5.605143712463379,27.082778497314454,5.658520712463379Q27.110678497314453,5.7118977124633785,27.133278497314453,5.767813712463379Q27.155878497314454,5.823730712463379,27.173078497314453,5.881647712463379Q27.190178497314452,5.939565712463379,27.201778497314454,5.998925712463379Q27.213278497314455,6.058288712463379,27.219078497314452,6.118518712463379Q27.224878497314453,6.178748712463379,27.224878497314453,6.239278712463379Q27.224878497314453,6.299798712463379,27.219078497314452,6.360028712463379Q27.213278497314455,6.420258712463379,27.201778497314454,6.479618712463379Q27.190178497314452,6.538978712463379,27.173078497314453,6.5968987124633784Q27.155878497314454,6.654818712463379,27.133278497314453,6.7107287124633785Q27.110678497314453,6.766648712463379,27.082778497314454,6.820028712463379Q27.054878497314455,6.8734087124633785,27.022078497314453,6.923728712463379Q26.98927849731445,6.974048712463379,26.951778497314454,7.020838712463378Q26.914278497314456,7.0676187124633785,26.872478497314454,7.110418712463379L18.361158497314452,15.826028712463378Q18.319358497314454,15.86882871246338,18.273668497314453,15.907228712463379Q18.227988497314453,15.945628712463378,18.17883849731445,15.979228712463378Q18.129698497314454,16.01282871246338,18.077568497314452,16.04132871246338Q18.025448497314454,16.06992871246338,17.970838497314453,16.09302871246338Q17.916228497314453,16.11622871246338,17.859668497314452,16.133828712463377Q17.803108497314454,16.15132871246338,17.745148497314453,16.16312871246338Q17.687178497314452,16.174928712463377,17.62835849731445,16.180928712463377Q17.569538497314454,16.18682871246338,17.510428497314454,16.18682871246338Q17.451328497314453,16.18682871246338,17.392508497314452,16.180928712463377Q17.333688497314455,16.174928712463377,17.275714497314453,16.16312871246338Q17.217745497314453,16.15132871246338,17.161185497314452,16.133828712463377Q17.10462549731445,16.11622871246338,17.05001949731445,16.09302871246338Q16.995413497314452,16.06992871246338,16.943287497314454,16.04132871246338Q16.891162497314454,16.01282871246338,16.842018497314452,15.979228712463378Q16.792874497314454,15.945628712463378,16.747185497314454,15.907228712463379Q16.70149649731445,15.86882871246338,16.659703497314453,15.826028712463378L16.659703497314453,15.826028712463378Q16.617909497314454,15.783228712463378,16.580413497314453,15.736428712463379Q16.542918497314453,15.68962871246338,16.510081497314452,15.63932871246338Q16.47724449731445,15.58902871246338,16.449382497314453,15.535628712463378Q16.421520497314454,15.482228712463378,16.398901797314455,15.426328712463379Q16.376283297314455,15.37042871246338,16.359125997314454,15.31252871246338Q16.341968697314453,15.25452871246338,16.330437797314453,15.19522871246338Q16.318906997314453,15.135828712463379,16.313113657314453,15.075628712463379Q16.307320322314453,15.015428712463379,16.307320289314454,14.954858712463379Q16.307320256314455,14.894338712463378,16.313113517314452,14.834098712463378Q16.318906797314455,14.77386871246338,16.330437597314454,14.71450871246338Q16.34196829731445,14.65514871246338,16.359125597314453,14.597228712463378Q16.376282797314452,14.539308712463379,16.398901297314453,14.483398712463378Q16.421519497314453,14.42747871246338,16.44938149731445,14.374098712463379Q16.477243497314454,14.32072871246338,16.510080497314455,14.270398712463379Q16.542917497314452,14.220078712463378,16.580413497314453,14.173298712463378Q16.617908497314453,14.126508712463378,16.659702497314452,14.083708712463379L25.171018497314453,5.368129712463379Q25.212808497314455,5.325333712463379,25.258498497314456,5.286937712463379Q25.304188497314453,5.248541712463379,25.353328497314454,5.214916712463379Q25.40246849731445,5.181291712463379,25.454598497314453,5.152761712463379Q25.506728497314455,5.124230712463379,25.561328497314452,5.101069512463379Q25.615938497314453,5.077908212463379,25.672498497314454,5.060339212463379Q25.729058497314455,5.042770112463379,25.787028497314452,5.030962612463379Q25.844998497314453,5.019155012463379,25.903818497314454,5.013222702463379Q25.96263849731445,5.007290366463379,26.021738497314452,5.007290366463379Q26.080848497314452,5.007290366463379,26.139668497314453,5.013222702463379Q26.198488497314454,5.019155012463379,26.256458497314455,5.030962612463379Q26.31437849731445,5.042770112463379,26.370978497314454,5.060339212463379Q26.427578497314453,5.077908212463379,26.482178497314454,5.101069512463379Q26.53677849731445,5.124230712463379,26.588878497314454,5.152761712463379Q26.640978497314453,5.181291712463379,26.690178497314452,5.214916712463379Q26.73927849731445,5.248541712463379,26.784978497314455,5.286937712463379Q26.83067849731445,5.325333712463379,26.872478497314454,5.368129712463379Z'%20fill='%238C8C8C'%20fill-opacity='1'%20/%3e%3c/g%3e%3c/g%3e%3c/svg%3e";function useDraggableWithBoundary(tg){const{elRef:eg}=tg,gg=ref(0),ig=ref(0),Ig=ref(!1);let og=0,ng=0,sg=0,ag=0;const Cg=()=>{if(!eg.value)return;const dg=eg.value.getBoundingClientRect();sg=dg.width,ag=dg.height},lg=(dg,mg)=>Math.min(Math.max(dg,-mg),mg),Ag=dg=>{if(!Ig.value)return;let mg=dg.clientX-og,bg=dg.clientY-ng;const pg=(window.innerWidth-sg)/2,Zg=(window.innerHeight-ag)/2;mg=lg(mg,pg),bg=lg(bg,Zg),gg.value=mg,ig.value=bg},cg=()=>{Ig.value=!1,document.removeEventListener("mousemove",Ag),document.removeEventListener("mouseup",cg)},rg=async dg=>{dg.button===0&&(Ig.value=!0,await nextTick(),Cg(),og=dg.clientX-gg.value,ng=dg.clientY-ig.value,document.addEventListener("mousemove",Ag),document.addEventListener("mouseup",cg))},ug=()=>{Cg(),gg.value=lg(gg.value,window.innerWidth-sg),ig.value=lg(ig.value,window.innerHeight-ag)};return window.addEventListener("resize",ug),onUnmounted(()=>{document.removeEventListener("mousemove",Ag),document.removeEventListener("mouseup",cg),window.removeEventListener("resize",ug)}),{x:gg,y:ig,onMouseDown:rg}}const _hoisted_1$10={class:"d-container"},_hoisted_2$J={key:0,class:"d-mask"},_hoisted_3$C={class:"d-t-header"},_hoisted_4$y=["src"],_hoisted_5$u={key:0,class:"footer"},_sfc_main$13=defineComponent({__name:"Dialog",props:mergeModels({width:{type:String,default:"40%",required:!1},height:{type:String,default:"50%",required:!1},minHeight:{type:String,default:"300px",required:!1},maxHeight:{type:String,default:"auto",required:!1},minWidth:{type:String,default:void 0,required:!1},title:{type:String,required:!1},okBtnText:{type:String,default:"确认",require:!1},cancelBtnText:{type:String,default:"取消",require:!1},showOkBtn:{type:Boolean,default:!0,require:!1},showCancelBtn:{type:Boolean,default:!0,require:!1},showClose:{type:Boolean,default:!0,require:!1},noFooter:{type:Boolean,default:!1},maskShow:{type:Boolean,default:!1}},{open:{type:Boolean,default:!0},openModifiers:{},enabledOk:{type:Boolean,default:!0},enabledOkModifiers:{}}),emits:mergeModels(["finish"],["update:open","update:enabledOk"]),setup(tg,{emit:eg}){const gg=ref(),ig=eg,Ig=useModel(tg,"open"),og=tg;useModel(tg,"enabledOk");const{x:ng,y:sg,onMouseDown:ag}=useDraggableWithBoundary({elRef:gg}),Cg=lg=>{lg.stopPropagation(),ig("finish","close")};return(lg,Ag)=>{const cg=Button$1;return Ig.value?(openBlock(),createBlock(Teleport,{key:0,to:"body"},[createBaseVNode("div",_hoisted_1$10,[tg.maskShow?(openBlock(),createElementBlock("div",_hoisted_2$J)):createCommentVNode("",!0),createBaseVNode("div",{ref_key:"dialogRef",ref:gg,class:"dialog-content",style:normalizeStyle$1({height:og.height,minHeight:og.minHeight,width:og.width,minWidth:og.minWidth,maxHeight:og.maxHeight,transform:`translate(${unref(ng)}px, ${unref(sg)}px)`})},[createBaseVNode("div",_hoisted_3$C,[createBaseVNode("div",{class:"d-t-header-title",onMousedown:Ag[0]||(Ag[0]=(...rg)=>unref(ag)&&unref(ag)(...rg))},toDisplayString(og.title),33),tg.showClose?(openBlock(),createElementBlock("img",{key:0,class:"m-close-icon",src:unref(IconClose$1),onClick:Cg},null,8,_hoisted_4$y)):createCommentVNode("",!0)]),createBaseVNode("div",mergeProps({class:"custom-content"},lg.$attrs),[renderSlot(lg.$slots,"default",{},void 0)],16),tg.noFooter?createCommentVNode("",!0):(openBlock(),createElementBlock("div",_hoisted_5$u,[renderSlot(lg.$slots,"ext-button",{},void 0),tg.showOkBtn?(openBlock(),createBlock(cg,{key:0,type:"primary",onClick:Ag[1]||(Ag[1]=rg=>ig("finish","ok")),disabled:!tg.enabledOk},{default:withCtx(()=>[createTextVNode(toDisplayString(tg.okBtnText),1)]),_:1},8,["disabled"])):createCommentVNode("",!0),tg.showCancelBtn?(openBlock(),createBlock(cg,{key:1,style:{background:"#ffffff",color:"#828282"},onClick:Ag[2]||(Ag[2]=rg=>ig("finish","cancel"))},{default:withCtx(()=>[createTextVNode(toDisplayString(tg.cancelBtnText),1)]),_:1})):createCommentVNode("",!0)]))],4)])])):createCommentVNode("",!0)}}}),__unplugin_components_1$1=_export_sfc(_sfc_main$13,[["__scopeId","data-v-870d244d"]]);var browser={},canPromise,hasRequiredCanPromise;function requireCanPromise(){return hasRequiredCanPromise||(hasRequiredCanPromise=1,canPromise=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),canPromise}var qrcode$1={},utils$1={},hasRequiredUtils$1;function requireUtils$1(){if(hasRequiredUtils$1)return utils$1;hasRequiredUtils$1=1;let tg;const eg=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return utils$1.getSymbolSize=function(ig){if(!ig)throw new Error('"version" cannot be null or undefined');if(ig<1||ig>40)throw new Error('"version" should be in range from 1 to 40');return ig*4+17},utils$1.getSymbolTotalCodewords=function(ig){return eg[ig]},utils$1.getBCHDigit=function(gg){let ig=0;for(;gg!==0;)ig++,gg>>>=1;return ig},utils$1.setToSJISFunction=function(ig){if(typeof ig!="function")throw new Error('"toSJISFunc" is not a valid function.');tg=ig},utils$1.isKanjiModeEnabled=function(){return typeof tg<"u"},utils$1.toSJIS=function(ig){return tg(ig)},utils$1}var errorCorrectionLevel={},hasRequiredErrorCorrectionLevel;function requireErrorCorrectionLevel(){return hasRequiredErrorCorrectionLevel||(hasRequiredErrorCorrectionLevel=1,(function(tg){tg.L={bit:1},tg.M={bit:0},tg.Q={bit:3},tg.H={bit:2};function eg(gg){if(typeof gg!="string")throw new Error("Param is not a string");switch(gg.toLowerCase()){case"l":case"low":return tg.L;case"m":case"medium":return tg.M;case"q":case"quartile":return tg.Q;case"h":case"high":return tg.H;default:throw new Error("Unknown EC Level: "+gg)}}tg.isValid=function(ig){return ig&&typeof ig.bit<"u"&&ig.bit>=0&&ig.bit<4},tg.from=function(ig,Ig){if(tg.isValid(ig))return ig;try{return eg(ig)}catch{return Ig}}})(errorCorrectionLevel)),errorCorrectionLevel}var bitBuffer,hasRequiredBitBuffer;function requireBitBuffer(){if(hasRequiredBitBuffer)return bitBuffer;hasRequiredBitBuffer=1;function tg(){this.buffer=[],this.length=0}return tg.prototype={get:function(eg){const gg=Math.floor(eg/8);return(this.buffer[gg]>>>7-eg%8&1)===1},put:function(eg,gg){for(let ig=0;ig<gg;ig++)this.putBit((eg>>>gg-ig-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(eg){const gg=Math.floor(this.length/8);this.buffer.length<=gg&&this.buffer.push(0),eg&&(this.buffer[gg]|=128>>>this.length%8),this.length++}},bitBuffer=tg,bitBuffer}var bitMatrix,hasRequiredBitMatrix;function requireBitMatrix(){if(hasRequiredBitMatrix)return bitMatrix;hasRequiredBitMatrix=1;function tg(eg){if(!eg||eg<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=eg,this.data=new Uint8Array(eg*eg),this.reservedBit=new Uint8Array(eg*eg)}return tg.prototype.set=function(eg,gg,ig,Ig){const og=eg*this.size+gg;this.data[og]=ig,Ig&&(this.reservedBit[og]=!0)},tg.prototype.get=function(eg,gg){return this.data[eg*this.size+gg]},tg.prototype.xor=function(eg,gg,ig){this.data[eg*this.size+gg]^=ig},tg.prototype.isReserved=function(eg,gg){return this.reservedBit[eg*this.size+gg]},bitMatrix=tg,bitMatrix}var alignmentPattern={},hasRequiredAlignmentPattern;function requireAlignmentPattern(){return hasRequiredAlignmentPattern||(hasRequiredAlignmentPattern=1,(function(tg){const eg=requireUtils$1().getSymbolSize;tg.getRowColCoords=function(ig){if(ig===1)return[];const Ig=Math.floor(ig/7)+2,og=eg(ig),ng=og===145?26:Math.ceil((og-13)/(2*Ig-2))*2,sg=[og-7];for(let ag=1;ag<Ig-1;ag++)sg[ag]=sg[ag-1]-ng;return sg.push(6),sg.reverse()},tg.getPositions=function(ig){const Ig=[],og=tg.getRowColCoords(ig),ng=og.length;for(let sg=0;sg<ng;sg++)for(let ag=0;ag<ng;ag++)sg===0&&ag===0||sg===0&&ag===ng-1||sg===ng-1&&ag===0||Ig.push([og[sg],og[ag]]);return Ig}})(alignmentPattern)),alignmentPattern}var finderPattern={},hasRequiredFinderPattern;function requireFinderPattern(){if(hasRequiredFinderPattern)return finderPattern;hasRequiredFinderPattern=1;const tg=requireUtils$1().getSymbolSize,eg=7;return finderPattern.getPositions=function(ig){const Ig=tg(ig);return[[0,0],[Ig-eg,0],[0,Ig-eg]]},finderPattern}var maskPattern={},hasRequiredMaskPattern;function requireMaskPattern(){return hasRequiredMaskPattern||(hasRequiredMaskPattern=1,(function(tg){tg.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const eg={N1:3,N2:3,N3:40,N4:10};tg.isValid=function(Ig){return Ig!=null&&Ig!==""&&!isNaN(Ig)&&Ig>=0&&Ig<=7},tg.from=function(Ig){return tg.isValid(Ig)?parseInt(Ig,10):void 0},tg.getPenaltyN1=function(Ig){const og=Ig.size;let ng=0,sg=0,ag=0,Cg=null,lg=null;for(let Ag=0;Ag<og;Ag++){sg=ag=0,Cg=lg=null;for(let cg=0;cg<og;cg++){let rg=Ig.get(Ag,cg);rg===Cg?sg++:(sg>=5&&(ng+=eg.N1+(sg-5)),Cg=rg,sg=1),rg=Ig.get(cg,Ag),rg===lg?ag++:(ag>=5&&(ng+=eg.N1+(ag-5)),lg=rg,ag=1)}sg>=5&&(ng+=eg.N1+(sg-5)),ag>=5&&(ng+=eg.N1+(ag-5))}return ng},tg.getPenaltyN2=function(Ig){const og=Ig.size;let ng=0;for(let sg=0;sg<og-1;sg++)for(let ag=0;ag<og-1;ag++){const Cg=Ig.get(sg,ag)+Ig.get(sg,ag+1)+Ig.get(sg+1,ag)+Ig.get(sg+1,ag+1);(Cg===4||Cg===0)&&ng++}return ng*eg.N2},tg.getPenaltyN3=function(Ig){const og=Ig.size;let ng=0,sg=0,ag=0;for(let Cg=0;Cg<og;Cg++){sg=ag=0;for(let lg=0;lg<og;lg++)sg=sg<<1&2047|Ig.get(Cg,lg),lg>=10&&(sg===1488||sg===93)&&ng++,ag=ag<<1&2047|Ig.get(lg,Cg),lg>=10&&(ag===1488||ag===93)&&ng++}return ng*eg.N3},tg.getPenaltyN4=function(Ig){let og=0;const ng=Ig.data.length;for(let ag=0;ag<ng;ag++)og+=Ig.data[ag];return Math.abs(Math.ceil(og*100/ng/5)-10)*eg.N4};function gg(ig,Ig,og){switch(ig){case tg.Patterns.PATTERN000:return(Ig+og)%2===0;case tg.Patterns.PATTERN001:return Ig%2===0;case tg.Patterns.PATTERN010:return og%3===0;case tg.Patterns.PATTERN011:return(Ig+og)%3===0;case tg.Patterns.PATTERN100:return(Math.floor(Ig/2)+Math.floor(og/3))%2===0;case tg.Patterns.PATTERN101:return Ig*og%2+Ig*og%3===0;case tg.Patterns.PATTERN110:return(Ig*og%2+Ig*og%3)%2===0;case tg.Patterns.PATTERN111:return(Ig*og%3+(Ig+og)%2)%2===0;default:throw new Error("bad maskPattern:"+ig)}}tg.applyMask=function(Ig,og){const ng=og.size;for(let sg=0;sg<ng;sg++)for(let ag=0;ag<ng;ag++)og.isReserved(ag,sg)||og.xor(ag,sg,gg(Ig,ag,sg))},tg.getBestMask=function(Ig,og){const ng=Object.keys(tg.Patterns).length;let sg=0,ag=1/0;for(let Cg=0;Cg<ng;Cg++){og(Cg),tg.applyMask(Cg,Ig);const lg=tg.getPenaltyN1(Ig)+tg.getPenaltyN2(Ig)+tg.getPenaltyN3(Ig)+tg.getPenaltyN4(Ig);tg.applyMask(Cg,Ig),lg<ag&&(ag=lg,sg=Cg)}return sg}})(maskPattern)),maskPattern}var errorCorrectionCode={},hasRequiredErrorCorrectionCode;function requireErrorCorrectionCode(){if(hasRequiredErrorCorrectionCode)return errorCorrectionCode;hasRequiredErrorCorrectionCode=1;const tg=requireErrorCorrectionLevel(),eg=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],gg=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return errorCorrectionCode.getBlocksCount=function(Ig,og){switch(og){case tg.L:return eg[(Ig-1)*4+0];case tg.M:return eg[(Ig-1)*4+1];case tg.Q:return eg[(Ig-1)*4+2];case tg.H:return eg[(Ig-1)*4+3];default:return}},errorCorrectionCode.getTotalCodewordsCount=function(Ig,og){switch(og){case tg.L:return gg[(Ig-1)*4+0];case tg.M:return gg[(Ig-1)*4+1];case tg.Q:return gg[(Ig-1)*4+2];case tg.H:return gg[(Ig-1)*4+3];default:return}},errorCorrectionCode}var polynomial={},galoisField={},hasRequiredGaloisField;function requireGaloisField(){if(hasRequiredGaloisField)return galoisField;hasRequiredGaloisField=1;const tg=new Uint8Array(512),eg=new Uint8Array(256);return(function(){let ig=1;for(let Ig=0;Ig<255;Ig++)tg[Ig]=ig,eg[ig]=Ig,ig<<=1,ig&256&&(ig^=285);for(let Ig=255;Ig<512;Ig++)tg[Ig]=tg[Ig-255]})(),galoisField.log=function(ig){if(ig<1)throw new Error("log("+ig+")");return eg[ig]},galoisField.exp=function(ig){return tg[ig]},galoisField.mul=function(ig,Ig){return ig===0||Ig===0?0:tg[eg[ig]+eg[Ig]]},galoisField}var hasRequiredPolynomial;function requirePolynomial(){return hasRequiredPolynomial||(hasRequiredPolynomial=1,(function(tg){const eg=requireGaloisField();tg.mul=function(ig,Ig){const og=new Uint8Array(ig.length+Ig.length-1);for(let ng=0;ng<ig.length;ng++)for(let sg=0;sg<Ig.length;sg++)og[ng+sg]^=eg.mul(ig[ng],Ig[sg]);return og},tg.mod=function(ig,Ig){let og=new Uint8Array(ig);for(;og.length-Ig.length>=0;){const ng=og[0];for(let ag=0;ag<Ig.length;ag++)og[ag]^=eg.mul(Ig[ag],ng);let sg=0;for(;sg<og.length&&og[sg]===0;)sg++;og=og.slice(sg)}return og},tg.generateECPolynomial=function(ig){let Ig=new Uint8Array([1]);for(let og=0;og<ig;og++)Ig=tg.mul(Ig,new Uint8Array([1,eg.exp(og)]));return Ig}})(polynomial)),polynomial}var reedSolomonEncoder,hasRequiredReedSolomonEncoder;function requireReedSolomonEncoder(){if(hasRequiredReedSolomonEncoder)return reedSolomonEncoder;hasRequiredReedSolomonEncoder=1;const tg=requirePolynomial();function eg(gg){this.genPoly=void 0,this.degree=gg,this.degree&&this.initialize(this.degree)}return eg.prototype.initialize=function(ig){this.degree=ig,this.genPoly=tg.generateECPolynomial(this.degree)},eg.prototype.encode=function(ig){if(!this.genPoly)throw new Error("Encoder not initialized");const Ig=new Uint8Array(ig.length+this.degree);Ig.set(ig);const og=tg.mod(Ig,this.genPoly),ng=this.degree-og.length;if(ng>0){const sg=new Uint8Array(this.degree);return sg.set(og,ng),sg}return og},reedSolomonEncoder=eg,reedSolomonEncoder}var version={},mode={},versionCheck={},hasRequiredVersionCheck;function requireVersionCheck(){return hasRequiredVersionCheck||(hasRequiredVersionCheck=1,versionCheck.isValid=function(eg){return!isNaN(eg)&&eg>=1&&eg<=40}),versionCheck}var regex={},hasRequiredRegex;function requireRegex(){if(hasRequiredRegex)return regex;hasRequiredRegex=1;const tg="[0-9]+",eg="[A-Z $%*+\\-./:]+";let gg="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";gg=gg.replace(/u/g,"\\u");const ig="(?:(?![A-Z0-9 $%*+\\-./:]|"+gg+`)(?:.|[\r
|
|
906
|
+
`).flatMap(Ig=>{let og="";const ng=Ig.split(/\s+/).filter(sg=>sg);return ng.reduce((sg,ag,Cg)=>{const lg=og?`${og} ${ag}`:ag;return tg.measureText(lg).width<=gg?og=lg:(og&&sg.push(og),og=ag,(Cg===ng.length-1||tg.measureText(ag).width>gg)&&(sg.push(...splitLongWord(tg,ag,gg)),og="")),Cg===ng.length-1&&og&&sg.push(og),sg},[])})}function getLineHeight(tg){const eg=tg.font.match(/\d+/),gg=10;return eg?parseInt(eg[0],gg):gg}function generateThumbnail(tg,eg,gg){let{width:ig,height:Ig}=tg;const og=Math.min(eg/ig,gg/Ig);ig*=og,Ig*=og;const ng=document.createElement("canvas"),sg=ng.getContext("2d");if(!sg)throw new Error("Canvas context not available");return ng.width=ig,ng.height=Ig,sg.drawImage(tg,0,0,ig,Ig),ng.toDataURL("image/png",.85)}class LuxonError extends Error{}class InvalidDateTimeError extends LuxonError{constructor(eg){super(`Invalid DateTime: ${eg.toMessage()}`)}}class InvalidIntervalError extends LuxonError{constructor(eg){super(`Invalid Interval: ${eg.toMessage()}`)}}class InvalidDurationError extends LuxonError{constructor(eg){super(`Invalid Duration: ${eg.toMessage()}`)}}class ConflictingSpecificationError extends LuxonError{}class InvalidUnitError extends LuxonError{constructor(eg){super(`Invalid unit ${eg}`)}}class InvalidArgumentError extends LuxonError{}class ZoneIsAbstractError extends LuxonError{constructor(){super("Zone is an abstract class")}}const n="numeric",s="short",l="long",DATE_SHORT={year:n,month:n,day:n},DATE_MED={year:n,month:s,day:n},DATE_MED_WITH_WEEKDAY={year:n,month:s,day:n,weekday:s},DATE_FULL={year:n,month:l,day:n},DATE_HUGE={year:n,month:l,day:n,weekday:l},TIME_SIMPLE={hour:n,minute:n},TIME_WITH_SECONDS={hour:n,minute:n,second:n},TIME_WITH_SHORT_OFFSET={hour:n,minute:n,second:n,timeZoneName:s},TIME_WITH_LONG_OFFSET={hour:n,minute:n,second:n,timeZoneName:l},TIME_24_SIMPLE={hour:n,minute:n,hourCycle:"h23"},TIME_24_WITH_SECONDS={hour:n,minute:n,second:n,hourCycle:"h23"},TIME_24_WITH_SHORT_OFFSET={hour:n,minute:n,second:n,hourCycle:"h23",timeZoneName:s},TIME_24_WITH_LONG_OFFSET={hour:n,minute:n,second:n,hourCycle:"h23",timeZoneName:l},DATETIME_SHORT={year:n,month:n,day:n,hour:n,minute:n},DATETIME_SHORT_WITH_SECONDS={year:n,month:n,day:n,hour:n,minute:n,second:n},DATETIME_MED={year:n,month:s,day:n,hour:n,minute:n},DATETIME_MED_WITH_SECONDS={year:n,month:s,day:n,hour:n,minute:n,second:n},DATETIME_MED_WITH_WEEKDAY={year:n,month:s,day:n,weekday:s,hour:n,minute:n},DATETIME_FULL={year:n,month:l,day:n,hour:n,minute:n,timeZoneName:s},DATETIME_FULL_WITH_SECONDS={year:n,month:l,day:n,hour:n,minute:n,second:n,timeZoneName:s},DATETIME_HUGE={year:n,month:l,day:n,weekday:l,hour:n,minute:n,timeZoneName:l},DATETIME_HUGE_WITH_SECONDS={year:n,month:l,day:n,weekday:l,hour:n,minute:n,second:n,timeZoneName:l};class Zone{get type(){throw new ZoneIsAbstractError}get name(){throw new ZoneIsAbstractError}get ianaName(){return this.name}get isUniversal(){throw new ZoneIsAbstractError}offsetName(eg,gg){throw new ZoneIsAbstractError}formatOffset(eg,gg){throw new ZoneIsAbstractError}offset(eg){throw new ZoneIsAbstractError}equals(eg){throw new ZoneIsAbstractError}get isValid(){throw new ZoneIsAbstractError}}let singleton$1=null;class SystemZone extends Zone{static get instance(){return singleton$1===null&&(singleton$1=new SystemZone),singleton$1}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(eg,{format:gg,locale:ig}){return parseZoneInfo(eg,gg,ig)}formatOffset(eg,gg){return formatOffset(this.offset(eg),gg)}offset(eg){return-new Date(eg).getTimezoneOffset()}equals(eg){return eg.type==="system"}get isValid(){return!0}}const dtfCache=new Map;function makeDTF(tg){let eg=dtfCache.get(tg);return eg===void 0&&(eg=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:tg,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),dtfCache.set(tg,eg)),eg}const typeToPos={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function hackyOffset(tg,eg){const gg=tg.format(eg).replace(/\u200E/g,""),ig=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(gg),[,Ig,og,ng,sg,ag,Cg,lg]=ig;return[ng,Ig,og,sg,ag,Cg,lg]}function partsOffset(tg,eg){const gg=tg.formatToParts(eg),ig=[];for(let Ig=0;Ig<gg.length;Ig++){const{type:og,value:ng}=gg[Ig],sg=typeToPos[og];og==="era"?ig[sg]=ng:isUndefined$1(sg)||(ig[sg]=parseInt(ng,10))}return ig}const ianaZoneCache=new Map;class IANAZone extends Zone{static create(eg){let gg=ianaZoneCache.get(eg);return gg===void 0&&ianaZoneCache.set(eg,gg=new IANAZone(eg)),gg}static resetCache(){ianaZoneCache.clear(),dtfCache.clear()}static isValidSpecifier(eg){return this.isValidZone(eg)}static isValidZone(eg){if(!eg)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:eg}).format(),!0}catch{return!1}}constructor(eg){super(),this.zoneName=eg,this.valid=IANAZone.isValidZone(eg)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(eg,{format:gg,locale:ig}){return parseZoneInfo(eg,gg,ig,this.name)}formatOffset(eg,gg){return formatOffset(this.offset(eg),gg)}offset(eg){if(!this.valid)return NaN;const gg=new Date(eg);if(isNaN(gg))return NaN;const ig=makeDTF(this.name);let[Ig,og,ng,sg,ag,Cg,lg]=ig.formatToParts?partsOffset(ig,gg):hackyOffset(ig,gg);sg==="BC"&&(Ig=-Math.abs(Ig)+1);const cg=objToLocalTS({year:Ig,month:og,day:ng,hour:ag===24?0:ag,minute:Cg,second:lg,millisecond:0});let rg=+gg;const ug=rg%1e3;return rg-=ug>=0?ug:1e3+ug,(cg-rg)/(60*1e3)}equals(eg){return eg.type==="iana"&&eg.name===this.name}get isValid(){return this.valid}}let intlLFCache={};function getCachedLF(tg,eg={}){const gg=JSON.stringify([tg,eg]);let ig=intlLFCache[gg];return ig||(ig=new Intl.ListFormat(tg,eg),intlLFCache[gg]=ig),ig}const intlDTCache=new Map;function getCachedDTF(tg,eg={}){const gg=JSON.stringify([tg,eg]);let ig=intlDTCache.get(gg);return ig===void 0&&(ig=new Intl.DateTimeFormat(tg,eg),intlDTCache.set(gg,ig)),ig}const intlNumCache=new Map;function getCachedINF(tg,eg={}){const gg=JSON.stringify([tg,eg]);let ig=intlNumCache.get(gg);return ig===void 0&&(ig=new Intl.NumberFormat(tg,eg),intlNumCache.set(gg,ig)),ig}const intlRelCache=new Map;function getCachedRTF(tg,eg={}){const{base:gg,...ig}=eg,Ig=JSON.stringify([tg,ig]);let og=intlRelCache.get(Ig);return og===void 0&&(og=new Intl.RelativeTimeFormat(tg,eg),intlRelCache.set(Ig,og)),og}let sysLocaleCache=null;function systemLocale(){return sysLocaleCache||(sysLocaleCache=new Intl.DateTimeFormat().resolvedOptions().locale,sysLocaleCache)}const intlResolvedOptionsCache=new Map;function getCachedIntResolvedOptions(tg){let eg=intlResolvedOptionsCache.get(tg);return eg===void 0&&(eg=new Intl.DateTimeFormat(tg).resolvedOptions(),intlResolvedOptionsCache.set(tg,eg)),eg}const weekInfoCache=new Map;function getCachedWeekInfo(tg){let eg=weekInfoCache.get(tg);if(!eg){const gg=new Intl.Locale(tg);eg="getWeekInfo"in gg?gg.getWeekInfo():gg.weekInfo,"minimalDays"in eg||(eg={...fallbackWeekSettings,...eg}),weekInfoCache.set(tg,eg)}return eg}function parseLocaleString(tg){const eg=tg.indexOf("-x-");eg!==-1&&(tg=tg.substring(0,eg));const gg=tg.indexOf("-u-");if(gg===-1)return[tg];{let ig,Ig;try{ig=getCachedDTF(tg).resolvedOptions(),Ig=tg}catch{const ag=tg.substring(0,gg);ig=getCachedDTF(ag).resolvedOptions(),Ig=ag}const{numberingSystem:og,calendar:ng}=ig;return[Ig,og,ng]}}function intlConfigString(tg,eg,gg){return(gg||eg)&&(tg.includes("-u-")||(tg+="-u"),gg&&(tg+=`-ca-${gg}`),eg&&(tg+=`-nu-${eg}`)),tg}function mapMonths(tg){const eg=[];for(let gg=1;gg<=12;gg++){const ig=DateTime.utc(2009,gg,1);eg.push(tg(ig))}return eg}function mapWeekdays(tg){const eg=[];for(let gg=1;gg<=7;gg++){const ig=DateTime.utc(2016,11,13+gg);eg.push(tg(ig))}return eg}function listStuff(tg,eg,gg,ig){const Ig=tg.listingMode();return Ig==="error"?null:Ig==="en"?gg(eg):ig(eg)}function supportsFastNumbers(tg){return tg.numberingSystem&&tg.numberingSystem!=="latn"?!1:tg.numberingSystem==="latn"||!tg.locale||tg.locale.startsWith("en")||getCachedIntResolvedOptions(tg.locale).numberingSystem==="latn"}class PolyNumberFormatter{constructor(eg,gg,ig){this.padTo=ig.padTo||0,this.floor=ig.floor||!1;const{padTo:Ig,floor:og,...ng}=ig;if(!gg||Object.keys(ng).length>0){const sg={useGrouping:!1,...ig};ig.padTo>0&&(sg.minimumIntegerDigits=ig.padTo),this.inf=getCachedINF(eg,sg)}}format(eg){if(this.inf){const gg=this.floor?Math.floor(eg):eg;return this.inf.format(gg)}else{const gg=this.floor?Math.floor(eg):roundTo(eg,3);return padStart(gg,this.padTo)}}}class PolyDateFormatter{constructor(eg,gg,ig){this.opts=ig,this.originalZone=void 0;let Ig;if(this.opts.timeZone)this.dt=eg;else if(eg.zone.type==="fixed"){const ng=-1*(eg.offset/60),sg=ng>=0?`Etc/GMT+${ng}`:`Etc/GMT${ng}`;eg.offset!==0&&IANAZone.create(sg).valid?(Ig=sg,this.dt=eg):(Ig="UTC",this.dt=eg.offset===0?eg:eg.setZone("UTC").plus({minutes:eg.offset}),this.originalZone=eg.zone)}else eg.zone.type==="system"?this.dt=eg:eg.zone.type==="iana"?(this.dt=eg,Ig=eg.zone.name):(Ig="UTC",this.dt=eg.setZone("UTC").plus({minutes:eg.offset}),this.originalZone=eg.zone);const og={...this.opts};og.timeZone=og.timeZone||Ig,this.dtf=getCachedDTF(gg,og)}format(){return this.originalZone?this.formatToParts().map(({value:eg})=>eg).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const eg=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?eg.map(gg=>{if(gg.type==="timeZoneName"){const ig=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...gg,value:ig}}else return gg}):eg}resolvedOptions(){return this.dtf.resolvedOptions()}}class PolyRelFormatter{constructor(eg,gg,ig){this.opts={style:"long",...ig},!gg&&hasRelative()&&(this.rtf=getCachedRTF(eg,ig))}format(eg,gg){return this.rtf?this.rtf.format(eg,gg):formatRelativeTime(gg,eg,this.opts.numeric,this.opts.style!=="long")}formatToParts(eg,gg){return this.rtf?this.rtf.formatToParts(eg,gg):[]}}const fallbackWeekSettings={firstDay:1,minimalDays:4,weekend:[6,7]};class Locale{static fromOpts(eg){return Locale.create(eg.locale,eg.numberingSystem,eg.outputCalendar,eg.weekSettings,eg.defaultToEN)}static create(eg,gg,ig,Ig,og=!1){const ng=eg||Settings.defaultLocale,sg=ng||(og?"en-US":systemLocale()),ag=gg||Settings.defaultNumberingSystem,Cg=ig||Settings.defaultOutputCalendar,lg=validateWeekSettings(Ig)||Settings.defaultWeekSettings;return new Locale(sg,ag,Cg,lg,ng)}static resetCache(){sysLocaleCache=null,intlDTCache.clear(),intlNumCache.clear(),intlRelCache.clear(),intlResolvedOptionsCache.clear(),weekInfoCache.clear()}static fromObject({locale:eg,numberingSystem:gg,outputCalendar:ig,weekSettings:Ig}={}){return Locale.create(eg,gg,ig,Ig)}constructor(eg,gg,ig,Ig,og){const[ng,sg,ag]=parseLocaleString(eg);this.locale=ng,this.numberingSystem=gg||sg||null,this.outputCalendar=ig||ag||null,this.weekSettings=Ig,this.intl=intlConfigString(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=og,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=supportsFastNumbers(this)),this.fastNumbersCached}listingMode(){const eg=this.isEnglish(),gg=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return eg&&gg?"en":"intl"}clone(eg){return!eg||Object.getOwnPropertyNames(eg).length===0?this:Locale.create(eg.locale||this.specifiedLocale,eg.numberingSystem||this.numberingSystem,eg.outputCalendar||this.outputCalendar,validateWeekSettings(eg.weekSettings)||this.weekSettings,eg.defaultToEN||!1)}redefaultToEN(eg={}){return this.clone({...eg,defaultToEN:!0})}redefaultToSystem(eg={}){return this.clone({...eg,defaultToEN:!1})}months(eg,gg=!1){return listStuff(this,eg,months,()=>{const ig=this.intl==="ja"||this.intl.startsWith("ja-");gg&=!ig;const Ig=gg?{month:eg,day:"numeric"}:{month:eg},og=gg?"format":"standalone";if(!this.monthsCache[og][eg]){const ng=ig?sg=>this.dtFormatter(sg,Ig).format():sg=>this.extract(sg,Ig,"month");this.monthsCache[og][eg]=mapMonths(ng)}return this.monthsCache[og][eg]})}weekdays(eg,gg=!1){return listStuff(this,eg,weekdays,()=>{const ig=gg?{weekday:eg,year:"numeric",month:"long",day:"numeric"}:{weekday:eg},Ig=gg?"format":"standalone";return this.weekdaysCache[Ig][eg]||(this.weekdaysCache[Ig][eg]=mapWeekdays(og=>this.extract(og,ig,"weekday"))),this.weekdaysCache[Ig][eg]})}meridiems(){return listStuff(this,void 0,()=>meridiems,()=>{if(!this.meridiemCache){const eg={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[DateTime.utc(2016,11,13,9),DateTime.utc(2016,11,13,19)].map(gg=>this.extract(gg,eg,"dayperiod"))}return this.meridiemCache})}eras(eg){return listStuff(this,eg,eras,()=>{const gg={era:eg};return this.eraCache[eg]||(this.eraCache[eg]=[DateTime.utc(-40,1,1),DateTime.utc(2017,1,1)].map(ig=>this.extract(ig,gg,"era"))),this.eraCache[eg]})}extract(eg,gg,ig){const Ig=this.dtFormatter(eg,gg),og=Ig.formatToParts(),ng=og.find(sg=>sg.type.toLowerCase()===ig);return ng?ng.value:null}numberFormatter(eg={}){return new PolyNumberFormatter(this.intl,eg.forceSimple||this.fastNumbers,eg)}dtFormatter(eg,gg={}){return new PolyDateFormatter(eg,this.intl,gg)}relFormatter(eg={}){return new PolyRelFormatter(this.intl,this.isEnglish(),eg)}listFormatter(eg={}){return getCachedLF(this.intl,eg)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||getCachedIntResolvedOptions(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:hasLocaleWeekInfo()?getCachedWeekInfo(this.locale):fallbackWeekSettings}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(eg){return this.locale===eg.locale&&this.numberingSystem===eg.numberingSystem&&this.outputCalendar===eg.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let singleton=null;class FixedOffsetZone extends Zone{static get utcInstance(){return singleton===null&&(singleton=new FixedOffsetZone(0)),singleton}static instance(eg){return eg===0?FixedOffsetZone.utcInstance:new FixedOffsetZone(eg)}static parseSpecifier(eg){if(eg){const gg=eg.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(gg)return new FixedOffsetZone(signedOffset(gg[1],gg[2]))}return null}constructor(eg){super(),this.fixed=eg}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${formatOffset(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${formatOffset(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(eg,gg){return formatOffset(this.fixed,gg)}get isUniversal(){return!0}offset(){return this.fixed}equals(eg){return eg.type==="fixed"&&eg.fixed===this.fixed}get isValid(){return!0}}class InvalidZone extends Zone{constructor(eg){super(),this.zoneName=eg}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function normalizeZone(tg,eg){if(isUndefined$1(tg)||tg===null)return eg;if(tg instanceof Zone)return tg;if(isString$1(tg)){const gg=tg.toLowerCase();return gg==="default"?eg:gg==="local"||gg==="system"?SystemZone.instance:gg==="utc"||gg==="gmt"?FixedOffsetZone.utcInstance:FixedOffsetZone.parseSpecifier(gg)||IANAZone.create(tg)}else return isNumber$1(tg)?FixedOffsetZone.instance(tg):typeof tg=="object"&&"offset"in tg&&typeof tg.offset=="function"?tg:new InvalidZone(tg)}const numberingSystems={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},numberingSystemsUTF16={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},hanidecChars=numberingSystems.hanidec.replace(/[\[|\]]/g,"").split("");function parseDigits(tg){let eg=parseInt(tg,10);if(isNaN(eg)){eg="";for(let gg=0;gg<tg.length;gg++){const ig=tg.charCodeAt(gg);if(tg[gg].search(numberingSystems.hanidec)!==-1)eg+=hanidecChars.indexOf(tg[gg]);else for(const Ig in numberingSystemsUTF16){const[og,ng]=numberingSystemsUTF16[Ig];ig>=og&&ig<=ng&&(eg+=ig-og)}}return parseInt(eg,10)}else return eg}const digitRegexCache=new Map;function resetDigitRegexCache(){digitRegexCache.clear()}function digitRegex({numberingSystem:tg},eg=""){const gg=tg||"latn";let ig=digitRegexCache.get(gg);ig===void 0&&(ig=new Map,digitRegexCache.set(gg,ig));let Ig=ig.get(eg);return Ig===void 0&&(Ig=new RegExp(`${numberingSystems[gg]}${eg}`),ig.set(eg,Ig)),Ig}let now=()=>Date.now(),defaultZone="system",defaultLocale=null,defaultNumberingSystem=null,defaultOutputCalendar=null,twoDigitCutoffYear=60,throwOnInvalid,defaultWeekSettings=null;class Settings{static get now(){return now}static set now(eg){now=eg}static set defaultZone(eg){defaultZone=eg}static get defaultZone(){return normalizeZone(defaultZone,SystemZone.instance)}static get defaultLocale(){return defaultLocale}static set defaultLocale(eg){defaultLocale=eg}static get defaultNumberingSystem(){return defaultNumberingSystem}static set defaultNumberingSystem(eg){defaultNumberingSystem=eg}static get defaultOutputCalendar(){return defaultOutputCalendar}static set defaultOutputCalendar(eg){defaultOutputCalendar=eg}static get defaultWeekSettings(){return defaultWeekSettings}static set defaultWeekSettings(eg){defaultWeekSettings=validateWeekSettings(eg)}static get twoDigitCutoffYear(){return twoDigitCutoffYear}static set twoDigitCutoffYear(eg){twoDigitCutoffYear=eg%100}static get throwOnInvalid(){return throwOnInvalid}static set throwOnInvalid(eg){throwOnInvalid=eg}static resetCaches(){Locale.resetCache(),IANAZone.resetCache(),DateTime.resetCache(),resetDigitRegexCache()}}class Invalid{constructor(eg,gg){this.reason=eg,this.explanation=gg}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const nonLeapLadder=[0,31,59,90,120,151,181,212,243,273,304,334],leapLadder=[0,31,60,91,121,152,182,213,244,274,305,335];function unitOutOfRange(tg,eg){return new Invalid("unit out of range",`you specified ${eg} (of type ${typeof eg}) as a ${tg}, which is invalid`)}function dayOfWeek(tg,eg,gg){const ig=new Date(Date.UTC(tg,eg-1,gg));tg<100&&tg>=0&&ig.setUTCFullYear(ig.getUTCFullYear()-1900);const Ig=ig.getUTCDay();return Ig===0?7:Ig}function computeOrdinal(tg,eg,gg){return gg+(isLeapYear(tg)?leapLadder:nonLeapLadder)[eg-1]}function uncomputeOrdinal(tg,eg){const gg=isLeapYear(tg)?leapLadder:nonLeapLadder,ig=gg.findIndex(og=>og<eg),Ig=eg-gg[ig];return{month:ig+1,day:Ig}}function isoWeekdayToLocal(tg,eg){return(tg-eg+7)%7+1}function gregorianToWeek(tg,eg=4,gg=1){const{year:ig,month:Ig,day:og}=tg,ng=computeOrdinal(ig,Ig,og),sg=isoWeekdayToLocal(dayOfWeek(ig,Ig,og),gg);let ag=Math.floor((ng-sg+14-eg)/7),Cg;return ag<1?(Cg=ig-1,ag=weeksInWeekYear(Cg,eg,gg)):ag>weeksInWeekYear(ig,eg,gg)?(Cg=ig+1,ag=1):Cg=ig,{weekYear:Cg,weekNumber:ag,weekday:sg,...timeObject(tg)}}function weekToGregorian(tg,eg=4,gg=1){const{weekYear:ig,weekNumber:Ig,weekday:og}=tg,ng=isoWeekdayToLocal(dayOfWeek(ig,1,eg),gg),sg=daysInYear(ig);let ag=Ig*7+og-ng-7+eg,Cg;ag<1?(Cg=ig-1,ag+=daysInYear(Cg)):ag>sg?(Cg=ig+1,ag-=daysInYear(ig)):Cg=ig;const{month:lg,day:Ag}=uncomputeOrdinal(Cg,ag);return{year:Cg,month:lg,day:Ag,...timeObject(tg)}}function gregorianToOrdinal(tg){const{year:eg,month:gg,day:ig}=tg,Ig=computeOrdinal(eg,gg,ig);return{year:eg,ordinal:Ig,...timeObject(tg)}}function ordinalToGregorian(tg){const{year:eg,ordinal:gg}=tg,{month:ig,day:Ig}=uncomputeOrdinal(eg,gg);return{year:eg,month:ig,day:Ig,...timeObject(tg)}}function usesLocalWeekValues(tg,eg){if(!isUndefined$1(tg.localWeekday)||!isUndefined$1(tg.localWeekNumber)||!isUndefined$1(tg.localWeekYear)){if(!isUndefined$1(tg.weekday)||!isUndefined$1(tg.weekNumber)||!isUndefined$1(tg.weekYear))throw new ConflictingSpecificationError("Cannot mix locale-based week fields with ISO-based week fields");return isUndefined$1(tg.localWeekday)||(tg.weekday=tg.localWeekday),isUndefined$1(tg.localWeekNumber)||(tg.weekNumber=tg.localWeekNumber),isUndefined$1(tg.localWeekYear)||(tg.weekYear=tg.localWeekYear),delete tg.localWeekday,delete tg.localWeekNumber,delete tg.localWeekYear,{minDaysInFirstWeek:eg.getMinDaysInFirstWeek(),startOfWeek:eg.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function hasInvalidWeekData(tg,eg=4,gg=1){const ig=isInteger(tg.weekYear),Ig=integerBetween(tg.weekNumber,1,weeksInWeekYear(tg.weekYear,eg,gg)),og=integerBetween(tg.weekday,1,7);return ig?Ig?og?!1:unitOutOfRange("weekday",tg.weekday):unitOutOfRange("week",tg.weekNumber):unitOutOfRange("weekYear",tg.weekYear)}function hasInvalidOrdinalData(tg){const eg=isInteger(tg.year),gg=integerBetween(tg.ordinal,1,daysInYear(tg.year));return eg?gg?!1:unitOutOfRange("ordinal",tg.ordinal):unitOutOfRange("year",tg.year)}function hasInvalidGregorianData(tg){const eg=isInteger(tg.year),gg=integerBetween(tg.month,1,12),ig=integerBetween(tg.day,1,daysInMonth(tg.year,tg.month));return eg?gg?ig?!1:unitOutOfRange("day",tg.day):unitOutOfRange("month",tg.month):unitOutOfRange("year",tg.year)}function hasInvalidTimeData(tg){const{hour:eg,minute:gg,second:ig,millisecond:Ig}=tg,og=integerBetween(eg,0,23)||eg===24&&gg===0&&ig===0&&Ig===0,ng=integerBetween(gg,0,59),sg=integerBetween(ig,0,59),ag=integerBetween(Ig,0,999);return og?ng?sg?ag?!1:unitOutOfRange("millisecond",Ig):unitOutOfRange("second",ig):unitOutOfRange("minute",gg):unitOutOfRange("hour",eg)}function isUndefined$1(tg){return typeof tg>"u"}function isNumber$1(tg){return typeof tg=="number"}function isInteger(tg){return typeof tg=="number"&&tg%1===0}function isString$1(tg){return typeof tg=="string"}function isDate$1(tg){return Object.prototype.toString.call(tg)==="[object Date]"}function hasRelative(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function hasLocaleWeekInfo(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function maybeArray(tg){return Array.isArray(tg)?tg:[tg]}function bestBy(tg,eg,gg){if(tg.length!==0)return tg.reduce((ig,Ig)=>{const og=[eg(Ig),Ig];return ig&&gg(ig[0],og[0])===ig[0]?ig:og},null)[1]}function pick(tg,eg){return eg.reduce((gg,ig)=>(gg[ig]=tg[ig],gg),{})}function hasOwnProperty(tg,eg){return Object.prototype.hasOwnProperty.call(tg,eg)}function validateWeekSettings(tg){if(tg==null)return null;if(typeof tg!="object")throw new InvalidArgumentError("Week settings must be an object");if(!integerBetween(tg.firstDay,1,7)||!integerBetween(tg.minimalDays,1,7)||!Array.isArray(tg.weekend)||tg.weekend.some(eg=>!integerBetween(eg,1,7)))throw new InvalidArgumentError("Invalid week settings");return{firstDay:tg.firstDay,minimalDays:tg.minimalDays,weekend:Array.from(tg.weekend)}}function integerBetween(tg,eg,gg){return isInteger(tg)&&tg>=eg&&tg<=gg}function floorMod(tg,eg){return tg-eg*Math.floor(tg/eg)}function padStart(tg,eg=2){const gg=tg<0;let ig;return gg?ig="-"+(""+-tg).padStart(eg,"0"):ig=(""+tg).padStart(eg,"0"),ig}function parseInteger(tg){if(!(isUndefined$1(tg)||tg===null||tg===""))return parseInt(tg,10)}function parseFloating(tg){if(!(isUndefined$1(tg)||tg===null||tg===""))return parseFloat(tg)}function parseMillis(tg){if(!(isUndefined$1(tg)||tg===null||tg==="")){const eg=parseFloat("0."+tg)*1e3;return Math.floor(eg)}}function roundTo(tg,eg,gg="round"){const ig=10**eg;switch(gg){case"expand":return tg>0?Math.ceil(tg*ig)/ig:Math.floor(tg*ig)/ig;case"trunc":return Math.trunc(tg*ig)/ig;case"round":return Math.round(tg*ig)/ig;case"floor":return Math.floor(tg*ig)/ig;case"ceil":return Math.ceil(tg*ig)/ig;default:throw new RangeError(`Value rounding ${gg} is out of range`)}}function isLeapYear(tg){return tg%4===0&&(tg%100!==0||tg%400===0)}function daysInYear(tg){return isLeapYear(tg)?366:365}function daysInMonth(tg,eg){const gg=floorMod(eg-1,12)+1,ig=tg+(eg-gg)/12;return gg===2?isLeapYear(ig)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][gg-1]}function objToLocalTS(tg){let eg=Date.UTC(tg.year,tg.month-1,tg.day,tg.hour,tg.minute,tg.second,tg.millisecond);return tg.year<100&&tg.year>=0&&(eg=new Date(eg),eg.setUTCFullYear(tg.year,tg.month-1,tg.day)),+eg}function firstWeekOffset(tg,eg,gg){return-isoWeekdayToLocal(dayOfWeek(tg,1,eg),gg)+eg-1}function weeksInWeekYear(tg,eg=4,gg=1){const ig=firstWeekOffset(tg,eg,gg),Ig=firstWeekOffset(tg+1,eg,gg);return(daysInYear(tg)-ig+Ig)/7}function untruncateYear(tg){return tg>99?tg:tg>Settings.twoDigitCutoffYear?1900+tg:2e3+tg}function parseZoneInfo(tg,eg,gg,ig=null){const Ig=new Date(tg),og={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};ig&&(og.timeZone=ig);const ng={timeZoneName:eg,...og},sg=new Intl.DateTimeFormat(gg,ng).formatToParts(Ig).find(ag=>ag.type.toLowerCase()==="timezonename");return sg?sg.value:null}function signedOffset(tg,eg){let gg=parseInt(tg,10);Number.isNaN(gg)&&(gg=0);const ig=parseInt(eg,10)||0,Ig=gg<0||Object.is(gg,-0)?-ig:ig;return gg*60+Ig}function asNumber(tg){const eg=Number(tg);if(typeof tg=="boolean"||tg===""||!Number.isFinite(eg))throw new InvalidArgumentError(`Invalid unit value ${tg}`);return eg}function normalizeObject(tg,eg){const gg={};for(const ig in tg)if(hasOwnProperty(tg,ig)){const Ig=tg[ig];if(Ig==null)continue;gg[eg(ig)]=asNumber(Ig)}return gg}function formatOffset(tg,eg){const gg=Math.trunc(Math.abs(tg/60)),ig=Math.trunc(Math.abs(tg%60)),Ig=tg>=0?"+":"-";switch(eg){case"short":return`${Ig}${padStart(gg,2)}:${padStart(ig,2)}`;case"narrow":return`${Ig}${gg}${ig>0?`:${ig}`:""}`;case"techie":return`${Ig}${padStart(gg,2)}${padStart(ig,2)}`;default:throw new RangeError(`Value format ${eg} is out of range for property format`)}}function timeObject(tg){return pick(tg,["hour","minute","second","millisecond"])}const monthsLong=["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],monthsNarrow=["J","F","M","A","M","J","J","A","S","O","N","D"];function months(tg){switch(tg){case"narrow":return[...monthsNarrow];case"short":return[...monthsShort];case"long":return[...monthsLong];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const weekdaysLong=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],weekdaysShort=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],weekdaysNarrow=["M","T","W","T","F","S","S"];function weekdays(tg){switch(tg){case"narrow":return[...weekdaysNarrow];case"short":return[...weekdaysShort];case"long":return[...weekdaysLong];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const meridiems=["AM","PM"],erasLong=["Before Christ","Anno Domini"],erasShort=["BC","AD"],erasNarrow=["B","A"];function eras(tg){switch(tg){case"narrow":return[...erasNarrow];case"short":return[...erasShort];case"long":return[...erasLong];default:return null}}function meridiemForDateTime(tg){return meridiems[tg.hour<12?0:1]}function weekdayForDateTime(tg,eg){return weekdays(eg)[tg.weekday-1]}function monthForDateTime(tg,eg){return months(eg)[tg.month-1]}function eraForDateTime(tg,eg){return eras(eg)[tg.year<0?0:1]}function formatRelativeTime(tg,eg,gg="always",ig=!1){const Ig={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},og=["hours","minutes","seconds"].indexOf(tg)===-1;if(gg==="auto"&&og){const Ag=tg==="days";switch(eg){case 1:return Ag?"tomorrow":`next ${Ig[tg][0]}`;case-1:return Ag?"yesterday":`last ${Ig[tg][0]}`;case 0:return Ag?"today":`this ${Ig[tg][0]}`}}const ng=Object.is(eg,-0)||eg<0,sg=Math.abs(eg),ag=sg===1,Cg=Ig[tg],lg=ig?ag?Cg[1]:Cg[2]||Cg[1]:ag?Ig[tg][0]:tg;return ng?`${sg} ${lg} ago`:`in ${sg} ${lg}`}function stringifyTokens(tg,eg){let gg="";for(const ig of tg)ig.literal?gg+=ig.val:gg+=eg(ig.val);return gg}const macroTokenToFormatOpts={D:DATE_SHORT,DD:DATE_MED,DDD:DATE_FULL,DDDD:DATE_HUGE,t:TIME_SIMPLE,tt:TIME_WITH_SECONDS,ttt:TIME_WITH_SHORT_OFFSET,tttt:TIME_WITH_LONG_OFFSET,T:TIME_24_SIMPLE,TT:TIME_24_WITH_SECONDS,TTT:TIME_24_WITH_SHORT_OFFSET,TTTT:TIME_24_WITH_LONG_OFFSET,f:DATETIME_SHORT,ff:DATETIME_MED,fff:DATETIME_FULL,ffff:DATETIME_HUGE,F:DATETIME_SHORT_WITH_SECONDS,FF:DATETIME_MED_WITH_SECONDS,FFF:DATETIME_FULL_WITH_SECONDS,FFFF:DATETIME_HUGE_WITH_SECONDS};class Formatter{static create(eg,gg={}){return new Formatter(eg,gg)}static parseFormat(eg){let gg=null,ig="",Ig=!1;const og=[];for(let ng=0;ng<eg.length;ng++){const sg=eg.charAt(ng);sg==="'"?((ig.length>0||Ig)&&og.push({literal:Ig||/^\s+$/.test(ig),val:ig===""?"'":ig}),gg=null,ig="",Ig=!Ig):Ig||sg===gg?ig+=sg:(ig.length>0&&og.push({literal:/^\s+$/.test(ig),val:ig}),ig=sg,gg=sg)}return ig.length>0&&og.push({literal:Ig||/^\s+$/.test(ig),val:ig}),og}static macroTokenToFormatOpts(eg){return macroTokenToFormatOpts[eg]}constructor(eg,gg){this.opts=gg,this.loc=eg,this.systemLoc=null}formatWithSystemDefault(eg,gg){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(eg,{...this.opts,...gg}).format()}dtFormatter(eg,gg={}){return this.loc.dtFormatter(eg,{...this.opts,...gg})}formatDateTime(eg,gg){return this.dtFormatter(eg,gg).format()}formatDateTimeParts(eg,gg){return this.dtFormatter(eg,gg).formatToParts()}formatInterval(eg,gg){return this.dtFormatter(eg.start,gg).dtf.formatRange(eg.start.toJSDate(),eg.end.toJSDate())}resolvedOptions(eg,gg){return this.dtFormatter(eg,gg).resolvedOptions()}num(eg,gg=0,ig=void 0){if(this.opts.forceSimple)return padStart(eg,gg);const Ig={...this.opts};return gg>0&&(Ig.padTo=gg),ig&&(Ig.signDisplay=ig),this.loc.numberFormatter(Ig).format(eg)}formatDateTimeFromString(eg,gg){const ig=this.loc.listingMode()==="en",Ig=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",og=(rg,ug)=>this.loc.extract(eg,rg,ug),ng=rg=>eg.isOffsetFixed&&eg.offset===0&&rg.allowZ?"Z":eg.isValid?eg.zone.formatOffset(eg.ts,rg.format):"",sg=()=>ig?meridiemForDateTime(eg):og({hour:"numeric",hourCycle:"h12"},"dayperiod"),ag=(rg,ug)=>ig?monthForDateTime(eg,rg):og(ug?{month:rg}:{month:rg,day:"numeric"},"month"),Cg=(rg,ug)=>ig?weekdayForDateTime(eg,rg):og(ug?{weekday:rg}:{weekday:rg,month:"long",day:"numeric"},"weekday"),lg=rg=>{const ug=Formatter.macroTokenToFormatOpts(rg);return ug?this.formatWithSystemDefault(eg,ug):rg},Ag=rg=>ig?eraForDateTime(eg,rg):og({era:rg},"era"),cg=rg=>{switch(rg){case"S":return this.num(eg.millisecond);case"u":case"SSS":return this.num(eg.millisecond,3);case"s":return this.num(eg.second);case"ss":return this.num(eg.second,2);case"uu":return this.num(Math.floor(eg.millisecond/10),2);case"uuu":return this.num(Math.floor(eg.millisecond/100));case"m":return this.num(eg.minute);case"mm":return this.num(eg.minute,2);case"h":return this.num(eg.hour%12===0?12:eg.hour%12);case"hh":return this.num(eg.hour%12===0?12:eg.hour%12,2);case"H":return this.num(eg.hour);case"HH":return this.num(eg.hour,2);case"Z":return ng({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return ng({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return ng({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return eg.zone.offsetName(eg.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return eg.zone.offsetName(eg.ts,{format:"long",locale:this.loc.locale});case"z":return eg.zoneName;case"a":return sg();case"d":return Ig?og({day:"numeric"},"day"):this.num(eg.day);case"dd":return Ig?og({day:"2-digit"},"day"):this.num(eg.day,2);case"c":return this.num(eg.weekday);case"ccc":return Cg("short",!0);case"cccc":return Cg("long",!0);case"ccccc":return Cg("narrow",!0);case"E":return this.num(eg.weekday);case"EEE":return Cg("short",!1);case"EEEE":return Cg("long",!1);case"EEEEE":return Cg("narrow",!1);case"L":return Ig?og({month:"numeric",day:"numeric"},"month"):this.num(eg.month);case"LL":return Ig?og({month:"2-digit",day:"numeric"},"month"):this.num(eg.month,2);case"LLL":return ag("short",!0);case"LLLL":return ag("long",!0);case"LLLLL":return ag("narrow",!0);case"M":return Ig?og({month:"numeric"},"month"):this.num(eg.month);case"MM":return Ig?og({month:"2-digit"},"month"):this.num(eg.month,2);case"MMM":return ag("short",!1);case"MMMM":return ag("long",!1);case"MMMMM":return ag("narrow",!1);case"y":return Ig?og({year:"numeric"},"year"):this.num(eg.year);case"yy":return Ig?og({year:"2-digit"},"year"):this.num(eg.year.toString().slice(-2),2);case"yyyy":return Ig?og({year:"numeric"},"year"):this.num(eg.year,4);case"yyyyyy":return Ig?og({year:"numeric"},"year"):this.num(eg.year,6);case"G":return Ag("short");case"GG":return Ag("long");case"GGGGG":return Ag("narrow");case"kk":return this.num(eg.weekYear.toString().slice(-2),2);case"kkkk":return this.num(eg.weekYear,4);case"W":return this.num(eg.weekNumber);case"WW":return this.num(eg.weekNumber,2);case"n":return this.num(eg.localWeekNumber);case"nn":return this.num(eg.localWeekNumber,2);case"ii":return this.num(eg.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(eg.localWeekYear,4);case"o":return this.num(eg.ordinal);case"ooo":return this.num(eg.ordinal,3);case"q":return this.num(eg.quarter);case"qq":return this.num(eg.quarter,2);case"X":return this.num(Math.floor(eg.ts/1e3));case"x":return this.num(eg.ts);default:return lg(rg)}};return stringifyTokens(Formatter.parseFormat(gg),cg)}formatDurationFromString(eg,gg){const ig=this.opts.signMode==="negativeLargestOnly"?-1:1,Ig=lg=>{switch(lg[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},og=(lg,Ag)=>cg=>{const rg=Ig(cg);if(rg){const ug=Ag.isNegativeDuration&&rg!==Ag.largestUnit?ig:1;let dg;return this.opts.signMode==="negativeLargestOnly"&&rg!==Ag.largestUnit?dg="never":this.opts.signMode==="all"?dg="always":dg="auto",this.num(lg.get(rg)*ug,cg.length,dg)}else return cg},ng=Formatter.parseFormat(gg),sg=ng.reduce((lg,{literal:Ag,val:cg})=>Ag?lg:lg.concat(cg),[]),ag=eg.shiftTo(...sg.map(Ig).filter(lg=>lg)),Cg={isNegativeDuration:ag<0,largestUnit:Object.keys(ag.values)[0]};return stringifyTokens(ng,og(ag,Cg))}}const ianaRegex=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function combineRegexes(...tg){const eg=tg.reduce((gg,ig)=>gg+ig.source,"");return RegExp(`^${eg}$`)}function combineExtractors(...tg){return eg=>tg.reduce(([gg,ig,Ig],og)=>{const[ng,sg,ag]=og(eg,Ig);return[{...gg,...ng},sg||ig,ag]},[{},null,1]).slice(0,2)}function parse(tg,...eg){if(tg==null)return[null,null];for(const[gg,ig]of eg){const Ig=gg.exec(tg);if(Ig)return ig(Ig)}return[null,null]}function simpleParse(...tg){return(eg,gg)=>{const ig={};let Ig;for(Ig=0;Ig<tg.length;Ig++)ig[tg[Ig]]=parseInteger(eg[gg+Ig]);return[ig,null,gg+Ig]}}const offsetRegex=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,isoExtendedZone=`(?:${offsetRegex.source}?(?:\\[(${ianaRegex.source})\\])?)?`,isoTimeBaseRegex=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,isoTimeRegex=RegExp(`${isoTimeBaseRegex.source}${isoExtendedZone}`),isoTimeExtensionRegex=RegExp(`(?:[Tt]${isoTimeRegex.source})?`),isoYmdRegex=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,isoWeekRegex=/(\d{4})-?W(\d\d)(?:-?(\d))?/,isoOrdinalRegex=/(\d{4})-?(\d{3})/,extractISOWeekData=simpleParse("weekYear","weekNumber","weekDay"),extractISOOrdinalData=simpleParse("year","ordinal"),sqlYmdRegex=/(\d{4})-(\d\d)-(\d\d)/,sqlTimeRegex=RegExp(`${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?`),sqlTimeExtensionRegex=RegExp(`(?: ${sqlTimeRegex.source})?`);function int(tg,eg,gg){const ig=tg[eg];return isUndefined$1(ig)?gg:parseInteger(ig)}function extractISOYmd(tg,eg){return[{year:int(tg,eg),month:int(tg,eg+1,1),day:int(tg,eg+2,1)},null,eg+3]}function extractISOTime(tg,eg){return[{hours:int(tg,eg,0),minutes:int(tg,eg+1,0),seconds:int(tg,eg+2,0),milliseconds:parseMillis(tg[eg+3])},null,eg+4]}function extractISOOffset(tg,eg){const gg=!tg[eg]&&!tg[eg+1],ig=signedOffset(tg[eg+1],tg[eg+2]),Ig=gg?null:FixedOffsetZone.instance(ig);return[{},Ig,eg+3]}function extractIANAZone(tg,eg){const gg=tg[eg]?IANAZone.create(tg[eg]):null;return[{},gg,eg+1]}const isoTimeOnly=RegExp(`^T?${isoTimeBaseRegex.source}$`),isoDuration=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function extractISODuration(tg){const[eg,gg,ig,Ig,og,ng,sg,ag,Cg]=tg,lg=eg[0]==="-",Ag=ag&&ag[0]==="-",cg=(rg,ug=!1)=>rg!==void 0&&(ug||rg&&lg)?-rg:rg;return[{years:cg(parseFloating(gg)),months:cg(parseFloating(ig)),weeks:cg(parseFloating(Ig)),days:cg(parseFloating(og)),hours:cg(parseFloating(ng)),minutes:cg(parseFloating(sg)),seconds:cg(parseFloating(ag),ag==="-0"),milliseconds:cg(parseMillis(Cg),Ag)}]}const obsOffsets={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function fromStrings(tg,eg,gg,ig,Ig,og,ng){const sg={year:eg.length===2?untruncateYear(parseInteger(eg)):parseInteger(eg),month:monthsShort.indexOf(gg)+1,day:parseInteger(ig),hour:parseInteger(Ig),minute:parseInteger(og)};return ng&&(sg.second=parseInteger(ng)),tg&&(sg.weekday=tg.length>3?weekdaysLong.indexOf(tg)+1:weekdaysShort.indexOf(tg)+1),sg}const rfc2822=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function extractRFC2822(tg){const[,eg,gg,ig,Ig,og,ng,sg,ag,Cg,lg,Ag]=tg,cg=fromStrings(eg,Ig,ig,gg,og,ng,sg);let rg;return ag?rg=obsOffsets[ag]:Cg?rg=0:rg=signedOffset(lg,Ag),[cg,new FixedOffsetZone(rg)]}function preprocessRFC2822(tg){return tg.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const rfc1123=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,rfc850=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,ascii=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function extractRFC1123Or850(tg){const[,eg,gg,ig,Ig,og,ng,sg]=tg;return[fromStrings(eg,Ig,ig,gg,og,ng,sg),FixedOffsetZone.utcInstance]}function extractASCII(tg){const[,eg,gg,ig,Ig,og,ng,sg]=tg;return[fromStrings(eg,sg,gg,ig,Ig,og,ng),FixedOffsetZone.utcInstance]}const isoYmdWithTimeExtensionRegex=combineRegexes(isoYmdRegex,isoTimeExtensionRegex),isoWeekWithTimeExtensionRegex=combineRegexes(isoWeekRegex,isoTimeExtensionRegex),isoOrdinalWithTimeExtensionRegex=combineRegexes(isoOrdinalRegex,isoTimeExtensionRegex),isoTimeCombinedRegex=combineRegexes(isoTimeRegex),extractISOYmdTimeAndOffset=combineExtractors(extractISOYmd,extractISOTime,extractISOOffset,extractIANAZone),extractISOWeekTimeAndOffset=combineExtractors(extractISOWeekData,extractISOTime,extractISOOffset,extractIANAZone),extractISOOrdinalDateAndTime=combineExtractors(extractISOOrdinalData,extractISOTime,extractISOOffset,extractIANAZone),extractISOTimeAndOffset=combineExtractors(extractISOTime,extractISOOffset,extractIANAZone);function parseISODate(tg){return parse(tg,[isoYmdWithTimeExtensionRegex,extractISOYmdTimeAndOffset],[isoWeekWithTimeExtensionRegex,extractISOWeekTimeAndOffset],[isoOrdinalWithTimeExtensionRegex,extractISOOrdinalDateAndTime],[isoTimeCombinedRegex,extractISOTimeAndOffset])}function parseRFC2822Date(tg){return parse(preprocessRFC2822(tg),[rfc2822,extractRFC2822])}function parseHTTPDate(tg){return parse(tg,[rfc1123,extractRFC1123Or850],[rfc850,extractRFC1123Or850],[ascii,extractASCII])}function parseISODuration(tg){return parse(tg,[isoDuration,extractISODuration])}const extractISOTimeOnly=combineExtractors(extractISOTime);function parseISOTimeOnly(tg){return parse(tg,[isoTimeOnly,extractISOTimeOnly])}const sqlYmdWithTimeExtensionRegex=combineRegexes(sqlYmdRegex,sqlTimeExtensionRegex),sqlTimeCombinedRegex=combineRegexes(sqlTimeRegex),extractISOTimeOffsetAndIANAZone=combineExtractors(extractISOTime,extractISOOffset,extractIANAZone);function parseSQL(tg){return parse(tg,[sqlYmdWithTimeExtensionRegex,extractISOYmdTimeAndOffset],[sqlTimeCombinedRegex,extractISOTimeOffsetAndIANAZone])}const INVALID$2="Invalid Duration",lowOrderMatrix={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},casualMatrix={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...lowOrderMatrix},daysInYearAccurate=146097/400,daysInMonthAccurate=146097/4800,accurateMatrix={years:{quarters:4,months:12,weeks:daysInYearAccurate/7,days:daysInYearAccurate,hours:daysInYearAccurate*24,minutes:daysInYearAccurate*24*60,seconds:daysInYearAccurate*24*60*60,milliseconds:daysInYearAccurate*24*60*60*1e3},quarters:{months:3,weeks:daysInYearAccurate/28,days:daysInYearAccurate/4,hours:daysInYearAccurate*24/4,minutes:daysInYearAccurate*24*60/4,seconds:daysInYearAccurate*24*60*60/4,milliseconds:daysInYearAccurate*24*60*60*1e3/4},months:{weeks:daysInMonthAccurate/7,days:daysInMonthAccurate,hours:daysInMonthAccurate*24,minutes:daysInMonthAccurate*24*60,seconds:daysInMonthAccurate*24*60*60,milliseconds:daysInMonthAccurate*24*60*60*1e3},...lowOrderMatrix},orderedUnits$1=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],reverseUnits=orderedUnits$1.slice(0).reverse();function clone$1(tg,eg,gg=!1){const ig={values:gg?eg.values:{...tg.values,...eg.values||{}},loc:tg.loc.clone(eg.loc),conversionAccuracy:eg.conversionAccuracy||tg.conversionAccuracy,matrix:eg.matrix||tg.matrix};return new Duration(ig)}function durationToMillis(tg,eg){let gg=eg.milliseconds??0;for(const ig of reverseUnits.slice(1))eg[ig]&&(gg+=eg[ig]*tg[ig].milliseconds);return gg}function normalizeValues(tg,eg){const gg=durationToMillis(tg,eg)<0?-1:1;orderedUnits$1.reduceRight((ig,Ig)=>{if(isUndefined$1(eg[Ig]))return ig;if(ig){const og=eg[ig]*gg,ng=tg[Ig][ig],sg=Math.floor(og/ng);eg[Ig]+=sg*gg,eg[ig]-=sg*ng*gg}return Ig},null),orderedUnits$1.reduce((ig,Ig)=>{if(isUndefined$1(eg[Ig]))return ig;if(ig){const og=eg[ig]%1;eg[ig]-=og,eg[Ig]+=og*tg[ig][Ig]}return Ig},null)}function removeZeroes(tg){const eg={};for(const[gg,ig]of Object.entries(tg))ig!==0&&(eg[gg]=ig);return eg}class Duration{constructor(eg){const gg=eg.conversionAccuracy==="longterm"||!1;let ig=gg?accurateMatrix:casualMatrix;eg.matrix&&(ig=eg.matrix),this.values=eg.values,this.loc=eg.loc||Locale.create(),this.conversionAccuracy=gg?"longterm":"casual",this.invalid=eg.invalid||null,this.matrix=ig,this.isLuxonDuration=!0}static fromMillis(eg,gg){return Duration.fromObject({milliseconds:eg},gg)}static fromObject(eg,gg={}){if(eg==null||typeof eg!="object")throw new InvalidArgumentError(`Duration.fromObject: argument expected to be an object, got ${eg===null?"null":typeof eg}`);return new Duration({values:normalizeObject(eg,Duration.normalizeUnit),loc:Locale.fromObject(gg),conversionAccuracy:gg.conversionAccuracy,matrix:gg.matrix})}static fromDurationLike(eg){if(isNumber$1(eg))return Duration.fromMillis(eg);if(Duration.isDuration(eg))return eg;if(typeof eg=="object")return Duration.fromObject(eg);throw new InvalidArgumentError(`Unknown duration argument ${eg} of type ${typeof eg}`)}static fromISO(eg,gg){const[ig]=parseISODuration(eg);return ig?Duration.fromObject(ig,gg):Duration.invalid("unparsable",`the input "${eg}" can't be parsed as ISO 8601`)}static fromISOTime(eg,gg){const[ig]=parseISOTimeOnly(eg);return ig?Duration.fromObject(ig,gg):Duration.invalid("unparsable",`the input "${eg}" can't be parsed as ISO 8601`)}static invalid(eg,gg=null){if(!eg)throw new InvalidArgumentError("need to specify a reason the Duration is invalid");const ig=eg instanceof Invalid?eg:new Invalid(eg,gg);if(Settings.throwOnInvalid)throw new InvalidDurationError(ig);return new Duration({invalid:ig})}static normalizeUnit(eg){const gg={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[eg&&eg.toLowerCase()];if(!gg)throw new InvalidUnitError(eg);return gg}static isDuration(eg){return eg&&eg.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(eg,gg={}){const ig={...gg,floor:gg.round!==!1&&gg.floor!==!1};return this.isValid?Formatter.create(this.loc,ig).formatDurationFromString(this,eg):INVALID$2}toHuman(eg={}){if(!this.isValid)return INVALID$2;const gg=eg.showZeros!==!1,ig=orderedUnits$1.map(Ig=>{const og=this.values[Ig];return isUndefined$1(og)||og===0&&!gg?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...eg,unit:Ig.slice(0,-1)}).format(og)}).filter(Ig=>Ig);return this.loc.listFormatter({type:"conjunction",style:eg.listStyle||"narrow",...eg}).format(ig)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let eg="P";return this.years!==0&&(eg+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(eg+=this.months+this.quarters*3+"M"),this.weeks!==0&&(eg+=this.weeks+"W"),this.days!==0&&(eg+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(eg+="T"),this.hours!==0&&(eg+=this.hours+"H"),this.minutes!==0&&(eg+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(eg+=roundTo(this.seconds+this.milliseconds/1e3,3)+"S"),eg==="P"&&(eg+="T0S"),eg}toISOTime(eg={}){if(!this.isValid)return null;const gg=this.toMillis();return gg<0||gg>=864e5?null:(eg={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...eg,includeOffset:!1},DateTime.fromMillis(gg,{zone:"UTC"}).toISOTime(eg))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?durationToMillis(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(eg){if(!this.isValid)return this;const gg=Duration.fromDurationLike(eg),ig={};for(const Ig of orderedUnits$1)(hasOwnProperty(gg.values,Ig)||hasOwnProperty(this.values,Ig))&&(ig[Ig]=gg.get(Ig)+this.get(Ig));return clone$1(this,{values:ig},!0)}minus(eg){if(!this.isValid)return this;const gg=Duration.fromDurationLike(eg);return this.plus(gg.negate())}mapUnits(eg){if(!this.isValid)return this;const gg={};for(const ig of Object.keys(this.values))gg[ig]=asNumber(eg(this.values[ig],ig));return clone$1(this,{values:gg},!0)}get(eg){return this[Duration.normalizeUnit(eg)]}set(eg){if(!this.isValid)return this;const gg={...this.values,...normalizeObject(eg,Duration.normalizeUnit)};return clone$1(this,{values:gg})}reconfigure({locale:eg,numberingSystem:gg,conversionAccuracy:ig,matrix:Ig}={}){const ng={loc:this.loc.clone({locale:eg,numberingSystem:gg}),matrix:Ig,conversionAccuracy:ig};return clone$1(this,ng)}as(eg){return this.isValid?this.shiftTo(eg).get(eg):NaN}normalize(){if(!this.isValid)return this;const eg=this.toObject();return normalizeValues(this.matrix,eg),clone$1(this,{values:eg},!0)}rescale(){if(!this.isValid)return this;const eg=removeZeroes(this.normalize().shiftToAll().toObject());return clone$1(this,{values:eg},!0)}shiftTo(...eg){if(!this.isValid)return this;if(eg.length===0)return this;eg=eg.map(ng=>Duration.normalizeUnit(ng));const gg={},ig={},Ig=this.toObject();let og;for(const ng of orderedUnits$1)if(eg.indexOf(ng)>=0){og=ng;let sg=0;for(const Cg in ig)sg+=this.matrix[Cg][ng]*ig[Cg],ig[Cg]=0;isNumber$1(Ig[ng])&&(sg+=Ig[ng]);const ag=Math.trunc(sg);gg[ng]=ag,ig[ng]=(sg*1e3-ag*1e3)/1e3}else isNumber$1(Ig[ng])&&(ig[ng]=Ig[ng]);for(const ng in ig)ig[ng]!==0&&(gg[og]+=ng===og?ig[ng]:ig[ng]/this.matrix[og][ng]);return normalizeValues(this.matrix,gg),clone$1(this,{values:gg},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const eg={};for(const gg of Object.keys(this.values))eg[gg]=this.values[gg]===0?0:-this.values[gg];return clone$1(this,{values:eg},!0)}removeZeros(){if(!this.isValid)return this;const eg=removeZeroes(this.values);return clone$1(this,{values:eg},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(eg){if(!this.isValid||!eg.isValid||!this.loc.equals(eg.loc))return!1;function gg(ig,Ig){return ig===void 0||ig===0?Ig===void 0||Ig===0:ig===Ig}for(const ig of orderedUnits$1)if(!gg(this.values[ig],eg.values[ig]))return!1;return!0}}const INVALID$1="Invalid Interval";function validateStartEnd(tg,eg){return!tg||!tg.isValid?Interval.invalid("missing or invalid start"):!eg||!eg.isValid?Interval.invalid("missing or invalid end"):eg<tg?Interval.invalid("end before start",`The end of an interval must be after its start, but you had start=${tg.toISO()} and end=${eg.toISO()}`):null}class Interval{constructor(eg){this.s=eg.start,this.e=eg.end,this.invalid=eg.invalid||null,this.isLuxonInterval=!0}static invalid(eg,gg=null){if(!eg)throw new InvalidArgumentError("need to specify a reason the Interval is invalid");const ig=eg instanceof Invalid?eg:new Invalid(eg,gg);if(Settings.throwOnInvalid)throw new InvalidIntervalError(ig);return new Interval({invalid:ig})}static fromDateTimes(eg,gg){const ig=friendlyDateTime(eg),Ig=friendlyDateTime(gg),og=validateStartEnd(ig,Ig);return og??new Interval({start:ig,end:Ig})}static after(eg,gg){const ig=Duration.fromDurationLike(gg),Ig=friendlyDateTime(eg);return Interval.fromDateTimes(Ig,Ig.plus(ig))}static before(eg,gg){const ig=Duration.fromDurationLike(gg),Ig=friendlyDateTime(eg);return Interval.fromDateTimes(Ig.minus(ig),Ig)}static fromISO(eg,gg){const[ig,Ig]=(eg||"").split("/",2);if(ig&&Ig){let og,ng;try{og=DateTime.fromISO(ig,gg),ng=og.isValid}catch{ng=!1}let sg,ag;try{sg=DateTime.fromISO(Ig,gg),ag=sg.isValid}catch{ag=!1}if(ng&&ag)return Interval.fromDateTimes(og,sg);if(ng){const Cg=Duration.fromISO(Ig,gg);if(Cg.isValid)return Interval.after(og,Cg)}else if(ag){const Cg=Duration.fromISO(ig,gg);if(Cg.isValid)return Interval.before(sg,Cg)}}return Interval.invalid("unparsable",`the input "${eg}" can't be parsed as ISO 8601`)}static isInterval(eg){return eg&&eg.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(eg="milliseconds"){return this.isValid?this.toDuration(eg).get(eg):NaN}count(eg="milliseconds",gg){if(!this.isValid)return NaN;const ig=this.start.startOf(eg,gg);let Ig;return gg!=null&&gg.useLocaleWeeks?Ig=this.end.reconfigure({locale:ig.locale}):Ig=this.end,Ig=Ig.startOf(eg,gg),Math.floor(Ig.diff(ig,eg).get(eg))+(Ig.valueOf()!==this.end.valueOf())}hasSame(eg){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,eg):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(eg){return this.isValid?this.s>eg:!1}isBefore(eg){return this.isValid?this.e<=eg:!1}contains(eg){return this.isValid?this.s<=eg&&this.e>eg:!1}set({start:eg,end:gg}={}){return this.isValid?Interval.fromDateTimes(eg||this.s,gg||this.e):this}splitAt(...eg){if(!this.isValid)return[];const gg=eg.map(friendlyDateTime).filter(ng=>this.contains(ng)).sort((ng,sg)=>ng.toMillis()-sg.toMillis()),ig=[];let{s:Ig}=this,og=0;for(;Ig<this.e;){const ng=gg[og]||this.e,sg=+ng>+this.e?this.e:ng;ig.push(Interval.fromDateTimes(Ig,sg)),Ig=sg,og+=1}return ig}splitBy(eg){const gg=Duration.fromDurationLike(eg);if(!this.isValid||!gg.isValid||gg.as("milliseconds")===0)return[];let{s:ig}=this,Ig=1,og;const ng=[];for(;ig<this.e;){const sg=this.start.plus(gg.mapUnits(ag=>ag*Ig));og=+sg>+this.e?this.e:sg,ng.push(Interval.fromDateTimes(ig,og)),ig=og,Ig+=1}return ng}divideEqually(eg){return this.isValid?this.splitBy(this.length()/eg).slice(0,eg):[]}overlaps(eg){return this.e>eg.s&&this.s<eg.e}abutsStart(eg){return this.isValid?+this.e==+eg.s:!1}abutsEnd(eg){return this.isValid?+eg.e==+this.s:!1}engulfs(eg){return this.isValid?this.s<=eg.s&&this.e>=eg.e:!1}equals(eg){return!this.isValid||!eg.isValid?!1:this.s.equals(eg.s)&&this.e.equals(eg.e)}intersection(eg){if(!this.isValid)return this;const gg=this.s>eg.s?this.s:eg.s,ig=this.e<eg.e?this.e:eg.e;return gg>=ig?null:Interval.fromDateTimes(gg,ig)}union(eg){if(!this.isValid)return this;const gg=this.s<eg.s?this.s:eg.s,ig=this.e>eg.e?this.e:eg.e;return Interval.fromDateTimes(gg,ig)}static merge(eg){const[gg,ig]=eg.sort((Ig,og)=>Ig.s-og.s).reduce(([Ig,og],ng)=>og?og.overlaps(ng)||og.abutsStart(ng)?[Ig,og.union(ng)]:[Ig.concat([og]),ng]:[Ig,ng],[[],null]);return ig&&gg.push(ig),gg}static xor(eg){let gg=null,ig=0;const Ig=[],og=eg.map(ag=>[{time:ag.s,type:"s"},{time:ag.e,type:"e"}]),ng=Array.prototype.concat(...og),sg=ng.sort((ag,Cg)=>ag.time-Cg.time);for(const ag of sg)ig+=ag.type==="s"?1:-1,ig===1?gg=ag.time:(gg&&+gg!=+ag.time&&Ig.push(Interval.fromDateTimes(gg,ag.time)),gg=null);return Interval.merge(Ig)}difference(...eg){return Interval.xor([this].concat(eg)).map(gg=>this.intersection(gg)).filter(gg=>gg&&!gg.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:INVALID$1}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(eg=DATE_SHORT,gg={}){return this.isValid?Formatter.create(this.s.loc.clone(gg),eg).formatInterval(this):INVALID$1}toISO(eg){return this.isValid?`${this.s.toISO(eg)}/${this.e.toISO(eg)}`:INVALID$1}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:INVALID$1}toISOTime(eg){return this.isValid?`${this.s.toISOTime(eg)}/${this.e.toISOTime(eg)}`:INVALID$1}toFormat(eg,{separator:gg=" – "}={}){return this.isValid?`${this.s.toFormat(eg)}${gg}${this.e.toFormat(eg)}`:INVALID$1}toDuration(eg,gg){return this.isValid?this.e.diff(this.s,eg,gg):Duration.invalid(this.invalidReason)}mapEndpoints(eg){return Interval.fromDateTimes(eg(this.s),eg(this.e))}}class Info{static hasDST(eg=Settings.defaultZone){const gg=DateTime.now().setZone(eg).set({month:12});return!eg.isUniversal&&gg.offset!==gg.set({month:6}).offset}static isValidIANAZone(eg){return IANAZone.isValidZone(eg)}static normalizeZone(eg){return normalizeZone(eg,Settings.defaultZone)}static getStartOfWeek({locale:eg=null,locObj:gg=null}={}){return(gg||Locale.create(eg)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:eg=null,locObj:gg=null}={}){return(gg||Locale.create(eg)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:eg=null,locObj:gg=null}={}){return(gg||Locale.create(eg)).getWeekendDays().slice()}static months(eg="long",{locale:gg=null,numberingSystem:ig=null,locObj:Ig=null,outputCalendar:og="gregory"}={}){return(Ig||Locale.create(gg,ig,og)).months(eg)}static monthsFormat(eg="long",{locale:gg=null,numberingSystem:ig=null,locObj:Ig=null,outputCalendar:og="gregory"}={}){return(Ig||Locale.create(gg,ig,og)).months(eg,!0)}static weekdays(eg="long",{locale:gg=null,numberingSystem:ig=null,locObj:Ig=null}={}){return(Ig||Locale.create(gg,ig,null)).weekdays(eg)}static weekdaysFormat(eg="long",{locale:gg=null,numberingSystem:ig=null,locObj:Ig=null}={}){return(Ig||Locale.create(gg,ig,null)).weekdays(eg,!0)}static meridiems({locale:eg=null}={}){return Locale.create(eg).meridiems()}static eras(eg="short",{locale:gg=null}={}){return Locale.create(gg,null,"gregory").eras(eg)}static features(){return{relative:hasRelative(),localeWeek:hasLocaleWeekInfo()}}}function dayDiff(tg,eg){const gg=Ig=>Ig.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),ig=gg(eg)-gg(tg);return Math.floor(Duration.fromMillis(ig).as("days"))}function highOrderDiffs(tg,eg,gg){const ig=[["years",(ag,Cg)=>Cg.year-ag.year],["quarters",(ag,Cg)=>Cg.quarter-ag.quarter+(Cg.year-ag.year)*4],["months",(ag,Cg)=>Cg.month-ag.month+(Cg.year-ag.year)*12],["weeks",(ag,Cg)=>{const lg=dayDiff(ag,Cg);return(lg-lg%7)/7}],["days",dayDiff]],Ig={},og=tg;let ng,sg;for(const[ag,Cg]of ig)gg.indexOf(ag)>=0&&(ng=ag,Ig[ag]=Cg(tg,eg),sg=og.plus(Ig),sg>eg?(Ig[ag]--,tg=og.plus(Ig),tg>eg&&(sg=tg,Ig[ag]--,tg=og.plus(Ig))):tg=sg);return[tg,Ig,sg,ng]}function diff(tg,eg,gg,ig){let[Ig,og,ng,sg]=highOrderDiffs(tg,eg,gg);const ag=eg-Ig,Cg=gg.filter(Ag=>["hours","minutes","seconds","milliseconds"].indexOf(Ag)>=0);Cg.length===0&&(ng<eg&&(ng=Ig.plus({[sg]:1})),ng!==Ig&&(og[sg]=(og[sg]||0)+ag/(ng-Ig)));const lg=Duration.fromObject(og,ig);return Cg.length>0?Duration.fromMillis(ag,ig).shiftTo(...Cg).plus(lg):lg}const MISSING_FTP="missing Intl.DateTimeFormat.formatToParts support";function intUnit(tg,eg=gg=>gg){return{regex:tg,deser:([gg])=>eg(parseDigits(gg))}}const NBSP=" ",spaceOrNBSP=`[ ${NBSP}]`,spaceOrNBSPRegExp=new RegExp(spaceOrNBSP,"g");function fixListRegex(tg){return tg.replace(/\./g,"\\.?").replace(spaceOrNBSPRegExp,spaceOrNBSP)}function stripInsensitivities(tg){return tg.replace(/\./g,"").replace(spaceOrNBSPRegExp," ").toLowerCase()}function oneOf(tg,eg){return tg===null?null:{regex:RegExp(tg.map(fixListRegex).join("|")),deser:([gg])=>tg.findIndex(ig=>stripInsensitivities(gg)===stripInsensitivities(ig))+eg}}function offset(tg,eg){return{regex:tg,deser:([,gg,ig])=>signedOffset(gg,ig),groups:eg}}function simple(tg){return{regex:tg,deser:([eg])=>eg}}function escapeToken(tg){return tg.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function unitForToken(tg,eg){const gg=digitRegex(eg),ig=digitRegex(eg,"{2}"),Ig=digitRegex(eg,"{3}"),og=digitRegex(eg,"{4}"),ng=digitRegex(eg,"{6}"),sg=digitRegex(eg,"{1,2}"),ag=digitRegex(eg,"{1,3}"),Cg=digitRegex(eg,"{1,6}"),lg=digitRegex(eg,"{1,9}"),Ag=digitRegex(eg,"{2,4}"),cg=digitRegex(eg,"{4,6}"),rg=mg=>({regex:RegExp(escapeToken(mg.val)),deser:([bg])=>bg,literal:!0}),dg=(mg=>{if(tg.literal)return rg(mg);switch(mg.val){case"G":return oneOf(eg.eras("short"),0);case"GG":return oneOf(eg.eras("long"),0);case"y":return intUnit(Cg);case"yy":return intUnit(Ag,untruncateYear);case"yyyy":return intUnit(og);case"yyyyy":return intUnit(cg);case"yyyyyy":return intUnit(ng);case"M":return intUnit(sg);case"MM":return intUnit(ig);case"MMM":return oneOf(eg.months("short",!0),1);case"MMMM":return oneOf(eg.months("long",!0),1);case"L":return intUnit(sg);case"LL":return intUnit(ig);case"LLL":return oneOf(eg.months("short",!1),1);case"LLLL":return oneOf(eg.months("long",!1),1);case"d":return intUnit(sg);case"dd":return intUnit(ig);case"o":return intUnit(ag);case"ooo":return intUnit(Ig);case"HH":return intUnit(ig);case"H":return intUnit(sg);case"hh":return intUnit(ig);case"h":return intUnit(sg);case"mm":return intUnit(ig);case"m":return intUnit(sg);case"q":return intUnit(sg);case"qq":return intUnit(ig);case"s":return intUnit(sg);case"ss":return intUnit(ig);case"S":return intUnit(ag);case"SSS":return intUnit(Ig);case"u":return simple(lg);case"uu":return simple(sg);case"uuu":return intUnit(gg);case"a":return oneOf(eg.meridiems(),0);case"kkkk":return intUnit(og);case"kk":return intUnit(Ag,untruncateYear);case"W":return intUnit(sg);case"WW":return intUnit(ig);case"E":case"c":return intUnit(gg);case"EEE":return oneOf(eg.weekdays("short",!1),1);case"EEEE":return oneOf(eg.weekdays("long",!1),1);case"ccc":return oneOf(eg.weekdays("short",!0),1);case"cccc":return oneOf(eg.weekdays("long",!0),1);case"Z":case"ZZ":return offset(new RegExp(`([+-]${sg.source})(?::(${ig.source}))?`),2);case"ZZZ":return offset(new RegExp(`([+-]${sg.source})(${ig.source})?`),2);case"z":return simple(/[a-z_+-/]{1,256}?/i);case" ":return simple(/[^\S\n\r]/);default:return rg(mg)}})(tg)||{invalidReason:MISSING_FTP};return dg.token=tg,dg}const partTypeStyleToTokenVal={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function tokenForPart(tg,eg,gg){const{type:ig,value:Ig}=tg;if(ig==="literal"){const ag=/^\s+$/.test(Ig);return{literal:!ag,val:ag?" ":Ig}}const og=eg[ig];let ng=ig;ig==="hour"&&(eg.hour12!=null?ng=eg.hour12?"hour12":"hour24":eg.hourCycle!=null?eg.hourCycle==="h11"||eg.hourCycle==="h12"?ng="hour12":ng="hour24":ng=gg.hour12?"hour12":"hour24");let sg=partTypeStyleToTokenVal[ng];if(typeof sg=="object"&&(sg=sg[og]),sg)return{literal:!1,val:sg}}function buildRegex(tg){return[`^${tg.map(gg=>gg.regex).reduce((gg,ig)=>`${gg}(${ig.source})`,"")}$`,tg]}function match(tg,eg,gg){const ig=tg.match(eg);if(ig){const Ig={};let og=1;for(const ng in gg)if(hasOwnProperty(gg,ng)){const sg=gg[ng],ag=sg.groups?sg.groups+1:1;!sg.literal&&sg.token&&(Ig[sg.token.val[0]]=sg.deser(ig.slice(og,og+ag))),og+=ag}return[ig,Ig]}else return[ig,{}]}function dateTimeFromMatches(tg){const eg=og=>{switch(og){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let gg=null,ig;return isUndefined$1(tg.z)||(gg=IANAZone.create(tg.z)),isUndefined$1(tg.Z)||(gg||(gg=new FixedOffsetZone(tg.Z)),ig=tg.Z),isUndefined$1(tg.q)||(tg.M=(tg.q-1)*3+1),isUndefined$1(tg.h)||(tg.h<12&&tg.a===1?tg.h+=12:tg.h===12&&tg.a===0&&(tg.h=0)),tg.G===0&&tg.y&&(tg.y=-tg.y),isUndefined$1(tg.u)||(tg.S=parseMillis(tg.u)),[Object.keys(tg).reduce((og,ng)=>{const sg=eg(ng);return sg&&(og[sg]=tg[ng]),og},{}),gg,ig]}let dummyDateTimeCache=null;function getDummyDateTime(){return dummyDateTimeCache||(dummyDateTimeCache=DateTime.fromMillis(1555555555555)),dummyDateTimeCache}function maybeExpandMacroToken(tg,eg){if(tg.literal)return tg;const gg=Formatter.macroTokenToFormatOpts(tg.val),ig=formatOptsToTokens(gg,eg);return ig==null||ig.includes(void 0)?tg:ig}function expandMacroTokens(tg,eg){return Array.prototype.concat(...tg.map(gg=>maybeExpandMacroToken(gg,eg)))}class TokenParser{constructor(eg,gg){if(this.locale=eg,this.format=gg,this.tokens=expandMacroTokens(Formatter.parseFormat(gg),eg),this.units=this.tokens.map(ig=>unitForToken(ig,eg)),this.disqualifyingUnit=this.units.find(ig=>ig.invalidReason),!this.disqualifyingUnit){const[ig,Ig]=buildRegex(this.units);this.regex=RegExp(ig,"i"),this.handlers=Ig}}explainFromTokens(eg){if(this.isValid){const[gg,ig]=match(eg,this.regex,this.handlers),[Ig,og,ng]=ig?dateTimeFromMatches(ig):[null,null,void 0];if(hasOwnProperty(ig,"a")&&hasOwnProperty(ig,"H"))throw new ConflictingSpecificationError("Can't include meridiem when specifying 24-hour format");return{input:eg,tokens:this.tokens,regex:this.regex,rawMatches:gg,matches:ig,result:Ig,zone:og,specificOffset:ng}}else return{input:eg,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function explainFromTokens(tg,eg,gg){return new TokenParser(tg,gg).explainFromTokens(eg)}function parseFromTokens(tg,eg,gg){const{result:ig,zone:Ig,specificOffset:og,invalidReason:ng}=explainFromTokens(tg,eg,gg);return[ig,Ig,og,ng]}function formatOptsToTokens(tg,eg){if(!tg)return null;const ig=Formatter.create(eg,tg).dtFormatter(getDummyDateTime()),Ig=ig.formatToParts(),og=ig.resolvedOptions();return Ig.map(ng=>tokenForPart(ng,tg,og))}const INVALID="Invalid DateTime",MAX_DATE=864e13;function unsupportedZone(tg){return new Invalid("unsupported zone",`the zone "${tg.name}" is not supported`)}function possiblyCachedWeekData(tg){return tg.weekData===null&&(tg.weekData=gregorianToWeek(tg.c)),tg.weekData}function possiblyCachedLocalWeekData(tg){return tg.localWeekData===null&&(tg.localWeekData=gregorianToWeek(tg.c,tg.loc.getMinDaysInFirstWeek(),tg.loc.getStartOfWeek())),tg.localWeekData}function clone(tg,eg){const gg={ts:tg.ts,zone:tg.zone,c:tg.c,o:tg.o,loc:tg.loc,invalid:tg.invalid};return new DateTime({...gg,...eg,old:gg})}function fixOffset(tg,eg,gg){let ig=tg-eg*60*1e3;const Ig=gg.offset(ig);if(eg===Ig)return[ig,eg];ig-=(Ig-eg)*60*1e3;const og=gg.offset(ig);return Ig===og?[ig,Ig]:[tg-Math.min(Ig,og)*60*1e3,Math.max(Ig,og)]}function tsToObj(tg,eg){tg+=eg*60*1e3;const gg=new Date(tg);return{year:gg.getUTCFullYear(),month:gg.getUTCMonth()+1,day:gg.getUTCDate(),hour:gg.getUTCHours(),minute:gg.getUTCMinutes(),second:gg.getUTCSeconds(),millisecond:gg.getUTCMilliseconds()}}function objToTS(tg,eg,gg){return fixOffset(objToLocalTS(tg),eg,gg)}function adjustTime(tg,eg){const gg=tg.o,ig=tg.c.year+Math.trunc(eg.years),Ig=tg.c.month+Math.trunc(eg.months)+Math.trunc(eg.quarters)*3,og={...tg.c,year:ig,month:Ig,day:Math.min(tg.c.day,daysInMonth(ig,Ig))+Math.trunc(eg.days)+Math.trunc(eg.weeks)*7},ng=Duration.fromObject({years:eg.years-Math.trunc(eg.years),quarters:eg.quarters-Math.trunc(eg.quarters),months:eg.months-Math.trunc(eg.months),weeks:eg.weeks-Math.trunc(eg.weeks),days:eg.days-Math.trunc(eg.days),hours:eg.hours,minutes:eg.minutes,seconds:eg.seconds,milliseconds:eg.milliseconds}).as("milliseconds"),sg=objToLocalTS(og);let[ag,Cg]=fixOffset(sg,gg,tg.zone);return ng!==0&&(ag+=ng,Cg=tg.zone.offset(ag)),{ts:ag,o:Cg}}function parseDataToDateTime(tg,eg,gg,ig,Ig,og){const{setZone:ng,zone:sg}=gg;if(tg&&Object.keys(tg).length!==0||eg){const ag=eg||sg,Cg=DateTime.fromObject(tg,{...gg,zone:ag,specificOffset:og});return ng?Cg:Cg.setZone(sg)}else return DateTime.invalid(new Invalid("unparsable",`the input "${Ig}" can't be parsed as ${ig}`))}function toTechFormat(tg,eg,gg=!0){return tg.isValid?Formatter.create(Locale.create("en-US"),{allowZ:gg,forceSimple:!0}).formatDateTimeFromString(tg,eg):null}function toISODate(tg,eg,gg){const ig=tg.c.year>9999||tg.c.year<0;let Ig="";if(ig&&tg.c.year>=0&&(Ig+="+"),Ig+=padStart(tg.c.year,ig?6:4),gg==="year")return Ig;if(eg){if(Ig+="-",Ig+=padStart(tg.c.month),gg==="month")return Ig;Ig+="-"}else if(Ig+=padStart(tg.c.month),gg==="month")return Ig;return Ig+=padStart(tg.c.day),Ig}function toISOTime(tg,eg,gg,ig,Ig,og,ng){let sg=!gg||tg.c.millisecond!==0||tg.c.second!==0,ag="";switch(ng){case"day":case"month":case"year":break;default:if(ag+=padStart(tg.c.hour),ng==="hour")break;if(eg){if(ag+=":",ag+=padStart(tg.c.minute),ng==="minute")break;sg&&(ag+=":",ag+=padStart(tg.c.second))}else{if(ag+=padStart(tg.c.minute),ng==="minute")break;sg&&(ag+=padStart(tg.c.second))}if(ng==="second")break;sg&&(!ig||tg.c.millisecond!==0)&&(ag+=".",ag+=padStart(tg.c.millisecond,3))}return Ig&&(tg.isOffsetFixed&&tg.offset===0&&!og?ag+="Z":tg.o<0?(ag+="-",ag+=padStart(Math.trunc(-tg.o/60)),ag+=":",ag+=padStart(Math.trunc(-tg.o%60))):(ag+="+",ag+=padStart(Math.trunc(tg.o/60)),ag+=":",ag+=padStart(Math.trunc(tg.o%60)))),og&&(ag+="["+tg.zone.ianaName+"]"),ag}const defaultUnitValues={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},defaultWeekUnitValues={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},defaultOrdinalUnitValues={ordinal:1,hour:0,minute:0,second:0,millisecond:0},orderedUnits=["year","month","day","hour","minute","second","millisecond"],orderedWeekUnits=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],orderedOrdinalUnits=["year","ordinal","hour","minute","second","millisecond"];function normalizeUnit(tg){const eg={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[tg.toLowerCase()];if(!eg)throw new InvalidUnitError(tg);return eg}function normalizeUnitWithLocalWeeks(tg){switch(tg.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return normalizeUnit(tg)}}function guessOffsetForZone(tg){if(zoneOffsetTs===void 0&&(zoneOffsetTs=Settings.now()),tg.type!=="iana")return tg.offset(zoneOffsetTs);const eg=tg.name;let gg=zoneOffsetGuessCache.get(eg);return gg===void 0&&(gg=tg.offset(zoneOffsetTs),zoneOffsetGuessCache.set(eg,gg)),gg}function quickDT(tg,eg){const gg=normalizeZone(eg.zone,Settings.defaultZone);if(!gg.isValid)return DateTime.invalid(unsupportedZone(gg));const ig=Locale.fromObject(eg);let Ig,og;if(isUndefined$1(tg.year))Ig=Settings.now();else{for(const ag of orderedUnits)isUndefined$1(tg[ag])&&(tg[ag]=defaultUnitValues[ag]);const ng=hasInvalidGregorianData(tg)||hasInvalidTimeData(tg);if(ng)return DateTime.invalid(ng);const sg=guessOffsetForZone(gg);[Ig,og]=objToTS(tg,sg,gg)}return new DateTime({ts:Ig,zone:gg,loc:ig,o:og})}function diffRelative(tg,eg,gg){const ig=isUndefined$1(gg.round)?!0:gg.round,Ig=isUndefined$1(gg.rounding)?"trunc":gg.rounding,og=(sg,ag)=>(sg=roundTo(sg,ig||gg.calendary?0:2,gg.calendary?"round":Ig),eg.loc.clone(gg).relFormatter(gg).format(sg,ag)),ng=sg=>gg.calendary?eg.hasSame(tg,sg)?0:eg.startOf(sg).diff(tg.startOf(sg),sg).get(sg):eg.diff(tg,sg).get(sg);if(gg.unit)return og(ng(gg.unit),gg.unit);for(const sg of gg.units){const ag=ng(sg);if(Math.abs(ag)>=1)return og(ag,sg)}return og(tg>eg?-0:0,gg.units[gg.units.length-1])}function lastOpts(tg){let eg={},gg;return tg.length>0&&typeof tg[tg.length-1]=="object"?(eg=tg[tg.length-1],gg=Array.from(tg).slice(0,tg.length-1)):gg=Array.from(tg),[eg,gg]}let zoneOffsetTs;const zoneOffsetGuessCache=new Map;class DateTime{constructor(eg){const gg=eg.zone||Settings.defaultZone;let ig=eg.invalid||(Number.isNaN(eg.ts)?new Invalid("invalid input"):null)||(gg.isValid?null:unsupportedZone(gg));this.ts=isUndefined$1(eg.ts)?Settings.now():eg.ts;let Ig=null,og=null;if(!ig)if(eg.old&&eg.old.ts===this.ts&&eg.old.zone.equals(gg))[Ig,og]=[eg.old.c,eg.old.o];else{const sg=isNumber$1(eg.o)&&!eg.old?eg.o:gg.offset(this.ts);Ig=tsToObj(this.ts,sg),ig=Number.isNaN(Ig.year)?new Invalid("invalid input"):null,Ig=ig?null:Ig,og=ig?null:sg}this._zone=gg,this.loc=eg.loc||Locale.create(),this.invalid=ig,this.weekData=null,this.localWeekData=null,this.c=Ig,this.o=og,this.isLuxonDateTime=!0}static now(){return new DateTime({})}static local(){const[eg,gg]=lastOpts(arguments),[ig,Ig,og,ng,sg,ag,Cg]=gg;return quickDT({year:ig,month:Ig,day:og,hour:ng,minute:sg,second:ag,millisecond:Cg},eg)}static utc(){const[eg,gg]=lastOpts(arguments),[ig,Ig,og,ng,sg,ag,Cg]=gg;return eg.zone=FixedOffsetZone.utcInstance,quickDT({year:ig,month:Ig,day:og,hour:ng,minute:sg,second:ag,millisecond:Cg},eg)}static fromJSDate(eg,gg={}){const ig=isDate$1(eg)?eg.valueOf():NaN;if(Number.isNaN(ig))return DateTime.invalid("invalid input");const Ig=normalizeZone(gg.zone,Settings.defaultZone);return Ig.isValid?new DateTime({ts:ig,zone:Ig,loc:Locale.fromObject(gg)}):DateTime.invalid(unsupportedZone(Ig))}static fromMillis(eg,gg={}){if(isNumber$1(eg))return eg<-MAX_DATE||eg>MAX_DATE?DateTime.invalid("Timestamp out of range"):new DateTime({ts:eg,zone:normalizeZone(gg.zone,Settings.defaultZone),loc:Locale.fromObject(gg)});throw new InvalidArgumentError(`fromMillis requires a numerical input, but received a ${typeof eg} with value ${eg}`)}static fromSeconds(eg,gg={}){if(isNumber$1(eg))return new DateTime({ts:eg*1e3,zone:normalizeZone(gg.zone,Settings.defaultZone),loc:Locale.fromObject(gg)});throw new InvalidArgumentError("fromSeconds requires a numerical input")}static fromObject(eg,gg={}){eg=eg||{};const ig=normalizeZone(gg.zone,Settings.defaultZone);if(!ig.isValid)return DateTime.invalid(unsupportedZone(ig));const Ig=Locale.fromObject(gg),og=normalizeObject(eg,normalizeUnitWithLocalWeeks),{minDaysInFirstWeek:ng,startOfWeek:sg}=usesLocalWeekValues(og,Ig),ag=Settings.now(),Cg=isUndefined$1(gg.specificOffset)?ig.offset(ag):gg.specificOffset,lg=!isUndefined$1(og.ordinal),Ag=!isUndefined$1(og.year),cg=!isUndefined$1(og.month)||!isUndefined$1(og.day),rg=Ag||cg,ug=og.weekYear||og.weekNumber;if((rg||lg)&&ug)throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(cg&&lg)throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");const dg=ug||og.weekday&&!rg;let mg,bg,pg=tsToObj(ag,Cg);dg?(mg=orderedWeekUnits,bg=defaultWeekUnitValues,pg=gregorianToWeek(pg,ng,sg)):lg?(mg=orderedOrdinalUnits,bg=defaultOrdinalUnitValues,pg=gregorianToOrdinal(pg)):(mg=orderedUnits,bg=defaultUnitValues);let Zg=!1;for(const Wg of mg){const $g=og[Wg];isUndefined$1($g)?Zg?og[Wg]=bg[Wg]:og[Wg]=pg[Wg]:Zg=!0}const Gg=dg?hasInvalidWeekData(og,ng,sg):lg?hasInvalidOrdinalData(og):hasInvalidGregorianData(og),hg=Gg||hasInvalidTimeData(og);if(hg)return DateTime.invalid(hg);const fg=dg?weekToGregorian(og,ng,sg):lg?ordinalToGregorian(og):og,[wg,yg]=objToTS(fg,Cg,ig),Bg=new DateTime({ts:wg,zone:ig,o:yg,loc:Ig});return og.weekday&&rg&&eg.weekday!==Bg.weekday?DateTime.invalid("mismatched weekday",`you can't specify both a weekday of ${og.weekday} and a date of ${Bg.toISO()}`):Bg.isValid?Bg:DateTime.invalid(Bg.invalid)}static fromISO(eg,gg={}){const[ig,Ig]=parseISODate(eg);return parseDataToDateTime(ig,Ig,gg,"ISO 8601",eg)}static fromRFC2822(eg,gg={}){const[ig,Ig]=parseRFC2822Date(eg);return parseDataToDateTime(ig,Ig,gg,"RFC 2822",eg)}static fromHTTP(eg,gg={}){const[ig,Ig]=parseHTTPDate(eg);return parseDataToDateTime(ig,Ig,gg,"HTTP",gg)}static fromFormat(eg,gg,ig={}){if(isUndefined$1(eg)||isUndefined$1(gg))throw new InvalidArgumentError("fromFormat requires an input string and a format");const{locale:Ig=null,numberingSystem:og=null}=ig,ng=Locale.fromOpts({locale:Ig,numberingSystem:og,defaultToEN:!0}),[sg,ag,Cg,lg]=parseFromTokens(ng,eg,gg);return lg?DateTime.invalid(lg):parseDataToDateTime(sg,ag,ig,`format ${gg}`,eg,Cg)}static fromString(eg,gg,ig={}){return DateTime.fromFormat(eg,gg,ig)}static fromSQL(eg,gg={}){const[ig,Ig]=parseSQL(eg);return parseDataToDateTime(ig,Ig,gg,"SQL",eg)}static invalid(eg,gg=null){if(!eg)throw new InvalidArgumentError("need to specify a reason the DateTime is invalid");const ig=eg instanceof Invalid?eg:new Invalid(eg,gg);if(Settings.throwOnInvalid)throw new InvalidDateTimeError(ig);return new DateTime({invalid:ig})}static isDateTime(eg){return eg&&eg.isLuxonDateTime||!1}static parseFormatForOpts(eg,gg={}){const ig=formatOptsToTokens(eg,Locale.fromObject(gg));return ig?ig.map(Ig=>Ig?Ig.val:null).join(""):null}static expandFormat(eg,gg={}){return expandMacroTokens(Formatter.parseFormat(eg),Locale.fromObject(gg)).map(Ig=>Ig.val).join("")}static resetCache(){zoneOffsetTs=void 0,zoneOffsetGuessCache.clear()}get(eg){return this[eg]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?possiblyCachedWeekData(this).weekYear:NaN}get weekNumber(){return this.isValid?possiblyCachedWeekData(this).weekNumber:NaN}get weekday(){return this.isValid?possiblyCachedWeekData(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?possiblyCachedLocalWeekData(this).weekday:NaN}get localWeekNumber(){return this.isValid?possiblyCachedLocalWeekData(this).weekNumber:NaN}get localWeekYear(){return this.isValid?possiblyCachedLocalWeekData(this).weekYear:NaN}get ordinal(){return this.isValid?gregorianToOrdinal(this.c).ordinal:NaN}get monthShort(){return this.isValid?Info.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Info.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Info.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Info.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const eg=864e5,gg=6e4,ig=objToLocalTS(this.c),Ig=this.zone.offset(ig-eg),og=this.zone.offset(ig+eg),ng=this.zone.offset(ig-Ig*gg),sg=this.zone.offset(ig-og*gg);if(ng===sg)return[this];const ag=ig-ng*gg,Cg=ig-sg*gg,lg=tsToObj(ag,ng),Ag=tsToObj(Cg,sg);return lg.hour===Ag.hour&&lg.minute===Ag.minute&&lg.second===Ag.second&&lg.millisecond===Ag.millisecond?[clone(this,{ts:ag}),clone(this,{ts:Cg})]:[this]}get isInLeapYear(){return isLeapYear(this.year)}get daysInMonth(){return daysInMonth(this.year,this.month)}get daysInYear(){return this.isValid?daysInYear(this.year):NaN}get weeksInWeekYear(){return this.isValid?weeksInWeekYear(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?weeksInWeekYear(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(eg={}){const{locale:gg,numberingSystem:ig,calendar:Ig}=Formatter.create(this.loc.clone(eg),eg).resolvedOptions(this);return{locale:gg,numberingSystem:ig,outputCalendar:Ig}}toUTC(eg=0,gg={}){return this.setZone(FixedOffsetZone.instance(eg),gg)}toLocal(){return this.setZone(Settings.defaultZone)}setZone(eg,{keepLocalTime:gg=!1,keepCalendarTime:ig=!1}={}){if(eg=normalizeZone(eg,Settings.defaultZone),eg.equals(this.zone))return this;if(eg.isValid){let Ig=this.ts;if(gg||ig){const og=eg.offset(this.ts),ng=this.toObject();[Ig]=objToTS(ng,og,eg)}return clone(this,{ts:Ig,zone:eg})}else return DateTime.invalid(unsupportedZone(eg))}reconfigure({locale:eg,numberingSystem:gg,outputCalendar:ig}={}){const Ig=this.loc.clone({locale:eg,numberingSystem:gg,outputCalendar:ig});return clone(this,{loc:Ig})}setLocale(eg){return this.reconfigure({locale:eg})}set(eg){if(!this.isValid)return this;const gg=normalizeObject(eg,normalizeUnitWithLocalWeeks),{minDaysInFirstWeek:ig,startOfWeek:Ig}=usesLocalWeekValues(gg,this.loc),og=!isUndefined$1(gg.weekYear)||!isUndefined$1(gg.weekNumber)||!isUndefined$1(gg.weekday),ng=!isUndefined$1(gg.ordinal),sg=!isUndefined$1(gg.year),ag=!isUndefined$1(gg.month)||!isUndefined$1(gg.day),Cg=sg||ag,lg=gg.weekYear||gg.weekNumber;if((Cg||ng)&&lg)throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(ag&&ng)throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");let Ag;og?Ag=weekToGregorian({...gregorianToWeek(this.c,ig,Ig),...gg},ig,Ig):isUndefined$1(gg.ordinal)?(Ag={...this.toObject(),...gg},isUndefined$1(gg.day)&&(Ag.day=Math.min(daysInMonth(Ag.year,Ag.month),Ag.day))):Ag=ordinalToGregorian({...gregorianToOrdinal(this.c),...gg});const[cg,rg]=objToTS(Ag,this.o,this.zone);return clone(this,{ts:cg,o:rg})}plus(eg){if(!this.isValid)return this;const gg=Duration.fromDurationLike(eg);return clone(this,adjustTime(this,gg))}minus(eg){if(!this.isValid)return this;const gg=Duration.fromDurationLike(eg).negate();return clone(this,adjustTime(this,gg))}startOf(eg,{useLocaleWeeks:gg=!1}={}){if(!this.isValid)return this;const ig={},Ig=Duration.normalizeUnit(eg);switch(Ig){case"years":ig.month=1;case"quarters":case"months":ig.day=1;case"weeks":case"days":ig.hour=0;case"hours":ig.minute=0;case"minutes":ig.second=0;case"seconds":ig.millisecond=0;break}if(Ig==="weeks")if(gg){const og=this.loc.getStartOfWeek(),{weekday:ng}=this;ng<og&&(ig.weekNumber=this.weekNumber-1),ig.weekday=og}else ig.weekday=1;if(Ig==="quarters"){const og=Math.ceil(this.month/3);ig.month=(og-1)*3+1}return this.set(ig)}endOf(eg,gg){return this.isValid?this.plus({[eg]:1}).startOf(eg,gg).minus(1):this}toFormat(eg,gg={}){return this.isValid?Formatter.create(this.loc.redefaultToEN(gg)).formatDateTimeFromString(this,eg):INVALID}toLocaleString(eg=DATE_SHORT,gg={}){return this.isValid?Formatter.create(this.loc.clone(gg),eg).formatDateTime(this):INVALID}toLocaleParts(eg={}){return this.isValid?Formatter.create(this.loc.clone(eg),eg).formatDateTimeParts(this):[]}toISO({format:eg="extended",suppressSeconds:gg=!1,suppressMilliseconds:ig=!1,includeOffset:Ig=!0,extendedZone:og=!1,precision:ng="milliseconds"}={}){if(!this.isValid)return null;ng=normalizeUnit(ng);const sg=eg==="extended";let ag=toISODate(this,sg,ng);return orderedUnits.indexOf(ng)>=3&&(ag+="T"),ag+=toISOTime(this,sg,gg,ig,Ig,og,ng),ag}toISODate({format:eg="extended",precision:gg="day"}={}){return this.isValid?toISODate(this,eg==="extended",normalizeUnit(gg)):null}toISOWeekDate(){return toTechFormat(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:eg=!1,suppressSeconds:gg=!1,includeOffset:ig=!0,includePrefix:Ig=!1,extendedZone:og=!1,format:ng="extended",precision:sg="milliseconds"}={}){return this.isValid?(sg=normalizeUnit(sg),(Ig&&orderedUnits.indexOf(sg)>=3?"T":"")+toISOTime(this,ng==="extended",gg,eg,ig,og,sg)):null}toRFC2822(){return toTechFormat(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return toTechFormat(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?toISODate(this,!0):null}toSQLTime({includeOffset:eg=!0,includeZone:gg=!1,includeOffsetSpace:ig=!0}={}){let Ig="HH:mm:ss.SSS";return(gg||eg)&&(ig&&(Ig+=" "),gg?Ig+="z":eg&&(Ig+="ZZ")),toTechFormat(this,Ig,!0)}toSQL(eg={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(eg)}`:null}toString(){return this.isValid?this.toISO():INVALID}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(eg={}){if(!this.isValid)return{};const gg={...this.c};return eg.includeConfig&&(gg.outputCalendar=this.outputCalendar,gg.numberingSystem=this.loc.numberingSystem,gg.locale=this.loc.locale),gg}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(eg,gg="milliseconds",ig={}){if(!this.isValid||!eg.isValid)return Duration.invalid("created by diffing an invalid DateTime");const Ig={locale:this.locale,numberingSystem:this.numberingSystem,...ig},og=maybeArray(gg).map(Duration.normalizeUnit),ng=eg.valueOf()>this.valueOf(),sg=ng?this:eg,ag=ng?eg:this,Cg=diff(sg,ag,og,Ig);return ng?Cg.negate():Cg}diffNow(eg="milliseconds",gg={}){return this.diff(DateTime.now(),eg,gg)}until(eg){return this.isValid?Interval.fromDateTimes(this,eg):this}hasSame(eg,gg,ig){if(!this.isValid)return!1;const Ig=eg.valueOf(),og=this.setZone(eg.zone,{keepLocalTime:!0});return og.startOf(gg,ig)<=Ig&&Ig<=og.endOf(gg,ig)}equals(eg){return this.isValid&&eg.isValid&&this.valueOf()===eg.valueOf()&&this.zone.equals(eg.zone)&&this.loc.equals(eg.loc)}toRelative(eg={}){if(!this.isValid)return null;const gg=eg.base||DateTime.fromObject({},{zone:this.zone}),ig=eg.padding?this<gg?-eg.padding:eg.padding:0;let Ig=["years","months","days","hours","minutes","seconds"],og=eg.unit;return Array.isArray(eg.unit)&&(Ig=eg.unit,og=void 0),diffRelative(gg,this.plus(ig),{...eg,numeric:"always",units:Ig,unit:og})}toRelativeCalendar(eg={}){return this.isValid?diffRelative(eg.base||DateTime.fromObject({},{zone:this.zone}),this,{...eg,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...eg){if(!eg.every(DateTime.isDateTime))throw new InvalidArgumentError("min requires all arguments be DateTimes");return bestBy(eg,gg=>gg.valueOf(),Math.min)}static max(...eg){if(!eg.every(DateTime.isDateTime))throw new InvalidArgumentError("max requires all arguments be DateTimes");return bestBy(eg,gg=>gg.valueOf(),Math.max)}static fromFormatExplain(eg,gg,ig={}){const{locale:Ig=null,numberingSystem:og=null}=ig,ng=Locale.fromOpts({locale:Ig,numberingSystem:og,defaultToEN:!0});return explainFromTokens(ng,eg,gg)}static fromStringExplain(eg,gg,ig={}){return DateTime.fromFormatExplain(eg,gg,ig)}static buildFormatParser(eg,gg={}){const{locale:ig=null,numberingSystem:Ig=null}=gg,og=Locale.fromOpts({locale:ig,numberingSystem:Ig,defaultToEN:!0});return new TokenParser(og,eg)}static fromFormatParser(eg,gg,ig={}){if(isUndefined$1(eg)||isUndefined$1(gg))throw new InvalidArgumentError("fromFormatParser requires an input string and a format parser");const{locale:Ig=null,numberingSystem:og=null}=ig,ng=Locale.fromOpts({locale:Ig,numberingSystem:og,defaultToEN:!0});if(!ng.equals(gg.locale))throw new InvalidArgumentError(`fromFormatParser called with a locale of ${ng}, but the format parser was created for ${gg.locale}`);const{result:sg,zone:ag,specificOffset:Cg,invalidReason:lg}=gg.explainFromTokens(eg);return lg?DateTime.invalid(lg):parseDataToDateTime(sg,ag,ig,`format ${gg.format}`,eg,Cg)}static get DATE_SHORT(){return DATE_SHORT}static get DATE_MED(){return DATE_MED}static get DATE_MED_WITH_WEEKDAY(){return DATE_MED_WITH_WEEKDAY}static get DATE_FULL(){return DATE_FULL}static get DATE_HUGE(){return DATE_HUGE}static get TIME_SIMPLE(){return TIME_SIMPLE}static get TIME_WITH_SECONDS(){return TIME_WITH_SECONDS}static get TIME_WITH_SHORT_OFFSET(){return TIME_WITH_SHORT_OFFSET}static get TIME_WITH_LONG_OFFSET(){return TIME_WITH_LONG_OFFSET}static get TIME_24_SIMPLE(){return TIME_24_SIMPLE}static get TIME_24_WITH_SECONDS(){return TIME_24_WITH_SECONDS}static get TIME_24_WITH_SHORT_OFFSET(){return TIME_24_WITH_SHORT_OFFSET}static get TIME_24_WITH_LONG_OFFSET(){return TIME_24_WITH_LONG_OFFSET}static get DATETIME_SHORT(){return DATETIME_SHORT}static get DATETIME_SHORT_WITH_SECONDS(){return DATETIME_SHORT_WITH_SECONDS}static get DATETIME_MED(){return DATETIME_MED}static get DATETIME_MED_WITH_SECONDS(){return DATETIME_MED_WITH_SECONDS}static get DATETIME_MED_WITH_WEEKDAY(){return DATETIME_MED_WITH_WEEKDAY}static get DATETIME_FULL(){return DATETIME_FULL}static get DATETIME_FULL_WITH_SECONDS(){return DATETIME_FULL_WITH_SECONDS}static get DATETIME_HUGE(){return DATETIME_HUGE}static get DATETIME_HUGE_WITH_SECONDS(){return DATETIME_HUGE_WITH_SECONDS}}function friendlyDateTime(tg){if(DateTime.isDateTime(tg))return tg;if(tg&&tg.valueOf&&isNumber$1(tg.valueOf()))return DateTime.fromJSDate(tg);if(tg&&typeof tg=="object")return DateTime.fromObject(tg);throw new InvalidArgumentError(`Unknown datetime argument: ${tg}, of type ${typeof tg}`)}const WEEK_ZH=["一","二","三","四","五","六","日"],MONTH_ZH_NUM=["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],MONTH_ZH_CN=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"];function formatDate(tg,{years:eg=0,months:gg=0,days:ig=0}={}){const Ig=DateTime.now().plus({years:eg,months:gg,days:ig}).setLocale("zh-CN");let og=formatWithZhMonth(Ig,tg),ng=Ig.toFormat(og);return ng=formatWithZhWeekday(Ig,ng),ng}function formatWithZhWeekday(tg,eg){const gg=WEEK_ZH[tg.weekday-1];return eg.replace(/dddd/g,`星期${gg}`).replace(/ddd/g,`周${gg}`)}function formatWithZhMonth(tg,eg){const gg=tg.month-1;return eg.replace(/MMMM/g,MONTH_ZH_CN[gg]).replace(/MMM/g,MONTH_ZH_NUM[gg])}function throttle$1(tg,eg=300){let gg=0;return function(...ig){const Ig=Date.now();Ig-gg>=eg&&(tg.apply(this,ig),gg=Ig)}}function ptToPx$1(tg,eg=o.DPI){return tg*eg/72}function mitt(tg){return{all:tg=tg||new Map,on:function(eg,gg){var ig=tg.get(eg);ig?ig.push(gg):tg.set(eg,[gg])},off:function(eg,gg){var ig=tg.get(eg);ig&&(gg?ig.splice(ig.indexOf(gg)>>>0,1):tg.set(eg,[]))},emit:function(eg,gg){var ig=tg.get(eg);ig&&ig.slice().map(function(Ig){Ig(gg)}),(ig=tg.get("*"))&&ig.slice().map(function(Ig){Ig(eg,gg)})}}}const canvasEventBus=mitt();let allObjMap=new Proxy({},{get(tg,eg){return eg in tg?tg[eg]:[]},set(tg,eg,gg){return tg[eg]=gg,!0}});function clearObjectMap(){allObjMap=new Proxy({},{get(tg,eg){return eg in tg?tg[eg]:[]},set(tg,eg,gg){return tg[eg]=gg,!0}})}function updateObjectMap(tg){tg.type!=="group"&&tg.id!=="workspace"?!allObjMap[tg.type]||allObjMap[tg.type]&&allObjMap[tg.type].length===0?allObjMap[tg.type]=[tg]:allObjMap[tg.type].push(tg):tg._objects.forEach(eg=>updateObjectMap(eg))}function getAllObjectMap(tg=null,eg="get"){if(eg==="get"&&Object.keys(allObjMap).length)return allObjMap;{if(!tg)return allObjMap;clearObjectMap();const gg=ig=>{ig.type==="group"&&ig._objects?ig._objects.forEach(Ig=>gg(Ig)):ig.id!=="workspace"&&(!allObjMap[ig.type]||allObjMap[ig.type]&&allObjMap[ig.type].length===0?allObjMap[ig.type]=[ig]:allObjMap[ig.type].push(ig))};tg==null||tg.getObjects().forEach(ig=>gg(ig))}return allObjMap}function getObjectList(tg,eg){tg.type!=="group"&&tg.type!=="activeselection"?eg&&eg(tg):tg._objects.forEach(gg=>getObjectList(gg,eg))}function getCounterValueType(tg){return tg.valueType==="letter"?"letter":"number"}function normalizeLetterValue(tg){return String(tg??"").toUpperCase().replace(/[^A-Z]/g,"")||"A"}function letterValueToNumber(tg){return normalizeLetterValue(tg).split("").reduce((eg,gg)=>eg*26+gg.charCodeAt(0)-64,0)}function numberToLetterValue(tg){let eg=Math.max(1,Math.trunc(tg)),gg="";for(;eg>0;)eg--,gg=String.fromCharCode(65+eg%26)+gg,eg=Math.floor(eg/26);return gg}function formatCounterValue(tg){if(getCounterValueType(tg)==="letter")return normalizeLetterValue(tg.value);let eg=String(tg.value??"");if(!tg.zeroPadding)return eg;let gg=Number(eg);return gg<0?(gg=Math.abs(gg),`-${gg.toString().padStart(tg.length,"0")}`):eg.padStart(tg.length,"0")}function getNextCounterValue(tg){const eg=Math.trunc(Number(tg.incremental))||0;if(getCounterValueType(tg)==="letter"){const Ig=letterValueToNumber(normalizeLetterValue(tg.value))+eg;if(Ig<1)return null;const og=numberToLetterValue(Ig);return og.length<=tg.length?og:null}const gg=Number(tg.value);if(!Number.isFinite(gg))return null;const ig=gg+Number(tg.incremental);return Math.abs(ig).toString().length<=tg.length?ig:null}const Pl=class Pl extends ji{constructor(eg,gg){super(gg),this.hasFireChange=!1,this.minScaleLimit=.1,this.orginTextWidth=0,this.orginTextgaps=2,this.orginTextSize=0,this.orginTextHeight=0,this.lockScalingFlip=!0,this.objectCaching=!1,this._scaleAnchor=void 0,this.counterProps=null,this.reviewValueArgs=null,this.barcodeDateFormatType="",this.increaseDate=!1,this.concatTextIdListObj=null,this.connectObjIds=[],this._cache={canvas:void 0,error:void 0,update:!0},this.increaseDate=gg&&gg.increaseDate?gg.increaseDate:this.increaseDate,this.barcodeDateFormatType=gg&&gg.barcodeDateFormatType?gg.barcodeDateFormatType:this.barcodeDateFormatType,this.counterProps=gg&&gg.counterProps?gg.counterProps:this.counterProps,this.barcodeOptions=cloneDeep(eg),this.barcodeOptions.textsize=eg.textsize||14,this.barcodeOptions.textposition=eg.includetext?eg.textposition||"bottom":void 0,this.barcodeOptions.textfontname=eg.textfontname||"Arial",this.set({width:this.width||1,height:this.height||80}),this.on("scaling",ig=>{const Ig=ig.transform;if(!Ig)return;const og=Ig.corner,ng=["ml","tl","bl"].includes(og),sg=["mr","tr","br"].includes(og),ag=["mt","tl","tr"].includes(og),Cg=["mb","bl","br"].includes(og);if(!this._scaleAnchor){const dg=ng?"right":sg?"left":"center",mg=ag?"bottom":Cg?"top":"center",bg=this.getPointByOrigin(dg,mg);this._scaleAnchor={p:bg,ox:dg,oy:mg}}const lg=Math.max(1,this.width*this.scaleX),Ag=Math.max(1,this.height*this.scaleY);this.width=lg,this.height=Ag,this.scaleX=1,this.scaleY=1;const{p:cg,ox:rg,oy:ug}=this._scaleAnchor;if(this.group){const dg=kn.invertTransform(this.group.calcTransformMatrix()),mg=kn.transformPoint(cg,dg);this.setPositionByOrigin(mg,rg,ug)}else this.setPositionByOrigin(cg,rg,ug);this.setCoords()}),this.on("modified",()=>{this._scaleAnchor=void 0}),this.concatTextIdListObj=gg.concatTextIdListObj??this.concatTextIdListObj,this.connectObjIds=gg.connectObjIds??this.connectObjIds,canvasEventBus.off(`update:barcode:${this.id}`),canvasEventBus.on(`update:barcode:${this.id}`,async({list:ig,callback:Ig=function(){}}={})=>{let og=await this.updateBarCode2d(ig);Ig&&Ig(og)})}measureText(eg,gg,ig){if(gg.textposition&&gg.textposition!=="none"&&gg.textsize){eg.font=`${gg.textsize}px ${gg.textfontname}`,gg.textgaps&&(eg.letterSpacing=gg.textgaps+"px");const Ig=eg.measureText(gg.text);ig.textWidth=Ig.actualBoundingBoxRight-Ig.actualBoundingBoxLeft,ig.textHeight=Ig.fontBoundingBoxAscent+Ig.fontBoundingBoxDescent}}drawText(eg,gg,ig){if(gg.textposition&&gg.textposition!=="none"&&gg.textsize){gg.textcolor&&(eg.fillStyle=gg.textcolor);const Ig=(ag,Cg)=>{let lg=(ag==null?void 0:ag.textWidth)||0;return Cg.textxalign==="left"?-this.width/2+this.strokeWidth/2:Cg.textxalign==="center"?-lg/2:Cg.textxalign==="right"&&this._cache.canvas?this.width/2-this.strokeWidth/2-lg:0},og=(ag,Cg)=>{let lg=(ag==null?void 0:ag.textHeight)||0;if(Cg.textposition==="top"){if(this._cache.canvas){const Ag=-this.height/2+lg+this.strokeWidth/2;return ag.y+=ag.textHeight,Ag}}else if(Cg.textposition==="bottom"&&this._cache.canvas)return this.height/2-this.strokeWidth/2;return 0},ng=Ig(ig,gg),sg=og(ig,gg);eg.save(),eg.fillText(gg.text,ng*this.scaleX,sg*this.scaleY),eg.restore()}}countDate(){if(this.barcodeDateFormatType&&this.increaseDate){const eg=formatDate(this.barcodeDateFormatType);return console.log("formatted",eg),this.dirty=!0,this.setBarcodeOption({bcid:this.barcodeOptions.bcid,text:eg}),eg}}countCurrent(eg){let gg=this.counterProps||eg;if(gg){let ig=gg;if(!ig.value&&ig.value!==0)return"";const Ig=formatCounterValue(ig);return(ig.prefix&&ig.prefix.length>0?ig.prefix:"")+Ig+(ig.suffix&&ig.suffix.length>0?ig.suffix:"")}return""}countNext(eg="print"){if(this.counterProps){let gg=this.counterProps;if(!gg.value&&gg.value!==0)return;eg==="review"&&!this.reviewValueArgs&&(this.reviewValueArgs={...gg});const ig=formatCounterValue(gg);let Ig=(gg.prefix&&gg.prefix.length>0?gg.prefix:"")+ig+(gg.suffix&&gg.suffix.length>0?gg.suffix:"");const og=getNextCounterValue(gg);return og!==null&&(gg.value=og,this.counterProps.value=og),this.dirty=!0,this._cache.update=!0,Ig}else return""}reviewRecover(){if(this.reviewValueArgs){const eg=this.reviewValueArgs;this.counterProps=eg,this.reviewValueArgs=null;const gg=formatCounterValue(eg);let ig=(eg.prefix&&eg.prefix.length>0?eg.prefix:"")+gg+(eg.suffix&&eg.suffix.length>0?eg.suffix:"");this.setBarcodeOption({bcid:this.barcodeOptions.bcid,text:ig})}}calculateCheckDigit(eg){if(!/^\d{13}$/.test(eg))return"";let gg=0;for(let ig=0;ig<13;ig++){const Ig=parseInt(eg[ig]);gg+=Ig*(ig%2===0?3:1)}return(10-gg%10)%10}_render(eg){var dg,mg;let gg=cloneDeep(this.barcodeOptions);console.log("_render======",gg);let ig=gg.bcid==="ean13",Ig=gg.bcid==="upca",og=gg.bcid==="upce",ng=gg.bcid==="ean8";this.scaleX!==1&&(this.scaleX=1),this.scaleY!==1&&(this.scaleY=1);let sg=!1;if(this.orginTextgaps>Number(gg.textgaps)&&(sg=!0),this.orginTextSize>Number(gg.textsize)&&(sg=!0),gg.bcid==="gs1-128"){let bg=gg.text;if(bg.match(/\((\d){2}\)/)&&(bg=((dg=gg.text.match(/\(01\)(\d+)/))==null?void 0:dg[1])||""),bg.length<13&&(bg=bg.padStart(13,"0")),bg.length===13){let pg=this.calculateCheckDigit(bg);bg=bg+pg}gg.text="(01)"+bg}gg.textgaps=gg.textgaps||1,this.orginTextgaps=gg.textgaps||1,this.orginTextSize=gg.textsize||0,eg.font=`${gg.textsize}px ${gg.textfontname}`,gg.textgaps&&(eg.letterSpacing=gg.textgaps+"px");const ag=eg.measureText(gg.text);let Cg=ag.width/this.scaleX,lg=(ag.actualBoundingBoxAscent+ag.actualBoundingBoxDescent)/this.scaleY,Ag=0,cg=0;sg&&Cg<this.orginTextWidth&&(Ag=this.orginTextWidth-Cg),sg&&lg<this.orginTextHeight&&(cg=this.orginTextHeight-lg),sg&&Ag&&(this.height=this.height-cg),this.orginTextWidth=Cg,this.orginTextHeight=lg,this.height<lg+30&&(this.height=lg+30);let rg={w:this.width,h:this.height,x:-this.width/2,y:-this.height/2};rg.textWidth=Cg,rg.textHeight=lg,gg.includetext=!1,gg.scale=1,gg.paddingleft=0,gg.paddingright=0;let ug=["ean13","upca","upce","ean8"];if(ug.includes(gg.bcid)&&(gg={...gg,includetext:!0,textyoffset:-10},gg.bcid==="upca"&&(gg.textyoffset=-15),delete gg.paddingtop,delete gg.paddingbottom,delete gg.paddingleft,delete gg.paddingright,delete gg.textposition,delete gg.textxalign),typeof this.fill=="string"){let bg=rgbaStringToHex8(this.fill);gg.barcolor=hexToHex6_blend(bg)}if(this._cache.update){console.log("this._cache.update=====",this._cache.update);try{this._cache.canvas=generateCanvas(gg);let bg=this._cache.canvas.width;if(!ug.includes(gg.bcid)){let pg=getTargetDpi();this.canvas&&pg===300&&(bg=bg*1.32)}if(bg>this.width)this.width=bg;else{let pg=Math.round(this.width/bg)||1;this.width=bg*pg}rg.w=this.width,rg.x=-this.width/2,this._cache.error&&(this._cache.error=void 0),this.setCoords(),(mg=this.canvas)==null||mg.requestRenderAll(),this._cache.update=!1}catch(bg){console.warn("draw barcode",bg),this.dirty=!0,bg instanceof Error&&(console.log("error",bg.message),this._cache.error="条码内容错误:"+bg.message),this._cache.canvas=void 0}}if(eg.imageSmoothingEnabled=!1,this.strokeWidth>0&&typeof this.stroke=="string"&&(eg.lineWidth=this.strokeWidth,eg.strokeStyle=this.stroke,eg.strokeRect(rg.x,rg.y,rg.w,rg.h)),rg.barcodeCanvas=this._cache.canvas,!this._cache.error&&rg.barcodeCanvas){this.strokeWidth>0&&(rg.x+=this.strokeWidth/2,rg.y+=this.strokeWidth/2);let bg=rg.h-(rg.textHeight||0)-this.strokeWidth/2,pg=rg.y;gg.textposition==="top"?(bg=bg-5,pg=pg+rg.textHeight/this.scaleY+5):gg.textposition==="bottom"?bg=bg-5/this.scaleY:bg=rg.h-this.strokeWidth/2;let Gg=rg.w-this.strokeWidth/2,hg=bg;ug.includes(gg.bcid)&&(hg=rg.h-this.strokeWidth/2),eg.drawImage(rg.barcodeCanvas,0,0,rg.barcodeCanvas.width,rg.barcodeCanvas.height,rg.x,pg,Gg,hg);let fg=this.barcodeOptions.text;const wg=this.width;if(ig){let yg=this.calcEAN13CheckDigit(fg);fg=fg+""+yg,eg.save(),eg.fillStyle="#fff";let Bg=hg/8;eg.fillRect(rg.x,-rg.y-Bg,Gg,Bg);const Wg=Math.trunc(wg/95),$g=-rg.y-Math.trunc(hg/6);let Ng=rg.x+Math.trunc(Gg/13);eg.font=`${gg.textsize}px ${gg.textfontname}`,eg.fillStyle=gg.textcolor||"#000",eg.textAlign="center",eg.textBaseline="top";let Vg=rg.barcodeCanvas.width;this.width/Vg===1&&(eg.letterSpacing="-2px"),eg.fillText(fg[0],-Wg*2+Ng,$g),eg.fillText(fg.slice(1,7),Wg*(3+42/2)+rg.x+Math.trunc(Gg/10),$g),eg.fillText(fg.slice(7),Wg*(50+42/2)+rg.x+Math.trunc(Gg/10),$g),eg.restore()}else if(ng){let yg=this.calcEAN8CheckDigit(fg);fg=fg+""+yg,eg.save(),eg.fillStyle="#fff";let Bg=hg/8;eg.fillRect(rg.x,-rg.y-Bg,Gg,Bg);const Wg=Math.trunc(wg/67),$g=-rg.y-Math.trunc(hg/6);rg.x+Math.trunc(Gg/13),eg.font=`${gg.textsize}px ${gg.textfontname}`,eg.fillStyle=gg.textcolor||"#000",eg.textAlign="center",eg.textBaseline="top";let Ng=rg.barcodeCanvas.width;this.width/Ng===1&&(eg.letterSpacing="-1px");const Mg=Wg*12+rg.x+4,Yg=Wg*55+rg.x-4;eg.fillText(fg.slice(0,4),Mg,$g),eg.fillText(fg.slice(4),Yg,$g),eg.restore()}else if(Ig){eg.save(),eg.fillStyle="#fff";let yg=hg/8;eg.fillRect(rg.x,-rg.y-yg,Gg,yg);const Bg=-rg.y-Math.trunc(hg/6),Wg=rg.x;let $g=this.calcUPCACheckDigit(fg);fg=fg+""+$g,eg.font=`${gg.textsize}px ${gg.textfontname}`,eg.fillStyle=gg.textcolor||"#000",eg.textAlign="center",eg.textBaseline="top";let Ng=rg.barcodeCanvas.width;this.width/Ng===1&&(eg.letterSpacing="-1px"),this.drawUPCAText(eg,fg,wg,Bg,Wg),eg.restore()}else if(og){eg.save(),eg.fillStyle="#fff";let yg=hg/8;eg.fillRect(rg.x,-rg.y-yg,Gg,yg);const Bg=-rg.y-Math.trunc(hg/8),Wg=rg.x;let $g=this.calcUPCECheckDigit(fg);fg=fg+""+$g,console.log("digits========",fg),eg.font=`${gg.textsize}px ${gg.textfontname}`,eg.fillStyle=gg.textcolor||"#000",eg.textAlign="center",eg.textBaseline="top",this.drawUPCEText(eg,fg,wg,Bg,Wg),eg.restore()}else this.drawText(eg,gg,rg)}if(eg.save(),this._cache.error){const bg=wrapText(eg,this._cache.error,rg.w),pg=getLineHeight(eg);let Zg=rg.y+pg;const Gg=eg.fillStyle;eg.fillStyle="red";for(const hg of bg)if(eg.fillText(hg,rg.x,Zg),Zg+=pg,Zg>rg.y+this.height)break;eg.fillStyle=Gg}eg.restore(),console.log("_render barcode")}calcEAN13CheckDigit(eg){if(!/^\d{12}$/.test(eg))return"";let gg=0,ig=0;for(let ng=0;ng<12;ng++){const sg=Number(eg[11-ng]);(ng+1)%2===1?gg+=sg:ig+=sg}const og=(gg+ig*3)%10;return og===0?0:10-og}calcEAN8CheckDigit(eg){if(!/^\d{7}$/.test(eg))return"";let gg=0,ig=0;for(let ng=0;ng<7;ng++){const sg=Number(eg[6-ng]);(ng+1)%2===1?ig+=sg:gg+=sg}const og=(gg*3+ig)%10;return og===0?0:10-og}calcUPCACheckDigit(eg){if(!/^\d{11}$/.test(eg))return"";let gg=0,ig=0;for(let sg=0;sg<11;sg++){const ag=parseInt(eg[sg],10);(sg+1)%2===1?gg+=ag:ig+=ag}const og=(gg*3+ig)%10;return(og===0?0:10-og).toString()}calcUPCECheckDigit(eg){if(!/^\d{7}$/.test(eg))return"";const gg=eg.split("").map(Number),ig=gg[0],[Ig,og,ng,sg,ag,Cg]=gg.slice(1);let lg="";switch(Cg){case 0:case 1:case 2:lg=`${ig}${Ig}${og}${Cg}0000${ng}${sg}${ag}`;break;case 3:lg=`${ig}${Ig}${og}${ng}00000${sg}${ag}`;break;case 4:lg=`${ig}${Ig}${og}${ng}${sg}00000${ag}`;break;default:lg=`${ig}${Ig}${og}${ng}${sg}${ag}0000${Cg}`}const Ag=lg.split("").map(Number);let cg=0;for(let rg=0;rg<Ag.length;rg++)rg%2===0?cg+=Ag[rg]*3:cg+=Ag[rg];return(10-cg%10)%10}drawUPCAText(eg,gg,ig,Ig,og){const ng=gg[0],sg=gg.substring(1,6),ag=gg.substring(6,11),Cg=gg[11],lg=Ig,Ag=ig/95;[{text:ng,x:og+Ag*3.5},{text:sg,x:og+Ag*28+10},{text:ag,x:og+Ag*67},{text:Cg,x:og+Ag*91.5+10}].forEach(rg=>{rg.text&&eg.fillText(rg.text,rg.x,lg)})}drawUPCEText(eg,gg,ig,Ig,og){[{i:0,x:og+4},{i:1,x:og+ig*.25},{i:2,x:og+ig*.33},{i:3,x:og+ig*.44},{i:4,x:og+ig*.56},{i:5,x:og+ig*.68},{i:6,x:og+ig*.78},{i:7,x:og+ig+4}].forEach(sg=>{gg[sg.i]&&eg.fillText(gg[sg.i],sg.x,Ig)})}set(eg,gg){return this._cache&&(this._cache.update=!0),super.set(eg,gg)}setBarcodeOption(eg){eg.bcid!==this.barcodeOptions.bcid&&(this.barcodeBaseWidth=void 0),merge(this.barcodeOptions,eg),this.dirty=!0,this._cache.update=!0;let gg=this.group;for(;gg;)gg.dirty=!0,gg=gg.group;let ig=getAllObjectMap();this.updateBarCode2d([...ig.text,...ig.counter])}updateInGroup(){this.dirty=!0,this.setCoords();let eg=this.group;for(;eg;)eg.dirty=!0,eg==null||eg.triggerLayout("childUpdate"),eg.setCoords(),eg=eg.group}getBarcodeOption(){return cloneDeep(this.barcodeOptions)}async updateBarCode2d(eg=[],gg=""){var ig;if(this.concatTextIdListObj||this.connectObjIds&&this.connectObjIds.length>0){let Ig=!1,og="",ng=[],sg=[];const ag=lg=>{if(this.connectObjIds){let Ag=0;for(let cg of this.connectObjIds){if(cg.index=Ag,cg.id&&cg.id===lg.id){Ig=!0;let rg=lg.text+"";if(lg.type==="counter"&&(lg._props.mode==="1"?rg=lg.countCurrent():lg._props.mode==="2"&&(lg.updateText({isUpdateBarCodeDate:!1}),rg=lg.text+"")),cg.maxEnd=rg.length,cg.isSplit){cg.start=Math.min(cg.start,cg.maxEnd);let ug=rg.slice(cg.start,cg.end);ng[Ag]=ug}else ng[Ag]=rg}Ag++}}},Cg=lg=>{lg.type==="text"&&this.concatTextIdListObj&&this.concatTextIdListObj[lg.id]&&(Ig||(lg==null||lg.set("text",this.barcodeOptions.text),lg.updateInGroup()),sg.push(lg))};if(eg.length>0)eg.forEach(lg=>{ag(lg),Cg(lg)});else{const lg=Ag=>{Ag.type==="group"&&Ag._objects?Ag._objects.forEach(cg=>lg(cg)):(ag(Ag),Cg(Ag))};(ig=this.canvas)==null||ig.getObjects().forEach(Ag=>lg(Ag))}return Ig?(og=ng.join(""),this.barcodeOptions.text=og,this.dirty=!0,this._cache.update=!0,gg&&this.updateInGroup(),sg.forEach(lg=>{lg.updateInGroup(),lg==null||lg.set("text",og)}),setTimeout(()=>{var lg;(lg=this.canvas)==null||lg.requestRenderAll()},0),og):""}else return""}toObject(eg){let gg=["barcodeOptions","connectObjIds","concatTextIdListObj","counterProps","increaseDate","barcodeDateFormatType"];return super.toObject(eg?[...eg,...gg]:gg)}};Pl.type="Barcode";let ABarcode=Pl;ABarcode.fromObject=(tg,eg)=>ABarcode._fromObject(tg,{...eg,extraParam:"barcodeOptions"}),tt.setClass(ABarcode),tt.setSVGClass(ABarcode);function getBase64Data({x:tg=0,y:eg=0,Content:gg="",ErrLevel:ig=1,Width:Ig=0,Height:og=0,id:ng="",rWidth:sg=0,rHeight:ag=0,CellSize:Cg="8"}={},lg=""){let Ag=Ig/(og||1),cg=`${gg}-${ig}-${Ig+og}-${Ag}-${Cg}`;if(lpCodeMap.has(cg)){let rg=lpCodeMap.get(cg);return lg!=="noSaveCache"&&setCacheLpCode({sKey:cg,img:rg,rWidth:sg,rHeight:ag,x:tg,y:eg}),rg}return new Promise(async(rg,ug)=>{console.log("getLongbeiBase64Data=====");let dg=[JSON.stringify({Content:gg,ErrLevel:ig,Width:Ig,Height:og,CellSize:Cg})],mg=await window.dsapi.driverAction.DSLE_Custom_LPCodeCreate(dg);if(mg=JSON.parse(mg),mg.code===0){let bg=mg.payload;if(bg){let pg=await loadBase64ToPic(bg);lpCodeMap.set(cg,pg),lg!=="noSaveCache"&&setCacheLpCode({sKey:cg,img:pg,rWidth:sg,rHeight:ag,x:tg,y:eg}),rg(pg)}else ug("")}else ug(mg)})}function getMixBase64Data({x:tg=0,y:eg=0,Content:gg="",ErrLevel:ig="",Width:Ig=0,Height:og=0,id:ng="",DPI:sg=203,rWidth:ag=0,rHeight:Cg=0,CellSize:lg="8"}={},Ag=""){let cg=Ig/(og||1),rg=`${gg}-${ig}-${Ig+og}-${cg}-${lg}`;if(lpCodeMap.has(rg)){let ug=lpCodeMap.get(rg);return Ag!=="noSaveCache"&&setCacheMixLpCode({sKey:rg,img:ug,rWidth:ag,rHeight:Cg,x:tg,y:eg}),ug}return new Promise(async(ug,dg)=>{console.log("getMixLongbeiBase64Data=====");let mg=ig.split("-"),bg=mg[0]||"0",pg=mg[1]||"0",Zg=gg.split("|&&&|"),Gg=Zg.shift(),hg=Zg.join("")||Gg,fg=[JSON.stringify({LPContent:Gg||"",LPErrLevel:bg,QRContent:hg,QRErrLevel:pg,Width:Ig,Height:og,DPI:sg+"",CellSize:lg})],wg=await window.dsapi.driverAction.DSLE_Custom_LPMixCreate(fg);if(wg=JSON.parse(wg),wg.code===0){let yg=wg.payload;if(yg){let Bg=await loadBase64ToPic(yg);lpCodeMap.set(rg,Bg),Ag!=="noSaveCache"&&setCacheMixLpCode({sKey:rg,img:Bg,rWidth:ag,rHeight:Cg,x:tg,y:eg}),ug(Bg)}else dg("")}else dg(wg)})}function loadBase64ToPic(tg){return new Promise(async(eg,gg)=>{let ig=new Image;ig.onload=()=>{eg(ig)},ig.src=tg})}let maxCacheLength=2e3;function setCacheLpCode({x:tg=0,y:eg=0,id:gg="",sKey:ig="",img:Ig=null,rWidth:og=0,rHeight:ng=0}={}){if(!ig||!Ig||!gg)return;let sg={sKey:ig,img:Ig,rWidth:og,rHeight:ng,x:tg,y:eg};if(!cacheLpCodeMap.has(gg))cacheLpCodeMap.set(gg,[sg]);else{let ag=cacheLpCodeMap.get(gg);ag.length>maxCacheLength&&ag.splice(0,500),ag.push(sg),cacheLpCodeMap.set(gg,ag)}}function setCacheMixLpCode({x:tg=0,y:eg=0,id:gg="",sKey:ig="",img:Ig=null,rWidth:og=0,rHeight:ng=0}={}){if(!ig||!Ig||!gg)return;let sg={sKey:ig,img:Ig,rWidth:og,rHeight:ng,x:tg,y:eg};if(!cacheMixLpCodeMap.has(gg))cacheMixLpCodeMap.set(gg,[sg]);else{let ag=cacheMixLpCodeMap.get(gg);ag.length>maxCacheLength&&ag.splice(0,500),ag.push(sg),cacheMixLpCodeMap.set(gg,ag)}console.log("cacheMixLpCodeMap========",cacheMixLpCodeMap)}class cappedMap extends Map{constructor(eg=60){super(),this.limit=eg}set(eg,gg){if(!this.has(eg)&&this.size>=this.limit){const ig=this.keys().next().value;this.delete(ig)}return super.set(eg,gg)}}class fastMap extends Map{constructor(eg=60){super(),this.lastKey=null,this.limit=eg}set(eg,gg){if(!this.has(eg)&&this.size>=this.limit){const ig=this.keys().next().value;this.delete(ig)}return this.lastKey=eg,super.set(eg,gg)}getLast(){return super.get(this.lastKey)||null}}let cacheMixLpCodeMap=new fastMap(2e3),cacheLpCodeMap=new fastMap(2e3),errorLpCodeMap=new cappedMap(5555),lpCodeMap=new cappedMap(5555),lpBcid=["LPCode","LPMixQrCode"];function clearLpAndMixCacheById(tg){cacheMixLpCodeMap.has(tg)&&cacheMixLpCodeMap.delete(tg),cacheLpCodeMap.has(tg)&&cacheLpCodeMap.delete(tg)}function getLastCacheLpcode(tg){let eg=cacheLpCodeMap.get(tg);return eg?eg[eg.length-1]:null}function getLastMixCacheLpcode(tg){let eg=cacheMixLpCodeMap.get(tg);return eg?eg[eg.length-1]:null}const isff=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function addEvent(tg,eg,gg,ig){tg.addEventListener?tg.addEventListener(eg,gg,ig):tg.attachEvent&&tg.attachEvent("on".concat(eg),gg)}function removeEvent(tg,eg,gg,ig){tg.removeEventListener?tg.removeEventListener(eg,gg,ig):tg.detachEvent&&tg.detachEvent("on".concat(eg),gg)}function getMods(tg,eg){const gg=eg.slice(0,eg.length-1);for(let ig=0;ig<gg.length;ig++)gg[ig]=tg[gg[ig].toLowerCase()];return gg}function getKeys(tg){typeof tg!="string"&&(tg=""),tg=tg.replace(/\s/g,"");const eg=tg.split(",");let gg=eg.lastIndexOf("");for(;gg>=0;)eg[gg-1]+=",",eg.splice(gg,1),gg=eg.lastIndexOf("");return eg}function compareArray(tg,eg){const gg=tg.length>=eg.length?tg:eg,ig=tg.length>=eg.length?eg:tg;let Ig=!0;for(let og=0;og<gg.length;og++)ig.indexOf(gg[og])===-1&&(Ig=!1);return Ig}const _keyMap={backspace:8,"⌫":8,tab:9,clear:12,enter:13,"↩":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,arrowup:38,arrowdown:40,arrowleft:37,arrowright:39,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"⇪":20,",":188,".":190,"/":191,"`":192,"-":isff?173:189,"=":isff?61:187,";":isff?59:186,"'":222,"{":219,"}":221,"[":219,"]":221,"\\":220},_modifier={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,meta:91,command:91},modifierMap={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},_mods={16:!1,18:!1,17:!1,91:!1},_handlers={};for(let tg=1;tg<20;tg++)_keyMap["f".concat(tg)]=111+tg;let _downKeys=[],winListendFocus=null,_scope="all";const elementEventMap=new Map,code=tg=>_keyMap[tg.toLowerCase()]||_modifier[tg.toLowerCase()]||tg.toUpperCase().charCodeAt(0),getKey=tg=>Object.keys(_keyMap).find(eg=>_keyMap[eg]===tg),getModifier=tg=>Object.keys(_modifier).find(eg=>_modifier[eg]===tg);function setScope(tg){_scope=tg||"all"}function getScope(){return _scope||"all"}function getPressedKeyCodes(){return _downKeys.slice(0)}function getPressedKeyString(){return _downKeys.map(tg=>getKey(tg)||getModifier(tg)||String.fromCharCode(tg))}function getAllKeyCodes(){const tg=[];return Object.keys(_handlers).forEach(eg=>{_handlers[eg].forEach(gg=>{let{key:ig,scope:Ig,mods:og,shortcut:ng}=gg;tg.push({scope:Ig,shortcut:ng,mods:og,keys:ig.split("+").map(sg=>code(sg))})})}),tg}function filter(tg){const eg=tg.target||tg.srcElement,{tagName:gg}=eg;let ig=!0;const Ig=gg==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(eg.type);return(eg.isContentEditable||(Ig||gg==="TEXTAREA"||gg==="SELECT")&&!eg.readOnly)&&(ig=!1),ig}function isPressed(tg){return typeof tg=="string"&&(tg=code(tg)),_downKeys.indexOf(tg)!==-1}function deleteScope(tg,eg){let gg,ig;tg||(tg=getScope());for(const Ig in _handlers)if(Object.prototype.hasOwnProperty.call(_handlers,Ig))for(gg=_handlers[Ig],ig=0;ig<gg.length;)gg[ig].scope===tg?gg.splice(ig,1).forEach(ng=>{let{element:sg}=ng;return removeKeyEvent(sg)}):ig++;getScope()===tg&&setScope(eg||"all")}function clearModifier(tg){let eg=tg.keyCode||tg.which||tg.charCode;tg.key&&tg.key.toLowerCase()==="capslock"&&(eg=code(tg.key));const gg=_downKeys.indexOf(eg);if(gg>=0&&_downKeys.splice(gg,1),tg.key&&tg.key.toLowerCase()==="meta"&&_downKeys.splice(0,_downKeys.length),(eg===93||eg===224)&&(eg=91),eg in _mods){_mods[eg]=!1;for(const ig in _modifier)_modifier[ig]===eg&&(hotkeys[ig]=!1)}}function unbind(tg){if(typeof tg>"u")Object.keys(_handlers).forEach(Ig=>{Array.isArray(_handlers[Ig])&&_handlers[Ig].forEach(og=>eachUnbind(og)),delete _handlers[Ig]}),removeKeyEvent(null);else if(Array.isArray(tg))tg.forEach(Ig=>{Ig.key&&eachUnbind(Ig)});else if(typeof tg=="object")tg.key&&eachUnbind(tg);else if(typeof tg=="string"){for(var eg=arguments.length,gg=new Array(eg>1?eg-1:0),ig=1;ig<eg;ig++)gg[ig-1]=arguments[ig];let[Ig,og]=gg;typeof Ig=="function"&&(og=Ig,Ig=""),eachUnbind({key:tg,scope:Ig,method:og,splitKey:"+"})}}const eachUnbind=tg=>{let{key:eg,scope:gg,method:ig,splitKey:Ig="+"}=tg;getKeys(eg).forEach(ng=>{const sg=ng.split(Ig),ag=sg.length,Cg=sg[ag-1],lg=Cg==="*"?"*":code(Cg);if(!_handlers[lg])return;gg||(gg=getScope());const Ag=ag>1?getMods(_modifier,sg):[],cg=[];_handlers[lg]=_handlers[lg].filter(rg=>{const dg=(ig?rg.method===ig:!0)&&rg.scope===gg&&compareArray(rg.mods,Ag);return dg&&cg.push(rg.element),!dg}),cg.forEach(rg=>removeKeyEvent(rg))})};function eventHandler(tg,eg,gg,ig){if(eg.element!==ig)return;let Ig;if(eg.scope===gg||eg.scope==="all"){Ig=eg.mods.length>0;for(const og in _mods)Object.prototype.hasOwnProperty.call(_mods,og)&&(!_mods[og]&&eg.mods.indexOf(+og)>-1||_mods[og]&&eg.mods.indexOf(+og)===-1)&&(Ig=!1);(eg.mods.length===0&&!_mods[16]&&!_mods[18]&&!_mods[17]&&!_mods[91]||Ig||eg.shortcut==="*")&&(eg.keys=[],eg.keys=eg.keys.concat(_downKeys),eg.method(tg,eg)===!1&&(tg.preventDefault?tg.preventDefault():tg.returnValue=!1,tg.stopPropagation&&tg.stopPropagation(),tg.cancelBubble&&(tg.cancelBubble=!0)))}}function dispatch(tg,eg){const gg=_handlers["*"];let ig=tg.keyCode||tg.which||tg.charCode;if(tg.key&&tg.key.toLowerCase()==="capslock"||!hotkeys.filter.call(this,tg))return;if((ig===93||ig===224)&&(ig=91),_downKeys.indexOf(ig)===-1&&ig!==229&&_downKeys.push(ig),["metaKey","ctrlKey","altKey","shiftKey"].forEach(sg=>{const ag=modifierMap[sg];tg[sg]&&_downKeys.indexOf(ag)===-1?_downKeys.push(ag):!tg[sg]&&_downKeys.indexOf(ag)>-1?_downKeys.splice(_downKeys.indexOf(ag),1):sg==="metaKey"&&tg[sg]&&(_downKeys=_downKeys.filter(Cg=>Cg in modifierMap||Cg===ig))}),ig in _mods){_mods[ig]=!0;for(const sg in _modifier)if(Object.prototype.hasOwnProperty.call(_modifier,sg)){const ag=modifierMap[_modifier[sg]];hotkeys[sg]=tg[ag]}if(!gg)return}for(const sg in _mods)Object.prototype.hasOwnProperty.call(_mods,sg)&&(_mods[sg]=tg[modifierMap[sg]]);tg.getModifierState&&!(tg.altKey&&!tg.ctrlKey)&&tg.getModifierState("AltGraph")&&(_downKeys.indexOf(17)===-1&&_downKeys.push(17),_downKeys.indexOf(18)===-1&&_downKeys.push(18),_mods[17]=!0,_mods[18]=!0);const Ig=getScope();if(gg)for(let sg=0;sg<gg.length;sg++)gg[sg].scope===Ig&&(tg.type==="keydown"&&gg[sg].keydown||tg.type==="keyup"&&gg[sg].keyup)&&eventHandler(tg,gg[sg],Ig,eg);if(!(ig in _handlers))return;const og=_handlers[ig],ng=og.length;for(let sg=0;sg<ng;sg++)if((tg.type==="keydown"&&og[sg].keydown||tg.type==="keyup"&&og[sg].keyup)&&og[sg].key){const ag=og[sg],{splitKey:Cg}=ag,lg=ag.key.split(Cg),Ag=[];for(let cg=0;cg<lg.length;cg++)Ag.push(code(lg[cg]));Ag.sort().join("")===_downKeys.sort().join("")&&eventHandler(tg,ag,Ig,eg)}}function hotkeys(tg,eg,gg){_downKeys=[];const ig=getKeys(tg);let Ig=[],og="all",ng=document,sg=0,ag=!1,Cg=!0,lg="+",Ag=!1,cg=!1;for(gg===void 0&&typeof eg=="function"&&(gg=eg),Object.prototype.toString.call(eg)==="[object Object]"&&(eg.scope&&(og=eg.scope),eg.element&&(ng=eg.element),eg.keyup&&(ag=eg.keyup),eg.keydown!==void 0&&(Cg=eg.keydown),eg.capture!==void 0&&(Ag=eg.capture),typeof eg.splitKey=="string"&&(lg=eg.splitKey),eg.single===!0&&(cg=!0)),typeof eg=="string"&&(og=eg),cg&&unbind(tg,og);sg<ig.length;sg++)tg=ig[sg].split(lg),Ig=[],tg.length>1&&(Ig=getMods(_modifier,tg)),tg=tg[tg.length-1],tg=tg==="*"?"*":code(tg),tg in _handlers||(_handlers[tg]=[]),_handlers[tg].push({keyup:ag,keydown:Cg,scope:og,mods:Ig,shortcut:ig[sg],method:gg,key:ig[sg],splitKey:lg,element:ng});if(typeof ng<"u"&&window){if(!elementEventMap.has(ng)){const rg=function(){let dg=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;return dispatch(dg,ng)},ug=function(){let dg=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;dispatch(dg,ng),clearModifier(dg)};elementEventMap.set(ng,{keydownListener:rg,keyupListenr:ug,capture:Ag}),addEvent(ng,"keydown",rg,Ag),addEvent(ng,"keyup",ug,Ag)}if(!winListendFocus){const rg=()=>{_downKeys=[]};winListendFocus={listener:rg,capture:Ag},addEvent(window,"focus",rg,Ag)}}}function trigger(tg){let eg=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"all";Object.keys(_handlers).forEach(gg=>{_handlers[gg].filter(Ig=>Ig.scope===eg&&Ig.shortcut===tg).forEach(Ig=>{Ig&&Ig.method&&Ig.method()})})}function removeKeyEvent(tg){const eg=Object.values(_handlers).flat();if(eg.findIndex(ig=>{let{element:Ig}=ig;return Ig===tg})<0){const{keydownListener:ig,keyupListenr:Ig,capture:og}=elementEventMap.get(tg)||{};ig&&Ig&&(removeEvent(tg,"keyup",Ig,og),removeEvent(tg,"keydown",ig,og),elementEventMap.delete(tg))}if((eg.length<=0||elementEventMap.size<=0)&&(Object.keys(elementEventMap).forEach(Ig=>{const{keydownListener:og,keyupListenr:ng,capture:sg}=elementEventMap.get(Ig)||{};og&&ng&&(removeEvent(Ig,"keyup",ng,sg),removeEvent(Ig,"keydown",og,sg),elementEventMap.delete(Ig))}),elementEventMap.clear(),Object.keys(_handlers).forEach(Ig=>delete _handlers[Ig]),winListendFocus)){const{listener:Ig,capture:og}=winListendFocus;removeEvent(window,"focus",Ig,og),winListendFocus=null}}const _api={getPressedKeyString,setScope,getScope,deleteScope,getPressedKeyCodes,getAllKeyCodes,isPressed,filter,trigger,unbind,keyMap:_keyMap,modifier:_modifier,modifierMap};for(const tg in _api)Object.prototype.hasOwnProperty.call(_api,tg)&&(hotkeys[tg]=_api[tg]);if(typeof window<"u"){const tg=window.hotkeys;hotkeys.noConflict=eg=>(eg&&window.hotkeys===hotkeys&&(window.hotkeys=tg),hotkeys),window.hotkeys=hotkeys}class EditorData{constructor(){this.enabled=!0,this.dirty=!1,this.originState="",this.hasSetActiveSelection=!1,this.handle={selectionHandles:new Set,modifyHandles:new Set,mouseDownHandles:new Set,mouseUpHandles:new Set,doubleClickHandles:new Set,objectUpdateHandles:new Set,mouseOverHandles:new Set,mouseOutHandles:new Set,checkDirtyHandles:new Set},this.selectHandle=eg=>{if(this.enabled)for(const gg of this.handle.selectionHandles)if(eg.selected){const ig=this.canvas.getActiveObject();gg(eg.e,ig?[ig]:[]),this.canvas&&this.canvas.elements.container.focus({preventScroll:!0})}else gg(eg.e,[])},this.modifyHandle=throttle$3(eg=>{if(!(!this.enabled||this.isWorkspace(eg.target))){if(eg.target)for(const gg of this.handle.modifyHandles)gg(eg.e,eg.target);this.checkDirty(eg)}},200),this.doubleClickHandle=eg=>{var gg,ig;if(!(!this.enabled||this.isWorkspace(eg.target))&&eg.target){eg.target.type==="table"&&eg.scenePoint&&((ig=(gg=eg.target).handleCellDoubleClick)==null||ig.call(gg,eg.scenePoint));for(const Ig of this.handle.doubleClickHandles)Ig(eg.e,eg.target)}},this.mouseDownHandle=eg=>{if(!(!this.enabled||this.isWorkspace(eg.target))&&eg.target)for(const gg of this.handle.mouseDownHandles)gg(eg.e,eg.target)},this.mouseUpHandle=eg=>{if(!(!this.enabled||this.isWorkspace(eg.target))&&eg.target)for(const gg of this.handle.mouseUpHandles)gg(eg.e,eg.target)},this.checkDirty=debounce$2(eg=>{if(!this.canvas)return!1;const gg=this.canvas.toJSON(),ig=JSON.stringify(gg);this.originState||(this.originState=ig),this.dirty=this.originState!==ig,eg.isToDirty&&(this.dirty=!0),console.log("this.dirty=========",this.dirty);for(const Ig of this.handle.checkDirtyHandles)Ig();return this.dirty},100),this.objectUpdateHandle=debounce$2(eg=>{if(!(!this.enabled||this.isWorkspace(eg.target))){for(const gg of this.handle.objectUpdateHandles)gg(eg.target);this.checkDirty(eg)}},100),this.mouseOver=eg=>{for(const gg of this.handle.mouseOverHandles)gg()},this.mouseOut=eg=>{for(const gg of this.handle.mouseOutHandles)gg()}}init(eg){this.editor=eg,this.canvas=eg.getCanvas(),this.bind(),this.originState=JSON.stringify(this.canvas.toJSON())}getActiveObject(){return this.canvas.getActiveObject()}getActiveObjects(){return this.canvas.getActiveObjects()}getObjects(){return this.canvas.getObjects()||[]}getAllObjects(){if(!this.canvas)return[];const eg=[];function gg(ig){ig.type==="group"&&ig._objects?ig._objects.forEach(Ig=>gg(Ig)):ig.id!=="workspace"&&eg.push(ig)}return this.canvas.getObjects().forEach(ig=>gg(ig)),eg}clearActiveSelection(){this.canvas&&this.hasSetActiveSelection&&(this.canvas.discardActiveObject(),this.canvas.requestRenderAll(),this.hasSetActiveSelection=!1)}setObjectsActive(eg){if(!(!this.canvas||eg.length===0)){if(eg.length===1)this.canvas.setActiveObject(eg[0]);else{this.hasSetActiveSelection=!0;const gg=new Jo(eg,{canvas:this.canvas});this.canvas.setActiveObject(gg)}this.canvas.requestRenderAll()}}getObjectsList(){if(!this.canvas)return[];const eg=this.canvas.getObjects(),gg=[];for(const ig of eg)if(ig.id!=="workspace"&&ig.drawObjectType!=="ignoreObject"){if(ig instanceof Jo)continue;ig.parent?ig.parent instanceof Jo?gg.push(ig):console.log("obj.parent isn't ActiveSelection",ig.parent,ig.parent.type):gg.push(ig)}return gg}setActiveObjectProps(eg,gg=!0){if(this.canvas){const ig=this.canvas.getActiveObject();if(ig){for(const Ig in eg)console.error("objet set",Ig,eg[Ig]),ig.type==="text"?(Ig==="fontStyle"&&eg[Ig]==="italic"?ig.set("hasSetItalic",!0):Ig==="fontStyle"&&eg[Ig]==="normal"?ig.set("hasSetItalic",!1):ig.set(Ig,eg[Ig]),ig.splitByGrapheme&&ig.verticalTypeChange()):ig.set(Ig,eg[Ig]);return gg&&this.canvas.fire("custom:object:history",{target:ig,action:"history:update"}),!0}}return!1}setActiveObjectPos(eg){var gg;this.setActiveObjectProps(eg)&&((gg=this.canvas)==null||gg.getActiveObject().setCoords())}updateCanvas(){this.canvas.renderAll()}addModifyHandle(eg){this.handle.modifyHandles.add(eg)}addSelectionHandle(eg){this.handle.selectionHandles.add(eg)}addMouseDownHandle(eg){this.handle.mouseDownHandles.add(eg)}addMouseUpHandle(eg){this.handle.mouseUpHandles.add(eg)}addDoubleClickHandle(eg){this.handle.doubleClickHandles.add(eg)}addObjectUpdateHandle(eg){this.handle.objectUpdateHandles.add(eg)}addMouseOverHandle(eg){this.handle.mouseOverHandles.add(eg)}addMouseOutHandle(eg){this.handle.mouseOutHandles.add(eg)}removeMouseOverHandle(eg){this.handle.mouseOverHandles.delete(eg)}removeMouseOutHandle(eg){this.handle.mouseOutHandles.delete(eg)}removeModifyHandle(eg){this.handle.modifyHandles.delete(eg)}removeSelectionHandle(eg){this.handle.selectionHandles.delete(eg)}removeMouseDownHandle(eg){this.handle.mouseDownHandles.delete(eg)}removeMouseUpHandle(eg){this.handle.mouseUpHandles.delete(eg)}removeDoubleClickHandle(eg){this.handle.doubleClickHandles.delete(eg)}remvoeObjectUpdateHandle(eg){this.handle.objectUpdateHandles.delete(eg)}addCheckDirtyHandles(eg){this.handle.checkDirtyHandles.add(eg)}removeCheckDirtyHandles(eg){this.handle.checkDirtyHandles.delete(eg)}setOriginState(){if(!this.canvas)return!1;const eg=this.canvas.toJSON(),gg=JSON.stringify(eg);this.originState=gg}isWorkspace(eg){return eg&&eg.id==="workspace"}setEnabled(eg){this.enabled=eg}bind(){if(!this.canvas)return;const eg=this.canvas;eg.on("selection:created",this.selectHandle),eg.on("selection:updated",this.selectHandle),eg.on("selection:cleared",this.selectHandle),eg.on("object:modified",this.modifyHandle),eg.on("object:scaling",this.modifyHandle),eg.on("object:rotating",this.modifyHandle),eg.on("object:moving",this.modifyHandle),eg.on("object:skewing",this.modifyHandle),eg.on("custom:object:changed",this.modifyHandle),eg.on("custom:object:basechanged",this.modifyHandle),eg.on("mouse:dblclick",this.doubleClickHandle),eg.on("mouse:down",this.mouseDownHandle),eg.on("mouse:up",this.mouseUpHandle),eg.on("object:added",this.objectUpdateHandle),eg.on("object:removed",this.objectUpdateHandle),eg.on("custom:object:checkdirty",this.checkDirty),this.editor.on("group",this.objectUpdateHandle),this.editor.on("ungroup",this.objectUpdateHandle)}unbind(){if(!this.canvas)return;const eg=this.canvas;eg.off("selection:created",this.selectHandle),eg.off("selection:updated",this.selectHandle),eg.off("selection:cleared",this.selectHandle),eg.off("object:modified",this.modifyHandle),eg.off("object:scaling",this.modifyHandle),eg.off("object:rotating",this.modifyHandle),eg.off("object:moving",this.modifyHandle),eg.off("object:skewing",this.modifyHandle),eg.off("custom:object:changed",this.modifyHandle),eg.off("custom:object:basechanged",this.modifyHandle),eg.off("mouse:dblclick",this.doubleClickHandle),eg.off("mouse:down",this.mouseDownHandle),eg.off("mouse:up",this.mouseUpHandle),eg.off("object:added",this.objectUpdateHandle),eg.off("object:removed",this.objectUpdateHandle),eg.off("custom:object:checkdirty",this.checkDirty),this.editor.off("group",this.objectUpdateHandle),this.editor.off("ungroup",this.objectUpdateHandle)}}const byteToHex=[];for(let tg=0;tg<256;++tg)byteToHex.push((tg+256).toString(16).slice(1));function unsafeStringify(tg,eg=0){return(byteToHex[tg[eg+0]]+byteToHex[tg[eg+1]]+byteToHex[tg[eg+2]]+byteToHex[tg[eg+3]]+"-"+byteToHex[tg[eg+4]]+byteToHex[tg[eg+5]]+"-"+byteToHex[tg[eg+6]]+byteToHex[tg[eg+7]]+"-"+byteToHex[tg[eg+8]]+byteToHex[tg[eg+9]]+"-"+byteToHex[tg[eg+10]]+byteToHex[tg[eg+11]]+byteToHex[tg[eg+12]]+byteToHex[tg[eg+13]]+byteToHex[tg[eg+14]]+byteToHex[tg[eg+15]]).toLowerCase()}let getRandomValues;const rnds8=new Uint8Array(16);function rng(){if(!getRandomValues){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");getRandomValues=crypto.getRandomValues.bind(crypto)}return getRandomValues(rnds8)}const randomUUID=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),native={randomUUID};function v4(tg,eg,gg){var Ig;if(native.randomUUID&&!tg)return native.randomUUID();tg=tg||{};const ig=tg.random??((Ig=tg.rng)==null?void 0:Ig.call(tg))??rng();if(ig.length<16)throw new Error("Random bytes length must be >= 16");return ig[6]=ig[6]&15|64,ig[8]=ig[8]&63|128,unsafeStringify(ig)}function handleConcatBarcode2d(tg,eg,gg=!0,ig=null){if(tg){let Ig=[],og=getAllObjectMap(eg);Ig=[...og.text,...og.counter];let ng=[...og.barcode2d],sg=[...og.barcode],ag={};ng.forEach(lg=>{ag[lg.id]=lg});let Cg={};sg.forEach(lg=>{Cg[lg.id]=lg});for(let lg of Object.keys(tg)){if(ng.length){let Ag=ag[lg];if(!Ag)return;let cg=!0;if(ig&&ig.type==="counter"&&ig.data==="2"&&(Ag.barcode2dOptions.bcid==="LPCode"?(cg=!Ag.hasLpemit,Ag.hasLpemit=!0):Ag.barcode2dOptions.bcid==="LPMixQrCode"&&(cg=!Ag.hasLpMixemit,Ag.hasLpMixemit=!0)),!cg)return;canvasEventBus.emit(`update:barcode2d:${lg}`,{list:Ig,callback:rg=>{Ag.dirty=!0,Ag.barcode2dOptions.text=rg||Ag.barcode2dOptions.text,Ag.updateInGroup(),gg&&setTimeout(()=>{eg==null||eg.requestRenderAll()},30)}})}if(sg.length){let Ag=Cg[lg];if(!Ag)return;canvasEventBus.emit(`update:barcode:${lg}`,{list:Ig,callback:cg=>{Ag.dirty=!0,Ag.barcodeOptions.text=cg||Ag.barcodeOptions.text,Ag.updateInGroup(),gg&&setTimeout(()=>{eg==null||eg.requestRenderAll(),Ag.group&&setTimeout(()=>{Ag.updateInGroup(),eg==null||eg.requestRenderAll()},0)},30)}})}}}}function addHandle(tg,eg,gg){if(tg){let ig={},Ig=getAllObjectMap(eg);[...Ig.barcode2d,...Ig.barcode].forEach(ng=>{ig[ng.id]=ng});for(let ng of Object.keys(tg)){let sg=ig[ng];if(sg){let ag=sg.connectObjIds||[],Cg=cacheObj[gg];Cg&&(ag.some(lg=>lg.id===Cg.id)||(ag.splice(Cg.index,0,Cg),sg.set("connectObjIds",ag)))}}}}let cacheObj={};function deleteHandle(tg,eg,gg){if(tg){let ig={},Ig=getAllObjectMap(eg);[...Ig.barcode2d,...Ig.barcode].forEach(ng=>{ig[ng.id]=ng});for(let ng of Object.keys(tg)){let sg=ig[ng];if(sg){let ag=sg.connectObjIds||[];ag=ag.filter(Cg=>(Cg.id===gg&&(cacheObj[gg]=Cg),Cg.id!==gg)),sg.set("connectObjIds",ag)}}}}const eC=class eC extends No{constructor(eg,gg){if(super(eg,gg),this.hasSetSplit=!1,this.objectCaching=!0,this.hasSetItalic=!1,this.isClearCopyTextStyle=!1,this.propsMinHeight=0,this.strokeUniform=!0,this.isBgBlackColor=!1,this.customExportFields={varnish:"none"},this.backgroundColor="",this.connectBar2dMap=null,this.__canvasRef=null,this.verticalType="top",this.arcEnable=!1,this.arcRadius=100,this._originGetTopOffset=this._getTopOffset?this._getTopOffset.bind(this):()=>0,gg.hasSetItalic&&(this.hasSetItalic=gg.hasSetItalic),gg.propsMinHeight){this.propsMinHeight=gg.propsMinHeight;let ig=Math.max(this.height,this.propsMinHeight);this.height=ig}gg.verticalType&&(this.verticalType=gg.verticalType),gg.backgroundColor&&(this.backgroundColor=gg.backgroundColor),this.isBgBlackColor=gg.isBgBlackColor??this.isBgBlackColor,this.connectBar2dMap=gg.connectBar2dMap??this.connectBar2dMap,gg.arcEnable!==void 0&&(this.arcEnable=gg.arcEnable),gg.arcRadius!==void 0&&(this.arcRadius=gg.arcRadius),this.on("removed",ig=>{if(ig.target.type!=="activeselection"){if(this.inGroupRemove){this.inGroupRemove=!1;return}deleteHandle(this.connectBar2dMap,this.__canvasRef,this.id)}}),this.on("added",()=>{this.__canvasRef=this.canvas,addHandle(this.connectBar2dMap,this.__canvasRef,this.id)}),this.on("modified",ig=>{(ig==null?void 0:ig.action)!=="drag"&&this.type==="text"&&(this.verticalTypeChange(),this.tiggerHandleConcatBarcode2d())}),this.on("changed",()=>{this.type==="text"&&this.verticalTypeChange()}),this.verticalTypeChange()}tiggerHandleConcatBarcode2d(){this.connectBar2dMap&&handleConcatBarcode2d(this.connectBar2dMap,this.canvas)}updateInGroup(){this.dirty=!0,this.setCoords();let eg=this.group;for(;eg;)eg.dirty=!0,eg==null||eg.triggerLayout("childUpdate"),eg.setCoords(),eg=eg.group}_calcTextHeight(){const eg=this._textLines&&this._textLines.length||0,gg=this.fontSize*this.lineHeight,ig=(this.padding||0)*2;return eg*gg+ig}verticalTypeChange(){var gg;if(!this.splitByGrapheme||!this.propsMinHeight)return;const eg=Math.max(this._calcTextHeight(),this.propsMinHeight);this.height!==eg&&(this.height=eg),this.verticalType==="top"?this._getTopOffset=this._originGetTopOffset:this.verticalType==="vcenter"?this._getTopOffset=()=>{let ig=this._calcTextHeight();return(this.fontSize*this.lineHeight-this.fontSize)/2-ig/2}:this.verticalType==="bottom"&&(this._getTopOffset=()=>{const ig=this._calcTextHeight(),og=Math.max(ig,this.propsMinHeight)-ig;return this._originGetTopOffset()+og}),this.setCoords(),(gg=this.canvas)==null||gg.requestRenderAll()}set(eg,gg){return(eg==="fill"||eg==="stroke"||eg==="underline"||eg==="overline"||eg==="linethrough"||eg==="fontWeight"||eg==="fontStyle")&&(this.styles={}),super.set(eg,gg)}set locked(eg){super.locked=eg,this.editable=!eg}get locked(){return super.locked}_measureLine(eg){let gg=this._textLines[eg];return Array.isArray(gg)&&(gg=gg.map(ig=>ig.replace(" "," "))),this._textLines[eg]=gg,super._measureLine(eg)}getStandardSpaceWidth(eg=" ",gg="Arial"){const Ig=kn.createCanvasElement().getContext("2d");let og=0;return Ig&&(Ig.font=`${this.fontSize}px ${gg}`,og=Ig.measureText(eg).width),og}getTextWidth(eg="",gg=0,ig="Arial"){const og=kn.createCanvasElement().getContext("2d");let ng=0;return og&&(og.font=`${gg}px ${ig}`,ng=og.measureText(eg).width),ng}getTextHeight(eg="测",gg=!0){const Ig=kn.createCanvasElement().getContext("2d");let og=0;if(Ig){Ig.font=`${this.fontSize}px ${this.fontFamily}`;let ng=Ig.measureText(eg);og=ng.fontBoundingBoxAscent+ng.fontBoundingBoxDescent+(gg?Math.trunc(this.fontSize/3):0)}return og*this._textLines.length}_measureChar(eg,gg,ig,Ig){if(eg!==" "&&eg!==" ")return super._measureChar(eg,gg,ig,Ig);{const og=this.getStandardSpaceWidth(" ",this.fontFamily);return{width:og,kernedWidth:og}}}parseColor(eg){if(!eg)return null;if(eg.startsWith("#")){let ig=eg.slice(1);ig.length===3&&(ig=ig.split("").map(og=>og+og).join(""));const Ig=parseInt(ig,16);return{r:Ig>>16&255,g:Ig>>8&255,b:Ig&255,a:1}}const gg=eg.match(/rgba?\(([^)]+)\)/);if(gg){const[ig,Ig,og,ng=1]=gg[1].split(",").map(sg=>Number(sg.trim()));return{r:ig,g:Ig,b:og,a:ng}}return null}luminance({r:eg,g:gg,b:ig}){return .2126*eg+.7152*gg+.0722*ig}isDark(eg,gg=40){const ig=this.parseColor(eg);return ig?this.luminance(ig)<=gg:!1}_renderArcText(eg){const gg=this.text.replace(/\u00A0/g," "),ig=this.fontSize,Ig=Math.abs(this.arcRadius),og=this.arcRadius>=0;eg.save(),eg.font=`${this.fontStyle==="italic"||this.hasSetItalic?"italic ":""}${this.fontWeight==="bold"?"bold ":""}${ig}px ${this.fontFamily}`,eg.fillStyle=this.fill||"#000000",eg.textAlign="center",eg.textBaseline="middle";const ng=(this.charSpacing||0)/1e3*ig,sg=[];let ag=0;for(const ug of gg){const dg=eg.measureText(ug).width+ng;sg.push(dg),ag+=dg}const Cg=ag/Ig,lg=Ig-Ig*Math.cos(Cg/2),Ag=og?Ig-lg/2:-(Ig-lg/2);let rg=(og?-Math.PI/2:Math.PI/2)-Cg/2;for(let ug=0;ug<gg.length;ug++){const dg=gg[ug],mg=sg[ug]/2,bg=rg+mg/Ig,pg=Math.cos(bg)*Ig,Zg=Math.sin(bg)*Ig;eg.save(),eg.translate(pg,Ag+Zg),og?eg.rotate(bg+Math.PI/2):eg.rotate(bg-Math.PI/2),eg.fillText(dg,0,0),eg.restore(),rg+=sg[ug]/Ig}eg.restore()}_getArcParams(){const eg=this.text.replace(/\u00A0/g," "),gg=this.fontSize,ig=Math.abs(this.arcRadius),Ig=this.arcRadius>=0,ng=kn.createCanvasElement().getContext("2d");ng.font=`${this.fontStyle==="italic"||this.hasSetItalic?"italic ":""}${this.fontWeight==="bold"?"bold ":""}${gg}px ${this.fontFamily}`;const sg=(this.charSpacing||0)/1e3*gg,ag=[];let Cg=0;for(const ug of eg){const dg=ng.measureText(ug).width+sg;ag.push(dg),Cg+=dg}const lg=Cg/ig,Ag=ig-ig*Math.cos(lg/2),cg=Ig?ig-Ag/2:-(ig-Ag/2),rg=Ig?-Math.PI/2:Math.PI/2;return{text:eg,fontSize:gg,r:ig,bendUp:Ig,charWidths:ag,totalWidth:Cg,totalAngle:lg,sagitta:Ag,circleCenterOffsetY:cg,baseAngle:rg}}_getArcCursorInfo(eg){const{text:gg,r:ig,bendUp:Ig,charWidths:og,totalAngle:ng,circleCenterOffsetY:sg,baseAngle:ag}=this._getArcParams();let Cg=0;for(let mg=0;mg<Math.min(eg,gg.length);mg++)Cg+=og[mg]/ig;const lg=ag-ng/2+Cg,Ag=Math.cos(lg)*ig,cg=Math.sin(lg)*ig,rg=Ag,ug=sg+cg,dg=Ig?lg+Math.PI/2:lg-Math.PI/2;return{x:rg,y:ug,angle:dg}}_calcArcBoundingBox(){const{text:eg,r:gg,bendUp:ig,charWidths:Ig,totalAngle:og,circleCenterOffsetY:ng,baseAngle:sg}=this._getArcParams(),ag=this.fontSize,Cg=ag/2+4;if(!eg.length)return{w:ag+Cg*2,h:ag*1.2+Cg*2};let lg=1/0,Ag=-1/0,cg=1/0,rg=-1/0,ug=sg-og/2;for(let bg=0;bg<eg.length;bg++){const pg=ug,Zg=ug+Ig[bg]/gg,Gg=(pg+Zg)/2,hg=Math.cos(Gg)*gg,fg=Math.sin(Gg)*gg,wg=hg,yg=ng+fg,Bg=ig?Gg+Math.PI/2:Gg-Math.PI/2,Wg=Math.cos(Bg),$g=Math.sin(Bg),Ng=Ig[bg]/2+Cg,Vg=ag/2+Cg,Mg=[{dx:-Ng,dy:-Vg},{dx:Ng,dy:-Vg},{dx:Ng,dy:Vg},{dx:-Ng,dy:Vg}];for(const{dx:Yg,dy:Sg}of Mg){const vg=wg+Yg*Wg-Sg*$g,Rg=yg+Yg*$g+Sg*Wg;vg<lg&&(lg=vg),vg>Ag&&(Ag=vg),Rg<cg&&(cg=Rg),Rg>rg&&(rg=Rg)}ug=Zg}const dg=Ag-lg,mg=rg-cg;return{w:Math.max(dg,1),h:Math.max(mg,1)}}initDimensions(){if(this.arcEnable&&!this.splitByGrapheme){this._splitText(),this._clearCache(),this.dirty=!0;const eg=this._calcArcBoundingBox();this.width=eg.w,this.height=eg.h}else super.initDimensions()}_render(eg){this.arcEnable&&!this.splitByGrapheme?this._renderArcText(eg):super._render(eg)}__getCursorBoundariesOffsets(eg){if(this.arcEnable&&!this.splitByGrapheme){const{charIndex:gg}=this.get2DCursorLocation(eg),ig=this._getArcCursorInfo(gg);return{left:ig.x+this.width/2,top:ig.y+this.height/2}}return super.__getCursorBoundariesOffsets(eg)}_renderCursor(eg,gg,ig){if(this.arcEnable&&!this.splitByGrapheme){const{charIndex:Ig}=this.get2DCursorLocation(ig),og=this._getArcCursorInfo(Ig),ng=this.fontSize,sg=this.getObjectScaling().x*this.canvas.getZoom(),ag=this.cursorWidth/sg;eg.save(),eg.fillStyle=this.cursorColor||this.fill||"#000000",eg.globalAlpha=this._currentCursorOpacity,eg.translate(og.x,og.y),eg.rotate(og.angle),eg.fillRect(-ag/2,-ng/2,ag,ng),eg.restore()}else super._renderCursor(eg,gg,ig)}getSelectionStartFromPointer(eg){if(this.arcEnable&&!this.splitByGrapheme){const gg=this.canvas.getScenePoint(eg).transform(kn.invertTransform(this.calcTransformMatrix())),{text:ig,r:Ig,bendUp:og,charWidths:ng,totalAngle:sg,circleCenterOffsetY:ag,baseAngle:Cg}=this._getArcParams();let lg=1/0,Ag=0,cg=Cg-sg/2;for(let rg=0;rg<=ig.length;rg++){const ug=cg,dg=Math.cos(ug)*Ig,mg=Math.sin(ug)*Ig,bg=dg,pg=ag+mg,Zg=gg.x-bg,Gg=gg.y-pg,hg=Zg*Zg+Gg*Gg;hg<lg&&(lg=hg,Ag=rg),rg<ig.length&&(cg+=ng[rg]/Ig)}return Math.min(Ag,this._text.length)}return super.getSelectionStartFromPointer(eg)}_renderSelection(eg,gg,ig){if(this.arcEnable&&!this.splitByGrapheme){const{text:Ig,r:og,bendUp:ng,charWidths:sg,totalAngle:ag,circleCenterOffsetY:Cg,baseAngle:lg}=this._getArcParams(),Ag=this.fontSize,cg=Math.min(gg.selectionStart,gg.selectionEnd),rg=Math.max(gg.selectionStart,gg.selectionEnd);eg.save(),eg.fillStyle=this.selectionColor||"rgba(0,0,255,0.3)";let ug=lg-ag/2;for(let dg=0;dg<Ig.length;dg++){const mg=ug,bg=ug+sg[dg]/og,pg=(mg+bg)/2;if(dg>=cg&&dg<rg){const Zg=Math.cos(pg)*og,Gg=Math.sin(pg)*og,hg=Zg,fg=Cg+Gg,wg=ng?pg+Math.PI/2:pg-Math.PI/2;eg.save(),eg.translate(hg,fg),eg.rotate(wg),eg.fillRect(-sg[dg]/2,-Ag/2,sg[dg],Ag),eg.restore()}ug=bg}eg.restore()}else super._renderSelection(eg,gg,ig)}render(eg){if(eg.shadowBlur=0,eg.shadowColor="transparent",eg.imageSmoothingEnabled=!1,eg.textRendering="geometricPrecision",this.isClearCopyTextStyle&&(this.styles={},this.isClearCopyTextStyle=!1),this.splitByGrapheme){let ig=this.width*this.scaleX,Ig=this.height*this.scaleY,og=this.getTextHeight();Ig<og&&(Ig=og),this.hasSetSplit=!0,(ig!==this.width||Ig!==this.height||this.scaleY!==1)&&(this.set({width:ig,height:Ig,scaleX:1,scaleY:1}),this.height=Ig,this.propsMinHeight=this.height,this.setCoords())}else if(this.arcEnable){this.propsMinHeight=0,this.hasSetSplit&&(this.hasSetSplit=!1);const ig=this._calcArcBoundingBox();(this.width!==ig.w||this.height!==ig.h||this.scaleX!==1||this.scaleY!==1)&&(this.set({width:ig.w,height:ig.h,scaleX:1,scaleY:1}),this.setCoords()),this._forceClearCache=!0}else{this.propsMinHeight=0,this.hasSetSplit&&(this.hasSetSplit=!1);const ig=this.text.replace(/ /g," ");ig!==this.text&&(this.text=ig);let Ig=eg.measureText(this.text);Ig.width!==this.width&&this.set({width:Ig.width}),this._forceClearCache=!0}let gg=this.skewX;this.skewX=this.hasSetItalic?-15:0,gg!==this.skewX&&this.setCoords(),this.objectCaching=this.charSpacing<=1e5&&this.text.length<=800,this.dirty=!0,super.render(eg)}toObject(eg){let gg=["hasSetItalic","propsMinHeight","verticalType","backgroundColor","isBgBlackColor","fromBarCodeID","fromBarCode2dID","connectBar2dMap","arcEnable","arcRadius"];return super.toObject(eg?[...eg,...gg]:gg)}};eC.type="Text";let AText=eC;tt.setClass(AText);const nC=class nC extends AText{constructor(eg,gg){super("",gg),this.update=!0,this.reviewValueArgs=null,this.toStopDateUpdateBarcode=!1,this.fontSize=ptToPx$1(12),this.increaseYearVal=0,this.increaseMonthVal=0,this.increaseDayVal=0,this.charSpacing=1,this.fontFamily="微软雅黑",console.log("ACounter",eg),this.props=eg,this._props.mode==="3"&&this.updateText(),nC.isMode1Args(this._props.args)&&(this._props.args.nextValue=void 0),this.fontSize=gg.fontSize??this.fontSize,this.charSpacing=gg.charSpacing??this.charSpacing,this.fontFamily=gg.fontFamily??this.fontFamily,this.increaseYearVal=gg.increaseYearVal??this.increaseYearVal,this.increaseMonthVal=gg.increaseMonthVal??this.increaseMonthVal,this.increaseDayVal=gg.increaseDayVal??this.increaseDayVal}render(eg){console.log("_render======"),this.updateText(),super.render(eg)}reviewRecover(){if(this._props.mode==="1"&&nC.isMode1Args(this._props.args)&&this.reviewValueArgs){this._props.args=this.reviewValueArgs,this.reviewValueArgs=null;const eg=this._props.args,gg=formatCounterValue(eg);this.text=(eg.prefix&&eg.prefix.length>0?eg.prefix:"")+gg+(eg.suffix&&eg.suffix.length>0?eg.suffix:""),this.dirty=!1,this.update=!1,this._forceClearCache=!0}}countCurrent(){if(this._props.mode==="1"){const eg=this._props.args;if(!eg.value&&eg.value!==0)return"";const gg=formatCounterValue(eg);return(eg.prefix&&eg.prefix.length>0?eg.prefix:"")+gg+(eg.suffix&&eg.suffix.length>0?eg.suffix:"")}return""}countNext(eg="print"){if(this._props.mode==="1"&&nC.isMode1Args(this._props.args)){const gg=this._props.args;if(!gg.value&&gg.value!==0)return;eg==="review"&&!this.reviewValueArgs&&(this.reviewValueArgs={...gg});const ig=formatCounterValue(gg);this.text=(gg.prefix&&gg.prefix.length>0?gg.prefix:"")+ig+(gg.suffix&&gg.suffix.length>0?gg.suffix:"");const Ig=getNextCounterValue(gg);Ig!==null&&(gg.value=Ig,console.log("update value f",gg.value)),this.update=!0,this.dirty=!0,this._forceClearCache=!0}}updateText({isUpdateBarCodeDate:eg=!0}={}){if(this.update&&this._props.mode==="1")if(nC.isMode1Args(this._props.args)){const gg=this._props.args;if(!gg.value&&gg.value!==0)return;const ig=formatCounterValue(gg);this.text=(gg.prefix&&gg.prefix.length>0?gg.prefix:"")+ig+(gg.suffix&&gg.suffix.length>0?gg.suffix:""),this.dirty=!0,this._forceClearCache=!0,console.log("updateText",this.text,gg)}else return;else if(this._props.mode==="2")if(nC.isMode2Args(this._props.args)){if(!this.toStopDateUpdateBarcode){const gg=formatDate(this._props.args.format,{years:this.increaseYearVal,months:this.increaseMonthVal,days:this.increaseDayVal});console.log("formatted",this._props.args.format,gg),this.text=gg,this.dirty=!0,this._forceClearCache=!0,eg&&handleConcatBarcode2d(this.connectBar2dMap,this.canvas,!1,{type:this.type,data:this._props.mode})}}else return;else this.update&&this._props.mode==="3"&&nC.isMode3Args(this._props.args)&&(this.text=this._props.args.text,this.dirty=!0,this._forceClearCache=!0);this.set("dirty",!0),this.update&&(this.initDimensions(),this.setCoords(),this.update=!1,this.canvas&&this._props.mode!=="2"&&(handleConcatBarcode2d(this.connectBar2dMap,this.canvas),this.canvas.fire("custom:object:changed",{target:this})))}set(eg,gg){return super.set(eg,gg)}set props(eg){this.editable=eg.mode==="3",this._props=eg,this.dirty=!0,this.update=!0}get props(){return this._props}static isMode1Args(eg){return"value"in eg}static isMode2Args(eg){return"format"in eg}static isMode3Args(eg){return"text"in eg}toObject(eg){nC.isMode3Args(this._props.args)&&(this._props.args.text=this.text);let gg=["connectBar2dMap","increaseYearVal","increaseMonthVal","increaseDayVal"];return super.toObject(eg?[...eg,"_props",...gg]:["_props",...gg])}};nC.type="Counter";let ACounter=nC;ACounter.fromObject=tg=>ACounter._fromObject(tg,{extraParam:"_props"}),tt.setClass(ACounter),tt.setSVGClass(ACounter);const Yc=class Yc extends na{constructor(eg,gg){super(eg,gg),this.imgScaleType="1",this.originRatio=0,this.setGrayFilter=!1,this.isScaleOtherSidedys=!1,this.isSetSharpen=!1,this.imageAlign="leftTop",this.customExportFields={varnish:"none"},this.prevCoordsPoints=null,this.gasolineLayer="none",this.noSetOtherPrevCoordsPoints=!1,gg.imgScaleType&&(this.imgScaleType=gg.imgScaleType),gg.setGrayFilter&&(this.setGrayFilter=gg.setGrayFilter),this.isScaleOtherSidedys=gg.isScaleOtherSidedys??this.isScaleOtherSidedys,this.isSetSharpen=gg.isSetSharpen??this.isSetSharpen,this.imageAlign=gg.imageAlign??this.imageAlign,this.prevCoordsPoints=gg.prevCoordsPoints??this.prevCoordsPoints,this.gasolineLayer=gg.gasolineLayer??this.gasolineLayer}refreshAlignCoords(eg=203){var gg;if(this.prevCoordsPoints){this.setCoords();let ig=o.DPI/eg;const{bl:Ig,br:og,tl:ng,tr:sg}=this.aCoords,{bl:ag,br:Cg,tl:lg,tr:Ag}=this.prevCoordsPoints;ag.x=ag.x*ig,ag.y=ag.y*ig,Cg.x=Cg.x*ig,Cg.y=Cg.y*ig,lg.x=lg.x*ig,lg.y=lg.y*ig,Ag.x=Ag.x*ig,Ag.y=Ag.y*ig;const cg={x:0,y:0};switch(this.imageAlign){case"leftTop":break;case"leftBottom":cg.x=ag.x-Ig.x,cg.y=ag.y-Ig.y;break;case"leftCenter":let rg={x:Ig.x,y:(Ig.y-ng.y)/2},ug={x:ag.x,y:(ag.y-lg.y)/2};cg.x=ug.x-rg.x,cg.y=ug.y-rg.y;break;case"topCenter":let dg={x:(sg.x-ng.x)/2,y:sg.y},mg={x:(Ag.x-lg.x)/2,y:Ag.y};cg.x=mg.x-dg.x,cg.y=mg.y-dg.y;break;case"rightCenter":let bg={x:sg.x,y:(og.y-sg.y)/2},pg={x:Ag.x,y:(Cg.y-Ag.y)/2};cg.x=pg.x-bg.x,cg.y=pg.y-bg.y;break;case"bottomCenter":let Zg={x:(og.x-Ig.x)/2,y:og.y},Gg={x:(Cg.x-ag.x)/2,y:Cg.y};cg.x=Gg.x-Zg.x,cg.y=Gg.y-Zg.y;break;case"center":let hg={x:(sg.x-ng.x)/2,y:(Ig.y-ng.y)/2},fg={x:(Ag.x-lg.x)/2,y:(ag.y-lg.y)/2};cg.x=fg.x-hg.x,cg.y=fg.y-hg.y;break;case"rightTop":cg.x=Ag.x-sg.x,cg.y=Ag.y-sg.y;break;case"rightBottom":cg.x=Cg.x-og.x,cg.y=Cg.y-og.y;break}this.set({left:this.left+cg.x,top:this.top+cg.y}),this.setCoords(),(gg=this.canvas)==null||gg.requestRenderAll()}}_render(eg){const gg=this._element;if(!gg)return;let ig=this._filterScalingX,Ig=this._filterScalingY,og=this.width,ng=this.height,sg=Math.max(this.cropX,0),ag=Math.max(this.cropY,0),Cg=gg.naturalWidth||gg.width,lg=gg.naturalHeight||gg.height,Ag=sg*ig,cg=ag*Ig,rg=-og/2,ug=-ng/2;this.originRatio=Cg/lg;let dg=this.originRatio;this.imgScaleType==="2"?(og=this.height*dg,rg=-og/2,this.isScaleOtherSidedys&&this.width!==og&&(this.width=og,!this.noSetOtherPrevCoordsPoints&&this.setCoords())):this.imgScaleType==="3"&&(ng=this.width/dg,ug=-ng/2,this.isScaleOtherSidedys&&this.height!==ng&&(this.height=ng,!this.noSetOtherPrevCoordsPoints&&this.setCoords())),eg.save(),eg.beginPath(),eg.rect(-this.width/2,-this.height/2,this.width,this.height),eg.clip(),this.fill&&(eg.fillStyle=this.fill,eg.fillRect(-this.width/2,-this.height/2,this.width,this.height)),this.stroke&&this.strokeWidth&&(eg.strokeStyle=this.stroke,eg.lineWidth=this.strokeWidth,eg.strokeRect(-this.width/2,-this.height/2,this.width,this.height)),eg.imageSmoothingEnabled=!0,eg.imageSmoothingQuality="high",eg.drawImage(gg,Ag,cg,Cg,lg,rg,ug,og,ng),eg.restore();const mg=this.filters.findIndex(bg=>bg.type==="Grayscale");if(this.setGrayFilter&&mg<0){const bg=new bh.Grayscale;this.filters.push(bg)}else!this.setGrayFilter&&mg>=0&&this.filters.splice(mg,1);this.applyFilters(),this.canvas.leRenderEnv!=="transform"&&!this.noSetOtherPrevCoordsPoints&&(this.prevCoordsPoints=this.aCoords)}set(eg,gg){return super.set(eg,gg)}toObject(eg){let gg=["imgScaleType","setGrayFilter","isScaleOtherSidedys","isSetSharpen","imageAlign","prevCoordsPoints","gasolineLayer"];return super.toObject(eg?[...eg,...gg]:gg)}fromObject(eg){return Yc._fromObject(eg)}};Yc.type="Image";let AImage=Yc;tt.setClass(AImage),tt.setSVGClass(AImage);const rd=class rd extends ho{constructor(){super(...arguments),this.perPixelTargetFind=!0}_render(eg){eg.beginPath();const{width:gg,height:ig}=this,Ig=gg/2,og=ig/2;eg.ellipse(0,0,Ig,og,0,0,Math.PI*2),this._renderPaintInOrder(eg)}set(eg,gg){return super.set(eg,gg)}};rd.type="Circle";let ACircle=rd;tt.setClass(ACircle);class ARect extends Er{constructor(eg){super(eg),this.perPixelTargetFind=!0}set(eg,gg){return super.set(eg,gg)}}tt.setClass(ARect);class ATriangle extends vo{constructor(eg={}){super(eg),this.perPixelTargetFind=!0}set(eg,gg){return super.set(eg,gg)}}tt.setClass(ATriangle),tt.setSVGClass(ATriangle);class ALine extends mo{constructor(eg,gg={}){super(eg,gg),this.perPixelTargetFind=!0}set(eg,gg){return super.set(eg,gg)}}tt.setClass(ALine);const s0=class s0 extends na{constructor(){super(...arguments),this.hasControls=!1,this.selectable=!1,this.evented=!0,this.hoverCursor="pointer"}_renderFill(eg){const gg=this._element;if(!gg)return;const ig=this._filterScalingX,Ig=this._filterScalingY,og=this.width,ng=this.height,sg=Math.max(this.cropX,0),ag=Math.max(this.cropY,0),Cg=gg.naturalWidth||gg.width,lg=gg.naturalHeight||gg.height,Ag=sg*ig,cg=ag*Ig,rg=-og/2,ug=-ng/2;gg&&eg.drawImage(gg,Ag,cg,Cg,lg,rg,ug,og,ng)}};s0.type="Rfid";let RfidIcon=s0;tt.setClass(RfidIcon),tt.setSVGClass(RfidIcon);const a0=class a0 extends No{constructor(eg,gg){if(super(eg,gg),this.hasSetSplit=!1,this.objectCaching=!0,this.hasSetItalic=!1,this.isClearCopyTextStyle=!1,this.propsMinHeight=0,this.splitByGrapheme=!0,this.customExportFields={varnish:"none"},this._renderTimer=null,this.verticalType="top",this.currentFontLevel=0,this.baseFontSize=118,this.splitByGrapheme=!0,this._originGetTopOffset=this._getTopOffset?this._getTopOffset.bind(this):()=>0,gg.hasSetItalic&&(this.hasSetItalic=gg.hasSetItalic),gg.propsMinHeight){this.propsMinHeight=gg.propsMinHeight;let ig=Math.max(this.height,this.propsMinHeight);this.height=ig}gg.verticalType&&(this.verticalType=gg.verticalType),this.customExportFields=gg.customExportFields??this.customExportFields,this.on("modified",()=>{this.verticalTypeChange()}),this.on("changed",()=>{this.verticalTypeChange()}),this.verticalTypeChange()}_calcTextHeight(){const eg=this._textLines&&this._textLines.length||0,gg=this.fontSize*this.lineHeight,ig=(this.padding||0)*2;return eg*gg+ig}_handleDotLineBreak(eg,gg){var ig;if(eg.includes("·")){const Ig=eg.indexOf("·"),og=/[\u4e00-\u9fa5]/g,ng=((ig=eg.substring(Ig+1).match(og))==null?void 0:ig.length)||0;if(this.charSpacing=1,Ig==2&&(ng==2||ng==1))return[eg];let sg=0;if(ng>=11||Ig>=10?sg=5:ng>=10||Ig>=9?sg=4:ng>=9||Ig>=8?sg=3:ng>=8||Ig>=7?sg=2:ng>=7||Ig>=6?sg=1:sg=0,sg!==this.currentFontLevel){switch(sg){case 5:this.fontSize=64;break;case 4:this.fontSize=70;break;case 3:this.fontSize=78;break;case 2:this.fontSize=88;break;case 1:this.fontSize=100;break;case 0:this.fontSize=this.baseFontSize??118;break}this.currentFontLevel=sg}const ag=eg.substring(0,Ig+1),Cg=eg.substring(Ig+1).trim();return Cg?[ag,Cg]:[eg]}else eg.length<=4?(this.fontSize=this.baseFontSize??118,this.currentFontLevel=0,eg.length===2?this.charSpacing=800:eg.length===3?this.charSpacing=300:eg.length===4&&(this.charSpacing=300)):(this.charSpacing=1,this.fontSize=this.baseFontSize,this.currentFontLevel=0);return[...gg]}_wrapText(eg,gg){if(this.isClearCopyTextStyle&&(this.styles={},this.verticalTypeChange()),this.splitByGrapheme){const ig=o.DPI??96,ng=3*.393701*ig,sg=this.text;let ag=[...eg];return ag=this._handleDotLineBreak(sg,eg),this.width!==ng&&(this.width=ng,this.setCoords(),this._renderTimer&&clearTimeout(this._renderTimer),this._renderTimer=setTimeout(()=>{var Cg;(Cg=this.canvas)==null||Cg.requestRenderAll()},0)),super._wrapText(ag,ng)}else return super._wrapText(eg,gg)}verticalTypeChange(){var gg;if(!this.splitByGrapheme||!this.propsMinHeight)return;const eg=Math.max(this._calcTextHeight(),this.propsMinHeight);this.height!==eg&&(this.height=eg),this.verticalType==="top"?this._getTopOffset=this._originGetTopOffset:this.verticalType==="vcenter"?this._getTopOffset=()=>{let ig=this._calcTextHeight();return(this.fontSize*this.lineHeight-this.fontSize)/2-ig/2}:this.verticalType==="bottom"&&(this._getTopOffset=()=>{const ig=this._calcTextHeight(),og=Math.max(ig,this.propsMinHeight)-ig;return this._originGetTopOffset()+og}),this.setCoords(),(gg=this.canvas)==null||gg.requestRenderAll()}set(eg,gg){return(eg==="fill"||eg==="stroke"||eg==="underline"||eg==="overline"||eg==="linethrough"||eg==="fontWeight"||eg==="fontStyle")&&(this.styles={}),super.set(eg,gg)}set locked(eg){super.locked=eg,this.editable=!eg}get locked(){return super.locked}_measureLine(eg){let gg=this._textLines[eg];return Array.isArray(gg)&&(gg=gg.map(ig=>ig.replace(" "," "))),this._textLines[eg]=gg,super._measureLine(eg)}getStandardSpaceWidth(eg=" ",gg="Arial"){const Ig=kn.createCanvasElement().getContext("2d");let og=0;return Ig&&(Ig.font=`${this.fontSize}px ${gg}`,og=Ig.measureText(eg).width),og}getTextWidth(eg="",gg=0,ig="Arial"){const og=kn.createCanvasElement().getContext("2d");let ng=0;return og&&(og.font=`${gg}px ${ig}`,ng=og.measureText(eg).width),ng}getTextHeight(eg="测",gg=!0){const Ig=kn.createCanvasElement().getContext("2d");let og=0;if(Ig){Ig.font=`${this.fontSize}px ${this.fontFamily}`;let ng=Ig.measureText(eg);og=ng.fontBoundingBoxAscent+ng.fontBoundingBoxDescent+(gg?Math.trunc(this.fontSize/3):0)}return og*this._textLines.length}_measureChar(eg,gg,ig,Ig){if(eg!==" "&&eg!==" ")return super._measureChar(eg,gg,ig,Ig);{const og=this.getStandardSpaceWidth(" ",this.fontFamily);return{width:og,kernedWidth:og}}}render(eg){if(eg.shadowBlur=0,eg.shadowColor="transparent",eg.imageSmoothingEnabled=!1,this.isClearCopyTextStyle&&(this.styles={}),this.splitByGrapheme){let ig=this.width*this.scaleX,Ig=this.height*this.scaleY,og=this.getTextHeight();Ig<og&&(Ig=og),this.hasSetSplit=!0,(ig!==this.width||Ig!==this.height||this.scaleY!==1)&&(this.set({width:ig,height:Ig,scaleX:1,scaleY:1}),this.height=Ig,this.propsMinHeight=this.height,this.setCoords())}else{this.propsMinHeight=0,this.hasSetSplit&&(this.hasSetSplit=!1);const ig=this.text.replace(/ /g," ");ig!==this.text&&(this.text=ig);let Ig=eg.measureText(this.text);Ig.width!==this.width&&this.set({width:Ig.width}),this._forceClearCache=!0}let gg=this.skewX;this.skewX=this.hasSetItalic?-15:0,gg!==this.skewX&&this.setCoords(),this.charSpacing>1e5?this.objectCaching=!1:this.objectCaching=!0,this.dirty=!0,super.render(eg)}toObject(eg){let gg=["hasSetItalic","propsMinHeight","verticalType","customExportFields"];return super.toObject(eg?[...eg,...gg]:gg)}};a0.type="TextName";let ATextName=a0;tt.setClass(ATextName);const l0=class l0 extends Er{constructor(eg={}){const{rows:gg,columns:ig,tableTexts:Ig,tableCellStyles:og,tableCellBorders:ng,tableCellSpans:sg,columnWidths:ag,rowHeights:Cg,fontSize:lg,fontFamily:Ag,fontWeight:cg,fontStyle:rg,underline:ug,linethrough:dg,charSpacing:mg,lineHeight:bg,textAlign:pg,verticalType:Zg,...Gg}=eg;super({fill:"#000000FF",backgroundColor:"#FFFFFF00",stroke:"#000000",strokeWidth:1,...Gg}),this.perPixelTargetFind=!1,this.rows=2,this.columns=2,this.tableTexts=[],this.tableCellStyles=[],this.tableCellBorders=[],this.tableCellSpans=[],this.columnWidths=[],this.rowHeights=[],this.fontSize=24,this.fontFamily="微软雅黑",this.fontWeight="normal",this.fontStyle="normal",this.underline=!1,this.linethrough=!1,this.charSpacing=0,this.lineHeight=1.2,this.textAlign="center",this.verticalType="vcenter",this.strokeUniform=!0,this.selectedCellIndex=null,this.editingTextarea=null,this.keepEditingOnNextBlur=!1,this.editingPointerDownHandler=null,this.rows=this.normalizeCount(gg,2),this.columns=this.normalizeCount(ig,2),this.tableTexts=[...Ig||[]],this.tableCellStyles=[...og||[]],this.tableCellBorders=[...ng||[]],this.tableCellSpans=[...sg||[]],this.columnWidths=[...ag||[]],this.rowHeights=[...Cg||[]],this.syncTextCount(),this.applyTextOptions({fontSize:lg,fontFamily:Ag,fontWeight:cg,fontStyle:rg,underline:ug,linethrough:dg,charSpacing:mg,lineHeight:bg,textAlign:pg,verticalType:Zg}),this.on("scaling",hg=>this.resizeDuringScaling(hg)),this.on("modified",()=>{this.scaleAnchor=void 0}),this.on("removed",()=>this.removeEditingTextarea(!1))}set(eg,gg){var Ig,og,ng,sg,ag,Cg,lg;if(typeof eg=="object"&&eg)return Object.keys(eg).forEach(Ag=>this.set(Ag,eg[Ag])),this;if(eg==="rows"||eg==="columns"){this.removeEditingTextarea(!0);const Ag=this.normalizeCount(gg,eg==="rows"?this.rows:this.columns),cg=this.rows,rg=this.columns,ug=eg==="rows"?Ag:this.rows,dg=eg==="columns"?Ag:this.columns;return this.resizeByCountChange(eg,Ag),this.remapCellData(cg,rg,ug,dg),this[eg]=Ag,this.syncTextCount(),this.selectedCellIndex!==null&&this.selectedCellIndex>=this.rows*this.columns&&(this.selectedCellIndex=null),this.dirty=!0,this.setCoords(),(Ig=this.canvas)==null||Ig.requestRenderAll(),this}if(eg==="tableTexts")return this.tableTexts=Array.isArray(gg)?[...gg]:[],this.syncTextCount(),this.dirty=!0,(og=this.canvas)==null||og.requestRenderAll(),this;if(eg==="tableCellStyles")return this.tableCellStyles=Array.isArray(gg)?[...gg]:[],this.syncTextCount(),this.dirty=!0,(ng=this.canvas)==null||ng.requestRenderAll(),this;if(eg==="tableCellBorders")return this.tableCellBorders=Array.isArray(gg)?[...gg]:[],this.syncTextCount(),this.dirty=!0,(sg=this.canvas)==null||sg.requestRenderAll(),this;if(eg==="tableCellSpans")return this.tableCellSpans=Array.isArray(gg)?[...gg]:[],this.syncTextCount(),this.dirty=!0,(ag=this.canvas)==null||ag.requestRenderAll(),this;if(eg==="columnWidths"||eg==="rowHeights")return this[eg]=Array.isArray(gg)?[...gg]:[],this.syncTextCount(),this.dirty=!0,(Cg=this.canvas)==null||Cg.requestRenderAll(),this;const ig=super.set(eg,gg);return this.isTextStyleKey(eg)&&(this.dirty=!0,(lg=this.canvas)==null||lg.requestRenderAll(),this.updateEditingTextarea()),ig}toObject(eg){const gg=["rows","columns","tableTexts","tableCellStyles","tableCellBorders","tableCellSpans","columnWidths","rowHeights","fontSize","fontFamily","fontWeight","fontStyle","underline","linethrough","charSpacing","lineHeight","textAlign","verticalType","backgroundColor"];return super.toObject(eg?[...eg,...gg]:gg)}normalizeCount(eg,gg){const ig=Math.floor(Number(eg));return Number.isFinite(ig)?Math.min(Math.max(ig,1),50):gg}resizeDuringScaling(eg){const gg=eg==null?void 0:eg.transform;if(!gg)return;const ig=gg.corner,Ig=["ml","tl","bl"].includes(ig),og=["mr","tr","br"].includes(ig),ng=["mt","tl","tr"].includes(ig),sg=["mb","bl","br"].includes(ig);if(!this.scaleAnchor){const Ag=Ig?"right":og?"left":"center",cg=ng?"bottom":sg?"top":"center";this.scaleAnchor={point:this.getPointByOrigin(Ag,cg),originX:Ag,originY:cg}}this.width=Math.max(1,(this.width||1)*Math.abs(this.scaleX||1)),this.height=Math.max(1,(this.height||1)*Math.abs(this.scaleY||1)),this.scaleX=1,this.scaleY=1;const{point:ag,originX:Cg,originY:lg}=this.scaleAnchor;if(this.group){const Ag=kn.invertTransform(this.group.calcTransformMatrix()),cg=kn.transformPoint(ag,Ag);this.setPositionByOrigin(cg,Cg,lg)}else this.setPositionByOrigin(ag,Cg,lg);this.updateEditingTextarea(),this.dirty=!0,this.setCoords()}resizeByCountChange(eg,gg){if(eg==="columns"){const ig=this.width||0,Ig=Array.from({length:this.columns},(Cg,lg)=>(this.columnWidths[lg]||1/this.columns)*ig),og=Ig.reduce((Cg,lg)=>Cg+lg,0)/(Ig.length||1)||ig/(this.columns||1)||1,ng=Array.from({length:gg},(Cg,lg)=>lg<Ig.length?Ig[lg]:og),sg=ng.reduce((Cg,lg)=>Cg+lg,0);this.width=sg;const ag=sg||1;this.columnWidths=ng.map(Cg=>Cg/ag)}if(eg==="rows"){const ig=this.height||0,Ig=Array.from({length:this.rows},(Cg,lg)=>(this.rowHeights[lg]||1/this.rows)*ig),og=Ig.reduce((Cg,lg)=>Cg+lg,0)/(Ig.length||1)||ig/(this.rows||1)||1,ng=Array.from({length:gg},(Cg,lg)=>lg<Ig.length?Ig[lg]:og),sg=ng.reduce((Cg,lg)=>Cg+lg,0);this.height=sg;const ag=sg||1;this.rowHeights=ng.map(Cg=>Cg/ag)}}remapCellData(eg,gg,ig,Ig){if(eg===ig&&gg===Ig)return;const og=Array.isArray(this.tableTexts)?[...this.tableTexts]:[],ng=Array.isArray(this.tableCellStyles)?[...this.tableCellStyles]:[],sg=Array.isArray(this.tableCellBorders)?[...this.tableCellBorders]:[],ag=Array.isArray(this.tableCellSpans)?[...this.tableCellSpans]:[],Cg=ig*Ig;this.tableTexts=Array.from({length:Cg},(lg,Ag)=>{const cg=Math.floor(Ag/Ig),rg=Ag%Ig;return cg>=eg||rg>=gg?"":og[cg*gg+rg]||""}),this.tableCellStyles=Array.from({length:Cg},(lg,Ag)=>{const cg=Math.floor(Ag/Ig),rg=Ag%Ig;return cg>=eg||rg>=gg?{}:{...ng[cg*gg+rg]||{}}}),this.tableCellBorders=Array.from({length:Cg},(lg,Ag)=>{const cg=Math.floor(Ag/Ig),rg=Ag%Ig;return cg>=eg||rg>=gg?{}:{...sg[cg*gg+rg]||{}}}),this.tableCellSpans=Array.from({length:Cg},(lg,Ag)=>{const cg=Math.floor(Ag/Ig),rg=Ag%Ig;if(cg>=eg||rg>=gg)return this.createDefaultCellSpan();const ug=ag[cg*gg+rg]||{},dg=Number(ug.masterIndex),mg=Number.isFinite(dg)&&dg>=0?this.mapOldCellIndex(dg,gg,ig,Ig):null;return{...this.createDefaultCellSpan(),...ug,masterIndex:mg}}),this.selectedCellIndex!==null&&(this.selectedCellIndex=this.mapOldCellIndex(this.selectedCellIndex,gg,ig,Ig))}mapOldCellIndex(eg,gg,ig,Ig){const og=Math.floor(eg/gg),ng=eg%gg;return og>=ig||ng>=Ig?null:og*Ig+ng}createDefaultCellSpan(){return{rowSpan:1,colSpan:1,hidden:!1,masterIndex:null}}syncTextCount(){Array.isArray(this.tableTexts)||(this.tableTexts=[]);const eg=this.rows*this.columns;for(this.tableTexts.length>eg&&(this.tableTexts=this.tableTexts.slice(0,eg));this.tableTexts.length<eg;)this.tableTexts.push("");for(Array.isArray(this.tableCellStyles)||(this.tableCellStyles=[]),this.tableCellStyles.length>eg&&(this.tableCellStyles=this.tableCellStyles.slice(0,eg));this.tableCellStyles.length<eg;)this.tableCellStyles.push({});for(Array.isArray(this.tableCellBorders)||(this.tableCellBorders=[]),this.tableCellBorders.length>eg&&(this.tableCellBorders=this.tableCellBorders.slice(0,eg));this.tableCellBorders.length<eg;)this.tableCellBorders.push({});for(Array.isArray(this.tableCellSpans)||(this.tableCellSpans=[]),this.tableCellSpans.length>eg&&(this.tableCellSpans=this.tableCellSpans.slice(0,eg));this.tableCellSpans.length<eg;)this.tableCellSpans.push(this.createDefaultCellSpan());this.syncDimensionRatios(),this.selectedCellIndex!==null&&this.selectedCellIndex>=eg&&(this.selectedCellIndex=null)}syncDimensionRatios(){this.columnWidths=this.normalizeRatios(this.columnWidths,this.columns),this.rowHeights=this.normalizeRatios(this.rowHeights,this.rows)}normalizeRatios(eg,gg){const ig=Array.from({length:gg},(og,ng)=>{const sg=Number(eg[ng]);return Number.isFinite(sg)&&sg>0?sg:1}),Ig=ig.reduce((og,ng)=>og+ng,0)||gg||1;return ig.map(og=>og/Ig)}applyTextOptions(eg){["fontSize","fontFamily","fontWeight","fontStyle","underline","linethrough","charSpacing","lineHeight","textAlign","verticalType"].forEach(ig=>{eg[ig]!==void 0&&(this[ig]=eg[ig])})}isTextStyleKey(eg){return["fontSize","fontFamily","fontWeight","fontStyle","underline","linethrough","charSpacing","lineHeight","textAlign","verticalType","fill"].includes(eg)}getTextX(eg,gg,ig){return this.getTextXByAlign(eg,gg,ig,this.textAlign)}getTextXByAlign(eg,gg,ig,Ig="center"){return Ig==="left"?eg+ig:Ig==="right"?eg+gg-ig:eg+gg/2}getTextStartYByVertical(eg,gg,ig,Ig,og,ng="vcenter"){return ng==="top"?eg+ig+og/2:ng==="bottom"?eg+gg-ig-Ig+og/2:eg+gg/2-Ig/2+og/2}getTextareaVerticalPadding(eg,gg,ig){if(eg.verticalType==="top")return{top:0,bottom:0};const Ig=Math.max(gg-ig,0);return eg.verticalType==="bottom"?{top:Ig,bottom:0}:{top:Ig/2,bottom:0}}getDefaultCellStyle(){return{fontSize:Number(this.fontSize)||12,fontFamily:this.fontFamily||"微软雅黑",fill:this.fill||"#000000",fontWeight:this.fontWeight||"normal",fontStyle:this.fontStyle||"normal",underline:!!this.underline,linethrough:!!this.linethrough,charSpacing:Number(this.charSpacing)||0,lineHeight:Number(this.lineHeight)||1.2,textAlign:this.textAlign||"center",verticalType:this.verticalType||"vcenter"}}getCellStyle(eg){return this.syncTextCount(),{...this.getDefaultCellStyle(),...this.tableCellStyles[eg]||{}}}setCellStyle(eg,gg){var ig,Ig;this.syncTextCount(),!(eg<0||eg>=this.rows*this.columns)&&(this.tableCellStyles[eg]={...this.tableCellStyles[eg]||{},...gg},this.updateEditingTextarea(eg),this.dirty=!0,(ig=this.canvas)==null||ig.requestRenderAll(),(Ig=this.canvas)==null||Ig.fire("object:modified",{target:this}))}getCellBorderStyle(eg){return this.syncTextCount(),{top:"solid",right:"solid",bottom:"solid",left:"solid",...this.tableCellBorders[eg]||{}}}setCellBorderStyle(eg,gg){var ig,Ig;this.syncTextCount(),!(eg<0||eg>=this.rows*this.columns)&&(this.tableCellBorders[eg]={...this.tableCellBorders[eg]||{},...gg},this.dirty=!0,(ig=this.canvas)==null||ig.requestRenderAll(),(Ig=this.canvas)==null||Ig.fire("object:modified",{target:this}))}setAllCellBorderStyle(eg){var gg,ig;this.syncTextCount(),this.tableCellBorders=Array.from({length:this.rows*this.columns},()=>({top:eg,right:eg,bottom:eg,left:eg})),this.dirty=!0,(gg=this.canvas)==null||gg.requestRenderAll(),(ig=this.canvas)==null||ig.fire("object:modified",{target:this,action:"modifyprops"})}getCellLayout(eg){return{...this.getCellRect(eg),row:Math.floor(eg/this.columns),col:eg%this.columns}}setColumnWidth(eg,gg){var Cg,lg;const ig=this.width||0;if(eg<0||eg>=this.columns||!ig)return;const Ig=Math.min(8/ig,.9/this.columns),og=this.columns>1?1-Ig*(this.columns-1):1,ng=Math.min(Math.max(Number(gg)/ig,Ig),og),sg=this.columnWidths.reduce((Ag,cg,rg)=>Ag+(rg===eg?0:cg),0),ag=Math.max(1-ng,Ig*(this.columns-1));this.columnWidths=this.columnWidths.map((Ag,cg)=>cg===eg?ng:sg?Ag/sg*ag:ag/(this.columns-1)),this.syncDimensionRatios(),this.updateEditingTextarea(),this.dirty=!0,(Cg=this.canvas)==null||Cg.requestRenderAll(),(lg=this.canvas)==null||lg.fire("object:modified",{target:this})}setRowHeight(eg,gg){var Cg,lg;const ig=this.height||0;if(eg<0||eg>=this.rows||!ig)return;const Ig=Math.min(8/ig,.9/this.rows),og=this.rows>1?1-Ig*(this.rows-1):1,ng=Math.min(Math.max(Number(gg)/ig,Ig),og),sg=this.rowHeights.reduce((Ag,cg,rg)=>Ag+(rg===eg?0:cg),0),ag=Math.max(1-ng,Ig*(this.rows-1));this.rowHeights=this.rowHeights.map((Ag,cg)=>cg===eg?ng:sg?Ag/sg*ag:ag/(this.rows-1)),this.syncDimensionRatios(),this.updateEditingTextarea(),this.dirty=!0,(Cg=this.canvas)==null||Cg.requestRenderAll(),(lg=this.canvas)==null||lg.fire("object:modified",{target:this})}getColumnOffset(eg){const gg=this.width||0;return-gg/2+this.columnWidths.slice(0,eg).reduce((ig,Ig)=>ig+Ig*gg,0)}getRowOffset(eg){const gg=this.height||0;return-gg/2+this.rowHeights.slice(0,eg).reduce((ig,Ig)=>ig+Ig*gg,0)}getCellRect(eg){const gg=this.width||0,ig=this.height||0,Ig=Math.floor(eg/this.columns),og=eg%this.columns,ng=(this.columnWidths[og]||0)*gg,sg=(this.rowHeights[Ig]||0)*ig;return{left:this.getColumnOffset(og),top:this.getRowOffset(Ig),width:ng,height:sg}}getCellIndexByPoint(eg){const gg=this.width||0,ig=this.height||0;if(!gg||!ig||!this.rows||!this.columns)return-1;const Ig=kn.invertTransform(this.calcTransformMatrix()),og=kn.transformPoint(new ot(eg.x,eg.y),Ig),ng=og.x+gg/2,sg=og.y+ig/2;if(ng<0||sg<0||ng>gg||sg>ig)return-1;let ag=0,Cg=this.columns-1;for(let cg=0;cg<this.columns;cg++)if(ag+=this.columnWidths[cg]*gg,ng<=ag){Cg=cg;break}let lg=0,Ag=this.rows-1;for(let cg=0;cg<this.rows;cg++)if(lg+=this.rowHeights[cg]*ig,sg<=lg){Ag=cg;break}return Ag*this.columns+Cg}getViewportCellRect(eg){if(!this.canvas)return null;const gg=this.getCellRect(eg),ig=this.calcTransformMatrix(),Ig=this.canvas.viewportTransform,og=[new ot(gg.left,gg.top),new ot(gg.left+gg.width,gg.top),new ot(gg.left+gg.width,gg.top+gg.height),new ot(gg.left,gg.top+gg.height)].map(ag=>{const Cg=kn.transformPoint(ag,ig);return Ig?kn.transformPoint(Cg,Ig):Cg}),ng=og.map(ag=>ag.x),sg=og.map(ag=>ag.y);return{left:Math.min(...ng),top:Math.min(...sg),width:Math.max(...ng)-Math.min(...ng),height:Math.max(...sg)-Math.min(...sg)}}getCanvasElementRect(){var gg,ig;return this.canvas?(((ig=(gg=this.canvas.elements)==null?void 0:gg.upper)==null?void 0:ig.el)||this.canvas.upperCanvasEl||this.canvas.getElement()).getBoundingClientRect():null}removeEditingTextarea(eg=!0){var Ig,og,ng;if(!this.editingTextarea)return;const gg=this.editingTextarea;this.editingTextarea=null;const ig=Number(gg.dataset.cellIndex);this.editingPointerDownHandler&&(document.removeEventListener("pointerdown",this.editingPointerDownHandler,!0),this.editingPointerDownHandler=null),eg&&Number.isFinite(ig)&&(this.tableTexts[ig]=gg.value,this.dirty=!0,(Ig=this.canvas)==null||Ig.fire("object:modified",{target:this})),(og=gg.parentNode)==null||og.removeChild(gg),this.selectedCellIndex=null,this.dirty=!0,(ng=this.canvas)==null||ng.requestRenderAll()}isEditingAssistantTarget(eg){return!!eg.closest([".right-side-bar",".ant-select-dropdown",".ant-select-item",".ant-select-selector",".ant-select-selection-search-input",".ant-input-number",".ant-input-number-dropdown",".ant-dropdown",".ant-tooltip",".ant-popover"].join(","))}bindEditingPointerDown(eg){this.editingPointerDownHandler&&document.removeEventListener("pointerdown",this.editingPointerDownHandler,!0),this.editingPointerDownHandler=gg=>{const ig=gg.target;if(!(!ig||ig===eg||eg.contains(ig))){if(this.isEditingAssistantTarget(ig)){this.keepEditingOnNextBlur=!0;return}this.removeEditingTextarea(!0)}},document.addEventListener("pointerdown",this.editingPointerDownHandler,!0)}updateEditingTextarea(eg){if(!this.editingTextarea)return;const gg=this.editingTextarea,ig=Number(gg.dataset.cellIndex);if(!Number.isFinite(ig)||eg!==void 0&&eg!==ig)return;const Ig=this.getViewportCellRect(ig),og=this.getCanvasElementRect();if(!Ig||!og)return;const ng=this.getCellStyle(ig),sg=this.getCellEditFontSize(ig,Ig.height),ag=Math.max(2,Math.min(sg*.18,8)),Cg=Math.max(Ig.width-ag*2,12),lg=Math.max(Ig.height-ag*2,12),Ag=sg*(Number(ng.lineHeight)||1.2),cg=Math.max(gg.value.split(/\r?\n/).length,1),rg=this.getTextareaVerticalPadding(ng,lg,Ag*cg);gg.style.left=`${og.left+Ig.left+ag}px`,gg.style.top=`${og.top+Ig.top+ag}px`,gg.style.width=`${Cg}px`,gg.style.height=`${lg}px`,gg.style.color=ng.fill,gg.style.font=this.getFont(sg,ng),gg.style.lineHeight=`${Ag}px`,gg.style.textAlign=ng.textAlign,gg.style.letterSpacing=`${this.getSpacingPx(ng,sg)}px`,gg.style.padding=`${rg.top}px 0 ${rg.bottom}px 0`}startCellEditing(eg){if(!this.canvas)return;this.removeEditingTextarea(!0);const gg=this.getViewportCellRect(eg);if(!gg)return;const ig=this.getCanvasElementRect();if(!ig)return;const Ig=this.getCellEditFontSize(eg,gg.height),og=Math.max(2,Math.min(Ig*.18,8)),ng=document.createElement("textarea");ng.value=this.tableTexts[eg]||"",ng.dataset.cellIndex=`${eg}`,ng.spellcheck=!1,ng.style.position="fixed",ng.style.left=`${ig.left+gg.left+og}px`,ng.style.top=`${ig.top+gg.top+og}px`,ng.style.width=`${Math.max(gg.width-og*2,12)}px`,ng.style.height=`${Math.max(gg.height-og*2,12)}px`,ng.style.zIndex="9999",ng.style.padding="0",ng.style.margin="0",ng.style.border="1px solid #2F54EB",ng.style.outline="none",ng.style.resize="none",ng.style.overflow="hidden",ng.style.background="rgba(255, 255, 255, 0.92)";const sg=this.getCellStyle(eg);ng.style.color=sg.fill,ng.style.font=this.getFont(Ig,sg),ng.style.lineHeight=`${sg.lineHeight}`,ng.style.textAlign=sg.textAlign,ng.style.letterSpacing=`${this.getSpacingPx(sg,Ig)}px`,ng.style.boxSizing="border-box",ng.style.transformOrigin="left top";const ag=Cg=>Cg.stopPropagation();ng.addEventListener("mousedown",ag),ng.addEventListener("pointerdown",ag),ng.addEventListener("dblclick",ag),ng.addEventListener("keydown",Cg=>{Cg.stopPropagation(),Cg.key==="Escape"?(Cg.preventDefault(),this.removeEditingTextarea(!1)):Cg.key==="Enter"&&!Cg.shiftKey&&(Cg.preventDefault(),this.removeEditingTextarea(!0))}),ng.addEventListener("input",()=>this.updateEditingTextarea(eg)),ng.addEventListener("blur",()=>{if(this.keepEditingOnNextBlur){this.keepEditingOnNextBlur=!1;return}this.removeEditingTextarea(!0)}),document.body.appendChild(ng),this.editingTextarea=ng,this.bindEditingPointerDown(ng),this.updateEditingTextarea(eg),ng.focus(),ng.select()}selectCell(eg){var gg;this.selectedCellIndex=eg,this.dirty=!0,(gg=this.canvas)==null||gg.requestRenderAll()}handleCellDoubleClick(eg){const gg=this.getCellIndexByPoint(eg);gg<0||(this.selectCell(gg),this.startCellEditing(gg))}getFont(eg,gg){const ig=gg.fontStyle==="italic"?"italic ":"",Ig=gg.fontWeight==="bold"?"bold ":"";return`${ig}${Ig}${eg}px ${gg.fontFamily}`}getViewportZoom(){var ig,Ig;const eg=this.canvas,gg=(ig=this.canvas)==null?void 0:ig.viewportTransform;return((Ig=eg==null?void 0:eg.getZoom)==null?void 0:Ig.call(eg))||(gg?Math.hypot(gg[0],gg[1]):1)||1}getCellEditFontSize(eg,gg){const ig=this.getCellStyle(eg).fontSize||12;return Math.max(ig*this.getViewportZoom(),8)}getSpacingPx(eg,gg){return(Number(eg.charSpacing)||0)/1e3*gg}measureTextWidth(eg,gg,ig,Ig){const og=this.getSpacingPx(ig,Ig);return!gg||!og?eg.measureText(gg).width:Array.from(gg).reduce((ng,sg)=>ng+eg.measureText(sg).width,0)+Math.max(Array.from(gg).length-1,0)*og}drawTextLine(eg,gg,ig,Ig,og,ng){const sg=this.getSpacingPx(ig,ng);if(!sg){eg.fillText(gg,Ig,og);return}const ag=Array.from(gg);let Cg=Ig;const lg=this.measureTextWidth(eg,gg,ig,ng);ig.textAlign==="center"&&(Cg=Ig-lg/2),ig.textAlign==="right"&&(Cg=Ig-lg),eg.textAlign="left",ag.forEach(Ag=>{eg.fillText(Ag,Cg,og),Cg+=eg.measureText(Ag).width+sg})}drawTextDecoration(eg,gg,ig,Ig,og,ng,sg){if(!sg.underline&&!sg.linethrough)return;const ag=Math.min(this.measureTextWidth(eg,gg,sg,ng),og);let Cg=ig-ag/2;if(sg.textAlign==="left"&&(Cg=ig),sg.textAlign==="right"&&(Cg=ig-ag),eg.strokeStyle=sg.fill||"#000000",eg.lineWidth=Math.max(ng/16,1),sg.underline){const lg=Ig+ng*.38;eg.beginPath(),eg.moveTo(Cg,lg),eg.lineTo(Cg+ag,lg),eg.stroke()}sg.linethrough&&(eg.beginPath(),eg.moveTo(Cg,Ig),eg.lineTo(Cg+ag,Ig),eg.stroke())}drawCellText(eg,gg,ig,Ig,og,ng,sg){if(!gg)return;const ag=Math.min(4,og/6,ng/6),Cg=Math.max(og-ag*2,1),lg=this.getCellStyle(sg),Ag=this.getTextXByAlign(ig,og,ag,lg.textAlign),cg=this.scaleX||1,rg=this.scaleY||1,ug=Math.max(Number(lg.fontSize)||12,1),dg=String(gg).split(/\r?\n/),mg=ug*(Number(lg.lineHeight)||1.2),bg=dg.length*mg,pg=this.getTextStartYByVertical(Ig,ng,ag,bg,mg,lg.verticalType);eg.save(),eg.beginPath(),eg.rect(ig+.5,Ig+.5,Math.max(og-1,1),Math.max(ng-1,1)),eg.clip(),eg.translate(Ag,pg),eg.scale(1/cg,1/rg),eg.fillStyle=lg.fill||"#000000",eg.font=this.getFont(ug,lg),eg.textAlign=lg.textAlign,eg.textBaseline="middle",dg.forEach((Zg,Gg)=>{const hg=Gg*mg*rg;this.drawTextLine(eg,Zg,lg,0,hg,ug),this.drawTextDecoration(eg,Zg,0,hg,Cg*cg,ug,lg)}),eg.restore()}drawSelectedCell(eg){if(this.selectedCellIndex===null)return;const gg=this.selectedCellIndex;if(gg<0||gg>=this.rows*this.columns)return;const ig=this.getCellRect(gg);eg.save(),eg.fillStyle="rgba(47, 84, 235, 0.14)",eg.strokeStyle="#2F54EB",eg.lineWidth=1,eg.fillRect(ig.left,ig.top,ig.width,ig.height),eg.strokeRect(ig.left+.5,ig.top+.5,Math.max(ig.width-1,1),Math.max(ig.height-1,1)),eg.restore()}resolveBorderStyle(eg,gg){return eg==="none"||gg==="none"?"none":eg==="dashed"||gg==="dashed"?"dashed":"solid"}getDefaultBorderStyle(){return Array.isArray(this.strokeDashArray)&&this.strokeDashArray.length?"dashed":"solid"}getBorderSideStyle(eg,gg){var ig;return((ig=this.tableCellBorders[eg])==null?void 0:ig[gg])||this.getDefaultBorderStyle()}drawBorderSegment(eg,gg,ig,Ig,og,ng){gg!=="none"&&(eg.save(),eg.strokeStyle=this.stroke||"#000000",eg.lineWidth=this.strokeWidth||1,eg.setLineDash(gg==="dashed"&&Array.isArray(this.strokeDashArray)?this.strokeDashArray:gg==="dashed"?[6,4]:[]),eg.beginPath(),eg.moveTo(ig,Ig),eg.lineTo(og,ng),eg.stroke(),eg.restore())}drawTableBorders(eg){for(let gg=0;gg<=this.rows;gg++){const ig=this.getRowOffset(gg);for(let Ig=0;Ig<this.columns;Ig++){const og=this.getColumnOffset(Ig),ng=this.getColumnOffset(Ig+1),sg=gg>0?(gg-1)*this.columns+Ig:-1,ag=gg<this.rows?gg*this.columns+Ig:-1,Cg=sg>=0?this.getBorderSideStyle(sg,"bottom"):void 0,lg=ag>=0?this.getBorderSideStyle(ag,"top"):void 0,Ag=this.resolveBorderStyle(Cg||lg||"solid",Cg&&lg?lg:void 0);this.drawBorderSegment(eg,Ag,og,ig,ng,ig)}}for(let gg=0;gg<=this.columns;gg++){const ig=this.getColumnOffset(gg);for(let Ig=0;Ig<this.rows;Ig++){const og=this.getRowOffset(Ig),ng=this.getRowOffset(Ig+1),sg=gg>0?Ig*this.columns+gg-1:-1,ag=gg<this.columns?Ig*this.columns+gg:-1,Cg=sg>=0?this.getBorderSideStyle(sg,"right"):void 0,lg=ag>=0?this.getBorderSideStyle(ag,"left"):void 0,Ag=this.resolveBorderStyle(Cg||lg||"solid",Cg&&lg?lg:void 0);this.drawBorderSegment(eg,Ag,ig,og,ig,ng)}}}_render(eg){const gg=this.width||0,ig=this.height||0;if(!gg||!ig||!this.rows||!this.columns)return;const Ig=-gg/2,og=-ig/2;eg.save(),eg.fillStyle=this.backgroundColor||"#FFFFFF00",eg.fillRect(Ig,og,gg,ig),eg.restore(),this.drawSelectedCell(eg),this.drawTableBorders(eg),this.syncTextCount();for(let ng=0;ng<this.rows;ng++)for(let sg=0;sg<this.columns;sg++){const ag=ng*this.columns+sg,Cg=this.getCellRect(ag);this.drawCellText(eg,this.tableTexts[ag]||"",Cg.left,Cg.top,Cg.width,Cg.height,ag)}}};l0.type="table";let ATable=l0;tt.setClass(ATable);const RIBBON_BORDER_PATTERN_OPTIONS=[{label:"无描边",value:"none",source:{x:57,y:29,width:169,height:169}},{label:"图案 1",value:"ribbon-01",source:{x:293,y:29,width:169,height:169}},{label:"图案 2",value:"ribbon-02",source:{x:546,y:29,width:169,height:169}},{label:"图案 3",value:"ribbon-03",source:{x:781,y:29,width:169,height:169}},{label:"图案 4",value:"ribbon-04",source:{x:1005,y:29,width:169,height:169}},{label:"图案 5",value:"ribbon-05",source:{x:1230,y:29,width:169,height:169}},{label:"图案 6",value:"ribbon-06",source:{x:1436,y:29,width:169,height:169}},{label:"图案 7",value:"ribbon-07",source:{x:1660,y:29,width:169,height:169}},{label:"图案 8",value:"ribbon-08",source:{x:57,y:255,width:169,height:169}},{label:"图案 9",value:"ribbon-09",source:{x:296,y:255,width:169,height:169}},{label:"图案 10",value:"ribbon-10",source:{x:550,y:254,width:168,height:169}},{label:"图案 11",value:"ribbon-11",source:{x:781,y:255,width:169,height:169}},{label:"图案 12",value:"ribbon-12",source:{x:1003,y:254,width:169,height:169}},{label:"图案 13",value:"ribbon-13",source:{x:1230,y:255,width:169,height:169}},{label:"图案 14",value:"ribbon-14",source:{x:1436,y:255,width:169,height:169}},{label:"图案 15",value:"ribbon-15",source:{x:1660,y:254,width:169,height:169}},{label:"图案 16",value:"ribbon-16",source:{x:57,y:629,width:169,height:169}},{label:"图案 17",value:"ribbon-17",source:{x:550,y:480,width:168,height:169}},{label:"图案 18",value:"ribbon-18",source:{x:781,y:483,width:169,height:169}},{label:"图案 19",value:"ribbon-19",source:{x:1003,y:483,width:169,height:169}},{label:"图案 20",value:"ribbon-20",source:{x:1230,y:471,width:169,height:169}},{label:"图案 21",value:"ribbon-21",source:{x:1436,y:473,width:169,height:169}},{label:"图案 22",value:"ribbon-22",source:{x:1660,y:473,width:169,height:169}},{label:"图案 23",value:"ribbon-23",source:{x:781,y:693,width:169,height:169}},{label:"图案 24",value:"ribbon-24",source:{x:1003,y:686,width:169,height:169}},{label:"图案 25",value:"ribbon-25",source:{x:1230,y:683,width:169,height:169}},{label:"图案 26",value:"ribbon-26",source:{x:1436,y:683,width:169,height:169}},{label:"图案 27",value:"ribbon-27",source:{x:1660,y:683,width:169,height:169}}];RIBBON_BORDER_PATTERN_OPTIONS.map(tg=>tg.value);function drawRibbonBorder(tg,eg,gg,ig){if(eg==="none"||!(ig!=null&&ig.left)||!(ig!=null&&ig.right))return;const{width:Ig,height:og}=gg,ng=gg.left??0,sg=gg.top??0,ag=getRibbonBorderBandWidth(Ig);drawTextureSide(tg,ig.left,ng,sg,ag,og,"left"),drawTextureSide(tg,ig.right,ng+Ig-ag,sg,ag,og,"right")}function getRibbonBorderBandWidth(tg){return Math.max(16,Math.min(56,Math.round(tg*.11)))}function drawTextureSide(tg,eg,gg,ig,Ig,og,ng){const sg=getImageSourceWidth(eg),ag=Number(eg.naturalHeight||eg.height);if(!sg||!ag)return;const Cg=Math.max(1,Math.min(Ig,Math.round(sg))),lg=ng==="right"?gg+Ig-Cg:gg,Ag=Math.max(1,Math.round(ag*(Cg/sg)));let cg=ig;for(;cg<ig+og;){const rg=Math.min(Ag,ig+og-cg),ug=Math.max(1,Math.round(ag*(rg/Ag)));tg.drawImage(eg,0,0,sg,ug,lg,cg,Cg,rg),cg+=Ag}}function getImageSourceWidth(tg){return tg?Number(tg.naturalWidth||tg.width||0):0}const objectMap={line:(tg,eg)=>new ALine([0,0,0,0],{...tg}),rect:(tg,eg)=>new ARect(tg),triangle:(tg,eg)=>new ATriangle(tg),table:(tg,eg)=>new ATable(tg),circle:(tg,eg)=>new ACircle(tg),barcode:(tg,eg)=>new ABarcode(eg,tg),barcode2d:(tg,eg)=>new ABarcode2D(eg,tg),text:(tg,eg)=>new AText(eg??"",tg),textname:(tg,eg)=>new ATextName(eg??"",tg),counter:(tg,eg)=>new ACounter(eg,tg),image:(tg,eg)=>new AImage(eg,tg),rfid:(tg,eg)=>new RfidIcon(eg,tg)};o.DPI=203;class BaseEditor{constructor(){this.bindData=new EditorData,this.ribbonBorderPattern="none",this.ribbonBorderTextures=null}get width(){var eg;return(eg=this.canvas)==null?void 0:eg.elements.lower.el.offsetWidth}get height(){var eg;return(eg=this.canvas)==null?void 0:eg.elements.lower.el.offsetHeight}init(eg,gg){this.canvas=new In(eg,{...gg,imageSmoothingEnabled:!1,fireMiddleClick:!0,fireRightClick:!0,stopContextMenu:!1,controlsAboveOverlay:!0,preserveObjectStacking:!0,selectionKey:"ctrlKey"}),this.bindData.init(this);const ig=Ig=>{if(!this.canvas)return;const og=this.canvas.getActiveObject();if(!og||og.type!=="textname")return;const ng=og;ng.isEditing===!0&&(Ig.key==="Enter"||Ig.keyCode===13||Ig.key===" "||Ig.key==="Space"||Ig.keyCode===32)&&(Ig.preventDefault(),Ig.stopImmediatePropagation(),ng.selectionStart!==void 0&&(ng.selectionStart=ng.selectionEnd=ng.selectionStart))};document.addEventListener("keydown",ig),this.canvas.on("dispose",()=>{document.removeEventListener("keydown",ig)})}removeObject(eg){var gg;eg&&((gg=this.canvas)==null||gg.remove(eg))}addObject(eg,gg,ig,Ig){if(this.canvas)if(eg==="image")kn.loadImage(ig,{crossOrigin:"anonymous"}).then(og=>{let ng=og.width/og.height;gg.imgScaleType=ng>1?"3":ng<1?"2":"1";const sg=new AImage(og,gg);sg.id=v4(),sg.canvas=this.canvas,sg.padding=3,addObjName(this.canvas,sg),this.canvas.add(sg),this.canvas.setActiveObject(sg)});else{const og=objectMap[eg](gg,ig);og.id=v4(),og.canvas=this.canvas,og.padding=3,addObjName(this.canvas,og),this.canvas.add(og),this.canvas.setActiveObject(og)}}getActiveObjects(){return this.canvas.getActiveObjects()}getActiveObject(){return this.canvas.getActiveObject()}getObjects(){return this.canvas.getObjects()}getAllObjects(){const eg=this.getCanvas(),gg=[];function ig(Ig){Ig.type==="group"&&Ig._objects?Ig._objects.forEach(og=>ig(og)):Ig.id!=="workspace"&&gg.push(Ig)}return eg.getObjects().forEach(Ig=>ig(Ig)),gg}getBind(){return this.bindData}setRibbonBorderTextures(eg){var gg;this.ribbonBorderTextures=eg,(gg=this.canvas)==null||gg.requestRenderAll()}_toDataUrl(eg,gg,{exclude:ig=[],targetDPI:Ig=203,type:og="",ribbonBorderPattern:ng=this.ribbonBorderPattern}={},sg=null){let ag=sg;if(gg&&ag){const{left:wg,top:yg,right:Bg,bottom:Wg}=gg;ag.width=ag.width+wg+Bg,ag.height=ag.height+yg+Wg}const{left:Cg,top:lg,width:Ag,height:cg}=ag,rg=eg.viewportTransform,ug=new ot(Cg,lg).transform(rg),dg=new ot(Ag,cg).transform(rg),mg=dg.x-ug.x,bg=dg.y-ug.y;let pg=Ag/mg*(Math.trunc(Ig/o.DPI*100)/100);const Zg={format:"png",quality:1,width:mg,height:bg,left:ug.x,top:ug.y,multiplier:pg};eg.set("flagToDataURL",!0),(ag&&ag.type==="ellipse"||ag.type==="rect"&&ag.rx&&ag.ry)&&(eg.clipPath=ag);let Gg="",hg="",fg="";if(og==="print"){let wg=["text","counter","rect","circle","barcode","group"],yg=["line","ellipse","image","barcode2d"];hg=eg.toCanvasElement(pg,{...Zg,filter:Yg=>!ig.includes(Yg.id)&&(wg.includes(Yg.type)||Yg.id==="workspace")}),fg=eg.toCanvasElement(pg,{...Zg,filter:Yg=>!ig.includes(Yg.id)&&Yg.id!=="workspace"&&yg.includes(Yg.type)});let Bg=hg.getContext("2d"),Wg=Bg.getImageData(0,0,hg.width,hg.height),$g=Wg.data;const Ng=$g.length,Vg=Ng-Ng%16;let Mg=window.myThreshold||200;for(let Yg=0;Yg<Vg;Yg+=16){let Sg=$g[Yg],vg=$g[Yg+1],Rg=$g[Yg+2],kg=.299*Sg+.587*vg+.114*Rg;kg=kg>Mg?255:0,$g[Yg]=$g[Yg+1]=$g[Yg+2]=kg,Sg=$g[Yg+4],vg=$g[Yg+5],Rg=$g[Yg+6],kg=.299*Sg+.587*vg+.114*Rg,kg=kg>Mg?255:0,$g[Yg+4]=$g[Yg+5]=$g[Yg+6]=kg,Sg=$g[Yg+8],vg=$g[Yg+9],Rg=$g[Yg+10],kg=.299*Sg+.587*vg+.114*Rg,kg=kg>Mg?255:0,$g[Yg+8]=$g[Yg+9]=$g[Yg+10]=kg,Sg=$g[Yg+12],vg=$g[Yg+13],Rg=$g[Yg+14],kg=.299*Sg+.587*vg+.114*Rg,kg=kg>Mg?255:0,$g[Yg+12]=$g[Yg+13]=$g[Yg+14]=kg}for(let Yg=Vg;Yg<Ng;Yg+=4){const Sg=$g[Yg],vg=$g[Yg+1],Rg=$g[Yg+2];let kg=.299*Sg+.587*vg+.114*Rg;kg=kg>Mg?255:0,$g[Yg]=$g[Yg+1]=$g[Yg+2]=kg}Bg.save(),Bg.putImageData(Wg,0,0),Bg.globalCompositeOperation="multiply",Bg.fillStyle="rgba(255, 255, 255, 1)",Bg==null||Bg.fillRect(0,0,hg.width,hg.height),Bg.drawImage(fg,0,0,fg.width,fg.height),fg.width=0,fg.height=0,Bg.restore(),Gg=hg}else og==="review"?Gg=eg.toCanvasElement(pg,{...Zg,filter:wg=>!ig.includes(wg.id)}):ng!=="none"?Gg=eg.toCanvasElement(pg,{...Zg,filter:wg=>!ig.includes(wg.id)}):Gg=eg.toDataURL({...Zg,filter:wg=>!ig.includes(wg.id)});if(ng!=="none"&&Gg instanceof HTMLCanvasElement){const wg=Gg.getContext("2d");wg&&drawRibbonBorder(wg,ng,{width:Gg.width,height:Gg.height},this.ribbonBorderTextures),og!=="print"&&og!=="review"&&(Gg=Gg.toDataURL("image/png",1))}return eg.clipPath&&(eg.clipPath=void 0),eg.set("flagToDataURL",!1),Gg}storeStatus(){var eg;this.activeObjects=(eg=this.canvas)==null?void 0:eg.getActiveObject()}restoreStatus(eg=!1){var gg,ig,Ig;this.activeObjects?(console.log("restoreStatus"),(gg=this.canvas)==null||gg.setActiveObject(this.activeObjects),(ig=this.canvas)==null||ig.requestRenderAll(),this.activeObjects=void 0):eg&&((Ig=this.canvas)==null||Ig.requestRenderAll())}getCanvas(){if(!this.canvas)throw new Error("Editor uninit!!!");return this.canvas}static set DPI(eg){o.DPI=eg}static get DPI(){return o.DPI}dispose(){this.canvas&&this.canvas.dispose()}}Object.defineProperty(ji.prototype,"locked",{configurable:!0,enumerable:!0,get:function(){return this.lockMovementX&&this.lockMovementY&&this.lockRotation&&this.lockScalingX&&this.lockScalingY&&this.lockSkewingX&&this.lockSkewingY&&this.lockScalingFlip},set:function(tg){this.lockMovementX=this.lockMovementY=this.lockRotation=this.lockScalingX=this.lockScalingY=this.lockSkewingX=this.lockSkewingY=this.lockScalingFlip=tg,this.canvas&&this.canvas.fire("custom:object:locked",{target:this})}});class Editor extends BaseEditor{constructor(){super(...arguments),this.plugins=new Map,this.hooks=new Map,this.events=new Map,this.id=v4(),this._isShown=!1,this._isHasRfid=!1}get filePath(){return this._filePath}set filePath(eg){this._filePath=eg}get labelConfig(){return this._labelConfig}set labelConfig(eg){this._labelConfig=eg}get rfidConfig(){return this._rfidConfig}set rfidConfig(eg){this._rfidConfig=eg}get databaseConfig(){return this._databaseConfig}set databaseConfig(eg){this._databaseConfig=eg}init(eg,gg){super.init(eg,gg),this.canvas&&(this.canvas.on("custom:object:locked",ig=>{this.emit("custom:object:locked",ig)}),this.canvas.on("custom:object:refreshList",ig=>{this.emit("custom:object:refreshList",ig)}))}dispose(){this.canvas&&(this.canvas.off("custom:object:locked"),this.canvas.off("custom:object:refreshList")),this.plugins.forEach(eg=>eg.uninstall&&eg.uninstall())}addHotKey(eg,gg){hotkeys(eg,{single:!0},(ig,Ig)=>{ig.preventDefault(),gg({kbe:ig,hke:Ig})})}removeHotKey(eg){hotkeys.unbind(eg)}editActivated(){for(let eg of this.plugins.values())eg.enabled&&eg.enabled()}editDeactivated(){for(let eg of this.plugins.values())eg.disabled&&eg.disabled()}use(eg,gg){const ig=typeof eg=="function"?new eg(gg):eg;return this.checkDependencies(ig),this.runLifecycleHooks(ig,gg),ig.name&&this.plugins.set(ig.name,ig),this}checkDependencies(eg){eg.dependencies&&eg.dependencies.forEach(gg=>{if(!this.plugins.has(gg))throw new Error(`Plugin ${eg.name} requires ${gg} to be installed first`)})}runLifecycleHooks(eg,gg){eg.install&&eg.install(this,gg)}addHook(eg,gg){this.hooks.set(eg,gg)}triggerHook(eg,...gg){const ig=this.hooks.get(eg);if(ig)return ig(...gg)}getPlugin(eg){return this.plugins.get(eg)}on(eg,gg){this.events.has(eg)||this.events.set(eg,[]),this.events.get(eg).push(gg)}emit(eg,...gg){this.events.has(eg)&&this.events.get(eg).forEach(ig=>ig(...gg))}off(eg,gg){this.events.has(eg)&&(gg?this.events.set(eg,this.events.get(eg).filter(ig=>ig!==gg)):this.events.delete(eg))}toDataUrl({padding:eg,type:gg="",exclude:ig=[],targetDPI:Ig=203,isJudgeGrid:og=!1,ribbonBorderPattern:ng=this.ribbonBorderPattern}={}){if(!this.canvas)return;this.canvas.discardActiveObject();const sg=this.getPlugin("RulerPlugin"),ag=this.getPlugin("HistoryPlugin"),Cg=this.getPlugin("WorkspacePlugin"),lg=Cg.workspace;let Ag=!1;og&&(Ag=(lg==null?void 0:lg.isHasGrid)||!1,Ag&&(Cg==null||Cg.hideGrid())),sg&&sg.disabled(),ag&&ag.disabled();const cg=this._toDataUrl(this.canvas,eg,{exclude:ig,targetDPI:Ig,type:gg,ribbonBorderPattern:ng},lg);return this.canvas.renderAll(),sg&&sg.enabled(),ag&&ag.enabled(),og&&Ag&&(Cg==null||Cg.showGrid()),cg}toTemplateJson(){const eg={};eg.Version="1.0.0-alpha.1";let gg=this.canvas.toObject(cloneCommonField);if(eg.canvas=JSON.stringify(gg),this._labelConfig){const ig=this._labelConfig;ig.fileId.length===0&&(ig.fileId=v4()),eg.labelConfig=ig}return this._databaseConfig&&(eg.databaseConfig=this._databaseConfig),this._rfidConfig&&(eg.rfidConfig=this._rfidConfig),this._filePath&&(eg.filePath=this._filePath),JSON.stringify(eg)}toJSON(){return JSON.stringify(this.canvas.toObject(cloneCommonField))}fromTemplateJson(eg,gg){this.canvas&&this.canvas.loadFromJSON(eg).then(ig=>{ig.renderAll(),gg(),this.bindData&&this.canvas&&(this.bindData.originState=JSON.stringify(this.canvas.toJSON()))})}}const state$2=reactive({barcode2dSizeRatio:""});let sRatio=Math.trunc(4/3*100)/100,longbeiClearCode=["10000502","10002500","10000503"];const C0=class C0 extends ji{constructor(eg,gg){var og,ng;super(gg),this.lastCtx=null,this.lastDrawOption=null,this.hasToDataUrl=!1,this.counterProps=null,this.reviewValueArgs=null,this.barcodeDateFormatType="",this.increaseDate=!1,this.concatTextIdListObj=null,this.connectObjIds=[],this.isFirstLoad=!1,this.canModified=!0,this.useLongbeiCache=!0,this.inWorkerRender=!1,this.workerOtherImgData="",this.emitErrorMessage=throttle$1(sg=>{canvasEventBus.emit("canvasShowError",sg)},800),this._cache={canvas:void 0,error:void 0},this.counterProps=gg&&gg.counterProps?gg.counterProps:this.counterProps,this.increaseDate=gg&&gg.increaseDate?gg.increaseDate:this.increaseDate,this.barcodeDateFormatType=gg&&gg.barcodeDateFormatType?gg.barcodeDateFormatType:this.barcodeDateFormatType,((og=eg.extra)==null?void 0:og.version)==="0"&&(eg.extra=omit(eg.extra,["version"])),((ng=eg.extra)==null?void 0:ng.eclevel)==="0"&&(eg.extra=omit(eg.extra,["eclevel"])),eg.custom||(eg.custom={}),this.barcode2dOptions=cloneDeep(eg),this.concatTextIdListObj=gg&&gg.concatTextIdListObj?gg.concatTextIdListObj:this.concatTextIdListObj,this.connectObjIds=gg.connectObjIds??this.connectObjIds,this.barcode2dOptions.includetext=eg.includetext??!1,this.barcode2dOptions.textposition=this.barcode2dOptions.includetext?this.barcode2dOptions.textposition||"bottom":"none",this.barcode2dOptions.textsize=this.barcode2dOptions.textsize||14,this.barcode2dOptions.textfontname=this.barcode2dOptions.textfontname||"Arial",this.barcode2dOptions.textxalign=this.barcode2dOptions.textxalign||"center",this.barcode2dOptions.textgaps=this.barcode2dOptions.textgaps||0,this.set({width:this.width,height:this.height}),this.on("modified",sg=>{console.log("eee=======",sg),lpBcid.includes(this.barcode2dOptions.bcid)&&(sg==null?void 0:sg.action)!=="drag"&&(this.canModified=!0,setTimeout(()=>{let ag=this.barcode2dOptions.custom,Cg=this.width*this.scaleX,lg=this.height*this.scaleY,Ag=Math.max(Cg/lg,lg/Cg);Ag=Math.trunc(Ag*100)/100,[1,2,sRatio].includes(Ag)?(ag.sizeRatio=Ag===1?"1x1":Ag===2?"2x1":"4x3",state$2.barcode2dSizeRatio=ag.sizeRatio):(ag.sizeRatio="auto",state$2.barcode2dSizeRatio=ag.sizeRatio),console.log("state.barcode2dSizeRatio========",state$2.barcode2dSizeRatio)},30)),lpBcid.includes(this.barcode2dOptions.bcid)&&(sg==null?void 0:sg.action)==="drag"&&this.updateLpCodePosition()}),this.on("scaling",()=>{lpBcid.includes(this.barcode2dOptions.bcid)&&(this.canModified=!1,this.clearErrorLpCodeMap())}),canvasEventBus.off(`update:barcode2d:${this.id}`),canvasEventBus.on(`update:barcode2d:${this.id}`,async({list:sg,callback:ag=function(){}}={})=>{let Cg=await this.updateBarCode2d(sg);ag&&ag(Cg)})}updateLpCodePosition(){let eg=this.getLpCache();eg&&(eg.x=this.left,eg.y=this.top)}clearErrorLpCodeMap(){errorLpCodeMap.delete(this.id)}getLpCache(){let eg="",gg=this.id;return this.barcode2dOptions.bcid==="LPCode"?eg=getLastCacheLpcode(gg):this.barcode2dOptions.bcid==="LPMixQrCode"&&(eg=getLastMixCacheLpcode(gg)),eg}drawLpCode(eg,gg,ig,Ig,og,ng="",sg=null){var lg;let ag=eg||this.lastCtx;if(this._cache.error=void 0,ng==="cache"&&(this.width=Ig,this.height=og,this.scaleX=1,this.scaleY=1,sg&&(this.left=sg.x,this.top=sg.y),this.lastDrawOption={w:this.width,h:this.height,x:-this.width/2,y:-this.height/2},ig.w=this.lastDrawOption.w,ig.h=this.lastDrawOption.h,ig.x=this.lastDrawOption.x,ig.y=this.lastDrawOption.y,this.strokeWidth>0&&(ig.x+=this.strokeWidth,ig.y+=this.strokeWidth),this.setCoords()),this.inWorkerRender||(this.workerOtherImgData=gg),ag.drawImage(gg,ig.x,ig.y,Ig,og),this.strokeWidth>0){let Ag=this.stroke||"#fff";ag.lineWidth=this.strokeWidth,ag.strokeStyle=Ag,ag.strokeRect(-this.width/2,-this.height/2,Ig+this.strokeWidth*2,og+this.strokeWidth*2)}this.dirty=!0;let Cg=this.group;for(;Cg;)Cg.dirty=!0,Cg=Cg.group;this.isFirstLoad||(this.objectCaching=!1,this.isFirstLoad=!0),(lg=this.canvas)==null||lg.requestRenderAll(),this.objectCaching||setTimeout(()=>{this.objectCaching=!0},60)}getTextLayout(eg,gg,ig){if(!(gg.includetext&&gg.textposition!=="none"&&!!gg.text))return{showText:!1,textGap:0,textLineHeight:0,textAreaHeight:0,barcodeHeight:ig.h};const{scaleY:og}=this.getRenderScale(),ng=Number(gg.textsize)||14;eg.save(),eg.font=`${ng}px ${gg.textfontname||"Arial"}`;const sg=eg.measureText(gg.text||""),ag=sg.actualBoundingBoxAscent+sg.actualBoundingBoxDescent||ng*1.2;eg.restore();const Cg=14/og,lg=6/og,Ag=Math.min(ig.h-1,Math.ceil(ag/og+Cg+lg));return{showText:!0,textGap:Cg,textLineHeight:ag,textAreaHeight:Ag,barcodeHeight:Math.max(1,ig.h-Ag)}}getRenderScale(){var Ig;const eg=(Ig=this.getObjectScaling)==null?void 0:Ig.call(this),gg=Math.abs((eg==null?void 0:eg.x)||this.scaleX||1)||1,ig=Math.abs((eg==null?void 0:eg.y)||this.scaleY||1)||1;return{scaleX:gg,scaleY:ig}}renderText(eg,gg,ig,Ig,og){if(!gg.includetext||gg.textposition==="none"||!gg.text)return;const ng=gg.textxalign||"center";let sg=ig.x;ng==="center"?sg=ig.x+ig.w/2:ng==="right"&&(sg=ig.x+ig.w),eg.save();const{scaleX:ag,scaleY:Cg}=this.getRenderScale();eg.scale(1/ag,1/Cg),eg.font=`${gg.textsize||14}px ${gg.textfontname||"Arial"}`,eg.fillStyle=gg.textcolor||"#000",eg.textAlign=ng,eg.textBaseline="top",gg.textgaps&&(eg.letterSpacing=gg.textgaps+"px"),eg.fillText(gg.text,sg*ag,(ig.y+Ig+og)*Cg),eg.restore()}async _render(eg){var og,ng,sg,ag,Cg;const gg=cloneDeep(this.barcode2dOptions);this.lastCtx=eg;const ig={w:this.width,h:this.height,x:-this.width/2,y:-this.height/2},Ig=this.getTextLayout(eg,gg,ig);if(eg.save(),eg.imageSmoothingEnabled=!1,this.dirty){if(gg.width=ig.w,gg.height=Ig.barcodeHeight,typeof this.fill=="string"){let lg=rgbaStringToHex8(this.fill);gg.barcolor=hexToHex6_blend(lg)}this.strokeWidth>0&&(gg.width-=this.strokeWidth*2,gg.height-=this.strokeWidth*2);try{lpBcid.includes(gg.bcid)||(this._cache.canvas=generateCanvas(gg),this.dirty=!1,this._cache.error&&(this._cache.error=void 0))}catch(lg){this.dirty=!0,lg instanceof Error&&(console.log("error",lg.message),this._cache.error=lg.message),this._cache.canvas=void 0}}if(this.strokeWidth>0&&(ig.x+=this.strokeWidth,ig.y+=this.strokeWidth),this.lastDrawOption=ig,lpBcid.includes(gg.bcid)){let lg=this.lastDrawOption;const Ag=this.strokeWidth>0?lg.w-this.strokeWidth*2:lg.w,cg=Math.max(1,this.strokeWidth>0?Ig.barcodeHeight-this.strokeWidth*2:Ig.barcodeHeight);let rg=Ag*this.scaleX,ug=cg*this.scaleY,dg=gg.text,mg=Number((og=gg.extra)==null?void 0:og.eclevel)||1;mg=mg+"";let bg=Math.trunc(rg/Editor.DPI*25.4*100)/100,pg=Math.trunc(ug/Editor.DPI*25.4*100)/100,Zg=bg/(pg||1),Gg=((ng=gg.custom)==null?void 0:ng.CellSize)||"8",hg=`${dg}-${mg}-${bg+pg}-${Zg}-${Gg}`,fg=`${this.id}`,wg=null;if(gg.bcid==="LPMixQrCode"){let yg=((sg=gg.custom)==null?void 0:sg.LPErrLevel)||"0",Bg=((ag=gg.custom)==null?void 0:ag.QRErrLevel)||"0";mg=`${yg}-${Bg}`,hg=`${dg}-${mg}-${bg+pg}-${Zg}-${Gg}`}try{if(errorLpCodeMap.has(fg)){errorLpCodeMap.set(fg,this._cache.error||"龙贝码生成错误");let yg=this.getLpCache();if(yg&&this.useLongbeiCache){let Bg=yg||{};wg=Bg.img,this.drawLpCode(eg,wg,lg,Bg.rWidth,Bg.rHeight,"cache",Bg),this._cache.error=void 0}else this._cache.error=errorLpCodeMap.get(fg)||"龙贝码生成错误"}else{if(lpCodeMap.has(hg)&&this.useLongbeiCache){wg=lpCodeMap.get(hg);let yg={id:this.id,sKey:hg,img:wg,rWidth:rg,rHeight:ug,x:this.left,y:this.top};this.barcode2dOptions.bcid==="LPCode"?setCacheLpCode(yg):setCacheMixLpCode(yg)}else if(this.canModified){let yg={Content:dg,ErrLevel:mg,Width:bg,Height:pg,id:this.id,rWidth:rg,rHeight:ug,CellSize:Gg,x:this.left,y:this.top,DPI:Editor.DPI};this.useLongbeiCache||lpCodeMap.delete(hg),this.barcode2dOptions.bcid==="LPCode"?wg=await getBase64Data(yg):wg=await getMixBase64Data(yg),this.useLongbeiCache=!0}if(lpCodeMap.has(hg)&&this.useLongbeiCache)this._cache.error=void 0,this.drawLpCode(eg,wg,lg,Ag,cg);else if(this.useLongbeiCache){let yg=this.getLpCache();yg&&(wg=(yg||{}).img,this.drawLpCode(eg,wg,lg,Ag,cg),this._cache.error=void 0)}}}catch(yg){let Bg=yg&&yg.code,Wg=this.getLpCache();if(errorLpCodeMap.set(fg,this._cache.error||"龙贝码生成错误"),Bg&&(longbeiClearCode.includes(Bg+"")&&(this.useLongbeiCache=!1,clearLpAndMixCacheById(this.id),this._cache.error=`龙贝码: ${yg.payload}`),this.emitErrorMessage(yg.payload)),Wg&&this.useLongbeiCache){let $g=Wg||{};wg=$g.img,this.drawLpCode(eg,wg,lg,$g.rWidth,$g.rHeight,"cache",$g),this._cache.error=void 0}else Bg&&(this._cache.error=`龙贝码: ${yg.payload}`,this.dirty=!0,(Cg=this.canvas)==null||Cg.requestRenderAll())}}else this.objectCaching=!0;if(!this._cache.error&&!lpBcid.includes(gg.bcid)){if(this._cache.canvas){const lg=this.strokeWidth>0?ig.w-this.strokeWidth*2:ig.w,Ag=Math.max(1,this.strokeWidth>0?Ig.barcodeHeight-this.strokeWidth*2:Ig.barcodeHeight),cg=this._cache.canvas;if(eg.drawImage(cg,0,0,cg.width,cg.height,ig.x,ig.y,lg,Ag),this.strokeWidth>0){let rg=this.stroke||"#fff";eg.lineWidth=this.strokeWidth,eg.strokeStyle=rg,eg.strokeRect(-this.width/2,-this.height/2,ig.w,ig.h)}}}if(!this._cache.error&&Ig.showText&&this.renderText(eg,gg,ig,Ig.barcodeHeight,Ig.textGap),eg.translate(.5,.5),this._cache.error){const lg=wrapText(eg,this._cache.error,ig.w,"bold 18px 宋体"),Ag=getLineHeight(eg);let cg=ig.y+Ag;const rg=eg.fillStyle;eg.fillStyle="red";for(const ug of lg)eg.fillText(ug,ig.x,cg),cg+=Ag;eg.fillStyle=rg}eg.restore()}async getLongBeiImg(eg){var dg,mg,bg,pg;if(!lpBcid.includes(eg.bcid))return;let gg=this.lastDrawOption;const ig=this.strokeWidth>0?gg.w-this.strokeWidth*2:gg.w,Ig=this.strokeWidth>0?gg.h-this.strokeWidth*2:gg.h;let og=eg.text,ng=Number((dg=eg.extra)==null?void 0:dg.eclevel)||1,sg=ig*this.scaleX,ag=Ig*this.scaleY,Cg=Math.trunc(sg/Editor.DPI*25.4*100)/100,lg=Math.trunc(ag/Editor.DPI*25.4*100)/100,Ag=Cg/(lg||1),cg=((mg=eg.custom)==null?void 0:mg.CellSize)||"8",rg=`${og}-${ng}-${Cg+lg}-${Ag}-${cg}`,ug=null;if(eg.bcid==="LPMixQrCode"){let Zg=((bg=eg.custom)==null?void 0:bg.LPErrLevel)||"0",Gg=((pg=eg.custom)==null?void 0:pg.QRErrLevel)||"0";ng=`${Zg}-${Gg}`,rg=`${og}-${ng}-${Cg+lg}-${Ag}-${cg}`}this.clearErrorLpCodeMap();try{if(lpCodeMap.has(rg)&&this.useLongbeiCache)ug=lpCodeMap.get(rg);else{let Zg={Content:og,ErrLevel:ng,Width:Cg,Height:lg,id:this.id,rWidth:sg,rHeight:ag,CellSize:cg,x:this.left,y:this.top,DPI:Editor.DPI};this.barcode2dOptions.bcid==="LPCode"?ug=await getBase64Data(Zg,"noSaveCache"):ug=await getMixBase64Data(Zg,"noSaveCache"),this.useLongbeiCache=!0}return this.workerOtherImgData=ug,this._cache.error=void 0,ug}catch(Zg){console.error(Zg)}}dispose(){super.dispose()}set(eg,gg){return super.set(eg,gg)}countDate(eg=""){if(this.barcodeDateFormatType&&this.increaseDate){const gg=formatDate(this.barcodeDateFormatType);return console.log("formatted",gg),this.dirty=!0,eg!=="print"&&this.setBarcode2DOption({bcid:this.barcode2dOptions.bcid,text:gg}),gg}}countCurrent(eg){let gg=this.counterProps||eg;if(gg){let ig=gg;if(!ig.value&&ig.value!==0)return"";const Ig=formatCounterValue(ig);return(ig.prefix&&ig.prefix.length>0?ig.prefix:"")+Ig+(ig.suffix&&ig.suffix.length>0?ig.suffix:"")}return""}countNext(eg="print"){if(this.counterProps){let gg=this.counterProps;if(!gg.value&&gg.value!==0)return;eg==="review"&&!this.reviewValueArgs&&(this.reviewValueArgs={...gg});const ig=formatCounterValue(gg);let Ig=(gg.prefix&&gg.prefix.length>0?gg.prefix:"")+ig+(gg.suffix&&gg.suffix.length>0?gg.suffix:"");const og=getNextCounterValue(gg);return og!==null&&(gg.value=og,this.counterProps.value=og),this.dirty=!0,Ig}else return""}reviewRecover(){if(this.reviewValueArgs){const eg=this.reviewValueArgs;this.counterProps=eg,this.reviewValueArgs=null;const gg=formatCounterValue(eg);let ig=(eg.prefix&&eg.prefix.length>0?eg.prefix:"")+gg+(eg.suffix&&eg.suffix.length>0?eg.suffix:"");this.setBarcode2DOption({bcid:this.barcode2dOptions.bcid,text:ig})}}updateInGroup(){this.setCoords(),this.dirty=!0;let eg=this.group;for(;eg;)eg.dirty=!0,eg==null||eg.triggerLayout("childUpdate"),eg.setCoords(),eg=eg.group}async updateBarCode2d(eg=[],gg=""){var ig;if(this.concatTextIdListObj||this.connectObjIds&&this.connectObjIds.length>0){let Ig=!1,og="",ng=[],sg=[];const ag=lg=>{if(this.connectObjIds){let Ag=0;for(let cg of this.connectObjIds){if(cg.index=Ag,cg.id&&cg.id===lg.id){Ig=!0;let rg=lg.text+"";if(lg.type==="counter"&&(lg._props.mode==="1"?rg=lg.countCurrent():lg._props.mode==="2"&&(lg.updateText({isUpdateBarCodeDate:!1}),rg=lg.text+"")),cg.maxEnd=rg.length,cg.isSplit){cg.start=Math.min(cg.start,cg.maxEnd);let ug=rg.slice(cg.start,cg.end);ng[Ag]=ug}else ng[Ag]=rg}Ag++}}},Cg=lg=>{lg.type==="text"&&this.concatTextIdListObj&&this.concatTextIdListObj[lg.id]&&(Ig||(this.barcode2dOptions.bcid==="LPMixQrCode"?lg==null||lg.set("text",this.barcode2dOptions.text.replace(/\|&&&\|/g,"")):lg==null||lg.set("text",this.barcode2dOptions.text),lg.updateInGroup()),sg.push(lg))};if(eg.length>0)eg.forEach(lg=>{ag(lg),Cg(lg)});else{const lg=Ag=>{Ag.type==="group"&&Ag._objects?Ag._objects.forEach(cg=>lg(cg)):(ag(Ag),Cg(Ag))};(ig=this.canvas)==null||ig.getObjects().forEach(Ag=>lg(Ag))}return Ig?(og=ng.join(""),this.barcode2dOptions.text=og,lpBcid.includes(this.barcode2dOptions.bcid)&&gg&&await this.getLongBeiImg(this.barcode2dOptions),this.dirty=!0,gg&&this.updateInGroup(),setTimeout(()=>{var lg;(lg=this.canvas)==null||lg.requestRenderAll()},0),sg.forEach(lg=>{lg==null||lg.set("text",og),lg.updateInGroup()}),og):""}else return""}setBarcode2DOption(eg){if(this.barcode2dOptions.bcid!==eg.bcid&&(eg.extra={},this.barcode2dOptions.extra={}),merge(this.barcode2dOptions,eg),eg.extra&&(typeof+eg.extra.version=="number"&&eg.extra.version==="0"&&(this.barcode2dOptions.extra=omit(this.barcode2dOptions.extra,["version"])),eg.extra.eclevel==="0"&&(this.barcode2dOptions.extra=omit(this.barcode2dOptions.extra,["eclevel"]))),this.dirty=!0,!lpBcid.includes(this.barcode2dOptions.bcid)){let ig=this.group;for(;ig;)ig.dirty=!0,ig=ig.group}let gg=getAllObjectMap();this.updateBarCode2d([...gg.text,...gg.counter])}getBarcode2DOption(){return cloneDeep(this.barcode2dOptions)}toObject(eg){let gg=["barcode2dOptions","counterProps","concatTextIdListObj","increaseDate","barcodeDateFormatType","connectObjIds"];return super.toObject(eg?[...eg,...gg]:gg)}};C0.type="Barcode2D";let ABarcode2D=C0;ABarcode2D.fromObject=(tg,eg)=>ABarcode2D._fromObject(tg,{...eg,extraParam:"barcode2dOptions"}),tt.setClass(ABarcode2D),tt.setSVGClass(ABarcode2D);class ContextMenu{constructor(eg,gg){this.container=eg,this.menuItems=gg,this.activeSubmenus=[],this.shown=!1,this.disableTop=!1,this.disableBottom=!1,this.activeSubmenuHandler=this._activeSubmenuHandler.bind(this),this.menuItems=gg,this.menuElement=this.createMenuElement(),eg.appendChild(this.menuElement),this.setupEventListeners()}setTargetObj(eg){this.targetObj=eg}createMenuElement(){const eg=document.createElement("div");return eg.id="custom-context-menu",eg}createMenuItemElement(eg){const gg={itemText:eg.text??""};if(eg.isShow&&!eg.isShow(this.targetObj,gg))return document.createElement("div");if(eg.isSeparator){const ng=document.createElement("div");return ng.classList.add("item-separator"),ng}if(eg.isGroupTitle){const ng=document.createElement("div");return ng.textContent=gg.itemText,ng.classList.add("item-group"),ng}const ig=document.createElement("div");ig.className="menu-item",ig.dataset.id=eg.id,eg.disabled&&ig.classList.add("canvas-contextmenu-disabled"),eg.subItems&&eg.subItems.length>0&&ig.classList.add("has-submenu");const Ig=document.createElement("div");Ig.textContent=gg.itemText;const og=document.createElement("div");if(og.classList.add("menu-item-content"),og.appendChild(Ig),!eg.subItems||eg.subItems.length===0){const ng=document.createElement("div");ng.style.marginLeft="20px",ng.style.color="#999",ng.textContent=eg.hotKey||"",og.appendChild(ng)}if(ig.appendChild(og),eg.subItems&&eg.subItems.length>0){const ng=document.createElement("span");ng.className="arrow",ng.textContent="›",ig.appendChild(ng)}if(eg.subItems&&!eg.disabled){if(eg.subItems.length>0){const ng=this.activeSubmenus.length+1,sg=document.createElement("div");sg.className="submenu",sg.style.zIndex=ng+"",eg.subItems.forEach(ag=>{const Cg=this.createMenuItemElement(ag);Cg&&sg.appendChild(Cg)}),ig.appendChild(sg),ig.addEventListener("mouseenter",ag=>{this.activeSubmenuHandler(ag)||(sg.style.display="block",this.positionSubmenu(ig,sg),this.activeSubmenus.push(ig,sg))})}}else eg.disabled||(ig.addEventListener("click",ng=>{if(eg.handler){const sg=eg.handler(eg,ng);this.canvasContainer&&this.canvasContainer.focus({preventScroll:!0}),sg!==!1&&this.hide()}else this.hide();ng.stopPropagation()}),ig.addEventListener("mouseenter",this.activeSubmenuHandler));return ig}_activeSubmenuHandler(eg){if(this.activeSubmenus.length>0){const gg=eg.target;for(let ig=this.activeSubmenus.length-1;ig>0;ig-=2){const Ig=this.activeSubmenus[ig-1],og=this.activeSubmenus[ig];if(Ig.parentElement===gg.parentElement){if(Ig===gg)return!0;og.style.display="none"}else{if(og.contains(gg))return!1;og.style.display="none"}this.activeSubmenus.pop(),this.activeSubmenus.pop()}}return!1}setupEventListeners(){document.addEventListener("click",eg=>{!this.menuElement.contains(eg.target)&&this.shown&&this.hide()}),document.addEventListener("keydown",eg=>{eg.key==="Escape"&&this.shown&&this.hide()})}positionMenu(eg,gg){const ig=window.innerWidth,Ig=window.innerHeight,og=this.menuElement.offsetWidth,ng=this.menuElement.offsetHeight;eg+og>ig&&(eg=ig-og-5),gg+ng>Ig&&(gg=Ig-ng-5),this.menuElement.style.left=`${eg}px`,this.menuElement.style.top=`${gg}px`}positionSubmenu(eg,gg){const ig=eg.getBoundingClientRect(),Ig=gg.offsetWidth,og=window.innerWidth,ng=getComputedStyle(gg);let sg=0,ag=0;ig.right+Ig>og?(sg=-Ig-parseInt(ng.paddingLeft),gg.classList.add("left")):sg=ig.width+parseInt(ng.paddingLeft);const Cg=gg.offsetHeight,lg=window.innerHeight;ig.top+Cg>lg?ag=ig.height-Cg+parseInt(ng.paddingBottom):ag=-parseInt(ng.paddingTop),gg.style.left=`${sg}px`,gg.style.top=`${ag}px`}show(eg,gg){console.time("show"),this.shown&&this.hide(),this.menuElement.innerHTML="",this.menuItems.forEach(ig=>{const Ig=this.createMenuItemElement(ig);Ig&&this.menuElement.appendChild(Ig)}),this.menuElement.style.display="block",this.positionMenu(eg,gg),this.shown=!0,console.timeEnd("show")}hide(){this.shown&&(this.menuElement.style.display="none",this.menuElement.innerHTML="",this.shown=!1)}addItems(eg,gg){gg?this.addItemsToSubmenu(eg,gg,this.menuItems):this.menuItems.push(...eg)}addItemsToSubmenu(eg,gg,ig){for(const Ig of ig){if(Ig.id===gg)return Ig.subItems||(Ig.subItems=[]),Ig.subItems.push(...eg),!0;if(Ig.subItems&&this.addItemsToSubmenu(eg,gg,Ig.subItems))return!0}return!1}updateItem(eg,gg){return this.updateItemRecursive(eg,gg,this.menuItems)}updateItemRecursive(eg,gg,ig){for(const Ig of ig){if(Ig.id===eg)return Object.assign(Ig,gg),!0;if(Ig.subItems&&this.updateItemRecursive(eg,gg,Ig.subItems))return!0}return!1}removeItem(eg){return this.removeItemRecursive(eg,this.menuItems)}removeItemRecursive(eg,gg){const ig=gg.findIndex(Ig=>Ig.id===eg);if(ig!==-1)return gg.splice(ig,1),!0;for(const Ig of gg)if(Ig.subItems&&this.removeItemRecursive(eg,Ig.subItems))return!0;return!1}getItems(){return this.menuItems}setItems(eg){this.menuItems=eg}}class ContextMenuPlugin{constructor(){this.name="ContextMenuPlugin",this.eventHandler={contextmenu:this.contextMenuHandler.bind(this)}}addItem(eg){var ig;const gg=Array.isArray(eg)?eg:[eg];(ig=this.contextMenu)==null||ig.addItems(gg),gg.forEach(Ig=>{!Ig.isGroupTitle&&!Ig.isSeparator&&Ig.hotKey&&Ig.hotKeyHandler&&this.editor.addHotKey(Ig.hotKey,Ig.hotKeyHandler)})}removeItem(eg){var gg;(gg=this.contextMenu)==null||gg.removeItem(eg)}updateItem(eg,gg){if(this.contextMenu&&(this.contextMenu.updateItem(eg,gg),gg.hotKey&&gg.hotKeyHandler)){const ig=this.contextMenu.getItems().find(Ig=>Ig.id===eg);ig&&(ig.hotKey&&this.editor.removeHotKey(ig.hotKey),ig.hotKey=gg.hotKey,ig.hotKeyHandler=gg.hotKeyHandler,this.editor.addHotKey(ig.hotKey,ig.hotKeyHandler))}}disabled(){this.contextMenu&&this.container&&(this.editor.getCanvas().off("contextmenu",this.eventHandler.contextmenu),this.contextMenu.hide(),this.contextMenu.getItems().forEach(eg=>{!eg.isGroupTitle&&!eg.isSeparator&&eg.hotKey&&eg.hotKeyHandler&&this.editor.removeHotKey(eg.hotKey)}))}contextMenuHandler(eg){var gg;if(eg.e){const ig=eg.e;if(ig.button===2&&eg.target&&this.contextMenu){if(eg.target.id==="workspace")return;let Ig=((gg=this.canvas)==null?void 0:gg.getObjects())||[];Ig=Ig.filter(ag=>ag.id!=="workspace");let og=Ig==null?void 0:Ig.indexOf(eg.target);const ng=og===(Ig==null?void 0:Ig.length)-1,sg=og===0;this.contextMenu.disableTop=ng,this.contextMenu.disableBottom=sg,eg.target.type==="activeselection"?eg.target.getObjects().length>1?(this.contextMenu.updateItem("lock",{disabled:!0}),this.contextMenu.updateItem("layer",{disabled:!0})):(this.contextMenu.updateItem("lock",{disabled:!1}),this.contextMenu.updateItem("layer",{disabled:!1})):(this.contextMenu.updateItem("lock",{disabled:!1}),this.contextMenu.updateItem("layer",{disabled:!1})),this.contextMenu.updateItem("layer-top",{disabled:!1}),this.contextMenu.updateItem("layer-up",{disabled:!1}),this.contextMenu.updateItem("layer-bottom",{disabled:!1}),this.contextMenu.updateItem("layer-down",{disabled:!1}),ng&&(this.contextMenu.updateItem("layer-top",{disabled:!0}),this.contextMenu.updateItem("layer-up",{disabled:!0})),sg&&(this.contextMenu.updateItem("layer-bottom",{disabled:!0}),this.contextMenu.updateItem("layer-down",{disabled:!0})),ig.preventDefault(),this.canvas.setActiveObject(eg.target),this.contextMenu.setTargetObj(eg.target),this.contextMenu.show(ig.clientX,ig.clientY)}}}install(eg,gg){this.editor=eg,this.canvas=eg.getCanvas(),this.container=document.getElementById("app"),this.contextMenu=new ContextMenu(this.container,[]),this.contextMenu.canvasContainer=this.canvas.elements.container,this.enabled()}enabled(){this.contextMenu&&this.container&&(this.editor.getCanvas().on("contextmenu",this.eventHandler.contextmenu),this.contextMenu.getItems().forEach(eg=>{!eg.isGroupTitle&&!eg.isSeparator&&eg.hotKey&&eg.hotKeyHandler&&this.editor.addHotKey(eg.hotKey,eg.hotKeyHandler)}))}}class Ruler{constructor(eg,gg){this.ctx=eg,this.dpi=96,this.isShown=!1,this.gapValue=0,this.getGapMM=ig=>{const Ig=[.02,.05,.1,.2,.5,1,2,5,10],og=[500,200,100,50,25,10,5,2,1];let ng=0;for(;ng<Ig.length&&Ig[ng]<ig;)ng++;return og[ng-1]||1e3},this.options=gg}show(){this.isShown=!0}hide(){this.isShown=!1}drawLine(eg,gg,ig,Ig,og,ng){this.ctx.save(),this.ctx.beginPath(),og&&(this.ctx.strokeStyle=og),this.ctx.lineWidth=ng??1,this.ctx.moveTo(eg+.5,gg+.5),this.ctx.lineTo(eg+ig+.5,gg+Ig+.5),this.ctx.stroke(),this.ctx.restore()}drawText({text:eg="",left:gg=0,top:ig=0,fillStyle:Ig,align:og,angle:ng,fontSize:sg=this.options.fontSize}){this.ctx.save(),Ig&&(this.ctx.fillStyle=Ig),this.ctx.textAlign=og??"left",this.ctx.textBaseline="top",this.ctx.font=`${sg??10}px sans-serif, Noto Sans, SourceHanSansCN`,ng&&(this.ctx.translate(gg,ig),this.ctx.rotate(Math.PI/180*ng),this.ctx.translate(-gg,-ig)),this.ctx.fillText(eg,gg,ig),this.ctx.restore()}darwRect({left:eg=0,top:gg=0,width:ig,height:Ig,fillStyle:og,stroke:ng,strokeWidth:sg}){this.ctx.save(),this.ctx.beginPath(),og&&(this.ctx.fillStyle=og),this.ctx.rect(eg,gg,ig,Ig),this.ctx.fill(),ng&&(this.ctx.strokeStyle=ng,this.ctx.lineWidth=sg??1,this.ctx.stroke()),this.ctx.restore()}drawMask(eg,gg,ig,Ig,og,ng){this.ctx.save();const sg=eg?this.ctx.createLinearGradient(gg,og/2,gg+Ig,og/2):this.ctx.createLinearGradient(Ig/2,ig,Ig/2,og+ig),ag=new Le(ng);ag.setAlpha(0),sg.addColorStop(0,ag.toRgba()),sg.addColorStop(.33,ng),sg.addColorStop(.67,ng),sg.addColorStop(1,ag.toRgba()),this.darwRect({left:gg,top:ig,width:Ig,height:og,fillStyle:sg}),this.ctx.restore()}drawBackground(eg,gg,ig){const Ig=this.options.rulerSize,og=this.options.canvasWidth,ng=this.options.canvasHeight;eg?this.darwRect({left:0,top:0,width:og,height:Ig,fillStyle:this.options.backgroundColor}):this.darwRect({left:0,top:0,width:Ig,height:ng,fillStyle:this.options.backgroundColor})}drawMM(eg,gg,ig){const Ig=this.options.rulerSize,og=this.options.canvasWidth,ng=this.options.canvasHeight,sg=this.getGapMM(ig);this.gapValue=sg;const ag=this.dpi/25.4*ig*sg,Cg=Ig*.2,lg=Ig*.8,Ag=new Le(this.options.textColor).toRgb();eg?(this.drawLine(0,0,og,0,this.options.borderColor),this.drawLine(0,Ig,og,0,Ag)):(this.drawLine(0,0,0,ng,this.options.borderColor),this.drawLine(Ig,0,0,ng,Ag)),this.ctx.save(),this.ctx.beginPath();let cg=sg>2,rg=sg>10?10:sg>=5?5:1;if(eg){if(this.ctx.rect(Ig,0,og-Ig,Ig),this.ctx.clip(),gg<0){let mg=-gg*ig-ag,bg=1;for(;mg>Ig;){if(cg&&bg===1)for(let hg=1;hg<10;hg++){const fg=mg+ag/rg*hg;fg>Ig&&this.drawLine(fg,Cg+13,0,lg*.3,Ag,1)}if(this.drawLine(mg,Cg+10,0,lg*.6,Ag),cg)for(let hg=1;hg<10;hg++){const fg=mg-ag/rg*hg;fg>Ig&&this.drawLine(fg,Cg+13,0,lg*.3,Ag,1)}const pg=-bg*sg+"",Zg=10*pg.length/4,Gg=Ig-this.options.fontSize-2;this.drawText({text:pg,left:mg-Zg,top:Gg-7,fillStyle:Ag,align:void 0,angle:0}),mg-=ag,bg++}}let ug=-gg*ig,dg=0;for(;ug<og;){if(Math.ceil(ug)>=Ig){if(this.drawLine(ug,Cg+10,0,lg*.6,Ag),cg)for(let Zg=1;Zg<10;Zg++){const Gg=ug+ag/rg*Zg;Gg<og&&this.drawLine(Gg,Cg+13,0,lg*.3,Ag,1)}const mg=dg*sg+"",bg=10*mg.length/4,pg=Ig-this.options.fontSize-2;this.drawText({text:mg,left:ug-bg,top:pg-7,fillStyle:Ag,align:void 0,angle:0})}ug+=ag,dg++}}else{if(this.ctx.rect(0,Ig,Ig,ng-Ig),this.ctx.clip(),gg<0){let mg=-gg*ig-ag,bg=1;for(;mg>Ig;){if(cg&&bg===1)for(let hg=1;hg<10;hg++){const fg=mg+ag/rg*hg;fg>Ig&&this.drawLine(Cg+13,fg,lg*.3,0,Ag,1)}if(this.drawLine(Cg+10,mg,lg*.6,0,Ag),cg)for(let hg=1;hg<10;hg++){const fg=mg-ag/rg*hg;fg>Ig&&this.drawLine(Cg+13,fg,lg*.3,0,Ag,1)}const pg=-bg*sg+"",Zg=10*pg.length/4,Gg=Ig-this.options.fontSize-2;this.drawText({text:pg,left:Gg-7,top:mg+Zg,fillStyle:Ag,align:void 0,angle:-90}),mg-=ag,bg++}}let ug=-gg*ig,dg=0;for(;ug<ng;){if(ug>Ig){if(this.drawLine(Cg+10,ug,lg*.6,0,Ag),cg)for(let Zg=1;Zg<10;Zg++){const Gg=ug+ag/rg*Zg;Gg<ng&&this.drawLine(Cg+13,Gg,lg*.3,0,Ag,1)}const mg=dg*sg+"",bg=10*mg.length/4,pg=Ig-this.options.fontSize-2;this.drawText({text:mg,left:pg-7,top:ug+bg,fillStyle:Ag,align:void 0,angle:-90})}ug+=ag,dg++}}this.ctx.restore()}drawActiveLine(eg,gg,ig){if(!this.objectRect)return;const Ig=this.options.rulerSize,og=eg?"x":"y",ng=new Le(this.options.maskColor);this.objectRect[og].forEach(sg=>{if(ng.setAlpha(.5),sg.skip===og)return;let ag=eg?sg.left:sg.top,Cg=eg?sg.width:sg.height,lg=(ag-gg)*ig,Ag=Cg*ig;const cg={width:eg?Ag:Ig-8,height:eg?Ig-8:Ag,backgroundColor:this.options.backgroundColor};this.drawMask(eg,eg?lg:0,eg?2:lg,cg.width,cg.height,cg.backgroundColor),this.darwRect({left:eg?lg:Ig-8,top:eg?Ig-8:lg,width:eg?Ag:8,height:eg?8:Ag,fillStyle:ng.toRgba()});const rg=Ig/2-(this.options.fontSize??12)/2-4,ug=Zg=>Math.round(Zg*(25.4/Editor.DPI)*100)/100+"",dg=ug(ag),mg=ug(ag+Cg),bg={fill:ng.toRgba(),angle:eg?0:-90};this.drawText({text:dg,left:eg?lg-2:rg,top:eg?rg:lg-15,fillStyle:bg.fill,align:eg?"right":"center",angle:bg.angle}),dg!==mg&&this.drawText({text:mg,left:eg?lg+Ag+2:rg,top:eg?rg:lg+Ag+17,fillStyle:bg.fill,align:eg?"left":"center",angle:bg.angle});const pg=dg===mg?8:14;ng.setAlpha(1),this.drawLine(eg?lg:Ig-pg,eg?Ig-pg:lg,eg?0:pg,eg?pg:0,ng.toRgba()),dg!==mg&&this.drawLine(eg?lg+Ag:Ig-pg,eg?Ig-pg:lg+Ag,eg?0:pg,eg?pg:0,ng.toRgba())})}}class RulerPlugin{constructor(){this.name="RulerPlugin",this.eventHandler={calcObjectRect:throttle$3(this.calcObjectRect.bind(this),15),selectinClear:throttle$3(this.selectionClear.bind(this),15),renderRuler:eg=>{eg.ctx&&this.renderRuler()},canvasMouseDown:throttle$3(this.canvasMouseDown.bind(this),15),canvasMouseMove:throttle$3(this.canvasMouseMove.bind(this),15),canvasMouseUp:throttle$3(this.canvasMouseUp.bind(this),15)}}uninstall(){}install(eg,gg){this.editor=eg;const ig=Object.assign({rulerSize:25,fontSize:12,canvasWidth:this.editor.getCanvas().width,canvasHeight:this.editor.getCanvas().height,backgroundColor:"#fff",borderColor:"#ddd",maskColor:"#007fff",textColor:"#888"},gg);this.ruler=new Ruler(eg.getCanvas().elements.lower.ctx,ig),eg.getPlugin("ContextMenuPlugin")}enabled(){if(this.editor&&this.ruler&&!this.ruler.isShown){const eg=this.editor.getCanvas();eg.on("after:render",this.eventHandler.calcObjectRect),eg.on("after:render",this.eventHandler.renderRuler),eg.on("mouse:down",this.eventHandler.canvasMouseDown),eg.on("mouse:move",this.eventHandler.canvasMouseMove),eg.on("mouse:up",this.eventHandler.canvasMouseUp),eg.on("selection:cleared",this.eventHandler.selectinClear),this.ruler.dpi=Editor.DPI,this.ruler.show(),this.renderRuler()}}disabled(){if(this.editor&&this.ruler&&this.ruler.isShown){this.ruler.hide();const eg=this.editor.getCanvas();eg.off("after:render",this.eventHandler.calcObjectRect),eg.off("after:render",this.eventHandler.renderRuler),eg.off("mouse:down",this.eventHandler.canvasMouseDown),eg.off("mouse:move",this.eventHandler.canvasMouseMove),eg.off("mouse:up",this.eventHandler.canvasMouseUp),eg.off("selection:cleared",this.eventHandler.selectinClear),this.editor.getCanvas().renderAll()}}setCanvasSize(eg,gg){this.ruler&&(this.ruler.options.canvasWidth=eg,this.ruler.options.canvasHeight=gg)}calcObjectRect(){if(!this.editor)return;const gg=this.editor.getCanvas().getActiveObjects();if(gg.length===0)return;const ig=gg.reduce((Ig,og)=>{const ng=og.getBoundingRect();return Ig.push(ng),Ig},[]);ig.length!==0&&(this.ruler.objectRect={x:mergeLines(ig,!0),y:mergeLines(ig,!1)})}renderRuler(){if(!this.editor||!this.ruler||!this.ruler.isShown)return;const eg=this.editor.getCanvas(),gg=eg.viewportTransform;gg&&(this.ruler.drawBackground(!0,-(gg[4]/gg[0]),eg.getZoom()),this.ruler.drawBackground(!1,-(gg[5]/gg[3]),eg.getZoom()),this.ruler.drawMM(!0,-(gg[4]/gg[0]),eg.getZoom()),this.ruler.drawMM(!1,-(gg[5]/gg[3]),eg.getZoom()),this.ruler.drawActiveLine(!0,-(gg[4]/gg[0]),eg.getZoom()),this.ruler.drawActiveLine(!1,-(gg[5]/gg[3]),eg.getZoom()),this.ruler.options.callback&&this.ruler.options.callback(this.ruler.gapValue))}canvasMouseDown(){}canvasMouseUp(){}canvasMouseMove(){}selectionClear(){this.ruler&&(this.ruler.objectRect=void 0)}}const mergeLines=(tg,eg)=>{const gg=eg?"left":"top",ig=eg?"width":"height",Ig=1e-6;if(!tg||tg.length===0)return[];if(tg.length===1)return[Object.assign({},tg[0])];tg.sort((sg,ag)=>sg[gg]-ag[gg]);const og=[];let ng=Object.assign({},tg[0]);for(let sg=1;sg<tg.length;sg++){const ag=tg[sg],Cg=ng[gg]+ng[ig],lg=ag[gg];if(Cg>=lg-Ig){const Ag=Math.max(Cg,ag[gg]+ag[ig]);ng[ig]=Ag-ng[gg]}else og.push(ng),ng=Object.assign({},ag)}return og.push(ng),og};class WorkspacePlugin{constructor(){this.name="WorkspacePlugin",this.gapVal=20,this.backgroundColor="#FFFFFFFF",this.backgroundImage="",this.backgroundImageCover=!0,this.backgroundImageElement=null,this.backgroundImageLoadId=0,this.resizeObserver=new ResizeObserver(eg=>{for(let gg of eg){if(gg.target!==this.workspaceEl||!this.canvas)continue;const ig=Math.round(gg.contentRect.width),Ig=Math.round(gg.contentRect.height);if(!(ig<=0||Ig<=0||this.canvas.getWidth()===ig&&this.canvas.getHeight()===Ig)){if(this.editor){const og=this.editor.getPlugin("RulerPlugin");og&&og.setCanvasSize(ig,Ig)}this.canvas.setDimensions({width:ig,height:Ig})}}}),this.initWorkspace=()=>{const eg=this.canvas,gg=this.option.type;let ig;gg==="Rectangle"||gg==="RoundedRectangle"?ig=new Er({fill:this.option.backgroundColor??"yellow",width:this.option.width,height:this.option.height,rx:this.option.rx,ry:this.option.ry,strokeWidth:0}):ig=new _o({fill:this.option.backgroundColor??"yellow",width:this.option.width,height:this.option.height,rx:this.option.rx,ry:this.option.ry,strokeWidth:0}),ig.set("id","workspace"),ig.set("workspaceBackgroundColor",this.backgroundColor),ig.set("workspaceBackgroundImage",this.backgroundImage),ig.set("workspaceBackgroundImageCover",this.backgroundImageCover),this.bindRibbonBorderRender(ig),ig.set("selectable",!1),ig.set("hasControls",!1),ig.excludeFromExport=!0,ig.moveCursor="default",ig.hoverCursor="default",eg.insertAt(0,ig),this.workspace=ig,this.refreshWorkspaceBackground(),eg.renderAll();const Ig=this.workspaceEl.offsetWidth,og=this.workspaceEl.offsetHeight;eg.setDimensions({width:Ig,height:og}),this.resizeObserver.observe(this.workspaceEl),eg.on("mouse:wheel",this.onWheel);const sg=eg.lowerCanvasEl.width*.7,ag=eg.height*.7,Cg=sg/this.option.width,lg=ag/this.option.height;this.setZoomAuto(Math.min(Cg,lg))}}findParent(eg){for(;eg;){if(eg.id==="workspace")return eg;eg=eg.parentElement}return null}install(eg,gg){const ig=this.findParent(eg.getCanvas().elements.container);if(!ig)throw new Error("element #workspace is missing, plz check!");this.editor=eg,this.workspaceEl=ig,this.workspace=void 0,this.option=gg,this.backgroundColor=(gg==null?void 0:gg.backgroundColor)||"#FFFFFFFF",this.backgroundImage=(gg==null?void 0:gg.backgroundImage)||"",this.backgroundImageCover=(gg==null?void 0:gg.backgroundImageCover)!==!1,this.loadBackgroundImageElement(this.backgroundImage),this.editor.addHook("setSize",this.initWorkspace);const Ig=eg.getCanvas();Ig.backgroundImage=void 0,this.canvas=Ig,this.initWorkspace()}uninstall(){var eg;this.workspaceEl&&this.resizeObserver.unobserve(this.workspaceEl),this.workspace&&((eg=this.canvas)==null||eg.remove(this.workspace))}bindRibbonBorderRender(eg){const gg=eg._render.bind(eg);eg._render=ig=>{var sg,ag,Cg;if(gg(ig),this.drawBackgroundImage(ig,eg),this.drawGrid(ig,eg),(sg=this.editor)!=null&&sg.getCanvas().get("flagToDataURL"))return;const Ig=(ag=this.editor)==null?void 0:ag.ribbonBorderPattern;if(!Ig||Ig==="none")return;const og=eg.width||this.option.width,ng=eg.height||this.option.height;drawRibbonBorder(ig,Ig,{left:-og/2,top:-ng/2,width:og,height:ng},(Cg=this.editor)==null?void 0:Cg.ribbonBorderTextures)}}createWorkspacePath(eg,gg){const ig=gg.width||this.option.width,Ig=gg.height||this.option.height,og=-ig/2,ng=-Ig/2;if(eg.beginPath(),gg.type==="ellipse"){eg.ellipse(0,0,ig/2,Ig/2,0,0,Math.PI*2);return}const sg=Math.min(Math.abs(gg.rx||0),ig/2),ag=Math.min(Math.abs(gg.ry||0),Ig/2);if(!sg&&!ag){eg.rect(og,ng,ig,Ig);return}eg.moveTo(og+sg,ng),eg.lineTo(og+ig-sg,ng),eg.quadraticCurveTo(og+ig,ng,og+ig,ng+ag),eg.lineTo(og+ig,ng+Ig-ag),eg.quadraticCurveTo(og+ig,ng+Ig,og+ig-sg,ng+Ig),eg.lineTo(og+sg,ng+Ig),eg.quadraticCurveTo(og,ng+Ig,og,ng+Ig-ag),eg.lineTo(og,ng+ag),eg.quadraticCurveTo(og,ng,og+sg,ng)}drawBackgroundImage(eg,gg){const ig=this.backgroundImageElement;if(!ig||!this.backgroundImage)return;const Ig=gg.width||this.option.width,og=gg.height||this.option.height,ng=ig.naturalWidth||ig.width,sg=ig.naturalHeight||ig.height;if(!ng||!sg)return;const ag=this.backgroundImageCover?Ig:ng,Cg=this.backgroundImageCover?og:sg,lg=-ag/2,Ag=-Cg/2;eg.save(),this.createWorkspacePath(eg,gg),eg.clip(),eg.drawImage(ig,lg,Ag,ag,Cg),eg.restore()}drawGrid(eg,gg){var ag;if(!gg.isHasGrid||(ag=this.editor)!=null&&ag.getCanvas().get("flagToDataURL"))return;const ig=gg.width||this.option.width,Ig=gg.height||this.option.height,og=-ig/2,ng=-Ig/2,sg=20;eg.save(),this.createWorkspacePath(eg,gg),eg.clip(),eg.strokeStyle="#888",eg.lineWidth=1,eg.globalAlpha=1;for(let Cg=og+sg;Cg<og+ig;Cg+=sg)eg.beginPath(),eg.moveTo(Cg,ng),eg.lineTo(Cg,ng+Ig),eg.stroke();for(let Cg=ng+sg;Cg<ng+Ig;Cg+=sg)eg.beginPath(),eg.moveTo(og,Cg),eg.lineTo(og+ig,Cg),eg.stroke();eg.restore()}setZoomAuto(eg){this.workspaceEl;const gg=this.editor.getCanvas(),ig=gg.getCenterPoint();gg.setViewportTransform(T$1),gg.zoomToPoint(new ot(ig.x,ig.y),eg),this.workspace&&this.setCenterFromObject(this.workspace)}setCenterFromObject(eg){const gg=this.editor.getCanvas(),ig=eg.getCenterPoint(),Ig=gg.viewportTransform;gg.width===void 0||gg.height===void 0||!Ig||(Ig[4]=gg.width/2-ig.x*Ig[0],Ig[5]=gg.height/2-ig.y*Ig[3],gg.setViewportTransform(Ig),gg.renderAll())}showGrid(){this.createGridBackground()}hideGrid(){this.createGridBackground(!1)}async setBackground({color:eg,image:gg,cover:ig}){eg!==void 0&&(this.backgroundColor=eg||"#FFFFFFFF"),gg!==void 0&&(this.backgroundImage=gg||""),ig!==void 0&&(this.backgroundImageCover=ig),this.workspace&&(this.workspace.set("workspaceBackgroundColor",this.backgroundColor),this.workspace.set("workspaceBackgroundImage",this.backgroundImage),this.workspace.set("workspaceBackgroundImageCover",this.backgroundImageCover)),gg!==void 0&&await this.loadBackgroundImageElement(this.backgroundImage),this.refreshWorkspaceBackground()}refreshWorkspaceBackground(){!this.workspace||!this.canvas||(this.workspace.set("fill",this.backgroundColor||"#FFFFFFFF"),this.workspace.dirty=!0,this.canvas.requestRenderAll())}async loadBackgroundImageElement(eg){var ig;const gg=++this.backgroundImageLoadId;if(!eg){this.backgroundImageElement=null;return}try{const Ig=await new Promise((og,ng)=>{const sg=new Image;sg.onload=()=>og(sg),sg.onerror=ng,sg.src=eg});if(gg!==this.backgroundImageLoadId)return;this.backgroundImageElement=Ig,this.workspace&&(this.workspace.dirty=!0),(ig=this.canvas)==null||ig.requestRenderAll()}catch(Ig){if(gg!==this.backgroundImageLoadId)return;this.backgroundImageElement=null,console.log("load background image error",Ig)}}createGridBackground(eg=!0){!this.canvas||!this.workspace||(this.workspace.set("isHasGrid",eg),this.workspace.dirty=!0,this.canvas.renderAll())}onWheel(eg){const gg=eg.e.deltaY;let ig=this.getZoom();ig*=.999**gg,ig>12&&(ig=12),ig<.2&&(ig=.2);const Ig=this.getCenter();this.zoomToPoint(new ot(Ig.left,Ig.top),ig),eg.e.preventDefault(),eg.e.stopPropagation()}big(){let eg=this.canvas.getZoom();eg+=.05;const gg=this.canvas.getCenter();this.canvas.zoomToPoint(new ot(gg.left,gg.top),eg)}small(){let eg=this.canvas.getZoom();eg-=.05;const gg=this.canvas.getCenter();this.canvas.zoomToPoint(new ot(gg.left,gg.top),eg<0?.01:eg)}auto(){const gg=this.canvas.lowerCanvasEl.width*.7,ig=this.canvas.height*.7,Ig=gg/this.option.width,og=ig/this.option.height;this.setZoomAuto(Math.min(Ig,og))}one(){this.setZoomAuto(1)}enabled(){}disabled(){}}const aligningLineConfig={margin:4,width:1,color:"rgb(255,0,0,0.9)"};function getDistance(tg,eg){return Math.abs(tg-eg)}function setPositionDir(tg,eg,gg){const ig=tg.translateToCenterPoint(eg,"center","center"),Ig=tg.translateToOriginPoint(ig,tg.originX,tg.originY);gg=="x"?tg.setX(Ig.x):tg.setY(Ig.y)}const originXArr=["left","center","right"],originYArr=["top","center","bottom"];function collectVerticalPoint(tg){var eg,gg;const ig=aligningLineConfig.margin,{activeObject:Ig,isScale:og,index:ng,point:sg,list:ag}=tg,{dis:Cg,arr:lg}=getDistanceList(sg,ag,"x"),Ag=ig/((eg=(gg=Ig.canvas)===null||gg===void 0?void 0:gg.getZoom())!==null&&eg!==void 0?eg:1);if(Cg>Ag)return[];let cg=lg[lg.length-1].x-sg.x;const rg=ng==0||ng==3?-1:1;cg*=rg;const{width:ug,scaleX:dg,left:mg}=Ig,bg=Ig._getTransformedDimensions(),pg=(cg+bg.x)/bg.x;og?Ig.set("scaleX",dg*pg):Ig.set("width",ug*pg);const Zg=[0,cg/2*rg,cg*rg];rg<0&&Zg.reverse();const Gg=Zg[originXArr.indexOf(Ig.originX)];return Ig.set("left",mg+Gg),Ig.setCoords(),lg.map(hg=>({x:hg.x,y1:hg.y,y2:sg.y}))}function collectHorizontalPoint(tg){var eg,gg;const ig=aligningLineConfig.margin,{activeObject:Ig,isScale:og,index:ng,point:sg,list:ag}=tg,{dis:Cg,arr:lg}=getDistanceList(sg,ag,"y"),Ag=ig/((eg=(gg=Ig.canvas)===null||gg===void 0?void 0:gg.getZoom())!==null&&eg!==void 0?eg:1);if(Cg>Ag)return[];let cg=lg[lg.length-1].y-sg.y;const rg=ng<2?-1:1;cg*=rg;const{height:ug,scaleY:dg,top:mg}=Ig,bg=Ig._getTransformedDimensions(),pg=(cg+bg.y)/bg.y;og?Ig.set("scaleY",dg*pg):Ig.set("height",ug*pg);const Zg=[0,cg/2*rg,cg*rg];rg<0&&Zg.reverse();const Gg=Zg[originYArr.indexOf(Ig.originY)];return Ig.set("top",mg+Gg),Ig.setCoords(),lg.map(hg=>({y:hg.y,x1:hg.x,x2:sg.x}))}function getDistanceList(tg,eg,gg){let ig=1/0,Ig=[];for(const og of eg){const ng=getDistance(tg[gg],og[gg]);ig>ng&&(Ig=[],ig=ng),ig==ng&&Ig.push(og)}return{dis:ig,arr:Ig}}function drawLine(tg,eg,gg){const{width:ig,color:Ig}=aligningLineConfig,og=tg.getSelectionContext(),ng=tg.viewportTransform,sg=tg.getZoom();og.save(),og.transform(...ng),og.lineWidth=ig/sg,og.strokeStyle=Ig,og.beginPath(),og.moveTo(eg.x,eg.y),og.lineTo(gg.x,gg.y),og.stroke(),drawX(og,sg,eg),drawX(og,sg,gg),og.restore()}const xSize=2.4;function drawX(tg,eg,gg){const ig=xSize/eg;tg.save(),tg.translate(gg.x,gg.y),tg.beginPath(),tg.moveTo(-ig,-ig),tg.lineTo(ig,ig),tg.moveTo(ig,-ig),tg.lineTo(-ig,ig),tg.stroke(),tg.restore()}function drawPoint(tg,eg){const{width:gg,color:ig}=aligningLineConfig,Ig=tg.getSelectionContext(),og=tg.viewportTransform,ng=tg.getZoom();Ig.save(),Ig.transform(...og),Ig.lineWidth=gg/ng,Ig.strokeStyle=ig;for(const sg of eg)drawX(Ig,ng,sg);Ig.restore()}function drawPointList(tg,eg){const gg=eg.map(ig=>{const Ig="y2"in ig,og=Ig?ig.x:ig.x1,ng=Ig?ig.y1:ig.y;return new ot(og,ng)});drawPoint(tg,gg)}function drawVerticalLine(tg,eg){const gg=eg.x,ig=new ot(gg,eg.y1),Ig=new ot(gg,eg.y2);drawLine(tg,ig,Ig)}function drawHorizontalLine(tg,eg){const gg=eg.y,ig=new ot(eg.x1,gg),Ig=new ot(eg.x2,gg);drawLine(tg,ig,Ig)}function getObjectsByTarget(tg){const eg=new Set,gg=tg.canvas;if(!gg)return eg;const ig=tg instanceof Jo?tg.getObjects():[tg];return gg.forEachObject(Ig=>{if(Ig.isOnScreen()&&Ig.visible){if(Ig.constructor==Hr){collectObjectsByGroup(eg,Ig);return}eg.add(Ig)}}),deleteObjectsByList(eg,ig),eg}function deleteObjectsByList(tg,eg){for(const gg of eg)gg.constructor==Hr?deleteObjectsByList(tg,gg.getObjects()):tg.delete(gg)}function collectObjectsByGroup(tg,eg){const gg=eg.getObjects();for(const ig of gg)if(ig.visible){if(ig.constructor==Hr){collectObjectsByGroup(tg,ig);continue}tg.add(ig)}}function collectLine(tg){var eg,gg;const ig=aligningLineConfig.margin,{activeObject:Ig,activeObjectRect:og,objectRect:ng}=tg,sg=makeLineByRect(ng),ag=makeLineByRect(og),Cg=ig/((eg=(gg=Ig.canvas)===null||gg===void 0?void 0:gg.getZoom())!==null&&eg!==void 0?eg:1),lg={target:Ig,list:sg,aList:ag,margin:Cg},Ag=collectVerticalLine(lg),cg=collectHorizontalLine(lg);return{vLines:Ag,hLines:cg}}function collectVerticalLine(tg){const{target:eg,list:gg,aList:ig,margin:Ig}=tg,og=ig.map(Ag=>getDistanceLine(Ag,gg,"x")),ng=Math.min(...og.map(Ag=>Ag.dis));if(ng>Ig)return[];const sg=[],ag=ig[0].x2-ig[0].x,Cg=ig[0].y2-ig[0].y;let lg=!1;for(let Ag=0;Ag<og.length;Ag++){const cg=og[Ag];if(ng==cg.dis){const rg=gg[cg.index],ug=ig[cg.index],dg=rg.x,mg=ug.y,bg=Math.min(rg.y,rg.y2,mg,ug.y2),pg=Math.max(rg.y,rg.y2,mg,ug.y2);if(sg.push({x:dg,y1:bg,y2:pg}),lg)continue;lg=!0,setPos({target:eg,x:dg,y:mg,centerX:Ag-1,centerY:cg.index-1,width:ag,height:Cg,dir:"x"});const Zg=ng*cg.dir;ig.forEach(Gg=>Gg.x-=Zg)}}return sg}function collectHorizontalLine(tg){const{target:eg,list:gg,aList:ig,margin:Ig}=tg,og=ig.map(Ag=>getDistanceLine(Ag,gg,"y")),ng=Math.min(...og.map(Ag=>Ag.dis));if(ng>Ig)return[];const sg=[],ag=ig[0].x2-ig[0].x,Cg=ig[0].y2-ig[0].y;let lg=!1;for(let Ag=0;Ag<og.length;Ag++){const cg=og[Ag];if(ng==cg.dis){const rg=gg[cg.index],ug=ig[cg.index],dg=rg.y,mg=ug.x,bg=Math.min(rg.x,rg.x2,mg,ug.x2),pg=Math.max(rg.x,rg.x2,mg,ug.x2);if(sg.push({y:dg,x1:bg,x2:pg}),lg)continue;lg=!0,setPos({target:eg,x:mg,y:dg,centerX:cg.index-1,centerY:Ag-1,width:ag,height:Cg,dir:"y"});const Zg=ng*cg.dir;ig.forEach(Gg=>Gg.y-=Zg)}}return sg}function getDistanceLine(tg,eg,gg){let ig=1/0,Ig=-1,og=1;for(let ng=0;ng<eg.length;ng++){const sg=getDistance(tg[gg],eg[ng][gg]);ig>sg&&(Ig=ng,ig=sg,og=tg[gg]>eg[ng][gg]?1:-1)}return{dis:ig,index:Ig,dir:og}}function makeLineByRect(tg){const{left:eg,top:gg,width:ig,height:Ig}=tg,og={x:eg,y:gg,x2:eg+ig,y2:gg+Ig},ng=eg+ig/2,sg=gg+Ig/2,ag={x:ng,y:sg,x2:ng,y2:sg},Cg={x:eg+ig,x2:eg,y:gg+Ig,y2:gg};return[og,ag,Cg]}function setPos(tg){const{target:eg,centerX:gg,centerY:ig,width:Ig,height:og,dir:ng}=tg;let{x:sg,y:ag}=tg;sg-=gg*Ig/2,ag-=ig*og/2,setPositionDir(eg,new ot(sg,ag),ng),eg.setCoords()}function initAligningGuidelines(tg){let eg=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Object.assign(aligningLineConfig,eg);const gg=new Set,ig=new Set;let Ig=!1;const og=new Map,ng=cg=>{const rg=[cg.calcTransformMatrix().toString(),cg.width,cg.height].join(),ug=og.get(rg);if(ug)return ug;const dg=cg.getCoords(),bg=[kn.makeBoundingBoxFromPoints(dg),dg];return og.set(rg,bg),bg};function sg(cg){const rg=cg.target;rg.setCoords(),Ig=!1,ig.clear(),gg.clear();const ug=getObjectsByTarget(rg),dg=rg.getBoundingRect();for(const mg of ug){const bg=ng(mg)[0],{vLines:pg,hLines:Zg}=collectLine({activeObject:rg,activeObjectRect:dg,objectRect:bg});pg.forEach(Gg=>{ig.add(JSON.stringify(Gg))}),Zg.forEach(Gg=>{gg.add(JSON.stringify(Gg))})}}function ag(cg){const rg=cg.target;rg.setCoords();const ug=String(cg.transform.action).startsWith("scale");ig.clear(),gg.clear();const dg=getObjectsByTarget(rg);let mg=cg.transform.corner;rg.flipX&&(mg=mg.replace("l","r").replace("r","l")),rg.flipY&&(mg=mg.replace("t","b").replace("b","t"));let bg=["tl","tr","br","bl","mt","mr","mb","ml"].indexOf(mg);if(bg==-1)return;if(Ig=bg>3,Ig){if(rg.getTotalAngle()%90!=0)return;bg-=4}let pg=rg.getCoords()[bg];for(const Zg of dg){const[Gg,hg]=ng(Zg),fg=new ot(Gg.left+Gg.width/2,Gg.top+Gg.height/2),wg=[...hg,fg],yg={activeObject:rg,point:pg,list:wg,isScale:ug,index:bg},Bg=collectVerticalPoint(yg),Wg=collectHorizontalPoint(yg);Bg.forEach($g=>{ig.add(JSON.stringify($g))}),Wg.forEach($g=>{gg.add(JSON.stringify($g))}),(Bg.length||Wg.length)&&(pg=rg.getCoords()[bg])}}function Cg(){tg.clearContext(tg.contextTop)}function lg(){if(Ig){const cg=[];for(const rg of ig)cg.push(JSON.parse(rg));for(const rg of gg)cg.push(JSON.parse(rg));drawPointList(tg,cg)}else{for(const cg of ig)drawVerticalLine(tg,JSON.parse(cg));for(const cg of gg)drawHorizontalLine(tg,JSON.parse(cg))}}function Ag(){ig.clear(),gg.clear(),og.clear(),tg.requestRenderAll()}return tg.on("object:resizing",ag),tg.on("object:scaling",ag),tg.on("object:moving",sg),tg.on("before:render",Cg),tg.on("after:render",lg),tg.on("mouse:up",Ag),()=>{tg.off("object:resizing",ag),tg.off("object:scaling",ag),tg.off("object:moving",sg),tg.off("before:render",Cg),tg.off("after:render",lg),tg.off("mouse:up",Ag)}}class GuidelinesPlugin{constructor(){this.name="GuidelinesPlugin"}install(eg,gg={}){this.editor=eg,this.options=gg,this.enabled()}enabled(){this.editor&&(this.deactivate=initAligningGuidelines(this.editor.getCanvas(),this.options))}disabled(){this.deactivate&&this.deactivate()}}class DringPlugin{constructor(){this.name="DringPlugin",this.isDraging=!1,this.lastPosX=0,this.lastPosY=0,this.dispose=[]}install(eg,gg){this.editor=eg,this.canvas=eg.getCanvas(),this.enabled()}enabled(){this.editor.addHotKey("space",eg=>{}),this.dispose.length&&(this.dispose.length=0),this.dispose.push(this.canvas.on("mouse:down",this.mouseDown.bind(this))),this.dispose.push(this.canvas.on("mouse:move",this.mouseMove.bind(this))),this.dispose.push(this.canvas.on("mouse:up",this.mouseUP.bind(this)))}disabled(){this.editor.removeHotKey("space");for(const eg of this.dispose)eg()}mouseDown(eg){const gg=eg.e;(gg.altKey||this.isDraging||gg.button===1)&&(gg.preventDefault(),this.canvas.setCursor("grabbing"),this.canvas.discardActiveObject(),this.isDraging=!0,this.canvas.selection=!1,this.canvas.getObjects().forEach(ig=>{ig.selectable=!1}),this.lastPosX=gg.clientX,this.lastPosY=gg.clientY,this.canvas.requestRenderAll())}mouseMove(eg){if(this.isDraging){if(this.canvas.setCursor("grabbing"),!this.canvas.viewportTransform)return;const gg=this.canvas.viewportTransform,ig=eg.e;gg[4]+=ig.clientX-this.lastPosX,gg[5]+=ig.clientY-this.lastPosY,this.lastPosX=ig.clientX,this.lastPosY=ig.clientY,this.canvas.requestRenderAll()}}mouseUP(eg){this.canvas.viewportTransform&&this.isDraging&&(this.isDraging=!1,this.canvas.selection=!0,this.canvas.getObjects().forEach(gg=>{gg.id!=="workspace"&&gg.hasControls&&(gg.selectable=!0)}),this.canvas.setCursor("default"),this.canvas.requestRenderAll())}}class LockPlugin{constructor(){this.name="LockPlugin"}install(eg,gg){this.editor=eg,this.enabled()}switchLock(){const eg=this.editor;if(eg){const gg=eg.getCanvas(),ig=gg.getActiveObject();ig&&(ig.locked=!ig.locked,gg.fire("custom:object:history",{target:ig,action:"history:update"}))}}enabled(){if(this.editor){const gg=this.editor.getPlugin("ContextMenuPlugin");gg&&gg.addItem([{id:"lock",text:"锁定/解锁对象",hotKey:"Ctrl+L",hotKeyHandler:ig=>{this.switchLock()},handler:(ig,Ig)=>(this.switchLock(),!0),isShow:(ig,Ig)=>(Ig&&(Ig.itemText=(ig!=null&&ig.locked?"解锁":"锁定")+"对象"),!!ig)}])}}disabled(){if(this.editor){const gg=this.editor.getPlugin("ContextMenuPlugin");gg&&gg.removeItem("lock")}}}class LayerPlugin{constructor(){this.name="LayerPlugin"}workspaceSendToBack(){const eg=this.canvas,gg=eg.getObjects().find(ig=>ig.id==="workspace");gg&&eg.sendObjectToBack(gg)}layerChangeRefresh(){this.canvas.fire("custom:object:refreshList")}up(){const eg=this.canvas,gg=eg.getActiveObjects();if(gg&&gg.length===1){const ig=eg.getActiveObjects()[0];ig&&eg.bringObjectForward(ig),eg.renderAll(),this.workspaceSendToBack(),this.layerChangeRefresh()}}down(){const eg=this.canvas,gg=eg.getActiveObjects();if(gg&&gg.length===1){const ig=eg.getActiveObjects()[0];ig&&eg.sendObjectBackwards(ig),eg.renderAll(),this.workspaceSendToBack(),this.layerChangeRefresh()}}toFront(){const eg=this.canvas,gg=eg.getActiveObjects();if(gg&&gg.length===1){const ig=gg[0];ig&&eg.bringObjectToFront(ig),eg.renderAll(),this.workspaceSendToBack(),this.layerChangeRefresh()}}toBack(){const eg=this.canvas,gg=eg.getActiveObjects();if(gg&&gg.length===1){const ig=gg[0];ig&&eg.sendObjectToBack(ig),eg.renderAll(),this.workspaceSendToBack(),this.layerChangeRefresh()}}install(eg,gg){this.editor=eg;const ig=eg.getCanvas();this.canvas=ig;const Ig=eg.getPlugin("ContextMenuPlugin");Ig&&Ig.addItem({id:"layer",text:"图层管理",subItems:[{id:"layer-up",text:"上一个",handler:(og,ng)=>(this.up(),!0)},{id:"layer-down",text:"下一个",handler:(og,ng)=>(this.down(),!0)},{id:"layer-top",text:"置顶",handler:(og,ng)=>(this.toFront(),!0)},{id:"layer-bottom",text:"置底",handler:(og,ng)=>(this.toBack(),!0)}]})}enabled(){}disabled(){}}class ControlsPlugin{constructor(){this.name="ControlsPlugin"}drawImg(eg,gg,ig,Ig,og,ng,sg){sg!==void 0&&(eg.save(),eg.translate(gg,ig),eg.rotate(kn.degreesToRadians(sg)),eg.drawImage(Ig,-og/2,-ng/2,og,ng),eg.restore())}intervalControl(){const eg=document.createElement("img");eg.src=this.option.verticalImg;const gg=document.createElement("img");gg.src=this.option.horizontalImg;const ig=(og,ng,sg,ag,Cg)=>{this.drawImg(og,ng,sg,eg,20,25,Cg.angle)},Ig=(og,ng,sg,ag,Cg)=>{this.drawImg(og,ng,sg,gg,25,20,Cg.angle)};return{ml:new ni({x:-.5,y:0,offsetX:-1,cursorStyleHandler:ja.scaleSkewCursorStyleHandler,actionHandler:ja.scalingXOrSkewingY,getActionName:ja.scaleOrSkewActionName,render:ig}),mr:new ni({x:.5,y:0,offsetX:1,cursorStyleHandler:ja.scaleSkewCursorStyleHandler,actionHandler:ja.scalingXOrSkewingY,getActionName:ja.scaleOrSkewActionName,render:ig}),mb:new ni({x:0,y:.5,offsetY:1,cursorStyleHandler:ja.scaleSkewCursorStyleHandler,actionHandler:ja.scalingYOrSkewingX,getActionName:ja.scaleOrSkewActionName,render:Ig}),mt:new ni({x:0,y:-.5,offsetY:-1,cursorStyleHandler:ja.scaleSkewCursorStyleHandler,actionHandler:ja.scalingYOrSkewingX,getActionName:ja.scaleOrSkewActionName,render:Ig})}}peakControl(){const eg=document.createElement("img");eg.src=this.option.edgeImg;const gg=(ig,Ig,og,ng,sg)=>{this.drawImg(ig,Ig,og,eg,25,25,sg.angle)};return{tl:new ni({x:-.5,y:-.5,cursorStyleHandler:ja.scaleCursorStyleHandler,actionHandler:ja.scalingEqually,render:gg}),bl:new ni({x:-.5,y:.5,cursorStyleHandler:ja.scaleCursorStyleHandler,actionHandler:ja.scalingEqually,render:gg}),tr:new ni({x:.5,y:-.5,cursorStyleHandler:ja.scaleCursorStyleHandler,actionHandler:ja.scalingEqually,render:gg}),br:new ni({x:.5,y:.5,cursorStyleHandler:ja.scaleCursorStyleHandler,actionHandler:ja.scalingEqually,render:gg})}}rotationControl(){const eg=document.createElement("img");eg.src=this.option.rotateImg;const gg=(ig,Ig,og,ng,sg)=>{this.drawImg(ig,Ig,og,eg,40,40,sg.angle)};return{mtr:new ni({x:0,y:.5,cursorStyleHandler:ja.rotationStyleHandler,actionHandler:ja.rotationWithSnapping,offsetY:30,actionName:"rotate",render:gg})}}install(eg,gg){if(!gg||!gg.verticalImg||!gg.horizontalImg||!gg.edgeImg)throw new Error("ControlsPluginOption参数必需");this.option=gg,this.eidtor=eg,this.canvas=eg.getCanvas(),Ei.createControls=()=>({controls:{}}),Ei.ownDefaults.controls={...this.peakControl(),...this.intervalControl(),...this.rotationControl()},Ei.ownDefaults.snapAngle=15,Ei.ownDefaults.snapThreshold=5}enabled(){}disabled(){}}class AlignPlugin{constructor(){this.name="AlignPlugin",this.left=(...eg)=>{if(!this.canvas)return;const gg=this.canvas,ig=gg.getActiveObject(),Ig=gg.getActiveObjects();if(ig&&Ig.length>1){const{left:og=0}=ig;gg.discardActiveObject(),Ig.forEach(sg=>{const ag=sg.getBoundingRect();console.log("getBoundingRect",ag),console.log("item",sg.left,sg.width),sg.set({left:og-ag.left+Number(sg.left)}),sg.setCoords()}),console.log("align-left",Ig),gg.fire("custom:object:history",{action:"align-left"});const ng=new Jo(Ig,{canvas:gg});gg.setActiveObject(ng),gg.requestRenderAll()}else ig&&Ig.length===1&&this.alignSingleToWorkspace(ig,"left")},this.right=(...eg)=>{if(!this.canvas)return;const gg=this.canvas,ig=gg.getActiveObject(),Ig=gg.getActiveObjects();if(ig&&Ig.length>1){const{left:og=0,width:ng=0}=ig;gg.discardActiveObject(),Ig.forEach(ag=>{const Cg=ag.getBoundingRect();ag.set({left:og+ng-(Cg.left+Cg.width)+Number(ag.left)})}),gg.fire("custom:object:history",{action:"align-right"});const sg=new Jo(Ig,{canvas:gg});gg.setActiveObject(sg),gg.requestRenderAll()}else ig&&Ig.length===1&&this.alignSingleToWorkspace(ig,"right")},this.xcenter=(...eg)=>{if(!this.canvas)return;const gg=this.canvas,ig=gg.getActiveObject(),Ig=gg.getActiveObjects();if(ig&&Ig.length>1){const{left:og=0,width:ng=0}=ig;gg.discardActiveObject(),Ig.forEach(ag=>{const Cg=ag.getBoundingRect();ag.set({left:og+ng/2-(Cg.left+Cg.width/2)+Number(ag.left)})}),gg.fire("custom:object:history",{action:"align-xcenter"});const sg=new Jo(Ig,{canvas:gg});gg.setActiveObject(sg),gg.requestRenderAll()}},this.ycenter=(...eg)=>{if(!this.canvas)return;const gg=this.canvas,ig=gg.getActiveObject(),Ig=gg.getActiveObjects();if(ig&&Ig.length>1){const{top:og=0,height:ng=0}=ig;gg.discardActiveObject(),Ig.forEach(ag=>{const Cg=ag.getBoundingRect();ag.set({top:og+ng/2-(Cg.top+Cg.height/2)+Number(ag.top)})}),gg.fire("custom:object:history",{action:"align-ycenter"});const sg=new Jo(Ig,{canvas:gg});gg.setActiveObject(sg),gg.requestRenderAll()}},this.top=(...eg)=>{if(!this.canvas)return;const gg=this.canvas,ig=gg.getActiveObject(),Ig=gg.getActiveObjects();if(ig&&Ig.length>1){const{top:og=0}=ig;gg.discardActiveObject(),Ig.forEach(sg=>{const ag=sg.getBoundingRect();sg.set({top:og-ag.top+Number(sg.top)})}),gg.fire("custom:object:history",{action:"align-top"});const ng=new Jo(Ig,{canvas:gg});gg.setActiveObject(ng),gg.requestRenderAll()}else ig&&Ig.length===1&&this.alignSingleToWorkspace(ig,"top")},this.bottom=(...eg)=>{if(!this.canvas)return;const gg=this.canvas,ig=gg.getActiveObject(),Ig=gg.getActiveObjects();if(ig&&Ig.length>1){const{top:og=0,height:ng=0}=ig;gg.discardActiveObject(),Ig.forEach(ag=>{const Cg=ag.getBoundingRect();ag.set({top:og+ng-(Cg.top+Cg.height)+Number(ag.top)})}),gg.fire("custom:object:history",{action:"align-bottom"});const sg=new Jo(Ig,{canvas:gg});gg.setActiveObject(sg),gg.requestRenderAll()}else ig&&Ig.length===1&&this.alignSingleToWorkspace(ig,"bottom")},this.xequation=(...eg)=>{if(!this.canvas)return;const gg=this.canvas,ig=gg.getActiveObject();function Ig(lg){let Ag=1/0,cg=-1/0;for(const rg in lg.aCoords){const ug=rg;lg.aCoords[ug].x<Ag&&(Ag=lg.aCoords[ug].x),lg.aCoords[ug].x>cg&&(cg=lg.aCoords[ug].x)}return cg-Ag}function og(){let lg=0;return ig&&ig.forEachObject(Ag=>{lg+=Ig(Ag)}),lg}function ng(){const lg=og();if(ig)return(Number(ig.width)-lg)/(ig._objects.length-1)}function sg(lg){if(lg===0)return 0;let Ag=0;if(ig)for(let cg=0;cg<lg;cg++)Ag+=Ig(ig._objects[cg]);return Ag}if(ig&&ig.type==="activeselection"){const lg=ig;if(lg.getObjects().length<2)return;lg._objects.sort((rg,ug)=>rg.left-ug.left);const Ag=ng(),cg=Number(ig.width)/2;ig.forEachObject((rg,ug)=>{const dg=sg(ug),mg=Ag*ug+dg-cg;rg.set("left",mg)})}const ag=gg.getActiveObjects();if(ag.length<2)return;gg.discardActiveObject(),ag.forEach(lg=>{let Ag=1/0;for(const cg in lg.aCoords){const rg=cg;lg.aCoords[rg].x<Ag&&(Ag=lg.aCoords[rg].x)}lg.set("left",2*lg.left-Ag)}),gg.fire("custom:object:history",{action:"align-xequation"});const Cg=new Jo(ag,{canvas:gg});gg.setActiveObject(Cg),gg.requestRenderAll()},this.yequation=(...eg)=>{if(!this.canvas)return;const gg=this.canvas,ig=gg.getActiveObject()||{top:0,height:0};function Ig(lg){let Ag=1/0,cg=-1/0;for(const rg in lg.aCoords){const ug=rg;lg.aCoords[ug].y<Ag&&(Ag=lg.aCoords[ug].y),lg.aCoords[ug].y>cg&&(cg=lg.aCoords[ug].y)}return cg-Ag}function og(){let lg=0;return ig.forEachObject(Ag=>{lg+=Ig(Ag)}),lg}function ng(){const lg=og();return(ig.height-lg)/(ig._objects.length-1)}function sg(lg){if(lg===0)return 0;let Ag=0;for(let cg=0;cg<lg;cg++)Ag+=Ig(ig._objects[cg]);return Ag}if(console.log("activeObject",ig.type),ig&&ig.type==="activeselection"){const lg=ig;if(lg.getObjects().length<2)return;lg._objects.sort((rg,ug)=>rg.top-ug.top);const Ag=ng(),cg=Number(ig.height)/2;ig.forEachObject((rg,ug)=>{const dg=sg(ug),mg=Ag*ug+dg-cg;rg.set("top",mg)})}const ag=gg.getActiveObjects();if(ag.length<2)return;gg.discardActiveObject(),ag.forEach(lg=>{let Ag=1/0;for(const cg in lg.aCoords){const rg=cg;lg.aCoords[rg].y<Ag&&(Ag=lg.aCoords[rg].y)}lg.set("top",2*lg.top-Ag)}),gg.fire("custom:object:history",{action:"align-yequation"});const Cg=new Jo(ag,{canvas:gg});gg.setActiveObject(Cg),gg.requestRenderAll()}}install(eg,gg){this.editor=eg,this.canvas=eg.getCanvas(),this.enabled()}enabled(){this.editor&&(this.editor.addHook("left",this.left),this.editor.addHook("right",this.right),this.editor.addHook("top",this.top),this.editor.addHook("bottom",this.bottom),this.editor.addHook("xcenter",this.xcenter),this.editor.addHook("ycenter",this.ycenter),this.editor.addHook("x-equidistant",this.xequation),this.editor.addHook("y-equidistant",this.yequation))}disabled(){}alignSingleToWorkspace(eg,gg){var Cg;if(!this.canvas)return;const ig=this.canvas.getObjects().find(lg=>lg.id==="workspace");if(!ig)return;const Ig=eg.getBoundingRect(),og=ig.getBoundingRect(),ng={};let ag=((Cg=this.editor)==null?void 0:Cg.ribbonBorderPattern)&&this.editor.ribbonBorderPattern!=="none"?30:0;gg==="left"?ng.left=Number(eg.left||0)+og.left+ag-Ig.left:gg==="right"?ng.left=Number(eg.left||0)+og.left+og.width-ag-Ig.left-Ig.width:gg==="top"?ng.top=Number(eg.top||0)+og.top-Ig.top:gg==="bottom"&&(ng.top=Number(eg.top||0)+og.top+og.height-Ig.top-Ig.height),eg.set(ng),eg.setCoords(),this.canvas.fire("custom:object:history",{action:`align-${gg}`}),this.canvas.fire("custom:object:checkdirty",{isToDirty:!0}),this.canvas.requestRenderAll()}}class GroupPlugin{constructor(){this.name="GroupPlugin"}group(){if(!this.editor)return;const eg=this.editor.getCanvas();if(!eg.getActiveObject())return;const gg=this.editor.getPlugin("HistoryPlugin");gg&&(gg.pause=!0);const ig=eg.getActiveObject();console.log("group",ig.type),getObjectList(ig,og=>{(og.type==="text"||og.type==="counter")&&(og.inGroupRemove=!0)});let Ig;if(ig.type!=="activeSelection"&&ig.type!=="activeselection"){const og=eg.remove(ig);console.log("rmobj",og),Ig=new Hr(og)}else{const og=ig.removeAll();eg.remove(...og),Ig=new Hr(og)}console.log("group====1111",Ig),Ig.id=v4(),addObjName(eg,Ig),Ig.subTargetCheck=!0,gg&&(gg.pause=!1),eg.add(Ig),eg.setActiveObject(Ig),eg.requestRenderAll(),this.editor.emit("group",{target:Ig}),console.log("group",eg.getObjects())}ungroup(){if(!this.editor)return;const eg=this.editor.getCanvas(),gg=eg.getActiveObject();if(!gg||gg.type!=="group")return;const ig=this.editor.getPlugin("HistoryPlugin");ig&&(ig.pause=!0),eg.remove(gg);const Ig=gg.removeAll();eg.add(...Ig);var og=new Jo(Ig,{canvas:eg});ig&&(ig.pause=!1),eg.setActiveObject(og),eg.requestRenderAll(),this.editor.emit("ungroup",{target:og})}install(eg,gg){this.editor=eg,this.enabled()}enabled(){if(this.editor){const gg=this.editor.getPlugin("ContextMenuPlugin");gg&&gg.addItem([{id:"group1",text:"成组",isShow:(ig,Ig)=>!ig||ig.type!=="group",handler:(ig,Ig)=>(this.group(),!0)},{id:"group2",text:"拆分",isShow:(ig,Ig)=>!!(ig&&ig.type==="group"),handler:(ig,Ig)=>(this.ungroup(),!0)}])}}disabled(){if(this.editor){const eg=this.editor.getPlugin("ContextMenuPlugin");eg&&(eg.removeItem("group1"),eg.removeItem("group2"))}}}class HistoryList{constructor(eg){this.canvas=eg,this.history=[],this.historyRedo=[],this.customProp={id:"id",locked:!1,name:"name"},this.isProcess=!1,this.flagClearing=!1,this.undoTimer=void 0,this.extraKeys=Object.keys(this.customProp),this.updateList()}async updateList(){if(this.flagClearing||this.isProcess)return;let eg=null;const gg=this.canvas.getObjects();let ig=[...cloneCommonField,"hasSetHistory"];const Ig=gg.filter(ng=>ng.id!=="workspace"&&!ng.parent&&ng.drawObjectType!=="ignoreObject").map(async ng=>{if(ng.group&&ng.group.type==="activeselection"){eg||(eg=cloneDeep(ng.group));const sg=eg._objects.find(Cg=>Cg.id===ng.id);eg.remove(sg);let ag=await sg.clone(ig);return ag.set("flagActive",!0),ag.canvas=void 0,ag.evented=!0,ag}else{const sg=await ng.clone(ig);return sg.canvas=void 0,sg.evented=!0,sg}}),og=await Promise.all(Ig);this.history.push(og),console.log("history======",this.history),this.historyRedo=[]}clearCanvas(){this.flagClearing=!0;const eg=this.canvas.getObjects().filter(gg=>gg.id!=="workspace");this.canvas.remove(...eg),this.flagClearing=!1}async canvasRestore(eg){this.canvas.discardActiveObject();let gg;clearObjectMap();for(const ig of eg){const Ig=await ig.clone([...cloneCommonField,"flagActive"]);this.canvas.add(Ig),Ig.get("flagActive")&&(gg||(gg=[]),gg.push(Ig)),updateObjectMap(Ig)}gg&&this.canvas.setActiveObject(new Jo(gg)),this.canvas.requestRenderAll()}undo(){if(this.isProcess||this.history.length<=1)return;clearTimeout(this.undoTimer);let eg=this.history.pop();this.historyRedo.push(eg);const gg=this.history[this.history.length-1];console.log("history========",this.history,gg),this.isProcess=!0,this.clearCanvas(),this.canvasRestore(gg).then(()=>{this.isProcess=!1})}redo(){if(this.isProcess||this.historyRedo.length===0)return;const eg=this.historyRedo.pop();this.history.push(eg),this.isProcess=!0,this.clearCanvas(),this.canvasRestore(eg).then(()=>{this.isProcess=!1})}}class HistoryPlugin{constructor(){this.name="HistoryPlugin",this.historyScopeId="default",this.historyScopeMap=new Map,this.pause=!1,this.isMouseDown=!1,this.isObjectModify=!1,this.objectAddedTimer=null,this.hotKeyHandle=eg=>{this.pause||(eg.hke.key==="ctrl+z"||eg.hke.key==="⌘+z"?this.toUndo():(eg.hke.key==="ctrl+shift+z"||eg.hke.key==="⌘+shift+z")&&this.toRedo())},this.objectAdded=({target:eg})=>{var gg;clearTimeout(this.objectAddedTimer),!(this.pause||this.isMouseDown||(gg=this.historyList)!=null&&gg.isProcess)&&(eg.drawObjectType&&eg.drawObjectType==="ignoreObject"||(this.objectAddedTimer=setTimeout(()=>{var ig;this.pause||(ig=this.historyList)!=null&&ig.isProcess||this.historyList&&this.historyList.updateList()},10)))},this.objectRemoved=({target:eg})=>{var gg;this.pause||(gg=this.historyList)!=null&&gg.isProcess||eg.drawObjectType&&eg.drawObjectType==="ignoreObject"||(this.historyList&&this.historyList.updateList(),this.canvas&&this.canvas.discardActiveObject())},this.objectModified=({})=>{if(!this.pause){if(this.isMouseDown){this.isObjectModify=!0;return}this.historyList&&this.historyList.updateList()}},this.objectSkewing=()=>{if(!this.pause){if(this.isMouseDown){this.isObjectModify=!0;return}this.historyList&&this.historyList.updateList()}},this.historyUpdate=eg=>{if(!this.pause){if(this.isMouseDown){this.isObjectModify=!0;return}this.historyList&&this.historyList.updateList()}},this.mouseDown=()=>{this.isMouseDown=!0},this.mouseUp=eg=>{var gg;this.isObjectModify?(this.isObjectModify=!1,this.isMouseDown=!1,(gg=this.canvas)==null||gg.fire("custom:object:history",{action:"mouse:up:clear"})):this.isMouseDown=!1}}toUndo(){var eg;(eg=this.historyList)==null||eg.undo()}toRedo(){var eg;(eg=this.historyList)==null||eg.redo()}switchScope(eg="default"){if(!this.canvas)return;clearTimeout(this.objectAddedTimer),this.historyScopeId=eg||"default";let gg=this.historyScopeMap.get(this.historyScopeId);gg||(gg=new HistoryList(this.canvas),this.historyScopeMap.set(this.historyScopeId,gg)),this.historyList=gg,this.isMouseDown=!1,this.isObjectModify=!1}clearScope(eg){if(!eg){if(this.historyScopeMap.clear(),this.canvas){const gg=new HistoryList(this.canvas);this.historyScopeMap.set(this.historyScopeId,gg),this.historyList=gg}return}this.historyScopeMap.delete(eg),this.historyScopeId===eg&&this.switchScope("default")}install(eg,gg){this.editor=eg,this.canvas=eg.getCanvas(),this.historyScopeId=(gg==null?void 0:gg.scopeId)||"default",this.historyList=new HistoryList(this.canvas),this.historyScopeMap.set(this.historyScopeId,this.historyList),this.enabled()}enabled(){this.editor&&(this.editor.addHotKey("ctrl+z",this.hotKeyHandle),this.editor.addHotKey("⌘+z",this.hotKeyHandle),this.editor.addHotKey("ctrl+shift+z",this.hotKeyHandle),this.editor.addHotKey("⌘+shift+z",this.hotKeyHandle)),this.canvas&&(this.canvas.on("mouse:down",this.mouseDown),this.canvas.on("mouse:up",this.mouseUp),this.canvas.on("object:added",this.objectAdded),this.canvas.on("object:removed",this.objectRemoved),this.canvas.on("object:modified",this.objectModified),this.canvas.on("object:skewing",this.objectSkewing),this.canvas.on("custom:object:history",this.historyUpdate))}disabled(){this.editor&&(this.editor.removeHotKey("ctrl+z"),this.editor.removeHotKey("⌘+z"),this.editor.removeHotKey("ctrl+shift+z"),this.editor.removeHotKey("⌘+shift+z")),this.canvas&&(this.canvas.off("mouse:down",this.mouseDown),this.canvas.off("mouse:up",this.mouseUp),this.canvas.off("object:added",this.objectAdded),this.canvas.off("object:removed",this.objectRemoved),this.canvas.off("object:modified",this.objectModified),this.canvas.off("object:skewing",this.objectSkewing),this.canvas.off("custom:object:history",this.historyUpdate))}}class MoveHotKeyPlugin{constructor(){this.name="MoveHotKeyPlugin",this.keys={},this.holder=new Map}install(eg,gg){this.editor=eg,this.canvas=eg.getCanvas(),this.holder.set("keydown",this.keyDown.bind(this)),this.holder.set("keyup",this.keyUp.bind(this)),this.enabled()}move(){const eg=this.canvas.getActiveObject();if(eg!=null&&eg.locked)return;let gg=!0;if(eg&&eg.top!==void 0&&(this.keys.ArrowUp&&(eg.set("top",eg.top-1),gg=!1),this.keys.ArrowDown&&(eg.set("top",eg.top+1),gg=!1),this.keys.ArrowLeft&&(eg.set("left",eg.left-1),gg=!1),this.keys.ArrowRight&&(eg.set("left",eg.left+1),gg=!1),!gg&&(eg.setCoords(),this.canvas))){this.canvas.renderAll(),this.canvas.fire("custom:object:changed",{target:eg});return}this.intervalHolder,clearInterval(this.intervalHolder),this.intervalHolder=void 0,console.log("clearInterval")}keyDown(eg){if(this.keys[eg.code]=!0,["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(eg.code))eg.preventDefault();else return;this.move(),this.intervalHolder===void 0&&(this.intervalHolder=setInterval(this.move.bind(this),96))}keyUp(eg){this.keys[eg.code]=!1}enabled(){var eg;if((eg=this.canvas)!=null&&eg.elements.container){const gg=this.canvas.elements.container;gg.tabIndex=-1,this.holder.forEach((ig,Ig)=>{gg.addEventListener(Ig,ig)})}}disabled(){var eg;if((eg=this.canvas)!=null&&eg.elements.container){const gg=this.canvas.elements.container;this.holder.forEach((ig,Ig)=>{gg.removeEventListener(Ig,ig)})}}}class DeletePlugin{constructor(){this.name="DeletePlugin"}install(eg,gg){this.editor=eg,this.canvas=eg.getCanvas(),this.enabled()}flat(eg,gg){if(gg.push(eg),eg instanceof Hr){const ig=eg.getObjects();if(ig.length>0)for(const Ig of ig)Ig.locked||(gg.push(Ig),Ig instanceof Hr&&this.flat(Ig,gg))}}enabled(){if(this.editor){const eg=this.editor.getPlugin("ContextMenuPlugin");eg&&eg.addItem({id:"delete",text:"删除",hotKey:"delete,backspace",hotKeyHandler:gg=>this.toDelete(),handler:(gg,ig)=>this.toDelete()})}}toDelete(){var og;const gg=this.editor.getPlugin("HistoryPlugin");gg&&(gg.pause=!0);let ig=this.canvas.getActiveObjects();const Ig=[];for(const ng of ig)this.flat(ng,Ig);return Ig.length>0&&(this.canvas.remove(...Ig),this.canvas.requestRenderAll(),ig=ig.filter(ng=>{Ig.includes(ng)}),ig.length>0?this.canvas.setActiveObject(new Jo(ig)):this.canvas.discardActiveObject()),gg&&(gg.pause=!1),(og=this.canvas)==null||og.fire("custom:object:history",{target:null,action:"delete"}),!0}disabled(){if(this.editor){const eg=this.editor.getPlugin("ContextMenuPlugin");eg&&eg.removeItem("delete")}}}let isDrawing=!1;class AddObjectPlugin{constructor(){this.name="AddObjectPlugin",this.startPoint={},this.isMoverUp=!1,this.mouseDown=eg=>{if(!this.canvas)return;this.isMoverUp=!1;const gg=this.canvas,ig=eg.scenePoint;this.startPoint=ig,this.canvas.off("mouse:move",this.mouseMove),this.canvas.off("mouse:up",this.mouseUp),gg.on("mouse:move",this.mouseMove),gg.on("mouse:up",this.mouseUp)},this.mouseMove=eg=>{if(!this.canvas||this.isMoverUp)return;const gg=this.canvas,ig=eg.scenePoint;this.object||(this.object=new ALine([this.startPoint.x,this.startPoint.y,ig.x,ig.y],{...this.objectProps,id:v4(),evented:!1,strokeUniform:!0,hasControls:!1}),addObjName(this.canvas,this.object),this.object.strokeWidth=3,gg.add(this.object)),this.object.set({x2:ig.x,y2:ig.y}),this.object.setCoords(),gg.renderAll()},this.mouseUp=eg=>{!this.canvas||!this.object||(this.isMoverUp=!0,console.log("end",this.object),this.canvas.fire("object:modified",{target:this.object}),this.object=void 0,this.canvas.off("mouse:move",this.mouseMove),this.canvas.off("mouse:up",this.mouseUp),this.end())},this.start=eg=>{if(!this.canvas||isDrawing)return;isDrawing=!0,this.objectProps=eg;const gg=this.canvas;gg.defaultCursor="crosshair",gg.selection=!1,gg.forEachObject(ig=>{ig.set({evented:!1})}),this.canvas.on("mouse:down",this.mouseDown)},this.end=()=>{if(!this.canvas)return;const eg=this.canvas;eg.defaultCursor="default",eg.selection=!0,eg.forEachObject(gg=>{gg.set({evented:!0})}),eg.off("mouse:down",this.mouseDown),isDrawing=!1}}install(eg,gg){this.editor=eg,this.canvas=this.editor.getCanvas(),this.enabled()}enabled(){var eg,gg;this.canvas&&((eg=this.editor)==null||eg.addHook("addLine",this.start),(gg=this.editor)==null||gg.addHook("cancelAdd",this.end))}disabled(){this.canvas&&this.canvas.off("mouse:down",this.mouseDown)}}let _clipboard=null,isInCut=!1;const getClipboard=()=>{if(!(typeof navigator>"u"))return navigator.clipboard},writeClipboardText=async tg=>{const eg=getClipboard();if(!(eg!=null&&eg.writeText))return!1;try{return await eg.writeText(tg),!0}catch{return!1}},readClipboardText=async()=>{const tg=getClipboard();if(!(tg!=null&&tg.readText))return"";try{return await tg.readText()}catch{return""}};class CopyPaste{constructor(eg){this.canvas=eg,this.copyId="",this.pasteId="",this.cloneField=[...cloneCommonField,"hasSetHistory"]}getObjData(eg="copy"){return new Promise(async(gg,ig)=>{let Ig=this.canvas.getActiveObject();if(Ig){let og=null;if(await writeClipboardText(JSON.stringify({type:"fabric",data:""})),eg==="copy"){let ng=this.cloneField.filter(sg=>sg!=="locked");og=await Ig.clone(ng)}else Ig instanceof Jo?(og=this.canvas.remove(...Ig._objects),og=new Jo(og)):og=this.canvas.remove(Ig)[0],this.canvas.discardActiveObject(),this.canvas.requestRenderAll();_clipboard=og,gg(og)}else gg(null)})}async copy(){this.getObjData()}handleObject(eg,gg=!1){var ig;if(!gg){if(eg.counterProps&&typeof eg.counterProps=="object"&&(eg.counterProps={...eg.counterProps}),eg._props&&typeof eg._props=="object"&&(eg._props=JSON.parse(JSON.stringify(eg._props))),eg.databaseMixConcat&&typeof eg.databaseMixConcat=="object"&&(eg.databaseMixConcat=JSON.parse(JSON.stringify(eg.databaseMixConcat))),eg.connectObjIds&&typeof eg.connectObjIds=="object"&&(eg.connectObjIds=JSON.parse(JSON.stringify(eg.connectObjIds))),(eg.type==="text"||eg.type==="counter")&&delete eg.connectBar2dMap,eg.type==="barcode2d"||eg.type==="barcode")delete eg.concatTextIdListObj;else if(eg.type==="text"&&eg.fromBarCode2dID){const og=ng=>{if(ng.type==="group"&&ng._objects)return ng._objects.some(sg=>og(sg));if((ng.type==="barcode2d"||ng.type==="barcode")&&ng.id===eg.fromBarCode2dID){let sg=ng.concatTextIdListObj;return sg&&(sg[eg.id]=!0,ng.set("concatTextIdListObj",sg)),!0}};(ig=this.canvas)==null||ig.getObjects().some(ng=>og(ng))}}}async paste(){if(!_clipboard)return"no-data";let eg=this.cloneField;this.copyId!==this.pasteId&&(eg=eg.filter(og=>!["databaseSheet","databaseColumn","databaseTid","outsideInput","increaseCount","fromBarCode2d","fromBarCode2dID","increaseDate","barcodeDateFormatType"].includes(og)));let ig=await _clipboard.clone(eg);if(!ig)return"no-data";let Ig=isInCut;if(isInCut?isInCut=!1:(ig.set({left:ig.left+10,top:ig.top+10,evented:!0}),_clipboard&&(_clipboard.left+=10,_clipboard.top+=10)),ig.type==="activeselection")ig.canvas=this.canvas,deepTraverse(ig.getObjects(),(og,ng)=>{addObjName(this.canvas,og),ng&&(Ig||(og.id=v4()),this.handleObject(og,Ig),this.canvas.add(og))});else if(ig.type==="group"){ig.canvas=this.canvas;const og=new Hr;og.id=v4(),addObjName(this.canvas,og),deepTraverse(ig.getObjects(),(ng,sg)=>{addObjName(this.canvas,ng),sg&&(Ig||(ng.id=v4()),this.handleObject(ng,Ig),og.add(ng))}),this.canvas.add(og),ig=og}else Ig||(ig.id=v4()),this.handleObject(ig,Ig),addObjName(this.canvas,ig),this.canvas.add(ig);this.canvas.setActiveObject(ig),this.canvas.requestRenderAll()}async cut(){if(isInCut=!0,!await this.getObjData("cut"))return"no-data"}}class CopyPlugin{constructor(){this.name="CopyPlugin",this.pause=!1,this.pasteHandleFn=function(){},this.shouldHandleClipboardEvent=eg=>{var Ig;const gg=eg.target;if(gg instanceof Element&&gg.closest('input, textarea, select, [contenteditable="true"], [contenteditable=""]'))return!1;const ig=(Ig=this.canvas)==null?void 0:Ig.getActiveObject();return!!(ig&&!ig.isEditing)},this.setFabricClipboardData=eg=>{eg.clipboardData&&(eg.clipboardData.setData("text/plain",JSON.stringify({type:"fabric",data:""})),eg.preventDefault())},this.copyHandle=eg=>{this.pause||!this.shouldHandleClipboardEvent(eg)||(this.setFabricClipboardData(eg),this.toCopy())},this.cutHandle=eg=>{this.pause||!this.shouldHandleClipboardEvent(eg)||(this.setFabricClipboardData(eg),this.toCut())},this.pasteHandle=eg=>{var sg;const gg=(sg=this.canvas)==null?void 0:sg.getActiveObject(),ig=eg.target,Ig=ig instanceof Element&&!!ig.closest('input, textarea, select, [contenteditable="true"], [contenteditable=""]');if(gg&&gg.isEditing||Ig)return;let og=eg.clipboardData,ng=(og==null?void 0:og.items)||[];for(let ag of ng){if(ag.type.startsWith("image")){console.log("粘贴图片");let Cg=ag.getAsFile();canvasEventBus.emit("copyAddImageObj",Cg),console.log("file=====",Cg)}ag.type==="text/plain"&&ag.kind==="string"&&ag.getAsString(Cg=>{console.log("粘贴文本=====",Cg);let lg=Cg;try{lg=JSON.parse(Cg)}catch{lg=Cg}typeof lg=="string"?canvasEventBus.emit("copyAddTextObj",lg):lg.type&&lg.type==="fabric"&&this.toPaste(lg)})}},this.pasteHandleFn=throttle$1(this.pasteHandle,80)}toCopy(){var gg;const eg=this.editor;this.CopyPaste.copyId=eg.id||"",(gg=this.CopyPaste)==null||gg.copy()}async toPaste(eg=null){var og;const gg=this.editor;this.CopyPaste.pasteId=gg.id||"";const ig=gg.getPlugin("HistoryPlugin");ig&&(ig.pause=!0);let Ig={};if(window.isInElectron)try{Ig=await window.dsapi.systemApi.readClipboard(),Ig=JSON.parse(Ig)}catch{}else eg?Ig.text=eg:(Ig.text=await readClipboardText(),!Ig.text&&_clipboard&&(Ig.text=JSON.stringify({type:"fabric",data:""})));if(Ig.text){let ng=Ig.text;try{ng=JSON.parse(Ig.text)}catch{ng=Ig.text}typeof ng=="string"?(ig&&(ig.pause=!1),canvasEventBus.emit("copyAddTextObj",ng)):ng.type&&ng.type==="fabric"&&((og=this.CopyPaste)==null||og.paste().then(sg=>{var ag;ig&&(ig.pause=!1),sg!=="no-data"&&((ag=this.canvas)==null||ag.fire("custom:object:history",{action:"paste"}))}))}else Ig.imageData&&Ig.imageData.length?Ig.imageData.forEach(ng=>{canvasEventBus.emit("copyAddImageObj",ng)}):ig&&(ig.pause=!1)}toCut(){var ig;const eg=this.editor;this.CopyPaste.copyId=eg.id||"";const gg=eg.getPlugin("HistoryPlugin");gg&&(gg.pause=!0),(ig=this.CopyPaste)==null||ig.cut().then(Ig=>{var og;gg&&(gg.pause=!1),Ig!=="no-data"&&((og=this.canvas)==null||og.fire("custom:object:history",{target:null,action:"cut"}))})}install(eg,gg){this.editor=eg,this.canvas=eg.getCanvas(),this.CopyPaste=new CopyPaste(this.canvas),this.enabled()}enabled(){this.editor&&(document.removeEventListener("copy",this.copyHandle),document.addEventListener("copy",this.copyHandle),document.removeEventListener("cut",this.cutHandle),document.addEventListener("cut",this.cutHandle),document.removeEventListener("paste",this.pasteHandleFn),document.addEventListener("paste",this.pasteHandleFn))}disabled(){this.editor&&(document.removeEventListener("copy",this.copyHandle),document.removeEventListener("cut",this.cutHandle),document.removeEventListener("paste",this.pasteHandleFn))}}class SelectPlugin{constructor(){this.name="SelectPlugin",this.selectAll=()=>{if(this.canvas){const eg=this.canvas.getObjects().filter(ig=>ig.id!=="workspace"),gg=new Jo(eg);this.canvas.setActiveObject(gg),this.canvas.requestRenderAll()}}}install(eg,gg){this.canvas=eg.getCanvas(),this.enabled()}uninstall(){this.disabled()}enabled(){hotkeys("ctrl+a",this.selectAll)}disabled(){hotkeys.unbind("ctrl+a",this.selectAll)}}class LineContorlPlugin{constructor(){this.name="LineContorlPlugin",this._lastLeft=0,this._lastTop=0,this.moveTimer=null}install(eg,gg){this.canvas=eg.getCanvas(),this.enabled()}uninstall(){this.disabled()}_createHandle(eg,gg){return new ho({drawObjectType:"ignoreObject",idType:"lineHandle",left:eg,top:gg,radius:6,fill:"#fff",stroke:"#1976d2",strokeWidth:2,originX:"center",originY:"center",hasControls:!1,hasBorders:!1,selectable:!0,hoverCursor:"pointer",objectCaching:!1})}_bindEvents(){this.canvas&&(canvasEventBus.off("positionChange"),canvasEventBus.on("positionChange",eg=>{eg.type==="line"&&setTimeout(()=>{this._onSelection({selected:[eg]})},0)}),this.canvas.on("selection:created",eg=>this._onSelection(eg)),this.canvas.on("selection:updated",eg=>this._onSelection(eg)),this.canvas.on("custom:object:basechanged",eg=>{let gg=eg.type,ig=eg.activeObj,Ig=eg.val,og=eg.oldVal,ng=Ig-og;gg==="x"?(ig.x1=ig.x1+ng,ig.x2=ig.x2+ng):gg==="y"?(ig.y1=ig.y1+ng,ig.y2=ig.y2+ng):gg==="w"?ig.x2>ig.x1?ig.x2=ig.x2+ng:ig.x1=ig.x1+ng:gg==="h"&&(ig.y2>ig.y1?ig.y2=ig.y2+ng:ig.y1=ig.y1+ng),this._onSelection({selected:[ig]})}),this.canvas.on("selection:cleared",()=>this._hideHandles()))}_updateLineFromHandles(){var eg;this.lineObject&&this.handle1&&this.handle2&&(this.lineObject.set({x1:this.handle1.left,y1:this.handle1.top,x2:this.handle2.left,y2:this.handle2.top}),this.lineObject.setCoords(),(eg=this.canvas)==null||eg.requestRenderAll())}_updateHandlesFromLine(){var ig,Ig,og;if(!this.lineObject||!this.handle1||!this.handle2)return;const eg=this.lineObject.left-(this._lastLeft??this.lineObject.left),gg=this.lineObject.top-(this._lastTop??this.lineObject.top);(eg!==0||gg!==0)&&((ig=this.handle1)==null||ig.set({left:this.handle1.left+eg,top:this.handle1.top+gg}),(Ig=this.handle2)==null||Ig.set({left:this.handle2.left+eg,top:this.handle2.top+gg}),this.lineObject.set({x1:this.handle1.left,y1:this.handle1.top,x2:this.handle2.left,y2:this.handle2.top}),this.handle1.setCoords(),this.handle2.setCoords(),this.lineObject.setCoords()),this._lastLeft=this.lineObject.left,this._lastTop=this.lineObject.top,(og=this.canvas)==null||og.requestRenderAll()}_onSelection(eg){var ig,Ig,og,ng,sg,ag,Cg,lg;let gg=(eg==null?void 0:eg.selected[0])||{};if(eg.selected.length===1&&gg.type==="line"){if(this.lineObject=eg.selected[0],!this.lineObject||(this.handle1&&this.handle2&&((ig=this.canvas)==null||ig.remove(this.handle1,this.handle2)),this.lineObject.group))return;this._lastLeft=this.lineObject.left,this._lastTop=this.lineObject.top;let Ag=0,cg=0,rg=0,ug=0;this.lineObject.x1<=this.lineObject.x2?(this._lastLeft=this.lineObject.left,this._lastTop=this.lineObject.top,Ag=this._lastLeft,cg=this._lastLeft+this.lineObject.width):this.lineObject.x1>this.lineObject.x2&&(this._lastLeft=this.lineObject.left+this.lineObject.width,this._lastTop=this.lineObject.top,Ag=this._lastLeft,cg=this._lastLeft-this.lineObject.width),this.lineObject.y1>=this.lineObject.y2?(this._lastLeft=this.lineObject.left,this._lastTop=this.lineObject.top,rg=this._lastTop+this.lineObject.height,ug=this._lastTop):this.lineObject.y1<this.lineObject.y2&&(rg=this._lastTop,ug=this._lastTop+this.lineObject.height),this.handle1=this._createHandle(Ag,rg),this.handle2=this._createHandle(cg,ug),(Ig=this.handle1)==null||Ig.on("moving",()=>this._updateLineFromHandles()),(og=this.handle2)==null||og.on("moving",()=>this._updateLineFromHandles()),(ng=this.handle2)==null||ng.on("mouseup",()=>{var dg;(dg=this.canvas)==null||dg.discardActiveObject(),setTimeout(()=>{var mg,bg;this.lineObject&&((mg=this.canvas)==null||mg.setActiveObject(this.lineObject)),(bg=this.canvas)==null||bg.requestRenderAll()},220)}),(sg=this.handle1)==null||sg.on("mouseup",()=>{var dg;(dg=this.canvas)==null||dg.discardActiveObject(),setTimeout(()=>{var mg;this.lineObject&&((mg=this.canvas)==null||mg.setActiveObject(this.lineObject))},220)}),(ag=this.lineObject)==null||ag.on("moving",()=>this._updateHandlesFromLine()),(Cg=this.canvas)==null||Cg.add(this.handle1,this.handle2),(lg=this.canvas)==null||lg.requestRenderAll()}else gg&&gg.drawObjectType!=="ignoreObject"&&this._hideHandles()}_showHandles(){}_hideHandles(){var eg,gg;this.handle1&&this.handle2&&((eg=this.canvas)==null||eg.remove(this.handle1,this.handle2),(gg=this.canvas)==null||gg.requestRenderAll())}enabled(){this._bindEvents()}disabled(){canvasEventBus.off("positionChange")}}ji.customProperties=["customExportFields"];const _hoisted_1$11={class:"nest-menu"},_sfc_main$14=defineComponent({__name:"nest-menu",props:{items:{type:Array,required:!0}},setup(tg){const eg=useSlots(),gg=(ig,Ig="")=>ig.map((og,ng)=>{if(og.children&&og.children.length){let sg=(Ig?Ig+"-":"")+(ng+1);return h$2(Menu.SubMenu,{key:sg,title:og.label,popupClassName:"le-target-menu"},{default:()=>gg(og.children,sg)})}else return h$2(Menu.Item,{key:(Ig?Ig+"-":"")+(ng+1)},{default:()=>eg.item({data:og})})});return(ig,Ig)=>(openBlock(),createElementBlock("div",_hoisted_1$11,[createVNode(unref(Menu),mergeProps({mode:"horizontal"},ig.$attrs),{default:withCtx(()=>[(openBlock(!0),createElementBlock(Fragment,null,renderList(gg(tg.items),og=>(openBlock(),createBlock(resolveDynamicComponent(og),{key:og.key}))),128))]),_:1},16)]))}}),_export_sfc=(tg,eg)=>{const gg=tg.__vccOpts||tg;for(const[ig,Ig]of eg)gg[ig]=Ig;return gg},nestedMenu=_export_sfc(_sfc_main$14,[["__scopeId","data-v-ebd540f8"]]),emitter=mitt(),IconClose$1="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='21'%20height='20.5078125'%20viewBox='0%200%2021%2020.5078125'%3e%3cg%3e%3cg%3e%3cellipse%20cx='10.5'%20cy='10.25390625'%20rx='10.5'%20ry='10.25390625'%20fill='%23EAEAEA'%20fill-opacity='1'%20/%3e%3c/g%3e%3cg%20transform='matrix(0,1,-1,0,21.315007209777832,-11.299349784851074)'%3e%3cpath%20d='M26.872478497314454,5.368129712463379L26.872478497314454,5.368129712463379Q26.914278497314456,5.410926712463379,26.951778497314454,5.457711712463379Q26.98927849731445,5.504496712463379,27.022078497314453,5.554820712463379Q27.054878497314455,5.605143712463379,27.082778497314454,5.658520712463379Q27.110678497314453,5.7118977124633785,27.133278497314453,5.767813712463379Q27.155878497314454,5.823730712463379,27.173078497314453,5.881647712463379Q27.190178497314452,5.939565712463379,27.201778497314454,5.998925712463379Q27.213278497314455,6.058288712463379,27.219078497314452,6.118518712463379Q27.224878497314453,6.178748712463379,27.224878497314453,6.239278712463379Q27.224878497314453,6.299798712463379,27.219078497314452,6.360028712463379Q27.213278497314455,6.420258712463379,27.201778497314454,6.479618712463379Q27.190178497314452,6.538978712463379,27.173078497314453,6.5968987124633784Q27.155878497314454,6.654818712463379,27.133278497314453,6.7107287124633785Q27.110678497314453,6.766648712463379,27.082778497314454,6.820028712463379Q27.054878497314455,6.8734087124633785,27.022078497314453,6.923728712463379Q26.98927849731445,6.974048712463379,26.951778497314454,7.020838712463378Q26.914278497314456,7.0676187124633785,26.872478497314454,7.110418712463379L18.361158497314452,15.826028712463378Q18.319358497314454,15.86882871246338,18.273668497314453,15.907228712463379Q18.227988497314453,15.945628712463378,18.17883849731445,15.979228712463378Q18.129698497314454,16.01282871246338,18.077568497314452,16.04132871246338Q18.025448497314454,16.06992871246338,17.970838497314453,16.09302871246338Q17.916228497314453,16.11622871246338,17.859668497314452,16.133828712463377Q17.803108497314454,16.15132871246338,17.745148497314453,16.16312871246338Q17.687178497314452,16.174928712463377,17.62835849731445,16.180928712463377Q17.569538497314454,16.18682871246338,17.510428497314454,16.18682871246338Q17.451328497314453,16.18682871246338,17.392508497314452,16.180928712463377Q17.333688497314455,16.174928712463377,17.275714497314453,16.16312871246338Q17.217745497314453,16.15132871246338,17.161185497314452,16.133828712463377Q17.10462549731445,16.11622871246338,17.05001949731445,16.09302871246338Q16.995413497314452,16.06992871246338,16.943287497314454,16.04132871246338Q16.891162497314454,16.01282871246338,16.842018497314452,15.979228712463378Q16.792874497314454,15.945628712463378,16.747185497314454,15.907228712463379Q16.70149649731445,15.86882871246338,16.659703497314453,15.826028712463378L16.659703497314453,15.826028712463378Q16.617909497314454,15.783228712463378,16.580413497314453,15.736428712463379Q16.542918497314453,15.68962871246338,16.510081497314452,15.63932871246338Q16.47724449731445,15.58902871246338,16.449382497314453,15.535628712463378Q16.421520497314454,15.482228712463378,16.398901797314455,15.426328712463379Q16.376283297314455,15.37042871246338,16.359125997314454,15.31252871246338Q16.341968697314453,15.25452871246338,16.330437797314453,15.19522871246338Q16.318906997314453,15.135828712463379,16.313113657314453,15.075628712463379Q16.307320322314453,15.015428712463379,16.307320289314454,14.954858712463379Q16.307320256314455,14.894338712463378,16.313113517314452,14.834098712463378Q16.318906797314455,14.77386871246338,16.330437597314454,14.71450871246338Q16.34196829731445,14.65514871246338,16.359125597314453,14.597228712463378Q16.376282797314452,14.539308712463379,16.398901297314453,14.483398712463378Q16.421519497314453,14.42747871246338,16.44938149731445,14.374098712463379Q16.477243497314454,14.32072871246338,16.510080497314455,14.270398712463379Q16.542917497314452,14.220078712463378,16.580413497314453,14.173298712463378Q16.617908497314453,14.126508712463378,16.659702497314452,14.083708712463379L25.171018497314453,5.368129712463379Q25.212808497314455,5.325333712463379,25.258498497314456,5.286937712463379Q25.304188497314453,5.248541712463379,25.353328497314454,5.214916712463379Q25.40246849731445,5.181291712463379,25.454598497314453,5.152761712463379Q25.506728497314455,5.124230712463379,25.561328497314452,5.101069512463379Q25.615938497314453,5.077908212463379,25.672498497314454,5.060339212463379Q25.729058497314455,5.042770112463379,25.787028497314452,5.030962612463379Q25.844998497314453,5.019155012463379,25.903818497314454,5.013222702463379Q25.96263849731445,5.007290366463379,26.021738497314452,5.007290366463379Q26.080848497314452,5.007290366463379,26.139668497314453,5.013222702463379Q26.198488497314454,5.019155012463379,26.256458497314455,5.030962612463379Q26.31437849731445,5.042770112463379,26.370978497314454,5.060339212463379Q26.427578497314453,5.077908212463379,26.482178497314454,5.101069512463379Q26.53677849731445,5.124230712463379,26.588878497314454,5.152761712463379Q26.640978497314453,5.181291712463379,26.690178497314452,5.214916712463379Q26.73927849731445,5.248541712463379,26.784978497314455,5.286937712463379Q26.83067849731445,5.325333712463379,26.872478497314454,5.368129712463379Z'%20fill='%238C8C8C'%20fill-opacity='1'%20/%3e%3c/g%3e%3cg%20transform='rotate(90%2010.5%2010.5)%20matrix(0,1,-1,0,21.315007209777832,-11.299349784851074)'%3e%3cpath%20d='M26.872478497314454,5.368129712463379L26.872478497314454,5.368129712463379Q26.914278497314456,5.410926712463379,26.951778497314454,5.457711712463379Q26.98927849731445,5.504496712463379,27.022078497314453,5.554820712463379Q27.054878497314455,5.605143712463379,27.082778497314454,5.658520712463379Q27.110678497314453,5.7118977124633785,27.133278497314453,5.767813712463379Q27.155878497314454,5.823730712463379,27.173078497314453,5.881647712463379Q27.190178497314452,5.939565712463379,27.201778497314454,5.998925712463379Q27.213278497314455,6.058288712463379,27.219078497314452,6.118518712463379Q27.224878497314453,6.178748712463379,27.224878497314453,6.239278712463379Q27.224878497314453,6.299798712463379,27.219078497314452,6.360028712463379Q27.213278497314455,6.420258712463379,27.201778497314454,6.479618712463379Q27.190178497314452,6.538978712463379,27.173078497314453,6.5968987124633784Q27.155878497314454,6.654818712463379,27.133278497314453,6.7107287124633785Q27.110678497314453,6.766648712463379,27.082778497314454,6.820028712463379Q27.054878497314455,6.8734087124633785,27.022078497314453,6.923728712463379Q26.98927849731445,6.974048712463379,26.951778497314454,7.020838712463378Q26.914278497314456,7.0676187124633785,26.872478497314454,7.110418712463379L18.361158497314452,15.826028712463378Q18.319358497314454,15.86882871246338,18.273668497314453,15.907228712463379Q18.227988497314453,15.945628712463378,18.17883849731445,15.979228712463378Q18.129698497314454,16.01282871246338,18.077568497314452,16.04132871246338Q18.025448497314454,16.06992871246338,17.970838497314453,16.09302871246338Q17.916228497314453,16.11622871246338,17.859668497314452,16.133828712463377Q17.803108497314454,16.15132871246338,17.745148497314453,16.16312871246338Q17.687178497314452,16.174928712463377,17.62835849731445,16.180928712463377Q17.569538497314454,16.18682871246338,17.510428497314454,16.18682871246338Q17.451328497314453,16.18682871246338,17.392508497314452,16.180928712463377Q17.333688497314455,16.174928712463377,17.275714497314453,16.16312871246338Q17.217745497314453,16.15132871246338,17.161185497314452,16.133828712463377Q17.10462549731445,16.11622871246338,17.05001949731445,16.09302871246338Q16.995413497314452,16.06992871246338,16.943287497314454,16.04132871246338Q16.891162497314454,16.01282871246338,16.842018497314452,15.979228712463378Q16.792874497314454,15.945628712463378,16.747185497314454,15.907228712463379Q16.70149649731445,15.86882871246338,16.659703497314453,15.826028712463378L16.659703497314453,15.826028712463378Q16.617909497314454,15.783228712463378,16.580413497314453,15.736428712463379Q16.542918497314453,15.68962871246338,16.510081497314452,15.63932871246338Q16.47724449731445,15.58902871246338,16.449382497314453,15.535628712463378Q16.421520497314454,15.482228712463378,16.398901797314455,15.426328712463379Q16.376283297314455,15.37042871246338,16.359125997314454,15.31252871246338Q16.341968697314453,15.25452871246338,16.330437797314453,15.19522871246338Q16.318906997314453,15.135828712463379,16.313113657314453,15.075628712463379Q16.307320322314453,15.015428712463379,16.307320289314454,14.954858712463379Q16.307320256314455,14.894338712463378,16.313113517314452,14.834098712463378Q16.318906797314455,14.77386871246338,16.330437597314454,14.71450871246338Q16.34196829731445,14.65514871246338,16.359125597314453,14.597228712463378Q16.376282797314452,14.539308712463379,16.398901297314453,14.483398712463378Q16.421519497314453,14.42747871246338,16.44938149731445,14.374098712463379Q16.477243497314454,14.32072871246338,16.510080497314455,14.270398712463379Q16.542917497314452,14.220078712463378,16.580413497314453,14.173298712463378Q16.617908497314453,14.126508712463378,16.659702497314452,14.083708712463379L25.171018497314453,5.368129712463379Q25.212808497314455,5.325333712463379,25.258498497314456,5.286937712463379Q25.304188497314453,5.248541712463379,25.353328497314454,5.214916712463379Q25.40246849731445,5.181291712463379,25.454598497314453,5.152761712463379Q25.506728497314455,5.124230712463379,25.561328497314452,5.101069512463379Q25.615938497314453,5.077908212463379,25.672498497314454,5.060339212463379Q25.729058497314455,5.042770112463379,25.787028497314452,5.030962612463379Q25.844998497314453,5.019155012463379,25.903818497314454,5.013222702463379Q25.96263849731445,5.007290366463379,26.021738497314452,5.007290366463379Q26.080848497314452,5.007290366463379,26.139668497314453,5.013222702463379Q26.198488497314454,5.019155012463379,26.256458497314455,5.030962612463379Q26.31437849731445,5.042770112463379,26.370978497314454,5.060339212463379Q26.427578497314453,5.077908212463379,26.482178497314454,5.101069512463379Q26.53677849731445,5.124230712463379,26.588878497314454,5.152761712463379Q26.640978497314453,5.181291712463379,26.690178497314452,5.214916712463379Q26.73927849731445,5.248541712463379,26.784978497314455,5.286937712463379Q26.83067849731445,5.325333712463379,26.872478497314454,5.368129712463379Z'%20fill='%238C8C8C'%20fill-opacity='1'%20/%3e%3c/g%3e%3c/g%3e%3c/svg%3e";function useDraggableWithBoundary(tg){const{elRef:eg}=tg,gg=ref(0),ig=ref(0),Ig=ref(!1);let og=0,ng=0,sg=0,ag=0;const Cg=()=>{if(!eg.value)return;const dg=eg.value.getBoundingClientRect();sg=dg.width,ag=dg.height},lg=(dg,mg)=>Math.min(Math.max(dg,-mg),mg),Ag=dg=>{if(!Ig.value)return;let mg=dg.clientX-og,bg=dg.clientY-ng;const pg=(window.innerWidth-sg)/2,Zg=(window.innerHeight-ag)/2;mg=lg(mg,pg),bg=lg(bg,Zg),gg.value=mg,ig.value=bg},cg=()=>{Ig.value=!1,document.removeEventListener("mousemove",Ag),document.removeEventListener("mouseup",cg)},rg=async dg=>{dg.button===0&&(Ig.value=!0,await nextTick(),Cg(),og=dg.clientX-gg.value,ng=dg.clientY-ig.value,document.addEventListener("mousemove",Ag),document.addEventListener("mouseup",cg))},ug=()=>{Cg(),gg.value=lg(gg.value,window.innerWidth-sg),ig.value=lg(ig.value,window.innerHeight-ag)};return window.addEventListener("resize",ug),onUnmounted(()=>{document.removeEventListener("mousemove",Ag),document.removeEventListener("mouseup",cg),window.removeEventListener("resize",ug)}),{x:gg,y:ig,onMouseDown:rg}}const _hoisted_1$10={class:"d-container"},_hoisted_2$J={key:0,class:"d-mask"},_hoisted_3$C={class:"d-t-header"},_hoisted_4$y=["src"],_hoisted_5$u={key:0,class:"footer"},_sfc_main$13=defineComponent({__name:"Dialog",props:mergeModels({width:{type:String,default:"40%",required:!1},height:{type:String,default:"50%",required:!1},minHeight:{type:String,default:"300px",required:!1},maxHeight:{type:String,default:"auto",required:!1},minWidth:{type:String,default:void 0,required:!1},title:{type:String,required:!1},okBtnText:{type:String,default:"确认",require:!1},cancelBtnText:{type:String,default:"取消",require:!1},showOkBtn:{type:Boolean,default:!0,require:!1},showCancelBtn:{type:Boolean,default:!0,require:!1},showClose:{type:Boolean,default:!0,require:!1},noFooter:{type:Boolean,default:!1},maskShow:{type:Boolean,default:!1}},{open:{type:Boolean,default:!0},openModifiers:{},enabledOk:{type:Boolean,default:!0},enabledOkModifiers:{}}),emits:mergeModels(["finish"],["update:open","update:enabledOk"]),setup(tg,{emit:eg}){const gg=ref(),ig=eg,Ig=useModel(tg,"open"),og=tg;useModel(tg,"enabledOk");const{x:ng,y:sg,onMouseDown:ag}=useDraggableWithBoundary({elRef:gg}),Cg=lg=>{lg.stopPropagation(),ig("finish","close")};return(lg,Ag)=>{const cg=Button$1;return Ig.value?(openBlock(),createBlock(Teleport,{key:0,to:"body"},[createBaseVNode("div",_hoisted_1$10,[tg.maskShow?(openBlock(),createElementBlock("div",_hoisted_2$J)):createCommentVNode("",!0),createBaseVNode("div",{ref_key:"dialogRef",ref:gg,class:"dialog-content",style:normalizeStyle$1({height:og.height,minHeight:og.minHeight,width:og.width,minWidth:og.minWidth,maxHeight:og.maxHeight,transform:`translate(${unref(ng)}px, ${unref(sg)}px)`})},[createBaseVNode("div",_hoisted_3$C,[createBaseVNode("div",{class:"d-t-header-title",onMousedown:Ag[0]||(Ag[0]=(...rg)=>unref(ag)&&unref(ag)(...rg))},toDisplayString(og.title),33),tg.showClose?(openBlock(),createElementBlock("img",{key:0,class:"m-close-icon",src:unref(IconClose$1),onClick:Cg},null,8,_hoisted_4$y)):createCommentVNode("",!0)]),createBaseVNode("div",mergeProps({class:"custom-content"},lg.$attrs),[renderSlot(lg.$slots,"default",{},void 0)],16),tg.noFooter?createCommentVNode("",!0):(openBlock(),createElementBlock("div",_hoisted_5$u,[renderSlot(lg.$slots,"ext-button",{},void 0),tg.showOkBtn?(openBlock(),createBlock(cg,{key:0,type:"primary",onClick:Ag[1]||(Ag[1]=rg=>ig("finish","ok")),disabled:!tg.enabledOk},{default:withCtx(()=>[createTextVNode(toDisplayString(tg.okBtnText),1)]),_:1},8,["disabled"])):createCommentVNode("",!0),tg.showCancelBtn?(openBlock(),createBlock(cg,{key:1,style:{background:"#ffffff",color:"#828282"},onClick:Ag[2]||(Ag[2]=rg=>ig("finish","cancel"))},{default:withCtx(()=>[createTextVNode(toDisplayString(tg.cancelBtnText),1)]),_:1})):createCommentVNode("",!0)]))],4)])])):createCommentVNode("",!0)}}}),__unplugin_components_1$1=_export_sfc(_sfc_main$13,[["__scopeId","data-v-870d244d"]]);var browser={},canPromise,hasRequiredCanPromise;function requireCanPromise(){return hasRequiredCanPromise||(hasRequiredCanPromise=1,canPromise=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),canPromise}var qrcode$1={},utils$1={},hasRequiredUtils$1;function requireUtils$1(){if(hasRequiredUtils$1)return utils$1;hasRequiredUtils$1=1;let tg;const eg=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return utils$1.getSymbolSize=function(ig){if(!ig)throw new Error('"version" cannot be null or undefined');if(ig<1||ig>40)throw new Error('"version" should be in range from 1 to 40');return ig*4+17},utils$1.getSymbolTotalCodewords=function(ig){return eg[ig]},utils$1.getBCHDigit=function(gg){let ig=0;for(;gg!==0;)ig++,gg>>>=1;return ig},utils$1.setToSJISFunction=function(ig){if(typeof ig!="function")throw new Error('"toSJISFunc" is not a valid function.');tg=ig},utils$1.isKanjiModeEnabled=function(){return typeof tg<"u"},utils$1.toSJIS=function(ig){return tg(ig)},utils$1}var errorCorrectionLevel={},hasRequiredErrorCorrectionLevel;function requireErrorCorrectionLevel(){return hasRequiredErrorCorrectionLevel||(hasRequiredErrorCorrectionLevel=1,(function(tg){tg.L={bit:1},tg.M={bit:0},tg.Q={bit:3},tg.H={bit:2};function eg(gg){if(typeof gg!="string")throw new Error("Param is not a string");switch(gg.toLowerCase()){case"l":case"low":return tg.L;case"m":case"medium":return tg.M;case"q":case"quartile":return tg.Q;case"h":case"high":return tg.H;default:throw new Error("Unknown EC Level: "+gg)}}tg.isValid=function(ig){return ig&&typeof ig.bit<"u"&&ig.bit>=0&&ig.bit<4},tg.from=function(ig,Ig){if(tg.isValid(ig))return ig;try{return eg(ig)}catch{return Ig}}})(errorCorrectionLevel)),errorCorrectionLevel}var bitBuffer,hasRequiredBitBuffer;function requireBitBuffer(){if(hasRequiredBitBuffer)return bitBuffer;hasRequiredBitBuffer=1;function tg(){this.buffer=[],this.length=0}return tg.prototype={get:function(eg){const gg=Math.floor(eg/8);return(this.buffer[gg]>>>7-eg%8&1)===1},put:function(eg,gg){for(let ig=0;ig<gg;ig++)this.putBit((eg>>>gg-ig-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(eg){const gg=Math.floor(this.length/8);this.buffer.length<=gg&&this.buffer.push(0),eg&&(this.buffer[gg]|=128>>>this.length%8),this.length++}},bitBuffer=tg,bitBuffer}var bitMatrix,hasRequiredBitMatrix;function requireBitMatrix(){if(hasRequiredBitMatrix)return bitMatrix;hasRequiredBitMatrix=1;function tg(eg){if(!eg||eg<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=eg,this.data=new Uint8Array(eg*eg),this.reservedBit=new Uint8Array(eg*eg)}return tg.prototype.set=function(eg,gg,ig,Ig){const og=eg*this.size+gg;this.data[og]=ig,Ig&&(this.reservedBit[og]=!0)},tg.prototype.get=function(eg,gg){return this.data[eg*this.size+gg]},tg.prototype.xor=function(eg,gg,ig){this.data[eg*this.size+gg]^=ig},tg.prototype.isReserved=function(eg,gg){return this.reservedBit[eg*this.size+gg]},bitMatrix=tg,bitMatrix}var alignmentPattern={},hasRequiredAlignmentPattern;function requireAlignmentPattern(){return hasRequiredAlignmentPattern||(hasRequiredAlignmentPattern=1,(function(tg){const eg=requireUtils$1().getSymbolSize;tg.getRowColCoords=function(ig){if(ig===1)return[];const Ig=Math.floor(ig/7)+2,og=eg(ig),ng=og===145?26:Math.ceil((og-13)/(2*Ig-2))*2,sg=[og-7];for(let ag=1;ag<Ig-1;ag++)sg[ag]=sg[ag-1]-ng;return sg.push(6),sg.reverse()},tg.getPositions=function(ig){const Ig=[],og=tg.getRowColCoords(ig),ng=og.length;for(let sg=0;sg<ng;sg++)for(let ag=0;ag<ng;ag++)sg===0&&ag===0||sg===0&&ag===ng-1||sg===ng-1&&ag===0||Ig.push([og[sg],og[ag]]);return Ig}})(alignmentPattern)),alignmentPattern}var finderPattern={},hasRequiredFinderPattern;function requireFinderPattern(){if(hasRequiredFinderPattern)return finderPattern;hasRequiredFinderPattern=1;const tg=requireUtils$1().getSymbolSize,eg=7;return finderPattern.getPositions=function(ig){const Ig=tg(ig);return[[0,0],[Ig-eg,0],[0,Ig-eg]]},finderPattern}var maskPattern={},hasRequiredMaskPattern;function requireMaskPattern(){return hasRequiredMaskPattern||(hasRequiredMaskPattern=1,(function(tg){tg.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const eg={N1:3,N2:3,N3:40,N4:10};tg.isValid=function(Ig){return Ig!=null&&Ig!==""&&!isNaN(Ig)&&Ig>=0&&Ig<=7},tg.from=function(Ig){return tg.isValid(Ig)?parseInt(Ig,10):void 0},tg.getPenaltyN1=function(Ig){const og=Ig.size;let ng=0,sg=0,ag=0,Cg=null,lg=null;for(let Ag=0;Ag<og;Ag++){sg=ag=0,Cg=lg=null;for(let cg=0;cg<og;cg++){let rg=Ig.get(Ag,cg);rg===Cg?sg++:(sg>=5&&(ng+=eg.N1+(sg-5)),Cg=rg,sg=1),rg=Ig.get(cg,Ag),rg===lg?ag++:(ag>=5&&(ng+=eg.N1+(ag-5)),lg=rg,ag=1)}sg>=5&&(ng+=eg.N1+(sg-5)),ag>=5&&(ng+=eg.N1+(ag-5))}return ng},tg.getPenaltyN2=function(Ig){const og=Ig.size;let ng=0;for(let sg=0;sg<og-1;sg++)for(let ag=0;ag<og-1;ag++){const Cg=Ig.get(sg,ag)+Ig.get(sg,ag+1)+Ig.get(sg+1,ag)+Ig.get(sg+1,ag+1);(Cg===4||Cg===0)&&ng++}return ng*eg.N2},tg.getPenaltyN3=function(Ig){const og=Ig.size;let ng=0,sg=0,ag=0;for(let Cg=0;Cg<og;Cg++){sg=ag=0;for(let lg=0;lg<og;lg++)sg=sg<<1&2047|Ig.get(Cg,lg),lg>=10&&(sg===1488||sg===93)&&ng++,ag=ag<<1&2047|Ig.get(lg,Cg),lg>=10&&(ag===1488||ag===93)&&ng++}return ng*eg.N3},tg.getPenaltyN4=function(Ig){let og=0;const ng=Ig.data.length;for(let ag=0;ag<ng;ag++)og+=Ig.data[ag];return Math.abs(Math.ceil(og*100/ng/5)-10)*eg.N4};function gg(ig,Ig,og){switch(ig){case tg.Patterns.PATTERN000:return(Ig+og)%2===0;case tg.Patterns.PATTERN001:return Ig%2===0;case tg.Patterns.PATTERN010:return og%3===0;case tg.Patterns.PATTERN011:return(Ig+og)%3===0;case tg.Patterns.PATTERN100:return(Math.floor(Ig/2)+Math.floor(og/3))%2===0;case tg.Patterns.PATTERN101:return Ig*og%2+Ig*og%3===0;case tg.Patterns.PATTERN110:return(Ig*og%2+Ig*og%3)%2===0;case tg.Patterns.PATTERN111:return(Ig*og%3+(Ig+og)%2)%2===0;default:throw new Error("bad maskPattern:"+ig)}}tg.applyMask=function(Ig,og){const ng=og.size;for(let sg=0;sg<ng;sg++)for(let ag=0;ag<ng;ag++)og.isReserved(ag,sg)||og.xor(ag,sg,gg(Ig,ag,sg))},tg.getBestMask=function(Ig,og){const ng=Object.keys(tg.Patterns).length;let sg=0,ag=1/0;for(let Cg=0;Cg<ng;Cg++){og(Cg),tg.applyMask(Cg,Ig);const lg=tg.getPenaltyN1(Ig)+tg.getPenaltyN2(Ig)+tg.getPenaltyN3(Ig)+tg.getPenaltyN4(Ig);tg.applyMask(Cg,Ig),lg<ag&&(ag=lg,sg=Cg)}return sg}})(maskPattern)),maskPattern}var errorCorrectionCode={},hasRequiredErrorCorrectionCode;function requireErrorCorrectionCode(){if(hasRequiredErrorCorrectionCode)return errorCorrectionCode;hasRequiredErrorCorrectionCode=1;const tg=requireErrorCorrectionLevel(),eg=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],gg=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return errorCorrectionCode.getBlocksCount=function(Ig,og){switch(og){case tg.L:return eg[(Ig-1)*4+0];case tg.M:return eg[(Ig-1)*4+1];case tg.Q:return eg[(Ig-1)*4+2];case tg.H:return eg[(Ig-1)*4+3];default:return}},errorCorrectionCode.getTotalCodewordsCount=function(Ig,og){switch(og){case tg.L:return gg[(Ig-1)*4+0];case tg.M:return gg[(Ig-1)*4+1];case tg.Q:return gg[(Ig-1)*4+2];case tg.H:return gg[(Ig-1)*4+3];default:return}},errorCorrectionCode}var polynomial={},galoisField={},hasRequiredGaloisField;function requireGaloisField(){if(hasRequiredGaloisField)return galoisField;hasRequiredGaloisField=1;const tg=new Uint8Array(512),eg=new Uint8Array(256);return(function(){let ig=1;for(let Ig=0;Ig<255;Ig++)tg[Ig]=ig,eg[ig]=Ig,ig<<=1,ig&256&&(ig^=285);for(let Ig=255;Ig<512;Ig++)tg[Ig]=tg[Ig-255]})(),galoisField.log=function(ig){if(ig<1)throw new Error("log("+ig+")");return eg[ig]},galoisField.exp=function(ig){return tg[ig]},galoisField.mul=function(ig,Ig){return ig===0||Ig===0?0:tg[eg[ig]+eg[Ig]]},galoisField}var hasRequiredPolynomial;function requirePolynomial(){return hasRequiredPolynomial||(hasRequiredPolynomial=1,(function(tg){const eg=requireGaloisField();tg.mul=function(ig,Ig){const og=new Uint8Array(ig.length+Ig.length-1);for(let ng=0;ng<ig.length;ng++)for(let sg=0;sg<Ig.length;sg++)og[ng+sg]^=eg.mul(ig[ng],Ig[sg]);return og},tg.mod=function(ig,Ig){let og=new Uint8Array(ig);for(;og.length-Ig.length>=0;){const ng=og[0];for(let ag=0;ag<Ig.length;ag++)og[ag]^=eg.mul(Ig[ag],ng);let sg=0;for(;sg<og.length&&og[sg]===0;)sg++;og=og.slice(sg)}return og},tg.generateECPolynomial=function(ig){let Ig=new Uint8Array([1]);for(let og=0;og<ig;og++)Ig=tg.mul(Ig,new Uint8Array([1,eg.exp(og)]));return Ig}})(polynomial)),polynomial}var reedSolomonEncoder,hasRequiredReedSolomonEncoder;function requireReedSolomonEncoder(){if(hasRequiredReedSolomonEncoder)return reedSolomonEncoder;hasRequiredReedSolomonEncoder=1;const tg=requirePolynomial();function eg(gg){this.genPoly=void 0,this.degree=gg,this.degree&&this.initialize(this.degree)}return eg.prototype.initialize=function(ig){this.degree=ig,this.genPoly=tg.generateECPolynomial(this.degree)},eg.prototype.encode=function(ig){if(!this.genPoly)throw new Error("Encoder not initialized");const Ig=new Uint8Array(ig.length+this.degree);Ig.set(ig);const og=tg.mod(Ig,this.genPoly),ng=this.degree-og.length;if(ng>0){const sg=new Uint8Array(this.degree);return sg.set(og,ng),sg}return og},reedSolomonEncoder=eg,reedSolomonEncoder}var version={},mode={},versionCheck={},hasRequiredVersionCheck;function requireVersionCheck(){return hasRequiredVersionCheck||(hasRequiredVersionCheck=1,versionCheck.isValid=function(eg){return!isNaN(eg)&&eg>=1&&eg<=40}),versionCheck}var regex={},hasRequiredRegex;function requireRegex(){if(hasRequiredRegex)return regex;hasRequiredRegex=1;const tg="[0-9]+",eg="[A-Z $%*+\\-./:]+";let gg="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";gg=gg.replace(/u/g,"\\u");const ig="(?:(?![A-Z0-9 $%*+\\-./:]|"+gg+`)(?:.|[\r
|
|
907
907
|
]))+`;regex.KANJI=new RegExp(gg,"g"),regex.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),regex.BYTE=new RegExp(ig,"g"),regex.NUMERIC=new RegExp(tg,"g"),regex.ALPHANUMERIC=new RegExp(eg,"g");const Ig=new RegExp("^"+gg+"$"),og=new RegExp("^"+tg+"$"),ng=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return regex.testKanji=function(ag){return Ig.test(ag)},regex.testNumeric=function(ag){return og.test(ag)},regex.testAlphanumeric=function(ag){return ng.test(ag)},regex}var hasRequiredMode;function requireMode(){return hasRequiredMode||(hasRequiredMode=1,(function(tg){const eg=requireVersionCheck(),gg=requireRegex();tg.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},tg.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},tg.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},tg.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},tg.MIXED={bit:-1},tg.getCharCountIndicator=function(og,ng){if(!og.ccBits)throw new Error("Invalid mode: "+og);if(!eg.isValid(ng))throw new Error("Invalid version: "+ng);return ng>=1&&ng<10?og.ccBits[0]:ng<27?og.ccBits[1]:og.ccBits[2]},tg.getBestModeForData=function(og){return gg.testNumeric(og)?tg.NUMERIC:gg.testAlphanumeric(og)?tg.ALPHANUMERIC:gg.testKanji(og)?tg.KANJI:tg.BYTE},tg.toString=function(og){if(og&&og.id)return og.id;throw new Error("Invalid mode")},tg.isValid=function(og){return og&&og.bit&&og.ccBits};function ig(Ig){if(typeof Ig!="string")throw new Error("Param is not a string");switch(Ig.toLowerCase()){case"numeric":return tg.NUMERIC;case"alphanumeric":return tg.ALPHANUMERIC;case"kanji":return tg.KANJI;case"byte":return tg.BYTE;default:throw new Error("Unknown mode: "+Ig)}}tg.from=function(og,ng){if(tg.isValid(og))return og;try{return ig(og)}catch{return ng}}})(mode)),mode}var hasRequiredVersion;function requireVersion(){return hasRequiredVersion||(hasRequiredVersion=1,(function(tg){const eg=requireUtils$1(),gg=requireErrorCorrectionCode(),ig=requireErrorCorrectionLevel(),Ig=requireMode(),og=requireVersionCheck(),ng=7973,sg=eg.getBCHDigit(ng);function ag(cg,rg,ug){for(let dg=1;dg<=40;dg++)if(rg<=tg.getCapacity(dg,ug,cg))return dg}function Cg(cg,rg){return Ig.getCharCountIndicator(cg,rg)+4}function lg(cg,rg){let ug=0;return cg.forEach(function(dg){const mg=Cg(dg.mode,rg);ug+=mg+dg.getBitsLength()}),ug}function Ag(cg,rg){for(let ug=1;ug<=40;ug++)if(lg(cg,ug)<=tg.getCapacity(ug,rg,Ig.MIXED))return ug}tg.from=function(rg,ug){return og.isValid(rg)?parseInt(rg,10):ug},tg.getCapacity=function(rg,ug,dg){if(!og.isValid(rg))throw new Error("Invalid QR Code version");typeof dg>"u"&&(dg=Ig.BYTE);const mg=eg.getSymbolTotalCodewords(rg),bg=gg.getTotalCodewordsCount(rg,ug),pg=(mg-bg)*8;if(dg===Ig.MIXED)return pg;const Zg=pg-Cg(dg,rg);switch(dg){case Ig.NUMERIC:return Math.floor(Zg/10*3);case Ig.ALPHANUMERIC:return Math.floor(Zg/11*2);case Ig.KANJI:return Math.floor(Zg/13);case Ig.BYTE:default:return Math.floor(Zg/8)}},tg.getBestVersionForData=function(rg,ug){let dg;const mg=ig.from(ug,ig.M);if(Array.isArray(rg)){if(rg.length>1)return Ag(rg,mg);if(rg.length===0)return 1;dg=rg[0]}else dg=rg;return ag(dg.mode,dg.getLength(),mg)},tg.getEncodedBits=function(rg){if(!og.isValid(rg)||rg<7)throw new Error("Invalid QR Code version");let ug=rg<<12;for(;eg.getBCHDigit(ug)-sg>=0;)ug^=ng<<eg.getBCHDigit(ug)-sg;return rg<<12|ug}})(version)),version}var formatInfo={},hasRequiredFormatInfo;function requireFormatInfo(){if(hasRequiredFormatInfo)return formatInfo;hasRequiredFormatInfo=1;const tg=requireUtils$1(),eg=1335,gg=21522,ig=tg.getBCHDigit(eg);return formatInfo.getEncodedBits=function(og,ng){const sg=og.bit<<3|ng;let ag=sg<<10;for(;tg.getBCHDigit(ag)-ig>=0;)ag^=eg<<tg.getBCHDigit(ag)-ig;return(sg<<10|ag)^gg},formatInfo}var segments={},numericData,hasRequiredNumericData;function requireNumericData(){if(hasRequiredNumericData)return numericData;hasRequiredNumericData=1;const tg=requireMode();function eg(gg){this.mode=tg.NUMERIC,this.data=gg.toString()}return eg.getBitsLength=function(ig){return 10*Math.floor(ig/3)+(ig%3?ig%3*3+1:0)},eg.prototype.getLength=function(){return this.data.length},eg.prototype.getBitsLength=function(){return eg.getBitsLength(this.data.length)},eg.prototype.write=function(ig){let Ig,og,ng;for(Ig=0;Ig+3<=this.data.length;Ig+=3)og=this.data.substr(Ig,3),ng=parseInt(og,10),ig.put(ng,10);const sg=this.data.length-Ig;sg>0&&(og=this.data.substr(Ig),ng=parseInt(og,10),ig.put(ng,sg*3+1))},numericData=eg,numericData}var alphanumericData,hasRequiredAlphanumericData;function requireAlphanumericData(){if(hasRequiredAlphanumericData)return alphanumericData;hasRequiredAlphanumericData=1;const tg=requireMode(),eg=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function gg(ig){this.mode=tg.ALPHANUMERIC,this.data=ig}return gg.getBitsLength=function(Ig){return 11*Math.floor(Ig/2)+6*(Ig%2)},gg.prototype.getLength=function(){return this.data.length},gg.prototype.getBitsLength=function(){return gg.getBitsLength(this.data.length)},gg.prototype.write=function(Ig){let og;for(og=0;og+2<=this.data.length;og+=2){let ng=eg.indexOf(this.data[og])*45;ng+=eg.indexOf(this.data[og+1]),Ig.put(ng,11)}this.data.length%2&&Ig.put(eg.indexOf(this.data[og]),6)},alphanumericData=gg,alphanumericData}var byteData,hasRequiredByteData;function requireByteData(){if(hasRequiredByteData)return byteData;hasRequiredByteData=1;const tg=requireMode();function eg(gg){this.mode=tg.BYTE,typeof gg=="string"?this.data=new TextEncoder().encode(gg):this.data=new Uint8Array(gg)}return eg.getBitsLength=function(ig){return ig*8},eg.prototype.getLength=function(){return this.data.length},eg.prototype.getBitsLength=function(){return eg.getBitsLength(this.data.length)},eg.prototype.write=function(gg){for(let ig=0,Ig=this.data.length;ig<Ig;ig++)gg.put(this.data[ig],8)},byteData=eg,byteData}var kanjiData,hasRequiredKanjiData;function requireKanjiData(){if(hasRequiredKanjiData)return kanjiData;hasRequiredKanjiData=1;const tg=requireMode(),eg=requireUtils$1();function gg(ig){this.mode=tg.KANJI,this.data=ig}return gg.getBitsLength=function(Ig){return Ig*13},gg.prototype.getLength=function(){return this.data.length},gg.prototype.getBitsLength=function(){return gg.getBitsLength(this.data.length)},gg.prototype.write=function(ig){let Ig;for(Ig=0;Ig<this.data.length;Ig++){let og=eg.toSJIS(this.data[Ig]);if(og>=33088&&og<=40956)og-=33088;else if(og>=57408&&og<=60351)og-=49472;else throw new Error("Invalid SJIS character: "+this.data[Ig]+`
|
|
908
908
|
Make sure your charset is UTF-8`);og=(og>>>8&255)*192+(og&255),ig.put(og,13)}},kanjiData=gg,kanjiData}var dijkstra={exports:{}},hasRequiredDijkstra;function requireDijkstra(){return hasRequiredDijkstra||(hasRequiredDijkstra=1,(function(tg){var eg={single_source_shortest_paths:function(gg,ig,Ig){var og={},ng={};ng[ig]=0;var sg=eg.PriorityQueue.make();sg.push(ig,0);for(var ag,Cg,lg,Ag,cg,rg,ug,dg,mg;!sg.empty();){ag=sg.pop(),Cg=ag.value,Ag=ag.cost,cg=gg[Cg]||{};for(lg in cg)cg.hasOwnProperty(lg)&&(rg=cg[lg],ug=Ag+rg,dg=ng[lg],mg=typeof ng[lg]>"u",(mg||dg>ug)&&(ng[lg]=ug,sg.push(lg,ug),og[lg]=Cg))}if(typeof Ig<"u"&&typeof ng[Ig]>"u"){var bg=["Could not find a path from ",ig," to ",Ig,"."].join("");throw new Error(bg)}return og},extract_shortest_path_from_predecessor_list:function(gg,ig){for(var Ig=[],og=ig;og;)Ig.push(og),gg[og],og=gg[og];return Ig.reverse(),Ig},find_path:function(gg,ig,Ig){var og=eg.single_source_shortest_paths(gg,ig,Ig);return eg.extract_shortest_path_from_predecessor_list(og,Ig)},PriorityQueue:{make:function(gg){var ig=eg.PriorityQueue,Ig={},og;gg=gg||{};for(og in ig)ig.hasOwnProperty(og)&&(Ig[og]=ig[og]);return Ig.queue=[],Ig.sorter=gg.sorter||ig.default_sorter,Ig},default_sorter:function(gg,ig){return gg.cost-ig.cost},push:function(gg,ig){var Ig={value:gg,cost:ig};this.queue.push(Ig),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};tg.exports=eg})(dijkstra)),dijkstra.exports}var hasRequiredSegments;function requireSegments(){return hasRequiredSegments||(hasRequiredSegments=1,(function(tg){const eg=requireMode(),gg=requireNumericData(),ig=requireAlphanumericData(),Ig=requireByteData(),og=requireKanjiData(),ng=requireRegex(),sg=requireUtils$1(),ag=requireDijkstra();function Cg(bg){return unescape(encodeURIComponent(bg)).length}function lg(bg,pg,Zg){const Gg=[];let hg;for(;(hg=bg.exec(Zg))!==null;)Gg.push({data:hg[0],index:hg.index,mode:pg,length:hg[0].length});return Gg}function Ag(bg){const pg=lg(ng.NUMERIC,eg.NUMERIC,bg),Zg=lg(ng.ALPHANUMERIC,eg.ALPHANUMERIC,bg);let Gg,hg;return sg.isKanjiModeEnabled()?(Gg=lg(ng.BYTE,eg.BYTE,bg),hg=lg(ng.KANJI,eg.KANJI,bg)):(Gg=lg(ng.BYTE_KANJI,eg.BYTE,bg),hg=[]),pg.concat(Zg,Gg,hg).sort(function(wg,yg){return wg.index-yg.index}).map(function(wg){return{data:wg.data,mode:wg.mode,length:wg.length}})}function cg(bg,pg){switch(pg){case eg.NUMERIC:return gg.getBitsLength(bg);case eg.ALPHANUMERIC:return ig.getBitsLength(bg);case eg.KANJI:return og.getBitsLength(bg);case eg.BYTE:return Ig.getBitsLength(bg)}}function rg(bg){return bg.reduce(function(pg,Zg){const Gg=pg.length-1>=0?pg[pg.length-1]:null;return Gg&&Gg.mode===Zg.mode?(pg[pg.length-1].data+=Zg.data,pg):(pg.push(Zg),pg)},[])}function ug(bg){const pg=[];for(let Zg=0;Zg<bg.length;Zg++){const Gg=bg[Zg];switch(Gg.mode){case eg.NUMERIC:pg.push([Gg,{data:Gg.data,mode:eg.ALPHANUMERIC,length:Gg.length},{data:Gg.data,mode:eg.BYTE,length:Gg.length}]);break;case eg.ALPHANUMERIC:pg.push([Gg,{data:Gg.data,mode:eg.BYTE,length:Gg.length}]);break;case eg.KANJI:pg.push([Gg,{data:Gg.data,mode:eg.BYTE,length:Cg(Gg.data)}]);break;case eg.BYTE:pg.push([{data:Gg.data,mode:eg.BYTE,length:Cg(Gg.data)}])}}return pg}function dg(bg,pg){const Zg={},Gg={start:{}};let hg=["start"];for(let fg=0;fg<bg.length;fg++){const wg=bg[fg],yg=[];for(let Bg=0;Bg<wg.length;Bg++){const Wg=wg[Bg],$g=""+fg+Bg;yg.push($g),Zg[$g]={node:Wg,lastCount:0},Gg[$g]={};for(let Ng=0;Ng<hg.length;Ng++){const Vg=hg[Ng];Zg[Vg]&&Zg[Vg].node.mode===Wg.mode?(Gg[Vg][$g]=cg(Zg[Vg].lastCount+Wg.length,Wg.mode)-cg(Zg[Vg].lastCount,Wg.mode),Zg[Vg].lastCount+=Wg.length):(Zg[Vg]&&(Zg[Vg].lastCount=Wg.length),Gg[Vg][$g]=cg(Wg.length,Wg.mode)+4+eg.getCharCountIndicator(Wg.mode,pg))}}hg=yg}for(let fg=0;fg<hg.length;fg++)Gg[hg[fg]].end=0;return{map:Gg,table:Zg}}function mg(bg,pg){let Zg;const Gg=eg.getBestModeForData(bg);if(Zg=eg.from(pg,Gg),Zg!==eg.BYTE&&Zg.bit<Gg.bit)throw new Error('"'+bg+'" cannot be encoded with mode '+eg.toString(Zg)+`.
|
|
909
909
|
Suggested mode is: `+eg.toString(Gg));switch(Zg===eg.KANJI&&!sg.isKanjiModeEnabled()&&(Zg=eg.BYTE),Zg){case eg.NUMERIC:return new gg(bg);case eg.ALPHANUMERIC:return new ig(bg);case eg.KANJI:return new og(bg);case eg.BYTE:return new Ig(bg)}}tg.fromArray=function(pg){return pg.reduce(function(Zg,Gg){return typeof Gg=="string"?Zg.push(mg(Gg,null)):Gg.data&&Zg.push(mg(Gg.data,Gg.mode)),Zg},[])},tg.fromString=function(pg,Zg){const Gg=Ag(pg,sg.isKanjiModeEnabled()),hg=ug(Gg),fg=dg(hg,Zg),wg=ag.find_path(fg.map,"start","end"),yg=[];for(let Bg=1;Bg<wg.length-1;Bg++)yg.push(fg.table[wg[Bg]].node);return tg.fromArray(rg(yg))},tg.rawSplit=function(pg){return tg.fromArray(Ag(pg,sg.isKanjiModeEnabled()))}})(segments)),segments}var hasRequiredQrcode;function requireQrcode(){if(hasRequiredQrcode)return qrcode$1;hasRequiredQrcode=1;const tg=requireUtils$1(),eg=requireErrorCorrectionLevel(),gg=requireBitBuffer(),ig=requireBitMatrix(),Ig=requireAlignmentPattern(),og=requireFinderPattern(),ng=requireMaskPattern(),sg=requireErrorCorrectionCode(),ag=requireReedSolomonEncoder(),Cg=requireVersion(),lg=requireFormatInfo(),Ag=requireMode(),cg=requireSegments();function rg(fg,wg){const yg=fg.size,Bg=og.getPositions(wg);for(let Wg=0;Wg<Bg.length;Wg++){const $g=Bg[Wg][0],Ng=Bg[Wg][1];for(let Vg=-1;Vg<=7;Vg++)if(!($g+Vg<=-1||yg<=$g+Vg))for(let Mg=-1;Mg<=7;Mg++)Ng+Mg<=-1||yg<=Ng+Mg||(Vg>=0&&Vg<=6&&(Mg===0||Mg===6)||Mg>=0&&Mg<=6&&(Vg===0||Vg===6)||Vg>=2&&Vg<=4&&Mg>=2&&Mg<=4?fg.set($g+Vg,Ng+Mg,!0,!0):fg.set($g+Vg,Ng+Mg,!1,!0))}}function ug(fg){const wg=fg.size;for(let yg=8;yg<wg-8;yg++){const Bg=yg%2===0;fg.set(yg,6,Bg,!0),fg.set(6,yg,Bg,!0)}}function dg(fg,wg){const yg=Ig.getPositions(wg);for(let Bg=0;Bg<yg.length;Bg++){const Wg=yg[Bg][0],$g=yg[Bg][1];for(let Ng=-2;Ng<=2;Ng++)for(let Vg=-2;Vg<=2;Vg++)Ng===-2||Ng===2||Vg===-2||Vg===2||Ng===0&&Vg===0?fg.set(Wg+Ng,$g+Vg,!0,!0):fg.set(Wg+Ng,$g+Vg,!1,!0)}}function mg(fg,wg){const yg=fg.size,Bg=Cg.getEncodedBits(wg);let Wg,$g,Ng;for(let Vg=0;Vg<18;Vg++)Wg=Math.floor(Vg/3),$g=Vg%3+yg-8-3,Ng=(Bg>>Vg&1)===1,fg.set(Wg,$g,Ng,!0),fg.set($g,Wg,Ng,!0)}function bg(fg,wg,yg){const Bg=fg.size,Wg=lg.getEncodedBits(wg,yg);let $g,Ng;for($g=0;$g<15;$g++)Ng=(Wg>>$g&1)===1,$g<6?fg.set($g,8,Ng,!0):$g<8?fg.set($g+1,8,Ng,!0):fg.set(Bg-15+$g,8,Ng,!0),$g<8?fg.set(8,Bg-$g-1,Ng,!0):$g<9?fg.set(8,15-$g-1+1,Ng,!0):fg.set(8,15-$g-1,Ng,!0);fg.set(Bg-8,8,1,!0)}function pg(fg,wg){const yg=fg.size;let Bg=-1,Wg=yg-1,$g=7,Ng=0;for(let Vg=yg-1;Vg>0;Vg-=2)for(Vg===6&&Vg--;;){for(let Mg=0;Mg<2;Mg++)if(!fg.isReserved(Wg,Vg-Mg)){let Yg=!1;Ng<wg.length&&(Yg=(wg[Ng]>>>$g&1)===1),fg.set(Wg,Vg-Mg,Yg),$g--,$g===-1&&(Ng++,$g=7)}if(Wg+=Bg,Wg<0||yg<=Wg){Wg-=Bg,Bg=-Bg;break}}}function Zg(fg,wg,yg){const Bg=new gg;yg.forEach(function(Mg){Bg.put(Mg.mode.bit,4),Bg.put(Mg.getLength(),Ag.getCharCountIndicator(Mg.mode,fg)),Mg.write(Bg)});const Wg=tg.getSymbolTotalCodewords(fg),$g=sg.getTotalCodewordsCount(fg,wg),Ng=(Wg-$g)*8;for(Bg.getLengthInBits()+4<=Ng&&Bg.put(0,4);Bg.getLengthInBits()%8!==0;)Bg.putBit(0);const Vg=(Ng-Bg.getLengthInBits())/8;for(let Mg=0;Mg<Vg;Mg++)Bg.put(Mg%2?17:236,8);return Gg(Bg,fg,wg)}function Gg(fg,wg,yg){const Bg=tg.getSymbolTotalCodewords(wg),Wg=sg.getTotalCodewordsCount(wg,yg),$g=Bg-Wg,Ng=sg.getBlocksCount(wg,yg),Vg=Bg%Ng,Mg=Ng-Vg,Yg=Math.floor(Bg/Ng),Sg=Math.floor($g/Ng),vg=Sg+1,Rg=Yg-Sg,kg=new ag(Rg);let Kg=0;const Tg=new Array(Ng),xg=new Array(Ng);let Xg=0;const jg=new Uint8Array(fg.buffer);for(let qg=0;qg<Ng;qg++){const gI=qg<Mg?Sg:vg;Tg[qg]=jg.slice(Kg,Kg+gI),xg[qg]=kg.encode(Tg[qg]),Kg+=gI,Xg=Math.max(Xg,gI)}const zg=new Uint8Array(Bg);let Eg=0,Ug,iI;for(Ug=0;Ug<Xg;Ug++)for(iI=0;iI<Ng;iI++)Ug<Tg[iI].length&&(zg[Eg++]=Tg[iI][Ug]);for(Ug=0;Ug<Rg;Ug++)for(iI=0;iI<Ng;iI++)zg[Eg++]=xg[iI][Ug];return zg}function hg(fg,wg,yg,Bg){let Wg;if(Array.isArray(fg))Wg=cg.fromArray(fg);else if(typeof fg=="string"){let Yg=wg;if(!Yg){const Sg=cg.rawSplit(fg);Yg=Cg.getBestVersionForData(Sg,yg)}Wg=cg.fromString(fg,Yg||40)}else throw new Error("Invalid data");const $g=Cg.getBestVersionForData(Wg,yg);if(!$g)throw new Error("The amount of data is too big to be stored in a QR Code");if(!wg)wg=$g;else if(wg<$g)throw new Error(`
|