@vue-ui-kit/ant 2.4.0 → 2.4.2

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/cjs/index.js CHANGED
@@ -1,5 +1,5 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("vue"),A=require("ant-design-vue"),_t=require("@ant-design/icons-vue");function xl(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const pl=xl(_t);var yl={keyId:1,cookies:{path:"/"},treeOptions:{parentKey:"parentId",key:"id",children:"children"},parseDateFormat:"yyyy-MM-dd HH:mm:ss",firstDayOfWeek:1},ke=yl;function wl(r,e,t){if(r)if(r.forEach)r.forEach(e,t);else for(var i=0,s=r.length;i<s;i++)e.call(t,r[i],i,r)}var ee=wl,El=Object.prototype.toString,Xo=El,Cl=Xo;function bl(r){return function(e){return"[object "+r+"]"===Cl.call(e)}}var zt=bl,_l=zt,Rl=Array.isArray||_l("Array"),G=Rl;function Il(r,e){return r&&r.hasOwnProperty?r.hasOwnProperty(e):!1}var Ee=Il,Sl=Ee;function Tl(r,e,t){if(r)for(var i in r)Sl(r,i)&&e.call(t,r[i],i,r)}var Gt=Tl,Ol=G,kl=ee,Ll=Gt;function Dl(r,e,t){return r&&(Ol(r)?kl:Ll)(r,e,t)}var Z=Dl;function $l(r){return function(e){return typeof e===r}}var St=$l,Ml=St,Al=Ml("function"),re=Al,Nl=Z;function Bl(r,e){var t=Object[r];return function(i){var s=[];if(i){if(t)return t(i);Nl(i,e>1?function(o){s.push([""+o,i[o]])}:function(){s.push(arguments[e])})}return s}}var wr=Bl,Hl=wr,Fl=Hl("keys",1),Fe=Fl,Kl=Xo,Pl=Gt,Yl=ee;function Zi(r,e){var t=r.__proto__.constructor;return e?new t(e):new t}function ai(r,e){return e?zo(r,e):r}function zo(r,e){if(r)switch(Kl.call(r)){case"[object Object]":{var t=Object.create(Object.getPrototypeOf(r));return Pl(r,function(n,a){t[a]=ai(n,e)}),t}case"[object Date]":case"[object RegExp]":return Zi(r,r.valueOf());case"[object Array]":case"[object Arguments]":{var i=[];return Yl(r,function(n){i.push(ai(n,e))}),i}case"[object Set]":{var s=Zi(r);return s.forEach(function(n){s.add(ai(n,e))}),s}case"[object Map]":{var o=Zi(r);return o.forEach(function(n,a){o.set(a,ai(n,e))}),o}}return r}function Vl(r,e){return r&&zo(r,e)}var Er=Vl,Wl=ee,Xl=Fe,zl=G,Gl=Er,jr=Object.assign;function es(r,e,t){for(var i=e.length,s,o=1;o<i;o++)s=e[o],Wl(Xl(e[o]),t?function(n){r[n]=Gl(s[n],t)}:function(n){r[n]=s[n]});return r}var Ul=function(r){if(r){var e=arguments;if(r===!0){if(e.length>1)return r=zl(r[1])?[]:{},es(r,e,!0)}else return jr?jr.apply(Object,e):es(r,e)}return r},he=Ul,Go=ke,ql=ee,Zl=Z,Jl=re,Ql=he,Se=function(){};function jl(){ql(arguments,function(r){Zl(r,function(e,t){Se[t]=Jl(e)?function(){var i=e.apply(Se.$context,arguments);return Se.$context=null,i}:e})})}function Uo(r){return Ql(Go,r)}function ec(){return Go}var qo="3.7.8";Se.VERSION=qo;Se.version=qo;Se.mixin=jl;Se.setup=Uo;Se.setConfig=Uo;Se.getConfig=ec;var tc=Se;function ic(r,e,t){for(var i=r.length-1;i>=0;i--)e.call(t,r[i],i,r)}var Cr=ic,rc=Cr,sc=Fe;function oc(r,e,t){rc(sc(r),function(i){e.call(t,r[i],i,r)})}var Zo=oc;function nc(r){return r===null}var Ke=nc,ac=Ke;function lc(r,e){return function(t){return ac(t)?e:t[r]}}var Tt=lc,cc=Z,hc=re,dc=Tt;function uc(r,e,t){var i={};if(r)if(e)hc(e)||(e=dc(e)),cc(r,function(s,o){i[o]=e.call(t,s,o,r)});else return r;return i}var fc=uc;function gc(r){return r?r.constructor===Object:!1}var Ot=gc;function vc(r){return r!=="__proto__"&&r!=="constructor"}var Jo=vc,ts=G,is=Ot,mc=re,xc=Z,pc=Jo;function Qo(r,e){return is(r)&&is(e)||ts(r)&&ts(e)?(xc(e,function(t,i){pc(i)&&(r[i]=mc(e)?t:Qo(r[i],t))}),r):e}var yc=function(r){r||(r={});for(var e=arguments,t=e.length,i,s=1;s<t;s++)i=e[s],i&&Qo(r,i);return r},wc=yc,Ec=Z;function Cc(r,e,t){var i=[];if(r&&arguments.length>1){if(r.map)return r.map(e,t);Ec(r,function(){i.push(e.apply(t,arguments))})}return i}var ut=Cc,bc=Ee,_c=G;function Rc(r,e,t,i,s){return function(o,n,a){if(o&&n){if(r&&o[r])return o[r](n,a);if(e&&_c(o)){for(var c=0,d=o.length;c<d;c++)if(!!n.call(a,o[c],c,o)===i)return[!0,!1,c,o[c]][t]}else for(var f in o)if(bc(o,f)&&!!n.call(a,o[f],f,o)===i)return[!0,!1,f,o[f]][t]}return s}}var Li=Rc,Ic=Li,Sc=Ic("some",1,0,!0,!1),jo=Sc,Tc=Li,Oc=Tc("every",1,1,!1,!0),en=Oc,kc=Ee;function Lc(r,e){if(r){if(r.includes)return r.includes(e);for(var t in r)if(kc(r,t)&&e===r[t])return!0}return!1}var kt=Lc,rs=G,ss=kt;function Dc(r,e){var t,i=0;if(rs(r)&&rs(e)){for(t=e.length;i<t;i++)if(!ss(r,e[i]))return!1;return!0}return ss(r,e)}var tn=Dc,os=Z,$c=kt,Mc=re,Ac=Tt;function Nc(r,e,t){var i=[];if(e){Mc(e)||(e=Ac(e));var s,o={};os(r,function(n,a){s=e.call(t,n,a,r),o[s]||(o[s]=1,i.push(n))})}else os(r,function(n){$c(i,n)||i.push(n)});return i}var rn=Nc,Bc=ut;function Hc(r){return Bc(r,function(e){return e})}var br=Hc,Fc=rn,Kc=br;function Pc(){for(var r=arguments,e=[],t=0,i=r.length;t<i;t++)e=e.concat(Kc(r[t]));return Fc(e)}var Yc=Pc,Vc="undefined",Ce=Vc,Wc=Ce,Xc=St,zc=Xc(Wc),Le=zc,Gc=Ke,Uc=Le;function qc(r){return Gc(r)||Uc(r)}var Pe=qc,Zc=/(.+)?\[(\d+)\]$/,sn=Zc;function Jc(r){return r?r.splice&&r.join?r:(""+r).replace(/(\[\d+\])\.?/g,"$1.").replace(/\.$/,"").split("."):[]}var _r=Jc,Qc=sn,jc=_r,eh=Ee,th=Le,on=Pe;function ih(r,e,t){if(on(r))return t;var i=sh(r,e);return th(i)?t:i}function rh(r,e){var t=e?e.match(Qc):"";return t?t[1]?r[t[1]]?r[t[1]][t[2]]:void 0:r[t[2]]:r[e]}function sh(r,e){if(r){var t,i,s,o=0;if(r[e]||eh(r,e))return r[e];if(i=jc(e),s=i.length,s){for(t=r;o<s;o++)if(t=rh(t,i[o]),on(t))return o===s-1?t:void 0}return t}}var Ut=ih,ns=ee,oh=br,as=ut,ls=G,nh=re,ah=Ot,cs=Le,lh=Ke,ch=Pe,hh=Ut,dh=Tt,uh="asc",fh="desc";function dr(r,e){return cs(r)?1:lh(r)?cs(e)?-1:1:r&&r.localeCompare?r.localeCompare(e):r>e?1:-1}function gh(r,e,t){return function(i,s){var o=i[r],n=s[r];return o===n?t?t(i,s):0:e.order===fh?dr(n,o):dr(o,n)}}function vh(r,e,t,i){var s=[];return t=ls(t)?t:[t],ns(t,function(o,n){if(o){var a=o,c;ls(o)?(a=o[0],c=o[1]):ah(o)&&(a=o.field,c=o.order),s.push({field:a,order:c||uh}),ns(e,nh(a)?function(d,f){d[n]=a.call(i,d.data,f,r)}:function(d){d[n]=a?hh(d.data,a):d.data})}}),s}function mh(r,e,t){if(r){if(ch(e))return oh(r).sort(dr);for(var i,s=as(r,function(a){return{data:a}}),o=vh(r,s,e,t),n=o.length-1;n>=0;)i=gh(n,o[n],i),n--;return i&&(s=s.sort(i)),as(s,dh("data"))}return[]}var Rr=mh,xh=Rr,ph=xh,yh=ph;function wh(r,e){return r>=e?r:(r=r>>0)+Math.round(Math.random()*((e||9)-r))}var nn=wh,Eh=wr,Ch=Eh("values",0),Lt=Ch,bh=nn,_h=Lt;function Rh(r){for(var e,t=[],i=_h(r),s=i.length-1;s>=0;s--)e=s>0?bh(0,s):0,t.push(i[e]),i.splice(e,1);return t}var an=Rh,Ih=an;function Sh(r,e){var t=Ih(r);return arguments.length<=1?t[0]:(e<t.length&&(t.length=e||0),t)}var Th=Sh;function Oh(r){return function(e){if(e){var t=r(e&&e.replace?e.replace(/,/g,""):e);if(!isNaN(t))return t}return 0}}var ln=Oh,kh=ln,Lh=kh(parseFloat),ft=Lh,hs=ft;function Dh(r,e,t){var i=[],s=arguments.length;if(r){if(e=s>=2?hs(e):0,t=s>=3?hs(t):r.length,r.slice)return r.slice(e,t);for(;e<t;e++)i.push(r[e])}return i}var gt=Dh,$h=Z;function Mh(r,e,t){var i=[];if(r&&e){if(r.filter)return r.filter(e,t);$h(r,function(s,o){e.call(t,s,o,r)&&i.push(s)})}return i}var Ah=Mh,Nh=Li,Bh=Nh("",0,2,!0),Hh=Bh,Fh=Li,Kh=Fh("find",1,3,!0),Ph=Kh,Yh=G,Vh=Lt;function Wh(r,e,t){if(r){Yh(r)||(r=Vh(r));for(var i=r.length-1;i>=0;i--)if(e.call(t,r[i],i,r))return r[i]}}var Xh=Wh,zh=Fe;function Gh(r,e,t){if(r){var i,s,o=0,n=null,a=t,c=arguments.length>2,d=zh(r);if(r.length&&r.reduce)return s=function(){return e.apply(n,arguments)},c?r.reduce(s,a):r.reduce(s);for(c&&(o=1,a=r[d[0]]),i=d.length;o<i;o++)a=e.call(n,a,r[d[o]],o,r);return a}}var Uh=Gh,qh=G;function Zh(r,e,t,i){if(qh(r)&&r.copyWithin)return r.copyWithin(e,t,i);var s,o,n=e>>0,a=t>>0,c=r.length,d=arguments.length>3?i>>0:c;if(n<c&&(n=n>=0?n:c+n,n>=0&&(a=a>=0?a:c+a,d=d>=0?d:c+d,a<d)))for(s=0,o=r.slice(a,d);n<c&&!(o.length<=s);n++)r[n]=o[s++];return r}var Jh=Zh,Qh=G;function jh(r,e){var t,i=[],s=e>>0||1;if(Qh(r))if(s>=0&&r.length>s)for(t=0;t<r.length;)i.push(r.slice(t,t+s)),t+=s;else i=r.length?[r]:r;return i}var ed=jh,td=ut,id=Tt;function rd(r,e){return td(r,id(e))}var cn=rd,sd=re,ds=Pe,od=Ut,nd=ee;function ad(r){return function(e,t){if(e&&e.length){var i,s;return nd(e,function(o,n){t&&(o=sd(t)?t(o,n,e):od(o,t)),!ds(o)&&(ds(i)||r(i,o))&&(s=n,i=o)}),e[s]}return i}}var hn=ad,ld=hn,cd=ld(function(r,e){return r<e}),dn=cd,hd=cn,dd=dn;function ud(r){var e,t,i,s=[];if(r&&r.length)for(e=0,t=dd(r,function(o){return o?o.length:0}),i=t?t.length:0;e<i;e++)s.push(hd(r,e));return s}var un=ud,fd=un;function gd(){return fd(arguments)}var vd=gd,md=Lt,xd=Z;function pd(r,e){var t={};return e=e||[],xd(md(r),function(i,s){t[i]=e[s]}),t}var yd=pd,fn=G,wd=ee;function gn(r,e){var t=[];return wd(r,function(i){t=t.concat(fn(i)?e?gn(i,e):i:[i])}),t}function Ed(r,e){return fn(r)?gn(r,e):[]}var Cd=Ed,bd=ut,_d=G;function Rd(r,e){for(var t=0,i=e.length;r&&t<i;)r=r[e[t++]];return i&&r?r:0}function Id(r,e){for(var t,i=arguments,s=[],o=[],n=2,a=i.length;n<a;n++)s.push(i[n]);if(_d(e)){for(a=e.length-1,n=0;n<a;n++)o.push(e[n]);e=e[a]}return bd(r,function(c){if(o.length&&(c=Rd(c,o)),t=c[e]||e,t&&t.apply)return t.apply(c,s)})}var Sd=Id;function Td(r,e){return(console[r]||console.log)(e)}var Od=Td;function kd(r,e){try{delete r[e]}catch{r[e]=void 0}}var vn=kd,Ld=G,Dd=Cr,$d=Zo;function Md(r,e,t){return r&&(Ld(r)?Dd:$d)(r,e,t)}var mn=Md,Ad=St,Nd=Ad("object"),Di=Nd,Bd=vn,Hd=Ot,Fd=Di,Kd=G,Pd=Ke,Yd=he,Vd=Gt;function Wd(r,e,t){if(r){var i,s=arguments.length>1&&(Pd(e)||!Fd(e)),o=s?t:e;if(Hd(r))Vd(r,s?function(n,a){r[a]=e}:function(n,a){Bd(r,a)}),o&&Yd(r,o);else if(Kd(r)){if(s)for(i=r.length;i>0;)i--,r[i]=e;else r.length=0;o&&r.push.apply(r,o)}}return r}var xn=Wd,Xd=vn,zd=re,Gd=G,Ud=Z,qd=ee,Zd=mn,Jd=xn,Qd=Pe;function jd(r){return function(e,t){return t===r}}function eu(r,e,t){if(r){if(!Qd(e)){var i=[],s=[];return zd(e)||(e=jd(e)),Ud(r,function(o,n,a){e.call(t,o,n,a)&&i.push(n)}),Gd(r)?Zd(i,function(o,n){s.push(r[o]),r.splice(o,1)}):(s={},qd(i,function(o){s[o]=r[o],Xd(r,o)})),s}return Jd(r)}return r}var pn=eu,tu=ke,us=Od,iu=Rr,ru=Er,su=Pe,ur=Z,ou=pn,nu=he;function au(r,e){ur(r,function(t){t[e]&&!t[e].length&&ou(t,e)})}function lu(r,e){var t=nu({},tu.treeOptions,e),i=t.strict,s=t.key,o=t.parentKey,n=t.children,a=t.mapChildren,c=t.sortKey,d=t.reverse,f=t.data,u=[],g={},m={},x,v,p;return c&&(r=iu(ru(r),c),d&&(r=r.reverse())),ur(r,function(E){x=E[s],m[x]&&us("warn","Duplicate primary key="+x),m[x]=!0}),ur(r,function(E){x=E[s],f?(v={},v[f]=E):v=E,p=E[o],g[x]=g[x]||[],v[s]=x,v[o]=p,x===p&&(p=null,us("warn","Error infinite Loop. key="+x+" parentKey="+x)),g[p]=g[p]||[],g[p].push(v),v[n]=g[x],a&&(v[a]=g[x]),(!i||i&&su(p))&&(m[p]||u.push(v))}),i&&au(r,n),u}var cu=lu,hu=ke,du=ee,uu=he;function yn(r,e,t,i){var s=i.key,o=i.parentKey,n=i.children,a=i.data,c=i.updated,d=i.clear;return du(t,function(f){var u=f[n];a&&(f=f[a]),c!==!1&&(f[o]=e?e[s]:null),r.push(f),u&&u.length&&yn(r,f,u,i),d&&delete f[n]}),r}function fu(r,e){return yn([],null,r,uu({},hu.treeOptions,e))}var gu=fu;function vu(r){return function(e,t,i,s){var o=i||{},n=o.children||"children";return r(null,e,t,s,[],[],n,o)}}var $i=vu,mu=$i;function wn(r,e,t,i,s,o,n,a){if(e){var c,d,f,u,g,m;for(d=0,f=e.length;d<f;d++){if(c=e[d],u=s.concat([""+d]),g=o.concat([c]),t.call(i,c,d,e,u,r,g))return{index:d,item:c,path:u,items:e,parent:r,nodes:g};if(n&&c&&(m=wn(c,c[n],t,i,u.concat([n]),g,n),m))return m}}}var xu=mu(wn),pu=xu,yu=$i,wu=Z;function En(r,e,t,i,s,o,n,a){var c,d;wu(e,function(f,u){c=s.concat([""+u]),d=o.concat([f]),t.call(i,f,u,e,c,r,d),f&&n&&(c.push(n),En(f,f[n],t,i,c,d,n))})}var Eu=yu(En),Cn=Eu,Cu=$i,bu=ut;function bn(r,e,t,i,s,o,n,a){var c,d,f,u=a.mapChildren||n;return bu(e,function(g,m){return c=s.concat([""+m]),d=o.concat([g]),f=t.call(i,g,m,e,c,r,d),f&&g&&n&&g[n]&&(f[u]=bn(g,g[n],t,i,c,d,n,a)),f})}var _u=Cu(bn),Ru=_u,Iu=Cn;function Su(r,e,t,i){var s=[];return r&&e&&Iu(r,function(o,n,a,c,d,f){e.call(i,o,n,a,c,d,f)&&s.push(o)},t),s}var Tu=Su,Ou=$i,ku=ee,Lu=he;function _n(r,e,t,i,s,o,n,a,c){var d,f,u,g,m,x=[],v=c.original,p=c.data,E=c.mapChildren||a,C=c.isEvery;return ku(t,function(w,_){d=o.concat([""+_]),f=n.concat([w]),g=r&&!C||i.call(s,w,_,t,d,e,f),m=a&&w[a],g||m?(v?u=w:(u=Lu({},w),p&&(u[p]=w)),u[E]=_n(g,w,w[a],i,s,d,f,a,c),(g||u[E].length)&&x.push(u)):g&&x.push(u)}),x}var Du=Ou(function(r,e,t,i,s,o,n,a){return _n(0,r,e,t,i,s,o,n,a)}),$u=Du;function Mu(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,i=r.length;t<i;t++)if(e===r[t])return t}var Rn=Mu;function Au(r,e){if(r.lastIndexOf)return r.lastIndexOf(e);for(var t=r.length-1;t>=0;t--)if(e===r[t])return t;return-1}var In=Au,Nu=St,Bu=Nu("number"),De=Bu,Hu=De;function Fu(r){return Hu(r)&&isNaN(r)}var Ku=Fu,Pu=St,Yu=Pu("string"),Ye=Yu,Vu=zt,Wu=Vu("Date"),et=Wu,Xu=parseInt,qt=Xu;function zu(r){return Date.UTC(r.y,r.M||0,r.d||1,r.H||0,r.m||0,r.s||0,r.S||0)}var Gu=zu;function Uu(r){return r.getTime()}var fe=Uu,wi=qt,fs=Gu,qu=fe,Zu=Ye,Ju=et;function Zt(r){return"(\\d{"+r+"})"}function Qu(r){return r<10?r*100:r<100?r*10:r}function gs(r){return isNaN(r)?r:wi(r)}var pt=Zt(2),wt=Zt("1,2"),Sn=Zt("1,7"),Tn=Zt("3,4"),On=".{1}",Ht=On+wt,kn="(([zZ])|([-+]\\d{2}:?\\d{2}))",vs=[Tn,Ht,Ht,Ht,Ht,Ht,On+Sn,kn],fr=[];for(var Ji=vs.length-1;Ji>=0;Ji--){for(var ms="",lt=0;lt<Ji+1;lt++)ms+=vs[lt];fr.push(new RegExp("^"+ms+"$"))}function ju(r){for(var e,t={},i=0,s=fr.length;i<s;i++)if(e=r.match(fr[i]),e){t.y=e[1],t.M=e[2],t.d=e[3],t.H=e[4],t.m=e[5],t.s=e[6],t.S=e[7],t.Z=e[8];break}return t}var xs=[["yyyy",Tn],["yy",pt],["MM",pt],["M",wt],["dd",pt],["d",wt],["HH",pt],["H",wt],["mm",pt],["m",wt],["ss",pt],["s",wt],["SSS",Zt(3)],["S",Sn],["Z",kn]],Ln={},Dn=["\\[([^\\]]+)\\]"];for(var lt=0;lt<xs.length;lt++){var Qi=xs[lt];Ln[Qi[0]]=Qi[1]+"?",Dn.push(Qi[0])}var ef=new RegExp(Dn.join("|"),"g"),ps={};function tf(r,e){var t=ps[e];if(!t){var i=[],s=e.replace(/([$(){}*+.?\\^|])/g,"\\$1").replace(ef,function(f,u){var g=f.charAt(0);return g==="["?u:(i.push(g),Ln[f])});t=ps[e]={_i:i,_r:new RegExp(s)}}var o={},n=r.match(t._r);if(n){for(var a=t._i,c=1,d=n.length;c<d;c++)o[a[c-1]]=n[c];return o}return o}function rf(r){if(/^[zZ]/.test(r.Z))return new Date(fs(r));var e=r.Z.match(/([-+])(\d{2}):?(\d{2})/);return e?new Date(fs(r)-(e[1]==="-"?-1:1)*wi(e[2])*36e5+wi(e[3])*6e4):new Date("")}function sf(r,e){if(r){var t=Ju(r);if(t||!e&&/^[0-9]{11,15}$/.test(r))return new Date(t?qu(r):wi(r));if(Zu(r)){var i=e?tf(r,e):ju(r);if(i.y)return i.M&&(i.M=gs(i.M)-1),i.S&&(i.S=Qu(gs(i.S.substring(0,3)))),i.Z?rf(i):new Date(i.y,i.M||0,i.d||1,i.H||0,i.m||0,i.s||0,i.S||0)}}return new Date("")}var se=sf;function of(){return new Date}var Mi=of,nf=et,af=se,lf=Mi;function cf(r){var e,t=r?af(r):lf();return nf(t)?(e=t.getFullYear(),e%4===0&&(e%100!==0||e%400===0)):!1}var $n=cf,hf=G,df=Ee;function uf(r,e,t){if(r){if(hf(r))for(var i=0,s=r.length;i<s&&e.call(t,r[i],i,r)!==!1;i++);else for(var o in r)if(df(r,o)&&e.call(t,r[o],o,r)===!1)break}}var ff=uf,gf=G,vf=Ee;function mf(r,e,t){if(r){var i,s;if(gf(r))for(i=r.length-1;i>=0&&e.call(t,r[i],i,r)!==!1;i--);else for(s=vf(r),i=s.length-1;i>=0&&e.call(t,r[s[i]],s[i],r)!==!1;i--);}}var xf=mf,pf=G,yf=Ye,wf=Ee;function Ef(r,e){return function(t,i){if(t){if(t[r])return t[r](i);if(yf(t)||pf(t))return e(t,i);for(var s in t)if(wf(t,s)&&i===t[s])return s}return-1}}var Mn=Ef,Cf=Mn,bf=Rn,_f=Cf("indexOf",bf),Rf=_f,If=Mn,Sf=In,Tf=If("lastIndexOf",Sf),An=Tf,Of=G,kf=Ye,Lf=Z;function Df(r){var e=0;return kf(r)||Of(r)?r.length:(Lf(r,function(){e++}),e)}var Nn=Df,$f=De;function Mf(r){return $f(r)&&isFinite(r)}var Af=Mf,Nf=G,Bf=Ke,Hf=function(r){return!Bf(r)&&!isNaN(r)&&!Nf(r)&&r%1===0},Bn=Hf,Ff=G,Kf=Bn,Pf=Ke;function Yf(r){return!Pf(r)&&!isNaN(r)&&!Ff(r)&&!Kf(r)}var Vf=Yf,Wf=St,Xf=Wf("boolean"),Hn=Xf,zf=zt,Gf=zf("RegExp"),Ir=Gf,Uf=zt,qf=Uf("Error"),Fn=qf;function Zf(r){return r?r.constructor===TypeError:!1}var Jf=Zf;function Qf(r){for(var e in r)return!1;return!0}var Kn=Qf,jf=Ce,eg=typeof Symbol!==jf;function tg(r){return eg&&Symbol.isSymbol?Symbol.isSymbol(r):typeof r=="symbol"}var Pn=tg,ig=zt,rg=ig("Arguments"),sg=rg,og=Ye,ng=De;function ag(r){return!!(r&&og(r.nodeName)&&ng(r.nodeType))}var lg=ag,cg=Ce,hg=typeof document===cg?0:document,Sr=hg,dg=Sr;function ug(r){return!!(r&&dg&&r.nodeType===9)}var fg=ug,gg=Ce,vg=typeof window===gg?0:window,Yn=vg,mg=Yn;function xg(r){return!!(mg&&(r&&r===r.window))}var pg=xg,yg=Ce,wg=typeof FormData!==yg;function Eg(r){return wg&&r instanceof FormData}var Cg=Eg,bg=Ce,_g=typeof Map!==bg;function Rg(r){return _g&&r instanceof Map}var Ig=Rg,Sg=Ce,Tg=typeof WeakMap!==Sg;function Og(r){return Tg&&r instanceof WeakMap}var kg=Og,Lg=Ce,Dg=typeof Set!==Lg;function $g(r){return Dg&&r instanceof Set}var Mg=$g,Ag=Ce,Ng=typeof WeakSet!==Ag;function Bg(r){return Ng&&r instanceof WeakSet}var Hg=Bg,Fg=re,Kg=Ye,Pg=G,Yg=Ee;function Vg(r){return function(e,t,i){if(e&&Fg(t)){if(Pg(e)||Kg(e))return r(e,t,i);for(var s in e)if(Yg(e,s)&&t.call(i,e[s],s,e))return s}return-1}}var Vn=Vg,Wg=Vn,Xg=Wg(function(r,e,t){for(var i=0,s=r.length;i<s;i++)if(e.call(t,r[i],i,r))return i;return-1}),Tr=Xg,ys=De,ws=G,Es=Ye,zg=Ir,Gg=et,Ug=Hn,qg=Le,Cs=Fe,Zg=en;function Wn(r,e,t,i,s,o,n){if(r===e)return!0;if(r&&e&&!ys(r)&&!ys(e)&&!Es(r)&&!Es(e)){if(zg(r))return t(""+r,""+e,s,o,n);if(Gg(r)||Ug(r))return t(+r,+e,s,o,n);var a,c,d,f=ws(r),u=ws(e);if(f||u?f&&u:r.constructor===e.constructor)return c=Cs(r),d=Cs(e),i&&(a=i(r,e,s)),c.length===d.length?qg(a)?Zg(c,function(g,m){return g===d[m]&&Wn(r[g],e[d[m]],t,i,f||u?m:g,r,e)}):!!a:!1}return t(r,e,s,o,n)}var Xn=Wn;function Jg(r,e){return r===e}var zn=Jg,Qg=Xn,jg=zn;function ev(r,e){return Qg(r,e,jg)}var Gn=ev,bs=Fe,tv=Tr,_s=Gn,iv=jo,rv=tn;function sv(r,e){var t=bs(r),i=bs(e);if(i.length){if(rv(t,i))return iv(i,function(s){return tv(t,function(o){return o===s&&_s(r[o],e[s])})>-1})}else return!0;return _s(r,e)}var ov=sv,Rs=Xn,Is=zn,nv=re,av=Le;function lv(r,e,t){return nv(t)?Rs(r,e,function(i,s,o,n,a){var c=t(i,s,o,n,a);return av(c)?Is(i,s):!!c},t):Rs(r,e,Is)}var cv=lv,hv=Pn,dv=et,uv=G,fv=Ir,gv=Fn,vv=Ke;function mv(r){return vv(r)?"null":hv(r)?"symbol":dv(r)?"date":uv(r)?"array":fv(r)?"regexp":gv(r)?"error":typeof r}var xv=mv,pv=ke,yv=Pe;function wv(r){return""+(yv(r)?"":r)+pv.keyId++}var Ev=wv,Cv=Vn,bv=Cv(function(r,e,t){for(var i=r.length-1;i>=0;i--)if(e.call(t,r[i],i,r))return i;return-1}),_v=bv,Rv=Ot,Iv=Ye;function Sv(r){if(Rv(r))return r;if(Iv(r))try{return JSON.parse(r)}catch{}return{}}var Tv=Sv,Ov=Pe;function kv(r){return Ov(r)?"":JSON.stringify(r)}var Lv=kv,Dv=wr,$v=Dv("entries",2),Mv=$v,Av=re,Nv=G,Bv=Z,Hv=Tr;function Fv(r,e){return function(t,i){var s,o,n={},a=[],c=this,d=arguments,f=d.length;if(!Av(i)){for(o=1;o<f;o++)s=d[o],a.push.apply(a,Nv(s)?s:[s]);i=0}return Bv(t,function(u,g){((i?i.call(c,u,g,t):Hv(a,function(m){return m===g})>-1)?r:e)&&(n[g]=u)}),n}}var Un=Fv,Kv=Un,Pv=Kv(1,0),Yv=Pv,Vv=Un,Wv=Vv(0,1),Xv=Wv,zv=Lt;function Gv(r){return zv(r)[0]}var Uv=Gv,qv=Lt;function Zv(r){var e=qv(r);return e[e.length-1]}var Jv=Zv,Qv=sn,jv=_r,li=Ee;function em(r,e){if(r){if(li(r,e))return!0;var t,i,s,o,n,a,c=jv(e),d=0,f=c.length;for(n=r;d<f&&(a=!1,t=c[d],o=t?t.match(Qv):"",o?(i=o[1],s=o[2],i?n[i]&&li(n[i],s)&&(a=!0,n=n[i][s]):li(n,s)&&(a=!0,n=n[s])):li(n,t)&&(a=!0,n=n[t]),a);d++)if(d===f-1)return!0}return!1}var tm=em,Ss=qt,im=_r,rm=Jo,sm=Ee,Ts=/(.+)?\[(\d+)\]$/;function om(r,e,t,i,s){if(r[e])t&&(r[e]=s);else{var o,n,a=e?e.match(Ts):null;if(t)n=s;else{var c=i?i.match(Ts):null;c&&!c[1]?n=new Array(Ss(c[2])+1):n={}}return a?a[1]?(o=Ss(a[2]),r[a[1]]?t?r[a[1]][o]=n:r[a[1]][o]?n=r[a[1]][o]:r[a[1]][o]=n:(r[a[1]]=new Array(o+1),r[a[1]][o]=n)):r[a[2]]=n:r[e]=n,n}return r[e]}function nm(r,e,t){if(r&&rm(e)){if((r[e]||sm(r,e))&&!Os(e))r[e]=t;else for(var i=r,s=im(e),o=s.length,n=0;n<o;n++)if(!Os(s[n])){var a=n===o-1;i=om(i,s[n],a,a?null:s[n+1],t)}}return r}function Os(r){return r==="__proto__"||r==="constructor"||r==="prototype"}var am=nm,lm=Kn,cm=Di,hm=re,dm=Tt,um=Z;function fm(r){return function(){return lm(r)}}function gm(r,e,t){var i,s={};return r&&(e&&cm(e)?e=fm(e):hm(e)||(e=dm(e)),um(r,function(o,n){i=e?e.call(t,o,n,r):o,s[i]?s[i].push(o):s[i]=[o]})),s}var qn=gm,vm=qn,mm=Gt;function xm(r,e,t){var i=vm(r,e,t||this);return mm(i,function(s,o){i[o]=s.length}),i}var pm=xm;function ym(r,e,t){var i,s,o=[],n=arguments;if(n.length<2&&(e=n[0],r=0),i=r>>0,s=e>>0,i<e)for(t=t>>0||1;i<s;i+=t)o.push(i);return o}var Zn=ym,ks=Fe,wm=gt,Em=kt,Cm=ee,bm=he;function _m(r,e){if(r&&e){var t=bm.apply(this,[{}].concat(wm(arguments,1))),i=ks(t);Cm(ks(r),function(s){Em(i,s)&&(r[s]=t[s])})}return r}var Rm=_m,Im=hn,Sm=Im(function(r,e){return r>e}),Tm=Sm;function Om(r){return(r.split(".")[1]||"").length}var Ai=Om,km=qt;function Lm(r,e){if(r.repeat)return r.repeat(e);var t=isNaN(e)?[]:new Array(km(e));return t.join(r)+(t.length>0?r:"")}var Jt=Lm;function Dm(r,e){return r.substring(0,e)+"."+r.substring(e,r.length)}var Jn=Dm,ci=Jt,ji=Jn;function $m(r){var e=""+r,t=e.match(/^([-+]?)((\d+)|((\d+)?[.](\d+)?))e([-+]{1})([0-9]+)$/);if(t){var i=r<0,s=i?"-":"",o=t[3]||"",n=t[5]||"",a=t[6]||"",c=t[7],d=t[8],f=d-a.length,u=d-o.length,g=d-n.length;return c==="+"?o?s+o+ci("0",d):f>0?s+n+a+ci("0",f):s+n+ji(a,d):o?u>0?s+"0."+ci("0",Math.abs(u))+o:s+ji(o,u):g>0?s+"0."+ci("0",Math.abs(g))+n+a:s+ji(n,g)+a}return e}var tt=$m,Ls=Ai,Ds=tt;function Mm(r,e){var t=Ds(r),i=Ds(e);return parseInt(t.replace(".",""))*parseInt(i.replace(".",""))/Math.pow(10,Ls(t)+Ls(i))}var Qn=Mm,Am=Qn,$s=ft,Nm=tt;function Bm(r){return function(e,t){var i=$s(e),s=i;if(i){t=t>>0;var o=Nm(i),n=o.split("."),a=n[0],c=n[1]||"",d=c.substring(0,t+1),f=a+(d?"."+d:"");if(t>=c.length)return $s(f);if(f=i,t>0){var u=Math.pow(10,t);s=Math[r](Am(f,u))/u}else s=Math[r](f)}return s}}var Or=Bm,Hm=Or,Fm=Hm("round"),kr=Fm,Km=Or,Pm=Km("ceil"),jn=Pm,Ym=Or,Vm=Ym("floor"),ea=Vm,Wm=Pe,Xm=De,zm=tt;function Gm(r){return Xm(r)?zm(r):""+(Wm(r)?"":r)}var oe=Gm,Um=kr,qm=oe,Zm=Jt,Jm=Jn;function Qm(r,e){e=e>>0;var t=qm(Um(r,e)),i=t.split("."),s=i[0],o=i[1]||"",n=e-o.length;return e?n>0?s+"."+o+Zm("0",n):s+Jm(o,Math.abs(n)):s}var Lr=Qm,jm=ke,ex=kr,tx=jn,ix=ea,rx=De,sx=oe,ox=Lr,nx=tt,ax=he;function lx(r,e){var t=ax({},jm.commafyOptions,e),i=t.digits,s=rx(r),o,n,a,c,d;return s?(o=(t.ceil?tx:t.floor?ix:ex)(r,i),n=nx(i?ox(o,i):o).split("."),c=n[0],d=n[1],a=c&&o<0,a&&(c=c.substring(1,c.length))):(o=sx(r).replace(/,/g,""),n=o?[o]:[],c=n[0]),n.length?(a?"-":"")+c.replace(new RegExp("(?=(?!(\\b))(.{"+(t.spaceNumber||3)+"})+$)","g"),t.separator||",")+(d?"."+d:""):o}var cx=lx,hx=qt,dx=ln,ux=dx(hx),fx=ux,gx=Qn,Ms=ft;function vx(r,e){var t=Ms(r),i=Ms(e);return gx(t,i)}var Dr=vx,As=Ai,Ns=tt,Bs=Dr;function mx(r,e){var t=Ns(r),i=Ns(e),s=Math.pow(10,Math.max(As(t),As(i)));return(Bs(r,s)+Bs(e,s))/s}var ta=mx,xx=ta,Hs=ft;function px(r,e){return xx(Hs(r),Hs(e))}var yx=px,Fs=Ai,Ks=tt,Ps=ft,wx=Lr;function Ex(r,e){var t=Ps(r),i=Ps(e),s=Ks(t),o=Ks(i),n=Fs(s),a=Fs(o),c=Math.pow(10,Math.max(n,a)),d=n>=a?n:a;return parseFloat(wx((t*c-i*c)/c,d))}var Cx=Ex,Ys=Ai,Vs=tt,bx=Dr;function _x(r,e){var t=Vs(r),i=Vs(e),s=Ys(t),o=Ys(i),n=o-s,a=n<0,c=Math.pow(10,a?Math.abs(n):n);return bx(t.replace(".","")/i.replace(".",""),a?1/c:c)}var ia=_x,Rx=ia,Ws=ft;function Ix(r,e){return Rx(Ws(r),Ws(e))}var Sx=Ix,er=ta,Tx=re,Ox=G,kx=Z,Lx=Ut;function Dx(r,e,t){var i=0;return kx(r&&r.length>2&&Ox(r)?r.sort():r,e?Tx(e)?function(){i=er(i,e.apply(t,arguments))}:function(s){i=er(i,Lx(s,e))}:function(s){i=er(i,s)}),i}var ra=Dx,$x=ia,Mx=Nn,Ax=ra;function Nx(r,e,t){return $x(Ax(r,e,t),Mx(r))}var Bx=Nx,Hx="first",Qt=Hx,Fx="last",Ni=Fx;function Kx(r){return r.getFullYear()}var jt=Kx,Px=864e5,Dt=Px;function Yx(r){return r.getMonth()}var Bi=Yx,Vx=et,Wx=fe;function Xx(r){return Vx(r)&&!isNaN(Wx(r))}var ge=Xx,Xs=Qt,zx=Ni,Gx=Dt,Ux=jt,zs=fe,Gs=Bi,qx=se,Zx=ge,Jx=De;function sa(r,e,t){var i=e&&!isNaN(e)?e:0;if(r=qx(r),Zx(r)){if(t===Xs)return new Date(Ux(r),Gs(r)+i,1);if(t===zx)return new Date(zs(sa(r,i+1,Xs))-1);if(Jx(t)&&r.setDate(t),i){var s=r.getDate();if(r.setMonth(Gs(r)+i),s!==r.getDate())return r.setDate(1),new Date(zs(r)-Gx)}}return r}var ei=sa,Qx=Qt,Us=Ni,qs=jt,jx=ei,ep=se,tp=ge;function ip(r,e,t){var i;if(r=ep(r),tp(r)&&(e&&(i=e&&!isNaN(e)?e:0,r.setFullYear(qs(r)+i)),t||!isNaN(t))){if(t===Qx)return new Date(qs(r),0,1);if(t===Us)return r.setMonth(11),jx(r,0,Us);r.setMonth(t)}return r}var Hi=ip,rp=ei,sp=se,op=ge;function np(r){var e=r.getMonth();return e<3?1:e<6?2:e<9?3:4}function ap(r,e,t){var i,s=e&&!isNaN(e)?e*3:0;return r=sp(r),op(r)?(i=(np(r)-1)*3,r.setMonth(i),rp(r,s,t)):r}var lp=ap,Zs=Qt,cp=Ni,hp=qt,dp=jt,up=Bi,fp=fe,gp=se,vp=ge;function oa(r,e,t){if(r=gp(r),vp(r)&&!isNaN(e)){if(r.setDate(r.getDate()+hp(e)),t===Zs)return new Date(dp(r),up(r),r.getDate());if(t===cp)return new Date(fp(oa(r,1,Zs))-1)}return r}var na=oa;function mp(r){return r.toUpperCase()}var aa=mp,xp=Dt,pp=xp*7,la=pp,yp=ke,tr=Dt,wp=la,Ep=fe,Cp=se,bp=ge,Js=De;function _p(r,e,t,i){if(r=Cp(r),bp(r)){var s=Js(t),o=Js(i),n=Ep(r);if(s||o){var a=o?i:yp.firstDayOfWeek,c=r.getDay(),d=s?t:c;if(c!==d){var f=0;a>c?f=-(7-a+c):a<c&&(f=a-c),d>a?n+=((d===0?7:d)-a+f)*tr:d<a?n+=(7-a+d+f)*tr:n+=f*tr}}return e&&!isNaN(e)&&(n+=e*wp),new Date(n)}return r}var ca=_p,Rp=ke,hi=Dt,Ip=la,Sp=De,Tp=kt,Op=se,kp=ge,Qs=ca,Lp=Zn,Dp=ut,di=fe,$p=Dp(Lp(0,7),function(r){return[(r+1)%7,(r+2)%7,(r+3)%7]});function js(r,e){var t=new Date(r).getDay();return Tp($p[e],t)}function Mp(r,e){return function(t,i){var s=Sp(i)?i:Rp.firstDayOfWeek,o=Op(t);if(kp(o)){var n=Qs(o,0,s,s),a=r(n),c=di(a),d=di(n),f=d+hi*6,u=new Date(f),g=Qs(a,0,s,s),m=di(g),x;if(d===m)return 1;if(e(n,u)){for(x=di(r(u));x<f;x+=hi)if(js(x,s))return 1}var v=m+hi*6,p=new Date(f),E=1;if(e(g,p)){for(E=0,x=c;x<v;x+=hi)if(js(x,s)){E++;break}}return Math.floor((d-m)/Ip)+E}return NaN}}var ha=Mp,Ap=ha,Np=Ap(function(r){return new Date(r.getFullYear(),0,1)},function(r,e){return r.getFullYear()!==e.getFullYear()}),da=Np,Bp=jt,Hp=Bi;function Fp(r){return new Date(Bp(r),Hp(r),r.getDate())}var Kp=Fp,Pp=fe,Yp=Kp;function Vp(r){return Pp(Yp(r))}var Wp=Vp,Xp=Dt,zp=Qt,eo=Wp,Gp=Hi,Up=se,qp=ge;function Zp(r){return r=Up(r),qp(r)?Math.floor((eo(r)-eo(Gp(r,0,zp)))/Xp)+1:NaN}var ua=Zp,Jp=oe,Qp=Le,jp=Jt;function e0(r,e,t){var i=Jp(r);return e=e>>0,t=Qp(t)?" ":""+t,i.padStart?i.padStart(e,t):e>i.length?(e-=i.length,e>t.length&&(t+=jp(t,e/t.length)),t.slice(0,e)+i):i}var fa=e0,Ft=ke,t0=aa,i0=jt,to=Bi,r0=se,s0=da,o0=ua,n0=he,a0=ge,l0=re,Ie=fa;function Ue(r,e,t,i){var s=e[t];return s?l0(s)?s(i,t,r):s[i]:i}var c0=/\[([^\]]+)]|y{2,4}|M{1,2}|d{1,2}|H{1,2}|h{1,2}|m{1,2}|s{1,2}|S{1,3}|Z{1,2}|W{1,2}|D{1,3}|[aAeEq]/g;function h0(r,e,t){if(r){if(r=r0(r),a0(r)){var i=e||Ft.parseDateFormat||Ft.formatString,s=r.getHours(),o=s<12?"am":"pm",n=n0({},Ft.parseDateRules||Ft.formatStringMatchs,t?t.formats:null),a=function(w,_){return(""+i0(r)).substr(4-_)},c=function(w,_){return Ie(to(r)+1,_,"0")},d=function(w,_){return Ie(r.getDate(),_,"0")},f=function(w,_){return Ie(s,_,"0")},u=function(w,_){return Ie(s<=12?s:s-12,_,"0")},g=function(w,_){return Ie(r.getMinutes(),_,"0")},m=function(w,_){return Ie(r.getSeconds(),_,"0")},x=function(w,_){return Ie(r.getMilliseconds(),_,"0")},v=function(w,_){var S=r.getTimezoneOffset()/60*-1;return Ue(r,n,w,(S>=0?"+":"-")+Ie(S,2,"0")+(_===1?":":"")+"00")},p=function(w,_){return Ie(Ue(r,n,w,s0(r,(t?t.firstDay:null)||Ft.firstDayOfWeek)),_,"0")},E=function(w,_){return Ie(Ue(r,n,w,o0(r)),_,"0")},C={yyyy:a,yy:a,MM:c,M:c,dd:d,d,HH:f,H:f,hh:u,h:u,mm:g,m:g,ss:m,s:m,SSS:x,S:x,ZZ:v,Z:v,WW:p,W:p,DDD:E,D:E,a:function(w){return Ue(r,n,w,o)},A:function(w){return Ue(r,n,w,t0(o))},e:function(w){return Ue(r,n,w,r.getDay())},E:function(w){return Ue(r,n,w,r.getDay())},q:function(w){return Ue(r,n,w,Math.floor((to(r)+3)/3))}};return i.replace(c0,function(w,_){return _||(C[w]?C[w](w,w.length):w)})}return"Invalid Date"}return""}var ga=h0,d0=fe,u0=Mi,f0=Date.now||function(){return d0(u0())},va=f0,g0=fe,v0=va,m0=se,x0=et,p0=function(r,e){if(r){var t=m0(r,e);return x0(t)?g0(t):t}return v0()},y0=p0,io=ga;function w0(r,e,t){return r&&e?(r=io(r,t),r!=="Invalid Date"&&r===io(e,t)):!1}var E0=w0,C0=ha,b0=C0(function(r){return new Date(r.getFullYear(),r.getMonth(),1)},function(r,e){return r.getMonth()!==e.getMonth()}),_0=b0,R0=Hi,I0=se,S0=ge,T0=$n;function O0(r,e){return r=I0(r),S0(r)?T0(R0(r,e))?366:365:NaN}var k0=O0,L0=Dt,D0=Qt,$0=Ni,ro=fe,so=ei,M0=se,A0=ge;function N0(r,e){return r=M0(r),A0(r)?Math.floor((ro(so(r,e,$0))-ro(so(r,e,D0)))/L0)+1:NaN}var B0=N0,oo=fe,H0=Mi,no=se,ao=ge,lo=[["yyyy",31536e6],["MM",2592e6],["dd",864e5],["HH",36e5],["mm",6e4],["ss",1e3],["S",0]];function F0(r,e){var t,i,s,o,n,a,c={done:!1,time:0};if(r=no(r),e=e?no(e):H0(),ao(r)&&ao(e)&&(t=oo(r),i=oo(e),t<i))for(o=c.time=i-t,c.done=!0,a=0,n=lo.length;a<n;a++)s=lo[a],o>=s[1]?a===n-1?c[s[0]]=o||0:(c[s[0]]=Math.floor(o/s[1]),o-=c[s[0]]*s[1]):c[s[0]]=0;return c}var K0=F0,P0=oe,Y0=Le,V0=Jt;function W0(r,e,t){var i=P0(r);return e=e>>0,t=Y0(t)?" ":""+t,i.padEnd?i.padEnd(e,t):e>i.length?(e-=i.length,e>t.length&&(t+=V0(t,e/t.length)),i+t.slice(0,e)):i}var X0=W0,z0=oe,G0=Jt;function U0(r,e){return G0(z0(r),e)}var q0=U0,Z0=oe;function J0(r){return r&&r.trimRight?r.trimRight():Z0(r).replace(/[\s\uFEFF\xA0]+$/g,"")}var ma=J0,Q0=oe;function j0(r){return r&&r.trimLeft?r.trimLeft():Q0(r).replace(/^[\s\uFEFF\xA0]+/g,"")}var xa=j0,e1=ma,t1=xa;function i1(r){return r&&r.trim?r.trim():e1(t1(r))}var pa=i1,r1={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},ya=r1,s1=oe,o1=Fe;function n1(r){var e=new RegExp("(?:"+o1(r).join("|")+")","g");return function(t){return s1(t).replace(e,function(i){return r[i]})}}var wa=n1,a1=ya,l1=wa,c1=l1(a1),h1=c1,co=ya,d1=wa,u1=Z,Ea={};u1(co,function(r,e){Ea[co[e]]=e});var f1=d1(Ea),g1=f1;function v1(r,e,t){return r.substring(e,t)}var Ca=v1;function m1(r){return r.toLowerCase()}var ba=m1,x1=oe,qe=Ca,Kt=aa,p1=ba,ir={};function y1(r){if(r=x1(r),ir[r])return ir[r];var e=r.length,t=r.replace(/([-]+)/g,function(i,s,o){return o&&o+s.length<e?"-":""});return e=t.length,t=t.replace(/([A-Z]+)/g,function(i,s,o){var n=s.length;return s=p1(s),o?n>2&&o+n<e?Kt(qe(s,0,1))+qe(s,1,n-1)+Kt(qe(s,n-1,n)):Kt(qe(s,0,1))+qe(s,1,n):n>1&&o+n<e?qe(s,0,n-1)+Kt(qe(s,n-1,n)):s}).replace(/(-[a-zA-Z])/g,function(i,s){return Kt(qe(s,1,s.length))}),ir[r]=t,t}var w1=y1,E1=oe,yt=Ca,Ze=ba,rr={};function C1(r){if(r=E1(r),rr[r])return rr[r];if(/^[A-Z]+$/.test(r))return Ze(r);var e=r.replace(/^([a-z])([A-Z]+)([a-z]+)$/,function(t,i,s,o){var n=s.length;return n>1?i+"-"+Ze(yt(s,0,n-1))+"-"+Ze(yt(s,n-1,n))+o:Ze(i+"-"+s+o)}).replace(/^([A-Z]+)([a-z]+)?$/,function(t,i,s){var o=i.length;return Ze(yt(i,0,o-1)+"-"+yt(i,o-1,o)+(s||""))}).replace(/([a-z]?)([A-Z]+)([a-z]?)/g,function(t,i,s,o,n){var a=s.length;return a>1&&(i&&(i+="-"),o)?(i||"")+Ze(yt(s,0,a-1))+"-"+Ze(yt(s,a-1,a))+o:(i||"")+(n?"-":"")+Ze(s)+(o||"")});return e=e.replace(/([-]+)/g,function(t,i,s){return s&&s+i.length<e.length?"-":""}),rr[r]=e,e}var b1=C1,_1=oe;function R1(r,e,t){var i=_1(r);return(arguments.length===1?i:i.substring(t)).indexOf(e)===0}var I1=R1,S1=oe;function T1(r,e,t){var i=S1(r),s=arguments.length;return s>1&&(s>2?i.substring(0,t).indexOf(e)===t-1:i.indexOf(e)===i.length-1)}var O1=T1,k1=ke,L1=oe,D1=pa,$1=Ut;function M1(r,e,t){return L1(r).replace((t||k1).tmplRE||/\{{2}([.\w[\]\s]+)\}{2}/g,function(i,s){return $1(e,D1(s))})}var _a=M1,A1=_a;function N1(r,e){return A1(r,e,{tmplRE:/\{([.\w[\]\s]+)\}/g})}var B1=N1;function H1(){}var F1=H1,ho=gt;function K1(r,e){var t=ho(arguments,2);return function(){return r.apply(e,ho(arguments).concat(t))}}var P1=K1,uo=gt;function Y1(r,e){var t=!1,i=null,s=uo(arguments,2);return function(){return t||(i=r.apply(e,uo(arguments).concat(s)),t=!0),i}}var V1=Y1,W1=gt;function X1(r,e,t){var i=0,s=[];return function(){var o=arguments;i++,i<=r&&s.push(o[0]),i>=r&&e.apply(t,[s].concat(W1(o)))}}var z1=X1,G1=gt;function U1(r,e,t){var i=0,s=[];return t=t||this,function(){var o=arguments;i++,i<r&&(s.push(o[0]),e.apply(t,[s].concat(G1(o))))}}var q1=U1,Z1=he;function J1(r,e,t){var i=null,s=null,o=!1,n=null,a=Z1({leading:!0,trailing:!0},t),c=a.leading,d=a.trailing,f=function(){i=null,s=null},u=function(){o=!0,r.apply(s,i),n=setTimeout(g,e),f()},g=function(){if(n=null,o){f();return}if(d===!0){u();return}f()},m=function(){var v=n!==null;return v&&clearTimeout(n),f(),n=null,o=!1,v},x=function(){if(i=arguments,s=this,o=!1,n===null&&c===!0){u();return}d===!0&&(n=setTimeout(g,e))};return x.cancel=m,x}var Q1=J1,j1=he;function ey(r,e,t){var i=null,s=null,o=typeof t=="boolean"?{leading:t,trailing:!t}:j1({leading:!1,trailing:!0},t),n=!1,a=null,c=o.leading,d=o.trailing,f=function(){i=null,s=null},u=function(){n=!0,r.apply(s,i),f()},g=function(){if(c===!0&&(a=null),n){f();return}if(d===!0){u();return}f()},m=function(){var v=a!==null;return v&&clearTimeout(a),f(),a=null,n=!1,v},x=function(){n=!1,i=arguments,s=this,a===null?c===!0&&u():clearTimeout(a),a=setTimeout(g,e)};return x.cancel=m,x}var ty=ey,iy=gt;function ry(r,e){var t=iy(arguments,2),i=this;return setTimeout(function(){r.apply(i,t)},e)}var sy=ry,oy=decodeURIComponent,Ra=oy,fo=Ra,ny=ee,ay=Ye;function ly(r){var e,t={};return r&&ay(r)&&ny(r.split("&"),function(i){e=i.split("="),t[fo(e[0])]=fo(e[1]||"")}),t}var Ia=ly,cy=encodeURIComponent,Sa=cy,Ei=Sa,Ta=Z,Oa=G,ka=Ke,hy=Le,La=Ot;function Da(r,e,t){var i,s=[];return Ta(r,function(o,n){i=Oa(o),La(o)||i?s=s.concat(Da(o,e+"["+n+"]",i)):s.push(Ei(e+"["+(t?"":n)+"]")+"="+Ei(ka(o)?"":o))}),s}function dy(r){var e,t=[];return Ta(r,function(i,s){hy(i)||(e=Oa(i),La(i)||e?t=t.concat(Da(i,s,e)):t.push(Ei(s)+"="+Ei(ka(i)?"":i)))}),t.join("&").replace(/%20/g,"+")}var uy=dy,fy=Ce,gy=typeof location===fy?0:location,Fi=gy,ui=Fi;function vy(){return ui?ui.origin||ui.protocol+"//"+ui.host:""}var $a=vy,go=Fi,my=Ia,xy=$a;function vo(r){return my(r.split("?")[1]||"")}function py(r){var e,t,i,s,o=""+r;return o.indexOf("//")===0?o=(go?go.protocol:"")+o:o.indexOf("/")===0&&(o=xy()+o),i=o.replace(/#.*/,"").match(/(\?.*)/),s={href:o,hash:"",host:"",hostname:"",protocol:"",port:"",search:i&&i[1]&&i[1].length>1?i[1]:""},s.path=o.replace(/^([a-z0-9.+-]*:)\/\//,function(n,a){return s.protocol=a,""}).replace(/^([a-z0-9.+-]*)(:\d+)?\/?/,function(n,a,c){return t=c||"",s.port=t.replace(":",""),s.hostname=a,s.host=a+t,"/"}).replace(/(#.*)/,function(n,a){return s.hash=a.length>1?a:"",""}),e=s.hash.match(/#((.*)\?|(.*))/),s.pathname=s.path.replace(/(\?|#.*).*/,""),s.origin=s.protocol+"//"+s.host,s.hashKey=e&&(e[2]||e[1])||"",s.hashQuery=vo(s.hash),s.searchQuery=vo(s.search),s}var Ma=py,mo=Fi,yy=$a,wy=An;function Ey(){if(mo){var r=mo.pathname,e=wy(r,"/")+1;return yy()+(e===r.length?r:r.substring(0,e))}return""}var Cy=Ey,xo=Fi,by=Ma;function _y(){return xo?by(xo.href):{}}var Ry=_y,Aa=ke,sr=Sr,po=Ra,yo=Sa,Iy=G,wo=Di,Na=et,Sy=Le,Ty=kt,Oy=Fe,Ci=he,or=ee,ky=Mi,fi=fe,Ly=Hi,Dy=ei,$y=na;function Eo(r,e){var t=parseFloat(e),i=ky(),s=fi(i);switch(r){case"y":return fi(Ly(i,t));case"M":return fi(Dy(i,t));case"d":return fi($y(i,t));case"h":case"H":return s+t*60*60*1e3;case"m":return s+t*60*1e3;case"s":return s+t*1e3}return s}function nr(r){return(Na(r)?r:new Date(r)).toUTCString()}function Qe(r,e,t){if(sr){var i,s,o,n,a,c,d=[],f=arguments;return Iy(r)?d=r:f.length>1?d=[Ci({name:r,value:e},t)]:wo(r)&&(d=[r]),d.length>0?(or(d,function(u){i=Ci({},Aa.cookies,u),o=[],i.name&&(s=i.expires,o.push(yo(i.name)+"="+yo(wo(i.value)?JSON.stringify(i.value):i.value)),s&&(isNaN(s)?s=s.replace(/^([0-9]+)(y|M|d|H|h|m|s)$/,function(g,m,x){return nr(Eo(x,m))}):/^[0-9]{11,13}$/.test(s)||Na(s)?s=nr(s):s=nr(Eo("d",s)),i.expires=s),or(["expires","path","domain","secure"],function(g){Sy(i[g])||o.push(i[g]&&g==="secure"?g:g+"="+i[g])})),sr.cookie=o.join("; ")}),!0):(n={},a=sr.cookie,a&&or(a.split("; "),function(u){c=u.indexOf("="),n[po(u.substring(0,c))]=po(u.substring(c+1)||"")}),f.length===1?n[r]:n)}return!1}function My(r){return Ty(Ba(),r)}function Co(r){return Qe(r)}function bo(r,e,t){return Qe(r,e,t),Qe}function _o(r,e){Qe(r,"",Ci({expires:-1},Aa.cookies,e))}function Ba(){return Oy(Qe())}function Ay(){return Qe()}Ci(Qe,{has:My,set:bo,setItem:bo,get:Co,getItem:Co,remove:_o,removeItem:_o,keys:Ba,getJSON:Ay});var Ny=Qe,By=Ce,ar=Sr,lr=Yn,Hy=he,Fy=ee;function Ro(r){try{var e="__xe_t";return r.setItem(e,1),r.removeItem(e),!0}catch{return!1}}function gi(r){return navigator.userAgent.indexOf(r)>-1}function Ky(){var r,e,t,i=!1,s=!1,o=!1,n={isNode:!1,isMobile:i,isPC:!1,isDoc:!!ar};if(!lr&&typeof process!==By)n.isNode=!0;else{t=gi("Edge"),e=gi("Chrome"),i=/(Android|webOS|iPhone|iPad|iPod|SymbianOS|BlackBerry|Windows Phone)/.test(navigator.userAgent),n.isDoc&&(r=ar.body||ar.documentElement,Fy(["webkit","khtml","moz","ms","o"],function(a){n["-"+a]=!!r[a+"MatchesSelector"]}));try{s=Ro(lr.localStorage)}catch{}try{o=Ro(lr.sessionStorage)}catch{}Hy(n,{edge:t,firefox:gi("Firefox"),msie:!t&&n["-ms"],safari:!e&&!t&&gi("Safari"),isMobile:i,isPC:!i,isLocalStorage:s,isSessionStorage:o})}return n}var Py=Ky,Ha=tc,Io=he,Yy=Gt,Vy=Zo,Wy=fc,Xy=wc,zy=ut,Gy=jo,Uy=en,qy=tn,Zy=ee,Jy=Cr,Qy=rn,jy=Yc,ew=br,tw=yh,iw=Rr,rw=an,sw=Th,ow=gt,nw=Ah,aw=Hh,lw=kt,cw=Ph,hw=Xh,dw=Uh,uw=Jh,fw=ed,gw=vd,vw=un,mw=yd,xw=Cd,pw=cn,yw=Sd,ww=cu,Ew=gu,Cw=pu,bw=Cn,_w=Ru,Rw=Tu,Iw=$u,Sw=Rn,Tw=In,Ow=Ee,kw=G,Lw=Ke,Dw=Ku,$w=Le,Mw=re,Aw=Di,Nw=Ye,Bw=Ot,Hw=$n,Fw=et,Kw=Pe,Pw=Z,Yw=ff,Vw=xf,Ww=Rf,Xw=An,zw=Fe,Gw=Lt,Uw=Er,qw=Nn,Zw=mn,Jw=pn,Qw=xn,jw=Af,eE=Vf,tE=Bn,iE=Hn,rE=De,sE=Ir,oE=Fn,nE=Jf,aE=Kn,lE=Pn,cE=sg,hE=lg,dE=fg,uE=pg,fE=Cg,gE=Ig,vE=kg,mE=Mg,xE=Hg,pE=ov,yE=Gn,wE=cv,EE=xv,CE=Ev,bE=Tr,_E=_v,RE=Tv,IE=Lv,SE=Mv,TE=Yv,OE=Xv,kE=Uv,LE=Jv,DE=tm,$E=Ut,ME=am,AE=qn,NE=pm,BE=Zn,HE=Rm,FE=nn,KE=dn,PE=Tm,YE=cx,VE=kr,WE=jn,XE=ea,zE=Lr,GE=fx,UE=ft,qE=tt,ZE=yx,JE=Cx,QE=Dr,jE=Sx,e2=ra,t2=Bx,i2=Hi,r2=lp,s2=ei,o2=na,n2=se,a2=ga,l2=va,c2=y0,h2=ge,d2=E0,u2=ca,f2=ua,g2=da,v2=_0,m2=k0,x2=B0,p2=K0,y2=X0,w2=fa,E2=q0,C2=pa,b2=ma,_2=xa,R2=h1,I2=g1,S2=w1,T2=b1,O2=I1,k2=O1,L2=_a,D2=B1,So=oe,$2=F1,M2=Tt,A2=P1,N2=V1,B2=z1,H2=q1,F2=Q1,K2=ty,P2=sy,Y2=Ia,V2=uy,W2=Ma,X2=Cy,z2=Ry,G2=Ny,U2=Py;Io(Ha,{assign:Io,objectEach:Yy,lastObjectEach:Vy,objectMap:Wy,merge:Xy,uniq:Qy,union:jy,sortBy:tw,orderBy:iw,shuffle:rw,sample:sw,some:Gy,every:Uy,slice:ow,filter:nw,find:cw,findLast:hw,findKey:aw,includes:lw,arrayIndexOf:Sw,arrayLastIndexOf:Tw,map:zy,reduce:dw,copyWithin:uw,chunk:fw,zip:gw,unzip:vw,zipObject:mw,flatten:xw,toArray:ew,includeArrays:qy,pluck:pw,invoke:yw,arrayEach:Zy,lastArrayEach:Jy,toArrayTree:ww,toTreeArray:Ew,findTree:Cw,eachTree:bw,mapTree:_w,filterTree:Rw,searchTree:Iw,hasOwnProp:Ow,eqNull:Kw,isNaN:Dw,isFinite:jw,isUndefined:$w,isArray:kw,isFloat:eE,isInteger:tE,isFunction:Mw,isBoolean:iE,isString:Nw,isNumber:rE,isRegExp:sE,isObject:Aw,isPlainObject:Bw,isDate:Fw,isError:oE,isTypeError:nE,isEmpty:aE,isNull:Lw,isSymbol:lE,isArguments:cE,isElement:hE,isDocument:dE,isWindow:uE,isFormData:fE,isMap:gE,isWeakMap:vE,isSet:mE,isWeakSet:xE,isLeapYear:Hw,isMatch:pE,isEqual:yE,isEqualWith:wE,getType:EE,uniqueId:CE,getSize:qw,indexOf:Ww,lastIndexOf:Xw,findIndexOf:bE,findLastIndexOf:_E,toStringJSON:RE,toJSONString:IE,keys:zw,values:Gw,entries:SE,pick:TE,omit:OE,first:kE,last:LE,each:Pw,forOf:Yw,lastForOf:Vw,lastEach:Zw,has:DE,get:$E,set:ME,groupBy:AE,countBy:NE,clone:Uw,clear:Qw,remove:Jw,range:BE,destructuring:HE,random:FE,min:PE,max:KE,commafy:YE,round:VE,ceil:WE,floor:XE,toFixed:zE,toNumber:UE,toNumberString:qE,toInteger:GE,add:ZE,subtract:JE,multiply:QE,divide:jE,sum:e2,mean:t2,now:l2,timestamp:c2,isValidDate:h2,isDateSame:d2,toStringDate:n2,toDateString:a2,getWhatYear:i2,getWhatQuarter:r2,getWhatMonth:s2,getWhatWeek:u2,getWhatDay:o2,getYearDay:f2,getYearWeek:g2,getMonthWeek:v2,getDayOfYear:m2,getDayOfMonth:x2,getDateDiff:p2,trim:C2,trimLeft:_2,trimRight:b2,escape:R2,unescape:I2,camelCase:S2,kebabCase:T2,repeat:E2,padStart:w2,padEnd:y2,startsWith:O2,endsWith:k2,template:L2,toFormatString:D2,toString:So,toValueString:So,noop:$2,property:M2,bind:A2,once:N2,after:B2,before:H2,throttle:F2,debounce:K2,delay:P2,unserialize:Y2,serialize:V2,parseUrl:W2,getBaseURL:X2,locat:z2,browse:U2,cookie:G2});var T=Ha,J=[];for(var cr=0;cr<256;++cr)J.push((cr+256).toString(16).slice(1));function q2(r,e=0){return(J[r[e+0]]+J[r[e+1]]+J[r[e+2]]+J[r[e+3]]+"-"+J[r[e+4]]+J[r[e+5]]+"-"+J[r[e+6]]+J[r[e+7]]+"-"+J[r[e+8]]+J[r[e+9]]+"-"+J[r[e+10]]+J[r[e+11]]+J[r[e+12]]+J[r[e+13]]+J[r[e+14]]+J[r[e+15]]).toLowerCase()}var vi,Z2=new Uint8Array(16);function J2(){if(!vi&&(vi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!vi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return vi(Z2)}var Q2=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const To={randomUUID:Q2};function He(r,e,t){if(To.randomUUID&&!r)return To.randomUUID();r=r||{};var i=r.random||(r.rng||J2)();return i[6]=i[6]&15|64,i[8]=i[8]&63|128,q2(i)}const j2=r=>r==null||r==="",q=r=>!j2(r),at=r=>r==null,ue=r=>!at(r),eC=r=>function(e,t,i,s){const o=i||{},n=o.children||"children";return r(null,e,t,s,[],[],n,o)},Fa=(r,e,t,i,s,o,n)=>{let a,c;e.forEach((d,f)=>{a=s.concat([""+f]),c=o.concat([d]),t.call(i,d,f,e,a,r,c),d&&n&&(a.push(n),Fa(d,d[n]||[],t,i,a,c,n))})},Yt=eC(Fa),Ka={form:{labelCol:{span:6},wrapperCol:{span:16}},grid:{align:"left",lazyReset:!1,fitHeight:170,striped:!1},canvasTable:{DISABLED:!0,ENABLE_FINDER:!0,AUTO_ROW_HEIGHT:!0}};let ae=T.clone(Ka,!0);function Pa(r){ae={form:{...ae.form,...r.form},grid:{...ae.grid,...r.grid},canvasTable:{...ae.canvasTable,...r.canvasTable}}}function tC(){return ae}function Oo(){var r,e;return{labelCol:(r=ae.form)==null?void 0:r.labelCol,wrapperCol:(e=ae.form)==null?void 0:e.wrapperCol}}function Et(){var r,e,t,i;return{align:(r=ae.grid)==null?void 0:r.align,lazyReset:(e=ae.grid)==null?void 0:e.lazyReset,fitHeight:(t=ae.grid)==null?void 0:t.fitHeight,striped:(i=ae.grid)==null?void 0:i.striped}}function Ya(){return ae.canvasTable||{}}function iC(){ae=JSON.parse(JSON.stringify(Ka))}const Ki=r=>{var e;return{dataIndex:r.field,key:r.field,title:r.title,...T.omit(r,["children","slots","cellRender","formatter"]),children:(e=r.children)==null?void 0:e.map(t=>Ki(t))}},$r={xs:24,sm:24,md:12,lg:8,xl:8,xxl:6},Mr={xs:12,sm:5,md:6,lg:6,xl:5,xxl:4},rC={1:{xs:12,sm:5,md:6,lg:6,xl:5,xxl:4},2:{xs:12,sm:5,md:6,lg:6,xl:5,xxl:4},3:{xs:12,sm:5,md:6,lg:6,xl:5,xxl:5},4:{xs:12,sm:4,md:6,lg:9,xl:7,xxl:6},5:{xs:12,sm:4,md:6,lg:9,xl:7,xxl:6},6:{xs:12,sm:6,md:8,lg:10,xl:7,xxl:8},7:{xs:12,sm:6,md:8,lg:10,xl:9,xxl:9},8:{xs:12,sm:6,md:8,lg:10,xl:7,xxl:9},9:{xs:12,sm:6,md:8,lg:10,xl:9,xxl:10}},Va=r=>{const t=(24-r.reduce((s,o)=>s+o,0))%24,i=t===0?24:t<0?24+t:t;return i>1?i:24},ko=["xxs","xs","sm","md","lg","xl","xxl"],sC=r=>{const e=T.isArray(r)?r:T.isNumber(r)?Array.from({length:r},()=>$r):[];return T.zipObject(ko,ko.map(t=>e.every(i=>q(i[t]))?Va(e.map(i=>i[t])):24))};function Ar(r,e,t){const i=l.toValue(r);if(typeof i!="object"||i===null)return l.watch(r,e,t);let s=T.clone(i,!0);return l.watch(r,(o,n,a)=>{e(o,s,a),s=T.clone(o,!0)},t)}const nt="-",Ct={toString:({cellValue:r})=>{var e;return r?((e=r.toString)==null?void 0:e.call(r))??nt:nt},formatByOptions:({cellValue:r},e,t=",")=>{if(r==null)return nt;if(T.isArray(r))if(r.length>0){const s=e.filter(o=>r.includes(o.value));return s.length?s.map(o=>o.label).join(t):nt}else return nt;const i=e.find(s=>s.value===r);return i?i.label:nt},formatSex:({cellValue:r})=>q(r)?T.toNumber(r)===1?"男":"女":nt},oC=(r,{record:e,index:t,column:i,field:s})=>{if(T.isString(r)&&Ct[r]){const o=Ct[r];return o({row:e,rowIndex:t,cellValue:s?e[s]:null})}else if(T.isArray(r)&&Ct[r[0]]&&r.length>1){const o=Ct[r[0]];return o({row:e,rowIndex:t,cellValue:s?e[s]:null},...r.slice(1))}else return T.isFunction(r)?r({row:e,rowIndex:t,cellValue:s?e[s]:null,column:i}):s?e[s]:null},Wa=r=>{Object.assign(Ct,r)},nC=l.defineComponent(r=>{const{cellRender:e,renderTableParams:t}=r,{data:i,row:s,field:o,rowIndex:n}=t;return()=>{var a,c;return((c=(a=Vt.renders[e.name])==null?void 0:a.renderDefault)==null?void 0:c.call(a,e,{data:i,row:s,field:o,rowIndex:n},r.defaultHandler))??null}},{name:"RenderAntCell",props:["cellRender","renderTableParams","defaultHandler"]}),Xa=l.defineComponent(r=>{const{tableData:e,row:t,column:i,rowIndex:s}=r,o=i.field?t[i.field]:null;return()=>{var n,a;return((a=(n=i.slots)==null?void 0:n.default)==null?void 0:a.call(n,{row:t,column:i,rowIndex:s,cellValue:o}))??(i.cellRender?l.createVNode(nC,{cellRender:i.cellRender,defaultHandler:r.defaultHandler,renderTableParams:{data:e,row:t,field:i.field,rowIndex:s}},null):i.formatter?oC(i.formatter,{record:t,index:s,field:i.field,column:i}):o)}},{name:"RenderAntDefaultCell",props:["tableData","row","column","rowIndex","defaultHandler"]}),aC={class:"text-right mt-4px"},lC=l.defineComponent({__name:"TableInput",props:{modelValue:{type:Array,default:()=>[]},tableConfig:{type:Object,default:()=>({})},editColumns:{type:Array,default:()=>[]}},emits:["update:modelValue","trigger"],setup(r,{emit:e}){const t=r,i={size:"small",pagination:!1};l.watch(()=>t.modelValue,()=>{o("trigger")},{deep:!0});const s=l.computed(()=>T.merge({},i,t.tableConfig)),o=e,n=l.computed({get:()=>t.modelValue??[],set:u=>{o("update:modelValue",u)}}),a=l.computed(()=>[...t.editColumns,{title:"操作",fixed:"right",width:100,cellRender:{name:"ButtonTree",children:[{content:"删除",type:"link",danger:!0,clickEvt:({rowIndex:u})=>d(u)}]}}]),c=()=>{n.value=[...n.value,{}]},d=u=>{n.value=n.value.filter((g,m)=>m!==u)},f=l.computed(()=>{let u=0;return a.value.filter(g=>g.slots&&g.slots.default||g.formatter||g.cellRender?(g.field||(g.field="__holder__"+u,u++),!0):!1)});return(u,g)=>{const m=l.resolveComponent("a-form-item-rest"),x=l.resolveComponent("a-table"),v=l.resolveComponent("a-button");return l.openBlock(),l.createElementBlock("div",null,[l.createVNode(x,l.mergeProps({"data-source":n.value},s.value,{columns:a.value.map(p=>l.unref(Ki)(p))}),l.createSlots({_:2},[f.value.length>0?{name:"bodyCell",fn:l.withCtx(({column:p,record:E,index:C})=>[l.createVNode(m,null,{default:l.withCtx(()=>[f.value.some(w=>p.key&&w.field===p.key)?(l.openBlock(),l.createBlock(l.unref(Xa),{key:C,"row-index":C,"default-handler":{},column:f.value.find(w=>p.key&&w.field===p.key),row:E,"table-data":n.value},null,8,["row-index","column","row","table-data"])):l.createCommentVNode("",!0)]),_:2},1024)]),key:"0"}:void 0]),1040,["data-source","columns"]),l.createElementVNode("div",aC,[l.createVNode(v,{type:"primary",onClick:c},{default:l.withCtx(()=>g[0]||(g[0]=[l.createTextVNode("+添加",-1)])),_:1,__:[0]})])])}}}),le=r=>{const{icon:e}=r,t=pl;return t[e]?l.createVNode(t[e]):t[e]},Pt={AInput:{autocomplete:"off"},$input:{autocomplete:"off",allowClear:!0},AInputNumber:{min:0,controls:!1,precision:0},$number:{min:0,controls:!1,precision:0},$date:{format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD"},ADatePicker:{format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD"},$range:{format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD"},ARangePicker:{format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD"},$select:{getPopupContainer:r=>r.parentNode,allowClear:!0,showSearch:!0,filterOption:(r,e)=>e.label&&e.label.toLowerCase().includes(r.toLowerCase())},ASelect:{getPopupContainer:r=>r.parentNode,allowClear:!0,showSearch:!0,filterOption:(r,e)=>e.label&&e.label.toLowerCase().includes(r.toLowerCase())}},mi={PercentInput:{controls:!1,min:0,max:100,addonAfter:"%"},autoComplete:{inputProps:{}}},za={$input:A.Input,AInput:A.Input,$textarea:A.Textarea,Textarea:A.Textarea,$number:A.InputNumber,AInputNumber:A.InputNumber,$select:A.Select,ASelect:A.Select,$date:A.DatePicker,ADatePicker:A.DatePicker,$range:A.RangePicker,ARangePicker:A.RangePicker,AAutoComplete:A.AutoComplete,$Cascader:A.Cascader,ACascader:A.Cascader,ACheckbox:A.Checkbox,AMentions:A.Mentions,ARate:A.Rate,ASlider:A.Slider,$time:A.TimePicker,ATimePicker:A.TimePicker,ATreeSelect:A.TreeSelect},cC=r=>{const e=za[r];return{renderItemContent({props:t={},attrs:i={},events:s={},defaultValue:o},{data:n,field:a}){return ue(o)&&q(a)&&at(n[a])&&(n[a]=o),a?l.createVNode(e,l.mergeProps({is:r,value:n[a],"onUpdate:value":c=>n[a]=c},i,T.merge({},Pt[r],t),{onChange:(...c)=>{var d;(d=s.change)==null||d.call(s,{data:n,field:a},...c)}}),null):l.createVNode(e,l.mergeProps({is:r},t),null)},renderDefault({props:t=Pt[r]??{},attrs:i={},events:s={},defaultValue:o},{data:n,row:a,field:c}){return ue(o)&&q(c)&&at(a[c])&&(a[c]=o),c?l.createVNode(e,l.mergeProps({is:r,value:a[c],"onUpdate:value":d=>a[c]=d},i,T.merge({},Pt[r],t),{onChange:(...d)=>{var f;(f=s.change)==null||f.call(s,{data:n,row:a,field:c},...d)}}),null):l.createVNode(e,l.mergeProps({is:r},t),null)},renderEdit(t,{props:i=Pt[r]??{},attrs:s={},events:o={}},n,a){return l.createVNode(e,l.mergeProps({is:r,value:t.value,"onUpdate:value":c=>t.value=c},s,T.merge({},Pt[r],i),{onBlur:(...c)=>{var d;a==null||a("blur",t.value),(d=o.blur)==null||d.call(o,n,...c)}}),null)}}},Ga=(r,e,t)=>{var i,s;return r.dropdowns&&r.dropdowns.length>0&&r.dropdowns.filter(o=>{var n;return!((n=o.hiddenIf)!=null&&n.call(o,e))}).length>0?l.createVNode(A.Dropdown,{getPopupContainer:t??(()=>document.querySelector(".p-wrapper"))},{default:()=>{var o;return l.createVNode(A.Button,l.mergeProps(T.omit(r,["dynamicClassName","content","getContent","icon","clickEvt","dropdowns","getProps"]),{icon:r.icon?l.createVNode(le,{icon:r.icon},null):l.createVNode(le,{icon:"DownOutlined"},null)},((o=r.getProps)==null?void 0:o.call(r,e))??{}),{default:()=>{var n;return[r.content||(((n=r==null?void 0:r.getContent)==null?void 0:n.call(r,e))??"")]}})},overlay:()=>{var o;return l.createVNode("div",{class:`dropdown-wrapper ${((o=r==null?void 0:r.dynamicClassName)==null?void 0:o.call(r,e))??""}`},[r.dropdowns.filter(n=>{var a;return!((a=n.hiddenIf)!=null&&a.call(n,e))}).map(n=>Ga(n,e,t))])}}):l.createVNode(A.Button,l.mergeProps({class:((i=r==null?void 0:r.dynamicClassName)==null?void 0:i.call(r,e))||""},T.omit(r,["dynamicClassName","content","getContent","icon","clickEvt","dropdowns","getProps"]),{disabled:!!r.dropdowns&&r.dropdowns.length>0||r.disabled,icon:r.icon?l.createVNode(le,{icon:r.icon},null):null},((s=r.getProps)==null?void 0:s.call(r,e))??{},{onClick:()=>{r!=null&&r.clickEvt&&r.clickEvt(e)}}),{default:()=>{var o;return[r.content||(((o=r==null?void 0:r.getContent)==null?void 0:o.call(r,e))??"")]}})},gr={...Object.fromEntries(Object.keys(za).map(r=>[r,cC(r)])),$button:{renderItemContent({props:r={},events:e={}},{data:t,field:i},s){return l.createVNode(A.Button,l.mergeProps(T.omit(r,["content"]),{icon:r.icon?l.createVNode(le,{icon:r.icon},null):null,onClick:()=>{var o;(o=e.click)==null||o.call(e,{data:t,field:i}),r.htmlType==="reset"&&(s!=null&&s.reset)&&(r.beforeClick&&T.isFunction(r.beforeClick)?r.beforeClick({data:t,field:i}).then(n=>{s.reset(n?{data:n,field:i}:{data:t,field:i})}):s.reset({data:t,field:i}))}}),{default:()=>{var o;return[r.content,((o=r.suffix)==null?void 0:o.call(r,{data:t,field:i}))??null]}})},renderDefault({props:r={},events:e={}},{row:t,field:i},s){return l.createVNode(A.Button,l.mergeProps(T.omit(r,["content"]),{icon:r.icon?l.createVNode(le,{icon:r.icon},null):null,onClick:()=>{var o,n,a;(o=e.click)==null||o.call(e,{row:t,field:i}),r.htmlType==="reset"&&(s!=null&&s.reset)&&(r.beforeClick&&T.isFunction(r.beforeClick)?((n=s==null?void 0:s.setLoadings)==null||n.call(s,!0),r.beforeClick({row:t,field:i}).then(c=>{s.reset(c?{row:c,field:i}:{row:t,field:i})}).finally(()=>{var c;(c=s==null?void 0:s.setLoadings)==null||c.call(s,!1)})):s.reset({row:t,field:i})),r.htmlType==="pick"&&(s!=null&&s.pick)&&(r.beforeClick&&T.isFunction(r.beforeClick)?((a=s==null?void 0:s.setLoadings)==null||a.call(s,!0),r.beforeClick({row:t,field:i}).then(c=>{s.pick(c?{row:c,field:i}:{row:t,field:i})}).finally(()=>{var c;(c=s==null?void 0:s.setLoadings)==null||c.call(s,!1)})):s.pick({row:t,field:i}))}}),{default:()=>[r.content]})}},$buttons:{renderItemContent({props:r={},children:e=[]},{data:t,field:i},s){return l.createVNode("span",{class:"align-gap-box w-fit"},[e.map(o=>l.createVNode(A.Button,l.mergeProps(T.omit(Object.assign({},r,o.props),["content"]),{icon:o.props.icon?l.createVNode(le,{icon:o.props.icon},null):null,onClick:()=>{var n,a;(a=(n=o.events)==null?void 0:n.click)==null||a.call(n,{data:t,field:i}),o.props.htmlType==="reset"&&(s!=null&&s.reset)&&(r.beforeClick&&T.isFunction(r.beforeClick)?r.beforeClick({data:t,field:i}).then(c=>{s.reset(c?{data:c,field:i}:{data:t,field:i})}):s.reset({data:t,field:i})),o.props.htmlType==="pick"&&(s!=null&&s.pick)&&(r.beforeClick&&T.isFunction(r.beforeClick)?r.beforeClick({data:t,field:i}).then(c=>{s.pick(c?{data:c,field:i}:{data:t,field:i})}):s.pick({data:t,field:i}))}}),{default:()=>[o.props.content]}))])},renderDefault({props:r={},children:e=[]},{data:t,row:i,field:s},o){return l.createVNode("span",{class:"align-gap-box w-fit"},[e.filter(n=>{var a,c;return!((c=(a=n==null?void 0:n.props)==null?void 0:a.hiddenIf)!=null&&c.call(a,{data:t,row:i,field:s}))}).map(n=>l.createVNode(A.Button,l.mergeProps(T.omit(Object.assign({},r,n.props),["content","hiddenIf"]),{icon:n.props.icon?l.createVNode(le,{icon:n.props.icon},null):null,onClick:()=>{var a,c,d,f;(c=(a=n.events)==null?void 0:a.click)==null||c.call(a,{data:t,row:i,field:s}),n.props.htmlType==="reset"&&(o!=null&&o.reset)&&(r.beforeClick&&T.isFunction(r.beforeClick)?((d=o==null?void 0:o.setLoadings)==null||d.call(o,!0),r.beforeClick({row:i,field:s}).then(u=>{o.reset(u?{row:u,field:s}:{row:i,field:s})}).finally(()=>{var u;(u=o==null?void 0:o.setLoadings)==null||u.call(o,!1)})):o.reset({row:i,field:s})),n.props.htmlType==="pick"&&(o!=null&&o.pick)&&(r.beforeClick&&T.isFunction(r.beforeClick)?((f=o==null?void 0:o.setLoadings)==null||f.call(o,!0),r.beforeClick({row:i,field:s}).then(u=>{o.pick(u?{row:u,field:s}:{row:i,field:s})}).finally(()=>{var u;(u=o==null?void 0:o.setLoadings)==null||u.call(o,!1)})):o.pick({row:i,field:s}))}}),{default:()=>[n.props.content]}))])}},ButtonTree:{renderDefault({children:r=[],props:e={}},t){const i=l.ref(null);return l.createVNode("span",{ref:i,class:e.noGap?"align-no-gap-box":"align-gap-box"},[r.filter(s=>{var o;return!((o=s.hiddenIf)!=null&&o.call(s,t))}).map(s=>Ga(s,t,()=>{var o,n,a,c;return((c=(a=(n=(o=i.value)==null?void 0:o.parentElement)==null?void 0:n.parentElement)==null?void 0:a.parentElement)==null?void 0:c.parentElement)||document.body}))??[]])}},$radio:{renderItemContent({props:r={},events:e={},options:t,defaultValue:i},{data:s,field:o}){return ue(i)&&q(o)&&at(s[o])&&(s[o]=i),q(o)?l.createVNode(A.RadioGroup,l.mergeProps({value:s[o],"onUpdate:value":n=>s[o]=n},r,{options:r.options??t??[],disabled:!!r.disabled,onChange:(...n)=>{var a;(a=e.change)==null||a.call(e,{data:s,field:o},...n)}}),null):null},renderDefault({props:r={},options:e},{row:t,field:i}){return q(i)?l.createVNode(A.RadioGroup,l.mergeProps({value:t[i],"onUpdate:value":s=>t[i]=s},r,{options:r.options??e??[]}),null):null}},$autoComplete:{renderItemContent({props:r={},events:e={}},{data:t,field:i}){return q(i)?l.createVNode(A.AutoComplete,l.mergeProps({value:t[i],"onUpdate:value":s=>t[i]=s},Object.assign({},{filterOption:mi.autoComplete.filterOption},r),{onChange:(...s)=>{var o;(o=e.change)==null||o.call(e,{data:t,field:i},...s)}}),{default:()=>l.createVNode(l.resolveComponent("a-input"),Object.assign({},mi.autoComplete.inputProps,r.inputProps??{}),null)}):null}},$switch:{renderItemContent({props:r={},events:e={},defaultValue:t},{data:i,field:s}){return ue(t)&&q(s)&&at(i[s])&&(i[s]=t),q(s)?l.createVNode(A.Switch,l.mergeProps({checked:i[s],"onUpdate:checked":o=>i[s]=o},r,{onChange:(...o)=>{var n;(n=e.change)==null||n.call(e,{data:i,field:s},...o)}}),null):null}},$checkbox:{renderItemContent({props:r={},options:e,events:t={},defaultValue:i},{data:s,field:o}){return ue(i)&&q(o)&&at(s[o])&&(s[o]=i),q(o)?l.createVNode(A.CheckboxGroup,l.mergeProps({value:s[o],"onUpdate:value":n=>s[o]=n},r,{options:r.options??e??[],onChange:(...n)=>{var a;(a=t.change)==null||a.call(t,{data:s,field:o},...n)}}),null):null},renderDefault({props:r={},options:e},{row:t,field:i}){return q(i)?l.createVNode(A.CheckboxGroup,l.mergeProps({value:t[i],"onUpdate:value":s=>t[i]=s},r,{options:r.options??e??[]}),null):null}},$paragraph:{renderDefault({props:r={}},{row:e,field:t}){var o;const i={ellipsis:{expandable:!0,rows:3}},s=((o=r.getContent)==null?void 0:o.call(r,{row:e,field:t}))??(q(t)?e[t]:"");return q(t)?l.createVNode(A.TypographyParagraph,l.mergeProps(T.merge({},i,T.omit(r,["content","getContent"])),{content:s}),null):null}},$tableInput:{renderItemContent({props:r={},handleTrigger:e},{data:t,field:i}){return q(i)?l.createVNode(lC,{modelValue:t[i],"onUpdate:modelValue":s=>t[i]=s,onTrigger:()=>{e&&T.isFunction(e)&&e(r.cusFields??i)},editColumns:r.editColumns??[],tableConfig:r.tableConfig??{}},null):null}},PercentInput:{renderItemContent({props:r={},attrs:e={},defaultValue:t},{data:i,field:s}){const o=r.parse?100:1;if(q(s)){ue(t)&&at(i[s])&&(i[s]=t);const n=l.computed({get:()=>(i[s]??0)*o,set:a=>{i[s]=(a??0)/o}});return l.createVNode("div",{class:"flex items-center"},[r.info?l.createVNode("span",{class:"pr-4"},[r.info]):null,l.createVNode(l.resolveComponent("a-input-number"),l.mergeProps({class:"w-60px!"},e,{value:n.value,"onUpdate:value":a=>n.value=a},T.merge({},mi.PercentInput,T.omit(r,["info"]))),null)])}else return null},renderDefault({props:r={},attrs:e={}},{row:t,field:i}){const s=r.parse?100:1;if(q(i)){const o=l.computed({get:()=>(t[i]??0)*s,set:n=>{T.set(t,i,(n??0)/s)}});return[r.info?l.createVNode("span",{class:"pr-4"},[r.info]):null,l.createVNode(l.resolveComponent("a-input-number"),l.mergeProps({class:"w-60px!"},e,{value:o.value,"onUpdate:value":n=>o.value=n},T.merge({},mi.PercentInput,T.omit(r,["info"]))),null)]}else return null}},TreeSelect:{renderItemContent({props:r={}},{data:e,field:t}){return q(t)?l.createVNode(A.TreeSelect,l.mergeProps({value:e[t],"onUpdate:value":i=>e[t]=i},r),null):null},renderDefault({props:r={}},{row:e,field:t}){return q(t)?l.createVNode(A.TreeSelect,l.mergeProps({value:e[t],"onUpdate:value":i=>e[t]=i},r),null):null}}},Nr=(r,{renderItemContent:e,renderDefault:t,renderEdit:i})=>{gr.hasOwnProperty(r)&&console.warn(`render ${r} already exists, you are trying to override it`),gr[r]={renderItemContent:e,renderDefault:t,renderEdit:i}},Vt={renders:gr,addRender:Nr},hC=l.defineComponent((r,{emit:e})=>{const{itemRender:t,defaultHandler:i}=r,{renderFormParams:s}=l.toRefs(r),o=a=>{e("trigger",a)},n=(a,c)=>{e("delayTrigger",a,c)};return()=>{var a,c;return((c=(a=Vt.renders[t.name])==null?void 0:a.renderItemContent)==null?void 0:c.call(a,{...t,handleTrigger:o,handleDelayTrigger:n},s.value,i))??null}},{name:"RenderAntItem",props:{itemRender:{type:Object,required:!0},renderFormParams:{type:Object,required:!0},defaultHandler:{type:Object,required:!1}},emits:["trigger","delayTrigger"]}),dC=l.defineComponent(r=>{const{formData:e}=l.toRefs(r);return()=>{var t,i;return((i=(t=r.item.slots)==null?void 0:t.default)==null?void 0:i.call(t,{data:e.value,field:r.item.field},r.passTrigger,r.passDelayTrigger))??null}},{name:"RenderItemSlots",props:["formData","item","passTrigger","passDelayTrigger"]}),uC={key:2},fC=["innerHTML"],Br=l.defineComponent({__name:"PFormCol",props:{item:{},formData:{}},emits:["trigger","reset"],setup(r,{emit:e}){const t=r,i=e,s=l.ref(!1),o=l.ref(He()),n=(u,g)=>{const m=g??222;s.value=!0,setTimeout(()=>{s.value=!1,i("trigger",u)},m)},a=u=>{i("trigger",u)},c=()=>{i("reset")},d=()=>{o.value=He()},f=T.debounce(d,100);return Ar(()=>t.item,(u,g)=>{T.isEqual(u,g)||f()},{deep:!0}),(u,g)=>{const m=l.resolveComponent("a-tooltip"),x=l.resolveComponent("a-form-item"),v=l.resolveComponent("a-col");return l.openBlock(),l.createBlock(v,l.mergeProps({key:`_col_${o.value}`},u.item.col??(u.item.span?{span:u.item.span}:l.unref($r))),{default:l.withCtx(()=>{var p;return[(l.openBlock(),l.createBlock(x,l.mergeProps({key:`_item_${o.value}`,class:[`p-content-align-${u.item.align??"left"} ${u.item.forceRequired?"p-required":""}`,{"p-error-hang-out":s.value}],colon:"",label:u.item.title,name:u.item.field,"wrapper-col":u.item.wrapperCol??(u.item.title?void 0:{span:24})},l.unref(T.omit)(u.item,["field","title","span","col","wrapperCol","itemRender","forceRequired","tooltip"])),l.createSlots({default:l.withCtx(()=>{var E,C;return[(E=u.item.slots)!=null&&E.default?(l.openBlock(),l.createBlock(l.unref(dC),{key:`_sl_${u.item.field??"_"}_${o.value}`,"form-data":u.formData,item:u.item,"pass-delay-trigger":n,"pass-trigger":a},null,8,["form-data","item"])):(C=u.item.itemRender)!=null&&C.name?(l.openBlock(),l.createBlock(l.unref(hC),{key:`_re_${u.item.field??"_"}_${o.value}`,"default-handler":{reset:c},"item-render":u.item.itemRender,"render-form-params":{data:u.formData,field:u.item.field},onDelayTrigger:n,onTrigger:a},null,8,["default-handler","item-render","render-form-params"])):(l.openBlock(),l.createElementBlock("span",uC))]}),_:2},[(p=u.item.slots)!=null&&p.title?{name:"label",fn:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(u.item.slots.title)))]),key:"0"}:void 0,u.item.tooltipConfig?{name:"tooltip",fn:l.withCtx(()=>[l.unref(T.isFunction)(u.item.tooltipConfig.title)?(l.openBlock(),l.createBlock(m,l.normalizeProps(l.mergeProps({key:0},l.unref(T.omit)(u.item.tooltipConfig,["title"]))),{title:l.withCtx(()=>[l.createElementVNode("div",{innerHTML:u.item.tooltipConfig.title()},null,8,fC)]),default:l.withCtx(()=>[l.createVNode(l.unref(_t.InfoCircleOutlined),{class:"cursor-pointer py-4 px-2"})]),_:1},16)):(l.openBlock(),l.createBlock(m,l.normalizeProps(l.mergeProps({key:1},u.item.tooltipConfig)),{default:l.withCtx(()=>[l.createVNode(l.unref(_t.InfoCircleOutlined),{class:"cursor-pointer py-4 px-2"})]),_:1},16))]),key:"1"}:void 0]),1040,["class","label","name","wrapper-col"]))]}),_:1},16)}}}),gC={key:0,class:"p-pane p-wrapper"},Hr=l.defineComponent({__name:"PForm",props:{items:{},customReset:{},layout:{},labelCol:{default:()=>Oo().labelCol??{span:6}},wrapperCol:{default:()=>Oo().wrapperCol??{span:16}},colon:{type:Boolean},labelAlign:{},labelWrap:{type:Boolean},prefixCls:{},requiredMark:{},hideRequiredMark:{type:Boolean},model:{},rules:{},validateMessages:{},validateOnRuleChange:{type:Boolean},scrollToFirstError:{},onSubmit:{},name:{},validateTrigger:{},size:{},disabled:{type:Boolean},onValuesChange:{},onFieldsChange:{},onFinish:{},onFinishFailed:{},onValidate:{},data:{}},emits:["apply","reset"],setup(r,{expose:e,emit:t}){const i=r,s=t,{items:o,data:n}=l.toRefs(i);function a(){s("apply",n.value)}const c=l.ref(),d=l.ref(He()),f=()=>{d.value=He()},u=()=>{if(i.customReset)i.customReset();else{const v={};Yt(o.value,p=>{p.field&&p.itemRender?ue(p.itemRender.defaultValue)?v[p.field]=p.itemRender.defaultValue:v[p.field]=void 0:p.field&&p.slots&&(ue(p.slots.defaultValue)?v[p.field]=p.slots.defaultValue:v[p.field]=void 0)}),Object.assign(n.value,v)}s("reset")},g=l.computed(()=>({...T.omit(i,["items","data","model","labelCol","wrapperCol"]),labelCol:i.labelCol,wrapperCol:i.wrapperCol})),m=v=>{var p;v&&((p=c.value)==null||p.validateFields(v))},x=v=>{m(v)};return e({reset:f,$form:l.computed(()=>c.value)}),(v,p)=>l.unref(o).some(E=>{var C;return E.field&&E.itemRender||((C=E.slots)==null?void 0:C.default)})?(l.openBlock(),l.createElementBlock("div",gC,[(l.openBlock(),l.createBlock(l.unref(A.Form),l.mergeProps({key:d.value,ref_key:"formEl",ref:c,model:l.unref(n)},g.value,{onSubmit:a}),{default:l.withCtx(()=>[l.createVNode(l.unref(A.Row),{gutter:[6,12]},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(o),(E,C)=>(l.openBlock(),l.createBlock(Br,{key:`_col_${E.field||C}`,"form-data":l.unref(n),item:E,onReset:u,onTrigger:x},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["model"]))])):l.createCommentVNode("",!0)}}),vC=l.defineComponent(r=>{const{column:e}=r;return()=>{var t,i;return((i=(t=e.slots)==null?void 0:t.title)==null?void 0:i.call(t,{column:e}))??e.title}},{name:"RenderAntTitle",props:["column"]}),Ua=({title:r,content:e})=>new Promise((t,i)=>{A.Modal.confirm({title:r,content:e,onOk:()=>{t()},onCancel:()=>{i()}})}),mC=A.message.success,xC=A.message.error;A.message.info;const bi=A.message.warning,pC={key:0},yC={key:1,class:"p-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"},wC={class:"flex items-center flex-1 gap-4px"},EC={key:2},CC={class:"flex items-center gap-4px"},bC={key:0,class:"w-full text-slate-5 pl-4"},Fr=l.defineComponent({__name:"PGrid",props:{selectConfig:{},rowKey:{default:"id"},striped:{type:Boolean,default:()=>Et().striped??!1},manualFetch:{type:Boolean},align:{default:()=>Et().align??"left"},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},tableConfig:{},scrollMode:{default:"inner"},lazyReset:{type:Boolean,default:()=>Et().lazyReset??!1},fitHeight:{default:()=>Et().fitHeight??170},fitCanvasHeight:{},renderY:{}},emits:["toolbarButtonClick","toolbarToolClick","pick","resetQuery"],setup(r,{expose:e,emit:t}){var ze,Nt,F,xe,Re;const i=r,{formConfig:s,pageConfig:o,columns:n,toolbarConfig:a,proxyConfig:c,tableConfig:d,selectConfig:f,scrollMode:u}=l.toRefs(i),g=l.reactive({table:!1,toolbar:!1,form:!1}),m=k=>{T.isObject(k)?Object.keys(k).forEach(N=>{g[N]=k[N]}):T.isBoolean(k)&&(g.form=k,g.table=k,g.toolbar=k)},x=l.ref(),v=l.ref(),p=l.ref(),E=l.ref(500),C=l.ref([]),w=l.ref([]),_=k=>{const{ajax:N}=c.value;switch(k){case"multiDelete":N.multiDelete&&(C.value.length>0?Ua({title:"警告",content:"确认删除选中的数据吗?"}).then(()=>{g.table=!0,g.toolbar=!0,N.multiDelete(C.value).then(()=>{A.message.success("删除成功"),mt()}).catch(()=>{A.message.error("删除失败")}).finally(()=>{g.table=!1,g.toolbar=!1,b.multiDelete=!1})}):A.message.warn("请选择要删除的数据"));break}},S=l.computed(()=>{const k=[];return Yt(n.value??[],N=>{N.slots&&N.slots.title&&(N.field||(N.field="__holder__"+k.length),k.push(N))}),k}),B=l.ref(),K=l.ref(),R=l.ref(He()),I=l.ref(He()),b=l.reactive([...(((Nt=(ze=i.toolbarConfig)==null?void 0:ze.buttons)==null?void 0:Nt.map(k=>k.code))??[]).filter(k=>k),...(((xe=(F=i.toolbarConfig)==null?void 0:F.tools)==null?void 0:xe.map(k=>k.code))??[]).filter(k=>k)].reduce((k,N)=>(k[N]=!1,k),{})),O=(k,N)=>{b[k]=N},y=()=>{I.value=He()},M=T.debounce(y,100),D=l.computed(()=>{const k=[];return Yt(n.value??[],N=>{(N.slots&&N.slots.default||N.formatter||N.cellRender)&&(N.field||(N.field="__holder__"+k.length),k.push(N))}),k}),P=l.reactive({page:1,size:((Re=o.value)==null?void 0:Re.pageSize)??10}),Y=l.ref(0),V=l.ref(0),W=l.ref([]),z=l.computed(()=>c.value&&c.value.ajax?o.value?"pagination":"list":"bad"),Q=l.useAttrs(),te=t,Ve=l.computed(()=>w.value.filter(k=>C.value.includes(k[i.rowKey??"id"]))),be=k=>{te("toolbarButtonClick",{data:W.value,code:k,selectedKeys:C.value,records:Ve.value}),_(k)},Me=T.debounce(be,100),j=({key:k})=>Me(k),Wi=k=>{te("toolbarToolClick",{data:W.value,code:k,selectedKeys:C.value,records:Ve.value}),_(k)},Xi=T.debounce(Wi,100),ve=l.ref({}),zi=({row:k,field:N})=>{te("pick",{row:k,field:N})},it=k=>{if(s.value&&s.value.items.length>0){if(s.value.customReset)s.value.customReset();else{const N={};Yt(s.value.items,U=>{U.field&&U.itemRender?ue(U.itemRender.defaultValue)?N[U.field]=U.itemRender.defaultValue:N[U.field]=void 0:U.field&&U.slots&&(ue(U.slots.defaultValue)?N[U.field]=U.slots.defaultValue:N[U.field]=void 0)}),ve.value=N}te("resetQuery")}P.page=1,k||xt()},vt=(k,N)=>N?{list:T.isString(N.list)?T.get(k,N.list):T.isFunction(N.list)?N.list(k):void 0,total:T.isString(N.total)?T.get(k,N.total):T.isFunction(N.total)?N.total(k):void 0,result:T.isString(N.result)?T.get(k,N.result):T.isFunction(N.result)?N.result(k):void 0,message:T.isString(N.message)?T.get(k,N.message):T.isFunction(N.message)?N.message(k):void 0}:{list:k},si=l.ref(!0),Gi=()=>(w.value=[],C.value=[],it()),mt=()=>(P.page=1,w.value=[],C.value=[],rt()),Ui=(k,N,U)=>(P.page=k.current,P.size=k.pageSize,rt()),rt=()=>new Promise(k=>{if(z.value!=="bad"){g.form=!0,g.table=!0;const{ajax:N}=c.value;N.query({form:ve.value,page:P}).then(U=>{const{list:Ge,total:Bt,result:ie,message:ot}=vt(U,c.value.response);Ge?(W.value=Ge,Y.value++):ie?(W.value=ie,V.value=Bt??ie.length,Y.value++):(W.value=[],Y.value++,ot&&A.message.warn(ot)),k(W.value)}).catch(U=>{console.error("fetchData error",U),k([])}).finally(()=>{g.form=!1,g.table=!1})}}),xt=T.debounce(rt,160),We=(k,N)=>(Object.assign(ve.value,k),P.page=1,N?Promise.resolve():xt()),Ae=(k,N)=>(ve.value=k,P.page=1,N?Promise.resolve():xt()),me=l.computed(()=>z.value==="pagination"?{current:P.page,total:V.value,pageSize:P.size,responsive:!1,showSizeChanger:!0,showTotal:k=>`共${k}条数据`}:!1),Mt={size:"small",sticky:!0,transformCellText:({text:k})=>T.isArray(k)&&k.length===0?"-":k},st=l.computed(()=>T.merge({},Mt,(d==null?void 0:d.value)??{},f.value?{rowSelection:{type:f.value.multiple?"checkbox":"radio",preserveSelectedRowKeys:!0,selectedRowKeys:C.value,onChange:k=>{C.value=k;const N=i.rowKey??"id",U=w.value.map(ie=>ie[N]),Bt=k.filter(ie=>!U.includes(ie)).map(ie=>W.value.find(ot=>ot[N]===ie)).filter(ie=>!!ie);w.value=[...w.value,...Bt]},getCheckboxProps:f.value.getCheckboxProps}}:{})),oi=l.computed(()=>T.omit({labelCol:Mr,...s.value},["items"])),ni=()=>{mt()};l.watch(()=>[n.value,c.value,a.value],()=>{M()},{deep:!0});let Ne=null;const _e=()=>{Ne&&cancelAnimationFrame(Ne),Ne=requestAnimationFrame(()=>{if(Ne=null,!p.value)return;const k=p.value.getBoundingClientRect();E.value=i.renderY??Math.max(window.innerHeight-k.top-i.fitHeight,100),si.value=window.innerHeight>600})};let de=null;l.watch(v,k=>{de==null||de.disconnect(),de=null,k&&(de=new ResizeObserver(()=>_e()),de.observe(k))},{immediate:!0}),e({commitProxy:{query:xt,reload:Gi,reloadPage:mt,passQuery:We,forcePassQuery:Ae},$table:l.computed(()=>K.value),selectedRowKeys:l.computed(()=>C.value),setBtnLoading:O,selectedRecords:Ve,$form:l.computed(()=>B.value),getFormData:()=>ve.value,setLoadings:m,resizeTable:_e});let L,H=null;l.onMounted(()=>{if(_e(),window.addEventListener("resize",_e),L=new MutationObserver(k=>{k.forEach(N=>{if(N.type==="attributes"&&N.attributeName==="style"){const U=N.target;window.getComputedStyle(U).display!=="none"&&_e()}})}),x.value){L.observe(x.value,{attributes:!0,attributeFilter:["style"]}),H=new ResizeObserver(()=>_e());let k=x.value.parentElement;for(let N=0;N<5&&k&&k!==document.body;N++)H.observe(k),k=k.parentElement}it(i.manualFetch)});const X=k=>T.isFunction(k)?k():k,Be=k=>T.isString(k),At=["align"],Xe=k=>k.map(N=>({...At.reduce((U,Ge)=>({[Ge]:i[Ge]}),{}),...N}));return l.onBeforeUnmount(()=>{Ne&&cancelAnimationFrame(Ne),window.removeEventListener("resize",_e),L.disconnect(),de==null||de.disconnect(),H==null||H.disconnect()}),(k,N)=>{var ie,ot,Qr;const U=l.resolveComponent("a-menu-item"),Ge=l.resolveComponent("a-menu"),Bt=l.resolveComponent("a-dropdown");return l.openBlock(),l.createElementBlock("div",l.mergeProps({ref_key:"boxEl",ref:x,class:"h-full p-wrapper flex flex-col gap-8px overflow-y-auto"},l.unref(Q)),[z.value==="bad"?(l.openBlock(),l.createElementBlock("div",pC,"请检查配置")):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[(ot=(ie=l.unref(s))==null?void 0:ie.items)!=null&&ot.some($=>$.field&&$.itemRender)?(l.openBlock(),l.createElementBlock("div",{key:0,class:"p-pane p-form-wrapper",ref_key:"pFormWrapper",ref:v},[l.createVNode(l.unref(A.Spin),{spinning:g.form},{default:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.unref(A.Form),l.mergeProps({key:R.value,ref_key:"formEl",ref:B,model:ve.value},oi.value,{onSubmit:ni}),{default:l.withCtx(()=>[l.createVNode(l.unref(A.Row),{gutter:[6,12]},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(s).items,($,ne)=>(l.openBlock(),l.createBlock(Br,{key:`_col_${$.field||ne}`,"form-data":ve.value,item:$,onReset:N[0]||(N[0]=pe=>it(i.lazyReset))},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["model"]))]),_:1},8,["spinning"])],512)):l.createCommentVNode("",!0),l.unref(a)?(l.openBlock(),l.createElementBlock("div",yC,[l.createElementVNode("div",wC,[l.unref(a).buttons&&l.unref(a).buttons.length>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(a).buttons,($,ne)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:ne},[$.dropdowns&&$.dropdowns.length?(l.openBlock(),l.createBlock(Bt,{key:0},{overlay:l.withCtx(()=>[l.createVNode(Ge,{onClick:j},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList($.dropdowns,pe=>(l.openBlock(),l.createBlock(U,{key:pe.code},{default:l.withCtx(()=>[pe.content&&Be(X(pe.content))?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[l.createTextVNode(l.toDisplayString(X(pe.content)),1)],64)):pe.content?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(X(pe.content)),{key:1})):l.createCommentVNode("",!0)]),_:2},1024))),128))]),_:2},1024)]),default:l.withCtx(()=>[l.createVNode(l.unref(A.Button),{type:$.type,size:$.size??"middle",disabled:l.unref(a).disabled||$.disabled,loading:g.toolbar||!!$.code&&b[$.code],danger:$.danger,shape:$.shape,ghost:$.ghost,block:$.block},{default:l.withCtx(()=>[$.icon?(l.openBlock(),l.createBlock(l.unref(le),{key:0,icon:$.icon},null,8,["icon"])):l.createCommentVNode("",!0),$.content&&Be(X($.content))?(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[l.createTextVNode(l.toDisplayString(X($.content)),1)],64)):$.content?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(X($.content)),{key:2})):l.createCommentVNode("",!0),l.createVNode(l.unref(_t.DownOutlined))]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block"])]),_:2},1024)):$.code?(l.openBlock(),l.createBlock(l.unref(A.Button),{key:1,type:$.type,size:$.size??"middle",disabled:l.unref(a).disabled||$.disabled,loading:g.toolbar||!!$.code&&b[$.code],danger:$.danger,shape:$.shape,ghost:$.ghost,block:$.block,onClick:pe=>l.unref(Me)($.code)},{default:l.withCtx(()=>[$.icon?(l.openBlock(),l.createBlock(l.unref(le),{key:0,icon:$.icon},null,8,["icon"])):l.createCommentVNode("",!0),$.content&&Be(X($.content))?(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[l.createTextVNode(l.toDisplayString(X($.content)),1)],64)):$.content?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(X($.content)),{key:2})):l.createCommentVNode("",!0)]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block","onClick"])):(l.openBlock(),l.createElementBlock("div",EC))],64))),128)):l.createCommentVNode("",!0)]),l.createElementVNode("span",CC,[l.unref(a).tools&&l.unref(a).tools.length>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(a).tools,($,ne)=>(l.openBlock(),l.createBlock(l.unref(A.Button),{key:ne,type:$.type,size:$.size??"middle",disabled:l.unref(a).disabled||$.disabled,danger:$.danger,shape:$.shape,ghost:$.ghost,block:$.block,onClick:pe=>l.unref(Xi)($.code),loading:g.toolbar||!!$.code&&b[$.code]},{default:l.withCtx(()=>[$.icon?(l.openBlock(),l.createBlock(l.unref(le),{key:0,icon:$.icon},null,8,["icon"])):l.createCommentVNode("",!0),$.content&&Be(X($.content))?(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[l.createTextVNode(l.toDisplayString(X($.content)),1)],64)):$.content?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(X($.content)),{key:2})):l.createCommentVNode("",!0)]),_:2},1032,["type","size","disabled","danger","shape","ghost","block","onClick","loading"]))),128)):l.createCommentVNode("",!0)])])):l.createCommentVNode("",!0),l.createElementVNode("div",{ref_key:"tableWrapperEl",ref:p,class:l.normalizeClass(`p-pane flex-1 ${si.value?"h-0":""} p-${l.unref(u)??"inner"}-scroll`)},[(Qr=l.unref(f))!=null&&Qr.multiple&&l.unref(f).showCount?(l.openBlock(),l.createElementBlock("div",bC," 已选:"+l.toDisplayString(C.value.length),1)):l.createCommentVNode("",!0),(l.openBlock(),l.createBlock(l.unref(A.Table),l.mergeProps({key:I.value+"_table","row-key":k.rowKey??"id",ref_key:"tableEl",ref:K,"row-class-name":k.striped?($,ne)=>ne%2===1?"p-grid-row-striped":"":"",columns:Xe(l.unref(n)??[]).map($=>l.unref(Ki)($)),"data-source":W.value,loading:g.table,pagination:me.value},st.value,{scroll:{x:"max-content",y:E.value},onChange:Ui}),l.createSlots({_:2},[S.value.length>0?{name:"headerCell",fn:l.withCtx(({column:$})=>[S.value.some(ne=>$.key&&ne.field===$.key)?(l.openBlock(),l.createBlock(l.unref(vC),{key:I.value+"_title_"+Y.value+"_slot_"+$.key,column:S.value.find(ne=>$.key&&ne.field===$.key)},null,8,["column"])):l.createCommentVNode("",!0)]),key:"0"}:void 0,D.value.length>0?{name:"bodyCell",fn:l.withCtx(({column:$,record:ne,index:pe})=>[D.value.some(qi=>$.key&&qi.field===$.key)?(l.openBlock(),l.createBlock(l.unref(Xa),{key:I.value+"_cell_"+Y.value+"_slot_"+$.key,column:D.value.find(qi=>$.key&&qi.field===$.key),"default-handler":{pick:zi,setLoadings:m},row:ne,"row-index":pe,"table-data":W.value},null,8,["column","default-handler","row","row-index","table-data"])):l.createCommentVNode("",!0)]),key:"1"}:void 0]),1040,["row-key","row-class-name","columns","data-source","loading","pagination","scroll"]))],2)],64))],16)}}});(function(){try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode(":root{--evt-header-font: 12px normal Arial;--evt-body-font: 12px normal Arial;--evt-color-white: #fff;--evt-color-black: #000000;--evt-color-primary: rgb(82, 146, 247);--evt-text-color-primary: #333;--evt-text-color-regular: #666;--evt-text-color-secondary: #999;--evt-box-shadow: 0 2px 12px 0 #0000001a;--evt-editor-bg-color: #fff;--evt-editor-text-color: #333;--evt-border-color: #e1e6eb;--evt-body-bg-color: #fff;--evt-stripe-color: #fafafa;--evt-placeholder-color: #cdd0dc;--evt-header-bg-color: #f8faff;--evt-header-text-color: #1d2129;--evt-body-text-color: #4e5969;--evt-footer-text-color: #4e5969;--evt-loading-icon-color: #4e5969;--evt-expand-icon-color: #4e5969;--evt-shrink-icon-color: #4e5969;--evt-error-tip-icon-color: red;--evt-required-color: #f56c6c;--evt-cell-hover-icon-bg-color: #fff;--evt-cell-hover-icon-border-color: #dde0ea;--evt-scroller-color: #dee0e3;--evt-scroller-track-color: #fff;--evt-scroller-focus-color: #bbbec4;--evt-select-border-color: var(--evt-color-primary);--evt-select-area-color: rgba(82, 146, 247, .1);--evt-select-row-col-bg-color: rgba(82, 146, 247, .1);--evt-autofill-point-border-color: #fff;--evt-edit-bg-color: #fcf6ed;--evt-checkbox-color: var(--evt-color-primary);--evt-checkbox-uncheck-color: #dde0ea;--evt-checkbox-disabled-color: #f1f2f4;--evt-checkbox-check-disabled-color: #dde0ea;--evt-icon-edit-color: #4e5969;--evt-icon-select-color: #4e5969;--evt-readonly-color: #fff;--evt-readonly-text-color: var(--evt-body-text-color);--evt-error-tip-color: #ed3f14;--evt-footer-bg-color: #fafafa;--evt-highlight-hover-row-color: rgba(186, 203, 231, .1);--evt-highlight-selected-row-color: rgba(82, 146, 247, .1);--evt-tooltip-bg-color: #303133;--evt-tooltip-text-color: #fff;--evt-resize-row-line-color: #e1e6eb;--evt-resize-column-text-color: #fff;--evt-resize-column-text-bg-color: var(--evt-color-primary);--evt-resize-column-line-color: #e1e6eb;--evt-tree-line-color: #e1e6eb;--evt-sort-icon-color: var(--evt-color-primary);--evt-drag-tip-bg-color: rgba(82, 146, 247, .1);--evt-drag-tip-line-color: var(--evt-color-primary);--evt-context-menu-min-width: 150px;--evt-context-menu-max-width: 220px;--evt-context-menu-item-padding: 8px 12px;--evt-context-menu-bg-color: #fff;--evt-context-menu-text-color: #333;--evt-context-menu-item-hover-text-color: var(--evt-color-primary);--evt-context-menu-item-hover-bg-color: #f5f5f5;--evt-context-menu-text-size: 13px}.dark{--evt-border-color: #363637;--evt-header-bg-color: #141414;--evt-body-bg-color: #141414;--evt-header-text-color: #a3a6ad;--evt-body-text-color: #cfd3dc;--evt-readonly-text-color: #cfd3dc;--evt-footer-text-color: #cfd3dc;--evt-scroller-color: #414243;--evt-scroller-track-color: #141414;--evt-scroller-focus-color: #a3a6ad;--evt-edit-bg-color: #141414;--evt-footer-bg-color: #262727;--evt-autofill-point-border-color: #fff;--evt-editor-bg-color: #434343;--evt-editor-text-color: #cfd3dc;--evt-context-menu-bg-color: #141414;--evt-context-menu-text-color: #cfd3dc;--evt-context-menu-item-hover-text-color: var(--evt-color-primary);--evt-context-menu-item-hover-bg-color: #414243}.e-virt-table-container{position:relative;outline:none}.e-virt-table-stage{position:relative;overflow:hidden;outline:none;box-sizing:border-box;z-index:10;border-radius:8px;border:1px solid var(--evt-border-color)}.e-virt-table-canvas{position:absolute;left:0;top:0;box-sizing:border-box;background-color:var(--evt-body-bg-color);border:none;outline:none;z-index:10}.e-virt-table-editor{position:absolute;top:-10000px;left:-10000px;text-align:left;height:auto;line-height:0;z-index:100;overflow:hidden;background-color:var(--evt-editor-bg-color);border:2px solid var(--evt-color-primary);box-sizing:border-box;box-shadow:var(--evt-box-shadow);display:flex;align-items:center}.e-virt-table-overlayer{position:absolute;left:0;top:0;overflow:hidden;z-index:100;pointer-events:none}.e-virt-table-editor-textarea{width:100%;box-sizing:border-box;outline:none;font-weight:400;padding:8px;font-size:12px;color:inherit;white-space:pre-wrap;word-wrap:break-word;word-break:break-all;line-height:1.5;margin:0;border:none;vertical-align:middle;background:var(--evt-editor-bg-color);color:var(--evt-editor-text-color);overflow-y:auto;resize:none}.e-virt-table-context-menu{position:absolute;font-size:14px;color:var(--evt-text-color-regular);background-color:var(--evt-color-white);border-radius:4px;border:1px solid #e4e7ed;box-shadow:var(--evt-box-shadow);width:fit-content;padding:6px 0;z-index:9999;left:-99999px;top:-99999px}.e-virt-table-context-menu-item{cursor:pointer;padding:6px 24px;color:var(--evt-text-color-regular)}.e-virt-table-context-menu-item:hover{color:var(--evt-color-primary);background-color:#f5f7fa}.e-virt-table-loading{display:none;position:absolute;left:0;top:0;right:0;bottom:0;width:100%;height:100%;z-index:2000;background-color:#fff6;display:flex;align-items:center;justify-content:center}.e-virt-table-loading-spinner{opacity:1;display:flex;flex-direction:column;align-items:center;justify-content:center}.e-virt-table-loading-spinner svg{color:var(--evt-text-color-regular);animation:rotate 1s linear infinite}@keyframes rotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.e-virt-table-loading-text{margin:0;font-size:12px;color:var(--evt-text-color-regular)}.e-virt-table-main-menu,.e-virt-table-submenu{position:absolute;background:var(--evt-context-menu-bg-color);border-radius:4px;box-shadow:0 2px 8px #0000001a;min-width:var(--evt-context-menu-min-width);max-width:var(--evt-context-menu-max-width);color:var(--evt-text-color-primary)}.e-virt-table-main-menu{border:1px solid var(--evt-border-color);z-index:3000;left:-99999px;top:-99999px;display:none;position:fixed;background-color:var(--evt-body-bg-color)}.e-virt-table-submenu{border:1px solid var(--evt-border-color);z-index:1000;max-height:350px;overflow-y:auto;opacity:0;visibility:hidden;transform:translate(-10px);transition:opacity .2s,visibility .2s,transform .2s;-ms-overflow-style:none;scrollbar-width:none}.e-virt-table-submenu::-webkit-scrollbar{display:none}.e-virt-table-submenu.show{opacity:1;visibility:visible;transform:translate(0)}.e-virt-table-submenu:not(.show){transition:none}.e-virt-table-menu-item,.e-virt-table-submenu-item{position:relative;-webkit-user-select:none;user-select:none;padding:var(--evt-context-menu-item-padding);cursor:pointer;display:flex;justify-content:space-between;align-items:center;transition:background .2s,color .2s;color:var(--evt-context-menu-text-color);font-size:var(--evt-context-menu-text-size)}.e-virt-table-menu-item:last-child,.e-virt-table-submenu-item:last-child{border-bottom:none}.e-virt-table-menu-item:has(.e-virt-table-menu-item-icon){padding-left:8px}.e-virt-table-menu-item-content{display:flex;align-items:center;flex:1;min-width:0}.e-virt-table-menu-item-icon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;margin-right:8px;flex-shrink:0}.e-virt-table-menu-item-icon svg{width:100%;height:100%;fill:currentColor}.e-virt-table-menu-item-text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.e-virt-table-menu-arrow{display:inline-flex;align-items:center;justify-content:center;color:var(--evt-text-color-regular);transition:color .2s}.e-virt-table-menu-arrow svg{width:20px;height:20px;fill:currentColor}.e-virt-table-submenu-item:hover,.e-virt-table-menu-item:hover,.e-virt-table-menu-item.active{background:var(--evt-context-menu-item-hover-bg-color);color:var(--evt-context-menu-item-hover-text-color)}.e-virt-table-menu-item.disabled,.e-virt-table-submenu-item.disabled{cursor:not-allowed}.e-virt-table-finder-bar{position:absolute;top:8px;right:16px;display:none;z-index:10000;background:#fff;border:1px solid #dadce0;border-radius:12px;box-shadow:0 2px 6px #0003;padding:0 8px;height:48px;min-width:250px;align-items:center;font-size:12px}.e-virt-table-finder-bar.show{display:flex}.e-virt-table-finder-bar-input-wrapper{display:flex;align-items:center;flex:1;padding:0 8px;position:relative}.e-virt-table-finder-bar-input{border:none;outline:none;flex:1;font-size:12px;background:transparent;color:#333;min-width:150px;padding-left:0;position:relative}.e-virt-table-finder-bar-nav{display:flex;flex-direction:row;gap:8px;margin:0 8px;align-items:center}.e-virt-table-finder-bar-nav-btn{border:none;background:transparent;cursor:pointer;padding:0;color:#666;border-radius:50%;display:flex;align-items:center;justify-content:center}.e-virt-table-finder-bar-nav-btn svg{width:24px;height:24px}.e-virt-table-finder-bar-nav-btn.prev-btn{transform:rotate(-90deg)}.e-virt-table-finder-bar-nav-btn.next-btn{transform:rotate(90deg)}.e-virt-table-finder-bar-nav-btn.close-btn{font-size:24px;color:#666;line-height:1;width:24px;height:24px}.e-virt-table-finder-bar-nav-btn:hover{color:#666;background-color:#f0f0f0}.e-virt-table-finder-bar-count{color:#666;font-size:12px;margin:0 8px;white-space:nowrap;flex-shrink:0}.e-virt-table-finder-bar-count.no-results{color:#999}.e-virt-table-finder-bar-loading{display:none;position:absolute;left:8px;top:0;width:16px;height:16px;flex-shrink:0;pointer-events:none;z-index:0}.e-virt-table-finder-bar-loading.show{display:block}.e-virt-table-finder-bar-loading svg{width:100%;height:100%;color:#666;animation:rotate 1s linear infinite}.e-virt-table-empty{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);font-size:14px;color:#666;z-index:15}")),document.head.appendChild(r)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var _C=Object.defineProperty,RC=(r,e,t)=>e in r?_C(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,h=(r,e,t)=>RC(r,typeof e!="symbol"?e+"":e,t);class IC{constructor(e){h(this,"rules"),this.rules=e}validate(e){const t=[],{column:i,row:s,key:o,rowKey:n,colIndex:a,rowIndex:c,value:d,field:f,fieldValue:u}=e;Array.isArray(this.rules)||(this.rules=[this.rules]);for(const g of this.rules){if(g.validator){const m={field:f,fieldValue:u,value:d,column:i,colIndex:a,rowIndex:c,row:s,key:o,rowKey:n,...g};g.validator(m,d,x=>{x&&t.push({...m,message:x})})}if(!g.required&&(d==null||d===""))return t;g.pattern&&!g.pattern.test(d)&&t.push({value:d,column:i,row:s,key:o,rowKey:n,colIndex:a,rowIndex:c,field:f,fieldValue:u,message:g.message||`${o} is pattern validation error`}),g.required&&(d==null||d==="")&&t.push({value:d,column:i,row:s,key:o,rowKey:n,colIndex:a,rowIndex:c,field:f,fieldValue:u,message:g.message||`${o} is required`})}return t}}function qa(){return"xxxxxxxxxxxxxxxxxx".replace(/[x]/g,function(r){const e=Math.random()*16|0;return(r==="x"?e:e&3|8).toString(16)})}function Kr(r,e){let t=0,i;return function(...s){const o=new Date().getTime(),n=o-t,a=typeof e=="function"?e():e;!t||n>=a?(r.apply(this,s),t=o):i||(i=setTimeout(()=>{r.apply(this,s),t=new Date().getTime(),i=void 0},a-n))}}function pi(r=[]){return r.length?r.map(e=>pi(e.children)+1).sort((e,t)=>t-e)[0]:0}function SC(r=[]){let e=[],t=[],i=[];return r.forEach(s=>{s.fixed==="left"?e.push(s):s.fixed==="right"?i.push(s):t.push(s)}),[...e.sort((s,o)=>(s.sort??0)-(o.sort??0)),...t.sort((s,o)=>(s.sort??0)-(o.sort??0)),...i.sort((s,o)=>(s.sort??0)-(o.sort??0))]}function yi(r=[],e=1,t=0,i=""){return r.sort((s,o)=>(s.sort??0)-(o.sort??0)).map(s=>{if(s.children){let o=0,n=s.fixed;s.children.forEach(c=>{c.fixed=n});const a=yi(s.children,e-1,t+1,s.key);return a&&a.forEach(c=>{o+=c.colspan??0}),{...s,width:s.width,level:t,rowspan:1,colspan:o,parentKey:i,children:a.sort((c,d)=>(c.sort??0)-(d.sort??0))}}return{...s,level:t,rowspan:e,colspan:1,parentKey:i}})}function Wt(r=[]){let e=[];return r.forEach(t=>{t.children?e=e.concat(Wt(t.children)):e.push(t)}),e}function Za(r){return r.filter(e=>!e.hide).map(e=>Array.isArray(e.children)&&e.children.length>0?{...e,children:Za(e.children)}:{...e})}const Lo=/^(\r\n|\n\r|\r|\n)/,TC=/^[^\t\r\n]+/,Do=/^\t/;function OC(r){let e=[[""]];if(r.length===0)return e;let t=0,i=0,s;for(;r.length>0&&s!==r.length;)if(s=r.length,r.match(Do))r=r.replace(Do,""),t+=1,e[i][t]="";else if(r.match(Lo))r=r.replace(Lo,""),t=0,i+=1,e[i]=[""];else{let o="";if(r.startsWith('"')){let n=0,a=!0;for(;a;){const c=r.slice(0,1);c==='"'&&(n+=1),o+=c,r=r.slice(1),(r.length===0||r.match(/^[\t\r\n]/)&&n%2===0)&&(a=!1)}o=o.replace(/^"/,"").replace(/"$/,"").replace(/["]*/g,c=>new Array(Math.floor(c.length/2)).fill('"').join(""))}else{const n=r.match(TC);o=n?n[0]:"",r=r.slice(o.length)}e[i][t]=o}return Array.isArray(e)&&e.length>1&&e[e.length-1].length===1&&e[e.length-1][0]===""&&(e=e.slice(0,e.length-1)),e}function kC(r){let e,t,i,s,o="",n;for(e=0,t=r.length;e<t;e+=1){for(s=r[e].length,i=0;i<s;i+=1)i>0&&(o+=" "),n=r[e][i],typeof n=="string"?n.indexOf(`
2
- `)>-1?o+=`"${n.replace(/"/g,'""')}"`:o+=n:n==null?o+="":o+=n;e!==t-1&&(o+=`
3
- `)}return o}function Ja(r,e,t=[]){let i=0;const s=[];return r.forEach((o,n)=>{if(n===0)s.push(1);else{const a=t.reduce((d,f)=>`${d}${o[f]??""}`,"")||o[e],c=t.reduce((d,f)=>`${d}${r[n-1][f]??""}`,"")||r[n-1][e];a===c?(s[i]+=1,s.push(0)):(s.push(1),i=n)}}),s}function Qa(r,e){let t="",i="";const s={};return e.forEach((o,n)=>{n===0?(t=o.key,i=o.key,s[o.key]=1):r[o.key]===r[t]?(s[o.key]=0,s[i]+=1):(s[o.key]=1,t=o.key,i=o.key)}),s}function LC(r,e,t=[]){const{visibleRows:i,rowIndex:s,headIndex:o}=r,n=Ja(i,e,t);return n[s-o]===0?{rowspan:0,colspan:0,relationRowKeys:t,mergeRow:!0}:{rowspan:n[s-o],colspan:1,relationRowKeys:t,mergeRow:!0}}function DC(r,e=[]){const{column:t,row:i,visibleLeafColumns:s}=r,o=s.filter(n=>e.includes(n.key));if(e.includes(t.key)){const n=Qa(i,o);return n[t.key]===0?{rowspan:0,colspan:0,relationColKeys:e,mergeCol:!0}:{rowspan:1,colspan:n[t.key],relationColKeys:e,mergeCol:!0}}}function $C(r,e=document.documentElement){const t=r.startsWith("--")?r:`--${r}`;return getComputedStyle(e).getPropertyValue(t).trim()}function $o(r){if(!r)return new Date(0);if(typeof r=="number")return new Date(r);const e=String(r).trim(),t=new Date(e);if(!isNaN(t.getTime()))return t;const i=[/^(\d{4})-(\d{1,2})-(\d{1,2})$/,/^(\d{4})\/(\d{1,2})\/(\d{1,2})$/,/^(\d{4})\.(\d{1,2})\.(\d{1,2})$/,/^(\d{1,2})-(\d{1,2})-(\d{4})$/,/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/,/^(\d{1,2})-(\d{1,2})-(\d{4})$/,/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/,/^(\d{4})(\d{2})(\d{2})$/,/^(\d{4})-(\d{1,2})-(\d{1,2})\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/,/^(\d{4})\/(\d{1,2})\/(\d{1,2})\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/];for(const s of i){const o=e.match(s);if(o){const n=o.slice(1).map(Number);if(s.source.includes("YYYY-MM-DD")||s.source.includes("YYYY/MM/DD")||s.source.includes("YYYY.MM.DD")){const[a,c,d,f=0,u=0,g=0]=n;return new Date(a,c-1,d,f,u,g)}else if(s.source.includes("DD-MM-YYYY")||s.source.includes("DD/MM/YYYY")||s.source.includes("DD.MM.YYYY")){const[a,c,d,f=0,u=0,g=0]=n;return new Date(d,c-1,a,f,u,g)}else if(s.source.includes("MM-DD-YYYY")||s.source.includes("MM/DD/YYYY")||s.source.includes("MM.DD.YYYY")){const[a,c,d,f=0,u=0,g=0]=n;return new Date(d,a-1,c,f,u,g)}else if(s.source.includes("YYYYMMDD")){const[a,c,d]=n;return new Date(a,c-1,d)}}}return new Date(NaN)}function MC(r,e){const t=$o(r),i=$o(e);return isNaN(t.getTime())&&isNaN(i.getTime())?0:isNaN(t.getTime())?-1:isNaN(i.getTime())?1:t.getTime()-i.getTime()}class ja{constructor(e,t,i,s,o,n,a){h(this,"ctx"),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"fixed"),h(this,"cellType"),this.ctx=e,this.x=t,this.y=i,this.width=s,this.height=o,this.fixed=a,this.cellType=n}isHorizontalVisible(){if(this.fixed)return!0;const{stageWidth:e,fixedLeftWidth:t,scrollX:i,fixedRightWidth:s}=this.ctx,o=e;return!(this.x+this.width-t-i<=0||this.x-i>=o-s)}isVerticalVisible(){const{stageHeight:e,scrollY:t}=this.ctx,i=e;return!(this.y+this.height-t<=0||this.y-t>=i)}getDrawX(){if(this.fixed==="left")return this.x;if(this.fixed==="right"){const{stageWidth:e,config:{SCROLLER_TRACK_SIZE:t}}=this.ctx;return e-(this.ctx.header.width-this.x)-t}return this.x-this.ctx.scrollX}getDrawY(){return this.cellType==="header"?this.y:this.cellType==="footer"&&this.ctx.config.FOOTER_FIXED?this.y:this.y-this.ctx.scrollY}getLeftFixedX(){return this.x-this.ctx.scrollX}getRightFixedX(){}}class Pr extends ja{constructor(e,t,i,s,o,n,a,c,d,f="body",u=!0){super(e,s,o,n,a,f,c.fixed),h(this,"formatter"),h(this,"formatterFooter"),h(this,"hoverIconName",""),h(this,"operation",!1),h(this,"align"),h(this,"verticalAlign"),h(this,"fixed"),h(this,"type"),h(this,"editorType"),h(this,"editorProps"),h(this,"cellType"),h(this,"level"),h(this,"colspan",1),h(this,"rowspan",1),h(this,"mergeRow",!1),h(this,"mergeCol",!1),h(this,"relationRowKeys",[]),h(this,"relationColKeys",[]),h(this,"key"),h(this,"column"),h(this,"rowIndex"),h(this,"colIndex"),h(this,"rowKey"),h(this,"row"),h(this,"value"),h(this,"render"),h(this,"renderFooter"),h(this,"style",{}),h(this,"domDataset",{}),h(this,"rules",[]),h(this,"message",""),h(this,"text",""),h(this,"displayText",""),h(this,"visibleWidth",0),h(this,"visibleHeight",0),h(this,"isHasChanged",!1),h(this,"drawX",0),h(this,"drawY",0),h(this,"drawCellBgColor",""),h(this,"drawCellSkyBgColor",""),h(this,"drawTextColor",""),h(this,"drawTextFont",""),h(this,"drawTextX",0),h(this,"drawTextY",0),h(this,"drawTextWidth",0),h(this,"drawTextHeight",0),h(this,"drawTreeImageX",0),h(this,"drawTreeImageY",0),h(this,"drawTreeImageWidth",0),h(this,"drawTreeImageHeight",0),h(this,"drawTreeImageName",""),h(this,"drawTreeImageSource"),h(this,"drawSelectionImageX",0),h(this,"drawSelectionImageY",0),h(this,"drawSelectionImageWidth",0),h(this,"drawSelectionImageHeight",0),h(this,"drawSelectionImageName",""),h(this,"drawSelectionImageSource"),h(this,"drawHoverImageX",0),h(this,"drawHoverImageY",0),h(this,"drawHoverImageWidth",0),h(this,"drawHoverImageHeight",0),h(this,"drawHoverImageName",""),h(this,"drawHoverImageSource"),h(this,"autoRowHeight",!1),h(this,"calculatedHeight",0),h(this,"ellipsis",!1),h(this,"rowExpand",!1),h(this,"rowHasChildren",!1),h(this,"overflowTooltipShow",!0),h(this,"selectorCellValueType","value"),h(this,"overflowTooltipMaxWidth",500),h(this,"overflowTooltipPlacement","top"),h(this,"maxLineClamp","auto"),this.visibleWidth=this.width,this.visibleHeight=this.height,this.colIndex=i,this.rowIndex=t,this.key=c.key,this.type=c.type||"",this.editorType=c.editorType||"text",this.selectorCellValueType=c.selectorCellValueType||this.ctx.config.SELECTOR_CELL_VALUE_TYPE||"value",this.editorProps=c.editorProps||{},this.cellType=f,this.align=c.align||this.ctx.config.COLUMNS_ALIGN,this.verticalAlign=c.verticalAlign||this.ctx.config.COLUMNS_VERTICAL_ALIGN,this.fixed=c.fixed||"",this.level=c.level||0,this.operation=c.operation||!1,this.column=c,this.rules=c.rules||[],this.row=d,this.rowKey=this.cellType==="body"?this.ctx.database.getRowKeyForRowIndex(t):`${this.cellType}_${this.rowIndex}`,this.value=this.getValue(),this.render=c.render,this.overflowTooltipShow=c.overflowTooltipShow!==!1,this.autoRowHeight=c.autoRowHeight!==void 0?c.autoRowHeight:this.ctx.config.AUTO_ROW_HEIGHT,this.overflowTooltipMaxWidth=c.overflowTooltipMaxWidth||500,this.overflowTooltipPlacement=c.overflowTooltipPlacement||"top",this.renderFooter=c.renderFooter,this.hoverIconName=c.hoverIconName,this.formatter=c.formatter,this.formatterFooter=c.formatterFooter,this.maxLineClamp=c.maxLineClamp||"auto",u&&this.update()}setWidthHeight(e,t){this.width=e,this.height=t}getValidationMessage(){const e=this.ctx.database.getValidationError(this.rowKey,this.key);if(Array.isArray(e)&&e.length){const[t]=e;this.message=t.message||""}return this.message}update(){this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawTextX=this.drawX,this.drawTextY=this.drawY,this.isHasChanged=this.ctx.database.isHasChangedData(this.rowKey,this.key),this.updateSpan(),this.drawTextWidth=this.visibleWidth,this.drawTextHeight=this.visibleHeight,this.updateStyle(),this.updateType(),this.updateHoverIcon(),this.updateSelection(),this.updateTree(),this.updateEditor(),this.updateRender(),this.getValidationMessage(),this.updateContainer(),this.text=this.getText(),this.displayText=this.getDisplayText()}updateSpan(){if(this.cellType==="footer")return;const{SPAN_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e,{colspan:i=1,rowspan:s=1,relationRowKeys:o,relationColKeys:n,mergeRow:a=!1,mergeCol:c=!1}=t({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue(),headIndex:this.ctx.body.headIndex,headPosition:this.ctx.database.getPositionForRowIndex(this.ctx.body.headIndex),visibleRows:this.ctx.body.visibleRows,visibleLeafColumns:this.ctx.header.visibleLeafColumns,rows:this.ctx.body.data})||{};Array.isArray(o)&&o.length>0?this.relationRowKeys=o:this.relationRowKeys=[this.key],Array.isArray(n)&&n.length>0?this.relationColKeys=n:this.relationColKeys=[this.key],this.mergeCol=c,this.mergeRow=a,this.colspan=i,this.rowspan=s,this.visibleWidth=this.getWidthByColIndexColSpan(this.colIndex,this.colspan),this.visibleHeight=this.ctx.database.getHeightByRowIndexRowSpan(this.rowIndex,this.rowspan)}}updateSpanInfo(){if(this.mergeRow||this.mergeCol){const e=this.getSpanInfo();this.height=e.height,this.width=e.width,this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawY-=e.offsetTop,this.drawX-=e.offsetLeft}}updateType(){const{BODY_CELL_TYPE_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});t!==void 0&&(this.type=t)}}updateEditor(){const{BODY_CELL_EDITOR_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});if(t!==void 0){const{type:i,props:s={}}=t;this.editorType=i,this.editorProps=s}}}updateRender(){const{BODY_CELL_RENDER_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});t!==void 0&&(this.render=t)}}validate(){this.ctx.database.getValidator(this.rowKey,this.key).then(()=>{this.ctx.database.setValidationError(this.rowKey,this.key,[]),this.message=""}).catch(e=>{if(Array.isArray(e)&&e.length){const[t]=e;this.message=t.message,this.ctx.database.setValidationError(this.rowKey,this.key,e)}}).finally(()=>{this.ctx.emit("draw")})}updateStyle(){this.autoRowHeight&&(this.domDataset={"data-auto-height":!0,"data-row-index":this.rowIndex,"data-col-index":this.colIndex}),this.style=this.getOverlayerViewsStyle()}updateTree(){const{CELL_PADDING:e=0}=this.ctx.config,{rowKey:t,cellType:i}=this;let s,o=0,n="";if(!(["tree","selection-tree","tree-selection"].includes(this.type)&&i==="body"))return;const a=this.ctx.database.getRowForRowKey(t),{expand:c=!1,hasChildren:d=!1,expandLoading:f=!1,level:u=0}=a||{};this.rowExpand=c,this.rowHasChildren=d;const{TREE_INDENT:g=16,CHECKBOX_SIZE:m,TREE_ICON_SIZE:x}=this.ctx.config;if(o=u*g,f){const S=this.ctx.icons.get("loading");n="loading",s=S}else if(d){const S=this.ctx.icons.get("expand"),B=this.ctx.icons.get("shrink");s=c?B:S,n=c?"shrink":"expand"}let v=x,p=x,E=this.drawX;(this.align==="center"||this.align==="right")&&(E=this.drawX+(this.visibleWidth-v-2*e)/2,this.align="left");let C=E+o+e,w=this.drawY+(this.visibleHeight-p)/2,_=o+this.drawX+v-.5;this.type==="selection-tree"?(C=o+this.drawSelectionImageX+this.drawSelectionImageWidth,_=C+v-e/2):this.type==="tree-selection"?_=C+m+v-e/2:_=C+v-e/2,this.drawTextX=_,this.drawTextWidth=this.drawX+this.visibleWidth-_,!(C+v+e>this.drawX+this.visibleWidth)&&(w+p+e>this.drawY+this.visibleHeight||(this.drawTreeImageX=C,this.drawTreeImageY=w,this.drawTreeImageWidth=v,this.drawTreeImageHeight=p,s?(this.drawTreeImageName=n,this.drawTreeImageSource=s):(this.drawTreeImageName="",this.drawTreeImageSource=void 0)))}drawTreeLine(){const{TREE_LINE:e,TREE_INDENT:t=16,TREE_ICON_SIZE:i=16,TREE_LINE_COLOR:s="#e1e6eb"}=this.ctx.config;if(!e||this.cellType!=="body"||!["tree","selection-tree","tree-selection"].includes(this.type)||this.rowspan===0||this.colspan===0)return;const o=this.ctx.database.getRowForRowKey(this.rowKey)||{},n=o.level??0,a=this.drawTreeImageX+this.drawTreeImageWidth/2,c=this.drawTreeImageY+this.drawTreeImageHeight/2;let d=this.drawTreeImageX-n*t;const f=Array.isArray(o.parentRowKeys)?o.parentRowKeys:[];if(n>0){for(let x=0;x<n-1;x+=1){const v=f[x+1];if((v?this.ctx.database.getRowForRowKey(v)||{}:{}).isLastChild)continue;const p=Math.round(this.drawTreeImageX-(n-x)*t+i/2);this.ctx.paint.drawLine([p,this.drawY,p,this.drawY+this.visibleHeight],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}const u=Math.round(this.drawTreeImageX-t+i/2),g=o.isLastChild?c:this.drawY+this.visibleHeight;this.ctx.paint.drawLine([u,this.drawY,u,g],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0});const m=Math.round(d+(n-1)*t+i/2);this.ctx.paint.drawLine([m,c,a,c],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}if(o.hasChildren&&o.expand){const u=this.drawTreeImageY+this.drawTreeImageHeight,g=this.drawY+this.visibleHeight;this.ctx.paint.drawLine([a,u,a,g],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}}updateContainer(){const{BODY_BG_COLOR:e,EDIT_BG_COLOR:t,BODY_CELL_STYLE_METHOD:i,FOOTER_CELL_STYLE_METHOD:s,READONLY_TEXT_COLOR:o,BODY_TEXT_COLOR:n,FOOTER_TEXT_COLOR:a,FOOTER_BG_COLOR:c,HIGHLIGHT_SELECTED_ROW:d,HIGHLIGHT_SELECTED_ROW_COLOR:f,HIGHLIGHT_HOVER_ROW:u,HIGHLIGHT_HOVER_ROW_COLOR:g,STRIPE:m,STRIPE_COLOR:x,FINDER_CELL_BG_COLOR:v}=this.ctx.config;if(this.cellType==="footer"){let b=c,O=a;if(typeof s=="function"){const y=s,{backgroundColor:M,color:D,font:P}=y({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()})||{};M&&(b=M),D&&(O=D),P&&(this.drawTextFont=P)}this.drawCellSkyBgColor="transparent",this.drawCellBgColor=b,this.drawTextColor=O;return}let p="transparent";const E=this.ctx.hoverCell,C=this.ctx.currentCell;let w=this.rowIndex,_=this.rowIndex;if(this.rowspan!==1&&(u||d)){const b=this.getSpanInfo(),{yArr:O}=b;w=O[0],_=O[1]}u&&E&&(E.rowKey===this.rowKey&&(p=g),E.rowIndex>=w&&E.rowIndex<=_&&(p=g)),d&&C&&(C.rowKey===this.rowKey&&(p=f),C.rowIndex>=w&&C.rowIndex<=_&&(p=f)),this.drawCellSkyBgColor=p;let S=e,B=n;if(this.ctx.database.getReadonly(this.rowKey,this.key)||(S=t,B=o),m&&(this.rowIndex%2?S=x:S=e),typeof i=="function"){const b=i,{backgroundColor:O,color:y,font:M}=b({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,isHasChanged:this.isHasChanged,value:this.getValue()})||{};O&&(S=O),y&&(B=y),M&&(this.drawTextFont=M)}const{rowIndex:K,colIndex:R,type:I}=this.ctx.finderBar;K===this.rowIndex&&R===this.colIndex&&I==="body"&&(S=v),this.drawCellBgColor=S,this.drawTextColor=B}updateSelection(){const{visibleWidth:e,visibleHeight:t,rowspan:i,colspan:s,cellType:o,type:n,rowIndex:a,rowKey:c}=this;if(i===0||s===0||o==="footer"||!["index-selection","selection","selection-tree","tree-selection"].includes(n))return;const d=this.ctx.database.getRowSelectable(c),{CHECKBOX_SIZE:f=0,CELL_PADDING:u}=this.ctx.config;let g=this.drawX+u;(this.align==="center"||this.align==="right")&&(g=this.drawX+(e-f)/2);let m=g,x=this.drawY+(t-f)/2;if(n!=="selection-tree"&&n==="tree-selection"){const{TREE_INDENT:E=16,TREE_ICON_SIZE:C}=this.ctx.config,w=this.ctx.database.getRowForRowKey(c),{level:_=0}=w||{},S=_*E;m=g+C+S}let v=this.ctx.icons.get("checkbox-uncheck"),p="checkbox-uncheck";if(n==="selection-tree"||n==="tree-selection"){const E=this.ctx.database.getTreeSelectionState(c);E.indeterminate&&d?(v=this.ctx.icons.get("checkbox-indeterminate"),p="checkbox-indeterminate"):E.checked&&d?(v=this.ctx.icons.get("checkbox-check"),p="checkbox-check"):!E.checked&&d?(v=this.ctx.icons.get("checkbox-uncheck"),p="checkbox-uncheck"):(v=this.ctx.icons.get("checkbox-disabled"),p="checkbox-disabled")}else{const E=this.ctx.database.getRowSelection(c);E&&d?(v=this.ctx.icons.get("checkbox-check"),p="checkbox-check"):E&&!d?(v=this.ctx.icons.get("checkbox-check-disabled"),p="checkbox-check-disabled"):!E&&d?(v=this.ctx.icons.get("checkbox-uncheck"),p="checkbox-uncheck"):(v=this.ctx.icons.get("checkbox-disabled"),p="checkbox-disabled")}m+f+u>this.drawX+this.visibleWidth||x+f+u>this.drawY+this.visibleHeight||(n==="index-selection"?(this.ctx.hoverCell&&this.ctx.hoverCell.rowIndex===a||["checkbox-disabled","checkbox-check"].includes(p))&&(this.drawSelectionImageX=m,this.drawSelectionImageY=x,this.drawSelectionImageWidth=f,this.drawSelectionImageHeight=f,this.drawSelectionImageName=p,this.drawSelectionImageSource=v):(this.drawSelectionImageX=m,this.drawSelectionImageY=x,this.drawSelectionImageWidth=f,this.drawSelectionImageHeight=f,this.drawSelectionImageName=p,this.drawSelectionImageSource=v))}updateHoverIcon(){if(this.ctx.database.getReadonly(this.rowKey,this.key))return;const{BODY_CELL_HOVER_ICON_METHOD:e,CELL_HOVER_ICON_SIZE:t,CELL_PADDING:i,ENABLE_MERGE_CELL_LINK:s}=this.ctx.config;if(typeof e=="function"){const n=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});n!==void 0&&(this.hoverIconName=n)}const{hoverCell:o}=this.ctx;if(this.hoverIconName&&!this.ctx.editing&&o){let n=0,a=0;if(o.rowKey===this.rowKey&&(n=this.drawX+this.width-t-i,a=this.drawY+(this.height-t)/2),this.rowspan!==1&&s){const d=this.getSpanInfo(),{yArr:f}=d,u=f[0],g=f[1];if(o.rowIndex>=u&&o.rowIndex<=g){const{width:m,height:x,offsetTop:v,offsetLeft:p}=d;n=this.drawX-p+m-t-i,a=this.drawY-v+(x-t)/2}}const c=this.ctx.icons.get(this.hoverIconName);this.drawHoverImageX=n,this.drawHoverImageY=a,this.drawHoverImageWidth=t,this.drawHoverImageHeight=t,this.drawHoverImageName=this.hoverIconName,this.drawHoverImageSource=c}}getAutoHeight(){if(this.cellType!=="body"||!this.autoRowHeight||this.rowspan===0)return 0;if(this.render){const n=this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex);return this.rowspan>1?n<this.visibleHeight?0:Math.round(n-(this.visibleHeight-this.height)):Math.round(n)}if(!(this.displayText&&typeof this.displayText=="string"))return 0;const{BODY_FONT:e,CELL_PADDING:t,CELL_LINE_HEIGHT:i}=this.ctx.config,s=`${this.displayText}_${this.drawTextWidth}_${this.drawTextFont}`,o=this.ctx.paint.calculateTextHeight(this.displayText,this.drawTextWidth,{font:this.drawTextFont||e,padding:t,align:this.align,verticalAlign:this.verticalAlign,color:this.drawTextColor,autoRowHeight:this.autoRowHeight,lineHeight:i,maxLineClamp:this.maxLineClamp,cacheTextKey:s});return this.rowspan>1?o<this.visibleHeight?0:Math.round(o-(this.visibleHeight-this.height)):Math.round(o)}getSpanInfo(){return this.ctx.database.getSpanInfo(this)}getDisplayText(){return this.cellType==="footer"?this.renderFooter||this.text===null||this.text===void 0?"":this.text:this.rowspan===0||this.colspan===0||this.render||this.type==="index-selection"&&(this.ctx.hoverCell&&this.ctx.hoverCell.rowIndex===this.rowIndex||["checkbox-disabled","checkbox-check"].includes(this.drawSelectionImageName))||this.text===null||this.text===void 0?"":`${this.text}`}getText(){if(this.cellType==="footer")return typeof this.formatterFooter=="function"?this.formatterFooter({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.row[this.key]}):this.row[this.key];if(typeof this.formatter=="function")return this.formatter({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});const{BODY_CELL_FORMATTER_METHOD:e}=this.ctx.config;return typeof e=="function"?e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()}):["index-selection","index"].includes(this.type)?`${this.rowIndex+1}`:(this.value=this.ctx.database.getItemValue(this.rowKey,this.key),this.value)}getValue(){return this.ctx.database.getItemValue(this.rowKey,this.key)}setValue(e){this.ctx.setItemValueByEditor(this.rowKey,this.key,e)}getOverlayerViewsStyle(){let e=this.drawX-this.ctx.fixedLeftWidth,t=this.drawY-this.ctx.body.y;if(this.fixed==="left"?e=this.drawX:this.fixed==="right"&&(e=this.drawX-(this.ctx.stageWidth-this.ctx.fixedRightWidth)),this.cellType==="footer"&&this.ctx.config.FOOTER_FIXED&&(t=this.drawY-this.ctx.footer.y),this.autoRowHeight&&this.render&&this.verticalAlign==="middle"){const i=this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex);if(i<this.visibleHeight&&i>0){const s=(this.visibleHeight-i)/2;t=t+s}}return this.autoRowHeight&&this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex)===0&&(e=-99999,t=-99999),{position:"absolute",overflow:"hidden",left:`${Math.round(e-1)}px`,top:`${Math.round(t-1)}px`,width:`${this.visibleWidth}px`,height:this.autoRowHeight?"auto":`${this.visibleHeight}px`,pointerEvents:"initial",userSelect:"none"}}drawContainer(){const{paint:e,config:{BORDER_COLOR:t,BORDER:i}}=this.ctx,{drawX:s,drawY:o}=this;e.drawRect(s,o,this.visibleWidth,this.visibleHeight,{borderColor:i?t:"transparent",fillColor:this.drawCellBgColor}),e.drawRect(s,o,this.width,this.height,{borderColor:"transparent",fillColor:this.drawCellSkyBgColor}),i||this.ctx.paint.drawLine([s,o+this.visibleHeight,s+this.visibleWidth,o+this.visibleHeight],{borderColor:t,fillColor:t,borderWidth:1,lineCap:"round",lineJoin:"round"})}drawAutofillPiont(){if(this.cellType==="footer")return;const{SELECT_BORDER_COLOR:e,ENABLE_AUTOFILL:t,ENABLE_SELECTOR:i,AUTOFILL_POINT_BORDER_COLOR:s}=this.ctx.config;if(!i||!t||this.ctx.editing)return;const{xArr:o,yArr:n}=this.ctx.selector,a=o[1],c=n[1],{colIndex:d,rowIndex:f,drawX:u,drawY:g}=this;if(d===a&&f===c){const m=d===this.ctx.maxColIndex||f===this.ctx.maxRowIndex||d===this.ctx.lastCenterColIndex?6:4;this.ctx.paint.drawRect(u+this.width-m,g+this.height-m,6,6,{borderColor:s,fillColor:e})}}draw(){this.drawTreeLine(),this.drawText(),this.drawImage(),this.drawSelector(),this.drawAutofillPiont(),this.drawErrorTip()}getWidthByColIndexColSpan(e,t){if(t===0)return 0;let i=0;for(let s=e;s<e+t;s++){const o=this.ctx.header.leafCellHeaders[s];i+=o.width}return i}drawText(){const{CELL_PADDING:e,BODY_FONT:t,PLACEHOLDER_COLOR:i,CELL_LINE_HEIGHT:s}=this.ctx.config,{placeholder:o}=this.column;let n=this.displayText,a=this.drawTextColor;if(!this.ctx.database.getReadonly(this.rowKey,this.key)&&o&&["",null,void 0].includes(this.text)&&this.cellType==="body"&&!(this.rowspan===0||this.colspan===0)&&(n=o,a=i),["",null,void 0].includes(n))return!1;typeof n!="string"&&(n=`${n}`);const c=`${n}_${this.drawTextWidth}_${this.drawTextFont}`;return this.ellipsis=this.ctx.paint.drawText(n,this.drawTextX,this.drawTextY,this.drawTextWidth,this.drawTextHeight,{font:this.drawTextFont||t,padding:e,align:this.align,verticalAlign:this.verticalAlign,color:a,autoRowHeight:this.autoRowHeight,lineHeight:s,maxLineClamp:this.maxLineClamp,cacheTextKey:c}),this.ellipsis}drawImage(){if(this.drawSelectionImageSource&&this.ctx.paint.drawImage(this.drawSelectionImageSource,this.drawSelectionImageX,this.drawSelectionImageY,this.drawSelectionImageWidth,this.drawSelectionImageHeight),this.drawTreeImageSource&&this.ctx.paint.drawImage(this.drawTreeImageSource,this.drawTreeImageX,this.drawTreeImageY,this.drawTreeImageWidth,this.drawTreeImageHeight),this.drawHoverImageSource){const{CELL_HOVER_ICON_BG_COLOR:e,CELL_HOVER_ICON_BORDER_COLOR:t}=this.ctx.config;this.ctx.paint.drawRect(this.drawHoverImageX-2,this.drawHoverImageY-2,this.drawHoverImageWidth+4,this.drawHoverImageHeight+4,{borderColor:t,radius:4,borderWidth:1,fillColor:e}),this.ctx.paint.drawImage(this.drawHoverImageSource,this.drawHoverImageX,this.drawHoverImageY,this.drawHoverImageWidth,this.drawHoverImageHeight)}}drawSelector(){if(this.cellType==="footer")return;const{ENABLE_SELECTOR:e}=this.ctx.config;if(!e)return;const{xArr:t,yArr:i,xArrCopy:s,yArrCopy:o}=this.ctx.selector;this.drawBorder({xArr:s,yArr:o,borderColor:this.ctx.config.SELECT_BORDER_COLOR||"rgb(82,146,247)",fillColor:"transparent",borderWidth:1,lineDash:[4,4]}),this.drawBorder({xArr:this.ctx.autofill.xArr,yArr:this.ctx.autofill.yArr,borderColor:this.ctx.config.SELECT_BORDER_COLOR||"rgb(82,146,247)",fillColor:"transparent",borderWidth:1,lineDash:[4,4]}),this.drawBorder({xArr:t,yArr:i,borderColor:this.ctx.config.SELECT_BORDER_COLOR||"rgb(82,146,247)",fillColor:"transparent",borderWidth:1});const[n,a]=t,[c,d]=i;!(n===a&&c===d)&&this.colIndex>=n&&this.colIndex<=a&&this.rowIndex>=c&&this.rowIndex<=d&&this.ctx.paint.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:"transparent",fillColor:this.ctx.config.SELECT_AREA_COLOR||"rgba(82,146,247,0.1)"}),this.operation&&this.rowIndex>=c&&this.rowIndex<=d&&this.ctx.paint.drawRect(this.drawX,this.drawY,this.visibleWidth,this.visibleHeight,{borderColor:"transparent",fillColor:this.ctx.config.SELECT_ROW_COL_BG_COLOR||"transparent"})}drawErrorTip(){if(this.cellType==="footer"||!this.message||this.rowspan===0||this.colspan===0)return;const{ERROR_TIP_ICON_SIZE:e,ERROR_TIP_COLOR:t}=this.ctx.config,{width:i}=this,s=this.drawX,o=this.drawY,n=[s+i-e-.5,o,s+i-.5,o,s+i-.5,o+e];this.ctx.paint.drawLine(n,{borderColor:t,fillColor:t,borderWidth:1,lineCap:"round",lineJoin:"round"})}drawBorder(e){const{drawX:t,drawY:i,rowIndex:s,colIndex:o,height:n,width:a}=this;let c=t,d=i;const{xArr:f,yArr:u,lineDash:g=[],borderWidth:m=1,borderColor:x,fillColor:v}=e,p=f[0],E=f[1],C=u[0],w=u[1];if(o>=p&&o<=E&&s===C){const _=o===E?1:0,S=o===p?1:0;this.ctx.paint.drawLine([c+S,d+1,c+a-_,d+1],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}if(o===E&&s>=C&&s<=w){const _=s===C?1:0,S=s===w?1:0;this.ctx.paint.drawLine([c+a-1,d+_,c+a-1,d+n-S],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}if(o>=p&&o<=E&&s===w){const _=o===E?1:0,S=o===p?1:0;this.ctx.paint.drawLine([c+S,d+n-1,c+a-_,d+n-1],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}if(o===p&&s>=C&&s<=w){const _=s===w?1:0,S=s===C?1:0;this.ctx.paint.drawLine([c+1,d+S,c+1,d+n-_],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}}}class AC{constructor(e,t){h(this,"ctx"),h(this,"data"),h(this,"columns"),h(this,"footerData",[]),h(this,"rowKeyMap",new Map),h(this,"colIndexKeyMap",new Map),h(this,"headerMap",new Map),h(this,"rowIndexRowKeyMap",new Map),h(this,"rowKeyRowIndexMap",new Map),h(this,"checkboxKeyMap",new Map),h(this,"selectionMap",new Map),h(this,"expandMap",new Map),h(this,"originalDataMap",new Map),h(this,"changedDataMap",new Map),h(this,"validationErrorMap",new Map),h(this,"itemRowKeyMap",new WeakMap),h(this,"bufferData",[]),h(this,"customHeader",{fixedData:{},sortData:{},hideData:{},resizableData:{}}),h(this,"overlayerAutoHeightMap",new Map),h(this,"maxRowHeightCellMap",new Map),h(this,"bufferCheckState",{buffer:!1,check:!1,indeterminate:!1,selectable:!0}),h(this,"sumHeight",0),h(this,"filterMethod"),h(this,"positions",[]),h(this,"sortState",new Map),this.ctx=e;const{data:i=[],columns:s=[],footerData:o=[]}=t;this.data=i,this.footerData=o,this.columns=s,this.init()}init(e=!0){this.ctx.paint.clearTextCache(),this.clearBufferData(),this.rowKeyMap.clear(),this.checkboxKeyMap.clear(),this.colIndexKeyMap.clear(),this.rowIndexRowKeyMap.clear(),this.rowKeyRowIndexMap.clear(),this.maxRowHeightCellMap.clear();const t=this.getColumns(),i=Wt(t);if(this.ctx.hasSelection=i.some(s=>s.type==="selection"),this.ctx.hasTree=i.some(s=>s.type==="tree"),e){this.originalDataMap.clear(),this.changedDataMap.clear(),this.validationErrorMap.clear();const{ROW_KEY:s}=this.ctx.config;s?(this.ctx.hasSelection||this.selectionMap.clear(),this.ctx.hasTree||this.expandMap.clear()):(this.selectionMap.clear(),this.expandMap.clear())}this.itemRowKeyMap=new WeakMap,this.initData(this.data),this.getData(),this.bufferCheckState.buffer=!1}clearBufferData(){this.bufferData=[]}initData(e,t=0,i=[]){const s=e.length,{ROW_KEY:o="",DEFAULT_EXPAND_ALL:n,CELL_HEIGHT:a,SELECTABLE_METHOD:c,CHECKBOX_KEY:d,TREE_CHILDREN_KEY:f}=this.ctx.config;e.forEach((u,g)=>{var m;f!=="children"&&(u.children=u[f]);const x=u[o],v=x!=null?`${x}`:qa();this.itemRowKeyMap.set(u,v);const p=u._height||a,E=u._readonly;let C=!0;if(typeof c=="function"&&(C=c),d){const _=u[d];if(this.checkboxKeyMap.has(_)){const S=this.checkboxKeyMap.get(_)||[];S.push(v),this.checkboxKeyMap.set(_,S)}else this.checkboxKeyMap.set(_,[v])}this.selectionMap.set(v,{key:d?u[d]:v,row:u,check:((m=this.selectionMap.get(v))==null?void 0:m.check)||!1});const w=n||this.expandMap.get(v)||u._expand||!1;this.expandMap.set(v,w),this.rowKeyMap.set(v,{readonly:E,index:g,rowIndex:g,level:t,height:p,calculatedHeight:-1,check:!1,selectable:C,expand:w,expandLazy:!1,hasChildren:u._hasChildren||(Array.isArray(u.children)?u.children.length>0:!1),expandLoading:!1,item:u,parentRowKeys:i,parentRowKey:i[i.length-1]||"",isLastChild:g===s-1}),Array.isArray(u.children)&&u.children.length&&this.initData(u.children,t+1,[...i,v])})}setRowHeight(e,t){const i=this.rowIndexRowKeyMap.get(e);if(i===void 0)return;const s=this.rowKeyMap.get(i);s.height=t,s.item._height=t,this.clearBufferData()}setBatchRowHeight(e){e.forEach(({rowIndex:t,height:i})=>{const s=this.rowIndexRowKeyMap.get(t);if(s){const o=this.rowKeyMap.get(s);o.height=i,o.item._height=i}}),this.clearBufferData()}setBatchCalculatedRowHeight(e){return e.every(({height:t,rowIndex:i})=>this.getPositionForRowIndex(i).calculatedHeight===t)?!1:(e.forEach(({rowIndex:t,height:i})=>{const s=this.rowIndexRowKeyMap.get(t);if(s){const o=this.rowKeyMap.get(s),{height:n=-1}=this.getMaxRowHeightItem(s)||{};o.calculatedHeight=Math.max(i,n)}}),this.clearBufferData(),this.getData(),!0)}getAllRowsData(){let e=[];const t=i=>{i.forEach(s=>{e.push(s),Array.isArray(s.children)&&t(s.children)})};return t(this.data),e}generateColumns(e){const t=i=>i.map(s=>{var o,n,a,c,d,f,u,g;const m=s.children&&Array.isArray(s.children)?t(s.children):void 0,x={hide:(n=(o=this.customHeader)==null?void 0:o.hideData)==null?void 0:n[s.key],fixed:(c=(a=this.customHeader)==null?void 0:a.fixedData)==null?void 0:c[s.key],sort:(f=(d=this.customHeader)==null?void 0:d.sortData)==null?void 0:f[s.key],width:(g=(u=this.customHeader)==null?void 0:u.resizableData)==null?void 0:g[s.key]},v={};for(const[E,C]of Object.entries(x))C!==void 0&&(v[E]=C);const p=m&&m.every(E=>E.hide);return{...s,children:m,hide:p||(typeof s.hide=="function"?s.hide(s):s.hide),...v}});return t(e)}getColumns(){return this.generateColumns(this.columns)}setColumns(e){this.columns=e,this.clearBufferData()}setData(e){this.data=e,this.init()}getData(){if(this.bufferData.length>0)return{data:this.bufferData,sumHeight:this.sumHeight,positions:this.positions};let e=[],t=0;this.sumHeight=0,this.positions=[];const i=o=>{o.forEach(n=>{e.push(n);const a=this.itemRowKeyMap.get(n),{expand:c,hasChildren:d,height:f,calculatedHeight:u}=this.rowKeyMap.get(a),g=this.sumHeight,m=Math.max(u,f);this.sumHeight+=m,this.rowIndexRowKeyMap.set(t,a),this.rowKeyRowIndexMap.set(a,t),this.positions.push({top:g,height:m,bottom:this.sumHeight,calculatedHeight:u}),t+=1,c&&d&&i(n.children)})};this.rowIndexRowKeyMap.clear(),this.rowKeyRowIndexMap.clear();let s=this.data;if(typeof this.filterMethod=="function"&&(s=this.filterMethod(s)),this.sortState.size){const o=Array.from(this.sortState.entries()).sort((n,a)=>n[1].timestamp-a[1].timestamp);s=this.sortDataRecursive(s,o)}return i(s),this.bufferData=e,{data:e,sumHeight:this.sumHeight,positions:this.positions}}setFooterData(e){this.footerData=e}getFooterData(){return this.footerData}setFilterMethod(e){this.filterMethod=e}clearFilterMethod(){this.filterMethod=void 0}getSortState(e){return this.sortState.get(e)||{direction:"none",timestamp:0}}setSortState(e,t){const i=Date.now();this.ctx.config.SORT_STRICTLY&&this.sortState.clear(),t==="none"?this.sortState.delete(e):this.sortState.set(e,{direction:t,timestamp:i}),this.ctx.emit("sortChange",this.sortState),this.clearBufferData(),this.ctx.emit("draw")}clearSort(){this.sortState.clear(),this.ctx.emit("sortChange",this.sortState),this.clearBufferData(),this.ctx.emit("draw")}sortDataRecursive(e,t){let i=[...e];for(const[s,{direction:o}]of t){if(o==="none")continue;const n=this.getColumnByKey(s);!n||!n.column.sortBy||(i=this.applySingleColumnSort(i,s,o,n.column.sortBy))}return i.map(s=>(s.children&&Array.isArray(s.children)&&(s.children=this.sortDataRecursive(s.children,t)),s))}applySingleColumnSort(e,t,i,s){return e.sort((o,n)=>{const a=o[t],c=n[t];let d=0;if(typeof s=="function")d=s(o,n);else if(s==="number"){const f=Number(a)||0,u=Number(c)||0;d=f-u}else if(s==="string"){const f=String(a||""),u=String(c||"");d=f.localeCompare(u)}else s==="date"&&(d=MC(a,c));return i==="asc"?d:-d})}expandItem(e,t=!1){const i=this.rowKeyMap.get(e);i.expand=t,this.expandMap.set(e,t),this.clearBufferData(),this.ctx.emit("draw")}setExpandRowKeys(e,t=!0){this.expandMap.clear(),e.forEach(i=>{const s=this.rowKeyMap.get(i);this.expandMap.set(i,t),s.expand=t}),this.clearBufferData(),this.ctx.emit("draw")}getExpandRowKeys(){let e=[];return this.rowKeyMap.forEach((t,i)=>{t.expand&&e.push(i)}),e}expandAll(e){this.expandMap.clear(),this.rowKeyMap.forEach(t=>{t.expand=e,this.expandMap.set(t.key,e)}),this.clearBufferData(),this.ctx.emit("draw")}expandLoading(e,t=!1){const i=this.rowKeyMap.get(e);i.expandLoading=t,this.clearBufferData(),this.ctx.emit("draw")}setExpandChildren(e,t){const i=this.rowKeyMap.get(e);i.expand=!0,this.expandMap.set(e,!0),i.expandLazy=!0,i.item.children=t,this.initData(i.item.children,i.level+1),this.clearBufferData()}getIsExpandLoading(e){return this.rowKeyMap.get(e).expandLoading}getIsExpandLazy(e){return this.rowKeyMap.get(e).expandLazy}getIsExpand(e){return this.rowKeyMap.get(e).expand}getRowForRowKey(e){return this.rowKeyMap.get(e)}getRowForRowIndex(e){const t=this.getRowKeyForRowIndex(e);return this.rowKeyMap.get(t)}getRowKeyForRowIndex(e){return this.rowIndexRowKeyMap.get(e)||""}getRowKeyByItem(e){return this.itemRowKeyMap.get(e)}getRowIndexForRowKey(e){return this.rowKeyRowIndexMap.get(e)}getItemValueForRowIndexAndColIndex(e,t){if(!(this.rowIndexRowKeyMap.has(e)&&this.colIndexKeyMap.get(t)))return null;const i=this.rowIndexRowKeyMap.get(e),s=this.colIndexKeyMap.get(t);return i===void 0||s===void 0?null:{rowKey:i,key:s,value:this.getItemValue(i,s)}}getItemValue(e,t){const i=this.rowKeyMap.get(e);return i&&i.item?i.item[t]===void 0?null:i.item[t]:null}async batchSetItemValue(e,t=!1,i=!0,s="none"){let o=[],n=i;const a=new Set;let c=[],d=e.map(x=>{const{rowKey:v,key:p}=x;let E=x.value,C=E;const w=this.getRowDataItemForRowKey(v),_=this.getItemValue(v,p),S=this.getVirtualBodyCellByKey(v,p);return(S==null?void 0:S.type)==="number"&&(["",void 0,null].includes(E)?C=null:/^-?\d+(\.\d+)?$/.test(`${E}`)?C=Number(E):(C=_,c.push({...x,value:C,oldValue:_,row:w}))),{...x,value:C,oldValue:_,row:w}});if(d=d.filter(x=>!c.some(v=>x.rowKey===v.rowKey&&x.key===v.key)),c.length){const x={code:"ERR_BATCH_SET_NUMBER_VALUE",message:"Assignment failed, not a numeric type",data:c};this.ctx.emit("error",x)}if(d=d.filter(x=>x.oldValue!==x.value),!d.length)return;const{BEFORE_VALUE_CHANGE_METHOD:f}=this.ctx.config;s==="none"&&typeof f=="function"&&(d=await f(d),n=!1),d.forEach(x=>{const{value:v,rowKey:p,key:E}=x,C=this.getItemValue(p,E);a.add(p),this.setItemValue(p,E,v,!1,!1,!1,n),o.push({rowKey:p,key:E,oldValue:C,newValue:v})});let u=[];a.forEach(x=>{u.push(this.ctx.database.getRowDataItemForRowKey(x))});const g=d.map(({rowKey:x,key:v})=>this.getValidator(x,v));Promise.all(g).then(()=>{this.validationErrorMap.size===0&&this.changedDataMap.size>0&&this.ctx.emit("validateChangedData",this.getChangedData())});const m=d.map(x=>{const v=!!this.getValidationError(x.rowKey,x.key).length;return{...x,errorTip:v}});this.ctx.emit("change",m,u),t&&this.ctx.history.pushState({changeList:o,scrollX:this.ctx.scrollX,scrollY:this.ctx.scrollY,type:"multiple"}),this.ctx.emit("draw")}async setItemValue(e,t,i,s=!1,o=!1,n=!1,a=!0){if(!this.rowKeyMap.has(e))return{};const{item:c}=this.rowKeyMap.get(e);let d=c[t],f=i;if(a&&this.ctx.database.getReadonly(e,t))return{oldValue:d,newValue:d};c[t]!==null&&typeof c[t]=="object"&&(d=JSON.parse(JSON.stringify(c[t])));const u=`${e}​_${t}`;this.originalDataMap.has(u)||this.originalDataMap.set(u,d);const g=this.originalDataMap.get(u),m=this.getRowDataItemForRowKey(e);if(n){const x=this.getVirtualBodyCellByKey(e,t);if((x==null?void 0:x.type)==="number")if(["",void 0,null].includes(i))f=null;else if(/^-?\d+(\.\d+)?$/.test(`${i}`))f=Number(i);else{f=d;const p={code:"ERR_SET_NUMBER_VALUE",message:"Assignment failed, not a numeric type",data:[{rowKey:e,key:t,value:f,oldValue:d,row:m}]};this.ctx.emit("error",p)}if(f===d)return{oldValue:d,newValue:d};let v=[{rowKey:e,key:t,value:f,oldValue:d,row:m}];this.batchSetItemValue(v,s,!1),this.ctx.emit("editChange",{rowKey:e,key:t,oldValue:d,value:f,originalValue:g,row:m})}else this.changedDataMap.set(u,f),c[t]=f;return this.ctx.hasEvent("iterationChange")&&this.ctx.emit("iterationChange",{rowKey:e,key:t,oldValue:d,value:f,originalValue:this.originalDataMap.get(u),row:m}),o&&this.ctx.emit("draw"),{oldValue:d,newValue:f}}getRowDataItemForRowKey(e){if(!this.rowKeyMap.has(e))return{};const{item:t}=this.rowKeyMap.get(e);return t}setRowSelectionByCheckboxKey(e,t){const{CHECKBOX_KEY:i}=this.ctx.config;if(i){if(!this.rowKeyMap.has(e))return!1;const{item:s}=this.rowKeyMap.get(e),o=s[i];this.checkboxKeyMap.has(o)&&(this.checkboxKeyMap.get(o)||[]).forEach(n=>{const a=this.selectionMap.get(n);a&&(a.check=t)})}}toggleRowSelection(e,t){const i=this.rowKeyMap.get(e),s=this.selectionMap.get(e);if(!s)return;t==="selection-tree"||t==="tree-selection"?this.toggleTreeSelection(e):(s.check=!s.check,this.setRowSelectionByCheckboxKey(e,s.check)),this.ctx.emit("toggleRowSelection",i);const o=this.getSelectionRows();this.ctx.emit("selectionChange",o),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}toggleTreeSelection(e){const t=this.getTreeSelectionState(e),i=this.ctx.config.TREE_SELECT_MODE;if(i==="auto")t.checked&&!t.indeterminate?(this.clearTreeSelectionRecursive(e),this.setRowSelection(e,!1,!1)):(this.selectTreeSelectionRecursive(e),this.setRowSelection(e,!0,!1));else if(i==="cautious")t.checked&&!t.indeterminate?(this.clearTreeSelectionRecursive(e),this.setRowSelection(e,!1,!1)):(this.selectTreeSelectionRecursive(e),this.setRowSelection(e,!0,!1));else if(i==="strictly"){const s=this.selectionMap.get(e);s&&(s.check=!s.check,this.setRowSelectionByCheckboxKey(e,s.check))}this.ctx.emit("selectionChange",this.getSelectionRows()),this.ctx.emit("draw")}selectTreeSelectionRecursive(e){this.getTreeChildren(e).forEach(t=>{this.setRowSelectionByParent(t,!0),this.selectTreeSelectionRecursive(t)})}clearTreeSelectionRecursive(e){this.getTreeChildren(e).forEach(t=>{this.setRowSelectionByParent(t,!1),this.clearTreeSelectionRecursive(t)})}updateParentTreeSelection(e){const t=this.getTreeParent(e);if(!t)return;const i=this.getTreeChildren(t).map(c=>this.selectionMap.get(c)),s=i.filter(c=>c==null?void 0:c.check).length,o=i.length;let n=!1;o>0&&(s===0?n=!1:s===o||this.ctx.config.TREE_SELECT_MODE==="auto"?n=!0:this.ctx.config.TREE_SELECT_MODE==="cautious"&&(n=!1));const a=this.selectionMap.get(t);a&&a.check!==n&&(a.check=n,this.setRowSelectionByCheckboxKey(t,n),this.updateParentTreeSelection(t))}setRowSelection(e,t,i=!0){const s=this.selectionMap.get(e);s&&(s.check=t,this.setRowSelectionByCheckboxKey(e,s.check),this.ctx.emit("setRowSelection",t,s.row),(this.ctx.config.TREE_SELECT_MODE==="auto"||this.ctx.config.TREE_SELECT_MODE==="cautious")&&this.updateParentTreeSelection(e),i&&(this.bufferCheckState.buffer=!1,this.ctx.emit("draw")))}setRowSelectionByParent(e,t){const i=this.selectionMap.get(e);i&&(i.check=t,this.setRowSelectionByCheckboxKey(e,i.check))}getSelectionRows(){let e=[];return this.selectionMap.forEach(t=>{t.check&&e.push(t.row)}),e}getRowSelection(e){const t=this.selectionMap.get(e);return t?t.check:!1}getTreeSelectionState(e){if(!this.getRowForRowKey(e))return{checked:!1,indeterminate:!1};const t=this.selectionMap.get(e),i=(t==null?void 0:t.check)||!1;if(this.getTreeChildren(e).length===0)return{checked:i,indeterminate:!1};let s=!1,o=i;if(this.ctx.config.TREE_SELECT_MODE==="auto"){const n=u=>{const g=this.getTreeChildren(u);let m=[];for(const x of g)m.push(x),m.push(...n(x));return m},a=n(e).map(u=>this.selectionMap.get(u)),c=a.filter(u=>u==null?void 0:u.check).length,d=a.length,f=c>0;s=f&&c!==d,o=i||f,i&&d>0&&c===0&&(o=!1,s=!1)}else if(this.ctx.config.TREE_SELECT_MODE==="cautious"){const n=g=>{const m=this.getTreeChildren(g);let x=[];for(const v of m)x.push(v),x.push(...n(v));return x},a=n(e).map(g=>this.selectionMap.get(g)),c=a.filter(g=>g==null?void 0:g.check).length,d=a.length,f=c>0,u=c===d;s=f&&!u,o=i||u,i&&d>0&&c===0&&(o=!1,s=!1)}else this.ctx.config.TREE_SELECT_MODE==="strictly"&&(s=!1,o=i);return{checked:o,indeterminate:s}}getTreeChildren(e){const t=this.getRowForRowKey(e);if(!t||!t.item||!t.item.children)return[];const i=[],s=o=>{for(const n of o){const a=this.getRowKeyByItem(n);a&&i.push(a),n.children&&n.children.length>0&&s(n.children)}};return s(t.item.children),i}getTreeParent(e){const t=(i,s)=>{for(const o of i){const n=this.getRowKeyByItem(o);if(o.children)for(const a of o.children){if(this.getRowKeyByItem(a)===s)return n;const c=t(o.children,s);if(c)return c}}return null};return t(this.data,e)}getRowSelectable(e){const{selectable:t,item:i,rowIndex:s}=this.rowKeyMap.get(e);return typeof t=="function"?t({row:i,rowIndex:s}):t}toggleAllSelection(){this.ctx.config.TREE_SELECT_MODE==="auto"||this.ctx.config.TREE_SELECT_MODE==="cautious"?this.rowKeyMap.forEach((t,i)=>{let s=t.selectable;if(typeof s=="function"&&(s=s({row:t.item,rowIndex:t.rowIndex})),s){const o=this.selectionMap.get(i);o&&(o.check=!0,this.setRowSelectionByCheckboxKey(i,!0))}}):this.rowKeyMap.forEach((t,i)=>{let s=t.selectable;typeof s=="function"&&(s=s({row:t.item,rowIndex:t.rowIndex})),s&&this.setRowSelection(i,!0,!1)});const e=this.getSelectionRows();this.ctx.emit("toggleAllSelection",e),this.ctx.emit("selectionChange",e),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}clearSelection(e=!1){const t=this.ctx.config.TREE_SELECT_MODE==="auto"||this.ctx.config.TREE_SELECT_MODE==="cautious";e?t?this.rowKeyMap.forEach((s,o)=>{const n=this.selectionMap.get(o);n&&(n.check=!1,this.setRowSelectionByCheckboxKey(o,!1))}):this.rowKeyMap.forEach((s,o)=>{this.setRowSelection(o,!1,!1)}):(this.selectionMap.clear(),this.rowKeyMap.forEach((s,o)=>{this.selectionMap.set(o,{check:!1,row:s.item,key:o})}));const i=this.getSelectionRows();this.ctx.emit("clearSelection"),this.ctx.emit("selectionChange",i),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}getCheckedState(){const{buffer:e,...t}=this.bufferCheckState;if(e)return t;const i=this.rowKeyMap.size;let s=0,o=0;const n=this.selectionMap.size,a=Array.from(this.selectionMap.values()).some(g=>g.check);this.rowKeyMap.forEach((g,m)=>{var x;(x=this.selectionMap.get(m))!=null&&x.check&&(s+=1);let v=g.selectable;typeof v=="function"&&(v=v({row:g.item,rowIndex:g.rowIndex})),v&&(o+=1)});const c=n>i&&s===0&&a,d=o&&o>s&&s>0||c,f=o!==0,u=!!o&&o===s;return this.bufferCheckState={buffer:!0,check:u,indeterminate:d,selectable:f},{check:u,indeterminate:d,selectable:f}}updateColIndexKeyMap(e=[]){this.colIndexKeyMap.clear(),e.forEach(t=>{this.colIndexKeyMap.set(t.colIndex,t.key)})}getColumnByColIndex(e){var t;const i=this.colIndexKeyMap.get(e);if(i&&this.headerMap.has(i))return(t=this.headerMap.get(i))==null?void 0:t.column}getColumnByKey(e){const t=this.headerMap.get(e);if(t)return t}getColIndexForKey(e){var t;if(e&&this.headerMap.has(e))return(t=this.headerMap.get(e))==null?void 0:t.colIndex}getColHeaderByIndex(e){const t=this.colIndexKeyMap.get(e);if(t&&this.headerMap.has(t))return this.headerMap.get(t)}getChangedData(){let e=[];return this.changedDataMap.forEach((t,i)=>{const s=this.originalDataMap.get(i),o=i.split("​_")[0],n=i.split("​_")[1];s!==t&&e.push({rowKey:o,colKey:n,originalValue:s,row:this.ctx.database.getRowDataItemForRowKey(o),value:t})}),e}getChangedRows(){const e=new Set;this.changedDataMap.forEach((i,s)=>{const o=this.originalDataMap.get(s),n=s.split("​_")[0];o!==i&&e.add(n)});let t=[];return e.forEach(i=>{t.push(this.ctx.database.getRowDataItemForRowKey(i))}),t}isHasChangedData(e,t){const i=`${e}​_${t}`;if(!this.changedDataMap.has(i))return!1;const s=this.originalDataMap.get(i),o=this.changedDataMap.get(i);return s!==o}getPositionForRowIndex(e){return e<this.positions.length?this.positions[e]:{height:0,top:0,bottom:0,calculatedHeight:0}}setHeader(e,t){return e?(this.headerMap.set(e,t),!0):!1}getReadonly(e,t){const{DISABLED:i}=this.ctx.config;if(i)return!0;const s=this.rowKeyMap.get(e),o=this.headerMap.get(t);if(!s||!o)return!0;const n=s.readonly,a=o.readonly,{BODY_CELL_READONLY_METHOD:c}=this.ctx.config;if(typeof c=="function"&&o){const d=c({row:s.item,rowIndex:s.rowIndex,colIndex:o.colIndex,column:o.column,value:this.getItemValue(e,t)});if(d!==void 0)return d}return a||n}clearValidate(){this.validationErrorMap.clear()}hasValidationError(){return this.validationErrorMap.size!==0}getValidator(e,t){return new Promise(i=>{const s=this.rowKeyMap.get(e),o=this.headerMap.get(t),{BODY_CELL_RULES_METHOD:n}=this.ctx.config;if(s===void 0||o===void 0)return i([]);const a=o.column;let c=a.rules;if(typeof n=="function"){const d=n({row:s.item,rowIndex:s.rowIndex,colIndex:o.colIndex,column:a,value:this.getItemValue(e,t)});d&&(c=d)}if(c){const d={row:s.item,rowIndex:s.rowIndex,colIndex:o.colIndex,column:a,key:t,rowKey:e,value:this.getItemValue(e,t),field:t,fieldValue:this.getItemValue(e,t)},f=new IC(c).validate(d);this.setValidationError(e,t,f),i(f)}else this.clearValidationError(e,t),i([])})}getHeightByRowIndexRowSpan(e,t){let i=0;for(let s=0;s<t;s++){const o=this.positions[e+s];o&&(i+=o.height)}return i}getSpanInfo(e){const{rowIndex:t,key:i,rowKey:s,row:o,value:n,colIndex:a,relationRowKeys:c,relationColKeys:d,rowspan:f,height:u,width:g,colspan:m,mergeRow:x,mergeCol:v}=e;if(f===1&&m===1)return{xArr:[a,a],yArr:[t,t],rowspan:f,colspan:m,height:u,width:g,offsetTop:0,offsetLeft:0,dataList:[{rowKey:s,key:i,row:o,value:n}]};let p=t,E=t,C=a,w=a,_=[],S=0,B=0,K=0,R=0;if(f!==1&&x){R=g;const I=c.reduce((b,O)=>{const y=this.getItemValue(s,O)??"";return`${b}${y}`},"");for(let b=t-1;b>=0;b--){const O=this.rowIndexRowKeyMap.get(b)||"",y=c.reduce((M,D)=>{const P=this.getItemValue(O,D)??"";return`${M}${P}`},"");if(I===y)p=b;else break}for(let b=t;b<=this.ctx.maxRowIndex;b++){const O=this.rowIndexRowKeyMap.get(b)||"",y=c.reduce((M,D)=>{const P=this.getItemValue(O,D)??"";return`${M}${P}`},"");if(I===y)E=b;else break}for(let b=p;b<t;b++){const{height:O}=this.positions[b];S+=O}for(let b=p;b<=E;b++){const{height:O}=this.positions[b];K+=O;const y=this.rowIndexRowKeyMap.get(b)||"",{item:M}=this.rowKeyMap.get(y),D=this.getItemValue(y,i);_.push({rowKey:y,key:i,value:D,row:M})}}if(m!==1&&v){K=u;for(let I=a-1;I>=0;I--){const b=this.getColumnByColIndex(I);if(!b)break;const O=this.getItemValue(s,i),y=this.getItemValue(s,b.key);if(O===y&&d.includes(b.key))C=I;else break}for(let I=a;I<=this.ctx.maxColIndex;I++){const b=this.getColumnByColIndex(I);if(!b)break;const O=this.getItemValue(s,i),y=this.getItemValue(s,b.key);if(O===y&&d.includes(b.key))w=I;else break}for(let I=C;I<a;I++){const b=this.getColumnByColIndex(I);if(!b)break;B+=b.width||100}for(let I=C;I<=w;I++){const b=this.getColumnByColIndex(I);if(!b)break;R+=b.width||100,_.push({rowKey:s,key:b.key,value:this.getItemValue(s,b.key),row:o})}}return{xArr:[C,w],yArr:[p,E],rowspan:f,colspan:m,height:K,width:R,offsetTop:S,offsetLeft:B,dataList:_}}setValidationErrorByRowKey(e,t,i){const s=`${e}​_${t}`,o=this.getRowForRowKey(e),n=o==null?void 0:o.rowIndex,a=this.getColumnByKey(t);if(!e||!a||!o)return;const c=this.getItemValue(e,t),d=[{key:t,rowKey:e,rowIndex:n,colIndex:a.colIndex,column:a.column,row:o,value:c,message:i,field:t,fieldValue:c}];this.validationErrorMap.set(s,d)}setValidationError(e,t,i){const s=`${e}​_${t}`;this.validationErrorMap.set(s,i)}clearValidationError(e,t){const i=`${e}​_${t}`;this.validationErrorMap.has(i)&&this.validationErrorMap.delete(i)}getValidationError(e,t){const i=`${e}​_${t}`;return this.validationErrorMap.get(i)||[]}getVirtualBodyCell(e,t,i=!0){const s=this.getColumnByColIndex(t),o=this.getRowForRowIndex(e);return!s||!o?void 0:new Pr(this.ctx,e,t,0,0,0,0,s,o.item,"body",i)}getVirtualBodyCellByKey(e,t){const i=this.getRowIndexForRowKey(e),s=this.getColIndexForKey(t);if(!(i===void 0||s===void 0))return this.getVirtualBodyCell(i,s)}hasMergeCell(e,t){let i=!1;for(let s=t[0];s<=t[1];s++)for(let o=e[0];o<=e[1];o++){const n=this.getVirtualBodyCell(s,o);if(n&&(n.rowspan!==1||n.colspan!==1)){i=!0;break}}return i}calculateMaxTreeDepth(e,t=0){let i=t;return e.forEach(s=>{if(Array.isArray(s.children)&&s.children.length>0){const o=this.calculateMaxTreeDepth(s.children,t+1);i=Math.max(i,o)}}),i}setOverlayerAutoHeightMap(e){this.overlayerAutoHeightMap=e}getOverlayerAutoHeightMap(){return this.overlayerAutoHeightMap}getOverlayerAutoHeight(e,t){const i=`${e}​_${t}`;return this.overlayerAutoHeightMap.get(i)||0}setCustomHeader(e,t=!1){if(["fixedData","sortData","hideData","resizableData"].forEach(i=>{const s=e[i];s!==void 0&&(this.customHeader[i]=s)}),!t){const i=this.clearCustomHeaderInvalidValues(this.columns);this.ctx.emit("customHeaderChange",i)}}resetCustomHeader(){this.customHeader={},this.ctx.emit("resetHeader"),this.ctx.emit("customHeaderChange",this.customHeader)}getCustomHeader(){return this.customHeader}setCustomHeaderResizableData(e,t){let{resizableData:i={}}=this.customHeader;i[e]=t,this.setCustomHeader({resizableData:i})}setCustomHeaderHideData(e,t){let{hideData:i={}}=this.customHeader;e.forEach(s=>{i[s]=t}),this.setCustomHeader({hideData:i}),this.ctx.emit("resetHeader")}setCustomHeaderFixedData(e,t){let{fixedData:i={}}=this.customHeader;e.forEach(s=>{i[s]=t}),this.setCustomHeader({fixedData:i}),this.ctx.emit("resetHeader")}clearCustomHeaderInvalidValues(e){const t=(s,o={})=>{s.forEach(n=>{n.children&&n.children.length>0&&t(n.children,o);const a=(c,d)=>{var f,u;const g=(f=this.customHeader[c])==null?void 0:f[n.key];g!==void 0&&g!==d&&(o[c]||(o[c]={}),o[c][n.key]=g,c==="fixedData"&&!g&&!d&&((u=o[c])==null||delete u[n.key]))};a("fixedData",n.fixed),a("sortData",n.sort),a("hideData",n.hide),a("resizableData",n.width)})};let i={};return t(e,i),i}setMaxRowHeightItem(e,t,i){this.maxRowHeightCellMap.set(e,{key:t,height:i})}getMaxRowHeightItem(e){return this.maxRowHeightCellMap.get(e)}clearChangeData(){this.changedDataMap.clear()}}class NC{constructor(e){h(this,"ctx"),h(this,"history",[]),h(this,"historyIndex",-1),this.ctx=e,this.init()}init(){this.ctx.on("keydown",e=>{if(!this.ctx.editing){if(e.ctrlKey&&!e.shiftKey&&e.code==="KeyZ"||e.metaKey&&!e.shiftKey&&e.code==="KeyZ"){e.preventDefault(),this.ctx.clearSelector(),this.ctx.clearAutofill(),this.backState();return}if(e.ctrlKey&&e.code==="KeyY"||e.ctrlKey&&e.shiftKey&&e.code==="KeyZ"||e.metaKey&&e.shiftKey&&e.code==="KeyZ"){e.preventDefault(),this.ctx.clearSelector(),this.ctx.clearAutofill(),this.forwardState();return}}})}pushState(e){const{HISTORY_NUM:t=0,ENABLE_HISTORY:i}=this.ctx.config;i&&(this.history.push(e),this.history.length>t&&this.history.splice(0,1),this.historyIndex=this.history.length-1)}backState(){if(this.historyIndex>=0){const{changeList:e,scrollX:t,scrollY:i}=this.history[this.historyIndex],s=e.map(o=>({rowKey:o.rowKey,key:o.key,value:o.oldValue,row:{}}));this.ctx.setScroll(t,i),this.ctx.database.batchSetItemValue(s,!1,!1,"back"),this.historyIndex-=1}}forwardState(){if(this.historyIndex<this.history.length-1){this.historyIndex+=1;const{changeList:e}=this.history[this.historyIndex],t=e.map(i=>({rowKey:i.rowKey,key:i.key,value:i.newValue,row:{}}));this.ctx.database.batchSetItemValue(t,!1,!1,"forward")}}clear(){this.history=[],this.historyIndex=-1}}class BC{constructor(e){h(this,"eventTasks",new Set),h(this,"ctx"),this.ctx=e,this.init()}init(){this.bind(window,"resize",this.handleResize.bind(this)),this.bind(window,"mouseup",this.handleMouseUp.bind(this)),this.bind(window,"mousemove",this.handleMousemove.bind(this)),this.bind(window,"blur",this.handleOutsideMousedown.bind(this)),this.bind(window,"mousedown",this.handleOutsideMousedown.bind(this)),this.bind(this.ctx.stageElement,"click",this.handleClick.bind(this)),this.bind(window,"keydown",this.handleKeydown.bind(this)),this.bind(this.ctx.stageElement,"wheel",this.handleWheel.bind(this),{passive:!1}),this.bind(this.ctx.stageElement,"touchstart",this.handleTouchstart.bind(this),{passive:!1}),this.bind(this.ctx.stageElement,"touchend",this.handleTouchend.bind(this)),this.bind(this.ctx.stageElement,"touchmove",this.handleTouchmove.bind(this),{passive:!1}),this.bind(this.ctx.stageElement,"contextmenu",this.handleContextMenu.bind(this)),this.bind(this.ctx.stageElement,"mousedown",this.handleMouseDown.bind(this)),this.bind(this.ctx.stageElement,"dblclick",this.handleDblclick.bind(this)),this.bind(this.ctx.stageElement,"mouseover",this.handleMouseover.bind(this)),this.bind(this.ctx.stageElement,"mouseout",this.handleMouseout.bind(this)),this.bind(document,"selectionchange",this.selectionchange.bind(this))}selectionchange(){this.ctx.domSelectionStr="";const e=window.getSelection();e&&e.toString()&&(this.ctx.domSelectionStr=e.toString())}clearDomSelection(){const e=window.getSelection();e&&!e.isCollapsed&&e.removeAllRanges()}destroy(){Array.from(this.eventTasks).forEach(({target:e,name:t,fn:i,options:s})=>{this.unbind(e,t,i,s)}),this.eventTasks.clear()}handleResize(e){this.ctx.emit("resetHeader",e),this.ctx.emit("resize",e)}handleMouseDown(e){this.clearDomSelection(),e.button===0&&(this.ctx.mousedown=!0),this.ctx.emit("mousedown",e)}handleMousemove(e){const t=e,i=this.ctx.containerElement.getBoundingClientRect(),s=t.clientX-i.left,o=t.clientY-i.top;this.ctx.mouseX=s,this.ctx.mouseY=o,this.ctx.emit("mousemove",e)}handleMouseUp(e){e.button===0&&(this.ctx.mousedown=!1),this.ctx.emit("mouseup",e)}handleClick(e){this.ctx.emit("click",e)}handleKeydown(e){const{ENABLE_KEYBOARD:t}=this.ctx.config;t&&this.ctx.isTarget(e)&&(this.ctx.dragHeaderIng||this.ctx.emit("keydown",e))}handleWheel(e){this.ctx.emit("wheel",e)}handleTouchstart(e){this.ctx.emit("touchstart",e)}handleTouchend(e){this.ctx.emit("touchend",e)}handleTouchmove(e){this.ctx.emit("touchmove",e)}handleContextMenu(e){e.preventDefault(),this.ctx.emit("contextMenu",e)}handleMouseover(e){this.ctx.isMouseoverTargetContainer=!0,this.ctx.emit("mouseover",e)}handleMouseout(e){this.ctx.isMouseoverTargetContainer=!1,this.ctx.emit("mouseout",e)}handleDblclick(e){this.ctx.emit("dblclick",e)}handleOutsideMousedown(e){this.ctx.selector.enable&&(e.target instanceof Window||e.target instanceof Node&&!this.ctx.containerElement.contains(e.target))&&this.ctx.emit("outsideMousedown",e)}bind(e,t,i,s){e.addEventListener(t,i,s),this.eventTasks.add({target:e,name:t,fn:i,options:s})}unbind(e,t,i,s){e.removeEventListener(t,i,s);for(const o of this.eventTasks)if(o.target===e&&o.name===t&&o.fn===i){this.eventTasks.delete(o);break}}}class HC{constructor(){h(this,"events",new Map)}has(e){return this.events.has(e)}on(e,t){const i=this.events.get(e)||[];i.push(t),this.events.set(e,i)}once(e,t){const i=(...s)=>{t(...s),this.off(e,i)};return this.on(e,i),this}off(e,t){const i=this.events.get(e);if(i){const s=i.indexOf(t);s>=0&&(i.splice(s,1),i.length===0?this.events.delete(e):this.events.set(e,i))}}emit(e,...t){const i=this.events.get(e);i&&i.forEach(s=>{s(...t)})}destroy(){this.events.clear()}}class FC{constructor(e){h(this,"ctx"),h(this,"textCacheMap",new Map);const t=e.getContext("2d");if(!t)throw new Error("canvas context not found");this.ctx=t}clearTextCache(){this.textCacheMap.clear()}scale(e){this.ctx.setTransform(1,0,0,1,0,0),this.ctx.scale(e,e)}save(){this.ctx.save()}restore(){this.ctx.restore()}translate(e,t){this.ctx.translate(e,t)}setCursor(e="default"){this.ctx.canvas.style.cursor=e}clear(e=0,t=0,i,s){this.ctx.clearRect(e,t,i||this.ctx.canvas.width,s||this.ctx.canvas.height)}drawShadow(e,t,i,s,o){const{fillColor:n,side:a,shadowWidth:c,colorStart:d,colorEnd:f}=o;this.ctx.save(),n&&(this.ctx.fillStyle=n,this.ctx.fillRect(e,t,i,s));let u;switch(a){case"left":u=this.ctx.createLinearGradient(e-c,t,e,t),u.addColorStop(0,d),u.addColorStop(1,f),this.ctx.fillStyle=u,this.ctx.fillRect(e-c,t,c,s);break;case"right":u=this.ctx.createLinearGradient(e+i,t,e+i+c,t),u.addColorStop(0,d),u.addColorStop(1,f),this.ctx.fillStyle=u,this.ctx.fillRect(e+i,t,c,s);break;case"top":u=this.ctx.createLinearGradient(e,t-c,e,t),u.addColorStop(0,d),u.addColorStop(1,f),this.ctx.fillStyle=u,this.ctx.fillRect(e,t-c,i,c);break;case"bottom":u=this.ctx.createLinearGradient(e,t+s,e,t+s+c),u.addColorStop(0,d),u.addColorStop(1,f),this.ctx.fillStyle=u,this.ctx.fillRect(e,t+s,i,c);break;default:console.error("Invalid side specified for shadow");break}this.ctx.restore()}drawLine(e,t){if(e.length<4||e.length%2!==0)throw new Error("A valid array of points is required to draw a line");this.ctx.save();const{borderColor:i="black",borderWidth:s=1}=t;this.ctx.beginPath(),this.ctx.moveTo(e[0]-.5,e[1]-.5);for(let o=2;o<e.length;o+=2)this.ctx.lineTo(e[o]-.5,e[o+1]-.5);this.ctx.strokeStyle=i,this.ctx.lineWidth=s,t.lineDash&&(this.ctx.lineDashOffset=t.lineDashOffset??0,this.ctx.setLineDash(t.lineDash)),t.fillColor&&(this.ctx.fillStyle=t.fillColor,this.ctx.fill()),t.borderColor&&(this.ctx.strokeStyle=t.borderColor),this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()}drawImage(e,t,i,s,o){this.ctx.save(),this.ctx.drawImage(e,t,i,s,o),this.ctx.restore()}drawRect(e,t,i,s,{borderWidth:o=1,borderColor:n,fillColor:a,radius:c=0}={}){if(this.ctx.save(),this.ctx.beginPath(),a!==void 0&&(this.ctx.fillStyle=a),n!==void 0&&(this.ctx.lineWidth=o,this.ctx.strokeStyle=n),c===0)this.ctx.rect(e-.5,t-.5,i,s);else{const[d,f,u,g]=typeof c=="number"?[c,c,c,c]:c;this.ctx.moveTo(e+d,t),this.ctx.arcTo(e+i,t,e+i,t+f,f),this.ctx.arcTo(e+i,t+s,e+i-u,t+s,u),this.ctx.arcTo(e,t+s,e,t+s-g,g),this.ctx.arcTo(e,t,e+d,t,d)}a!==void 0&&this.ctx.fill(),n!==void 0&&this.ctx.stroke(),this.ctx.restore()}drawText(e="",t,i,s,o,n={}){var a;this.ctx.save();const{font:c="12px Arial",align:d="center",color:f="#495060",padding:u=0,verticalAlign:g="middle",maxLineClamp:m=1,autoRowHeight:x=!1,offsetLeft:v=0,offsetRight:p=0}=n;if(this.ctx.font=c,this.ctx.fillStyle=f,this.ctx.textAlign=d,["",null,void 0].includes(e))return this.ctx.restore(),!1;const E=parseInt(((a=c.match(/\d+/))==null?void 0:a[0])||"12")*(n.lineHeight||1.2),C=s-u*2-v-p;let w=!1;const _=Math.round((o-2*u)/E);let S=this.wrapText(e,C,n.cacheTextKey),B=Math.min(S.length,Math.max(_,1));m==="auto"&&x?B=S.length:typeof m=="number"&&m<B&&m!==1?B=m:(m===1&&(S=[e],B=1),m==="auto"&&_===1&&(S=[e],B=1));let K=i+u;const R=Math.round(B*E);g==="middle"?K=i+(o-R)/2:g==="bottom"&&(K=i+o-R-u);let I=t+u+v;d==="center"?I=t+s/2:d==="right"&&(I=t+s-u-p);for(let b=0;b<S.length;b++){const O=S[b],y=K+b*E;if(this.ctx.textBaseline="top",b===B-1){const M=S.slice(b).join(""),{_text:D,ellipsis:P}=this.handleEllipsis(M,s,u,c);this.ctx.fillText(D,I,y),w=P;break}this.ctx.fillText(O,I,y)}if(n.textCallback&&S.length){const b=S.reduce((P,Y)=>Math.max(P,this.ctx.measureText(Y).width),0),O=Math.round(b);let y=I,M=I+O;d==="center"?(y=I-O/2,M=I+O/2):d==="right"&&(y=I-O,M=I);const D={x:I,y:K,width:O,height:R,left:y,right:M,top:K,bottom:K+R};n.textCallback(D)}return this.ctx.restore(),w}wrapText(e,t,i=""){if(!e)return[""];if(i&&this.textCacheMap.has(i))return this.textCacheMap.get(i)||[""];const s=[],o=e.split(`
4
- `);for(const a of o){if(a===""){s.push("");continue}const c=a.split("");let d="";for(const f of c){const u=d+f;this.ctx.measureText(u).width<=t?d=u:d?(s.push(d),d=f):(s.push(f),d="")}d&&s.push(d)}const n=s.length>0?s:[""];return i&&this.textCacheMap.set(i,n),n}calculateTextHeight(e="",t,i={}){var s;const{font:o="12px Arial",padding:n=0,align:a="center",color:c="#495060",maxLineClamp:d=1,cacheTextKey:f=""}=i;this.ctx.save(),this.ctx.font=o,this.ctx.fillStyle=c,this.ctx.textAlign=a;const u=parseInt(((s=o.match(/\d+/))==null?void 0:s[0])||"12"),g=u*(i.lineHeight||1.2),m=t-n*2,x=this.wrapText(e,m,f);let v=1;return d==="auto"?v=x.length:x.length>d?v=d:v=x.length,this.ctx.restore(),Math.max(Math.floor(v*g+n*2),Math.floor(u+n*2))}handleEllipsis(e,t,i=0,s="12px Arial"){this.ctx.save();let o=!1,n=e;if(this.ctx.font=s,e==null||e==="")return this.ctx.restore(),{_text:"",ellipsis:o};const a=this.ctx.measureText("...").width;if(t<=a+i*2)return this.ctx.restore(),{_text:"",ellipsis:!0};const c=this.ctx.measureText(e).width,d=t-i*2;if(c&&c>=d){o=!0;let f=0;for(let u=0;u<e.length;u++)if(f+=this.ctx.measureText(e[u]).width,f>=d-a){n=e.slice(0,u)+"...",o=!0;break}}return this.ctx.restore(),{_text:n,ellipsis:o}}}class Mo{constructor(e){h(this,"_config",{}),h(this,"CSS_PREFIX","e-virt-table"),h(this,"ICONS",[]),h(this,"ROW_KEY",""),h(this,"DISABLED",!1),h(this,"HEADER_FONT","12px normal Arial"),h(this,"BODY_FONT","12px normal Arial"),h(this,"BORDER",!0),h(this,"STRIPE",!1),h(this,"STRIPE_COLOR","#fafafa"),h(this,"BORDER_COLOR","#e1e6eb"),h(this,"HEIGHT",0),h(this,"PLACEHOLDER_COLOR","#CDD0DC"),h(this,"EMPTY_BODY_HEIGHT",120),h(this,"EMPTY_CUSTOM_STYLE",{}),h(this,"NUMBER_ERROR_TIP","只允许输入数字"),h(this,"EMPTY_TEXT","暂无数据"),h(this,"LOADING_TEXT","加载中..."),h(this,"MAX_HEIGHT",1e3),h(this,"BORDER_RADIUS",8),h(this,"ENABLE_OFFSET_HEIGHT",!1),h(this,"OFFSET_HEIGHT",0),h(this,"HEADER_HEIGHT",36),h(this,"ENABLE_HEADER_STICKY",!1),h(this,"HEADER_BG_COLOR","#F8FAFF"),h(this,"BODY_BG_COLOR","#FFF"),h(this,"HEADER_TEXT_COLOR","#1D2129"),h(this,"REQUIRED_COLOR","#F56C6C"),h(this,"BODY_TEXT_COLOR","#4E5969"),h(this,"FOOTER_TEXT_COLOR","#4E5969"),h(this,"LOADING_ICON_SVG",""),h(this,"LOADING_ICON_COLOR","#4E5969"),h(this,"EXPAND_ICON_SVG",""),h(this,"SHRINK_ICON_SVG",""),h(this,"EXPAND_ICON_COLOR","#4E5969"),h(this,"SHRINK_ICON_COLOR","#4E5969"),h(this,"ERROR_TIP_ICON_COLOR","red"),h(this,"ERROR_TIP_ICON_SIZE",6),h(this,"COLUMNS_ALIGN","left"),h(this,"COLUMNS_VERTICAL_ALIGN","middle"),h(this,"EXPAND_LAZY",!0),h(this,"DEFAULT_EXPAND_ALL",!1),h(this,"CELL_WIDTH",100),h(this,"CELL_HEIGHT",36),h(this,"CELL_PADDING",8),h(this,"CELL_HOVER_ICON_SIZE",14),h(this,"CELL_HOVER_ICON_BG_COLOR","#fff"),h(this,"CELL_HOVER_ICON_BORDER_COLOR","#DDE0EA"),h(this,"SCROLLER_TRACK_SIZE",14),h(this,"SCROLLER_SIZE",8),h(this,"SCROLLER_COLOR","#dee0e3"),h(this,"SCROLLER_TRACK_COLOR","#fff"),h(this,"SCROLLER_FOCUS_COLOR","#bbbec4"),h(this,"SELECT_BORDER_COLOR","rgb(82,146,247)"),h(this,"SELECT_AREA_COLOR","rgba(82,146,247,0.1)"),h(this,"SELECT_ROW_COL_BG_COLOR","transparent"),h(this,"AUTOFILL_POINT_BORDER_COLOR","#fff"),h(this,"EDIT_BG_COLOR","#fcf6ed"),h(this,"CHECKBOX_KEY",""),h(this,"CHECKBOX_COLOR","rgb(82,146,247)"),h(this,"FINDER_CELL_BG_COLOR","rgb(255,229,144)"),h(this,"ENABLE_FINDER",!0),h(this,"CHECKBOX_SIZE",20),h(this,"CHECKBOX_DISABLED_SVG",""),h(this,"CHECKBOX_DISABLED_COLOR","#F1F2F4"),h(this,"CHECKBOX_CHECK_SVG",""),h(this,"CHECKBOX_UNCHECK_SVG",""),h(this,"CHECKBOX_UNCHECK_COLOR","#DDE0EA"),h(this,"CHECKBOX_INDETERMINATE_SVG",""),h(this,"CHECKBOX_CHECK_DISABLED_SVG",""),h(this,"CHECKBOX_CHECK_DISABLED_COLOR","#DDE0EA"),h(this,"ICON_EDIT_SVG",""),h(this,"ICON_EDIT_COLOR","#4E5969"),h(this,"ICON_SELECT_SVG",""),h(this,"ICON_SELECT_COLOR","#4E5969"),h(this,"SORT_STRICTLY",!0),h(this,"SORT_ASC_ICON_SVG",""),h(this,"SORT_DESC_ICON_SVG",""),h(this,"SORTABLE_ICON_SVG",""),h(this,"SORT_ICON_COLOR","rgb(82,146,247)"),h(this,"READONLY_COLOR","#fff"),h(this,"READONLY_TEXT_COLOR","#4E5969"),h(this,"ERROR_TIP_COLOR","#ED3F14"),h(this,"FOOTER_BG_COLOR","#fafafa"),h(this,"FOOTER_FIXED",!0),h(this,"FOOTER_POSITION","bottom"),h(this,"CELL_FOOTER_HEIGHT",36),h(this,"ENABLE_SELECTOR",!0),h(this,"TREE_SELECT_MODE","auto"),h(this,"TREE_CHILDREN_KEY","children"),h(this,"TREE_INDENT",20),h(this,"TREE_ICON_SIZE",20),h(this,"TREE_LINE",!1),h(this,"TREE_LINE_COLOR","#e1e6eb"),h(this,"ENABLE_EDIT_SINGLE_CLICK",!1),h(this,"ENABLE_EDIT_CLICK_SELECTOR",!0),h(this,"SELECTOR_AREA_MIN_X",0),h(this,"SELECTOR_AREA_MAX_X_OFFSET",0),h(this,"SELECTOR_AREA_MAX_X",0),h(this,"SELECTOR_AREA_MIN_Y",0),h(this,"SELECTOR_AREA_MAX_Y",0),h(this,"SELECTOR_AREA_MAX_Y_OFFSET",0),h(this,"SELECTOR_CELL_VALUE_TYPE","value"),h(this,"ENABLE_AUTO_THEME",!0),h(this,"ENABLE_SELECTOR_SINGLE",!1),h(this,"ENABLE_SELECTOR_SPAN_COL",!0),h(this,"ENABLE_SELECTOR_SPAN_ROW",!0),h(this,"ENABLE_SELECTOR_ALL_ROWS",!0),h(this,"ENABLE_SELECTOR_ALL_COLS",!0),h(this,"ENABLE_MERGE_CELL_LINK",!1),h(this,"ENABLE_AUTOFILL",!1),h(this,"ENABLE_AUTOFILL_SPAN_COL",!0),h(this,"ENABLE_AUTOFILL_SPAN_ROW",!0),h(this,"ENABLE_CONTEXT_MENU",!1),h(this,"ENABLE_HEADER_CONTEXT_MENU",!1),h(this,"ENABLE_COPY",!0),h(this,"ENABLE_PASTER",!0),h(this,"ENABLE_RESIZE_ROW",!0),h(this,"ENABLE_RESIZE_COLUMN",!0),h(this,"RESIZE_ROW_LINE_COLOR","#e1e6eb"),h(this,"RESIZE_COLUMN_LINE_COLOR","#e1e6eb"),h(this,"ENABLE_RESIZE_COLUMN_TEXT",!0),h(this,"RESIZE_COLUMN_TEXT_COLOR","#fff"),h(this,"RESIZE_COLUMN_TEXT_BG_COLOR","rgb(82,146,247)"),h(this,"RESIZE_ROW_MIN_HEIGHT",36),h(this,"RESIZE_COLUMN_MIN_WIDTH",40),h(this,"DRAG_TIP_BG_COLOR","rgba(82,146,247,0.1)"),h(this,"DRAG_TIP_LINE_COLOR","rgb(82,146,247)"),h(this,"ENABLE_KEYBOARD",!0),h(this,"ENABLE_HISTORY",!1),h(this,"ENABLE_VALIDATOR_IMMEDIATE",!0),h(this,"HISTORY_NUM",50),h(this,"HIGHLIGHT_HOVER_ROW",!1),h(this,"HIGHLIGHT_HOVER_ROW_COLOR","rgba(186,203,231,0.1)"),h(this,"HIGHLIGHT_SELECTED_ROW",!1),h(this,"HIGHLIGHT_SELECTED_ROW_COLOR","rgba(82,146,247,0.1)"),h(this,"TOOLTIP_BG_COLOR","#303133"),h(this,"TOOLTIP_TEXT_COLOR","#fff"),h(this,"TOOLTIP_ZINDEX",3e3),h(this,"TOOLTIP_CUSTOM_STYLE",{}),h(this,"CONTEXT_MENU",[{label:"复制",value:"copy"},{label:"剪切",value:"cut"},{label:"粘贴",value:"paste"},{label:"清空选中内容",value:"clearSelected"}]),h(this,"CUSTOM_BODY_CONTEXT_MENU",[]),h(this,"HEADER_CONTEXT_MENU",[{label:"左固定",value:"fixedLeft"},{label:"右固定",value:"fixedRight"},{label:"取消固定",value:"fixedNone"},{label:"隐藏",value:"hide"},{label:"显示",value:"visible"},{label:"恢复默认",value:"resetHeader"}]),h(this,"CUSTOM_HEADER_CONTEXT_MENU",[]),h(this,"CELL_LINE_HEIGHT",1.3),h(this,"AUTO_ROW_HEIGHT",!1),h(this,"ENABLE_DRAG_COLUMN",!1),h(this,"HEADER_CELL_STYLE_METHOD"),h(this,"BODY_CELL_STYLE_METHOD"),h(this,"FOOTER_CELL_STYLE_METHOD"),h(this,"BODY_CELL_READONLY_METHOD"),h(this,"BODY_CELL_FORMATTER_METHOD"),h(this,"BODY_CELL_RULES_METHOD"),h(this,"BODY_CELL_TYPE_METHOD"),h(this,"BODY_CELL_EDITOR_METHOD"),h(this,"BODY_CELL_RENDER_METHOD"),h(this,"BODY_CELL_HOVER_ICON_METHOD"),h(this,"SPAN_METHOD"),h(this,"SELECTABLE_METHOD"),h(this,"EXPAND_LAZY_METHOD"),h(this,"BEFORE_VALUE_CHANGE_METHOD"),h(this,"BEFORE_PASTE_DATA_METHOD"),h(this,"BEFORE_AUTOFILL_DATA_METHOD"),h(this,"BEFORE_SET_SELECTOR_METHOD"),h(this,"BEFORE_SET_AUTOFILL_METHOD"),h(this,"BEFORE_COPY_METHOD"),this._config=e,this.updateCssVar()}init(e){this._config=e,this.updateCssVar()}updateCssVar(){let e={};Object.keys(this).forEach(t=>{if(t.endsWith("_COLOR")||t.endsWith("_FONT")){const i=`--evt-${t.toLocaleLowerCase().replace(/_/g,"-")}`,s=$C(i);s&&(e[t]=s)}}),Object.assign(this,e,this._config)}}const _i='<svg t="1724122015492" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4237" width="32" height="32"><path d="M401.472 316.992l159.04 217.664L591.488 512l-30.976-22.656-159.04 217.728q-2.24 3.008-3.84 6.464-1.6 3.456-2.496 7.104-0.896 3.648-1.024 7.424-0.192 3.84 0.384 7.552 0.64 3.712 1.92 7.296 1.28 3.52 3.2 6.784 1.984 3.2 4.544 6.016 2.56 2.752 5.632 4.992 3.072 2.24 6.464 3.84 3.456 1.6 7.168 2.496 3.648 0.896 7.424 1.024 3.776 0.192 7.488-0.448 3.776-0.576 7.296-1.856 3.584-1.28 6.784-3.264 3.2-1.92 6.016-4.48 2.816-2.56 5.056-5.632l159.04-217.728q3.584-4.928 5.504-10.752 1.92-5.76 1.92-11.904 0-6.08-1.92-11.904-1.92-5.76-5.504-10.752L463.488 271.68q-2.24-3.072-5.056-5.632-2.752-2.56-6.016-4.48-3.2-1.984-6.784-3.328-3.52-1.28-7.296-1.856-3.712-0.576-7.488-0.448-3.84 0.192-7.424 1.088-3.712 0.896-7.168 2.496-3.392 1.6-6.4 3.84-3.136 2.176-5.696 4.992-2.56 2.752-4.48 6.016-1.984 3.2-3.264 6.784-1.28 3.52-1.92 7.296-0.576 3.712-0.384 7.488 0.128 3.84 1.024 7.488 0.896 3.648 2.496 7.04 1.6 3.456 3.84 6.528z m30.976-61.056q-3.776 0-7.488 0.704-3.712 0.768-7.168 2.24-3.52 1.408-6.656 3.52-3.2 2.112-5.824 4.8-2.688 2.624-4.8 5.76-2.112 3.2-3.52 6.656-1.472 3.52-2.176 7.232-0.768 3.712-0.768 7.488 0 3.776 0.768 7.488 0.704 3.712 2.176 7.232 1.408 3.456 3.52 6.592 2.112 3.2 4.8 5.824 2.688 2.688 5.76 4.8 3.2 2.112 6.72 3.52 3.456 1.472 7.168 2.176 3.712 0.768 7.488 0.768 3.84 0 7.488-0.768 3.712-0.704 7.232-2.176 3.456-1.408 6.592-3.52 3.2-2.112 5.824-4.8 2.688-2.688 4.8-5.76 2.112-3.2 3.52-6.656 1.472-3.52 2.24-7.232 0.704-3.712 0.704-7.488 0-3.84-0.704-7.488-0.768-3.712-2.24-7.232-1.408-3.456-3.52-6.592-2.112-3.2-4.8-5.824-2.624-2.688-5.76-4.8-3.2-2.112-6.656-3.52-3.52-1.472-7.232-2.24Q436.224 256 432.448 256z m0 435.392q-3.776 0-7.488 0.704-3.712 0.768-7.168 2.176-3.52 1.472-6.656 3.584-3.2 2.112-5.824 4.736-2.688 2.688-4.8 5.824-2.112 3.2-3.52 6.656-1.472 3.52-2.176 7.232-0.768 3.712-0.768 7.488 0 3.776 0.768 7.488 0.704 3.712 2.176 7.168 1.408 3.52 3.52 6.656 2.112 3.2 4.8 5.76 2.688 2.752 5.76 4.8 3.2 2.112 6.72 3.584 3.456 1.472 7.168 2.176 3.712 0.768 7.488 0.768 3.84 0 7.488-0.768 3.712-0.704 7.232-2.176 3.456-1.472 6.592-3.584 3.2-2.048 5.824-4.736 2.688-2.688 4.8-5.824 2.112-3.2 3.52-6.656 1.472-3.456 2.24-7.168 0.704-3.712 0.704-7.488 0-3.84-0.704-7.488-0.768-3.712-2.24-7.232-1.408-3.52-3.52-6.656-2.112-3.136-4.8-5.76-2.624-2.688-5.76-4.8-3.2-2.112-6.656-3.584-3.52-1.408-7.232-2.176-3.712-0.704-7.488-0.704z" p-id="4238"></path></svg>',Ao='<svg t="1722595535853" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4551" width="32" height="32"><path d="M640 128H384c-170.496 0-256 85.504-256 256v256c0 170.496 85.504 256 256 256h256c170.496 0 256-85.504 256-256V384c0-170.496-85.504-256-256-256z m67.584 302.592c-2.048 4.608-4.608 8.704-8.192 12.288L506.88 634.88c-3.584 3.584-7.68 6.144-12.288 8.192-4.608 2.048-9.728 3.072-14.848 3.072s-10.24-1.024-14.848-3.072c-4.608-2.048-8.704-4.608-12.288-8.192l-96.256-96.256c-3.584-3.584-6.144-7.68-8.192-12.288-2.048-4.608-3.072-9.728-3.072-14.848 0-2.56 0-5.12 1.024-7.68 0.512-2.56 1.024-5.12 2.048-7.168 1.024-2.56 2.048-4.608 3.584-6.656 1.536-2.048 3.072-4.096 4.608-5.632 1.536-2.048 3.584-3.584 5.632-4.608 2.048-1.536 4.096-2.56 6.656-3.584 2.56-1.024 4.608-1.536 7.168-2.048 2.56-0.512 5.12-0.512 7.68-0.512 5.12 0 10.24 1.024 14.848 3.072 4.608 2.048 8.704 4.608 12.288 8.192l69.12 68.608L645.12 389.12c3.584-3.584 7.68-6.144 12.288-8.192 4.608-2.048 9.728-3.072 14.848-3.072 2.56 0 5.12 0 7.68 0.512s5.12 1.024 7.168 2.048c2.56 1.024 4.608 2.048 6.656 3.584 2.048 1.536 4.096 3.072 5.632 4.608 1.536 1.536 3.584 3.584 4.608 5.632 1.536 2.048 2.56 4.096 3.584 6.656 1.024 2.56 1.536 4.608 2.048 7.168 0.512 2.56 1.024 5.12 1.024 7.68 0 5.12-1.024 10.24-3.072 14.848z" p-id="4552"></path></svg>',No='<svg t="1724122044148" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4551" width="32" height="32"><path d="M707.648 401.28L489.28 560.704l22.656 30.976 22.656-30.976L316.16 401.216q-3.072-2.24-6.464-3.84-3.456-1.536-7.104-2.432-3.712-0.896-7.488-1.088-3.776-0.128-7.488 0.448-3.776 0.64-7.296 1.92-3.584 1.28-6.784 3.2-3.2 1.984-6.016 4.544-2.816 2.56-5.056 5.632-2.176 3.072-3.84 6.464-1.536 3.456-2.432 7.104-0.896 3.712-1.088 7.488-0.128 3.776 0.448 7.488 0.64 3.776 1.92 7.296 1.28 3.584 3.2 6.784 1.984 3.2 4.544 6.016 2.56 2.752 5.632 4.992l218.368 159.552q4.928 3.584 10.752 5.504 5.76 1.92 11.904 1.92 6.08 0 11.904-1.92 5.76-1.92 10.752-5.504l218.368-159.552q3.008-2.24 5.568-4.992 2.56-2.816 4.544-6.016 1.92-3.2 3.264-6.784 1.28-3.52 1.92-7.296 0.576-3.712 0.384-7.488-0.128-3.84-1.024-7.488-0.896-3.648-2.496-7.04-1.6-3.456-3.84-6.528-2.24-3.072-4.992-5.632-2.816-2.56-6.016-4.48-3.2-1.984-6.784-3.328-3.584-1.28-7.296-1.856-3.712-0.64-7.488-0.448-3.84 0.192-7.488 1.088-3.648 0.896-7.04 2.496-3.456 1.536-6.528 3.84z m61.056 30.976q0-3.84-0.768-7.488-0.704-3.712-2.176-7.232-1.472-3.456-3.52-6.656-2.112-3.136-4.8-5.76-2.688-2.688-5.76-4.8-3.2-2.112-6.72-3.584-3.456-1.408-7.168-2.176-3.712-0.704-7.488-0.704-3.84 0-7.488 0.704-3.712 0.768-7.232 2.176-3.456 1.472-6.656 3.584-3.136 2.112-5.76 4.8-2.688 2.624-4.8 5.76-2.112 3.2-3.584 6.656-1.408 3.52-2.176 7.232-0.704 3.712-0.704 7.488 0 3.776 0.704 7.488 0.768 3.712 2.176 7.168 1.472 3.52 3.584 6.656 2.112 3.2 4.8 5.824 2.624 2.688 5.76 4.8 3.2 2.112 6.656 3.52 3.52 1.472 7.232 2.176 3.712 0.768 7.488 0.768 3.776 0 7.488-0.768 3.712-0.704 7.168-2.176 3.52-1.408 6.656-3.52 3.2-2.112 5.824-4.8 2.688-2.688 4.8-5.76 2.048-3.2 3.52-6.72 1.472-3.456 2.176-7.168 0.768-3.712 0.768-7.488z m-436.736 0q0-3.84-0.768-7.488-0.704-3.712-2.176-7.232-1.408-3.456-3.52-6.656-2.112-3.136-4.8-5.76-2.688-2.688-5.76-4.8-3.2-2.112-6.656-3.584-3.52-1.408-7.232-2.176-3.712-0.704-7.488-0.704-3.84 0-7.488 0.704-3.712 0.768-7.232 2.176-3.456 1.472-6.592 3.584-3.2 2.112-5.824 4.8-2.688 2.624-4.8 5.76-2.112 3.2-3.52 6.656-1.472 3.52-2.24 7.232-0.704 3.712-0.704 7.488 0 3.776 0.704 7.488 0.768 3.712 2.24 7.168 1.408 3.52 3.52 6.656 2.112 3.2 4.8 5.824 2.624 2.688 5.76 4.8 3.2 2.112 6.656 3.52 3.52 1.472 7.232 2.176 3.712 0.768 7.488 0.768 3.776 0 7.488-0.768 3.712-0.704 7.232-2.176 3.456-1.408 6.592-3.52 3.2-2.112 5.824-4.8 2.688-2.688 4.8-5.76 2.112-3.2 3.52-6.72 1.472-3.456 2.176-7.168 0.768-3.712 0.768-7.488z" p-id="4552"></path></svg>',Yr='<svg t="1755138507987" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5079" width="200" height="200"><path d="M512 938.688a42.688 42.688 0 0 1-35.072-18.432l-192-277.312A42.56 42.56 0 0 1 320 576h384a42.752 42.752 0 0 1 35.072 66.944l-192 277.312a42.688 42.688 0 0 1-35.072 18.432" fill="currentColor" p-id="2016"></path><path d="M704 448H320a42.752 42.752 0 0 1-35.072-66.944l192-277.312c16-23.04 54.208-23.04 70.144 0l192 277.312A42.56 42.56 0 0 1 704 448" fill="currentColor" p-id="2015"></path></svg>',KC=Yr.replace('fill="currentColor" p-id="2016"','fill="#bec4c7" p-id="2016"'),PC=Yr.replace('fill="currentColor" p-id="2015"','fill="#bec4c7" p-id="2015"'),el='<svg t="1724133395728" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2893" width="32" height="32"><path d="M512 226.8476541a19.82487759 19.82487759 0 0 1 14.66497778 5.70304692c3.80203107 3.82918865 5.70304692 8.71751457 5.70304693 14.66497779v122.20814825a19.82487759 19.82487759 0 0 1-5.70304693 14.66497778 19.82487759 19.82487759 0 0 1-14.66497778 5.70304691 19.82487759 19.82487759 0 0 1-14.66497778-5.70304691 19.82487759 19.82487759 0 0 1-5.70304693-14.66497778v-122.20814825a19.82487759 19.82487759 0 0 1 5.70304693-14.66497779 19.82487759 19.82487759 0 0 1 14.66497778-5.70304692z m0 407.36049415a19.82487759 19.82487759 0 0 1 14.66497778 5.70304691c3.80203107 3.82918865 5.70304692 8.71751457 5.70304693 14.66497778v122.20814827a19.82487759 19.82487759 0 0 1-5.70304693 14.66497776 19.82487759 19.82487759 0 0 1-14.66497778 5.70304693 19.82487759 19.82487759 0 0 1-14.66497778-5.70304693 19.82487759 19.82487759 0 0 1-5.70304693-14.66497776v-122.20814827a19.82487759 19.82487759 0 0 1 5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 14.66497778-5.70304691zM797.1523459 512a19.82487759 19.82487759 0 0 1-5.70304692 14.66497778 19.82487759 19.82487759 0 0 1-14.66497779 5.70304693h-122.20814825a19.82487759 19.82487759 0 0 1-14.66497778-5.70304693 19.82487759 19.82487759 0 0 1-5.70304691-14.66497778 19.82487759 19.82487759 0 0 1 5.70304691-14.66497778 19.82487759 19.82487759 0 0 1 14.66497778-5.70304693h122.20814825a19.82487759 19.82487759 0 0 1 14.66497779 5.70304693c3.80203107 3.82918865 5.70304692 8.71751457 5.70304692 14.66497778z m-407.36049415 0a19.82487759 19.82487759 0 0 1-5.70304691 14.66497778 19.82487759 19.82487759 0 0 1-14.66497778 5.70304693h-122.20814827a19.82487759 19.82487759 0 0 1-14.66497776-5.70304693 19.82487759 19.82487759 0 0 1-5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 14.66497776-5.70304693h122.20814827a19.82487759 19.82487759 0 0 1 14.66497778 5.70304693c3.80203107 3.82918865 5.70304692 8.71751457 5.70304691 14.66497778zM310.22076878 310.22076878a21.29137537 21.29137537 0 0 1 14.66497779-5.70304693c5.51294514 0 10.18401235 1.90101585 14.01320099 5.70304693l86.55052591 86.57768347a20.91117183 20.91117183 0 0 1 5.73020449 14.31193182 19.28172983 19.28172983 0 0 1-6.05609289 14.013201 19.11878565 19.11878565 0 0 1-14.013201 6.05609289 20.96548698 20.96548698 0 0 1-14.31193182-5.70304692L310.22076878 338.87178998a19.06447114 19.06447114 0 0 1-5.70304693-14.01320099c0-5.54010272 1.90101585-10.42842865 5.70304693-14.66497778z m288.32975775 288.32975775a19.79772001 19.79772001 0 0 1 14.3390894-6.35482371c5.29568642 0 10.04822572 2.11827457 14.31193182 6.38198066l86.57768347 86.55052651c3.80203107 3.80203107 5.70304692 8.47309828 5.70304691 14.01320102a19.55330372 19.55330372 0 0 1-6.05609225 14.31193182 19.66193339 19.66193339 0 0 1-14.31193245 6.05609288 19.01015661 19.01015661 0 0 1-14.01320099-5.70304692l-86.55052591-86.57768347a19.79772001 19.79772001 0 0 1-6.38198129-14.31193245c0-5.29568642 2.11827457-10.07538268 6.38198129-14.33908939zM713.77923122 310.22076878c3.80203107 4.26370672 5.70304692 9.15203265 5.70304693 14.66497779s-1.90101585 10.18401235-5.70304693 14.01320099l-86.57768347 86.55052591a20.91117183 20.91117183 0 0 1-14.31193182 5.73020449 19.28172983 19.28172983 0 0 1-14.013201-6.05609289 19.11878565 19.11878565 0 0 1-6.05609289-14.013201c0-5.29568642 1.90101585-10.07538268 5.70304692-14.31193182l86.57768348-86.57768347c3.80203107-3.80203107 8.50025585-5.70304692 14.01320099-5.70304693 5.54010272 0 10.40127108 1.90101585 14.66497779 5.70304693zM425.44947347 598.57768347a19.79772001 19.79772001 0 0 1 6.35482371 14.33908939c0 5.29568642-2.11827457 10.04822572-6.38198066 14.31193245L338.89894756 713.77923122a19.06447114 19.06447114 0 0 1-14.01320099 5.70304693 19.55330372 19.55330372 0 0 1-14.31193245-6.05609227 19.68909035 19.68909035 0 0 1-6.05609227-14.31193245 19.01015661 19.01015661 0 0 1 5.70304693-14.01320099l86.57768347-86.55052591a19.79772001 19.79772001 0 0 1 14.31193182-6.38198129c5.29568642 0 10.07538268 2.11827457 14.3390894 6.38198129z" fill="#000000" fill-opacity=".65" p-id="2894"></path></svg>';class YC{constructor(e){h(this,"ctx"),h(this,"list",[{name:"loading",configName:"LOADING_ICON_SVG",configColorName:"LOADING_ICON_COLOR",svg:el,color:"#4E5969"},{name:"expand",configName:"EXPAND_ICON_SVG",configColorName:"EXPAND_ICON_COLOR",svg:_i,color:"#4E5969"},{name:"shrink",configName:"SHRINK_ICON_SVG",configColorName:"SHRINK_ICON_COLOR",svg:No,color:"#4E5969"},{name:"checkbox-uncheck",configName:"CHECKBOX_UNCHECK_SVG",configColorName:"CHECKBOX_UNCHECK_COLOR",svg:'<svg t="1722595639920" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4708" width="32" height="32"><path d="M128 640V384a256 256 0 0 1 256-256h256a256 256 0 0 1 256 256v256a256 256 0 0 1-256 256H384a256 256 0 0 1-256-256z m64 0q0 79.552 56.256 135.744Q304.448 832 384 832h256q79.552 0 135.744-56.256Q832 719.552 832 640V384q0-79.552-56.256-135.744Q719.552 192 640 192H384q-79.552 0-135.744 56.256Q192 304.448 192 384v256z" p-id="4709"></path></svg>',color:""},{name:"checkbox-check",configName:"CHECKBOX_CHECK_SVG",configColorName:"CHECKBOX_COLOR",svg:Ao,color:"rgb(82,146,247)"},{name:"checkbox-indeterminate",configName:"CHECKBOX_INDETERMINATE_SVG",configColorName:"CHECKBOX_COLOR",svg:'<svg t="1722595280953" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4394" width="32" height="32"><path d="M128 384v256q0 12.608 1.28 25.088 1.216 12.544 3.648 24.832 2.432 12.352 6.08 24.384t8.448 23.68q4.864 11.584 10.752 22.72 5.952 11.072 12.928 21.504 7.04 10.496 14.976 20.224 8 9.728 16.896 18.56 8.896 8.96 18.56 16.896 9.728 8 20.224 14.976 10.432 7.04 21.504 12.928 11.136 5.888 22.72 10.688 11.648 4.864 23.68 8.512 12.032 3.648 24.32 6.08 12.352 2.432 24.896 3.712Q371.392 896 384 896h256q12.608 0 25.088-1.28 12.544-1.216 24.832-3.648 12.352-2.432 24.384-6.08t23.68-8.512q11.584-4.8 22.72-10.688 11.072-5.952 21.504-12.928 10.496-7.04 20.224-14.976 9.728-8 18.56-16.896 8.96-8.832 16.896-18.56 8-9.728 14.976-20.224 7.04-10.432 12.928-21.504 5.888-11.136 10.688-22.72 4.864-11.648 8.512-23.68 3.648-12.032 6.08-24.32 2.432-12.352 3.712-24.896Q896 652.608 896 640V384q0-12.608-1.28-25.088-1.216-12.544-3.648-24.832-2.432-12.352-6.08-24.384t-8.512-23.68q-4.8-11.584-10.688-22.72-5.952-11.072-12.928-21.504-7.04-10.496-14.976-20.224-8-9.664-16.896-18.56-8.832-8.96-18.56-16.896-9.728-8-20.224-14.976-10.432-7.04-21.504-12.928-11.136-5.888-22.72-10.752-11.648-4.8-23.68-8.448-12.032-3.648-24.32-6.08-12.352-2.432-24.896-3.712Q652.608 128 640 128H384q-12.608 0-25.088 1.28-12.544 1.216-24.832 3.648-12.352 2.432-24.384 6.08t-23.68 8.448q-11.584 4.864-22.72 10.752-11.072 5.952-21.504 12.928-10.496 7.04-20.224 14.976-9.664 8-18.56 16.896-8.96 8.896-16.896 18.56-8 9.728-14.976 20.224-7.04 10.432-12.928 21.504-5.888 11.136-10.752 22.72-4.8 11.648-8.448 23.68-3.648 12.032-6.08 24.32-2.432 12.352-3.712 24.896Q128 371.392 128 384z m566.016 166.336H330.112a38.4 38.4 0 0 1 0-76.8h363.904a38.4 38.4 0 0 1 0 76.8z" p-id="4395"></path></svg>',color:"rgb(82,146,247)"},{name:"checkbox-check-disabled",configName:"CHECKBOX_CHECK_DISABLED_SVG",svg:Ao,color:"#DDE0EA"},{name:"checkbox-disabled",configName:"CHECKBOX_DISABLED_SVG",configColorName:"CHECKBOX_DISABLED_COLOR",svg:'<svg t="1722595946663" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4865" width="32" height="32"><path d="M128 640V384a256 256 0 0 1 256-256h256a256 256 0 0 1 256 256v256a256 256 0 0 1-256 256H384a256 256 0 0 1-256-256z" p-id="4866"></path><path d="M128 640V384a256 256 0 0 1 256-256h256a256 256 0 0 1 256 256v256a256 256 0 0 1-256 256H384a256 256 0 0 1-256-256z m64 0q0 79.552 56.256 135.744Q304.448 832 384 832h256q79.552 0 135.744-56.256Q832 719.552 832 640V384q0-79.552-56.256-135.744Q719.552 192 640 192H384q-79.552 0-135.744 56.256Q192 304.448 192 384v256z" fill="#DDE0EA" p-id="4867"></path></svg>',color:"#F1F2F4"},{name:"icon-edit",configName:"ICON_EDIT_SVG",configColorName:"ICON_EDIT_COLOR",svg:'<svg t="1744798692576" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6606" width="200" height="200"><path d="M855.296 894.528H168.768v-76.8h686.528v76.8z m38.4-38.4q0 3.84-0.768 7.488-0.704 3.712-2.176 7.232-1.472 3.52-3.52 6.656-2.112 3.136-4.8 5.76-2.688 2.688-5.824 4.8-3.2 2.112-6.656 3.584-3.456 1.408-7.168 2.176-3.712 0.704-7.488 0.704-3.84 0-7.488-0.704-3.712-0.768-7.232-2.176-3.52-1.472-6.656-3.584-3.136-2.112-5.76-4.736-2.688-2.688-4.8-5.824-2.112-3.2-3.584-6.656-1.408-3.52-2.176-7.232-0.704-3.648-0.704-7.488 0-3.776 0.704-7.488 0.768-3.712 2.176-7.168 1.472-3.52 3.584-6.656 2.112-3.136 4.736-5.76 2.688-2.752 5.824-4.8 3.2-2.112 6.656-3.584 3.52-1.472 7.232-2.176 3.712-0.768 7.488-0.768 3.776 0 7.488 0.768 3.712 0.704 7.168 2.176 3.52 1.472 6.656 3.584 3.2 2.048 5.76 4.736 2.752 2.688 4.864 5.824 2.048 3.2 3.52 6.656 1.472 3.456 2.176 7.168 0.768 3.712 0.768 7.488z m-686.528 0q0 3.84-0.768 7.488-0.704 3.712-2.176 7.232-1.472 3.52-3.52 6.656-2.112 3.136-4.8 5.76-2.688 2.688-5.76 4.8-3.2 2.112-6.72 3.584-3.456 1.408-7.168 2.176-3.712 0.704-7.488 0.704-3.84 0-7.488-0.704-3.712-0.768-7.232-2.176-3.456-1.472-6.656-3.584-3.136-2.112-5.76-4.736-2.688-2.688-4.8-5.824-2.112-3.2-3.584-6.656-1.408-3.52-2.176-7.232-0.704-3.648-0.704-7.488 0-3.776 0.704-7.488 0.768-3.712 2.176-7.168 1.472-3.52 3.584-6.656 2.112-3.136 4.736-5.76 2.688-2.752 5.824-4.8 3.2-2.112 6.656-3.584 3.52-1.472 7.232-2.176 3.712-0.768 7.488-0.768 3.776 0 7.488 0.768 3.712 0.704 7.168 2.176 3.52 1.472 6.656 3.584 3.2 2.048 5.824 4.736 2.688 2.688 4.8 5.824 2.048 3.2 3.52 6.656 1.472 3.456 2.176 7.168 0.768 3.712 0.768 7.488zM652.032 211.2l-369.92 370.368v89.344h90.048l369.664-369.856L652.032 211.2z m-54.4-54.272q22.528-22.528 54.4-22.528 31.808 0 54.336 22.528l89.792 89.856q22.464 22.464 22.464 54.272t-22.464 54.272l-369.664 369.856q-22.464 22.528-54.336 22.528H282.24q-31.808 0-54.336-22.528-22.464-22.464-22.464-54.272V581.568q0-31.808 22.4-54.272l369.92-370.368z" p-id="6607"></path></svg>',color:"#4E5969"},{name:"icon-select",configName:"ICON_SELECT_SVG",configColorName:"ICON_SELECT_COLOR",svg:No,color:"#4E5969"},{name:"sort-asc",configName:"SORT_ASC_ICON_SVG",configColorName:"SORT_ICON_COLOR",svg:KC,color:"rgb(82,146,247)"},{name:"sort-desc",configName:"SORT_DESC_ICON_SVG",configColorName:"SORT_ICON_COLOR",svg:PC,color:"rgb(82,146,247)"},{name:"sort-default",configName:"SORTABLE_ICON_SVG",svg:Yr,color:"#bec4c7"}]),h(this,"icons",new Map),this.ctx=e,this.init()}async init(){const e=[];for(let t=0;t<this.list.length;t++){const i=this.list[t];let s=i.color,o=i.svg;if(i.configColorName){const a=this.ctx.config[i.configColorName];a&&(s=a)}if(i.configName){const a=this.ctx.config[i.configName];a&&(o=a)}const n=this.createImageFromSVG(o,s).then(a=>{this.icons.set(i.name,a)});e.push(n)}for(let t=0;t<this.ctx.config.ICONS.length;t++){const i=this.ctx.config.ICONS[t];let s=i.color;const o=this.createImageFromSVG(i.svg,s,i.isBlob).then(n=>{this.icons.set(i.name,n)});e.push(o)}await Promise.all(e),this.ctx.emit("draw")}async createImageFromSVG(e,t,i=!1){const s=new DOMParser().parseFromString(e,"image/svg+xml").documentElement;t&&s.querySelectorAll("*").forEach(a=>{const c=a.getAttribute("fill");(c==="currentColor"||c===null)&&a.setAttribute("fill",t)});const o=new Image;let n="";if(i){const a=new Blob([new XMLSerializer().serializeToString(s)],{type:"image/svg+xml"});n=URL.createObjectURL(a)}else n="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(s));return o.src=n,new Promise((a,c)=>{o.onerror=()=>c(new Error("Failed to load image:"+e)),o.onload=()=>{a(o)}})}get(e){return this.icons.get(e)}getSvg(e){return this.list.find(t=>t.name===e)}}class vr extends ja{constructor(e,t,i,s,o,n,a){super(e,i,s,o,n,"header",a.fixed),h(this,"align"),h(this,"hideHeaderSelection",!1),h(this,"verticalAlign","middle"),h(this,"fixed"),h(this,"minWidth"),h(this,"maxWidth"),h(this,"widthFillDisable"),h(this,"type"),h(this,"operation",!1),h(this,"editorType"),h(this,"level"),h(this,"text"),h(this,"hide",!1),h(this,"displayText",""),h(this,"colspan"),h(this,"rowspan"),h(this,"row"),h(this,"key"),h(this,"required",!1),h(this,"readonly",!1),h(this,"ellipsis",!1),h(this,"overflowTooltipShow",!0),h(this,"children",[]),h(this,"column"),h(this,"colIndex"),h(this,"rowKey"),h(this,"rules"),h(this,"hasChildren"),h(this,"render"),h(this,"style",{}),h(this,"drawX",0),h(this,"drawY",0),h(this,"sortIconName","sort-default"),h(this,"sortAscIconName","sort-asc"),h(this,"sortDescIconName","sort-desc"),h(this,"visibleWidth",0),h(this,"visibleHeight",0),h(this,"maxLineClampHeader","auto"),h(this,"domDataset",{}),h(this,"drawTextX",0),h(this,"drawTextY",0),h(this,"drawTextWidth",0),h(this,"drawTextHeight",0),h(this,"drawCellBgColor",""),h(this,"drawTextColor",""),h(this,"drawTextFont",""),h(this,"drawSelectionImageX",0),h(this,"drawSelectionImageY",0),h(this,"drawSelectionImageWidth",0),h(this,"drawSelectionImageHeight",0),h(this,"drawSelectionImageName",""),h(this,"drawSelectionImageSource"),h(this,"drawSortImageX",0),h(this,"drawSortImageY",0),h(this,"drawSortImageWidth",0),h(this,"drawSortImageHeight",0),h(this,"drawSortImageName",""),h(this,"drawSortImageSource"),this.ctx=e,this.x=i,this.y=s,this.width=o,this.height=n,this.visibleWidth=o,this.visibleHeight=n,this.colIndex=t,this.key=a.key,this.minWidth=a.minWidth,this.maxWidth=a.maxWidth,this.hide=(typeof a.hide=="function"?a.hide(a):a.hide)||!1,this.type=a.type||"",this.editorType=a.editorType||"text",this.hideHeaderSelection=a.hideHeaderSelection||!1,this.align=a.headerAlign||a.align||this.ctx.config.COLUMNS_ALIGN,this.verticalAlign=a.headerVerticalAlign||a.verticalAlign||this.ctx.config.COLUMNS_VERTICAL_ALIGN,this.fixed=a.fixed||"",this.level=a.level||0,this.operation=a.operation||!1,this.text=a.title,this.column=a,this.colspan=a.colspan||1,this.widthFillDisable=a.widthFillDisable||!1,this.rowspan=a.rowspan||1,this.rules=a.rules,this.readonly=a.readonly||!1,this.required=a.required||!1,this.sortIconName=a.sortIconName||"sort-default",this.sortAscIconName=a.sortAscIconName||"sort-asc",this.sortDescIconName=a.sortDescIconName||"sort-desc",this.rowKey=qa(),this.overflowTooltipShow=a.overflowTooltipHeaderShow!==!1,this.hasChildren=a.children&&a.children.length>0||!1,this.render=a.renderHeader,this.maxLineClampHeader=a.maxLineClampHeader||"auto"}isVerticalVisible(){const{stageHeight:e}=this.ctx,t=e;return!(this.y+this.height<=0||this.y>=t)}updateStyle(){this.style=this.getOverlayerViewsStyle()}updateContainer(){const{HEADER_CELL_STYLE_METHOD:e,HEADER_BG_COLOR:t,HEADER_TEXT_COLOR:i}=this.ctx.config;let s=t,o=i;if(typeof e=="function"){const c=e,{backgroundColor:d,color:f,font:u}=c({colIndex:this.colIndex,column:this.column})||{};d&&(s=d),f&&(o=f),u&&(this.drawTextFont=u)}const{colKey:n,type:a}=this.ctx.finderBar;a==="header"&&n===this.key&&(s=this.ctx.config.FINDER_CELL_BG_COLOR),this.drawCellBgColor=s,this.drawTextColor=o}update(){this.updateContainer(),this.displayText=this.getText(),this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawTextX=this.drawX,this.drawTextY=this.drawY,this.drawTextWidth=this.width,this.drawTextHeight=this.height,this.updateStyle()}draw(){this.drawEdge(),this.drawSelection(),this.drawText(),this.drawBg(),this.drawSortIcon()}drawEdge(){const{paint:e,config:{BORDER_COLOR:t,BORDER:i}}=this.ctx;e.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:i?t:"transparent",fillColor:this.drawCellBgColor})}drawText(){const{paint:e,config:{HEADER_FONT:t,CELL_PADDING:i,REQUIRED_COLOR:s}}=this.ctx,o=`${this.displayText}_${this.drawTextWidth}_${this.drawTextFont}`;this.ellipsis=e.drawText(this.displayText,this.drawTextX,this.drawTextY,this.drawTextWidth,this.drawTextHeight,{font:this.drawTextFont||t,padding:i,color:this.drawTextColor,align:this.align,verticalAlign:this.verticalAlign,maxLineClamp:this.maxLineClampHeader,offsetRight:this.column.sortBy?16:0,offsetLeft:this.required?12:0,cacheTextKey:o,textCallback:n=>{this.column.sortBy&&(this.drawSortImageX=n.right+4,this.drawSortImageY=n.top+(n.height-16)/2),this.required&&e.drawText("*",n.left-18,n.top+(n.height-12)/2,24,24,{color:s,font:"18px Arial",align:"center",verticalAlign:"middle",padding:0})}})}drawBg(){if(this.ctx.dragHeaderIng)return;const{ENABLE_SELECTOR:e,ENABLE_SELECTOR_SINGLE:t}=this.ctx.config;let i=-1,s=-1;if(this.ctx.focusCellHeader&&(i=this.ctx.focusCellHeader.colIndex,s=this.ctx.focusCellHeader.colIndex+this.ctx.focusCellHeader.colspan-1),e&&!t){const{xArr:n}=this.ctx.selector;i=n[0],s=n[1]}const o=this.colspan+this.colIndex-1;this.colIndex>=i&&this.colIndex<=s&&o<=s&&this.ctx.paint.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:"transparent",fillColor:this.ctx.config.SELECT_ROW_COL_BG_COLOR||"transparent"})}drawSelection(){if(!this.hideHeaderSelection&&["index-selection","selection","selection-tree","tree-selection"].includes(this.type)){const{indeterminate:e,check:t,selectable:i}=this.ctx.database.getCheckedState(),{CHECKBOX_SIZE:s=0,CELL_PADDING:o}=this.ctx.config;let n=this.drawX+(this.width-s)/2,a=this.drawY+(this.height-s)/2;this.drawTextX=n+s-o/2,this.drawTextWidth=this.drawX+this.visibleWidth-this.drawTextX,(this.align==="left"||this.align==="right")&&(n=this.drawX+o,this.drawTextX=n+s-o/2,this.drawTextWidth=this.drawX+this.visibleWidth-this.drawTextX),this.verticalAlign==="top"?a=this.drawY+o/2:this.verticalAlign==="bottom"&&(a=this.drawY+this.height-s-o/2);let c=this.ctx.icons.get("checkbox-uncheck"),d="checkbox-uncheck";e?(c=this.ctx.icons.get("checkbox-indeterminate"),d="checkbox-indeterminate"):t&&i?(c=this.ctx.icons.get("checkbox-check"),d="checkbox-check"):t&&!i?(c=this.ctx.icons.get("checkbox-check-disabled"),d="checkbox-check-disabled"):!t&&i?(c=this.ctx.icons.get("checkbox-uncheck"),d="checkbox-uncheck"):(c=this.ctx.icons.get("checkbox-disabled"),d="checkbox-disabled"),c&&(this.drawSelectionImageX=n,this.drawSelectionImageY=a,this.drawSelectionImageWidth=s,this.drawSelectionImageHeight=s,this.drawSelectionImageName=d,this.drawSelectionImageSource=c,this.ctx.paint.drawImage(this.drawSelectionImageSource,this.drawSelectionImageX,this.drawSelectionImageY,this.drawSelectionImageWidth,this.drawSelectionImageHeight))}}drawSortIcon(){if(!this.column.sortBy)return;const e=16;let t=this.sortIconName;const i=this.ctx.database.getSortState(this.key);i.direction==="asc"?t=this.sortAscIconName:i.direction==="desc"&&(t=this.sortDescIconName);const s=this.ctx.icons.get(t);s&&(this.drawSortImageWidth=e,this.drawSortImageHeight=e,this.drawSortImageName=t,this.drawSortImageSource=s,this.ctx.paint.drawImage(this.drawSortImageSource,this.drawSortImageX,this.drawSortImageY,this.drawSortImageWidth,this.drawSortImageHeight))}getText(){return this.render||["",null,void 0].includes(this.text)?"":`${this.text}`}getOverlayerViewsStyle(){let e="";return this.fixed==="left"?e=`${this.drawX}px`:this.fixed==="right"?e=`${this.drawX-(this.ctx.stageWidth-this.ctx.fixedRightWidth)}px`:e=`${this.drawX-this.ctx.fixedLeftWidth}px`,{position:"absolute",overflow:"hidden",left:e,top:`${this.drawY+1}px`,width:`${this.width}px`,height:`${this.height-2}px`,pointerEvents:"initial",userSelect:"none"}}}class VC{constructor(e){h(this,"ctx"),h(this,"visibleHoverCell"),h(this,"resizeObserver"),h(this,"mutationObserver"),this.ctx=e,this.init()}init(){this.resizeObserver=new ResizeObserver(e=>{this.ctx.emit("resetHeader"),this.ctx.emit("resizeObserver",e),this.ctx.emit("containerResize",this.ctx.containerElement)}),this.resizeObserver.observe(this.ctx.containerElement),this.mutationObserver=new MutationObserver(e=>{for(const t of e)t.type==="attributes"&&t.attributeName==="class"&&(this.ctx.config.updateCssVar(),this.ctx.emit("draw"))}),this.ctx.config.ENABLE_AUTO_THEME&&this.mutationObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),this.ctx.on("mousedown",e=>{if(this.isBusy(e))return;const{offsetY:t,offsetX:i}=this.ctx.getOffset(e),s=t,o=i,{body:{height:n,visibleHeight:a,visibleWidth:c,y:d}}=this.ctx,f=Math.min(n,a);o>0&&o<c&&s>d&&s<d+f||this.ctx.emit("mousedownBodyOutside",e),e.button===0&&(this.handleHeaderEvent(o,s,this.ctx.header.renderCellHeaders,u=>{this.ctx.focusCellHeader=u,this.ctx.focusCell=void 0,this.ctx.emit("cellHeaderMousedown",u,e)}),this.handleBodyEvent(o,s,this.ctx.body.renderRows,u=>{this.ctx.setFocusCell(u),this.ctx.focusCellHeader=void 0,this.ctx.emit("cellMousedown",u,e)}))}),this.ctx.on("mouseup",e=>{if(e.button!==0||this.isBusy(e))return;const{offsetY:t,offsetX:i}=this.ctx.getOffset(e),s=t,o=i;this.handleHeaderEvent(o,s,this.ctx.header.renderCellHeaders,n=>{this.ctx.focusCellHeader=n,this.ctx.emit("cellHeaderMouseup",n,e)}),this.handleBodyEvent(o,s,this.ctx.body.renderRows,n=>{this.ctx.setFocusCell(n),this.ctx.emit("cellMouseup",n,e)})}),this.ctx.on("click",e=>{if(e.button!==0||this.isBusy(e))return;const t=this.ctx.getOffset(e).offsetY,i=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(i,t,this.ctx.header.renderCellHeaders,s=>{this.ctx.clickCellHeader=s,this.ctx.emit("cellHeaderClick",s,e),this.selectionClick(s,e),this.sortClick(s,e)}),this.handleBodyEvent(i,t,this.ctx.body.renderRows,s=>{this.ctx.clickCell=s,this.ctx.emit("cellClick",s,e),this.selectionClick(s,e),this.treeClick(s,e)},!0),this.handleBodyEvent(i,t,this.ctx.body.renderRows,s=>{this.hoverIconClick(s)},!1)}),this.ctx.on("dblclick",e=>{if(e.button!==0||this.isBusy(e))return;const t=this.ctx.getOffset(e).offsetY,i=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(i,t,this.ctx.header.renderCellHeaders,s=>{this.ctx.emit("cellHeaderDblclick",s,e)}),this.handleBodyEvent(i,t,this.ctx.body.renderRows,s=>{this.ctx.clickCell=s,this.ctx.emit("cellDblclick",s,e)})}),this.ctx.on("contextMenu",e=>{if(this.isBusy(e))return;const{offsetY:t,offsetX:i}=this.ctx.getOffset(e),s=t,o=i;this.handleHeaderEvent(o,s,this.ctx.header.renderCellHeaders,n=>{this.ctx.emit("cellHeaderContextMenuClick",n,e)}),this.handleBodyEvent(o,s,this.ctx.body.renderRows,n=>{this.ctx.emit("cellContextMenuClick",n,e)})}),this.ctx.on("mouseout",e=>{!this.ctx.containerElement.contains(e.relatedTarget)&&this.ctx.hoverCell!==void 0&&(this.ctx.hoverRow=void 0,this.ctx.hoverCell=void 0,this.ctx.emit("draw"))}),this.ctx.on("mousemove",e=>{if(this.isBusy(e))return;this.ctx.isPointer=!1,this.ctx.stageElement.style.cursor==="pointer"&&(this.ctx.stageElement.style.cursor="default");const t=this.ctx.getOffset(e).offsetY,i=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(i,t,this.ctx.header.renderCellHeaders,s=>{this.ctx.emit("cellHeaderMouseenter",s,e),this.ctx.hoverCellHeader&&this.ctx.hoverCellHeader!==s&&this.ctx.emit("cellHeaderMouseleave",this.ctx.hoverCellHeader,e),this.imageEnterAndLeave(s,e),this.ctx.hoverCellHeader!==s&&(this.ctx.hoverCellHeader=s,this.visibleHoverCell=void 0,this.ctx.emit("cellHeaderHoverChange",s,e))}),this.handleBodyEvent(i,t,this.ctx.body.renderRows,s=>{this.imageEnterAndLeave(s,e),this.visibleHoverCell!==s&&(this.ctx.emit("visibleCellMouseleave",s,e),this.visibleHoverCell=s,this.ctx.hoverCellHeader=void 0,this.ctx.emit("visibleCellHoverChange",s,e))},!0),this.handleBodyEvent(i,t,this.ctx.body.renderRows,s=>{var o;this.imageEnterAndLeave(s,e),this.ctx.emit("cellMouseenter",s,e),this.ctx.hoverCell&&this.ctx.hoverCell!==s&&this.ctx.emit("cellMouseleave",s,e),this.ctx.hoverCell!==s&&(((o=this.ctx.hoverCell)==null?void 0:o.rowKey)!==s.rowKey&&(this.ctx.hoverCell=s,this.ctx.hoverRow=this.ctx.body.renderRows.find(n=>n.rowKey===s.rowKey),this.ctx.emit("rowHoverChange",this.ctx.hoverRow,s,e),this.ctx.emit("draw")),this.ctx.hoverCell=s,this.ctx.emit("cellHoverChange",s,e))}),this.handleFooterEvent(i,t,this.ctx.footer.renderRows,s=>{this.ctx.emit("cellFooterMouseenter",s,e),this.ctx.hoverCell&&this.ctx.hoverCell!==s&&this.ctx.emit("cellFooterMouseleave",s,e),this.ctx.emit("cellFooterHoverChange",s,e)})})}hoverIconClick(e){e.hoverIconName&&this.ctx.isPointer&&this.ctx.emit("hoverIconClick",e)}selectionClick(e,t){if(!(["selection","index-selection","selection-tree","tree-selection"].includes(e.type)&&this.ctx.isPointer))return;const{offsetY:i,offsetX:s}=this.ctx.getOffset(t),o=i,n=s;if(this.isInsideElement(n,o,e.drawSelectionImageX,e.drawSelectionImageY,e.drawSelectionImageWidth,e.drawSelectionImageHeight))if(e instanceof vr)e.drawSelectionImageName==="checkbox-uncheck"||e.drawSelectionImageName==="checkbox-indeterminate"?this.ctx.database.toggleAllSelection():e.drawSelectionImageName==="checkbox-check"&&this.ctx.database.clearSelection(!0);else{if(!this.ctx.database.getRowSelectable(e.rowKey))return;this.ctx.database.toggleRowSelection(e.rowKey,e.type)}}treeClick(e,t){if(!(["tree","selection-tree","tree-selection"].includes(e.type)&&this.ctx.isPointer))return;const{offsetY:i,offsetX:s}=this.ctx.getOffset(t),o=i,n=s;if(!this.isInsideElement(n,o,e.drawTreeImageX,e.drawTreeImageY,e.drawTreeImageWidth,e.drawTreeImageHeight))return;const a=this.ctx.database.getRowForRowKey(e.rowKey),{expand:c=!1,expandLazy:d=!1}=a||{},{EXPAND_LAZY:f,EXPAND_LAZY_METHOD:u}=this.ctx.config;if(f&&u&&!c&&!d)typeof u=="function"&&(this.ctx.database.expandLoading(e.rowKey,!0),u({row:e.row,rowIndex:e.rowIndex,colIndex:e.colIndex,column:e.column,value:e.getValue()}).then(g=>{this.ctx.database.setExpandChildren(e.rowKey,g),this.ctx.database.expandLoading(e.rowKey,!1),this.ctx.emit("expandChange",this.ctx.database.getExpandRowKeys())}).catch(g=>{this.ctx.database.expandLoading(e.rowKey,!1),console.error(g)}));else{const g=this.ctx.database.getIsExpand(e.rowKey);this.ctx.database.expandItem(e.rowKey,!g),this.ctx.emit("expandChange",this.ctx.database.getExpandRowKeys())}}sortClick(e,t){const{offsetY:i,offsetX:s}=this.ctx.getOffset(t),o=i,n=s;if(!this.isInsideElement(n,o,e.drawSortImageX,e.drawSortImageY,e.drawSortImageWidth,e.drawSortImageHeight))return;const a=this.ctx.database.getSortState(e.key);let c;a.direction==="none"?c="asc":a.direction==="asc"?c="desc":c="none",this.ctx.database.setSortState(e.key,c)}imageEnterAndLeave(e,t){const{offsetY:i,offsetX:s}=this.ctx.getOffset(t),o=i,n=s;if(e instanceof vr){if(e.drawSelectionImageSource&&this.isInsideElement(n,o,e.drawSelectionImageX,e.drawSelectionImageY,e.drawSelectionImageWidth,e.drawSelectionImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}if(e.drawSortImageSource&&this.isInsideElement(n,o,e.drawSortImageX,e.drawSortImageY,e.drawSortImageWidth,e.drawSortImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}}if(e instanceof Pr){if(e.drawSelectionImageSource&&this.isInsideElement(n,o,e.drawSelectionImageX,e.drawSelectionImageY,e.drawSelectionImageWidth,e.drawSelectionImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0,this.ctx.database.getRowSelectable(e.rowKey)||(this.ctx.stageElement.style.cursor="not-allowed");return}if(e.drawHoverImageSource&&this.isInsideElement(n,o,e.drawHoverImageX,e.drawHoverImageY,e.drawHoverImageWidth,e.drawHoverImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}if(e.drawTreeImageSource&&this.isInsideElement(n,o,e.drawTreeImageX,e.drawTreeImageY,e.drawTreeImageWidth,e.drawTreeImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}}}isInsideElement(e,t,i,s,o,n){return e>i&&e<i+o&&t>s&&t<s+n}isBusy(e){const{offsetY:t,offsetX:i}=this.ctx.getOffset(e),s=t,o=i;if(this.ctx.loading||!this.ctx.isTarget(e)||this.ctx.stageElement.style.cursor==="row-resize"||this.ctx.stageElement.style.cursor==="col-resize"||this.ctx.columnResizing||this.ctx.rowResizing)return!0;const{SCROLLER_TRACK_SIZE:n}=this.ctx.config;return!!(this.ctx.scrollerMove||this.ctx.scrollerFocus||s>this.ctx.stageHeight-n||o>this.ctx.stageWidth-n)}handleBodyEvent(e,t,i,s,o=!1){if(this.isInsideBody(t))for(const n of i){const a=n.fixedCells.concat(n.noFixedCells);for(const c of a){const d=c.getDrawX(),f=c.getDrawY();if(o){if(e>d&&e<d+c.visibleWidth&&t>f&&t<f+c.visibleHeight){s(c);return}}else if(e>d&&e<d+c.width&&t>f&&t<f+c.height){s(c);return}}}}handleHeaderEvent(e,t,i,s){for(const o of i){const n=o.getDrawX(),a=o.getDrawY();if(e>n&&e<n+o.width&&t>a&&t<a+o.height){s(o);return}}}handleFooterEvent(e,t,i,s,o=!1){for(const n of i){const a=n.fixedCells.concat(n.noFixedCells);for(const c of a){const d=c.getDrawX(),f=c.getDrawY();if(o){if(e>d&&e<d+c.visibleWidth&&t>f&&t<f+c.visibleHeight){s(c);return}}else if(e>d&&e<d+c.width&&t>f&&t<f+c.height){s(c);return}}}}isInsideBody(e){return e>this.ctx.body.y&&e<this.ctx.body.y+this.ctx.body.visibleHeight}destroy(){this.resizeObserver.unobserve(this.ctx.stageElement),this.mutationObserver.disconnect()}}class WC{constructor(e,t){h(this,"eventBus"),h(this,"eventBrowser"),h(this,"eventTable"),h(this,"containerElement"),h(this,"stageElement"),h(this,"canvasElement"),h(this,"overlayerElement"),h(this,"editorElement"),h(this,"emptyElement"),h(this,"contextMenuElement"),h(this,"loadingElement"),h(this,"stageWidth",0),h(this,"stageHeight",0),h(this,"paint"),h(this,"icons"),h(this,"domSelectionStr",""),h(this,"isMouseoverTargetContainer",!1),h(this,"mousedown",!1),h(this,"isPointer",!1),h(this,"isEmpty",!1),h(this,"rowResizing",!1),h(this,"columnResizing",!1),h(this,"scrollerMove",!1),h(this,"scrollerFocus",!1),h(this,"autofillMove",!1),h(this,"selectorMove",!1),h(this,"disableHoverIconClick",!1),h(this,"selectColsIng",!1),h(this,"selectRowsIng",!1),h(this,"dragHeaderIng",!1),h(this,"finding",!1),h(this,"adjustPositioning",!1),h(this,"contextMenuIng",!1),h(this,"editing",!1),h(this,"loading",!1),h(this,"onlyMergeCell",!1),h(this,"selectOnlyOne",!1),h(this,"hasSelection",!1),h(this,"hasTree",!1),h(this,"scrollY",0),h(this,"scrollX",0),h(this,"fixedLeftWidth",0),h(this,"fixedRightWidth",0),h(this,"lastCenterColIndex",0),h(this,"maxColIndex",0),h(this,"maxRowIndex",0),h(this,"hoverRow"),h(this,"clickCell"),h(this,"focusCell"),h(this,"currentCell"),h(this,"hoverCell"),h(this,"clickCellHeader"),h(this,"focusCellHeader"),h(this,"hoverCellHeader"),h(this,"mouseX",0),h(this,"mouseY",0),h(this,"body",{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,headIndex:0,tailIndex:0,visibleRows:[],renderRows:[],data:[]}),h(this,"footer",{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,renderRows:[]}),h(this,"header",{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,visibleLeafColumns:[],leafCellHeaders:[],allCellHeaders:[],renderLeafCellHeaders:[],renderCellHeaders:[],fixedLeftCellHeaders:[],fixedRightCellHeaders:[],renderCenterCellHeaders:[]}),h(this,"selector",{enable:!1,xArr:[-1,-1],yArr:[-1,-1],xArrCopy:[-1,-1],yArrCopy:[-1,-1]}),h(this,"autofill",{enable:!1,xArr:[-1,-1],yArr:[-1,-1]}),h(this,"finderBar",{text:"",rowIndex:-1,colIndex:-1,type:"body"}),h(this,"database"),h(this,"history"),h(this,"config");const{containerElement:i,stageElement:s,canvasElement:o,overlayerElement:n,editorElement:a,emptyElement:c,loadingElement:d,contextMenuElement:f}=e;this.containerElement=i,s.tabIndex=0,this.stageElement=s,this.canvasElement=o,this.overlayerElement=n,this.editorElement=a,this.emptyElement=c,this.loadingElement=d,this.contextMenuElement=f,this.config=new Mo(t.config||{}),this.eventBus=new HC,this.eventBrowser=new BC(this),this.eventTable=new VC(this),this.paint=new FC(this.canvasElement),this.database=new AC(this,t),this.history=new NC(this),this.icons=new YC(this)}setConfig(e){this.config=new Mo(e)}setItemValueByEditor(e,t,i,s=!0,o=!0,n=!0){if(this.config.ENABLE_MERGE_CELL_LINK){const a=this.database.getVirtualBodyCellByKey(e,t);if(a&&(a.mergeRow||a.mergeCol)){const{dataList:c}=a.getSpanInfo(),d=c.map(f=>({...f,value:i}));this.database.batchSetItemValue(d,s,n);return}}this.database.setItemValue(e,t,i,s,o,!0,n)}batchSetItemValueByEditor(e,t=!0,i=!0){if(this.config.ENABLE_MERGE_CELL_LINK){const s=[];e.forEach(o=>{const n=this.database.getRowIndexForRowKey(o.rowKey),a=this.database.getColIndexForKey(o.key);if(n===void 0||a===void 0)return;const c=this.database.getVirtualBodyCell(n,a);if(c){const{dataList:d}=c.getSpanInfo(),f=d.map(u=>({...u,value:o.value}));s.push(...f)}}),this.database.batchSetItemValue(s,t,i)}else this.database.batchSetItemValue(e,t,i)}setFocusCell(e){var t;if(this.focusCell!==e){if(((t=this.focusCell)==null?void 0:t.rowKey)!==e.rowKey){this.currentCell=e,this.emit("rowFocusChange",e);const i={rowIndex:e.rowIndex,rowKey:e.rowKey,row:e.row};this.emit("currentRowChange",i)}this.focusCell=e,this.emit("cellFocusChange",e)}}clearSelector(){this.selector.enable=!1,this.selector.xArr=[-1,-1],this.selector.yArr=[-1,-1],this.emit("clearSelector")}clearSelectorCopy(){this.selector.xArrCopy=[-1,-1],this.selector.yArrCopy=[-1,-1]}clearAutofill(){this.autofill={enable:!1,xArr:[-1,-1],yArr:[-1,-1]}}getSelectedData(){const e=[],t=this.selector.yArr,i=this.selector.xArr;let s="";for(let o=0;o<=t[1]-t[0];o++){const n=[];for(let a=0;a<=i[1]-i[0];a++){const c=o+t[0],d=a+i[0],f=this.database.getVirtualBodyCell(c,d);f&&(f.selectorCellValueType==="displayText"?n.push(f.displayText):n.push(f.getValue()))}s+=`${n.join(" ")}\r`,e.push(n)}return s=s?s.replace(/\r$/,""):" ",{xArr:i,yArr:t,text:s,value:e}}setScroll(e,t){let i=Math.floor(e);const s=this.body.width-this.body.visibleWidth;i<0?i=0:i>s&&(i=s);let o=Math.floor(t),n=this.body.height-this.body.visibleHeight;this.config.FOOTER_FIXED||(n=this.body.height+this.footer.height-this.body.visibleHeight),o<0?o=0:o>n&&(o=n),this.emit("setScroll",i,o)}setScrollX(e){let t=Math.floor(e);const i=this.body.width-this.body.visibleWidth;t<0?t=0:t>i&&(t=i),this.emit("setScrollX",t)}setScrollY(e){let t=Math.floor(e),i=0;this.config.FOOTER_FIXED||(i=this.footer.height);const s=this.body.height-this.body.visibleHeight+i;t<0?t=0:t>s&&(t=s),this.emit("setScrollY",t)}startAdjustPosition(e){this.emit("startAdjustPosition",e)}stopAdjustPosition(){this.emit("stopAdjustPosition")}isTarget(e){return!!this.containerElement.contains(e.target)}getOffset(e){const{left:t,top:i}=this.containerElement.getBoundingClientRect();return{offsetX:e.clientX-t,offsetY:e.clientY-i}}hasEvent(e){return this.eventBus.has(e)}on(e,t){this.eventBus.on(e,t)}once(e,t){this.eventBus.once(e,t)}off(e,t){this.eventBus.off(e,t)}emit(e,...t){this.eventBus.emit(e,...t)}destroy(){this.eventTable.destroy(),this.eventBrowser.destroy(),this.eventBus.destroy()}}class Bo{constructor(e,t){h(this,"ctx"),h(this,"type"),h(this,"isFocus",!1),h(this,"trackX",0),h(this,"trackY",0),h(this,"trackWidth",0),h(this,"trackHeight",0),h(this,"splitPoints",[]),h(this,"barX",0),h(this,"barY",0),h(this,"barWidth",0),h(this,"barHeight",0),h(this,"distance",0),h(this,"visibleDistance",0),h(this,"clientX",0),h(this,"clientY",0),h(this,"dragStart",0),h(this,"isDragging",!1),h(this,"scroll",0),this.ctx=e,this.type=t,this.type==="vertical"?this.scroll=this.ctx.scrollY:this.scroll=this.ctx.scrollX}onWheel(e){this.updateScroll(e)}onTouchmove(e){const{clientY:t,clientX:i}=e.touches[0],s=t-this.clientY,o=i-this.clientX;let n=0;this.type==="vertical"?(n=Math.max(0,Math.min(this.dragStart-s,this.distance)),this.hasScrollbar()&&!(n===0&&s>0||n===this.distance&&s<0)&&e.preventDefault()):this.type==="horizontal"&&(n=Math.max(0,Math.min(this.dragStart-o,this.distance))),this.scroll=n}onTouchstart(e){const{clientY:t,clientX:i}=e.touches[0];this.clientX=i,this.clientY=t,this.dragStart=this.scroll}onMouseDown(e){if(!(e.target instanceof Element)||!this.ctx.isTarget(e))return;if(this.ctx.stageElement.style.cursor==="row-resize"||this.ctx.stageElement.style.cursor==="col-resize")return!0;const{offsetX:t,offsetY:i,clientX:s,clientY:o}=e;if(!(s==this.clientX&&o==this.clientY)){if(this.isOnScrollbar(t,i))this.clientX=s,this.clientY=o,this.isDragging=!0,this.ctx.scrollerMove=!0,this.isFocus=!0,this.dragStart=this.scroll,e.preventDefault();else if(this.isOnTrack(t,i)){let n=0;this.type==="vertical"?n=(i-this.ctx.header.height-this.barHeight/2)/(this.visibleDistance-this.barHeight)*this.distance:n=(t-this.barWidth/2)/(this.visibleDistance-this.barWidth)*this.distance,this.scroll=Math.max(0,Math.min(n,this.distance))}}}onMouseUp(){this.isDragging=!1,this.isFocus=!1,this.clientX=0,this.clientY=0}onMouseMove(e){const{offsetX:t,offsetY:i,clientX:s,clientY:o,buttons:n}=e;if(this.isOnScrollbar(t,i)&&e.target===this.ctx.canvasElement?this.isFocus=!0:this.isFocus=!1,n===0||s==this.clientX&&o==this.clientY)return;let a=0;if(this.type==="horizontal"?a=s-this.clientX:a=o-this.clientY,this.isDragging&&a!==0){let c=0;this.type==="vertical"?c=this.dragStart+a/(this.visibleDistance-this.barHeight)*this.distance:c=this.dragStart+a/(this.visibleDistance-this.barWidth)*this.distance,this.scroll=Math.max(0,Math.min(c,this.distance))}}isPointInElement(e,t,i,s,o,n){return e>=i&&e<=i+o&&t>=s&&t<=s+n}hasScrollbar(){return this.type==="vertical"?this.barHeight>0:this.type==="horizontal"?this.barWidth>0:!1}isOnScrollbar(e,t){return this.isPointInElement(e,t,this.barX,this.barY,this.barWidth,this.barHeight)}isOnTrack(e,t){return this.isPointInElement(e,t,this.trackX,this.trackY,this.trackWidth,this.trackHeight)}updateScroll(e){const t=e.deltaX,i=e.deltaY;this.type==="vertical"&&e.shiftKey===!1?(this.hasScrollbar()&&!(this.scroll===0&&i<0||this.scroll===this.distance&&i>0)&&e.preventDefault(),this.scroll=Math.max(0,Math.min(this.scroll+i,this.distance))):this.type==="horizontal"&&(e.shiftKey?this.scroll=Math.max(0,Math.min(this.scroll+i,this.distance)):this.scroll=Math.max(0,Math.min(this.scroll+t,this.distance)))}updatedSize(){const{body:e,header:t,stageHeight:i,stageWidth:s,config:{SCROLLER_TRACK_SIZE:o=0,SCROLLER_SIZE:n=0,BORDER:a}}=this.ctx,c=s,d=i,f=t.height,u=t.width,g=e.height,m=this.ctx.footer.height;if(this.type==="vertical"){this.visibleDistance=d-o-f,this.distance=g-this.visibleDistance+m,this.trackX=c-o,this.trackY=0,this.splitPoints=[this.trackX,f,this.trackX+o,f],this.trackWidth=o,this.trackHeight=d,this.barX=this.trackX-1+(o-n)/2,this.barWidth=n;const x=this.distance?this.visibleDistance/(g+m):0;let v=Math.floor(x*this.visibleDistance);v<30?v=30:v>this.visibleDistance&&(v=0),this.barHeight=v,this.barY=f+this.scroll/this.distance*(this.visibleDistance-this.barHeight),this.scroll=Math.max(0,Math.min(this.scroll,this.distance))}else{this.visibleDistance=c-o,this.distance=u-this.visibleDistance,this.splitPoints=[c-o,d-o,c-o,d];const x=a?0:.5;this.trackX=0,this.trackY=d-o+x,this.trackWidth=c,this.trackHeight=o;const v=this.distance?this.visibleDistance/u:0;let p=Math.floor(v*this.visibleDistance);this.barY=this.trackY-1+(o-n)/2,p<30?p=30:p>=this.visibleDistance&&(p=0),this.barWidth=p,this.barHeight=n,this.barX=this.scroll/this.distance*(this.visibleDistance-this.barWidth),this.scroll=Math.max(0,Math.min(this.scroll,this.distance))}}draw(){const{config:{SCROLLER_FOCUS_COLOR:e,SCROLLER_COLOR:t,BORDER_COLOR:i,BORDER:s,SCROLLER_TRACK_COLOR:o}}=this.ctx;this.updatedSize();let n=i;s||(n="transparent"),this.ctx.paint.drawRect(this.trackX,this.trackY,this.trackWidth,this.trackHeight,{borderColor:n,fillColor:o}),this.ctx.paint.drawRect(this.barX,this.barY,this.barWidth,this.barHeight,{fillColor:this.isFocus||this.isDragging?e:t,radius:4}),this.splitPoints.length>0&&this.ctx.paint.drawLine(this.splitPoints,{borderColor:n,borderWidth:1}),this.ctx.scrollerFocus=this.isFocus}}class XC{constructor(e){h(this,"ctx"),h(this,"verticalScrollbar"),h(this,"horizontalScrollbar"),h(this,"mousedownHeader",!1),h(this,"adjustPositionX",""),h(this,"adjustPositionY",""),h(this,"timerX",0),h(this,"timerY",0),this.ctx=e,this.verticalScrollbar=new Bo(e,"vertical"),this.horizontalScrollbar=new Bo(e,"horizontal"),this.ctx.on("wheel",t=>this.onWheel(t)),this.ctx.on("mousedown",t=>this.onMouseDown(t)),this.ctx.on("mousemove",t=>this.onMouseMove(t)),this.ctx.on("mouseup",()=>this.onMouseUp()),this.ctx.on("touchmove",t=>this.onTouchmove(t)),this.ctx.on("touchstart",t=>{this.onTouchstart(t)}),this.ctx.on("setScroll",(t,i)=>{this.setScroll(t,i)}),this.ctx.on("setScrollX",t=>{this.setScrollX(t)}),this.ctx.on("setScrollY",t=>{this.setScrollY(t)}),this.ctx.on("scrollToIndex",(t,i)=>{this.scrollToIndex(t,i)}),this.ctx.on("cellHeaderMousedown",()=>{this.mousedownHeader=!0}),this.ctx.on("startAdjustPosition",t=>{this.startAdjustPosition(t)}),this.ctx.on("stopAdjustPosition",()=>{this.stopAdjustPosition()})}onWheel(e){this.verticalScrollbar.onWheel(e),this.horizontalScrollbar.onWheel(e),this.draw()}onTouchmove(e){this.verticalScrollbar.onTouchmove(e),this.horizontalScrollbar.onTouchmove(e),this.draw()}onTouchstart(e){this.verticalScrollbar.onTouchstart(e),this.horizontalScrollbar.onTouchstart(e),this.draw()}onMouseDown(e){this.verticalScrollbar.onMouseDown(e),this.horizontalScrollbar.onMouseDown(e),this.draw()}onMouseMove(e){this.verticalScrollbar.onMouseMove(e),this.horizontalScrollbar.onMouseMove(e),this.draw()}onMouseUp(){this.mousedownHeader=!1,this.verticalScrollbar.onMouseUp(),this.horizontalScrollbar.onMouseUp(),this.ctx.scrollerMove=!1}draw(){this.verticalScrollbar.draw(),this.horizontalScrollbar.draw();const e=Math.floor(this.horizontalScrollbar.scroll),t=Math.floor(this.verticalScrollbar.scroll);(e!==this.ctx.scrollX||t!==this.ctx.scrollY)&&(this.ctx.emit("onScroll",e,t),e!==this.ctx.scrollX&&this.ctx.emit("onScrollX",e),t!==this.ctx.scrollY&&this.ctx.emit("onScrollY",t),this.ctx.scrollX=e,this.ctx.scrollY=t,this.ctx.emit("draw"))}setScroll(e,t){this.horizontalScrollbar.scroll=e,this.verticalScrollbar.scroll=t,this.ctx.emit("draw"),this.ctx.emit("onScroll",e,t)}setScrollX(e){this.horizontalScrollbar.scroll=e,this.ctx.emit("draw")}setScrollY(e){this.verticalScrollbar.scroll=e,this.ctx.emit("draw")}scrollToColkey(e){const{header:t}=this.ctx,i=t.leafCellHeaders.find(s=>s.key===e);i&&this.setScrollX(i.x-t.visibleWidth/2)}scrollToColIndex(e){const{header:t}=this.ctx,i=t.leafCellHeaders.find(s=>s.colIndex===e);i&&this.setScrollX(i.x-t.visibleWidth/2)}scrollToRowIndex(e){const{body:t,database:i}=this.ctx,{top:s}=i.getPositionForRowIndex(e);this.setScrollY(s-t.visibleHeight/2)}scrollToIndex(e,t){this.scrollToRowIndex(e),this.scrollToColIndex(t)}scrollToRowKey(e){const{body:t,database:i}=this.ctx,s=i.getRowIndexForRowKey(e);if(s===void 0)return;const{top:o}=i.getPositionForRowIndex(s);this.setScrollY(o-t.visibleHeight/2)}startAdjustPosition(e){var t,i;const{offsetX:s,offsetY:o}=this.ctx.getOffset(e);let n="",a="";if(((t=this.ctx.focusCell)==null?void 0:t.fixed)!=="left"&&s<this.ctx.fixedLeftWidth?n="left":((i=this.ctx.focusCell)==null?void 0:i.fixed)!=="right"&&s>this.ctx.body.visibleWidth-this.ctx.fixedRightWidth?n="right":(n="",this.stopAdjustPosition(!0,!1)),!this.mousedownHeader&&o<this.ctx.header.visibleHeight?a="top":o>this.ctx.header.visibleHeight+this.ctx.body.visibleHeight?a="bottom":(a="",this.stopAdjustPosition(!1,!0)),n&&this.adjustPositionX!==n){this.adjustPositionX=n;let c=10*(n==="left"?-1:1);this.timerX&&(clearInterval(this.timerX),this.timerX=0),this.timerX=setInterval(()=>{c*=1.5;const{scrollX:d}=this.ctx,f=d+c;(f<0||f>this.ctx.body.width)&&(clearInterval(this.timerX),this.timerX=0),this.ctx.setScrollX(f)},100)}if(a&&this.adjustPositionY!==a){this.adjustPositionY=a;let c=10*(a==="top"?-1:1);this.timerY&&(clearInterval(this.timerY),this.timerY=0),this.timerY=setInterval(()=>{c*=1.5;const{scrollY:d}=this.ctx,f=d+c;(f<0||f>this.ctx.body.height)&&(clearInterval(this.timerY),this.timerY=0),this.ctx.setScrollY(f)},100)}}stopAdjustPosition(e=!0,t=!0){e&&(this.adjustPositionX="",this.timerX&&(clearInterval(this.timerX),this.timerX=0)),t&&(this.adjustPositionY="",this.timerY&&(clearInterval(this.timerY),this.timerY=0))}}class zC{constructor(e,t){h(this,"root"),h(this,"key"),h(this,"childrenKey"),this.root=e,this.key=(t==null?void 0:t.key)||"key",this.childrenKey=(t==null?void 0:t.childrenKey)||"children"}getTree(){return this.root}treeMove(e,t,i){const s=this.findNodeWithParent(this.root,e[this.key]);if(!s)throw new Error("Source node not found");const{parent:o,index:n,node:a}=s;if(o){const u=o[this.childrenKey];u.splice(n,1),u.length===0&&delete o[this.childrenKey]}else this.root.splice(n,1);const c=this.findNodeWithParent(this.root,t[this.key]);if(!c)throw new Error("Target node not found");const{parent:d,index:f}=c;i==="before"?d?d[this.childrenKey].splice(f,0,a):this.root.splice(f,0,a):i==="after"&&(d?d[this.childrenKey].splice(f+1,0,a):this.root.splice(f+1,0,a))}findNodeWithParent(e,t,i=null){for(let s=0;s<e.length;s++){const o=e[s];if(o[this.key]===t)return{parent:i,index:s,node:o};if(o[this.childrenKey]){const n=this.findNodeWithParent(o[this.childrenKey],t,o);if(n)return n}}return null}}class GC{constructor(e){h(this,"ctx"),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"resizeTarget",null),h(this,"dragTarget",null),h(this,"dragingCell"),h(this,"dragCellDiff",0),h(this,"resizeNum",0),h(this,"isResizing",!1),h(this,"clientX",0),h(this,"resizeDiff",0),h(this,"columnIndex",0),h(this,"isMouseDown",!1),h(this,"columns"),h(this,"visibleColumns"),h(this,"visibleLeafColumns",[]),h(this,"visibleHeight",0),h(this,"visibleWidth",0),h(this,"allCellHeaders",[]),h(this,"leafCellHeaders",[]),h(this,"renderLeafCellHeaders",[]),h(this,"fixedLeftCellHeaders",[]),h(this,"centerCellHeaders",[]),h(this,"fixedRightCellHeaders",[]),h(this,"renderCenterCellHeaders",[]),h(this,"renderFixedCellHeaders",[]),this.ctx=e,this.ctx.on("resetHeader",Kr(()=>{this.init(),this.ctx.clearSelector(),this.ctx.emit("draw")},100)),this.init(),this.initResizeColumn(),this.initDragColumn()}init(e=!1){const{config:{HEADER_HEIGHT:t,SCROLLER_TRACK_SIZE:i}}=this.ctx;if(!e){const u=this.ctx.database.getColumns();this.columns=u}this.allCellHeaders=[],this.leafCellHeaders=[],this.fixedLeftCellHeaders=[],this.fixedRightCellHeaders=[],this.centerCellHeaders=[],this.visibleColumns=Za(this.columns);const s=pi(this.visibleColumns),o=Wt(this.visibleColumns);this.height=t*s,this.visibleHeight=this.height,this.width=o.reduce((u,g)=>{const m=g.width||100,{maxWidth:x,minWidth:v}=g;return x&&m>x?u+x:v&&m<v?u+v:u+m},0),this.columnIndex=0,this.resizeNum=0;const n=SC(yi(this.visibleColumns,s));this.render(n,0),this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);const a=this.ctx.containerElement.getBoundingClientRect();this.resizeNum>0?this.ctx.stageWidth=Math.floor(a.width):this.ctx.stageWidth=Math.min(Math.floor(this.width+i),Math.floor(a.width)),this.ctx.stageElement.style.width=this.ctx.stageWidth+"px",this.visibleWidth=this.ctx.stageWidth-i;const c=this.visibleWidth-this.width;if(this.resizeNum&&c>0){const u=Math.floor(c/this.resizeNum*100)/100;this.resizeAllColumn(u)}const d=this.fixedLeftCellHeaders.filter(u=>!u.hasChildren);this.ctx.fixedLeftWidth=d.reduce((u,g)=>u+g.width,0);const f=this.fixedRightCellHeaders.filter(u=>!u.hasChildren);this.ctx.fixedRightWidth=f.reduce((u,g)=>u+g.width,i),this.ctx.maxColIndex=this.leafCellHeaders.length-1,this.ctx.header.x=this.x,this.ctx.header.y=this.y,this.ctx.header.width=this.width,this.ctx.header.height=this.height,this.ctx.header.allCellHeaders=this.allCellHeaders,this.ctx.header.visibleWidth=this.visibleWidth,this.ctx.header.visibleHeight=this.visibleHeight}initResizeColumn(){this.ctx.on("mousedown",e=>{this.ctx.config.ENABLE_RESIZE_COLUMN&&this.ctx.isTarget(e)&&(this.clientX=e.clientX,this.resizeTarget?(this.isResizing=!0,this.ctx.columnResizing=!0):this.isResizing=!1,this.isMouseDown=!0)}),this.ctx.on("mouseup",()=>{this.ctx.config.ENABLE_RESIZE_COLUMN&&(this.isMouseDown=!1,this.resizeDiff!==0&&this.resizeTarget&&this.resizeColumn(this.resizeTarget,this.resizeDiff),this.resizeTarget=null,this.isResizing=!1,this.isMouseDown=!1,this.ctx.columnResizing=!1,this.clientX=0,this.resizeDiff=0)}),this.ctx.on("mousemove",e=>{if(!this.ctx.config.ENABLE_RESIZE_COLUMN||this.ctx.editing)return;const{stageWidth:t,config:{RESIZE_COLUMN_MIN_WIDTH:i}}=this.ctx;if(this.isResizing&&this.resizeTarget){const s=this.resizeTarget.width,o=this.resizeTarget.minWidth,n=this.resizeTarget.maxWidth;let a=e.clientX-this.clientX;a+s<i&&(a=-(s-i)),o&&a+s<o&&(a=-(s-o)),n&&a+s>n&&(a=n-s),this.resizeDiff=a,this.ctx.emit("draw")}else{if(this.resizeTarget=null,this.isMouseDown)return;if(e.offsetX<0||e.offsetX>this.visibleWidth){this.ctx.stageElement.style.cursor==="col-resize"&&(this.ctx.stageElement.style.cursor="default");return}this.ctx.stageElement.style.cursor==="col-resize"&&(this.ctx.stageElement.style.cursor="default");const s=[...this.renderFixedCellHeaders,...this.renderCenterCellHeaders];for(const o of s){const{offsetX:n,offsetY:a}=this.ctx.getOffset(e),c=n,d=a,f=o.getDrawX(),u=o.getDrawY();if(c>f+o.width-5&&c<f+o.width+4&&c<t-4&&d>u){const g=o.colIndex+o.colspan-1,m=this.leafCellHeaders.find(x=>x.colIndex===g);if(!m||!m.fixed&&this.ctx.stageWidth-this.ctx.fixedRightWidth<f+o.width)return;this.ctx.isTarget(e)&&a<=this.height&&(this.ctx.stageElement.style.cursor="col-resize",this.resizeTarget=m)}}}})}initDragColumn(){this.ctx.on("cellHeaderMousedown",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(e.column.dragDisabled||(this.dragTarget===e?(this.ctx.dragHeaderIng=!0,this.dragCellDiff=this.ctx.mouseX-e.drawX,this.ctx.stageElement.style.cursor="grabbing"):(this.dragTarget=e,this.ctx.dragHeaderIng=!1)))}),this.ctx.on("cellMousedown",()=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(this.dragTarget=null,this.ctx.dragHeaderIng=!1)}),this.ctx.on("mouseup",()=>{if(this.ctx.config.ENABLE_DRAG_COLUMN){if(this.dragingCell&&this.dragTarget){const e=(d,f={})=>(d.forEach((u,g)=>{u.children&&e(u.children,f),f[u.key]=g}),f),t=this.ctx.database.getColumns(),i=yi(t,pi(t)),s=new zC(i,{key:"key",childrenKey:"children"}),o=this.dragTarget.colIndex>this.dragingCell.colIndex?"before":"after";s.treeMove(this.dragTarget.column,this.dragingCell.column,o);const n=s.getTree(),a=e(n);this.ctx.database.setCustomHeader({sortData:a}),this.init();const c={source:this.dragTarget,target:this.dragingCell,columns:i};this.ctx.emit("columnDragChange",c)}this.ctx.dragHeaderIng&&this.dragTarget&&(this.ctx.dragHeaderIng=!1,this.dragTarget=null,this.dragingCell=void 0,this.dragCellDiff=0,this.ctx.clearSelector(),this.ctx.focusCellHeader=void 0,this.ctx.stageElement.style.cursor="default",this.ctx.emit("draw"))}}),this.ctx.on("mousemove",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(!this.ctx.dragHeaderIng||!this.dragTarget||(this.dragTarget.fixed||this.ctx.startAdjustPosition(e),this.ctx.emit("draw")))}),this.ctx.on("cellHoverChange",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(e.column.dragDisabled||(this.dragingCell=this.getDragCellHeader(e.colIndex)))}),this.ctx.on("cellHeaderHoverChange",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(e.column.dragDisabled||(this.dragingCell=this.getDragCellHeader(e.colIndex)))})}getDragCellHeader(e){if(!this.dragTarget||!this.ctx.dragHeaderIng)return;const{column:{parentKey:t},key:i,level:s,fixed:o}=this.dragTarget,n=this.allCellHeaders.find(a=>a.key!==i&&a.fixed===o&&a.column.level===s&&a.column.parentKey===t&&a.colIndex<=e&&a.colIndex+a.colspan-1>=e);if(this.ctx.dragHeaderIng){const a=n?"grabbing":"not-allowed";this.ctx.stageElement.style.cursor=a}return n}resizeColumn(e,t){const i=n=>{n.forEach(a=>{if(a.children&&a.children.length>0&&i(a.children),a.key===e.key){const c=a.width||100;a.width=c+t}})};i(this.columns);let s=0;if(this.width<this.visibleWidth){const n=this.visibleWidth-this.width;s=Math.floor(n/this.resizeNum*100)/100,this.resizeAllColumn(s)}const o=e.width+t+s;this.ctx.emit("resizeColumnChange",{colIndex:e.colIndex,key:e.key,oldWidth:e.width,width:o,column:e.column,columns:this.columns}),this.ctx.database.setCustomHeaderResizableData(e.key,o),this.init(!0),this.ctx.emit("draw")}resizeAllColumn(e){if(e===0)return;const t=new Map;let i=!0;for(const o of this.allCellHeaders)if(o.widthFillDisable)t.set(o.key,o.width);else{const n=o.width+e*o.colspan;t.set(o.key,n),n<this.ctx.config.RESIZE_COLUMN_MIN_WIDTH&&(i=!1)}if(!i)return;const s=o=>{o.forEach(n=>{t.has(n.key)&&(n.width=t.get(n.key)),n.children&&n.children.length>0&&s(n.children)})};s(this.columns),this.init(!0),this.ctx.emit("draw")}getCustomHeader(){const e=this.ctx.database.getColumns(),t=this.ctx.database.getCustomHeader(),{sortData:i={}}=t;return Object.keys(i).length===0?{columns:e,customHeader:t}:{columns:yi(e,pi(e)),customHeader:t}}render(e,t){const i=e.length;let s=t;const{HEADER_HEIGHT:o=0}=this.ctx.config;for(let n=0;n<i;n++){const a=e[n],c=o*(a.rowspan||0),d=o*(a.level||0);let{minWidth:f,maxWidth:u}=a,g=a.width||100;f&&g<f&&(g=f),u&&g>u&&(g=u),a.children&&(g=Wt(a.children).reduce((x,v)=>x+((v==null?void 0:v.width)||100),0));const m=new vr(this.ctx,this.columnIndex,s,d,g,c,a);this.ctx.database.setHeader(a.key,m),this.allCellHeaders.push(m),a.children||(this.leafCellHeaders.push(m),m.column.widthFillDisable||this.resizeNum++),a.fixed==="left"?this.fixedLeftCellHeaders.push(m):a.fixed==="right"?this.fixedRightCellHeaders.push(m):this.centerCellHeaders.push(m),!a.children&&this.columnIndex++,a.children&&this.render(a.children,s),s+=g}}drawTipLine(){if(this.isResizing&&this.resizeTarget){const{stageHeight:e,config:{RESIZE_COLUMN_LINE_COLOR:t,RESIZE_COLUMN_TEXT_COLOR:i,RESIZE_COLUMN_TEXT_BG_COLOR:s,ENABLE_RESIZE_COLUMN_TEXT:o}}=this.ctx,n=this.resizeTarget.getDrawX(),a=this.resizeTarget.width,c=n+a+this.resizeDiff-.5,d=[c-.5,0,c-.5,e];if(this.ctx.paint.drawLine(d,{borderColor:t}),o){const f=`${Math.floor(a+this.resizeDiff)}px`,u=45,g=24;this.ctx.paint.drawRect(c+u/2,this.ctx.mouseY-g/2,u,g,{fillColor:s,borderWidth:0,borderColor:"transparent"}),this.ctx.paint.drawText(f,c+u/2,this.ctx.mouseY-g/2,u,g+2,{padding:0,color:i,align:"center",verticalAlign:"middle"})}}}drawDragTip(){if(this.dragTarget&&this.ctx.dragHeaderIng){const{DRAG_TIP_BG_COLOR:e,DRAG_TIP_LINE_COLOR:t}=this.ctx.config,i=this.dragTarget.width;if(this.ctx.paint.drawRect(this.ctx.mouseX-this.dragCellDiff,this.visibleHeight,i,this.ctx.body.visibleHeight,{fillColor:e,borderWidth:0,borderColor:"transparent"}),this.dragingCell){const{drawX:s,drawY:o,visibleWidth:n,colIndex:a}=this.dragingCell;let c=s,d=o;a>this.dragTarget.colIndex&&(c=s+n),a===0&&(c=c+1),a===this.ctx.maxColIndex&&(c=c-1);const f=[c,d,c,this.ctx.stageHeight],u=[c-4,d,c+4,d,c,d+6,c-4,d];this.ctx.paint.drawLine(u,{borderColor:t,borderWidth:1.2,fillColor:t}),this.ctx.paint.drawLine(f,{borderColor:t,borderWidth:1.2})}}}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:i,header:s,stageWidth:o,config:{HEADER_BG_COLOR:n,SCROLLER_TRACK_SIZE:a}}=this.ctx;if(i>0&&e!==0&&this.ctx.paint.drawShadow(this.x,this.y,e,this.height,{fillColor:n,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),i<Math.floor(s.width-o-1)&&t!==a){const c=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(c,this.y,t,this.height,{fillColor:n,side:"left",shadowWidth:4,colorStart:"rgba(0,0,0,0)",colorEnd:"rgba(0,0,0,0.1)"})}}update(){const e=[],t=[],i=[];if(this.centerCellHeaders.length){const s=this.centerCellHeaders[this.centerCellHeaders.length-1];this.ctx.lastCenterColIndex=s.colIndex}this.centerCellHeaders.forEach(s=>{s.isHorizontalVisible()&&s.isVerticalVisible()&&(t.push(s),s.hasChildren||e.push(s))}),this.fixedLeftCellHeaders.forEach(s=>{i.push(s),s.hasChildren||e.push(s)}),this.fixedRightCellHeaders.forEach(s=>{i.push(s),s.hasChildren||e.push(s)}),this.renderCenterCellHeaders=t,this.renderFixedCellHeaders=i,this.renderLeafCellHeaders=e.sort((s,o)=>s.x-o.x),this.visibleLeafColumns=this.renderLeafCellHeaders.map(s=>s.column),this.ctx.header.visibleLeafColumns=this.visibleLeafColumns,this.ctx.header.leafCellHeaders=this.leafCellHeaders,this.ctx.header.renderLeafCellHeaders=this.renderLeafCellHeaders,this.ctx.header.renderCellHeaders=this.renderFixedCellHeaders.concat(this.renderCenterCellHeaders)}drawBottomLine(){const{stageWidth:e,config:{BORDER_COLOR:t}}=this.ctx,i=[0,this.height,e,this.height];this.ctx.paint.drawLine(i,{borderColor:t,borderWidth:1})}draw(){this.renderCenterCellHeaders.forEach(e=>{e.update(),e.draw()}),this.drawFixedShadow(),this.renderFixedCellHeaders.forEach(e=>{e.update(),e.draw()}),this.drawBottomLine(),this.drawTipLine(),this.drawDragTip()}}class tl{constructor(e,t,i=0,s=0,o=0,n=0,a,c="body"){h(this,"ctx"),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height"),h(this,"cells",[]),h(this,"fixedCells",[]),h(this,"noFixedCells",[]),h(this,"calculatedHeightCells",[]),h(this,"rowIndex",0),h(this,"rowKey",""),h(this,"rowType","body"),h(this,"data"),h(this,"calculatedHeight",-1),this.ctx=e,this.x=i,this.y=s,this.width=o,this.height=n,this.rowIndex=t,this.rowKey=e.database.getRowKeyForRowIndex(t)||"",this.rowType=c,this.data=a,this.update()}update(){const{header:e}=this.ctx,t=[],i=[],s=[],o=[];e.renderLeafCellHeaders.forEach(n=>{const a=new Pr(this.ctx,this.rowIndex,n.colIndex,n.x,this.y,n.width,this.height,n.column,this.data,this.rowType);a.fixed?i.push(a):s.push(a),t.push(a),a.autoRowHeight&&o.push(a)}),this.cells=t,this.calculatedHeightCells=o,this.fixedCells=i,this.noFixedCells=s}updateCalculatedHeight(){const e=this.calculatedHeightCells.map(t=>{const i=t.getAutoHeight(),{key:s,height:o=-1}=this.ctx.database.getMaxRowHeightItem(this.rowKey)||{};return i>o?this.ctx.database.setMaxRowHeightItem(this.rowKey,t.key,i):i!==0&&t.key===s&&i<o&&this.ctx.database.setMaxRowHeightItem(this.rowKey,t.key,i),i});return this.calculatedHeight=e.length?Math.max(...e):-1,this.calculatedHeight}drawCenter(){this.noFixedCells.forEach(e=>{e.draw()})}drawFixed(){this.fixedCells.forEach(e=>{e.draw()})}drawContainer(){this.noFixedCells.forEach(e=>{e.drawContainer()})}drawFixedContainer(){this.fixedCells.forEach(e=>{e.drawContainer()})}}class UC{constructor(e){h(this,"resizeTarget",null),h(this,"isMouseDown",!1),h(this,"resizeDiff",0),h(this,"clientY",0),h(this,"ctx"),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"headIndex",0),h(this,"tailIndex",0),h(this,"isResizing",!1),h(this,"renderRows",[]),h(this,"visibleRows",[]),h(this,"visibleHeight",0),h(this,"visibleWidth",0),h(this,"containerRect"),h(this,"data",[]),this.ctx=e,this.init(),this.initResizeRow()}init(){const{canvasElement:e,header:t,footer:i,database:s,config:{FOOTER_FIXED:o,SCROLLER_TRACK_SIZE:n=0,HEIGHT:a,EMPTY_BODY_HEIGHT:c=0,MAX_HEIGHT:d=0,ENABLE_OFFSET_HEIGHT:f=0,OFFSET_HEIGHT:u=0,FOOTER_POSITION:g}}=this.ctx;if(!t.width)return;this.x=0,g==="top"&&o?this.y=t.height+i.height:this.y=t.height;const{data:m,sumHeight:x}=s.getData();this.height=x,this.data=m,this.width=t.width,this.visibleWidth=this.ctx.stageWidth-n;const v=this.ctx.footer.height;this.ctx.isEmpty=!this.data.length,!this.data.length&&!a?this.height=c:!this.data.length&&a&&(this.height=a-t.height-v-n);let p=this.height+t.height+n;p+=v;let E=p;const C=window.innerHeight,{top:w}=this.containerRect||this.ctx.containerElement.getBoundingClientRect();if(C>w&&f&&!a){const O=C-w-u;O>t.height+n?E=O:p>d&&(E=d)}else this.data.length&&a?E=a:this.data.length&&d&&p>d&&(E=d);E>0&&(this.ctx.stageHeight=Math.floor(E),this.ctx.stageElement.style.height=`${this.ctx.stageHeight}px`);let _=this.ctx.stageHeight-t.height-n;o?this.visibleHeight=_-v:this.visibleHeight=_,this.data.length||(this.height=this.visibleHeight),this.ctx.body.x=this.x,this.ctx.body.y=this.y,this.ctx.body.width=this.width,this.ctx.body.height=this.height,this.ctx.body.visibleWidth=this.visibleWidth,this.ctx.body.visibleHeight=this.visibleHeight,this.ctx.body.data=m;const S=window.devicePixelRatio||1,B=this.ctx.stageWidth*S,K=this.ctx.stageHeight*S;e.width=Math.round(B),e.height=Math.round(K);const R=this.data.length?"not-empty":"empty";this.ctx.emit("emptyChange",{isEmpty:R,type:R,headerHeight:t.height,bodyHeight:this.height,footerHeight:v,width:this.width,height:this.data.length?0:c+v});const I=Math.round(e.width/S*1e4)/1e4,b=Math.round(e.height/S*1e4)/1e4;this.ctx.canvasElement.setAttribute("style",`height:${b}px;width:${I}px;`),this.ctx.paint.scale(S)}initResizeRow(){this.ctx.on("resize",()=>{this.ctx.config.ENABLE_RESIZE_ROW&&(this.containerRect=this.ctx.containerElement.getBoundingClientRect())}),this.ctx.on("resizeObserver",()=>{this.ctx.config.ENABLE_RESIZE_ROW&&(this.containerRect=this.ctx.containerElement.getBoundingClientRect())}),this.ctx.on("mouseup",()=>{this.ctx.config.ENABLE_RESIZE_ROW&&(this.isMouseDown=!1,this.resizeDiff!==0&&this.resizeTarget&&this.resizeRow(this.resizeTarget,this.resizeDiff),this.resizeTarget=null,this.resizeDiff=0,this.isResizing=!1,setTimeout(()=>{this.ctx.rowResizing=!1},0),this.clientY=0)}),this.ctx.on("mousedown",e=>{this.ctx.config.ENABLE_RESIZE_ROW&&this.ctx.isTarget(e)&&(this.clientY=e.clientY,this.resizeTarget?(this.isResizing=!0,this.ctx.rowResizing=!0):(this.isResizing=!1,this.ctx.rowResizing=!1),this.isMouseDown=!0)}),this.ctx.on("mousemove",e=>{if(!this.ctx.config.ENABLE_RESIZE_ROW||this.ctx.editing)return;const{offsetY:t,offsetX:i}=this.ctx.getOffset(e),s=t,o=i,n=e.clientY,{stageHeight:a,scrollY:c,config:{RESIZE_ROW_MIN_HEIGHT:d=0}}=this.ctx;if(this.isResizing&&this.resizeTarget){const f=this.resizeTarget.height;let u=n-this.clientY;const{calculatedHeight:g}=this.resizeTarget,m=g===-1?d:g;u+f<m&&(u=-(f-m)),this.resizeDiff=u,this.ctx.emit("draw")}else{if(this.resizeTarget=null,this.isMouseDown)return;if(o<0||o>this.ctx.body.visibleWidth||s<0||s>this.ctx.header.visibleHeight+this.ctx.body.visibleHeight){this.ctx.stageElement.style.cursor==="row-resize"&&(this.ctx.stageElement.style.cursor="default");return}if(this.ctx.stageElement.style.cursor==="crosshair")return;this.ctx.stageElement.style.cursor==="row-resize"&&(this.ctx.stageElement.style.cursor="default");for(let f=0;f<this.renderRows.length;f++){const u=this.renderRows[f];if(s>u.y-c+u.height-1.5&&s<u.y-c+u.height+1.5&&s<a-4)for(let g=0;g<u.cells.length;g++){const m=u.cells[g];o>m.drawX+10&&o<m.drawX+m.width-10&&m.rowspan===1&&(this.ctx.stageElement.style.cursor="row-resize",this.resizeTarget=u)}}}})}resizeRow(e,t){const{rowIndex:i,height:s,rowKey:o,data:n}=e;this.ctx.database.setRowHeight(i,s+t),this.init(),this.ctx.emit("draw"),this.ctx.emit("resizeRowChange",{rowIndex:i,oldHeight:s,height:s+t,rowKey:o,row:n,data:this.data})}drawTipLine(){if(this.isResizing&&this.resizeTarget){const{stageWidth:e,scrollY:t,config:{RESIZE_ROW_LINE_COLOR:i}}=this.ctx,s=this.resizeTarget.y-t,o=this.resizeTarget.height,n=s+o+this.resizeDiff-.5,a=[0,n-.5,e,n-.5];this.ctx.paint.drawLine(a,{borderColor:i,borderWidth:1})}}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:i,header:s,stageWidth:o,config:{HEADER_BG_COLOR:n,SCROLLER_TRACK_SIZE:a}}=this.ctx;if(i>0&&e!==0&&!this.ctx.isEmpty&&this.ctx.paint.drawShadow(this.x,this.y,e,this.height,{fillColor:n,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),i<Math.floor(s.width-o-1)&&t!==a&&!this.ctx.isEmpty){const c=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(c,this.y,t,this.height,{fillColor:n,side:"left",shadowWidth:4,colorStart:"rgba(0,0,0,0)",colorEnd:"rgba(0,0,0,0.1)"})}}binarySearch(e,t){let i=0,s=e.length-1,o=-1;for(;i<=s;){let n=Math.floor((i+s)/2),a=e[n].bottom;if(a===t)return n;a<t?i=n+1:(o=n,s=n-1)}return o}update(){this.init();const{header:e,database:t,scrollY:i,config:{CELL_HEIGHT:s}}=this.ctx,o=i,{data:n,positions:a}=t.getData();this.ctx.maxRowIndex=n.length-1;let c=this.binarySearch(a,o),d=this.binarySearch(a,o+this.visibleHeight);if(d===-1&&(d=this.ctx.maxRowIndex),c===-1&&d===this.ctx.maxRowIndex){const u=Math.floor(this.visibleHeight/s);c=this.ctx.maxRowIndex-u}this.headIndex=Math.max(0,c),this.tailIndex=Math.min(this.ctx.maxRowIndex,d+1),this.visibleRows=n.slice(this.headIndex,this.tailIndex+1),this.ctx.body.headIndex=this.headIndex,this.ctx.body.tailIndex=this.tailIndex,this.ctx.body.visibleRows=this.visibleRows;const f=[];for(let u=0;u<this.visibleRows.length;u++){const g=this.headIndex+u,m=this.visibleRows[u],{height:x,top:v}=this.ctx.database.getPositionForRowIndex(g),p=new tl(this.ctx,g,0,v+this.y,e.width,x,m);f.push(p)}this.renderRows=f,this.ctx.body.renderRows=f}updateAutoHeight(){const e=this.ctx.body.renderRows;if(!e.some(i=>i.calculatedHeightCells.length>0))return!1;e.forEach(i=>{i.updateCalculatedHeight()});const t=e.map(i=>({height:i.calculatedHeight,rowIndex:i.rowIndex}));return this.ctx.database.setBatchCalculatedRowHeight(t)}draw(){this.renderRows.forEach(e=>{e.drawContainer()}),this.renderRows.forEach(e=>{e.drawCenter()}),this.drawFixedShadow(),this.renderRows.forEach(e=>{e.drawFixedContainer()}),this.renderRows.forEach(e=>{e.drawFixed()}),this.drawTipLine()}}class qC{constructor(e){h(this,"ctx"),h(this,"renderRows",[]),h(this,"data",[]),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"visibleWidth",0),h(this,"visibleHeight",0),this.ctx=e,this.init()}init(){this.data=this.ctx.database.getFooterData();const{header:e,body:t,config:{CELL_FOOTER_HEIGHT:i,FOOTER_FIXED:s,SCROLLER_TRACK_SIZE:o,FOOTER_POSITION:n}}=this.ctx;this.width=e.width,this.visibleWidth=e.visibleWidth,this.height=this.data.reduce(a=>a+i,0),this.visibleHeight=this.height,s?n==="top"?this.y=this.ctx.header.height:this.y=this.ctx.stageHeight-this.height-o:this.y=t.y+t.height,this.ctx.footer.x=this.x,this.ctx.footer.y=this.y,this.ctx.footer.height=this.height,this.ctx.footer.width=this.width,this.ctx.footer.visibleWidth=this.visibleWidth,this.ctx.footer.visibleHeight=this.visibleHeight}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:i,header:s,stageWidth:o,config:{HEADER_BG_COLOR:n,SCROLLER_TRACK_SIZE:a}}=this.ctx;let c=this.y;if(this.ctx.config.FOOTER_FIXED||(c=this.y-this.ctx.scrollY),i>0&&e!==0&&this.ctx.paint.drawShadow(this.x,c,e,this.height,{fillColor:n,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),i<Math.floor(s.width-o-1)&&t!==a){const d=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(d,c,t,this.height,{fillColor:n,side:"left",shadowWidth:4,colorStart:"rgba(0,0,0,0)",colorEnd:"rgba(0,0,0,0.1)"})}}update(){this.init();const{CELL_FOOTER_HEIGHT:e}=this.ctx.config;let t=this.y;const i=[];this.data.forEach((s,o)=>{const n=new tl(this.ctx,o,0,t,this.width,e,s,"footer");t+=e,i.push(n)}),this.renderRows=i,this.ctx.footer.renderRows=this.renderRows}drawTopLine(){const{stageWidth:e,config:{BORDER_COLOR:t}}=this.ctx,i=[0,this.y,e,this.y];this.ctx.paint.drawLine(i,{borderColor:t,borderWidth:1})}draw(){this.renderRows.forEach(e=>{e.drawContainer()}),this.renderRows.forEach(e=>{e.drawCenter()}),this.drawFixedShadow(),this.renderRows.forEach(e=>{e.drawFixedContainer()}),this.renderRows.forEach(e=>{e.drawFixed()}),this.drawTopLine()}}class ZC{constructor(e){h(this,"isCut",!1),h(this,"isMultipleRow",!1),h(this,"ctx"),this.ctx=e,this.init()}init(){this.ctx.on("setMoveFocus",e=>{this.moveFocus(e)}),this.ctx.on("mousemove",Kr(e=>{var t,i;(t=this.ctx.focusCell)!=null&&t.fixed||(i=this.ctx.focusCellHeader)!=null&&i.fixed||!this.ctx.dragHeaderIng&&this.ctx.selectorMove&&this.ctx.startAdjustPosition(e)},100)),this.ctx.on("cellHoverChange",e=>{if(!this.ctx.autofillMove){if(e.operation){this.selectRows(e,!1);return}this.isMultipleRow||this.mouseenter()}}),this.ctx.on("cellMousedown",(e,t)=>{if(!(!this.ctx.isTarget(t)||this.ctx.stageElement.style.cursor==="pointer"||this.ctx.isPointer||this.ctx.stageElement.style.cursor==="crosshair")){if(e.operation){this.isMultipleRow=!0,this.selectRows(e);return}window.getComputedStyle(t.target).userSelect!=="text"&&t.preventDefault(),this.isMultipleRow=!1,this.click(t.shiftKey),this.ctx.emit("selectorClick",e)}}),this.ctx.on("mouseup",()=>{this.ctx.selectorMove=!1,this.ctx.stopAdjustPosition(),this.ctx.adjustPositioning=!1,this.ctx.disableHoverIconClick=!1}),this.ctx.on("cellHeaderHoverChange",e=>{this.ctx.mousedown&&this.selectCols(e)}),this.ctx.on("cellHoverChange",e=>{this.ctx.mousedown&&this.selectCols(e)}),this.ctx.on("cellHeaderMousedown",(e,t)=>{this.ctx.stageElement.style.cursor==="pointer"||this.ctx.isPointer||(window.getComputedStyle(t.target).userSelect!=="text"&&t.preventDefault(),this.ctx.clearSelector(),e.operation?this.selectAll():this.selectCols(e))}),this.ctx.on("keydown",e=>{if(!this.ctx.editing&&!this.ctx.finding){if(e.ctrlKey&&e.code==="KeyV"||e.metaKey&&e.code==="KeyV"){this.paste();return}if(e.ctrlKey&&e.code==="KeyC"||e.metaKey&&e.code==="KeyC"){this.copy(),this.isCut=!1;return}if(e.ctrlKey&&e.code==="KeyX"||e.metaKey&&e.code==="KeyX"){this.isCut=!0,this.copy();return}if((e.ctrlKey&&e.code==="KeyA"||e.metaKey&&e.code==="KeyA")&&(e.preventDefault(),this.selectAll()),e.code==="ArrowLeft"||e.shiftKey&&e.code==="Tab"){e.preventDefault(),this.moveFocus("LEFT");return}if(e.code==="ArrowUp"){e.preventDefault(),this.moveFocus("TOP");return}if(e.code==="ArrowRight"||e.code==="Tab"){e.preventDefault(),this.moveFocus("RIGHT");return}if(e.code==="ArrowDown"){e.preventDefault(),this.moveFocus("BOTTOM");return}if(e.code==="Delete"||e.code==="Backspace"){e.preventDefault();const{xArr:t,yArr:i}=this.ctx.selector;this.clearSelectedData(t,i);return}}}),this.ctx.on("contextMenuClearSelected",()=>{const{xArr:e,yArr:t}=this.ctx.selector;this.clearSelectedData(e,t)}),this.ctx.on("contextMenuCopy",()=>{this.copy()}),this.ctx.on("contextMenuPaste",()=>{this.paste()}),this.ctx.on("contextMenuCut",()=>{this.isCut=!0,this.copy()}),this.ctx.on("setSelectorCell",e=>{this.ctx.setFocusCell(e),this.click()}),this.ctx.on("selectCols",e=>{this.selectCols(e)})}setSelector(e,t){if(this.ctx.dragHeaderIng)return;const{ENABLE_SELECTOR_SPAN_COL:i,ENABLE_SELECTOR_SPAN_ROW:s}=this.ctx.config;let o=e,n=t;if(!s){const[a]=n;n=[a,a]}if(!i){const[a]=o;o=[a,a]}if(JSON.stringify(this.ctx.selector.xArr)!==JSON.stringify(o)||JSON.stringify(this.ctx.selector.yArr)!==JSON.stringify(n)){this.ctx.mousedown&&(this.ctx.selectorMove=!0,this.ctx.disableHoverIconClick=!0),this.ctx.selector.enable=!0;const{SELECTOR_AREA_MIN_X:a,SELECTOR_AREA_MAX_X:c,SELECTOR_AREA_MIN_Y:d,SELECTOR_AREA_MAX_Y:f,SELECTOR_AREA_MAX_X_OFFSET:u,SELECTOR_AREA_MAX_Y_OFFSET:g}=this.ctx.config,m=a,x=c||this.ctx.maxColIndex-u,v=d,p=f||this.ctx.maxRowIndex-g;let[E,C]=o,[w,_]=n;if(E<m||C>x||w<v||_>p)return;if(this.ctx.config.ENABLE_MERGE_CELL_LINK){const B=this.adjustMergeCells(o,n);w=B.yArr[0],_=B.yArr[1],E=B.xArr[0],C=B.xArr[1],this.ctx.onlyMergeCell=B.onlyMergeCell}E===C&&w===_?this.ctx.selectOnlyOne=!0:this.ctx.selectOnlyOne=!1,o=[Math.max(m,E),Math.min(x,C)],n=[Math.max(v,w),Math.min(p,_)];const{BEFORE_SET_SELECTOR_METHOD:S}=this.ctx.config;if(typeof S=="function"){const B=S({focusCell:this.ctx.focusCell,xArr:o,yArr:n});if(!B)return;o=B.xArr,n=B.yArr}this.ctx.selector.xArr=o,this.ctx.selector.yArr=n,_===this.ctx.maxRowIndex&&w===0?this.ctx.selectColsIng=!0:this.ctx.selectColsIng=!1,C===this.ctx.maxColIndex&&E===0?this.ctx.selectRowsIng=!0:this.ctx.selectRowsIng=!1,this.ctx.emit("setSelector",this.ctx.selector),this.ctx.emit("drawView")}}adjustMergeCells(e,t){var i;const[s,o]=t,[n,a]=e;if(o===this.ctx.maxRowIndex&&s===0||a===this.ctx.maxColIndex&&n===0)return{xArr:e,yArr:t,onlyMergeCell:!1};let c=[],d=[];for(let v=0;v<=t[1]-t[0];v++)for(let p=0;p<=e[1]-e[0];p++){const E=v+t[0],C=p+e[0],w=this.ctx.database.getVirtualBodyCell(E,C);w&&((E===s||E===o)&&c.push(w),(C===n||C===a)&&d.push(w))}const f=c.reduce((v,p)=>{const{yArr:E}=p.getSpanInfo(),[C,w]=E;return v.minY=Math.min(v.minY,C),v.maxY=Math.max(v.maxY,w),v},{minY:s,maxY:o}),u=d.reduce((v,p)=>{const{xArr:E}=p.getSpanInfo(),[C,w]=E;return v.minX=Math.min(v.minX,C),v.maxX=Math.max(v.maxX,w),v},{minX:n,maxX:a}),g=[u.minX,u.maxX],m=[f.minY,f.maxY];let x=!1;if(u.minX!==u.maxX||f.minY!==f.maxY){const v=JSON.stringify(g)+JSON.stringify(m),p=(i=this.ctx.focusCell)==null?void 0:i.getSpanInfo();x=(p&&JSON.stringify(p.xArr)+JSON.stringify(p.yArr))===v}return{xArr:g,yArr:m,onlyMergeCell:x}}selectCols(e){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||!this.ctx.config.ENABLE_SELECTOR_ALL_ROWS||this.ctx.autofillMove||this.ctx.columnResizing||this.ctx.editing)return;const{SELECTOR_AREA_MIN_Y:t,SELECTOR_AREA_MAX_Y:i,SELECTOR_AREA_MAX_Y_OFFSET:s}=this.ctx.config,o=t,n=i||this.ctx.maxRowIndex-s;if(this.ctx.focusCellHeader){const{colIndex:a}=this.ctx.focusCellHeader;if(this.ctx.clearSelector(),this.ctx.mousedown&&e.colIndex>=a){const c=[a,e.colIndex+e.colspan-1],d=[o,n];this.setSelector(c,d)}else{const c=[e.colIndex,a+e.colspan-1],d=[o,n];this.setSelector(c,d)}}}selectAll(){if(this.ctx.autofillMove||this.ctx.editing)return;const{ENABLE_SELECTOR_ALL_ROWS:e,ENABLE_SELECTOR_ALL_COLS:t}=this.ctx.config;if(e&&t){const{SELECTOR_AREA_MIN_X:i,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MIN_Y:o,SELECTOR_AREA_MAX_Y:n,SELECTOR_AREA_MAX_X_OFFSET:a,SELECTOR_AREA_MAX_Y_OFFSET:c}=this.ctx.config,d=i,f=s||this.ctx.maxColIndex-a,u=o,g=n||this.ctx.maxRowIndex-c,m=[d,f],x=[u,g];this.setSelector(m,x)}}selectRows(e,t=!0){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||!this.ctx.config.ENABLE_SELECTOR_ALL_COLS||this.ctx.autofillMove||this.ctx.editing)return;const{SELECTOR_AREA_MIN_X:i,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MAX_X_OFFSET:o}=this.ctx.config,n=s||this.ctx.maxColIndex-o,a=i;if(t){this.ctx.setFocusCell(e);const c=[a,n],d=[e.rowIndex,e.rowIndex];this.setSelector(c,d)}if(this.ctx.focusCell&&this.ctx.mousedown){const{rowIndex:c}=this.ctx.focusCell;if(e.rowIndex>=c){const d=[a,n],f=[c,e.rowIndex];this.setSelector(d,f)}else{const d=[a,n],f=[e.rowIndex,c];this.setSelector(d,f)}}}mouseenter(){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||this.ctx.editing)return;const{mousedown:e,focusCell:t,hoverCell:i}=this.ctx;if(e&&t&&i){const{rowIndex:s,colIndex:o}=t,n=Math.min(i.colIndex,o),a=Math.max(i.colIndex,o),c=Math.min(i.rowIndex,s),d=Math.max(i.rowIndex,s),f=[n,a],u=[c,d];this.setSelector(f,u)}}click(e=!1){const{focusCell:t,clickCell:i}=this.ctx;if(t&&this.isInSettingRange(t.rowIndex,t.colIndex))if(this.ctx.selector.enable=!0,i&&e){if(this.ctx.config.ENABLE_SELECTOR_SINGLE)return;const{colIndex:s,rowIndex:o}=i,{colIndex:n,rowIndex:a}=t,c=Math.min(n,s),d=Math.max(n,s),f=Math.min(a,o),u=Math.max(a,o),g=[c,d],m=[f,u];this.setSelector(g,m)}else{this.ctx.emit("cellSelectedClick",t);const s=[t.colIndex,t.colIndex],o=[t.rowIndex,t.rowIndex];this.setSelector(s,o),this.adjustBoundaryPosition()}}clearCopyLine(){this.ctx.selector.xArrCopy=[-1,-1],this.ctx.selector.yArrCopy=[-1,-1]}getCell(e,t){const i=this.ctx.body.renderRows.find(s=>s.rowIndex===e);return i==null?void 0:i.cells.find(s=>s.colIndex===t)}copy(){if(!this.ctx.config.ENABLE_COPY||this.ctx.domSelectionStr)return;let{value:e,xArr:t,yArr:i}=this.ctx.getSelectedData();if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(t,i))if(this.ctx.onlyMergeCell&&this.ctx.focusCell){const n=this.ctx.focusCell;e=[[n.getValue()]],t=[n.colIndex,n.colIndex],i=[n.rowIndex,n.rowIndex]}else{const n={code:"ERR_MERGED_CELLS_COPY",message:"Merged cells cannot span copy data"};this.ctx.hasEvent("error")?this.ctx.emit("error",n):alert(n.message);return}const{BEFORE_COPY_METHOD:s}=this.ctx.config;if(typeof s=="function"){const n=s({focusCell:this.ctx.focusCell,data:e,xArr:t,yArr:i});if(!n)return;e=n.data}const o=kC(e);navigator.clipboard?navigator.clipboard.writeText(o).then(()=>{this.ctx.selector.xArrCopy=this.ctx.selector.xArr.slice(),this.ctx.selector.yArrCopy=this.ctx.selector.yArr.slice(),this.ctx.emit("copyChange",{xArr:this.ctx.selector.xArrCopy,yArr:this.ctx.selector.yArrCopy,data:e}),this.ctx.emit("draw")}).catch(n=>console.error("Copy Failure:",n)):console.error("current browser does not support the Clipboard API")}clearSelectedData(e,t,i=!1,s=null){let o=[];const n=new Set;for(let c=0;c<=t[1]-t[0];c++)for(let d=0;d<=e[1]-e[0];d++){const f=c+t[0],u=d+e[0],g=this.ctx.database.getItemValueForRowIndexAndColIndex(f,u);if(g){const{rowKey:m,key:x}=g;this.ctx.database.getReadonly(m,x)||(n.add(m),o.push({rowKey:m,key:x,value:s,row:{}}))}}if(!o.length)return[];if(i)return o;this.ctx.database.batchSetItemValue(o,!0);let a=[];return n.forEach(c=>{a.push(this.ctx.database.getRowDataItemForRowKey(c))}),this.ctx.emit("clearSelectedDataChange",o,a),o}paste(){if(!navigator.clipboard){console.error("current browser does not support the Clipboard API");return}const{ENABLE_PASTER:e}=this.ctx.config;if(this.ctx.selector.enable&&e){const t=this.ctx.selector.yArr[0],i=this.ctx.selector.xArr[0],s=new Set;navigator.clipboard.readText().then(async o=>{let n=OC(o);const a=[i,i+n[0].length-1],c=[t,t+n.length-1],[d,f]=c,[u,g]=a,m=f-this.ctx.maxRowIndex,x=g-this.ctx.maxColIndex;(m>0||x>0)&&this.ctx.emit("onPastedDataOverflow",{maxY:f,maxX:g,minY:d,minX:u,overflowRowCount:m,overflowColCount:x,textArr:n});const v=n.length===1&&n[0].length===1;if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(a,c)&&!v){const w={code:"ERR_MERGED_CELLS_PASTE",message:"Merged cells cannot span paste data"};this.ctx.hasEvent("error")?this.ctx.emit("error",w):alert(w.message);return}let p=[];for(let w=0;w<=n.length-1;w++){const _=n[w].length;for(let S=0;S<=_-1;S++){const B=w+t,K=S+i,R=n[w][S],I=this.ctx.database.getItemValueForRowIndexAndColIndex(B,K);if(I){const{rowKey:b,key:O}=I;this.ctx.database.getReadonly(b,O)||(s.add(b),p.push({rowKey:b,key:O,value:R,row:{}}))}}}if(this.isCut){const w=this.clearSelectedData(this.ctx.selector.xArrCopy,this.ctx.selector.yArrCopy,!0),_=p.map(S=>`${S.rowKey}-${S.key}`);w.forEach(S=>{_.includes(`${S.rowKey}-${S.key}`)||p.unshift(S)}),this.isCut=!1}if(!p.length)return;const{BEFORE_PASTE_DATA_METHOD:E}=this.ctx.config;if(typeof E=="function"){const w=E,_=p.map(S=>({rowKey:S.rowKey,key:S.key,value:S.value,oldValue:this.ctx.database.getItemValue(S.rowKey,S.key),row:this.ctx.database.getRowDataItemForRowKey(S.rowKey)}));if(p=await w(_,a,c,n),p&&!p.length)return}this.clearCopyLine(),this.ctx.batchSetItemValueByEditor(p,!0);let C=[];s.forEach(w=>{C.push(this.ctx.database.getRowDataItemForRowKey(w))}),this.ctx.emit("pasteChange",p,C),this.ctx.emit("draw")}).catch(o=>{console.error("Failed to get the clipboard content:",o)})}}moveFocus(e){if(this.ctx.editing)return;const{focusCell:t}=this.ctx;if(!t)return;let{colIndex:i=0,rowIndex:s=0}=t;const o=0,n=0,a=this.ctx.maxColIndex,c=this.ctx.maxRowIndex;switch(e){case"LEFT":i>o&&i--;break;case"TOP":s>n&&s--;break;case"RIGHT":i<a&&i++;break;case"BOTTOM":s<c&&s++;break}const d=[i,i],f=[s,s],u=this.getCell(s,i);u&&(u.operation||this.isInSettingRange(u.rowIndex,u.colIndex)&&(this.ctx.setFocusCell(u),this.setSelector(d,f),this.adjustBoundaryPosition(),this.ctx.emit("moveFocus",u),this.ctx.emit("draw")))}isInSettingRange(e,t){const{SELECTOR_AREA_MIN_X:i,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MIN_Y:o,SELECTOR_AREA_MAX_Y:n,SELECTOR_AREA_MAX_X_OFFSET:a,SELECTOR_AREA_MAX_Y_OFFSET:c}=this.ctx.config,d=i,f=s||this.ctx.maxColIndex-a,u=o,g=n||this.ctx.maxRowIndex-c;return!(t<d||t>f||e<u||e>g)}adjustBoundaryPosition(){const{stageHeight:e,stageWidth:t,focusCell:i,fixedRightWidth:s,fixedLeftWidth:o,header:n,footer:a,body:c,scrollX:d,scrollY:f,config:{SCROLLER_TRACK_SIZE:u,FOOTER_FIXED:g,FOOTER_POSITION:m,ENABLE_MERGE_CELL_LINK:x}}=this.ctx;if(!i)return;x&&this.ctx.onlyMergeCell&&i.updateSpanInfo();const{drawX:v,drawY:p,width:E,height:C,fixed:w}=i,_=o-v+1,S=i.drawX+E-(t-s)+1;let B=n.height-p,K=C;K>c.visibleHeight&&(K=c.visibleHeight);let R=0;g&&(m==="top"?B=n.height+a.height-p:R=a.visibleHeight);const I=p+K-(e-R-u);let b=d,O=f;S>0&&!w?b=Math.floor(d+S):_>0&&!w&&(b=Math.floor(d-_)),B>0?O=Math.floor(f-B):I>0&&(O=Math.floor(f+I)),(Math.abs(d-b)>2||Math.abs(f-O)>2)&&(this.ctx.adjustPositioning=!0,this.ctx.emit("adjustBoundaryPosition",i),this.ctx.setScroll(b,O))}destroy(){}}class JC{constructor(e){h(this,"ctx"),h(this,"maxColRowCell"),this.ctx=e,this.init()}init(){this.ctx.on("mousemove",e=>{if(this.ctx.stageElement.style.cursor==="crosshair"&&(this.ctx.stageElement.style.cursor="default"),this.ctx.editing||!this.ctx.focusCell||!this.maxColRowCell)return;const{offsetX:t,offsetY:i}=this.ctx.getOffset(e),{colIndex:s,rowIndex:o,drawX:n,drawY:a,width:c,height:d}=this.maxColRowCell,f=6,u=s===this.ctx.maxColIndex||o===this.ctx.maxRowIndex?0:2,g=n+c-f+u,m=a+d-f+u;t>g&&i>m&&t<g+f&&i<m+f&&(this.ctx.stageElement.style.cursor="crosshair"),this.ctx.autofillMove&&this.ctx.startAdjustPosition(e)}),this.ctx.on("cellMouseenter",e=>{const{xArr:t,yArr:i}=this.ctx.selector,s=t[1],o=i[1],{colIndex:n,rowIndex:a}=e;this.ctx.config.ENABLE_AUTOFILL&&n===s&&a===o&&(this.maxColRowCell=e),this.mouseenter(e)}),this.ctx.on("mousedown",()=>{this.ctx.stageElement.style.cursor==="crosshair"&&this.setMousedown()}),this.ctx.on("mouseup",()=>{this.setMouseUp(),this.ctx.stopAdjustPosition()})}isAutofillIng(){const{xArr:e,yArr:t}=this.ctx.selector;return!(JSON.stringify(this.ctx.autofill.xArr)===JSON.stringify(e)&&JSON.stringify(this.ctx.autofill.yArr)===JSON.stringify(t))}setMousedown(){this.ctx.autofill.enable=!0,this.ctx.autofillMove=!0,this.ctx.disableHoverIconClick=!0}setMouseUp(){this.ctx.autofill.enable&&(this.isAutofillIng()&&this.autofillData(),this.ctx.autofill.enable=!1,this.ctx.autofillMove=!1,this.ctx.autofill.xArr=[-1,-1],this.ctx.autofill.yArr=[-1,-1],setTimeout(()=>{this.ctx.disableHoverIconClick=!1},0))}setAutofill(e,t){const{ENABLE_AUTOFILL:i,ENABLE_AUTOFILL_SPAN_COL:s,ENABLE_AUTOFILL_SPAN_ROW:o}=this.ctx.config;if(!i)return;let n=e,a=t;const c=this.ctx.selector.xArr,d=this.ctx.selector.yArr;if(!(!o&&JSON.stringify(d)!==JSON.stringify(a))&&!(!s&&JSON.stringify(c)!==JSON.stringify(n))&&(JSON.stringify(this.ctx.autofill.xArr)!==JSON.stringify(n)||JSON.stringify(this.ctx.autofill.yArr)!==JSON.stringify(a))){const{SELECTOR_AREA_MIN_X:f,SELECTOR_AREA_MAX_X:u,SELECTOR_AREA_MIN_Y:g,SELECTOR_AREA_MAX_Y:m,SELECTOR_AREA_MAX_X_OFFSET:x,SELECTOR_AREA_MAX_Y_OFFSET:v}=this.ctx.config,p=f,E=u||this.ctx.maxColIndex-x,C=g,w=m||this.ctx.maxRowIndex-v;let[_,S]=n,[B,K]=a;if(_<p||B<C)return;n=[Math.max(p,_),Math.min(E,S)],a=[Math.max(C,B),Math.min(w,K)];const{BEFORE_SET_AUTOFILL_METHOD:R}=this.ctx.config;if(typeof R=="function"){const I=R({focusCell:this.ctx.focusCell,xArr:n,yArr:a});if(!I)return;n=I.xArr,a=I.yArr}this.ctx.autofill.xArr=n,this.ctx.autofill.yArr=a,this.ctx.emit("setAutofill",this.ctx.autofill),this.ctx.emit("draw")}}async autofillData(){const e=new Set,t=this.ctx.getSelectedData(),i=new Map;for(let m=0;m<=t.yArr[1]-t.yArr[0];m++)for(let x=0;x<=t.xArr[1]-t.xArr[0];x++){const v=m+t.yArr[0],p=x+t.xArr[0];i.set(`${v}-${p}`,!0)}const{value:s}=t,o=s[0].length,n=s.length,a=this.ctx.autofill.xArr,c=this.ctx.autofill.yArr,d=o===1&&n===1;if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(a,c)&&!d){const m={code:"ERR_MERGED_CELLS_AUTOFILL",message:"Merged cells cannot span autofill data"};this.ctx.hasEvent("error")?this.ctx.emit("error",m):alert(m.message);return}let f=[];for(let m=0;m<=c[1]-c[0];m++)for(let x=0;x<=a[1]-a[0];x++){const v=x+a[0],p=m+c[0],E=s[m%n][x%o],C=this.ctx.database.getItemValueForRowIndexAndColIndex(p,v),w=`${p}-${v}`;if(C&&!i.has(w)){const{rowKey:_,key:S}=C;this.ctx.database.getReadonly(_,S)||(e.add(_),f.push({rowKey:_,key:S,value:E,row:{}}))}}if(!f.length)return;this.ctx.selector.xArr=this.ctx.autofill.xArr,this.ctx.selector.yArr=this.ctx.autofill.yArr;const{BEFORE_AUTOFILL_DATA_METHOD:u}=this.ctx.config;if(typeof u=="function"){const m=u,x=f.map(v=>({rowKey:v.rowKey,key:v.key,value:v.value,oldValue:this.ctx.database.getItemValue(v.rowKey,v.key),row:this.ctx.database.getRowDataItemForRowKey(v.rowKey)}));if(f=await m(x,a,c),f&&!f.length)return}this.ctx.batchSetItemValueByEditor(f,!0);let g=[];e.forEach(m=>{g.push(this.ctx.database.getRowDataItemForRowKey(m))}),this.ctx.emit("autofillChange",f,g),this.ctx.emit("draw")}mouseenter(e){if(["index","selection","index-selection"].includes(e.type))return;const{selector:t,autofill:i}=this.ctx;if(this.ctx.mousedown&&t.enable&&i.enable){const{rowIndex:s,colIndex:o}=e,n=t.xArr.slice(),a=t.yArr.slice();s>=t.yArr[0]&&s<=t.yArr[1]?o>t.xArr[1]?n.splice(1,1,o):o<t.xArr[0]&&n.splice(0,1,o):s>t.yArr[1]?a.splice(1,1,s):s<t.yArr[0]&&a.splice(0,1,s),this.setAutofill(n,a)}}destroy(){}}const Rt=Math.min,ct=Math.max,Ri=Math.round,xi=Math.floor,Te=r=>({x:r,y:r}),QC={left:"right",right:"left",bottom:"top",top:"bottom"},jC={start:"end",end:"start"};function mr(r,e,t){return ct(r,Rt(e,t))}function ti(r,e){return typeof r=="function"?r(e):r}function ht(r){return r.split("-")[0]}function ii(r){return r.split("-")[1]}function il(r){return r==="x"?"y":"x"}function Vr(r){return r==="y"?"height":"width"}const eb=new Set(["top","bottom"]);function Je(r){return eb.has(ht(r))?"y":"x"}function Wr(r){return il(Je(r))}function tb(r,e,t){t===void 0&&(t=!1);const i=ii(r),s=Wr(r),o=Vr(s);let n=s==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(n=Ii(n)),[n,Ii(n)]}function ib(r){const e=Ii(r);return[xr(r),e,xr(e)]}function xr(r){return r.replace(/start|end/g,e=>jC[e])}const Ho=["left","right"],Fo=["right","left"],rb=["top","bottom"],sb=["bottom","top"];function ob(r,e,t){switch(r){case"top":case"bottom":return t?e?Fo:Ho:e?Ho:Fo;case"left":case"right":return e?rb:sb;default:return[]}}function nb(r,e,t,i){const s=ii(r);let o=ob(ht(r),t==="start",i);return s&&(o=o.map(n=>n+"-"+s),e&&(o=o.concat(o.map(xr)))),o}function Ii(r){return r.replace(/left|right|bottom|top/g,e=>QC[e])}function ab(r){return{top:0,right:0,bottom:0,left:0,...r}}function rl(r){return typeof r!="number"?ab(r):{top:r,right:r,bottom:r,left:r}}function Si(r){const{x:e,y:t,width:i,height:s}=r;return{width:i,height:s,top:t,left:e,right:e+i,bottom:t+s,x:e,y:t}}function Ko(r,e,t){let{reference:i,floating:s}=r;const o=Je(e),n=Wr(e),a=Vr(n),c=ht(e),d=o==="y",f=i.x+i.width/2-s.width/2,u=i.y+i.height/2-s.height/2,g=i[a]/2-s[a]/2;let m;switch(c){case"top":m={x:f,y:i.y-s.height};break;case"bottom":m={x:f,y:i.y+i.height};break;case"right":m={x:i.x+i.width,y:u};break;case"left":m={x:i.x-s.width,y:u};break;default:m={x:i.x,y:i.y}}switch(ii(e)){case"start":m[n]-=g*(t&&d?-1:1);break;case"end":m[n]+=g*(t&&d?-1:1);break}return m}const lb=async(r,e,t)=>{const{placement:i="bottom",strategy:s="absolute",middleware:o=[],platform:n}=t,a=o.filter(Boolean),c=await(n.isRTL==null?void 0:n.isRTL(e));let d=await n.getElementRects({reference:r,floating:e,strategy:s}),{x:f,y:u}=Ko(d,i,c),g=i,m={},x=0;for(let v=0;v<a.length;v++){const{name:p,fn:E}=a[v],{x:C,y:w,data:_,reset:S}=await E({x:f,y:u,initialPlacement:i,placement:g,strategy:s,middlewareData:m,rects:d,platform:n,elements:{reference:r,floating:e}});f=C??f,u=w??u,m={...m,[p]:{...m[p],..._}},S&&x<=50&&(x++,typeof S=="object"&&(S.placement&&(g=S.placement),S.rects&&(d=S.rects===!0?await n.getElementRects({reference:r,floating:e,strategy:s}):S.rects),{x:f,y:u}=Ko(d,g,c)),v=-1)}return{x:f,y:u,placement:g,strategy:s,middlewareData:m}};async function sl(r,e){var t;e===void 0&&(e={});const{x:i,y:s,platform:o,rects:n,elements:a,strategy:c}=r,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:g=!1,padding:m=0}=ti(e,r),x=rl(m),v=a[g?u==="floating"?"reference":"floating":u],p=Si(await o.getClippingRect({element:(t=await(o.isElement==null?void 0:o.isElement(v)))==null||t?v:v.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:d,rootBoundary:f,strategy:c})),E=u==="floating"?{x:i,y:s,width:n.floating.width,height:n.floating.height}:n.reference,C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),w=await(o.isElement==null?void 0:o.isElement(C))?await(o.getScale==null?void 0:o.getScale(C))||{x:1,y:1}:{x:1,y:1},_=Si(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:E,offsetParent:C,strategy:c}):E);return{top:(p.top-_.top+x.top)/w.y,bottom:(_.bottom-p.bottom+x.bottom)/w.y,left:(p.left-_.left+x.left)/w.x,right:(_.right-p.right+x.right)/w.x}}const cb=r=>({name:"arrow",options:r,async fn(e){const{x:t,y:i,placement:s,rects:o,platform:n,elements:a,middlewareData:c}=e,{element:d,padding:f=0}=ti(r,e)||{};if(d==null)return{};const u=rl(f),g={x:t,y:i},m=Wr(s),x=Vr(m),v=await n.getDimensions(d),p=m==="y",E=p?"top":"left",C=p?"bottom":"right",w=p?"clientHeight":"clientWidth",_=o.reference[x]+o.reference[m]-g[m]-o.floating[x],S=g[m]-o.reference[m],B=await(n.getOffsetParent==null?void 0:n.getOffsetParent(d));let K=B?B[w]:0;(!K||!await(n.isElement==null?void 0:n.isElement(B)))&&(K=a.floating[w]||o.floating[x]);const R=_/2-S/2,I=K/2-v[x]/2-1,b=Rt(u[E],I),O=Rt(u[C],I),y=b,M=K-v[x]-O,D=K/2-v[x]/2+R,P=mr(y,D,M),Y=!c.arrow&&ii(s)!=null&&D!==P&&o.reference[x]/2-(D<y?b:O)-v[x]/2<0,V=Y?D<y?D-y:D-M:0;return{[m]:g[m]+V,data:{[m]:P,centerOffset:D-P-V,...Y&&{alignmentOffset:V}},reset:Y}}}),hb=function(r){return r===void 0&&(r={}),{name:"flip",options:r,async fn(e){var t,i;const{placement:s,middlewareData:o,rects:n,initialPlacement:a,platform:c,elements:d}=e,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:g,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:v=!0,...p}=ti(r,e);if((t=o.arrow)!=null&&t.alignmentOffset)return{};const E=ht(s),C=Je(a),w=ht(a)===a,_=await(c.isRTL==null?void 0:c.isRTL(d.floating)),S=g||(w||!v?[Ii(a)]:ib(a)),B=x!=="none";!g&&B&&S.push(...nb(a,v,x,_));const K=[a,...S],R=await sl(e,p),I=[];let b=((i=o.flip)==null?void 0:i.overflows)||[];if(f&&I.push(R[E]),u){const D=tb(s,n,_);I.push(R[D[0]],R[D[1]])}if(b=[...b,{placement:s,overflows:I}],!I.every(D=>D<=0)){var O,y;const D=(((O=o.flip)==null?void 0:O.index)||0)+1,P=K[D];if(P&&(!(u==="alignment"&&C!==Je(P))||b.every(V=>Je(V.placement)===C?V.overflows[0]>0:!0)))return{data:{index:D,overflows:b},reset:{placement:P}};let Y=(y=b.filter(V=>V.overflows[0]<=0).sort((V,W)=>V.overflows[1]-W.overflows[1])[0])==null?void 0:y.placement;if(!Y)switch(m){case"bestFit":{var M;const V=(M=b.filter(W=>{if(B){const z=Je(W.placement);return z===C||z==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(z=>z>0).reduce((z,Q)=>z+Q,0)]).sort((W,z)=>W[1]-z[1])[0])==null?void 0:M[0];V&&(Y=V);break}case"initialPlacement":Y=a;break}if(s!==Y)return{reset:{placement:Y}}}return{}}}},db=new Set(["left","top"]);async function ub(r,e){const{placement:t,platform:i,elements:s}=r,o=await(i.isRTL==null?void 0:i.isRTL(s.floating)),n=ht(t),a=ii(t),c=Je(t)==="y",d=db.has(n)?-1:1,f=o&&c?-1:1,u=ti(e,r);let{mainAxis:g,crossAxis:m,alignmentAxis:x}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof x=="number"&&(m=a==="end"?x*-1:x),c?{x:m*f,y:g*d}:{x:g*d,y:m*f}}const fb=function(r){return r===void 0&&(r=0),{name:"offset",options:r,async fn(e){var t,i;const{x:s,y:o,placement:n,middlewareData:a}=e,c=await ub(e,r);return n===((t=a.offset)==null?void 0:t.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:s+c.x,y:o+c.y,data:{...c,placement:n}}}}},gb=function(r){return r===void 0&&(r={}),{name:"shift",options:r,async fn(e){const{x:t,y:i,placement:s}=e,{mainAxis:o=!0,crossAxis:n=!1,limiter:a={fn:p=>{let{x:E,y:C}=p;return{x:E,y:C}}},...c}=ti(r,e),d={x:t,y:i},f=await sl(e,c),u=Je(ht(s)),g=il(u);let m=d[g],x=d[u];if(o){const p=g==="y"?"top":"left",E=g==="y"?"bottom":"right",C=m+f[p],w=m-f[E];m=mr(C,m,w)}if(n){const p=u==="y"?"top":"left",E=u==="y"?"bottom":"right",C=x+f[p],w=x-f[E];x=mr(C,x,w)}const v=a.fn({...e,[g]:m,[u]:x});return{...v,data:{x:v.x-t,y:v.y-i,enabled:{[g]:o,[u]:n}}}}}};function Pi(){return typeof window<"u"}function $t(r){return ol(r)?(r.nodeName||"").toLowerCase():"#document"}function ce(r){var e;return(r==null||(e=r.ownerDocument)==null?void 0:e.defaultView)||window}function $e(r){var e;return(e=(ol(r)?r.ownerDocument:r.document)||window.document)==null?void 0:e.documentElement}function ol(r){return Pi()?r instanceof Node||r instanceof ce(r).Node:!1}function ye(r){return Pi()?r instanceof Element||r instanceof ce(r).Element:!1}function Oe(r){return Pi()?r instanceof HTMLElement||r instanceof ce(r).HTMLElement:!1}function Po(r){return!Pi()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof ce(r).ShadowRoot}const vb=new Set(["inline","contents"]);function ri(r){const{overflow:e,overflowX:t,overflowY:i,display:s}=we(r);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!vb.has(s)}const mb=new Set(["table","td","th"]);function xb(r){return mb.has($t(r))}const pb=[":popover-open",":modal"];function Yi(r){return pb.some(e=>{try{return r.matches(e)}catch{return!1}})}const yb=["transform","translate","scale","rotate","perspective"],wb=["transform","translate","scale","rotate","perspective","filter"],Eb=["paint","layout","strict","content"];function Xr(r){const e=zr(),t=ye(r)?we(r):r;return yb.some(i=>t[i]?t[i]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||wb.some(i=>(t.willChange||"").includes(i))||Eb.some(i=>(t.contain||"").includes(i))}function Cb(r){let e=je(r);for(;Oe(e)&&!It(e);){if(Xr(e))return e;if(Yi(e))return null;e=je(e)}return null}function zr(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const bb=new Set(["html","body","#document"]);function It(r){return bb.has($t(r))}function we(r){return ce(r).getComputedStyle(r)}function Vi(r){return ye(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function je(r){if($t(r)==="html")return r;const e=r.assignedSlot||r.parentNode||Po(r)&&r.host||$e(r);return Po(e)?e.host:e}function nl(r){const e=je(r);return It(e)?r.ownerDocument?r.ownerDocument.body:r.body:Oe(e)&&ri(e)?e:nl(e)}function Xt(r,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const s=nl(r),o=s===((i=r.ownerDocument)==null?void 0:i.body),n=ce(s);if(o){const a=pr(n);return e.concat(n,n.visualViewport||[],ri(s)?s:[],a&&t?Xt(a):[])}return e.concat(s,Xt(s,[],t))}function pr(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function al(r){const e=we(r);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const s=Oe(r),o=s?r.offsetWidth:t,n=s?r.offsetHeight:i,a=Ri(t)!==o||Ri(i)!==n;return a&&(t=o,i=n),{width:t,height:i,$:a}}function Gr(r){return ye(r)?r:r.contextElement}function bt(r){const e=Gr(r);if(!Oe(e))return Te(1);const t=e.getBoundingClientRect(),{width:i,height:s,$:o}=al(e);let n=(o?Ri(t.width):t.width)/i,a=(o?Ri(t.height):t.height)/s;return(!n||!Number.isFinite(n))&&(n=1),(!a||!Number.isFinite(a))&&(a=1),{x:n,y:a}}const _b=Te(0);function ll(r){const e=ce(r);return!zr()||!e.visualViewport?_b:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Rb(r,e,t){return e===void 0&&(e=!1),!t||e&&t!==ce(r)?!1:e}function dt(r,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const s=r.getBoundingClientRect(),o=Gr(r);let n=Te(1);e&&(i?ye(i)&&(n=bt(i)):n=bt(r));const a=Rb(o,t,i)?ll(o):Te(0);let c=(s.left+a.x)/n.x,d=(s.top+a.y)/n.y,f=s.width/n.x,u=s.height/n.y;if(o){const g=ce(o),m=i&&ye(i)?ce(i):i;let x=g,v=pr(x);for(;v&&i&&m!==x;){const p=bt(v),E=v.getBoundingClientRect(),C=we(v),w=E.left+(v.clientLeft+parseFloat(C.paddingLeft))*p.x,_=E.top+(v.clientTop+parseFloat(C.paddingTop))*p.y;c*=p.x,d*=p.y,f*=p.x,u*=p.y,c+=w,d+=_,x=ce(v),v=pr(x)}}return Si({width:f,height:u,x:c,y:d})}function Ur(r,e){const t=Vi(r).scrollLeft;return e?e.left+t:dt($e(r)).left+t}function cl(r,e,t){t===void 0&&(t=!1);const i=r.getBoundingClientRect(),s=i.left+e.scrollLeft-(t?0:Ur(r,i)),o=i.top+e.scrollTop;return{x:s,y:o}}function Ib(r){let{elements:e,rect:t,offsetParent:i,strategy:s}=r;const o=s==="fixed",n=$e(i),a=e?Yi(e.floating):!1;if(i===n||a&&o)return t;let c={scrollLeft:0,scrollTop:0},d=Te(1);const f=Te(0),u=Oe(i);if((u||!u&&!o)&&(($t(i)!=="body"||ri(n))&&(c=Vi(i)),Oe(i))){const m=dt(i);d=bt(i),f.x=m.x+i.clientLeft,f.y=m.y+i.clientTop}const g=n&&!u&&!o?cl(n,c,!0):Te(0);return{width:t.width*d.x,height:t.height*d.y,x:t.x*d.x-c.scrollLeft*d.x+f.x+g.x,y:t.y*d.y-c.scrollTop*d.y+f.y+g.y}}function Sb(r){return Array.from(r.getClientRects())}function Tb(r){const e=$e(r),t=Vi(r),i=r.ownerDocument.body,s=ct(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),o=ct(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let n=-t.scrollLeft+Ur(r);const a=-t.scrollTop;return we(i).direction==="rtl"&&(n+=ct(e.clientWidth,i.clientWidth)-s),{width:s,height:o,x:n,y:a}}function Ob(r,e){const t=ce(r),i=$e(r),s=t.visualViewport;let o=i.clientWidth,n=i.clientHeight,a=0,c=0;if(s){o=s.width,n=s.height;const d=zr();(!d||d&&e==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}return{width:o,height:n,x:a,y:c}}const kb=new Set(["absolute","fixed"]);function Lb(r,e){const t=dt(r,!0,e==="fixed"),i=t.top+r.clientTop,s=t.left+r.clientLeft,o=Oe(r)?bt(r):Te(1),n=r.clientWidth*o.x,a=r.clientHeight*o.y,c=s*o.x,d=i*o.y;return{width:n,height:a,x:c,y:d}}function Yo(r,e,t){let i;if(e==="viewport")i=Ob(r,t);else if(e==="document")i=Tb($e(r));else if(ye(e))i=Lb(e,t);else{const s=ll(r);i={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return Si(i)}function hl(r,e){const t=je(r);return t===e||!ye(t)||It(t)?!1:we(t).position==="fixed"||hl(t,e)}function Db(r,e){const t=e.get(r);if(t)return t;let i=Xt(r,[],!1).filter(a=>ye(a)&&$t(a)!=="body"),s=null;const o=we(r).position==="fixed";let n=o?je(r):r;for(;ye(n)&&!It(n);){const a=we(n),c=Xr(n);!c&&a.position==="fixed"&&(s=null),(o?!c&&!s:!c&&a.position==="static"&&s&&kb.has(s.position)||ri(n)&&!c&&hl(r,n))?i=i.filter(d=>d!==n):s=a,n=je(n)}return e.set(r,i),i}function $b(r){let{element:e,boundary:t,rootBoundary:i,strategy:s}=r;const o=[...t==="clippingAncestors"?Yi(e)?[]:Db(e,this._c):[].concat(t),i],n=o[0],a=o.reduce((c,d)=>{const f=Yo(e,d,s);return c.top=ct(f.top,c.top),c.right=Rt(f.right,c.right),c.bottom=Rt(f.bottom,c.bottom),c.left=ct(f.left,c.left),c},Yo(e,n,s));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Mb(r){const{width:e,height:t}=al(r);return{width:e,height:t}}function Ab(r,e,t){const i=Oe(e),s=$e(e),o=t==="fixed",n=dt(r,!0,o,e);let a={scrollLeft:0,scrollTop:0};const c=Te(0);function d(){c.x=Ur(s)}if(i||!i&&!o)if(($t(e)!=="body"||ri(s))&&(a=Vi(e)),i){const m=dt(e,!0,o,e);c.x=m.x+e.clientLeft,c.y=m.y+e.clientTop}else s&&d();o&&!i&&s&&d();const f=s&&!i&&!o?cl(s,a):Te(0),u=n.left+a.scrollLeft-c.x-f.x,g=n.top+a.scrollTop-c.y-f.y;return{x:u,y:g,width:n.width,height:n.height}}function hr(r){return we(r).position==="static"}function Vo(r,e){if(!Oe(r)||we(r).position==="fixed")return null;if(e)return e(r);let t=r.offsetParent;return $e(r)===t&&(t=t.ownerDocument.body),t}function dl(r,e){const t=ce(r);if(Yi(r))return t;if(!Oe(r)){let s=je(r);for(;s&&!It(s);){if(ye(s)&&!hr(s))return s;s=je(s)}return t}let i=Vo(r,e);for(;i&&xb(i)&&hr(i);)i=Vo(i,e);return i&&It(i)&&hr(i)&&!Xr(i)?t:i||Cb(r)||t}const Nb=async function(r){const e=this.getOffsetParent||dl,t=this.getDimensions,i=await t(r.floating);return{reference:Ab(r.reference,await e(r.floating),r.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function Bb(r){return we(r).direction==="rtl"}const Hb={convertOffsetParentRelativeRectToViewportRelativeRect:Ib,getDocumentElement:$e,getClippingRect:$b,getOffsetParent:dl,getElementRects:Nb,getClientRects:Sb,getDimensions:Mb,getScale:bt,isElement:ye,isRTL:Bb};function ul(r,e){return r.x===e.x&&r.y===e.y&&r.width===e.width&&r.height===e.height}function Fb(r,e){let t=null,i;const s=$e(r);function o(){var a;clearTimeout(i),(a=t)==null||a.disconnect(),t=null}function n(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),o();const d=r.getBoundingClientRect(),{left:f,top:u,width:g,height:m}=d;if(a||e(),!g||!m)return;const x=xi(u),v=xi(s.clientWidth-(f+g)),p=xi(s.clientHeight-(u+m)),E=xi(f),C={rootMargin:-x+"px "+-v+"px "+-p+"px "+-E+"px",threshold:ct(0,Rt(1,c))||1};let w=!0;function _(S){const B=S[0].intersectionRatio;if(B!==c){if(!w)return n();B?n(!1,B):i=setTimeout(()=>{n(!1,1e-7)},1e3)}B===1&&!ul(d,r.getBoundingClientRect())&&n(),w=!1}try{t=new IntersectionObserver(_,{...C,root:s.ownerDocument})}catch{t=new IntersectionObserver(_,C)}t.observe(r)}return n(!0),o}function yr(r,e,t,i){i===void 0&&(i={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=i,d=Gr(r),f=s||o?[...d?Xt(d):[],...Xt(e)]:[];f.forEach(E=>{s&&E.addEventListener("scroll",t,{passive:!0}),o&&E.addEventListener("resize",t)});const u=d&&a?Fb(d,t):null;let g=-1,m=null;n&&(m=new ResizeObserver(E=>{let[C]=E;C&&C.target===d&&m&&(m.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var w;(w=m)==null||w.observe(e)})),t()}),d&&!c&&m.observe(d),m.observe(e));let x,v=c?dt(r):null;c&&p();function p(){const E=dt(r);v&&!ul(v,E)&&t(),v=E,x=requestAnimationFrame(p)}return t(),()=>{var E;f.forEach(C=>{s&&C.removeEventListener("scroll",t),o&&C.removeEventListener("resize",t)}),u==null||u(),(E=m)==null||E.disconnect(),m=null,c&&cancelAnimationFrame(x)}}const Ti=fb,Oi=gb,qr=hb,Kb=cb,ki=(r,e,t)=>{const i=new Map,s={platform:Hb,...t},o={...s.platform,_c:i};return lb(r,e,{...s,platform:o})};let Pb=class{constructor(r){h(this,"ctx"),h(this,"enable",!1),h(this,"contentEl"),h(this,"floatingEl"),h(this,"arrowEl"),this.ctx=r;const{TOOLTIP_BG_COLOR:e,TOOLTIP_TEXT_COLOR:t,TOOLTIP_ZINDEX:i,TOOLTIP_CUSTOM_STYLE:s,CSS_PREFIX:o}=this.ctx.config;this.contentEl=document.createElement("div"),this.arrowEl=document.createElement("div"),this.floatingEl=document.createElement("div"),this.floatingEl.className=`${o}-tooltip`,this.contentEl.className=`${o}-tooltip-content`,this.arrowEl.className=`${o}-tooltip-arrow`;const n={display:"none",position:"absolute",background:e,color:t,boxSizing:"border-box",zIndex:i,padding:"8px",borderRadius:"4px",fontSize:"12px",...s},a={position:"absolute",width:"10px",height:"10px",background:n.background,backgroundColor:n.backgroundColor,transform:"rotate(45deg)",zIndex:n.zIndex};Object.assign(this.arrowEl.style,a),Object.assign(this.floatingEl.style,n),this.floatingEl.appendChild(this.contentEl),this.floatingEl.appendChild(this.arrowEl),this.ctx.containerElement.appendChild(this.floatingEl),this.init()}init(){this.floatingEl.addEventListener("mouseleave",()=>{this.hide()}),this.ctx.on("mouseout",r=>{this.floatingEl.contains(r.relatedTarget)||this.hide()}),this.ctx.on("onScroll",()=>{this.hide()}),this.ctx.on("startEdit",()=>{this.hide()}),this.ctx.on("visibleCellHoverChange",(r,e)=>{this.floatingEl.contains(e.target)||(r.ellipsis||r.message)&&this.show(r)}),this.ctx.on("visibleCellMouseleave",(r,e)=>{this.floatingEl.contains(e.target)||this.hide()}),this.ctx.on("cellHeaderMouseleave",(r,e)=>{this.floatingEl.contains(e.target)||this.hide()}),this.ctx.on("cellHeaderHoverChange",(r,e)=>{this.floatingEl.contains(e.target)||r.ellipsis&&this.show(r)}),this.ctx.on("cellFooterMouseleave",(r,e)=>{this.floatingEl.contains(e.target)||this.hide()}),this.ctx.on("cellFooterHoverChange",(r,e)=>{this.floatingEl.contains(e.target)||r.ellipsis&&this.show(r)}),this.ctx.on("cellShowTooltip",(r,e)=>{this.show(r,e)}),this.ctx.on("cellHideTooltip",()=>{this.hide()})}show(r,e){if(this.ctx.contextMenuIng||!r.overflowTooltipShow||this.ctx.mousedown)return;this.floatingEl.style.display="block";let t=r.getText();r.message&&(t=r.message),e&&(t=e);const i=this.ctx.containerElement.getBoundingClientRect();if(!i)return;this.enable=!0,this.contentEl.style.maxWidth=`${r.overflowTooltipMaxWidth||500}px`,this.contentEl.style.minWidth="100px",this.contentEl.style.width="100%",this.contentEl.style.display="inline-block",this.contentEl.style.wordBreak="break-all",this.contentEl.style.lineHeight="1.5",this.contentEl.innerText=t;const s=r.drawX+i.x,o=r.drawY+i.y;ki({getBoundingClientRect(){return{width:r.visibleWidth,height:r.visibleHeight,x:s,y:o,left:s,right:s+r.visibleWidth,top:o,bottom:o+r.visibleHeight}}},this.floatingEl,{placement:r.overflowTooltipPlacement,middleware:[Oi(),qr(),Ti(6),Kb({element:this.arrowEl})]}).then(n=>{const{x:a,y:c,placement:d,middlewareData:f}=n;if(Object.assign(this.floatingEl.style,{top:`${c}px`,left:`${a}px`}),f.arrow){const u=f.arrow;["left","left-start","left-end"].includes(d)?Object.assign(this.arrowEl.style,{top:`${u.y}px`,bottom:"",left:"",right:"-5px"}):["right","right-start","right-end"].includes(d)?Object.assign(this.arrowEl.style,{top:`${u.y}px`,bottom:"",left:"-5px",right:""}):["bottom","bottom-start","bottom-end"].includes(d)?Object.assign(this.arrowEl.style,{top:"-5px",bottom:"",left:`${u.x}px`,right:""}):["top","top-start","top-end"].includes(d)&&Object.assign(this.arrowEl.style,{top:"",bottom:"-5px",left:`${u.x}px`,right:""})}})}hide(){this.enable&&(this.enable=!1,this.floatingEl.style.display="none")}destroy(){this.contentEl.remove(),this.arrowEl.remove(),this.floatingEl.remove()}};class Yb{constructor(e){h(this,"editorEl"),h(this,"inputEl"),h(this,"enable",!1),h(this,"cellTarget",null),h(this,"selectorArrStr",""),h(this,"ctx"),h(this,"drawY",0),h(this,"drawX",0),h(this,"cancel",!1),this.ctx=e,this.initTextEditor(),this.init()}init(){this.ctx.on("outsideMousedown",()=>{this.cellTarget&&this.cellTarget.editorType==="text"&&this.clearEditor()}),this.ctx.on("moveFocus",e=>{this.cellTarget=e;const{xArr:t,yArr:i}=this.ctx.selector;this.selectorArrStr=JSON.stringify(t)+JSON.stringify(i)}),this.ctx.on("onScroll",()=>{this.enable&&this.doneEdit()}),this.ctx.on("hoverIconClick",e=>{this.ctx.disableHoverIconClick||this.editCell(e.rowIndex,e.colIndex)}),this.ctx.on("cellMousedown",()=>{this.inputEl.focus({preventScroll:!0})}),this.ctx.on("keydown",e=>{if(!this.ctx.isTarget(e)||!this.ctx.focusCell||this.ctx.finding)return;if(e.code==="Escape"&&this.ctx.editing){this.cancel=!0;const{focusCell:a}=this.ctx;a&&(this.ctx.emit("setSelectorCell",a),this.cellTarget=a),this.doneEdit();return}if((e.altKey||e.metaKey)&&e.key==="Enter"&&this.ctx.editing&&this.inputEl){e.preventDefault();const a=this.inputEl.selectionStart,c=this.inputEl.value.substring(0,a),d=this.inputEl.value.substring(a);this.inputEl.value=c+`
5
- `+d,this.inputEl.selectionStart=this.inputEl.selectionEnd=a+1,this.autoSize();return}if(e.code==="Tab"&&this.ctx.editing){if(e.preventDefault(),this.doneEdit(),e.shiftKey){this.ctx.emit("setMoveFocus","LEFT");return}this.ctx.emit("setMoveFocus","RIGHT");return}if(e.key==="Enter"&&this.ctx.editing){if(e.preventDefault(),this.doneEdit(),e.shiftKey){this.ctx.emit("setMoveFocus","TOP");return}this.ctx.emit("setMoveFocus","BOTTOM");return}if(e.key==="Enter"&&!this.ctx.editing){e.preventDefault(),this.startEdit();return}const t=e.key,i=e.ctrlKey,s=e.altKey,o=e.shiftKey,n=e.metaKey;i||s||o||n||["Enter","Escape","Tab","Backspace","Delete","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown","Insert","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"].includes(t)||this.startEdit(!0)}),this.ctx.on("cellMouseup",e=>{if(this.ctx.isPointer||!this.isInSelectorRange(e.rowIndex,e.colIndex))return;const{xArr:t,yArr:i}=this.ctx.selector,s=JSON.stringify(t)+JSON.stringify(i);if(this.selectorArrStr===s&&this.cellTarget){if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.onlyMergeCell){this.startEdit();return}if(this.ctx.selectOnlyOne&&e.rowKey===this.cellTarget.rowKey&&e.key===this.cellTarget.key){this.startEdit();return}}if(this.selectorArrStr=s,this.doneEdit(),this.cellTarget=e,this.ctx.config.ENABLE_EDIT_SINGLE_CLICK){if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.onlyMergeCell){this.startEdit();return}this.ctx.selectOnlyOne&&this.startEdit()}}),this.ctx.on("mousedownBodyOutside",()=>{this.enable&&this.doneEdit(),this.cellTarget=null})}isInSelectorRange(e,t){const{xArr:i,yArr:s}=this.ctx.selector,[o,n]=i,[a,c]=s;return!(t<o||t>n||e<a||e>c)}initTextEditor(){this.inputEl=document.createElement("textarea"),this.inputEl.id="e-virt-table-editor-textarea",this.inputEl.setAttribute("rows","1"),this.inputEl.setAttribute("tabindex","-1"),this.inputEl.addEventListener("input",this.autoSize.bind(this)),this.editorEl=this.ctx.editorElement,this.inputEl.className="e-virt-table-editor-textarea",this.editorEl.appendChild(this.inputEl),this.ctx.containerElement.appendChild(this.editorEl)}autoSize(){const e=this.inputEl.value;this.cellTarget&&this.cellTarget.type==="number"&&e!==""&&(this.ctx.emit("cellHideTooltip"),/^-?\d+(\.\d+)?$/.test(e)||this.ctx.emit("cellShowTooltip",this.cellTarget,this.ctx.config.NUMBER_ERROR_TIP)),this.inputEl.style.height="auto";let t=this.inputEl.scrollHeight,i=this.ctx.body.visibleHeight;t>i&&(t=i);const{stageHeight:s,footer:o,header:n,config:{SCROLLER_TRACK_SIZE:a}}=this.ctx,c=s-o.height-a;this.editorEl.style.bottom="auto",this.drawY<n.height&&(this.editorEl.style.top=`${n.height-1}px`),this.drawY+t>c&&(this.editorEl.style.left=`${this.drawX-1}px`,this.editorEl.style.top="auto",this.editorEl.style.bottom=`${s-c}px`),this.inputEl.style.height=`${t}px`}startEditByInput(e,t=!1){const i=t?null:e.getValue(),{editorType:s}=e;if(s==="none")return;e.update(),this.ctx.config.ENABLE_MERGE_CELL_LINK&&e.updateSpanInfo();let{height:o,width:n,drawY:a,drawX:c}=e;this.drawX=c,this.drawY=a;const{config:{CELL_PADDING:d},header:f}=this.ctx;let u=this.ctx.body.visibleHeight;o>u&&(o=u),this.editorEl.style.display="inline-block",this.editorEl.style.zIndex="100",this.editorEl.style.left=`${this.drawX-1}px`,this.editorEl.style.top=`${this.drawY-1}px`,this.editorEl.style.bottom="auto",this.editorEl.style.maxHeight=`${u}px`,s==="text"?(this.inputEl.style.display="inline-block",this.inputEl.style.minWidth=`${n-1}px`,this.inputEl.style.minHeight=`${o-1}px`,this.inputEl.style.maxHeight=`${u}px`,this.inputEl.style.width=`${n-1}px`,this.inputEl.style.height="auto",this.inputEl.style.padding=`${d}px`,this.inputEl.value="",i!==null&&(this.inputEl.value=i,this.inputEl.focus({preventScroll:!0}))):this.inputEl.style.display="none",(this.inputEl.scrollHeight>o||this.drawY<f.height)&&this.autoSize()}doneEditByInput(){if(this.cellTarget&&this.cellTarget.editorType==="text"){const{rowKey:e,key:t}=this.cellTarget,i=this.cellTarget.getValue(),s=this.inputEl.value;s!==i&&!(s===""&&i===null)&&!this.cancel&&this.ctx.setItemValueByEditor(e,t,s,!0)}}startEdit(e=!1){this.cancel=!1;const{ENABLE_EDIT_CLICK_SELECTOR:t}=this.ctx.config;if(!t)return;const i=this.ctx.focusCell;if(!i||["index","index-selection","selection"].includes(i.type)||this.enable||!(i.isVerticalVisible()&&i.isHorizontalVisible()))return;const{rowKey:s,key:o}=i,n=this.ctx.database.getReadonly(s,o);i&&!n&&(this.enable=!0,this.ctx.editing=!0,this.cellTarget=i,this.startEditByInput(this.cellTarget,e),this.ctx.emit("startEdit",this.cellTarget),this.ctx.emit("draw"))}editCell(e,t){const i=this.ctx.body.renderRows.find(d=>d.rowIndex===e);if(!i)return;const s=i.cells.find(d=>d.colIndex===t);if(!s)return;this.ctx.emit("setSelectorCell",s);const o=this.ctx.focusCell;if(!o||["index","index-selection","selection"].includes(o.type)||this.enable)return;const{rowKey:n,key:a}=o,c=this.ctx.database.getReadonly(n,a);o&&!c&&(this.enable=!0,this.ctx.editing=!0,this.cellTarget=o,this.startEditByInput(this.cellTarget),this.ctx.emit("startEdit",this.cellTarget),this.ctx.emit("draw"))}doneEdit(){if(!this.enable)return;const{header:e,config:{CELL_HEIGHT:t}}=this.ctx;this.doneEditByInput(),this.ctx.emit("cellHideTooltip"),this.ctx.emit("doneEdit",this.cellTarget),this.enable=!1,this.ctx.editing=!1,this.inputEl.style.display="inline-block",this.editorEl.style.left="0px",this.editorEl.style.top=`${e.height}px`,this.editorEl.style.maxHeight=`${t}px`,this.editorEl.style.zIndex="-1",setTimeout(()=>{this.inputEl.focus({preventScroll:!0})},0),this.ctx.emit("draw")}clearEditor(){this.doneEdit(),this.cellTarget=null,this.selectorArrStr="",this.ctx.clearSelector(),this.ctx.focusCell=void 0,this.ctx.emit("draw")}destroy(){var e;(e=this.editorEl)==null||e.remove()}}let Vb=class{constructor(r){h(this,"ctx"),h(this,"emptyEl"),this.ctx=r;const{EMPTY_TEXT:e,EMPTY_CUSTOM_STYLE:t}=this.ctx.config;this.ctx.emptyElement?this.emptyEl=this.ctx.emptyElement:(this.emptyEl=document.createElement("div"),this.emptyEl.innerText=e),this.emptyEl.className="e-virt-table-empty",this.emptyEl.style.display="none",this.ctx.containerElement.appendChild(this.emptyEl),this.ctx.on("emptyChange",({type:i,headerHeight:s,bodyHeight:o,footerHeight:n})=>{const a=s+(o+n)/2,c={display:i==="empty"?"block":"none",top:`${a}px`,...t};Object.assign(this.emptyEl.style,c)})}destroy(){this.emptyEl.remove()}};class Wb{constructor(e){h(this,"ctx"),h(this,"observer"),this.ctx=e,this.init()}arerMapsEqual(e,t){if(e.size!==t.size)return!1;for(let[i,s]of e)if(!t.has(i)||t.get(i)!==s)return!1;return!0}init(){this.observer=new MutationObserver(Kr(()=>{const e=this.ctx.overlayerElement.querySelectorAll('[data-auto-height="true"]'),t=new Map;e.forEach(s=>{const o=Number(s.getAttribute("data-row-index")),n=Number(s.getAttribute("data-col-index"));if(isNaN(o)||isNaN(n))return;const a=s.getBoundingClientRect(),c=`${o}​_${n}`;t.set(c,Math.round(a.height))});const i=this.ctx.database.getOverlayerAutoHeightMap();if(!this.arerMapsEqual(i,t)){if(this.ctx.database.setOverlayerAutoHeightMap(t),i.size===0&&t.size===0)return;this.ctx.emit("draw")}},16.67)),this.observer.observe(this.ctx.overlayerElement,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),this.ctx.overlayerElement.getAttribute("data-overlayer")==="default"&&this.ctx.on("overlayerChange",e=>{const t=this.ctx.overlayerElement;t.replaceChildren(),Object.assign(t.style,e.style),e.views.forEach(i=>{const s=document.createElement("div");s.className=i.class,Object.assign(s.style,i.style),i.views.forEach(o=>{const n=document.createElement("div");Object.assign(n.style,o.style),o.cells.forEach(a=>{const c=document.createElement("div");Object.assign(c.style,a.style),Object.keys(a.domDataset).forEach(d=>{c.setAttribute(d,a.domDataset[d])}),typeof a.render=="function"&&a.render(c,a),n.appendChild(c)}),s.appendChild(n)}),t.appendChild(s)})})}draw(){const e=this.getContainer();this.ctx.emit("overlayerChange",e)}destroy(){this.observer&&this.observer.disconnect(),this.ctx.emit("overlayerChange",{style:{},views:[]})}getContainer(){const e=this.getHeader(),t=this.getBody(),i=this.getFooter();let s=[];const{FOOTER_FIXED:o,FOOTER_POSITION:n}=this.ctx.config;return o?n==="top"?s=[e,i,t]:s=[e,t,i]:s=[e,t],{views:s}}getHeader(){const{fixedLeftWidth:e,fixedRightWidth:t,config:{SCROLLER_TRACK_SIZE:i,CSS_PREFIX:s}}=this.ctx,{visibleWidth:o,visibleHeight:n,renderCellHeaders:a}=this.ctx.header;let c=[],d=[],f=[];a.forEach(v=>{v.render&&(v.fixed==="left"?d.push(v):v.fixed==="right"?f.push(v):c.push(v))});const u=t-i,g={key:"left",style:{position:"absolute",top:"0px",left:"0px",overflow:"hidden",width:`${e}px`,height:`${n}px`},cells:d},m={key:"center",style:{position:"absolute",top:"0px",left:`${e}px`,overflow:"hidden",width:`${o-e-u+1}px`,height:`${n}px`},cells:c},x={key:"right",style:{position:"absolute",top:"0px",right:"0px",overflow:"hidden",width:`${u+1}px`,height:`${n}px`},cells:f};return{type:"header",class:`${s}-overlayer-header`,style:{position:"relative",overflow:"hidden",width:`${o}px`,height:`${n}px`},views:[g,m,x]}}getBody(){const e=[],t=[],i=[];let s=this.ctx.body.renderRows;this.ctx.config.FOOTER_FIXED||(s=s.concat(this.ctx.footer.renderRows)),s.forEach(v=>{v.cells.forEach(p=>{p.cellType==="footer"&&(p.render=p.renderFooter),p.render&&(p.fixed==="left"?t.push(p):p.fixed==="right"?i.push(p):e.push(p))})});const{fixedLeftWidth:o,fixedRightWidth:n,config:{SCROLLER_TRACK_SIZE:a,CSS_PREFIX:c}}=this.ctx,{visibleWidth:d,visibleHeight:f}=this.ctx.body,u=n-a,g={key:"left",style:{position:"absolute",top:`${.5}px`,left:`${.5}px`,overflow:"hidden",width:`${o}px`,height:`${f}px`},cells:t},m={key:"center",style:{position:"absolute",top:`${.5}px`,left:`${o-.5}px`,overflow:"hidden",width:`${d-o-u}px`,height:`${f}px`},cells:e},x={key:"right",style:{position:"absolute",top:"0px",right:"0px",overflow:"hidden",width:`${u}px`,height:`${f}px`},cells:i};return{type:"body",class:`${c}-overlayer-body`,style:{position:"relative",overflow:"hidden",width:`${d}px`,height:`${f}px`},views:[g,m,x]}}getFooter(){const e=[],t=[],i=[];this.ctx.footer.renderRows.forEach(x=>{x.cells.forEach(v=>{v.cellType==="footer"&&v.renderFooter&&(v.render=v.renderFooter,v.fixed==="left"?t.push(v):v.fixed==="right"?i.push(v):e.push(v))})});const{fixedLeftWidth:s,fixedRightWidth:o,config:{SCROLLER_TRACK_SIZE:n,CSS_PREFIX:a}}=this.ctx,{visibleWidth:c,visibleHeight:d}=this.ctx.footer,f=o-n,u={key:"left",style:{position:"absolute",top:`${.5}px`,left:`${.5}px`,overflow:"hidden",width:`${s}px`,height:`${d}px`},cells:t},g={key:"center",style:{position:"absolute",top:`${.5}px`,left:`${s-.5}px`,overflow:"hidden",width:`${c-s-f}px`,height:`${d}px`},cells:e},m={key:"right",style:{position:"absolute",top:`${.5}px`,right:`${.5}px`,overflow:"hidden",width:`${f}px`,height:`${d}px`},cells:i};return{type:"footer",class:`${a}-overlayer-footer`,style:{position:"relative",overflow:"hidden",width:`${c}px`,height:`${d}px`},views:[u,g,m]}}}class Wo{constructor(e,t=[],i={}){h(this,"container"),h(this,"menuData"),h(this,"onClick"),h(this,"activeSubmenus",new Set),h(this,"boundMouseEnterHandler"),h(this,"boundMouseLeaveHandler"),h(this,"boundClickHandler"),this.container=e,this.menuData=t,this.onClick=i.onClick,this.boundMouseEnterHandler=s=>this.handleMouseEvent(s,"enter"),this.boundMouseLeaveHandler=s=>this.handleMouseEvent(s,"leave"),this.boundClickHandler=s=>this.handleClick(s),this.createMenu(),this.bindEvents()}createMenu(){this.container.className="e-virt-table-main-menu",this.container.style.display="block";const e=document.createDocumentFragment();this.menuData.forEach(t=>{e.appendChild(this.createMenuItem(t))}),this.container.appendChild(e)}createMenuItem(e,t=!1){var i;const s=this.createElement("div",t?"e-virt-table-submenu-item":"e-virt-table-menu-item");s.setAttribute(t?"data-submenu":"data-menu",e.value),e.disabled&&s.classList.add("disabled");const o=this.createElement("div","e-virt-table-menu-item-content");if(e.icon){const a=this.createElement("span","e-virt-table-menu-item-icon");a.innerHTML=e.icon,o.appendChild(a)}else o.classList.add("menu-item-no-icon");const n=this.createElement("span","e-virt-table-menu-item-text");if(n.textContent=e.label,o.appendChild(n),s.appendChild(o),(i=e.children)!=null&&i.length){const a=this.createElement("span","e-virt-table-menu-arrow");a.innerHTML=_i,s.appendChild(a);const c=this.createSubmenu(e.children);s._submenu=c,this.container.appendChild(c)}return s}createSubmenu(e){const t=this.createElement("div","e-virt-table-submenu");return e.forEach(i=>{t.appendChild(this.createMenuItem(i,!0))}),t}createElement(e,t=""){const i=document.createElement(e);return t&&(i.className=t),i}bindEvents(){this.container.addEventListener("mouseenter",this.boundMouseEnterHandler,!0),this.container.addEventListener("mouseleave",this.boundMouseLeaveHandler,!0),this.container.addEventListener("click",this.boundClickHandler)}handleMouseEvent(e,t){e.stopPropagation();const i=e.target.closest(".e-virt-table-menu-item, .e-virt-table-submenu-item");i&&(this.container.contains(i)||i.classList.contains("e-virt-table-submenu-item"))&&(t==="enter"?this.handleHover(i):this.handleLeave(i))}handleHover(e){e.classList.contains("e-virt-table-menu-item")&&(this.container.querySelectorAll(".e-virt-table-menu-item").forEach(i=>i.classList.remove("active")),e.classList.contains("disabled")||e.classList.add("active"));const t=e._submenu||e.querySelector(".e-virt-table-submenu");t&&(this.hideSiblingSubmenus(e),this.showSubmenu(e,t))}handleLeave(e){const t=e._submenu||e.querySelector(".e-virt-table-submenu");setTimeout(()=>{const i=t;i&&!i.matches(":hover")&&!e.matches(":hover")&&(this.hideSubmenu(i),e.classList.contains("e-virt-table-menu-item")&&e.classList.remove("active"))},150)}hideSiblingSubmenus(e){let t;if(e.classList.contains("e-virt-table-menu-item"))t=this.container.querySelectorAll(".e-virt-table-menu-item");else{const i=e.closest(".e-virt-table-submenu");if(i)t=i.querySelectorAll(".e-virt-table-submenu-item");else return}t.forEach(i=>{i!==e&&i._submenu&&this.hideSubmenu(i._submenu)})}async showSubmenu(e,t){if(this.activeSubmenus.has(t))return;this.activeSubmenus.add(t),t.classList.add("show");const i=yr(e,t,async()=>{const s=this.container.getBoundingClientRect(),o=window.innerWidth,n=t.offsetWidth||200,a=o-s.right,c=s.left,d=a>=n||a>=c?"right-start":"left-start",{x:f,y:u}=await ki(e,t,{placement:d,middleware:[Ti(8),Oi({padding:8})]});Object.assign(t.style,{left:`${f}px`,top:`${u}px`})});t._cleanup=i}hideSubmenu(e){if(!this.activeSubmenus.has(e))return;this.activeSubmenus.delete(e),e.classList.remove("show"),this.hideAllChildSubmenus(e);const t=e;t._cleanup&&(t._cleanup(),delete t._cleanup)}hideAllChildSubmenus(e){e.querySelectorAll(".e-virt-table-submenu-item").forEach(t=>{if(t._submenu){const i=t._submenu;if(this.activeSubmenus.has(i)){this.activeSubmenus.delete(i),i.classList.remove("show");const s=i;s._cleanup&&(s._cleanup(),delete s._cleanup),this.hideAllChildSubmenus(i)}}})}handleClick(e){e.stopPropagation();const t=e.target.closest(".e-virt-table-menu-item, .e-virt-table-submenu-item");if(!t||t.classList.contains("disabled"))return;if(t.classList.contains("e-virt-table-menu-item")){const o=t._submenu||t.querySelector(".e-virt-table-submenu");if(o){this.showSubmenu(t,o);return}}const i=t.getAttribute("data-menu")||(t==null?void 0:t.getAttribute("data-submenu")),s=this.findMenuItem(i||"");s&&(s.event&&s.event(e,this.hide.bind(this)),this.onClick&&this.onClick(s,i||""))}findMenuItem(e,t=this.menuData){for(const i of t){if(i.value===e)return i;if(i.children){const s=this.findMenuItem(e,i.children);if(s)return s}}return null}positionMenu(e){const t={getBoundingClientRect:()=>({width:0,height:0,top:e.clientY,left:e.clientX,right:e.clientX,bottom:e.clientY,x:e.clientX,y:e.clientY}),contextElement:document.body};yr(t,this.container,()=>{ki(t,this.container,{placement:"right-start",middleware:[Ti(),Oi(),qr()]}).then(({x:i,y:s})=>{this.container&&Object.assign(this.container.style,{left:`${i}px`,top:`${s}px`})})})}hide(){this.cleanupAllSubmenus(this.container),this.container.style.display="none"}destroy(){this.container.removeEventListener("mouseenter",this.boundMouseEnterHandler,!0),this.container.removeEventListener("mouseleave",this.boundMouseLeaveHandler,!0),this.container.removeEventListener("click",this.boundClickHandler),this.cleanupAllSubmenus(this.container),this.container.style.display="none",this.container.replaceChildren()}removeMenuItem(e){const t=this.container.querySelector(`[data-menu="${e}"]`);if(!t)return!1;const i=t.querySelector(".e-virt-table-submenu");return i&&this.cleanupSubmenuRecursively(i),t.remove(),!0}removeSubMenuItem(e){const t=this.container.querySelector(`[data-submenu="${e}"]`);if(!t)return!1;const i=t.closest(".e-virt-table-submenu"),s=t._submenu;if(s&&this.cleanupSubmenuRecursively(s),t.remove(),i&&i.querySelectorAll(".e-virt-table-submenu-item").length===0){const o=this.container.querySelector("[data-menu]");if(o&&o._submenu===i)this.removeMenuItem(o.getAttribute("data-menu")||"");else{const n=this.container.querySelectorAll("[data-menu], [data-submenu]");for(const a of n)if(a._submenu===i){const c=a.getAttribute("data-menu")||a.getAttribute("data-submenu");c&&(a.hasAttribute("data-menu")?this.removeMenuItem(c):this.removeSubMenuItem(c));break}}}return!0}cleanupAllSubmenus(e){e.querySelectorAll(".e-virt-table-menu-item").forEach(t=>{t._submenu&&(this.cleanupSubmenuRecursively(t._submenu),t._submenu=void 0)})}cleanupSubmenuRecursively(e){const t=e;t._cleanup&&(t._cleanup(),delete t._cleanup),e.querySelectorAll(".e-virt-table-submenu-item").forEach(i=>{i._submenu&&this.cleanupSubmenuRecursively(i._submenu)}),e.remove()}}class Xb{constructor(e){h(this,"ctx"),h(this,"contextMenuEl"),h(this,"currentDOMTreeMenu"),h(this,"isCustom",!1),this.ctx=e,this.ctx.contextMenuElement?(this.contextMenuEl=this.ctx.contextMenuElement,this.contextMenuEl.className="e-virt-table-main-menu",this.isCustom=!0):(this.contextMenuEl=document.createElement("div"),this.isCustom=!1),this.ctx.containerElement.appendChild(this.contextMenuEl),this.init()}init(){this.ctx.on("outsideMousedown",()=>{this.hide()}),this.ctx.on("cellContextMenuClick",(e,t)=>{if(this.isCustom){this.contextMenuEl.style.display="block",this.positionMenu(t);return}const{ENABLE_CONTEXT_MENU:i,CUSTOM_BODY_CONTEXT_MENU:s,CONTEXT_MENU:o}=this.ctx.config,n=[...o,...s];if(!i||n.length===0)return;t.preventDefault();const{xArr:a,yArr:c}=this.ctx.selector,[d,f]=a,[u,g]=c,{rowIndex:m,colIndex:x}=e;m>=u&&m<=g&&x>=d&&x<=f||this.ctx.emit("setSelectorCell",e,t),this.currentDOMTreeMenu&&this.currentDOMTreeMenu.destroy(),this.ctx.contextMenuIng=!0,this.currentDOMTreeMenu=new Wo(this.contextMenuEl,n,{onClick:(v,p)=>{p==="copy"?(this.ctx.emit("contextMenuCopy"),this.hide()):p==="paste"?(this.ctx.emit("contextMenuPaste"),this.hide()):p==="cut"?(this.ctx.emit("contextMenuCut"),this.hide()):p==="clearSelected"&&(this.ctx.emit("contextMenuClearSelected"),this.hide())}}),this.currentDOMTreeMenu.positionMenu(t)}),this.ctx.on("cellHeaderContextMenuClick",(e,t)=>{if(this.isCustom){this.contextMenuEl.style.display="block",this.positionMenu(t);return}const{SELECTOR_AREA_MIN_X:i,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MAX_X_OFFSET:o}=this.ctx.config,n=i,a=s||this.ctx.maxColIndex-o;if(e.colIndex<n||e.colIndex>a)return;const{HEADER_CONTEXT_MENU:c,CUSTOM_HEADER_CONTEXT_MENU:d,ENABLE_HEADER_CONTEXT_MENU:f}=this.ctx.config,u=[...c,...d];if(!f||u.length===0)return;t.preventDefault();const{xArr:g}=this.ctx.selector,[m,x]=g,{colIndex:v}=e;v>=m&&v<=x||(this.ctx.focusCellHeader=e,this.ctx.emit("selectCols",e)),this.currentDOMTreeMenu&&this.currentDOMTreeMenu.destroy();const p=this.ctx.database.getColumns(),E=u.map(C=>C.value==="visible"?{...C,children:this.filterColumns(p)}:C);this.ctx.contextMenuIng=!0,this.currentDOMTreeMenu=new Wo(this.contextMenuEl,E,{onClick:(C,w)=>{const{xArr:_}=this.ctx.selector,[S,B]=_;if(w==="fixedLeft"||w==="fixedRight"||w==="fixedNone"){const K=this.ctx.header.allCellHeaders.filter(R=>R.colIndex>=S&&R.colIndex<=B).filter(R=>R.level===0).filter(R=>!R.column.fixedDisabled).map(R=>R.key);this.ctx.database.setCustomHeaderFixedData(K,w==="fixedLeft"?"left":w==="fixedRight"?"right":""),this.hide()}else if(w==="hide"){const K=this.ctx.header.leafCellHeaders.filter(R=>R.colIndex>=S&&R.colIndex<=B).filter(R=>!R.children.length).filter(R=>!R.column.hideDisabled).map(R=>R.key);K.length>0&&this.ctx.database.setCustomHeaderHideData(K,!0),this.hide()}else if(w!=="visible")if(w.startsWith("visible_")){if(!C.key)return;if(C.children){const R=this.getLeafKeys(C.children);this.ctx.database.setCustomHeaderHideData(R,!1)}else this.ctx.database.setCustomHeaderHideData([C.key],!1);this.currentDOMTreeMenu&&this.currentDOMTreeMenu.removeSubMenuItem(w);const K=this.ctx.database.getColumns();Wt(K).filter(R=>R.hide).length===0&&this.hide()}else w==="resetHeader"&&(this.ctx.database.resetCustomHeader(),this.hide())}}),this.positionMenu(t)}),this.ctx.on("click",()=>{this.hide()}),this.ctx.on("onScroll",this.hide.bind(this)),this.ctx.on("resize",this.hide.bind(this))}positionMenu(e){const t={getBoundingClientRect:()=>({width:0,height:0,top:e.clientY,left:e.clientX,right:e.clientX,bottom:e.clientY,x:e.clientX,y:e.clientY}),contextElement:document.body};yr(t,this.contextMenuEl,()=>{ki(t,this.contextMenuEl,{placement:"right-start",middleware:[Ti(),Oi(),qr()]}).then(({x:i,y:s})=>{this.contextMenuEl&&Object.assign(this.contextMenuEl.style,{left:`${i}px`,top:`${s}px`})})})}filterColumns(e){const t=[];for(const i of e)if(i.children&&i.children.length>0){const s=this.filterColumns(i.children);s.length>0&&t.push({label:i.title,key:i.key,value:`visible_${i.key}`,children:s})}else i.hide&&t.push({label:i.title,value:`visible_${i.key}`,key:i.key});return t}getLeafKeys(e){return e.reduce((t,i)=>(!i.children||i.children.length===0?t.push(String(i.key)):t.push(...this.getLeafKeys(i.children)),t),[])}hide(){this.currentDOMTreeMenu&&(this.currentDOMTreeMenu.destroy(),this.currentDOMTreeMenu=void 0),this.contextMenuEl.style.display="none",this.ctx.contextMenuIng=!1}destroy(){var e;this.hide(),(e=this.contextMenuEl)==null||e.remove()}}class zb{constructor(e){if(h(this,"ctx"),h(this,"loadingEl"),this.ctx=e,this.ctx.loadingElement)this.loadingEl=this.ctx.loadingElement;else{this.loadingEl=document.createElement("div");const t=document.createElement("div");t.className="e-virt-table-loading-spinner";const i=this.ctx.icons.getSvg("loading");if(i){const o=new DOMParser().parseFromString(i.svg,"image/svg+xml").documentElement;t.appendChild(o)}const s=document.createElement("p");s.className="e-virt-table-loading-text",s.innerText=this.ctx.config.LOADING_TEXT,t.appendChild(s),this.loadingEl.appendChild(t)}this.loadingEl.className="e-virt-table-loading",this.loadingEl.style.display="none",this.ctx.containerElement.appendChild(this.loadingEl)}show(){this.loadingEl.style.display="flex"}hide(){this.loadingEl.style.display="none"}destroy(){this.loadingEl.remove()}}class Gb{constructor(e){h(this,"ctx"),h(this,"container"),h(this,"input"),h(this,"prevBtn"),h(this,"nextBtn"),h(this,"closeBtn"),h(this,"countEl"),h(this,"loadingEl"),h(this,"isVisible",!1),h(this,"searchResults",[]),h(this,"currentIndex",-1),h(this,"searchData",[]),h(this,"isComposing",!1),this.ctx=e,this.container=this.createContainer(),this.ctx.containerElement.appendChild(this.container),this.bindEvents(),this.ctx.on("keydown",t=>{if(this.ctx.config.ENABLE_FINDER&&!this.ctx.editing){if((t.ctrlKey||t.metaKey)&&t.code==="KeyF"){t.preventDefault(),this.show();return}if(this.ctx.finding){if(t.code==="Escape"){t.preventDefault(),this.hide();return}if(t.code==="ArrowUp"||t.shiftKey&&t.key==="Enter"){t.preventDefault(),this.navigatePrevious();return}if(t.code==="ArrowDown"||t.key==="Enter"){t.preventDefault(),this.navigateNext();return}}}}),this.ctx.on("setSelector",()=>{this.hide()}),this.ctx.on("outsideMousedown",()=>{this.hide()})}async initSearchData(){this.showLoading(),this.searchData=[],setTimeout(()=>{const{allCellHeaders:e}=this.ctx.header;for(let s=0;s<e.length;s++){const o=e[s];o&&["string","number"].includes(typeof o.text)&&this.searchData.push({rowIndex:0,colIndex:o.colIndex,text:`${o.text}`,type:"header",colKey:o.key})}const{maxColIndex:t,maxRowIndex:i}=this.ctx;for(let s=0;s<i;s++)for(let o=0;o<t;o++){const n=this.ctx.database.getVirtualBodyCell(s,o,!1),a=n==null?void 0:n.getText();["string","number"].includes(typeof a)&&this.searchData.push({rowIndex:s,colIndex:o,text:`${a}`,type:"body"})}this.hideLoading()},0)}createContainer(){const e=document.createElement("div");e.className="e-virt-table-finder-bar";const t=document.createElement("div");t.className="e-virt-table-finder-bar-input-wrapper",this.input=document.createElement("input"),this.input.type="text",this.input.className="e-virt-table-finder-bar-input",this.input.placeholder="",t.appendChild(this.input),this.loadingEl=document.createElement("div"),this.loadingEl.className="e-virt-table-finder-bar-loading";const i=el;this.loadingEl.innerHTML=i,t.appendChild(this.loadingEl),this.countEl=document.createElement("span"),this.countEl.className="e-virt-table-finder-bar-count";const s=document.createElement("div");return s.className="e-virt-table-finder-bar-nav",this.prevBtn=document.createElement("button"),this.prevBtn.className="e-virt-table-finder-bar-nav-btn prev-btn",this.prevBtn.innerHTML=_i,this.nextBtn=document.createElement("button"),this.nextBtn.className="e-virt-table-finder-bar-nav-btn next-btn",this.nextBtn.innerHTML=_i,s.appendChild(this.prevBtn),s.appendChild(this.nextBtn),this.closeBtn=document.createElement("button"),this.closeBtn.className="e-virt-table-finder-bar-nav-btn close-btn",this.closeBtn.innerHTML="×",e.appendChild(t),e.appendChild(this.countEl),e.appendChild(s),e.appendChild(this.closeBtn),e}bindEvents(){this.input.addEventListener("input",()=>{this.isComposing||this.performSearch()}),this.input.addEventListener("compositionstart",()=>{this.isComposing=!0}),this.input.addEventListener("compositionend",()=>{this.isComposing=!1,this.performSearch()}),this.prevBtn.addEventListener("click",()=>{this.navigatePrevious()}),this.nextBtn.addEventListener("click",()=>{this.navigateNext()}),this.closeBtn.addEventListener("click",()=>{this.hide()})}performSearch(){const e=this.input.value.trim();if(this.searchResults=[],this.currentIndex=-1,!e){this.cearFinderBar(),this.updateCount();return}this.showLoading(),setTimeout(()=>{this.searchResults=this.searchData.filter(t=>t.text.toLowerCase().includes(e.toLowerCase())),this.searchResults.length>0?(this.currentIndex=0,this.scrollToCurrentResult()):this.cearFinderBar(),this.updateCount(),this.hideLoading()},0)}scrollToCurrentResult(){if(this.currentIndex<0||this.currentIndex>=this.searchResults.length)return;const e=this.searchResults[this.currentIndex];this.ctx.finderBar=e;const{rowIndex:t,colIndex:i}=e;this.ctx.emit("scrollToIndex",t,i)}navigateNext(){this.searchResults.length!==0&&(this.currentIndex=(this.currentIndex+1)%this.searchResults.length,this.scrollToCurrentResult(),this.updateCount())}navigatePrevious(){this.searchResults.length!==0&&(this.currentIndex=this.currentIndex<=0?this.searchResults.length-1:this.currentIndex-1,this.scrollToCurrentResult(),this.updateCount())}updateCount(){if(this.searchResults.length===0)this.input.value.trim()?(this.countEl.textContent="0/0",this.countEl.classList.add("no-results")):(this.countEl.textContent="",this.countEl.classList.remove("no-results"));else{const e=this.currentIndex+1,t=this.searchResults.length;this.countEl.textContent=`${e}/${t}`,this.countEl.classList.remove("no-results")}}show(){this.isVisible||(this.isVisible=!0,this.ctx.finding=!0,this.container.classList.add("show"),this.input.focus(),this.initSearchData())}showLoading(){var e;this.loadingEl.classList.add("show"),(e=this.loadingEl.parentElement)==null||e.classList.add("loading"),this.input.readOnly=!0}hideLoading(){var e;this.loadingEl.classList.remove("show"),(e=this.loadingEl.parentElement)==null||e.classList.remove("loading"),this.input.readOnly=!1}cearFinderBar(){this.ctx.finderBar={rowIndex:-1,colIndex:-1,text:"",type:"header"},this.ctx.emit("draw")}hide(){this.isVisible&&(this.isVisible=!1,this.container.classList.remove("show"),this.ctx.finding=!1,this.input.value="",this.searchResults=[],this.searchData=[],this.currentIndex=-1,this.hideLoading(),this.ctx.finderBar={rowIndex:-1,colIndex:-1,text:"",type:"header"},this.updateCount(),this.ctx.emit("draw"))}destroy(){this.hide(),this.container.remove()}}class Ub{constructor(e,t){h(this,"options"),h(this,"scroller"),h(this,"header"),h(this,"body"),h(this,"footer"),h(this,"selector"),h(this,"autofill"),h(this,"tooltip"),h(this,"editor"),h(this,"empty"),h(this,"overlayer"),h(this,"contextMenu"),h(this,"loading"),h(this,"finderBar"),h(this,"animationFrameId"),h(this,"ctx"),this.options=t;const{overlayerElement:i,editorElement:s,emptyElement:o,contextMenuElement:n}=this.options,a=this.createContainer(e,i,s,o,n);this.ctx=new WC(a,this.options),this.header=new GC(this.ctx),this.footer=new qC(this.ctx),this.body=new UC(this.ctx),this.scroller=new XC(this.ctx),this.selector=new ZC(this.ctx),this.autofill=new JC(this.ctx),this.tooltip=new Pb(this.ctx),this.empty=new Vb(this.ctx),this.editor=new Yb(this.ctx),this.overlayer=new Wb(this.ctx),this.contextMenu=new Xb(this.ctx),this.loading=new zb(this.ctx),this.finderBar=new Gb(this.ctx),this.ctx.on("draw",()=>{this.draw()}),this.ctx.on("drawView",()=>{this.draw(!0)}),this.draw()}createContainer(e,t,i,s,o){e.className="e-virt-table-container";const n=document.createElement("div"),a=document.createElement("canvas"),c=t||document.createElement("div");n.className="e-virt-table-stage",e.tabIndex=0,a.className="e-virt-table-canvas",c.className="e-virt-table-overlayer",c.setAttribute("data-overlayer",t?"custom":"default");const d=i||document.createElement("div");d.className="e-virt-table-editor";const f=s,u=o;return n.appendChild(a),n.appendChild(c),e.appendChild(n),{containerElement:e,stageElement:n,canvasElement:a,overlayerElement:c,editorElement:d,emptyElement:f,contextMenuElement:u}}doDraw(e=!1){this.header.update(),this.footer.update(),this.body.update(),this.ctx.paint.clear(),this.body.draw(),this.footer.draw(),this.header.draw(),this.scroller.draw(),e||this.overlayer.draw()}draw(e=!1){this.animationFrameId&&cancelAnimationFrame(this.animationFrameId),this.animationFrameId=requestAnimationFrame(()=>{this.doDraw(e),this.body.updateAutoHeight()&&this.doDraw(e)})}loadConfig(e){this.ctx.config.init(e),this.ctx.database.init(!1),this.header.init(),this.ctx.emit("draw")}loadColumns(e){this.editor.doneEdit(),this.ctx.database.setColumns(e),this.header.init(),this.ctx.emit("draw")}loadData(e){this.editor.doneEdit(),this.ctx.database.setData(e),this.header.init(),this.tooltip.hide(),this.ctx.emit("draw")}loadFooterData(e){this.ctx.database.setFooterData(e),this.ctx.emit("draw")}setCustomHeader(e,t=!0){this.ctx.database.setCustomHeader(e,t),this.header.init(),this.ctx.emit("draw")}getCustomHeader(){return this.header.getCustomHeader()}showColumns(e,t=!0){this.ctx.database.setCustomHeaderHideData(e,!t),this.header.init(),this.ctx.emit("draw")}fixedColumns(e,t){this.ctx.database.setCustomHeaderFixedData(e,t),this.header.init(),this.ctx.emit("draw")}setLoading(e){this.ctx.loading=e,e?this.loading.show():this.loading.hide()}on(e,t){this.ctx.on(e,t)}emit(e,...t){this.ctx.emit(e,...t)}off(e,t){this.ctx.off(e,t)}filterMethod(e){this.ctx.database.setFilterMethod(e),this.ctx.database.init(!1),this.header.init(),this.ctx.emit("draw")}editCell(e,t){this.editor.editCell(e,t)}setItemValue(e,t,i,s=!0,o=!0,n=!1){this.ctx.database.setItemValue(e,t,i,s,o,n)}batchSetItemValue(e,t=!0){this.ctx.database.batchSetItemValue(e,t)}setItemValueByEditor(e,t,i,s=!0,o=!0){this.ctx.setItemValueByEditor(e,t,i,s,o),this.editor.doneEdit()}clearEditableData(e=null){const t=[0,this.ctx.maxColIndex],i=[0,this.ctx.maxRowIndex];return this.selector.clearSelectedData(t,i,!1,e)}clearEditor(){this.editor.clearEditor()}doLayout(){this.ctx.emit("draw")}getChangedData(){return this.ctx.database.getChangedData()}getChangedRows(){return this.ctx.database.getChangedRows()}setCurrentRowByRowIndex(e){this.ctx.currentCell=this.ctx.database.getVirtualBodyCell(e,0),this.ctx.emit("draw")}setCurrentRow(e){const t=this.ctx.database.getColumnByColIndex(0);t&&(this.ctx.currentCell=this.ctx.database.getVirtualBodyCellByKey(e,t.key),this.ctx.emit("draw"))}getCurrentRow(){const e=this.ctx.currentCell;return e?{row:e.row,rowIndex:e.rowIndex,rowKey:e.rowKey}:void 0}clearValidate(){this.ctx.database.clearValidate(),this.ctx.emit("draw")}validateFields(e,t=!0){return new Promise(async(i,s)=>{let o=[];for(let n=0;n<e.length;n++){const{rowKey:a,key:c}=e[n],d=await this.ctx.database.getValidator(a,c);Array.isArray(d)&&d.length&&o.push(d)}if(o.length){if(s(o),t){const[n]=o;if(Array.isArray(n)&&n.length){const[a]=n,{rowKey:c,key:d}=a;this.scrollToRowkey(c),this.scrollToColkey(d)}}this.ctx.emit("draw")}else i([]),this.ctx.emit("draw")})}async validate(e=!0){return new Promise(async(t,i)=>{try{const s=await this.getValidations();t(s)}catch(s){if(e&&Array.isArray(s)&&s.length){const[o]=s;if(Array.isArray(o)&&o.length){const[n]=o,{rowKey:a,key:c}=n,d=this.ctx.database.getRowForRowKey(a);if(d){const{parentRowKeys:f=[]}=d;f&&f.length&&this.setExpandRowKeys(f,!0)}this.scrollToRowkey(a),this.scrollToColkey(c)}}i(s)}})}setValidations(e){if(e.forEach(t=>{const{rowIndex:i,key:s,message:o,rowKey:n}=t;if(i!==void 0&&n===void 0){const a=this.ctx.database.getRowKeyForRowIndex(i);this.ctx.database.setValidationErrorByRowKey(a,s,o)}n&&this.ctx.database.setValidationErrorByRowKey(n,s,o)}),e&&Array.isArray(e)&&e.length){const[t]=e;if(t&&t.rowKey)this.scrollToRowkey(t.rowKey),this.scrollToColkey(t.key);else if(t&&t.rowIndex!==void 0&&t.rowIndex>=0&&t.key){const{rowIndex:i,key:s}=t;this.scrollToRowIndex(i),this.scrollToColkey(s)}}}getValidations(){return new Promise(async(e,t)=>{const i=this.ctx.database.getAllRowsData(),s=this.ctx.header.leafCellHeaders;let o=[];for(let n=0;n<i.length;n++)for(let a=0;a<s.length;a++){const c=this.ctx.database.getRowKeyByItem(i[n]),d=s[a].key,f=await this.ctx.database.getValidator(c,d);Array.isArray(f)&&f.length&&o.push(f)}o.length?(t(o),this.ctx.emit("draw")):(e([]),this.ctx.emit("draw"))})}hasValidationError(){return this.ctx.database.hasValidationError()}scrollTo(e,t){this.scroller.setScroll(e,t)}scrollXTo(e){this.scroller.setScrollX(e)}scrollToColkey(e){this.scroller.scrollToColkey(e)}scrollToRowkey(e){this.scroller.scrollToRowKey(e)}scrollToColIndex(e){this.scroller.scrollToColIndex(e)}scrollToRowIndex(e){this.scroller.scrollToRowIndex(e)}scrollYTo(e){this.scroller.setScrollY(e)}setExpandRowKeys(e,t=!0){this.ctx.database.setExpandRowKeys(e,t)}getExpandRowKeys(){return this.ctx.database.getExpandRowKeys()}clearSelection(){this.ctx.database.clearSelection(),this.ctx.emit("draw")}toggleRowSelection(e){const t=this.ctx.database.getRowKeyByItem(e);this.ctx.database.toggleRowSelection(t),this.ctx.emit("draw")}setSelectionByRows(e,t=!0){e.forEach(i=>{const s=this.ctx.database.getRowKeyByItem(i);this.ctx.database.setRowSelection(s,t,!1)}),this.ctx.emit("selectionChange",this.getSelectionRows()),this.ctx.emit("draw")}setSelectionByRowKeys(e,t=!0){e.forEach(i=>{this.ctx.database.setRowSelection(i,t,!1)}),this.ctx.emit("selectionChange",this.getSelectionRows()),this.ctx.emit("draw")}toggleAllSelection(){this.ctx.database.toggleAllSelection(),this.ctx.emit("draw")}toggleRowExpand(e,t){this.ctx.database.expandItem(e,t),this.ctx.emit("draw")}toggleExpandAll(e){this.ctx.database.expandAll(e),this.ctx.emit("draw")}getSelectionRows(){return this.ctx.database.getSelectionRows()}getPositionForRowIndex(e){return this.ctx.database.getPositionForRowIndex(e)}getCellValue(e,t){return this.ctx.database.getItemValue(e,t)}getCellValueByIndex(e,t){return this.ctx.database.getItemValueForRowIndexAndColIndex(e,t)}clearSort(){this.ctx.database.clearSort()}contextMenuHide(){this.contextMenu.hide()}getUtils(){return{mergeColCell:DC,mergeRowCell:LC,getSpanArrByRow:Ja,getSpanObjByColumn:Qa}}getColumnByKey(e){var t;return(t=this.ctx.database.getColumnByKey(e))==null?void 0:t.column}clearChangeData(){this.ctx.database.clearChangeData(),this.ctx.emit("draw")}destroy(){this.overlayer.destroy(),this.empty.destroy(),this.editor.destroy(),this.tooltip.destroy(),this.selector.destroy(),this.autofill.destroy(),this.contextMenu.destroy(),this.loading.destroy(),this.finderBar.destroy(),this.ctx.destroy(),this.ctx.containerElement.remove()}}const qb=l.defineComponent((r,{emit:e})=>{const{cellRender:t,renderTableParams:i}=r,{row:s,field:o}=i;if(o){const n=l.ref(s[o]);return()=>{var a,c;return((c=(a=Vt.renders[t.name])==null?void 0:a.renderEdit)==null?void 0:c.call(a,n,t,i,e))??null}}else return()=>null},{name:"RenderEditCell",props:["cellRender","renderTableParams"],emits:["blur"]}),Zr=l.defineComponent({__name:"PCanvasTable",props:{columns:{},data:{},config:{default:()=>({})},footerData:{},loading:{type:Boolean}},emits:["change","selectionChange","ready"],setup(r,{expose:e,emit:t}){const i=t,s=l.ref([]),o=r,n=Ya(),a=l.computed(()=>({...o,config:{AUTO_ROW_HEIGHT:!0,DISABLED:!0,...n,...o.config}}));let c=null;const d=l.useAttrs(),f=l.ref(null),u=l.ref(null),g=l.ref(null),m=l.ref(null),x=l.ref(),v=l.ref("text"),p=l.ref(),E={},C={},w=l.computed(()=>{const y=x.value;return y?{width:`${y.width}px`,height:`${y.height}px`}:{}}),_=y=>Ct[y]||(({cellValue:M})=>M),S=y=>{var M;return(M=Vt.renders[y])==null?void 0:M.renderDefault},B=(y,...M)=>({row:D,rowIndex:P,value:Y})=>y({row:D,rowIndex:P,cellValue:Y},...M),K=y=>{var M,D,P,Y,V;if((M=y.slots)!=null&&M.default&&T.isFunction((D=y.slots)==null?void 0:D.default))return W=>{var z,Q;return(Q=(z=y.slots)==null?void 0:z.default)==null?void 0:Q.call(z,{row:W.row,column:y,rowIndex:W.rowIndex})};if((P=y.slots)!=null&&P.default&&T.isString((Y=y.slots)==null?void 0:Y.default))return`slot:${(V=y.slots)==null?void 0:V.default}`;if(y.cellRender&&y.cellRender.name)return W=>{var z,Q;return(Q=S(y.cellRender.name))==null?void 0:Q(y.cellRender,{data:o.data,row:W.row,rowIndex:W.rowIndex,field:y.field||W.column.key,title:((z=W.column)==null?void 0:z.title)??""},{})}},R=y=>{var M,D;if((M=y.slots)!=null&&M.title&&T.isFunction((D=y.slots)==null?void 0:D.title))return P=>{var Y,V;return(V=(Y=y.slots)==null?void 0:Y.title)==null?void 0:V.call(Y,{column:y})}},I=y=>{var M,D,P,Y,V,W,z;return(M=y.slots)!=null&&M.edit&&(y.field||y.key)&&T.isFunction((D=y.slots)==null?void 0:D.edit)?E[`__slot:${y.field||y.key}`]=y:(P=y.editRender)!=null&&P.name&&(y.field||y.key)&&(C[y.field||y.key]=y.editRender),{...T.omit(y,["formatter"]),key:y.key||y.field||He(),formatter:T.isString(y.formatter)?B(_(y.formatter)):T.isArray(y.formatter)&&T.isString(y.formatter[0])?B(_(y.formatter[0]),...y.formatter.slice(1)):T.isFunction(y.formatter)?B(y.formatter):void 0,editorType:y.editorType??((Y=y.slots)!=null&&Y.edit&&(y.field||y.key)&&T.isFunction((V=y.slots)==null?void 0:V.edit)?`__slot:${y.field||y.key}`:(W=y.editRender)!=null&&W.name?y.editRender.name:void 0),render:K(y),renderHeader:R(y),children:(z=y.children)==null?void 0:z.map(Q=>I(Q))}};l.onMounted(()=>{f.value&&(c=new Ub(f.value,{config:a.value.config,columns:o.columns.map(y=>I(y)),data:o.data,footerData:o.footerData,emptyElement:g.value||void 0,overlayerElement:m.value||void 0,editorElement:u.value||void 0}),Object.keys(d).forEach(y=>{const M=d[y];if(typeof M=="function"&&y.startsWith("on")){const D=y.charAt(2).toLowerCase()+y.slice(3);c==null||c.on(D,M)}}),c.on("change",y=>{i("change",y)}),c.on("overlayerChange",y=>{p.value=y,console.log("overlayerChange",y)}),c.on("startEdit",y=>{x.value=y,v.value=y.editorType,v.value}),c.on("doneEdit",()=>{v.value="text"}),c.on("selectionChange",y=>{s.value=y,i("selectionChange",y)}),i("ready",c))});function b(y){if(!c||!x.value)return;const{rowKey:M,key:D}=x.value;c==null||c.setItemValueByEditor(M,D,y)}const O=()=>document.body;return l.watch(()=>o.data,y=>{c==null||c.loadData(y)},{deep:!0}),Ar(()=>o.columns,(y,M)=>{T.isEqual(y,M)||c==null||c.loadColumns(y.map(D=>I(D)))},{deep:!0}),l.watch(()=>a.value.config,y=>{c==null||c.loadConfig(y)},{deep:!0}),l.watch(()=>o.footerData,y=>{c==null||c.loadFooterData(y||[])},{deep:!0}),l.watch(()=>o.loading,(y,M)=>{y!==M&&(c==null||c.setLoading(y))},{immediate:!0}),e({$table:c,selectedRecords:l.computed(()=>s.value),reloadData:()=>{c==null||c.loadData(o.data)}}),(y,M)=>{const D=l.resolveComponent("a-empty"),P=l.resolveComponent("a-spin");return l.openBlock(),l.createBlock(P,{spinning:y.loading},{default:l.withCtx(()=>{var Y,V,W,z,Q,te,Ve;return[l.createElementVNode("div",{ref_key:"eVirtTableRef",ref:f},[l.createElementVNode("div",{ref_key:"eVirtTableEditorRef",ref:u},[v.value.startsWith("__slot:")?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(E[v.value].slots.edit({row:x.value.row,column:E[v.value],rowIndex:x.value.rowIndex})),{key:0,bordered:!1,style:l.normalizeStyle(w.value),class:"ev-editor-wrapper","get-popup-container":O,value:x.value.value,"onUpdate:value":M[0]||(M[0]=be=>x.value.value=be),cell:x.value,onBlur:b},null,40,["style","value","cell"])):(Y=l.unref(Vt).renders[v.value])!=null&&Y.renderEdit?(l.openBlock(),l.createBlock(l.unref(qb),{key:1,"cell-render":C[x.value.key],class:"ev-editor-wrapper",style:l.normalizeStyle(w.value),"render-table-params":{data:o.data,row:(V=x.value)==null?void 0:V.row,rowIndex:((W=x.value)==null?void 0:W.rowIndex)??-1,field:((z=x.value)==null?void 0:z.key)??"",title:((te=(Q=x.value)==null?void 0:Q.column)==null?void 0:te.title)??""},bordered:!1,"get-popup-container":O,onBlur:b},null,8,["cell-render","style","render-table-params"])):l.createCommentVNode("",!0)],512),l.createElementVNode("div",{ref_key:"eVirtTableEmptyRef",ref:g},[l.renderSlot(y.$slots,"empty",{},()=>[l.createVNode(D,{description:"空数据"})])],512),l.createElementVNode("div",{ref_key:"eVirtTableOverlayerRef",ref:m},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(((Ve=p.value)==null?void 0:Ve.views)||[],be=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(be.class),style:l.normalizeStyle(be.style),key:be.type},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(be.views,Me=>(l.openBlock(),l.createElementBlock("div",{style:l.normalizeStyle(Me.style),key:Me.key},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(Me.cells,j=>(l.openBlock(),l.createElementBlock("div",l.mergeProps({class:"canvas-cell",key:`${j.rowKey}_${j.key}`,style:{...j.style}},{ref_for:!0},j.domDataset),[typeof j.render=="function"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(j.render(j)),{key:0,bordered:!1})):typeof j.render=="string"&&j.render.startsWith("slot:")?l.renderSlot(y.$slots,j.render.replace("slot:",""),l.mergeProps({key:1,ref_for:!0},j,{cell:j})):l.createCommentVNode("",!0)],16))),128))],4))),128))],6))),128))],512)],512)]}),_:3},8,["spinning"])}}}),Zb={key:0},Jb={key:1,class:"p-canvas-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"},Qb={class:"flex items-center flex-1 gap-4px"},jb={key:2},e_={class:"flex items-center gap-4px"},t_={key:0,class:"w-full text-slate-5 pl-4"},fl=l.defineComponent({__name:"PCanvasGrid",props:{staticConfig:{},manualFetch:{type:Boolean},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},config:{},lazyReset:{type:Boolean,default:()=>Et().lazyReset??!1},fitHeight:{default:()=>Et().fitCanvasHeight??100}},emits:["toolbarButtonClick","toolbarToolClick","pick","resetQuery"],setup(r,{expose:e,emit:t}){var oi,ni,Ne,_e,de;const i=r,s=l.useAttrs(),o=t,{formConfig:n,pageConfig:a,columns:c,toolbarConfig:d,proxyConfig:f,config:u,staticConfig:g}=l.toRefs(i),m=Ya(),x=l.ref(He()),v=l.ref({}),p=l.computed(()=>({...i,config:{...m,...i.config}})),E=l.computed(()=>f.value&&f.value.ajax?a.value?"pagination":"list":"bad");l.computed(()=>E.value==="pagination"?{current:_.page,total:B.value,pageSize:_.size,responsive:!1,showSizeChanger:!0,showTotal:L=>`共${L}条数据`}:!1);const C=l.computed(()=>T.omit({labelCol:Mr,...n.value},["items"])),w=l.reactive({toolbar:!1,form:!1,table:!1}),_=l.reactive({page:1,size:((oi=a.value)==null?void 0:oi.pageSize)??10}),S=l.ref(0),B=l.ref(0),K=l.ref([]),R=l.ref(),I=l.ref(),b=l.ref(),O=l.ref(),y=l.ref(),M=l.ref(500),D=l.ref({}),P=L=>{D.value[_.page]=L},Y=l.reactive([...(((Ne=(ni=i.toolbarConfig)==null?void 0:ni.buttons)==null?void 0:Ne.map(L=>L.code))??[]).filter(L=>L),...(((de=(_e=i.toolbarConfig)==null?void 0:_e.tools)==null?void 0:de.map(L=>L.code))??[]).filter(L=>L)].reduce((L,H)=>(L[H]=!1,L),{})),V=(L,H)=>{Y[L]=H},W=L=>{T.isObject(L)?(Object.prototype.hasOwnProperty.call(L,"toolbar")&&(w.toolbar=L.toolbar),Object.prototype.hasOwnProperty.call(L,"form")&&(w.form=L.form),Object.prototype.hasOwnProperty.call(L,"table")&&(w.table=L.table)):T.isBoolean(L)&&(w.form=L,w.toolbar=L,w.table=L)},z=l.computed(()=>T.uniq(Object.values(D.value).flat(),L=>{var H;return L[((H=p.value.config)==null?void 0:H.ROW_KEY)??"id"]})),Q=()=>{it()},te=l.computed(()=>z.value.map(L=>{var H;return L[((H=p.value.config)==null?void 0:H.ROW_KEY)??"id"]})),Ve=(L,H)=>H?{list:T.isString(H.list)?T.get(L,H.list):T.isFunction(H.list)?H.list(L):void 0,total:T.isString(H.total)?T.get(L,H.total):T.isFunction(H.total)?H.total(L):void 0,result:T.isString(H.result)?T.get(L,H.result):T.isFunction(H.result)?H.result(L):void 0,message:T.isString(H.message)?T.get(L,H.message):T.isFunction(H.message)?H.message(L):void 0}:{list:L},be=L=>{o("toolbarButtonClick",{data:K.value,code:L,selectedKeys:te.value,records:z.value}),mt(L)},Me=T.debounce(be,100),j=({key:L})=>Me(L),Wi=L=>{o("toolbarToolClick",{data:K.value,code:L,selectedKeys:te.value,records:z.value}),mt(L)},Xi=T.debounce(Wi,100),ve=()=>new Promise(L=>{if(E.value!=="bad"){W({table:!0,form:!0});const{ajax:H}=f.value;H.query({form:v.value,page:_}).then(X=>{const{list:Be,total:At,result:Xe,message:ze}=Ve(X,f.value.response);Be?(K.value=Be,S.value++):Xe?(K.value=Xe,B.value=At??Xe.length,S.value++):(K.value=[],S.value++,ze&&bi(ze)),L(K.value)}).catch(X=>{console.error("fetchData error",X),L([])}).finally(()=>{W({table:!1,form:!1})})}}),zi=(L,H)=>(_.page=L,_.size=H,ve()),it=()=>(_.page=1,D.value={},ve()),vt=T.debounce(ve,160),si=(L,H)=>(Object.assign(v.value,L),_.page=1,H?Promise.resolve():vt()),Gi=(L,H)=>(v.value=L,_.page=1,H?Promise.resolve():vt()),mt=L=>{const{ajax:H}=f.value;switch(L){case"multiDelete":H.multiDelete&&(te.value.length>0?Ua({title:"警告",content:"确认删除选中的数据吗?"}).then(()=>{W({table:!0,toolbar:!0}),H.multiDelete(te.value).then(()=>{mC("删除成功"),it()}).catch(()=>{xC("删除失败")}).finally(()=>{W({table:!1,toolbar:!1}),Y.multiDelete=!1})}):bi("请选择要删除的数据"));break}},Ui=l.computed(()=>!g.value||!g.value.selectable&&!g.value.tree?c.value:[g.value.selectable&&g.value.tree?{type:"selection-tree",width:40,widthFillDisable:!0,title:""}:g.value.selectable?{type:"selection",width:40,widthFillDisable:!0,title:""}:g.value.tree?{type:"tree",width:40,widthFillDisable:!0,title:""}:{type:"index",width:40,widthFillDisable:!0,title:""},...c.value]),rt=L=>{if(n.value&&n.value.items.length>0){if(n.value.customReset)n.value.customReset();else{const H={};Yt(n.value.items,X=>{X.field&&X.itemRender?ue(X.itemRender.defaultValue)?H[X.field]=X.itemRender.defaultValue:H[X.field]=void 0:X.field&&X.slots&&(ue(X.slots.defaultValue)?H[X.field]=X.slots.defaultValue:H[X.field]=void 0)}),v.value=H}o("resetQuery")}_.page=1,L||vt()},xt=()=>(D.value={},rt());let We=null;const Ae=()=>{We&&cancelAnimationFrame(We),We=requestAnimationFrame(()=>{if(We=null,!y.value)return;const L=y.value.getBoundingClientRect();M.value=Math.max(window.innerHeight-L.top-i.fitHeight,100)})};let me=null;l.watch(O,L=>{me==null||me.disconnect(),me=null,L&&(me=new ResizeObserver(()=>Ae()),me.observe(L))},{immediate:!0});let Mt,st=null;return l.onMounted(()=>{if(Ae(),window.addEventListener("resize",Ae),Mt=new MutationObserver(L=>{L.forEach(H=>{if(H.type==="attributes"&&H.attributeName==="style"){const X=H.target;window.getComputedStyle(X).display!=="none"&&Ae()}})}),b.value){Mt.observe(b.value,{attributes:!0,attributeFilter:["style"]}),st=new ResizeObserver(()=>Ae());let L=b.value.parentElement;for(let H=0;H<5&&L&&L!==document.body;H++)st.observe(L),L=L.parentElement}rt(i.manualFetch)}),l.onBeforeUnmount(()=>{We&&cancelAnimationFrame(We),window.removeEventListener("resize",Ae),Mt.disconnect(),me==null||me.disconnect(),st==null||st.disconnect()}),e({commitProxy:{query:vt,reload:xt,reloadPage:it,passQuery:si,forcePassQuery:Gi},$canvasTable:l.computed(()=>I.value),selectedRowKeys:te,setBtnLoading:V,selectedRecords:z,$form:l.computed(()=>R.value),getFormData:()=>v.value,setLoadings:W,resizeTable:Ae}),(L,H)=>{var Xe,ze,Nt;const X=l.resolveComponent("a-menu-item"),Be=l.resolveComponent("a-menu"),At=l.resolveComponent("a-dropdown");return l.openBlock(),l.createElementBlock("div",l.mergeProps({ref_key:"boxEl",ref:b,class:"h-full p-wrapper flex flex-col gap-8px overflow-y-auto"},l.unref(s)),[E.value==="bad"?(l.openBlock(),l.createElementBlock("div",Zb,"请检查配置")):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[(ze=(Xe=l.unref(n))==null?void 0:Xe.items)!=null&&ze.some(F=>F.field&&F.itemRender)?(l.openBlock(),l.createElementBlock("div",{key:0,class:"p-pane p-form-wrapper",ref_key:"pFormWrapper",ref:O},[l.createVNode(l.unref(A.Spin),{spinning:w.form},{default:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.unref(A.Form),l.mergeProps({key:x.value,ref_key:"formEl",ref:R,model:v.value},C.value,{onSubmit:Q}),{default:l.withCtx(()=>[l.createVNode(l.unref(A.Row),{gutter:[6,12]},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(n).items,(F,xe)=>(l.openBlock(),l.createBlock(Br,{key:`_col_${F.field||xe}`,"form-data":v.value,item:F,onReset:H[0]||(H[0]=Re=>rt(i.lazyReset))},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["model"]))]),_:1},8,["spinning"])],512)):l.createCommentVNode("",!0),l.unref(d)?(l.openBlock(),l.createElementBlock("div",Jb,[l.createElementVNode("div",Qb,[l.unref(d).buttons&&l.unref(d).buttons.length>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(d).buttons,(F,xe)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:xe},[F.dropdowns&&F.dropdowns.length?(l.openBlock(),l.createBlock(At,{key:0},{overlay:l.withCtx(()=>[l.createVNode(Be,{onClick:j},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(F.dropdowns,Re=>(l.openBlock(),l.createBlock(X,{key:Re.code},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(Re.content),1)]),_:2},1024))),128))]),_:2},1024)]),default:l.withCtx(()=>[l.createVNode(l.unref(A.Button),{type:F.type,size:F.size??"middle",disabled:l.unref(d).disabled||F.disabled,loading:w.toolbar||!!F.code&&Y[F.code],danger:F.danger,shape:F.shape,ghost:F.ghost,block:F.block},{default:l.withCtx(()=>[F.icon?(l.openBlock(),l.createBlock(l.unref(le),{key:0,icon:F.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(F.content)+" ",1),l.createVNode(l.unref(_t.DownOutlined))]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block"])]),_:2},1024)):F.code?(l.openBlock(),l.createBlock(l.unref(A.Button),{key:1,type:F.type,size:F.size??"middle",disabled:l.unref(d).disabled||F.disabled,loading:w.toolbar||!!F.code&&Y[F.code],danger:F.danger,shape:F.shape,ghost:F.ghost,block:F.block,onClick:Re=>l.unref(Me)(F.code)},{default:l.withCtx(()=>[F.icon?(l.openBlock(),l.createBlock(l.unref(le),{key:0,icon:F.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(F.content),1)]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block","onClick"])):(l.openBlock(),l.createElementBlock("div",jb))],64))),128)):l.createCommentVNode("",!0)]),l.createElementVNode("span",e_,[l.unref(d).tools&&l.unref(d).tools.length>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(d).tools,(F,xe)=>(l.openBlock(),l.createBlock(l.unref(A.Button),{key:xe,type:F.type,size:F.size??"middle",disabled:l.unref(d).disabled||F.disabled,danger:F.danger,shape:F.shape,ghost:F.ghost,block:F.block,onClick:Re=>l.unref(Xi)(F.code),loading:w.toolbar||!!F.code&&Y[F.code]},{default:l.withCtx(()=>[F.icon?(l.openBlock(),l.createBlock(l.unref(le),{key:0,icon:F.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(F.content),1)]),_:2},1032,["type","size","disabled","danger","shape","ghost","block","onClick","loading"]))),128)):l.createCommentVNode("",!0)])])):l.createCommentVNode("",!0),l.createElementVNode("div",{ref_key:"tableWrapperEl",ref:y,class:l.normalizeClass("p-pane flex-1 h-0 p-inner-scroll")},[(Nt=l.unref(g))!=null&&Nt.selectable&&l.unref(g).showCount?(l.openBlock(),l.createElementBlock("div",t_," 已选:"+l.toDisplayString(te.value.length),1)):l.createCommentVNode("",!0),l.createVNode(Zr,{ref_key:"canvasTableRef",ref:I,columns:Ui.value,config:{...p.value.config,HEIGHT:M.value},data:K.value,loading:w.table,onSelectionChange:P},l.createSlots({_:2},[l.renderList(L.$slots,(F,xe)=>({name:xe,fn:l.withCtx(Re=>[l.renderSlot(L.$slots,xe,l.normalizeProps(l.guardReactiveProps(Re)))])}))]),1032,["columns","config","data","loading"]),E.value==="pagination"?(l.openBlock(),l.createBlock(l.unref(A.Pagination),{key:1,class:"p-canvas-pagination",size:"small",current:_.page,"page-size":_.size,total:B.value,onChange:zi},null,8,["current","page-size","total"])):l.createCommentVNode("",!0)],512)],64))],16)}}}),Jr=l.defineComponent({__name:"PGroupBlock",props:{getFormSetting:{type:Function},source:{}},setup(r,{expose:e}){const t=r,i=l.ref(),{source:s}=l.toRefs(t),o=l.computed(()=>{var a;return(a=i.value)==null?void 0:a.$form}),n=l.computed(()=>t.getFormSetting(s.value));return e({$form:o}),(a,c)=>(l.openBlock(),l.createBlock(Hr,l.mergeProps({ref_key:"formEl",ref:i},n.value,{data:l.unref(s)}),null,16,["data"]))}}),i_=l.defineComponent({__name:"CollapseCard",props:{defaultCollapsed:{type:Boolean,default:!1},title:{default:void 0},collapsible:{type:Boolean,default:!1}},setup(r,{expose:e}){const t=r,i=l.ref(t.defaultCollapsed?[]:["content"]);return e({collapse:()=>{i.value=[]},expand:()=>{i.value=["content"]}}),(s,o)=>{const n=l.resolveComponent("a-collapse-panel"),a=l.resolveComponent("a-collapse"),c=l.resolveComponent("a-card");return s.collapsible?(l.openBlock(),l.createBlock(a,{key:0,"active-key":i.value,"onUpdate:activeKey":o[0]||(o[0]=d=>i.value=d),class:"collapsible-card"},{default:l.withCtx(()=>[l.createVNode(n,{key:"content","force-render":"",header:s.title},l.createSlots({_:2},[l.renderList(s.$slots,(d,f)=>({name:f,fn:l.withCtx(()=>[l.renderSlot(s.$slots,f)])}))]),1032,["header"])]),_:3},8,["active-key"])):(l.openBlock(),l.createBlock(c,{key:1,size:"small",title:s.title},l.createSlots({_:2},[l.renderList(s.$slots,(d,f)=>({name:f,fn:l.withCtx(()=>[l.renderSlot(s.$slots,f)])}))]),1032,["title"]))}}}),gl=l.defineComponent({__name:"PFormGroup",props:l.mergeModels({getFormSetting:{type:Function},title:{},tabLabel:{},getTabLabel:{type:Function},editAble:{type:Boolean},showAdd:{type:Boolean},collapsible:{type:Boolean},defaultCollapsed:{type:Boolean},lazyErrorMark:{type:Boolean},forceRender:{type:Boolean},keepSerial:{type:Boolean},loading:{type:Boolean},itemMenus:{},createItem:{type:Function},max:{},menuHandler:{type:Function}},{modelValue:{type:Array,default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(r,{expose:e}){const t=A.Form.useForm,i=l.ref(),s=r,o=l.ref(),n=l.useModel(r,"modelValue"),a=l.ref(0),c=l.ref([]),d=l.ref([]),f=R=>{a.value=R},u=l.computed(()=>s.max??1/0),g=R=>{(s.createItem??(()=>Promise.resolve({})))({list:n.value}).then(b=>{var O;n.value=[...n.value,{...b,__index:(((O=T.max(n.value,y=>y.__index??-1))==null?void 0:O.__index)??-1)+1}],a.value=R})},m=s.itemMenus??[{content:"复制",code:"copy"},{content:"删除",code:"delete"}],x=R=>{var I,b,O,y,M,D;return((M=(y=(O=(b=(I=R==null?void 0:R.parentElement)==null?void 0:I.parentElement)==null?void 0:b.parentElement)==null?void 0:O.parentElement)==null?void 0:y.parentElement)==null?void 0:M.parentElement)??((D=o.value)==null?void 0:D.$el)??document.body},v=l.computed(()=>s.forceRender||n.value.length<=5),p=R=>{var b;const I=(b=n.value.find((O,y)=>y===R))==null?void 0:b.__index;q(I)&&(c.value=c.value.filter(O=>O!==I))},E=()=>{l.nextTick().then(()=>{var R,I;p(a.value),(I=(R=d.value[a.value])==null?void 0:R.$form)==null||I.validate()})},C=(R,I)=>{var b;return((b=s.getTabLabel)==null?void 0:b.call(s,R,I))??`${s.tabLabel} ${s.keepSerial?I+1:(R.__index??0)+1}`};l.watch(()=>n.value,()=>{if(!s.keepSerial){const R=n.value.filter(I=>!q(I.__index));R.length>0&&R.forEach(I=>{var b;I.__index=(((b=T.max(n.value,O=>O.__index??-1))==null?void 0:b.__index)??-1)+1})}},{immediate:!0});const w=({key:R},I,b)=>{var O;if(s.menuHandler&&T.isFunction(s.menuHandler))s.menuHandler({code:T.toString(R),data:I,index:b});else switch(R){case"delete":n.value=n.value.filter((y,M)=>M!==b),l.nextTick(()=>{d.value=d.value.filter(y=>!!y),b<=a.value&&a.value>0&&a.value--});break;case"copy":if(n.value.length>=u.value){bi("已达到最大数量");return}n.value=[...n.value,T.clone({...T.omit(I,["id","__index"]),__index:(((O=T.max(n.value,y=>y.__index??-1))==null?void 0:O.__index)??-1)+1})];break}},_=T.debounce(w,100);l.watchEffect(()=>{n.value.length===0?a.value=0:a.value>=n.value.length&&(a.value=n.value.length-1)});const S=T.debounce(p,50);l.watchEffect(()=>{var b;const R=n.value.map((O,y)=>c.value.includes(O.__index)?y:void 0).filter(q),I=(b=i.value)==null?void 0:b.$el;I&&I.querySelectorAll(":scope >.ant-tabs-nav>.ant-tabs-nav-wrap>.ant-tabs-nav-list>.ant-tabs-tab>.ant-tabs-tab-btn").forEach((y,M)=>{R.includes(M)?y.classList.add("p-error-group-tab"):y.classList.remove("p-error-group-tab")})}),e({collapse:()=>{var R,I;(I=(R=o.value)==null?void 0:R.collapse)==null||I.call(R)},expand:()=>{var R,I;(I=(R=o.value)==null?void 0:R.expand)==null||I.call(R)},activeKey:l.computed(()=>a.value),setActiveKey:f,validateAll:()=>{const R=v.value?d.value.map(I=>{var b;return(b=I.$form)==null?void 0:b.validate()}):n.value.map(I=>{var b;return((b=t(I,s.getFormSetting(I).rules))==null?void 0:b.validate())??Promise.resolve()});return Promise.allSettled(R).then(I=>{if(c.value=I.map((b,O)=>{var y;return b.status==="rejected"&&typeof((y=n.value[O])==null?void 0:y.__index)=="number"?n.value[O].__index:void 0}).filter(b=>typeof b=="number"),!s.lazyErrorMark&&c.value.length){const b=c.value[0],O=n.value.findIndex(y=>y.__index===b);O!==-1&&(a.value=O)}return c.value.length?Promise.reject({error_indexes:c.value,results:I}):Promise.resolve(I)})},validate:async(R,I)=>{var O,y,M;const b=n.value.findIndex(D=>D.__index===R);try{return await(v.value?((y=(O=d.value[b])==null?void 0:O.$form)==null?void 0:y.validate())??Promise.resolve():((M=t(n.value[b],s.getFormSetting(n.value[b]).rules))==null?void 0:M.validate())??Promise.resolve()),c.value=c.value.filter(D=>D!==R),Promise.resolve()}catch(D){return!c.value.includes(R)&&!I&&(c.value=[...c.value,R]),Promise.reject(D)}},validateFields:async(R,I,b)=>{var P,Y;const O=n.value.findIndex(V=>V.__index===R),M=s.getFormSetting(n.value[O]).rules,D=t(n.value[O],M);try{return await(v.value?((Y=(P=d.value[O])==null?void 0:P.$form)==null?void 0:Y.validateFields(I))??Promise.resolve():Promise.allSettled(I.map(V=>D.validateField(V,n.value[O][V],M[V]??[])))),Promise.resolve()}catch(V){return!c.value.includes(R)&&!b&&(c.value=[...c.value,R]),Promise.reject(V)}}});const B=l.useSlots(),K=l.computed(()=>Object.keys(B).filter(R=>R.startsWith("group-")).map(R=>({original:R,target:R.replace("group-","")})));return(R,I)=>{const b=l.resolveComponent("a-spin");return l.openBlock(),l.createBlock(i_,{ref_key:"rootRef",ref:o,title:R.title,size:"small",collapsible:R.collapsible,"default-collapsed":R.defaultCollapsed},l.createSlots({default:l.withCtx(()=>[R.loading?(l.openBlock(),l.createBlock(b,{key:0,class:"w-full"})):(l.openBlock(),l.createBlock(l.unref(A.Tabs),{key:1,ref_key:"tabsRef",ref:i,type:"editable-card",activeKey:a.value,"onUpdate:activeKey":I[1]||(I[1]=O=>a.value=O),"hide-add":"",onChange:E},{rightExtra:l.withCtx(()=>[l.renderSlot(R.$slots,"rightExtra",{},()=>[R.showAdd&&n.value.length<u.value?(l.openBlock(),l.createBlock(l.unref(A.Button),{key:0,type:"link",onClick:I[0]||(I[0]=O=>g(n.value.length))},{default:l.withCtx(()=>I[2]||(I[2]=[l.createTextVNode(" + 新增 ",-1)])),_:1,__:[2]})):l.createCommentVNode("",!0)])]),default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(n.value,(O,y)=>(l.openBlock(),l.createBlock(l.unref(A.TabPane),{key:y,tab:C(O,y),"force-render":v.value},{closeIcon:l.withCtx(()=>{var M;return[R.editAble&&((M=l.unref(m))!=null&&M.length)?(l.openBlock(),l.createBlock(l.unref(A.Dropdown),{key:0,"get-popup-container":x},{overlay:l.withCtx(()=>[l.createVNode(l.unref(A.Menu),{onClick:D=>l.unref(_)(D,O,y)},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(m).filter(D=>{var P;return((P=D.visibleMethod)==null?void 0:P.call(D,{data:O,index:y}))??!0}),D=>(l.openBlock(),l.createBlock(l.unref(A.MenuItem),{key:D.code},{default:l.withCtx(()=>[l.createElementVNode("div",null,l.toDisplayString(D.content),1)]),_:2},1024))),128))]),_:2},1032,["onClick"])]),default:l.withCtx(()=>[l.createVNode(l.unref(_t.MoreOutlined))]),_:2},1024)):l.createCommentVNode("",!0)]}),default:l.withCtx(()=>[(l.openBlock(),l.createBlock(Jr,{ref_for:!0,ref_key:"blockInstance",ref:d,key:y,source:O,"get-form-setting":R.getFormSetting,onFocusCapture:M=>l.unref(S)(y),onClickCapture:M=>l.unref(S)(y)},null,8,["source","get-form-setting","onFocusCapture","onClickCapture"]))]),_:2},1032,["tab","force-render"]))),128))]),_:3},8,["activeKey"]))]),_:2},[l.renderList(K.value,O=>({name:O.target,fn:l.withCtx(()=>[l.renderSlot(R.$slots,O.original)])}))]),1032,["title","collapsible","default-collapsed"])}}}),r_={class:"w-full text-right p-2"},vl=l.defineComponent({__name:"PromisePicker",props:{gridSetting:{},title:{default:"数据选择"},width:{default:"70%"},multipleAllowEmpty:{type:Boolean,default:!1},bodyStyle:{default:()=>({})},beforePick:{type:Function,default:()=>Promise.resolve()}},setup(r,{expose:e}){const t=l.ref(),i=l.ref(!1),s=r,o=l.computed(()=>{var x;return(x=s.gridSetting.selectConfig)==null?void 0:x.multiple});let n,a,c;const d=l.reactive({modal:!1}),f=()=>{c&&c()},u=()=>{d.modal=!1,c&&c()},g=({row:x,field:v})=>{n&&!o.value&&s.beforePick(x).then(()=>{d.modal=!1,n({row:x,field:v})})},m=()=>{var v;const x=((v=t.value)==null?void 0:v.selectedRecords)??[];x.length===0&&!s.multipleAllowEmpty?bi("请选择数据"):s.beforePick(x).then(()=>{d.modal=!1,a(x)})};return l.onMounted(()=>{}),e({pick:()=>new Promise((x,v)=>{n=x,c=v,i.value=!1,d.modal=!0,l.nextTick(()=>{i.value=!0})}),pickMultiple:()=>new Promise((x,v)=>{a=x,c=v,i.value=!1,d.modal=!0,l.nextTick(()=>{i.value=!0})}),grid:t,hide:()=>{d.modal=!1}}),(x,v)=>(l.openBlock(),l.createBlock(l.unref(A.Modal),{open:d.modal,"onUpdate:open":v[0]||(v[0]=p=>d.modal=p),"destroy-on-close":"",title:x.title,width:x.width,footer:o.value?void 0:null,onCancel:f,"body-style":x.bodyStyle},l.createSlots({default:l.withCtx(()=>[l.createElementVNode("div",{style:l.normalizeStyle({minHeight:i.value?"unset":"642px"})},[l.createVNode(Fr,l.mergeProps(x.gridSetting,{ref_key:"gridEl",ref:t,onPick:g}),null,16)],4)]),_:2},[o.value?{name:"footer",fn:l.withCtx(()=>[l.createElementVNode("div",r_,[l.createElementVNode("span",null,[l.createVNode(l.unref(A.Button),{class:"mr-4",onClick:u},{default:l.withCtx(()=>v[1]||(v[1]=[l.createTextVNode(" 取消 ",-1)])),_:1,__:[1]}),l.createVNode(l.unref(A.Button),{type:"primary",onClick:m},{default:l.withCtx(()=>v[2]||(v[2]=[l.createTextVNode(" 确定 ",-1)])),_:1,__:[2]})])])]),key:"0"}:void 0]),1032,["open","title","width","footer","body-style"]))}});function ml(r){r&&Pa(r)}const s_={install(r){r.component("PForm",Hr),r.component("PGrid",Fr),r.component("PCanvasTable",Zr),r.component("PCanvasGrid",fl),r.component("PFormGroup",gl),r.component("PGroupBlock",Jr),r.component("PromisePicker",vl)},addFormatter:Wa,addRender:Nr,setup:ml};exports.PCanvasGrid=fl;exports.PCanvasTable=Zr;exports.PForm=Hr;exports.PFormGroup=gl;exports.PGrid=Fr;exports.PGroupBlock=Jr;exports.PromisePicker=vl;exports.addFormatter=Wa;exports.addRender=Nr;exports.cleanCol=Ki;exports.default=s_;exports.defaultItemResponsive=$r;exports.defaultLabelCol=Mr;exports.get24rest=Va;exports.getButtonResponsive=sC;exports.getUIKitConfig=tC;exports.labelColDict=rC;exports.resetUIKitConfig=iC;exports.setUIKitConfig=Pa;exports.setup=ml;exports.watchPreviousDeep=Ar;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("vue"),M=require("ant-design-vue"),Zt=require("@ant-design/icons-vue");function _l(i){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const t in i)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>i[t]})}}return e.default=i,Object.freeze(e)}const Rl=_l(Zt);var Il={keyId:1,cookies:{path:"/"},treeOptions:{parentKey:"parentId",key:"id",children:"children"},parseDateFormat:"yyyy-MM-dd HH:mm:ss",firstDayOfWeek:1},ke=Il;function Sl(i,e,t){if(i)if(i.forEach)i.forEach(e,t);else for(var r=0,s=i.length;r<s;r++)e.call(t,i[r],r,i)}var ie=Sl,Tl=Object.prototype.toString,Un=Tl,Ol=Un;function kl(i){return function(e){return"[object "+i+"]"===Ol.call(e)}}var Jt=kl,Dl=Jt,Ll=Array.isArray||Dl("Array"),G=Ll;function $l(i,e){return i&&i.hasOwnProperty?i.hasOwnProperty(e):!1}var Ee=$l,Ml=Ee;function Al(i,e,t){if(i)for(var r in i)Ml(i,r)&&e.call(t,i[r],r,i)}var Qt=Al,Nl=G,Bl=ie,Hl=Qt;function Fl(i,e,t){return i&&(Nl(i)?Bl:Hl)(i,e,t)}var Z=Fl;function Kl(i){return function(e){return typeof e===i}}var Dt=Kl,Pl=Dt,Yl=Pl("function"),le=Yl,Vl=Z;function Wl(i,e){var t=Object[i];return function(r){var s=[];if(r){if(t)return t(r);Vl(r,e>1?function(n){s.push([""+n,r[n]])}:function(){s.push(arguments[e])})}return s}}var wr=Wl,Xl=wr,zl=Xl("keys",1),Ke=zl,Gl=Un,Ul=Qt,ql=ie;function Zi(i,e){var t=i.__proto__.constructor;return e?new t(e):new t}function hi(i,e){return e?qn(i,e):i}function qn(i,e){if(i)switch(Gl.call(i)){case"[object Object]":{var t=Object.create(Object.getPrototypeOf(i));return Ul(i,function(o,a){t[a]=hi(o,e)}),t}case"[object Date]":case"[object RegExp]":return Zi(i,i.valueOf());case"[object Array]":case"[object Arguments]":{var r=[];return ql(i,function(o){r.push(hi(o,e))}),r}case"[object Set]":{var s=Zi(i);return s.forEach(function(o){s.add(hi(o,e))}),s}case"[object Map]":{var n=Zi(i);return n.forEach(function(o,a){n.set(a,hi(o,e))}),n}}return i}function Zl(i,e){return i&&qn(i,e)}var Er=Zl,Jl=ie,Ql=Ke,jl=G,ec=Er,jr=Object.assign;function es(i,e,t){for(var r=e.length,s,n=1;n<r;n++)s=e[n],Jl(Ql(e[n]),t?function(o){i[o]=ec(s[o],t)}:function(o){i[o]=s[o]});return i}var tc=function(i){if(i){var e=arguments;if(i===!0){if(e.length>1)return i=jl(i[1])?[]:{},es(i,e,!0)}else return jr?jr.apply(Object,e):es(i,e)}return i},ue=tc,Zn=ke,ic=ie,rc=Z,sc=le,nc=ue,Se=function(){};function oc(){ic(arguments,function(i){rc(i,function(e,t){Se[t]=sc(e)?function(){var r=e.apply(Se.$context,arguments);return Se.$context=null,r}:e})})}function Jn(i){return nc(Zn,i)}function ac(){return Zn}var Qn="3.9.1";Se.VERSION=Qn;Se.version=Qn;Se.mixin=oc;Se.setup=Jn;Se.setConfig=Jn;Se.getConfig=ac;var lc=Se;function cc(i,e,t){for(var r=i.length-1;r>=0;r--)e.call(t,i[r],r,i)}var Cr=cc,hc=Cr,dc=Ke;function uc(i,e,t){hc(dc(i),function(r){e.call(t,i[r],r,i)})}var jn=uc;function fc(i){return i===null}var Pe=fc,gc=Pe;function vc(i,e){return function(t){return gc(t)?e:t[i]}}var Lt=vc,mc=Z,xc=le,pc=Lt;function yc(i,e,t){var r={};if(i)if(e)xc(e)||(e=pc(e)),mc(i,function(s,n){r[n]=e.call(t,s,n,i)});else return i;return r}var wc=yc;function Ec(i){return i?i.constructor===Object:!1}var $t=Ec;function Cc(i){return i!=="__proto__"&&i!=="constructor"}var eo=Cc,ts=G,is=$t,bc=le,_c=Z,Rc=eo;function to(i,e){return is(i)&&is(e)||ts(i)&&ts(e)?(_c(e,function(t,r){Rc(r)&&(i[r]=bc(e)?t:to(i[r],t))}),i):e}var Ic=function(i){i||(i={});for(var e=arguments,t=e.length,r,s=1;s<t;s++)r=e[s],r&&to(i,r);return i},Sc=Ic,Tc=Z;function Oc(i,e,t){var r=[];if(i&&arguments.length>1){if(i.map)return i.map(e,t);Tc(i,function(){r.push(e.apply(t,arguments))})}return r}var vt=Oc,kc=Ee,Dc=G;function Lc(i,e,t,r,s){return function(n,o,a){if(n&&o){if(i&&n[i])return n[i](o,a);if(e&&Dc(n)){for(var l=0,d=n.length;l<d;l++)if(!!o.call(a,n[l],l,n)===r)return[!0,!1,l,n[l]][t]}else for(var u in n)if(kc(n,u)&&!!o.call(a,n[u],u,n)===r)return[!0,!1,u,n[u]][t]}return s}}var Mi=Lc,$c=Mi,Mc=$c("some",1,0,!0,!1),io=Mc,Ac=Mi,Nc=Ac("every",1,1,!1,!0),ro=Nc,Bc=Ee;function Hc(i,e){if(i){if(i.includes)return i.includes(e);for(var t in i)if(Bc(i,t)&&e===i[t])return!0}return!1}var Mt=Hc,rs=G,ss=Mt;function Fc(i,e){var t,r=0;if(rs(i)&&rs(e)){for(t=e.length;r<t;r++)if(!ss(i,e[r]))return!1;return!0}return ss(i,e)}var so=Fc,ns=Z,Kc=Mt,Pc=le,Yc=Lt;function Vc(i,e,t){var r=[];if(e){Pc(e)||(e=Yc(e));var s,n={};ns(i,function(o,a){s=e.call(t,o,a,i),n[s]||(n[s]=1,r.push(o))})}else ns(i,function(o){Kc(r,o)||r.push(o)});return r}var no=Vc,Wc=vt;function Xc(i){return Wc(i,function(e){return e})}var br=Xc,zc=no,Gc=br;function Uc(){for(var i=arguments,e=[],t=0,r=i.length;t<r;t++)e=e.concat(Gc(i[t]));return zc(e)}var qc=Uc,Zc="undefined",Ce=Zc,Jc=Ce,Qc=Dt,jc=Qc(Jc),De=jc,eh=Pe,th=De;function ih(i){return eh(i)||th(i)}var Le=ih,rh=/(.+)?\[(\d+)\]$/,oo=rh;function sh(i){return i?i.splice&&i.join?i:(""+i).replace(/(\[\d+\])\.?/g,"$1.").replace(/\.$/,"").split("."):[]}var _r=sh,nh=oo,oh=_r,ah=Ee,lh=De,ao=Le;function ch(i,e,t){if(ao(i))return t;var r=dh(i,e);return lh(r)?t:r}function hh(i,e){var t=e?e.match(nh):"";return t?t[1]?i[t[1]]?i[t[1]][t[2]]:void 0:i[t[2]]:i[e]}function dh(i,e){if(i){var t,r,s,n=0;if(i[e]||ah(i,e))return i[e];if(r=oh(e),s=r.length,s){for(t=i;n<s;n++)if(t=hh(t,r[n]),ao(t))return n===s-1?t:void 0}return t}}var jt=ch,os=ie,uh=br,as=vt,ls=G,fh=le,gh=$t,cs=De,vh=Pe,mh=Le,xh=jt,ph=Lt,yh="asc",wh="desc";function dr(i,e){return cs(i)?1:vh(i)?cs(e)?-1:1:i&&i.localeCompare?i.localeCompare(e):i>e?1:-1}function Eh(i,e,t){return function(r,s){var n=r[i],o=s[i];return n===o?t?t(r,s):0:e.order===wh?dr(o,n):dr(n,o)}}function Ch(i,e,t,r){var s=[];return t=ls(t)?t:[t],os(t,function(n,o){if(n){var a=n,l;ls(n)?(a=n[0],l=n[1]):gh(n)&&(a=n.field,l=n.order),s.push({field:a,order:l||yh}),os(e,fh(a)?function(d,u){d[o]=a.call(r,d.data,u,i)}:function(d){d[o]=a?xh(d.data,a):d.data})}}),s}function bh(i,e,t){if(i){if(mh(e))return uh(i).sort(dr);for(var r,s=as(i,function(a){return{data:a}}),n=Ch(i,s,e,t),o=n.length-1;o>=0;)r=Eh(o,n[o],r),o--;return r&&(s=s.sort(r)),as(s,ph("data"))}return[]}var Rr=bh,_h=Rr,Rh=_h,Ih=Rh;function Sh(i,e){return i>=e?i:(i=i>>0)+Math.round(Math.random()*((e||9)-i))}var lo=Sh,Th=wr,Oh=Th("values",0),At=Oh,kh=lo,Dh=At;function Lh(i){for(var e,t=[],r=Dh(i),s=r.length-1;s>=0;s--)e=s>0?kh(0,s):0,t.push(r[e]),r.splice(e,1);return t}var co=Lh,$h=co;function Mh(i,e){var t=$h(i);return arguments.length<=1?t[0]:(e<t.length&&(t.length=e||0),t)}var Ah=Mh;function Nh(i){return function(e){if(e){var t=i(e&&e.replace?e.replace(/,/g,""):e);if(!isNaN(t))return t}return 0}}var ho=Nh,Bh=ho,Hh=Bh(parseFloat),mt=Hh,hs=mt;function Fh(i,e,t){var r=[],s=arguments.length;if(i){if(e=s>=2?hs(e):0,t=s>=3?hs(t):i.length,i.slice)return i.slice(e,t);for(;e<t;e++)r.push(i[e])}return r}var xt=Fh,Kh=Z;function Ph(i,e,t){var r=[];if(i&&e){if(i.filter)return i.filter(e,t);Kh(i,function(s,n){e.call(t,s,n,i)&&r.push(s)})}return r}var Yh=Ph,Vh=Mi,Wh=Vh("",0,2,!0),Xh=Wh,zh=Mi,Gh=zh("find",1,3,!0),Uh=Gh,qh=G,Zh=At;function Jh(i,e,t){if(i){qh(i)||(i=Zh(i));for(var r=i.length-1;r>=0;r--)if(e.call(t,i[r],r,i))return i[r]}}var Qh=Jh,jh=Ke;function ed(i,e,t){if(i){var r,s,n=0,o=null,a=t,l=arguments.length>2,d=jh(i);if(i.length&&i.reduce)return s=function(){return e.apply(o,arguments)},l?i.reduce(s,a):i.reduce(s);for(l&&(n=1,a=i[d[0]]),r=d.length;n<r;n++)a=e.call(o,a,i[d[n]],n,i);return a}}var td=ed,id=G;function rd(i,e,t,r){if(id(i)&&i.copyWithin)return i.copyWithin(e,t,r);var s,n,o=e>>0,a=t>>0,l=i.length,d=arguments.length>3?r>>0:l;if(o<l&&(o=o>=0?o:l+o,o>=0&&(a=a>=0?a:l+a,d=d>=0?d:l+d,a<d)))for(s=0,n=i.slice(a,d);o<l&&!(n.length<=s);o++)i[o]=n[s++];return i}var sd=rd,nd=G;function od(i,e){var t,r=[],s=e>>0||1;if(nd(i))if(s>=0&&i.length>s)for(t=0;t<i.length;)r.push(i.slice(t,t+s)),t+=s;else r=i.length?[i]:i;return r}var ad=od,ld=vt,cd=Lt;function hd(i,e){return ld(i,cd(e))}var uo=hd,dd=le,ds=Le,ud=jt,fd=ie;function gd(i){return function(e,t){if(e&&e.length){var r,s;return fd(e,function(n,o){t&&(n=dd(t)?t(n,o,e):ud(n,t)),!ds(n)&&(ds(r)||i(r,n))&&(s=o,r=n)}),e[s]}return r}}var fo=gd,vd=fo,md=vd(function(i,e){return i<e}),go=md,xd=uo,pd=go;function yd(i){var e,t,r,s=[];if(i&&i.length)for(e=0,t=pd(i,function(n){return n?n.length:0}),r=t?t.length:0;e<r;e++)s.push(xd(i,e));return s}var vo=yd,wd=vo;function Ed(){return wd(arguments)}var Cd=Ed,bd=At,_d=Z;function Rd(i,e){var t={};return e=e||[],_d(bd(i),function(r,s){t[r]=e[s]}),t}var Id=Rd,mo=G,Sd=ie;function xo(i,e){var t=[];return Sd(i,function(r){t=t.concat(mo(r)?e?xo(r,e):r:[r])}),t}function Td(i,e){return mo(i)?xo(i,e):[]}var Od=Td,kd=vt,Dd=G;function Ld(i,e){for(var t=0,r=e.length;i&&t<r;)i=i[e[t++]];return r&&i?i:0}function $d(i,e){for(var t,r=arguments,s=[],n=[],o=2,a=r.length;o<a;o++)s.push(r[o]);if(Dd(e)){for(a=e.length-1,o=0;o<a;o++)n.push(e[o]);e=e[a]}return kd(i,function(l){if(n.length&&(l=Ld(l,n)),t=l[e]||e,t&&t.apply)return t.apply(l,s)})}var Md=$d;function Ad(i,e){return(console[i]||console.log)(e)}var Nd=Ad;function Bd(i,e){try{delete i[e]}catch{i[e]=void 0}}var po=Bd,Hd=G,Fd=Cr,Kd=jn;function Pd(i,e,t){return i&&(Hd(i)?Fd:Kd)(i,e,t)}var yo=Pd,Yd=Dt,Vd=Yd("object"),Ai=Vd,Wd=po,Xd=$t,zd=Ai,Gd=G,Ud=Pe,qd=ue,Zd=Qt;function Jd(i,e,t){if(i){var r,s=arguments.length>1&&(Ud(e)||!zd(e)),n=s?t:e;if(Xd(i))Zd(i,s?function(o,a){i[a]=e}:function(o,a){Wd(i,a)}),n&&qd(i,n);else if(Gd(i)){if(s)for(r=i.length;r>0;)r--,i[r]=e;else i.length=0;n&&i.push.apply(i,n)}}return i}var wo=Jd,Qd=po,jd=le,eu=G,tu=Z,iu=ie,ru=yo,su=wo,nu=Le;function ou(i){return function(e,t){return t===i}}function au(i,e,t){if(i){if(!nu(e)){var r=[],s=[];return jd(e)||(e=ou(e)),tu(i,function(n,o,a){e.call(t,n,o,a)&&r.push(o)}),eu(i)?ru(r,function(n,o){s.push(i[n]),i.splice(n,1)}):(s={},iu(r,function(n){s[n]=i[n],Qd(i,n)})),s}return su(i)}return i}var Eo=au,lu=ke,us=Nd,cu=Rr,hu=Er,du=Le,ur=Z,uu=Eo,fu=ue;function gu(i,e){ur(i,function(t){t[e]&&!t[e].length&&uu(t,e)})}function vu(i,e){var t=fu({},lu.treeOptions,e),r=t.strict,s=t.key,n=t.parentKey,o=t.children,a=t.mapChildren,l=t.sortKey,d=t.reverse,u=t.data,f=[],g={},m={},x,v,p;return l&&(i=cu(hu(i),l),d&&(i=i.reverse())),ur(i,function(w){x=w[s],m[x]&&us("warn","Duplicate primary key="+x),m[x]=!0}),ur(i,function(w){x=w[s],u?(v={},v[u]=w):v=w,p=w[n],g[x]=g[x]||[],v[s]=x,v[n]=p,x===p&&(p=null,us("warn","Error infinite Loop. key="+x+" parentKey="+x)),g[p]=g[p]||[],g[p].push(v),v[o]=g[x],a&&(v[a]=g[x]),(!r||r&&du(p))&&(m[p]||f.push(v))}),r&&gu(i,o),f}var mu=vu,xu=ke,pu=ie,yu=ue;function Co(i,e,t,r){var s=r.key,n=r.parentKey,o=r.children,a=r.data,l=r.updated,d=r.clear;return pu(t,function(u){var f=u[o];a&&(u=u[a]),l!==!1&&(u[n]=e?e[s]:null),i.push(u),f&&f.length&&Co(i,u,f,r),d&&delete u[o]}),i}function wu(i,e){return Co([],null,i,yu({},xu.treeOptions,e))}var Eu=wu;function Cu(i){return function(e,t,r,s){var n=r||{},o=n.children||"children";return i(null,e,t,s,[],[],o,n)}}var Ni=Cu,bu=Ni;function bo(i,e,t,r,s,n,o,a){if(e){var l,d,u,f,g,m;for(d=0,u=e.length;d<u;d++){if(l=e[d],f=s.concat([""+d]),g=n.concat([l]),t.call(r,l,d,e,f,i,g))return{index:d,item:l,path:f,items:e,parent:i,nodes:g};if(o&&l&&(m=bo(l,l[o],t,r,f.concat([o]),g,o),m))return m}}}var _u=bu(bo),Ru=_u,Iu=Ni,Su=Z;function _o(i,e,t,r,s,n,o,a){var l,d;Su(e,function(u,f){l=s.concat([""+f]),d=n.concat([u]),t.call(r,u,f,e,l,i,d),u&&o&&(l.push(o),_o(u,u[o],t,r,l,d,o))})}var Tu=Iu(_o),Ro=Tu,Ou=Ni,ku=vt;function Io(i,e,t,r,s,n,o,a){var l,d,u,f=a.mapChildren||o;return ku(e,function(g,m){return l=s.concat([""+m]),d=n.concat([g]),u=t.call(r,g,m,e,l,i,d),u&&g&&o&&g[o]&&(u[f]=Io(g,g[o],t,r,l,d,o,a)),u})}var Du=Ou(Io),Lu=Du,$u=Ro;function Mu(i,e,t,r){var s=[];return i&&e&&$u(i,function(n,o,a,l,d,u){e.call(r,n,o,a,l,d,u)&&s.push(n)},t),s}var Au=Mu,Nu=Ni,Bu=ie,Hu=ue;function So(i,e,t,r,s,n,o,a,l){var d,u,f,g,m,x=[],v=l.original,p=l.data,w=l.mapChildren||a,E=l.isEvery;return Bu(t,function(C,b){d=n.concat([""+b]),u=o.concat([C]),g=i&&!E||r.call(s,C,b,t,d,e,u),m=a&&C[a],g||m?(v?f=C:(f=Hu({},C),p&&(f[p]=C)),f[w]=So(g,C,C[a],r,s,d,u,a,l),(g||f[w].length)&&x.push(f)):g&&x.push(f)}),x}var Fu=Nu(function(i,e,t,r,s,n,o,a){return So(0,i,e,t,r,s,n,o,a)}),Ku=Fu;function Pu(i,e){if(i.indexOf)return i.indexOf(e);for(var t=0,r=i.length;t<r;t++)if(e===i[t])return t}var To=Pu;function Yu(i,e){if(i.lastIndexOf)return i.lastIndexOf(e);for(var t=i.length-1;t>=0;t--)if(e===i[t])return t;return-1}var Oo=Yu,Vu=Dt,Wu=Vu("number"),$e=Wu,Xu=$e;function zu(i){return Xu(i)&&isNaN(i)}var Gu=zu,Uu=Dt,qu=Uu("string"),Ye=qu,Zu=Jt,Ju=Zu("Date"),et=Ju,Qu=parseInt,tt=Qu;function ju(i){return Date.UTC(i.y,i.M||0,i.d||1,i.H||0,i.m||0,i.s||0,i.S||0)}var ef=ju;function tf(i){return i.getTime()}var re=tf,bi=tt,fs=ef,rf=re,sf=Ye,nf=et;function ei(i){return"(\\d{"+i+"})"}function of(i){return i<10?i*100:i<100?i*10:i}function gs(i){return isNaN(i)?i:bi(i)}var bt=ei(2),Rt=ei("1,2"),ko=ei("1,7"),Do=ei("3,4"),Lo=".{1}",Yt=Lo+Rt,$o="(([zZ])|([-+]\\d{2}:?\\d{2}))",vs=[Do,Yt,Yt,Yt,Yt,Yt,Lo+ko,$o],fr=[];for(var Ji=vs.length-1;Ji>=0;Ji--){for(var ms="",dt=0;dt<Ji+1;dt++)ms+=vs[dt];fr.push(new RegExp("^"+ms+"$"))}function af(i){for(var e,t={},r=0,s=fr.length;r<s;r++)if(e=i.match(fr[r]),e){t.y=e[1],t.M=e[2],t.d=e[3],t.H=e[4],t.m=e[5],t.s=e[6],t.S=e[7],t.Z=e[8];break}return t}var xs=[["yyyy",Do],["yy",bt],["MM",bt],["M",Rt],["dd",bt],["d",Rt],["HH",bt],["H",Rt],["mm",bt],["m",Rt],["ss",bt],["s",Rt],["SSS",ei(3)],["S",ko],["Z",$o]],Mo={},Ao=["\\[([^\\]]+)\\]"];for(var dt=0;dt<xs.length;dt++){var Qi=xs[dt];Mo[Qi[0]]=Qi[1]+"?",Ao.push(Qi[0])}var lf=new RegExp(Ao.join("|"),"g"),ps={};function cf(i,e){var t=ps[e];if(!t){var r=[],s=e.replace(/([$(){}*+.?\\^|])/g,"\\$1").replace(lf,function(u,f){var g=u.charAt(0);return g==="["?f:(r.push(g),Mo[u])});t=ps[e]={_i:r,_r:new RegExp(s)}}var n={},o=i.match(t._r);if(o){for(var a=t._i,l=1,d=o.length;l<d;l++)n[a[l-1]]=o[l];return n}return n}function hf(i){if(/^[zZ]/.test(i.Z))return new Date(fs(i));var e=i.Z.match(/([-+])(\d{2}):?(\d{2})/);return e?new Date(fs(i)-(e[1]==="-"?-1:1)*bi(e[2])*36e5+bi(e[3])*6e4):new Date("")}function df(i,e){if(i){var t=nf(i);if(t||!e&&/^[0-9]{11,15}$/.test(i))return new Date(t?rf(i):bi(i));if(sf(i)){var r=e?cf(i,e):af(i);if(r.y)return r.M&&(r.M=gs(r.M)-1),r.S&&(r.S=of(gs(r.S.substring(0,3)))),r.Z?hf(r):new Date(r.y,r.M||0,r.d||1,r.H||0,r.m||0,r.s||0,r.S||0)}}return new Date("")}var Q=df;function uf(){return new Date}var Bi=uf,ff=et,gf=Q,vf=Bi;function mf(i){var e,t=i?gf(i):vf();return ff(t)?(e=t.getFullYear(),e%4===0&&(e%100!==0||e%400===0)):!1}var No=mf,xf=G,pf=Ee;function yf(i,e,t){if(i){if(xf(i))for(var r=0,s=i.length;r<s&&e.call(t,i[r],r,i)!==!1;r++);else for(var n in i)if(pf(i,n)&&e.call(t,i[n],n,i)===!1)break}}var wf=yf,Ef=G,Cf=Ee;function bf(i,e,t){if(i){var r,s;if(Ef(i))for(r=i.length-1;r>=0&&e.call(t,i[r],r,i)!==!1;r--);else for(s=Cf(i),r=s.length-1;r>=0&&e.call(t,i[s[r]],s[r],i)!==!1;r--);}}var _f=bf,Rf=G,If=Ye,Sf=Ee;function Tf(i,e){return function(t,r){if(t){if(t[i])return t[i](r);if(If(t)||Rf(t))return e(t,r);for(var s in t)if(Sf(t,s)&&r===t[s])return s}return-1}}var Bo=Tf,Of=Bo,kf=To,Df=Of("indexOf",kf),Lf=Df,$f=Bo,Mf=Oo,Af=$f("lastIndexOf",Mf),Ho=Af,Nf=G,Bf=Ye,Hf=Z;function Ff(i){var e=0;return Bf(i)||Nf(i)?i.length:(Hf(i,function(){e++}),e)}var Fo=Ff,Kf=$e;function Pf(i){return Kf(i)&&isFinite(i)}var Yf=Pf,Vf=G,Wf=Pe,Xf=function(i){return!Wf(i)&&!isNaN(i)&&!Vf(i)&&i%1===0},Ko=Xf,zf=G,Gf=Ko,Uf=Pe;function qf(i){return!Uf(i)&&!isNaN(i)&&!zf(i)&&!Gf(i)}var Zf=qf,Jf=Dt,Qf=Jf("boolean"),Po=Qf,jf=Jt,eg=jf("RegExp"),Ir=eg,tg=Jt,ig=tg("Error"),Yo=ig;function rg(i){return i?i.constructor===TypeError:!1}var sg=rg;function ng(i){for(var e in i)return!1;return!0}var Vo=ng,og=Ce,ag=typeof Symbol!==og;function lg(i){return ag&&Symbol.isSymbol?Symbol.isSymbol(i):typeof i=="symbol"}var Wo=lg,cg=Jt,hg=cg("Arguments"),dg=hg,ug=Ye,fg=$e;function gg(i){return!!(i&&ug(i.nodeName)&&fg(i.nodeType))}var vg=gg,mg=Ce,xg=typeof document===mg?0:document,Sr=xg,pg=Sr;function yg(i){return!!(i&&pg&&i.nodeType===9)}var wg=yg,Eg=Ce,Cg=typeof window===Eg?0:window,Xo=Cg,bg=Xo;function _g(i){return!!(bg&&(i&&i===i.window))}var Rg=_g,Ig=Ce,Sg=typeof FormData!==Ig;function Tg(i){return Sg&&i instanceof FormData}var Og=Tg,kg=Ce,Dg=typeof Map!==kg;function Lg(i){return Dg&&i instanceof Map}var $g=Lg,Mg=Ce,Ag=typeof WeakMap!==Mg;function Ng(i){return Ag&&i instanceof WeakMap}var Bg=Ng,Hg=Ce,Fg=typeof Set!==Hg;function Kg(i){return Fg&&i instanceof Set}var Pg=Kg,Yg=Ce,Vg=typeof WeakSet!==Yg;function Wg(i){return Vg&&i instanceof WeakSet}var Xg=Wg,zg=le,Gg=Ye,Ug=G,qg=Ee;function Zg(i){return function(e,t,r){if(e&&zg(t)){if(Ug(e)||Gg(e))return i(e,t,r);for(var s in e)if(qg(e,s)&&t.call(r,e[s],s,e))return s}return-1}}var zo=Zg,Jg=zo,Qg=Jg(function(i,e,t){for(var r=0,s=i.length;r<s;r++)if(e.call(t,i[r],r,i))return r;return-1}),Tr=Qg,ys=$e,ws=G,Es=Ye,jg=Ir,ev=et,tv=Po,iv=De,Cs=Ke,rv=ro;function Go(i,e,t,r,s,n,o){if(i===e)return!0;if(i&&e&&!ys(i)&&!ys(e)&&!Es(i)&&!Es(e)){if(jg(i))return t(""+i,""+e,s,n,o);if(ev(i)||tv(i))return t(+i,+e,s,n,o);var a,l,d,u=ws(i),f=ws(e);if(u||f?u&&f:i.constructor===e.constructor)return l=Cs(i),d=Cs(e),r&&(a=r(i,e,s)),l.length===d.length?iv(a)?rv(l,function(g,m){return g===d[m]&&Go(i[g],e[d[m]],t,r,u||f?m:g,i,e)}):!!a:!1}return t(i,e,s,n,o)}var Uo=Go;function sv(i,e){return i===e}var qo=sv,nv=Uo,ov=qo;function av(i,e){return nv(i,e,ov)}var Zo=av,bs=Ke,lv=Tr,_s=Zo,cv=io,hv=so;function dv(i,e){var t=bs(i),r=bs(e);if(r.length){if(hv(t,r))return cv(r,function(s){return lv(t,function(n){return n===s&&_s(i[n],e[s])})>-1})}else return!0;return _s(i,e)}var uv=dv,Rs=Uo,Is=qo,fv=le,gv=De;function vv(i,e,t){return fv(t)?Rs(i,e,function(r,s,n,o,a){var l=t(r,s,n,o,a);return gv(l)?Is(r,s):!!l},t):Rs(i,e,Is)}var mv=vv,xv=Wo,pv=et,yv=G,wv=Ir,Ev=Yo,Cv=Pe;function bv(i){return Cv(i)?"null":xv(i)?"symbol":pv(i)?"date":yv(i)?"array":wv(i)?"regexp":Ev(i)?"error":typeof i}var _v=bv,Rv=ke,Iv=Le;function Sv(i){return""+(Iv(i)?"":i)+Rv.keyId++}var Tv=Sv,Ov=zo,kv=Ov(function(i,e,t){for(var r=i.length-1;r>=0;r--)if(e.call(t,i[r],r,i))return r;return-1}),Dv=kv,Lv=$t,$v=Ye;function Mv(i){if(Lv(i))return i;if($v(i))try{return JSON.parse(i)}catch{}return{}}var Av=Mv,Nv=Le;function Bv(i){return Nv(i)?"":JSON.stringify(i)}var Hv=Bv,Fv=wr,Kv=Fv("entries",2),Pv=Kv,Yv=le,Vv=G,Wv=Z,Xv=Tr;function zv(i,e){return function(t,r){var s,n,o={},a=[],l=this,d=arguments,u=d.length;if(!Yv(r)){for(n=1;n<u;n++)s=d[n],a.push.apply(a,Vv(s)?s:[s]);r=0}return Wv(t,function(f,g){((r?r.call(l,f,g,t):Xv(a,function(m){return m===g})>-1)?i:e)&&(o[g]=f)}),o}}var Jo=zv,Gv=Jo,Uv=Gv(1,0),qv=Uv,Zv=Jo,Jv=Zv(0,1),Qv=Jv,jv=At;function em(i){return jv(i)[0]}var tm=em,im=At;function rm(i){var e=im(i);return e[e.length-1]}var sm=rm,nm=oo,om=_r,di=Ee;function am(i,e){if(i){if(di(i,e))return!0;var t,r,s,n,o,a,l=om(e),d=0,u=l.length;for(o=i;d<u&&(a=!1,t=l[d],n=t?t.match(nm):"",n?(r=n[1],s=n[2],r?o[r]&&di(o[r],s)&&(a=!0,o=o[r][s]):di(o,s)&&(a=!0,o=o[s])):di(o,t)&&(a=!0,o=o[t]),a);d++)if(d===u-1)return!0}return!1}var lm=am,Ss=tt,cm=_r,hm=eo,dm=Ee,Ts=/(.+)?\[(\d+)\]$/;function um(i,e,t,r,s){if(i[e])t&&(i[e]=s);else{var n,o,a=e?e.match(Ts):null;if(t)o=s;else{var l=r?r.match(Ts):null;l&&!l[1]?o=new Array(Ss(l[2])+1):o={}}return a?a[1]?(n=Ss(a[2]),i[a[1]]?t?i[a[1]][n]=o:i[a[1]][n]?o=i[a[1]][n]:i[a[1]][n]=o:(i[a[1]]=new Array(n+1),i[a[1]][n]=o)):i[a[2]]=o:i[e]=o,o}return i[e]}function fm(i,e,t){if(i&&hm(e)){if((i[e]||dm(i,e))&&!Os(e))i[e]=t;else for(var r=i,s=cm(e),n=s.length,o=0;o<n;o++)if(!Os(s[o])){var a=o===n-1;r=um(r,s[o],a,a?null:s[o+1],t)}}return i}function Os(i){return i==="__proto__"||i==="constructor"||i==="prototype"}var gm=fm,vm=Vo,mm=Ai,xm=le,pm=Lt,ym=Z;function wm(i){return function(){return vm(i)}}function Em(i,e,t){var r,s={};return i&&(e&&mm(e)?e=wm(e):xm(e)||(e=pm(e)),ym(i,function(n,o){r=e?e.call(t,n,o,i):n,s[r]?s[r].push(n):s[r]=[n]})),s}var Qo=Em,Cm=Qo,bm=Qt;function _m(i,e,t){var r=Cm(i,e,t||this);return bm(r,function(s,n){r[n]=s.length}),r}var Rm=_m;function Im(i,e,t){var r,s,n=[],o=arguments;if(o.length<2&&(e=o[0],i=0),r=i>>0,s=e>>0,r<e)for(t=t>>0||1;r<s;r+=t)n.push(r);return n}var jo=Im,ks=Ke,Sm=xt,Tm=Mt,Om=ie,km=ue;function Dm(i,e){if(i&&e){var t=km.apply(this,[{}].concat(Sm(arguments,1))),r=ks(t);Om(ks(i),function(s){Tm(r,s)&&(i[s]=t[s])})}return i}var Lm=Dm,$m=fo,Mm=$m(function(i,e){return i>e}),Am=Mm;function Nm(i){return(i.split(".")[1]||"").length}var Hi=Nm,Bm=tt;function Hm(i,e){if(i.repeat)return i.repeat(e);var t=isNaN(e)?[]:new Array(Bm(e));return t.join(i)+(t.length>0?i:"")}var ti=Hm;function Fm(i,e){return i.substring(0,e)+"."+i.substring(e,i.length)}var ea=Fm,ui=ti,ji=ea;function Km(i){var e=""+i,t=e.match(/^([-+]?)((\d+)|((\d+)?[.](\d+)?))e([-+]{1})([0-9]+)$/);if(t){var r=i<0,s=r?"-":"",n=t[3]||"",o=t[5]||"",a=t[6]||"",l=t[7],d=t[8],u=d-a.length,f=d-n.length,g=d-o.length;return l==="+"?n?s+n+ui("0",d):u>0?s+o+a+ui("0",u):s+o+ji(a,d):n?f>0?s+"0."+ui("0",Math.abs(f))+n:s+ji(n,f):g>0?s+"0."+ui("0",Math.abs(g))+o+a:s+ji(o,g)+a}return e}var it=Km,Ds=Hi,Ls=it;function Pm(i,e){var t=Ls(i),r=Ls(e);return parseInt(t.replace(".",""))*parseInt(r.replace(".",""))/Math.pow(10,Ds(t)+Ds(r))}var ta=Pm,Ym=ta,$s=mt,Vm=it;function Wm(i){return function(e,t){var r=$s(e),s=r;if(r){t=t>>0;var n=Vm(r),o=n.split("."),a=o[0],l=o[1]||"",d=l.substring(0,t+1),u=a+(d?"."+d:"");if(t>=l.length)return $s(u);if(u=r,t>0){var f=Math.pow(10,t);s=Math[i](Ym(u,f))/f}else s=Math[i](u)}return s}}var Or=Wm,Xm=Or,zm=Xm("round"),kr=zm,Gm=Or,Um=Gm("ceil"),ia=Um,qm=Or,Zm=qm("floor"),ra=Zm,Jm=Le,Qm=$e,jm=it;function ex(i){return Qm(i)?jm(i):""+(Jm(i)?"":i)}var ce=ex,tx=kr,ix=ce,rx=ti,sx=ea;function nx(i,e){e=e>>0;var t=ix(tx(i,e)),r=t.split("."),s=r[0],n=r[1]||"",o=e-n.length;return e?o>0?s+"."+n+rx("0",o):s+sx(n,Math.abs(o)):s}var Dr=nx,ox=ke,ax=kr,lx=ia,cx=ra,hx=$e,dx=ce,ux=Dr,fx=it,gx=ue;function vx(i,e){var t=gx({},ox.commafyOptions,e),r=t.digits,s=hx(i),n,o,a,l,d;return s?(n=(t.ceil?lx:t.floor?cx:ax)(i,r),o=fx(r?ux(n,r):n).split("."),l=o[0],d=o[1],a=l&&n<0,a&&(l=l.substring(1,l.length))):(n=dx(i).replace(/,/g,""),o=n?[n]:[],l=o[0]),o.length?(a?"-":"")+l.replace(new RegExp("(?=(?!(\\b))(.{"+(t.spaceNumber||3)+"})+$)","g"),t.separator||",")+(d?"."+d:""):n}var mx=vx,xx=tt,px=ho,yx=px(xx),wx=yx,Ex=ta,Ms=mt;function Cx(i,e){var t=Ms(i),r=Ms(e);return Ex(t,r)}var Lr=Cx,As=Hi,Ns=it,Bs=Lr;function bx(i,e){var t=Ns(i),r=Ns(e),s=Math.pow(10,Math.max(As(t),As(r)));return(Bs(i,s)+Bs(e,s))/s}var sa=bx,_x=sa,Hs=mt;function Rx(i,e){return _x(Hs(i),Hs(e))}var Ix=Rx,Fs=Hi,Ks=it,Ps=mt,Sx=Dr;function Tx(i,e){var t=Ps(i),r=Ps(e),s=Ks(t),n=Ks(r),o=Fs(s),a=Fs(n),l=Math.pow(10,Math.max(o,a)),d=o>=a?o:a;return parseFloat(Sx((t*l-r*l)/l,d))}var Ox=Tx,Ys=Hi,Vs=it,kx=Lr;function Dx(i,e){var t=Vs(i),r=Vs(e),s=Ys(t),n=Ys(r),o=n-s,a=o<0,l=Math.pow(10,a?Math.abs(o):o);return kx(t.replace(".","")/r.replace(".",""),a?1/l:l)}var na=Dx,Lx=na,Ws=mt;function $x(i,e){return Lx(Ws(i),Ws(e))}var Mx=$x,er=sa,Ax=le,Nx=G,Bx=Z,Hx=jt;function Fx(i,e,t){var r=0;return Bx(i&&i.length>2&&Nx(i)?i.sort():i,e?Ax(e)?function(){r=er(r,e.apply(t,arguments))}:function(s){r=er(r,Hx(s,e))}:function(s){r=er(r,s)}),r}var oa=Fx,Kx=na,Px=Fo,Yx=oa;function Vx(i,e,t){return Kx(Yx(i,e,t),Px(i))}var Wx=Vx,Xx="first",rt=Xx,zx="last",pt=zx;function Gx(i){return i.getFullYear()}var st=Gx,Ux=864e5,Nt=Ux;function qx(i){return i.getMonth()}var yt=qx,Zx=et,Jx=re;function Qx(i){return Zx(i)&&!isNaN(Jx(i))}var se=Qx,Xs=rt,jx=pt,ep=Nt,tp=st,zs=re,Gs=yt,ip=Q,rp=se,sp=$e;function aa(i,e,t){var r=e&&!isNaN(e)?e:0;if(i=ip(i),rp(i)){if(t===Xs)return new Date(tp(i),Gs(i)+r,1);if(t===jx)return new Date(zs(aa(i,r+1,Xs))-1);if(sp(t)&&i.setDate(t),r){var s=i.getDate();if(i.setMonth(Gs(i)+r),s!==i.getDate())return i.setDate(1),new Date(zs(i)-ep)}}return i}var ii=aa,np=rt,Us=pt,qs=st,op=ii,ap=Q,lp=se;function cp(i,e,t){var r;if(i=ap(i),lp(i)&&(e&&(r=e&&!isNaN(e)?e:0,i.setFullYear(qs(i)+r)),t||!isNaN(t))){if(t===np)return new Date(qs(i),0,1);if(t===Us)return i.setMonth(11),op(i,0,Us);i.setMonth(t)}return i}var Fi=cp,hp=ii,dp=Q,up=se;function fp(i){var e=i.getMonth();return e<3?1:e<6?2:e<9?3:4}function gp(i,e,t){var r,s=e&&!isNaN(e)?e*3:0;return i=dp(i),up(i)?(r=(fp(i)-1)*3,i.setMonth(r),hp(i,s,t)):i}var vp=gp,mp=Nt,xp=mp*7,la=xp,pp=ke,tr=Nt,yp=la,wp=re,Ep=Q,Cp=se,Zs=$e;function bp(i,e,t,r){if(i=Ep(i),Cp(i)){var s=Zs(t),n=Zs(r),o=wp(i);if(s||n){var a=n?r:pp.firstDayOfWeek,l=i.getDay(),d=s?t:l;if(l!==d){var u=0;a>l?u=-(7-a+l):a<l&&(u=a-l),d>a?o+=((d===0?7:d)-a+u)*tr:d<a?o+=(7-a+d+u)*tr:o+=u*tr}}return e&&!isNaN(e)&&(o+=e*yp),new Date(o)}return i}var ca=bp,Js=rt,_p=pt,Rp=tt,Ip=st,Sp=yt,Tp=re,Op=Q,kp=se;function ha(i,e,t){if(i=Op(i),kp(i)&&!isNaN(e)){if(i.setDate(i.getDate()+Rp(e)),t===Js)return new Date(Ip(i),Sp(i),i.getDate());if(t===_p)return new Date(Tp(ha(i,1,Js))-1)}return i}var da=ha,Qs=rt,Dp=pt,Lp=tt,$p=st,Mp=yt,Ap=re,Np=Q,Bp=se;function ua(i,e,t){if(i=Np(i),Bp(i)&&!isNaN(e)){if(i.setHours(i.getHours()+Lp(e)),t===Qs)return new Date($p(i),Mp(i),i.getDate(),i.getHours());if(t===Dp)return new Date(Ap(ua(i,1,Qs))-1)}return i}var Hp=ua,js=rt,Fp=pt,Kp=tt,Pp=st,Yp=yt,Vp=re,Wp=Q,Xp=se;function fa(i,e,t){if(i=Wp(i),Xp(i)&&!isNaN(e)){if(i.setMinutes(i.getMinutes()+Kp(e)),t===js)return new Date(Pp(i),Yp(i),i.getDate(),i.getHours(),i.getMinutes());if(t===Fp)return new Date(Vp(fa(i,1,js))-1)}return i}var zp=fa,en=rt,Gp=pt,Up=tt,qp=st,Zp=yt,Jp=re,Qp=Q,jp=se;function ga(i,e,t){if(i=Qp(i),jp(i)&&!isNaN(e)){if(i.setSeconds(i.getSeconds()+Up(e)),t===en)return new Date(qp(i),Zp(i),i.getDate(),i.getHours(),i.getMinutes(),i.getSeconds());if(t===Gp)return new Date(Jp(ga(i,1,en))-1)}return i}var e0=ga;function t0(i){return i.toUpperCase()}var va=t0,i0=ke,fi=Nt,r0=la,s0=$e,n0=Mt,o0=Q,a0=se,tn=ca,l0=jo,c0=vt,gi=re,h0=c0(l0(0,7),function(i){return[(i+1)%7,(i+2)%7,(i+3)%7]});function rn(i,e){var t=new Date(i).getDay();return n0(h0[e],t)}function d0(i,e){return function(t,r){var s=s0(r)?r:i0.firstDayOfWeek,n=o0(t);if(a0(n)){var o=tn(n,0,s,s),a=i(o),l=gi(a),d=gi(o),u=d+fi*6,f=new Date(u),g=tn(a,0,s,s),m=gi(g),x;if(d===m)return 1;if(e(o,f)){for(x=gi(i(f));x<u;x+=fi)if(rn(x,s))return 1}var v=m+fi*6,p=new Date(u),w=1;if(e(g,p)){for(w=0,x=l;x<v;x+=fi)if(rn(x,s)){w++;break}}return Math.floor((d-m)/r0)+w}return NaN}}var ma=d0,u0=ma,f0=u0(function(i){return new Date(i.getFullYear(),0,1)},function(i,e){return i.getFullYear()!==e.getFullYear()}),xa=f0,g0=st,v0=yt;function m0(i){return new Date(g0(i),v0(i),i.getDate())}var x0=m0,p0=re,y0=x0;function w0(i){return p0(y0(i))}var E0=w0,C0=Nt,b0=rt,sn=E0,_0=Fi,R0=Q,I0=se;function S0(i){return i=R0(i),I0(i)?Math.floor((sn(i)-sn(_0(i,0,b0)))/C0)+1:NaN}var pa=S0,T0=ce,O0=De,k0=ti;function D0(i,e,t){var r=T0(i);return e=e>>0,t=O0(t)?" ":""+t,r.padStart?r.padStart(e,t):e>r.length?(e-=r.length,e>t.length&&(t+=k0(t,e/t.length)),t.slice(0,e)+r):r}var ya=D0,Vt=ke,L0=va,$0=st,nn=yt,M0=Q,A0=xa,N0=pa,B0=ue,H0=se,F0=le,K0=Le,Ie=ya;function Ue(i,e,t,r){var s=e[t];return s?F0(s)?s(r,t,i):s[r]:r}var P0=/\[([^\]]+)]|y{2,4}|M{1,2}|d{1,2}|H{1,2}|h{1,2}|m{1,2}|s{1,2}|S{1,3}|Z{1,2}|W{1,2}|D{1,3}|[aAeEq]/g;function Y0(i,e,t){if(i){if(i=M0(i),H0(i)){var r=t||{},s=e||Vt.parseDateFormat||Vt.formatString,n=i.getHours(),o=n<12?"am":"pm",a=B0({},Vt.parseDateRules||Vt.formatStringMatchs,r.formats),l=function(b,_){return(""+$0(i)).substring(4-_)},d=function(b,_){return Ie(nn(i)+1,_,"0")},u=function(b,_){return Ie(i.getDate(),_,"0")},f=function(b,_){return Ie(n,_,"0")},g=function(b,_){return Ie(n<=12?n:n-12,_,"0")},m=function(b,_){return Ie(i.getMinutes(),_,"0")},x=function(b,_){return Ie(i.getSeconds(),_,"0")},v=function(b,_){return Ie(i.getMilliseconds(),_,"0")},p=function(b,_){var B=i.getTimezoneOffset()/60*-1;return Ue(i,a,b,(B>=0?"+":"-")+Ie(B,2,"0")+(_===1?":":"")+"00")},w=function(b,_){return Ie(Ue(i,a,b,A0(i,K0(r.firstDay)?Vt.firstDayOfWeek:r.firstDay)),_,"0")},E=function(b,_){return Ie(Ue(i,a,b,N0(i)),_,"0")},C={yyyy:l,yy:l,MM:d,M:d,dd:u,d:u,HH:f,H:f,hh:g,h:g,mm:m,m,ss:x,s:x,SSS:v,S:v,ZZ:p,Z:p,WW:w,W:w,DDD:E,D:E,a:function(b){return Ue(i,a,b,o)},A:function(b){return Ue(i,a,b,L0(o))},e:function(b){return Ue(i,a,b,i.getDay())},E:function(b){return Ue(i,a,b,i.getDay())},q:function(b){return Ue(i,a,b,Math.floor((nn(i)+3)/3))}};return s.replace(P0,function(b,_){return _||(C[b]?C[b](b,b.length):b)})}return"Invalid Date"}return""}var wa=Y0,V0=re,W0=Bi,X0=Date.now||function(){return V0(W0())},Ea=X0,z0=re,G0=Ea,U0=Q,q0=et,Z0=function(i,e){if(i){var t=U0(i,e);return q0(t)?z0(t):t}return G0()},J0=Z0,on=wa;function Q0(i,e,t){return i&&e?(i=on(i,t),i!=="Invalid Date"&&i===on(e,t)):!1}var j0=Q0,e1=ma,t1=e1(function(i){return new Date(i.getFullYear(),i.getMonth(),1)},function(i,e){return i.getMonth()!==e.getMonth()}),i1=t1,r1=Fi,s1=Q,n1=se,o1=No;function a1(i,e){return i=s1(i),n1(i)?o1(r1(i,e))?366:365:NaN}var l1=a1,c1=Nt,h1=rt,d1=pt,an=re,ln=ii,u1=Q,f1=se;function g1(i,e){return i=u1(i),f1(i)?Math.floor((an(ln(i,e,d1))-an(ln(i,e,h1)))/c1)+1:NaN}var v1=g1,cn=re,m1=Bi,hn=Q,dn=se,un=[["yyyy",31536e6],["MM",2592e6],["dd",864e5],["HH",36e5],["mm",6e4],["ss",1e3],["S",0]];function x1(i,e){var t,r,s,n,o,a,l={done:!1,status:!1,time:0};if(i=hn(i),e=e?hn(e):m1(),dn(i)&&dn(e)&&(t=cn(i),r=cn(e),t<r))for(n=l.time=r-t,l.done=!0,l.status=!0,a=0,o=un.length;a<o;a++)s=un[a],n>=s[1]?a===o-1?l[s[0]]=n||0:(l[s[0]]=Math.floor(n/s[1]),n-=l[s[0]]*s[1]):l[s[0]]=0;return l}var p1=x1,y1=ce,w1=De,E1=ti;function C1(i,e,t){var r=y1(i);return e=e>>0,t=w1(t)?" ":""+t,r.padEnd?r.padEnd(e,t):e>r.length?(e-=r.length,e>t.length&&(t+=E1(t,e/t.length)),r+t.slice(0,e)):r}var b1=C1,_1=ce,R1=ti;function I1(i,e){return R1(_1(i),e)}var S1=I1,T1=ce;function O1(i){return i&&i.trimRight?i.trimRight():T1(i).replace(/[\s\uFEFF\xA0]+$/g,"")}var Ca=O1,k1=ce;function D1(i){return i&&i.trimLeft?i.trimLeft():k1(i).replace(/^[\s\uFEFF\xA0]+/g,"")}var ba=D1,L1=Ca,$1=ba;function M1(i){return i&&i.trim?i.trim():L1($1(i))}var _a=M1,A1={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},Ra=A1,N1=ce,B1=Ke;function H1(i){var e=new RegExp("(?:"+B1(i).join("|")+")","g");return function(t){return N1(t).replace(e,function(r){return i[r]})}}var Ia=H1,F1=Ra,K1=Ia,P1=K1(F1),Y1=P1,fn=Ra,V1=Ia,W1=Z,Sa={};W1(fn,function(i,e){Sa[fn[e]]=e});var X1=V1(Sa),z1=X1;function G1(i,e,t){return i.substring(e,t)}var Ta=G1;function U1(i){return i.toLowerCase()}var Oa=U1,q1=ce,qe=Ta,Wt=va,Z1=Oa,ir={};function J1(i){if(i=q1(i),ir[i])return ir[i];var e=i.length,t=i.replace(/([-]+)/g,function(r,s,n){return n&&n+s.length<e?"-":""});return e=t.length,t=t.replace(/([A-Z]+)/g,function(r,s,n){var o=s.length;return s=Z1(s),n?o>2&&n+o<e?Wt(qe(s,0,1))+qe(s,1,o-1)+Wt(qe(s,o-1,o)):Wt(qe(s,0,1))+qe(s,1,o):o>1&&n+o<e?qe(s,0,o-1)+Wt(qe(s,o-1,o)):s}).replace(/(-[a-zA-Z])/g,function(r,s){return Wt(qe(s,1,s.length))}),ir[i]=t,t}var Q1=J1,j1=ce,_t=Ta,Ze=Oa,rr={};function ey(i){if(i=j1(i),rr[i])return rr[i];if(/^[A-Z]+$/.test(i))return Ze(i);var e=i.replace(/^([a-z])([A-Z]+)([a-z]+)$/,function(t,r,s,n){var o=s.length;return o>1?r+"-"+Ze(_t(s,0,o-1))+"-"+Ze(_t(s,o-1,o))+n:Ze(r+"-"+s+n)}).replace(/^([A-Z]+)([a-z]+)?$/,function(t,r,s){var n=r.length;return Ze(_t(r,0,n-1)+"-"+_t(r,n-1,n)+(s||""))}).replace(/([a-z]?)([A-Z]+)([a-z]?)/g,function(t,r,s,n,o){var a=s.length;return a>1&&(r&&(r+="-"),n)?(r||"")+Ze(_t(s,0,a-1))+"-"+Ze(_t(s,a-1,a))+n:(r||"")+(o?"-":"")+Ze(s)+(n||"")});return e=e.replace(/([-]+)/g,function(t,r,s){return s&&s+r.length<e.length?"-":""}),rr[i]=e,e}var ty=ey,iy=ce;function ry(i,e,t){var r=iy(i);return(arguments.length===1?r:r.substring(t)).indexOf(e)===0}var sy=ry,ny=ce;function oy(i,e,t){var r=ny(i),s=arguments.length;return s>1&&(s>2?r.substring(0,t).indexOf(e)===t-1:r.indexOf(e)===r.length-1)}var ay=oy,ly=ke,cy=ce,hy=_a,dy=jt;function uy(i,e,t){return cy(i).replace((t||ly).tmplRE||/\{{2}([.\w[\]\s]+)\}{2}/g,function(r,s){return dy(e,hy(s))})}var ka=uy,fy=ka;function gy(i,e){return fy(i,e,{tmplRE:/\{([.\w[\]\s]+)\}/g})}var vy=gy;function my(){}var xy=my,gn=xt;function py(i,e){var t=gn(arguments,2);return function(){return i.apply(e,gn(arguments).concat(t))}}var yy=py,vn=xt;function wy(i,e){var t=!1,r=null,s=vn(arguments,2);return function(){return t||(r=i.apply(e,vn(arguments).concat(s)),t=!0),r}}var Ey=wy,Cy=xt;function by(i,e,t){var r=0,s=[];return function(){var n=arguments;r++,r<=i&&s.push(n[0]),r>=i&&e.apply(t,[s].concat(Cy(n)))}}var _y=by,Ry=xt;function Iy(i,e,t){var r=0,s=[];return t=t||this,function(){var n=arguments;r++,r<i&&(s.push(n[0]),e.apply(t,[s].concat(Ry(n))))}}var Sy=Iy,Ty=ue;function Oy(i,e,t){var r=null,s=null,n=!1,o=null,a=Ty({leading:!0,trailing:!0},t),l=a.leading,d=a.trailing,u=function(){r=null,s=null},f=function(){n=!0,i.apply(s,r),o=setTimeout(g,e),u()},g=function(){if(o=null,n){u();return}if(d===!0){f();return}u()},m=function(){var v=o!==null;return v&&clearTimeout(o),u(),o=null,n=!1,v},x=function(){if(r=arguments,s=this,n=!1,o===null&&l===!0){f();return}d===!0&&(o=setTimeout(g,e))};return x.cancel=m,x}var ky=Oy,Dy=ue;function Ly(i,e,t){var r=null,s=null,n=typeof t=="boolean"?{leading:t,trailing:!t}:Dy({leading:!1,trailing:!0},t),o=!1,a=null,l=n.leading,d=n.trailing,u=function(){r=null,s=null},f=function(){o=!0,i.apply(s,r),u()},g=function(){if(l===!0&&(a=null),o){u();return}if(d===!0){f();return}u()},m=function(){var v=a!==null;return v&&clearTimeout(a),u(),a=null,o=!1,v},x=function(){o=!1,r=arguments,s=this,a===null?l===!0&&f():clearTimeout(a),a=setTimeout(g,e)};return x.cancel=m,x}var $y=Ly,My=xt;function Ay(i,e){var t=My(arguments,2),r=this;return setTimeout(function(){i.apply(r,t)},e)}var Ny=Ay,By=decodeURIComponent,Da=By,mn=Da,Hy=ie,Fy=Ye;function Ky(i){var e,t={};return i&&Fy(i)&&Hy(i.split("&"),function(r){e=r.split("="),t[mn(e[0])]=mn(e[1]||"")}),t}var La=Ky,Py=encodeURIComponent,$a=Py,_i=$a,Ma=Z,Aa=G,Na=Pe,Yy=De,Ba=$t;function Ha(i,e,t){var r,s=[];return Ma(i,function(n,o){r=Aa(n),Ba(n)||r?s=s.concat(Ha(n,e+"["+o+"]",r)):s.push(_i(e+"["+(t?"":o)+"]")+"="+_i(Na(n)?"":n))}),s}function Vy(i){var e,t=[];return Ma(i,function(r,s){Yy(r)||(e=Aa(r),Ba(r)||e?t=t.concat(Ha(r,s,e)):t.push(_i(s)+"="+_i(Na(r)?"":r)))}),t.join("&").replace(/%20/g,"+")}var Wy=Vy,Xy=Ce,zy=typeof location===Xy?0:location,Ki=zy,vi=Ki;function Gy(){return vi?vi.origin||vi.protocol+"//"+vi.host:""}var Fa=Gy,xn=Ki,Uy=La,qy=Fa;function pn(i){return Uy(i.split("?")[1]||"")}function Zy(i){var e,t,r,s,n=""+i;return n.indexOf("//")===0?n=(xn?xn.protocol:"")+n:n.indexOf("/")===0&&(n=qy()+n),r=n.replace(/#.*/,"").match(/(\?.*)/),s={href:n,hash:"",host:"",hostname:"",protocol:"",port:"",search:r&&r[1]&&r[1].length>1?r[1]:""},s.path=n.replace(/^([a-z0-9.+-]*:)\/\//,function(o,a){return s.protocol=a,""}).replace(/^([a-z0-9.+-]*)(:\d+)?\/?/,function(o,a,l){return t=l||"",s.port=t.replace(":",""),s.hostname=a,s.host=a+t,"/"}).replace(/(#.*)/,function(o,a){return s.hash=a.length>1?a:"",""}),e=s.hash.match(/#((.*)\?|(.*))/),s.pathname=s.path.replace(/(\?|#.*).*/,""),s.origin=s.protocol+"//"+s.host,s.hashKey=e&&(e[2]||e[1])||"",s.hashQuery=pn(s.hash),s.searchQuery=pn(s.search),s}var Ka=Zy,yn=Ki,Jy=Fa,Qy=Ho;function jy(){if(yn){var i=yn.pathname,e=Qy(i,"/")+1;return Jy()+(e===i.length?i:i.substring(0,e))}return""}var ew=jy,wn=Ki,tw=Ka;function iw(){return wn?tw(wn.href):{}}var rw=iw,Pa=ke,sr=Sr,En=Da,Cn=$a,sw=G,bn=Ai,Ya=et,nw=De,ow=Mt,aw=Ke,Ri=ue,nr=ie,lw=Bi,mi=re,cw=Fi,hw=ii,dw=da;function _n(i,e){var t=parseFloat(e),r=lw(),s=mi(r);switch(i){case"y":return mi(cw(r,t));case"M":return mi(hw(r,t));case"d":return mi(dw(r,t));case"h":case"H":return s+t*60*60*1e3;case"m":return s+t*60*1e3;case"s":return s+t*1e3}return s}function or(i){return(Ya(i)?i:new Date(i)).toUTCString()}function Qe(i,e,t){if(sr){var r,s,n,o,a,l,d=[],u=arguments;return sw(i)?d=i:u.length>1?d=[Ri({name:i,value:e},t)]:bn(i)&&(d=[i]),d.length>0?(nr(d,function(f){r=Ri({},Pa.cookies,f),n=[],r.name&&(s=r.expires,n.push(Cn(r.name)+"="+Cn(bn(r.value)?JSON.stringify(r.value):r.value)),s&&(isNaN(s)?s=s.replace(/^([0-9]+)(y|M|d|H|h|m|s)$/,function(g,m,x){return or(_n(x,m))}):/^[0-9]{11,13}$/.test(s)||Ya(s)?s=or(s):s=or(_n("d",s)),r.expires=s),nr(["expires","path","domain","secure"],function(g){nw(r[g])||n.push(r[g]&&g==="secure"?g:g+"="+r[g])})),sr.cookie=n.join("; ")}),!0):(o={},a=sr.cookie,a&&nr(a.split("; "),function(f){l=f.indexOf("="),o[En(f.substring(0,l))]=En(f.substring(l+1)||"")}),u.length===1?o[i]:o)}return!1}function uw(i){return ow(Va(),i)}function Rn(i){return Qe(i)}function In(i,e,t){return Qe(i,e,t),Qe}function Sn(i,e){Qe(i,"",Ri({expires:-1},Pa.cookies,e))}function Va(){return aw(Qe())}function fw(){return Qe()}Ri(Qe,{has:uw,set:In,setItem:In,get:Rn,getItem:Rn,remove:Sn,removeItem:Sn,keys:Va,getJSON:fw});var gw=Qe,vw=Ce,ar=Sr,lr=Xo,mw=ue,xw=ie;function Tn(i){try{var e="__xe_t";return i.setItem(e,1),i.removeItem(e),!0}catch{return!1}}function xi(i){return navigator.userAgent.indexOf(i)>-1}function pw(){var i,e,t,r=!1,s=!1,n=!1,o={isNode:!1,isMobile:r,isPC:!1,isDoc:!!ar};if(!lr&&typeof process!==vw)o.isNode=!0;else{t=xi("Edge"),e=xi("Chrome"),r=/(Android|webOS|iPhone|iPad|iPod|SymbianOS|BlackBerry|Windows Phone)/.test(navigator.userAgent),o.isDoc&&(i=ar.body||ar.documentElement,xw(["webkit","khtml","moz","ms","o"],function(a){o["-"+a]=!!i[a+"MatchesSelector"]}));try{s=Tn(lr.localStorage)}catch{}try{n=Tn(lr.sessionStorage)}catch{}mw(o,{edge:t,firefox:xi("Firefox"),msie:!t&&o["-ms"],safari:!e&&!t&&xi("Safari"),isMobile:r,isPC:!r,isLocalStorage:s,isSessionStorage:n})}return o}var yw=pw,Wa=lc,On=ue,ww=Qt,Ew=jn,Cw=wc,bw=Sc,_w=vt,Rw=io,Iw=ro,Sw=so,Tw=ie,Ow=Cr,kw=no,Dw=qc,Lw=br,$w=Ih,Mw=Rr,Aw=co,Nw=Ah,Bw=xt,Hw=Yh,Fw=Xh,Kw=Mt,Pw=Uh,Yw=Qh,Vw=td,Ww=sd,Xw=ad,zw=Cd,Gw=vo,Uw=Id,qw=Od,Zw=uo,Jw=Md,Qw=mu,jw=Eu,eE=Ru,tE=Ro,iE=Lu,rE=Au,sE=Ku,nE=To,oE=Oo,aE=Ee,lE=G,cE=Pe,hE=Gu,dE=De,uE=le,fE=Ai,gE=Ye,vE=$t,mE=No,xE=et,pE=Le,yE=Z,wE=wf,EE=_f,CE=Lf,bE=Ho,_E=Ke,RE=At,IE=Er,SE=Fo,TE=yo,OE=Eo,kE=wo,DE=Yf,LE=Zf,$E=Ko,ME=Po,AE=$e,NE=Ir,BE=Yo,HE=sg,FE=Vo,KE=Wo,PE=dg,YE=vg,VE=wg,WE=Rg,XE=Og,zE=$g,GE=Bg,UE=Pg,qE=Xg,ZE=uv,JE=Zo,QE=mv,jE=_v,e2=Tv,t2=Tr,i2=Dv,r2=Av,s2=Hv,n2=Pv,o2=qv,a2=Qv,l2=tm,c2=sm,h2=lm,d2=jt,u2=gm,f2=Qo,g2=Rm,v2=jo,m2=Lm,x2=lo,p2=go,y2=Am,w2=mx,E2=kr,C2=ia,b2=ra,_2=Dr,R2=wx,I2=mt,S2=it,T2=Ix,O2=Ox,k2=Lr,D2=Mx,L2=oa,$2=Wx,M2=Fi,A2=vp,N2=ii,B2=ca,H2=da,F2=Hp,K2=zp,P2=e0,Y2=Q,V2=wa,W2=Ea,X2=J0,z2=se,G2=j0,U2=pa,q2=xa,Z2=i1,J2=l1,Q2=v1,j2=p1,eC=b1,tC=ya,iC=S1,rC=_a,sC=Ca,nC=ba,oC=Y1,aC=z1,lC=Q1,cC=ty,hC=sy,dC=ay,uC=ka,fC=vy,kn=ce,gC=xy,vC=Lt,mC=yy,xC=Ey,pC=_y,yC=Sy,wC=ky,EC=$y,CC=Ny,bC=La,_C=Wy,RC=Ka,IC=ew,SC=rw,TC=gw,OC=yw;On(Wa,{assign:On,objectEach:ww,lastObjectEach:Ew,objectMap:Cw,merge:bw,uniq:kw,union:Dw,sortBy:$w,orderBy:Mw,shuffle:Aw,sample:Nw,some:Rw,every:Iw,slice:Bw,filter:Hw,find:Pw,findLast:Yw,findKey:Fw,includes:Kw,arrayIndexOf:nE,arrayLastIndexOf:oE,map:_w,reduce:Vw,copyWithin:Ww,chunk:Xw,zip:zw,unzip:Gw,zipObject:Uw,flatten:qw,toArray:Lw,includeArrays:Sw,pluck:Zw,invoke:Jw,arrayEach:Tw,lastArrayEach:Ow,toArrayTree:Qw,toTreeArray:jw,findTree:eE,eachTree:tE,mapTree:iE,filterTree:rE,searchTree:sE,hasOwnProp:aE,eqNull:pE,isNaN:hE,isFinite:DE,isUndefined:dE,isArray:lE,isFloat:LE,isInteger:$E,isFunction:uE,isBoolean:ME,isString:gE,isNumber:AE,isRegExp:NE,isObject:fE,isPlainObject:vE,isDate:xE,isError:BE,isTypeError:HE,isEmpty:FE,isNull:cE,isSymbol:KE,isArguments:PE,isElement:YE,isDocument:VE,isWindow:WE,isFormData:XE,isMap:zE,isWeakMap:GE,isSet:UE,isWeakSet:qE,isLeapYear:mE,isMatch:ZE,isEqual:JE,isEqualWith:QE,getType:jE,uniqueId:e2,getSize:SE,indexOf:CE,lastIndexOf:bE,findIndexOf:t2,findLastIndexOf:i2,toStringJSON:r2,toJSONString:s2,keys:_E,values:RE,entries:n2,pick:o2,omit:a2,first:l2,last:c2,each:yE,forOf:wE,lastForOf:EE,lastEach:TE,has:h2,get:d2,set:u2,groupBy:f2,countBy:g2,clone:IE,clear:kE,remove:OE,range:v2,destructuring:m2,random:x2,min:y2,max:p2,commafy:w2,round:E2,ceil:C2,floor:b2,toFixed:_2,toNumber:I2,toNumberString:S2,toInteger:R2,add:T2,subtract:O2,multiply:k2,divide:D2,sum:L2,mean:$2,now:W2,timestamp:X2,isValidDate:z2,isDateSame:G2,toStringDate:Y2,toDateString:V2,getWhatYear:M2,getWhatQuarter:A2,getWhatMonth:N2,getWhatWeek:B2,getWhatDay:H2,getWhatHours:F2,getWhatMinutes:K2,getWhatSeconds:P2,getYearDay:U2,getYearWeek:q2,getMonthWeek:Z2,getDayOfYear:J2,getDayOfMonth:Q2,getDateDiff:j2,trim:rC,trimLeft:nC,trimRight:sC,escape:oC,unescape:aC,camelCase:lC,kebabCase:cC,repeat:iC,padStart:tC,padEnd:eC,startsWith:hC,endsWith:dC,template:uC,toFormatString:fC,toString:kn,toValueString:kn,noop:gC,property:vC,bind:mC,once:xC,after:pC,before:yC,throttle:wC,debounce:EC,delay:CC,unserialize:bC,serialize:_C,parseUrl:RC,getBaseURL:IC,locat:SC,browse:OC,cookie:TC});var T=Wa,J=[];for(var cr=0;cr<256;++cr)J.push((cr+256).toString(16).slice(1));function kC(i,e=0){return(J[i[e+0]]+J[i[e+1]]+J[i[e+2]]+J[i[e+3]]+"-"+J[i[e+4]]+J[i[e+5]]+"-"+J[i[e+6]]+J[i[e+7]]+"-"+J[i[e+8]]+J[i[e+9]]+"-"+J[i[e+10]]+J[i[e+11]]+J[i[e+12]]+J[i[e+13]]+J[i[e+14]]+J[i[e+15]]).toLowerCase()}var pi,DC=new Uint8Array(16);function LC(){if(!pi&&(pi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!pi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return pi(DC)}var $C=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Dn={randomUUID:$C};function Fe(i,e,t){if(Dn.randomUUID&&!i)return Dn.randomUUID();i=i||{};var r=i.random||(i.rng||LC)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,kC(r)}const MC=i=>i==null||i==="",q=i=>!MC(i),ht=i=>i==null,ve=i=>!ht(i),AC=i=>function(e,t,r,s){const n=r||{},o=n.children||"children";return i(null,e,t,s,[],[],o,n)},Xa=(i,e,t,r,s,n,o)=>{let a,l;e.forEach((d,u)=>{a=s.concat([""+u]),l=n.concat([d]),t.call(r,d,u,e,a,i,l),d&&o&&(a.push(o),Xa(d,d[o]||[],t,r,a,l,o))})},zt=AC(Xa),za={form:{labelCol:{span:6},wrapperCol:{span:16}},grid:{align:"left",lazyReset:!1,fitHeight:170,striped:!1},canvasTable:{DISABLED:!0,ENABLE_FINDER:!0,AUTO_ROW_HEIGHT:!0}};let te=T.clone(za,!0);function Ga(i){te={form:{...te.form,...i.form},grid:{...te.grid,...i.grid},canvasTable:{...te.canvasTable,...i.canvasTable},renderTooltip:i.renderTooltip??te.renderTooltip}}function Ua(){return te.renderTooltip}function NC(){return te}function Ln(){var i,e;return{labelCol:(i=te.form)==null?void 0:i.labelCol,wrapperCol:(e=te.form)==null?void 0:e.wrapperCol}}function It(){var i,e,t,r;return{align:(i=te.grid)==null?void 0:i.align,lazyReset:(e=te.grid)==null?void 0:e.lazyReset,fitHeight:(t=te.grid)==null?void 0:t.fitHeight,striped:(r=te.grid)==null?void 0:r.striped}}function qa(){return te.canvasTable||{}}function BC(){te=JSON.parse(JSON.stringify(za))}const Pi=i=>{var e;return{dataIndex:i.field,key:i.field,title:i.title,...T.omit(i,["children","slots","cellRender","formatter"]),children:(e=i.children)==null?void 0:e.map(t=>Pi(t))}},$r={xs:24,sm:24,md:12,lg:8,xl:8,xxl:6},Mr={xs:12,sm:5,md:6,lg:6,xl:5,xxl:4},HC={1:{xs:12,sm:5,md:6,lg:6,xl:5,xxl:4},2:{xs:12,sm:5,md:6,lg:6,xl:5,xxl:4},3:{xs:12,sm:5,md:6,lg:6,xl:5,xxl:5},4:{xs:12,sm:4,md:6,lg:9,xl:7,xxl:6},5:{xs:12,sm:4,md:6,lg:9,xl:7,xxl:6},6:{xs:12,sm:6,md:8,lg:10,xl:7,xxl:8},7:{xs:12,sm:6,md:8,lg:10,xl:9,xxl:9},8:{xs:12,sm:6,md:8,lg:10,xl:7,xxl:9},9:{xs:12,sm:6,md:8,lg:10,xl:9,xxl:10}},Za=i=>{const t=(24-i.reduce((s,n)=>s+n,0))%24,r=t===0?24:t<0?24+t:t;return r>1?r:24},$n=["xxs","xs","sm","md","lg","xl","xxl"],FC=i=>{const e=T.isArray(i)?i:T.isNumber(i)?Array.from({length:i},()=>$r):[];return T.zipObject($n,$n.map(t=>e.every(r=>q(r[t]))?Za(e.map(r=>r[t])):24))};function Ar(i,e,t){const r=c.toValue(i);if(typeof r!="object"||r===null)return c.watch(i,e,t);let s=T.clone(r,!0);return c.watch(i,(n,o,a)=>{e(n,s,a),s=T.clone(n,!0)},t)}const ct="-",St={toString:({cellValue:i})=>{var e;return i?((e=i.toString)==null?void 0:e.call(i))??ct:ct},formatByOptions:({cellValue:i},e,t=",")=>{if(i==null)return ct;if(T.isArray(i))if(i.length>0){const s=e.filter(n=>i.includes(n.value));return s.length?s.map(n=>n.label).join(t):ct}else return ct;const r=e.find(s=>s.value===i);return r?r.label:ct},formatSex:({cellValue:i})=>q(i)?T.toNumber(i)===1?"男":"女":ct},KC=(i,{record:e,index:t,column:r,field:s})=>{if(T.isString(i)&&St[i]){const n=St[i];return n({row:e,rowIndex:t,cellValue:s?e[s]:null})}else if(T.isArray(i)&&St[i[0]]&&i.length>1){const n=St[i[0]];return n({row:e,rowIndex:t,cellValue:s?e[s]:null},...i.slice(1))}else return T.isFunction(i)?i({row:e,rowIndex:t,cellValue:s?e[s]:null,column:r}):s?e[s]:null},Ja=i=>{Object.assign(St,i)},PC=c.defineComponent(i=>{const{cellRender:e,renderTableParams:t}=i,{data:r,row:s,field:n,rowIndex:o}=t;return()=>{var a,l;return((l=(a=Gt.renders[e.name])==null?void 0:a.renderDefault)==null?void 0:l.call(a,e,{data:r,row:s,field:n,rowIndex:o},i.defaultHandler))??null}},{name:"RenderAntCell",props:["cellRender","renderTableParams","defaultHandler"]}),Qa=c.defineComponent(i=>{const{tableData:e,row:t,column:r,rowIndex:s}=i,n=r.field?t[r.field]:null;return()=>{var o,a;return((a=(o=r.slots)==null?void 0:o.default)==null?void 0:a.call(o,{row:t,column:r,rowIndex:s,cellValue:n}))??(r.cellRender?c.createVNode(PC,{cellRender:r.cellRender,defaultHandler:i.defaultHandler,renderTableParams:{data:e,row:t,field:r.field,rowIndex:s}},null):r.formatter?KC(r.formatter,{record:t,index:s,field:r.field,column:r}):n)}},{name:"RenderAntDefaultCell",props:["tableData","row","column","rowIndex","defaultHandler"]}),YC={class:"text-right mt-4px"},VC=c.defineComponent({__name:"TableInput",props:{modelValue:{type:Array,default:()=>[]},tableConfig:{type:Object,default:()=>({})},editColumns:{type:Array,default:()=>[]}},emits:["update:modelValue","trigger"],setup(i,{emit:e}){const t=i,r={size:"small",pagination:!1};c.watch(()=>t.modelValue,()=>{n("trigger")},{deep:!0});const s=c.computed(()=>T.merge({},r,t.tableConfig)),n=e,o=c.computed({get:()=>t.modelValue??[],set:f=>{n("update:modelValue",f)}}),a=c.computed(()=>[...t.editColumns,{title:"操作",fixed:"right",width:100,cellRender:{name:"ButtonTree",children:[{content:"删除",type:"link",danger:!0,clickEvt:({rowIndex:f})=>d(f)}]}}]),l=()=>{o.value=[...o.value,{}]},d=f=>{o.value=o.value.filter((g,m)=>m!==f)},u=c.computed(()=>{let f=0;return a.value.filter(g=>g.slots&&g.slots.default||g.formatter||g.cellRender?(g.field||(g.field="__holder__"+f,f++),!0):!1)});return(f,g)=>{const m=c.resolveComponent("a-form-item-rest"),x=c.resolveComponent("a-table"),v=c.resolveComponent("a-button");return c.openBlock(),c.createElementBlock("div",null,[c.createVNode(x,c.mergeProps({"data-source":o.value},s.value,{columns:a.value.map(p=>c.unref(Pi)(p))}),c.createSlots({_:2},[u.value.length>0?{name:"bodyCell",fn:c.withCtx(({column:p,record:w,index:E})=>[c.createVNode(m,null,{default:c.withCtx(()=>[u.value.some(C=>p.key&&C.field===p.key)?(c.openBlock(),c.createBlock(c.unref(Qa),{key:E,"row-index":E,"default-handler":{},column:u.value.find(C=>p.key&&C.field===p.key),row:w,"table-data":o.value},null,8,["row-index","column","row","table-data"])):c.createCommentVNode("",!0)]),_:2},1024)]),key:"0"}:void 0]),1040,["data-source","columns"]),c.createElementVNode("div",YC,[c.createVNode(v,{type:"primary",onClick:l},{default:c.withCtx(()=>[...g[0]||(g[0]=[c.createTextVNode("+添加",-1)])]),_:1})])])}}}),he=i=>{const{icon:e}=i,t=Rl;return t[e]?c.createVNode(t[e]):t[e]},Xt={AInput:{autocomplete:"off"},$input:{autocomplete:"off",allowClear:!0},AInputNumber:{min:0,controls:!1,precision:0},$number:{min:0,controls:!1,precision:0},$date:{format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD"},ADatePicker:{format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD"},$range:{format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD"},ARangePicker:{format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD"},$select:{getPopupContainer:i=>i.parentNode,allowClear:!0,showSearch:!0,filterOption:(i,e)=>e.label&&e.label.toLowerCase().includes(i.toLowerCase())},ASelect:{getPopupContainer:i=>i.parentNode,allowClear:!0,showSearch:!0,filterOption:(i,e)=>e.label&&e.label.toLowerCase().includes(i.toLowerCase())}},yi={PercentInput:{controls:!1,min:0,max:100,addonAfter:"%"},autoComplete:{inputProps:{}}},ja={$input:M.Input,AInput:M.Input,$textarea:M.Textarea,Textarea:M.Textarea,$number:M.InputNumber,AInputNumber:M.InputNumber,$select:M.Select,ASelect:M.Select,$date:M.DatePicker,ADatePicker:M.DatePicker,$range:M.RangePicker,ARangePicker:M.RangePicker,AAutoComplete:M.AutoComplete,$Cascader:M.Cascader,ACascader:M.Cascader,ACheckbox:M.Checkbox,AMentions:M.Mentions,ARate:M.Rate,ASlider:M.Slider,$time:M.TimePicker,ATimePicker:M.TimePicker,ATreeSelect:M.TreeSelect},WC=i=>{const e=ja[i];return{renderItemContent({props:t={},attrs:r={},events:s={},defaultValue:n},{data:o,field:a}){return ve(n)&&q(a)&&ht(o[a])&&(o[a]=n),a?c.createVNode(e,c.mergeProps({is:i,value:o[a],"onUpdate:value":l=>o[a]=l},r,T.merge({},Xt[i],t),{onChange:(...l)=>{var d;(d=s.change)==null||d.call(s,{data:o,field:a},...l)}}),null):c.createVNode(e,c.mergeProps({is:i},t),null)},renderDefault({props:t=Xt[i]??{},attrs:r={},events:s={},defaultValue:n},{data:o,row:a,field:l}){return ve(n)&&q(l)&&ht(a[l])&&(a[l]=n),l?c.createVNode(e,c.mergeProps({is:i,value:a[l],"onUpdate:value":d=>a[l]=d},r,T.merge({},Xt[i],t),{onChange:(...d)=>{var u;(u=s.change)==null||u.call(s,{data:o,row:a,field:l},...d)}}),null):c.createVNode(e,c.mergeProps({is:i},t),null)},renderEdit(t,{props:r=Xt[i]??{},attrs:s={},events:n={}},o,a){return c.createVNode(e,c.mergeProps({is:i,value:t.value,"onUpdate:value":l=>t.value=l},s,T.merge({},Xt[i],r),{onBlur:(...l)=>{var d;a==null||a("blur",t.value),(d=n.blur)==null||d.call(n,o,...l)}}),null)}}},el=(i,e,t)=>{var r,s;return i.dropdowns&&i.dropdowns.length>0&&i.dropdowns.filter(n=>{var o;return!((o=n.hiddenIf)!=null&&o.call(n,e))}).length>0?c.createVNode(M.Dropdown,{getPopupContainer:t??(()=>document.querySelector(".p-wrapper"))},{default:()=>{var n;return c.createVNode(M.Button,c.mergeProps(T.omit(i,["dynamicClassName","content","getContent","icon","clickEvt","dropdowns","getProps"]),{icon:i.icon?c.createVNode(he,{icon:i.icon},null):c.createVNode(he,{icon:"DownOutlined"},null)},((n=i.getProps)==null?void 0:n.call(i,e))??{}),{default:()=>{var o;return[i.content||(((o=i==null?void 0:i.getContent)==null?void 0:o.call(i,e))??"")]}})},overlay:()=>{var n;return c.createVNode("div",{class:`dropdown-wrapper ${((n=i==null?void 0:i.dynamicClassName)==null?void 0:n.call(i,e))??""}`},[i.dropdowns.filter(o=>{var a;return!((a=o.hiddenIf)!=null&&a.call(o,e))}).map(o=>el(o,e,t))])}}):c.createVNode(M.Button,c.mergeProps({class:((r=i==null?void 0:i.dynamicClassName)==null?void 0:r.call(i,e))||""},T.omit(i,["dynamicClassName","content","getContent","icon","clickEvt","dropdowns","getProps"]),{disabled:!!i.dropdowns&&i.dropdowns.length>0||i.disabled,icon:i.icon?c.createVNode(he,{icon:i.icon},null):null},((s=i.getProps)==null?void 0:s.call(i,e))??{},{onClick:()=>{i!=null&&i.clickEvt&&i.clickEvt(e)}}),{default:()=>{var n;return[i.content||(((n=i==null?void 0:i.getContent)==null?void 0:n.call(i,e))??"")]}})},gr={...Object.fromEntries(Object.keys(ja).map(i=>[i,WC(i)])),$button:{renderItemContent({props:i={},events:e={}},{data:t,field:r},s){return c.createVNode(M.Button,c.mergeProps(T.omit(i,["content"]),{icon:i.icon?c.createVNode(he,{icon:i.icon},null):null,onClick:()=>{var n;(n=e.click)==null||n.call(e,{data:t,field:r}),i.htmlType==="reset"&&(s!=null&&s.reset)&&(i.beforeClick&&T.isFunction(i.beforeClick)?i.beforeClick({data:t,field:r}).then(o=>{s.reset(o?{data:o,field:r}:{data:t,field:r})}):s.reset({data:t,field:r}))}}),{default:()=>{var n;return[i.content,((n=i.suffix)==null?void 0:n.call(i,{data:t,field:r}))??null]}})},renderDefault({props:i={},events:e={}},{row:t,field:r},s){return c.createVNode(M.Button,c.mergeProps(T.omit(i,["content"]),{icon:i.icon?c.createVNode(he,{icon:i.icon},null):null,onClick:()=>{var n,o,a;(n=e.click)==null||n.call(e,{row:t,field:r}),i.htmlType==="reset"&&(s!=null&&s.reset)&&(i.beforeClick&&T.isFunction(i.beforeClick)?((o=s==null?void 0:s.setLoadings)==null||o.call(s,!0),i.beforeClick({row:t,field:r}).then(l=>{s.reset(l?{row:l,field:r}:{row:t,field:r})}).finally(()=>{var l;(l=s==null?void 0:s.setLoadings)==null||l.call(s,!1)})):s.reset({row:t,field:r})),i.htmlType==="pick"&&(s!=null&&s.pick)&&(i.beforeClick&&T.isFunction(i.beforeClick)?((a=s==null?void 0:s.setLoadings)==null||a.call(s,!0),i.beforeClick({row:t,field:r}).then(l=>{s.pick(l?{row:l,field:r}:{row:t,field:r})}).finally(()=>{var l;(l=s==null?void 0:s.setLoadings)==null||l.call(s,!1)})):s.pick({row:t,field:r}))}}),{default:()=>[i.content]})}},$buttons:{renderItemContent({props:i={},children:e=[]},{data:t,field:r},s){return c.createVNode("span",{class:"align-gap-box w-fit"},[e.map(n=>c.createVNode(M.Button,c.mergeProps(T.omit(Object.assign({},i,n.props),["content"]),{icon:n.props.icon?c.createVNode(he,{icon:n.props.icon},null):null,onClick:()=>{var o,a;(a=(o=n.events)==null?void 0:o.click)==null||a.call(o,{data:t,field:r}),n.props.htmlType==="reset"&&(s!=null&&s.reset)&&(i.beforeClick&&T.isFunction(i.beforeClick)?i.beforeClick({data:t,field:r}).then(l=>{s.reset(l?{data:l,field:r}:{data:t,field:r})}):s.reset({data:t,field:r})),n.props.htmlType==="pick"&&(s!=null&&s.pick)&&(i.beforeClick&&T.isFunction(i.beforeClick)?i.beforeClick({data:t,field:r}).then(l=>{s.pick(l?{data:l,field:r}:{data:t,field:r})}):s.pick({data:t,field:r}))}}),{default:()=>[n.props.content]}))])},renderDefault({props:i={},children:e=[]},{data:t,row:r,field:s},n){return c.createVNode("span",{class:"align-gap-box w-fit"},[e.filter(o=>{var a,l;return!((l=(a=o==null?void 0:o.props)==null?void 0:a.hiddenIf)!=null&&l.call(a,{data:t,row:r,field:s}))}).map(o=>c.createVNode(M.Button,c.mergeProps(T.omit(Object.assign({},i,o.props),["content","hiddenIf"]),{icon:o.props.icon?c.createVNode(he,{icon:o.props.icon},null):null,onClick:()=>{var a,l,d,u;(l=(a=o.events)==null?void 0:a.click)==null||l.call(a,{data:t,row:r,field:s}),o.props.htmlType==="reset"&&(n!=null&&n.reset)&&(i.beforeClick&&T.isFunction(i.beforeClick)?((d=n==null?void 0:n.setLoadings)==null||d.call(n,!0),i.beforeClick({row:r,field:s}).then(f=>{n.reset(f?{row:f,field:s}:{row:r,field:s})}).finally(()=>{var f;(f=n==null?void 0:n.setLoadings)==null||f.call(n,!1)})):n.reset({row:r,field:s})),o.props.htmlType==="pick"&&(n!=null&&n.pick)&&(i.beforeClick&&T.isFunction(i.beforeClick)?((u=n==null?void 0:n.setLoadings)==null||u.call(n,!0),i.beforeClick({row:r,field:s}).then(f=>{n.pick(f?{row:f,field:s}:{row:r,field:s})}).finally(()=>{var f;(f=n==null?void 0:n.setLoadings)==null||f.call(n,!1)})):n.pick({row:r,field:s}))}}),{default:()=>[o.props.content]}))])}},ButtonTree:{renderDefault({children:i=[],props:e={}},t){const r=c.ref(null);return c.createVNode("span",{ref:r,class:e.noGap?"align-no-gap-box":"align-gap-box"},[i.filter(s=>{var n;return!((n=s.hiddenIf)!=null&&n.call(s,t))}).map(s=>el(s,t,()=>{var n,o,a,l;return((l=(a=(o=(n=r.value)==null?void 0:n.parentElement)==null?void 0:o.parentElement)==null?void 0:a.parentElement)==null?void 0:l.parentElement)||document.body}))??[]])}},$radio:{renderItemContent({props:i={},events:e={},options:t,defaultValue:r},{data:s,field:n}){return ve(r)&&q(n)&&ht(s[n])&&(s[n]=r),q(n)?c.createVNode(M.RadioGroup,c.mergeProps({value:s[n],"onUpdate:value":o=>s[n]=o},i,{options:i.options??t??[],disabled:!!i.disabled,onChange:(...o)=>{var a;(a=e.change)==null||a.call(e,{data:s,field:n},...o)}}),null):null},renderDefault({props:i={},options:e},{row:t,field:r}){return q(r)?c.createVNode(M.RadioGroup,c.mergeProps({value:t[r],"onUpdate:value":s=>t[r]=s},i,{options:i.options??e??[]}),null):null}},$autoComplete:{renderItemContent({props:i={},events:e={}},{data:t,field:r}){return q(r)?c.createVNode(M.AutoComplete,c.mergeProps({value:t[r],"onUpdate:value":s=>t[r]=s},Object.assign({},{filterOption:yi.autoComplete.filterOption},i),{onChange:(...s)=>{var n;(n=e.change)==null||n.call(e,{data:t,field:r},...s)}}),{default:()=>c.createVNode(c.resolveComponent("a-input"),Object.assign({},yi.autoComplete.inputProps,i.inputProps??{}),null)}):null}},$switch:{renderItemContent({props:i={},events:e={},defaultValue:t},{data:r,field:s}){return ve(t)&&q(s)&&ht(r[s])&&(r[s]=t),q(s)?c.createVNode(M.Switch,c.mergeProps({checked:r[s],"onUpdate:checked":n=>r[s]=n},i,{onChange:(...n)=>{var o;(o=e.change)==null||o.call(e,{data:r,field:s},...n)}}),null):null}},$checkbox:{renderItemContent({props:i={},options:e,events:t={},defaultValue:r},{data:s,field:n}){return ve(r)&&q(n)&&ht(s[n])&&(s[n]=r),q(n)?c.createVNode(M.CheckboxGroup,c.mergeProps({value:s[n],"onUpdate:value":o=>s[n]=o},i,{options:i.options??e??[],onChange:(...o)=>{var a;(a=t.change)==null||a.call(t,{data:s,field:n},...o)}}),null):null},renderDefault({props:i={},options:e},{row:t,field:r}){return q(r)?c.createVNode(M.CheckboxGroup,c.mergeProps({value:t[r],"onUpdate:value":s=>t[r]=s},i,{options:i.options??e??[]}),null):null}},$paragraph:{renderDefault({props:i={}},{row:e,field:t}){var n;const r={ellipsis:{expandable:!0,rows:3}},s=((n=i.getContent)==null?void 0:n.call(i,{row:e,field:t}))??(q(t)?e[t]:"");return q(t)?c.createVNode(M.TypographyParagraph,c.mergeProps(T.merge({},r,T.omit(i,["content","getContent"])),{content:s}),null):null}},$tableInput:{renderItemContent({props:i={},handleTrigger:e},{data:t,field:r}){return q(r)?c.createVNode(VC,{modelValue:t[r],"onUpdate:modelValue":s=>t[r]=s,onTrigger:()=>{e&&T.isFunction(e)&&e(i.cusFields??r)},editColumns:i.editColumns??[],tableConfig:i.tableConfig??{}},null):null}},PercentInput:{renderItemContent({props:i={},attrs:e={},defaultValue:t},{data:r,field:s}){const n=i.parse?100:1;if(q(s)){ve(t)&&ht(r[s])&&(r[s]=t);const o=c.computed({get:()=>(r[s]??0)*n,set:a=>{r[s]=(a??0)/n}});return c.createVNode("div",{class:"flex items-center"},[i.info?c.createVNode("span",{class:"pr-4"},[i.info]):null,c.createVNode(c.resolveComponent("a-input-number"),c.mergeProps({class:"w-60px!"},e,{value:o.value,"onUpdate:value":a=>o.value=a},T.merge({},yi.PercentInput,T.omit(i,["info"]))),null)])}else return null},renderDefault({props:i={},attrs:e={}},{row:t,field:r}){const s=i.parse?100:1;if(q(r)){const n=c.computed({get:()=>(t[r]??0)*s,set:o=>{T.set(t,r,(o??0)/s)}});return[i.info?c.createVNode("span",{class:"pr-4"},[i.info]):null,c.createVNode(c.resolveComponent("a-input-number"),c.mergeProps({class:"w-60px!"},e,{value:n.value,"onUpdate:value":o=>n.value=o},T.merge({},yi.PercentInput,T.omit(i,["info"]))),null)]}else return null}},TreeSelect:{renderItemContent({props:i={}},{data:e,field:t}){return q(t)?c.createVNode(M.TreeSelect,c.mergeProps({value:e[t],"onUpdate:value":r=>e[t]=r},i),null):null},renderDefault({props:i={}},{row:e,field:t}){return q(t)?c.createVNode(M.TreeSelect,c.mergeProps({value:e[t],"onUpdate:value":r=>e[t]=r},i),null):null}}},Nr=(i,{renderItemContent:e,renderDefault:t,renderEdit:r})=>{gr.hasOwnProperty(i)&&console.warn(`render ${i} already exists, you are trying to override it`),gr[i]={renderItemContent:e,renderDefault:t,renderEdit:r}},Gt={renders:gr,addRender:Nr},XC=c.defineComponent((i,{emit:e})=>{const{itemRender:t,defaultHandler:r}=i,{renderFormParams:s}=c.toRefs(i),n=a=>{e("trigger",a)},o=(a,l)=>{e("delayTrigger",a,l)};return()=>{var a,l;return((l=(a=Gt.renders[t.name])==null?void 0:a.renderItemContent)==null?void 0:l.call(a,{...t,handleTrigger:n,handleDelayTrigger:o},s.value,r))??null}},{name:"RenderAntItem",props:{itemRender:{type:Object,required:!0},renderFormParams:{type:Object,required:!0},defaultHandler:{type:Object,required:!1}},emits:["trigger","delayTrigger"]}),zC=c.defineComponent(i=>{const{formData:e}=c.toRefs(i);return()=>{var t,r;return((r=(t=i.item.slots)==null?void 0:t.default)==null?void 0:r.call(t,{data:e.value,field:i.item.field},i.passTrigger,i.passDelayTrigger))??null}},{name:"RenderItemSlots",props:["formData","item","passTrigger","passDelayTrigger"]}),GC={key:2},Br=c.defineComponent({__name:"PFormCol",props:{item:{},formData:{}},emits:["trigger","reset"],setup(i,{emit:e}){const t=i,r=e,s=c.ref(!1),n=c.ref(Fe()),o=(g,m)=>{const x=m??222;s.value=!0,setTimeout(()=>{s.value=!1,r("trigger",g)},x)},a=g=>{r("trigger",g)},l=()=>{r("reset")},d=()=>{n.value=Fe()},u=T.debounce(d,100),f=c.computed(()=>{if(!t.item.tooltipConfig)return null;const g=t.item.tooltipConfig,m=Ua(),x=()=>c.h(Zt.InfoCircleOutlined,{class:"cursor-pointer py-4 px-2"}),v=T.isFunction(g.title)?g.title:String(g.title??"");return m?()=>m(x,v):()=>T.isFunction(g.title)?c.h(M.Tooltip,T.omit(g,["title"]),{default:x,title:()=>c.h("div",{innerHTML:g.title()})}):c.h(M.Tooltip,g,{default:x})});return Ar(()=>t.item,(g,m)=>{T.isEqual(g,m)||u()},{deep:!0}),(g,m)=>{const x=c.resolveComponent("a-form-item"),v=c.resolveComponent("a-col");return c.openBlock(),c.createBlock(v,c.mergeProps({key:`_col_${n.value}`},i.item.col??(i.item.span?{span:i.item.span}:c.unref($r))),{default:c.withCtx(()=>{var p;return[(c.openBlock(),c.createBlock(x,c.mergeProps({key:`_item_${n.value}`,class:[`p-content-align-${i.item.align??"left"} ${i.item.forceRequired?"p-required":""}`,{"p-error-hang-out":s.value}],colon:"",label:i.item.title,name:i.item.field,"wrapper-col":i.item.wrapperCol??(i.item.title?void 0:{span:24})},c.unref(T.omit)(i.item,["field","title","span","col","wrapperCol","itemRender","forceRequired","tooltip"])),c.createSlots({default:c.withCtx(()=>{var w,E;return[(w=i.item.slots)!=null&&w.default?(c.openBlock(),c.createBlock(c.unref(zC),{key:`_sl_${i.item.field??"_"}_${n.value}`,"form-data":i.formData,item:i.item,"pass-delay-trigger":o,"pass-trigger":a},null,8,["form-data","item"])):(E=i.item.itemRender)!=null&&E.name?(c.openBlock(),c.createBlock(c.unref(XC),{key:`_re_${i.item.field??"_"}_${n.value}`,"default-handler":{reset:l},"item-render":i.item.itemRender,"render-form-params":{data:i.formData,field:i.item.field},onDelayTrigger:o,onTrigger:a},null,8,["default-handler","item-render","render-form-params"])):(c.openBlock(),c.createElementBlock("span",GC))]}),_:2},[(p=i.item.slots)!=null&&p.title?{name:"label",fn:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(i.item.slots.title)))]),key:"0"}:void 0,f.value?{name:"tooltip",fn:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(f.value)))]),key:"1"}:void 0]),1040,["class","label","name","wrapper-col"]))]}),_:1},16)}}}),UC={key:0,class:"p-pane p-wrapper"},Hr=c.defineComponent({__name:"PForm",props:{name:{},items:{},customReset:{},layout:{},labelCol:{default:()=>Ln().labelCol??{span:6}},wrapperCol:{default:()=>Ln().wrapperCol??{span:16}},colon:{type:Boolean},labelAlign:{},labelWrap:{type:Boolean},prefixCls:{},requiredMark:{},hideRequiredMark:{type:Boolean},model:{},rules:{},validateMessages:{},validateOnRuleChange:{type:Boolean},scrollToFirstError:{},onSubmit:{},validateTrigger:{},size:{},disabled:{type:Boolean},onValuesChange:{},onFieldsChange:{},onFinish:{},onFinishFailed:{},onValidate:{},data:{}},emits:["apply","reset"],setup(i,{expose:e,emit:t}){const r=i,s=t,{items:n,data:o}=c.toRefs(r);function a(){s("apply",o.value)}const l=c.ref(),d=c.ref(Fe()),u=()=>{d.value=Fe()},f=()=>{if(r.customReset)r.customReset();else{const v={};zt(n.value,p=>{p.field&&p.itemRender?ve(p.itemRender.defaultValue)?v[p.field]=p.itemRender.defaultValue:v[p.field]=void 0:p.field&&p.slots&&(ve(p.slots.defaultValue)?v[p.field]=p.slots.defaultValue:v[p.field]=void 0)}),Object.assign(o.value,v)}s("reset")},g=c.computed(()=>({...T.omit(r,["items","data","model","labelCol","wrapperCol"]),labelCol:r.labelCol,wrapperCol:r.wrapperCol})),m=v=>{var p;v&&((p=l.value)==null||p.validateFields(v))},x=v=>{m(v)};return e({reset:u,$form:c.computed(()=>l.value)}),(v,p)=>c.unref(n).some(w=>{var E;return w.field&&w.itemRender||((E=w.slots)==null?void 0:E.default)})?(c.openBlock(),c.createElementBlock("div",UC,[(c.openBlock(),c.createBlock(c.unref(M.Form),c.mergeProps({name:i.name,key:d.value,ref_key:"formEl",ref:l,model:c.unref(o)},g.value,{onSubmit:a}),{default:c.withCtx(()=>[c.createVNode(c.unref(M.Row),{gutter:[6,12]},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(n),(w,E)=>(c.openBlock(),c.createBlock(Br,{key:`_col_${w.field||E}`,"form-data":c.unref(o),item:w,onReset:f,onTrigger:x},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["name","model"]))])):c.createCommentVNode("",!0)}}),qC=c.defineComponent(i=>{const{column:e}=i;return()=>{var t,r;return((r=(t=e.slots)==null?void 0:t.title)==null?void 0:r.call(t,{column:e}))??e.title}},{name:"RenderAntTitle",props:["column"]}),tl=({title:i,content:e})=>new Promise((t,r)=>{M.Modal.confirm({title:i,content:e,onOk:()=>{t()},onCancel:()=>{r()}})}),ZC=M.message.success,JC=M.message.error;M.message.info;const Ii=M.message.warning,QC={key:0},jC={key:1,class:"p-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"},eb={class:"flex items-center flex-1 gap-4px"},tb={key:2},ib={class:"flex items-center gap-4px"},rb={key:0,class:"w-full text-slate-5 pl-4"},Fr=c.defineComponent({__name:"PGrid",props:{selectConfig:{},rowKey:{default:"id"},striped:{type:Boolean,default:()=>It().striped??!1},manualFetch:{type:Boolean},align:{default:()=>It().align??"left"},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},tableConfig:{},scrollMode:{default:"inner"},lazyReset:{type:Boolean,default:()=>It().lazyReset??!1},fitHeight:{default:()=>It().fitHeight??170},fitCanvasHeight:{},renderY:{}},emits:["toolbarButtonClick","toolbarToolClick","pick","resetQuery"],setup(i,{expose:e,emit:t}){var ze,Kt,F,pe,Re;const r=i,{formConfig:s,pageConfig:n,columns:o,toolbarConfig:a,proxyConfig:l,tableConfig:d,selectConfig:u,scrollMode:f}=c.toRefs(r),g=c.reactive({table:!1,toolbar:!1,form:!1}),m=k=>{T.isObject(k)?Object.keys(k).forEach(N=>{g[N]=k[N]}):T.isBoolean(k)&&(g.form=k,g.table=k,g.toolbar=k)},x=c.ref(),v=c.ref(),p=c.ref(),w=c.ref(500),E=c.ref([]),C=c.ref([]),b=k=>{const{ajax:N}=l.value;switch(k){case"multiDelete":N.multiDelete&&(E.value.length>0?tl({title:"警告",content:"确认删除选中的数据吗?"}).then(()=>{g.table=!0,g.toolbar=!0,N.multiDelete(E.value).then(()=>{M.message.success("删除成功"),Et()}).catch(()=>{M.message.error("删除失败")}).finally(()=>{g.table=!1,g.toolbar=!1,R.multiDelete=!1})}):M.message.warn("请选择要删除的数据"));break}},_=c.computed(()=>{const k=[];return zt(o.value??[],N=>{N.slots&&N.slots.title&&(N.field||(N.field="__holder__"+k.length),k.push(N))}),k}),B=c.ref(),K=c.ref(),S=c.ref(Fe()),I=c.ref(Fe()),R=c.reactive([...(((Kt=(ze=r.toolbarConfig)==null?void 0:ze.buttons)==null?void 0:Kt.map(k=>k.code))??[]).filter(k=>k),...(((pe=(F=r.toolbarConfig)==null?void 0:F.tools)==null?void 0:pe.map(k=>k.code))??[]).filter(k=>k)].reduce((k,N)=>(k[N]=!1,k),{})),O=(k,N)=>{R[k]=N},y=()=>{I.value=Fe()},A=T.debounce(y,100),L=c.computed(()=>{const k=[];return zt(o.value??[],N=>{(N.slots&&N.slots.default||N.formatter||N.cellRender)&&(N.field||(N.field="__holder__"+k.length),k.push(N))}),k}),P=c.reactive({page:1,size:((Re=n.value)==null?void 0:Re.pageSize)??10}),Y=c.ref(0),V=c.ref(0),W=c.ref([]),z=c.computed(()=>l.value&&l.value.ajax?n.value?"pagination":"list":"bad"),j=c.useAttrs(),ne=t,Ve=c.computed(()=>C.value.filter(k=>E.value.includes(k[r.rowKey??"id"]))),be=k=>{ne("toolbarButtonClick",{data:W.value,code:k,selectedKeys:E.value,records:Ve.value}),b(k)},Ae=T.debounce(be,100),ee=({key:k})=>Ae(k),Xi=k=>{ne("toolbarToolClick",{data:W.value,code:k,selectedKeys:E.value,records:Ve.value}),b(k)},zi=T.debounce(Xi,100),me=c.ref({}),Gi=({row:k,field:N})=>{ne("pick",{row:k,field:N})},nt=k=>{if(s.value&&s.value.items.length>0){if(s.value.customReset)s.value.customReset();else{const N={};zt(s.value.items,U=>{U.field&&U.itemRender?ve(U.itemRender.defaultValue)?N[U.field]=U.itemRender.defaultValue:N[U.field]=void 0:U.field&&U.slots&&(ve(U.slots.defaultValue)?N[U.field]=U.slots.defaultValue:N[U.field]=void 0)}),me.value=N}ne("resetQuery")}P.page=1,k||Ct()},wt=(k,N)=>N?{list:T.isString(N.list)?T.get(k,N.list):T.isFunction(N.list)?N.list(k):void 0,total:T.isString(N.total)?T.get(k,N.total):T.isFunction(N.total)?N.total(k):void 0,result:T.isString(N.result)?T.get(k,N.result):T.isFunction(N.result)?N.result(k):void 0,message:T.isString(N.message)?T.get(k,N.message):T.isFunction(N.message)?N.message(k):void 0}:{list:k},oi=c.ref(!0),Ui=()=>(C.value=[],E.value=[],nt()),Et=()=>(P.page=1,C.value=[],E.value=[],ot()),qi=(k,N,U)=>(P.page=k.current,P.size=k.pageSize,ot()),ot=()=>new Promise(k=>{if(z.value!=="bad"){g.form=!0,g.table=!0;const{ajax:N}=l.value;N.query({form:me.value,page:P}).then(U=>{const{list:Ge,total:Pt,result:oe,message:lt}=wt(U,l.value.response);Ge?(W.value=Ge,Y.value++):oe?(W.value=oe,V.value=Pt??oe.length,Y.value++):(W.value=[],Y.value++,lt&&M.message.warn(lt)),k(W.value)}).catch(U=>{console.error("fetchData error",U),k([])}).finally(()=>{g.form=!1,g.table=!1})}}),Ct=T.debounce(ot,160),We=(k,N)=>(Object.assign(me.value,k),P.page=1,N?Promise.resolve():Ct()),Ne=(k,N)=>(me.value=k,P.page=1,N?Promise.resolve():Ct()),xe=c.computed(()=>z.value==="pagination"?{current:P.page,total:V.value,pageSize:P.size,responsive:!1,showSizeChanger:!0,showTotal:k=>`共${k}条数据`}:!1),Ht={size:"small",sticky:!0,transformCellText:({text:k})=>T.isArray(k)&&k.length===0?"-":k},at=c.computed(()=>T.merge({},Ht,(d==null?void 0:d.value)??{},u.value?{rowSelection:{type:u.value.multiple?"checkbox":"radio",preserveSelectedRowKeys:!0,selectedRowKeys:E.value,onChange:k=>{E.value=k;const N=r.rowKey??"id",U=C.value.map(oe=>oe[N]),Pt=k.filter(oe=>!U.includes(oe)).map(oe=>W.value.find(lt=>lt[N]===oe)).filter(oe=>!!oe);C.value=[...C.value,...Pt]},getCheckboxProps:u.value.getCheckboxProps}}:{})),ai=c.computed(()=>T.omit({labelCol:Mr,...s.value},["items"])),li=()=>{Et()};c.watch(()=>[o.value,l.value,a.value],()=>{A()},{deep:!0});let Be=null;const _e=()=>{Be&&cancelAnimationFrame(Be),Be=requestAnimationFrame(()=>{if(Be=null,!p.value)return;const k=p.value.getBoundingClientRect();w.value=r.renderY??Math.max(window.innerHeight-k.top-r.fitHeight,100),oi.value=window.innerHeight>600})};let fe=null;c.watch(v,k=>{fe==null||fe.disconnect(),fe=null,k&&(fe=new ResizeObserver(()=>_e()),fe.observe(k))},{immediate:!0}),e({commitProxy:{query:Ct,reload:Ui,reloadPage:Et,passQuery:We,forcePassQuery:Ne},$table:c.computed(()=>K.value),selectedRowKeys:c.computed(()=>E.value),setBtnLoading:O,selectedRecords:Ve,$form:c.computed(()=>B.value),getFormData:()=>me.value,setLoadings:m,resizeTable:_e});let D,H=null;c.onMounted(()=>{if(_e(),window.addEventListener("resize",_e),D=new MutationObserver(k=>{k.forEach(N=>{if(N.type==="attributes"&&N.attributeName==="style"){const U=N.target;window.getComputedStyle(U).display!=="none"&&_e()}})}),x.value){D.observe(x.value,{attributes:!0,attributeFilter:["style"]}),H=new ResizeObserver(()=>_e());let k=x.value.parentElement;for(let N=0;N<5&&k&&k!==document.body;N++)H.observe(k),k=k.parentElement}nt(r.manualFetch)});const X=k=>T.isFunction(k)?k():k,He=k=>T.isString(k),Ft=["align"],Xe=k=>k.map(N=>({...Ft.reduce((U,Ge)=>({[Ge]:r[Ge]}),{}),...N}));return c.onBeforeUnmount(()=>{Be&&cancelAnimationFrame(Be),window.removeEventListener("resize",_e),D.disconnect(),fe==null||fe.disconnect(),H==null||H.disconnect()}),(k,N)=>{var oe,lt,Qr;const U=c.resolveComponent("a-menu-item"),Ge=c.resolveComponent("a-menu"),Pt=c.resolveComponent("a-dropdown");return c.openBlock(),c.createElementBlock("div",c.mergeProps({ref_key:"boxEl",ref:x,class:"h-full p-wrapper flex flex-col gap-8px overflow-y-auto"},c.unref(j)),[z.value==="bad"?(c.openBlock(),c.createElementBlock("div",QC,"请检查配置")):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[(lt=(oe=c.unref(s))==null?void 0:oe.items)!=null&&lt.some($=>$.field&&$.itemRender)?(c.openBlock(),c.createElementBlock("div",{key:0,class:"p-pane p-form-wrapper",ref_key:"pFormWrapper",ref:v},[c.createVNode(c.unref(M.Spin),{spinning:g.form},{default:c.withCtx(()=>{var $;return[(c.openBlock(),c.createBlock(c.unref(M.Form),c.mergeProps({name:($=c.unref(s))==null?void 0:$.name,key:S.value,ref_key:"formEl",ref:B,model:me.value},ai.value,{onSubmit:li}),{default:c.withCtx(()=>[c.createVNode(c.unref(M.Row),{gutter:[6,12]},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(s).items,(ae,ge)=>(c.openBlock(),c.createBlock(Br,{key:`_col_${ae.field||ge}`,"form-data":me.value,item:ae,onReset:N[0]||(N[0]=ci=>nt(r.lazyReset))},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["name","model"]))]}),_:1},8,["spinning"])],512)):c.createCommentVNode("",!0),c.unref(a)?(c.openBlock(),c.createElementBlock("div",jC,[c.createElementVNode("div",eb,[c.unref(a).buttons&&c.unref(a).buttons.length>0?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(c.unref(a).buttons,($,ae)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:ae},[$.dropdowns&&$.dropdowns.length?(c.openBlock(),c.createBlock(Pt,{key:0},{overlay:c.withCtx(()=>[c.createVNode(Ge,{onClick:ee},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList($.dropdowns,ge=>(c.openBlock(),c.createBlock(U,{key:ge.code},{default:c.withCtx(()=>[ge.content&&He(X(ge.content))?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[c.createTextVNode(c.toDisplayString(X(ge.content)),1)],64)):ge.content?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(X(ge.content)),{key:1})):c.createCommentVNode("",!0)]),_:2},1024))),128))]),_:2},1024)]),default:c.withCtx(()=>[c.createVNode(c.unref(M.Button),{type:$.type,size:$.size??"middle",disabled:c.unref(a).disabled||$.disabled,loading:g.toolbar||!!$.code&&R[$.code],danger:$.danger,shape:$.shape,ghost:$.ghost,block:$.block},{default:c.withCtx(()=>[$.icon?(c.openBlock(),c.createBlock(c.unref(he),{key:0,icon:$.icon},null,8,["icon"])):c.createCommentVNode("",!0),$.content&&He(X($.content))?(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[c.createTextVNode(c.toDisplayString(X($.content)),1)],64)):$.content?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(X($.content)),{key:2})):c.createCommentVNode("",!0),c.createVNode(c.unref(Zt.DownOutlined))]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block"])]),_:2},1024)):$.code?(c.openBlock(),c.createBlock(c.unref(M.Button),{key:1,type:$.type,size:$.size??"middle",disabled:c.unref(a).disabled||$.disabled,loading:g.toolbar||!!$.code&&R[$.code],danger:$.danger,shape:$.shape,ghost:$.ghost,block:$.block,onClick:ge=>c.unref(Ae)($.code)},{default:c.withCtx(()=>[$.icon?(c.openBlock(),c.createBlock(c.unref(he),{key:0,icon:$.icon},null,8,["icon"])):c.createCommentVNode("",!0),$.content&&He(X($.content))?(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[c.createTextVNode(c.toDisplayString(X($.content)),1)],64)):$.content?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(X($.content)),{key:2})):c.createCommentVNode("",!0)]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block","onClick"])):(c.openBlock(),c.createElementBlock("div",tb))],64))),128)):c.createCommentVNode("",!0)]),c.createElementVNode("span",ib,[c.unref(a).tools&&c.unref(a).tools.length>0?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(c.unref(a).tools,($,ae)=>(c.openBlock(),c.createBlock(c.unref(M.Button),{key:ae,type:$.type,size:$.size??"middle",disabled:c.unref(a).disabled||$.disabled,danger:$.danger,shape:$.shape,ghost:$.ghost,block:$.block,onClick:ge=>c.unref(zi)($.code),loading:g.toolbar||!!$.code&&R[$.code]},{default:c.withCtx(()=>[$.icon?(c.openBlock(),c.createBlock(c.unref(he),{key:0,icon:$.icon},null,8,["icon"])):c.createCommentVNode("",!0),$.content&&He(X($.content))?(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[c.createTextVNode(c.toDisplayString(X($.content)),1)],64)):$.content?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(X($.content)),{key:2})):c.createCommentVNode("",!0)]),_:2},1032,["type","size","disabled","danger","shape","ghost","block","onClick","loading"]))),128)):c.createCommentVNode("",!0)])])):c.createCommentVNode("",!0),c.createElementVNode("div",{ref_key:"tableWrapperEl",ref:p,class:c.normalizeClass(`p-pane flex-1 ${oi.value?"h-0":""} p-${c.unref(f)??"inner"}-scroll`)},[(Qr=c.unref(u))!=null&&Qr.multiple&&c.unref(u).showCount?(c.openBlock(),c.createElementBlock("div",rb," 已选:"+c.toDisplayString(E.value.length),1)):c.createCommentVNode("",!0),(c.openBlock(),c.createBlock(c.unref(M.Table),c.mergeProps({key:I.value+"_table","row-key":i.rowKey??"id",ref_key:"tableEl",ref:K,"row-class-name":i.striped?($,ae)=>ae%2===1?"p-grid-row-striped":"":"",columns:Xe(c.unref(o)??[]).map($=>c.unref(Pi)($)),"data-source":W.value,loading:g.table,pagination:xe.value},at.value,{scroll:{x:"max-content",y:w.value},onChange:qi}),c.createSlots({_:2},[_.value.length>0?{name:"headerCell",fn:c.withCtx(({column:$})=>[_.value.some(ae=>$.key&&ae.field===$.key)?(c.openBlock(),c.createBlock(c.unref(qC),{key:I.value+"_title_"+Y.value+"_slot_"+$.key,column:_.value.find(ae=>$.key&&ae.field===$.key)},null,8,["column"])):c.createCommentVNode("",!0)]),key:"0"}:void 0,L.value.length>0?{name:"bodyCell",fn:c.withCtx(({column:$,record:ae,index:ge})=>[L.value.some(ci=>$.key&&ci.field===$.key)?(c.openBlock(),c.createBlock(c.unref(Qa),{key:I.value+"_cell_"+Y.value+"_slot_"+$.key,column:L.value.find(ci=>$.key&&ci.field===$.key),"default-handler":{pick:Gi,setLoadings:m},row:ae,"row-index":ge,"table-data":W.value},null,8,["column","default-handler","row","row-index","table-data"])):c.createCommentVNode("",!0)]),key:"1"}:void 0]),1040,["row-key","row-class-name","columns","data-source","loading","pagination","scroll"]))],2)],64))],16)}}});(function(){try{if(typeof document<"u"){var i=document.createElement("style");i.appendChild(document.createTextNode(":root{--evt-header-font: 12px normal Arial;--evt-body-font: 12px normal Arial;--evt-color-white: #fff;--evt-color-black: #000000;--evt-color-primary: rgb(82, 146, 247);--evt-text-color-primary: #333;--evt-text-color-regular: #666;--evt-text-color-secondary: #999;--evt-box-shadow: 0 2px 12px 0 #0000001a;--evt-editor-bg-color: #fff;--evt-editor-text-color: #333;--evt-border-color: #e1e6eb;--evt-body-bg-color: #fff;--evt-stripe-color: #fafafa;--evt-placeholder-color: #cdd0dc;--evt-header-bg-color: #f8faff;--evt-header-text-color: #1d2129;--evt-body-text-color: #4e5969;--evt-footer-text-color: #4e5969;--evt-loading-icon-color: #4e5969;--evt-expand-icon-color: #4e5969;--evt-shrink-icon-color: #4e5969;--evt-error-tip-icon-color: red;--evt-required-color: #f56c6c;--evt-cell-hover-icon-bg-color: #fff;--evt-cell-hover-icon-border-color: #dde0ea;--evt-scroller-color: #dee0e3;--evt-scroller-track-color: #fff;--evt-scroller-focus-color: #bbbec4;--evt-select-border-color: var(--evt-color-primary);--evt-select-area-color: rgba(82, 146, 247, .1);--evt-select-row-col-bg-color: rgba(82, 146, 247, .1);--evt-autofill-point-border-color: #fff;--evt-edit-bg-color: #fcf6ed;--evt-checkbox-color: var(--evt-color-primary);--evt-checkbox-uncheck-color: #dde0ea;--evt-checkbox-disabled-color: #f1f2f4;--evt-checkbox-check-disabled-color: #dde0ea;--evt-icon-edit-color: #4e5969;--evt-icon-select-color: #4e5969;--evt-readonly-color: #fff;--evt-readonly-text-color: var(--evt-body-text-color);--evt-error-tip-color: #ed3f14;--evt-footer-bg-color: #fafafa;--evt-highlight-hover-row-color: rgba(186, 203, 231, .1);--evt-highlight-selected-row-color: rgba(82, 146, 247, .1);--evt-tooltip-bg-color: #303133;--evt-tooltip-text-color: #fff;--evt-resize-row-line-color: #e1e6eb;--evt-resize-column-text-color: #fff;--evt-resize-column-text-bg-color: var(--evt-color-primary);--evt-resize-column-line-color: #e1e6eb;--evt-tree-line-color: #e1e6eb;--evt-sort-icon-color: var(--evt-color-primary);--evt-drag-tip-bg-color: rgba(82, 146, 247, .1);--evt-drag-tip-line-color: var(--evt-color-primary);--evt-context-menu-min-width: 150px;--evt-context-menu-max-width: 220px;--evt-context-menu-item-padding: 8px 12px;--evt-context-menu-bg-color: #fff;--evt-context-menu-text-color: #333;--evt-context-menu-item-hover-text-color: var(--evt-color-primary);--evt-context-menu-item-hover-bg-color: #f5f5f5;--evt-context-menu-text-size: 13px}.dark{--evt-border-color: #363637;--evt-header-bg-color: #141414;--evt-body-bg-color: #141414;--evt-header-text-color: #a3a6ad;--evt-body-text-color: #cfd3dc;--evt-readonly-text-color: #cfd3dc;--evt-footer-text-color: #cfd3dc;--evt-scroller-color: #414243;--evt-scroller-track-color: #141414;--evt-scroller-focus-color: #a3a6ad;--evt-edit-bg-color: #141414;--evt-footer-bg-color: #262727;--evt-autofill-point-border-color: #fff;--evt-editor-bg-color: #434343;--evt-editor-text-color: #cfd3dc;--evt-context-menu-bg-color: #141414;--evt-context-menu-text-color: #cfd3dc;--evt-context-menu-item-hover-text-color: var(--evt-color-primary);--evt-context-menu-item-hover-bg-color: #414243}.e-virt-table-container{position:relative;outline:none}.e-virt-table-stage{position:relative;overflow:hidden;outline:none;box-sizing:border-box;z-index:10;border-radius:8px;border:1px solid var(--evt-border-color)}.e-virt-table-canvas{position:absolute;left:0;top:0;box-sizing:border-box;background-color:var(--evt-body-bg-color);border:none;outline:none;z-index:10}.e-virt-table-editor{position:absolute;top:-10000px;left:-10000px;text-align:left;height:auto;line-height:0;z-index:100;overflow:hidden;background-color:var(--evt-editor-bg-color);border:2px solid var(--evt-color-primary);box-sizing:border-box;box-shadow:var(--evt-box-shadow);display:flex;align-items:center}.e-virt-table-overlayer{position:absolute;left:0;top:0;overflow:hidden;z-index:100;pointer-events:none}.e-virt-table-editor-textarea{width:100%;box-sizing:border-box;outline:none;font-weight:400;padding:8px;font-size:12px;color:inherit;white-space:pre-wrap;word-wrap:break-word;word-break:break-all;line-height:1.5;margin:0;border:none;vertical-align:middle;background:var(--evt-editor-bg-color);color:var(--evt-editor-text-color);overflow-y:auto;resize:none}.e-virt-table-context-menu{position:absolute;font-size:14px;color:var(--evt-text-color-regular);background-color:var(--evt-color-white);border-radius:4px;border:1px solid #e4e7ed;box-shadow:var(--evt-box-shadow);width:fit-content;padding:6px 0;z-index:9999;left:-99999px;top:-99999px}.e-virt-table-context-menu-item{cursor:pointer;padding:6px 24px;color:var(--evt-text-color-regular)}.e-virt-table-context-menu-item:hover{color:var(--evt-color-primary);background-color:#f5f7fa}.e-virt-table-loading{display:none;position:absolute;left:0;top:0;right:0;bottom:0;width:100%;height:100%;z-index:2000;background-color:#fff6;display:flex;align-items:center;justify-content:center}.e-virt-table-loading-spinner{opacity:1;display:flex;flex-direction:column;align-items:center;justify-content:center}.e-virt-table-loading-spinner svg{color:var(--evt-text-color-regular);animation:rotate 1s linear infinite}@keyframes rotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.e-virt-table-loading-text{margin:0;font-size:12px;color:var(--evt-text-color-regular)}.e-virt-table-main-menu,.e-virt-table-submenu{position:absolute;background:var(--evt-context-menu-bg-color);border-radius:4px;box-shadow:0 2px 8px #0000001a;min-width:var(--evt-context-menu-min-width);max-width:var(--evt-context-menu-max-width);color:var(--evt-text-color-primary)}.e-virt-table-main-menu{border:1px solid var(--evt-border-color);z-index:3000;left:-99999px;top:-99999px;display:none;position:fixed;background-color:var(--evt-body-bg-color)}.e-virt-table-submenu{border:1px solid var(--evt-border-color);z-index:1000;max-height:350px;overflow-y:auto;opacity:0;visibility:hidden;transform:translate(-10px);transition:opacity .2s,visibility .2s,transform .2s;-ms-overflow-style:none;scrollbar-width:none}.e-virt-table-submenu::-webkit-scrollbar{display:none}.e-virt-table-submenu.show{opacity:1;visibility:visible;transform:translate(0)}.e-virt-table-submenu:not(.show){transition:none}.e-virt-table-menu-item,.e-virt-table-submenu-item{position:relative;-webkit-user-select:none;user-select:none;padding:var(--evt-context-menu-item-padding);cursor:pointer;display:flex;justify-content:space-between;align-items:center;transition:background .2s,color .2s;color:var(--evt-context-menu-text-color);font-size:var(--evt-context-menu-text-size)}.e-virt-table-menu-item:last-child,.e-virt-table-submenu-item:last-child{border-bottom:none}.e-virt-table-menu-item:has(.e-virt-table-menu-item-icon){padding-left:8px}.e-virt-table-menu-item-content{display:flex;align-items:center;flex:1;min-width:0}.e-virt-table-menu-item-icon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;margin-right:8px;flex-shrink:0}.e-virt-table-menu-item-icon svg{width:100%;height:100%;fill:currentColor}.e-virt-table-menu-item-text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.e-virt-table-menu-arrow{display:inline-flex;align-items:center;justify-content:center;color:var(--evt-text-color-regular);transition:color .2s}.e-virt-table-menu-arrow svg{width:20px;height:20px;fill:currentColor}.e-virt-table-submenu-item:hover,.e-virt-table-menu-item:hover,.e-virt-table-menu-item.active{background:var(--evt-context-menu-item-hover-bg-color);color:var(--evt-context-menu-item-hover-text-color)}.e-virt-table-menu-item.disabled,.e-virt-table-submenu-item.disabled{cursor:not-allowed}.e-virt-table-finder-bar{position:absolute;top:8px;right:16px;display:none;z-index:10000;background:#fff;border:1px solid #dadce0;border-radius:12px;box-shadow:0 2px 6px #0003;padding:0 8px;height:48px;min-width:250px;align-items:center;font-size:12px}.e-virt-table-finder-bar.show{display:flex}.e-virt-table-finder-bar-input-wrapper{display:flex;align-items:center;flex:1;padding:0 8px;position:relative}.e-virt-table-finder-bar-input{border:none;outline:none;flex:1;font-size:12px;background:transparent;color:#333;min-width:150px;padding-left:0;position:relative}.e-virt-table-finder-bar-nav{display:flex;flex-direction:row;gap:8px;margin:0 8px;align-items:center}.e-virt-table-finder-bar-nav-btn{border:none;background:transparent;cursor:pointer;padding:0;color:#666;border-radius:50%;display:flex;align-items:center;justify-content:center}.e-virt-table-finder-bar-nav-btn svg{width:24px;height:24px}.e-virt-table-finder-bar-nav-btn.prev-btn{transform:rotate(-90deg)}.e-virt-table-finder-bar-nav-btn.next-btn{transform:rotate(90deg)}.e-virt-table-finder-bar-nav-btn.close-btn{font-size:24px;color:#666;line-height:1;width:24px;height:24px}.e-virt-table-finder-bar-nav-btn:hover{color:#666;background-color:#f0f0f0}.e-virt-table-finder-bar-count{color:#666;font-size:12px;margin:0 8px;white-space:nowrap;flex-shrink:0}.e-virt-table-finder-bar-count.no-results{color:#999}.e-virt-table-finder-bar-loading{display:none;position:absolute;left:8px;top:0;width:16px;height:16px;flex-shrink:0;pointer-events:none;z-index:0}.e-virt-table-finder-bar-loading.show{display:block}.e-virt-table-finder-bar-loading svg{width:100%;height:100%;color:#666;animation:rotate 1s linear infinite}.e-virt-table-empty{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);font-size:14px;color:#666;z-index:15}")),document.head.appendChild(i)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var sb=Object.defineProperty,nb=(i,e,t)=>e in i?sb(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,h=(i,e,t)=>nb(i,typeof e!="symbol"?e+"":e,t);class ob{constructor(e){h(this,"rules"),this.rules=e}validate(e){const t=[],{column:r,row:s,key:n,rowKey:o,colIndex:a,rowIndex:l,value:d,field:u,fieldValue:f}=e;Array.isArray(this.rules)||(this.rules=[this.rules]);for(const g of this.rules){if(g.validator){const m={field:u,fieldValue:f,value:d,column:r,colIndex:a,rowIndex:l,row:s,key:n,rowKey:o,...g};g.validator(m,d,x=>{x&&t.push({...m,message:x})})}if(!g.required&&(d==null||d===""))return t;g.pattern&&!g.pattern.test(d)&&t.push({value:d,column:r,row:s,key:n,rowKey:o,colIndex:a,rowIndex:l,field:u,fieldValue:f,message:g.message||`${n} is pattern validation error`}),g.required&&(d==null||d==="")&&t.push({value:d,column:r,row:s,key:n,rowKey:o,colIndex:a,rowIndex:l,field:u,fieldValue:f,message:g.message||`${n} is required`})}return t}}function il(){return"xxxxxxxxxxxxxxxxxx".replace(/[x]/g,function(i){const e=Math.random()*16|0;return(i==="x"?e:e&3|8).toString(16)})}function Kr(i,e){let t=0,r;return function(...s){const n=new Date().getTime(),o=n-t,a=typeof e=="function"?e():e;!t||o>=a?(i.apply(this,s),t=n):r||(r=setTimeout(()=>{i.apply(this,s),t=new Date().getTime(),r=void 0},a-o))}}function Ei(i=[]){return i.length?i.map(e=>Ei(e.children)+1).sort((e,t)=>t-e)[0]:0}function ab(i=[]){let e=[],t=[],r=[];return i.forEach(s=>{s.fixed==="left"?e.push(s):s.fixed==="right"?r.push(s):t.push(s)}),[...e.sort((s,n)=>(s.sort??0)-(n.sort??0)),...t.sort((s,n)=>(s.sort??0)-(n.sort??0)),...r.sort((s,n)=>(s.sort??0)-(n.sort??0))]}function Ci(i=[],e=1,t=0,r=""){return i.sort((s,n)=>(s.sort??0)-(n.sort??0)).map(s=>{if(s.children){let n=0,o=s.fixed;s.children.forEach(l=>{l.fixed=o});const a=Ci(s.children,e-1,t+1,s.key);return a&&a.forEach(l=>{n+=l.colspan??0}),{...s,width:s.width,level:t,rowspan:1,colspan:n,parentKey:r,children:a.sort((l,d)=>(l.sort??0)-(d.sort??0))}}return{...s,level:t,rowspan:e,colspan:1,parentKey:r}})}function Ut(i=[]){let e=[];return i.forEach(t=>{t.children?e=e.concat(Ut(t.children)):e.push(t)}),e}function rl(i){return i.filter(e=>!e.hide).map(e=>Array.isArray(e.children)&&e.children.length>0?{...e,children:rl(e.children)}:{...e})}const Mn=/^(\r\n|\n\r|\r|\n)/,lb=/^[^\t\r\n]+/,An=/^\t/;function cb(i){let e=[[""]];if(i.length===0)return e;let t=0,r=0,s;for(;i.length>0&&s!==i.length;)if(s=i.length,i.match(An))i=i.replace(An,""),t+=1,e[r][t]="";else if(i.match(Mn))i=i.replace(Mn,""),t=0,r+=1,e[r]=[""];else{let n="";if(i.startsWith('"')){let o=0,a=!0;for(;a;){const l=i.slice(0,1);l==='"'&&(o+=1),n+=l,i=i.slice(1),(i.length===0||i.match(/^[\t\r\n]/)&&o%2===0)&&(a=!1)}n=n.replace(/^"/,"").replace(/"$/,"").replace(/["]*/g,l=>new Array(Math.floor(l.length/2)).fill('"').join(""))}else{const o=i.match(lb);n=o?o[0]:"",i=i.slice(n.length)}e[r][t]=n}return Array.isArray(e)&&e.length>1&&e[e.length-1].length===1&&e[e.length-1][0]===""&&(e=e.slice(0,e.length-1)),e}function hb(i){let e,t,r,s,n="",o;for(e=0,t=i.length;e<t;e+=1){for(s=i[e].length,r=0;r<s;r+=1)r>0&&(n+=" "),o=i[e][r],typeof o=="string"?o.indexOf(`
2
+ `)>-1?n+=`"${o.replace(/"/g,'""')}"`:n+=o:o==null?n+="":n+=o;e!==t-1&&(n+=`
3
+ `)}return n}function sl(i,e,t=[]){let r=0;const s=[];return i.forEach((n,o)=>{if(o===0)s.push(1);else{const a=t.reduce((d,u)=>`${d}${n[u]??""}`,"")||n[e],l=t.reduce((d,u)=>`${d}${i[o-1][u]??""}`,"")||i[o-1][e];a===l?(s[r]+=1,s.push(0)):(s.push(1),r=o)}}),s}function nl(i,e){let t="",r="";const s={};return e.forEach((n,o)=>{o===0?(t=n.key,r=n.key,s[n.key]=1):i[n.key]===i[t]?(s[n.key]=0,s[r]+=1):(s[n.key]=1,t=n.key,r=n.key)}),s}function db(i,e,t=[]){const{visibleRows:r,rowIndex:s,headIndex:n}=i,o=sl(r,e,t);return o[s-n]===0?{rowspan:0,colspan:0,relationRowKeys:t,mergeRow:!0}:{rowspan:o[s-n],colspan:1,relationRowKeys:t,mergeRow:!0}}function ub(i,e=[]){const{column:t,row:r,visibleLeafColumns:s}=i,n=s.filter(o=>e.includes(o.key));if(e.includes(t.key)){const o=nl(r,n);return o[t.key]===0?{rowspan:0,colspan:0,relationColKeys:e,mergeCol:!0}:{rowspan:1,colspan:o[t.key],relationColKeys:e,mergeCol:!0}}}function fb(i,e=document.documentElement){const t=i.startsWith("--")?i:`--${i}`;return getComputedStyle(e).getPropertyValue(t).trim()}function Nn(i){if(!i)return new Date(0);if(typeof i=="number")return new Date(i);const e=String(i).trim(),t=new Date(e);if(!isNaN(t.getTime()))return t;const r=[/^(\d{4})-(\d{1,2})-(\d{1,2})$/,/^(\d{4})\/(\d{1,2})\/(\d{1,2})$/,/^(\d{4})\.(\d{1,2})\.(\d{1,2})$/,/^(\d{1,2})-(\d{1,2})-(\d{4})$/,/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/,/^(\d{1,2})-(\d{1,2})-(\d{4})$/,/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/,/^(\d{4})(\d{2})(\d{2})$/,/^(\d{4})-(\d{1,2})-(\d{1,2})\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/,/^(\d{4})\/(\d{1,2})\/(\d{1,2})\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/];for(const s of r){const n=e.match(s);if(n){const o=n.slice(1).map(Number);if(s.source.includes("YYYY-MM-DD")||s.source.includes("YYYY/MM/DD")||s.source.includes("YYYY.MM.DD")){const[a,l,d,u=0,f=0,g=0]=o;return new Date(a,l-1,d,u,f,g)}else if(s.source.includes("DD-MM-YYYY")||s.source.includes("DD/MM/YYYY")||s.source.includes("DD.MM.YYYY")){const[a,l,d,u=0,f=0,g=0]=o;return new Date(d,l-1,a,u,f,g)}else if(s.source.includes("MM-DD-YYYY")||s.source.includes("MM/DD/YYYY")||s.source.includes("MM.DD.YYYY")){const[a,l,d,u=0,f=0,g=0]=o;return new Date(d,a-1,l,u,f,g)}else if(s.source.includes("YYYYMMDD")){const[a,l,d]=o;return new Date(a,l-1,d)}}}return new Date(NaN)}function gb(i,e){const t=Nn(i),r=Nn(e);return isNaN(t.getTime())&&isNaN(r.getTime())?0:isNaN(t.getTime())?-1:isNaN(r.getTime())?1:t.getTime()-r.getTime()}class ol{constructor(e,t,r,s,n,o,a){h(this,"ctx"),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"fixed"),h(this,"cellType"),this.ctx=e,this.x=t,this.y=r,this.width=s,this.height=n,this.fixed=a,this.cellType=o}isHorizontalVisible(){if(this.fixed)return!0;const{stageWidth:e,fixedLeftWidth:t,scrollX:r,fixedRightWidth:s}=this.ctx,n=e;return!(this.x+this.width-t-r<=0||this.x-r>=n-s)}isVerticalVisible(){const{stageHeight:e,scrollY:t}=this.ctx,r=e;return!(this.y+this.height-t<=0||this.y-t>=r)}getDrawX(){if(this.fixed==="left")return this.x;if(this.fixed==="right"){const{stageWidth:e,config:{SCROLLER_TRACK_SIZE:t}}=this.ctx;return e-(this.ctx.header.width-this.x)-t}return this.x-this.ctx.scrollX}getDrawY(){return this.cellType==="header"?this.y:this.cellType==="footer"&&this.ctx.config.FOOTER_FIXED?this.y:this.y-this.ctx.scrollY}getLeftFixedX(){return this.x-this.ctx.scrollX}getRightFixedX(){}}class Pr extends ol{constructor(e,t,r,s,n,o,a,l,d,u="body",f=!0){super(e,s,n,o,a,u,l.fixed),h(this,"formatter"),h(this,"formatterFooter"),h(this,"hoverIconName",""),h(this,"operation",!1),h(this,"align"),h(this,"verticalAlign"),h(this,"fixed"),h(this,"type"),h(this,"editorType"),h(this,"editorProps"),h(this,"cellType"),h(this,"level"),h(this,"colspan",1),h(this,"rowspan",1),h(this,"mergeRow",!1),h(this,"mergeCol",!1),h(this,"relationRowKeys",[]),h(this,"relationColKeys",[]),h(this,"key"),h(this,"column"),h(this,"rowIndex"),h(this,"colIndex"),h(this,"rowKey"),h(this,"row"),h(this,"value"),h(this,"render"),h(this,"renderFooter"),h(this,"style",{}),h(this,"domDataset",{}),h(this,"rules",[]),h(this,"message",""),h(this,"text",""),h(this,"displayText",""),h(this,"visibleWidth",0),h(this,"visibleHeight",0),h(this,"isHasChanged",!1),h(this,"drawX",0),h(this,"drawY",0),h(this,"drawCellBgColor",""),h(this,"drawCellSkyBgColor",""),h(this,"drawTextColor",""),h(this,"drawTextFont",""),h(this,"drawTextX",0),h(this,"drawTextY",0),h(this,"drawTextWidth",0),h(this,"drawTextHeight",0),h(this,"drawTreeImageX",0),h(this,"drawTreeImageY",0),h(this,"drawTreeImageWidth",0),h(this,"drawTreeImageHeight",0),h(this,"drawTreeImageName",""),h(this,"drawTreeImageSource"),h(this,"drawSelectionImageX",0),h(this,"drawSelectionImageY",0),h(this,"drawSelectionImageWidth",0),h(this,"drawSelectionImageHeight",0),h(this,"drawSelectionImageName",""),h(this,"drawSelectionImageSource"),h(this,"drawHoverImageX",0),h(this,"drawHoverImageY",0),h(this,"drawHoverImageWidth",0),h(this,"drawHoverImageHeight",0),h(this,"drawHoverImageName",""),h(this,"drawHoverImageSource"),h(this,"autoRowHeight",!1),h(this,"calculatedHeight",0),h(this,"ellipsis",!1),h(this,"rowExpand",!1),h(this,"rowHasChildren",!1),h(this,"overflowTooltipShow",!0),h(this,"selectorCellValueType","value"),h(this,"overflowTooltipMaxWidth",500),h(this,"overflowTooltipPlacement","top"),h(this,"maxLineClamp","auto"),this.visibleWidth=this.width,this.visibleHeight=this.height,this.colIndex=r,this.rowIndex=t,this.key=l.key,this.type=l.type||"",this.editorType=l.editorType||"text",this.selectorCellValueType=l.selectorCellValueType||this.ctx.config.SELECTOR_CELL_VALUE_TYPE||"value",this.editorProps=l.editorProps||{},this.cellType=u,this.align=l.align||this.ctx.config.COLUMNS_ALIGN,this.verticalAlign=l.verticalAlign||this.ctx.config.COLUMNS_VERTICAL_ALIGN,this.fixed=l.fixed||"",this.level=l.level||0,this.operation=l.operation||!1,this.column=l,this.rules=l.rules||[],this.row=d,this.rowKey=this.cellType==="body"?this.ctx.database.getRowKeyForRowIndex(t):`${this.cellType}_${this.rowIndex}`,this.value=this.getValue(),this.render=l.render,this.overflowTooltipShow=l.overflowTooltipShow!==!1,this.autoRowHeight=l.autoRowHeight!==void 0?l.autoRowHeight:this.ctx.config.AUTO_ROW_HEIGHT,this.overflowTooltipMaxWidth=l.overflowTooltipMaxWidth||500,this.overflowTooltipPlacement=l.overflowTooltipPlacement||"top",this.renderFooter=l.renderFooter,this.hoverIconName=l.hoverIconName,this.formatter=l.formatter,this.formatterFooter=l.formatterFooter,this.maxLineClamp=l.maxLineClamp||"auto",f&&this.update()}setWidthHeight(e,t){this.width=e,this.height=t}getValidationMessage(){const e=this.ctx.database.getValidationError(this.rowKey,this.key);if(Array.isArray(e)&&e.length){const[t]=e;this.message=t.message||""}return this.message}update(){this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawTextX=this.drawX,this.drawTextY=this.drawY,this.isHasChanged=this.ctx.database.isHasChangedData(this.rowKey,this.key),this.updateSpan(),this.drawTextWidth=this.visibleWidth,this.drawTextHeight=this.visibleHeight,this.updateStyle(),this.updateType(),this.updateHoverIcon(),this.updateSelection(),this.updateTree(),this.updateEditor(),this.updateRender(),this.getValidationMessage(),this.updateContainer(),this.text=this.getText(),this.displayText=this.getDisplayText()}updateSpan(){if(this.cellType==="footer")return;const{SPAN_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e,{colspan:r=1,rowspan:s=1,relationRowKeys:n,relationColKeys:o,mergeRow:a=!1,mergeCol:l=!1}=t({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue(),headIndex:this.ctx.body.headIndex,headPosition:this.ctx.database.getPositionForRowIndex(this.ctx.body.headIndex),visibleRows:this.ctx.body.visibleRows,visibleLeafColumns:this.ctx.header.visibleLeafColumns,rows:this.ctx.body.data})||{};Array.isArray(n)&&n.length>0?this.relationRowKeys=n:this.relationRowKeys=[this.key],Array.isArray(o)&&o.length>0?this.relationColKeys=o:this.relationColKeys=[this.key],this.mergeCol=l,this.mergeRow=a,this.colspan=r,this.rowspan=s,this.visibleWidth=this.getWidthByColIndexColSpan(this.colIndex,this.colspan),this.visibleHeight=this.ctx.database.getHeightByRowIndexRowSpan(this.rowIndex,this.rowspan)}}updateSpanInfo(){if(this.mergeRow||this.mergeCol){const e=this.getSpanInfo();this.height=e.height,this.width=e.width,this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawY-=e.offsetTop,this.drawX-=e.offsetLeft}}updateType(){const{BODY_CELL_TYPE_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});t!==void 0&&(this.type=t)}}updateEditor(){const{BODY_CELL_EDITOR_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});if(t!==void 0){const{type:r,props:s={}}=t;this.editorType=r,this.editorProps=s}}}updateRender(){const{BODY_CELL_RENDER_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});t!==void 0&&(this.render=t)}}validate(){this.ctx.database.getValidator(this.rowKey,this.key).then(()=>{this.ctx.database.setValidationError(this.rowKey,this.key,[]),this.message=""}).catch(e=>{if(Array.isArray(e)&&e.length){const[t]=e;this.message=t.message,this.ctx.database.setValidationError(this.rowKey,this.key,e)}}).finally(()=>{this.ctx.emit("draw")})}updateStyle(){this.autoRowHeight&&(this.domDataset={"data-auto-height":!0,"data-row-index":this.rowIndex,"data-col-index":this.colIndex}),this.style=this.getOverlayerViewsStyle()}updateTree(){const{CELL_PADDING:e=0}=this.ctx.config,{rowKey:t,cellType:r}=this;let s,n=0,o="";if(!(["tree","selection-tree","tree-selection"].includes(this.type)&&r==="body"))return;const a=this.ctx.database.getRowForRowKey(t),{expand:l=!1,hasChildren:d=!1,expandLoading:u=!1,level:f=0}=a||{};this.rowExpand=l,this.rowHasChildren=d;const{TREE_INDENT:g=16,CHECKBOX_SIZE:m,TREE_ICON_SIZE:x}=this.ctx.config;if(n=f*g,u){const _=this.ctx.icons.get("loading");o="loading",s=_}else if(d){const _=this.ctx.icons.get("expand"),B=this.ctx.icons.get("shrink");s=l?B:_,o=l?"shrink":"expand"}let v=x,p=x,w=this.drawX;(this.align==="center"||this.align==="right")&&(w=this.drawX+(this.visibleWidth-v-2*e)/2,this.align="left");let E=w+n+e,C=this.drawY+(this.visibleHeight-p)/2,b=n+this.drawX+v-.5;this.type==="selection-tree"?(E=n+this.drawSelectionImageX+this.drawSelectionImageWidth,b=E+v-e/2):this.type==="tree-selection"?b=E+m+v-e/2:b=E+v-e/2,this.drawTextX=b,this.drawTextWidth=this.drawX+this.visibleWidth-b,!(E+v+e>this.drawX+this.visibleWidth)&&(C+p+e>this.drawY+this.visibleHeight||(this.drawTreeImageX=E,this.drawTreeImageY=C,this.drawTreeImageWidth=v,this.drawTreeImageHeight=p,s?(this.drawTreeImageName=o,this.drawTreeImageSource=s):(this.drawTreeImageName="",this.drawTreeImageSource=void 0)))}drawTreeLine(){const{TREE_LINE:e,TREE_INDENT:t=16,TREE_ICON_SIZE:r=16,TREE_LINE_COLOR:s="#e1e6eb"}=this.ctx.config;if(!e||this.cellType!=="body"||!["tree","selection-tree","tree-selection"].includes(this.type)||this.rowspan===0||this.colspan===0)return;const n=this.ctx.database.getRowForRowKey(this.rowKey)||{},o=n.level??0,a=this.drawTreeImageX+this.drawTreeImageWidth/2,l=this.drawTreeImageY+this.drawTreeImageHeight/2;let d=this.drawTreeImageX-o*t;const u=Array.isArray(n.parentRowKeys)?n.parentRowKeys:[];if(o>0){for(let x=0;x<o-1;x+=1){const v=u[x+1];if((v?this.ctx.database.getRowForRowKey(v)||{}:{}).isLastChild)continue;const p=Math.round(this.drawTreeImageX-(o-x)*t+r/2);this.ctx.paint.drawLine([p,this.drawY,p,this.drawY+this.visibleHeight],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}const f=Math.round(this.drawTreeImageX-t+r/2),g=n.isLastChild?l:this.drawY+this.visibleHeight;this.ctx.paint.drawLine([f,this.drawY,f,g],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0});const m=Math.round(d+(o-1)*t+r/2);this.ctx.paint.drawLine([m,l,a,l],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}if(n.hasChildren&&n.expand){const f=this.drawTreeImageY+this.drawTreeImageHeight,g=this.drawY+this.visibleHeight;this.ctx.paint.drawLine([a,f,a,g],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}}updateContainer(){const{BODY_BG_COLOR:e,EDIT_BG_COLOR:t,BODY_CELL_STYLE_METHOD:r,FOOTER_CELL_STYLE_METHOD:s,READONLY_TEXT_COLOR:n,BODY_TEXT_COLOR:o,FOOTER_TEXT_COLOR:a,FOOTER_BG_COLOR:l,HIGHLIGHT_SELECTED_ROW:d,HIGHLIGHT_SELECTED_ROW_COLOR:u,HIGHLIGHT_HOVER_ROW:f,HIGHLIGHT_HOVER_ROW_COLOR:g,STRIPE:m,STRIPE_COLOR:x,FINDER_CELL_BG_COLOR:v}=this.ctx.config;if(this.cellType==="footer"){let R=l,O=a;if(typeof s=="function"){const y=s,{backgroundColor:A,color:L,font:P}=y({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()})||{};A&&(R=A),L&&(O=L),P&&(this.drawTextFont=P)}this.drawCellSkyBgColor="transparent",this.drawCellBgColor=R,this.drawTextColor=O;return}let p="transparent";const w=this.ctx.hoverCell,E=this.ctx.currentCell;let C=this.rowIndex,b=this.rowIndex;if(this.rowspan!==1&&(f||d)){const R=this.getSpanInfo(),{yArr:O}=R;C=O[0],b=O[1]}f&&w&&(w.rowKey===this.rowKey&&(p=g),w.rowIndex>=C&&w.rowIndex<=b&&(p=g)),d&&E&&(E.rowKey===this.rowKey&&(p=u),E.rowIndex>=C&&E.rowIndex<=b&&(p=u)),this.drawCellSkyBgColor=p;let _=e,B=o;if(this.ctx.database.getReadonly(this.rowKey,this.key)||(_=t,B=n),m&&(this.rowIndex%2?_=x:_=e),typeof r=="function"){const R=r,{backgroundColor:O,color:y,font:A}=R({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,isHasChanged:this.isHasChanged,value:this.getValue()})||{};O&&(_=O),y&&(B=y),A&&(this.drawTextFont=A)}const{rowIndex:K,colIndex:S,type:I}=this.ctx.finderBar;K===this.rowIndex&&S===this.colIndex&&I==="body"&&(_=v),this.drawCellBgColor=_,this.drawTextColor=B}updateSelection(){const{visibleWidth:e,visibleHeight:t,rowspan:r,colspan:s,cellType:n,type:o,rowIndex:a,rowKey:l}=this;if(r===0||s===0||n==="footer"||!["index-selection","selection","selection-tree","tree-selection"].includes(o))return;const d=this.ctx.database.getRowSelectable(l),{CHECKBOX_SIZE:u=0,CELL_PADDING:f}=this.ctx.config;let g=this.drawX+f;(this.align==="center"||this.align==="right")&&(g=this.drawX+(e-u)/2);let m=g,x=this.drawY+(t-u)/2;if(o!=="selection-tree"&&o==="tree-selection"){const{TREE_INDENT:w=16,TREE_ICON_SIZE:E}=this.ctx.config,C=this.ctx.database.getRowForRowKey(l),{level:b=0}=C||{},_=b*w;m=g+E+_}let v=this.ctx.icons.get("checkbox-uncheck"),p="checkbox-uncheck";if(o==="selection-tree"||o==="tree-selection"){const w=this.ctx.database.getTreeSelectionState(l);w.indeterminate&&d?(v=this.ctx.icons.get("checkbox-indeterminate"),p="checkbox-indeterminate"):w.checked&&d?(v=this.ctx.icons.get("checkbox-check"),p="checkbox-check"):!w.checked&&d?(v=this.ctx.icons.get("checkbox-uncheck"),p="checkbox-uncheck"):(v=this.ctx.icons.get("checkbox-disabled"),p="checkbox-disabled")}else{const w=this.ctx.database.getRowSelection(l);w&&d?(v=this.ctx.icons.get("checkbox-check"),p="checkbox-check"):w&&!d?(v=this.ctx.icons.get("checkbox-check-disabled"),p="checkbox-check-disabled"):!w&&d?(v=this.ctx.icons.get("checkbox-uncheck"),p="checkbox-uncheck"):(v=this.ctx.icons.get("checkbox-disabled"),p="checkbox-disabled")}m+u+f>this.drawX+this.visibleWidth||x+u+f>this.drawY+this.visibleHeight||(o==="index-selection"?(this.ctx.hoverCell&&this.ctx.hoverCell.rowIndex===a||["checkbox-disabled","checkbox-check"].includes(p))&&(this.drawSelectionImageX=m,this.drawSelectionImageY=x,this.drawSelectionImageWidth=u,this.drawSelectionImageHeight=u,this.drawSelectionImageName=p,this.drawSelectionImageSource=v):(this.drawSelectionImageX=m,this.drawSelectionImageY=x,this.drawSelectionImageWidth=u,this.drawSelectionImageHeight=u,this.drawSelectionImageName=p,this.drawSelectionImageSource=v))}updateHoverIcon(){if(this.ctx.database.getReadonly(this.rowKey,this.key))return;const{BODY_CELL_HOVER_ICON_METHOD:e,CELL_HOVER_ICON_SIZE:t,CELL_PADDING:r,ENABLE_MERGE_CELL_LINK:s}=this.ctx.config;if(typeof e=="function"){const o=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});o!==void 0&&(this.hoverIconName=o)}const{hoverCell:n}=this.ctx;if(this.hoverIconName&&!this.ctx.editing&&n){let o=0,a=0;if(n.rowKey===this.rowKey&&(o=this.drawX+this.width-t-r,a=this.drawY+(this.height-t)/2),this.rowspan!==1&&s){const d=this.getSpanInfo(),{yArr:u}=d,f=u[0],g=u[1];if(n.rowIndex>=f&&n.rowIndex<=g){const{width:m,height:x,offsetTop:v,offsetLeft:p}=d;o=this.drawX-p+m-t-r,a=this.drawY-v+(x-t)/2}}const l=this.ctx.icons.get(this.hoverIconName);this.drawHoverImageX=o,this.drawHoverImageY=a,this.drawHoverImageWidth=t,this.drawHoverImageHeight=t,this.drawHoverImageName=this.hoverIconName,this.drawHoverImageSource=l}}getAutoHeight(){if(this.cellType!=="body"||!this.autoRowHeight||this.rowspan===0)return 0;if(this.render){const o=this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex);return this.rowspan>1?o<this.visibleHeight?0:Math.round(o-(this.visibleHeight-this.height)):Math.round(o)}if(!(this.displayText&&typeof this.displayText=="string"))return 0;const{BODY_FONT:e,CELL_PADDING:t,CELL_LINE_HEIGHT:r}=this.ctx.config,s=`${this.displayText}_${this.drawTextWidth}_${this.drawTextFont}`,n=this.ctx.paint.calculateTextHeight(this.displayText,this.drawTextWidth,{font:this.drawTextFont||e,padding:t,align:this.align,verticalAlign:this.verticalAlign,color:this.drawTextColor,autoRowHeight:this.autoRowHeight,lineHeight:r,maxLineClamp:this.maxLineClamp,cacheTextKey:s});return this.rowspan>1?n<this.visibleHeight?0:Math.round(n-(this.visibleHeight-this.height)):Math.round(n)}getSpanInfo(){return this.ctx.database.getSpanInfo(this)}getDisplayText(){return this.cellType==="footer"?this.renderFooter||this.text===null||this.text===void 0?"":this.text:this.rowspan===0||this.colspan===0||this.render||this.type==="index-selection"&&(this.ctx.hoverCell&&this.ctx.hoverCell.rowIndex===this.rowIndex||["checkbox-disabled","checkbox-check"].includes(this.drawSelectionImageName))||this.text===null||this.text===void 0?"":`${this.text}`}getText(){if(this.cellType==="footer")return typeof this.formatterFooter=="function"?this.formatterFooter({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.row[this.key]}):this.row[this.key];if(typeof this.formatter=="function")return this.formatter({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});const{BODY_CELL_FORMATTER_METHOD:e}=this.ctx.config;return typeof e=="function"?e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()}):["index-selection","index"].includes(this.type)?`${this.rowIndex+1}`:(this.value=this.ctx.database.getItemValue(this.rowKey,this.key),this.value)}getValue(){return this.ctx.database.getItemValue(this.rowKey,this.key)}setValue(e){this.ctx.setItemValueByEditor(this.rowKey,this.key,e)}getOverlayerViewsStyle(){let e=this.drawX-this.ctx.fixedLeftWidth,t=this.drawY-this.ctx.body.y;if(this.fixed==="left"?e=this.drawX:this.fixed==="right"&&(e=this.drawX-(this.ctx.stageWidth-this.ctx.fixedRightWidth)),this.cellType==="footer"&&this.ctx.config.FOOTER_FIXED&&(t=this.drawY-this.ctx.footer.y),this.autoRowHeight&&this.render&&this.verticalAlign==="middle"){const s=this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex);if(s<this.visibleHeight&&s>0){const n=(this.visibleHeight-s)/2;t=t+n}}this.autoRowHeight&&this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex)===0&&(e=-99999,t=-99999);let r={};return this.rowspan===0&&(r={display:"none"}),{position:"absolute",overflow:"hidden",left:`${Math.round(e-1)}px`,top:`${Math.round(t-1)}px`,width:`${this.visibleWidth}px`,height:this.autoRowHeight?"auto":`${this.visibleHeight}px`,pointerEvents:"initial",userSelect:"none",...r}}drawContainer(){const{paint:e,config:{BORDER_COLOR:t,BORDER:r}}=this.ctx,{drawX:s,drawY:n}=this;e.drawRect(s,n,this.visibleWidth,this.visibleHeight,{borderColor:r?t:"transparent",fillColor:this.drawCellBgColor}),e.drawRect(s,n,this.width,this.height,{borderColor:"transparent",fillColor:this.drawCellSkyBgColor}),r||this.ctx.paint.drawLine([s,n+this.visibleHeight,s+this.visibleWidth,n+this.visibleHeight],{borderColor:t,fillColor:t,borderWidth:1,lineCap:"round",lineJoin:"round"})}drawAutofillPiont(){if(this.cellType==="footer")return;const{SELECT_BORDER_COLOR:e,ENABLE_AUTOFILL:t,ENABLE_SELECTOR:r,AUTOFILL_POINT_BORDER_COLOR:s}=this.ctx.config;if(!r||!t||this.ctx.editing)return;const{xArr:n,yArr:o}=this.ctx.selector,a=n[1],l=o[1],{colIndex:d,rowIndex:u,drawX:f,drawY:g}=this;if(d===a&&u===l){const m=d===this.ctx.maxColIndex||u===this.ctx.maxRowIndex||d===this.ctx.lastCenterColIndex?6:4;this.ctx.paint.drawRect(f+this.width-m,g+this.height-m,6,6,{borderColor:s,fillColor:e})}}draw(){this.drawTreeLine(),this.drawText(),this.drawImage(),this.drawSelector(),this.drawAutofillPiont(),this.drawErrorTip()}getWidthByColIndexColSpan(e,t){if(t===0)return 0;let r=0;for(let s=e;s<e+t;s++){const n=this.ctx.header.leafCellHeaders[s];r+=n.width}return r}drawText(){const{CELL_PADDING:e,BODY_FONT:t,PLACEHOLDER_COLOR:r,CELL_LINE_HEIGHT:s}=this.ctx.config,{placeholder:n}=this.column;let o=this.displayText,a=this.drawTextColor;if(!this.ctx.database.getReadonly(this.rowKey,this.key)&&n&&["",null,void 0].includes(this.text)&&this.cellType==="body"&&!(this.rowspan===0||this.colspan===0)&&(o=n,a=r),["",null,void 0].includes(o))return!1;typeof o!="string"&&(o=`${o}`);const l=`${o}_${this.drawTextWidth}_${this.drawTextFont}`;return this.ellipsis=this.ctx.paint.drawText(o,this.drawTextX,this.drawTextY,this.drawTextWidth,this.drawTextHeight,{font:this.drawTextFont||t,padding:e,align:this.align,verticalAlign:this.verticalAlign,color:a,autoRowHeight:this.autoRowHeight,lineHeight:s,maxLineClamp:this.maxLineClamp,cacheTextKey:l}),this.ellipsis}drawImage(){if(this.drawSelectionImageSource&&this.ctx.paint.drawImage(this.drawSelectionImageSource,this.drawSelectionImageX,this.drawSelectionImageY,this.drawSelectionImageWidth,this.drawSelectionImageHeight),this.drawTreeImageSource&&this.ctx.paint.drawImage(this.drawTreeImageSource,this.drawTreeImageX,this.drawTreeImageY,this.drawTreeImageWidth,this.drawTreeImageHeight),this.drawHoverImageSource){const{CELL_HOVER_ICON_BG_COLOR:e,CELL_HOVER_ICON_BORDER_COLOR:t}=this.ctx.config;this.ctx.paint.drawRect(this.drawHoverImageX-2,this.drawHoverImageY-2,this.drawHoverImageWidth+4,this.drawHoverImageHeight+4,{borderColor:t,radius:4,borderWidth:1,fillColor:e}),this.ctx.paint.drawImage(this.drawHoverImageSource,this.drawHoverImageX,this.drawHoverImageY,this.drawHoverImageWidth,this.drawHoverImageHeight)}}drawSelector(){if(this.cellType==="footer")return;const{ENABLE_SELECTOR:e}=this.ctx.config;if(!e)return;const{xArr:t,yArr:r,xArrCopy:s,yArrCopy:n}=this.ctx.selector;this.drawBorder({xArr:s,yArr:n,borderColor:this.ctx.config.SELECT_BORDER_COLOR||"rgb(82,146,247)",fillColor:"transparent",borderWidth:1,lineDash:[4,4]}),this.drawBorder({xArr:this.ctx.autofill.xArr,yArr:this.ctx.autofill.yArr,borderColor:this.ctx.config.SELECT_BORDER_COLOR||"rgb(82,146,247)",fillColor:"transparent",borderWidth:1,lineDash:[4,4]}),this.drawBorder({xArr:t,yArr:r,borderColor:this.ctx.config.SELECT_BORDER_COLOR||"rgb(82,146,247)",fillColor:"transparent",borderWidth:1});const[o,a]=t,[l,d]=r;!(o===a&&l===d)&&this.colIndex>=o&&this.colIndex<=a&&this.rowIndex>=l&&this.rowIndex<=d&&this.ctx.paint.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:"transparent",fillColor:this.ctx.config.SELECT_AREA_COLOR||"rgba(82,146,247,0.1)"}),this.operation&&this.rowIndex>=l&&this.rowIndex<=d&&this.ctx.paint.drawRect(this.drawX,this.drawY,this.visibleWidth,this.visibleHeight,{borderColor:"transparent",fillColor:this.ctx.config.SELECT_ROW_COL_BG_COLOR||"transparent"})}drawErrorTip(){if(this.cellType==="footer"||!this.message||this.rowspan===0||this.colspan===0)return;const{ERROR_TIP_ICON_SIZE:e,ERROR_TIP_COLOR:t}=this.ctx.config,{width:r}=this,s=this.drawX,n=this.drawY,o=[s+r-e-.5,n,s+r-.5,n,s+r-.5,n+e];this.ctx.paint.drawLine(o,{borderColor:t,fillColor:t,borderWidth:1,lineCap:"round",lineJoin:"round"})}drawBorder(e){const{drawX:t,drawY:r,rowIndex:s,colIndex:n,height:o,width:a}=this;let l=t,d=r;const{xArr:u,yArr:f,lineDash:g=[],borderWidth:m=1,borderColor:x,fillColor:v}=e,p=u[0],w=u[1],E=f[0],C=f[1];if(n>=p&&n<=w&&s===E){const b=n===w?1:0,_=n===p?1:0;this.ctx.paint.drawLine([l+_,d+1,l+a-b,d+1],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}if(n===w&&s>=E&&s<=C){const b=s===E?1:0,_=s===C?1:0;this.ctx.paint.drawLine([l+a-1,d+b,l+a-1,d+o-_],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}if(n>=p&&n<=w&&s===C){const b=n===w?1:0,_=n===p?1:0;this.ctx.paint.drawLine([l+_,d+o-1,l+a-b,d+o-1],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}if(n===p&&s>=E&&s<=C){const b=s===C?1:0,_=s===E?1:0;this.ctx.paint.drawLine([l+1,d+_,l+1,d+o-b],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}}}class vb{constructor(e,t){h(this,"ctx"),h(this,"data"),h(this,"columns"),h(this,"footerData",[]),h(this,"rowKeyMap",new Map),h(this,"colIndexKeyMap",new Map),h(this,"headerMap",new Map),h(this,"rowIndexRowKeyMap",new Map),h(this,"rowKeyRowIndexMap",new Map),h(this,"checkboxKeyMap",new Map),h(this,"selectionMap",new Map),h(this,"expandMap",new Map),h(this,"originalDataMap",new Map),h(this,"changedDataMap",new Map),h(this,"validationErrorMap",new Map),h(this,"itemRowKeyMap",new WeakMap),h(this,"bufferData",[]),h(this,"customHeader",{fixedData:{},sortData:{},hideData:{},resizableData:{}}),h(this,"overlayerAutoHeightMap",new Map),h(this,"maxRowHeightCellMap",new Map),h(this,"bufferCheckState",{buffer:!1,check:!1,indeterminate:!1,selectable:!0}),h(this,"sumHeight",0),h(this,"filterMethod"),h(this,"positions",[]),h(this,"sortState",new Map),this.ctx=e;const{data:r=[],columns:s=[],footerData:n=[]}=t;this.data=r,this.footerData=n,this.columns=s,this.init()}init(e=!0){this.ctx.paint.clearTextCache(),this.clearBufferData(),this.rowKeyMap.clear(),this.checkboxKeyMap.clear(),this.colIndexKeyMap.clear(),this.rowIndexRowKeyMap.clear(),this.rowKeyRowIndexMap.clear(),this.maxRowHeightCellMap.clear();const t=this.getColumns(),r=Ut(t);if(this.ctx.hasSelection=r.some(s=>s.type==="selection"),this.ctx.hasTree=r.some(s=>s.type==="tree"),e){this.originalDataMap.clear(),this.changedDataMap.clear(),this.validationErrorMap.clear();const{ROW_KEY:s}=this.ctx.config;s?(this.ctx.hasSelection||this.selectionMap.clear(),this.ctx.hasTree||this.expandMap.clear()):(this.selectionMap.clear(),this.expandMap.clear())}this.itemRowKeyMap=new WeakMap,this.initData(this.data),this.getData(),this.bufferCheckState.buffer=!1}clearBufferData(){this.bufferData=[]}initData(e,t=0,r=[]){const s=e.length,{ROW_KEY:n="",DEFAULT_EXPAND_ALL:o,CELL_HEIGHT:a,SELECTABLE_METHOD:l,CHECKBOX_KEY:d,TREE_CHILDREN_KEY:u}=this.ctx.config;e.forEach((f,g)=>{var m;u!=="children"&&(f.children=f[u]);const x=f[n],v=x!=null?`${x}`:il();this.itemRowKeyMap.set(f,v);const p=f._height||a,w=f._readonly;let E=!0;if(typeof l=="function"&&(E=l),d){const b=f[d];if(this.checkboxKeyMap.has(b)){const _=this.checkboxKeyMap.get(b)||[];_.push(v),this.checkboxKeyMap.set(b,_)}else this.checkboxKeyMap.set(b,[v])}this.selectionMap.set(v,{key:d?f[d]:v,row:f,check:((m=this.selectionMap.get(v))==null?void 0:m.check)||!1});const C=o||this.expandMap.get(v)||f._expand||!1;this.expandMap.set(v,C),this.rowKeyMap.set(v,{readonly:w,index:g,rowIndex:g,level:t,height:p,calculatedHeight:-1,check:!1,selectable:E,expand:C,expandLazy:!1,hasChildren:f._hasChildren||(Array.isArray(f.children)?f.children.length>0:!1),expandLoading:!1,item:f,parentRowKeys:r,parentRowKey:r[r.length-1]||"",isLastChild:g===s-1}),Array.isArray(f.children)&&f.children.length&&this.initData(f.children,t+1,[...r,v])})}setRowHeight(e,t){const r=this.rowIndexRowKeyMap.get(e);if(r===void 0)return;const s=this.rowKeyMap.get(r);s.height=t,s.item._height=t,this.clearBufferData()}setBatchRowHeight(e){e.forEach(({rowIndex:t,height:r})=>{const s=this.rowIndexRowKeyMap.get(t);if(s){const n=this.rowKeyMap.get(s);n.height=r,n.item._height=r}}),this.clearBufferData()}setBatchCalculatedRowHeight(e){return e.every(({height:t,rowIndex:r})=>this.getPositionForRowIndex(r).calculatedHeight===t)?!1:(e.forEach(({rowIndex:t,height:r})=>{const s=this.rowIndexRowKeyMap.get(t);if(s){const n=this.rowKeyMap.get(s),{height:o=-1}=this.getMaxRowHeightItem(s)||{};n.calculatedHeight=Math.max(r,o)}}),this.clearBufferData(),this.getData(),!0)}getAllRowsData(){let e=[];const t=r=>{r.forEach(s=>{e.push(s),Array.isArray(s.children)&&t(s.children)})};return t(this.data),e}generateColumns(e){const t=r=>r.map(s=>{var n,o,a,l,d,u,f,g;const m=s.children&&Array.isArray(s.children)?t(s.children):void 0,x={hide:(o=(n=this.customHeader)==null?void 0:n.hideData)==null?void 0:o[s.key],fixed:(l=(a=this.customHeader)==null?void 0:a.fixedData)==null?void 0:l[s.key],sort:(u=(d=this.customHeader)==null?void 0:d.sortData)==null?void 0:u[s.key],width:(g=(f=this.customHeader)==null?void 0:f.resizableData)==null?void 0:g[s.key]},v={};for(const[w,E]of Object.entries(x))E!==void 0&&(v[w]=E);const p=m&&m.every(w=>w.hide);return{...s,children:m,hide:p||(typeof s.hide=="function"?s.hide(s):s.hide),...v}});return t(e)}getColumns(){return this.generateColumns(this.columns)}setColumns(e){this.columns=e,this.clearBufferData()}setData(e){this.data=e,this.init()}getData(){if(this.bufferData.length>0)return{data:this.bufferData,sumHeight:this.sumHeight,positions:this.positions};let e=[],t=0;this.sumHeight=0,this.positions=[];const r=n=>{n.forEach(o=>{e.push(o);const a=this.itemRowKeyMap.get(o),{expand:l,hasChildren:d,height:u,calculatedHeight:f}=this.rowKeyMap.get(a),g=this.sumHeight,m=Math.max(f,u);this.sumHeight+=m,this.rowIndexRowKeyMap.set(t,a),this.rowKeyRowIndexMap.set(a,t),this.positions.push({top:g,height:m,bottom:this.sumHeight,calculatedHeight:f}),t+=1,l&&d&&r(o.children)})};this.rowIndexRowKeyMap.clear(),this.rowKeyRowIndexMap.clear();let s=this.data;if(typeof this.filterMethod=="function"&&(s=this.filterMethod(s)),this.sortState.size){const n=Array.from(this.sortState.entries()).sort((o,a)=>o[1].timestamp-a[1].timestamp);s=this.sortDataRecursive(s,n)}return r(s),this.bufferData=e,{data:e,sumHeight:this.sumHeight,positions:this.positions}}setFooterData(e){this.footerData=e}getFooterData(){return this.footerData}setFilterMethod(e){this.filterMethod=e}clearFilterMethod(){this.filterMethod=void 0}getSortState(e){return this.sortState.get(e)||{direction:"none",timestamp:0}}setSortState(e,t){const r=Date.now();this.ctx.config.SORT_STRICTLY&&this.sortState.clear(),t==="none"?this.sortState.delete(e):this.sortState.set(e,{direction:t,timestamp:r}),this.ctx.emit("sortChange",this.sortState),this.clearBufferData(),this.ctx.emit("draw")}clearSort(){this.sortState.clear(),this.ctx.emit("sortChange",this.sortState),this.clearBufferData(),this.ctx.emit("draw")}sortDataRecursive(e,t){let r=[...e];for(const[s,{direction:n}]of t){if(n==="none")continue;const o=this.getColumnByKey(s);!o||!o.column.sortBy||(r=this.applySingleColumnSort(r,s,n,o.column.sortBy))}return r.map(s=>(s.children&&Array.isArray(s.children)&&(s.children=this.sortDataRecursive(s.children,t)),s))}applySingleColumnSort(e,t,r,s){return e.sort((n,o)=>{const a=n[t],l=o[t];let d=0;if(typeof s=="function")d=s(n,o);else if(s==="number"){const u=Number(a)||0,f=Number(l)||0;d=u-f}else if(s==="string"){const u=String(a||""),f=String(l||"");d=u.localeCompare(f)}else s==="date"&&(d=gb(a,l));return r==="asc"?d:-d})}expandItem(e,t=!1){const r=this.rowKeyMap.get(e);r.expand=t,this.expandMap.set(e,t),this.clearBufferData(),this.ctx.emit("draw")}setExpandRowKeys(e,t=!0){this.expandMap.clear(),e.forEach(r=>{const s=this.rowKeyMap.get(r);this.expandMap.set(r,t),s.expand=t}),this.clearBufferData(),this.ctx.emit("draw")}getExpandRowKeys(){let e=[];return this.rowKeyMap.forEach((t,r)=>{t.expand&&e.push(r)}),e}expandAll(e){this.expandMap.clear(),this.rowKeyMap.forEach(t=>{t.expand=e,this.expandMap.set(t.key,e)}),this.clearBufferData(),this.ctx.emit("draw")}expandLoading(e,t=!1){const r=this.rowKeyMap.get(e);r.expandLoading=t,this.clearBufferData(),this.ctx.emit("draw")}setExpandChildren(e,t){const r=this.rowKeyMap.get(e);r.expand=!0,this.expandMap.set(e,!0),r.expandLazy=!0,r.item.children=t,this.initData(r.item.children,r.level+1),this.clearBufferData()}getIsExpandLoading(e){return this.rowKeyMap.get(e).expandLoading}getIsExpandLazy(e){return this.rowKeyMap.get(e).expandLazy}getIsExpand(e){return this.rowKeyMap.get(e).expand}getRowForRowKey(e){return this.rowKeyMap.get(e)}getRowForRowIndex(e){const t=this.getRowKeyForRowIndex(e);return this.rowKeyMap.get(t)}getRowKeyForRowIndex(e){return this.rowIndexRowKeyMap.get(e)||""}getRowKeyByItem(e){return this.itemRowKeyMap.get(e)}getRowIndexForRowKey(e){return this.rowKeyRowIndexMap.get(e)}getItemValueForRowIndexAndColIndex(e,t){if(!(this.rowIndexRowKeyMap.has(e)&&this.colIndexKeyMap.get(t)))return null;const r=this.rowIndexRowKeyMap.get(e),s=this.colIndexKeyMap.get(t);return r===void 0||s===void 0?null:{rowKey:r,key:s,value:this.getItemValue(r,s)}}getItemValue(e,t){const r=this.rowKeyMap.get(e);return r&&r.item?r.item[t]===void 0?null:r.item[t]:null}async batchSetItemValue(e,t=!1,r=!0,s="none"){let n=[],o=r;const a=new Set;let l=[],d=e.map(x=>{const{rowKey:v,key:p}=x;let w=x.value,E=w;const C=this.getRowDataItemForRowKey(v),b=this.getItemValue(v,p),_=this.getVirtualBodyCellByKey(v,p);return(_==null?void 0:_.type)==="number"&&(["",void 0,null].includes(w)?E=null:/^-?\d+(\.\d+)?$/.test(`${w}`)?E=Number(w):(E=b,l.push({...x,value:E,oldValue:b,row:C}))),{...x,value:E,oldValue:b,row:C}});if(d=d.filter(x=>!l.some(v=>x.rowKey===v.rowKey&&x.key===v.key)),l.length){const x={code:"ERR_BATCH_SET_NUMBER_VALUE",message:"Assignment failed, not a numeric type",data:l};this.ctx.emit("error",x)}if(d=d.filter(x=>x.oldValue!==x.value),!d.length)return;const{BEFORE_VALUE_CHANGE_METHOD:u}=this.ctx.config;s==="none"&&typeof u=="function"&&(d=await u(d),o=!1),d.forEach(x=>{const{value:v,rowKey:p,key:w}=x,E=this.getItemValue(p,w);a.add(p),this.setItemValue(p,w,v,!1,!1,!1,o),n.push({rowKey:p,key:w,oldValue:E,newValue:v})});let f=[];a.forEach(x=>{f.push(this.ctx.database.getRowDataItemForRowKey(x))});const g=d.map(({rowKey:x,key:v})=>this.getValidator(x,v));Promise.all(g).then(()=>{this.validationErrorMap.size===0&&this.changedDataMap.size>0&&this.ctx.emit("validateChangedData",this.getChangedData())});const m=d.map(x=>{const v=!!this.getValidationError(x.rowKey,x.key).length;return{...x,errorTip:v}});this.ctx.emit("change",m,f),t&&this.ctx.history.pushState({changeList:n,scrollX:this.ctx.scrollX,scrollY:this.ctx.scrollY,type:"multiple"}),this.ctx.emit("draw")}async setItemValue(e,t,r,s=!1,n=!1,o=!1,a=!0){if(!this.rowKeyMap.has(e))return{};const{item:l}=this.rowKeyMap.get(e);let d=l[t],u=r;if(a&&this.ctx.database.getReadonly(e,t))return{oldValue:d,newValue:d};l[t]!==null&&typeof l[t]=="object"&&(d=JSON.parse(JSON.stringify(l[t])));const f=`${e}​_${t}`;this.originalDataMap.has(f)||this.originalDataMap.set(f,d);const g=this.originalDataMap.get(f),m=this.getRowDataItemForRowKey(e);if(o){const x=this.getVirtualBodyCellByKey(e,t);if((x==null?void 0:x.type)==="number")if(["",void 0,null].includes(r))u=null;else if(/^-?\d+(\.\d+)?$/.test(`${r}`))u=Number(r);else{u=d;const p={code:"ERR_SET_NUMBER_VALUE",message:"Assignment failed, not a numeric type",data:[{rowKey:e,key:t,value:u,oldValue:d,row:m}]};this.ctx.emit("error",p)}if(u===d)return{oldValue:d,newValue:d};let v=[{rowKey:e,key:t,value:u,oldValue:d,row:m}];this.batchSetItemValue(v,s,!1),this.ctx.emit("editChange",{rowKey:e,key:t,oldValue:d,value:u,originalValue:g,row:m})}else this.changedDataMap.set(f,u),l[t]=u;return this.ctx.hasEvent("iterationChange")&&this.ctx.emit("iterationChange",{rowKey:e,key:t,oldValue:d,value:u,originalValue:this.originalDataMap.get(f),row:m}),n&&this.ctx.emit("draw"),{oldValue:d,newValue:u}}getRowDataItemForRowKey(e){if(!this.rowKeyMap.has(e))return{};const{item:t}=this.rowKeyMap.get(e);return t}setRowSelectionByCheckboxKey(e,t){const{CHECKBOX_KEY:r}=this.ctx.config;if(r){if(!this.rowKeyMap.has(e))return!1;const{item:s}=this.rowKeyMap.get(e),n=s[r];this.checkboxKeyMap.has(n)&&(this.checkboxKeyMap.get(n)||[]).forEach(o=>{const a=this.selectionMap.get(o);a&&(a.check=t)})}}toggleRowSelection(e,t){const r=this.rowKeyMap.get(e),s=this.selectionMap.get(e);if(!s)return;t==="selection-tree"||t==="tree-selection"?this.toggleTreeSelection(e):(s.check=!s.check,this.setRowSelectionByCheckboxKey(e,s.check)),this.ctx.emit("toggleRowSelection",r);const n=this.getSelectionRows();this.ctx.emit("selectionChange",n),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}toggleTreeSelection(e){const t=this.getTreeSelectionState(e),r=this.ctx.config.TREE_SELECT_MODE;if(r==="auto")t.checked&&!t.indeterminate?(this.clearTreeSelectionRecursive(e),this.setRowSelection(e,!1,!1)):(this.selectTreeSelectionRecursive(e),this.setRowSelection(e,!0,!1));else if(r==="cautious")t.checked&&!t.indeterminate?(this.clearTreeSelectionRecursive(e),this.setRowSelection(e,!1,!1)):(this.selectTreeSelectionRecursive(e),this.setRowSelection(e,!0,!1));else if(r==="strictly"){const s=this.selectionMap.get(e);s&&(s.check=!s.check,this.setRowSelectionByCheckboxKey(e,s.check))}this.ctx.emit("selectionChange",this.getSelectionRows()),this.ctx.emit("draw")}selectTreeSelectionRecursive(e){this.getTreeChildren(e).forEach(t=>{this.setRowSelectionByParent(t,!0),this.selectTreeSelectionRecursive(t)})}clearTreeSelectionRecursive(e){this.getTreeChildren(e).forEach(t=>{this.setRowSelectionByParent(t,!1),this.clearTreeSelectionRecursive(t)})}updateParentTreeSelection(e){const t=this.getTreeParent(e);if(!t)return;const r=this.getTreeChildren(t).map(l=>this.selectionMap.get(l)),s=r.filter(l=>l==null?void 0:l.check).length,n=r.length;let o=!1;n>0&&(s===0?o=!1:s===n||this.ctx.config.TREE_SELECT_MODE==="auto"?o=!0:this.ctx.config.TREE_SELECT_MODE==="cautious"&&(o=!1));const a=this.selectionMap.get(t);a&&a.check!==o&&(a.check=o,this.setRowSelectionByCheckboxKey(t,o),this.updateParentTreeSelection(t))}setRowSelection(e,t,r=!0){const s=this.selectionMap.get(e);s&&(s.check=t,this.setRowSelectionByCheckboxKey(e,s.check),this.ctx.emit("setRowSelection",t,s.row),(this.ctx.config.TREE_SELECT_MODE==="auto"||this.ctx.config.TREE_SELECT_MODE==="cautious")&&this.updateParentTreeSelection(e),r&&(this.bufferCheckState.buffer=!1,this.ctx.emit("draw")))}setRowSelectionByParent(e,t){const r=this.selectionMap.get(e);r&&(r.check=t,this.setRowSelectionByCheckboxKey(e,r.check))}getSelectionRows(){let e=[];return this.selectionMap.forEach(t=>{t.check&&e.push(t.row)}),e}getRowSelection(e){const t=this.selectionMap.get(e);return t?t.check:!1}getTreeSelectionState(e){if(!this.getRowForRowKey(e))return{checked:!1,indeterminate:!1};const t=this.selectionMap.get(e),r=(t==null?void 0:t.check)||!1;if(this.getTreeChildren(e).length===0)return{checked:r,indeterminate:!1};let s=!1,n=r;if(this.ctx.config.TREE_SELECT_MODE==="auto"){const o=f=>{const g=this.getTreeChildren(f);let m=[];for(const x of g)m.push(x),m.push(...o(x));return m},a=o(e).map(f=>this.selectionMap.get(f)),l=a.filter(f=>f==null?void 0:f.check).length,d=a.length,u=l>0;s=u&&l!==d,n=r||u,r&&d>0&&l===0&&(n=!1,s=!1)}else if(this.ctx.config.TREE_SELECT_MODE==="cautious"){const o=g=>{const m=this.getTreeChildren(g);let x=[];for(const v of m)x.push(v),x.push(...o(v));return x},a=o(e).map(g=>this.selectionMap.get(g)),l=a.filter(g=>g==null?void 0:g.check).length,d=a.length,u=l>0,f=l===d;s=u&&!f,n=r||f,r&&d>0&&l===0&&(n=!1,s=!1)}else this.ctx.config.TREE_SELECT_MODE==="strictly"&&(s=!1,n=r);return{checked:n,indeterminate:s}}getTreeChildren(e){const t=this.getRowForRowKey(e);if(!t||!t.item||!t.item.children)return[];const r=[],s=n=>{for(const o of n){const a=this.getRowKeyByItem(o);a&&r.push(a),o.children&&o.children.length>0&&s(o.children)}};return s(t.item.children),r}getTreeParent(e){const t=(r,s)=>{for(const n of r){const o=this.getRowKeyByItem(n);if(n.children)for(const a of n.children){if(this.getRowKeyByItem(a)===s)return o;const l=t(n.children,s);if(l)return l}}return null};return t(this.data,e)}getRowSelectable(e){const{selectable:t,item:r,rowIndex:s}=this.rowKeyMap.get(e);return typeof t=="function"?t({row:r,rowIndex:s}):t}toggleAllSelection(){this.ctx.config.TREE_SELECT_MODE==="auto"||this.ctx.config.TREE_SELECT_MODE==="cautious"?this.rowKeyMap.forEach((t,r)=>{let s=t.selectable;if(typeof s=="function"&&(s=s({row:t.item,rowIndex:t.rowIndex})),s){const n=this.selectionMap.get(r);n&&(n.check=!0,this.setRowSelectionByCheckboxKey(r,!0))}}):this.rowKeyMap.forEach((t,r)=>{let s=t.selectable;typeof s=="function"&&(s=s({row:t.item,rowIndex:t.rowIndex})),s&&this.setRowSelection(r,!0,!1)});const e=this.getSelectionRows();this.ctx.emit("toggleAllSelection",e),this.ctx.emit("selectionChange",e),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}clearSelection(e=!1){const t=this.ctx.config.TREE_SELECT_MODE==="auto"||this.ctx.config.TREE_SELECT_MODE==="cautious";e?t?this.rowKeyMap.forEach((s,n)=>{const o=this.selectionMap.get(n);o&&(o.check=!1,this.setRowSelectionByCheckboxKey(n,!1))}):this.rowKeyMap.forEach((s,n)=>{this.setRowSelection(n,!1,!1)}):(this.selectionMap.clear(),this.rowKeyMap.forEach((s,n)=>{this.selectionMap.set(n,{check:!1,row:s.item,key:n})}));const r=this.getSelectionRows();this.ctx.emit("clearSelection"),this.ctx.emit("selectionChange",r),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}getCheckedState(){const{buffer:e,...t}=this.bufferCheckState;if(e)return t;const r=this.rowKeyMap.size;let s=0,n=0;const o=this.selectionMap.size,a=Array.from(this.selectionMap.values()).some(g=>g.check);this.rowKeyMap.forEach((g,m)=>{var x;(x=this.selectionMap.get(m))!=null&&x.check&&(s+=1);let v=g.selectable;typeof v=="function"&&(v=v({row:g.item,rowIndex:g.rowIndex})),v&&(n+=1)});const l=o>r&&s===0&&a,d=n&&n>s&&s>0||l,u=n!==0,f=!!n&&n===s;return this.bufferCheckState={buffer:!0,check:f,indeterminate:d,selectable:u},{check:f,indeterminate:d,selectable:u}}updateColIndexKeyMap(e=[]){this.colIndexKeyMap.clear(),e.forEach(t=>{this.colIndexKeyMap.set(t.colIndex,t.key)})}getColumnByColIndex(e){var t;const r=this.colIndexKeyMap.get(e);if(r&&this.headerMap.has(r))return(t=this.headerMap.get(r))==null?void 0:t.column}getColumnByKey(e){const t=this.headerMap.get(e);if(t)return t}getColIndexForKey(e){var t;if(e&&this.headerMap.has(e))return(t=this.headerMap.get(e))==null?void 0:t.colIndex}getColHeaderByIndex(e){const t=this.colIndexKeyMap.get(e);if(t&&this.headerMap.has(t))return this.headerMap.get(t)}getChangedData(){let e=[];return this.changedDataMap.forEach((t,r)=>{const s=this.originalDataMap.get(r),n=r.split("​_")[0],o=r.split("​_")[1];s!==t&&e.push({rowKey:n,colKey:o,originalValue:s,row:this.ctx.database.getRowDataItemForRowKey(n),value:t})}),e}getChangedRows(){const e=new Set;this.changedDataMap.forEach((r,s)=>{const n=this.originalDataMap.get(s),o=s.split("​_")[0];n!==r&&e.add(o)});let t=[];return e.forEach(r=>{t.push(this.ctx.database.getRowDataItemForRowKey(r))}),t}isHasChangedData(e,t){const r=`${e}​_${t}`;if(!this.changedDataMap.has(r))return!1;const s=this.originalDataMap.get(r),n=this.changedDataMap.get(r);return s!==n}getPositionForRowIndex(e){return e<this.positions.length?this.positions[e]:{height:0,top:0,bottom:0,calculatedHeight:0}}setHeader(e,t){return e?(this.headerMap.set(e,t),!0):!1}getReadonly(e,t){const{DISABLED:r}=this.ctx.config;if(r)return!0;const s=this.rowKeyMap.get(e),n=this.headerMap.get(t);if(!s||!n)return!0;const o=s.readonly,a=n.readonly,{BODY_CELL_READONLY_METHOD:l}=this.ctx.config;if(typeof l=="function"&&n){const d=l({row:s.item,rowIndex:s.rowIndex,colIndex:n.colIndex,column:n.column,value:this.getItemValue(e,t)});if(d!==void 0)return d}return a||o}clearValidate(){this.validationErrorMap.clear()}hasValidationError(){return this.validationErrorMap.size!==0}getValidator(e,t){return this.ctx.database.getReadonly(e,t)?new Promise(r=>{r([])}):new Promise(r=>{const s=this.rowKeyMap.get(e),n=this.headerMap.get(t),{BODY_CELL_RULES_METHOD:o}=this.ctx.config;if(s===void 0||n===void 0)return r([]);const a=n.column;let l=a.rules;if(typeof o=="function"){const d=o({row:s.item,rowIndex:s.rowIndex,colIndex:n.colIndex,column:a,value:this.getItemValue(e,t)});d&&(l=d)}if(l){const d={row:s.item,rowIndex:s.rowIndex,colIndex:n.colIndex,column:a,key:t,rowKey:e,value:this.getItemValue(e,t),field:t,fieldValue:this.getItemValue(e,t)},u=new ob(l).validate(d);this.setValidationError(e,t,u),r(u)}else this.clearValidationError(e,t),r([])})}getHeightByRowIndexRowSpan(e,t){let r=0;for(let s=0;s<t;s++){const n=this.positions[e+s];n&&(r+=n.height)}return r}getSpanInfo(e){const{rowIndex:t,key:r,rowKey:s,row:n,value:o,colIndex:a,relationRowKeys:l,relationColKeys:d,rowspan:u,height:f,width:g,colspan:m,mergeRow:x,mergeCol:v}=e;if(u===1&&m===1)return{xArr:[a,a],yArr:[t,t],rowspan:u,colspan:m,height:f,width:g,offsetTop:0,offsetLeft:0,dataList:[{rowKey:s,key:r,row:n,value:o}]};let p=t,w=t,E=a,C=a,b=[],_=0,B=0,K=0,S=0;if(u!==1&&x){S=g;const I=l.reduce((R,O)=>{const y=this.getItemValue(s,O)??"";return`${R}${y}`},"");for(let R=t-1;R>=0;R--){const O=this.rowIndexRowKeyMap.get(R)||"",y=l.reduce((A,L)=>{const P=this.getItemValue(O,L)??"";return`${A}${P}`},"");if(I===y)p=R;else break}for(let R=t;R<=this.ctx.maxRowIndex;R++){const O=this.rowIndexRowKeyMap.get(R)||"",y=l.reduce((A,L)=>{const P=this.getItemValue(O,L)??"";return`${A}${P}`},"");if(I===y)w=R;else break}for(let R=p;R<t;R++){const{height:O}=this.positions[R];_+=O}for(let R=p;R<=w;R++){const{height:O}=this.positions[R];K+=O;const y=this.rowIndexRowKeyMap.get(R)||"",{item:A}=this.rowKeyMap.get(y),L=this.getItemValue(y,r);b.push({rowKey:y,key:r,value:L,row:A})}}if(m!==1&&v){K=f;for(let I=a-1;I>=0;I--){const R=this.getColumnByColIndex(I);if(!R)break;const O=this.getItemValue(s,r),y=this.getItemValue(s,R.key);if(O===y&&d.includes(R.key))E=I;else break}for(let I=a;I<=this.ctx.maxColIndex;I++){const R=this.getColumnByColIndex(I);if(!R)break;const O=this.getItemValue(s,r),y=this.getItemValue(s,R.key);if(O===y&&d.includes(R.key))C=I;else break}for(let I=E;I<a;I++){const R=this.getColumnByColIndex(I);if(!R)break;B+=R.width||100}for(let I=E;I<=C;I++){const R=this.getColumnByColIndex(I);if(!R)break;S+=R.width||100,b.push({rowKey:s,key:R.key,value:this.getItemValue(s,R.key),row:n})}}return{xArr:[E,C],yArr:[p,w],rowspan:u,colspan:m,height:K,width:S,offsetTop:_,offsetLeft:B,dataList:b}}setValidationErrorByRowKey(e,t,r){const s=`${e}​_${t}`,n=this.getRowForRowKey(e),o=n==null?void 0:n.rowIndex,a=this.getColumnByKey(t);if(!e||!a||!n)return;const l=this.getItemValue(e,t),d=[{key:t,rowKey:e,rowIndex:o,colIndex:a.colIndex,column:a.column,row:n,value:l,message:r,field:t,fieldValue:l}];this.validationErrorMap.set(s,d)}setValidationError(e,t,r){const s=`${e}​_${t}`;this.validationErrorMap.set(s,r)}clearValidationError(e,t){const r=`${e}​_${t}`;this.validationErrorMap.has(r)&&this.validationErrorMap.delete(r)}getValidationError(e,t){const r=`${e}​_${t}`;return this.validationErrorMap.get(r)||[]}getVirtualBodyCell(e,t,r=!0){const s=this.getColumnByColIndex(t),n=this.getRowForRowIndex(e);return!s||!n?void 0:new Pr(this.ctx,e,t,0,0,0,0,s,n.item,"body",r)}getVirtualBodyCellByKey(e,t){const r=this.getRowIndexForRowKey(e),s=this.getColIndexForKey(t);if(!(r===void 0||s===void 0))return this.getVirtualBodyCell(r,s)}hasMergeCell(e,t){let r=!1;for(let s=t[0];s<=t[1];s++)for(let n=e[0];n<=e[1];n++){const o=this.getVirtualBodyCell(s,n);if(o&&(o.rowspan!==1||o.colspan!==1)){r=!0;break}}return r}calculateMaxTreeDepth(e,t=0){let r=t;return e.forEach(s=>{if(Array.isArray(s.children)&&s.children.length>0){const n=this.calculateMaxTreeDepth(s.children,t+1);r=Math.max(r,n)}}),r}setOverlayerAutoHeightMap(e){this.overlayerAutoHeightMap=e}getOverlayerAutoHeightMap(){return this.overlayerAutoHeightMap}getOverlayerAutoHeight(e,t){const r=`${e}​_${t}`;return this.overlayerAutoHeightMap.get(r)||0}setCustomHeader(e,t=!1){if(["fixedData","sortData","hideData","resizableData"].forEach(r=>{const s=e[r];s!==void 0&&(this.customHeader[r]=s)}),!t){const r=this.clearCustomHeaderInvalidValues(this.columns);this.ctx.emit("customHeaderChange",r)}}resetCustomHeader(){this.customHeader={},this.ctx.emit("resetHeader"),this.ctx.emit("customHeaderChange",this.customHeader)}getCustomHeader(){return this.customHeader}setCustomHeaderResizableData(e,t){let{resizableData:r={}}=this.customHeader;r[e]=t,this.setCustomHeader({resizableData:r})}setCustomHeaderHideData(e,t){let{hideData:r={}}=this.customHeader;e.forEach(s=>{r[s]=t}),this.setCustomHeader({hideData:r}),this.ctx.emit("resetHeader")}setCustomHeaderFixedData(e,t){let{fixedData:r={}}=this.customHeader;e.forEach(s=>{r[s]=t}),this.setCustomHeader({fixedData:r}),this.ctx.emit("resetHeader")}clearCustomHeaderInvalidValues(e){const t=(s,n={})=>{s.forEach(o=>{o.children&&o.children.length>0&&t(o.children,n);const a=(l,d)=>{var u,f;const g=(u=this.customHeader[l])==null?void 0:u[o.key];g!==void 0&&g!==d&&(n[l]||(n[l]={}),n[l][o.key]=g,l==="fixedData"&&!g&&!d&&((f=n[l])==null||delete f[o.key]))};a("fixedData",o.fixed),a("sortData",o.sort),a("hideData",o.hide),a("resizableData",o.width)})};let r={};return t(e,r),r}setMaxRowHeightItem(e,t,r){this.maxRowHeightCellMap.set(e,{key:t,height:r})}getMaxRowHeightItem(e){return this.maxRowHeightCellMap.get(e)}clearChangeData(){this.changedDataMap.clear()}}class mb{constructor(e){h(this,"ctx"),h(this,"history",[]),h(this,"historyIndex",-1),this.ctx=e,this.init()}init(){this.ctx.on("keydown",e=>{if(!this.ctx.editing){if(e.ctrlKey&&!e.shiftKey&&e.code==="KeyZ"||e.metaKey&&!e.shiftKey&&e.code==="KeyZ"){e.preventDefault(),this.ctx.clearSelector(),this.ctx.clearAutofill(),this.backState();return}if(e.ctrlKey&&e.code==="KeyY"||e.ctrlKey&&e.shiftKey&&e.code==="KeyZ"||e.metaKey&&e.shiftKey&&e.code==="KeyZ"){e.preventDefault(),this.ctx.clearSelector(),this.ctx.clearAutofill(),this.forwardState();return}}})}pushState(e){const{HISTORY_NUM:t=0,ENABLE_HISTORY:r}=this.ctx.config;r&&(this.history.push(e),this.history.length>t&&this.history.splice(0,1),this.historyIndex=this.history.length-1)}backState(){if(this.historyIndex>=0){const{changeList:e,scrollX:t,scrollY:r}=this.history[this.historyIndex],s=e.map(n=>({rowKey:n.rowKey,key:n.key,value:n.oldValue,row:{}}));this.ctx.setScroll(t,r),this.ctx.database.batchSetItemValue(s,!1,!1,"back"),this.historyIndex-=1}}forwardState(){if(this.historyIndex<this.history.length-1){this.historyIndex+=1;const{changeList:e}=this.history[this.historyIndex],t=e.map(r=>({rowKey:r.rowKey,key:r.key,value:r.newValue,row:{}}));this.ctx.database.batchSetItemValue(t,!1,!1,"forward")}}clear(){this.history=[],this.historyIndex=-1}}class xb{constructor(e){h(this,"eventTasks",new Set),h(this,"ctx"),this.ctx=e,this.init()}init(){this.bind(window,"resize",this.handleResize.bind(this)),this.bind(window,"mouseup",this.handleMouseUp.bind(this)),this.bind(window,"mousemove",this.handleMousemove.bind(this)),this.bind(window,"blur",this.handleOutsideMousedown.bind(this)),this.bind(window,"mousedown",this.handleOutsideMousedown.bind(this)),this.bind(this.ctx.stageElement,"click",this.handleClick.bind(this)),this.bind(window,"keydown",this.handleKeydown.bind(this)),this.bind(this.ctx.stageElement,"wheel",this.handleWheel.bind(this),{passive:!1}),this.bind(this.ctx.stageElement,"touchstart",this.handleTouchstart.bind(this),{passive:!1}),this.bind(this.ctx.stageElement,"touchend",this.handleTouchend.bind(this)),this.bind(this.ctx.stageElement,"touchmove",this.handleTouchmove.bind(this),{passive:!1}),this.bind(this.ctx.stageElement,"contextmenu",this.handleContextMenu.bind(this)),this.bind(this.ctx.stageElement,"mousedown",this.handleMouseDown.bind(this)),this.bind(this.ctx.stageElement,"dblclick",this.handleDblclick.bind(this)),this.bind(this.ctx.stageElement,"mouseover",this.handleMouseover.bind(this)),this.bind(this.ctx.stageElement,"mouseout",this.handleMouseout.bind(this)),this.bind(document,"selectionchange",this.selectionchange.bind(this))}selectionchange(){this.ctx.domSelectionStr="";const e=window.getSelection();e&&e.toString()&&(this.ctx.domSelectionStr=e.toString())}clearDomSelection(){const e=window.getSelection();e&&!e.isCollapsed&&e.removeAllRanges()}destroy(){Array.from(this.eventTasks).forEach(({target:e,name:t,fn:r,options:s})=>{this.unbind(e,t,r,s)}),this.eventTasks.clear()}handleResize(e){this.ctx.emit("resetHeader",e),this.ctx.emit("resize",e)}handleMouseDown(e){this.clearDomSelection(),e.button===0&&(this.ctx.mousedown=!0),this.ctx.emit("mousedown",e)}handleMousemove(e){const t=e,r=this.ctx.containerElement.getBoundingClientRect(),s=t.clientX-r.left,n=t.clientY-r.top;this.ctx.mouseX=s,this.ctx.mouseY=n,this.ctx.emit("mousemove",e)}handleMouseUp(e){e.button===0&&(this.ctx.mousedown=!1),this.ctx.emit("mouseup",e)}handleClick(e){this.ctx.emit("click",e)}handleKeydown(e){const{ENABLE_KEYBOARD:t}=this.ctx.config;t&&this.ctx.isTarget(e)&&(this.ctx.dragHeaderIng||this.ctx.emit("keydown",e))}handleWheel(e){this.ctx.emit("wheel",e)}handleTouchstart(e){this.ctx.emit("touchstart",e)}handleTouchend(e){this.ctx.emit("touchend",e)}handleTouchmove(e){this.ctx.emit("touchmove",e)}handleContextMenu(e){e.preventDefault(),this.ctx.emit("contextMenu",e)}handleMouseover(e){this.ctx.isMouseoverTargetContainer=!0,this.ctx.emit("mouseover",e)}handleMouseout(e){this.ctx.isMouseoverTargetContainer=!1,this.ctx.emit("mouseout",e)}handleDblclick(e){this.ctx.emit("dblclick",e)}handleOutsideMousedown(e){this.ctx.selector.enable&&(e.target instanceof Window||e.target instanceof Node&&!this.ctx.containerElement.contains(e.target))&&this.ctx.emit("outsideMousedown",e)}bind(e,t,r,s){e.addEventListener(t,r,s),this.eventTasks.add({target:e,name:t,fn:r,options:s})}unbind(e,t,r,s){e.removeEventListener(t,r,s);for(const n of this.eventTasks)if(n.target===e&&n.name===t&&n.fn===r){this.eventTasks.delete(n);break}}}class pb{constructor(){h(this,"events",new Map)}has(e){return this.events.has(e)}on(e,t){const r=this.events.get(e)||[];r.push(t),this.events.set(e,r)}once(e,t){const r=(...s)=>{t(...s),this.off(e,r)};return this.on(e,r),this}off(e,t){const r=this.events.get(e);if(r){const s=r.indexOf(t);s>=0&&(r.splice(s,1),r.length===0?this.events.delete(e):this.events.set(e,r))}}emit(e,...t){const r=this.events.get(e);r&&r.forEach(s=>{s(...t)})}destroy(){this.events.clear()}}class yb{constructor(e){h(this,"ctx"),h(this,"textCacheMap",new Map);const t=e.getContext("2d");if(!t)throw new Error("canvas context not found");this.ctx=t}clearTextCache(){this.textCacheMap.clear()}scale(e){this.ctx.setTransform(1,0,0,1,0,0),this.ctx.scale(e,e)}save(){this.ctx.save()}restore(){this.ctx.restore()}translate(e,t){this.ctx.translate(e,t)}setCursor(e="default"){this.ctx.canvas.style.cursor=e}clear(e=0,t=0,r,s){this.ctx.clearRect(e,t,r||this.ctx.canvas.width,s||this.ctx.canvas.height)}drawShadow(e,t,r,s,n){const{fillColor:o,side:a,shadowWidth:l,colorStart:d,colorEnd:u}=n;this.ctx.save(),o&&(this.ctx.fillStyle=o,this.ctx.fillRect(e,t,r,s));let f;switch(a){case"left":f=this.ctx.createLinearGradient(e-l,t,e,t),f.addColorStop(0,d),f.addColorStop(1,u),this.ctx.fillStyle=f,this.ctx.fillRect(e-l,t,l,s);break;case"right":f=this.ctx.createLinearGradient(e+r,t,e+r+l,t),f.addColorStop(0,d),f.addColorStop(1,u),this.ctx.fillStyle=f,this.ctx.fillRect(e+r,t,l,s);break;case"top":f=this.ctx.createLinearGradient(e,t-l,e,t),f.addColorStop(0,d),f.addColorStop(1,u),this.ctx.fillStyle=f,this.ctx.fillRect(e,t-l,r,l);break;case"bottom":f=this.ctx.createLinearGradient(e,t+s,e,t+s+l),f.addColorStop(0,d),f.addColorStop(1,u),this.ctx.fillStyle=f,this.ctx.fillRect(e,t+s,r,l);break;default:console.error("Invalid side specified for shadow");break}this.ctx.restore()}drawLine(e,t){if(e.length<4||e.length%2!==0)throw new Error("A valid array of points is required to draw a line");this.ctx.save();const{borderColor:r="black",borderWidth:s=1}=t;this.ctx.beginPath(),this.ctx.moveTo(e[0]-.5,e[1]-.5);for(let n=2;n<e.length;n+=2)this.ctx.lineTo(e[n]-.5,e[n+1]-.5);this.ctx.strokeStyle=r,this.ctx.lineWidth=s,t.lineDash&&(this.ctx.lineDashOffset=t.lineDashOffset??0,this.ctx.setLineDash(t.lineDash)),t.fillColor&&(this.ctx.fillStyle=t.fillColor,this.ctx.fill()),t.borderColor&&(this.ctx.strokeStyle=t.borderColor),this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()}drawImage(e,t,r,s,n){this.ctx.save(),this.ctx.drawImage(e,t,r,s,n),this.ctx.restore()}drawRect(e,t,r,s,{borderWidth:n=1,borderColor:o,fillColor:a,radius:l=0}={}){if(this.ctx.save(),this.ctx.beginPath(),a!==void 0&&(this.ctx.fillStyle=a),o!==void 0&&(this.ctx.lineWidth=n,this.ctx.strokeStyle=o),l===0)this.ctx.rect(e-.5,t-.5,r,s);else{const[d,u,f,g]=typeof l=="number"?[l,l,l,l]:l;this.ctx.moveTo(e+d,t),this.ctx.arcTo(e+r,t,e+r,t+u,u),this.ctx.arcTo(e+r,t+s,e+r-f,t+s,f),this.ctx.arcTo(e,t+s,e,t+s-g,g),this.ctx.arcTo(e,t,e+d,t,d)}a!==void 0&&this.ctx.fill(),o!==void 0&&this.ctx.stroke(),this.ctx.restore()}drawText(e="",t,r,s,n,o={}){var a;this.ctx.save();const{font:l="12px Arial",align:d="center",color:u="#495060",padding:f=0,verticalAlign:g="middle",maxLineClamp:m=1,autoRowHeight:x=!1,offsetLeft:v=0,offsetRight:p=0}=o;if(this.ctx.font=l,this.ctx.fillStyle=u,this.ctx.textAlign=d,["",null,void 0].includes(e))return this.ctx.restore(),!1;const w=parseInt(((a=l.match(/\d+/))==null?void 0:a[0])||"12")*(o.lineHeight||1.2),E=s-f*2-v-p;let C=!1;const b=Math.round((n-2*f)/w);let _=this.wrapText(e,E,o.cacheTextKey),B=Math.min(_.length,Math.max(b,1));m==="auto"&&x?B=_.length:typeof m=="number"&&m<B&&m!==1?B=m:(m===1&&(_=[e],B=1),m==="auto"&&b===1&&(_=[e],B=1));let K=r+f;const S=Math.round(B*w);g==="middle"?K=r+(n-S)/2:g==="bottom"&&(K=r+n-S-f);let I=t+f+v;d==="center"?I=t+s/2:d==="right"&&(I=t+s-f-p);for(let R=0;R<_.length;R++){const O=_[R],y=K+R*w;if(this.ctx.textBaseline="top",R===B-1){const A=_.slice(R).join(""),{_text:L,ellipsis:P}=this.handleEllipsis(A,s,f,l);this.ctx.fillText(L,I,y),C=P;break}this.ctx.fillText(O,I,y)}if(o.textCallback&&_.length){const R=_.reduce((P,Y)=>Math.max(P,this.ctx.measureText(Y).width),0),O=Math.round(R);let y=I,A=I+O;d==="center"?(y=I-O/2,A=I+O/2):d==="right"&&(y=I-O,A=I);const L={x:I,y:K,width:O,height:S,left:y,right:A,top:K,bottom:K+S};o.textCallback(L)}return this.ctx.restore(),C}wrapText(e,t,r=""){if(!e)return[""];if(r&&this.textCacheMap.has(r))return this.textCacheMap.get(r)||[""];const s=[],n=e.split(`
4
+ `);for(const a of n){if(a===""){s.push("");continue}const l=a.split("");let d="";for(const u of l){const f=d+u;this.ctx.measureText(f).width<=t?d=f:d?(s.push(d),d=u):(s.push(u),d="")}d&&s.push(d)}const o=s.length>0?s:[""];return r&&this.textCacheMap.set(r,o),o}calculateTextHeight(e="",t,r={}){var s;const{font:n="12px Arial",padding:o=0,align:a="center",color:l="#495060",maxLineClamp:d=1,cacheTextKey:u=""}=r;this.ctx.save(),this.ctx.font=n,this.ctx.fillStyle=l,this.ctx.textAlign=a;const f=parseInt(((s=n.match(/\d+/))==null?void 0:s[0])||"12"),g=f*(r.lineHeight||1.2),m=t-o*2,x=this.wrapText(e,m,u);let v=1;return d==="auto"?v=x.length:x.length>d?v=d:v=x.length,this.ctx.restore(),Math.max(Math.floor(v*g+o*2),Math.floor(f+o*2))}handleEllipsis(e,t,r=0,s="12px Arial"){this.ctx.save();let n=!1,o=e;if(this.ctx.font=s,e==null||e==="")return this.ctx.restore(),{_text:"",ellipsis:n};const a=this.ctx.measureText("...").width;if(t<=a+r*2)return this.ctx.restore(),{_text:"",ellipsis:!0};const l=this.ctx.measureText(e).width,d=t-r*2;if(l&&l>=d){n=!0;let u=0;for(let f=0;f<e.length;f++)if(u+=this.ctx.measureText(e[f]).width,u>=d-a){o=e.slice(0,f)+"...",n=!0;break}}return this.ctx.restore(),{_text:o,ellipsis:n}}}class Bn{constructor(e){h(this,"_config",{}),h(this,"CSS_PREFIX","e-virt-table"),h(this,"ICONS",[]),h(this,"ROW_KEY",""),h(this,"DISABLED",!1),h(this,"HEADER_FONT","12px normal Arial"),h(this,"BODY_FONT","12px normal Arial"),h(this,"BORDER",!0),h(this,"STRIPE",!1),h(this,"STRIPE_COLOR","#fafafa"),h(this,"BORDER_COLOR","#e1e6eb"),h(this,"HEIGHT",0),h(this,"PLACEHOLDER_COLOR","#CDD0DC"),h(this,"EMPTY_BODY_HEIGHT",120),h(this,"EMPTY_CUSTOM_STYLE",{}),h(this,"NUMBER_ERROR_TIP","只允许输入数字"),h(this,"EMPTY_TEXT","暂无数据"),h(this,"LOADING_TEXT","加载中..."),h(this,"MAX_HEIGHT",1e3),h(this,"BORDER_RADIUS",8),h(this,"ENABLE_OFFSET_HEIGHT",!1),h(this,"OFFSET_HEIGHT",0),h(this,"HEADER_HEIGHT",36),h(this,"ENABLE_HEADER_STICKY",!1),h(this,"HEADER_BG_COLOR","#F8FAFF"),h(this,"BODY_BG_COLOR","#FFF"),h(this,"HEADER_TEXT_COLOR","#1D2129"),h(this,"REQUIRED_COLOR","#F56C6C"),h(this,"BODY_TEXT_COLOR","#4E5969"),h(this,"FOOTER_TEXT_COLOR","#4E5969"),h(this,"LOADING_ICON_SVG",""),h(this,"LOADING_ICON_COLOR","#4E5969"),h(this,"EXPAND_ICON_SVG",""),h(this,"SHRINK_ICON_SVG",""),h(this,"EXPAND_ICON_COLOR","#4E5969"),h(this,"SHRINK_ICON_COLOR","#4E5969"),h(this,"ERROR_TIP_ICON_COLOR","red"),h(this,"ERROR_TIP_ICON_SIZE",6),h(this,"COLUMNS_ALIGN","left"),h(this,"COLUMNS_VERTICAL_ALIGN","middle"),h(this,"EXPAND_LAZY",!0),h(this,"DEFAULT_EXPAND_ALL",!1),h(this,"CELL_WIDTH",100),h(this,"CELL_HEIGHT",36),h(this,"CELL_PADDING",8),h(this,"CELL_HOVER_ICON_SIZE",14),h(this,"CELL_HOVER_ICON_BG_COLOR","#fff"),h(this,"CELL_HOVER_ICON_BORDER_COLOR","#DDE0EA"),h(this,"SCROLLER_TRACK_SIZE",14),h(this,"SCROLLER_SIZE",8),h(this,"SCROLLER_COLOR","#dee0e3"),h(this,"SCROLLER_TRACK_COLOR","#fff"),h(this,"SCROLLER_FOCUS_COLOR","#bbbec4"),h(this,"SELECT_BORDER_COLOR","rgb(82,146,247)"),h(this,"SELECT_AREA_COLOR","rgba(82,146,247,0.1)"),h(this,"SELECT_ROW_COL_BG_COLOR","transparent"),h(this,"AUTOFILL_POINT_BORDER_COLOR","#fff"),h(this,"EDIT_BG_COLOR","#fcf6ed"),h(this,"CHECKBOX_KEY",""),h(this,"CHECKBOX_COLOR","rgb(82,146,247)"),h(this,"FINDER_CELL_BG_COLOR","rgb(255,229,144)"),h(this,"ENABLE_FINDER",!0),h(this,"CHECKBOX_SIZE",20),h(this,"CHECKBOX_DISABLED_SVG",""),h(this,"CHECKBOX_DISABLED_COLOR","#F1F2F4"),h(this,"CHECKBOX_CHECK_SVG",""),h(this,"CHECKBOX_UNCHECK_SVG",""),h(this,"CHECKBOX_UNCHECK_COLOR","#DDE0EA"),h(this,"CHECKBOX_INDETERMINATE_SVG",""),h(this,"CHECKBOX_CHECK_DISABLED_SVG",""),h(this,"CHECKBOX_CHECK_DISABLED_COLOR","#DDE0EA"),h(this,"ICON_EDIT_SVG",""),h(this,"ICON_EDIT_COLOR","#4E5969"),h(this,"ICON_SELECT_SVG",""),h(this,"ICON_SELECT_COLOR","#4E5969"),h(this,"SORT_STRICTLY",!0),h(this,"SORT_ASC_ICON_SVG",""),h(this,"SORT_DESC_ICON_SVG",""),h(this,"SORTABLE_ICON_SVG",""),h(this,"SORT_ICON_COLOR","rgb(82,146,247)"),h(this,"READONLY_COLOR","#fff"),h(this,"READONLY_TEXT_COLOR","#4E5969"),h(this,"ERROR_TIP_COLOR","#ED3F14"),h(this,"FOOTER_BG_COLOR","#fafafa"),h(this,"FOOTER_FIXED",!0),h(this,"FOOTER_POSITION","bottom"),h(this,"CELL_FOOTER_HEIGHT",36),h(this,"ENABLE_SELECTOR",!0),h(this,"TREE_SELECT_MODE","auto"),h(this,"TREE_CHILDREN_KEY","children"),h(this,"TREE_INDENT",20),h(this,"TREE_ICON_SIZE",20),h(this,"TREE_LINE",!1),h(this,"TREE_LINE_COLOR","#e1e6eb"),h(this,"ENABLE_EDIT_SINGLE_CLICK",!1),h(this,"ENABLE_EDIT_CLICK_SELECTOR",!0),h(this,"SELECTOR_AREA_MIN_X",0),h(this,"SELECTOR_AREA_MAX_X_OFFSET",0),h(this,"SELECTOR_AREA_MAX_X",0),h(this,"SELECTOR_AREA_MIN_Y",0),h(this,"SELECTOR_AREA_MAX_Y",0),h(this,"SELECTOR_AREA_MAX_Y_OFFSET",0),h(this,"SELECTOR_CELL_VALUE_TYPE","value"),h(this,"ENABLE_AUTO_THEME",!0),h(this,"ENABLE_SELECTOR_SINGLE",!1),h(this,"ENABLE_SELECTOR_SPAN_COL",!0),h(this,"ENABLE_SELECTOR_SPAN_ROW",!0),h(this,"ENABLE_SELECTOR_ALL_ROWS",!0),h(this,"ENABLE_SELECTOR_ALL_COLS",!0),h(this,"ENABLE_MERGE_CELL_LINK",!1),h(this,"ENABLE_AUTOFILL",!1),h(this,"ENABLE_AUTOFILL_SPAN_COL",!0),h(this,"ENABLE_AUTOFILL_SPAN_ROW",!0),h(this,"ENABLE_CONTEXT_MENU",!1),h(this,"ENABLE_HEADER_CONTEXT_MENU",!1),h(this,"ENABLE_COPY",!0),h(this,"ENABLE_PASTER",!0),h(this,"ENABLE_RESIZE_ROW",!0),h(this,"ENABLE_RESIZE_COLUMN",!0),h(this,"RESIZE_ROW_LINE_COLOR","#e1e6eb"),h(this,"RESIZE_COLUMN_LINE_COLOR","#e1e6eb"),h(this,"ENABLE_RESIZE_COLUMN_TEXT",!0),h(this,"RESIZE_COLUMN_TEXT_COLOR","#fff"),h(this,"RESIZE_COLUMN_TEXT_BG_COLOR","rgb(82,146,247)"),h(this,"RESIZE_ROW_MIN_HEIGHT",36),h(this,"RESIZE_COLUMN_MIN_WIDTH",40),h(this,"DRAG_TIP_BG_COLOR","rgba(82,146,247,0.1)"),h(this,"DRAG_TIP_LINE_COLOR","rgb(82,146,247)"),h(this,"ENABLE_KEYBOARD",!0),h(this,"ENABLE_HISTORY",!1),h(this,"ENABLE_VALIDATOR_IMMEDIATE",!0),h(this,"HISTORY_NUM",50),h(this,"HIGHLIGHT_HOVER_ROW",!1),h(this,"HIGHLIGHT_HOVER_ROW_COLOR","rgba(186,203,231,0.1)"),h(this,"HIGHLIGHT_SELECTED_ROW",!1),h(this,"HIGHLIGHT_SELECTED_ROW_COLOR","rgba(82,146,247,0.1)"),h(this,"TOOLTIP_BG_COLOR","#303133"),h(this,"TOOLTIP_TEXT_COLOR","#fff"),h(this,"TOOLTIP_ZINDEX",3e3),h(this,"TOOLTIP_CUSTOM_STYLE",{}),h(this,"CONTEXT_MENU",[{label:"复制",value:"copy"},{label:"剪切",value:"cut"},{label:"粘贴",value:"paste"},{label:"清空选中内容",value:"clearSelected"}]),h(this,"CUSTOM_BODY_CONTEXT_MENU",[]),h(this,"HEADER_CONTEXT_MENU",[{label:"左固定",value:"fixedLeft"},{label:"右固定",value:"fixedRight"},{label:"取消固定",value:"fixedNone"},{label:"隐藏",value:"hide"},{label:"显示",value:"visible"},{label:"恢复默认",value:"resetHeader"}]),h(this,"CUSTOM_HEADER_CONTEXT_MENU",[]),h(this,"CELL_LINE_HEIGHT",1.3),h(this,"AUTO_ROW_HEIGHT",!1),h(this,"ENABLE_DRAG_COLUMN",!1),h(this,"HEADER_CELL_STYLE_METHOD"),h(this,"BODY_CELL_STYLE_METHOD"),h(this,"FOOTER_CELL_STYLE_METHOD"),h(this,"BODY_CELL_READONLY_METHOD"),h(this,"BODY_CELL_FORMATTER_METHOD"),h(this,"BODY_CELL_RULES_METHOD"),h(this,"BODY_CELL_TYPE_METHOD"),h(this,"BODY_CELL_EDITOR_METHOD"),h(this,"BODY_CELL_RENDER_METHOD"),h(this,"BODY_CELL_HOVER_ICON_METHOD"),h(this,"SPAN_METHOD"),h(this,"SELECTABLE_METHOD"),h(this,"EXPAND_LAZY_METHOD"),h(this,"BEFORE_VALUE_CHANGE_METHOD"),h(this,"BEFORE_PASTE_DATA_METHOD"),h(this,"BEFORE_AUTOFILL_DATA_METHOD"),h(this,"BEFORE_SET_SELECTOR_METHOD"),h(this,"BEFORE_SET_AUTOFILL_METHOD"),h(this,"BEFORE_COPY_METHOD"),this._config=e,this.updateCssVar()}init(e){this._config=e,this.updateCssVar()}updateCssVar(){let e={};Object.keys(this).forEach(t=>{if(t.endsWith("_COLOR")||t.endsWith("_FONT")){const r=`--evt-${t.toLocaleLowerCase().replace(/_/g,"-")}`,s=fb(r);s&&(e[t]=s)}}),Object.assign(this,e,this._config)}}const Si='<svg t="1724122015492" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4237" width="32" height="32"><path d="M401.472 316.992l159.04 217.664L591.488 512l-30.976-22.656-159.04 217.728q-2.24 3.008-3.84 6.464-1.6 3.456-2.496 7.104-0.896 3.648-1.024 7.424-0.192 3.84 0.384 7.552 0.64 3.712 1.92 7.296 1.28 3.52 3.2 6.784 1.984 3.2 4.544 6.016 2.56 2.752 5.632 4.992 3.072 2.24 6.464 3.84 3.456 1.6 7.168 2.496 3.648 0.896 7.424 1.024 3.776 0.192 7.488-0.448 3.776-0.576 7.296-1.856 3.584-1.28 6.784-3.264 3.2-1.92 6.016-4.48 2.816-2.56 5.056-5.632l159.04-217.728q3.584-4.928 5.504-10.752 1.92-5.76 1.92-11.904 0-6.08-1.92-11.904-1.92-5.76-5.504-10.752L463.488 271.68q-2.24-3.072-5.056-5.632-2.752-2.56-6.016-4.48-3.2-1.984-6.784-3.328-3.52-1.28-7.296-1.856-3.712-0.576-7.488-0.448-3.84 0.192-7.424 1.088-3.712 0.896-7.168 2.496-3.392 1.6-6.4 3.84-3.136 2.176-5.696 4.992-2.56 2.752-4.48 6.016-1.984 3.2-3.264 6.784-1.28 3.52-1.92 7.296-0.576 3.712-0.384 7.488 0.128 3.84 1.024 7.488 0.896 3.648 2.496 7.04 1.6 3.456 3.84 6.528z m30.976-61.056q-3.776 0-7.488 0.704-3.712 0.768-7.168 2.24-3.52 1.408-6.656 3.52-3.2 2.112-5.824 4.8-2.688 2.624-4.8 5.76-2.112 3.2-3.52 6.656-1.472 3.52-2.176 7.232-0.768 3.712-0.768 7.488 0 3.776 0.768 7.488 0.704 3.712 2.176 7.232 1.408 3.456 3.52 6.592 2.112 3.2 4.8 5.824 2.688 2.688 5.76 4.8 3.2 2.112 6.72 3.52 3.456 1.472 7.168 2.176 3.712 0.768 7.488 0.768 3.84 0 7.488-0.768 3.712-0.704 7.232-2.176 3.456-1.408 6.592-3.52 3.2-2.112 5.824-4.8 2.688-2.688 4.8-5.76 2.112-3.2 3.52-6.656 1.472-3.52 2.24-7.232 0.704-3.712 0.704-7.488 0-3.84-0.704-7.488-0.768-3.712-2.24-7.232-1.408-3.456-3.52-6.592-2.112-3.2-4.8-5.824-2.624-2.688-5.76-4.8-3.2-2.112-6.656-3.52-3.52-1.472-7.232-2.24Q436.224 256 432.448 256z m0 435.392q-3.776 0-7.488 0.704-3.712 0.768-7.168 2.176-3.52 1.472-6.656 3.584-3.2 2.112-5.824 4.736-2.688 2.688-4.8 5.824-2.112 3.2-3.52 6.656-1.472 3.52-2.176 7.232-0.768 3.712-0.768 7.488 0 3.776 0.768 7.488 0.704 3.712 2.176 7.168 1.408 3.52 3.52 6.656 2.112 3.2 4.8 5.76 2.688 2.752 5.76 4.8 3.2 2.112 6.72 3.584 3.456 1.472 7.168 2.176 3.712 0.768 7.488 0.768 3.84 0 7.488-0.768 3.712-0.704 7.232-2.176 3.456-1.472 6.592-3.584 3.2-2.048 5.824-4.736 2.688-2.688 4.8-5.824 2.112-3.2 3.52-6.656 1.472-3.456 2.24-7.168 0.704-3.712 0.704-7.488 0-3.84-0.704-7.488-0.768-3.712-2.24-7.232-1.408-3.52-3.52-6.656-2.112-3.136-4.8-5.76-2.624-2.688-5.76-4.8-3.2-2.112-6.656-3.584-3.52-1.408-7.232-2.176-3.712-0.704-7.488-0.704z" p-id="4238"></path></svg>',Hn='<svg t="1722595535853" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4551" width="32" height="32"><path d="M640 128H384c-170.496 0-256 85.504-256 256v256c0 170.496 85.504 256 256 256h256c170.496 0 256-85.504 256-256V384c0-170.496-85.504-256-256-256z m67.584 302.592c-2.048 4.608-4.608 8.704-8.192 12.288L506.88 634.88c-3.584 3.584-7.68 6.144-12.288 8.192-4.608 2.048-9.728 3.072-14.848 3.072s-10.24-1.024-14.848-3.072c-4.608-2.048-8.704-4.608-12.288-8.192l-96.256-96.256c-3.584-3.584-6.144-7.68-8.192-12.288-2.048-4.608-3.072-9.728-3.072-14.848 0-2.56 0-5.12 1.024-7.68 0.512-2.56 1.024-5.12 2.048-7.168 1.024-2.56 2.048-4.608 3.584-6.656 1.536-2.048 3.072-4.096 4.608-5.632 1.536-2.048 3.584-3.584 5.632-4.608 2.048-1.536 4.096-2.56 6.656-3.584 2.56-1.024 4.608-1.536 7.168-2.048 2.56-0.512 5.12-0.512 7.68-0.512 5.12 0 10.24 1.024 14.848 3.072 4.608 2.048 8.704 4.608 12.288 8.192l69.12 68.608L645.12 389.12c3.584-3.584 7.68-6.144 12.288-8.192 4.608-2.048 9.728-3.072 14.848-3.072 2.56 0 5.12 0 7.68 0.512s5.12 1.024 7.168 2.048c2.56 1.024 4.608 2.048 6.656 3.584 2.048 1.536 4.096 3.072 5.632 4.608 1.536 1.536 3.584 3.584 4.608 5.632 1.536 2.048 2.56 4.096 3.584 6.656 1.024 2.56 1.536 4.608 2.048 7.168 0.512 2.56 1.024 5.12 1.024 7.68 0 5.12-1.024 10.24-3.072 14.848z" p-id="4552"></path></svg>',Fn='<svg t="1724122044148" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4551" width="32" height="32"><path d="M707.648 401.28L489.28 560.704l22.656 30.976 22.656-30.976L316.16 401.216q-3.072-2.24-6.464-3.84-3.456-1.536-7.104-2.432-3.712-0.896-7.488-1.088-3.776-0.128-7.488 0.448-3.776 0.64-7.296 1.92-3.584 1.28-6.784 3.2-3.2 1.984-6.016 4.544-2.816 2.56-5.056 5.632-2.176 3.072-3.84 6.464-1.536 3.456-2.432 7.104-0.896 3.712-1.088 7.488-0.128 3.776 0.448 7.488 0.64 3.776 1.92 7.296 1.28 3.584 3.2 6.784 1.984 3.2 4.544 6.016 2.56 2.752 5.632 4.992l218.368 159.552q4.928 3.584 10.752 5.504 5.76 1.92 11.904 1.92 6.08 0 11.904-1.92 5.76-1.92 10.752-5.504l218.368-159.552q3.008-2.24 5.568-4.992 2.56-2.816 4.544-6.016 1.92-3.2 3.264-6.784 1.28-3.52 1.92-7.296 0.576-3.712 0.384-7.488-0.128-3.84-1.024-7.488-0.896-3.648-2.496-7.04-1.6-3.456-3.84-6.528-2.24-3.072-4.992-5.632-2.816-2.56-6.016-4.48-3.2-1.984-6.784-3.328-3.584-1.28-7.296-1.856-3.712-0.64-7.488-0.448-3.84 0.192-7.488 1.088-3.648 0.896-7.04 2.496-3.456 1.536-6.528 3.84z m61.056 30.976q0-3.84-0.768-7.488-0.704-3.712-2.176-7.232-1.472-3.456-3.52-6.656-2.112-3.136-4.8-5.76-2.688-2.688-5.76-4.8-3.2-2.112-6.72-3.584-3.456-1.408-7.168-2.176-3.712-0.704-7.488-0.704-3.84 0-7.488 0.704-3.712 0.768-7.232 2.176-3.456 1.472-6.656 3.584-3.136 2.112-5.76 4.8-2.688 2.624-4.8 5.76-2.112 3.2-3.584 6.656-1.408 3.52-2.176 7.232-0.704 3.712-0.704 7.488 0 3.776 0.704 7.488 0.768 3.712 2.176 7.168 1.472 3.52 3.584 6.656 2.112 3.2 4.8 5.824 2.624 2.688 5.76 4.8 3.2 2.112 6.656 3.52 3.52 1.472 7.232 2.176 3.712 0.768 7.488 0.768 3.776 0 7.488-0.768 3.712-0.704 7.168-2.176 3.52-1.408 6.656-3.52 3.2-2.112 5.824-4.8 2.688-2.688 4.8-5.76 2.048-3.2 3.52-6.72 1.472-3.456 2.176-7.168 0.768-3.712 0.768-7.488z m-436.736 0q0-3.84-0.768-7.488-0.704-3.712-2.176-7.232-1.408-3.456-3.52-6.656-2.112-3.136-4.8-5.76-2.688-2.688-5.76-4.8-3.2-2.112-6.656-3.584-3.52-1.408-7.232-2.176-3.712-0.704-7.488-0.704-3.84 0-7.488 0.704-3.712 0.768-7.232 2.176-3.456 1.472-6.592 3.584-3.2 2.112-5.824 4.8-2.688 2.624-4.8 5.76-2.112 3.2-3.52 6.656-1.472 3.52-2.24 7.232-0.704 3.712-0.704 7.488 0 3.776 0.704 7.488 0.768 3.712 2.24 7.168 1.408 3.52 3.52 6.656 2.112 3.2 4.8 5.824 2.624 2.688 5.76 4.8 3.2 2.112 6.656 3.52 3.52 1.472 7.232 2.176 3.712 0.768 7.488 0.768 3.776 0 7.488-0.768 3.712-0.704 7.232-2.176 3.456-1.408 6.592-3.52 3.2-2.112 5.824-4.8 2.688-2.688 4.8-5.76 2.112-3.2 3.52-6.72 1.472-3.456 2.176-7.168 0.768-3.712 0.768-7.488z" p-id="4552"></path></svg>',Yr='<svg t="1755138507987" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5079" width="200" height="200"><path d="M512 938.688a42.688 42.688 0 0 1-35.072-18.432l-192-277.312A42.56 42.56 0 0 1 320 576h384a42.752 42.752 0 0 1 35.072 66.944l-192 277.312a42.688 42.688 0 0 1-35.072 18.432" fill="currentColor" p-id="2016"></path><path d="M704 448H320a42.752 42.752 0 0 1-35.072-66.944l192-277.312c16-23.04 54.208-23.04 70.144 0l192 277.312A42.56 42.56 0 0 1 704 448" fill="currentColor" p-id="2015"></path></svg>',wb=Yr.replace('fill="currentColor" p-id="2016"','fill="#bec4c7" p-id="2016"'),Eb=Yr.replace('fill="currentColor" p-id="2015"','fill="#bec4c7" p-id="2015"'),al='<svg t="1724133395728" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2893" width="32" height="32"><path d="M512 226.8476541a19.82487759 19.82487759 0 0 1 14.66497778 5.70304692c3.80203107 3.82918865 5.70304692 8.71751457 5.70304693 14.66497779v122.20814825a19.82487759 19.82487759 0 0 1-5.70304693 14.66497778 19.82487759 19.82487759 0 0 1-14.66497778 5.70304691 19.82487759 19.82487759 0 0 1-14.66497778-5.70304691 19.82487759 19.82487759 0 0 1-5.70304693-14.66497778v-122.20814825a19.82487759 19.82487759 0 0 1 5.70304693-14.66497779 19.82487759 19.82487759 0 0 1 14.66497778-5.70304692z m0 407.36049415a19.82487759 19.82487759 0 0 1 14.66497778 5.70304691c3.80203107 3.82918865 5.70304692 8.71751457 5.70304693 14.66497778v122.20814827a19.82487759 19.82487759 0 0 1-5.70304693 14.66497776 19.82487759 19.82487759 0 0 1-14.66497778 5.70304693 19.82487759 19.82487759 0 0 1-14.66497778-5.70304693 19.82487759 19.82487759 0 0 1-5.70304693-14.66497776v-122.20814827a19.82487759 19.82487759 0 0 1 5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 14.66497778-5.70304691zM797.1523459 512a19.82487759 19.82487759 0 0 1-5.70304692 14.66497778 19.82487759 19.82487759 0 0 1-14.66497779 5.70304693h-122.20814825a19.82487759 19.82487759 0 0 1-14.66497778-5.70304693 19.82487759 19.82487759 0 0 1-5.70304691-14.66497778 19.82487759 19.82487759 0 0 1 5.70304691-14.66497778 19.82487759 19.82487759 0 0 1 14.66497778-5.70304693h122.20814825a19.82487759 19.82487759 0 0 1 14.66497779 5.70304693c3.80203107 3.82918865 5.70304692 8.71751457 5.70304692 14.66497778z m-407.36049415 0a19.82487759 19.82487759 0 0 1-5.70304691 14.66497778 19.82487759 19.82487759 0 0 1-14.66497778 5.70304693h-122.20814827a19.82487759 19.82487759 0 0 1-14.66497776-5.70304693 19.82487759 19.82487759 0 0 1-5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 14.66497776-5.70304693h122.20814827a19.82487759 19.82487759 0 0 1 14.66497778 5.70304693c3.80203107 3.82918865 5.70304692 8.71751457 5.70304691 14.66497778zM310.22076878 310.22076878a21.29137537 21.29137537 0 0 1 14.66497779-5.70304693c5.51294514 0 10.18401235 1.90101585 14.01320099 5.70304693l86.55052591 86.57768347a20.91117183 20.91117183 0 0 1 5.73020449 14.31193182 19.28172983 19.28172983 0 0 1-6.05609289 14.013201 19.11878565 19.11878565 0 0 1-14.013201 6.05609289 20.96548698 20.96548698 0 0 1-14.31193182-5.70304692L310.22076878 338.87178998a19.06447114 19.06447114 0 0 1-5.70304693-14.01320099c0-5.54010272 1.90101585-10.42842865 5.70304693-14.66497778z m288.32975775 288.32975775a19.79772001 19.79772001 0 0 1 14.3390894-6.35482371c5.29568642 0 10.04822572 2.11827457 14.31193182 6.38198066l86.57768347 86.55052651c3.80203107 3.80203107 5.70304692 8.47309828 5.70304691 14.01320102a19.55330372 19.55330372 0 0 1-6.05609225 14.31193182 19.66193339 19.66193339 0 0 1-14.31193245 6.05609288 19.01015661 19.01015661 0 0 1-14.01320099-5.70304692l-86.55052591-86.57768347a19.79772001 19.79772001 0 0 1-6.38198129-14.31193245c0-5.29568642 2.11827457-10.07538268 6.38198129-14.33908939zM713.77923122 310.22076878c3.80203107 4.26370672 5.70304692 9.15203265 5.70304693 14.66497779s-1.90101585 10.18401235-5.70304693 14.01320099l-86.57768347 86.55052591a20.91117183 20.91117183 0 0 1-14.31193182 5.73020449 19.28172983 19.28172983 0 0 1-14.013201-6.05609289 19.11878565 19.11878565 0 0 1-6.05609289-14.013201c0-5.29568642 1.90101585-10.07538268 5.70304692-14.31193182l86.57768348-86.57768347c3.80203107-3.80203107 8.50025585-5.70304692 14.01320099-5.70304693 5.54010272 0 10.40127108 1.90101585 14.66497779 5.70304693zM425.44947347 598.57768347a19.79772001 19.79772001 0 0 1 6.35482371 14.33908939c0 5.29568642-2.11827457 10.04822572-6.38198066 14.31193245L338.89894756 713.77923122a19.06447114 19.06447114 0 0 1-14.01320099 5.70304693 19.55330372 19.55330372 0 0 1-14.31193245-6.05609227 19.68909035 19.68909035 0 0 1-6.05609227-14.31193245 19.01015661 19.01015661 0 0 1 5.70304693-14.01320099l86.57768347-86.55052591a19.79772001 19.79772001 0 0 1 14.31193182-6.38198129c5.29568642 0 10.07538268 2.11827457 14.3390894 6.38198129z" fill="#000000" fill-opacity=".65" p-id="2894"></path></svg>';class Cb{constructor(e){h(this,"ctx"),h(this,"list",[{name:"loading",configName:"LOADING_ICON_SVG",configColorName:"LOADING_ICON_COLOR",svg:al,color:"#4E5969"},{name:"expand",configName:"EXPAND_ICON_SVG",configColorName:"EXPAND_ICON_COLOR",svg:Si,color:"#4E5969"},{name:"shrink",configName:"SHRINK_ICON_SVG",configColorName:"SHRINK_ICON_COLOR",svg:Fn,color:"#4E5969"},{name:"checkbox-uncheck",configName:"CHECKBOX_UNCHECK_SVG",configColorName:"CHECKBOX_UNCHECK_COLOR",svg:'<svg t="1722595639920" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4708" width="32" height="32"><path d="M128 640V384a256 256 0 0 1 256-256h256a256 256 0 0 1 256 256v256a256 256 0 0 1-256 256H384a256 256 0 0 1-256-256z m64 0q0 79.552 56.256 135.744Q304.448 832 384 832h256q79.552 0 135.744-56.256Q832 719.552 832 640V384q0-79.552-56.256-135.744Q719.552 192 640 192H384q-79.552 0-135.744 56.256Q192 304.448 192 384v256z" p-id="4709"></path></svg>',color:""},{name:"checkbox-check",configName:"CHECKBOX_CHECK_SVG",configColorName:"CHECKBOX_COLOR",svg:Hn,color:"rgb(82,146,247)"},{name:"checkbox-indeterminate",configName:"CHECKBOX_INDETERMINATE_SVG",configColorName:"CHECKBOX_COLOR",svg:'<svg t="1722595280953" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4394" width="32" height="32"><path d="M128 384v256q0 12.608 1.28 25.088 1.216 12.544 3.648 24.832 2.432 12.352 6.08 24.384t8.448 23.68q4.864 11.584 10.752 22.72 5.952 11.072 12.928 21.504 7.04 10.496 14.976 20.224 8 9.728 16.896 18.56 8.896 8.96 18.56 16.896 9.728 8 20.224 14.976 10.432 7.04 21.504 12.928 11.136 5.888 22.72 10.688 11.648 4.864 23.68 8.512 12.032 3.648 24.32 6.08 12.352 2.432 24.896 3.712Q371.392 896 384 896h256q12.608 0 25.088-1.28 12.544-1.216 24.832-3.648 12.352-2.432 24.384-6.08t23.68-8.512q11.584-4.8 22.72-10.688 11.072-5.952 21.504-12.928 10.496-7.04 20.224-14.976 9.728-8 18.56-16.896 8.96-8.832 16.896-18.56 8-9.728 14.976-20.224 7.04-10.432 12.928-21.504 5.888-11.136 10.688-22.72 4.864-11.648 8.512-23.68 3.648-12.032 6.08-24.32 2.432-12.352 3.712-24.896Q896 652.608 896 640V384q0-12.608-1.28-25.088-1.216-12.544-3.648-24.832-2.432-12.352-6.08-24.384t-8.512-23.68q-4.8-11.584-10.688-22.72-5.952-11.072-12.928-21.504-7.04-10.496-14.976-20.224-8-9.664-16.896-18.56-8.832-8.96-18.56-16.896-9.728-8-20.224-14.976-10.432-7.04-21.504-12.928-11.136-5.888-22.72-10.752-11.648-4.8-23.68-8.448-12.032-3.648-24.32-6.08-12.352-2.432-24.896-3.712Q652.608 128 640 128H384q-12.608 0-25.088 1.28-12.544 1.216-24.832 3.648-12.352 2.432-24.384 6.08t-23.68 8.448q-11.584 4.864-22.72 10.752-11.072 5.952-21.504 12.928-10.496 7.04-20.224 14.976-9.664 8-18.56 16.896-8.96 8.896-16.896 18.56-8 9.728-14.976 20.224-7.04 10.432-12.928 21.504-5.888 11.136-10.752 22.72-4.8 11.648-8.448 23.68-3.648 12.032-6.08 24.32-2.432 12.352-3.712 24.896Q128 371.392 128 384z m566.016 166.336H330.112a38.4 38.4 0 0 1 0-76.8h363.904a38.4 38.4 0 0 1 0 76.8z" p-id="4395"></path></svg>',color:"rgb(82,146,247)"},{name:"checkbox-check-disabled",configName:"CHECKBOX_CHECK_DISABLED_SVG",svg:Hn,color:"#DDE0EA"},{name:"checkbox-disabled",configName:"CHECKBOX_DISABLED_SVG",configColorName:"CHECKBOX_DISABLED_COLOR",svg:'<svg t="1722595946663" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4865" width="32" height="32"><path d="M128 640V384a256 256 0 0 1 256-256h256a256 256 0 0 1 256 256v256a256 256 0 0 1-256 256H384a256 256 0 0 1-256-256z" p-id="4866"></path><path d="M128 640V384a256 256 0 0 1 256-256h256a256 256 0 0 1 256 256v256a256 256 0 0 1-256 256H384a256 256 0 0 1-256-256z m64 0q0 79.552 56.256 135.744Q304.448 832 384 832h256q79.552 0 135.744-56.256Q832 719.552 832 640V384q0-79.552-56.256-135.744Q719.552 192 640 192H384q-79.552 0-135.744 56.256Q192 304.448 192 384v256z" fill="#DDE0EA" p-id="4867"></path></svg>',color:"#F1F2F4"},{name:"icon-edit",configName:"ICON_EDIT_SVG",configColorName:"ICON_EDIT_COLOR",svg:'<svg t="1744798692576" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6606" width="200" height="200"><path d="M855.296 894.528H168.768v-76.8h686.528v76.8z m38.4-38.4q0 3.84-0.768 7.488-0.704 3.712-2.176 7.232-1.472 3.52-3.52 6.656-2.112 3.136-4.8 5.76-2.688 2.688-5.824 4.8-3.2 2.112-6.656 3.584-3.456 1.408-7.168 2.176-3.712 0.704-7.488 0.704-3.84 0-7.488-0.704-3.712-0.768-7.232-2.176-3.52-1.472-6.656-3.584-3.136-2.112-5.76-4.736-2.688-2.688-4.8-5.824-2.112-3.2-3.584-6.656-1.408-3.52-2.176-7.232-0.704-3.648-0.704-7.488 0-3.776 0.704-7.488 0.768-3.712 2.176-7.168 1.472-3.52 3.584-6.656 2.112-3.136 4.736-5.76 2.688-2.752 5.824-4.8 3.2-2.112 6.656-3.584 3.52-1.472 7.232-2.176 3.712-0.768 7.488-0.768 3.776 0 7.488 0.768 3.712 0.704 7.168 2.176 3.52 1.472 6.656 3.584 3.2 2.048 5.76 4.736 2.752 2.688 4.864 5.824 2.048 3.2 3.52 6.656 1.472 3.456 2.176 7.168 0.768 3.712 0.768 7.488z m-686.528 0q0 3.84-0.768 7.488-0.704 3.712-2.176 7.232-1.472 3.52-3.52 6.656-2.112 3.136-4.8 5.76-2.688 2.688-5.76 4.8-3.2 2.112-6.72 3.584-3.456 1.408-7.168 2.176-3.712 0.704-7.488 0.704-3.84 0-7.488-0.704-3.712-0.768-7.232-2.176-3.456-1.472-6.656-3.584-3.136-2.112-5.76-4.736-2.688-2.688-4.8-5.824-2.112-3.2-3.584-6.656-1.408-3.52-2.176-7.232-0.704-3.648-0.704-7.488 0-3.776 0.704-7.488 0.768-3.712 2.176-7.168 1.472-3.52 3.584-6.656 2.112-3.136 4.736-5.76 2.688-2.752 5.824-4.8 3.2-2.112 6.656-3.584 3.52-1.472 7.232-2.176 3.712-0.768 7.488-0.768 3.776 0 7.488 0.768 3.712 0.704 7.168 2.176 3.52 1.472 6.656 3.584 3.2 2.048 5.824 4.736 2.688 2.688 4.8 5.824 2.048 3.2 3.52 6.656 1.472 3.456 2.176 7.168 0.768 3.712 0.768 7.488zM652.032 211.2l-369.92 370.368v89.344h90.048l369.664-369.856L652.032 211.2z m-54.4-54.272q22.528-22.528 54.4-22.528 31.808 0 54.336 22.528l89.792 89.856q22.464 22.464 22.464 54.272t-22.464 54.272l-369.664 369.856q-22.464 22.528-54.336 22.528H282.24q-31.808 0-54.336-22.528-22.464-22.464-22.464-54.272V581.568q0-31.808 22.4-54.272l369.92-370.368z" p-id="6607"></path></svg>',color:"#4E5969"},{name:"icon-select",configName:"ICON_SELECT_SVG",configColorName:"ICON_SELECT_COLOR",svg:Fn,color:"#4E5969"},{name:"sort-asc",configName:"SORT_ASC_ICON_SVG",configColorName:"SORT_ICON_COLOR",svg:wb,color:"rgb(82,146,247)"},{name:"sort-desc",configName:"SORT_DESC_ICON_SVG",configColorName:"SORT_ICON_COLOR",svg:Eb,color:"rgb(82,146,247)"},{name:"sort-default",configName:"SORTABLE_ICON_SVG",svg:Yr,color:"#bec4c7"}]),h(this,"icons",new Map),this.ctx=e,this.init()}async init(){const e=[];for(let t=0;t<this.list.length;t++){const r=this.list[t];let s=r.color,n=r.svg;if(r.configColorName){const a=this.ctx.config[r.configColorName];a&&(s=a)}if(r.configName){const a=this.ctx.config[r.configName];a&&(n=a)}const o=this.createImageFromSVG(n,s).then(a=>{this.icons.set(r.name,a)});e.push(o)}for(let t=0;t<this.ctx.config.ICONS.length;t++){const r=this.ctx.config.ICONS[t];let s=r.color;const n=this.createImageFromSVG(r.svg,s,r.isBlob).then(o=>{this.icons.set(r.name,o)});e.push(n)}await Promise.all(e),this.ctx.emit("draw")}async createImageFromSVG(e,t,r=!1){const s=new DOMParser().parseFromString(e,"image/svg+xml").documentElement;t&&s.querySelectorAll("*").forEach(a=>{const l=a.getAttribute("fill");(l==="currentColor"||l===null)&&a.setAttribute("fill",t)});const n=new Image;let o="";if(r){const a=new Blob([new XMLSerializer().serializeToString(s)],{type:"image/svg+xml"});o=URL.createObjectURL(a)}else o="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(s));return n.src=o,new Promise((a,l)=>{n.onerror=()=>l(new Error("Failed to load image:"+e)),n.onload=()=>{a(n)}})}get(e){return this.icons.get(e)}getSvg(e){return this.list.find(t=>t.name===e)}}class vr extends ol{constructor(e,t,r,s,n,o,a){super(e,r,s,n,o,"header",a.fixed),h(this,"align"),h(this,"hideHeaderSelection",!1),h(this,"verticalAlign","middle"),h(this,"fixed"),h(this,"minWidth"),h(this,"maxWidth"),h(this,"widthFillDisable"),h(this,"type"),h(this,"operation",!1),h(this,"editorType"),h(this,"level"),h(this,"text"),h(this,"hide",!1),h(this,"displayText",""),h(this,"colspan"),h(this,"rowspan"),h(this,"row"),h(this,"key"),h(this,"required",!1),h(this,"readonly",!1),h(this,"ellipsis",!1),h(this,"overflowTooltipShow",!0),h(this,"children",[]),h(this,"column"),h(this,"colIndex"),h(this,"rowKey"),h(this,"rules"),h(this,"hasChildren"),h(this,"render"),h(this,"style",{}),h(this,"drawX",0),h(this,"drawY",0),h(this,"sortIconName","sort-default"),h(this,"sortAscIconName","sort-asc"),h(this,"sortDescIconName","sort-desc"),h(this,"visibleWidth",0),h(this,"visibleHeight",0),h(this,"maxLineClampHeader","auto"),h(this,"domDataset",{}),h(this,"drawTextX",0),h(this,"drawTextY",0),h(this,"drawTextWidth",0),h(this,"drawTextHeight",0),h(this,"drawCellBgColor",""),h(this,"drawTextColor",""),h(this,"drawTextFont",""),h(this,"drawSelectionImageX",0),h(this,"drawSelectionImageY",0),h(this,"drawSelectionImageWidth",0),h(this,"drawSelectionImageHeight",0),h(this,"drawSelectionImageName",""),h(this,"drawSelectionImageSource"),h(this,"drawSortImageX",0),h(this,"drawSortImageY",0),h(this,"drawSortImageWidth",0),h(this,"drawSortImageHeight",0),h(this,"drawSortImageName",""),h(this,"drawSortImageSource"),this.ctx=e,this.x=r,this.y=s,this.width=n,this.height=o,this.visibleWidth=n,this.visibleHeight=o,this.colIndex=t,this.key=a.key,this.minWidth=a.minWidth,this.maxWidth=a.maxWidth,this.hide=(typeof a.hide=="function"?a.hide(a):a.hide)||!1,this.type=a.type||"",this.editorType=a.editorType||"text",this.hideHeaderSelection=a.hideHeaderSelection||!1,this.align=a.headerAlign||a.align||this.ctx.config.COLUMNS_ALIGN,this.verticalAlign=a.headerVerticalAlign||a.verticalAlign||this.ctx.config.COLUMNS_VERTICAL_ALIGN,this.fixed=a.fixed||"",this.level=a.level||0,this.operation=a.operation||!1,this.text=a.title,this.column=a,this.colspan=a.colspan||1,this.widthFillDisable=a.widthFillDisable||!1,this.rowspan=a.rowspan||1,this.rules=a.rules,this.readonly=a.readonly||!1,this.required=a.required||!1,this.sortIconName=a.sortIconName||"sort-default",this.sortAscIconName=a.sortAscIconName||"sort-asc",this.sortDescIconName=a.sortDescIconName||"sort-desc",this.rowKey=il(),this.overflowTooltipShow=a.overflowTooltipHeaderShow!==!1,this.hasChildren=a.children&&a.children.length>0||!1,this.render=a.renderHeader,this.maxLineClampHeader=a.maxLineClampHeader||"auto"}isVerticalVisible(){const{stageHeight:e}=this.ctx,t=e;return!(this.y+this.height<=0||this.y>=t)}updateStyle(){this.style=this.getOverlayerViewsStyle()}updateContainer(){const{HEADER_CELL_STYLE_METHOD:e,HEADER_BG_COLOR:t,HEADER_TEXT_COLOR:r}=this.ctx.config;let s=t,n=r;if(typeof e=="function"){const l=e,{backgroundColor:d,color:u,font:f}=l({colIndex:this.colIndex,column:this.column})||{};d&&(s=d),u&&(n=u),f&&(this.drawTextFont=f)}const{colKey:o,type:a}=this.ctx.finderBar;a==="header"&&o===this.key&&(s=this.ctx.config.FINDER_CELL_BG_COLOR),this.drawCellBgColor=s,this.drawTextColor=n}update(){this.updateContainer(),this.displayText=this.getText(),this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawTextX=this.drawX,this.drawTextY=this.drawY,this.drawTextWidth=this.width,this.drawTextHeight=this.height,this.updateStyle()}draw(){this.drawEdge(),this.drawSelection(),this.drawText(),this.drawBg(),this.drawSortIcon()}drawEdge(){const{paint:e,config:{BORDER_COLOR:t,BORDER:r}}=this.ctx;e.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:r?t:"transparent",fillColor:this.drawCellBgColor})}drawText(){const{paint:e,config:{HEADER_FONT:t,CELL_PADDING:r,REQUIRED_COLOR:s}}=this.ctx,n=`${this.displayText}_${this.drawTextWidth}_${this.drawTextFont}`;this.ellipsis=e.drawText(this.displayText,this.drawTextX,this.drawTextY,this.drawTextWidth,this.drawTextHeight,{font:this.drawTextFont||t,padding:r,color:this.drawTextColor,align:this.align,verticalAlign:this.verticalAlign,maxLineClamp:this.maxLineClampHeader,offsetRight:this.column.sortBy?16:0,offsetLeft:this.required?12:0,cacheTextKey:n,textCallback:o=>{this.column.sortBy&&(this.drawSortImageX=o.right+4,this.drawSortImageY=o.top+(o.height-16)/2),this.required&&e.drawText("*",o.left-18,o.top+(o.height-12)/2,24,24,{color:s,font:"18px Arial",align:"center",verticalAlign:"middle",padding:0})}})}drawBg(){if(this.ctx.dragHeaderIng)return;const{ENABLE_SELECTOR:e,ENABLE_SELECTOR_SINGLE:t}=this.ctx.config;let r=-1,s=-1;if(this.ctx.focusCellHeader&&(r=this.ctx.focusCellHeader.colIndex,s=this.ctx.focusCellHeader.colIndex+this.ctx.focusCellHeader.colspan-1),e&&!t){const{xArr:o}=this.ctx.selector;r=o[0],s=o[1]}const n=this.colspan+this.colIndex-1;this.colIndex>=r&&this.colIndex<=s&&n<=s&&this.ctx.paint.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:"transparent",fillColor:this.ctx.config.SELECT_ROW_COL_BG_COLOR||"transparent"})}drawSelection(){if(!this.hideHeaderSelection&&["index-selection","selection","selection-tree","tree-selection"].includes(this.type)){const{indeterminate:e,check:t,selectable:r}=this.ctx.database.getCheckedState(),{CHECKBOX_SIZE:s=0,CELL_PADDING:n}=this.ctx.config;let o=this.drawX+(this.width-s)/2,a=this.drawY+(this.height-s)/2;this.drawTextX=o+s-n/2,this.drawTextWidth=this.drawX+this.visibleWidth-this.drawTextX,(this.align==="left"||this.align==="right")&&(o=this.drawX+n,this.drawTextX=o+s-n/2,this.drawTextWidth=this.drawX+this.visibleWidth-this.drawTextX),this.verticalAlign==="top"?a=this.drawY+n/2:this.verticalAlign==="bottom"&&(a=this.drawY+this.height-s-n/2);let l=this.ctx.icons.get("checkbox-uncheck"),d="checkbox-uncheck";e?(l=this.ctx.icons.get("checkbox-indeterminate"),d="checkbox-indeterminate"):t&&r?(l=this.ctx.icons.get("checkbox-check"),d="checkbox-check"):t&&!r?(l=this.ctx.icons.get("checkbox-check-disabled"),d="checkbox-check-disabled"):!t&&r?(l=this.ctx.icons.get("checkbox-uncheck"),d="checkbox-uncheck"):(l=this.ctx.icons.get("checkbox-disabled"),d="checkbox-disabled"),l&&(this.drawSelectionImageX=o,this.drawSelectionImageY=a,this.drawSelectionImageWidth=s,this.drawSelectionImageHeight=s,this.drawSelectionImageName=d,this.drawSelectionImageSource=l,this.ctx.paint.drawImage(this.drawSelectionImageSource,this.drawSelectionImageX,this.drawSelectionImageY,this.drawSelectionImageWidth,this.drawSelectionImageHeight))}}drawSortIcon(){if(!this.column.sortBy)return;const e=16;let t=this.sortIconName;const r=this.ctx.database.getSortState(this.key);r.direction==="asc"?t=this.sortAscIconName:r.direction==="desc"&&(t=this.sortDescIconName);const s=this.ctx.icons.get(t);s&&(this.drawSortImageWidth=e,this.drawSortImageHeight=e,this.drawSortImageName=t,this.drawSortImageSource=s,this.ctx.paint.drawImage(this.drawSortImageSource,this.drawSortImageX,this.drawSortImageY,this.drawSortImageWidth,this.drawSortImageHeight))}getText(){return this.render||["",null,void 0].includes(this.text)?"":`${this.text}`}getOverlayerViewsStyle(){let e="";return this.fixed==="left"?e=`${this.drawX}px`:this.fixed==="right"?e=`${this.drawX-(this.ctx.stageWidth-this.ctx.fixedRightWidth)}px`:e=`${this.drawX-this.ctx.fixedLeftWidth}px`,{position:"absolute",overflow:"hidden",left:e,top:`${this.drawY+1}px`,width:`${this.width}px`,height:`${this.height-2}px`,pointerEvents:"initial",userSelect:"none"}}}class bb{constructor(e){h(this,"ctx"),h(this,"visibleHoverCell"),h(this,"resizeObserver"),h(this,"mutationObserver"),this.ctx=e,this.init()}init(){this.resizeObserver=new ResizeObserver(e=>{this.ctx.emit("resetHeader"),this.ctx.emit("resizeObserver",e),this.ctx.emit("containerResize",this.ctx.containerElement)}),this.resizeObserver.observe(this.ctx.containerElement),this.mutationObserver=new MutationObserver(e=>{for(const t of e)t.type==="attributes"&&t.attributeName==="class"&&(this.ctx.config.updateCssVar(),this.ctx.emit("draw"))}),this.ctx.config.ENABLE_AUTO_THEME&&this.mutationObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),this.ctx.on("mousedown",e=>{if(this.isBusy(e))return;const{offsetY:t,offsetX:r}=this.ctx.getOffset(e),s=t,n=r,{body:{height:o,visibleHeight:a,visibleWidth:l,y:d}}=this.ctx,u=Math.min(o,a);n>0&&n<l&&s>d&&s<d+u||this.ctx.emit("mousedownBodyOutside",e),e.button===0&&(this.handleHeaderEvent(n,s,this.ctx.header.renderCellHeaders,f=>{this.ctx.focusCellHeader=f,this.ctx.focusCell=void 0,this.ctx.emit("cellHeaderMousedown",f,e)}),this.handleBodyEvent(n,s,this.ctx.body.renderRows,f=>{this.ctx.setFocusCell(f),this.ctx.focusCellHeader=void 0,this.ctx.emit("cellMousedown",f,e)}))}),this.ctx.on("mouseup",e=>{if(e.button!==0||this.isBusy(e))return;const{offsetY:t,offsetX:r}=this.ctx.getOffset(e),s=t,n=r;this.handleHeaderEvent(n,s,this.ctx.header.renderCellHeaders,o=>{this.ctx.focusCellHeader=o,this.ctx.emit("cellHeaderMouseup",o,e)}),this.handleBodyEvent(n,s,this.ctx.body.renderRows,o=>{this.ctx.setFocusCell(o),this.ctx.emit("cellMouseup",o,e)})}),this.ctx.on("click",e=>{if(e.button!==0||this.isBusy(e))return;const t=this.ctx.getOffset(e).offsetY,r=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(r,t,this.ctx.header.renderCellHeaders,s=>{this.ctx.clickCellHeader=s,this.ctx.emit("cellHeaderClick",s,e),this.selectionClick(s,e),this.sortClick(s,e)}),this.handleBodyEvent(r,t,this.ctx.body.renderRows,s=>{this.ctx.clickCell=s,this.ctx.emit("cellClick",s,e),this.selectionClick(s,e),this.treeClick(s,e)},!0),this.handleBodyEvent(r,t,this.ctx.body.renderRows,s=>{this.hoverIconClick(s)},!1)}),this.ctx.on("dblclick",e=>{if(e.button!==0||this.isBusy(e))return;const t=this.ctx.getOffset(e).offsetY,r=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(r,t,this.ctx.header.renderCellHeaders,s=>{this.ctx.emit("cellHeaderDblclick",s,e)}),this.handleBodyEvent(r,t,this.ctx.body.renderRows,s=>{this.ctx.clickCell=s,this.ctx.emit("cellDblclick",s,e)})}),this.ctx.on("contextMenu",e=>{if(this.isBusy(e))return;const{offsetY:t,offsetX:r}=this.ctx.getOffset(e),s=t,n=r;this.handleHeaderEvent(n,s,this.ctx.header.renderCellHeaders,o=>{this.ctx.emit("cellHeaderContextMenuClick",o,e)}),this.handleBodyEvent(n,s,this.ctx.body.renderRows,o=>{this.ctx.emit("cellContextMenuClick",o,e)})}),this.ctx.on("mouseout",e=>{!this.ctx.containerElement.contains(e.relatedTarget)&&this.ctx.hoverCell!==void 0&&(this.ctx.hoverRow=void 0,this.ctx.hoverCell=void 0,this.ctx.emit("draw"))}),this.ctx.on("mousemove",e=>{if(this.isBusy(e))return;this.ctx.isPointer=!1,this.ctx.stageElement.style.cursor==="pointer"&&(this.ctx.stageElement.style.cursor="default");const t=this.ctx.getOffset(e).offsetY,r=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(r,t,this.ctx.header.renderCellHeaders,s=>{this.ctx.emit("cellHeaderMouseenter",s,e),this.ctx.hoverCellHeader&&this.ctx.hoverCellHeader!==s&&this.ctx.emit("cellHeaderMouseleave",this.ctx.hoverCellHeader,e),this.imageEnterAndLeave(s,e),this.ctx.hoverCellHeader!==s&&(this.ctx.hoverCellHeader=s,this.visibleHoverCell=void 0,this.ctx.emit("cellHeaderHoverChange",s,e))}),this.handleBodyEvent(r,t,this.ctx.body.renderRows,s=>{this.imageEnterAndLeave(s,e),this.visibleHoverCell!==s&&(this.ctx.emit("visibleCellMouseleave",s,e),this.visibleHoverCell=s,this.ctx.hoverCellHeader=void 0,this.ctx.emit("visibleCellHoverChange",s,e))},!0),this.handleBodyEvent(r,t,this.ctx.body.renderRows,s=>{var n;this.imageEnterAndLeave(s,e),this.ctx.emit("cellMouseenter",s,e),this.ctx.hoverCell&&this.ctx.hoverCell!==s&&this.ctx.emit("cellMouseleave",s,e),this.ctx.hoverCell!==s&&(((n=this.ctx.hoverCell)==null?void 0:n.rowKey)!==s.rowKey&&(this.ctx.hoverCell=s,this.ctx.hoverRow=this.ctx.body.renderRows.find(o=>o.rowKey===s.rowKey),this.ctx.emit("rowHoverChange",this.ctx.hoverRow,s,e),this.ctx.emit("draw")),this.ctx.hoverCell=s,this.ctx.emit("cellHoverChange",s,e))}),this.handleFooterEvent(r,t,this.ctx.footer.renderRows,s=>{this.ctx.emit("cellFooterMouseenter",s,e),this.ctx.hoverCell&&this.ctx.hoverCell!==s&&this.ctx.emit("cellFooterMouseleave",s,e),this.ctx.emit("cellFooterHoverChange",s,e)})})}hoverIconClick(e){e.hoverIconName&&this.ctx.isPointer&&!this.ctx.disableHoverIconClick&&this.ctx.emit("hoverIconClick",e)}selectionClick(e,t){if(!(["selection","index-selection","selection-tree","tree-selection"].includes(e.type)&&this.ctx.isPointer))return;const{offsetY:r,offsetX:s}=this.ctx.getOffset(t),n=r,o=s;if(this.isInsideElement(o,n,e.drawSelectionImageX,e.drawSelectionImageY,e.drawSelectionImageWidth,e.drawSelectionImageHeight))if(e instanceof vr)e.drawSelectionImageName==="checkbox-uncheck"||e.drawSelectionImageName==="checkbox-indeterminate"?this.ctx.database.toggleAllSelection():e.drawSelectionImageName==="checkbox-check"&&this.ctx.database.clearSelection(!0);else{if(!this.ctx.database.getRowSelectable(e.rowKey))return;this.ctx.database.toggleRowSelection(e.rowKey,e.type)}}treeClick(e,t){if(!(["tree","selection-tree","tree-selection"].includes(e.type)&&this.ctx.isPointer))return;const{offsetY:r,offsetX:s}=this.ctx.getOffset(t),n=r,o=s;if(!this.isInsideElement(o,n,e.drawTreeImageX,e.drawTreeImageY,e.drawTreeImageWidth,e.drawTreeImageHeight))return;const a=this.ctx.database.getRowForRowKey(e.rowKey),{expand:l=!1,expandLazy:d=!1}=a||{},{EXPAND_LAZY:u,EXPAND_LAZY_METHOD:f}=this.ctx.config;if(u&&f&&!l&&!d)typeof f=="function"&&(this.ctx.database.expandLoading(e.rowKey,!0),f({row:e.row,rowIndex:e.rowIndex,colIndex:e.colIndex,column:e.column,value:e.getValue()}).then(g=>{this.ctx.database.setExpandChildren(e.rowKey,g),this.ctx.database.expandLoading(e.rowKey,!1),this.ctx.emit("expandChange",this.ctx.database.getExpandRowKeys())}).catch(g=>{this.ctx.database.expandLoading(e.rowKey,!1),console.error(g)}));else{const g=this.ctx.database.getIsExpand(e.rowKey);this.ctx.database.expandItem(e.rowKey,!g),this.ctx.emit("expandChange",this.ctx.database.getExpandRowKeys())}}sortClick(e,t){const{offsetY:r,offsetX:s}=this.ctx.getOffset(t),n=r,o=s;if(!this.isInsideElement(o,n,e.drawSortImageX,e.drawSortImageY,e.drawSortImageWidth,e.drawSortImageHeight))return;const a=this.ctx.database.getSortState(e.key);let l;a.direction==="none"?l="asc":a.direction==="asc"?l="desc":l="none",this.ctx.database.setSortState(e.key,l)}imageEnterAndLeave(e,t){const{offsetY:r,offsetX:s}=this.ctx.getOffset(t),n=r,o=s;if(e instanceof vr){if(e.drawSelectionImageSource&&this.isInsideElement(o,n,e.drawSelectionImageX,e.drawSelectionImageY,e.drawSelectionImageWidth,e.drawSelectionImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}if(e.drawSortImageSource&&this.isInsideElement(o,n,e.drawSortImageX,e.drawSortImageY,e.drawSortImageWidth,e.drawSortImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}}if(e instanceof Pr){if(e.drawSelectionImageSource&&this.isInsideElement(o,n,e.drawSelectionImageX,e.drawSelectionImageY,e.drawSelectionImageWidth,e.drawSelectionImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0,this.ctx.database.getRowSelectable(e.rowKey)||(this.ctx.stageElement.style.cursor="not-allowed");return}if(e.drawHoverImageSource&&this.isInsideElement(o,n,e.drawHoverImageX,e.drawHoverImageY,e.drawHoverImageWidth,e.drawHoverImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}if(e.drawTreeImageSource&&this.isInsideElement(o,n,e.drawTreeImageX,e.drawTreeImageY,e.drawTreeImageWidth,e.drawTreeImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}}}isInsideElement(e,t,r,s,n,o){return e>r&&e<r+n&&t>s&&t<s+o}isBusy(e){const{offsetY:t,offsetX:r}=this.ctx.getOffset(e),s=t,n=r;if(this.ctx.loading||!this.ctx.isTarget(e)||this.ctx.stageElement.style.cursor==="row-resize"||this.ctx.stageElement.style.cursor==="col-resize"||this.ctx.columnResizing||this.ctx.rowResizing)return!0;const{SCROLLER_TRACK_SIZE:o}=this.ctx.config;return!!(this.ctx.scrollerMove||this.ctx.scrollerFocus||s>this.ctx.stageHeight-o||n>this.ctx.stageWidth-o)}handleBodyEvent(e,t,r,s,n=!1){if(this.isInsideBody(t))for(const o of r){const a=o.fixedCells.concat(o.noFixedCells);for(const l of a){const d=l.getDrawX(),u=l.getDrawY();if(n){if(e>d&&e<d+l.visibleWidth&&t>u&&t<u+l.visibleHeight){s(l);return}}else if(e>d&&e<d+l.width&&t>u&&t<u+l.height){s(l);return}}}}handleHeaderEvent(e,t,r,s){for(const n of r){const o=n.getDrawX(),a=n.getDrawY();if(e>o&&e<o+n.width&&t>a&&t<a+n.height){s(n);return}}}handleFooterEvent(e,t,r,s,n=!1){for(const o of r){const a=o.fixedCells.concat(o.noFixedCells);for(const l of a){const d=l.getDrawX(),u=l.getDrawY();if(n){if(e>d&&e<d+l.visibleWidth&&t>u&&t<u+l.visibleHeight){s(l);return}}else if(e>d&&e<d+l.width&&t>u&&t<u+l.height){s(l);return}}}}isInsideBody(e){return e>this.ctx.body.y&&e<this.ctx.body.y+this.ctx.body.visibleHeight}destroy(){this.resizeObserver.unobserve(this.ctx.stageElement),this.mutationObserver.disconnect()}}class _b{constructor(e,t){h(this,"eventBus"),h(this,"eventBrowser"),h(this,"eventTable"),h(this,"containerElement"),h(this,"stageElement"),h(this,"canvasElement"),h(this,"overlayerElement"),h(this,"editorElement"),h(this,"emptyElement"),h(this,"contextMenuElement"),h(this,"loadingElement"),h(this,"stageWidth",0),h(this,"stageHeight",0),h(this,"paint"),h(this,"icons"),h(this,"domSelectionStr",""),h(this,"isMouseoverTargetContainer",!1),h(this,"mousedown",!1),h(this,"isPointer",!1),h(this,"isEmpty",!1),h(this,"rowResizing",!1),h(this,"columnResizing",!1),h(this,"scrollerMove",!1),h(this,"scrollerFocus",!1),h(this,"autofillMove",!1),h(this,"selectorMove",!1),h(this,"disableHoverIconClick",!1),h(this,"selectColsIng",!1),h(this,"selectRowsIng",!1),h(this,"dragHeaderIng",!1),h(this,"finding",!1),h(this,"contextMenuIng",!1),h(this,"editing",!1),h(this,"loading",!1),h(this,"onlyMergeCell",!1),h(this,"selectOnlyOne",!1),h(this,"hasSelection",!1),h(this,"hasTree",!1),h(this,"scrollY",0),h(this,"scrollX",0),h(this,"fixedLeftWidth",0),h(this,"fixedRightWidth",0),h(this,"lastCenterColIndex",0),h(this,"maxColIndex",0),h(this,"maxRowIndex",0),h(this,"hoverRow"),h(this,"clickCell"),h(this,"focusCell"),h(this,"currentCell"),h(this,"hoverCell"),h(this,"clickCellHeader"),h(this,"focusCellHeader"),h(this,"hoverCellHeader"),h(this,"mouseX",0),h(this,"mouseY",0),h(this,"body",{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,headIndex:0,tailIndex:0,visibleRows:[],renderRows:[],data:[]}),h(this,"footer",{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,renderRows:[]}),h(this,"header",{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,visibleLeafColumns:[],leafCellHeaders:[],allCellHeaders:[],renderLeafCellHeaders:[],renderCellHeaders:[],fixedLeftCellHeaders:[],fixedRightCellHeaders:[],renderCenterCellHeaders:[]}),h(this,"selector",{enable:!1,xArr:[-1,-1],yArr:[-1,-1],xArrCopy:[-1,-1],yArrCopy:[-1,-1]}),h(this,"autofill",{enable:!1,xArr:[-1,-1],yArr:[-1,-1]}),h(this,"finderBar",{text:"",rowIndex:-1,colIndex:-1,type:"body"}),h(this,"database"),h(this,"history"),h(this,"config");const{containerElement:r,stageElement:s,canvasElement:n,overlayerElement:o,editorElement:a,emptyElement:l,loadingElement:d,contextMenuElement:u}=e;this.containerElement=r,s.tabIndex=0,this.stageElement=s,this.canvasElement=n,this.overlayerElement=o,this.editorElement=a,this.emptyElement=l,this.loadingElement=d,this.contextMenuElement=u,this.config=new Bn(t.config||{}),this.eventBus=new pb,this.eventBrowser=new xb(this),this.eventTable=new bb(this),this.paint=new yb(this.canvasElement),this.database=new vb(this,t),this.history=new mb(this),this.icons=new Cb(this)}setConfig(e){this.config=new Bn(e)}setItemValueByEditor(e,t,r,s=!0,n=!0,o=!0){if(this.config.ENABLE_MERGE_CELL_LINK){const a=this.database.getVirtualBodyCellByKey(e,t);if(a&&(a.mergeRow||a.mergeCol)){const{dataList:l}=a.getSpanInfo(),d=l.map(u=>({...u,value:r}));this.database.batchSetItemValue(d,s,o);return}}this.database.setItemValue(e,t,r,s,n,!0,o)}batchSetItemValueByEditor(e,t=!0,r=!0){if(this.config.ENABLE_MERGE_CELL_LINK){const s=[];e.forEach(n=>{const o=this.database.getRowIndexForRowKey(n.rowKey),a=this.database.getColIndexForKey(n.key);if(o===void 0||a===void 0)return;const l=this.database.getVirtualBodyCell(o,a);if(l){const{dataList:d}=l.getSpanInfo(),u=d.map(f=>({...f,value:n.value}));s.push(...u)}}),this.database.batchSetItemValue(s,t,r)}else this.database.batchSetItemValue(e,t,r)}setFocusCell(e){var t;if(this.focusCell!==e){if(((t=this.focusCell)==null?void 0:t.rowKey)!==e.rowKey){this.currentCell=e,this.emit("rowFocusChange",e);const r={rowIndex:e.rowIndex,rowKey:e.rowKey,row:e.row};this.emit("currentRowChange",r)}this.focusCell=e,this.emit("cellFocusChange",e)}}clearSelector(){this.selector.enable=!1,this.selector.xArr=[-1,-1],this.selector.yArr=[-1,-1],this.emit("clearSelector")}clearSelectorCopy(){this.selector.xArrCopy=[-1,-1],this.selector.yArrCopy=[-1,-1]}clearAutofill(){this.autofill={enable:!1,xArr:[-1,-1],yArr:[-1,-1]}}getSelectedData(){const e=[],t=this.selector.yArr,r=this.selector.xArr;let s="";for(let n=0;n<=t[1]-t[0];n++){const o=[];for(let a=0;a<=r[1]-r[0];a++){const l=n+t[0],d=a+r[0],u=this.database.getVirtualBodyCell(l,d);u&&(u.selectorCellValueType==="displayText"?o.push(u.displayText):o.push(u.getValue()))}s+=`${o.join(" ")}\r`,e.push(o)}return s=s?s.replace(/\r$/,""):" ",{xArr:r,yArr:t,text:s,value:e}}setScroll(e,t){let r=Math.floor(e);const s=this.body.width-this.body.visibleWidth;r<0?r=0:r>s&&(r=s);let n=Math.floor(t),o=this.body.height-this.body.visibleHeight;this.config.FOOTER_FIXED||(o=this.body.height+this.footer.height-this.body.visibleHeight),n<0?n=0:n>o&&(n=o),this.emit("setScroll",r,n)}setScrollX(e){let t=Math.floor(e);const r=this.body.width-this.body.visibleWidth;t<0?t=0:t>r&&(t=r),this.emit("setScrollX",t)}setScrollY(e){let t=Math.floor(e),r=0;this.config.FOOTER_FIXED||(r=this.footer.height);const s=this.body.height-this.body.visibleHeight+r;t<0?t=0:t>s&&(t=s),this.emit("setScrollY",t)}startAdjustPosition(e){this.emit("startAdjustPosition",e)}stopAdjustPosition(){this.emit("stopAdjustPosition")}isTarget(e){return!!this.containerElement.contains(e.target)}getOffset(e){const{left:t,top:r}=this.containerElement.getBoundingClientRect();return{offsetX:e.clientX-t,offsetY:e.clientY-r}}hasEvent(e){return this.eventBus.has(e)}on(e,t){this.eventBus.on(e,t)}once(e,t){this.eventBus.once(e,t)}off(e,t){this.eventBus.off(e,t)}emit(e,...t){this.eventBus.emit(e,...t)}destroy(){this.eventTable.destroy(),this.eventBrowser.destroy(),this.eventBus.destroy()}}class Kn{constructor(e,t){h(this,"ctx"),h(this,"type"),h(this,"isFocus",!1),h(this,"trackX",0),h(this,"trackY",0),h(this,"trackWidth",0),h(this,"trackHeight",0),h(this,"splitPoints",[]),h(this,"barX",0),h(this,"barY",0),h(this,"barWidth",0),h(this,"barHeight",0),h(this,"distance",0),h(this,"visibleDistance",0),h(this,"clientX",0),h(this,"clientY",0),h(this,"dragStart",0),h(this,"isDragging",!1),h(this,"scroll",0),this.ctx=e,this.type=t,this.type==="vertical"?this.scroll=this.ctx.scrollY:this.scroll=this.ctx.scrollX}onWheel(e){this.updateScroll(e)}onTouchmove(e){const{clientY:t,clientX:r}=e.touches[0],s=t-this.clientY,n=r-this.clientX;let o=0;this.type==="vertical"?(o=Math.max(0,Math.min(this.dragStart-s,this.distance)),this.hasScrollbar()&&!(o===0&&s>0||o===this.distance&&s<0)&&e.preventDefault()):this.type==="horizontal"&&(o=Math.max(0,Math.min(this.dragStart-n,this.distance))),this.scroll=o}onTouchstart(e){const{clientY:t,clientX:r}=e.touches[0];this.clientX=r,this.clientY=t,this.dragStart=this.scroll}onMouseDown(e){if(!(e.target instanceof Element)||!this.ctx.isTarget(e))return;if(this.ctx.stageElement.style.cursor==="row-resize"||this.ctx.stageElement.style.cursor==="col-resize")return!0;const{offsetX:t,offsetY:r,clientX:s,clientY:n}=e;if(!(s==this.clientX&&n==this.clientY)){if(this.isOnScrollbar(t,r))this.clientX=s,this.clientY=n,this.isDragging=!0,this.ctx.scrollerMove=!0,this.isFocus=!0,this.dragStart=this.scroll,e.preventDefault();else if(this.isOnTrack(t,r)){let o=0;this.type==="vertical"?o=(r-this.ctx.header.height-this.barHeight/2)/(this.visibleDistance-this.barHeight)*this.distance:o=(t-this.barWidth/2)/(this.visibleDistance-this.barWidth)*this.distance,this.scroll=Math.max(0,Math.min(o,this.distance))}}}onMouseUp(){this.isDragging=!1,this.isFocus=!1,this.clientX=0,this.clientY=0}onMouseMove(e){const{offsetX:t,offsetY:r,clientX:s,clientY:n,buttons:o}=e;if(this.isOnScrollbar(t,r)&&e.target===this.ctx.canvasElement?this.isFocus=!0:this.isFocus=!1,o===0||s==this.clientX&&n==this.clientY)return;let a=0;if(this.type==="horizontal"?a=s-this.clientX:a=n-this.clientY,this.isDragging&&a!==0){let l=0;this.type==="vertical"?l=this.dragStart+a/(this.visibleDistance-this.barHeight)*this.distance:l=this.dragStart+a/(this.visibleDistance-this.barWidth)*this.distance,this.scroll=Math.max(0,Math.min(l,this.distance))}}isPointInElement(e,t,r,s,n,o){return e>=r&&e<=r+n&&t>=s&&t<=s+o}hasScrollbar(){return this.type==="vertical"?this.barHeight>0:this.type==="horizontal"?this.barWidth>0:!1}isOnScrollbar(e,t){return this.isPointInElement(e,t,this.barX,this.barY,this.barWidth,this.barHeight)}isOnTrack(e,t){return this.isPointInElement(e,t,this.trackX,this.trackY,this.trackWidth,this.trackHeight)}updateScroll(e){const t=e.deltaX,r=e.deltaY;this.type==="vertical"&&e.shiftKey===!1?(this.hasScrollbar()&&!(this.scroll===0&&r<0||this.scroll===this.distance&&r>0)&&e.preventDefault(),this.scroll=Math.max(0,Math.min(this.scroll+r,this.distance))):this.type==="horizontal"&&(e.shiftKey?this.scroll=Math.max(0,Math.min(this.scroll+r,this.distance)):this.scroll=Math.max(0,Math.min(this.scroll+t,this.distance)))}updatedSize(){const{body:e,header:t,stageHeight:r,stageWidth:s,config:{SCROLLER_TRACK_SIZE:n=0,SCROLLER_SIZE:o=0,BORDER:a}}=this.ctx,l=s,d=r,u=t.height,f=t.width,g=e.height,m=this.ctx.footer.height;if(this.type==="vertical"){this.visibleDistance=d-n-u,this.distance=g-this.visibleDistance+m,this.trackX=l-n,this.trackY=0,this.splitPoints=[this.trackX,u,this.trackX+n,u],this.trackWidth=n,this.trackHeight=d,this.barX=this.trackX-1+(n-o)/2,this.barWidth=o;const x=this.distance?this.visibleDistance/(g+m):0;let v=Math.floor(x*this.visibleDistance);v<30?v=30:v>this.visibleDistance&&(v=0),this.barHeight=v,this.barY=u+this.scroll/this.distance*(this.visibleDistance-this.barHeight),this.scroll=Math.max(0,Math.min(this.scroll,this.distance))}else{this.visibleDistance=l-n,this.distance=f-this.visibleDistance,this.splitPoints=[l-n,d-n,l-n,d];const x=a?0:.5;this.trackX=0,this.trackY=d-n+x,this.trackWidth=l,this.trackHeight=n;const v=this.distance?this.visibleDistance/f:0;let p=Math.floor(v*this.visibleDistance);this.barY=this.trackY-1+(n-o)/2,p<30?p=30:p>=this.visibleDistance&&(p=0),this.barWidth=p,this.barHeight=o,this.barX=this.scroll/this.distance*(this.visibleDistance-this.barWidth),this.scroll=Math.max(0,Math.min(this.scroll,this.distance))}}draw(){const{config:{SCROLLER_FOCUS_COLOR:e,SCROLLER_COLOR:t,BORDER_COLOR:r,BORDER:s,SCROLLER_TRACK_COLOR:n}}=this.ctx;this.updatedSize();let o=r;s||(o="transparent"),this.ctx.paint.drawRect(this.trackX,this.trackY,this.trackWidth,this.trackHeight,{borderColor:o,fillColor:n}),this.ctx.paint.drawRect(this.barX,this.barY,this.barWidth,this.barHeight,{fillColor:this.isFocus||this.isDragging?e:t,radius:4}),this.splitPoints.length>0&&this.ctx.paint.drawLine(this.splitPoints,{borderColor:o,borderWidth:1}),this.ctx.scrollerFocus=this.isFocus}}class Rb{constructor(e){h(this,"ctx"),h(this,"verticalScrollbar"),h(this,"horizontalScrollbar"),h(this,"mousedownHeader",!1),h(this,"adjustPositionX",""),h(this,"adjustPositionY",""),h(this,"timerX",0),h(this,"timerY",0),this.ctx=e,this.verticalScrollbar=new Kn(e,"vertical"),this.horizontalScrollbar=new Kn(e,"horizontal"),this.ctx.on("wheel",t=>this.onWheel(t)),this.ctx.on("mousedown",t=>this.onMouseDown(t)),this.ctx.on("mousemove",t=>this.onMouseMove(t)),this.ctx.on("mouseup",()=>this.onMouseUp()),this.ctx.on("touchmove",t=>this.onTouchmove(t)),this.ctx.on("touchstart",t=>{this.onTouchstart(t)}),this.ctx.on("setScroll",(t,r)=>{this.setScroll(t,r)}),this.ctx.on("setScrollX",t=>{this.setScrollX(t)}),this.ctx.on("setScrollY",t=>{this.setScrollY(t)}),this.ctx.on("scrollToIndex",(t,r)=>{this.scrollToIndex(t,r)}),this.ctx.on("cellHeaderMousedown",()=>{this.mousedownHeader=!0}),this.ctx.on("startAdjustPosition",t=>{this.startAdjustPosition(t)}),this.ctx.on("stopAdjustPosition",()=>{this.stopAdjustPosition()})}onWheel(e){this.verticalScrollbar.onWheel(e),this.horizontalScrollbar.onWheel(e),this.draw()}onTouchmove(e){this.verticalScrollbar.onTouchmove(e),this.horizontalScrollbar.onTouchmove(e),this.draw()}onTouchstart(e){this.verticalScrollbar.onTouchstart(e),this.horizontalScrollbar.onTouchstart(e),this.draw()}onMouseDown(e){this.verticalScrollbar.onMouseDown(e),this.horizontalScrollbar.onMouseDown(e),this.draw()}onMouseMove(e){this.verticalScrollbar.onMouseMove(e),this.horizontalScrollbar.onMouseMove(e),this.draw()}onMouseUp(){this.mousedownHeader=!1,this.verticalScrollbar.onMouseUp(),this.horizontalScrollbar.onMouseUp(),this.ctx.scrollerMove=!1}draw(){this.verticalScrollbar.draw(),this.horizontalScrollbar.draw();const e=Math.floor(this.horizontalScrollbar.scroll),t=Math.floor(this.verticalScrollbar.scroll);(e!==this.ctx.scrollX||t!==this.ctx.scrollY)&&(this.ctx.emit("onScroll",e,t),e!==this.ctx.scrollX&&this.ctx.emit("onScrollX",e),t!==this.ctx.scrollY&&this.ctx.emit("onScrollY",t),this.ctx.scrollX=e,this.ctx.scrollY=t,this.ctx.emit("draw"))}setScroll(e,t){this.horizontalScrollbar.scroll=e,this.verticalScrollbar.scroll=t,this.ctx.emit("draw"),this.ctx.emit("onScroll",e,t)}setScrollX(e){this.horizontalScrollbar.scroll=e,this.ctx.emit("draw")}setScrollY(e){this.verticalScrollbar.scroll=e,this.ctx.emit("draw")}scrollToColkey(e){const{header:t}=this.ctx,r=t.leafCellHeaders.find(s=>s.key===e);r&&this.setScrollX(r.x-t.visibleWidth/2)}scrollToColIndex(e){const{header:t}=this.ctx,r=t.leafCellHeaders.find(s=>s.colIndex===e);r&&this.setScrollX(r.x-t.visibleWidth/2)}scrollToRowIndex(e){const{body:t,database:r}=this.ctx,{top:s}=r.getPositionForRowIndex(e);this.setScrollY(s-t.visibleHeight/2)}scrollToIndex(e,t){this.scrollToRowIndex(e),this.scrollToColIndex(t)}scrollToRowKey(e){const{body:t,database:r}=this.ctx,s=r.getRowIndexForRowKey(e);if(s===void 0)return;const{top:n}=r.getPositionForRowIndex(s);this.setScrollY(n-t.visibleHeight/2)}startAdjustPosition(e){var t,r;const{offsetX:s,offsetY:n}=this.ctx.getOffset(e);let o="",a="";if(((t=this.ctx.focusCell)==null?void 0:t.fixed)!=="left"&&s<this.ctx.fixedLeftWidth?o="left":((r=this.ctx.focusCell)==null?void 0:r.fixed)!=="right"&&s>this.ctx.body.visibleWidth-this.ctx.fixedRightWidth?o="right":(o="",this.stopAdjustPosition(!0,!1)),!this.mousedownHeader&&n<this.ctx.header.visibleHeight?a="top":n>this.ctx.header.visibleHeight+this.ctx.body.visibleHeight?a="bottom":(a="",this.stopAdjustPosition(!1,!0)),o&&this.adjustPositionX!==o){this.adjustPositionX=o;let l=10*(o==="left"?-1:1);this.timerX&&(clearInterval(this.timerX),this.timerX=0),this.timerX=setInterval(()=>{l*=1.5;const{scrollX:d}=this.ctx,u=d+l;(u<0||u>this.ctx.body.width)&&(clearInterval(this.timerX),this.timerX=0),this.ctx.setScrollX(u)},100)}if(a&&this.adjustPositionY!==a){this.adjustPositionY=a;let l=10*(a==="top"?-1:1);this.timerY&&(clearInterval(this.timerY),this.timerY=0),this.timerY=setInterval(()=>{l*=1.5;const{scrollY:d}=this.ctx,u=d+l;(u<0||u>this.ctx.body.height)&&(clearInterval(this.timerY),this.timerY=0),this.ctx.setScrollY(u)},100)}}stopAdjustPosition(e=!0,t=!0){e&&(this.adjustPositionX="",this.timerX&&(clearInterval(this.timerX),this.timerX=0)),t&&(this.adjustPositionY="",this.timerY&&(clearInterval(this.timerY),this.timerY=0))}}class Ib{constructor(e,t){h(this,"root"),h(this,"key"),h(this,"childrenKey"),this.root=e,this.key=(t==null?void 0:t.key)||"key",this.childrenKey=(t==null?void 0:t.childrenKey)||"children"}getTree(){return this.root}treeMove(e,t,r){const s=this.findNodeWithParent(this.root,e[this.key]);if(!s)throw new Error("Source node not found");const{parent:n,index:o,node:a}=s;if(n){const f=n[this.childrenKey];f.splice(o,1),f.length===0&&delete n[this.childrenKey]}else this.root.splice(o,1);const l=this.findNodeWithParent(this.root,t[this.key]);if(!l)throw new Error("Target node not found");const{parent:d,index:u}=l;r==="before"?d?d[this.childrenKey].splice(u,0,a):this.root.splice(u,0,a):r==="after"&&(d?d[this.childrenKey].splice(u+1,0,a):this.root.splice(u+1,0,a))}findNodeWithParent(e,t,r=null){for(let s=0;s<e.length;s++){const n=e[s];if(n[this.key]===t)return{parent:r,index:s,node:n};if(n[this.childrenKey]){const o=this.findNodeWithParent(n[this.childrenKey],t,n);if(o)return o}}return null}}class Sb{constructor(e){h(this,"ctx"),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"resizeTarget",null),h(this,"dragTarget",null),h(this,"dragingCell"),h(this,"dragCellDiff",0),h(this,"resizeNum",0),h(this,"isResizing",!1),h(this,"clientX",0),h(this,"resizeDiff",0),h(this,"columnIndex",0),h(this,"isMouseDown",!1),h(this,"columns"),h(this,"visibleColumns"),h(this,"visibleLeafColumns",[]),h(this,"visibleHeight",0),h(this,"visibleWidth",0),h(this,"allCellHeaders",[]),h(this,"leafCellHeaders",[]),h(this,"renderLeafCellHeaders",[]),h(this,"fixedLeftCellHeaders",[]),h(this,"centerCellHeaders",[]),h(this,"fixedRightCellHeaders",[]),h(this,"renderCenterCellHeaders",[]),h(this,"renderFixedCellHeaders",[]),this.ctx=e,this.ctx.on("resetHeader",Kr(()=>{this.init(),this.ctx.clearSelector(),this.ctx.emit("draw")},100)),this.init(),this.initResizeColumn(),this.initDragColumn()}init(e=!1){const{config:{HEADER_HEIGHT:t,SCROLLER_TRACK_SIZE:r}}=this.ctx;if(!e){const f=this.ctx.database.getColumns();this.columns=f}this.allCellHeaders=[],this.leafCellHeaders=[],this.fixedLeftCellHeaders=[],this.fixedRightCellHeaders=[],this.centerCellHeaders=[],this.visibleColumns=rl(this.columns);const s=Ei(this.visibleColumns),n=Ut(this.visibleColumns);this.height=t*s,this.visibleHeight=this.height,this.width=n.reduce((f,g)=>{const m=g.width||100,{maxWidth:x,minWidth:v}=g;return x&&m>x?f+x:v&&m<v?f+v:f+m},0),this.columnIndex=0,this.resizeNum=0;const o=ab(Ci(this.visibleColumns,s));this.render(o,0),this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);const a=this.ctx.containerElement.getBoundingClientRect();this.resizeNum>0?this.ctx.stageWidth=Math.floor(a.width):this.ctx.stageWidth=Math.min(Math.floor(this.width+r),Math.floor(a.width)),this.ctx.stageElement.style.width=this.ctx.stageWidth+"px",this.visibleWidth=this.ctx.stageWidth-r;const l=this.visibleWidth-this.width;if(this.resizeNum&&l>0){const f=Math.floor(l/this.resizeNum*100)/100;this.resizeAllColumn(f)}const d=this.fixedLeftCellHeaders.filter(f=>!f.hasChildren);this.ctx.fixedLeftWidth=d.reduce((f,g)=>f+g.width,0);const u=this.fixedRightCellHeaders.filter(f=>!f.hasChildren);this.ctx.fixedRightWidth=u.reduce((f,g)=>f+g.width,r),this.ctx.maxColIndex=this.leafCellHeaders.length-1,this.ctx.header.x=this.x,this.ctx.header.y=this.y,this.ctx.header.width=this.width,this.ctx.header.height=this.height,this.ctx.header.allCellHeaders=this.allCellHeaders,this.ctx.header.visibleWidth=this.visibleWidth,this.ctx.header.visibleHeight=this.visibleHeight}initResizeColumn(){this.ctx.on("mousedown",e=>{this.ctx.config.ENABLE_RESIZE_COLUMN&&this.ctx.isTarget(e)&&(this.clientX=e.clientX,this.resizeTarget?(this.isResizing=!0,this.ctx.columnResizing=!0):this.isResizing=!1,this.isMouseDown=!0)}),this.ctx.on("mouseup",()=>{this.ctx.config.ENABLE_RESIZE_COLUMN&&(this.isMouseDown=!1,this.resizeDiff!==0&&this.resizeTarget&&this.resizeColumn(this.resizeTarget,this.resizeDiff),this.resizeTarget=null,this.isResizing=!1,this.isMouseDown=!1,this.ctx.columnResizing=!1,this.clientX=0,this.resizeDiff=0)}),this.ctx.on("mousemove",e=>{if(!this.ctx.config.ENABLE_RESIZE_COLUMN||this.ctx.editing)return;const{stageWidth:t,config:{RESIZE_COLUMN_MIN_WIDTH:r}}=this.ctx;if(this.isResizing&&this.resizeTarget){const s=this.resizeTarget.width,n=this.resizeTarget.minWidth,o=this.resizeTarget.maxWidth;let a=e.clientX-this.clientX;a+s<r&&(a=-(s-r)),n&&a+s<n&&(a=-(s-n)),o&&a+s>o&&(a=o-s),this.resizeDiff=a,this.ctx.emit("draw")}else{if(this.resizeTarget=null,this.isMouseDown)return;if(e.offsetX<0||e.offsetX>this.visibleWidth){this.ctx.stageElement.style.cursor==="col-resize"&&(this.ctx.stageElement.style.cursor="default");return}this.ctx.stageElement.style.cursor==="col-resize"&&(this.ctx.stageElement.style.cursor="default");const s=[...this.renderFixedCellHeaders,...this.renderCenterCellHeaders];for(const n of s){const{offsetX:o,offsetY:a}=this.ctx.getOffset(e),l=o,d=a,u=n.getDrawX(),f=n.getDrawY();if(l>u+n.width-5&&l<u+n.width+4&&l<t-4&&d>f){const g=n.colIndex+n.colspan-1,m=this.leafCellHeaders.find(x=>x.colIndex===g);if(!m||!m.fixed&&this.ctx.stageWidth-this.ctx.fixedRightWidth<u+n.width)return;this.ctx.isTarget(e)&&a<=this.height&&(this.ctx.stageElement.style.cursor="col-resize",this.resizeTarget=m)}}}})}initDragColumn(){this.ctx.on("cellHeaderMousedown",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(e.column.dragDisabled||(this.dragTarget===e?(this.ctx.dragHeaderIng=!0,this.dragCellDiff=this.ctx.mouseX-e.drawX,this.ctx.stageElement.style.cursor="grabbing"):(this.dragTarget=e,this.ctx.dragHeaderIng=!1)))}),this.ctx.on("cellMousedown",()=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(this.dragTarget=null,this.ctx.dragHeaderIng=!1)}),this.ctx.on("mouseup",()=>{if(this.ctx.config.ENABLE_DRAG_COLUMN){if(this.dragingCell&&this.dragTarget){const e=(d,u={})=>(d.forEach((f,g)=>{f.children&&e(f.children,u),u[f.key]=g}),u),t=this.ctx.database.getColumns(),r=Ci(t,Ei(t)),s=new Ib(r,{key:"key",childrenKey:"children"}),n=this.dragTarget.colIndex>this.dragingCell.colIndex?"before":"after";s.treeMove(this.dragTarget.column,this.dragingCell.column,n);const o=s.getTree(),a=e(o);this.ctx.database.setCustomHeader({sortData:a}),this.init();const l={source:this.dragTarget,target:this.dragingCell,columns:r};this.ctx.emit("columnDragChange",l)}this.ctx.dragHeaderIng&&this.dragTarget&&(this.ctx.dragHeaderIng=!1,this.dragTarget=null,this.dragingCell=void 0,this.dragCellDiff=0,this.ctx.clearSelector(),this.ctx.focusCellHeader=void 0,this.ctx.stageElement.style.cursor="default",this.ctx.emit("draw"))}}),this.ctx.on("mousemove",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(!this.ctx.dragHeaderIng||!this.dragTarget||(this.dragTarget.fixed||this.ctx.startAdjustPosition(e),this.ctx.emit("draw")))}),this.ctx.on("cellHoverChange",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(e.column.dragDisabled||(this.dragingCell=this.getDragCellHeader(e.colIndex)))}),this.ctx.on("cellHeaderHoverChange",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(e.column.dragDisabled||(this.dragingCell=this.getDragCellHeader(e.colIndex)))})}getDragCellHeader(e){if(!this.dragTarget||!this.ctx.dragHeaderIng)return;const{column:{parentKey:t},key:r,level:s,fixed:n}=this.dragTarget,o=this.allCellHeaders.find(a=>a.key!==r&&a.fixed===n&&a.column.level===s&&a.column.parentKey===t&&a.colIndex<=e&&a.colIndex+a.colspan-1>=e);if(this.ctx.dragHeaderIng){const a=o?"grabbing":"not-allowed";this.ctx.stageElement.style.cursor=a}return o}resizeColumn(e,t){const r=o=>{o.forEach(a=>{if(a.children&&a.children.length>0&&r(a.children),a.key===e.key){const l=a.width||100;a.width=l+t}})};r(this.columns);let s=0;if(this.width<this.visibleWidth){const o=this.visibleWidth-this.width;s=Math.floor(o/this.resizeNum*100)/100,this.resizeAllColumn(s)}const n=e.width+t+s;this.ctx.emit("resizeColumnChange",{colIndex:e.colIndex,key:e.key,oldWidth:e.width,width:n,column:e.column,columns:this.columns}),this.ctx.database.setCustomHeaderResizableData(e.key,n),this.init(!0),this.ctx.emit("draw")}resizeAllColumn(e){if(e===0)return;const t=new Map;let r=!0;for(const n of this.allCellHeaders)if(n.widthFillDisable)t.set(n.key,n.width);else{const o=n.width+e*n.colspan;t.set(n.key,o),o<this.ctx.config.RESIZE_COLUMN_MIN_WIDTH&&(r=!1)}if(!r)return;const s=n=>{n.forEach(o=>{t.has(o.key)&&(o.width=t.get(o.key)),o.children&&o.children.length>0&&s(o.children)})};s(this.columns),this.init(!0),this.ctx.emit("draw")}getCustomHeader(){const e=this.ctx.database.getColumns(),t=this.ctx.database.getCustomHeader(),{sortData:r={}}=t;return Object.keys(r).length===0?{columns:e,customHeader:t}:{columns:Ci(e,Ei(e)),customHeader:t}}render(e,t){const r=e.length;let s=t;const{HEADER_HEIGHT:n=0}=this.ctx.config;for(let o=0;o<r;o++){const a=e[o],l=n*(a.rowspan||0),d=n*(a.level||0);let{minWidth:u,maxWidth:f}=a,g=a.width||100;u&&g<u&&(g=u),f&&g>f&&(g=f),a.children&&(g=Ut(a.children).reduce((x,v)=>x+((v==null?void 0:v.width)||100),0));const m=new vr(this.ctx,this.columnIndex,s,d,g,l,a);this.ctx.database.setHeader(a.key,m),this.allCellHeaders.push(m),a.children||(this.leafCellHeaders.push(m),m.column.widthFillDisable||this.resizeNum++),a.fixed==="left"?this.fixedLeftCellHeaders.push(m):a.fixed==="right"?this.fixedRightCellHeaders.push(m):this.centerCellHeaders.push(m),!a.children&&this.columnIndex++,a.children&&this.render(a.children,s),s+=g}}drawTipLine(){if(this.isResizing&&this.resizeTarget){const{stageHeight:e,config:{RESIZE_COLUMN_LINE_COLOR:t,RESIZE_COLUMN_TEXT_COLOR:r,RESIZE_COLUMN_TEXT_BG_COLOR:s,ENABLE_RESIZE_COLUMN_TEXT:n}}=this.ctx,o=this.resizeTarget.getDrawX(),a=this.resizeTarget.width,l=o+a+this.resizeDiff-.5,d=[l-.5,0,l-.5,e];if(this.ctx.paint.drawLine(d,{borderColor:t}),n){const u=`${Math.floor(a+this.resizeDiff)}px`,f=45,g=24;this.ctx.paint.drawRect(l+f/2,this.ctx.mouseY-g/2,f,g,{fillColor:s,borderWidth:0,borderColor:"transparent"}),this.ctx.paint.drawText(u,l+f/2,this.ctx.mouseY-g/2,f,g+2,{padding:0,color:r,align:"center",verticalAlign:"middle"})}}}drawDragTip(){if(this.dragTarget&&this.ctx.dragHeaderIng){const{DRAG_TIP_BG_COLOR:e,DRAG_TIP_LINE_COLOR:t}=this.ctx.config,r=this.dragTarget.width;if(this.ctx.paint.drawRect(this.ctx.mouseX-this.dragCellDiff,this.visibleHeight,r,this.ctx.body.visibleHeight,{fillColor:e,borderWidth:0,borderColor:"transparent"}),this.dragingCell){const{drawX:s,drawY:n,visibleWidth:o,colIndex:a}=this.dragingCell;let l=s,d=n;a>this.dragTarget.colIndex&&(l=s+o),a===0&&(l=l+1),a===this.ctx.maxColIndex&&(l=l-1);const u=[l,d,l,this.ctx.stageHeight],f=[l-4,d,l+4,d,l,d+6,l-4,d];this.ctx.paint.drawLine(f,{borderColor:t,borderWidth:1.2,fillColor:t}),this.ctx.paint.drawLine(u,{borderColor:t,borderWidth:1.2})}}}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:r,header:s,stageWidth:n,config:{HEADER_BG_COLOR:o,SCROLLER_TRACK_SIZE:a}}=this.ctx;if(r>0&&e!==0&&this.ctx.paint.drawShadow(this.x,this.y,e,this.height,{fillColor:o,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),r<Math.floor(s.width-n-1)&&t!==a){const l=s.width-(this.x+this.width)+n-t;this.ctx.paint.drawShadow(l,this.y,t,this.height,{fillColor:o,side:"left",shadowWidth:4,colorStart:"rgba(0,0,0,0)",colorEnd:"rgba(0,0,0,0.1)"})}}update(){const e=[],t=[],r=[];if(this.centerCellHeaders.length){const s=this.centerCellHeaders[this.centerCellHeaders.length-1];this.ctx.lastCenterColIndex=s.colIndex}this.centerCellHeaders.forEach(s=>{s.isHorizontalVisible()&&s.isVerticalVisible()&&(t.push(s),s.hasChildren||e.push(s))}),this.fixedLeftCellHeaders.forEach(s=>{r.push(s),s.hasChildren||e.push(s)}),this.fixedRightCellHeaders.forEach(s=>{r.push(s),s.hasChildren||e.push(s)}),this.renderCenterCellHeaders=t,this.renderFixedCellHeaders=r,this.renderLeafCellHeaders=e.sort((s,n)=>s.x-n.x),this.visibleLeafColumns=this.renderLeafCellHeaders.map(s=>s.column),this.ctx.header.visibleLeafColumns=this.visibleLeafColumns,this.ctx.header.leafCellHeaders=this.leafCellHeaders,this.ctx.header.renderLeafCellHeaders=this.renderLeafCellHeaders,this.ctx.header.renderCellHeaders=this.renderFixedCellHeaders.concat(this.renderCenterCellHeaders)}drawBottomLine(){const{stageWidth:e,config:{BORDER_COLOR:t}}=this.ctx,r=[0,this.height,e,this.height];this.ctx.paint.drawLine(r,{borderColor:t,borderWidth:1})}draw(){this.renderCenterCellHeaders.forEach(e=>{e.update(),e.draw()}),this.drawFixedShadow(),this.renderFixedCellHeaders.forEach(e=>{e.update(),e.draw()}),this.drawBottomLine(),this.drawTipLine(),this.drawDragTip()}}class ll{constructor(e,t,r=0,s=0,n=0,o=0,a,l="body"){h(this,"ctx"),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height"),h(this,"cells",[]),h(this,"fixedCells",[]),h(this,"noFixedCells",[]),h(this,"calculatedHeightCells",[]),h(this,"rowIndex",0),h(this,"rowKey",""),h(this,"rowType","body"),h(this,"data"),h(this,"calculatedHeight",-1),this.ctx=e,this.x=r,this.y=s,this.width=n,this.height=o,this.rowIndex=t,this.rowKey=e.database.getRowKeyForRowIndex(t)||"",this.rowType=l,this.data=a,this.update()}update(){const{header:e}=this.ctx,t=[],r=[],s=[],n=[];e.renderLeafCellHeaders.forEach(o=>{const a=new Pr(this.ctx,this.rowIndex,o.colIndex,o.x,this.y,o.width,this.height,o.column,this.data,this.rowType);a.fixed?r.push(a):s.push(a),t.push(a),a.autoRowHeight&&n.push(a)}),this.cells=t,this.calculatedHeightCells=n,this.fixedCells=r,this.noFixedCells=s}updateCalculatedHeight(){const e=this.calculatedHeightCells.map(t=>{const r=t.getAutoHeight(),{key:s,height:n=-1}=this.ctx.database.getMaxRowHeightItem(this.rowKey)||{};return r>n?this.ctx.database.setMaxRowHeightItem(this.rowKey,t.key,r):t.key===s&&r<n&&this.ctx.database.setMaxRowHeightItem(this.rowKey,t.key,r),r});return this.calculatedHeight=e.length?Math.max(...e):-1,this.calculatedHeight}drawCenter(){this.noFixedCells.forEach(e=>{e.draw()})}drawFixed(){this.fixedCells.forEach(e=>{e.draw()})}drawContainer(){this.noFixedCells.forEach(e=>{e.drawContainer()})}drawFixedContainer(){this.fixedCells.forEach(e=>{e.drawContainer()})}}class Tb{constructor(e){h(this,"resizeTarget",null),h(this,"isMouseDown",!1),h(this,"resizeDiff",0),h(this,"clientY",0),h(this,"ctx"),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"headIndex",0),h(this,"tailIndex",0),h(this,"isResizing",!1),h(this,"renderRows",[]),h(this,"visibleRows",[]),h(this,"visibleHeight",0),h(this,"visibleWidth",0),h(this,"containerRect"),h(this,"data",[]),this.ctx=e,this.init(),this.initResizeRow()}init(){const{canvasElement:e,header:t,footer:r,database:s,config:{FOOTER_FIXED:n,SCROLLER_TRACK_SIZE:o=0,HEIGHT:a,EMPTY_BODY_HEIGHT:l=0,MAX_HEIGHT:d=0,ENABLE_OFFSET_HEIGHT:u=0,OFFSET_HEIGHT:f=0,FOOTER_POSITION:g}}=this.ctx;if(!t.width)return;this.x=0,g==="top"&&n?this.y=t.height+r.height:this.y=t.height;const{data:m,sumHeight:x}=s.getData();this.height=x,this.data=m,this.width=t.width,this.visibleWidth=this.ctx.stageWidth-o;const v=this.ctx.footer.height;this.ctx.isEmpty=!this.data.length,!this.data.length&&!a?this.height=l:!this.data.length&&a&&(this.height=a-t.height-v-o);let p=this.height+t.height+o;p+=v;let w=p;const E=window.innerHeight,{top:C}=this.containerRect||this.ctx.containerElement.getBoundingClientRect();if(E>C&&u&&!a){const O=E-C-f;O>t.height+o?w=O:p>d&&(w=d)}else this.data.length&&a?w=a:this.data.length&&d&&p>d&&(w=d);w>0&&(this.ctx.stageHeight=Math.floor(w),this.ctx.stageElement.style.height=`${this.ctx.stageHeight}px`);let b=this.ctx.stageHeight-t.height-o;n?this.visibleHeight=b-v:this.visibleHeight=b,this.data.length||(this.height=this.visibleHeight),this.ctx.body.x=this.x,this.ctx.body.y=this.y,this.ctx.body.width=this.width,this.ctx.body.height=this.height,this.ctx.body.visibleWidth=this.visibleWidth,this.ctx.body.visibleHeight=this.visibleHeight,this.ctx.body.data=m;const _=window.devicePixelRatio||1,B=this.ctx.stageWidth*_,K=this.ctx.stageHeight*_;e.width=Math.round(B),e.height=Math.round(K);const S=this.data.length?"not-empty":"empty";this.ctx.emit("emptyChange",{isEmpty:S,type:S,headerHeight:t.height,bodyHeight:this.height,footerHeight:v,width:this.width,height:this.data.length?0:l+v});const I=Math.round(e.width/_*1e4)/1e4,R=Math.round(e.height/_*1e4)/1e4;this.ctx.canvasElement.setAttribute("style",`height:${R}px;width:${I}px;`),this.ctx.paint.scale(_)}initResizeRow(){this.ctx.on("resize",()=>{this.ctx.config.ENABLE_RESIZE_ROW&&(this.containerRect=this.ctx.containerElement.getBoundingClientRect())}),this.ctx.on("resizeObserver",()=>{this.ctx.config.ENABLE_RESIZE_ROW&&(this.containerRect=this.ctx.containerElement.getBoundingClientRect())}),this.ctx.on("mouseup",()=>{this.ctx.config.ENABLE_RESIZE_ROW&&(this.isMouseDown=!1,this.resizeDiff!==0&&this.resizeTarget&&this.resizeRow(this.resizeTarget,this.resizeDiff),this.resizeTarget=null,this.resizeDiff=0,this.isResizing=!1,setTimeout(()=>{this.ctx.rowResizing=!1},0),this.clientY=0)}),this.ctx.on("mousedown",e=>{this.ctx.config.ENABLE_RESIZE_ROW&&this.ctx.isTarget(e)&&(this.clientY=e.clientY,this.resizeTarget?(this.isResizing=!0,this.ctx.rowResizing=!0):(this.isResizing=!1,this.ctx.rowResizing=!1),this.isMouseDown=!0)}),this.ctx.on("mousemove",e=>{if(!this.ctx.config.ENABLE_RESIZE_ROW||this.ctx.editing)return;const{offsetY:t,offsetX:r}=this.ctx.getOffset(e),s=t,n=r,o=e.clientY,{stageHeight:a,scrollY:l,config:{RESIZE_ROW_MIN_HEIGHT:d=0}}=this.ctx;if(this.isResizing&&this.resizeTarget){const u=this.resizeTarget.height;let f=o-this.clientY;const{calculatedHeight:g}=this.resizeTarget,m=g===-1?d:g;f+u<m&&(f=-(u-m)),this.resizeDiff=f,this.ctx.emit("draw")}else{if(this.resizeTarget=null,this.isMouseDown)return;if(n<0||n>this.ctx.body.visibleWidth||s<0||s>this.ctx.header.visibleHeight+this.ctx.body.visibleHeight){this.ctx.stageElement.style.cursor==="row-resize"&&(this.ctx.stageElement.style.cursor="default");return}if(this.ctx.stageElement.style.cursor==="crosshair")return;this.ctx.stageElement.style.cursor==="row-resize"&&(this.ctx.stageElement.style.cursor="default");for(let u=0;u<this.renderRows.length;u++){const f=this.renderRows[u];if(s>f.y-l+f.height-1.5&&s<f.y-l+f.height+1.5&&s<a-4)for(let g=0;g<f.cells.length;g++){const m=f.cells[g];n>m.drawX+10&&n<m.drawX+m.width-10&&m.rowspan===1&&(this.ctx.stageElement.style.cursor="row-resize",this.resizeTarget=f)}}}})}resizeRow(e,t){const{rowIndex:r,height:s,rowKey:n,data:o}=e;this.ctx.database.setRowHeight(r,s+t),this.init(),this.ctx.emit("draw"),this.ctx.emit("resizeRowChange",{rowIndex:r,oldHeight:s,height:s+t,rowKey:n,row:o,data:this.data})}drawTipLine(){if(this.isResizing&&this.resizeTarget){const{stageWidth:e,scrollY:t,config:{RESIZE_ROW_LINE_COLOR:r}}=this.ctx,s=this.resizeTarget.y-t,n=this.resizeTarget.height,o=s+n+this.resizeDiff-.5,a=[0,o-.5,e,o-.5];this.ctx.paint.drawLine(a,{borderColor:r,borderWidth:1})}}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:r,header:s,stageWidth:n,config:{HEADER_BG_COLOR:o,SCROLLER_TRACK_SIZE:a}}=this.ctx;if(r>0&&e!==0&&!this.ctx.isEmpty&&this.ctx.paint.drawShadow(this.x,this.y,e,this.height,{fillColor:o,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),r<Math.floor(s.width-n-1)&&t!==a&&!this.ctx.isEmpty){const l=s.width-(this.x+this.width)+n-t;this.ctx.paint.drawShadow(l,this.y,t,this.height,{fillColor:o,side:"left",shadowWidth:4,colorStart:"rgba(0,0,0,0)",colorEnd:"rgba(0,0,0,0.1)"})}}binarySearch(e,t){let r=0,s=e.length-1,n=-1;for(;r<=s;){let o=Math.floor((r+s)/2),a=e[o].bottom;if(a===t)return o;a<t?r=o+1:(n=o,s=o-1)}return n}update(){this.init();const{header:e,database:t,scrollY:r,config:{CELL_HEIGHT:s}}=this.ctx,n=r,{data:o,positions:a}=t.getData();this.ctx.maxRowIndex=o.length-1;let l=this.binarySearch(a,n),d=this.binarySearch(a,n+this.visibleHeight);if(d===-1&&(d=this.ctx.maxRowIndex),l===-1&&d===this.ctx.maxRowIndex){const f=Math.floor(this.visibleHeight/s);l=this.ctx.maxRowIndex-f}this.headIndex=Math.max(0,l),this.tailIndex=Math.min(this.ctx.maxRowIndex,d+1),this.visibleRows=o.slice(this.headIndex,this.tailIndex+1),this.ctx.body.headIndex=this.headIndex,this.ctx.body.tailIndex=this.tailIndex,this.ctx.body.visibleRows=this.visibleRows;const u=[];for(let f=0;f<this.visibleRows.length;f++){const g=this.headIndex+f,m=this.visibleRows[f],{height:x,top:v}=this.ctx.database.getPositionForRowIndex(g),p=new ll(this.ctx,g,0,v+this.y,e.width,x,m);u.push(p)}this.renderRows=u,this.ctx.body.renderRows=u}updateAutoHeight(){const e=this.ctx.body.renderRows;if(!e.some(r=>r.calculatedHeightCells.length>0))return!1;e.forEach(r=>{r.updateCalculatedHeight()});const t=e.map(r=>({height:r.calculatedHeight,rowIndex:r.rowIndex}));return this.ctx.database.setBatchCalculatedRowHeight(t)}draw(){this.renderRows.forEach(e=>{e.drawContainer()}),this.renderRows.forEach(e=>{e.drawCenter()}),this.drawFixedShadow(),this.renderRows.forEach(e=>{e.drawFixedContainer()}),this.renderRows.forEach(e=>{e.drawFixed()}),this.drawTipLine()}}class Ob{constructor(e){h(this,"ctx"),h(this,"renderRows",[]),h(this,"data",[]),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"visibleWidth",0),h(this,"visibleHeight",0),this.ctx=e,this.init()}init(){this.data=this.ctx.database.getFooterData();const{header:e,body:t,config:{CELL_FOOTER_HEIGHT:r,FOOTER_FIXED:s,SCROLLER_TRACK_SIZE:n,FOOTER_POSITION:o}}=this.ctx;this.width=e.width,this.visibleWidth=e.visibleWidth,this.height=this.data.reduce(a=>a+r,0),this.visibleHeight=this.height,s?o==="top"?this.y=this.ctx.header.height:this.y=this.ctx.stageHeight-this.height-n:this.y=t.y+t.height,this.ctx.footer.x=this.x,this.ctx.footer.y=this.y,this.ctx.footer.height=this.height,this.ctx.footer.width=this.width,this.ctx.footer.visibleWidth=this.visibleWidth,this.ctx.footer.visibleHeight=this.visibleHeight}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:r,header:s,stageWidth:n,config:{HEADER_BG_COLOR:o,SCROLLER_TRACK_SIZE:a}}=this.ctx;let l=this.y;if(this.ctx.config.FOOTER_FIXED||(l=this.y-this.ctx.scrollY),r>0&&e!==0&&this.ctx.paint.drawShadow(this.x,l,e,this.height,{fillColor:o,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),r<Math.floor(s.width-n-1)&&t!==a){const d=s.width-(this.x+this.width)+n-t;this.ctx.paint.drawShadow(d,l,t,this.height,{fillColor:o,side:"left",shadowWidth:4,colorStart:"rgba(0,0,0,0)",colorEnd:"rgba(0,0,0,0.1)"})}}update(){this.init();const{CELL_FOOTER_HEIGHT:e}=this.ctx.config;let t=this.y;const r=[];this.data.forEach((s,n)=>{const o=new ll(this.ctx,n,0,t,this.width,e,s,"footer");t+=e,r.push(o)}),this.renderRows=r,this.ctx.footer.renderRows=this.renderRows}drawTopLine(){const{stageWidth:e,config:{BORDER_COLOR:t}}=this.ctx,r=[0,this.y,e,this.y];this.ctx.paint.drawLine(r,{borderColor:t,borderWidth:1})}draw(){this.renderRows.forEach(e=>{e.drawContainer()}),this.renderRows.forEach(e=>{e.drawCenter()}),this.drawFixedShadow(),this.renderRows.forEach(e=>{e.drawFixedContainer()}),this.renderRows.forEach(e=>{e.drawFixed()}),this.drawTopLine()}}class kb{constructor(e){h(this,"isCut",!1),h(this,"isMultipleRow",!1),h(this,"ctx"),this.ctx=e,this.init()}init(){this.ctx.on("setMoveFocus",e=>{this.moveFocus(e)}),this.ctx.on("mousemove",Kr(e=>{var t;(t=this.ctx.focusCellHeader)!=null&&t.fixed||!this.ctx.dragHeaderIng&&this.ctx.selectorMove&&this.ctx.startAdjustPosition(e)},100)),this.ctx.on("cellHoverChange",e=>{if(!this.ctx.autofillMove){if(e.operation){this.selectRows(e,!1);return}this.isMultipleRow||this.mouseenter()}}),this.ctx.on("cellClick",()=>{this.adjustBoundaryPosition()}),this.ctx.on("cellMousedown",(e,t)=>{if(!(!this.ctx.isTarget(t)||this.ctx.stageElement.style.cursor==="pointer"||this.ctx.isPointer||this.ctx.stageElement.style.cursor==="crosshair")){if(e.operation){this.isMultipleRow=!0,this.selectRows(e);return}window.getComputedStyle(t.target).userSelect!=="text"&&t.preventDefault(),this.isMultipleRow=!1,this.click(t.shiftKey),this.ctx.emit("selectorClick",e)}}),this.ctx.on("mouseup",()=>{this.ctx.selectorMove=!1,this.ctx.stopAdjustPosition(),setTimeout(()=>{this.ctx.disableHoverIconClick=!1},0)}),this.ctx.on("cellHeaderHoverChange",e=>{this.ctx.mousedown&&this.selectCols(e)}),this.ctx.on("cellHoverChange",e=>{this.ctx.mousedown&&this.selectCols(e)}),this.ctx.on("cellHeaderMousedown",(e,t)=>{this.ctx.stageElement.style.cursor==="pointer"||this.ctx.isPointer||(window.getComputedStyle(t.target).userSelect!=="text"&&t.preventDefault(),this.ctx.clearSelector(),e.operation?this.selectAll():this.selectCols(e))}),this.ctx.on("keydown",e=>{if(!this.ctx.editing&&!this.ctx.finding){if(e.ctrlKey&&e.code==="KeyV"||e.metaKey&&e.code==="KeyV"){this.paste();return}if(e.ctrlKey&&e.code==="KeyC"||e.metaKey&&e.code==="KeyC"){this.copy(),this.isCut=!1;return}if(e.ctrlKey&&e.code==="KeyX"||e.metaKey&&e.code==="KeyX"){this.isCut=!0,this.copy();return}if((e.ctrlKey&&e.code==="KeyA"||e.metaKey&&e.code==="KeyA")&&(e.preventDefault(),this.selectAll()),e.code==="ArrowLeft"||e.shiftKey&&e.code==="Tab"){e.preventDefault(),this.moveFocus("LEFT");return}if(e.code==="ArrowUp"){e.preventDefault(),this.moveFocus("TOP");return}if(e.code==="ArrowRight"||e.code==="Tab"){e.preventDefault(),this.moveFocus("RIGHT");return}if(e.code==="ArrowDown"){e.preventDefault(),this.moveFocus("BOTTOM");return}if(e.code==="Delete"||e.code==="Backspace"){e.preventDefault();const{xArr:t,yArr:r}=this.ctx.selector;this.clearSelectedData(t,r);return}}}),this.ctx.on("contextMenuClearSelected",()=>{const{xArr:e,yArr:t}=this.ctx.selector;this.clearSelectedData(e,t)}),this.ctx.on("contextMenuCopy",()=>{this.copy()}),this.ctx.on("contextMenuPaste",()=>{this.paste()}),this.ctx.on("contextMenuCut",()=>{this.isCut=!0,this.copy()}),this.ctx.on("setSelectorCell",e=>{this.ctx.setFocusCell(e),this.click(),this.adjustBoundaryPosition()}),this.ctx.on("selectCols",e=>{this.selectCols(e)})}setSelector(e,t){if(this.ctx.dragHeaderIng)return;const{ENABLE_SELECTOR_SPAN_COL:r,ENABLE_SELECTOR_SPAN_ROW:s}=this.ctx.config;let n=e,o=t;if(!s){const[a]=o;o=[a,a]}if(!r){const[a]=n;n=[a,a]}if(JSON.stringify(this.ctx.selector.xArr)!==JSON.stringify(n)||JSON.stringify(this.ctx.selector.yArr)!==JSON.stringify(o)){this.ctx.mousedown&&(this.ctx.selectorMove=!0,this.ctx.disableHoverIconClick=!0),this.ctx.selector.enable=!0;const{SELECTOR_AREA_MIN_X:a,SELECTOR_AREA_MAX_X:l,SELECTOR_AREA_MIN_Y:d,SELECTOR_AREA_MAX_Y:u,SELECTOR_AREA_MAX_X_OFFSET:f,SELECTOR_AREA_MAX_Y_OFFSET:g}=this.ctx.config,m=a,x=l||this.ctx.maxColIndex-f,v=d,p=u||this.ctx.maxRowIndex-g;let[w,E]=n,[C,b]=o;if(w<m||E>x||C<v||b>p)return;if(this.ctx.config.ENABLE_MERGE_CELL_LINK){const B=this.adjustMergeCells(n,o);C=B.yArr[0],b=B.yArr[1],w=B.xArr[0],E=B.xArr[1],this.ctx.onlyMergeCell=B.onlyMergeCell}w===E&&C===b?this.ctx.selectOnlyOne=!0:this.ctx.selectOnlyOne=!1,n=[Math.max(m,w),Math.min(x,E)],o=[Math.max(v,C),Math.min(p,b)];const{BEFORE_SET_SELECTOR_METHOD:_}=this.ctx.config;if(typeof _=="function"){const B=_({focusCell:this.ctx.focusCell,xArr:n,yArr:o});if(!B)return;n=B.xArr,o=B.yArr}this.ctx.selector.xArr=n,this.ctx.selector.yArr=o,b===this.ctx.maxRowIndex&&C===0?this.ctx.selectColsIng=!0:this.ctx.selectColsIng=!1,E===this.ctx.maxColIndex&&w===0?this.ctx.selectRowsIng=!0:this.ctx.selectRowsIng=!1,this.ctx.emit("setSelector",this.ctx.selector),this.ctx.emit("drawView")}}adjustMergeCells(e,t){var r;const[s,n]=t,[o,a]=e;if(n===this.ctx.maxRowIndex&&s===0||a===this.ctx.maxColIndex&&o===0)return{xArr:e,yArr:t,onlyMergeCell:!1};let l=[],d=[];for(let v=0;v<=t[1]-t[0];v++)for(let p=0;p<=e[1]-e[0];p++){const w=v+t[0],E=p+e[0],C=this.ctx.database.getVirtualBodyCell(w,E);C&&((w===s||w===n)&&l.push(C),(E===o||E===a)&&d.push(C))}const u=l.reduce((v,p)=>{const{yArr:w}=p.getSpanInfo(),[E,C]=w;return v.minY=Math.min(v.minY,E),v.maxY=Math.max(v.maxY,C),v},{minY:s,maxY:n}),f=d.reduce((v,p)=>{const{xArr:w}=p.getSpanInfo(),[E,C]=w;return v.minX=Math.min(v.minX,E),v.maxX=Math.max(v.maxX,C),v},{minX:o,maxX:a}),g=[f.minX,f.maxX],m=[u.minY,u.maxY];let x=!1;if(f.minX!==f.maxX||u.minY!==u.maxY){const v=JSON.stringify(g)+JSON.stringify(m),p=(r=this.ctx.focusCell)==null?void 0:r.getSpanInfo();x=(p&&JSON.stringify(p.xArr)+JSON.stringify(p.yArr))===v}return{xArr:g,yArr:m,onlyMergeCell:x}}selectCols(e){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||!this.ctx.config.ENABLE_SELECTOR_ALL_ROWS||this.ctx.autofillMove||this.ctx.columnResizing||this.ctx.editing)return;const{SELECTOR_AREA_MIN_Y:t,SELECTOR_AREA_MAX_Y:r,SELECTOR_AREA_MAX_Y_OFFSET:s}=this.ctx.config,n=t,o=r||this.ctx.maxRowIndex-s;if(this.ctx.focusCellHeader){const{colIndex:a}=this.ctx.focusCellHeader;if(this.ctx.clearSelector(),this.ctx.mousedown&&e.colIndex>=a){const l=[a,e.colIndex+e.colspan-1],d=[n,o];this.setSelector(l,d)}else{const l=[e.colIndex,a+e.colspan-1],d=[n,o];this.setSelector(l,d)}}}selectAll(){if(this.ctx.autofillMove||this.ctx.editing)return;const{ENABLE_SELECTOR_ALL_ROWS:e,ENABLE_SELECTOR_ALL_COLS:t}=this.ctx.config;if(e&&t){const{SELECTOR_AREA_MIN_X:r,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MIN_Y:n,SELECTOR_AREA_MAX_Y:o,SELECTOR_AREA_MAX_X_OFFSET:a,SELECTOR_AREA_MAX_Y_OFFSET:l}=this.ctx.config,d=r,u=s||this.ctx.maxColIndex-a,f=n,g=o||this.ctx.maxRowIndex-l,m=[d,u],x=[f,g];this.setSelector(m,x)}}selectRows(e,t=!0){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||!this.ctx.config.ENABLE_SELECTOR_ALL_COLS||this.ctx.autofillMove||this.ctx.editing)return;const{SELECTOR_AREA_MIN_X:r,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MAX_X_OFFSET:n}=this.ctx.config,o=s||this.ctx.maxColIndex-n,a=r;if(t){this.ctx.setFocusCell(e);const l=[a,o],d=[e.rowIndex,e.rowIndex];this.setSelector(l,d)}if(this.ctx.focusCell&&this.ctx.mousedown){const{rowIndex:l}=this.ctx.focusCell;if(e.rowIndex>=l){const d=[a,o],u=[l,e.rowIndex];this.setSelector(d,u)}else{const d=[a,o],u=[e.rowIndex,l];this.setSelector(d,u)}}}mouseenter(){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||this.ctx.editing)return;const{mousedown:e,focusCell:t,hoverCell:r}=this.ctx;if(e&&t&&r){const{rowIndex:s,colIndex:n}=t,o=Math.min(r.colIndex,n),a=Math.max(r.colIndex,n),l=Math.min(r.rowIndex,s),d=Math.max(r.rowIndex,s),u=[o,a],f=[l,d];this.setSelector(u,f)}}click(e=!1){const{focusCell:t,clickCell:r}=this.ctx;if(t&&this.isInSettingRange(t.rowIndex,t.colIndex))if(this.ctx.selector.enable=!0,r&&e){if(this.ctx.config.ENABLE_SELECTOR_SINGLE)return;const{colIndex:s,rowIndex:n}=r,{colIndex:o,rowIndex:a}=t,l=Math.min(o,s),d=Math.max(o,s),u=Math.min(a,n),f=Math.max(a,n),g=[l,d],m=[u,f];this.setSelector(g,m)}else{this.ctx.emit("cellSelectedClick",t);const s=[t.colIndex,t.colIndex],n=[t.rowIndex,t.rowIndex];this.setSelector(s,n)}}clearCopyLine(){this.ctx.selector.xArrCopy=[-1,-1],this.ctx.selector.yArrCopy=[-1,-1]}getCell(e,t){const r=this.ctx.body.renderRows.find(s=>s.rowIndex===e);return r==null?void 0:r.cells.find(s=>s.colIndex===t)}copy(){if(!this.ctx.config.ENABLE_COPY||this.ctx.domSelectionStr)return;let{value:e,xArr:t,yArr:r}=this.ctx.getSelectedData();if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(t,r))if(this.ctx.onlyMergeCell&&this.ctx.focusCell){const o=this.ctx.focusCell;e=[[o.getValue()]],t=[o.colIndex,o.colIndex],r=[o.rowIndex,o.rowIndex]}else{const o={code:"ERR_MERGED_CELLS_COPY",message:"Merged cells cannot span copy data"};this.ctx.hasEvent("error")?this.ctx.emit("error",o):alert(o.message);return}const{BEFORE_COPY_METHOD:s}=this.ctx.config;if(typeof s=="function"){const o=s({focusCell:this.ctx.focusCell,data:e,xArr:t,yArr:r});if(!o)return;e=o.data}const n=hb(e);navigator.clipboard?navigator.clipboard.writeText(n).then(()=>{this.ctx.selector.xArrCopy=this.ctx.selector.xArr.slice(),this.ctx.selector.yArrCopy=this.ctx.selector.yArr.slice(),this.ctx.emit("copyChange",{xArr:this.ctx.selector.xArrCopy,yArr:this.ctx.selector.yArrCopy,data:e}),this.ctx.emit("draw")}).catch(o=>console.error("Copy Failure:",o)):console.error("current browser does not support the Clipboard API")}clearSelectedData(e,t,r=!1,s=null){let n=[];const o=new Set;for(let l=0;l<=t[1]-t[0];l++)for(let d=0;d<=e[1]-e[0];d++){const u=l+t[0],f=d+e[0],g=this.ctx.database.getItemValueForRowIndexAndColIndex(u,f);if(g){const{rowKey:m,key:x}=g;this.ctx.database.getReadonly(m,x)||(o.add(m),n.push({rowKey:m,key:x,value:s,row:{}}))}}if(!n.length)return[];if(r)return n;this.ctx.database.batchSetItemValue(n,!0);let a=[];return o.forEach(l=>{a.push(this.ctx.database.getRowDataItemForRowKey(l))}),this.ctx.emit("clearSelectedDataChange",n,a),n}paste(){if(!navigator.clipboard){console.error("current browser does not support the Clipboard API");return}const{ENABLE_PASTER:e}=this.ctx.config;if(this.ctx.selector.enable&&e){const t=this.ctx.selector.yArr[0],r=this.ctx.selector.xArr[0],s=new Set;navigator.clipboard.readText().then(async n=>{let o=cb(n);const a=[r,r+o[0].length-1],l=[t,t+o.length-1],[d,u]=l,[f,g]=a,m=u-this.ctx.maxRowIndex,x=g-this.ctx.maxColIndex;(m>0||x>0)&&this.ctx.emit("onPastedDataOverflow",{maxY:u,maxX:g,minY:d,minX:f,overflowRowCount:m,overflowColCount:x,textArr:o});const v=o.length===1&&o[0].length===1;if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(a,l)&&!v){const C={code:"ERR_MERGED_CELLS_PASTE",message:"Merged cells cannot span paste data"};this.ctx.hasEvent("error")?this.ctx.emit("error",C):alert(C.message);return}let p=[];for(let C=0;C<=o.length-1;C++){const b=o[C].length;for(let _=0;_<=b-1;_++){const B=C+t,K=_+r,S=o[C][_],I=this.ctx.database.getItemValueForRowIndexAndColIndex(B,K);if(I){const{rowKey:R,key:O}=I;this.ctx.database.getReadonly(R,O)||(s.add(R),p.push({rowKey:R,key:O,value:S,row:{}}))}}}if(this.isCut){const C=this.clearSelectedData(this.ctx.selector.xArrCopy,this.ctx.selector.yArrCopy,!0),b=p.map(_=>`${_.rowKey}-${_.key}`);C.forEach(_=>{b.includes(`${_.rowKey}-${_.key}`)||p.unshift(_)}),this.isCut=!1}if(!p.length)return;const{BEFORE_PASTE_DATA_METHOD:w}=this.ctx.config;if(typeof w=="function"){const C=w,b=p.map(_=>({rowKey:_.rowKey,key:_.key,value:_.value,oldValue:this.ctx.database.getItemValue(_.rowKey,_.key),row:this.ctx.database.getRowDataItemForRowKey(_.rowKey)}));if(p=await C(b,a,l,o),p&&!p.length)return}this.clearCopyLine(),this.ctx.batchSetItemValueByEditor(p,!0);let E=[];s.forEach(C=>{E.push(this.ctx.database.getRowDataItemForRowKey(C))}),this.ctx.emit("pasteChange",p,E),this.ctx.emit("draw")}).catch(n=>{console.error("Failed to get the clipboard content:",n)})}}moveFocus(e){if(this.ctx.editing)return;const{focusCell:t}=this.ctx;if(!t)return;let{colIndex:r=0,rowIndex:s=0}=t;const n=0,o=0,a=this.ctx.maxColIndex,l=this.ctx.maxRowIndex;switch(e){case"LEFT":r>n&&r--;break;case"TOP":s>o&&s--;break;case"RIGHT":r<a&&r++;break;case"BOTTOM":s<l&&s++;break}const d=[r,r],u=[s,s],f=this.getCell(s,r);f&&(f.operation||this.isInSettingRange(f.rowIndex,f.colIndex)&&(this.ctx.setFocusCell(f),this.setSelector(d,u),this.adjustBoundaryPosition(),this.ctx.emit("moveFocus",f),this.ctx.emit("draw")))}isInSettingRange(e,t){const{SELECTOR_AREA_MIN_X:r,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MIN_Y:n,SELECTOR_AREA_MAX_Y:o,SELECTOR_AREA_MAX_X_OFFSET:a,SELECTOR_AREA_MAX_Y_OFFSET:l}=this.ctx.config,d=r,u=s||this.ctx.maxColIndex-a,f=n,g=o||this.ctx.maxRowIndex-l;return!(t<d||t>u||e<f||e>g)}adjustBoundaryPosition(){const{stageHeight:e,stageWidth:t,focusCell:r,fixedRightWidth:s,fixedLeftWidth:n,header:o,footer:a,body:l,scrollX:d,scrollY:u,config:{SCROLLER_TRACK_SIZE:f,FOOTER_FIXED:g,FOOTER_POSITION:m,ENABLE_MERGE_CELL_LINK:x}}=this.ctx;if(!r)return;x&&this.ctx.onlyMergeCell&&r.updateSpanInfo();const{drawX:v,drawY:p,width:w,height:E,fixed:C}=r,b=n-v+1,_=r.drawX+w-(t-s)+1;let B=o.height-p,K=E;K>l.visibleHeight&&(K=l.visibleHeight);let S=0;g&&(m==="top"?B=o.height+a.height-p:S=a.visibleHeight);const I=p+K-(e-S-f);let R=d,O=u;_>0&&!C?R=Math.floor(d+_):b>0&&!C&&(R=Math.floor(d-b)),B>0?O=Math.floor(u-B):I>0&&(O=Math.floor(u+I)),(Math.abs(d-R)>2.5||Math.abs(u-O)>2.5)&&this.ctx.setScroll(R,O)}destroy(){}}class Db{constructor(e){h(this,"ctx"),h(this,"maxColRowCell"),this.ctx=e,this.init()}init(){this.ctx.on("mousemove",e=>{if(this.ctx.stageElement.style.cursor==="crosshair"&&(this.ctx.stageElement.style.cursor="default"),this.ctx.editing||!this.ctx.focusCell||!this.maxColRowCell)return;const{offsetX:t,offsetY:r}=this.ctx.getOffset(e),{colIndex:s,rowIndex:n,drawX:o,drawY:a,width:l,height:d}=this.maxColRowCell,u=6,f=s===this.ctx.maxColIndex||n===this.ctx.maxRowIndex?0:2,g=o+l-u+f,m=a+d-u+f;t>g&&r>m&&t<g+u&&r<m+u&&(this.ctx.stageElement.style.cursor="crosshair"),this.ctx.autofillMove&&this.ctx.startAdjustPosition(e)}),this.ctx.on("cellMouseenter",e=>{const{xArr:t,yArr:r}=this.ctx.selector,s=t[1],n=r[1],{colIndex:o,rowIndex:a}=e;this.ctx.config.ENABLE_AUTOFILL&&o===s&&a===n&&(this.maxColRowCell=e),this.mouseenter(e)}),this.ctx.on("mousedown",()=>{this.ctx.stageElement.style.cursor==="crosshair"&&this.setMousedown()}),this.ctx.on("mouseup",()=>{this.setMouseUp(),this.ctx.stopAdjustPosition()})}isAutofillIng(){const{xArr:e,yArr:t}=this.ctx.selector;return!(JSON.stringify(this.ctx.autofill.xArr)===JSON.stringify(e)&&JSON.stringify(this.ctx.autofill.yArr)===JSON.stringify(t))}setMousedown(){this.ctx.autofill.enable=!0,this.ctx.autofillMove=!0,this.ctx.disableHoverIconClick=!0}setMouseUp(){this.ctx.autofill.enable&&(this.isAutofillIng()&&this.autofillData(),this.ctx.autofill.enable=!1,this.ctx.autofillMove=!1,this.ctx.autofill.xArr=[-1,-1],this.ctx.autofill.yArr=[-1,-1],setTimeout(()=>{this.ctx.disableHoverIconClick=!1},0))}setAutofill(e,t){const{ENABLE_AUTOFILL:r,ENABLE_AUTOFILL_SPAN_COL:s,ENABLE_AUTOFILL_SPAN_ROW:n}=this.ctx.config;if(!r)return;let o=e,a=t;const l=this.ctx.selector.xArr,d=this.ctx.selector.yArr;if(!(!n&&JSON.stringify(d)!==JSON.stringify(a))&&!(!s&&JSON.stringify(l)!==JSON.stringify(o))&&(JSON.stringify(this.ctx.autofill.xArr)!==JSON.stringify(o)||JSON.stringify(this.ctx.autofill.yArr)!==JSON.stringify(a))){const{SELECTOR_AREA_MIN_X:u,SELECTOR_AREA_MAX_X:f,SELECTOR_AREA_MIN_Y:g,SELECTOR_AREA_MAX_Y:m,SELECTOR_AREA_MAX_X_OFFSET:x,SELECTOR_AREA_MAX_Y_OFFSET:v}=this.ctx.config,p=u,w=f||this.ctx.maxColIndex-x,E=g,C=m||this.ctx.maxRowIndex-v;let[b,_]=o,[B,K]=a;if(b<p||B<E)return;o=[Math.max(p,b),Math.min(w,_)],a=[Math.max(E,B),Math.min(C,K)];const{BEFORE_SET_AUTOFILL_METHOD:S}=this.ctx.config;if(typeof S=="function"){const I=S({focusCell:this.ctx.focusCell,xArr:o,yArr:a});if(!I)return;o=I.xArr,a=I.yArr}this.ctx.autofill.xArr=o,this.ctx.autofill.yArr=a,this.ctx.emit("setAutofill",this.ctx.autofill),this.ctx.emit("draw")}}async autofillData(){const e=new Set,t=this.ctx.getSelectedData(),r=new Map;for(let m=0;m<=t.yArr[1]-t.yArr[0];m++)for(let x=0;x<=t.xArr[1]-t.xArr[0];x++){const v=m+t.yArr[0],p=x+t.xArr[0];r.set(`${v}-${p}`,!0)}const{value:s}=t,n=s[0].length,o=s.length,a=this.ctx.autofill.xArr,l=this.ctx.autofill.yArr,d=n===1&&o===1;if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(a,l)&&!d){const m={code:"ERR_MERGED_CELLS_AUTOFILL",message:"Merged cells cannot span autofill data"};this.ctx.hasEvent("error")?this.ctx.emit("error",m):alert(m.message);return}let u=[];for(let m=0;m<=l[1]-l[0];m++)for(let x=0;x<=a[1]-a[0];x++){const v=x+a[0],p=m+l[0],w=s[m%o][x%n],E=this.ctx.database.getItemValueForRowIndexAndColIndex(p,v),C=`${p}-${v}`;if(E&&!r.has(C)){const{rowKey:b,key:_}=E;this.ctx.database.getReadonly(b,_)||(e.add(b),u.push({rowKey:b,key:_,value:w,row:{}}))}}if(!u.length)return;this.ctx.selector.xArr=this.ctx.autofill.xArr,this.ctx.selector.yArr=this.ctx.autofill.yArr;const{BEFORE_AUTOFILL_DATA_METHOD:f}=this.ctx.config;if(typeof f=="function"){const m=f,x=u.map(v=>({rowKey:v.rowKey,key:v.key,value:v.value,oldValue:this.ctx.database.getItemValue(v.rowKey,v.key),row:this.ctx.database.getRowDataItemForRowKey(v.rowKey)}));if(u=await m(x,a,l),u&&!u.length)return}this.ctx.batchSetItemValueByEditor(u,!0);let g=[];e.forEach(m=>{g.push(this.ctx.database.getRowDataItemForRowKey(m))}),this.ctx.emit("autofillChange",u,g),this.ctx.emit("draw")}mouseenter(e){if(["index","selection","index-selection"].includes(e.type))return;const{selector:t,autofill:r}=this.ctx;if(this.ctx.mousedown&&t.enable&&r.enable){const{rowIndex:s,colIndex:n}=e,o=t.xArr.slice(),a=t.yArr.slice();s>=t.yArr[0]&&s<=t.yArr[1]?n>t.xArr[1]?o.splice(1,1,n):n<t.xArr[0]&&o.splice(0,1,n):s>t.yArr[1]?a.splice(1,1,s):s<t.yArr[0]&&a.splice(0,1,s),this.setAutofill(o,a)}}destroy(){}}const Ot=Math.min,ut=Math.max,Ti=Math.round,wi=Math.floor,Te=i=>({x:i,y:i}),Lb={left:"right",right:"left",bottom:"top",top:"bottom"},$b={start:"end",end:"start"};function mr(i,e,t){return ut(i,Ot(e,t))}function ri(i,e){return typeof i=="function"?i(e):i}function ft(i){return i.split("-")[0]}function si(i){return i.split("-")[1]}function cl(i){return i==="x"?"y":"x"}function Vr(i){return i==="y"?"height":"width"}const Mb=new Set(["top","bottom"]);function Je(i){return Mb.has(ft(i))?"y":"x"}function Wr(i){return cl(Je(i))}function Ab(i,e,t){t===void 0&&(t=!1);const r=si(i),s=Wr(i),n=Vr(s);let o=s==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[n]>e.floating[n]&&(o=Oi(o)),[o,Oi(o)]}function Nb(i){const e=Oi(i);return[xr(i),e,xr(e)]}function xr(i){return i.replace(/start|end/g,e=>$b[e])}const Pn=["left","right"],Yn=["right","left"],Bb=["top","bottom"],Hb=["bottom","top"];function Fb(i,e,t){switch(i){case"top":case"bottom":return t?e?Yn:Pn:e?Pn:Yn;case"left":case"right":return e?Bb:Hb;default:return[]}}function Kb(i,e,t,r){const s=si(i);let n=Fb(ft(i),t==="start",r);return s&&(n=n.map(o=>o+"-"+s),e&&(n=n.concat(n.map(xr)))),n}function Oi(i){return i.replace(/left|right|bottom|top/g,e=>Lb[e])}function Pb(i){return{top:0,right:0,bottom:0,left:0,...i}}function hl(i){return typeof i!="number"?Pb(i):{top:i,right:i,bottom:i,left:i}}function ki(i){const{x:e,y:t,width:r,height:s}=i;return{width:r,height:s,top:t,left:e,right:e+r,bottom:t+s,x:e,y:t}}function Vn(i,e,t){let{reference:r,floating:s}=i;const n=Je(e),o=Wr(e),a=Vr(o),l=ft(e),d=n==="y",u=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,g=r[a]/2-s[a]/2;let m;switch(l){case"top":m={x:u,y:r.y-s.height};break;case"bottom":m={x:u,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:f};break;case"left":m={x:r.x-s.width,y:f};break;default:m={x:r.x,y:r.y}}switch(si(e)){case"start":m[o]-=g*(t&&d?-1:1);break;case"end":m[o]+=g*(t&&d?-1:1);break}return m}const Yb=async(i,e,t)=>{const{placement:r="bottom",strategy:s="absolute",middleware:n=[],platform:o}=t,a=n.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let d=await o.getElementRects({reference:i,floating:e,strategy:s}),{x:u,y:f}=Vn(d,r,l),g=r,m={},x=0;for(let v=0;v<a.length;v++){const{name:p,fn:w}=a[v],{x:E,y:C,data:b,reset:_}=await w({x:u,y:f,initialPlacement:r,placement:g,strategy:s,middlewareData:m,rects:d,platform:o,elements:{reference:i,floating:e}});u=E??u,f=C??f,m={...m,[p]:{...m[p],...b}},_&&x<=50&&(x++,typeof _=="object"&&(_.placement&&(g=_.placement),_.rects&&(d=_.rects===!0?await o.getElementRects({reference:i,floating:e,strategy:s}):_.rects),{x:u,y:f}=Vn(d,g,l)),v=-1)}return{x:u,y:f,placement:g,strategy:s,middlewareData:m}};async function dl(i,e){var t;e===void 0&&(e={});const{x:r,y:s,platform:n,rects:o,elements:a,strategy:l}=i,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:g=!1,padding:m=0}=ri(e,i),x=hl(m),v=a[g?f==="floating"?"reference":"floating":f],p=ki(await n.getClippingRect({element:(t=await(n.isElement==null?void 0:n.isElement(v)))==null||t?v:v.contextElement||await(n.getDocumentElement==null?void 0:n.getDocumentElement(a.floating)),boundary:d,rootBoundary:u,strategy:l})),w=f==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,E=await(n.getOffsetParent==null?void 0:n.getOffsetParent(a.floating)),C=await(n.isElement==null?void 0:n.isElement(E))?await(n.getScale==null?void 0:n.getScale(E))||{x:1,y:1}:{x:1,y:1},b=ki(n.convertOffsetParentRelativeRectToViewportRelativeRect?await n.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:E,strategy:l}):w);return{top:(p.top-b.top+x.top)/C.y,bottom:(b.bottom-p.bottom+x.bottom)/C.y,left:(p.left-b.left+x.left)/C.x,right:(b.right-p.right+x.right)/C.x}}const Vb=i=>({name:"arrow",options:i,async fn(e){const{x:t,y:r,placement:s,rects:n,platform:o,elements:a,middlewareData:l}=e,{element:d,padding:u=0}=ri(i,e)||{};if(d==null)return{};const f=hl(u),g={x:t,y:r},m=Wr(s),x=Vr(m),v=await o.getDimensions(d),p=m==="y",w=p?"top":"left",E=p?"bottom":"right",C=p?"clientHeight":"clientWidth",b=n.reference[x]+n.reference[m]-g[m]-n.floating[x],_=g[m]-n.reference[m],B=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let K=B?B[C]:0;(!K||!await(o.isElement==null?void 0:o.isElement(B)))&&(K=a.floating[C]||n.floating[x]);const S=b/2-_/2,I=K/2-v[x]/2-1,R=Ot(f[w],I),O=Ot(f[E],I),y=R,A=K-v[x]-O,L=K/2-v[x]/2+S,P=mr(y,L,A),Y=!l.arrow&&si(s)!=null&&L!==P&&n.reference[x]/2-(L<y?R:O)-v[x]/2<0,V=Y?L<y?L-y:L-A:0;return{[m]:g[m]+V,data:{[m]:P,centerOffset:L-P-V,...Y&&{alignmentOffset:V}},reset:Y}}}),Wb=function(i){return i===void 0&&(i={}),{name:"flip",options:i,async fn(e){var t,r;const{placement:s,middlewareData:n,rects:o,initialPlacement:a,platform:l,elements:d}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:g,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:v=!0,...p}=ri(i,e);if((t=n.arrow)!=null&&t.alignmentOffset)return{};const w=ft(s),E=Je(a),C=ft(a)===a,b=await(l.isRTL==null?void 0:l.isRTL(d.floating)),_=g||(C||!v?[Oi(a)]:Nb(a)),B=x!=="none";!g&&B&&_.push(...Kb(a,v,x,b));const K=[a,..._],S=await dl(e,p),I=[];let R=((r=n.flip)==null?void 0:r.overflows)||[];if(u&&I.push(S[w]),f){const L=Ab(s,o,b);I.push(S[L[0]],S[L[1]])}if(R=[...R,{placement:s,overflows:I}],!I.every(L=>L<=0)){var O,y;const L=(((O=n.flip)==null?void 0:O.index)||0)+1,P=K[L];if(P&&(!(f==="alignment"&&E!==Je(P))||R.every(V=>Je(V.placement)===E?V.overflows[0]>0:!0)))return{data:{index:L,overflows:R},reset:{placement:P}};let Y=(y=R.filter(V=>V.overflows[0]<=0).sort((V,W)=>V.overflows[1]-W.overflows[1])[0])==null?void 0:y.placement;if(!Y)switch(m){case"bestFit":{var A;const V=(A=R.filter(W=>{if(B){const z=Je(W.placement);return z===E||z==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(z=>z>0).reduce((z,j)=>z+j,0)]).sort((W,z)=>W[1]-z[1])[0])==null?void 0:A[0];V&&(Y=V);break}case"initialPlacement":Y=a;break}if(s!==Y)return{reset:{placement:Y}}}return{}}}},Xb=new Set(["left","top"]);async function zb(i,e){const{placement:t,platform:r,elements:s}=i,n=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=ft(t),a=si(t),l=Je(t)==="y",d=Xb.has(o)?-1:1,u=n&&l?-1:1,f=ri(e,i);let{mainAxis:g,crossAxis:m,alignmentAxis:x}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof x=="number"&&(m=a==="end"?x*-1:x),l?{x:m*u,y:g*d}:{x:g*d,y:m*u}}const Gb=function(i){return i===void 0&&(i=0),{name:"offset",options:i,async fn(e){var t,r;const{x:s,y:n,placement:o,middlewareData:a}=e,l=await zb(e,i);return o===((t=a.offset)==null?void 0:t.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+l.x,y:n+l.y,data:{...l,placement:o}}}}},Ub=function(i){return i===void 0&&(i={}),{name:"shift",options:i,async fn(e){const{x:t,y:r,placement:s}=e,{mainAxis:n=!0,crossAxis:o=!1,limiter:a={fn:p=>{let{x:w,y:E}=p;return{x:w,y:E}}},...l}=ri(i,e),d={x:t,y:r},u=await dl(e,l),f=Je(ft(s)),g=cl(f);let m=d[g],x=d[f];if(n){const p=g==="y"?"top":"left",w=g==="y"?"bottom":"right",E=m+u[p],C=m-u[w];m=mr(E,m,C)}if(o){const p=f==="y"?"top":"left",w=f==="y"?"bottom":"right",E=x+u[p],C=x-u[w];x=mr(E,x,C)}const v=a.fn({...e,[g]:m,[f]:x});return{...v,data:{x:v.x-t,y:v.y-r,enabled:{[g]:n,[f]:o}}}}}};function Yi(){return typeof window<"u"}function Bt(i){return ul(i)?(i.nodeName||"").toLowerCase():"#document"}function de(i){var e;return(i==null||(e=i.ownerDocument)==null?void 0:e.defaultView)||window}function Me(i){var e;return(e=(ul(i)?i.ownerDocument:i.document)||window.document)==null?void 0:e.documentElement}function ul(i){return Yi()?i instanceof Node||i instanceof de(i).Node:!1}function ye(i){return Yi()?i instanceof Element||i instanceof de(i).Element:!1}function Oe(i){return Yi()?i instanceof HTMLElement||i instanceof de(i).HTMLElement:!1}function Wn(i){return!Yi()||typeof ShadowRoot>"u"?!1:i instanceof ShadowRoot||i instanceof de(i).ShadowRoot}const qb=new Set(["inline","contents"]);function ni(i){const{overflow:e,overflowX:t,overflowY:r,display:s}=we(i);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!qb.has(s)}const Zb=new Set(["table","td","th"]);function Jb(i){return Zb.has(Bt(i))}const Qb=[":popover-open",":modal"];function Vi(i){return Qb.some(e=>{try{return i.matches(e)}catch{return!1}})}const jb=["transform","translate","scale","rotate","perspective"],e_=["transform","translate","scale","rotate","perspective","filter"],t_=["paint","layout","strict","content"];function Xr(i){const e=zr(),t=ye(i)?we(i):i;return jb.some(r=>t[r]?t[r]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||e_.some(r=>(t.willChange||"").includes(r))||t_.some(r=>(t.contain||"").includes(r))}function i_(i){let e=je(i);for(;Oe(e)&&!kt(e);){if(Xr(e))return e;if(Vi(e))return null;e=je(e)}return null}function zr(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const r_=new Set(["html","body","#document"]);function kt(i){return r_.has(Bt(i))}function we(i){return de(i).getComputedStyle(i)}function Wi(i){return ye(i)?{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}:{scrollLeft:i.scrollX,scrollTop:i.scrollY}}function je(i){if(Bt(i)==="html")return i;const e=i.assignedSlot||i.parentNode||Wn(i)&&i.host||Me(i);return Wn(e)?e.host:e}function fl(i){const e=je(i);return kt(e)?i.ownerDocument?i.ownerDocument.body:i.body:Oe(e)&&ni(e)?e:fl(e)}function qt(i,e,t){var r;e===void 0&&(e=[]),t===void 0&&(t=!0);const s=fl(i),n=s===((r=i.ownerDocument)==null?void 0:r.body),o=de(s);if(n){const a=pr(o);return e.concat(o,o.visualViewport||[],ni(s)?s:[],a&&t?qt(a):[])}return e.concat(s,qt(s,[],t))}function pr(i){return i.parent&&Object.getPrototypeOf(i.parent)?i.frameElement:null}function gl(i){const e=we(i);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=Oe(i),n=s?i.offsetWidth:t,o=s?i.offsetHeight:r,a=Ti(t)!==n||Ti(r)!==o;return a&&(t=n,r=o),{width:t,height:r,$:a}}function Gr(i){return ye(i)?i:i.contextElement}function Tt(i){const e=Gr(i);if(!Oe(e))return Te(1);const t=e.getBoundingClientRect(),{width:r,height:s,$:n}=gl(e);let o=(n?Ti(t.width):t.width)/r,a=(n?Ti(t.height):t.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const s_=Te(0);function vl(i){const e=de(i);return!zr()||!e.visualViewport?s_:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function n_(i,e,t){return e===void 0&&(e=!1),!t||e&&t!==de(i)?!1:e}function gt(i,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const s=i.getBoundingClientRect(),n=Gr(i);let o=Te(1);e&&(r?ye(r)&&(o=Tt(r)):o=Tt(i));const a=n_(n,t,r)?vl(n):Te(0);let l=(s.left+a.x)/o.x,d=(s.top+a.y)/o.y,u=s.width/o.x,f=s.height/o.y;if(n){const g=de(n),m=r&&ye(r)?de(r):r;let x=g,v=pr(x);for(;v&&r&&m!==x;){const p=Tt(v),w=v.getBoundingClientRect(),E=we(v),C=w.left+(v.clientLeft+parseFloat(E.paddingLeft))*p.x,b=w.top+(v.clientTop+parseFloat(E.paddingTop))*p.y;l*=p.x,d*=p.y,u*=p.x,f*=p.y,l+=C,d+=b,x=de(v),v=pr(x)}}return ki({width:u,height:f,x:l,y:d})}function Ur(i,e){const t=Wi(i).scrollLeft;return e?e.left+t:gt(Me(i)).left+t}function ml(i,e,t){t===void 0&&(t=!1);const r=i.getBoundingClientRect(),s=r.left+e.scrollLeft-(t?0:Ur(i,r)),n=r.top+e.scrollTop;return{x:s,y:n}}function o_(i){let{elements:e,rect:t,offsetParent:r,strategy:s}=i;const n=s==="fixed",o=Me(r),a=e?Vi(e.floating):!1;if(r===o||a&&n)return t;let l={scrollLeft:0,scrollTop:0},d=Te(1);const u=Te(0),f=Oe(r);if((f||!f&&!n)&&((Bt(r)!=="body"||ni(o))&&(l=Wi(r)),Oe(r))){const m=gt(r);d=Tt(r),u.x=m.x+r.clientLeft,u.y=m.y+r.clientTop}const g=o&&!f&&!n?ml(o,l,!0):Te(0);return{width:t.width*d.x,height:t.height*d.y,x:t.x*d.x-l.scrollLeft*d.x+u.x+g.x,y:t.y*d.y-l.scrollTop*d.y+u.y+g.y}}function a_(i){return Array.from(i.getClientRects())}function l_(i){const e=Me(i),t=Wi(i),r=i.ownerDocument.body,s=ut(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),n=ut(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-t.scrollLeft+Ur(i);const a=-t.scrollTop;return we(r).direction==="rtl"&&(o+=ut(e.clientWidth,r.clientWidth)-s),{width:s,height:n,x:o,y:a}}function c_(i,e){const t=de(i),r=Me(i),s=t.visualViewport;let n=r.clientWidth,o=r.clientHeight,a=0,l=0;if(s){n=s.width,o=s.height;const d=zr();(!d||d&&e==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}return{width:n,height:o,x:a,y:l}}const h_=new Set(["absolute","fixed"]);function d_(i,e){const t=gt(i,!0,e==="fixed"),r=t.top+i.clientTop,s=t.left+i.clientLeft,n=Oe(i)?Tt(i):Te(1),o=i.clientWidth*n.x,a=i.clientHeight*n.y,l=s*n.x,d=r*n.y;return{width:o,height:a,x:l,y:d}}function Xn(i,e,t){let r;if(e==="viewport")r=c_(i,t);else if(e==="document")r=l_(Me(i));else if(ye(e))r=d_(e,t);else{const s=vl(i);r={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return ki(r)}function xl(i,e){const t=je(i);return t===e||!ye(t)||kt(t)?!1:we(t).position==="fixed"||xl(t,e)}function u_(i,e){const t=e.get(i);if(t)return t;let r=qt(i,[],!1).filter(a=>ye(a)&&Bt(a)!=="body"),s=null;const n=we(i).position==="fixed";let o=n?je(i):i;for(;ye(o)&&!kt(o);){const a=we(o),l=Xr(o);!l&&a.position==="fixed"&&(s=null),(n?!l&&!s:!l&&a.position==="static"&&s&&h_.has(s.position)||ni(o)&&!l&&xl(i,o))?r=r.filter(d=>d!==o):s=a,o=je(o)}return e.set(i,r),r}function f_(i){let{element:e,boundary:t,rootBoundary:r,strategy:s}=i;const n=[...t==="clippingAncestors"?Vi(e)?[]:u_(e,this._c):[].concat(t),r],o=n[0],a=n.reduce((l,d)=>{const u=Xn(e,d,s);return l.top=ut(u.top,l.top),l.right=Ot(u.right,l.right),l.bottom=Ot(u.bottom,l.bottom),l.left=ut(u.left,l.left),l},Xn(e,o,s));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function g_(i){const{width:e,height:t}=gl(i);return{width:e,height:t}}function v_(i,e,t){const r=Oe(e),s=Me(e),n=t==="fixed",o=gt(i,!0,n,e);let a={scrollLeft:0,scrollTop:0};const l=Te(0);function d(){l.x=Ur(s)}if(r||!r&&!n)if((Bt(e)!=="body"||ni(s))&&(a=Wi(e)),r){const m=gt(e,!0,n,e);l.x=m.x+e.clientLeft,l.y=m.y+e.clientTop}else s&&d();n&&!r&&s&&d();const u=s&&!r&&!n?ml(s,a):Te(0),f=o.left+a.scrollLeft-l.x-u.x,g=o.top+a.scrollTop-l.y-u.y;return{x:f,y:g,width:o.width,height:o.height}}function hr(i){return we(i).position==="static"}function zn(i,e){if(!Oe(i)||we(i).position==="fixed")return null;if(e)return e(i);let t=i.offsetParent;return Me(i)===t&&(t=t.ownerDocument.body),t}function pl(i,e){const t=de(i);if(Vi(i))return t;if(!Oe(i)){let s=je(i);for(;s&&!kt(s);){if(ye(s)&&!hr(s))return s;s=je(s)}return t}let r=zn(i,e);for(;r&&Jb(r)&&hr(r);)r=zn(r,e);return r&&kt(r)&&hr(r)&&!Xr(r)?t:r||i_(i)||t}const m_=async function(i){const e=this.getOffsetParent||pl,t=this.getDimensions,r=await t(i.floating);return{reference:v_(i.reference,await e(i.floating),i.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function x_(i){return we(i).direction==="rtl"}const p_={convertOffsetParentRelativeRectToViewportRelativeRect:o_,getDocumentElement:Me,getClippingRect:f_,getOffsetParent:pl,getElementRects:m_,getClientRects:a_,getDimensions:g_,getScale:Tt,isElement:ye,isRTL:x_};function yl(i,e){return i.x===e.x&&i.y===e.y&&i.width===e.width&&i.height===e.height}function y_(i,e){let t=null,r;const s=Me(i);function n(){var a;clearTimeout(r),(a=t)==null||a.disconnect(),t=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),n();const d=i.getBoundingClientRect(),{left:u,top:f,width:g,height:m}=d;if(a||e(),!g||!m)return;const x=wi(f),v=wi(s.clientWidth-(u+g)),p=wi(s.clientHeight-(f+m)),w=wi(u),E={rootMargin:-x+"px "+-v+"px "+-p+"px "+-w+"px",threshold:ut(0,Ot(1,l))||1};let C=!0;function b(_){const B=_[0].intersectionRatio;if(B!==l){if(!C)return o();B?o(!1,B):r=setTimeout(()=>{o(!1,1e-7)},1e3)}B===1&&!yl(d,i.getBoundingClientRect())&&o(),C=!1}try{t=new IntersectionObserver(b,{...E,root:s.ownerDocument})}catch{t=new IntersectionObserver(b,E)}t.observe(i)}return o(!0),n}function yr(i,e,t,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:n=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,d=Gr(i),u=s||n?[...d?qt(d):[],...qt(e)]:[];u.forEach(w=>{s&&w.addEventListener("scroll",t,{passive:!0}),n&&w.addEventListener("resize",t)});const f=d&&a?y_(d,t):null;let g=-1,m=null;o&&(m=new ResizeObserver(w=>{let[E]=w;E&&E.target===d&&m&&(m.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var C;(C=m)==null||C.observe(e)})),t()}),d&&!l&&m.observe(d),m.observe(e));let x,v=l?gt(i):null;l&&p();function p(){const w=gt(i);v&&!yl(v,w)&&t(),v=w,x=requestAnimationFrame(p)}return t(),()=>{var w;u.forEach(E=>{s&&E.removeEventListener("scroll",t),n&&E.removeEventListener("resize",t)}),f==null||f(),(w=m)==null||w.disconnect(),m=null,l&&cancelAnimationFrame(x)}}const Di=Gb,Li=Ub,qr=Wb,w_=Vb,$i=(i,e,t)=>{const r=new Map,s={platform:p_,...t},n={...s.platform,_c:r};return Yb(i,e,{...s,platform:n})};let E_=class{constructor(i){h(this,"ctx"),h(this,"enable",!1),h(this,"contentEl"),h(this,"floatingEl"),h(this,"arrowEl"),this.ctx=i;const{TOOLTIP_BG_COLOR:e,TOOLTIP_TEXT_COLOR:t,TOOLTIP_ZINDEX:r,TOOLTIP_CUSTOM_STYLE:s,CSS_PREFIX:n}=this.ctx.config;this.contentEl=document.createElement("div"),this.arrowEl=document.createElement("div"),this.floatingEl=document.createElement("div"),this.floatingEl.className=`${n}-tooltip`,this.contentEl.className=`${n}-tooltip-content`,this.arrowEl.className=`${n}-tooltip-arrow`;const o={display:"none",position:"absolute",background:e,color:t,boxSizing:"border-box",zIndex:r,padding:"8px",borderRadius:"4px",fontSize:"12px",...s},a={position:"absolute",width:"10px",height:"10px",background:o.background,backgroundColor:o.backgroundColor,transform:"rotate(45deg)",zIndex:o.zIndex};Object.assign(this.arrowEl.style,a),Object.assign(this.floatingEl.style,o),this.floatingEl.appendChild(this.contentEl),this.floatingEl.appendChild(this.arrowEl),this.ctx.containerElement.appendChild(this.floatingEl),this.init()}init(){this.floatingEl.addEventListener("mouseleave",()=>{this.hide()}),this.ctx.on("mouseout",i=>{this.floatingEl.contains(i.relatedTarget)||this.hide()}),this.ctx.on("onScroll",()=>{this.hide()}),this.ctx.on("startEdit",()=>{this.hide()}),this.ctx.on("visibleCellHoverChange",(i,e)=>{this.floatingEl.contains(e.target)||(i.ellipsis||i.message)&&this.show(i)}),this.ctx.on("visibleCellMouseleave",(i,e)=>{this.floatingEl.contains(e.target)||this.hide()}),this.ctx.on("cellHeaderMouseleave",(i,e)=>{this.floatingEl.contains(e.target)||this.hide()}),this.ctx.on("cellHeaderHoverChange",(i,e)=>{this.floatingEl.contains(e.target)||i.ellipsis&&this.show(i)}),this.ctx.on("cellFooterMouseleave",(i,e)=>{this.floatingEl.contains(e.target)||this.hide()}),this.ctx.on("cellFooterHoverChange",(i,e)=>{this.floatingEl.contains(e.target)||i.ellipsis&&this.show(i)}),this.ctx.on("cellShowTooltip",(i,e)=>{this.show(i,e)}),this.ctx.on("cellHideTooltip",()=>{this.hide()})}show(i,e){if(this.ctx.contextMenuIng||!i.overflowTooltipShow||this.ctx.mousedown)return;this.floatingEl.style.display="block";let t=i.getText();i.message&&(t=i.message),e&&(t=e);const r=this.ctx.containerElement.getBoundingClientRect();if(!r)return;this.enable=!0,this.contentEl.style.maxWidth=`${i.overflowTooltipMaxWidth||500}px`,this.contentEl.style.minWidth="100px",this.contentEl.style.width="100%",this.contentEl.style.display="inline-block",this.contentEl.style.wordBreak="break-all",this.contentEl.style.lineHeight="1.5",this.contentEl.innerText=t;const s=i.drawX+r.x,n=i.drawY+r.y;$i({getBoundingClientRect(){return{width:i.visibleWidth,height:i.visibleHeight,x:s,y:n,left:s,right:s+i.visibleWidth,top:n,bottom:n+i.visibleHeight}}},this.floatingEl,{placement:i.overflowTooltipPlacement,middleware:[Li(),qr(),Di(6),w_({element:this.arrowEl})]}).then(o=>{const{x:a,y:l,placement:d,middlewareData:u}=o;if(Object.assign(this.floatingEl.style,{top:`${l}px`,left:`${a}px`}),u.arrow){const f=u.arrow;["left","left-start","left-end"].includes(d)?Object.assign(this.arrowEl.style,{top:`${f.y}px`,bottom:"",left:"",right:"-5px"}):["right","right-start","right-end"].includes(d)?Object.assign(this.arrowEl.style,{top:`${f.y}px`,bottom:"",left:"-5px",right:""}):["bottom","bottom-start","bottom-end"].includes(d)?Object.assign(this.arrowEl.style,{top:"-5px",bottom:"",left:`${f.x}px`,right:""}):["top","top-start","top-end"].includes(d)&&Object.assign(this.arrowEl.style,{top:"",bottom:"-5px",left:`${f.x}px`,right:""})}})}hide(){this.enable&&(this.enable=!1,this.floatingEl.style.display="none")}destroy(){this.contentEl.remove(),this.arrowEl.remove(),this.floatingEl.remove()}};class C_{constructor(e){h(this,"editorEl"),h(this,"inputEl"),h(this,"enable",!1),h(this,"cellTarget",null),h(this,"selectorArrStr",""),h(this,"ctx"),h(this,"drawY",0),h(this,"drawX",0),h(this,"cancel",!1),this.ctx=e,this.initTextEditor(),this.init()}init(){this.ctx.on("outsideMousedown",()=>{this.cellTarget&&this.cellTarget.editorType==="text"&&this.clearEditor()}),this.ctx.on("moveFocus",e=>{this.cellTarget=e,this.resetEditorStyle();const{xArr:t,yArr:r}=this.ctx.selector;this.selectorArrStr=JSON.stringify(t)+JSON.stringify(r),this.focusInput()}),this.ctx.on("onScroll",()=>{this.enable&&this.doneEdit()}),this.ctx.on("hoverIconClick",e=>{this.editCell(e.rowIndex,e.colIndex)}),this.ctx.on("keydown",e=>{if(!this.ctx.isTarget(e)||!this.ctx.focusCell||this.ctx.finding)return;const{focusCell:t}=this.ctx;if(t.isVerticalVisible()&&t.isHorizontalVisible()||this.ctx.emit("scrollToIndex",t.rowIndex,t.colIndex),e.code==="Escape"&&this.ctx.editing){this.cancel=!0;const{focusCell:l}=this.ctx;l&&(this.ctx.emit("setSelectorCell",l),this.cellTarget=l),this.doneEdit();return}if((e.altKey||e.metaKey)&&e.key==="Enter"&&this.ctx.editing&&this.inputEl){e.preventDefault();const l=this.inputEl.selectionStart,d=this.inputEl.value.substring(0,l),u=this.inputEl.value.substring(l);this.inputEl.value=d+`
5
+ `+u,this.inputEl.selectionStart=this.inputEl.selectionEnd=l+1,this.autoSize();return}if(e.code==="Tab"&&this.ctx.editing){if(e.preventDefault(),this.doneEdit(),e.shiftKey){this.ctx.emit("setMoveFocus","LEFT");return}this.ctx.emit("setMoveFocus","RIGHT");return}if(e.key==="Enter"&&this.ctx.editing){if(e.preventDefault(),this.doneEdit(),e.shiftKey){this.ctx.emit("setMoveFocus","TOP");return}this.ctx.emit("setMoveFocus","BOTTOM");return}if(e.key==="Enter"&&!this.ctx.editing){e.preventDefault(),this.startEdit();return}const r=e.key,s=e.ctrlKey,n=e.altKey,o=e.shiftKey,a=e.metaKey;if(!(s||n||o||a||["Enter","Escape","Tab","Backspace","Delete","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown","Insert","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"].includes(r))){if(document.activeElement!==this.inputEl){e.preventDefault();return}this.startEdit(!0)}}),this.ctx.on("cellClick",e=>{if(this.ctx.isPointer||!this.isInSelectorRange(e.rowIndex,e.colIndex))return;const{xArr:t,yArr:r}=this.ctx.selector,s=JSON.stringify(t)+JSON.stringify(r);if(this.focusInput(),this.selectorArrStr===s&&this.cellTarget){if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.onlyMergeCell){this.startEdit();return}if(this.ctx.selectOnlyOne&&e.rowKey===this.cellTarget.rowKey&&e.key===this.cellTarget.key){this.startEdit();return}}if(this.selectorArrStr=s,this.doneEdit(),this.cellTarget=e,this.resetEditorStyle(),this.ctx.config.ENABLE_EDIT_SINGLE_CLICK){if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.onlyMergeCell){this.startEdit();return}this.ctx.selectOnlyOne&&this.startEdit()}})}isInSelectorRange(e,t){const{xArr:r,yArr:s}=this.ctx.selector,[n,o]=r,[a,l]=s;return!(t<n||t>o||e<a||e>l)}initTextEditor(){this.inputEl=document.createElement("textarea"),this.inputEl.id="e-virt-table-editor-textarea",this.inputEl.setAttribute("rows","1"),this.inputEl.setAttribute("tabindex","-1"),this.inputEl.addEventListener("input",this.autoSize.bind(this)),this.editorEl=this.ctx.editorElement,this.inputEl.className="e-virt-table-editor-textarea",this.editorEl.appendChild(this.inputEl),this.ctx.containerElement.appendChild(this.editorEl)}autoSize(){if(!this.ctx.editing)return;const e=this.inputEl.value;this.cellTarget&&this.cellTarget.type==="number"&&e!==""&&(this.ctx.emit("cellHideTooltip"),/^-?\d+(\.\d+)?$/.test(e)||this.ctx.emit("cellShowTooltip",this.cellTarget,this.ctx.config.NUMBER_ERROR_TIP)),this.inputEl.style.height="auto";let t=this.inputEl.scrollHeight,r=this.ctx.body.visibleHeight;t>r&&(t=r);const{stageHeight:s,footer:n,header:o,config:{SCROLLER_TRACK_SIZE:a}}=this.ctx,l=s-n.height-a;this.editorEl.style.bottom="auto",this.drawY<o.height&&(this.editorEl.style.top=`${o.height-1}px`),this.drawY+t>l&&(this.editorEl.style.left=`${this.drawX-1}px`,this.editorEl.style.top="auto",this.editorEl.style.bottom=`${s-l}px`),this.inputEl.style.height=`${t}px`}startEditByInput(e,t=!1){const r=t?null:e.getValue(),{editorType:s}=e;if(s==="none")return;e.update(),this.ctx.config.ENABLE_MERGE_CELL_LINK&&e.updateSpanInfo();let{height:n,width:o,drawY:a,drawX:l}=e;this.drawX=l,this.drawY=a;const{config:{CELL_PADDING:d},header:u}=this.ctx;let f=this.ctx.body.visibleHeight;n>f&&(n=f),this.editorEl.style.zIndex="100",this.editorEl.style.left=`${this.drawX-1}px`,this.editorEl.style.top=`${this.drawY}px`,this.editorEl.style.bottom="auto",this.editorEl.style.maxWidth="none",this.editorEl.style.maxHeight=`${f}px`,["text"].includes(s)?(this.inputEl.style.opacity="1",this.inputEl.style.position="relative",this.inputEl.style.minWidth=`${o-1}px`,this.inputEl.style.minHeight=`${n-1}px`,this.inputEl.style.maxHeight=`${f}px`,this.inputEl.style.width=`${o}px`,this.inputEl.style.height="auto",this.inputEl.style.padding=`${d}px`,this.inputEl.value="",r!==null&&(this.inputEl.value=r)):(this.inputEl.style.opacity="0",this.inputEl.style.width="1px",this.inputEl.style.height="1px",this.inputEl.style.position="absolute",this.inputEl.style.left="0px",this.inputEl.style.top="0px"),(this.inputEl.scrollHeight>n||this.drawY<u.height)&&this.autoSize()}doneEditByInput(){if(this.cellTarget&&this.cellTarget.editorType==="text"){const{rowKey:e,key:t}=this.cellTarget,r=this.cellTarget.getValue(),s=this.inputEl.value;s!==r&&!(s===""&&r===null)&&!this.cancel&&this.ctx.setItemValueByEditor(e,t,s,!0)}}focusInput(){document.activeElement!==this.inputEl&&this.inputEl.focus({preventScroll:!0})}startEdit(e=!1){this.cancel=!1;const{ENABLE_EDIT_CLICK_SELECTOR:t}=this.ctx.config;if(!t)return;const r=this.ctx.focusCell;if(!r||["index","index-selection","selection"].includes(r.type)||this.enable||!(r.isVerticalVisible()&&r.isHorizontalVisible()))return;const{rowKey:s,key:n}=r,o=this.ctx.database.getReadonly(s,n);r&&!o&&(this.enable=!0,this.ctx.editing=!0,this.cellTarget=r,this.startEditByInput(this.cellTarget,e),this.ctx.emit("startEdit",this.cellTarget),this.ctx.emit("draw"))}editCell(e,t){const r=this.ctx.body.renderRows.find(d=>d.rowIndex===e);if(!r)return;const s=r.cells.find(d=>d.colIndex===t);if(!s)return;this.ctx.emit("setSelectorCell",s);const n=this.ctx.focusCell;if(!n||["index","index-selection","selection"].includes(n.type)||this.enable)return;const{rowKey:o,key:a}=n,l=this.ctx.database.getReadonly(o,a);n&&!l&&(this.enable=!0,this.ctx.editing=!0,this.cellTarget=n,this.startEditByInput(this.cellTarget),this.ctx.emit("startEdit",this.cellTarget),this.ctx.emit("draw"))}doneEdit(){this.enable&&(this.doneEditByInput(),this.ctx.emit("cellHideTooltip"),this.ctx.emit("doneEdit",this.cellTarget),this.enable=!1,this.ctx.editing=!1,this.resetEditorStyle(),setTimeout(()=>{this.focusInput()},0),this.ctx.emit("draw"))}resetEditorStyle(){const e=this.cellTarget;e&&(this.editorEl.style.left=`${e.drawX}px`,this.editorEl.style.top=`${e.drawY}px`,this.editorEl.style.maxWidth="1px",this.editorEl.style.maxHeight="1px",this.editorEl.style.zIndex="-1")}clearEditor(){this.doneEdit(),this.cellTarget=null,this.selectorArrStr="",this.ctx.clearSelector(),this.ctx.focusCell=void 0,this.inputEl.blur(),this.ctx.emit("draw")}destroy(){var e;(e=this.editorEl)==null||e.remove()}}let b_=class{constructor(i){h(this,"ctx"),h(this,"emptyEl"),this.ctx=i;const{EMPTY_TEXT:e,EMPTY_CUSTOM_STYLE:t}=this.ctx.config;this.ctx.emptyElement?this.emptyEl=this.ctx.emptyElement:(this.emptyEl=document.createElement("div"),this.emptyEl.innerText=e),this.emptyEl.className="e-virt-table-empty",this.emptyEl.style.display="none",this.ctx.containerElement.appendChild(this.emptyEl),this.ctx.on("emptyChange",({type:r,headerHeight:s,bodyHeight:n,footerHeight:o})=>{const a=s+(n+o)/2,l={display:r==="empty"?"block":"none",top:`${a}px`,...t};Object.assign(this.emptyEl.style,l)})}destroy(){this.emptyEl.remove()}};class __{constructor(e){h(this,"ctx"),h(this,"observer"),this.ctx=e,this.init()}arerMapsEqual(e,t){if(e.size!==t.size)return!1;for(let[r,s]of e)if(!t.has(r)||t.get(r)!==s)return!1;return!0}init(){this.observer=new MutationObserver(Kr(()=>{const e=this.ctx.overlayerElement.querySelectorAll('[data-auto-height="true"]'),t=new Map;e.forEach(s=>{const n=Number(s.getAttribute("data-row-index")),o=Number(s.getAttribute("data-col-index"));if(isNaN(n)||isNaN(o))return;const a=s.getBoundingClientRect(),l=`${n}​_${o}`;t.set(l,Math.round(a.height))});const r=this.ctx.database.getOverlayerAutoHeightMap();if(!this.arerMapsEqual(r,t)){if(this.ctx.database.setOverlayerAutoHeightMap(t),r.size===0&&t.size===0)return;this.ctx.emit("draw")}},16.67)),this.observer.observe(this.ctx.overlayerElement,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),this.ctx.overlayerElement.getAttribute("data-overlayer")==="default"&&this.ctx.on("overlayerChange",e=>{const t=this.ctx.overlayerElement;t.replaceChildren(),Object.assign(t.style,e.style),e.views.forEach(r=>{const s=document.createElement("div");s.className=r.class,Object.assign(s.style,r.style),r.views.forEach(n=>{const o=document.createElement("div");Object.assign(o.style,n.style),n.cells.forEach(a=>{const l=document.createElement("div");Object.assign(l.style,a.style),Object.keys(a.domDataset).forEach(d=>{l.setAttribute(d,a.domDataset[d])}),typeof a.render=="function"&&a.render(l,a),o.appendChild(l)}),s.appendChild(o)}),t.appendChild(s)})})}draw(){const e=this.getContainer();this.ctx.emit("overlayerChange",e)}destroy(){this.observer&&this.observer.disconnect(),this.ctx.emit("overlayerChange",{style:{},views:[]})}getContainer(){const e=this.getHeader(),t=this.getBody(),r=this.getFooter();let s=[];const{FOOTER_FIXED:n,FOOTER_POSITION:o}=this.ctx.config;return n?o==="top"?s=[e,r,t]:s=[e,t,r]:s=[e,t],{views:s}}getHeader(){const{fixedLeftWidth:e,fixedRightWidth:t,config:{SCROLLER_TRACK_SIZE:r,CSS_PREFIX:s}}=this.ctx,{visibleWidth:n,visibleHeight:o,renderCellHeaders:a}=this.ctx.header;let l=[],d=[],u=[];a.forEach(v=>{v.render&&(v.fixed==="left"?d.push(v):v.fixed==="right"?u.push(v):l.push(v))});const f=t-r,g={key:"left",style:{position:"absolute",top:"0px",left:"0px",overflow:"hidden",width:`${e}px`,height:`${o}px`},cells:d},m={key:"center",style:{position:"absolute",top:"0px",left:`${e}px`,overflow:"hidden",width:`${n-e-f+1}px`,height:`${o}px`},cells:l},x={key:"right",style:{position:"absolute",top:"0px",right:"0px",overflow:"hidden",width:`${f+1}px`,height:`${o}px`},cells:u};return{type:"header",class:`${s}-overlayer-header`,style:{position:"relative",overflow:"hidden",width:`${n}px`,height:`${o}px`},views:[g,m,x]}}getBody(){const e=[],t=[],r=[];let s=this.ctx.body.renderRows;this.ctx.config.FOOTER_FIXED||(s=s.concat(this.ctx.footer.renderRows)),s.forEach(v=>{v.cells.forEach(p=>{p.cellType==="footer"&&(p.render=p.renderFooter),p.render&&(p.fixed==="left"?t.push(p):p.fixed==="right"?r.push(p):e.push(p))})});const{fixedLeftWidth:n,fixedRightWidth:o,config:{SCROLLER_TRACK_SIZE:a,CSS_PREFIX:l}}=this.ctx,{visibleWidth:d,visibleHeight:u}=this.ctx.body,f=o-a,g={key:"left",style:{position:"absolute",top:`${.5}px`,left:`${.5}px`,overflow:"hidden",width:`${n}px`,height:`${u}px`},cells:t},m={key:"center",style:{position:"absolute",top:`${.5}px`,left:`${n-.5}px`,overflow:"hidden",width:`${d-n-f}px`,height:`${u}px`},cells:e},x={key:"right",style:{position:"absolute",top:"0px",right:"0px",overflow:"hidden",width:`${f}px`,height:`${u}px`},cells:r};return{type:"body",class:`${l}-overlayer-body`,style:{position:"relative",overflow:"hidden",width:`${d}px`,height:`${u}px`},views:[g,m,x]}}getFooter(){const e=[],t=[],r=[];this.ctx.footer.renderRows.forEach(x=>{x.cells.forEach(v=>{v.cellType==="footer"&&v.renderFooter&&(v.render=v.renderFooter,v.fixed==="left"?t.push(v):v.fixed==="right"?r.push(v):e.push(v))})});const{fixedLeftWidth:s,fixedRightWidth:n,config:{SCROLLER_TRACK_SIZE:o,CSS_PREFIX:a}}=this.ctx,{visibleWidth:l,visibleHeight:d}=this.ctx.footer,u=n-o,f={key:"left",style:{position:"absolute",top:`${.5}px`,left:`${.5}px`,overflow:"hidden",width:`${s}px`,height:`${d}px`},cells:t},g={key:"center",style:{position:"absolute",top:`${.5}px`,left:`${s-.5}px`,overflow:"hidden",width:`${l-s-u}px`,height:`${d}px`},cells:e},m={key:"right",style:{position:"absolute",top:`${.5}px`,right:`${.5}px`,overflow:"hidden",width:`${u}px`,height:`${d}px`},cells:r};return{type:"footer",class:`${a}-overlayer-footer`,style:{position:"relative",overflow:"hidden",width:`${l}px`,height:`${d}px`},views:[f,g,m]}}}class Gn{constructor(e,t=[],r={}){h(this,"container"),h(this,"menuData"),h(this,"onClick"),h(this,"activeSubmenus",new Set),h(this,"boundMouseEnterHandler"),h(this,"boundMouseLeaveHandler"),h(this,"boundClickHandler"),this.container=e,this.menuData=t,this.onClick=r.onClick,this.boundMouseEnterHandler=s=>this.handleMouseEvent(s,"enter"),this.boundMouseLeaveHandler=s=>this.handleMouseEvent(s,"leave"),this.boundClickHandler=s=>this.handleClick(s),this.createMenu(),this.bindEvents()}createMenu(){this.container.className="e-virt-table-main-menu",this.container.style.display="block";const e=document.createDocumentFragment();this.menuData.forEach(t=>{e.appendChild(this.createMenuItem(t))}),this.container.appendChild(e)}createMenuItem(e,t=!1){var r;const s=this.createElement("div",t?"e-virt-table-submenu-item":"e-virt-table-menu-item");s.setAttribute(t?"data-submenu":"data-menu",e.value),e.disabled&&s.classList.add("disabled");const n=this.createElement("div","e-virt-table-menu-item-content");if(e.icon){const a=this.createElement("span","e-virt-table-menu-item-icon");a.innerHTML=e.icon,n.appendChild(a)}else n.classList.add("menu-item-no-icon");const o=this.createElement("span","e-virt-table-menu-item-text");if(o.textContent=e.label,n.appendChild(o),s.appendChild(n),(r=e.children)!=null&&r.length){const a=this.createElement("span","e-virt-table-menu-arrow");a.innerHTML=Si,s.appendChild(a);const l=this.createSubmenu(e.children);s._submenu=l,this.container.appendChild(l)}return s}createSubmenu(e){const t=this.createElement("div","e-virt-table-submenu");return e.forEach(r=>{t.appendChild(this.createMenuItem(r,!0))}),t}createElement(e,t=""){const r=document.createElement(e);return t&&(r.className=t),r}bindEvents(){this.container.addEventListener("mouseenter",this.boundMouseEnterHandler,!0),this.container.addEventListener("mouseleave",this.boundMouseLeaveHandler,!0),this.container.addEventListener("click",this.boundClickHandler)}handleMouseEvent(e,t){e.stopPropagation();const r=e.target.closest(".e-virt-table-menu-item, .e-virt-table-submenu-item");r&&(this.container.contains(r)||r.classList.contains("e-virt-table-submenu-item"))&&(t==="enter"?this.handleHover(r):this.handleLeave(r))}handleHover(e){e.classList.contains("e-virt-table-menu-item")&&(this.container.querySelectorAll(".e-virt-table-menu-item").forEach(r=>r.classList.remove("active")),e.classList.contains("disabled")||e.classList.add("active"));const t=e._submenu||e.querySelector(".e-virt-table-submenu");t&&(this.hideSiblingSubmenus(e),this.showSubmenu(e,t))}handleLeave(e){const t=e._submenu||e.querySelector(".e-virt-table-submenu");setTimeout(()=>{const r=t;r&&!r.matches(":hover")&&!e.matches(":hover")&&(this.hideSubmenu(r),e.classList.contains("e-virt-table-menu-item")&&e.classList.remove("active"))},150)}hideSiblingSubmenus(e){let t;if(e.classList.contains("e-virt-table-menu-item"))t=this.container.querySelectorAll(".e-virt-table-menu-item");else{const r=e.closest(".e-virt-table-submenu");if(r)t=r.querySelectorAll(".e-virt-table-submenu-item");else return}t.forEach(r=>{r!==e&&r._submenu&&this.hideSubmenu(r._submenu)})}async showSubmenu(e,t){if(this.activeSubmenus.has(t))return;this.activeSubmenus.add(t),t.classList.add("show");const r=yr(e,t,async()=>{const s=this.container.getBoundingClientRect(),n=window.innerWidth,o=t.offsetWidth||200,a=n-s.right,l=s.left,d=a>=o||a>=l?"right-start":"left-start",{x:u,y:f}=await $i(e,t,{placement:d,middleware:[Di(8),Li({padding:8})]});Object.assign(t.style,{left:`${u}px`,top:`${f}px`})});t._cleanup=r}hideSubmenu(e){if(!this.activeSubmenus.has(e))return;this.activeSubmenus.delete(e),e.classList.remove("show"),this.hideAllChildSubmenus(e);const t=e;t._cleanup&&(t._cleanup(),delete t._cleanup)}hideAllChildSubmenus(e){e.querySelectorAll(".e-virt-table-submenu-item").forEach(t=>{if(t._submenu){const r=t._submenu;if(this.activeSubmenus.has(r)){this.activeSubmenus.delete(r),r.classList.remove("show");const s=r;s._cleanup&&(s._cleanup(),delete s._cleanup),this.hideAllChildSubmenus(r)}}})}handleClick(e){e.stopPropagation();const t=e.target.closest(".e-virt-table-menu-item, .e-virt-table-submenu-item");if(!t||t.classList.contains("disabled"))return;if(t.classList.contains("e-virt-table-menu-item")){const n=t._submenu||t.querySelector(".e-virt-table-submenu");if(n){this.showSubmenu(t,n);return}}const r=t.getAttribute("data-menu")||(t==null?void 0:t.getAttribute("data-submenu")),s=this.findMenuItem(r||"");s&&(s.event&&s.event(e,this.hide.bind(this)),this.onClick&&this.onClick(s,r||""))}findMenuItem(e,t=this.menuData){for(const r of t){if(r.value===e)return r;if(r.children){const s=this.findMenuItem(e,r.children);if(s)return s}}return null}positionMenu(e){const t={getBoundingClientRect:()=>({width:0,height:0,top:e.clientY,left:e.clientX,right:e.clientX,bottom:e.clientY,x:e.clientX,y:e.clientY}),contextElement:document.body};yr(t,this.container,()=>{$i(t,this.container,{placement:"right-start",middleware:[Di(),Li(),qr()]}).then(({x:r,y:s})=>{this.container&&Object.assign(this.container.style,{left:`${r}px`,top:`${s}px`})})})}hide(){this.cleanupAllSubmenus(this.container),this.container.style.display="none"}destroy(){this.container.removeEventListener("mouseenter",this.boundMouseEnterHandler,!0),this.container.removeEventListener("mouseleave",this.boundMouseLeaveHandler,!0),this.container.removeEventListener("click",this.boundClickHandler),this.cleanupAllSubmenus(this.container),this.container.style.display="none",this.container.replaceChildren()}removeMenuItem(e){const t=this.container.querySelector(`[data-menu="${e}"]`);if(!t)return!1;const r=t.querySelector(".e-virt-table-submenu");return r&&this.cleanupSubmenuRecursively(r),t.remove(),!0}removeSubMenuItem(e){const t=this.container.querySelector(`[data-submenu="${e}"]`);if(!t)return!1;const r=t.closest(".e-virt-table-submenu"),s=t._submenu;if(s&&this.cleanupSubmenuRecursively(s),t.remove(),r&&r.querySelectorAll(".e-virt-table-submenu-item").length===0){const n=this.container.querySelector("[data-menu]");if(n&&n._submenu===r)this.removeMenuItem(n.getAttribute("data-menu")||"");else{const o=this.container.querySelectorAll("[data-menu], [data-submenu]");for(const a of o)if(a._submenu===r){const l=a.getAttribute("data-menu")||a.getAttribute("data-submenu");l&&(a.hasAttribute("data-menu")?this.removeMenuItem(l):this.removeSubMenuItem(l));break}}}return!0}cleanupAllSubmenus(e){e.querySelectorAll(".e-virt-table-menu-item").forEach(t=>{t._submenu&&(this.cleanupSubmenuRecursively(t._submenu),t._submenu=void 0)})}cleanupSubmenuRecursively(e){const t=e;t._cleanup&&(t._cleanup(),delete t._cleanup),e.querySelectorAll(".e-virt-table-submenu-item").forEach(r=>{r._submenu&&this.cleanupSubmenuRecursively(r._submenu)}),e.remove()}}class R_{constructor(e){h(this,"ctx"),h(this,"contextMenuEl"),h(this,"currentDOMTreeMenu"),h(this,"isCustom",!1),this.ctx=e,this.ctx.contextMenuElement?(this.contextMenuEl=this.ctx.contextMenuElement,this.contextMenuEl.className="e-virt-table-main-menu",this.isCustom=!0):(this.contextMenuEl=document.createElement("div"),this.isCustom=!1),this.ctx.containerElement.appendChild(this.contextMenuEl),this.init()}init(){this.ctx.on("outsideMousedown",()=>{this.hide()}),this.ctx.on("cellContextMenuClick",(e,t)=>{if(this.isCustom){this.contextMenuEl.style.display="block",this.positionMenu(t);return}const{ENABLE_CONTEXT_MENU:r,CUSTOM_BODY_CONTEXT_MENU:s,CONTEXT_MENU:n}=this.ctx.config,o=[...n,...s];if(!r||o.length===0)return;t.preventDefault();const{xArr:a,yArr:l}=this.ctx.selector,[d,u]=a,[f,g]=l,{rowIndex:m,colIndex:x}=e;m>=f&&m<=g&&x>=d&&x<=u||this.ctx.emit("setSelectorCell",e,t),this.currentDOMTreeMenu&&this.currentDOMTreeMenu.destroy(),this.ctx.contextMenuIng=!0,this.currentDOMTreeMenu=new Gn(this.contextMenuEl,o,{onClick:(v,p)=>{p==="copy"?(this.ctx.emit("contextMenuCopy"),this.hide()):p==="paste"?(this.ctx.emit("contextMenuPaste"),this.hide()):p==="cut"?(this.ctx.emit("contextMenuCut"),this.hide()):p==="clearSelected"&&(this.ctx.emit("contextMenuClearSelected"),this.hide())}}),this.currentDOMTreeMenu.positionMenu(t)}),this.ctx.on("cellHeaderContextMenuClick",(e,t)=>{if(this.isCustom){this.contextMenuEl.style.display="block",this.positionMenu(t);return}const{SELECTOR_AREA_MIN_X:r,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MAX_X_OFFSET:n}=this.ctx.config,o=r,a=s||this.ctx.maxColIndex-n;if(e.colIndex<o||e.colIndex>a)return;const{HEADER_CONTEXT_MENU:l,CUSTOM_HEADER_CONTEXT_MENU:d,ENABLE_HEADER_CONTEXT_MENU:u}=this.ctx.config,f=[...l,...d];if(!u||f.length===0)return;t.preventDefault();const{xArr:g}=this.ctx.selector,[m,x]=g,{colIndex:v}=e;v>=m&&v<=x||(this.ctx.focusCellHeader=e,this.ctx.emit("selectCols",e)),this.currentDOMTreeMenu&&this.currentDOMTreeMenu.destroy();const p=this.ctx.database.getColumns(),w=f.map(E=>E.value==="visible"?{...E,children:this.filterColumns(p)}:E);this.ctx.contextMenuIng=!0,this.currentDOMTreeMenu=new Gn(this.contextMenuEl,w,{onClick:(E,C)=>{const{xArr:b}=this.ctx.selector,[_,B]=b;if(C==="fixedLeft"||C==="fixedRight"||C==="fixedNone"){const K=this.ctx.header.allCellHeaders.filter(S=>S.colIndex>=_&&S.colIndex<=B).filter(S=>S.level===0).filter(S=>!S.column.fixedDisabled).map(S=>S.key);this.ctx.database.setCustomHeaderFixedData(K,C==="fixedLeft"?"left":C==="fixedRight"?"right":""),this.hide()}else if(C==="hide"){const K=this.ctx.header.leafCellHeaders.filter(S=>S.colIndex>=_&&S.colIndex<=B).filter(S=>!S.children.length).filter(S=>!S.column.hideDisabled).map(S=>S.key);K.length>0&&this.ctx.database.setCustomHeaderHideData(K,!0),this.hide()}else if(C!=="visible")if(C.startsWith("visible_")){if(!E.key)return;if(E.children){const S=this.getLeafKeys(E.children);this.ctx.database.setCustomHeaderHideData(S,!1)}else this.ctx.database.setCustomHeaderHideData([E.key],!1);this.currentDOMTreeMenu&&this.currentDOMTreeMenu.removeSubMenuItem(C);const K=this.ctx.database.getColumns();Ut(K).filter(S=>S.hide).length===0&&this.hide()}else C==="resetHeader"&&(this.ctx.database.resetCustomHeader(),this.hide())}}),this.positionMenu(t)}),this.ctx.on("click",()=>{this.hide()}),this.ctx.on("onScroll",this.hide.bind(this)),this.ctx.on("resize",this.hide.bind(this))}positionMenu(e){const t={getBoundingClientRect:()=>({width:0,height:0,top:e.clientY,left:e.clientX,right:e.clientX,bottom:e.clientY,x:e.clientX,y:e.clientY}),contextElement:document.body};yr(t,this.contextMenuEl,()=>{$i(t,this.contextMenuEl,{placement:"right-start",middleware:[Di(),Li(),qr()]}).then(({x:r,y:s})=>{this.contextMenuEl&&Object.assign(this.contextMenuEl.style,{left:`${r}px`,top:`${s}px`})})})}filterColumns(e){const t=[];for(const r of e)if(r.children&&r.children.length>0){const s=this.filterColumns(r.children);s.length>0&&t.push({label:r.title,key:r.key,value:`visible_${r.key}`,children:s})}else r.hide&&t.push({label:r.title,value:`visible_${r.key}`,key:r.key});return t}getLeafKeys(e){return e.reduce((t,r)=>(!r.children||r.children.length===0?t.push(String(r.key)):t.push(...this.getLeafKeys(r.children)),t),[])}hide(){this.currentDOMTreeMenu&&(this.currentDOMTreeMenu.destroy(),this.currentDOMTreeMenu=void 0),this.contextMenuEl.style.display="none",this.ctx.contextMenuIng=!1}destroy(){var e;this.hide(),(e=this.contextMenuEl)==null||e.remove()}}class I_{constructor(e){if(h(this,"ctx"),h(this,"loadingEl"),this.ctx=e,this.ctx.loadingElement)this.loadingEl=this.ctx.loadingElement;else{this.loadingEl=document.createElement("div");const t=document.createElement("div");t.className="e-virt-table-loading-spinner";const r=this.ctx.icons.getSvg("loading");if(r){const n=new DOMParser().parseFromString(r.svg,"image/svg+xml").documentElement;t.appendChild(n)}const s=document.createElement("p");s.className="e-virt-table-loading-text",s.innerText=this.ctx.config.LOADING_TEXT,t.appendChild(s),this.loadingEl.appendChild(t)}this.loadingEl.className="e-virt-table-loading",this.loadingEl.style.display="none",this.ctx.containerElement.appendChild(this.loadingEl)}show(){this.loadingEl.style.display="flex"}hide(){this.loadingEl.style.display="none"}destroy(){this.loadingEl.remove()}}class S_{constructor(e){h(this,"ctx"),h(this,"container"),h(this,"input"),h(this,"prevBtn"),h(this,"nextBtn"),h(this,"closeBtn"),h(this,"countEl"),h(this,"loadingEl"),h(this,"isVisible",!1),h(this,"searchResults",[]),h(this,"currentIndex",-1),h(this,"searchData",[]),h(this,"isComposing",!1),this.ctx=e,this.container=this.createContainer(),this.ctx.containerElement.appendChild(this.container),this.bindEvents(),this.ctx.on("keydown",t=>{if(this.ctx.config.ENABLE_FINDER&&!this.ctx.editing){if((t.ctrlKey||t.metaKey)&&t.code==="KeyF"){t.preventDefault(),this.show();return}if(this.ctx.finding){if(t.code==="Escape"){t.preventDefault(),this.hide();return}if(t.code==="ArrowUp"||t.shiftKey&&t.key==="Enter"){t.preventDefault(),this.navigatePrevious();return}if(t.code==="ArrowDown"||t.key==="Enter"){t.preventDefault(),this.navigateNext();return}}}}),this.ctx.on("setSelector",()=>{this.hide()}),this.ctx.on("outsideMousedown",()=>{this.hide()})}async initSearchData(){this.showLoading(),this.searchData=[],setTimeout(()=>{const{allCellHeaders:e}=this.ctx.header;for(let s=0;s<e.length;s++){const n=e[s];n&&["string","number"].includes(typeof n.text)&&this.searchData.push({rowIndex:0,colIndex:n.colIndex,text:`${n.text}`,type:"header",colKey:n.key})}const{maxColIndex:t,maxRowIndex:r}=this.ctx;for(let s=0;s<r;s++)for(let n=0;n<t;n++){const o=this.ctx.database.getVirtualBodyCell(s,n,!1),a=o==null?void 0:o.getText();["string","number"].includes(typeof a)&&this.searchData.push({rowIndex:s,colIndex:n,text:`${a}`,type:"body"})}this.hideLoading()},0)}createContainer(){const e=document.createElement("div");e.className="e-virt-table-finder-bar";const t=document.createElement("div");t.className="e-virt-table-finder-bar-input-wrapper",this.input=document.createElement("input"),this.input.type="text",this.input.className="e-virt-table-finder-bar-input",this.input.placeholder="",t.appendChild(this.input),this.loadingEl=document.createElement("div"),this.loadingEl.className="e-virt-table-finder-bar-loading";const r=al;this.loadingEl.innerHTML=r,t.appendChild(this.loadingEl),this.countEl=document.createElement("span"),this.countEl.className="e-virt-table-finder-bar-count";const s=document.createElement("div");return s.className="e-virt-table-finder-bar-nav",this.prevBtn=document.createElement("button"),this.prevBtn.className="e-virt-table-finder-bar-nav-btn prev-btn",this.prevBtn.innerHTML=Si,this.nextBtn=document.createElement("button"),this.nextBtn.className="e-virt-table-finder-bar-nav-btn next-btn",this.nextBtn.innerHTML=Si,s.appendChild(this.prevBtn),s.appendChild(this.nextBtn),this.closeBtn=document.createElement("button"),this.closeBtn.className="e-virt-table-finder-bar-nav-btn close-btn",this.closeBtn.innerHTML="×",e.appendChild(t),e.appendChild(this.countEl),e.appendChild(s),e.appendChild(this.closeBtn),e}bindEvents(){this.input.addEventListener("input",()=>{this.isComposing||this.performSearch()}),this.input.addEventListener("compositionstart",()=>{this.isComposing=!0}),this.input.addEventListener("compositionend",()=>{this.isComposing=!1,this.performSearch()}),this.prevBtn.addEventListener("click",()=>{this.navigatePrevious()}),this.nextBtn.addEventListener("click",()=>{this.navigateNext()}),this.closeBtn.addEventListener("click",()=>{this.hide()})}performSearch(){const e=this.input.value.trim();if(this.searchResults=[],this.currentIndex=-1,!e){this.cearFinderBar(),this.updateCount();return}this.showLoading(),setTimeout(()=>{this.searchResults=this.searchData.filter(t=>t.text.toLowerCase().includes(e.toLowerCase())),this.searchResults.length>0?(this.currentIndex=0,this.scrollToCurrentResult()):this.cearFinderBar(),this.updateCount(),this.hideLoading()},0)}scrollToCurrentResult(){if(this.currentIndex<0||this.currentIndex>=this.searchResults.length)return;const e=this.searchResults[this.currentIndex];this.ctx.finderBar=e;const{rowIndex:t,colIndex:r}=e;this.ctx.emit("scrollToIndex",t,r)}navigateNext(){this.searchResults.length!==0&&(this.currentIndex=(this.currentIndex+1)%this.searchResults.length,this.scrollToCurrentResult(),this.updateCount())}navigatePrevious(){this.searchResults.length!==0&&(this.currentIndex=this.currentIndex<=0?this.searchResults.length-1:this.currentIndex-1,this.scrollToCurrentResult(),this.updateCount())}updateCount(){if(this.searchResults.length===0)this.input.value.trim()?(this.countEl.textContent="0/0",this.countEl.classList.add("no-results")):(this.countEl.textContent="",this.countEl.classList.remove("no-results"));else{const e=this.currentIndex+1,t=this.searchResults.length;this.countEl.textContent=`${e}/${t}`,this.countEl.classList.remove("no-results")}}show(){this.isVisible||(this.isVisible=!0,this.ctx.finding=!0,this.container.classList.add("show"),this.input.focus(),this.initSearchData())}showLoading(){var e;this.loadingEl.classList.add("show"),(e=this.loadingEl.parentElement)==null||e.classList.add("loading"),this.input.readOnly=!0}hideLoading(){var e;this.loadingEl.classList.remove("show"),(e=this.loadingEl.parentElement)==null||e.classList.remove("loading"),this.input.readOnly=!1}cearFinderBar(){this.ctx.finderBar={rowIndex:-1,colIndex:-1,text:"",type:"header"},this.ctx.emit("draw")}hide(){this.isVisible&&(this.isVisible=!1,this.container.classList.remove("show"),this.ctx.finding=!1,this.input.value="",this.searchResults=[],this.searchData=[],this.currentIndex=-1,this.hideLoading(),this.ctx.finderBar={rowIndex:-1,colIndex:-1,text:"",type:"header"},this.updateCount(),this.ctx.emit("draw"))}destroy(){this.hide(),this.container.remove()}}class T_{constructor(e,t){h(this,"options"),h(this,"scroller"),h(this,"header"),h(this,"body"),h(this,"footer"),h(this,"selector"),h(this,"autofill"),h(this,"tooltip"),h(this,"editor"),h(this,"empty"),h(this,"overlayer"),h(this,"contextMenu"),h(this,"loading"),h(this,"finderBar"),h(this,"animationFrameId"),h(this,"ctx"),this.options=t;const{overlayerElement:r,editorElement:s,emptyElement:n,contextMenuElement:o}=this.options,a=this.createContainer(e,r,s,n,o);this.ctx=new _b(a,this.options),this.header=new Sb(this.ctx),this.footer=new Ob(this.ctx),this.body=new Tb(this.ctx),this.scroller=new Rb(this.ctx),this.selector=new kb(this.ctx),this.autofill=new Db(this.ctx),this.tooltip=new E_(this.ctx),this.empty=new b_(this.ctx),this.editor=new C_(this.ctx),this.overlayer=new __(this.ctx),this.contextMenu=new R_(this.ctx),this.loading=new I_(this.ctx),this.finderBar=new S_(this.ctx),this.ctx.on("draw",()=>{this.draw()}),this.ctx.on("drawView",()=>{this.draw(!0)}),this.draw()}createContainer(e,t,r,s,n){e.className="e-virt-table-container";const o=document.createElement("div"),a=document.createElement("canvas"),l=t||document.createElement("div");o.className="e-virt-table-stage",e.tabIndex=0,a.className="e-virt-table-canvas",l.className="e-virt-table-overlayer",l.setAttribute("data-overlayer",t?"custom":"default");const d=r||document.createElement("div");d.className="e-virt-table-editor";const u=s,f=n;return o.appendChild(a),o.appendChild(l),e.appendChild(o),{containerElement:e,stageElement:o,canvasElement:a,overlayerElement:l,editorElement:d,emptyElement:u,contextMenuElement:f}}doDraw(e=!1){this.header.update(),this.footer.update(),this.body.update(),this.ctx.paint.clear(),this.body.draw(),this.footer.draw(),this.header.draw(),this.scroller.draw(),e||this.overlayer.draw()}draw(e=!1){this.animationFrameId&&cancelAnimationFrame(this.animationFrameId),this.animationFrameId=requestAnimationFrame(()=>{this.doDraw(e),this.body.updateAutoHeight()&&this.doDraw(e)})}loadConfig(e){this.ctx.config.init(e),this.ctx.database.init(!1),this.header.init(),this.ctx.emit("draw")}loadColumns(e){this.editor.doneEdit(),this.ctx.database.setColumns(e),this.header.init(),this.ctx.emit("draw")}loadData(e){this.editor.doneEdit(),this.ctx.database.setData(e),this.header.init(),this.tooltip.hide(),this.ctx.emit("draw")}loadFooterData(e){this.ctx.database.setFooterData(e),this.ctx.emit("draw")}setCustomHeader(e,t=!0){this.ctx.database.setCustomHeader(e,t),this.header.init(),this.ctx.emit("draw")}getCustomHeader(){return this.header.getCustomHeader()}showColumns(e,t=!0){this.ctx.database.setCustomHeaderHideData(e,!t),this.header.init(),this.ctx.emit("draw")}fixedColumns(e,t){this.ctx.database.setCustomHeaderFixedData(e,t),this.header.init(),this.ctx.emit("draw")}setLoading(e){this.ctx.loading=e,e?this.loading.show():this.loading.hide()}on(e,t){this.ctx.on(e,t)}emit(e,...t){this.ctx.emit(e,...t)}off(e,t){this.ctx.off(e,t)}filterMethod(e){this.ctx.database.setFilterMethod(e),this.ctx.database.init(!1),this.header.init(),this.ctx.emit("draw")}editCell(e,t){this.editor.editCell(e,t)}setItemValue(e,t,r,s=!0,n=!0,o=!1){this.ctx.database.setItemValue(e,t,r,s,n,o)}batchSetItemValue(e,t=!0){this.ctx.database.batchSetItemValue(e,t)}setItemValueByEditor(e,t,r,s=!0,n=!0){this.ctx.setItemValueByEditor(e,t,r,s,n),this.editor.doneEdit()}clearEditableData(e=null){const t=[0,this.ctx.maxColIndex],r=[0,this.ctx.maxRowIndex];return this.selector.clearSelectedData(t,r,!1,e)}clearEditor(){this.editor.clearEditor()}doLayout(){this.ctx.emit("draw")}getChangedData(){return this.ctx.database.getChangedData()}getChangedRows(){return this.ctx.database.getChangedRows()}setCurrentRowByRowIndex(e){this.ctx.currentCell=this.ctx.database.getVirtualBodyCell(e,0),this.ctx.emit("draw")}setCurrentRow(e){const t=this.ctx.database.getColumnByColIndex(0);t&&(this.ctx.currentCell=this.ctx.database.getVirtualBodyCellByKey(e,t.key),this.ctx.emit("draw"))}getCurrentRow(){const e=this.ctx.currentCell;return e?{row:e.row,rowIndex:e.rowIndex,rowKey:e.rowKey}:void 0}clearValidate(){this.ctx.database.clearValidate(),this.ctx.emit("draw")}validateFields(e,t=!0){return new Promise(async(r,s)=>{let n=[];for(let o=0;o<e.length;o++){const{rowKey:a,key:l}=e[o],d=await this.ctx.database.getValidator(a,l);Array.isArray(d)&&d.length&&n.push(d)}if(n.length){if(s(n),t){const[o]=n;if(Array.isArray(o)&&o.length){const[a]=o,{rowKey:l,key:d}=a;this.scrollToRowkey(l),this.scrollToColkey(d)}}this.ctx.emit("draw")}else r([]),this.ctx.emit("draw")})}async validate(e=!0){return new Promise(async(t,r)=>{try{const s=await this.getValidations();t(s)}catch(s){if(e&&Array.isArray(s)&&s.length){const[n]=s;if(Array.isArray(n)&&n.length){const[o]=n,{rowKey:a,key:l}=o,d=this.ctx.database.getRowForRowKey(a);if(d){const{parentRowKeys:u=[]}=d;u&&u.length&&this.setExpandRowKeys(u,!0)}this.scrollToRowkey(a),this.scrollToColkey(l)}}r(s)}})}setValidations(e){if(e.forEach(t=>{const{rowIndex:r,key:s,message:n,rowKey:o}=t;if(r!==void 0&&o===void 0){const a=this.ctx.database.getRowKeyForRowIndex(r);this.ctx.database.setValidationErrorByRowKey(a,s,n)}o&&this.ctx.database.setValidationErrorByRowKey(o,s,n)}),e&&Array.isArray(e)&&e.length){const[t]=e;if(t&&t.rowKey)this.scrollToRowkey(t.rowKey),this.scrollToColkey(t.key);else if(t&&t.rowIndex!==void 0&&t.rowIndex>=0&&t.key){const{rowIndex:r,key:s}=t;this.scrollToRowIndex(r),this.scrollToColkey(s)}}}getValidations(){return this.ctx.config.DISABLED?new Promise(e=>{e([])}):new Promise(async(e,t)=>{const r=this.ctx.database.getAllRowsData(),s=this.ctx.header.leafCellHeaders;let n=[];for(let o=0;o<r.length;o++)for(let a=0;a<s.length;a++){const l=this.ctx.database.getRowKeyByItem(r[o]),d=s[a].key,u=await this.ctx.database.getValidator(l,d);Array.isArray(u)&&u.length&&n.push(u)}n.length?(t(n),this.ctx.emit("draw")):(e([]),this.ctx.emit("draw"))})}hasValidationError(){return this.ctx.database.hasValidationError()}scrollTo(e,t){this.scroller.setScroll(e,t)}scrollXTo(e){this.scroller.setScrollX(e)}scrollToColkey(e){this.scroller.scrollToColkey(e)}scrollToRowkey(e){this.scroller.scrollToRowKey(e)}scrollToColIndex(e){this.scroller.scrollToColIndex(e)}scrollToRowIndex(e){this.scroller.scrollToRowIndex(e)}scrollYTo(e){this.scroller.setScrollY(e)}setExpandRowKeys(e,t=!0){this.ctx.database.setExpandRowKeys(e,t)}getExpandRowKeys(){return this.ctx.database.getExpandRowKeys()}clearSelection(){this.ctx.database.clearSelection(),this.ctx.emit("draw")}toggleRowSelection(e){const t=this.ctx.database.getRowKeyByItem(e);this.ctx.database.toggleRowSelection(t),this.ctx.emit("draw")}setSelectionByRows(e,t=!0){e.forEach(r=>{const s=this.ctx.database.getRowKeyByItem(r);this.ctx.database.setRowSelection(s,t,!1)}),this.ctx.emit("selectionChange",this.getSelectionRows()),this.ctx.emit("draw")}setSelectionByRowKeys(e,t=!0){e.forEach(r=>{this.ctx.database.setRowSelection(r,t,!1)}),this.ctx.emit("selectionChange",this.getSelectionRows()),this.ctx.emit("draw")}toggleAllSelection(){this.ctx.database.toggleAllSelection(),this.ctx.emit("draw")}toggleRowExpand(e,t){this.ctx.database.expandItem(e,t),this.ctx.emit("draw")}toggleExpandAll(e){this.ctx.database.expandAll(e),this.ctx.emit("draw")}getSelectionRows(){return this.ctx.database.getSelectionRows()}getPositionForRowIndex(e){return this.ctx.database.getPositionForRowIndex(e)}getCellValue(e,t){return this.ctx.database.getItemValue(e,t)}getCellValueByIndex(e,t){return this.ctx.database.getItemValueForRowIndexAndColIndex(e,t)}clearSort(){this.ctx.database.clearSort()}contextMenuHide(){this.contextMenu.hide()}getUtils(){return{mergeColCell:ub,mergeRowCell:db,getSpanArrByRow:sl,getSpanObjByColumn:nl}}getColumnByKey(e){var t;return(t=this.ctx.database.getColumnByKey(e))==null?void 0:t.column}clearChangeData(){this.ctx.database.clearChangeData(),this.ctx.emit("draw")}getReadonly(e,t){return this.ctx.database.getReadonly(e,t)}destroy(){this.overlayer.destroy(),this.empty.destroy(),this.editor.destroy(),this.tooltip.destroy(),this.selector.destroy(),this.autofill.destroy(),this.contextMenu.destroy(),this.loading.destroy(),this.finderBar.destroy(),this.ctx.destroy(),this.ctx.containerElement.remove()}}const O_=c.defineComponent((i,{emit:e})=>{const{cellRender:t,renderTableParams:r}=i,{row:s,field:n}=r;if(n){const o=c.ref(s[n]);return()=>{var a,l;return((l=(a=Gt.renders[t.name])==null?void 0:a.renderEdit)==null?void 0:l.call(a,o,t,r,e))??null}}else return()=>null},{name:"RenderEditCell",props:["cellRender","renderTableParams"],emits:["blur"]}),Zr=c.defineComponent({__name:"PCanvasTable",props:{columns:{},data:{},config:{default:()=>({})},footerData:{},loading:{type:Boolean}},emits:["change","selectionChange","ready"],setup(i,{expose:e,emit:t}){const r=t,s=c.ref([]),n=i,o=qa(),a=c.computed(()=>({...n,config:{AUTO_ROW_HEIGHT:!0,DISABLED:!0,...o,...n.config}}));let l=null;const d=c.useAttrs(),u=c.ref(null),f=c.ref(null),g=c.ref(null),m=c.ref(null),x=c.ref(),v=c.ref("text"),p=c.ref(),w={},E={},C=c.computed(()=>{const y=x.value;return y?{width:`${y.width}px`,height:`${y.height}px`}:{}}),b=y=>St[y]||(({cellValue:A})=>A),_=y=>{var A;return(A=Gt.renders[y])==null?void 0:A.renderDefault},B=(y,...A)=>({row:L,rowIndex:P,value:Y})=>y({row:L,rowIndex:P,cellValue:Y},...A),K=y=>{var A,L,P,Y,V;if((A=y.slots)!=null&&A.default&&T.isFunction((L=y.slots)==null?void 0:L.default))return W=>{var z,j;return(j=(z=y.slots)==null?void 0:z.default)==null?void 0:j.call(z,{row:W.row,column:y,rowIndex:W.rowIndex})};if((P=y.slots)!=null&&P.default&&T.isString((Y=y.slots)==null?void 0:Y.default))return`slot:${(V=y.slots)==null?void 0:V.default}`;if(y.cellRender&&y.cellRender.name)return W=>{var z,j;return(j=_(y.cellRender.name))==null?void 0:j(y.cellRender,{data:n.data,row:W.row,rowIndex:W.rowIndex,field:y.field||W.column.key,title:((z=W.column)==null?void 0:z.title)??""},{})}},S=y=>{var A,L;if((A=y.slots)!=null&&A.title&&T.isFunction((L=y.slots)==null?void 0:L.title))return P=>{var Y,V;return(V=(Y=y.slots)==null?void 0:Y.title)==null?void 0:V.call(Y,{column:y})}},I=y=>{var A,L,P,Y,V,W,z;return(A=y.slots)!=null&&A.edit&&(y.field||y.key)&&T.isFunction((L=y.slots)==null?void 0:L.edit)?w[`__slot:${y.field||y.key}`]=y:(P=y.editRender)!=null&&P.name&&(y.field||y.key)&&(E[y.field||y.key]=y.editRender),{...T.omit(y,["formatter"]),key:y.key||y.field||Fe(),formatter:T.isString(y.formatter)?B(b(y.formatter)):T.isArray(y.formatter)&&T.isString(y.formatter[0])?B(b(y.formatter[0]),...y.formatter.slice(1)):T.isFunction(y.formatter)?B(y.formatter):void 0,editorType:y.editorType??((Y=y.slots)!=null&&Y.edit&&(y.field||y.key)&&T.isFunction((V=y.slots)==null?void 0:V.edit)?`__slot:${y.field||y.key}`:(W=y.editRender)!=null&&W.name?y.editRender.name:void 0),render:K(y),renderHeader:S(y),children:(z=y.children)==null?void 0:z.map(j=>I(j))}};c.onMounted(()=>{u.value&&(l=new T_(u.value,{config:a.value.config,columns:n.columns.map(y=>I(y)),data:n.data,footerData:n.footerData,emptyElement:g.value||void 0,overlayerElement:m.value||void 0,editorElement:f.value||void 0}),Object.keys(d).forEach(y=>{const A=d[y];if(typeof A=="function"&&y.startsWith("on")){const L=y.charAt(2).toLowerCase()+y.slice(3);l==null||l.on(L,A)}}),l.on("change",y=>{r("change",y)}),l.on("overlayerChange",y=>{p.value=y,console.log("overlayerChange",y)}),l.on("startEdit",y=>{x.value=y,v.value=y.editorType,v.value}),l.on("doneEdit",()=>{v.value="text"}),l.on("selectionChange",y=>{s.value=y,r("selectionChange",y)}),r("ready",l))});function R(y){if(!l||!x.value)return;const{rowKey:A,key:L}=x.value;l==null||l.setItemValueByEditor(A,L,y)}const O=()=>document.body;return c.watch(()=>n.data,y=>{l==null||l.loadData(y)},{deep:!0}),Ar(()=>n.columns,(y,A)=>{T.isEqual(y,A)||l==null||l.loadColumns(y.map(L=>I(L)))},{deep:!0}),c.watch(()=>a.value.config,y=>{l==null||l.loadConfig(y)},{deep:!0}),c.watch(()=>n.footerData,y=>{l==null||l.loadFooterData(y||[])},{deep:!0}),c.watch(()=>n.loading,(y,A)=>{y!==A&&(l==null||l.setLoading(y))},{immediate:!0}),e({$table:l,selectedRecords:c.computed(()=>s.value),reloadData:()=>{l==null||l.loadData(n.data)}}),(y,A)=>{const L=c.resolveComponent("a-empty"),P=c.resolveComponent("a-spin");return c.openBlock(),c.createBlock(P,{spinning:i.loading},{default:c.withCtx(()=>{var Y,V,W,z,j,ne,Ve;return[c.createElementVNode("div",{ref_key:"eVirtTableRef",ref:u},[c.createElementVNode("div",{ref_key:"eVirtTableEditorRef",ref:f},[v.value.startsWith("__slot:")?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(w[v.value].slots.edit({row:x.value.row,column:w[v.value],rowIndex:x.value.rowIndex})),{key:0,bordered:!1,style:c.normalizeStyle(C.value),class:"ev-editor-wrapper","get-popup-container":O,value:x.value.value,"onUpdate:value":A[0]||(A[0]=be=>x.value.value=be),cell:x.value,onBlur:R},null,40,["style","value","cell"])):(Y=c.unref(Gt).renders[v.value])!=null&&Y.renderEdit?(c.openBlock(),c.createBlock(c.unref(O_),{key:1,"cell-render":E[x.value.key],class:"ev-editor-wrapper",style:c.normalizeStyle(C.value),"render-table-params":{data:n.data,row:(V=x.value)==null?void 0:V.row,rowIndex:((W=x.value)==null?void 0:W.rowIndex)??-1,field:((z=x.value)==null?void 0:z.key)??"",title:((ne=(j=x.value)==null?void 0:j.column)==null?void 0:ne.title)??""},bordered:!1,"get-popup-container":O,onBlur:R},null,8,["cell-render","style","render-table-params"])):c.createCommentVNode("",!0)],512),c.createElementVNode("div",{ref_key:"eVirtTableEmptyRef",ref:g},[c.renderSlot(y.$slots,"empty",{},()=>[c.createVNode(L,{description:"空数据"})])],512),c.createElementVNode("div",{ref_key:"eVirtTableOverlayerRef",ref:m},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(((Ve=p.value)==null?void 0:Ve.views)||[],be=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(be.class),style:c.normalizeStyle(be.style),key:be.type},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(be.views,Ae=>(c.openBlock(),c.createElementBlock("div",{style:c.normalizeStyle(Ae.style),key:Ae.key},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(Ae.cells,ee=>(c.openBlock(),c.createElementBlock("div",c.mergeProps({class:"canvas-cell",key:`${ee.rowKey}_${ee.key}`,style:{...ee.style}},{ref_for:!0},ee.domDataset),[typeof ee.render=="function"?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(ee.render(ee)),{key:0,bordered:!1})):typeof ee.render=="string"&&ee.render.startsWith("slot:")?c.renderSlot(y.$slots,ee.render.replace("slot:",""),c.mergeProps({key:1,ref_for:!0},ee,{cell:ee})):c.createCommentVNode("",!0)],16))),128))],4))),128))],6))),128))],512)],512)]}),_:3},8,["spinning"])}}}),k_={key:0},D_={key:1,class:"p-canvas-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"},L_={class:"flex items-center flex-1 gap-4px"},$_={key:2},M_={class:"flex items-center gap-4px"},A_={key:0,class:"w-full text-slate-5 pl-4"},wl=c.defineComponent({__name:"PCanvasGrid",props:{staticConfig:{},manualFetch:{type:Boolean},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},config:{},lazyReset:{type:Boolean,default:()=>It().lazyReset??!1},fitHeight:{default:()=>It().fitCanvasHeight??100}},emits:["toolbarButtonClick","toolbarToolClick","pick","resetQuery"],setup(i,{expose:e,emit:t}){var ai,li,Be,_e,fe;const r=i,s=c.useAttrs(),n=t,{formConfig:o,pageConfig:a,columns:l,toolbarConfig:d,proxyConfig:u,config:f,staticConfig:g}=c.toRefs(r),m=qa(),x=c.ref(Fe()),v=c.ref({}),p=c.computed(()=>({...r,config:{...m,...r.config}})),w=c.computed(()=>u.value&&u.value.ajax?a.value?"pagination":"list":"bad");c.computed(()=>w.value==="pagination"?{current:b.page,total:B.value,pageSize:b.size,responsive:!1,showSizeChanger:!0,showTotal:D=>`共${D}条数据`}:!1);const E=c.computed(()=>T.omit({labelCol:Mr,...o.value},["items"])),C=c.reactive({toolbar:!1,form:!1,table:!1}),b=c.reactive({page:1,size:((ai=a.value)==null?void 0:ai.pageSize)??10}),_=c.ref(0),B=c.ref(0),K=c.ref([]),S=c.ref(),I=c.ref(),R=c.ref(),O=c.ref(),y=c.ref(),A=c.ref(500),L=c.ref({}),P=D=>{L.value[b.page]=D},Y=c.reactive([...(((Be=(li=r.toolbarConfig)==null?void 0:li.buttons)==null?void 0:Be.map(D=>D.code))??[]).filter(D=>D),...(((fe=(_e=r.toolbarConfig)==null?void 0:_e.tools)==null?void 0:fe.map(D=>D.code))??[]).filter(D=>D)].reduce((D,H)=>(D[H]=!1,D),{})),V=(D,H)=>{Y[D]=H},W=D=>{T.isObject(D)?(Object.prototype.hasOwnProperty.call(D,"toolbar")&&(C.toolbar=D.toolbar),Object.prototype.hasOwnProperty.call(D,"form")&&(C.form=D.form),Object.prototype.hasOwnProperty.call(D,"table")&&(C.table=D.table)):T.isBoolean(D)&&(C.form=D,C.toolbar=D,C.table=D)},z=c.computed(()=>T.uniq(Object.values(L.value).flat(),D=>{var H;return D[((H=p.value.config)==null?void 0:H.ROW_KEY)??"id"]})),j=()=>{nt()},ne=c.computed(()=>z.value.map(D=>{var H;return D[((H=p.value.config)==null?void 0:H.ROW_KEY)??"id"]})),Ve=(D,H)=>H?{list:T.isString(H.list)?T.get(D,H.list):T.isFunction(H.list)?H.list(D):void 0,total:T.isString(H.total)?T.get(D,H.total):T.isFunction(H.total)?H.total(D):void 0,result:T.isString(H.result)?T.get(D,H.result):T.isFunction(H.result)?H.result(D):void 0,message:T.isString(H.message)?T.get(D,H.message):T.isFunction(H.message)?H.message(D):void 0}:{list:D},be=D=>{n("toolbarButtonClick",{data:K.value,code:D,selectedKeys:ne.value,records:z.value}),Et(D)},Ae=T.debounce(be,100),ee=({key:D})=>Ae(D),Xi=D=>{n("toolbarToolClick",{data:K.value,code:D,selectedKeys:ne.value,records:z.value}),Et(D)},zi=T.debounce(Xi,100),me=()=>new Promise(D=>{if(w.value!=="bad"){W({table:!0,form:!0});const{ajax:H}=u.value;H.query({form:v.value,page:b}).then(X=>{const{list:He,total:Ft,result:Xe,message:ze}=Ve(X,u.value.response);He?(K.value=He,_.value++):Xe?(K.value=Xe,B.value=Ft??Xe.length,_.value++):(K.value=[],_.value++,ze&&Ii(ze)),D(K.value)}).catch(X=>{console.error("fetchData error",X),D([])}).finally(()=>{W({table:!1,form:!1})})}}),Gi=(D,H)=>(b.page=D,b.size=H,me()),nt=()=>(b.page=1,L.value={},me()),wt=T.debounce(me,160),oi=(D,H)=>(Object.assign(v.value,D),b.page=1,H?Promise.resolve():wt()),Ui=(D,H)=>(v.value=D,b.page=1,H?Promise.resolve():wt()),Et=D=>{const{ajax:H}=u.value;switch(D){case"multiDelete":H.multiDelete&&(ne.value.length>0?tl({title:"警告",content:"确认删除选中的数据吗?"}).then(()=>{W({table:!0,toolbar:!0}),H.multiDelete(ne.value).then(()=>{ZC("删除成功"),nt()}).catch(()=>{JC("删除失败")}).finally(()=>{W({table:!1,toolbar:!1}),Y.multiDelete=!1})}):Ii("请选择要删除的数据"));break}},qi=c.computed(()=>!g.value||!g.value.selectable&&!g.value.tree?l.value:[g.value.selectable&&g.value.tree?{type:"selection-tree",width:40,widthFillDisable:!0,title:""}:g.value.selectable?{type:"selection",width:40,widthFillDisable:!0,title:""}:g.value.tree?{type:"tree",width:40,widthFillDisable:!0,title:""}:{type:"index",width:40,widthFillDisable:!0,title:""},...l.value]),ot=D=>{if(o.value&&o.value.items.length>0){if(o.value.customReset)o.value.customReset();else{const H={};zt(o.value.items,X=>{X.field&&X.itemRender?ve(X.itemRender.defaultValue)?H[X.field]=X.itemRender.defaultValue:H[X.field]=void 0:X.field&&X.slots&&(ve(X.slots.defaultValue)?H[X.field]=X.slots.defaultValue:H[X.field]=void 0)}),v.value=H}n("resetQuery")}b.page=1,D||wt()},Ct=()=>(L.value={},ot());let We=null;const Ne=()=>{We&&cancelAnimationFrame(We),We=requestAnimationFrame(()=>{if(We=null,!y.value)return;const D=y.value.getBoundingClientRect();A.value=Math.max(window.innerHeight-D.top-r.fitHeight,100)})};let xe=null;c.watch(O,D=>{xe==null||xe.disconnect(),xe=null,D&&(xe=new ResizeObserver(()=>Ne()),xe.observe(D))},{immediate:!0});let Ht,at=null;return c.onMounted(()=>{if(Ne(),window.addEventListener("resize",Ne),Ht=new MutationObserver(D=>{D.forEach(H=>{if(H.type==="attributes"&&H.attributeName==="style"){const X=H.target;window.getComputedStyle(X).display!=="none"&&Ne()}})}),R.value){Ht.observe(R.value,{attributes:!0,attributeFilter:["style"]}),at=new ResizeObserver(()=>Ne());let D=R.value.parentElement;for(let H=0;H<5&&D&&D!==document.body;H++)at.observe(D),D=D.parentElement}ot(r.manualFetch)}),c.onBeforeUnmount(()=>{We&&cancelAnimationFrame(We),window.removeEventListener("resize",Ne),Ht.disconnect(),xe==null||xe.disconnect(),at==null||at.disconnect()}),e({commitProxy:{query:wt,reload:Ct,reloadPage:nt,passQuery:oi,forcePassQuery:Ui},$canvasTable:c.computed(()=>I.value),selectedRowKeys:ne,setBtnLoading:V,selectedRecords:z,$form:c.computed(()=>S.value),getFormData:()=>v.value,setLoadings:W,resizeTable:Ne}),(D,H)=>{var Xe,ze,Kt;const X=c.resolveComponent("a-menu-item"),He=c.resolveComponent("a-menu"),Ft=c.resolveComponent("a-dropdown");return c.openBlock(),c.createElementBlock("div",c.mergeProps({ref_key:"boxEl",ref:R,class:"h-full p-wrapper flex flex-col gap-8px overflow-y-auto"},c.unref(s)),[w.value==="bad"?(c.openBlock(),c.createElementBlock("div",k_,"请检查配置")):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[(ze=(Xe=c.unref(o))==null?void 0:Xe.items)!=null&&ze.some(F=>F.field&&F.itemRender)?(c.openBlock(),c.createElementBlock("div",{key:0,class:"p-pane p-form-wrapper",ref_key:"pFormWrapper",ref:O},[c.createVNode(c.unref(M.Spin),{spinning:C.form},{default:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.unref(M.Form),c.mergeProps({key:x.value,ref_key:"formEl",ref:S,model:v.value},E.value,{onSubmit:j}),{default:c.withCtx(()=>[c.createVNode(c.unref(M.Row),{gutter:[6,12]},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(o).items,(F,pe)=>(c.openBlock(),c.createBlock(Br,{key:`_col_${F.field||pe}`,"form-data":v.value,item:F,onReset:H[0]||(H[0]=Re=>ot(r.lazyReset))},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["model"]))]),_:1},8,["spinning"])],512)):c.createCommentVNode("",!0),c.unref(d)?(c.openBlock(),c.createElementBlock("div",D_,[c.createElementVNode("div",L_,[c.unref(d).buttons&&c.unref(d).buttons.length>0?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(c.unref(d).buttons,(F,pe)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:pe},[F.dropdowns&&F.dropdowns.length?(c.openBlock(),c.createBlock(Ft,{key:0},{overlay:c.withCtx(()=>[c.createVNode(He,{onClick:ee},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(F.dropdowns,Re=>(c.openBlock(),c.createBlock(X,{key:Re.code},{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(Re.content),1)]),_:2},1024))),128))]),_:2},1024)]),default:c.withCtx(()=>[c.createVNode(c.unref(M.Button),{type:F.type,size:F.size??"middle",disabled:c.unref(d).disabled||F.disabled,loading:C.toolbar||!!F.code&&Y[F.code],danger:F.danger,shape:F.shape,ghost:F.ghost,block:F.block},{default:c.withCtx(()=>[F.icon?(c.openBlock(),c.createBlock(c.unref(he),{key:0,icon:F.icon},null,8,["icon"])):c.createCommentVNode("",!0),c.createTextVNode(" "+c.toDisplayString(F.content)+" ",1),c.createVNode(c.unref(Zt.DownOutlined))]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block"])]),_:2},1024)):F.code?(c.openBlock(),c.createBlock(c.unref(M.Button),{key:1,type:F.type,size:F.size??"middle",disabled:c.unref(d).disabled||F.disabled,loading:C.toolbar||!!F.code&&Y[F.code],danger:F.danger,shape:F.shape,ghost:F.ghost,block:F.block,onClick:Re=>c.unref(Ae)(F.code)},{default:c.withCtx(()=>[F.icon?(c.openBlock(),c.createBlock(c.unref(he),{key:0,icon:F.icon},null,8,["icon"])):c.createCommentVNode("",!0),c.createTextVNode(" "+c.toDisplayString(F.content),1)]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block","onClick"])):(c.openBlock(),c.createElementBlock("div",$_))],64))),128)):c.createCommentVNode("",!0)]),c.createElementVNode("span",M_,[c.unref(d).tools&&c.unref(d).tools.length>0?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(c.unref(d).tools,(F,pe)=>(c.openBlock(),c.createBlock(c.unref(M.Button),{key:pe,type:F.type,size:F.size??"middle",disabled:c.unref(d).disabled||F.disabled,danger:F.danger,shape:F.shape,ghost:F.ghost,block:F.block,onClick:Re=>c.unref(zi)(F.code),loading:C.toolbar||!!F.code&&Y[F.code]},{default:c.withCtx(()=>[F.icon?(c.openBlock(),c.createBlock(c.unref(he),{key:0,icon:F.icon},null,8,["icon"])):c.createCommentVNode("",!0),c.createTextVNode(" "+c.toDisplayString(F.content),1)]),_:2},1032,["type","size","disabled","danger","shape","ghost","block","onClick","loading"]))),128)):c.createCommentVNode("",!0)])])):c.createCommentVNode("",!0),c.createElementVNode("div",{ref_key:"tableWrapperEl",ref:y,class:c.normalizeClass("p-pane flex-1 h-0 p-inner-scroll")},[(Kt=c.unref(g))!=null&&Kt.selectable&&c.unref(g).showCount?(c.openBlock(),c.createElementBlock("div",A_," 已选:"+c.toDisplayString(ne.value.length),1)):c.createCommentVNode("",!0),c.createVNode(Zr,{ref_key:"canvasTableRef",ref:I,columns:qi.value,config:{...p.value.config,HEIGHT:A.value},data:K.value,loading:C.table,onSelectionChange:P},c.createSlots({_:2},[c.renderList(D.$slots,(F,pe)=>({name:pe,fn:c.withCtx(Re=>[c.renderSlot(D.$slots,pe,c.normalizeProps(c.guardReactiveProps(Re)))])}))]),1032,["columns","config","data","loading"]),w.value==="pagination"?(c.openBlock(),c.createBlock(c.unref(M.Pagination),{key:1,class:"p-canvas-pagination",size:"small",current:b.page,"page-size":b.size,total:B.value,onChange:Gi},null,8,["current","page-size","total"])):c.createCommentVNode("",!0)],512)],64))],16)}}}),Jr=c.defineComponent({__name:"PGroupBlock",props:{name:{},getFormSetting:{type:Function},source:{}},setup(i,{expose:e}){const t=i,r=c.ref(),{source:s}=c.toRefs(t),n=c.computed(()=>{var a;return(a=r.value)==null?void 0:a.$form}),o=c.computed(()=>t.getFormSetting(s.value));return e({$form:n}),(a,l)=>(c.openBlock(),c.createBlock(Hr,c.mergeProps({name:i.name,ref_key:"formEl",ref:r},o.value,{data:c.unref(s)}),null,16,["name","data"]))}}),N_=c.defineComponent({__name:"CollapseCard",props:{defaultCollapsed:{type:Boolean,default:!1},title:{default:void 0},collapsible:{type:Boolean,default:!1}},setup(i,{expose:e}){const t=i,r=c.ref(t.defaultCollapsed?[]:["content"]);return e({collapse:()=>{r.value=[]},expand:()=>{r.value=["content"]}}),(s,n)=>{const o=c.resolveComponent("a-collapse-panel"),a=c.resolveComponent("a-collapse"),l=c.resolveComponent("a-card");return i.collapsible?(c.openBlock(),c.createBlock(a,{key:0,"active-key":r.value,"onUpdate:activeKey":n[0]||(n[0]=d=>r.value=d),class:"collapsible-card"},{default:c.withCtx(()=>[c.createVNode(o,{key:"content","force-render":"",header:i.title},c.createSlots({_:2},[c.renderList(s.$slots,(d,u)=>({name:u,fn:c.withCtx(()=>[c.renderSlot(s.$slots,u)])}))]),1032,["header"])]),_:3},8,["active-key"])):(c.openBlock(),c.createBlock(l,{key:1,size:"small",title:i.title},c.createSlots({_:2},[c.renderList(s.$slots,(d,u)=>({name:u,fn:c.withCtx(()=>[c.renderSlot(s.$slots,u)])}))]),1032,["title"]))}}}),El=c.defineComponent({__name:"PFormGroup",props:c.mergeModels({name:{},getFormSetting:{type:Function},title:{},tabLabel:{},getTabLabel:{type:Function},editAble:{type:Boolean},showAdd:{type:Boolean},collapsible:{type:Boolean},defaultCollapsed:{type:Boolean},lazyErrorMark:{type:Boolean},forceRender:{type:Boolean},keepSerial:{type:Boolean},loading:{type:Boolean},itemMenus:{},createItem:{type:Function},max:{},menuHandler:{type:Function}},{modelValue:{type:Array,default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(i,{expose:e}){const t=M.Form.useForm,r=c.ref(),s=i,n=c.ref(),o=c.useModel(i,"modelValue"),a=c.ref(0),l=c.ref([]),d=c.ref([]),u=S=>{a.value=S},f=c.computed(()=>s.max??1/0),g=S=>{(s.createItem??(()=>Promise.resolve({})))({list:o.value}).then(R=>{var O;o.value=[...o.value,{...R,__index:(((O=T.max(o.value,y=>y.__index??-1))==null?void 0:O.__index)??-1)+1}],a.value=S})},m=s.itemMenus??[{content:"复制",code:"copy"},{content:"删除",code:"delete"}],x=S=>{var I,R,O,y,A,L;return((A=(y=(O=(R=(I=S==null?void 0:S.parentElement)==null?void 0:I.parentElement)==null?void 0:R.parentElement)==null?void 0:O.parentElement)==null?void 0:y.parentElement)==null?void 0:A.parentElement)??((L=n.value)==null?void 0:L.$el)??document.body},v=c.computed(()=>s.forceRender||o.value.length<=5),p=S=>{var R;const I=(R=o.value.find((O,y)=>y===S))==null?void 0:R.__index;q(I)&&(l.value=l.value.filter(O=>O!==I))},w=()=>{c.nextTick().then(()=>{var S,I;p(a.value),(I=(S=d.value[a.value])==null?void 0:S.$form)==null||I.validate()})},E=(S,I)=>{var R;return((R=s.getTabLabel)==null?void 0:R.call(s,S,I))??`${s.tabLabel} ${s.keepSerial?I+1:(S.__index??0)+1}`};c.watch(()=>o.value,()=>{if(!s.keepSerial){const S=o.value.filter(I=>!q(I.__index));S.length>0&&S.forEach(I=>{var R;I.__index=(((R=T.max(o.value,O=>O.__index??-1))==null?void 0:R.__index)??-1)+1})}},{immediate:!0});const C=({key:S},I,R)=>{var O;if(s.menuHandler&&T.isFunction(s.menuHandler))s.menuHandler({code:T.toString(S),data:I,index:R});else switch(S){case"delete":o.value=o.value.filter((y,A)=>A!==R),c.nextTick(()=>{d.value=d.value.filter(y=>!!y),R<=a.value&&a.value>0&&a.value--});break;case"copy":if(o.value.length>=f.value){Ii("已达到最大数量");return}o.value=[...o.value,T.clone({...T.omit(I,["id","__index"]),__index:(((O=T.max(o.value,y=>y.__index??-1))==null?void 0:O.__index)??-1)+1})];break}},b=T.debounce(C,100);c.watchEffect(()=>{o.value.length===0?a.value=0:a.value>=o.value.length&&(a.value=o.value.length-1)});const _=T.debounce(p,50);c.watchEffect(()=>{var R;const S=o.value.map((O,y)=>l.value.includes(O.__index)?y:void 0).filter(q),I=(R=r.value)==null?void 0:R.$el;I&&I.querySelectorAll(":scope >.ant-tabs-nav>.ant-tabs-nav-wrap>.ant-tabs-nav-list>.ant-tabs-tab>.ant-tabs-tab-btn").forEach((y,A)=>{S.includes(A)?y.classList.add("p-error-group-tab"):y.classList.remove("p-error-group-tab")})}),e({collapse:()=>{var S,I;(I=(S=n.value)==null?void 0:S.collapse)==null||I.call(S)},expand:()=>{var S,I;(I=(S=n.value)==null?void 0:S.expand)==null||I.call(S)},activeKey:c.computed(()=>a.value),setActiveKey:u,validateAll:()=>{const S=v.value?d.value.map(I=>{var R;return(R=I.$form)==null?void 0:R.validate()}):o.value.map(I=>{var R;return((R=t(I,s.getFormSetting(I).rules))==null?void 0:R.validate())??Promise.resolve()});return Promise.allSettled(S).then(I=>{if(l.value=I.map((R,O)=>{var y;return R.status==="rejected"&&typeof((y=o.value[O])==null?void 0:y.__index)=="number"?o.value[O].__index:void 0}).filter(R=>typeof R=="number"),!s.lazyErrorMark&&l.value.length){const R=l.value[0],O=o.value.findIndex(y=>y.__index===R);O!==-1&&(a.value=O)}return l.value.length?Promise.reject({error_indexes:l.value,results:I}):Promise.resolve(I)})},validate:async(S,I)=>{var O,y,A;const R=o.value.findIndex(L=>L.__index===S);try{return await(v.value?((y=(O=d.value[R])==null?void 0:O.$form)==null?void 0:y.validate())??Promise.resolve():((A=t(o.value[R],s.getFormSetting(o.value[R]).rules))==null?void 0:A.validate())??Promise.resolve()),l.value=l.value.filter(L=>L!==S),Promise.resolve()}catch(L){return!l.value.includes(S)&&!I&&(l.value=[...l.value,S]),Promise.reject(L)}},validateFields:async(S,I,R)=>{var P,Y;const O=o.value.findIndex(V=>V.__index===S),A=s.getFormSetting(o.value[O]).rules,L=t(o.value[O],A);try{return await(v.value?((Y=(P=d.value[O])==null?void 0:P.$form)==null?void 0:Y.validateFields(I))??Promise.resolve():Promise.allSettled(I.map(V=>L.validateField(V,o.value[O][V],A[V]??[])))),Promise.resolve()}catch(V){return!l.value.includes(S)&&!R&&(l.value=[...l.value,S]),Promise.reject(V)}}});const B=c.useSlots(),K=c.computed(()=>Object.keys(B).filter(S=>S.startsWith("group-")).map(S=>({original:S,target:S.replace("group-","")})));return(S,I)=>{const R=c.resolveComponent("a-spin");return c.openBlock(),c.createBlock(N_,{ref_key:"rootRef",ref:n,title:i.title,size:"small",collapsible:i.collapsible,"default-collapsed":i.defaultCollapsed},c.createSlots({default:c.withCtx(()=>[i.loading?(c.openBlock(),c.createBlock(R,{key:0,class:"w-full"})):(c.openBlock(),c.createBlock(c.unref(M.Tabs),{key:1,ref_key:"tabsRef",ref:r,type:"editable-card",activeKey:a.value,"onUpdate:activeKey":I[1]||(I[1]=O=>a.value=O),"hide-add":"",onChange:w},{rightExtra:c.withCtx(()=>[c.renderSlot(S.$slots,"rightExtra",{},()=>[i.showAdd&&o.value.length<f.value?(c.openBlock(),c.createBlock(c.unref(M.Button),{key:0,type:"link",onClick:I[0]||(I[0]=O=>g(o.value.length))},{default:c.withCtx(()=>[...I[2]||(I[2]=[c.createTextVNode(" + 新增 ",-1)])]),_:1})):c.createCommentVNode("",!0)])]),default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(o.value,(O,y)=>(c.openBlock(),c.createBlock(c.unref(M.TabPane),{key:y,tab:E(O,y),"force-render":v.value},{closeIcon:c.withCtx(()=>{var A;return[i.editAble&&((A=c.unref(m))!=null&&A.length)?(c.openBlock(),c.createBlock(c.unref(M.Dropdown),{key:0,"get-popup-container":x},{overlay:c.withCtx(()=>[c.createVNode(c.unref(M.Menu),{onClick:L=>c.unref(b)(L,O,y)},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(m).filter(L=>{var P;return((P=L.visibleMethod)==null?void 0:P.call(L,{data:O,index:y}))??!0}),L=>(c.openBlock(),c.createBlock(c.unref(M.MenuItem),{key:L.code},{default:c.withCtx(()=>[c.createElementVNode("div",null,c.toDisplayString(L.content),1)]),_:2},1024))),128))]),_:2},1032,["onClick"])]),default:c.withCtx(()=>[c.createVNode(c.unref(Zt.MoreOutlined))]),_:2},1024)):c.createCommentVNode("",!0)]}),default:c.withCtx(()=>[(c.openBlock(),c.createBlock(Jr,{ref_for:!0,ref_key:"blockInstance",ref:d,key:y,source:O,name:i.name?`${i.name}_${y}`:void 0,"get-form-setting":i.getFormSetting,onFocusCapture:A=>c.unref(_)(y),onClickCapture:A=>c.unref(_)(y)},null,8,["source","name","get-form-setting","onFocusCapture","onClickCapture"]))]),_:2},1032,["tab","force-render"]))),128))]),_:3},8,["activeKey"]))]),_:2},[c.renderList(K.value,O=>({name:O.target,fn:c.withCtx(()=>[c.renderSlot(S.$slots,O.original)])}))]),1032,["title","collapsible","default-collapsed"])}}}),B_={class:"w-full text-right p-2"},Cl=c.defineComponent({__name:"PromisePicker",props:{gridSetting:{},title:{default:"数据选择"},width:{default:"70%"},multipleAllowEmpty:{type:Boolean,default:!1},bodyStyle:{default:()=>({})},beforePick:{type:Function,default:()=>Promise.resolve()}},setup(i,{expose:e}){const t=c.ref(),r=c.ref(!1),s=i,n=c.computed(()=>{var x;return(x=s.gridSetting.selectConfig)==null?void 0:x.multiple});let o,a,l;const d=c.reactive({modal:!1}),u=()=>{l&&l()},f=()=>{d.modal=!1,l&&l()},g=({row:x,field:v})=>{o&&!n.value&&s.beforePick(x).then(()=>{d.modal=!1,o({row:x,field:v})})},m=()=>{var v;const x=((v=t.value)==null?void 0:v.selectedRecords)??[];x.length===0&&!s.multipleAllowEmpty?Ii("请选择数据"):s.beforePick(x).then(()=>{d.modal=!1,a(x)})};return c.onMounted(()=>{}),e({pick:()=>new Promise((x,v)=>{o=x,l=v,r.value=!1,d.modal=!0,c.nextTick(()=>{r.value=!0})}),pickMultiple:()=>new Promise((x,v)=>{a=x,l=v,r.value=!1,d.modal=!0,c.nextTick(()=>{r.value=!0})}),grid:t,hide:()=>{d.modal=!1}}),(x,v)=>(c.openBlock(),c.createBlock(c.unref(M.Modal),{open:d.modal,"onUpdate:open":v[0]||(v[0]=p=>d.modal=p),"destroy-on-close":"",title:i.title,width:i.width,footer:n.value?void 0:null,onCancel:u,"body-style":i.bodyStyle},c.createSlots({default:c.withCtx(()=>[c.createElementVNode("div",{style:c.normalizeStyle({minHeight:r.value?"unset":"642px"})},[c.createVNode(Fr,c.mergeProps(i.gridSetting,{ref_key:"gridEl",ref:t,onPick:g}),null,16)],4)]),_:2},[n.value?{name:"footer",fn:c.withCtx(()=>[c.createElementVNode("div",B_,[c.createElementVNode("span",null,[c.createVNode(c.unref(M.Button),{class:"mr-4",onClick:f},{default:c.withCtx(()=>[...v[1]||(v[1]=[c.createTextVNode(" 取消 ",-1)])]),_:1}),c.createVNode(c.unref(M.Button),{type:"primary",onClick:m},{default:c.withCtx(()=>[...v[2]||(v[2]=[c.createTextVNode(" 确定 ",-1)])]),_:1})])])]),key:"0"}:void 0]),1032,["open","title","width","footer","body-style"]))}});function bl(i){i&&Ga(i)}const H_={install(i){i.component("PForm",Hr),i.component("PGrid",Fr),i.component("PCanvasTable",Zr),i.component("PCanvasGrid",wl),i.component("PFormGroup",El),i.component("PGroupBlock",Jr),i.component("PromisePicker",Cl)},addFormatter:Ja,addRender:Nr,setup:bl};exports.PCanvasGrid=wl;exports.PCanvasTable=Zr;exports.PForm=Hr;exports.PFormGroup=El;exports.PGrid=Fr;exports.PGroupBlock=Jr;exports.PromisePicker=Cl;exports.addFormatter=Ja;exports.addRender=Nr;exports.cleanCol=Pi;exports.default=H_;exports.defaultItemResponsive=$r;exports.defaultLabelCol=Mr;exports.get24rest=Za;exports.getButtonResponsive=FC;exports.getTooltipRenderer=Ua;exports.getUIKitConfig=NC;exports.labelColDict=HC;exports.resetUIKitConfig=BC;exports.setUIKitConfig=Ga;exports.setup=bl;exports.watchPreviousDeep=Ar;