@vue-ui-kit/ant 2.3.0 → 2.3.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 c=require("vue"),M=require("ant-design-vue"),xt=require("@ant-design/icons-vue");function hl(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 dl=hl(xt);var ul={keyId:1,cookies:{path:"/"},treeOptions:{parentKey:"parentId",key:"id",children:"children"},parseDateFormat:"yyyy-MM-dd HH:mm:ss",firstDayOfWeek:1},Ie=ul;function fl(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 te=fl,gl=Object.prototype.toString,Bo=gl,vl=Bo;function ml(r){return function(e){return"[object "+r+"]"===vl.call(e)}}var Bt=ml,xl=Bt,pl=Array.isArray||xl("Array"),X=pl;function wl(r,e){return r&&r.hasOwnProperty?r.hasOwnProperty(e):!1}var ye=wl,yl=ye;function El(r,e,t){if(r)for(var i in r)yl(r,i)&&e.call(t,r[i],i,r)}var Ft=El,Cl=X,bl=te,_l=Ft;function Rl(r,e,t){return r&&(Cl(r)?bl:_l)(r,e,t)}var Q=Rl;function Sl(r){return function(e){return typeof e===r}}var yt=Sl,Il=yt,Tl=Il("function"),ie=Tl,Ol=Q;function kl(r,e){var t=Object[r];return function(i){var s=[];if(i){if(t)return t(i);Ol(i,e>1?function(o){s.push([""+o,i[o]])}:function(){s.push(arguments[e])})}return s}}var fr=kl,Ll=fr,Dl=Ll("keys",1),$e=Dl,$l=Bo,Ml=Ft,Al=te;function Vi(r,e){var t=r.__proto__.constructor;return e?new t(e):new t}function ii(r,e){return e?Fo(r,e):r}function Fo(r,e){if(r)switch($l.call(r)){case"[object Object]":{var t=Object.create(Object.getPrototypeOf(r));return Ml(r,function(n,a){t[a]=ii(n,e)}),t}case"[object Date]":case"[object RegExp]":return Vi(r,r.valueOf());case"[object Array]":case"[object Arguments]":{var i=[];return Al(r,function(n){i.push(ii(n,e))}),i}case"[object Set]":{var s=Vi(r);return s.forEach(function(n){s.add(ii(n,e))}),s}case"[object Map]":{var o=Vi(r);return o.forEach(function(n,a){o.set(a,ii(n,e))}),o}}return r}function Nl(r,e){return r&&Fo(r,e)}var gr=Nl,Hl=te,Bl=$e,Fl=X,Kl=gr,zr=Object.assign;function Gr(r,e,t){for(var i=e.length,s,o=1;o<i;o++)s=e[o],Hl(Bl(e[o]),t?function(n){r[n]=Kl(s[n],t)}:function(n){r[n]=s[n]});return r}var Pl=function(r){if(r){var e=arguments;if(r===!0){if(e.length>1)return r=Fl(r[1])?[]:{},Gr(r,e,!0)}else return zr?zr.apply(Object,e):Gr(r,e)}return r},ae=Pl,Ko=Ie,Yl=te,Vl=Q,Wl=ie,Xl=ae,_e=function(){};function zl(){Yl(arguments,function(r){Vl(r,function(e,t){_e[t]=Wl(e)?function(){var i=e.apply(_e.$context,arguments);return _e.$context=null,i}:e})})}function Po(r){return Xl(Ko,r)}function Gl(){return Ko}var Yo="3.7.8";_e.VERSION=Yo;_e.version=Yo;_e.mixin=zl;_e.setup=Po;_e.setConfig=Po;_e.getConfig=Gl;var Ul=_e;function ql(r,e,t){for(var i=r.length-1;i>=0;i--)e.call(t,r[i],i,r)}var vr=ql,Zl=vr,Jl=$e;function Ql(r,e,t){Zl(Jl(r),function(i){e.call(t,r[i],i,r)})}var Vo=Ql;function jl(r){return r===null}var Me=jl,ec=Me;function tc(r,e){return function(t){return ec(t)?e:t[r]}}var Et=tc,ic=Q,rc=ie,sc=Et;function oc(r,e,t){var i={};if(r)if(e)rc(e)||(e=sc(e)),ic(r,function(s,o){i[o]=e.call(t,s,o,r)});else return r;return i}var nc=oc;function ac(r){return r?r.constructor===Object:!1}var Ct=ac;function lc(r){return r!=="__proto__"&&r!=="constructor"}var Wo=lc,Ur=X,qr=Ct,cc=ie,hc=Q,dc=Wo;function Xo(r,e){return qr(r)&&qr(e)||Ur(r)&&Ur(e)?(hc(e,function(t,i){dc(i)&&(r[i]=cc(e)?t:Xo(r[i],t))}),r):e}var uc=function(r){r||(r={});for(var e=arguments,t=e.length,i,s=1;s<t;s++)i=e[s],i&&Xo(r,i);return r},fc=uc,gc=Q;function vc(r,e,t){var i=[];if(r&&arguments.length>1){if(r.map)return r.map(e,t);gc(r,function(){i.push(e.apply(t,arguments))})}return i}var ot=vc,mc=ye,xc=X;function pc(r,e,t,i,s){return function(o,n,a){if(o&&n){if(r&&o[r])return o[r](n,a);if(e&&xc(o)){for(var l=0,d=o.length;l<d;l++)if(!!n.call(a,o[l],l,o)===i)return[!0,!1,l,o[l]][t]}else for(var u in o)if(mc(o,u)&&!!n.call(a,o[u],u,o)===i)return[!0,!1,u,o[u]][t]}return s}}var Ri=pc,wc=Ri,yc=wc("some",1,0,!0,!1),zo=yc,Ec=Ri,Cc=Ec("every",1,1,!1,!0),Go=Cc,bc=ye;function _c(r,e){if(r){if(r.includes)return r.includes(e);for(var t in r)if(bc(r,t)&&e===r[t])return!0}return!1}var bt=_c,Zr=X,Jr=bt;function Rc(r,e){var t,i=0;if(Zr(r)&&Zr(e)){for(t=e.length;i<t;i++)if(!Jr(r,e[i]))return!1;return!0}return Jr(r,e)}var Uo=Rc,Qr=Q,Sc=bt,Ic=ie,Tc=Et;function Oc(r,e,t){var i=[];if(e){Ic(e)||(e=Tc(e));var s,o={};Qr(r,function(n,a){s=e.call(t,n,a,r),o[s]||(o[s]=1,i.push(n))})}else Qr(r,function(n){Sc(i,n)||i.push(n)});return i}var qo=Oc,kc=ot;function Lc(r){return kc(r,function(e){return e})}var mr=Lc,Dc=qo,$c=mr;function Mc(){for(var r=arguments,e=[],t=0,i=r.length;t<i;t++)e=e.concat($c(r[t]));return Dc(e)}var Ac=Mc,Nc="undefined",Ee=Nc,Hc=Ee,Bc=yt,Fc=Bc(Hc),Te=Fc,Kc=Me,Pc=Te;function Yc(r){return Kc(r)||Pc(r)}var Ae=Yc,Vc=/(.+)?\[(\d+)\]$/,Zo=Vc;function Wc(r){return r?r.splice&&r.join?r:(""+r).replace(/(\[\d+\])\.?/g,"$1.").replace(/\.$/,"").split("."):[]}var xr=Wc,Xc=Zo,zc=xr,Gc=ye,Uc=Te,Jo=Ae;function qc(r,e,t){if(Jo(r))return t;var i=Jc(r,e);return Uc(i)?t:i}function Zc(r,e){var t=e?e.match(Xc):"";return t?t[1]?r[t[1]]?r[t[1]][t[2]]:void 0:r[t[2]]:r[e]}function Jc(r,e){if(r){var t,i,s,o=0;if(r[e]||Gc(r,e))return r[e];if(i=zc(e),s=i.length,s){for(t=r;o<s;o++)if(t=Zc(t,i[o]),Jo(t))return o===s-1?t:void 0}return t}}var Kt=qc,jr=te,Qc=mr,es=ot,ts=X,jc=ie,eh=Ct,is=Te,th=Me,ih=Ae,rh=Kt,sh=Et,oh="asc",nh="desc";function sr(r,e){return is(r)?1:th(r)?is(e)?-1:1:r&&r.localeCompare?r.localeCompare(e):r>e?1:-1}function ah(r,e,t){return function(i,s){var o=i[r],n=s[r];return o===n?t?t(i,s):0:e.order===nh?sr(n,o):sr(o,n)}}function lh(r,e,t,i){var s=[];return t=ts(t)?t:[t],jr(t,function(o,n){if(o){var a=o,l;ts(o)?(a=o[0],l=o[1]):eh(o)&&(a=o.field,l=o.order),s.push({field:a,order:l||oh}),jr(e,jc(a)?function(d,u){d[n]=a.call(i,d.data,u,r)}:function(d){d[n]=a?rh(d.data,a):d.data})}}),s}function ch(r,e,t){if(r){if(ih(e))return Qc(r).sort(sr);for(var i,s=es(r,function(a){return{data:a}}),o=lh(r,s,e,t),n=o.length-1;n>=0;)i=ah(n,o[n],i),n--;return i&&(s=s.sort(i)),es(s,sh("data"))}return[]}var pr=ch,hh=pr,dh=hh,uh=dh;function fh(r,e){return r>=e?r:(r=r>>0)+Math.round(Math.random()*((e||9)-r))}var Qo=fh,gh=fr,vh=gh("values",0),_t=vh,mh=Qo,xh=_t;function ph(r){for(var e,t=[],i=xh(r),s=i.length-1;s>=0;s--)e=s>0?mh(0,s):0,t.push(i[e]),i.splice(e,1);return t}var jo=ph,wh=jo;function yh(r,e){var t=wh(r);return arguments.length<=1?t[0]:(e<t.length&&(t.length=e||0),t)}var Eh=yh;function Ch(r){return function(e){if(e){var t=r(e&&e.replace?e.replace(/,/g,""):e);if(!isNaN(t))return t}return 0}}var en=Ch,bh=en,_h=bh(parseFloat),nt=_h,rs=nt;function Rh(r,e,t){var i=[],s=arguments.length;if(r){if(e=s>=2?rs(e):0,t=s>=3?rs(t):r.length,r.slice)return r.slice(e,t);for(;e<t;e++)i.push(r[e])}return i}var at=Rh,Sh=Q;function Ih(r,e,t){var i=[];if(r&&e){if(r.filter)return r.filter(e,t);Sh(r,function(s,o){e.call(t,s,o,r)&&i.push(s)})}return i}var Th=Ih,Oh=Ri,kh=Oh("",0,2,!0),Lh=kh,Dh=Ri,$h=Dh("find",1,3,!0),Mh=$h,Ah=X,Nh=_t;function Hh(r,e,t){if(r){Ah(r)||(r=Nh(r));for(var i=r.length-1;i>=0;i--)if(e.call(t,r[i],i,r))return r[i]}}var Bh=Hh,Fh=$e;function Kh(r,e,t){if(r){var i,s,o=0,n=null,a=t,l=arguments.length>2,d=Fh(r);if(r.length&&r.reduce)return s=function(){return e.apply(n,arguments)},l?r.reduce(s,a):r.reduce(s);for(l&&(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 Ph=Kh,Yh=X;function Vh(r,e,t,i){if(Yh(r)&&r.copyWithin)return r.copyWithin(e,t,i);var s,o,n=e>>0,a=t>>0,l=r.length,d=arguments.length>3?i>>0:l;if(n<l&&(n=n>=0?n:l+n,n>=0&&(a=a>=0?a:l+a,d=d>=0?d:l+d,a<d)))for(s=0,o=r.slice(a,d);n<l&&!(o.length<=s);n++)r[n]=o[s++];return r}var Wh=Vh,Xh=X;function zh(r,e){var t,i=[],s=e>>0||1;if(Xh(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 Gh=zh,Uh=ot,qh=Et;function Zh(r,e){return Uh(r,qh(e))}var tn=Zh,Jh=ie,ss=Ae,Qh=Kt,jh=te;function ed(r){return function(e,t){if(e&&e.length){var i,s;return jh(e,function(o,n){t&&(o=Jh(t)?t(o,n,e):Qh(o,t)),!ss(o)&&(ss(i)||r(i,o))&&(s=n,i=o)}),e[s]}return i}}var rn=ed,td=rn,id=td(function(r,e){return r<e}),sn=id,rd=tn,sd=sn;function od(r){var e,t,i,s=[];if(r&&r.length)for(e=0,t=sd(r,function(o){return o?o.length:0}),i=t?t.length:0;e<i;e++)s.push(rd(r,e));return s}var on=od,nd=on;function ad(){return nd(arguments)}var ld=ad,cd=_t,hd=Q;function dd(r,e){var t={};return e=e||[],hd(cd(r),function(i,s){t[i]=e[s]}),t}var ud=dd,nn=X,fd=te;function an(r,e){var t=[];return fd(r,function(i){t=t.concat(nn(i)?e?an(i,e):i:[i])}),t}function gd(r,e){return nn(r)?an(r,e):[]}var vd=gd,md=ot,xd=X;function pd(r,e){for(var t=0,i=e.length;r&&t<i;)r=r[e[t++]];return i&&r?r:0}function wd(r,e){for(var t,i=arguments,s=[],o=[],n=2,a=i.length;n<a;n++)s.push(i[n]);if(xd(e)){for(a=e.length-1,n=0;n<a;n++)o.push(e[n]);e=e[a]}return md(r,function(l){if(o.length&&(l=pd(l,o)),t=l[e]||e,t&&t.apply)return t.apply(l,s)})}var yd=wd;function Ed(r,e){return(console[r]||console.log)(e)}var Cd=Ed;function bd(r,e){try{delete r[e]}catch{r[e]=void 0}}var ln=bd,_d=X,Rd=vr,Sd=Vo;function Id(r,e,t){return r&&(_d(r)?Rd:Sd)(r,e,t)}var cn=Id,Td=yt,Od=Td("object"),Si=Od,kd=ln,Ld=Ct,Dd=Si,$d=X,Md=Me,Ad=ae,Nd=Ft;function Hd(r,e,t){if(r){var i,s=arguments.length>1&&(Md(e)||!Dd(e)),o=s?t:e;if(Ld(r))Nd(r,s?function(n,a){r[a]=e}:function(n,a){kd(r,a)}),o&&Ad(r,o);else if($d(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 hn=Hd,Bd=ln,Fd=ie,Kd=X,Pd=Q,Yd=te,Vd=cn,Wd=hn,Xd=Ae;function zd(r){return function(e,t){return t===r}}function Gd(r,e,t){if(r){if(!Xd(e)){var i=[],s=[];return Fd(e)||(e=zd(e)),Pd(r,function(o,n,a){e.call(t,o,n,a)&&i.push(n)}),Kd(r)?Vd(i,function(o,n){s.push(r[o]),r.splice(o,1)}):(s={},Yd(i,function(o){s[o]=r[o],Bd(r,o)})),s}return Wd(r)}return r}var dn=Gd,Ud=Ie,os=Cd,qd=pr,Zd=gr,Jd=Ae,or=Q,Qd=dn,jd=ae;function eu(r,e){or(r,function(t){t[e]&&!t[e].length&&Qd(t,e)})}function tu(r,e){var t=jd({},Ud.treeOptions,e),i=t.strict,s=t.key,o=t.parentKey,n=t.children,a=t.mapChildren,l=t.sortKey,d=t.reverse,u=t.data,f=[],g={},m={},x,v,p;return l&&(r=qd(Zd(r),l),d&&(r=r.reverse())),or(r,function(E){x=E[s],m[x]&&os("warn","Duplicate primary key="+x),m[x]=!0}),or(r,function(E){x=E[s],u?(v={},v[u]=E):v=E,p=E[o],g[x]=g[x]||[],v[s]=x,v[o]=p,x===p&&(p=null,os("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&&Jd(p))&&(m[p]||f.push(v))}),i&&eu(r,n),f}var iu=tu,ru=Ie,su=te,ou=ae;function un(r,e,t,i){var s=i.key,o=i.parentKey,n=i.children,a=i.data,l=i.updated,d=i.clear;return su(t,function(u){var f=u[n];a&&(u=u[a]),l!==!1&&(u[o]=e?e[s]:null),r.push(u),f&&f.length&&un(r,u,f,i),d&&delete u[n]}),r}function nu(r,e){return un([],null,r,ou({},ru.treeOptions,e))}var au=nu;function lu(r){return function(e,t,i,s){var o=i||{},n=o.children||"children";return r(null,e,t,s,[],[],n,o)}}var Ii=lu,cu=Ii;function fn(r,e,t,i,s,o,n,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=o.concat([l]),t.call(i,l,d,e,f,r,g))return{index:d,item:l,path:f,items:e,parent:r,nodes:g};if(n&&l&&(m=fn(l,l[n],t,i,f.concat([n]),g,n),m))return m}}}var hu=cu(fn),du=hu,uu=Ii,fu=Q;function gn(r,e,t,i,s,o,n,a){var l,d;fu(e,function(u,f){l=s.concat([""+f]),d=o.concat([u]),t.call(i,u,f,e,l,r,d),u&&n&&(l.push(n),gn(u,u[n],t,i,l,d,n))})}var gu=uu(gn),vn=gu,vu=Ii,mu=ot;function mn(r,e,t,i,s,o,n,a){var l,d,u,f=a.mapChildren||n;return mu(e,function(g,m){return l=s.concat([""+m]),d=o.concat([g]),u=t.call(i,g,m,e,l,r,d),u&&g&&n&&g[n]&&(u[f]=mn(g,g[n],t,i,l,d,n,a)),u})}var xu=vu(mn),pu=xu,wu=vn;function yu(r,e,t,i){var s=[];return r&&e&&wu(r,function(o,n,a,l,d,u){e.call(i,o,n,a,l,d,u)&&s.push(o)},t),s}var Eu=yu,Cu=Ii,bu=te,_u=ae;function xn(r,e,t,i,s,o,n,a,l){var d,u,f,g,m,x=[],v=l.original,p=l.data,E=l.mapChildren||a,b=l.isEvery;return bu(t,function(y,C){d=o.concat([""+C]),u=n.concat([y]),g=r&&!b||i.call(s,y,C,t,d,e,u),m=a&&y[a],g||m?(v?f=y:(f=_u({},y),p&&(f[p]=y)),f[E]=xn(g,y,y[a],i,s,d,u,a,l),(g||f[E].length)&&x.push(f)):g&&x.push(f)}),x}var Ru=Cu(function(r,e,t,i,s,o,n,a){return xn(0,r,e,t,i,s,o,n,a)}),Su=Ru;function Iu(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 pn=Iu;function Tu(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 wn=Tu,Ou=yt,ku=Ou("number"),Oe=ku,Lu=Oe;function Du(r){return Lu(r)&&isNaN(r)}var $u=Du,Mu=yt,Au=Mu("string"),Ne=Au,Nu=Bt,Hu=Nu("Date"),Xe=Hu,Bu=parseInt,Pt=Bu;function Fu(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 Ku=Fu;function Pu(r){return r.getTime()}var ue=Pu,vi=Pt,ns=Ku,Yu=ue,Vu=Ne,Wu=Xe;function Yt(r){return"(\\d{"+r+"})"}function Xu(r){return r<10?r*100:r<100?r*10:r}function as(r){return isNaN(r)?r:vi(r)}var ut=Yt(2),gt=Yt("1,2"),yn=Yt("1,7"),En=Yt("3,4"),Cn=".{1}",Ot=Cn+gt,bn="(([zZ])|([-+]\\d{2}:?\\d{2}))",ls=[En,Ot,Ot,Ot,Ot,Ot,Cn+yn,bn],nr=[];for(var Wi=ls.length-1;Wi>=0;Wi--){for(var cs="",tt=0;tt<Wi+1;tt++)cs+=ls[tt];nr.push(new RegExp("^"+cs+"$"))}function zu(r){for(var e,t={},i=0,s=nr.length;i<s;i++)if(e=r.match(nr[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 hs=[["yyyy",En],["yy",ut],["MM",ut],["M",gt],["dd",ut],["d",gt],["HH",ut],["H",gt],["mm",ut],["m",gt],["ss",ut],["s",gt],["SSS",Yt(3)],["S",yn],["Z",bn]],_n={},Rn=["\\[([^\\]]+)\\]"];for(var tt=0;tt<hs.length;tt++){var Xi=hs[tt];_n[Xi[0]]=Xi[1]+"?",Rn.push(Xi[0])}var Gu=new RegExp(Rn.join("|"),"g"),ds={};function Uu(r,e){var t=ds[e];if(!t){var i=[],s=e.replace(/([$(){}*+.?\\^|])/g,"\\$1").replace(Gu,function(u,f){var g=u.charAt(0);return g==="["?f:(i.push(g),_n[u])});t=ds[e]={_i:i,_r:new RegExp(s)}}var o={},n=r.match(t._r);if(n){for(var a=t._i,l=1,d=n.length;l<d;l++)o[a[l-1]]=n[l];return o}return o}function qu(r){if(/^[zZ]/.test(r.Z))return new Date(ns(r));var e=r.Z.match(/([-+])(\d{2}):?(\d{2})/);return e?new Date(ns(r)-(e[1]==="-"?-1:1)*vi(e[2])*36e5+vi(e[3])*6e4):new Date("")}function Zu(r,e){if(r){var t=Wu(r);if(t||!e&&/^[0-9]{11,15}$/.test(r))return new Date(t?Yu(r):vi(r));if(Vu(r)){var i=e?Uu(r,e):zu(r);if(i.y)return i.M&&(i.M=as(i.M)-1),i.S&&(i.S=Xu(as(i.S.substring(0,3)))),i.Z?qu(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 re=Zu;function Ju(){return new Date}var Ti=Ju,Qu=Xe,ju=re,ef=Ti;function tf(r){var e,t=r?ju(r):ef();return Qu(t)?(e=t.getFullYear(),e%4===0&&(e%100!==0||e%400===0)):!1}var Sn=tf,rf=X,sf=ye;function of(r,e,t){if(r){if(rf(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(sf(r,o)&&e.call(t,r[o],o,r)===!1)break}}var nf=of,af=X,lf=ye;function cf(r,e,t){if(r){var i,s;if(af(r))for(i=r.length-1;i>=0&&e.call(t,r[i],i,r)!==!1;i--);else for(s=lf(r),i=s.length-1;i>=0&&e.call(t,r[s[i]],s[i],r)!==!1;i--);}}var hf=cf,df=X,uf=Ne,ff=ye;function gf(r,e){return function(t,i){if(t){if(t[r])return t[r](i);if(uf(t)||df(t))return e(t,i);for(var s in t)if(ff(t,s)&&i===t[s])return s}return-1}}var In=gf,vf=In,mf=pn,xf=vf("indexOf",mf),pf=xf,wf=In,yf=wn,Ef=wf("lastIndexOf",yf),Tn=Ef,Cf=X,bf=Ne,_f=Q;function Rf(r){var e=0;return bf(r)||Cf(r)?r.length:(_f(r,function(){e++}),e)}var On=Rf,Sf=Oe;function If(r){return Sf(r)&&isFinite(r)}var Tf=If,Of=X,kf=Me,Lf=function(r){return!kf(r)&&!isNaN(r)&&!Of(r)&&r%1===0},kn=Lf,Df=X,$f=kn,Mf=Me;function Af(r){return!Mf(r)&&!isNaN(r)&&!Df(r)&&!$f(r)}var Nf=Af,Hf=yt,Bf=Hf("boolean"),Ln=Bf,Ff=Bt,Kf=Ff("RegExp"),wr=Kf,Pf=Bt,Yf=Pf("Error"),Dn=Yf;function Vf(r){return r?r.constructor===TypeError:!1}var Wf=Vf;function Xf(r){for(var e in r)return!1;return!0}var $n=Xf,zf=Ee,Gf=typeof Symbol!==zf;function Uf(r){return Gf&&Symbol.isSymbol?Symbol.isSymbol(r):typeof r=="symbol"}var Mn=Uf,qf=Bt,Zf=qf("Arguments"),Jf=Zf,Qf=Ne,jf=Oe;function eg(r){return!!(r&&Qf(r.nodeName)&&jf(r.nodeType))}var tg=eg,ig=Ee,rg=typeof document===ig?0:document,yr=rg,sg=yr;function og(r){return!!(r&&sg&&r.nodeType===9)}var ng=og,ag=Ee,lg=typeof window===ag?0:window,An=lg,cg=An;function hg(r){return!!(cg&&(r&&r===r.window))}var dg=hg,ug=Ee,fg=typeof FormData!==ug;function gg(r){return fg&&r instanceof FormData}var vg=gg,mg=Ee,xg=typeof Map!==mg;function pg(r){return xg&&r instanceof Map}var wg=pg,yg=Ee,Eg=typeof WeakMap!==yg;function Cg(r){return Eg&&r instanceof WeakMap}var bg=Cg,_g=Ee,Rg=typeof Set!==_g;function Sg(r){return Rg&&r instanceof Set}var Ig=Sg,Tg=Ee,Og=typeof WeakSet!==Tg;function kg(r){return Og&&r instanceof WeakSet}var Lg=kg,Dg=ie,$g=Ne,Mg=X,Ag=ye;function Ng(r){return function(e,t,i){if(e&&Dg(t)){if(Mg(e)||$g(e))return r(e,t,i);for(var s in e)if(Ag(e,s)&&t.call(i,e[s],s,e))return s}return-1}}var Nn=Ng,Hg=Nn,Bg=Hg(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}),Er=Bg,us=Oe,fs=X,gs=Ne,Fg=wr,Kg=Xe,Pg=Ln,Yg=Te,vs=$e,Vg=Go;function Hn(r,e,t,i,s,o,n){if(r===e)return!0;if(r&&e&&!us(r)&&!us(e)&&!gs(r)&&!gs(e)){if(Fg(r))return t(""+r,""+e,s,o,n);if(Kg(r)||Pg(r))return t(+r,+e,s,o,n);var a,l,d,u=fs(r),f=fs(e);if(u||f?u&&f:r.constructor===e.constructor)return l=vs(r),d=vs(e),i&&(a=i(r,e,s)),l.length===d.length?Yg(a)?Vg(l,function(g,m){return g===d[m]&&Hn(r[g],e[d[m]],t,i,u||f?m:g,r,e)}):!!a:!1}return t(r,e,s,o,n)}var Bn=Hn;function Wg(r,e){return r===e}var Fn=Wg,Xg=Bn,zg=Fn;function Gg(r,e){return Xg(r,e,zg)}var Kn=Gg,ms=$e,Ug=Er,xs=Kn,qg=zo,Zg=Uo;function Jg(r,e){var t=ms(r),i=ms(e);if(i.length){if(Zg(t,i))return qg(i,function(s){return Ug(t,function(o){return o===s&&xs(r[o],e[s])})>-1})}else return!0;return xs(r,e)}var Qg=Jg,ps=Bn,ws=Fn,jg=ie,ev=Te;function tv(r,e,t){return jg(t)?ps(r,e,function(i,s,o,n,a){var l=t(i,s,o,n,a);return ev(l)?ws(i,s):!!l},t):ps(r,e,ws)}var iv=tv,rv=Mn,sv=Xe,ov=X,nv=wr,av=Dn,lv=Me;function cv(r){return lv(r)?"null":rv(r)?"symbol":sv(r)?"date":ov(r)?"array":nv(r)?"regexp":av(r)?"error":typeof r}var hv=cv,dv=Ie,uv=Ae;function fv(r){return""+(uv(r)?"":r)+dv.keyId++}var gv=fv,vv=Nn,mv=vv(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}),xv=mv,pv=Ct,wv=Ne;function yv(r){if(pv(r))return r;if(wv(r))try{return JSON.parse(r)}catch{}return{}}var Ev=yv,Cv=Ae;function bv(r){return Cv(r)?"":JSON.stringify(r)}var _v=bv,Rv=fr,Sv=Rv("entries",2),Iv=Sv,Tv=ie,Ov=X,kv=Q,Lv=Er;function Dv(r,e){return function(t,i){var s,o,n={},a=[],l=this,d=arguments,u=d.length;if(!Tv(i)){for(o=1;o<u;o++)s=d[o],a.push.apply(a,Ov(s)?s:[s]);i=0}return kv(t,function(f,g){((i?i.call(l,f,g,t):Lv(a,function(m){return m===g})>-1)?r:e)&&(n[g]=f)}),n}}var Pn=Dv,$v=Pn,Mv=$v(1,0),Av=Mv,Nv=Pn,Hv=Nv(0,1),Bv=Hv,Fv=_t;function Kv(r){return Fv(r)[0]}var Pv=Kv,Yv=_t;function Vv(r){var e=Yv(r);return e[e.length-1]}var Wv=Vv,Xv=Zo,zv=xr,ri=ye;function Gv(r,e){if(r){if(ri(r,e))return!0;var t,i,s,o,n,a,l=zv(e),d=0,u=l.length;for(n=r;d<u&&(a=!1,t=l[d],o=t?t.match(Xv):"",o?(i=o[1],s=o[2],i?n[i]&&ri(n[i],s)&&(a=!0,n=n[i][s]):ri(n,s)&&(a=!0,n=n[s])):ri(n,t)&&(a=!0,n=n[t]),a);d++)if(d===u-1)return!0}return!1}var Uv=Gv,ys=Pt,qv=xr,Zv=Wo,Jv=ye,Es=/(.+)?\[(\d+)\]$/;function Qv(r,e,t,i,s){if(r[e])t&&(r[e]=s);else{var o,n,a=e?e.match(Es):null;if(t)n=s;else{var l=i?i.match(Es):null;l&&!l[1]?n=new Array(ys(l[2])+1):n={}}return a?a[1]?(o=ys(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 jv(r,e,t){if(r&&Zv(e)){if((r[e]||Jv(r,e))&&!Cs(e))r[e]=t;else for(var i=r,s=qv(e),o=s.length,n=0;n<o;n++)if(!Cs(s[n])){var a=n===o-1;i=Qv(i,s[n],a,a?null:s[n+1],t)}}return r}function Cs(r){return r==="__proto__"||r==="constructor"||r==="prototype"}var em=jv,tm=$n,im=Si,rm=ie,sm=Et,om=Q;function nm(r){return function(){return tm(r)}}function am(r,e,t){var i,s={};return r&&(e&&im(e)?e=nm(e):rm(e)||(e=sm(e)),om(r,function(o,n){i=e?e.call(t,o,n,r):o,s[i]?s[i].push(o):s[i]=[o]})),s}var Yn=am,lm=Yn,cm=Ft;function hm(r,e,t){var i=lm(r,e,t||this);return cm(i,function(s,o){i[o]=s.length}),i}var dm=hm;function um(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 Vn=um,bs=$e,fm=at,gm=bt,vm=te,mm=ae;function xm(r,e){if(r&&e){var t=mm.apply(this,[{}].concat(fm(arguments,1))),i=bs(t);vm(bs(r),function(s){gm(i,s)&&(r[s]=t[s])})}return r}var pm=xm,wm=rn,ym=wm(function(r,e){return r>e}),Em=ym;function Cm(r){return(r.split(".")[1]||"").length}var Oi=Cm,bm=Pt;function _m(r,e){if(r.repeat)return r.repeat(e);var t=isNaN(e)?[]:new Array(bm(e));return t.join(r)+(t.length>0?r:"")}var Vt=_m;function Rm(r,e){return r.substring(0,e)+"."+r.substring(e,r.length)}var Wn=Rm,si=Vt,zi=Wn;function Sm(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]||"",l=t[7],d=t[8],u=d-a.length,f=d-o.length,g=d-n.length;return l==="+"?o?s+o+si("0",d):u>0?s+n+a+si("0",u):s+n+zi(a,d):o?f>0?s+"0."+si("0",Math.abs(f))+o:s+zi(o,f):g>0?s+"0."+si("0",Math.abs(g))+n+a:s+zi(n,g)+a}return e}var ze=Sm,_s=Oi,Rs=ze;function Im(r,e){var t=Rs(r),i=Rs(e);return parseInt(t.replace(".",""))*parseInt(i.replace(".",""))/Math.pow(10,_s(t)+_s(i))}var Xn=Im,Tm=Xn,Ss=nt,Om=ze;function km(r){return function(e,t){var i=Ss(e),s=i;if(i){t=t>>0;var o=Om(i),n=o.split("."),a=n[0],l=n[1]||"",d=l.substring(0,t+1),u=a+(d?"."+d:"");if(t>=l.length)return Ss(u);if(u=i,t>0){var f=Math.pow(10,t);s=Math[r](Tm(u,f))/f}else s=Math[r](u)}return s}}var Cr=km,Lm=Cr,Dm=Lm("round"),br=Dm,$m=Cr,Mm=$m("ceil"),zn=Mm,Am=Cr,Nm=Am("floor"),Gn=Nm,Hm=Ae,Bm=Oe,Fm=ze;function Km(r){return Bm(r)?Fm(r):""+(Hm(r)?"":r)}var se=Km,Pm=br,Ym=se,Vm=Vt,Wm=Wn;function Xm(r,e){e=e>>0;var t=Ym(Pm(r,e)),i=t.split("."),s=i[0],o=i[1]||"",n=e-o.length;return e?n>0?s+"."+o+Vm("0",n):s+Wm(o,Math.abs(n)):s}var _r=Xm,zm=Ie,Gm=br,Um=zn,qm=Gn,Zm=Oe,Jm=se,Qm=_r,jm=ze,ex=ae;function tx(r,e){var t=ex({},zm.commafyOptions,e),i=t.digits,s=Zm(r),o,n,a,l,d;return s?(o=(t.ceil?Um:t.floor?qm:Gm)(r,i),n=jm(i?Qm(o,i):o).split("."),l=n[0],d=n[1],a=l&&o<0,a&&(l=l.substring(1,l.length))):(o=Jm(r).replace(/,/g,""),n=o?[o]:[],l=n[0]),n.length?(a?"-":"")+l.replace(new RegExp("(?=(?!(\\b))(.{"+(t.spaceNumber||3)+"})+$)","g"),t.separator||",")+(d?"."+d:""):o}var ix=tx,rx=Pt,sx=en,ox=sx(rx),nx=ox,ax=Xn,Is=nt;function lx(r,e){var t=Is(r),i=Is(e);return ax(t,i)}var Rr=lx,Ts=Oi,Os=ze,ks=Rr;function cx(r,e){var t=Os(r),i=Os(e),s=Math.pow(10,Math.max(Ts(t),Ts(i)));return(ks(r,s)+ks(e,s))/s}var Un=cx,hx=Un,Ls=nt;function dx(r,e){return hx(Ls(r),Ls(e))}var ux=dx,Ds=Oi,$s=ze,Ms=nt,fx=_r;function gx(r,e){var t=Ms(r),i=Ms(e),s=$s(t),o=$s(i),n=Ds(s),a=Ds(o),l=Math.pow(10,Math.max(n,a)),d=n>=a?n:a;return parseFloat(fx((t*l-i*l)/l,d))}var vx=gx,As=Oi,Ns=ze,mx=Rr;function xx(r,e){var t=Ns(r),i=Ns(e),s=As(t),o=As(i),n=o-s,a=n<0,l=Math.pow(10,a?Math.abs(n):n);return mx(t.replace(".","")/i.replace(".",""),a?1/l:l)}var qn=xx,px=qn,Hs=nt;function wx(r,e){return px(Hs(r),Hs(e))}var yx=wx,Gi=Un,Ex=ie,Cx=X,bx=Q,_x=Kt;function Rx(r,e,t){var i=0;return bx(r&&r.length>2&&Cx(r)?r.sort():r,e?Ex(e)?function(){i=Gi(i,e.apply(t,arguments))}:function(s){i=Gi(i,_x(s,e))}:function(s){i=Gi(i,s)}),i}var Zn=Rx,Sx=qn,Ix=On,Tx=Zn;function Ox(r,e,t){return Sx(Tx(r,e,t),Ix(r))}var kx=Ox,Lx="first",Wt=Lx,Dx="last",ki=Dx;function $x(r){return r.getFullYear()}var Xt=$x,Mx=864e5,Rt=Mx;function Ax(r){return r.getMonth()}var Li=Ax,Nx=Xe,Hx=ue;function Bx(r){return Nx(r)&&!isNaN(Hx(r))}var fe=Bx,Bs=Wt,Fx=ki,Kx=Rt,Px=Xt,Fs=ue,Ks=Li,Yx=re,Vx=fe,Wx=Oe;function Jn(r,e,t){var i=e&&!isNaN(e)?e:0;if(r=Yx(r),Vx(r)){if(t===Bs)return new Date(Px(r),Ks(r)+i,1);if(t===Fx)return new Date(Fs(Jn(r,i+1,Bs))-1);if(Wx(t)&&r.setDate(t),i){var s=r.getDate();if(r.setMonth(Ks(r)+i),s!==r.getDate())return r.setDate(1),new Date(Fs(r)-Kx)}}return r}var zt=Jn,Xx=Wt,Ps=ki,Ys=Xt,zx=zt,Gx=re,Ux=fe;function qx(r,e,t){var i;if(r=Gx(r),Ux(r)&&(e&&(i=e&&!isNaN(e)?e:0,r.setFullYear(Ys(r)+i)),t||!isNaN(t))){if(t===Xx)return new Date(Ys(r),0,1);if(t===Ps)return r.setMonth(11),zx(r,0,Ps);r.setMonth(t)}return r}var Di=qx,Zx=zt,Jx=re,Qx=fe;function jx(r){var e=r.getMonth();return e<3?1:e<6?2:e<9?3:4}function ep(r,e,t){var i,s=e&&!isNaN(e)?e*3:0;return r=Jx(r),Qx(r)?(i=(jx(r)-1)*3,r.setMonth(i),Zx(r,s,t)):r}var tp=ep,Vs=Wt,ip=ki,rp=Pt,sp=Xt,op=Li,np=ue,ap=re,lp=fe;function Qn(r,e,t){if(r=ap(r),lp(r)&&!isNaN(e)){if(r.setDate(r.getDate()+rp(e)),t===Vs)return new Date(sp(r),op(r),r.getDate());if(t===ip)return new Date(np(Qn(r,1,Vs))-1)}return r}var jn=Qn;function cp(r){return r.toUpperCase()}var ea=cp,hp=Rt,dp=hp*7,ta=dp,up=Ie,Ui=Rt,fp=ta,gp=ue,vp=re,mp=fe,Ws=Oe;function xp(r,e,t,i){if(r=vp(r),mp(r)){var s=Ws(t),o=Ws(i),n=gp(r);if(s||o){var a=o?i:up.firstDayOfWeek,l=r.getDay(),d=s?t:l;if(l!==d){var u=0;a>l?u=-(7-a+l):a<l&&(u=a-l),d>a?n+=((d===0?7:d)-a+u)*Ui:d<a?n+=(7-a+d+u)*Ui:n+=u*Ui}}return e&&!isNaN(e)&&(n+=e*fp),new Date(n)}return r}var ia=xp,pp=Ie,oi=Rt,wp=ta,yp=Oe,Ep=bt,Cp=re,bp=fe,Xs=ia,_p=Vn,Rp=ot,ni=ue,Sp=Rp(_p(0,7),function(r){return[(r+1)%7,(r+2)%7,(r+3)%7]});function zs(r,e){var t=new Date(r).getDay();return Ep(Sp[e],t)}function Ip(r,e){return function(t,i){var s=yp(i)?i:pp.firstDayOfWeek,o=Cp(t);if(bp(o)){var n=Xs(o,0,s,s),a=r(n),l=ni(a),d=ni(n),u=d+oi*6,f=new Date(u),g=Xs(a,0,s,s),m=ni(g),x;if(d===m)return 1;if(e(n,f)){for(x=ni(r(f));x<u;x+=oi)if(zs(x,s))return 1}var v=m+oi*6,p=new Date(u),E=1;if(e(g,p)){for(E=0,x=l;x<v;x+=oi)if(zs(x,s)){E++;break}}return Math.floor((d-m)/wp)+E}return NaN}}var ra=Ip,Tp=ra,Op=Tp(function(r){return new Date(r.getFullYear(),0,1)},function(r,e){return r.getFullYear()!==e.getFullYear()}),sa=Op,kp=Xt,Lp=Li;function Dp(r){return new Date(kp(r),Lp(r),r.getDate())}var $p=Dp,Mp=ue,Ap=$p;function Np(r){return Mp(Ap(r))}var Hp=Np,Bp=Rt,Fp=Wt,Gs=Hp,Kp=Di,Pp=re,Yp=fe;function Vp(r){return r=Pp(r),Yp(r)?Math.floor((Gs(r)-Gs(Kp(r,0,Fp)))/Bp)+1:NaN}var oa=Vp,Wp=se,Xp=Te,zp=Vt;function Gp(r,e,t){var i=Wp(r);return e=e>>0,t=Xp(t)?" ":""+t,i.padStart?i.padStart(e,t):e>i.length?(e-=i.length,e>t.length&&(t+=zp(t,e/t.length)),t.slice(0,e)+i):i}var na=Gp,kt=Ie,Up=ea,qp=Xt,Us=Li,Zp=re,Jp=sa,Qp=oa,jp=ae,e0=fe,t0=ie,be=na;function Fe(r,e,t,i){var s=e[t];return s?t0(s)?s(i,t,r):s[i]:i}var i0=/\[([^\]]+)]|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 r0(r,e,t){if(r){if(r=Zp(r),e0(r)){var i=e||kt.parseDateFormat||kt.formatString,s=r.getHours(),o=s<12?"am":"pm",n=jp({},kt.parseDateRules||kt.formatStringMatchs,t?t.formats:null),a=function(y,C){return(""+qp(r)).substr(4-C)},l=function(y,C){return be(Us(r)+1,C,"0")},d=function(y,C){return be(r.getDate(),C,"0")},u=function(y,C){return be(s,C,"0")},f=function(y,C){return be(s<=12?s:s-12,C,"0")},g=function(y,C){return be(r.getMinutes(),C,"0")},m=function(y,C){return be(r.getSeconds(),C,"0")},x=function(y,C){return be(r.getMilliseconds(),C,"0")},v=function(y,C){var T=r.getTimezoneOffset()/60*-1;return Fe(r,n,y,(T>=0?"+":"-")+be(T,2,"0")+(C===1?":":"")+"00")},p=function(y,C){return be(Fe(r,n,y,Jp(r,(t?t.firstDay:null)||kt.firstDayOfWeek)),C,"0")},E=function(y,C){return be(Fe(r,n,y,Qp(r)),C,"0")},b={yyyy:a,yy:a,MM:l,M:l,dd:d,d,HH:u,H:u,hh:f,h:f,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(y){return Fe(r,n,y,o)},A:function(y){return Fe(r,n,y,Up(o))},e:function(y){return Fe(r,n,y,r.getDay())},E:function(y){return Fe(r,n,y,r.getDay())},q:function(y){return Fe(r,n,y,Math.floor((Us(r)+3)/3))}};return i.replace(i0,function(y,C){return C||(b[y]?b[y](y,y.length):y)})}return"Invalid Date"}return""}var aa=r0,s0=ue,o0=Ti,n0=Date.now||function(){return s0(o0())},la=n0,a0=ue,l0=la,c0=re,h0=Xe,d0=function(r,e){if(r){var t=c0(r,e);return h0(t)?a0(t):t}return l0()},u0=d0,qs=aa;function f0(r,e,t){return r&&e?(r=qs(r,t),r!=="Invalid Date"&&r===qs(e,t)):!1}var g0=f0,v0=ra,m0=v0(function(r){return new Date(r.getFullYear(),r.getMonth(),1)},function(r,e){return r.getMonth()!==e.getMonth()}),x0=m0,p0=Di,w0=re,y0=fe,E0=Sn;function C0(r,e){return r=w0(r),y0(r)?E0(p0(r,e))?366:365:NaN}var b0=C0,_0=Rt,R0=Wt,S0=ki,Zs=ue,Js=zt,I0=re,T0=fe;function O0(r,e){return r=I0(r),T0(r)?Math.floor((Zs(Js(r,e,S0))-Zs(Js(r,e,R0)))/_0)+1:NaN}var k0=O0,Qs=ue,L0=Ti,js=re,eo=fe,to=[["yyyy",31536e6],["MM",2592e6],["dd",864e5],["HH",36e5],["mm",6e4],["ss",1e3],["S",0]];function D0(r,e){var t,i,s,o,n,a,l={done:!1,time:0};if(r=js(r),e=e?js(e):L0(),eo(r)&&eo(e)&&(t=Qs(r),i=Qs(e),t<i))for(o=l.time=i-t,l.done=!0,a=0,n=to.length;a<n;a++)s=to[a],o>=s[1]?a===n-1?l[s[0]]=o||0:(l[s[0]]=Math.floor(o/s[1]),o-=l[s[0]]*s[1]):l[s[0]]=0;return l}var $0=D0,M0=se,A0=Te,N0=Vt;function H0(r,e,t){var i=M0(r);return e=e>>0,t=A0(t)?" ":""+t,i.padEnd?i.padEnd(e,t):e>i.length?(e-=i.length,e>t.length&&(t+=N0(t,e/t.length)),i+t.slice(0,e)):i}var B0=H0,F0=se,K0=Vt;function P0(r,e){return K0(F0(r),e)}var Y0=P0,V0=se;function W0(r){return r&&r.trimRight?r.trimRight():V0(r).replace(/[\s\uFEFF\xA0]+$/g,"")}var ca=W0,X0=se;function z0(r){return r&&r.trimLeft?r.trimLeft():X0(r).replace(/^[\s\uFEFF\xA0]+/g,"")}var ha=z0,G0=ca,U0=ha;function q0(r){return r&&r.trim?r.trim():G0(U0(r))}var da=q0,Z0={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},ua=Z0,J0=se,Q0=$e;function j0(r){var e=new RegExp("(?:"+Q0(r).join("|")+")","g");return function(t){return J0(t).replace(e,function(i){return r[i]})}}var fa=j0,e1=ua,t1=fa,i1=t1(e1),r1=i1,io=ua,s1=fa,o1=Q,ga={};o1(io,function(r,e){ga[io[e]]=e});var n1=s1(ga),a1=n1;function l1(r,e,t){return r.substring(e,t)}var va=l1;function c1(r){return r.toLowerCase()}var ma=c1,h1=se,Ke=va,Lt=ea,d1=ma,qi={};function u1(r){if(r=h1(r),qi[r])return qi[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=d1(s),o?n>2&&o+n<e?Lt(Ke(s,0,1))+Ke(s,1,n-1)+Lt(Ke(s,n-1,n)):Lt(Ke(s,0,1))+Ke(s,1,n):n>1&&o+n<e?Ke(s,0,n-1)+Lt(Ke(s,n-1,n)):s}).replace(/(-[a-zA-Z])/g,function(i,s){return Lt(Ke(s,1,s.length))}),qi[r]=t,t}var f1=u1,g1=se,ft=va,Pe=ma,Zi={};function v1(r){if(r=g1(r),Zi[r])return Zi[r];if(/^[A-Z]+$/.test(r))return Pe(r);var e=r.replace(/^([a-z])([A-Z]+)([a-z]+)$/,function(t,i,s,o){var n=s.length;return n>1?i+"-"+Pe(ft(s,0,n-1))+"-"+Pe(ft(s,n-1,n))+o:Pe(i+"-"+s+o)}).replace(/^([A-Z]+)([a-z]+)?$/,function(t,i,s){var o=i.length;return Pe(ft(i,0,o-1)+"-"+ft(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||"")+Pe(ft(s,0,a-1))+"-"+Pe(ft(s,a-1,a))+o:(i||"")+(n?"-":"")+Pe(s)+(o||"")});return e=e.replace(/([-]+)/g,function(t,i,s){return s&&s+i.length<e.length?"-":""}),Zi[r]=e,e}var m1=v1,x1=se;function p1(r,e,t){var i=x1(r);return(arguments.length===1?i:i.substring(t)).indexOf(e)===0}var w1=p1,y1=se;function E1(r,e,t){var i=y1(r),s=arguments.length;return s>1&&(s>2?i.substring(0,t).indexOf(e)===t-1:i.indexOf(e)===i.length-1)}var C1=E1,b1=Ie,_1=se,R1=da,S1=Kt;function I1(r,e,t){return _1(r).replace((t||b1).tmplRE||/\{{2}([.\w[\]\s]+)\}{2}/g,function(i,s){return S1(e,R1(s))})}var xa=I1,T1=xa;function O1(r,e){return T1(r,e,{tmplRE:/\{([.\w[\]\s]+)\}/g})}var k1=O1;function L1(){}var D1=L1,ro=at;function $1(r,e){var t=ro(arguments,2);return function(){return r.apply(e,ro(arguments).concat(t))}}var M1=$1,so=at;function A1(r,e){var t=!1,i=null,s=so(arguments,2);return function(){return t||(i=r.apply(e,so(arguments).concat(s)),t=!0),i}}var N1=A1,H1=at;function B1(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(H1(o)))}}var F1=B1,K1=at;function P1(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(K1(o))))}}var Y1=P1,V1=ae;function W1(r,e,t){var i=null,s=null,o=!1,n=null,a=V1({leading:!0,trailing:!0},t),l=a.leading,d=a.trailing,u=function(){i=null,s=null},f=function(){o=!0,r.apply(s,i),n=setTimeout(g,e),u()},g=function(){if(n=null,o){u();return}if(d===!0){f();return}u()},m=function(){var v=n!==null;return v&&clearTimeout(n),u(),n=null,o=!1,v},x=function(){if(i=arguments,s=this,o=!1,n===null&&l===!0){f();return}d===!0&&(n=setTimeout(g,e))};return x.cancel=m,x}var X1=W1,z1=ae;function G1(r,e,t){var i=null,s=null,o=typeof t=="boolean"?{leading:t,trailing:!t}:z1({leading:!1,trailing:!0},t),n=!1,a=null,l=o.leading,d=o.trailing,u=function(){i=null,s=null},f=function(){n=!0,r.apply(s,i),u()},g=function(){if(l===!0&&(a=null),n){u();return}if(d===!0){f();return}u()},m=function(){var v=a!==null;return v&&clearTimeout(a),u(),a=null,n=!1,v},x=function(){n=!1,i=arguments,s=this,a===null?l===!0&&f():clearTimeout(a),a=setTimeout(g,e)};return x.cancel=m,x}var U1=G1,q1=at;function Z1(r,e){var t=q1(arguments,2),i=this;return setTimeout(function(){r.apply(i,t)},e)}var J1=Z1,Q1=decodeURIComponent,pa=Q1,oo=pa,j1=te,ew=Ne;function tw(r){var e,t={};return r&&ew(r)&&j1(r.split("&"),function(i){e=i.split("="),t[oo(e[0])]=oo(e[1]||"")}),t}var wa=tw,iw=encodeURIComponent,ya=iw,mi=ya,Ea=Q,Ca=X,ba=Me,rw=Te,_a=Ct;function Ra(r,e,t){var i,s=[];return Ea(r,function(o,n){i=Ca(o),_a(o)||i?s=s.concat(Ra(o,e+"["+n+"]",i)):s.push(mi(e+"["+(t?"":n)+"]")+"="+mi(ba(o)?"":o))}),s}function sw(r){var e,t=[];return Ea(r,function(i,s){rw(i)||(e=Ca(i),_a(i)||e?t=t.concat(Ra(i,s,e)):t.push(mi(s)+"="+mi(ba(i)?"":i)))}),t.join("&").replace(/%20/g,"+")}var ow=sw,nw=Ee,aw=typeof location===nw?0:location,$i=aw,ai=$i;function lw(){return ai?ai.origin||ai.protocol+"//"+ai.host:""}var Sa=lw,no=$i,cw=wa,hw=Sa;function ao(r){return cw(r.split("?")[1]||"")}function dw(r){var e,t,i,s,o=""+r;return o.indexOf("//")===0?o=(no?no.protocol:"")+o:o.indexOf("/")===0&&(o=hw()+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,l){return t=l||"",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=ao(s.hash),s.searchQuery=ao(s.search),s}var Ia=dw,lo=$i,uw=Sa,fw=Tn;function gw(){if(lo){var r=lo.pathname,e=fw(r,"/")+1;return uw()+(e===r.length?r:r.substring(0,e))}return""}var vw=gw,co=$i,mw=Ia;function xw(){return co?mw(co.href):{}}var pw=xw,Ta=Ie,Ji=yr,ho=pa,uo=ya,ww=X,fo=Si,Oa=Xe,yw=Te,Ew=bt,Cw=$e,xi=ae,Qi=te,bw=Ti,li=ue,_w=Di,Rw=zt,Sw=jn;function go(r,e){var t=parseFloat(e),i=bw(),s=li(i);switch(r){case"y":return li(_w(i,t));case"M":return li(Rw(i,t));case"d":return li(Sw(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 ji(r){return(Oa(r)?r:new Date(r)).toUTCString()}function Ve(r,e,t){if(Ji){var i,s,o,n,a,l,d=[],u=arguments;return ww(r)?d=r:u.length>1?d=[xi({name:r,value:e},t)]:fo(r)&&(d=[r]),d.length>0?(Qi(d,function(f){i=xi({},Ta.cookies,f),o=[],i.name&&(s=i.expires,o.push(uo(i.name)+"="+uo(fo(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 ji(go(x,m))}):/^[0-9]{11,13}$/.test(s)||Oa(s)?s=ji(s):s=ji(go("d",s)),i.expires=s),Qi(["expires","path","domain","secure"],function(g){yw(i[g])||o.push(i[g]&&g==="secure"?g:g+"="+i[g])})),Ji.cookie=o.join("; ")}),!0):(n={},a=Ji.cookie,a&&Qi(a.split("; "),function(f){l=f.indexOf("="),n[ho(f.substring(0,l))]=ho(f.substring(l+1)||"")}),u.length===1?n[r]:n)}return!1}function Iw(r){return Ew(ka(),r)}function vo(r){return Ve(r)}function mo(r,e,t){return Ve(r,e,t),Ve}function xo(r,e){Ve(r,"",xi({expires:-1},Ta.cookies,e))}function ka(){return Cw(Ve())}function Tw(){return Ve()}xi(Ve,{has:Iw,set:mo,setItem:mo,get:vo,getItem:vo,remove:xo,removeItem:xo,keys:ka,getJSON:Tw});var Ow=Ve,kw=Ee,er=yr,tr=An,Lw=ae,Dw=te;function po(r){try{var e="__xe_t";return r.setItem(e,1),r.removeItem(e),!0}catch{return!1}}function ci(r){return navigator.userAgent.indexOf(r)>-1}function $w(){var r,e,t,i=!1,s=!1,o=!1,n={isNode:!1,isMobile:i,isPC:!1,isDoc:!!er};if(!tr&&typeof process!==kw)n.isNode=!0;else{t=ci("Edge"),e=ci("Chrome"),i=/(Android|webOS|iPhone|iPad|iPod|SymbianOS|BlackBerry|Windows Phone)/.test(navigator.userAgent),n.isDoc&&(r=er.body||er.documentElement,Dw(["webkit","khtml","moz","ms","o"],function(a){n["-"+a]=!!r[a+"MatchesSelector"]}));try{s=po(tr.localStorage)}catch{}try{o=po(tr.sessionStorage)}catch{}Lw(n,{edge:t,firefox:ci("Firefox"),msie:!t&&n["-ms"],safari:!e&&!t&&ci("Safari"),isMobile:i,isPC:!i,isLocalStorage:s,isSessionStorage:o})}return n}var Mw=$w,La=Ul,wo=ae,Aw=Ft,Nw=Vo,Hw=nc,Bw=fc,Fw=ot,Kw=zo,Pw=Go,Yw=Uo,Vw=te,Ww=vr,Xw=qo,zw=Ac,Gw=mr,Uw=uh,qw=pr,Zw=jo,Jw=Eh,Qw=at,jw=Th,ey=Lh,ty=bt,iy=Mh,ry=Bh,sy=Ph,oy=Wh,ny=Gh,ay=ld,ly=on,cy=ud,hy=vd,dy=tn,uy=yd,fy=iu,gy=au,vy=du,my=vn,xy=pu,py=Eu,wy=Su,yy=pn,Ey=wn,Cy=ye,by=X,_y=Me,Ry=$u,Sy=Te,Iy=ie,Ty=Si,Oy=Ne,ky=Ct,Ly=Sn,Dy=Xe,$y=Ae,My=Q,Ay=nf,Ny=hf,Hy=pf,By=Tn,Fy=$e,Ky=_t,Py=gr,Yy=On,Vy=cn,Wy=dn,Xy=hn,zy=Tf,Gy=Nf,Uy=kn,qy=Ln,Zy=Oe,Jy=wr,Qy=Dn,jy=Wf,eE=$n,tE=Mn,iE=Jf,rE=tg,sE=ng,oE=dg,nE=vg,aE=wg,lE=bg,cE=Ig,hE=Lg,dE=Qg,uE=Kn,fE=iv,gE=hv,vE=gv,mE=Er,xE=xv,pE=Ev,wE=_v,yE=Iv,EE=Av,CE=Bv,bE=Pv,_E=Wv,RE=Uv,SE=Kt,IE=em,TE=Yn,OE=dm,kE=Vn,LE=pm,DE=Qo,$E=sn,ME=Em,AE=ix,NE=br,HE=zn,BE=Gn,FE=_r,KE=nx,PE=nt,YE=ze,VE=ux,WE=vx,XE=Rr,zE=yx,GE=Zn,UE=kx,qE=Di,ZE=tp,JE=zt,QE=jn,jE=re,e2=aa,t2=la,i2=u0,r2=fe,s2=g0,o2=ia,n2=oa,a2=sa,l2=x0,c2=b0,h2=k0,d2=$0,u2=B0,f2=na,g2=Y0,v2=da,m2=ca,x2=ha,p2=r1,w2=a1,y2=f1,E2=m1,C2=w1,b2=C1,_2=xa,R2=k1,yo=se,S2=D1,I2=Et,T2=M1,O2=N1,k2=F1,L2=Y1,D2=X1,$2=U1,M2=J1,A2=wa,N2=ow,H2=Ia,B2=vw,F2=pw,K2=Ow,P2=Mw;wo(La,{assign:wo,objectEach:Aw,lastObjectEach:Nw,objectMap:Hw,merge:Bw,uniq:Xw,union:zw,sortBy:Uw,orderBy:qw,shuffle:Zw,sample:Jw,some:Kw,every:Pw,slice:Qw,filter:jw,find:iy,findLast:ry,findKey:ey,includes:ty,arrayIndexOf:yy,arrayLastIndexOf:Ey,map:Fw,reduce:sy,copyWithin:oy,chunk:ny,zip:ay,unzip:ly,zipObject:cy,flatten:hy,toArray:Gw,includeArrays:Yw,pluck:dy,invoke:uy,arrayEach:Vw,lastArrayEach:Ww,toArrayTree:fy,toTreeArray:gy,findTree:vy,eachTree:my,mapTree:xy,filterTree:py,searchTree:wy,hasOwnProp:Cy,eqNull:$y,isNaN:Ry,isFinite:zy,isUndefined:Sy,isArray:by,isFloat:Gy,isInteger:Uy,isFunction:Iy,isBoolean:qy,isString:Oy,isNumber:Zy,isRegExp:Jy,isObject:Ty,isPlainObject:ky,isDate:Dy,isError:Qy,isTypeError:jy,isEmpty:eE,isNull:_y,isSymbol:tE,isArguments:iE,isElement:rE,isDocument:sE,isWindow:oE,isFormData:nE,isMap:aE,isWeakMap:lE,isSet:cE,isWeakSet:hE,isLeapYear:Ly,isMatch:dE,isEqual:uE,isEqualWith:fE,getType:gE,uniqueId:vE,getSize:Yy,indexOf:Hy,lastIndexOf:By,findIndexOf:mE,findLastIndexOf:xE,toStringJSON:pE,toJSONString:wE,keys:Fy,values:Ky,entries:yE,pick:EE,omit:CE,first:bE,last:_E,each:My,forOf:Ay,lastForOf:Ny,lastEach:Vy,has:RE,get:SE,set:IE,groupBy:TE,countBy:OE,clone:Py,clear:Xy,remove:Wy,range:kE,destructuring:LE,random:DE,min:ME,max:$E,commafy:AE,round:NE,ceil:HE,floor:BE,toFixed:FE,toNumber:PE,toNumberString:YE,toInteger:KE,add:VE,subtract:WE,multiply:XE,divide:zE,sum:GE,mean:UE,now:t2,timestamp:i2,isValidDate:r2,isDateSame:s2,toStringDate:jE,toDateString:e2,getWhatYear:qE,getWhatQuarter:ZE,getWhatMonth:JE,getWhatWeek:o2,getWhatDay:QE,getYearDay:n2,getYearWeek:a2,getMonthWeek:l2,getDayOfYear:c2,getDayOfMonth:h2,getDateDiff:d2,trim:v2,trimLeft:x2,trimRight:m2,escape:p2,unescape:w2,camelCase:y2,kebabCase:E2,repeat:g2,padStart:f2,padEnd:u2,startsWith:C2,endsWith:b2,template:_2,toFormatString:R2,toString:yo,toValueString:yo,noop:S2,property:I2,bind:T2,once:O2,after:k2,before:L2,throttle:D2,debounce:$2,delay:M2,unserialize:A2,serialize:N2,parseUrl:H2,getBaseURL:B2,locat:F2,browse:P2,cookie:K2});var I=La,ee=[];for(var ir=0;ir<256;++ir)ee.push((ir+256).toString(16).slice(1));function Y2(r,e=0){return(ee[r[e+0]]+ee[r[e+1]]+ee[r[e+2]]+ee[r[e+3]]+"-"+ee[r[e+4]]+ee[r[e+5]]+"-"+ee[r[e+6]]+ee[r[e+7]]+"-"+ee[r[e+8]]+ee[r[e+9]]+"-"+ee[r[e+10]]+ee[r[e+11]]+ee[r[e+12]]+ee[r[e+13]]+ee[r[e+14]]+ee[r[e+15]]).toLowerCase()}var hi,V2=new Uint8Array(16);function W2(){if(!hi&&(hi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!hi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return hi(V2)}var X2=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Eo={randomUUID:X2};function De(r,e,t){if(Eo.randomUUID&&!r)return Eo.randomUUID();r=r||{};var i=r.random||(r.rng||W2)();return i[6]=i[6]&15|64,i[8]=i[8]&63|128,Y2(i)}const z2=r=>r==null||r==="",Z=r=>!z2(r),et=r=>r==null,he=r=>!et(r),G2=r=>function(e,t,i,s){const o=i||{},n=o.children||"children";return r(null,e,t,s,[],[],n,o)},Da=(r,e,t,i,s,o,n)=>{let a,l;e.forEach((d,u)=>{a=s.concat([""+u]),l=o.concat([d]),t.call(i,d,u,e,a,r,l),d&&n&&(a.push(n),Da(d,d[n]||[],t,i,a,l,n))})},$t=G2(Da),$a={form:{labelCol:{span:6},wrapperCol:{span:16}},grid:{align:"left",lazyReset:!1,fitHeight:170},canvasTable:{DISABLED:!0}};let de=I.clone($a,!0);function Ma(r){de={form:{...de.form,...r.form},grid:{...de.grid,...r.grid},canvasTable:{...de.canvasTable,...r.canvasTable}}}function U2(){return de}function Co(){var r,e;return{labelCol:(r=de.form)==null?void 0:r.labelCol,wrapperCol:(e=de.form)==null?void 0:e.wrapperCol}}function Mt(){var r,e,t;return{align:(r=de.grid)==null?void 0:r.align,lazyReset:(e=de.grid)==null?void 0:e.lazyReset,fitHeight:(t=de.grid)==null?void 0:t.fitHeight}}function Aa(){return de.canvasTable||{}}function q2(){de=JSON.parse(JSON.stringify($a))}const Mi=r=>{var e;return{dataIndex:r.field,key:r.field,title:r.title,...I.omit(r,["children","slots","cellRender","formatter"]),children:(e=r.children)==null?void 0:e.map(t=>Mi(t))}},Sr={xs:24,sm:24,md:12,lg:8,xl:8,xxl:6},Ir={xs:12,sm:5,md:6,lg:6,xl:5,xxl:4},Z2={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}},Na=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},bo=["xxs","xs","sm","md","lg","xl","xxl"],J2=r=>{const e=I.isArray(r)?r:I.isNumber(r)?Array.from({length:r},()=>Sr):[];return I.zipObject(bo,bo.map(t=>e.every(i=>Z(i[t]))?Na(e.map(i=>i[t])):24))};function Tr(r,e,t){const i=c.toValue(r);if(typeof i!="object"||i===null)return c.watch(r,e,t);let s=I.clone(i,!0);return c.watch(r,(o,n,a)=>{e(o,s,a),s=I.clone(o,!0)},t)}const je="-",vt={toString:({cellValue:r})=>{var e;return r?((e=r.toString)==null?void 0:e.call(r))??je:je},formatByOptions:({cellValue:r},e,t=",")=>{if(r==null)return je;if(I.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):je}else return je;const i=e.find(s=>s.value===r);return i?i.label:je},formatSex:({cellValue:r})=>Z(r)?I.toNumber(r)===1?"男":"女":je},Q2=(r,{record:e,index:t,column:i,field:s})=>{if(I.isString(r)&&vt[r]){const o=vt[r];return o({row:e,rowIndex:t,cellValue:s?e[s]:null})}else if(I.isArray(r)&&vt[r[0]]&&r.length>1){const o=vt[r[0]];return o({row:e,rowIndex:t,cellValue:s?e[s]:null},...r.slice(1))}else return I.isFunction(r)?r({row:e,rowIndex:t,cellValue:s?e[s]:null,column:i}):s?e[s]:null},Ha=r=>{Object.assign(vt,r)},j2=c.defineComponent(r=>{const{cellRender:e,renderTableParams:t}=r,{data:i,row:s,field:o,rowIndex:n}=t;return()=>{var a,l;return((l=(a=At.renders[e.name])==null?void 0:a.renderDefault)==null?void 0:l.call(a,e,{data:i,row:s,field:o,rowIndex:n},r.defaultHandler))??null}},{name:"RenderAntCell",props:["cellRender","renderTableParams","defaultHandler"]}),Ba=c.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?c.createVNode(j2,{cellRender:i.cellRender,defaultHandler:r.defaultHandler,renderTableParams:{data:e,row:t,field:i.field,rowIndex:s}},null):i.formatter?Q2(i.formatter,{record:t,index:s,field:i.field,column:i}):o)}},{name:"RenderAntDefaultCell",props:["tableData","row","column","rowIndex","defaultHandler"]}),eC={class:"text-right mt-4px"},tC=c.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};c.watch(()=>t.modelValue,()=>{o("trigger")},{deep:!0});const s=c.computed(()=>I.merge({},i,t.tableConfig)),o=e,n=c.computed({get:()=>t.modelValue??[],set:f=>{o("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=()=>{n.value=[...n.value,{}]},d=f=>{n.value=n.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":n.value},s.value,{columns:a.value.map(p=>c.unref(Mi)(p))}),c.createSlots({_:2},[u.value.length>0?{name:"bodyCell",fn:c.withCtx(({column:p,record:E,index:b})=>[c.createVNode(m,null,{default:c.withCtx(()=>[u.value.some(y=>p.key&&y.field===p.key)?(c.openBlock(),c.createBlock(c.unref(Ba),{key:b,"row-index":b,"default-handler":{},column:u.value.find(y=>p.key&&y.field===p.key),row:E,"table-data":n.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",eC,[c.createVNode(v,{type:"primary",onClick:l},{default:c.withCtx(()=>g[0]||(g[0]=[c.createTextVNode("+添加",-1)])),_:1,__:[0]})])])}}}),oe=r=>{const{icon:e}=r,t=dl;return t[e]?c.createVNode(t[e]):t[e]},Dt={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())}},di={PercentInput:{controls:!1,min:0,max:100,addonAfter:"%"},autoComplete:{inputProps:{}}},Fa={$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},iC=r=>{const e=Fa[r];return{renderItemContent({props:t={},attrs:i={},events:s={},defaultValue:o},{data:n,field:a}){return he(o)&&Z(a)&&et(n[a])&&(n[a]=o),a?c.createVNode(e,c.mergeProps({is:r,value:n[a],"onUpdate:value":l=>n[a]=l},i,I.merge({},Dt[r],t),{onChange:(...l)=>{var d;(d=s.change)==null||d.call(s,{data:n,field:a},...l)}}),null):c.createVNode(e,c.mergeProps({is:r},t),null)},renderDefault({props:t=Dt[r]??{},attrs:i={},events:s={},defaultValue:o},{data:n,row:a,field:l}){return he(o)&&Z(l)&&et(a[l])&&(a[l]=o),l?c.createVNode(e,c.mergeProps({is:r,value:a[l],"onUpdate:value":d=>a[l]=d},i,I.merge({},Dt[r],t),{onChange:(...d)=>{var u;(u=s.change)==null||u.call(s,{data:n,row:a,field:l},...d)}}),null):c.createVNode(e,c.mergeProps({is:r},t),null)},renderEdit(t,{props:i=Dt[r]??{},attrs:s={},events:o={}},n,a){return c.createVNode(e,c.mergeProps({is:r,value:t.value,"onUpdate:value":l=>t.value=l},s,I.merge({},Dt[r],i),{onBlur:(...l)=>{var d;a==null||a("blur",t.value),(d=o.blur)==null||d.call(o,n,...l)}}),null)}}},Ka=(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?c.createVNode(M.Dropdown,{getPopupContainer:t??(()=>document.querySelector(".p-wrapper"))},{default:()=>{var o;return c.createVNode(M.Button,c.mergeProps(I.omit(r,["dynamicClassName","content","getContent","icon","clickEvt","dropdowns","getProps"]),{icon:r.icon?c.createVNode(oe,{icon:r.icon},null):c.createVNode(oe,{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 c.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=>Ka(n,e,t))])}}):c.createVNode(M.Button,c.mergeProps({class:((i=r==null?void 0:r.dynamicClassName)==null?void 0:i.call(r,e))||""},I.omit(r,["dynamicClassName","content","getContent","icon","clickEvt","dropdowns","getProps"]),{disabled:!!r.dropdowns&&r.dropdowns.length>0||r.disabled,icon:r.icon?c.createVNode(oe,{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))??"")]}})},ar={...Object.fromEntries(Object.keys(Fa).map(r=>[r,iC(r)])),$button:{renderItemContent({props:r={},events:e={}},{data:t,field:i},s){return c.createVNode(M.Button,c.mergeProps(I.omit(r,["content"]),{icon:r.icon?c.createVNode(oe,{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&&I.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 c.createVNode(M.Button,c.mergeProps(I.omit(r,["content"]),{icon:r.icon?c.createVNode(oe,{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&&I.isFunction(r.beforeClick)?((n=s==null?void 0:s.setLoadings)==null||n.call(s,!0),r.beforeClick({row:t,field:i}).then(l=>{s.reset(l?{row:l,field:i}:{row:t,field:i})}).finally(()=>{var l;(l=s==null?void 0:s.setLoadings)==null||l.call(s,!1)})):s.reset({row:t,field:i})),r.htmlType==="pick"&&(s!=null&&s.pick)&&(r.beforeClick&&I.isFunction(r.beforeClick)?((a=s==null?void 0:s.setLoadings)==null||a.call(s,!0),r.beforeClick({row:t,field:i}).then(l=>{s.pick(l?{row:l,field:i}:{row:t,field:i})}).finally(()=>{var l;(l=s==null?void 0:s.setLoadings)==null||l.call(s,!1)})):s.pick({row:t,field:i}))}}),{default:()=>[r.content]})}},$buttons:{renderItemContent({props:r={},children:e=[]},{data:t,field:i},s){return c.createVNode("span",{class:"align-gap-box w-fit"},[e.map(o=>c.createVNode(M.Button,c.mergeProps(I.omit(Object.assign({},r,o.props),["content"]),{icon:o.props.icon?c.createVNode(oe,{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&&I.isFunction(r.beforeClick)?r.beforeClick({data:t,field:i}).then(l=>{s.reset(l?{data:l,field:i}:{data:t,field:i})}):s.reset({data:t,field:i})),o.props.htmlType==="pick"&&(s!=null&&s.pick)&&(r.beforeClick&&I.isFunction(r.beforeClick)?r.beforeClick({data:t,field:i}).then(l=>{s.pick(l?{data:l,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 c.createVNode("span",{class:"align-gap-box w-fit"},[e.filter(n=>{var a,l;return!((l=(a=n==null?void 0:n.props)==null?void 0:a.hiddenIf)!=null&&l.call(a,{data:t,row:i,field:s}))}).map(n=>c.createVNode(M.Button,c.mergeProps(I.omit(Object.assign({},r,n.props),["content","hiddenIf"]),{icon:n.props.icon?c.createVNode(oe,{icon:n.props.icon},null):null,onClick:()=>{var a,l,d,u;(l=(a=n.events)==null?void 0:a.click)==null||l.call(a,{data:t,row:i,field:s}),n.props.htmlType==="reset"&&(o!=null&&o.reset)&&(r.beforeClick&&I.isFunction(r.beforeClick)?((d=o==null?void 0:o.setLoadings)==null||d.call(o,!0),r.beforeClick({row:i,field:s}).then(f=>{o.reset(f?{row:f,field:s}:{row:i,field:s})}).finally(()=>{var f;(f=o==null?void 0:o.setLoadings)==null||f.call(o,!1)})):o.reset({row:i,field:s})),n.props.htmlType==="pick"&&(o!=null&&o.pick)&&(r.beforeClick&&I.isFunction(r.beforeClick)?((u=o==null?void 0:o.setLoadings)==null||u.call(o,!0),r.beforeClick({row:i,field:s}).then(f=>{o.pick(f?{row:f,field:s}:{row:i,field:s})}).finally(()=>{var f;(f=o==null?void 0:o.setLoadings)==null||f.call(o,!1)})):o.pick({row:i,field:s}))}}),{default:()=>[n.props.content]}))])}},ButtonTree:{renderDefault({children:r=[],props:e={}},t){const i=c.ref(null);return c.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=>Ka(s,t,()=>{var o,n,a,l;return((l=(a=(n=(o=i.value)==null?void 0:o.parentElement)==null?void 0:n.parentElement)==null?void 0:a.parentElement)==null?void 0:l.parentElement)||document.body}))??[]])}},$radio:{renderItemContent({props:r={},events:e={},options:t,defaultValue:i},{data:s,field:o}){return he(i)&&Z(o)&&et(s[o])&&(s[o]=i),Z(o)?c.createVNode(M.RadioGroup,c.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 Z(i)?c.createVNode(M.RadioGroup,c.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 Z(i)?c.createVNode(M.AutoComplete,c.mergeProps({value:t[i],"onUpdate:value":s=>t[i]=s},Object.assign({},{filterOption:di.autoComplete.filterOption},r),{onChange:(...s)=>{var o;(o=e.change)==null||o.call(e,{data:t,field:i},...s)}}),{default:()=>c.createVNode(c.resolveComponent("a-input"),Object.assign({},di.autoComplete.inputProps,r.inputProps??{}),null)}):null}},$switch:{renderItemContent({props:r={},events:e={},defaultValue:t},{data:i,field:s}){return he(t)&&Z(s)&&et(i[s])&&(i[s]=t),Z(s)?c.createVNode(M.Switch,c.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 he(i)&&Z(o)&&et(s[o])&&(s[o]=i),Z(o)?c.createVNode(M.CheckboxGroup,c.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 Z(i)?c.createVNode(M.CheckboxGroup,c.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}))??(Z(t)?e[t]:"");return Z(t)?c.createVNode(M.TypographyParagraph,c.mergeProps(I.merge({},i,I.omit(r,["content","getContent"])),{content:s}),null):null}},$tableInput:{renderItemContent({props:r={},handleTrigger:e},{data:t,field:i}){return Z(i)?c.createVNode(tC,{modelValue:t[i],"onUpdate:modelValue":s=>t[i]=s,onTrigger:()=>{e&&I.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(Z(s)){he(t)&&et(i[s])&&(i[s]=t);const n=c.computed({get:()=>(i[s]??0)*o,set:a=>{i[s]=(a??0)/o}});return c.createVNode("div",{class:"flex items-center"},[r.info?c.createVNode("span",{class:"pr-4"},[r.info]):null,c.createVNode(c.resolveComponent("a-input-number"),c.mergeProps({class:"w-60px!"},e,{value:n.value,"onUpdate:value":a=>n.value=a},I.merge({},di.PercentInput,I.omit(r,["info"]))),null)])}else return null},renderDefault({props:r={},attrs:e={}},{row:t,field:i}){const s=r.parse?100:1;if(Z(i)){const o=c.computed({get:()=>(t[i]??0)*s,set:n=>{I.set(t,i,(n??0)/s)}});return[r.info?c.createVNode("span",{class:"pr-4"},[r.info]):null,c.createVNode(c.resolveComponent("a-input-number"),c.mergeProps({class:"w-60px!"},e,{value:o.value,"onUpdate:value":n=>o.value=n},I.merge({},di.PercentInput,I.omit(r,["info"]))),null)]}else return null}},TreeSelect:{renderItemContent({props:r={}},{data:e,field:t}){return Z(t)?c.createVNode(M.TreeSelect,c.mergeProps({value:e[t],"onUpdate:value":i=>e[t]=i},r),null):null},renderDefault({props:r={}},{row:e,field:t}){return Z(t)?c.createVNode(M.TreeSelect,c.mergeProps({value:e[t],"onUpdate:value":i=>e[t]=i},r),null):null}}},Or=(r,{renderItemContent:e,renderDefault:t,renderEdit:i})=>{ar.hasOwnProperty(r)&&console.warn(`render ${r} already exists, you are trying to override it`),ar[r]={renderItemContent:e,renderDefault:t,renderEdit:i}},At={renders:ar,addRender:Or},rC=c.defineComponent((r,{emit:e})=>{const{itemRender:t,defaultHandler:i}=r,{renderFormParams:s}=c.toRefs(r),o=a=>{e("trigger",a)},n=(a,l)=>{e("delayTrigger",a,l)};return()=>{var a,l;return((l=(a=At.renders[t.name])==null?void 0:a.renderItemContent)==null?void 0:l.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"]}),sC=c.defineComponent(r=>{const{formData:e}=c.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"]}),oC={key:2},nC=["innerHTML"],kr=c.defineComponent({__name:"PFormCol",props:{item:{},formData:{}},emits:["trigger","reset"],setup(r,{emit:e}){const t=r,i=e,s=c.ref(!1),o=c.ref(De()),n=(f,g)=>{const m=g??222;s.value=!0,setTimeout(()=>{s.value=!1,i("trigger",f)},m)},a=f=>{i("trigger",f)},l=()=>{i("reset")},d=()=>{o.value=De()},u=I.debounce(d,100);return Tr(()=>t.item,(f,g)=>{I.isEqual(f,g)||u()},{deep:!0}),(f,g)=>{const m=c.resolveComponent("a-tooltip"),x=c.resolveComponent("a-form-item"),v=c.resolveComponent("a-col");return c.openBlock(),c.createBlock(v,c.mergeProps({key:`_col_${o.value}`},f.item.col??(f.item.span?{span:f.item.span}:c.unref(Sr))),{default:c.withCtx(()=>{var p;return[(c.openBlock(),c.createBlock(x,c.mergeProps({key:`_item_${o.value}`,class:[`p-content-align-${f.item.align??"left"} ${f.item.forceRequired?"p-required":""}`,{"p-error-hang-out":s.value}],colon:"",label:f.item.title,name:f.item.field,"wrapper-col":f.item.wrapperCol??(f.item.title?void 0:{span:24})},c.unref(I.omit)(f.item,["field","title","span","col","wrapperCol","itemRender","forceRequired","tooltip"])),c.createSlots({default:c.withCtx(()=>{var E,b;return[(E=f.item.slots)!=null&&E.default?(c.openBlock(),c.createBlock(c.unref(sC),{key:`_sl_${f.item.field??"_"}_${o.value}`,"form-data":f.formData,item:f.item,"pass-delay-trigger":n,"pass-trigger":a},null,8,["form-data","item"])):(b=f.item.itemRender)!=null&&b.name?(c.openBlock(),c.createBlock(c.unref(rC),{key:`_re_${f.item.field??"_"}_${o.value}`,"default-handler":{reset:l},"item-render":f.item.itemRender,"render-form-params":{data:f.formData,field:f.item.field},onDelayTrigger:n,onTrigger:a},null,8,["default-handler","item-render","render-form-params"])):(c.openBlock(),c.createElementBlock("span",oC))]}),_:2},[(p=f.item.slots)!=null&&p.title?{name:"label",fn:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(f.item.slots.title)))]),key:"0"}:void 0,f.item.tooltipConfig?{name:"tooltip",fn:c.withCtx(()=>[c.unref(I.isFunction)(f.item.tooltipConfig.title)?(c.openBlock(),c.createBlock(m,c.normalizeProps(c.mergeProps({key:0},c.unref(I.omit)(f.item.tooltipConfig,["title"]))),{title:c.withCtx(()=>[c.createElementVNode("div",{innerHTML:f.item.tooltipConfig.title()},null,8,nC)]),default:c.withCtx(()=>[c.createVNode(c.unref(xt.InfoCircleOutlined),{class:"cursor-pointer py-4 px-2"})]),_:1},16)):(c.openBlock(),c.createBlock(m,c.normalizeProps(c.mergeProps({key:1},f.item.tooltipConfig)),{default:c.withCtx(()=>[c.createVNode(c.unref(xt.InfoCircleOutlined),{class:"cursor-pointer py-4 px-2"})]),_:1},16))]),key:"1"}:void 0]),1040,["class","label","name","wrapper-col"]))]}),_:1},16)}}}),aC={key:0,class:"p-pane p-wrapper"},Lr=c.defineComponent({__name:"PForm",props:{items:{},customReset:{},layout:{},labelCol:{default:()=>Co().labelCol??{span:6}},wrapperCol:{default:()=>Co().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}=c.toRefs(i);function a(){s("apply",n.value)}const l=c.ref(),d=c.ref(De()),u=()=>{d.value=De()},f=()=>{if(i.customReset)i.customReset();else{const v={};$t(o.value,p=>{p.field&&p.itemRender?he(p.itemRender.defaultValue)?v[p.field]=p.itemRender.defaultValue:v[p.field]=void 0:p.field&&p.slots&&(he(p.slots.defaultValue)?v[p.field]=p.slots.defaultValue:v[p.field]=void 0)}),Object.assign(n.value,v)}s("reset")},g=c.computed(()=>({...I.omit(i,["items","data","model","labelCol","wrapperCol"]),labelCol:i.labelCol,wrapperCol:i.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(o).some(E=>{var b;return E.field&&E.itemRender||((b=E.slots)==null?void 0:b.default)})?(c.openBlock(),c.createElementBlock("div",aC,[(c.openBlock(),c.createBlock(c.unref(M.Form),c.mergeProps({key:d.value,ref_key:"formEl",ref:l,model:c.unref(n)},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(o),(E,b)=>(c.openBlock(),c.createBlock(kr,{key:`_col_${E.field||b}`,"form-data":c.unref(n),item:E,onReset:f,onTrigger:x},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["model"]))])):c.createCommentVNode("",!0)}}),lC=c.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"]}),Pa=({title:r,content:e})=>new Promise((t,i)=>{M.Modal.confirm({title:r,content:e,onOk:()=>{t()},onCancel:()=>{i()}})}),cC=M.message.success,hC=M.message.error;M.message.info;const pi=M.message.warning,dC={key:0},uC={key:1,class:"p-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"},fC={class:"flex items-center flex-1 gap-4px"},gC={key:2},vC={class:"flex items-center gap-4px"},mC={key:0,class:"w-full text-slate-5 pl-4"},Dr=c.defineComponent({__name:"PGrid",props:{selectConfig:{},rowKey:{default:"id"},manualFetch:{type:Boolean},align:{default:()=>Mt().align??"left"},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},tableConfig:{},scrollMode:{default:"inner"},lazyReset:{type:Boolean,default:()=>Mt().lazyReset??!1},fitHeight:{default:()=>Mt().fitHeight??170},fitCanvasHeight:{},renderY:{}},emits:["toolbarButtonClick","toolbarToolClick","pick","resetQuery"],setup(r,{expose:e,emit:t}){var Be,ce,ve,Tt,K;const i=r,{formConfig:s,pageConfig:o,columns:n,toolbarConfig:a,proxyConfig:l,tableConfig:d,selectConfig:u,scrollMode:f}=c.toRefs(i),g=c.reactive({table:!1,toolbar:!1,form:!1}),m=k=>{I.isObject(k)?Object.keys(k).forEach(L=>{g[L]=k[L]}):I.isBoolean(k)&&(g.form=k,g.table=k,g.toolbar=k)},x=c.ref(),v=c.ref(),p=c.ref(500),E=c.ref([]),b=c.ref([]),y=k=>{const{ajax:L}=l.value;switch(k){case"multiDelete":L.multiDelete&&(E.value.length>0?Pa({title:"警告",content:"确认删除选中的数据吗?"}).then(()=>{g.table=!0,g.toolbar=!0,L.multiDelete(E.value).then(()=>{M.message.success("删除成功"),ht()}).catch(()=>{M.message.error("删除失败")}).finally(()=>{g.table=!1,g.toolbar=!1,_.multiDelete=!1})}):M.message.warn("请选择要删除的数据"));break}},C=c.computed(()=>{const k=[];return $t(n.value??[],L=>{L.slots&&L.slots.title&&(L.field||(L.field="__holder__"+k.length),k.push(L))}),k}),T=c.ref(),N=c.ref(),B=c.ref(De()),R=c.ref(De()),_=c.reactive([...(((ce=(Be=i.toolbarConfig)==null?void 0:Be.buttons)==null?void 0:ce.map(k=>k.code))??[]).filter(k=>k),...(((Tt=(ve=i.toolbarConfig)==null?void 0:ve.tools)==null?void 0:Tt.map(k=>k.code))??[]).filter(k=>k)].reduce((k,L)=>(k[L]=!1,k),{})),S=(k,L)=>{_[k]=L},O=()=>{R.value=De()},w=I.debounce(O,100),A=c.computed(()=>{const k=[];return $t(n.value??[],L=>{(L.slots&&L.slots.default||L.formatter||L.cellRender)&&(L.field||(L.field="__holder__"+k.length),k.push(L))}),k}),$=c.reactive({page:1,size:((K=o.value)==null?void 0:K.pageSize)??10}),Y=c.ref(0),V=c.ref(0),P=c.ref([]),W=c.computed(()=>l.value&&l.value.ajax?o.value?"pagination":"list":"bad"),G=c.useAttrs(),q=t,He=c.computed(()=>b.value.filter(k=>E.value.includes(k[i.rowKey??"id"]))),lt=k=>{q("toolbarButtonClick",{data:P.value,code:k,selectedKeys:E.value,records:He.value}),y(k)},le=I.debounce(lt,100),Ge=({key:k})=>le(k),J=k=>{q("toolbarToolClick",{data:P.value,code:k,selectedKeys:E.value,records:He.value}),y(k)},Bi=I.debounce(J,100),ge=c.ref({}),Fi=({row:k,field:L})=>{q("pick",{row:k,field:L})},Ue=k=>{if(s.value&&s.value.items.length>0){if(s.value.customReset)s.value.customReset();else{const L={};$t(s.value.items,z=>{z.field&&z.itemRender?he(z.itemRender.defaultValue)?L[z.field]=z.itemRender.defaultValue:L[z.field]=void 0:z.field&&z.slots&&(he(z.slots.defaultValue)?L[z.field]=z.slots.defaultValue:L[z.field]=void 0)}),ge.value=L}q("resetQuery")}$.page=1,k||dt()},ct=(k,L)=>L?{list:I.isString(L.list)?I.get(k,L.list):I.isFunction(L.list)?L.list(k):void 0,total:I.isString(L.total)?I.get(k,L.total):I.isFunction(L.total)?L.total(k):void 0,result:I.isString(L.result)?I.get(k,L.result):I.isFunction(L.result)?L.result(k):void 0,message:I.isString(L.message)?I.get(k,L.message):I.isFunction(L.message)?L.message(k):void 0}:{list:k},Zt=c.ref(!0),Ki=()=>(b.value=[],E.value=[],Ue()),ht=()=>($.page=1,b.value=[],E.value=[],qe()),Pi=(k,L,z)=>($.page=k.current,$.size=k.pageSize,qe()),qe=()=>new Promise(k=>{if(W.value!=="bad"){g.form=!0,g.table=!0;const{ajax:L}=l.value;L.query({form:ge.value,page:$}).then(z=>{const{list:me,total:Je,result:j,message:Ce}=ct(z,l.value.response);me?(P.value=me,Y.value++):j?(P.value=j,V.value=Je??j.length,Y.value++):(P.value=[],Y.value++,Ce&&M.message.warn(Ce)),k(P.value)}).catch(z=>{console.error("fetchData error",z),k([])}).finally(()=>{g.form=!1,g.table=!1})}}),dt=I.debounce(qe,160),Ze=(k,L)=>(Object.assign(ge.value,k),$.page=1,L?Promise.resolve():dt()),It=(k,L)=>(ge.value=k,$.page=1,L?Promise.resolve():dt()),Jt=c.computed(()=>W.value==="pagination"?{current:$.page,total:V.value,pageSize:$.size,responsive:!1,showSizeChanger:!0,showTotal:k=>`共${k}条数据`}:!1),Qt={size:"small",sticky:!0,transformCellText:({text:k})=>I.isArray(k)&&k.length===0?"-":k},jt=c.computed(()=>I.merge({},Qt,(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 L=i.rowKey??"id",z=b.value.map(j=>j[L]),Je=k.filter(j=>!z.includes(j)).map(j=>P.value.find(Ce=>Ce[L]===j)).filter(j=>!!j);b.value=[...b.value,...Je]},getCheckboxProps:u.value.getCheckboxProps}}:{})),ei=c.computed(()=>I.omit({labelCol:Ir,...s.value},["items"])),ti=()=>{ht()};c.watch(()=>[n.value,l.value,a.value],()=>{w()},{deep:!0});const D=()=>{var j,Ce;const k=(j=x.value)==null?void 0:j.parentElement,L=k?window.getComputedStyle(k).height:"0px",z=v.value?window.getComputedStyle(v.value).height:"0px",me=z.includes("px")?I.toNumber(z.replace("px","")):0,Je=(Ce=u.value)!=null&&Ce.showCount?22:0;p.value=i.renderY??I.toNumber(L.replace("px",""))-i.fitHeight-(i.toolbarConfig?30:0)-me-Je,Zt.value=I.toNumber(L.replace("px",""))>600};e({commitProxy:{query:dt,reload:Ki,reloadPage:ht,passQuery:Ze,forcePassQuery:It},$table:c.computed(()=>N.value),selectedRowKeys:c.computed(()=>E.value),setBtnLoading:S,selectedRecords:He,$form:c.computed(()=>T.value),getFormData:()=>ge.value,setLoadings:m,resizeTable:D});let F;c.onMounted(()=>{D(),window.addEventListener("resize",D),F=new MutationObserver(k=>{k.forEach(L=>{if(L.type==="attributes"&&L.attributeName==="style"){const z=L.target;window.getComputedStyle(z).display!=="none"&&D()}})}),x.value&&F.observe(x.value,{attributes:!0,attributeFilter:["style"]}),Ue(i.manualFetch)});const U=["align"],Le=k=>k.map(L=>({...U.reduce((z,me)=>({[me]:i[me]}),{}),...L}));return c.onBeforeUnmount(()=>{window.removeEventListener("resize",D),F.disconnect()}),(k,L)=>{var j,Ce,Xr;const z=c.resolveComponent("a-menu-item"),me=c.resolveComponent("a-menu"),Je=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(G)),[W.value==="bad"?(c.openBlock(),c.createElementBlock("div",dC,"请检查配置")):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[(Ce=(j=c.unref(s))==null?void 0:j.items)!=null&&Ce.some(H=>H.field&&H.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(()=>[(c.openBlock(),c.createBlock(c.unref(M.Form),c.mergeProps({key:B.value,ref_key:"formEl",ref:T,model:ge.value},ei.value,{onSubmit:ti}),{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,(H,xe)=>(c.openBlock(),c.createBlock(kr,{key:`_col_${H.field||xe}`,"form-data":ge.value,item:H,onReset:L[0]||(L[0]=Qe=>Ue(i.lazyReset))},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["model"]))]),_:1},8,["spinning"])],512)):c.createCommentVNode("",!0),c.unref(a)?(c.openBlock(),c.createElementBlock("div",uC,[c.createElementVNode("div",fC,[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,(H,xe)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:xe},[H.dropdowns&&H.dropdowns.length?(c.openBlock(),c.createBlock(Je,{key:0},{overlay:c.withCtx(()=>[c.createVNode(me,{onClick:Ge},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(H.dropdowns,Qe=>(c.openBlock(),c.createBlock(z,{key:Qe.code},{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(Qe.content),1)]),_:2},1024))),128))]),_:2},1024)]),default:c.withCtx(()=>[c.createVNode(c.unref(M.Button),{type:H.type,size:H.size??"middle",disabled:c.unref(a).disabled||H.disabled,loading:g.toolbar||!!H.code&&_[H.code],danger:H.danger,shape:H.shape,ghost:H.ghost,block:H.block},{default:c.withCtx(()=>[H.icon?(c.openBlock(),c.createBlock(c.unref(oe),{key:0,icon:H.icon},null,8,["icon"])):c.createCommentVNode("",!0),c.createTextVNode(" "+c.toDisplayString(H.content)+" ",1),c.createVNode(c.unref(xt.DownOutlined))]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block"])]),_:2},1024)):H.code?(c.openBlock(),c.createBlock(c.unref(M.Button),{key:1,type:H.type,size:H.size??"middle",disabled:c.unref(a).disabled||H.disabled,loading:g.toolbar||!!H.code&&_[H.code],danger:H.danger,shape:H.shape,ghost:H.ghost,block:H.block,onClick:Qe=>c.unref(le)(H.code)},{default:c.withCtx(()=>[H.icon?(c.openBlock(),c.createBlock(c.unref(oe),{key:0,icon:H.icon},null,8,["icon"])):c.createCommentVNode("",!0),c.createTextVNode(" "+c.toDisplayString(H.content),1)]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block","onClick"])):(c.openBlock(),c.createElementBlock("div",gC))],64))),128)):c.createCommentVNode("",!0)]),c.createElementVNode("span",vC,[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,(H,xe)=>(c.openBlock(),c.createBlock(c.unref(M.Button),{key:xe,type:H.type,size:H.size??"middle",disabled:c.unref(a).disabled||H.disabled,danger:H.danger,shape:H.shape,ghost:H.ghost,block:H.block,onClick:Qe=>c.unref(Bi)(H.code),loading:g.toolbar||!!H.code&&_[H.code]},{default:c.withCtx(()=>[H.icon?(c.openBlock(),c.createBlock(c.unref(oe),{key:0,icon:H.icon},null,8,["icon"])):c.createCommentVNode("",!0),c.createTextVNode(" "+c.toDisplayString(H.content),1)]),_:2},1032,["type","size","disabled","danger","shape","ghost","block","onClick","loading"]))),128)):c.createCommentVNode("",!0)])])):c.createCommentVNode("",!0),c.createElementVNode("div",{class:c.normalizeClass(`p-pane flex-1 ${Zt.value?"h-0":""} p-${c.unref(f)??"inner"}-scroll`)},[(Xr=c.unref(u))!=null&&Xr.multiple&&c.unref(u).showCount?(c.openBlock(),c.createElementBlock("div",mC," 已选:"+c.toDisplayString(E.value.length),1)):c.createCommentVNode("",!0),(c.openBlock(),c.createBlock(c.unref(M.Table),c.mergeProps({key:R.value+"_table","row-key":k.rowKey??"id",ref_key:"tableEl",ref:N,columns:Le(c.unref(n)??[]).map(H=>c.unref(Mi)(H)),"data-source":P.value,loading:g.table,pagination:Jt.value},jt.value,{scroll:{x:"max-content",y:p.value},onChange:Pi}),c.createSlots({_:2},[C.value.length>0?{name:"headerCell",fn:c.withCtx(({column:H})=>[C.value.some(xe=>H.key&&xe.field===H.key)?(c.openBlock(),c.createBlock(c.unref(lC),{key:R.value+"_title_"+Y.value+"_slot_"+H.key,column:C.value.find(xe=>H.key&&xe.field===H.key)},null,8,["column"])):c.createCommentVNode("",!0)]),key:"0"}:void 0,A.value.length>0?{name:"bodyCell",fn:c.withCtx(({column:H,record:xe,index:Qe})=>[A.value.some(Yi=>H.key&&Yi.field===H.key)?(c.openBlock(),c.createBlock(c.unref(Ba),{key:R.value+"_cell_"+Y.value+"_slot_"+H.key,column:A.value.find(Yi=>H.key&&Yi.field===H.key),"default-handler":{pick:Fi,setLoadings:m},row:xe,"row-index":Qe,"table-data":P.value},null,8,["column","default-handler","row","row-index","table-data"])):c.createCommentVNode("",!0)]),key:"1"}:void 0]),1040,["row-key","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-stripe-color: #fafafa;--evt-placeholder-color: #cdd0dc;--evt-header-bg-color: #f8faff;--evt-body-bg-color: #fff;--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;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}")),document.head.appendChild(r)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var xC=Object.defineProperty,pC=(r,e,t)=>e in r?xC(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,h=(r,e,t)=>pC(r,typeof e!="symbol"?e+"":e,t);class wC{constructor(e){h(this,"rules"),this.rules=e}validate(e){const t=[],{column:i,row:s,key:o,rowKey:n,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:i,colIndex:a,rowIndex:l,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:l,field:u,fieldValue:f,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:l,field:u,fieldValue:f,message:g.message||`${o} is required`})}return t}}function Ya(){return"xxxxxxxxxxxxxxxxxx".replace(/[x]/g,function(r){const e=Math.random()*16|0;return(r==="x"?e:e&3|8).toString(16)})}function $r(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 fi(r=[]){return r.length?r.map(e=>fi(e.children)+1).sort((e,t)=>t-e)[0]:0}function yC(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 gi(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(l=>{l.fixed=n});const a=gi(s.children,e-1,t+1,s.key);return a&&a.forEach(l=>{o+=l.colspan??0}),{...s,width:s.width,level:t,rowspan:1,colspan:o,parentKey:i,children:a.sort((l,d)=>(l.sort??0)-(d.sort??0))}}return{...s,level:t,rowspan:e,colspan:1,parentKey:i}})}function Nt(r=[]){let e=[];return r.forEach(t=>{t.children?e=e.concat(Nt(t.children)):e.push(t)}),e}function Va(r){return r.filter(e=>!e.hide).map(e=>Array.isArray(e.children)&&e.children.length>0?{...e,children:Va(e.children)}:{...e})}const _o=/^(\r\n|\n\r|\r|\n)/,EC=/^[^\t\r\n]+/,Ro=/^\t/;function CC(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(Ro))r=r.replace(Ro,""),t+=1,e[i][t]="";else if(r.match(_o))r=r.replace(_o,""),t=0,i+=1,e[i]=[""];else{let o="";if(r.startsWith('"')){let n=0,a=!0;for(;a;){const l=r.slice(0,1);l==='"'&&(n+=1),o+=l,r=r.slice(1),(r.length===0||r.match(/^[\t\r\n]/)&&n%2===0)&&(a=!1)}o=o.replace(/^"/,"").replace(/"$/,"").replace(/["]*/g,l=>new Array(Math.floor(l.length/2)).fill('"').join(""))}else{const n=r.match(EC);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 bC(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(`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("vue"),M=require("ant-design-vue"),pt=require("@ant-design/icons-vue");function hl(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 dl=hl(pt);var ul={keyId:1,cookies:{path:"/"},treeOptions:{parentKey:"parentId",key:"id",children:"children"},parseDateFormat:"yyyy-MM-dd HH:mm:ss",firstDayOfWeek:1},Ie=ul;function fl(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 te=fl,gl=Object.prototype.toString,Bo=gl,vl=Bo;function ml(r){return function(e){return"[object "+r+"]"===vl.call(e)}}var Bt=ml,xl=Bt,pl=Array.isArray||xl("Array"),X=pl;function wl(r,e){return r&&r.hasOwnProperty?r.hasOwnProperty(e):!1}var ye=wl,yl=ye;function El(r,e,t){if(r)for(var i in r)yl(r,i)&&e.call(t,r[i],i,r)}var Ft=El,Cl=X,bl=te,_l=Ft;function Rl(r,e,t){return r&&(Cl(r)?bl:_l)(r,e,t)}var Q=Rl;function Sl(r){return function(e){return typeof e===r}}var Et=Sl,Il=Et,Tl=Il("function"),ie=Tl,Ol=Q;function kl(r,e){var t=Object[r];return function(i){var s=[];if(i){if(t)return t(i);Ol(i,e>1?function(o){s.push([""+o,i[o]])}:function(){s.push(arguments[e])})}return s}}var fr=kl,Ll=fr,Dl=Ll("keys",1),$e=Dl,$l=Bo,Ml=Ft,Al=te;function Vi(r,e){var t=r.__proto__.constructor;return e?new t(e):new t}function ii(r,e){return e?Fo(r,e):r}function Fo(r,e){if(r)switch($l.call(r)){case"[object Object]":{var t=Object.create(Object.getPrototypeOf(r));return Ml(r,function(n,a){t[a]=ii(n,e)}),t}case"[object Date]":case"[object RegExp]":return Vi(r,r.valueOf());case"[object Array]":case"[object Arguments]":{var i=[];return Al(r,function(n){i.push(ii(n,e))}),i}case"[object Set]":{var s=Vi(r);return s.forEach(function(n){s.add(ii(n,e))}),s}case"[object Map]":{var o=Vi(r);return o.forEach(function(n,a){o.set(a,ii(n,e))}),o}}return r}function Nl(r,e){return r&&Fo(r,e)}var gr=Nl,Hl=te,Bl=$e,Fl=X,Kl=gr,zr=Object.assign;function Gr(r,e,t){for(var i=e.length,s,o=1;o<i;o++)s=e[o],Hl(Bl(e[o]),t?function(n){r[n]=Kl(s[n],t)}:function(n){r[n]=s[n]});return r}var Pl=function(r){if(r){var e=arguments;if(r===!0){if(e.length>1)return r=Fl(r[1])?[]:{},Gr(r,e,!0)}else return zr?zr.apply(Object,e):Gr(r,e)}return r},ce=Pl,Ko=Ie,Yl=te,Vl=Q,Wl=ie,Xl=ce,_e=function(){};function zl(){Yl(arguments,function(r){Vl(r,function(e,t){_e[t]=Wl(e)?function(){var i=e.apply(_e.$context,arguments);return _e.$context=null,i}:e})})}function Po(r){return Xl(Ko,r)}function Gl(){return Ko}var Yo="3.7.8";_e.VERSION=Yo;_e.version=Yo;_e.mixin=zl;_e.setup=Po;_e.setConfig=Po;_e.getConfig=Gl;var Ul=_e;function ql(r,e,t){for(var i=r.length-1;i>=0;i--)e.call(t,r[i],i,r)}var vr=ql,Zl=vr,Jl=$e;function Ql(r,e,t){Zl(Jl(r),function(i){e.call(t,r[i],i,r)})}var Vo=Ql;function jl(r){return r===null}var Me=jl,ec=Me;function tc(r,e){return function(t){return ec(t)?e:t[r]}}var Ct=tc,ic=Q,rc=ie,sc=Ct;function oc(r,e,t){var i={};if(r)if(e)rc(e)||(e=sc(e)),ic(r,function(s,o){i[o]=e.call(t,s,o,r)});else return r;return i}var nc=oc;function ac(r){return r?r.constructor===Object:!1}var bt=ac;function lc(r){return r!=="__proto__"&&r!=="constructor"}var Wo=lc,Ur=X,qr=bt,cc=ie,hc=Q,dc=Wo;function Xo(r,e){return qr(r)&&qr(e)||Ur(r)&&Ur(e)?(hc(e,function(t,i){dc(i)&&(r[i]=cc(e)?t:Xo(r[i],t))}),r):e}var uc=function(r){r||(r={});for(var e=arguments,t=e.length,i,s=1;s<t;s++)i=e[s],i&&Xo(r,i);return r},fc=uc,gc=Q;function vc(r,e,t){var i=[];if(r&&arguments.length>1){if(r.map)return r.map(e,t);gc(r,function(){i.push(e.apply(t,arguments))})}return i}var ot=vc,mc=ye,xc=X;function pc(r,e,t,i,s){return function(o,n,a){if(o&&n){if(r&&o[r])return o[r](n,a);if(e&&xc(o)){for(var l=0,d=o.length;l<d;l++)if(!!n.call(a,o[l],l,o)===i)return[!0,!1,l,o[l]][t]}else for(var u in o)if(mc(o,u)&&!!n.call(a,o[u],u,o)===i)return[!0,!1,u,o[u]][t]}return s}}var Ri=pc,wc=Ri,yc=wc("some",1,0,!0,!1),zo=yc,Ec=Ri,Cc=Ec("every",1,1,!1,!0),Go=Cc,bc=ye;function _c(r,e){if(r){if(r.includes)return r.includes(e);for(var t in r)if(bc(r,t)&&e===r[t])return!0}return!1}var _t=_c,Zr=X,Jr=_t;function Rc(r,e){var t,i=0;if(Zr(r)&&Zr(e)){for(t=e.length;i<t;i++)if(!Jr(r,e[i]))return!1;return!0}return Jr(r,e)}var Uo=Rc,Qr=Q,Sc=_t,Ic=ie,Tc=Ct;function Oc(r,e,t){var i=[];if(e){Ic(e)||(e=Tc(e));var s,o={};Qr(r,function(n,a){s=e.call(t,n,a,r),o[s]||(o[s]=1,i.push(n))})}else Qr(r,function(n){Sc(i,n)||i.push(n)});return i}var qo=Oc,kc=ot;function Lc(r){return kc(r,function(e){return e})}var mr=Lc,Dc=qo,$c=mr;function Mc(){for(var r=arguments,e=[],t=0,i=r.length;t<i;t++)e=e.concat($c(r[t]));return Dc(e)}var Ac=Mc,Nc="undefined",Ee=Nc,Hc=Ee,Bc=Et,Fc=Bc(Hc),Te=Fc,Kc=Me,Pc=Te;function Yc(r){return Kc(r)||Pc(r)}var Ae=Yc,Vc=/(.+)?\[(\d+)\]$/,Zo=Vc;function Wc(r){return r?r.splice&&r.join?r:(""+r).replace(/(\[\d+\])\.?/g,"$1.").replace(/\.$/,"").split("."):[]}var xr=Wc,Xc=Zo,zc=xr,Gc=ye,Uc=Te,Jo=Ae;function qc(r,e,t){if(Jo(r))return t;var i=Jc(r,e);return Uc(i)?t:i}function Zc(r,e){var t=e?e.match(Xc):"";return t?t[1]?r[t[1]]?r[t[1]][t[2]]:void 0:r[t[2]]:r[e]}function Jc(r,e){if(r){var t,i,s,o=0;if(r[e]||Gc(r,e))return r[e];if(i=zc(e),s=i.length,s){for(t=r;o<s;o++)if(t=Zc(t,i[o]),Jo(t))return o===s-1?t:void 0}return t}}var Kt=qc,jr=te,Qc=mr,es=ot,ts=X,jc=ie,eh=bt,is=Te,th=Me,ih=Ae,rh=Kt,sh=Ct,oh="asc",nh="desc";function sr(r,e){return is(r)?1:th(r)?is(e)?-1:1:r&&r.localeCompare?r.localeCompare(e):r>e?1:-1}function ah(r,e,t){return function(i,s){var o=i[r],n=s[r];return o===n?t?t(i,s):0:e.order===nh?sr(n,o):sr(o,n)}}function lh(r,e,t,i){var s=[];return t=ts(t)?t:[t],jr(t,function(o,n){if(o){var a=o,l;ts(o)?(a=o[0],l=o[1]):eh(o)&&(a=o.field,l=o.order),s.push({field:a,order:l||oh}),jr(e,jc(a)?function(d,u){d[n]=a.call(i,d.data,u,r)}:function(d){d[n]=a?rh(d.data,a):d.data})}}),s}function ch(r,e,t){if(r){if(ih(e))return Qc(r).sort(sr);for(var i,s=es(r,function(a){return{data:a}}),o=lh(r,s,e,t),n=o.length-1;n>=0;)i=ah(n,o[n],i),n--;return i&&(s=s.sort(i)),es(s,sh("data"))}return[]}var pr=ch,hh=pr,dh=hh,uh=dh;function fh(r,e){return r>=e?r:(r=r>>0)+Math.round(Math.random()*((e||9)-r))}var Qo=fh,gh=fr,vh=gh("values",0),Rt=vh,mh=Qo,xh=Rt;function ph(r){for(var e,t=[],i=xh(r),s=i.length-1;s>=0;s--)e=s>0?mh(0,s):0,t.push(i[e]),i.splice(e,1);return t}var jo=ph,wh=jo;function yh(r,e){var t=wh(r);return arguments.length<=1?t[0]:(e<t.length&&(t.length=e||0),t)}var Eh=yh;function Ch(r){return function(e){if(e){var t=r(e&&e.replace?e.replace(/,/g,""):e);if(!isNaN(t))return t}return 0}}var en=Ch,bh=en,_h=bh(parseFloat),nt=_h,rs=nt;function Rh(r,e,t){var i=[],s=arguments.length;if(r){if(e=s>=2?rs(e):0,t=s>=3?rs(t):r.length,r.slice)return r.slice(e,t);for(;e<t;e++)i.push(r[e])}return i}var at=Rh,Sh=Q;function Ih(r,e,t){var i=[];if(r&&e){if(r.filter)return r.filter(e,t);Sh(r,function(s,o){e.call(t,s,o,r)&&i.push(s)})}return i}var Th=Ih,Oh=Ri,kh=Oh("",0,2,!0),Lh=kh,Dh=Ri,$h=Dh("find",1,3,!0),Mh=$h,Ah=X,Nh=Rt;function Hh(r,e,t){if(r){Ah(r)||(r=Nh(r));for(var i=r.length-1;i>=0;i--)if(e.call(t,r[i],i,r))return r[i]}}var Bh=Hh,Fh=$e;function Kh(r,e,t){if(r){var i,s,o=0,n=null,a=t,l=arguments.length>2,d=Fh(r);if(r.length&&r.reduce)return s=function(){return e.apply(n,arguments)},l?r.reduce(s,a):r.reduce(s);for(l&&(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 Ph=Kh,Yh=X;function Vh(r,e,t,i){if(Yh(r)&&r.copyWithin)return r.copyWithin(e,t,i);var s,o,n=e>>0,a=t>>0,l=r.length,d=arguments.length>3?i>>0:l;if(n<l&&(n=n>=0?n:l+n,n>=0&&(a=a>=0?a:l+a,d=d>=0?d:l+d,a<d)))for(s=0,o=r.slice(a,d);n<l&&!(o.length<=s);n++)r[n]=o[s++];return r}var Wh=Vh,Xh=X;function zh(r,e){var t,i=[],s=e>>0||1;if(Xh(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 Gh=zh,Uh=ot,qh=Ct;function Zh(r,e){return Uh(r,qh(e))}var tn=Zh,Jh=ie,ss=Ae,Qh=Kt,jh=te;function ed(r){return function(e,t){if(e&&e.length){var i,s;return jh(e,function(o,n){t&&(o=Jh(t)?t(o,n,e):Qh(o,t)),!ss(o)&&(ss(i)||r(i,o))&&(s=n,i=o)}),e[s]}return i}}var rn=ed,td=rn,id=td(function(r,e){return r<e}),sn=id,rd=tn,sd=sn;function od(r){var e,t,i,s=[];if(r&&r.length)for(e=0,t=sd(r,function(o){return o?o.length:0}),i=t?t.length:0;e<i;e++)s.push(rd(r,e));return s}var on=od,nd=on;function ad(){return nd(arguments)}var ld=ad,cd=Rt,hd=Q;function dd(r,e){var t={};return e=e||[],hd(cd(r),function(i,s){t[i]=e[s]}),t}var ud=dd,nn=X,fd=te;function an(r,e){var t=[];return fd(r,function(i){t=t.concat(nn(i)?e?an(i,e):i:[i])}),t}function gd(r,e){return nn(r)?an(r,e):[]}var vd=gd,md=ot,xd=X;function pd(r,e){for(var t=0,i=e.length;r&&t<i;)r=r[e[t++]];return i&&r?r:0}function wd(r,e){for(var t,i=arguments,s=[],o=[],n=2,a=i.length;n<a;n++)s.push(i[n]);if(xd(e)){for(a=e.length-1,n=0;n<a;n++)o.push(e[n]);e=e[a]}return md(r,function(l){if(o.length&&(l=pd(l,o)),t=l[e]||e,t&&t.apply)return t.apply(l,s)})}var yd=wd;function Ed(r,e){return(console[r]||console.log)(e)}var Cd=Ed;function bd(r,e){try{delete r[e]}catch{r[e]=void 0}}var ln=bd,_d=X,Rd=vr,Sd=Vo;function Id(r,e,t){return r&&(_d(r)?Rd:Sd)(r,e,t)}var cn=Id,Td=Et,Od=Td("object"),Si=Od,kd=ln,Ld=bt,Dd=Si,$d=X,Md=Me,Ad=ce,Nd=Ft;function Hd(r,e,t){if(r){var i,s=arguments.length>1&&(Md(e)||!Dd(e)),o=s?t:e;if(Ld(r))Nd(r,s?function(n,a){r[a]=e}:function(n,a){kd(r,a)}),o&&Ad(r,o);else if($d(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 hn=Hd,Bd=ln,Fd=ie,Kd=X,Pd=Q,Yd=te,Vd=cn,Wd=hn,Xd=Ae;function zd(r){return function(e,t){return t===r}}function Gd(r,e,t){if(r){if(!Xd(e)){var i=[],s=[];return Fd(e)||(e=zd(e)),Pd(r,function(o,n,a){e.call(t,o,n,a)&&i.push(n)}),Kd(r)?Vd(i,function(o,n){s.push(r[o]),r.splice(o,1)}):(s={},Yd(i,function(o){s[o]=r[o],Bd(r,o)})),s}return Wd(r)}return r}var dn=Gd,Ud=Ie,os=Cd,qd=pr,Zd=gr,Jd=Ae,or=Q,Qd=dn,jd=ce;function eu(r,e){or(r,function(t){t[e]&&!t[e].length&&Qd(t,e)})}function tu(r,e){var t=jd({},Ud.treeOptions,e),i=t.strict,s=t.key,o=t.parentKey,n=t.children,a=t.mapChildren,l=t.sortKey,d=t.reverse,u=t.data,f=[],g={},m={},x,v,p;return l&&(r=qd(Zd(r),l),d&&(r=r.reverse())),or(r,function(E){x=E[s],m[x]&&os("warn","Duplicate primary key="+x),m[x]=!0}),or(r,function(E){x=E[s],u?(v={},v[u]=E):v=E,p=E[o],g[x]=g[x]||[],v[s]=x,v[o]=p,x===p&&(p=null,os("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&&Jd(p))&&(m[p]||f.push(v))}),i&&eu(r,n),f}var iu=tu,ru=Ie,su=te,ou=ce;function un(r,e,t,i){var s=i.key,o=i.parentKey,n=i.children,a=i.data,l=i.updated,d=i.clear;return su(t,function(u){var f=u[n];a&&(u=u[a]),l!==!1&&(u[o]=e?e[s]:null),r.push(u),f&&f.length&&un(r,u,f,i),d&&delete u[n]}),r}function nu(r,e){return un([],null,r,ou({},ru.treeOptions,e))}var au=nu;function lu(r){return function(e,t,i,s){var o=i||{},n=o.children||"children";return r(null,e,t,s,[],[],n,o)}}var Ii=lu,cu=Ii;function fn(r,e,t,i,s,o,n,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=o.concat([l]),t.call(i,l,d,e,f,r,g))return{index:d,item:l,path:f,items:e,parent:r,nodes:g};if(n&&l&&(m=fn(l,l[n],t,i,f.concat([n]),g,n),m))return m}}}var hu=cu(fn),du=hu,uu=Ii,fu=Q;function gn(r,e,t,i,s,o,n,a){var l,d;fu(e,function(u,f){l=s.concat([""+f]),d=o.concat([u]),t.call(i,u,f,e,l,r,d),u&&n&&(l.push(n),gn(u,u[n],t,i,l,d,n))})}var gu=uu(gn),vn=gu,vu=Ii,mu=ot;function mn(r,e,t,i,s,o,n,a){var l,d,u,f=a.mapChildren||n;return mu(e,function(g,m){return l=s.concat([""+m]),d=o.concat([g]),u=t.call(i,g,m,e,l,r,d),u&&g&&n&&g[n]&&(u[f]=mn(g,g[n],t,i,l,d,n,a)),u})}var xu=vu(mn),pu=xu,wu=vn;function yu(r,e,t,i){var s=[];return r&&e&&wu(r,function(o,n,a,l,d,u){e.call(i,o,n,a,l,d,u)&&s.push(o)},t),s}var Eu=yu,Cu=Ii,bu=te,_u=ce;function xn(r,e,t,i,s,o,n,a,l){var d,u,f,g,m,x=[],v=l.original,p=l.data,E=l.mapChildren||a,b=l.isEvery;return bu(t,function(y,C){d=o.concat([""+C]),u=n.concat([y]),g=r&&!b||i.call(s,y,C,t,d,e,u),m=a&&y[a],g||m?(v?f=y:(f=_u({},y),p&&(f[p]=y)),f[E]=xn(g,y,y[a],i,s,d,u,a,l),(g||f[E].length)&&x.push(f)):g&&x.push(f)}),x}var Ru=Cu(function(r,e,t,i,s,o,n,a){return xn(0,r,e,t,i,s,o,n,a)}),Su=Ru;function Iu(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 pn=Iu;function Tu(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 wn=Tu,Ou=Et,ku=Ou("number"),Oe=ku,Lu=Oe;function Du(r){return Lu(r)&&isNaN(r)}var $u=Du,Mu=Et,Au=Mu("string"),Ne=Au,Nu=Bt,Hu=Nu("Date"),Xe=Hu,Bu=parseInt,Pt=Bu;function Fu(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 Ku=Fu;function Pu(r){return r.getTime()}var fe=Pu,vi=Pt,ns=Ku,Yu=fe,Vu=Ne,Wu=Xe;function Yt(r){return"(\\d{"+r+"})"}function Xu(r){return r<10?r*100:r<100?r*10:r}function as(r){return isNaN(r)?r:vi(r)}var ut=Yt(2),gt=Yt("1,2"),yn=Yt("1,7"),En=Yt("3,4"),Cn=".{1}",kt=Cn+gt,bn="(([zZ])|([-+]\\d{2}:?\\d{2}))",ls=[En,kt,kt,kt,kt,kt,Cn+yn,bn],nr=[];for(var Wi=ls.length-1;Wi>=0;Wi--){for(var cs="",tt=0;tt<Wi+1;tt++)cs+=ls[tt];nr.push(new RegExp("^"+cs+"$"))}function zu(r){for(var e,t={},i=0,s=nr.length;i<s;i++)if(e=r.match(nr[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 hs=[["yyyy",En],["yy",ut],["MM",ut],["M",gt],["dd",ut],["d",gt],["HH",ut],["H",gt],["mm",ut],["m",gt],["ss",ut],["s",gt],["SSS",Yt(3)],["S",yn],["Z",bn]],_n={},Rn=["\\[([^\\]]+)\\]"];for(var tt=0;tt<hs.length;tt++){var Xi=hs[tt];_n[Xi[0]]=Xi[1]+"?",Rn.push(Xi[0])}var Gu=new RegExp(Rn.join("|"),"g"),ds={};function Uu(r,e){var t=ds[e];if(!t){var i=[],s=e.replace(/([$(){}*+.?\\^|])/g,"\\$1").replace(Gu,function(u,f){var g=u.charAt(0);return g==="["?f:(i.push(g),_n[u])});t=ds[e]={_i:i,_r:new RegExp(s)}}var o={},n=r.match(t._r);if(n){for(var a=t._i,l=1,d=n.length;l<d;l++)o[a[l-1]]=n[l];return o}return o}function qu(r){if(/^[zZ]/.test(r.Z))return new Date(ns(r));var e=r.Z.match(/([-+])(\d{2}):?(\d{2})/);return e?new Date(ns(r)-(e[1]==="-"?-1:1)*vi(e[2])*36e5+vi(e[3])*6e4):new Date("")}function Zu(r,e){if(r){var t=Wu(r);if(t||!e&&/^[0-9]{11,15}$/.test(r))return new Date(t?Yu(r):vi(r));if(Vu(r)){var i=e?Uu(r,e):zu(r);if(i.y)return i.M&&(i.M=as(i.M)-1),i.S&&(i.S=Xu(as(i.S.substring(0,3)))),i.Z?qu(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 re=Zu;function Ju(){return new Date}var Ti=Ju,Qu=Xe,ju=re,ef=Ti;function tf(r){var e,t=r?ju(r):ef();return Qu(t)?(e=t.getFullYear(),e%4===0&&(e%100!==0||e%400===0)):!1}var Sn=tf,rf=X,sf=ye;function of(r,e,t){if(r){if(rf(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(sf(r,o)&&e.call(t,r[o],o,r)===!1)break}}var nf=of,af=X,lf=ye;function cf(r,e,t){if(r){var i,s;if(af(r))for(i=r.length-1;i>=0&&e.call(t,r[i],i,r)!==!1;i--);else for(s=lf(r),i=s.length-1;i>=0&&e.call(t,r[s[i]],s[i],r)!==!1;i--);}}var hf=cf,df=X,uf=Ne,ff=ye;function gf(r,e){return function(t,i){if(t){if(t[r])return t[r](i);if(uf(t)||df(t))return e(t,i);for(var s in t)if(ff(t,s)&&i===t[s])return s}return-1}}var In=gf,vf=In,mf=pn,xf=vf("indexOf",mf),pf=xf,wf=In,yf=wn,Ef=wf("lastIndexOf",yf),Tn=Ef,Cf=X,bf=Ne,_f=Q;function Rf(r){var e=0;return bf(r)||Cf(r)?r.length:(_f(r,function(){e++}),e)}var On=Rf,Sf=Oe;function If(r){return Sf(r)&&isFinite(r)}var Tf=If,Of=X,kf=Me,Lf=function(r){return!kf(r)&&!isNaN(r)&&!Of(r)&&r%1===0},kn=Lf,Df=X,$f=kn,Mf=Me;function Af(r){return!Mf(r)&&!isNaN(r)&&!Df(r)&&!$f(r)}var Nf=Af,Hf=Et,Bf=Hf("boolean"),Ln=Bf,Ff=Bt,Kf=Ff("RegExp"),wr=Kf,Pf=Bt,Yf=Pf("Error"),Dn=Yf;function Vf(r){return r?r.constructor===TypeError:!1}var Wf=Vf;function Xf(r){for(var e in r)return!1;return!0}var $n=Xf,zf=Ee,Gf=typeof Symbol!==zf;function Uf(r){return Gf&&Symbol.isSymbol?Symbol.isSymbol(r):typeof r=="symbol"}var Mn=Uf,qf=Bt,Zf=qf("Arguments"),Jf=Zf,Qf=Ne,jf=Oe;function eg(r){return!!(r&&Qf(r.nodeName)&&jf(r.nodeType))}var tg=eg,ig=Ee,rg=typeof document===ig?0:document,yr=rg,sg=yr;function og(r){return!!(r&&sg&&r.nodeType===9)}var ng=og,ag=Ee,lg=typeof window===ag?0:window,An=lg,cg=An;function hg(r){return!!(cg&&(r&&r===r.window))}var dg=hg,ug=Ee,fg=typeof FormData!==ug;function gg(r){return fg&&r instanceof FormData}var vg=gg,mg=Ee,xg=typeof Map!==mg;function pg(r){return xg&&r instanceof Map}var wg=pg,yg=Ee,Eg=typeof WeakMap!==yg;function Cg(r){return Eg&&r instanceof WeakMap}var bg=Cg,_g=Ee,Rg=typeof Set!==_g;function Sg(r){return Rg&&r instanceof Set}var Ig=Sg,Tg=Ee,Og=typeof WeakSet!==Tg;function kg(r){return Og&&r instanceof WeakSet}var Lg=kg,Dg=ie,$g=Ne,Mg=X,Ag=ye;function Ng(r){return function(e,t,i){if(e&&Dg(t)){if(Mg(e)||$g(e))return r(e,t,i);for(var s in e)if(Ag(e,s)&&t.call(i,e[s],s,e))return s}return-1}}var Nn=Ng,Hg=Nn,Bg=Hg(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}),Er=Bg,us=Oe,fs=X,gs=Ne,Fg=wr,Kg=Xe,Pg=Ln,Yg=Te,vs=$e,Vg=Go;function Hn(r,e,t,i,s,o,n){if(r===e)return!0;if(r&&e&&!us(r)&&!us(e)&&!gs(r)&&!gs(e)){if(Fg(r))return t(""+r,""+e,s,o,n);if(Kg(r)||Pg(r))return t(+r,+e,s,o,n);var a,l,d,u=fs(r),f=fs(e);if(u||f?u&&f:r.constructor===e.constructor)return l=vs(r),d=vs(e),i&&(a=i(r,e,s)),l.length===d.length?Yg(a)?Vg(l,function(g,m){return g===d[m]&&Hn(r[g],e[d[m]],t,i,u||f?m:g,r,e)}):!!a:!1}return t(r,e,s,o,n)}var Bn=Hn;function Wg(r,e){return r===e}var Fn=Wg,Xg=Bn,zg=Fn;function Gg(r,e){return Xg(r,e,zg)}var Kn=Gg,ms=$e,Ug=Er,xs=Kn,qg=zo,Zg=Uo;function Jg(r,e){var t=ms(r),i=ms(e);if(i.length){if(Zg(t,i))return qg(i,function(s){return Ug(t,function(o){return o===s&&xs(r[o],e[s])})>-1})}else return!0;return xs(r,e)}var Qg=Jg,ps=Bn,ws=Fn,jg=ie,ev=Te;function tv(r,e,t){return jg(t)?ps(r,e,function(i,s,o,n,a){var l=t(i,s,o,n,a);return ev(l)?ws(i,s):!!l},t):ps(r,e,ws)}var iv=tv,rv=Mn,sv=Xe,ov=X,nv=wr,av=Dn,lv=Me;function cv(r){return lv(r)?"null":rv(r)?"symbol":sv(r)?"date":ov(r)?"array":nv(r)?"regexp":av(r)?"error":typeof r}var hv=cv,dv=Ie,uv=Ae;function fv(r){return""+(uv(r)?"":r)+dv.keyId++}var gv=fv,vv=Nn,mv=vv(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}),xv=mv,pv=bt,wv=Ne;function yv(r){if(pv(r))return r;if(wv(r))try{return JSON.parse(r)}catch{}return{}}var Ev=yv,Cv=Ae;function bv(r){return Cv(r)?"":JSON.stringify(r)}var _v=bv,Rv=fr,Sv=Rv("entries",2),Iv=Sv,Tv=ie,Ov=X,kv=Q,Lv=Er;function Dv(r,e){return function(t,i){var s,o,n={},a=[],l=this,d=arguments,u=d.length;if(!Tv(i)){for(o=1;o<u;o++)s=d[o],a.push.apply(a,Ov(s)?s:[s]);i=0}return kv(t,function(f,g){((i?i.call(l,f,g,t):Lv(a,function(m){return m===g})>-1)?r:e)&&(n[g]=f)}),n}}var Pn=Dv,$v=Pn,Mv=$v(1,0),Av=Mv,Nv=Pn,Hv=Nv(0,1),Bv=Hv,Fv=Rt;function Kv(r){return Fv(r)[0]}var Pv=Kv,Yv=Rt;function Vv(r){var e=Yv(r);return e[e.length-1]}var Wv=Vv,Xv=Zo,zv=xr,ri=ye;function Gv(r,e){if(r){if(ri(r,e))return!0;var t,i,s,o,n,a,l=zv(e),d=0,u=l.length;for(n=r;d<u&&(a=!1,t=l[d],o=t?t.match(Xv):"",o?(i=o[1],s=o[2],i?n[i]&&ri(n[i],s)&&(a=!0,n=n[i][s]):ri(n,s)&&(a=!0,n=n[s])):ri(n,t)&&(a=!0,n=n[t]),a);d++)if(d===u-1)return!0}return!1}var Uv=Gv,ys=Pt,qv=xr,Zv=Wo,Jv=ye,Es=/(.+)?\[(\d+)\]$/;function Qv(r,e,t,i,s){if(r[e])t&&(r[e]=s);else{var o,n,a=e?e.match(Es):null;if(t)n=s;else{var l=i?i.match(Es):null;l&&!l[1]?n=new Array(ys(l[2])+1):n={}}return a?a[1]?(o=ys(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 jv(r,e,t){if(r&&Zv(e)){if((r[e]||Jv(r,e))&&!Cs(e))r[e]=t;else for(var i=r,s=qv(e),o=s.length,n=0;n<o;n++)if(!Cs(s[n])){var a=n===o-1;i=Qv(i,s[n],a,a?null:s[n+1],t)}}return r}function Cs(r){return r==="__proto__"||r==="constructor"||r==="prototype"}var em=jv,tm=$n,im=Si,rm=ie,sm=Ct,om=Q;function nm(r){return function(){return tm(r)}}function am(r,e,t){var i,s={};return r&&(e&&im(e)?e=nm(e):rm(e)||(e=sm(e)),om(r,function(o,n){i=e?e.call(t,o,n,r):o,s[i]?s[i].push(o):s[i]=[o]})),s}var Yn=am,lm=Yn,cm=Ft;function hm(r,e,t){var i=lm(r,e,t||this);return cm(i,function(s,o){i[o]=s.length}),i}var dm=hm;function um(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 Vn=um,bs=$e,fm=at,gm=_t,vm=te,mm=ce;function xm(r,e){if(r&&e){var t=mm.apply(this,[{}].concat(fm(arguments,1))),i=bs(t);vm(bs(r),function(s){gm(i,s)&&(r[s]=t[s])})}return r}var pm=xm,wm=rn,ym=wm(function(r,e){return r>e}),Em=ym;function Cm(r){return(r.split(".")[1]||"").length}var Oi=Cm,bm=Pt;function _m(r,e){if(r.repeat)return r.repeat(e);var t=isNaN(e)?[]:new Array(bm(e));return t.join(r)+(t.length>0?r:"")}var Vt=_m;function Rm(r,e){return r.substring(0,e)+"."+r.substring(e,r.length)}var Wn=Rm,si=Vt,zi=Wn;function Sm(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]||"",l=t[7],d=t[8],u=d-a.length,f=d-o.length,g=d-n.length;return l==="+"?o?s+o+si("0",d):u>0?s+n+a+si("0",u):s+n+zi(a,d):o?f>0?s+"0."+si("0",Math.abs(f))+o:s+zi(o,f):g>0?s+"0."+si("0",Math.abs(g))+n+a:s+zi(n,g)+a}return e}var ze=Sm,_s=Oi,Rs=ze;function Im(r,e){var t=Rs(r),i=Rs(e);return parseInt(t.replace(".",""))*parseInt(i.replace(".",""))/Math.pow(10,_s(t)+_s(i))}var Xn=Im,Tm=Xn,Ss=nt,Om=ze;function km(r){return function(e,t){var i=Ss(e),s=i;if(i){t=t>>0;var o=Om(i),n=o.split("."),a=n[0],l=n[1]||"",d=l.substring(0,t+1),u=a+(d?"."+d:"");if(t>=l.length)return Ss(u);if(u=i,t>0){var f=Math.pow(10,t);s=Math[r](Tm(u,f))/f}else s=Math[r](u)}return s}}var Cr=km,Lm=Cr,Dm=Lm("round"),br=Dm,$m=Cr,Mm=$m("ceil"),zn=Mm,Am=Cr,Nm=Am("floor"),Gn=Nm,Hm=Ae,Bm=Oe,Fm=ze;function Km(r){return Bm(r)?Fm(r):""+(Hm(r)?"":r)}var se=Km,Pm=br,Ym=se,Vm=Vt,Wm=Wn;function Xm(r,e){e=e>>0;var t=Ym(Pm(r,e)),i=t.split("."),s=i[0],o=i[1]||"",n=e-o.length;return e?n>0?s+"."+o+Vm("0",n):s+Wm(o,Math.abs(n)):s}var _r=Xm,zm=Ie,Gm=br,Um=zn,qm=Gn,Zm=Oe,Jm=se,Qm=_r,jm=ze,ex=ce;function tx(r,e){var t=ex({},zm.commafyOptions,e),i=t.digits,s=Zm(r),o,n,a,l,d;return s?(o=(t.ceil?Um:t.floor?qm:Gm)(r,i),n=jm(i?Qm(o,i):o).split("."),l=n[0],d=n[1],a=l&&o<0,a&&(l=l.substring(1,l.length))):(o=Jm(r).replace(/,/g,""),n=o?[o]:[],l=n[0]),n.length?(a?"-":"")+l.replace(new RegExp("(?=(?!(\\b))(.{"+(t.spaceNumber||3)+"})+$)","g"),t.separator||",")+(d?"."+d:""):o}var ix=tx,rx=Pt,sx=en,ox=sx(rx),nx=ox,ax=Xn,Is=nt;function lx(r,e){var t=Is(r),i=Is(e);return ax(t,i)}var Rr=lx,Ts=Oi,Os=ze,ks=Rr;function cx(r,e){var t=Os(r),i=Os(e),s=Math.pow(10,Math.max(Ts(t),Ts(i)));return(ks(r,s)+ks(e,s))/s}var Un=cx,hx=Un,Ls=nt;function dx(r,e){return hx(Ls(r),Ls(e))}var ux=dx,Ds=Oi,$s=ze,Ms=nt,fx=_r;function gx(r,e){var t=Ms(r),i=Ms(e),s=$s(t),o=$s(i),n=Ds(s),a=Ds(o),l=Math.pow(10,Math.max(n,a)),d=n>=a?n:a;return parseFloat(fx((t*l-i*l)/l,d))}var vx=gx,As=Oi,Ns=ze,mx=Rr;function xx(r,e){var t=Ns(r),i=Ns(e),s=As(t),o=As(i),n=o-s,a=n<0,l=Math.pow(10,a?Math.abs(n):n);return mx(t.replace(".","")/i.replace(".",""),a?1/l:l)}var qn=xx,px=qn,Hs=nt;function wx(r,e){return px(Hs(r),Hs(e))}var yx=wx,Gi=Un,Ex=ie,Cx=X,bx=Q,_x=Kt;function Rx(r,e,t){var i=0;return bx(r&&r.length>2&&Cx(r)?r.sort():r,e?Ex(e)?function(){i=Gi(i,e.apply(t,arguments))}:function(s){i=Gi(i,_x(s,e))}:function(s){i=Gi(i,s)}),i}var Zn=Rx,Sx=qn,Ix=On,Tx=Zn;function Ox(r,e,t){return Sx(Tx(r,e,t),Ix(r))}var kx=Ox,Lx="first",Wt=Lx,Dx="last",ki=Dx;function $x(r){return r.getFullYear()}var Xt=$x,Mx=864e5,St=Mx;function Ax(r){return r.getMonth()}var Li=Ax,Nx=Xe,Hx=fe;function Bx(r){return Nx(r)&&!isNaN(Hx(r))}var ge=Bx,Bs=Wt,Fx=ki,Kx=St,Px=Xt,Fs=fe,Ks=Li,Yx=re,Vx=ge,Wx=Oe;function Jn(r,e,t){var i=e&&!isNaN(e)?e:0;if(r=Yx(r),Vx(r)){if(t===Bs)return new Date(Px(r),Ks(r)+i,1);if(t===Fx)return new Date(Fs(Jn(r,i+1,Bs))-1);if(Wx(t)&&r.setDate(t),i){var s=r.getDate();if(r.setMonth(Ks(r)+i),s!==r.getDate())return r.setDate(1),new Date(Fs(r)-Kx)}}return r}var zt=Jn,Xx=Wt,Ps=ki,Ys=Xt,zx=zt,Gx=re,Ux=ge;function qx(r,e,t){var i;if(r=Gx(r),Ux(r)&&(e&&(i=e&&!isNaN(e)?e:0,r.setFullYear(Ys(r)+i)),t||!isNaN(t))){if(t===Xx)return new Date(Ys(r),0,1);if(t===Ps)return r.setMonth(11),zx(r,0,Ps);r.setMonth(t)}return r}var Di=qx,Zx=zt,Jx=re,Qx=ge;function jx(r){var e=r.getMonth();return e<3?1:e<6?2:e<9?3:4}function ep(r,e,t){var i,s=e&&!isNaN(e)?e*3:0;return r=Jx(r),Qx(r)?(i=(jx(r)-1)*3,r.setMonth(i),Zx(r,s,t)):r}var tp=ep,Vs=Wt,ip=ki,rp=Pt,sp=Xt,op=Li,np=fe,ap=re,lp=ge;function Qn(r,e,t){if(r=ap(r),lp(r)&&!isNaN(e)){if(r.setDate(r.getDate()+rp(e)),t===Vs)return new Date(sp(r),op(r),r.getDate());if(t===ip)return new Date(np(Qn(r,1,Vs))-1)}return r}var jn=Qn;function cp(r){return r.toUpperCase()}var ea=cp,hp=St,dp=hp*7,ta=dp,up=Ie,Ui=St,fp=ta,gp=fe,vp=re,mp=ge,Ws=Oe;function xp(r,e,t,i){if(r=vp(r),mp(r)){var s=Ws(t),o=Ws(i),n=gp(r);if(s||o){var a=o?i:up.firstDayOfWeek,l=r.getDay(),d=s?t:l;if(l!==d){var u=0;a>l?u=-(7-a+l):a<l&&(u=a-l),d>a?n+=((d===0?7:d)-a+u)*Ui:d<a?n+=(7-a+d+u)*Ui:n+=u*Ui}}return e&&!isNaN(e)&&(n+=e*fp),new Date(n)}return r}var ia=xp,pp=Ie,oi=St,wp=ta,yp=Oe,Ep=_t,Cp=re,bp=ge,Xs=ia,_p=Vn,Rp=ot,ni=fe,Sp=Rp(_p(0,7),function(r){return[(r+1)%7,(r+2)%7,(r+3)%7]});function zs(r,e){var t=new Date(r).getDay();return Ep(Sp[e],t)}function Ip(r,e){return function(t,i){var s=yp(i)?i:pp.firstDayOfWeek,o=Cp(t);if(bp(o)){var n=Xs(o,0,s,s),a=r(n),l=ni(a),d=ni(n),u=d+oi*6,f=new Date(u),g=Xs(a,0,s,s),m=ni(g),x;if(d===m)return 1;if(e(n,f)){for(x=ni(r(f));x<u;x+=oi)if(zs(x,s))return 1}var v=m+oi*6,p=new Date(u),E=1;if(e(g,p)){for(E=0,x=l;x<v;x+=oi)if(zs(x,s)){E++;break}}return Math.floor((d-m)/wp)+E}return NaN}}var ra=Ip,Tp=ra,Op=Tp(function(r){return new Date(r.getFullYear(),0,1)},function(r,e){return r.getFullYear()!==e.getFullYear()}),sa=Op,kp=Xt,Lp=Li;function Dp(r){return new Date(kp(r),Lp(r),r.getDate())}var $p=Dp,Mp=fe,Ap=$p;function Np(r){return Mp(Ap(r))}var Hp=Np,Bp=St,Fp=Wt,Gs=Hp,Kp=Di,Pp=re,Yp=ge;function Vp(r){return r=Pp(r),Yp(r)?Math.floor((Gs(r)-Gs(Kp(r,0,Fp)))/Bp)+1:NaN}var oa=Vp,Wp=se,Xp=Te,zp=Vt;function Gp(r,e,t){var i=Wp(r);return e=e>>0,t=Xp(t)?" ":""+t,i.padStart?i.padStart(e,t):e>i.length?(e-=i.length,e>t.length&&(t+=zp(t,e/t.length)),t.slice(0,e)+i):i}var na=Gp,Lt=Ie,Up=ea,qp=Xt,Us=Li,Zp=re,Jp=sa,Qp=oa,jp=ce,e0=ge,t0=ie,be=na;function Fe(r,e,t,i){var s=e[t];return s?t0(s)?s(i,t,r):s[i]:i}var i0=/\[([^\]]+)]|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 r0(r,e,t){if(r){if(r=Zp(r),e0(r)){var i=e||Lt.parseDateFormat||Lt.formatString,s=r.getHours(),o=s<12?"am":"pm",n=jp({},Lt.parseDateRules||Lt.formatStringMatchs,t?t.formats:null),a=function(y,C){return(""+qp(r)).substr(4-C)},l=function(y,C){return be(Us(r)+1,C,"0")},d=function(y,C){return be(r.getDate(),C,"0")},u=function(y,C){return be(s,C,"0")},f=function(y,C){return be(s<=12?s:s-12,C,"0")},g=function(y,C){return be(r.getMinutes(),C,"0")},m=function(y,C){return be(r.getSeconds(),C,"0")},x=function(y,C){return be(r.getMilliseconds(),C,"0")},v=function(y,C){var T=r.getTimezoneOffset()/60*-1;return Fe(r,n,y,(T>=0?"+":"-")+be(T,2,"0")+(C===1?":":"")+"00")},p=function(y,C){return be(Fe(r,n,y,Jp(r,(t?t.firstDay:null)||Lt.firstDayOfWeek)),C,"0")},E=function(y,C){return be(Fe(r,n,y,Qp(r)),C,"0")},b={yyyy:a,yy:a,MM:l,M:l,dd:d,d,HH:u,H:u,hh:f,h:f,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(y){return Fe(r,n,y,o)},A:function(y){return Fe(r,n,y,Up(o))},e:function(y){return Fe(r,n,y,r.getDay())},E:function(y){return Fe(r,n,y,r.getDay())},q:function(y){return Fe(r,n,y,Math.floor((Us(r)+3)/3))}};return i.replace(i0,function(y,C){return C||(b[y]?b[y](y,y.length):y)})}return"Invalid Date"}return""}var aa=r0,s0=fe,o0=Ti,n0=Date.now||function(){return s0(o0())},la=n0,a0=fe,l0=la,c0=re,h0=Xe,d0=function(r,e){if(r){var t=c0(r,e);return h0(t)?a0(t):t}return l0()},u0=d0,qs=aa;function f0(r,e,t){return r&&e?(r=qs(r,t),r!=="Invalid Date"&&r===qs(e,t)):!1}var g0=f0,v0=ra,m0=v0(function(r){return new Date(r.getFullYear(),r.getMonth(),1)},function(r,e){return r.getMonth()!==e.getMonth()}),x0=m0,p0=Di,w0=re,y0=ge,E0=Sn;function C0(r,e){return r=w0(r),y0(r)?E0(p0(r,e))?366:365:NaN}var b0=C0,_0=St,R0=Wt,S0=ki,Zs=fe,Js=zt,I0=re,T0=ge;function O0(r,e){return r=I0(r),T0(r)?Math.floor((Zs(Js(r,e,S0))-Zs(Js(r,e,R0)))/_0)+1:NaN}var k0=O0,Qs=fe,L0=Ti,js=re,eo=ge,to=[["yyyy",31536e6],["MM",2592e6],["dd",864e5],["HH",36e5],["mm",6e4],["ss",1e3],["S",0]];function D0(r,e){var t,i,s,o,n,a,l={done:!1,time:0};if(r=js(r),e=e?js(e):L0(),eo(r)&&eo(e)&&(t=Qs(r),i=Qs(e),t<i))for(o=l.time=i-t,l.done=!0,a=0,n=to.length;a<n;a++)s=to[a],o>=s[1]?a===n-1?l[s[0]]=o||0:(l[s[0]]=Math.floor(o/s[1]),o-=l[s[0]]*s[1]):l[s[0]]=0;return l}var $0=D0,M0=se,A0=Te,N0=Vt;function H0(r,e,t){var i=M0(r);return e=e>>0,t=A0(t)?" ":""+t,i.padEnd?i.padEnd(e,t):e>i.length?(e-=i.length,e>t.length&&(t+=N0(t,e/t.length)),i+t.slice(0,e)):i}var B0=H0,F0=se,K0=Vt;function P0(r,e){return K0(F0(r),e)}var Y0=P0,V0=se;function W0(r){return r&&r.trimRight?r.trimRight():V0(r).replace(/[\s\uFEFF\xA0]+$/g,"")}var ca=W0,X0=se;function z0(r){return r&&r.trimLeft?r.trimLeft():X0(r).replace(/^[\s\uFEFF\xA0]+/g,"")}var ha=z0,G0=ca,U0=ha;function q0(r){return r&&r.trim?r.trim():G0(U0(r))}var da=q0,Z0={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},ua=Z0,J0=se,Q0=$e;function j0(r){var e=new RegExp("(?:"+Q0(r).join("|")+")","g");return function(t){return J0(t).replace(e,function(i){return r[i]})}}var fa=j0,e1=ua,t1=fa,i1=t1(e1),r1=i1,io=ua,s1=fa,o1=Q,ga={};o1(io,function(r,e){ga[io[e]]=e});var n1=s1(ga),a1=n1;function l1(r,e,t){return r.substring(e,t)}var va=l1;function c1(r){return r.toLowerCase()}var ma=c1,h1=se,Ke=va,Dt=ea,d1=ma,qi={};function u1(r){if(r=h1(r),qi[r])return qi[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=d1(s),o?n>2&&o+n<e?Dt(Ke(s,0,1))+Ke(s,1,n-1)+Dt(Ke(s,n-1,n)):Dt(Ke(s,0,1))+Ke(s,1,n):n>1&&o+n<e?Ke(s,0,n-1)+Dt(Ke(s,n-1,n)):s}).replace(/(-[a-zA-Z])/g,function(i,s){return Dt(Ke(s,1,s.length))}),qi[r]=t,t}var f1=u1,g1=se,ft=va,Pe=ma,Zi={};function v1(r){if(r=g1(r),Zi[r])return Zi[r];if(/^[A-Z]+$/.test(r))return Pe(r);var e=r.replace(/^([a-z])([A-Z]+)([a-z]+)$/,function(t,i,s,o){var n=s.length;return n>1?i+"-"+Pe(ft(s,0,n-1))+"-"+Pe(ft(s,n-1,n))+o:Pe(i+"-"+s+o)}).replace(/^([A-Z]+)([a-z]+)?$/,function(t,i,s){var o=i.length;return Pe(ft(i,0,o-1)+"-"+ft(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||"")+Pe(ft(s,0,a-1))+"-"+Pe(ft(s,a-1,a))+o:(i||"")+(n?"-":"")+Pe(s)+(o||"")});return e=e.replace(/([-]+)/g,function(t,i,s){return s&&s+i.length<e.length?"-":""}),Zi[r]=e,e}var m1=v1,x1=se;function p1(r,e,t){var i=x1(r);return(arguments.length===1?i:i.substring(t)).indexOf(e)===0}var w1=p1,y1=se;function E1(r,e,t){var i=y1(r),s=arguments.length;return s>1&&(s>2?i.substring(0,t).indexOf(e)===t-1:i.indexOf(e)===i.length-1)}var C1=E1,b1=Ie,_1=se,R1=da,S1=Kt;function I1(r,e,t){return _1(r).replace((t||b1).tmplRE||/\{{2}([.\w[\]\s]+)\}{2}/g,function(i,s){return S1(e,R1(s))})}var xa=I1,T1=xa;function O1(r,e){return T1(r,e,{tmplRE:/\{([.\w[\]\s]+)\}/g})}var k1=O1;function L1(){}var D1=L1,ro=at;function $1(r,e){var t=ro(arguments,2);return function(){return r.apply(e,ro(arguments).concat(t))}}var M1=$1,so=at;function A1(r,e){var t=!1,i=null,s=so(arguments,2);return function(){return t||(i=r.apply(e,so(arguments).concat(s)),t=!0),i}}var N1=A1,H1=at;function B1(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(H1(o)))}}var F1=B1,K1=at;function P1(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(K1(o))))}}var Y1=P1,V1=ce;function W1(r,e,t){var i=null,s=null,o=!1,n=null,a=V1({leading:!0,trailing:!0},t),l=a.leading,d=a.trailing,u=function(){i=null,s=null},f=function(){o=!0,r.apply(s,i),n=setTimeout(g,e),u()},g=function(){if(n=null,o){u();return}if(d===!0){f();return}u()},m=function(){var v=n!==null;return v&&clearTimeout(n),u(),n=null,o=!1,v},x=function(){if(i=arguments,s=this,o=!1,n===null&&l===!0){f();return}d===!0&&(n=setTimeout(g,e))};return x.cancel=m,x}var X1=W1,z1=ce;function G1(r,e,t){var i=null,s=null,o=typeof t=="boolean"?{leading:t,trailing:!t}:z1({leading:!1,trailing:!0},t),n=!1,a=null,l=o.leading,d=o.trailing,u=function(){i=null,s=null},f=function(){n=!0,r.apply(s,i),u()},g=function(){if(l===!0&&(a=null),n){u();return}if(d===!0){f();return}u()},m=function(){var v=a!==null;return v&&clearTimeout(a),u(),a=null,n=!1,v},x=function(){n=!1,i=arguments,s=this,a===null?l===!0&&f():clearTimeout(a),a=setTimeout(g,e)};return x.cancel=m,x}var U1=G1,q1=at;function Z1(r,e){var t=q1(arguments,2),i=this;return setTimeout(function(){r.apply(i,t)},e)}var J1=Z1,Q1=decodeURIComponent,pa=Q1,oo=pa,j1=te,ew=Ne;function tw(r){var e,t={};return r&&ew(r)&&j1(r.split("&"),function(i){e=i.split("="),t[oo(e[0])]=oo(e[1]||"")}),t}var wa=tw,iw=encodeURIComponent,ya=iw,mi=ya,Ea=Q,Ca=X,ba=Me,rw=Te,_a=bt;function Ra(r,e,t){var i,s=[];return Ea(r,function(o,n){i=Ca(o),_a(o)||i?s=s.concat(Ra(o,e+"["+n+"]",i)):s.push(mi(e+"["+(t?"":n)+"]")+"="+mi(ba(o)?"":o))}),s}function sw(r){var e,t=[];return Ea(r,function(i,s){rw(i)||(e=Ca(i),_a(i)||e?t=t.concat(Ra(i,s,e)):t.push(mi(s)+"="+mi(ba(i)?"":i)))}),t.join("&").replace(/%20/g,"+")}var ow=sw,nw=Ee,aw=typeof location===nw?0:location,$i=aw,ai=$i;function lw(){return ai?ai.origin||ai.protocol+"//"+ai.host:""}var Sa=lw,no=$i,cw=wa,hw=Sa;function ao(r){return cw(r.split("?")[1]||"")}function dw(r){var e,t,i,s,o=""+r;return o.indexOf("//")===0?o=(no?no.protocol:"")+o:o.indexOf("/")===0&&(o=hw()+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,l){return t=l||"",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=ao(s.hash),s.searchQuery=ao(s.search),s}var Ia=dw,lo=$i,uw=Sa,fw=Tn;function gw(){if(lo){var r=lo.pathname,e=fw(r,"/")+1;return uw()+(e===r.length?r:r.substring(0,e))}return""}var vw=gw,co=$i,mw=Ia;function xw(){return co?mw(co.href):{}}var pw=xw,Ta=Ie,Ji=yr,ho=pa,uo=ya,ww=X,fo=Si,Oa=Xe,yw=Te,Ew=_t,Cw=$e,xi=ce,Qi=te,bw=Ti,li=fe,_w=Di,Rw=zt,Sw=jn;function go(r,e){var t=parseFloat(e),i=bw(),s=li(i);switch(r){case"y":return li(_w(i,t));case"M":return li(Rw(i,t));case"d":return li(Sw(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 ji(r){return(Oa(r)?r:new Date(r)).toUTCString()}function Ve(r,e,t){if(Ji){var i,s,o,n,a,l,d=[],u=arguments;return ww(r)?d=r:u.length>1?d=[xi({name:r,value:e},t)]:fo(r)&&(d=[r]),d.length>0?(Qi(d,function(f){i=xi({},Ta.cookies,f),o=[],i.name&&(s=i.expires,o.push(uo(i.name)+"="+uo(fo(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 ji(go(x,m))}):/^[0-9]{11,13}$/.test(s)||Oa(s)?s=ji(s):s=ji(go("d",s)),i.expires=s),Qi(["expires","path","domain","secure"],function(g){yw(i[g])||o.push(i[g]&&g==="secure"?g:g+"="+i[g])})),Ji.cookie=o.join("; ")}),!0):(n={},a=Ji.cookie,a&&Qi(a.split("; "),function(f){l=f.indexOf("="),n[ho(f.substring(0,l))]=ho(f.substring(l+1)||"")}),u.length===1?n[r]:n)}return!1}function Iw(r){return Ew(ka(),r)}function vo(r){return Ve(r)}function mo(r,e,t){return Ve(r,e,t),Ve}function xo(r,e){Ve(r,"",xi({expires:-1},Ta.cookies,e))}function ka(){return Cw(Ve())}function Tw(){return Ve()}xi(Ve,{has:Iw,set:mo,setItem:mo,get:vo,getItem:vo,remove:xo,removeItem:xo,keys:ka,getJSON:Tw});var Ow=Ve,kw=Ee,er=yr,tr=An,Lw=ce,Dw=te;function po(r){try{var e="__xe_t";return r.setItem(e,1),r.removeItem(e),!0}catch{return!1}}function ci(r){return navigator.userAgent.indexOf(r)>-1}function $w(){var r,e,t,i=!1,s=!1,o=!1,n={isNode:!1,isMobile:i,isPC:!1,isDoc:!!er};if(!tr&&typeof process!==kw)n.isNode=!0;else{t=ci("Edge"),e=ci("Chrome"),i=/(Android|webOS|iPhone|iPad|iPod|SymbianOS|BlackBerry|Windows Phone)/.test(navigator.userAgent),n.isDoc&&(r=er.body||er.documentElement,Dw(["webkit","khtml","moz","ms","o"],function(a){n["-"+a]=!!r[a+"MatchesSelector"]}));try{s=po(tr.localStorage)}catch{}try{o=po(tr.sessionStorage)}catch{}Lw(n,{edge:t,firefox:ci("Firefox"),msie:!t&&n["-ms"],safari:!e&&!t&&ci("Safari"),isMobile:i,isPC:!i,isLocalStorage:s,isSessionStorage:o})}return n}var Mw=$w,La=Ul,wo=ce,Aw=Ft,Nw=Vo,Hw=nc,Bw=fc,Fw=ot,Kw=zo,Pw=Go,Yw=Uo,Vw=te,Ww=vr,Xw=qo,zw=Ac,Gw=mr,Uw=uh,qw=pr,Zw=jo,Jw=Eh,Qw=at,jw=Th,ey=Lh,ty=_t,iy=Mh,ry=Bh,sy=Ph,oy=Wh,ny=Gh,ay=ld,ly=on,cy=ud,hy=vd,dy=tn,uy=yd,fy=iu,gy=au,vy=du,my=vn,xy=pu,py=Eu,wy=Su,yy=pn,Ey=wn,Cy=ye,by=X,_y=Me,Ry=$u,Sy=Te,Iy=ie,Ty=Si,Oy=Ne,ky=bt,Ly=Sn,Dy=Xe,$y=Ae,My=Q,Ay=nf,Ny=hf,Hy=pf,By=Tn,Fy=$e,Ky=Rt,Py=gr,Yy=On,Vy=cn,Wy=dn,Xy=hn,zy=Tf,Gy=Nf,Uy=kn,qy=Ln,Zy=Oe,Jy=wr,Qy=Dn,jy=Wf,eE=$n,tE=Mn,iE=Jf,rE=tg,sE=ng,oE=dg,nE=vg,aE=wg,lE=bg,cE=Ig,hE=Lg,dE=Qg,uE=Kn,fE=iv,gE=hv,vE=gv,mE=Er,xE=xv,pE=Ev,wE=_v,yE=Iv,EE=Av,CE=Bv,bE=Pv,_E=Wv,RE=Uv,SE=Kt,IE=em,TE=Yn,OE=dm,kE=Vn,LE=pm,DE=Qo,$E=sn,ME=Em,AE=ix,NE=br,HE=zn,BE=Gn,FE=_r,KE=nx,PE=nt,YE=ze,VE=ux,WE=vx,XE=Rr,zE=yx,GE=Zn,UE=kx,qE=Di,ZE=tp,JE=zt,QE=jn,jE=re,e2=aa,t2=la,i2=u0,r2=ge,s2=g0,o2=ia,n2=oa,a2=sa,l2=x0,c2=b0,h2=k0,d2=$0,u2=B0,f2=na,g2=Y0,v2=da,m2=ca,x2=ha,p2=r1,w2=a1,y2=f1,E2=m1,C2=w1,b2=C1,_2=xa,R2=k1,yo=se,S2=D1,I2=Ct,T2=M1,O2=N1,k2=F1,L2=Y1,D2=X1,$2=U1,M2=J1,A2=wa,N2=ow,H2=Ia,B2=vw,F2=pw,K2=Ow,P2=Mw;wo(La,{assign:wo,objectEach:Aw,lastObjectEach:Nw,objectMap:Hw,merge:Bw,uniq:Xw,union:zw,sortBy:Uw,orderBy:qw,shuffle:Zw,sample:Jw,some:Kw,every:Pw,slice:Qw,filter:jw,find:iy,findLast:ry,findKey:ey,includes:ty,arrayIndexOf:yy,arrayLastIndexOf:Ey,map:Fw,reduce:sy,copyWithin:oy,chunk:ny,zip:ay,unzip:ly,zipObject:cy,flatten:hy,toArray:Gw,includeArrays:Yw,pluck:dy,invoke:uy,arrayEach:Vw,lastArrayEach:Ww,toArrayTree:fy,toTreeArray:gy,findTree:vy,eachTree:my,mapTree:xy,filterTree:py,searchTree:wy,hasOwnProp:Cy,eqNull:$y,isNaN:Ry,isFinite:zy,isUndefined:Sy,isArray:by,isFloat:Gy,isInteger:Uy,isFunction:Iy,isBoolean:qy,isString:Oy,isNumber:Zy,isRegExp:Jy,isObject:Ty,isPlainObject:ky,isDate:Dy,isError:Qy,isTypeError:jy,isEmpty:eE,isNull:_y,isSymbol:tE,isArguments:iE,isElement:rE,isDocument:sE,isWindow:oE,isFormData:nE,isMap:aE,isWeakMap:lE,isSet:cE,isWeakSet:hE,isLeapYear:Ly,isMatch:dE,isEqual:uE,isEqualWith:fE,getType:gE,uniqueId:vE,getSize:Yy,indexOf:Hy,lastIndexOf:By,findIndexOf:mE,findLastIndexOf:xE,toStringJSON:pE,toJSONString:wE,keys:Fy,values:Ky,entries:yE,pick:EE,omit:CE,first:bE,last:_E,each:My,forOf:Ay,lastForOf:Ny,lastEach:Vy,has:RE,get:SE,set:IE,groupBy:TE,countBy:OE,clone:Py,clear:Xy,remove:Wy,range:kE,destructuring:LE,random:DE,min:ME,max:$E,commafy:AE,round:NE,ceil:HE,floor:BE,toFixed:FE,toNumber:PE,toNumberString:YE,toInteger:KE,add:VE,subtract:WE,multiply:XE,divide:zE,sum:GE,mean:UE,now:t2,timestamp:i2,isValidDate:r2,isDateSame:s2,toStringDate:jE,toDateString:e2,getWhatYear:qE,getWhatQuarter:ZE,getWhatMonth:JE,getWhatWeek:o2,getWhatDay:QE,getYearDay:n2,getYearWeek:a2,getMonthWeek:l2,getDayOfYear:c2,getDayOfMonth:h2,getDateDiff:d2,trim:v2,trimLeft:x2,trimRight:m2,escape:p2,unescape:w2,camelCase:y2,kebabCase:E2,repeat:g2,padStart:f2,padEnd:u2,startsWith:C2,endsWith:b2,template:_2,toFormatString:R2,toString:yo,toValueString:yo,noop:S2,property:I2,bind:T2,once:O2,after:k2,before:L2,throttle:D2,debounce:$2,delay:M2,unserialize:A2,serialize:N2,parseUrl:H2,getBaseURL:B2,locat:F2,browse:P2,cookie:K2});var I=La,ee=[];for(var ir=0;ir<256;++ir)ee.push((ir+256).toString(16).slice(1));function Y2(r,e=0){return(ee[r[e+0]]+ee[r[e+1]]+ee[r[e+2]]+ee[r[e+3]]+"-"+ee[r[e+4]]+ee[r[e+5]]+"-"+ee[r[e+6]]+ee[r[e+7]]+"-"+ee[r[e+8]]+ee[r[e+9]]+"-"+ee[r[e+10]]+ee[r[e+11]]+ee[r[e+12]]+ee[r[e+13]]+ee[r[e+14]]+ee[r[e+15]]).toLowerCase()}var hi,V2=new Uint8Array(16);function W2(){if(!hi&&(hi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!hi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return hi(V2)}var X2=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Eo={randomUUID:X2};function De(r,e,t){if(Eo.randomUUID&&!r)return Eo.randomUUID();r=r||{};var i=r.random||(r.rng||W2)();return i[6]=i[6]&15|64,i[8]=i[8]&63|128,Y2(i)}const z2=r=>r==null||r==="",Z=r=>!z2(r),et=r=>r==null,ue=r=>!et(r),G2=r=>function(e,t,i,s){const o=i||{},n=o.children||"children";return r(null,e,t,s,[],[],n,o)},Da=(r,e,t,i,s,o,n)=>{let a,l;e.forEach((d,u)=>{a=s.concat([""+u]),l=o.concat([d]),t.call(i,d,u,e,a,r,l),d&&n&&(a.push(n),Da(d,d[n]||[],t,i,a,l,n))})},Mt=G2(Da),$a={form:{labelCol:{span:6},wrapperCol:{span:16}},grid:{align:"left",lazyReset:!1,fitHeight:170,striped:!1},canvasTable:{DISABLED:!0}};let ne=I.clone($a,!0);function Ma(r){ne={form:{...ne.form,...r.form},grid:{...ne.grid,...r.grid},canvasTable:{...ne.canvasTable,...r.canvasTable}}}function U2(){return ne}function Co(){var r,e;return{labelCol:(r=ne.form)==null?void 0:r.labelCol,wrapperCol:(e=ne.form)==null?void 0:e.wrapperCol}}function vt(){var r,e,t,i;return{align:(r=ne.grid)==null?void 0:r.align,lazyReset:(e=ne.grid)==null?void 0:e.lazyReset,fitHeight:(t=ne.grid)==null?void 0:t.fitHeight,striped:(i=ne.grid)==null?void 0:i.striped}}function Aa(){return ne.canvasTable||{}}function q2(){ne=JSON.parse(JSON.stringify($a))}const Mi=r=>{var e;return{dataIndex:r.field,key:r.field,title:r.title,...I.omit(r,["children","slots","cellRender","formatter"]),children:(e=r.children)==null?void 0:e.map(t=>Mi(t))}},Sr={xs:24,sm:24,md:12,lg:8,xl:8,xxl:6},Ir={xs:12,sm:5,md:6,lg:6,xl:5,xxl:4},Z2={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}},Na=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},bo=["xxs","xs","sm","md","lg","xl","xxl"],J2=r=>{const e=I.isArray(r)?r:I.isNumber(r)?Array.from({length:r},()=>Sr):[];return I.zipObject(bo,bo.map(t=>e.every(i=>Z(i[t]))?Na(e.map(i=>i[t])):24))};function Tr(r,e,t){const i=c.toValue(r);if(typeof i!="object"||i===null)return c.watch(r,e,t);let s=I.clone(i,!0);return c.watch(r,(o,n,a)=>{e(o,s,a),s=I.clone(o,!0)},t)}const je="-",mt={toString:({cellValue:r})=>{var e;return r?((e=r.toString)==null?void 0:e.call(r))??je:je},formatByOptions:({cellValue:r},e,t=",")=>{if(r==null)return je;if(I.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):je}else return je;const i=e.find(s=>s.value===r);return i?i.label:je},formatSex:({cellValue:r})=>Z(r)?I.toNumber(r)===1?"男":"女":je},Q2=(r,{record:e,index:t,column:i,field:s})=>{if(I.isString(r)&&mt[r]){const o=mt[r];return o({row:e,rowIndex:t,cellValue:s?e[s]:null})}else if(I.isArray(r)&&mt[r[0]]&&r.length>1){const o=mt[r[0]];return o({row:e,rowIndex:t,cellValue:s?e[s]:null},...r.slice(1))}else return I.isFunction(r)?r({row:e,rowIndex:t,cellValue:s?e[s]:null,column:i}):s?e[s]:null},Ha=r=>{Object.assign(mt,r)},j2=c.defineComponent(r=>{const{cellRender:e,renderTableParams:t}=r,{data:i,row:s,field:o,rowIndex:n}=t;return()=>{var a,l;return((l=(a=At.renders[e.name])==null?void 0:a.renderDefault)==null?void 0:l.call(a,e,{data:i,row:s,field:o,rowIndex:n},r.defaultHandler))??null}},{name:"RenderAntCell",props:["cellRender","renderTableParams","defaultHandler"]}),Ba=c.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?c.createVNode(j2,{cellRender:i.cellRender,defaultHandler:r.defaultHandler,renderTableParams:{data:e,row:t,field:i.field,rowIndex:s}},null):i.formatter?Q2(i.formatter,{record:t,index:s,field:i.field,column:i}):o)}},{name:"RenderAntDefaultCell",props:["tableData","row","column","rowIndex","defaultHandler"]}),eC={class:"text-right mt-4px"},tC=c.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};c.watch(()=>t.modelValue,()=>{o("trigger")},{deep:!0});const s=c.computed(()=>I.merge({},i,t.tableConfig)),o=e,n=c.computed({get:()=>t.modelValue??[],set:f=>{o("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=()=>{n.value=[...n.value,{}]},d=f=>{n.value=n.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":n.value},s.value,{columns:a.value.map(p=>c.unref(Mi)(p))}),c.createSlots({_:2},[u.value.length>0?{name:"bodyCell",fn:c.withCtx(({column:p,record:E,index:b})=>[c.createVNode(m,null,{default:c.withCtx(()=>[u.value.some(y=>p.key&&y.field===p.key)?(c.openBlock(),c.createBlock(c.unref(Ba),{key:b,"row-index":b,"default-handler":{},column:u.value.find(y=>p.key&&y.field===p.key),row:E,"table-data":n.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",eC,[c.createVNode(v,{type:"primary",onClick:l},{default:c.withCtx(()=>g[0]||(g[0]=[c.createTextVNode("+添加",-1)])),_:1,__:[0]})])])}}}),ae=r=>{const{icon:e}=r,t=dl;return t[e]?c.createVNode(t[e]):t[e]},$t={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())}},di={PercentInput:{controls:!1,min:0,max:100,addonAfter:"%"},autoComplete:{inputProps:{}}},Fa={$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},iC=r=>{const e=Fa[r];return{renderItemContent({props:t={},attrs:i={},events:s={},defaultValue:o},{data:n,field:a}){return ue(o)&&Z(a)&&et(n[a])&&(n[a]=o),a?c.createVNode(e,c.mergeProps({is:r,value:n[a],"onUpdate:value":l=>n[a]=l},i,I.merge({},$t[r],t),{onChange:(...l)=>{var d;(d=s.change)==null||d.call(s,{data:n,field:a},...l)}}),null):c.createVNode(e,c.mergeProps({is:r},t),null)},renderDefault({props:t=$t[r]??{},attrs:i={},events:s={},defaultValue:o},{data:n,row:a,field:l}){return ue(o)&&Z(l)&&et(a[l])&&(a[l]=o),l?c.createVNode(e,c.mergeProps({is:r,value:a[l],"onUpdate:value":d=>a[l]=d},i,I.merge({},$t[r],t),{onChange:(...d)=>{var u;(u=s.change)==null||u.call(s,{data:n,row:a,field:l},...d)}}),null):c.createVNode(e,c.mergeProps({is:r},t),null)},renderEdit(t,{props:i=$t[r]??{},attrs:s={},events:o={}},n,a){return c.createVNode(e,c.mergeProps({is:r,value:t.value,"onUpdate:value":l=>t.value=l},s,I.merge({},$t[r],i),{onBlur:(...l)=>{var d;a==null||a("blur",t.value),(d=o.blur)==null||d.call(o,n,...l)}}),null)}}},Ka=(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?c.createVNode(M.Dropdown,{getPopupContainer:t??(()=>document.querySelector(".p-wrapper"))},{default:()=>{var o;return c.createVNode(M.Button,c.mergeProps(I.omit(r,["dynamicClassName","content","getContent","icon","clickEvt","dropdowns","getProps"]),{icon:r.icon?c.createVNode(ae,{icon:r.icon},null):c.createVNode(ae,{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 c.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=>Ka(n,e,t))])}}):c.createVNode(M.Button,c.mergeProps({class:((i=r==null?void 0:r.dynamicClassName)==null?void 0:i.call(r,e))||""},I.omit(r,["dynamicClassName","content","getContent","icon","clickEvt","dropdowns","getProps"]),{disabled:!!r.dropdowns&&r.dropdowns.length>0||r.disabled,icon:r.icon?c.createVNode(ae,{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))??"")]}})},ar={...Object.fromEntries(Object.keys(Fa).map(r=>[r,iC(r)])),$button:{renderItemContent({props:r={},events:e={}},{data:t,field:i},s){return c.createVNode(M.Button,c.mergeProps(I.omit(r,["content"]),{icon:r.icon?c.createVNode(ae,{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&&I.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 c.createVNode(M.Button,c.mergeProps(I.omit(r,["content"]),{icon:r.icon?c.createVNode(ae,{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&&I.isFunction(r.beforeClick)?((n=s==null?void 0:s.setLoadings)==null||n.call(s,!0),r.beforeClick({row:t,field:i}).then(l=>{s.reset(l?{row:l,field:i}:{row:t,field:i})}).finally(()=>{var l;(l=s==null?void 0:s.setLoadings)==null||l.call(s,!1)})):s.reset({row:t,field:i})),r.htmlType==="pick"&&(s!=null&&s.pick)&&(r.beforeClick&&I.isFunction(r.beforeClick)?((a=s==null?void 0:s.setLoadings)==null||a.call(s,!0),r.beforeClick({row:t,field:i}).then(l=>{s.pick(l?{row:l,field:i}:{row:t,field:i})}).finally(()=>{var l;(l=s==null?void 0:s.setLoadings)==null||l.call(s,!1)})):s.pick({row:t,field:i}))}}),{default:()=>[r.content]})}},$buttons:{renderItemContent({props:r={},children:e=[]},{data:t,field:i},s){return c.createVNode("span",{class:"align-gap-box w-fit"},[e.map(o=>c.createVNode(M.Button,c.mergeProps(I.omit(Object.assign({},r,o.props),["content"]),{icon:o.props.icon?c.createVNode(ae,{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&&I.isFunction(r.beforeClick)?r.beforeClick({data:t,field:i}).then(l=>{s.reset(l?{data:l,field:i}:{data:t,field:i})}):s.reset({data:t,field:i})),o.props.htmlType==="pick"&&(s!=null&&s.pick)&&(r.beforeClick&&I.isFunction(r.beforeClick)?r.beforeClick({data:t,field:i}).then(l=>{s.pick(l?{data:l,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 c.createVNode("span",{class:"align-gap-box w-fit"},[e.filter(n=>{var a,l;return!((l=(a=n==null?void 0:n.props)==null?void 0:a.hiddenIf)!=null&&l.call(a,{data:t,row:i,field:s}))}).map(n=>c.createVNode(M.Button,c.mergeProps(I.omit(Object.assign({},r,n.props),["content","hiddenIf"]),{icon:n.props.icon?c.createVNode(ae,{icon:n.props.icon},null):null,onClick:()=>{var a,l,d,u;(l=(a=n.events)==null?void 0:a.click)==null||l.call(a,{data:t,row:i,field:s}),n.props.htmlType==="reset"&&(o!=null&&o.reset)&&(r.beforeClick&&I.isFunction(r.beforeClick)?((d=o==null?void 0:o.setLoadings)==null||d.call(o,!0),r.beforeClick({row:i,field:s}).then(f=>{o.reset(f?{row:f,field:s}:{row:i,field:s})}).finally(()=>{var f;(f=o==null?void 0:o.setLoadings)==null||f.call(o,!1)})):o.reset({row:i,field:s})),n.props.htmlType==="pick"&&(o!=null&&o.pick)&&(r.beforeClick&&I.isFunction(r.beforeClick)?((u=o==null?void 0:o.setLoadings)==null||u.call(o,!0),r.beforeClick({row:i,field:s}).then(f=>{o.pick(f?{row:f,field:s}:{row:i,field:s})}).finally(()=>{var f;(f=o==null?void 0:o.setLoadings)==null||f.call(o,!1)})):o.pick({row:i,field:s}))}}),{default:()=>[n.props.content]}))])}},ButtonTree:{renderDefault({children:r=[],props:e={}},t){const i=c.ref(null);return c.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=>Ka(s,t,()=>{var o,n,a,l;return((l=(a=(n=(o=i.value)==null?void 0:o.parentElement)==null?void 0:n.parentElement)==null?void 0:a.parentElement)==null?void 0:l.parentElement)||document.body}))??[]])}},$radio:{renderItemContent({props:r={},events:e={},options:t,defaultValue:i},{data:s,field:o}){return ue(i)&&Z(o)&&et(s[o])&&(s[o]=i),Z(o)?c.createVNode(M.RadioGroup,c.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 Z(i)?c.createVNode(M.RadioGroup,c.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 Z(i)?c.createVNode(M.AutoComplete,c.mergeProps({value:t[i],"onUpdate:value":s=>t[i]=s},Object.assign({},{filterOption:di.autoComplete.filterOption},r),{onChange:(...s)=>{var o;(o=e.change)==null||o.call(e,{data:t,field:i},...s)}}),{default:()=>c.createVNode(c.resolveComponent("a-input"),Object.assign({},di.autoComplete.inputProps,r.inputProps??{}),null)}):null}},$switch:{renderItemContent({props:r={},events:e={},defaultValue:t},{data:i,field:s}){return ue(t)&&Z(s)&&et(i[s])&&(i[s]=t),Z(s)?c.createVNode(M.Switch,c.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)&&Z(o)&&et(s[o])&&(s[o]=i),Z(o)?c.createVNode(M.CheckboxGroup,c.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 Z(i)?c.createVNode(M.CheckboxGroup,c.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}))??(Z(t)?e[t]:"");return Z(t)?c.createVNode(M.TypographyParagraph,c.mergeProps(I.merge({},i,I.omit(r,["content","getContent"])),{content:s}),null):null}},$tableInput:{renderItemContent({props:r={},handleTrigger:e},{data:t,field:i}){return Z(i)?c.createVNode(tC,{modelValue:t[i],"onUpdate:modelValue":s=>t[i]=s,onTrigger:()=>{e&&I.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(Z(s)){ue(t)&&et(i[s])&&(i[s]=t);const n=c.computed({get:()=>(i[s]??0)*o,set:a=>{i[s]=(a??0)/o}});return c.createVNode("div",{class:"flex items-center"},[r.info?c.createVNode("span",{class:"pr-4"},[r.info]):null,c.createVNode(c.resolveComponent("a-input-number"),c.mergeProps({class:"w-60px!"},e,{value:n.value,"onUpdate:value":a=>n.value=a},I.merge({},di.PercentInput,I.omit(r,["info"]))),null)])}else return null},renderDefault({props:r={},attrs:e={}},{row:t,field:i}){const s=r.parse?100:1;if(Z(i)){const o=c.computed({get:()=>(t[i]??0)*s,set:n=>{I.set(t,i,(n??0)/s)}});return[r.info?c.createVNode("span",{class:"pr-4"},[r.info]):null,c.createVNode(c.resolveComponent("a-input-number"),c.mergeProps({class:"w-60px!"},e,{value:o.value,"onUpdate:value":n=>o.value=n},I.merge({},di.PercentInput,I.omit(r,["info"]))),null)]}else return null}},TreeSelect:{renderItemContent({props:r={}},{data:e,field:t}){return Z(t)?c.createVNode(M.TreeSelect,c.mergeProps({value:e[t],"onUpdate:value":i=>e[t]=i},r),null):null},renderDefault({props:r={}},{row:e,field:t}){return Z(t)?c.createVNode(M.TreeSelect,c.mergeProps({value:e[t],"onUpdate:value":i=>e[t]=i},r),null):null}}},Or=(r,{renderItemContent:e,renderDefault:t,renderEdit:i})=>{ar.hasOwnProperty(r)&&console.warn(`render ${r} already exists, you are trying to override it`),ar[r]={renderItemContent:e,renderDefault:t,renderEdit:i}},At={renders:ar,addRender:Or},rC=c.defineComponent((r,{emit:e})=>{const{itemRender:t,defaultHandler:i}=r,{renderFormParams:s}=c.toRefs(r),o=a=>{e("trigger",a)},n=(a,l)=>{e("delayTrigger",a,l)};return()=>{var a,l;return((l=(a=At.renders[t.name])==null?void 0:a.renderItemContent)==null?void 0:l.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"]}),sC=c.defineComponent(r=>{const{formData:e}=c.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"]}),oC={key:2},nC=["innerHTML"],kr=c.defineComponent({__name:"PFormCol",props:{item:{},formData:{}},emits:["trigger","reset"],setup(r,{emit:e}){const t=r,i=e,s=c.ref(!1),o=c.ref(De()),n=(f,g)=>{const m=g??222;s.value=!0,setTimeout(()=>{s.value=!1,i("trigger",f)},m)},a=f=>{i("trigger",f)},l=()=>{i("reset")},d=()=>{o.value=De()},u=I.debounce(d,100);return Tr(()=>t.item,(f,g)=>{I.isEqual(f,g)||u()},{deep:!0}),(f,g)=>{const m=c.resolveComponent("a-tooltip"),x=c.resolveComponent("a-form-item"),v=c.resolveComponent("a-col");return c.openBlock(),c.createBlock(v,c.mergeProps({key:`_col_${o.value}`},f.item.col??(f.item.span?{span:f.item.span}:c.unref(Sr))),{default:c.withCtx(()=>{var p;return[(c.openBlock(),c.createBlock(x,c.mergeProps({key:`_item_${o.value}`,class:[`p-content-align-${f.item.align??"left"} ${f.item.forceRequired?"p-required":""}`,{"p-error-hang-out":s.value}],colon:"",label:f.item.title,name:f.item.field,"wrapper-col":f.item.wrapperCol??(f.item.title?void 0:{span:24})},c.unref(I.omit)(f.item,["field","title","span","col","wrapperCol","itemRender","forceRequired","tooltip"])),c.createSlots({default:c.withCtx(()=>{var E,b;return[(E=f.item.slots)!=null&&E.default?(c.openBlock(),c.createBlock(c.unref(sC),{key:`_sl_${f.item.field??"_"}_${o.value}`,"form-data":f.formData,item:f.item,"pass-delay-trigger":n,"pass-trigger":a},null,8,["form-data","item"])):(b=f.item.itemRender)!=null&&b.name?(c.openBlock(),c.createBlock(c.unref(rC),{key:`_re_${f.item.field??"_"}_${o.value}`,"default-handler":{reset:l},"item-render":f.item.itemRender,"render-form-params":{data:f.formData,field:f.item.field},onDelayTrigger:n,onTrigger:a},null,8,["default-handler","item-render","render-form-params"])):(c.openBlock(),c.createElementBlock("span",oC))]}),_:2},[(p=f.item.slots)!=null&&p.title?{name:"label",fn:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(f.item.slots.title)))]),key:"0"}:void 0,f.item.tooltipConfig?{name:"tooltip",fn:c.withCtx(()=>[c.unref(I.isFunction)(f.item.tooltipConfig.title)?(c.openBlock(),c.createBlock(m,c.normalizeProps(c.mergeProps({key:0},c.unref(I.omit)(f.item.tooltipConfig,["title"]))),{title:c.withCtx(()=>[c.createElementVNode("div",{innerHTML:f.item.tooltipConfig.title()},null,8,nC)]),default:c.withCtx(()=>[c.createVNode(c.unref(pt.InfoCircleOutlined),{class:"cursor-pointer py-4 px-2"})]),_:1},16)):(c.openBlock(),c.createBlock(m,c.normalizeProps(c.mergeProps({key:1},f.item.tooltipConfig)),{default:c.withCtx(()=>[c.createVNode(c.unref(pt.InfoCircleOutlined),{class:"cursor-pointer py-4 px-2"})]),_:1},16))]),key:"1"}:void 0]),1040,["class","label","name","wrapper-col"]))]}),_:1},16)}}}),aC={key:0,class:"p-pane p-wrapper"},Lr=c.defineComponent({__name:"PForm",props:{items:{},customReset:{},layout:{},labelCol:{default:()=>Co().labelCol??{span:6}},wrapperCol:{default:()=>Co().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}=c.toRefs(i);function a(){s("apply",n.value)}const l=c.ref(),d=c.ref(De()),u=()=>{d.value=De()},f=()=>{if(i.customReset)i.customReset();else{const v={};Mt(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=c.computed(()=>({...I.omit(i,["items","data","model","labelCol","wrapperCol"]),labelCol:i.labelCol,wrapperCol:i.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(o).some(E=>{var b;return E.field&&E.itemRender||((b=E.slots)==null?void 0:b.default)})?(c.openBlock(),c.createElementBlock("div",aC,[(c.openBlock(),c.createBlock(c.unref(M.Form),c.mergeProps({key:d.value,ref_key:"formEl",ref:l,model:c.unref(n)},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(o),(E,b)=>(c.openBlock(),c.createBlock(kr,{key:`_col_${E.field||b}`,"form-data":c.unref(n),item:E,onReset:f,onTrigger:x},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["model"]))])):c.createCommentVNode("",!0)}}),lC=c.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"]}),Pa=({title:r,content:e})=>new Promise((t,i)=>{M.Modal.confirm({title:r,content:e,onOk:()=>{t()},onCancel:()=>{i()}})}),cC=M.message.success,hC=M.message.error;M.message.info;const pi=M.message.warning,dC={key:0},uC={key:1,class:"p-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"},fC={class:"flex items-center flex-1 gap-4px"},gC={key:2},vC={class:"flex items-center gap-4px"},mC={key:0,class:"w-full text-slate-5 pl-4"},Dr=c.defineComponent({__name:"PGrid",props:{selectConfig:{},rowKey:{default:"id"},striped:{type:Boolean,default:()=>vt().striped??!1},manualFetch:{type:Boolean},align:{default:()=>vt().align??"left"},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},tableConfig:{},scrollMode:{default:"inner"},lazyReset:{type:Boolean,default:()=>vt().lazyReset??!1},fitHeight:{default:()=>vt().fitHeight??170},fitCanvasHeight:{},renderY:{}},emits:["toolbarButtonClick","toolbarToolClick","pick","resetQuery"],setup(r,{expose:e,emit:t}){var Be,de,me,Ot,K;const i=r,{formConfig:s,pageConfig:o,columns:n,toolbarConfig:a,proxyConfig:l,tableConfig:d,selectConfig:u,scrollMode:f}=c.toRefs(i),g=c.reactive({table:!1,toolbar:!1,form:!1}),m=k=>{I.isObject(k)?Object.keys(k).forEach(L=>{g[L]=k[L]}):I.isBoolean(k)&&(g.form=k,g.table=k,g.toolbar=k)},x=c.ref(),v=c.ref(),p=c.ref(500),E=c.ref([]),b=c.ref([]),y=k=>{const{ajax:L}=l.value;switch(k){case"multiDelete":L.multiDelete&&(E.value.length>0?Pa({title:"警告",content:"确认删除选中的数据吗?"}).then(()=>{g.table=!0,g.toolbar=!0,L.multiDelete(E.value).then(()=>{M.message.success("删除成功"),ht()}).catch(()=>{M.message.error("删除失败")}).finally(()=>{g.table=!1,g.toolbar=!1,_.multiDelete=!1})}):M.message.warn("请选择要删除的数据"));break}},C=c.computed(()=>{const k=[];return Mt(n.value??[],L=>{L.slots&&L.slots.title&&(L.field||(L.field="__holder__"+k.length),k.push(L))}),k}),T=c.ref(),N=c.ref(),B=c.ref(De()),R=c.ref(De()),_=c.reactive([...(((de=(Be=i.toolbarConfig)==null?void 0:Be.buttons)==null?void 0:de.map(k=>k.code))??[]).filter(k=>k),...(((Ot=(me=i.toolbarConfig)==null?void 0:me.tools)==null?void 0:Ot.map(k=>k.code))??[]).filter(k=>k)].reduce((k,L)=>(k[L]=!1,k),{})),S=(k,L)=>{_[k]=L},O=()=>{R.value=De()},w=I.debounce(O,100),A=c.computed(()=>{const k=[];return Mt(n.value??[],L=>{(L.slots&&L.slots.default||L.formatter||L.cellRender)&&(L.field||(L.field="__holder__"+k.length),k.push(L))}),k}),$=c.reactive({page:1,size:((K=o.value)==null?void 0:K.pageSize)??10}),Y=c.ref(0),V=c.ref(0),P=c.ref([]),W=c.computed(()=>l.value&&l.value.ajax?o.value?"pagination":"list":"bad"),G=c.useAttrs(),q=t,He=c.computed(()=>b.value.filter(k=>E.value.includes(k[i.rowKey??"id"]))),lt=k=>{q("toolbarButtonClick",{data:P.value,code:k,selectedKeys:E.value,records:He.value}),y(k)},he=I.debounce(lt,100),Ge=({key:k})=>he(k),J=k=>{q("toolbarToolClick",{data:P.value,code:k,selectedKeys:E.value,records:He.value}),y(k)},Bi=I.debounce(J,100),ve=c.ref({}),Fi=({row:k,field:L})=>{q("pick",{row:k,field:L})},Ue=k=>{if(s.value&&s.value.items.length>0){if(s.value.customReset)s.value.customReset();else{const L={};Mt(s.value.items,z=>{z.field&&z.itemRender?ue(z.itemRender.defaultValue)?L[z.field]=z.itemRender.defaultValue:L[z.field]=void 0:z.field&&z.slots&&(ue(z.slots.defaultValue)?L[z.field]=z.slots.defaultValue:L[z.field]=void 0)}),ve.value=L}q("resetQuery")}$.page=1,k||dt()},ct=(k,L)=>L?{list:I.isString(L.list)?I.get(k,L.list):I.isFunction(L.list)?L.list(k):void 0,total:I.isString(L.total)?I.get(k,L.total):I.isFunction(L.total)?L.total(k):void 0,result:I.isString(L.result)?I.get(k,L.result):I.isFunction(L.result)?L.result(k):void 0,message:I.isString(L.message)?I.get(k,L.message):I.isFunction(L.message)?L.message(k):void 0}:{list:k},Zt=c.ref(!0),Ki=()=>(b.value=[],E.value=[],Ue()),ht=()=>($.page=1,b.value=[],E.value=[],qe()),Pi=(k,L,z)=>($.page=k.current,$.size=k.pageSize,qe()),qe=()=>new Promise(k=>{if(W.value!=="bad"){g.form=!0,g.table=!0;const{ajax:L}=l.value;L.query({form:ve.value,page:$}).then(z=>{const{list:xe,total:Je,result:j,message:Ce}=ct(z,l.value.response);xe?(P.value=xe,Y.value++):j?(P.value=j,V.value=Je??j.length,Y.value++):(P.value=[],Y.value++,Ce&&M.message.warn(Ce)),k(P.value)}).catch(z=>{console.error("fetchData error",z),k([])}).finally(()=>{g.form=!1,g.table=!1})}}),dt=I.debounce(qe,160),Ze=(k,L)=>(Object.assign(ve.value,k),$.page=1,L?Promise.resolve():dt()),Tt=(k,L)=>(ve.value=k,$.page=1,L?Promise.resolve():dt()),Jt=c.computed(()=>W.value==="pagination"?{current:$.page,total:V.value,pageSize:$.size,responsive:!1,showSizeChanger:!0,showTotal:k=>`共${k}条数据`}:!1),Qt={size:"small",sticky:!0,transformCellText:({text:k})=>I.isArray(k)&&k.length===0?"-":k},jt=c.computed(()=>I.merge({},Qt,(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 L=i.rowKey??"id",z=b.value.map(j=>j[L]),Je=k.filter(j=>!z.includes(j)).map(j=>P.value.find(Ce=>Ce[L]===j)).filter(j=>!!j);b.value=[...b.value,...Je]},getCheckboxProps:u.value.getCheckboxProps}}:{})),ei=c.computed(()=>I.omit({labelCol:Ir,...s.value},["items"])),ti=()=>{ht()};c.watch(()=>[n.value,l.value,a.value],()=>{w()},{deep:!0});const D=()=>{var j,Ce;const k=(j=x.value)==null?void 0:j.parentElement,L=k?window.getComputedStyle(k).height:"0px",z=v.value?window.getComputedStyle(v.value).height:"0px",xe=z.includes("px")?I.toNumber(z.replace("px","")):0,Je=(Ce=u.value)!=null&&Ce.showCount?22:0;p.value=i.renderY??I.toNumber(L.replace("px",""))-i.fitHeight-(i.toolbarConfig?30:0)-xe-Je,Zt.value=I.toNumber(L.replace("px",""))>600};e({commitProxy:{query:dt,reload:Ki,reloadPage:ht,passQuery:Ze,forcePassQuery:Tt},$table:c.computed(()=>N.value),selectedRowKeys:c.computed(()=>E.value),setBtnLoading:S,selectedRecords:He,$form:c.computed(()=>T.value),getFormData:()=>ve.value,setLoadings:m,resizeTable:D});let F;c.onMounted(()=>{D(),window.addEventListener("resize",D),F=new MutationObserver(k=>{k.forEach(L=>{if(L.type==="attributes"&&L.attributeName==="style"){const z=L.target;window.getComputedStyle(z).display!=="none"&&D()}})}),x.value&&F.observe(x.value,{attributes:!0,attributeFilter:["style"]}),Ue(i.manualFetch)});const U=["align"],Le=k=>k.map(L=>({...U.reduce((z,xe)=>({[xe]:i[xe]}),{}),...L}));return c.onBeforeUnmount(()=>{window.removeEventListener("resize",D),F.disconnect()}),(k,L)=>{var j,Ce,Xr;const z=c.resolveComponent("a-menu-item"),xe=c.resolveComponent("a-menu"),Je=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(G)),[W.value==="bad"?(c.openBlock(),c.createElementBlock("div",dC,"请检查配置")):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[(Ce=(j=c.unref(s))==null?void 0:j.items)!=null&&Ce.some(H=>H.field&&H.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(()=>[(c.openBlock(),c.createBlock(c.unref(M.Form),c.mergeProps({key:B.value,ref_key:"formEl",ref:T,model:ve.value},ei.value,{onSubmit:ti}),{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,(H,oe)=>(c.openBlock(),c.createBlock(kr,{key:`_col_${H.field||oe}`,"form-data":ve.value,item:H,onReset:L[0]||(L[0]=Qe=>Ue(i.lazyReset))},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["model"]))]),_:1},8,["spinning"])],512)):c.createCommentVNode("",!0),c.unref(a)?(c.openBlock(),c.createElementBlock("div",uC,[c.createElementVNode("div",fC,[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,(H,oe)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:oe},[H.dropdowns&&H.dropdowns.length?(c.openBlock(),c.createBlock(Je,{key:0},{overlay:c.withCtx(()=>[c.createVNode(xe,{onClick:Ge},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(H.dropdowns,Qe=>(c.openBlock(),c.createBlock(z,{key:Qe.code},{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(Qe.content),1)]),_:2},1024))),128))]),_:2},1024)]),default:c.withCtx(()=>[c.createVNode(c.unref(M.Button),{type:H.type,size:H.size??"middle",disabled:c.unref(a).disabled||H.disabled,loading:g.toolbar||!!H.code&&_[H.code],danger:H.danger,shape:H.shape,ghost:H.ghost,block:H.block},{default:c.withCtx(()=>[H.icon?(c.openBlock(),c.createBlock(c.unref(ae),{key:0,icon:H.icon},null,8,["icon"])):c.createCommentVNode("",!0),c.createTextVNode(" "+c.toDisplayString(H.content)+" ",1),c.createVNode(c.unref(pt.DownOutlined))]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block"])]),_:2},1024)):H.code?(c.openBlock(),c.createBlock(c.unref(M.Button),{key:1,type:H.type,size:H.size??"middle",disabled:c.unref(a).disabled||H.disabled,loading:g.toolbar||!!H.code&&_[H.code],danger:H.danger,shape:H.shape,ghost:H.ghost,block:H.block,onClick:Qe=>c.unref(he)(H.code)},{default:c.withCtx(()=>[H.icon?(c.openBlock(),c.createBlock(c.unref(ae),{key:0,icon:H.icon},null,8,["icon"])):c.createCommentVNode("",!0),c.createTextVNode(" "+c.toDisplayString(H.content),1)]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block","onClick"])):(c.openBlock(),c.createElementBlock("div",gC))],64))),128)):c.createCommentVNode("",!0)]),c.createElementVNode("span",vC,[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,(H,oe)=>(c.openBlock(),c.createBlock(c.unref(M.Button),{key:oe,type:H.type,size:H.size??"middle",disabled:c.unref(a).disabled||H.disabled,danger:H.danger,shape:H.shape,ghost:H.ghost,block:H.block,onClick:Qe=>c.unref(Bi)(H.code),loading:g.toolbar||!!H.code&&_[H.code]},{default:c.withCtx(()=>[H.icon?(c.openBlock(),c.createBlock(c.unref(ae),{key:0,icon:H.icon},null,8,["icon"])):c.createCommentVNode("",!0),c.createTextVNode(" "+c.toDisplayString(H.content),1)]),_:2},1032,["type","size","disabled","danger","shape","ghost","block","onClick","loading"]))),128)):c.createCommentVNode("",!0)])])):c.createCommentVNode("",!0),c.createElementVNode("div",{class:c.normalizeClass(`p-pane flex-1 ${Zt.value?"h-0":""} p-${c.unref(f)??"inner"}-scroll`)},[(Xr=c.unref(u))!=null&&Xr.multiple&&c.unref(u).showCount?(c.openBlock(),c.createElementBlock("div",mC," 已选:"+c.toDisplayString(E.value.length),1)):c.createCommentVNode("",!0),(c.openBlock(),c.createBlock(c.unref(M.Table),c.mergeProps({key:R.value+"_table","row-key":k.rowKey??"id",ref_key:"tableEl",ref:N,"row-class-name":k.striped?(H,oe)=>oe%2===1?"p-grid-row-striped":"":"",columns:Le(c.unref(n)??[]).map(H=>c.unref(Mi)(H)),"data-source":P.value,loading:g.table,pagination:Jt.value},jt.value,{scroll:{x:"max-content",y:p.value},onChange:Pi}),c.createSlots({_:2},[C.value.length>0?{name:"headerCell",fn:c.withCtx(({column:H})=>[C.value.some(oe=>H.key&&oe.field===H.key)?(c.openBlock(),c.createBlock(c.unref(lC),{key:R.value+"_title_"+Y.value+"_slot_"+H.key,column:C.value.find(oe=>H.key&&oe.field===H.key)},null,8,["column"])):c.createCommentVNode("",!0)]),key:"0"}:void 0,A.value.length>0?{name:"bodyCell",fn:c.withCtx(({column:H,record:oe,index:Qe})=>[A.value.some(Yi=>H.key&&Yi.field===H.key)?(c.openBlock(),c.createBlock(c.unref(Ba),{key:R.value+"_cell_"+Y.value+"_slot_"+H.key,column:A.value.find(Yi=>H.key&&Yi.field===H.key),"default-handler":{pick:Fi,setLoadings:m},row:oe,"row-index":Qe,"table-data":P.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 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-stripe-color: #fafafa;--evt-placeholder-color: #cdd0dc;--evt-header-bg-color: #f8faff;--evt-body-bg-color: #fff;--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;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}")),document.head.appendChild(r)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var xC=Object.defineProperty,pC=(r,e,t)=>e in r?xC(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,h=(r,e,t)=>pC(r,typeof e!="symbol"?e+"":e,t);class wC{constructor(e){h(this,"rules"),this.rules=e}validate(e){const t=[],{column:i,row:s,key:o,rowKey:n,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:i,colIndex:a,rowIndex:l,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:l,field:u,fieldValue:f,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:l,field:u,fieldValue:f,message:g.message||`${o} is required`})}return t}}function Ya(){return"xxxxxxxxxxxxxxxxxx".replace(/[x]/g,function(r){const e=Math.random()*16|0;return(r==="x"?e:e&3|8).toString(16)})}function $r(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 fi(r=[]){return r.length?r.map(e=>fi(e.children)+1).sort((e,t)=>t-e)[0]:0}function yC(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 gi(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(l=>{l.fixed=n});const a=gi(s.children,e-1,t+1,s.key);return a&&a.forEach(l=>{o+=l.colspan??0}),{...s,width:s.width,level:t,rowspan:1,colspan:o,parentKey:i,children:a.sort((l,d)=>(l.sort??0)-(d.sort??0))}}return{...s,level:t,rowspan:e,colspan:1,parentKey:i}})}function Nt(r=[]){let e=[];return r.forEach(t=>{t.children?e=e.concat(Nt(t.children)):e.push(t)}),e}function Va(r){return r.filter(e=>!e.hide).map(e=>Array.isArray(e.children)&&e.children.length>0?{...e,children:Va(e.children)}:{...e})}const _o=/^(\r\n|\n\r|\r|\n)/,EC=/^[^\t\r\n]+/,Ro=/^\t/;function CC(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(Ro))r=r.replace(Ro,""),t+=1,e[i][t]="";else if(r.match(_o))r=r.replace(_o,""),t=0,i+=1,e[i]=[""];else{let o="";if(r.startsWith('"')){let n=0,a=!0;for(;a;){const l=r.slice(0,1);l==='"'&&(n+=1),o+=l,r=r.slice(1),(r.length===0||r.match(/^[\t\r\n]/)&&n%2===0)&&(a=!1)}o=o.replace(/^"/,"").replace(/"$/,"").replace(/["]*/g,l=>new Array(Math.floor(l.length/2)).fill('"').join(""))}else{const n=r.match(EC);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 bC(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
2
  `)>-1?o+=`"${n.replace(/"/g,'""')}"`:o+=n:n==null?o+="":o+=n;e!==t-1&&(o+=`
3
3
  `)}return o}function Wa(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,u)=>`${d}${o[u]??""}`,"")||o[e],l=t.reduce((d,u)=>`${d}${r[n-1][u]??""}`,"")||r[n-1][e];a===l?(s[i]+=1,s.push(0)):(s.push(1),i=n)}}),s}function Xa(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 _C(r,e,t=[]){const{visibleRows:i,rowIndex:s,headIndex:o}=r,n=Wa(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 RC(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=Xa(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 SC(r,e=document.documentElement){const t=r.startsWith("--")?r:`--${r}`;return getComputedStyle(e).getPropertyValue(t).trim()}function So(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,l,d,u=0,f=0,g=0]=n;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]=n;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]=n;return new Date(d,a-1,l,u,f,g)}else if(s.source.includes("YYYYMMDD")){const[a,l,d]=n;return new Date(a,l-1,d)}}}return new Date(NaN)}function IC(r,e){const t=So(r),i=So(e);return isNaN(t.getTime())&&isNaN(i.getTime())?0:isNaN(t.getTime())?-1:isNaN(i.getTime())?1:t.getTime()-i.getTime()}class za{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 Mr extends za{constructor(e,t,i,s,o,n,a,l,d,u="body"){super(e,s,o,n,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=i,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",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: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(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=l,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: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(o=f*g,u){const T=this.ctx.icons.get("loading");n="loading",s=T}else if(d){const T=this.ctx.icons.get("expand"),N=this.ctx.icons.get("shrink");s=l?N:T,n=l?"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 b=E+o+e,y=this.drawY+(this.visibleHeight-p)/2,C=o+this.drawX+v-.5;this.type==="selection-tree"?(b=o+this.drawSelectionImageX+this.drawSelectionImageWidth,C=b+v-e/2):this.type==="tree-selection"?C=b+m+v-e/2:C=b+v-e/2,this.drawTextX=C,this.drawTextWidth=this.drawX+this.visibleWidth-C,!(b+v+e>this.drawX+this.visibleWidth)&&(y+p+e>this.drawY+this.visibleHeight||(this.drawTreeImageX=b,this.drawTreeImageY=y,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,l=this.drawTreeImageY+this.drawTreeImageHeight/2;let d=this.drawTreeImageX-n*t;const u=Array.isArray(o.parentRowKeys)?o.parentRowKeys:[];if(n>0){for(let x=0;x<n-1;x+=1){const v=u[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 f=Math.round(this.drawTreeImageX-t+i/2),g=o.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+(n-1)*t+i/2);this.ctx.paint.drawLine([m,l,a,l],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}if(o.hasChildren&&o.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:i,FOOTER_CELL_STYLE_METHOD:s,READONLY_TEXT_COLOR:o,BODY_TEXT_COLOR:n,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}=this.ctx.config;if(this.cellType==="footer"){let N=l,B=a;if(typeof s=="function"){const R=s,{backgroundColor:_,color:S,font:O}=R({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()})||{};_&&(N=_),S&&(B=S),O&&(this.drawTextFont=O)}this.drawCellSkyBgColor="transparent",this.drawCellBgColor=N,this.drawTextColor=B;return}let v="transparent";const p=this.ctx.hoverCell,E=this.ctx.currentCell;let b=this.rowIndex,y=this.rowIndex;if(this.rowspan!==1&&(f||d)){const N=this.getSpanInfo(),{yArr:B}=N;b=B[0],y=B[1]}f&&p&&(p.rowKey===this.rowKey&&(v=g),p.rowIndex>=b&&p.rowIndex<=y&&(v=g)),d&&E&&(E.rowKey===this.rowKey&&(v=u),E.rowIndex>=b&&E.rowIndex<=y&&(v=u)),this.drawCellSkyBgColor=v;let C=e,T=n;if(this.ctx.database.getReadonly(this.rowKey,this.key)||(C=t,T=o),m&&(this.rowIndex%2?C=x:C=e),typeof i=="function"){const N=i,{backgroundColor:B,color:R,font:_}=N({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,isHasChanged:this.isHasChanged,value:this.getValue()})||{};B&&(C=B),R&&(T=R),_&&(this.drawTextFont=_)}this.drawCellBgColor=C,this.drawTextColor=T}updateSelection(){const{visibleWidth:e,visibleHeight:t,rowspan:i,colspan:s,cellType:o,type:n,rowIndex:a,rowKey:l}=this;if(i===0||s===0||o==="footer"||!["index-selection","selection","selection-tree","tree-selection"].includes(n))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(n!=="selection-tree"&&n==="tree-selection"){const{TREE_INDENT:E=16,TREE_ICON_SIZE:b}=this.ctx.config,y=this.ctx.database.getRowForRowKey(l),{level:C=0}=y||{},T=C*E;m=g+b+T}let v=this.ctx.icons.get("checkbox-uncheck"),p="checkbox-uncheck";if(n==="selection-tree"||n==="tree-selection"){const E=this.ctx.database.getTreeSelectionState(l);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(l);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+u+f>this.drawX+this.visibleWidth||x+u+f>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=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: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:u}=d,f=u[0],g=u[1];if(o.rowIndex>=f&&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 l=this.ctx.icons.get(this.hoverIconName);this.drawHoverImageX=n,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 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}px`,t=`${this.drawY-this.ctx.body.y}px`;return this.fixed==="left"?e=`${this.drawX}px`:this.fixed==="right"&&(e=`${this.drawX-(this.ctx.stageWidth-this.ctx.fixedRightWidth)}px`),this.cellType==="footer"&&this.ctx.config.FOOTER_FIXED&&(t=`${this.drawY-this.ctx.footer.y}px`),this.autoRowHeight&&this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex)===0&&(e="-99999px",t="-99999px"),{position:"absolute",overflow:"hidden",left:e,top:t,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],l=n[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 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 l=`${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: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: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,[l,d]=i;!(n===a&&l===d)&&this.colIndex>=n&&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: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 l=t,d=i;const{xArr:u,yArr:f,lineDash:g=[],borderWidth:m=1,borderColor:x,fillColor:v}=e,p=u[0],E=u[1],b=f[0],y=f[1];if(o>=p&&o<=E&&s===b){const C=o===E?1:0,T=o===p?1:0;this.ctx.paint.drawLine([l+T,d+1,l+a-C,d+1],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}if(o===E&&s>=b&&s<=y){const C=s===b?1:0,T=s===y?1:0;this.ctx.paint.drawLine([l+a-1,d+C,l+a-1,d+n-T],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}if(o>=p&&o<=E&&s===y){const C=o===E?1:0,T=o===p?1:0;this.ctx.paint.drawLine([l+T,d+n-1,l+a-C,d+n-1],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}if(o===p&&s>=b&&s<=y){const C=s===y?1:0,T=s===b?1:0;this.ctx.paint.drawLine([l+1,d+T,l+1,d+n-C],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}}}class TC{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,"maxRowHeightMap",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.maxRowHeightMap.clear();const t=this.getColumns(),i=Nt(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: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[o],v=x!=null?`${x}`:Ya();this.itemRowKeyMap.set(f,v);const p=f._height||a,E=f._readonly;let b=!0;if(typeof l=="function"&&(b=l),d){const C=f[d];if(this.checkboxKeyMap.has(C)){const T=this.checkboxKeyMap.get(C)||[];T.push(v),this.checkboxKeyMap.set(C,T)}else this.checkboxKeyMap.set(C,[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 y=n||this.expandMap.get(v)||f._expand||!1;this.expandMap.set(v,y),this.rowKeyMap.set(v,{readonly:E,index:g,rowIndex:g,level:t,height:p,calculatedHeight:-1,check:!1,selectable:b,expand:y,expandLazy:!1,hasChildren:f._hasChildren||(Array.isArray(f.children)?f.children.length>0:!1),expandLoading:!1,item:f,parentRowKeys:i,parentRowKey:i[i.length-1]||"",isLastChild:g===s-1}),Array.isArray(f.children)&&f.children.length&&this.initData(f.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){e.every(({height:t,rowIndex:i})=>this.getPositionForRowIndex(i).calculatedHeight===t)||(e.forEach(({rowIndex:t,height:i})=>{const s=this.rowIndexRowKeyMap.get(t);if(s){const o=this.rowKeyMap.get(s);if(o.calculatedHeight=i,this.ctx.config.REMEMBER_MAX_ROW_HEIGHT){const n=this.maxRowHeightMap.get(s)||o.height;i>n&&this.maxRowHeightMap.set(s,i)}}}),this.clearBufferData(),this.getData(),this.ctx.emit("draw"))}clearMaxRowHeight(){this.maxRowHeightMap.clear(),this.clearBufferData(),this.getData(),this.ctx.emit("draw")}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,l,d,u,f,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:(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[p,E]of Object.entries(x))E!==void 0&&(v[p]=E);return{...s,children:m,hide: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:l,hasChildren:d,height:u,calculatedHeight:f}=this.rowKeyMap.get(a),g=this.sumHeight;let m=Math.max(f,u);if(this.ctx.config.REMEMBER_MAX_ROW_HEIGHT){const x=this.maxRowHeightMap.get(a)||u;m>x?(this.maxRowHeightMap.set(a,m),m=m):m=x}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&&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],l=n[t];let d=0;if(typeof s=="function")d=s(o,n);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=IC(a,l));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 l=[],d=e.map(x=>{const{rowKey:v,key:p}=x;let E=x.value,b=E;const y=this.getRowDataItemForRowKey(v),C=this.getItemValue(v,p),T=this.getVirtualBodyCellByKey(v,p);return(T==null?void 0:T.type)==="number"&&(["",void 0,null].includes(E)?b=null:/^-?\d+(\.\d+)?$/.test(`${E}`)?b=Number(E):(b=C,l.push({...x,value:b,oldValue:C,row:y}))),{...x,value:b,oldValue:C,row:y}});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),n=!1),d.forEach(x=>{const{value:v,rowKey:p,key:E}=x,b=this.getItemValue(p,E);a.add(p),this.setItemValue(p,E,v,!1,!1,!1,n),o.push({rowKey:p,key:E,oldValue:b,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: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:l}=this.rowKeyMap.get(e);let d=l[t],u=i;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(n){const x=this.getVirtualBodyCellByKey(e,t);if((x==null?void 0:x.type)==="number")if(["",void 0,null].includes(i))u=null;else if(/^-?\d+(\.\d+)?$/.test(`${i}`))u=Number(i);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}),o&&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: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(l=>this.selectionMap.get(l)),s=i.filter(l=>l==null?void 0:l.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=f=>{const g=this.getTreeChildren(f);let m=[];for(const x of g)m.push(x),m.push(...n(x));return m},a=n(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,o=i||u,i&&d>0&&l===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)),l=a.filter(g=>g==null?void 0:g.check).length,d=a.length,u=l>0,f=l===d;s=u&&!f,o=i||f,i&&d>0&&l===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 l=t(o.children,s);if(l)return l}}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 l=n>i&&s===0&&a,d=o&&o>s&&s>0||l,u=o!==0,f=!!o&&o===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 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:l}=this.ctx.config;if(typeof l=="function"&&o){const d=l({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 l=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&&(l=d)}if(l){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)},u=new wC(l).validate(d);this.setValidationError(e,t,u),i(u)}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: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:i,row:o,value:n}]};let p=t,E=t,b=a,y=a,C=[],T=0,N=0,B=0,R=0;if(u!==1&&x){R=g;const _=l.reduce((S,O)=>{const w=this.getItemValue(s,O)??"";return`${S}${w}`},"");for(let S=t-1;S>=0;S--){const O=this.rowIndexRowKeyMap.get(S)||"",w=l.reduce((A,$)=>{const Y=this.getItemValue(O,$)??"";return`${A}${Y}`},"");if(_===w)p=S;else break}for(let S=t;S<=this.ctx.maxRowIndex;S++){const O=this.rowIndexRowKeyMap.get(S)||"",w=l.reduce((A,$)=>{const Y=this.getItemValue(O,$)??"";return`${A}${Y}`},"");if(_===w)E=S;else break}for(let S=p;S<t;S++){const{height:O}=this.positions[S];T+=O}for(let S=p;S<=E;S++){const{height:O}=this.positions[S];B+=O;const w=this.rowIndexRowKeyMap.get(S)||"",{item:A}=this.rowKeyMap.get(w),$=this.getItemValue(w,i);C.push({rowKey:w,key:i,value:$,row:A})}}if(m!==1&&v){B=f;for(let _=a-1;_>=0;_--){const S=this.getColumnByColIndex(_);if(!S)break;const O=this.getItemValue(s,i),w=this.getItemValue(s,S.key);if(O===w&&d.includes(S.key))b=_;else break}for(let _=a;_<=this.ctx.maxColIndex;_++){const S=this.getColumnByColIndex(_);if(!S)break;const O=this.getItemValue(s,i),w=this.getItemValue(s,S.key);if(O===w&&d.includes(S.key))y=_;else break}for(let _=b;_<a;_++){const S=this.getColumnByColIndex(_);if(!S)break;N+=S.width||100}for(let _=b;_<=y;_++){const S=this.getColumnByColIndex(_);if(!S)break;R+=S.width||100,C.push({rowKey:s,key:S.key,value:this.getItemValue(s,S.key),row:o})}}return{xArr:[b,y],yArr:[p,E],rowspan:u,colspan:m,height:B,width:R,offsetTop:T,offsetLeft:N,dataList:C}}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 l=this.getItemValue(e,t),d=[{key:t,rowKey:e,rowIndex:n,colIndex:a.colIndex,column:a.column,row:o,value:l,message:i,field:t,fieldValue:l}];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){const i=this.getColumnByColIndex(t),s=this.getRowForRowIndex(e);return!i||!s?void 0:new Mr(this.ctx,e,t,0,0,0,0,i,s.item,"body")}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=(l,d)=>{var u,f;const g=(u=this.customHeader[l])==null?void 0:u[n.key];g!==void 0&&g!==d&&(o[l]||(o[l]={}),o[l][n.key]=g,l==="fixedData"&&!g&&!d&&((f=o[l])==null||delete f[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}clearChangeData(){this.changedDataMap.clear()}}class OC{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 kC{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 LC{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 DC{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:l,colorStart:d,colorEnd:u}=o;this.ctx.save(),n&&(this.ctx.fillStyle=n,this.ctx.fillRect(e,t,i,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+i,t,e+i+l,t),f.addColorStop(0,d),f.addColorStop(1,u),this.ctx.fillStyle=f,this.ctx.fillRect(e+i,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,i,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,i,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: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:l=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),l===0)this.ctx.rect(e-.5,t-.5,i,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+i,t,e+i,t+u,u),this.ctx.arcTo(e+i,t+s,e+i-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(),n!==void 0&&this.ctx.stroke(),this.ctx.restore()}drawText(e="",t,i,s,o,n={}){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}=n;if(this.ctx.font=l,this.ctx.fillStyle=u,this.ctx.textAlign=d,["",null,void 0].includes(e))return this.ctx.restore(),!1;const E=parseInt(((a=l.match(/\d+/))==null?void 0:a[0])||"12")*(n.lineHeight||1.2),b=s-f*2-v-p;let y=!1;const C=Math.round((o-2*f)/E);let T=this.wrapText(e,b,n.cacheTextKey),N=Math.min(T.length,Math.max(C,1));m==="auto"&&x?N=T.length:typeof m=="number"&&m<N&&m!==1?N=m:(m===1&&(T=[e],N=1),m==="auto"&&C===1&&(T=[e],N=1));let B=i+f;const R=Math.round(N*E);g==="middle"?B=i+(o-R)/2:g==="bottom"&&(B=i+o-R-f);let _=t+f+v;d==="center"?_=t+s/2:d==="right"&&(_=t+s-f-p);for(let S=0;S<T.length;S++){const O=T[S],w=B+S*E;if(this.ctx.textBaseline="top",S===N-1){const A=T.slice(S).join(""),{_text:$,ellipsis:Y}=this.handleEllipsis(A,s,f,l);this.ctx.fillText($,_,w),y=Y;break}this.ctx.fillText(O,_,w)}if(n.textCallback&&T.length){const S=T.reduce((Y,V)=>Math.max(Y,this.ctx.measureText(V).width),0),O=Math.round(S);let w=_,A=_+O;d==="center"?(w=_-O/2,A=_+O/2):d==="right"&&(w=_-O,A=_);const $={x:_,y:B,width:O,height:R,left:w,right:A,top:B,bottom:B+R};n.textCallback($)}return this.ctx.restore(),y}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 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 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:l="#495060",maxLineClamp:d=1,cacheTextKey:u=""}=i;this.ctx.save(),this.ctx.font=o,this.ctx.fillStyle=l,this.ctx.textAlign=a;const f=parseInt(((s=o.match(/\d+/))==null?void 0:s[0])||"12"),g=f*(i.lineHeight||1.2),m=t-n*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+n*2),Math.floor(f+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 l=this.ctx.measureText(e).width,d=t-i*2;if(l&&l>=d){o=!0;let u=0;for(let f=0;f<e.length;f++)if(u+=this.ctx.measureText(e[f]).width,u>=d-a){n=e.slice(0,f)+"...",o=!0;break}}return this.ctx.restore(),{_text:n,ellipsis:o}}}class Io{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,"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,"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,"REMEMBER_MAX_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=SC(i);s&&(e[t]=s)}}),Object.assign(this,e,this._config)}}const Ga='<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>',To='<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>',Oo='<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>',Ar='<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>',$C=Ar.replace('fill="currentColor" p-id="2016"','fill="#bec4c7" p-id="2016"'),MC=Ar.replace('fill="currentColor" p-id="2015"','fill="#bec4c7" p-id="2015"');class AC{constructor(e){h(this,"ctx"),h(this,"list",[{name:"loading",configName:"LOADING_ICON_SVG",configColorName:"LOADING_ICON_COLOR",svg:'<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>',color:"#4E5969"},{name:"expand",configName:"EXPAND_ICON_SVG",configColorName:"EXPAND_ICON_COLOR",svg:Ga,color:"#4E5969"},{name:"shrink",configName:"SHRINK_ICON_SVG",configColorName:"SHRINK_ICON_COLOR",svg:Oo,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:To,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:To,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:Oo,color:"#4E5969"},{name:"sort-asc",configName:"SORT_ASC_ICON_SVG",configColorName:"SORT_ICON_COLOR",svg:$C,color:"rgb(82,146,247)"},{name:"sort-desc",configName:"SORT_DESC_ICON_SVG",configColorName:"SORT_ICON_COLOR",svg:MC,color:"rgb(82,146,247)"},{name:"sort-default",configName:"SORTABLE_ICON_SVG",svg:Ar,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 l=a.getAttribute("fill");(l==="currentColor"||l===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,l)=>{o.onerror=()=>l(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 lr extends za{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=Ya(),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 n=e,{backgroundColor:a,color:l,font:d}=n({colIndex:this.colIndex,column:this.column})||{};a&&(s=a),l&&(o=l),d&&(this.drawTextFont=d)}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 l=this.ctx.icons.get("checkbox-uncheck"),d="checkbox-uncheck";e?(l=this.ctx.icons.get("checkbox-indeterminate"),d="checkbox-indeterminate"):t&&i?(l=this.ctx.icons.get("checkbox-check"),d="checkbox-check"):t&&!i?(l=this.ctx.icons.get("checkbox-check-disabled"),d="checkbox-check-disabled"):!t&&i?(l=this.ctx.icons.get("checkbox-uncheck"),d="checkbox-uncheck"):(l=this.ctx.icons.get("checkbox-disabled"),d="checkbox-disabled"),l&&(this.drawSelectionImageX=n,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 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 NC{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(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.focusCell=void 0,this.ctx.emit("cellHeaderMousedown",n,e)}),this.handleBodyEvent(o,s,this.ctx.body.renderRows,n=>{this.ctx.setFocusCell(n),this.ctx.focusCellHeader=void 0,this.ctx.emit("cellMousedown",n,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 lr)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: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: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 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:i,offsetX:s}=this.ctx.getOffset(t),o=i,n=s;if(e instanceof lr){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 Mr){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 l of a){const d=l.getDrawX(),u=l.getDrawY();if(o){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,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 l of a){const d=l.getDrawX(),u=l.getDrawY();if(o){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 HC{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,"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,"database"),h(this,"history"),h(this,"config");const{containerElement:i,stageElement:s,canvasElement:o,overlayerElement:n,editorElement:a,emptyElement:l,loadingElement:d,contextMenuElement:u}=e;this.containerElement=i,s.tabIndex=0,this.stageElement=s,this.canvasElement=o,this.overlayerElement=n,this.editorElement=a,this.emptyElement=l,this.loadingElement=d,this.contextMenuElement=u,this.config=new Io(t.config||{}),this.eventBus=new LC,this.eventBrowser=new kC(this),this.eventTable=new NC(this),this.paint=new DC(this.canvasElement),this.database=new TC(this,t),this.history=new OC(this),this.icons=new AC(this)}setConfig(e){this.config=new Io(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:l}=a.getSpanInfo(),d=l.map(u=>({...u,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 l=this.database.getVirtualBodyCell(n,a);if(l){const{dataList:d}=l.getSpanInfo(),u=d.map(f=>({...f,value:o.value}));s.push(...u)}}),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 l=o+t[0],d=a+i[0],u=this.database.getVirtualBodyCell(l,d);u&&(u.selectorCellValueType==="displayText"?n.push(u.displayText):n.push(u.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 ko{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 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,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,l=s,d=i,u=t.height,f=t.width,g=e.height,m=this.ctx.footer.height;if(this.type==="vertical"){this.visibleDistance=d-o-u,this.distance=g-this.visibleDistance+m,this.trackX=l-o,this.trackY=0,this.splitPoints=[this.trackX,u,this.trackX+o,u],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=u+this.scroll/this.distance*(this.visibleDistance-this.barHeight),this.scroll=Math.max(0,Math.min(this.scroll,this.distance))}else{this.visibleDistance=l-o,this.distance=f-this.visibleDistance,this.splitPoints=[l-o,d-o,l-o,d];const x=a?0:.5;this.trackX=0,this.trackY=d-o+x,this.trackWidth=l,this.trackHeight=o;const v=this.distance?this.visibleDistance/f: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 BC{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 ko(e,"vertical"),this.horizontalScrollbar=new ko(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("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&&i.x>t.visibleWidth/2&&this.setScrollX(i.x-t.visibleWidth/2)}scrollToRowIndex(e){const{body:t,database:i}=this.ctx,{top:s}=i.getPositionForRowIndex(e);s>t.visibleHeight&&this.setScrollY(s-t.visibleHeight/2)}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 l=10*(n==="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 FC{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 f=o[this.childrenKey];f.splice(n,1),f.length===0&&delete o[this.childrenKey]}else this.root.splice(n,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;i==="before"?d?d[this.childrenKey].splice(u,0,a):this.root.splice(u,0,a):i==="after"&&(d?d[this.childrenKey].splice(u+1,0,a):this.root.splice(u+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 KC{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",$r(()=>{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 f=this.ctx.database.getColumns();this.columns=f}this.allCellHeaders=[],this.leafCellHeaders=[],this.fixedLeftCellHeaders=[],this.fixedRightCellHeaders=[],this.centerCellHeaders=[],this.visibleColumns=Va(this.columns);const s=fi(this.visibleColumns),o=Nt(this.visibleColumns);this.height=t*s,this.visibleHeight=this.height,this.width=o.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 n=yC(gi(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 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,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),l=n,d=a,u=o.getDrawX(),f=o.getDrawY();if(l>u+o.width-5&&l<u+o.width+4&&l<t-4&&d>f){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<u+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,u={})=>(d.forEach((f,g)=>{f.children&&e(f.children,u),u[f.key]=g}),u),t=this.ctx.database.getColumns(),i=gi(t,fi(t)),s=new FC(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 l={source:this.dragTarget,target:this.dragingCell,columns:i};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: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 l=a.width||100;a.width=l+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:gi(e,fi(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],l=o*(a.rowspan||0),d=o*(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=Nt(a.children).reduce((x,v)=>x+((v==null?void 0:v.width)||100),0));const m=new lr(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:i,RESIZE_COLUMN_TEXT_BG_COLOR:s,ENABLE_RESIZE_COLUMN_TEXT:o}}=this.ctx,n=this.resizeTarget.getDrawX(),a=this.resizeTarget.width,l=n+a+this.resizeDiff-.5,d=[l-.5,0,l-.5,e];if(this.ctx.paint.drawLine(d,{borderColor:t}),o){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: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 l=s,d=o;a>this.dragTarget.colIndex&&(l=s+n),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: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 l=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(l,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 Ua{constructor(e,t,i=0,s=0,o=0,n=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=i,this.y=s,this.width=o,this.height=n,this.rowIndex=t,this.rowKey=e.database.getRowKeyForRowIndex(t)||"",this.rowType=l,this.data=a,this.update()}update(){const{header:e}=this.ctx,t=[],i=[],s=[],o=[];e.renderLeafCellHeaders.forEach(n=>{const a=new Mr(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=>t.getAutoHeight());this.calculatedHeight=e.length?Math.max(...e):-1}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 PC{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: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"&&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=l:!this.data.length&&a&&(this.height=a-t.height-v-n);let p=this.height+t.height+n;p+=v;let E=p;const b=window.innerHeight,{top:y}=this.containerRect||this.ctx.containerElement.getBoundingClientRect();if(b>y&&u&&!a){const O=b-y-f;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 C=this.ctx.stageHeight-t.height-n;o?this.visibleHeight=C-v:this.visibleHeight=C,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 T=window.devicePixelRatio||1,N=this.ctx.stageWidth*T,B=this.ctx.stageHeight*T;e.width=Math.round(N),e.height=Math.round(B);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:l+v});const _=Math.round(e.width/T*1e4)/1e4,S=Math.round(e.height/T*1e4)/1e4;this.ctx.canvasElement.setAttribute("style",`height:${S}px;width:${_}px;`),this.ctx.paint.scale(T)}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:l,config:{RESIZE_ROW_MIN_HEIGHT:d=0}}=this.ctx;if(this.isResizing&&this.resizeTarget){const u=this.resizeTarget.height;let f=n-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(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 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];o>m.drawX+10&&o<m.drawX+m.width-10&&m.rowspan===1&&(this.ctx.stageElement.style.cursor="row-resize",this.resizeTarget=f)}}}})}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 l=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(l,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 l=this.binarySearch(a,o),d=this.binarySearch(a,o+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=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 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 Ua(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(i=>i.calculatedHeightCells.length>0))return;e.forEach(i=>{i.updateCalculatedHeight()});const t=e.map(i=>({height:i.calculatedHeight,rowIndex:i.rowIndex}));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 YC{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 l=this.y;if(this.ctx.config.FOOTER_FIXED||(l=this.y-this.ctx.scrollY),i>0&&e!==0&&this.ctx.paint.drawShadow(this.x,l,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,l,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 Ua(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 VC{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",$r(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){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: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[E,b]=o,[y,C]=n;if(E<m||b>x||y<v||C>p)return;if(this.ctx.config.ENABLE_MERGE_CELL_LINK){const N=this.adjustMergeCells(o,n);y=N.yArr[0],C=N.yArr[1],E=N.xArr[0],b=N.xArr[1],this.ctx.onlyMergeCell=N.onlyMergeCell}E===b&&y===C?this.ctx.selectOnlyOne=!0:this.ctx.selectOnlyOne=!1,o=[Math.max(m,E),Math.min(x,b)],n=[Math.max(v,y),Math.min(p,C)];const{BEFORE_SET_SELECTOR_METHOD:T}=this.ctx.config;if(typeof T=="function"){const N=T({focusCell:this.ctx.focusCell,xArr:o,yArr:n});if(!N)return;o=N.xArr,n=N.yArr}this.ctx.selector.xArr=o,this.ctx.selector.yArr=n,C===this.ctx.maxRowIndex&&y===0?this.ctx.selectColsIng=!0:this.ctx.selectColsIng=!1,b===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 l=[],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],b=p+e[0],y=this.ctx.database.getVirtualBodyCell(E,b);y&&((E===s||E===o)&&l.push(y),(b===n||b===a)&&d.push(y))}const u=l.reduce((v,p)=>{const{yArr:E}=p.getSpanInfo(),[b,y]=E;return v.minY=Math.min(v.minY,b),v.maxY=Math.max(v.maxY,y),v},{minY:s,maxY:o}),f=d.reduce((v,p)=>{const{xArr:E}=p.getSpanInfo(),[b,y]=E;return v.minX=Math.min(v.minX,b),v.maxX=Math.max(v.maxX,y),v},{minX:n,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=(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 l=[a,e.colIndex+e.colspan-1],d=[o,n];this.setSelector(l,d)}else{const l=[e.colIndex,a+e.colspan-1],d=[o,n];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: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:l}=this.ctx.config,d=i,u=s||this.ctx.maxColIndex-a,f=o,g=n||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: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 l=[a,n],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,n],u=[l,e.rowIndex];this.setSelector(d,u)}else{const d=[a,n],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: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),l=Math.min(i.rowIndex,s),d=Math.max(i.rowIndex,s),u=[n,a],f=[l,d];this.setSelector(u,f)}}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,l=Math.min(n,s),d=Math.max(n,s),u=Math.min(a,o),f=Math.max(a,o),g=[l,d],m=[u,f];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=bC(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 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)||(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(l=>{a.push(this.ctx.database.getRowDataItemForRowKey(l))}),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=CC(o);const a=[i,i+n[0].length-1],l=[t,t+n.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:n});const v=n.length===1&&n[0].length===1;if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(a,l)&&!v){const y={code:"ERR_MERGED_CELLS_PASTE",message:"Merged cells cannot span paste data"};this.ctx.hasEvent("error")?this.ctx.emit("error",y):alert(y.message);return}let p=[];for(let y=0;y<=n.length-1;y++){const C=n[y].length;for(let T=0;T<=C-1;T++){const N=y+t,B=T+i,R=n[y][T],_=this.ctx.database.getItemValueForRowIndexAndColIndex(N,B);if(_){const{rowKey:S,key:O}=_;this.ctx.database.getReadonly(S,O)||(s.add(S),p.push({rowKey:S,key:O,value:R,row:{}}))}}}if(this.isCut){const y=this.clearSelectedData(this.ctx.selector.xArrCopy,this.ctx.selector.yArrCopy,!0),C=p.map(T=>`${T.rowKey}-${T.key}`);y.forEach(T=>{C.includes(`${T.rowKey}-${T.key}`)||p.unshift(T)}),this.isCut=!1}if(!p.length)return;const{BEFORE_PASTE_DATA_METHOD:E}=this.ctx.config;if(typeof E=="function"){const y=E,C=p.map(T=>({rowKey:T.rowKey,key:T.key,value:T.value,oldValue:this.ctx.database.getItemValue(T.rowKey,T.key),row:this.ctx.database.getRowDataItemForRowKey(T.rowKey)}));if(p=await y(C,a,l,n),p&&!p.length)return}this.clearCopyLine(),this.ctx.batchSetItemValueByEditor(p,!0);let b=[];s.forEach(y=>{b.push(this.ctx.database.getRowDataItemForRowKey(y))}),this.ctx.emit("pasteChange",p,b),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,l=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<l&&s++;break}const d=[i,i],u=[s,s],f=this.getCell(s,i);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: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:l}=this.ctx.config,d=i,u=s||this.ctx.maxColIndex-a,f=o,g=n||this.ctx.maxRowIndex-l;return!(t<d||t>u||e<f||e>g)}adjustBoundaryPosition(){const{stageHeight:e,stageWidth:t,focusCell:i,fixedRightWidth:s,fixedLeftWidth:o,header:n,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(!i)return;x&&this.ctx.onlyMergeCell&&i.updateSpanInfo();const{drawX:v,drawY:p,width:E,height:b,fixed:y}=i,C=o-v+1,T=i.drawX+E-(t-s)+1;let N=n.height-p,B=b;B>l.visibleHeight&&(B=l.visibleHeight);let R=0;g&&(m==="top"?N=n.height+a.height-p:R=a.visibleHeight);const _=p+B-(e-R-f);let S=d,O=u;T>0&&!y?S=Math.floor(d+T):C>0&&!y&&(S=Math.floor(d-C)),N>0?O=Math.floor(u-N):_>0&&(O=Math.floor(u+_)),(Math.abs(d-S)>2||Math.abs(u-O)>2)&&(this.ctx.adjustPositioning=!0,this.ctx.emit("adjustBoundaryPosition",i),this.ctx.setScroll(S,O))}destroy(){}}class WC{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:l,height:d}=this.maxColRowCell,u=6,f=s===this.ctx.maxColIndex||o===this.ctx.maxRowIndex?0:2,g=n+l-u+f,m=a+d-u+f;t>g&&i>m&&t<g+u&&i<m+u&&(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 l=this.ctx.selector.xArr,d=this.ctx.selector.yArr;if(!(!o&&JSON.stringify(d)!==JSON.stringify(a))&&!(!s&&JSON.stringify(l)!==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: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,E=f||this.ctx.maxColIndex-x,b=g,y=m||this.ctx.maxRowIndex-v;let[C,T]=n,[N,B]=a;if(C<p||N<b)return;n=[Math.max(p,C),Math.min(E,T)],a=[Math.max(b,N),Math.min(y,B)];const{BEFORE_SET_AUTOFILL_METHOD:R}=this.ctx.config;if(typeof R=="function"){const _=R({focusCell:this.ctx.focusCell,xArr:n,yArr:a});if(!_)return;n=_.xArr,a=_.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,l=this.ctx.autofill.yArr,d=o===1&&n===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],E=s[m%n][x%o],b=this.ctx.database.getItemValueForRowIndexAndColIndex(p,v),y=`${p}-${v}`;if(b&&!i.has(y)){const{rowKey:C,key:T}=b;this.ctx.database.getReadonly(C,T)||(e.add(C),u.push({rowKey:C,key:T,value:E,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: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 pt=Math.min,it=Math.max,wi=Math.round,ui=Math.floor,Re=r=>({x:r,y:r}),XC={left:"right",right:"left",bottom:"top",top:"bottom"},zC={start:"end",end:"start"};function cr(r,e,t){return it(r,pt(e,t))}function Gt(r,e){return typeof r=="function"?r(e):r}function rt(r){return r.split("-")[0]}function Ut(r){return r.split("-")[1]}function qa(r){return r==="x"?"y":"x"}function Nr(r){return r==="y"?"height":"width"}const GC=new Set(["top","bottom"]);function Ye(r){return GC.has(rt(r))?"y":"x"}function Hr(r){return qa(Ye(r))}function UC(r,e,t){t===void 0&&(t=!1);const i=Ut(r),s=Hr(r),o=Nr(s);let n=s==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(n=yi(n)),[n,yi(n)]}function qC(r){const e=yi(r);return[hr(r),e,hr(e)]}function hr(r){return r.replace(/start|end/g,e=>zC[e])}const Lo=["left","right"],Do=["right","left"],ZC=["top","bottom"],JC=["bottom","top"];function QC(r,e,t){switch(r){case"top":case"bottom":return t?e?Do:Lo:e?Lo:Do;case"left":case"right":return e?ZC:JC;default:return[]}}function jC(r,e,t,i){const s=Ut(r);let o=QC(rt(r),t==="start",i);return s&&(o=o.map(n=>n+"-"+s),e&&(o=o.concat(o.map(hr)))),o}function yi(r){return r.replace(/left|right|bottom|top/g,e=>XC[e])}function eb(r){return{top:0,right:0,bottom:0,left:0,...r}}function Za(r){return typeof r!="number"?eb(r):{top:r,right:r,bottom:r,left:r}}function Ei(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 $o(r,e,t){let{reference:i,floating:s}=r;const o=Ye(e),n=Hr(e),a=Nr(n),l=rt(e),d=o==="y",u=i.x+i.width/2-s.width/2,f=i.y+i.height/2-s.height/2,g=i[a]/2-s[a]/2;let m;switch(l){case"top":m={x:u,y:i.y-s.height};break;case"bottom":m={x:u,y:i.y+i.height};break;case"right":m={x:i.x+i.width,y:f};break;case"left":m={x:i.x-s.width,y:f};break;default:m={x:i.x,y:i.y}}switch(Ut(e)){case"start":m[n]-=g*(t&&d?-1:1);break;case"end":m[n]+=g*(t&&d?-1:1);break}return m}const tb=async(r,e,t)=>{const{placement:i="bottom",strategy:s="absolute",middleware:o=[],platform:n}=t,a=o.filter(Boolean),l=await(n.isRTL==null?void 0:n.isRTL(e));let d=await n.getElementRects({reference:r,floating:e,strategy:s}),{x:u,y:f}=$o(d,i,l),g=i,m={},x=0;for(let v=0;v<a.length;v++){const{name:p,fn:E}=a[v],{x:b,y,data:C,reset:T}=await E({x:u,y:f,initialPlacement:i,placement:g,strategy:s,middlewareData:m,rects:d,platform:n,elements:{reference:r,floating:e}});u=b??u,f=y??f,m={...m,[p]:{...m[p],...C}},T&&x<=50&&(x++,typeof T=="object"&&(T.placement&&(g=T.placement),T.rects&&(d=T.rects===!0?await n.getElementRects({reference:r,floating:e,strategy:s}):T.rects),{x:u,y:f}=$o(d,g,l)),v=-1)}return{x:u,y:f,placement:g,strategy:s,middlewareData:m}};async function Ja(r,e){var t;e===void 0&&(e={});const{x:i,y:s,platform:o,rects:n,elements:a,strategy:l}=r,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:g=!1,padding:m=0}=Gt(e,r),x=Za(m),v=a[g?f==="floating"?"reference":"floating":f],p=Ei(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:u,strategy:l})),E=f==="floating"?{x:i,y:s,width:n.floating.width,height:n.floating.height}:n.reference,b=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),y=await(o.isElement==null?void 0:o.isElement(b))?await(o.getScale==null?void 0:o.getScale(b))||{x:1,y:1}:{x:1,y:1},C=Ei(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:E,offsetParent:b,strategy:l}):E);return{top:(p.top-C.top+x.top)/y.y,bottom:(C.bottom-p.bottom+x.bottom)/y.y,left:(p.left-C.left+x.left)/y.x,right:(C.right-p.right+x.right)/y.x}}const ib=r=>({name:"arrow",options:r,async fn(e){const{x:t,y:i,placement:s,rects:o,platform:n,elements:a,middlewareData:l}=e,{element:d,padding:u=0}=Gt(r,e)||{};if(d==null)return{};const f=Za(u),g={x:t,y:i},m=Hr(s),x=Nr(m),v=await n.getDimensions(d),p=m==="y",E=p?"top":"left",b=p?"bottom":"right",y=p?"clientHeight":"clientWidth",C=o.reference[x]+o.reference[m]-g[m]-o.floating[x],T=g[m]-o.reference[m],N=await(n.getOffsetParent==null?void 0:n.getOffsetParent(d));let B=N?N[y]:0;(!B||!await(n.isElement==null?void 0:n.isElement(N)))&&(B=a.floating[y]||o.floating[x]);const R=C/2-T/2,_=B/2-v[x]/2-1,S=pt(f[E],_),O=pt(f[b],_),w=S,A=B-v[x]-O,$=B/2-v[x]/2+R,Y=cr(w,$,A),V=!l.arrow&&Ut(s)!=null&&$!==Y&&o.reference[x]/2-($<w?S:O)-v[x]/2<0,P=V?$<w?$-w:$-A:0;return{[m]:g[m]+P,data:{[m]:Y,centerOffset:$-Y-P,...V&&{alignmentOffset:P}},reset:V}}}),rb=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:l,elements:d}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:g,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:v=!0,...p}=Gt(r,e);if((t=o.arrow)!=null&&t.alignmentOffset)return{};const E=rt(s),b=Ye(a),y=rt(a)===a,C=await(l.isRTL==null?void 0:l.isRTL(d.floating)),T=g||(y||!v?[yi(a)]:qC(a)),N=x!=="none";!g&&N&&T.push(...jC(a,v,x,C));const B=[a,...T],R=await Ja(e,p),_=[];let S=((i=o.flip)==null?void 0:i.overflows)||[];if(u&&_.push(R[E]),f){const $=UC(s,n,C);_.push(R[$[0]],R[$[1]])}if(S=[...S,{placement:s,overflows:_}],!_.every($=>$<=0)){var O,w;const $=(((O=o.flip)==null?void 0:O.index)||0)+1,Y=B[$];if(Y&&(!(f==="alignment"&&b!==Ye(Y))||S.every(P=>Ye(P.placement)===b?P.overflows[0]>0:!0)))return{data:{index:$,overflows:S},reset:{placement:Y}};let V=(w=S.filter(P=>P.overflows[0]<=0).sort((P,W)=>P.overflows[1]-W.overflows[1])[0])==null?void 0:w.placement;if(!V)switch(m){case"bestFit":{var A;const P=(A=S.filter(W=>{if(N){const G=Ye(W.placement);return G===b||G==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(G=>G>0).reduce((G,q)=>G+q,0)]).sort((W,G)=>W[1]-G[1])[0])==null?void 0:A[0];P&&(V=P);break}case"initialPlacement":V=a;break}if(s!==V)return{reset:{placement:V}}}return{}}}},sb=new Set(["left","top"]);async function ob(r,e){const{placement:t,platform:i,elements:s}=r,o=await(i.isRTL==null?void 0:i.isRTL(s.floating)),n=rt(t),a=Ut(t),l=Ye(t)==="y",d=sb.has(n)?-1:1,u=o&&l?-1:1,f=Gt(e,r);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 nb=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,l=await ob(e,r);return n===((t=a.offset)==null?void 0:t.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:s+l.x,y:o+l.y,data:{...l,placement:n}}}}},ab=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:b}=p;return{x:E,y:b}}},...l}=Gt(r,e),d={x:t,y:i},u=await Ja(e,l),f=Ye(rt(s)),g=qa(f);let m=d[g],x=d[f];if(o){const p=g==="y"?"top":"left",E=g==="y"?"bottom":"right",b=m+u[p],y=m-u[E];m=cr(b,m,y)}if(n){const p=f==="y"?"top":"left",E=f==="y"?"bottom":"right",b=x+u[p],y=x-u[E];x=cr(b,x,y)}const v=a.fn({...e,[g]:m,[f]:x});return{...v,data:{x:v.x-t,y:v.y-i,enabled:{[g]:o,[f]:n}}}}}};function Ai(){return typeof window<"u"}function St(r){return Qa(r)?(r.nodeName||"").toLowerCase():"#document"}function ne(r){var e;return(r==null||(e=r.ownerDocument)==null?void 0:e.defaultView)||window}function ke(r){var e;return(e=(Qa(r)?r.ownerDocument:r.document)||window.document)==null?void 0:e.documentElement}function Qa(r){return Ai()?r instanceof Node||r instanceof ne(r).Node:!1}function pe(r){return Ai()?r instanceof Element||r instanceof ne(r).Element:!1}function Se(r){return Ai()?r instanceof HTMLElement||r instanceof ne(r).HTMLElement:!1}function Mo(r){return!Ai()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof ne(r).ShadowRoot}const lb=new Set(["inline","contents"]);function qt(r){const{overflow:e,overflowX:t,overflowY:i,display:s}=we(r);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!lb.has(s)}const cb=new Set(["table","td","th"]);function hb(r){return cb.has(St(r))}const db=[":popover-open",":modal"];function Ni(r){return db.some(e=>{try{return r.matches(e)}catch{return!1}})}const ub=["transform","translate","scale","rotate","perspective"],fb=["transform","translate","scale","rotate","perspective","filter"],gb=["paint","layout","strict","content"];function Br(r){const e=Fr(),t=pe(r)?we(r):r;return ub.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)||fb.some(i=>(t.willChange||"").includes(i))||gb.some(i=>(t.contain||"").includes(i))}function vb(r){let e=We(r);for(;Se(e)&&!wt(e);){if(Br(e))return e;if(Ni(e))return null;e=We(e)}return null}function Fr(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const mb=new Set(["html","body","#document"]);function wt(r){return mb.has(St(r))}function we(r){return ne(r).getComputedStyle(r)}function Hi(r){return pe(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function We(r){if(St(r)==="html")return r;const e=r.assignedSlot||r.parentNode||Mo(r)&&r.host||ke(r);return Mo(e)?e.host:e}function ja(r){const e=We(r);return wt(e)?r.ownerDocument?r.ownerDocument.body:r.body:Se(e)&&qt(e)?e:ja(e)}function Ht(r,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const s=ja(r),o=s===((i=r.ownerDocument)==null?void 0:i.body),n=ne(s);if(o){const a=dr(n);return e.concat(n,n.visualViewport||[],qt(s)?s:[],a&&t?Ht(a):[])}return e.concat(s,Ht(s,[],t))}function dr(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function el(r){const e=we(r);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const s=Se(r),o=s?r.offsetWidth:t,n=s?r.offsetHeight:i,a=wi(t)!==o||wi(i)!==n;return a&&(t=o,i=n),{width:t,height:i,$:a}}function Kr(r){return pe(r)?r:r.contextElement}function mt(r){const e=Kr(r);if(!Se(e))return Re(1);const t=e.getBoundingClientRect(),{width:i,height:s,$:o}=el(e);let n=(o?wi(t.width):t.width)/i,a=(o?wi(t.height):t.height)/s;return(!n||!Number.isFinite(n))&&(n=1),(!a||!Number.isFinite(a))&&(a=1),{x:n,y:a}}const xb=Re(0);function tl(r){const e=ne(r);return!Fr()||!e.visualViewport?xb:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function pb(r,e,t){return e===void 0&&(e=!1),!t||e&&t!==ne(r)?!1:e}function st(r,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const s=r.getBoundingClientRect(),o=Kr(r);let n=Re(1);e&&(i?pe(i)&&(n=mt(i)):n=mt(r));const a=pb(o,t,i)?tl(o):Re(0);let l=(s.left+a.x)/n.x,d=(s.top+a.y)/n.y,u=s.width/n.x,f=s.height/n.y;if(o){const g=ne(o),m=i&&pe(i)?ne(i):i;let x=g,v=dr(x);for(;v&&i&&m!==x;){const p=mt(v),E=v.getBoundingClientRect(),b=we(v),y=E.left+(v.clientLeft+parseFloat(b.paddingLeft))*p.x,C=E.top+(v.clientTop+parseFloat(b.paddingTop))*p.y;l*=p.x,d*=p.y,u*=p.x,f*=p.y,l+=y,d+=C,x=ne(v),v=dr(x)}}return Ei({width:u,height:f,x:l,y:d})}function Pr(r,e){const t=Hi(r).scrollLeft;return e?e.left+t:st(ke(r)).left+t}function il(r,e,t){t===void 0&&(t=!1);const i=r.getBoundingClientRect(),s=i.left+e.scrollLeft-(t?0:Pr(r,i)),o=i.top+e.scrollTop;return{x:s,y:o}}function wb(r){let{elements:e,rect:t,offsetParent:i,strategy:s}=r;const o=s==="fixed",n=ke(i),a=e?Ni(e.floating):!1;if(i===n||a&&o)return t;let l={scrollLeft:0,scrollTop:0},d=Re(1);const u=Re(0),f=Se(i);if((f||!f&&!o)&&((St(i)!=="body"||qt(n))&&(l=Hi(i)),Se(i))){const m=st(i);d=mt(i),u.x=m.x+i.clientLeft,u.y=m.y+i.clientTop}const g=n&&!f&&!o?il(n,l,!0):Re(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 yb(r){return Array.from(r.getClientRects())}function Eb(r){const e=ke(r),t=Hi(r),i=r.ownerDocument.body,s=it(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),o=it(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let n=-t.scrollLeft+Pr(r);const a=-t.scrollTop;return we(i).direction==="rtl"&&(n+=it(e.clientWidth,i.clientWidth)-s),{width:s,height:o,x:n,y:a}}function Cb(r,e){const t=ne(r),i=ke(r),s=t.visualViewport;let o=i.clientWidth,n=i.clientHeight,a=0,l=0;if(s){o=s.width,n=s.height;const d=Fr();(!d||d&&e==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}return{width:o,height:n,x:a,y:l}}const bb=new Set(["absolute","fixed"]);function _b(r,e){const t=st(r,!0,e==="fixed"),i=t.top+r.clientTop,s=t.left+r.clientLeft,o=Se(r)?mt(r):Re(1),n=r.clientWidth*o.x,a=r.clientHeight*o.y,l=s*o.x,d=i*o.y;return{width:n,height:a,x:l,y:d}}function Ao(r,e,t){let i;if(e==="viewport")i=Cb(r,t);else if(e==="document")i=Eb(ke(r));else if(pe(e))i=_b(e,t);else{const s=tl(r);i={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return Ei(i)}function rl(r,e){const t=We(r);return t===e||!pe(t)||wt(t)?!1:we(t).position==="fixed"||rl(t,e)}function Rb(r,e){const t=e.get(r);if(t)return t;let i=Ht(r,[],!1).filter(a=>pe(a)&&St(a)!=="body"),s=null;const o=we(r).position==="fixed";let n=o?We(r):r;for(;pe(n)&&!wt(n);){const a=we(n),l=Br(n);!l&&a.position==="fixed"&&(s=null),(o?!l&&!s:!l&&a.position==="static"&&s&&bb.has(s.position)||qt(n)&&!l&&rl(r,n))?i=i.filter(d=>d!==n):s=a,n=We(n)}return e.set(r,i),i}function Sb(r){let{element:e,boundary:t,rootBoundary:i,strategy:s}=r;const o=[...t==="clippingAncestors"?Ni(e)?[]:Rb(e,this._c):[].concat(t),i],n=o[0],a=o.reduce((l,d)=>{const u=Ao(e,d,s);return l.top=it(u.top,l.top),l.right=pt(u.right,l.right),l.bottom=pt(u.bottom,l.bottom),l.left=it(u.left,l.left),l},Ao(e,n,s));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Ib(r){const{width:e,height:t}=el(r);return{width:e,height:t}}function Tb(r,e,t){const i=Se(e),s=ke(e),o=t==="fixed",n=st(r,!0,o,e);let a={scrollLeft:0,scrollTop:0};const l=Re(0);function d(){l.x=Pr(s)}if(i||!i&&!o)if((St(e)!=="body"||qt(s))&&(a=Hi(e)),i){const m=st(e,!0,o,e);l.x=m.x+e.clientLeft,l.y=m.y+e.clientTop}else s&&d();o&&!i&&s&&d();const u=s&&!i&&!o?il(s,a):Re(0),f=n.left+a.scrollLeft-l.x-u.x,g=n.top+a.scrollTop-l.y-u.y;return{x:f,y:g,width:n.width,height:n.height}}function rr(r){return we(r).position==="static"}function No(r,e){if(!Se(r)||we(r).position==="fixed")return null;if(e)return e(r);let t=r.offsetParent;return ke(r)===t&&(t=t.ownerDocument.body),t}function sl(r,e){const t=ne(r);if(Ni(r))return t;if(!Se(r)){let s=We(r);for(;s&&!wt(s);){if(pe(s)&&!rr(s))return s;s=We(s)}return t}let i=No(r,e);for(;i&&hb(i)&&rr(i);)i=No(i,e);return i&&wt(i)&&rr(i)&&!Br(i)?t:i||vb(r)||t}const Ob=async function(r){const e=this.getOffsetParent||sl,t=this.getDimensions,i=await t(r.floating);return{reference:Tb(r.reference,await e(r.floating),r.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function kb(r){return we(r).direction==="rtl"}const Lb={convertOffsetParentRelativeRectToViewportRelativeRect:wb,getDocumentElement:ke,getClippingRect:Sb,getOffsetParent:sl,getElementRects:Ob,getClientRects:yb,getDimensions:Ib,getScale:mt,isElement:pe,isRTL:kb};function ol(r,e){return r.x===e.x&&r.y===e.y&&r.width===e.width&&r.height===e.height}function Db(r,e){let t=null,i;const s=ke(r);function o(){var a;clearTimeout(i),(a=t)==null||a.disconnect(),t=null}function n(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const d=r.getBoundingClientRect(),{left:u,top:f,width:g,height:m}=d;if(a||e(),!g||!m)return;const x=ui(f),v=ui(s.clientWidth-(u+g)),p=ui(s.clientHeight-(f+m)),E=ui(u),b={rootMargin:-x+"px "+-v+"px "+-p+"px "+-E+"px",threshold:it(0,pt(1,l))||1};let y=!0;function C(T){const N=T[0].intersectionRatio;if(N!==l){if(!y)return n();N?n(!1,N):i=setTimeout(()=>{n(!1,1e-7)},1e3)}N===1&&!ol(d,r.getBoundingClientRect())&&n(),y=!1}try{t=new IntersectionObserver(C,{...b,root:s.ownerDocument})}catch{t=new IntersectionObserver(C,b)}t.observe(r)}return n(!0),o}function ur(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:l=!1}=i,d=Kr(r),u=s||o?[...d?Ht(d):[],...Ht(e)]:[];u.forEach(E=>{s&&E.addEventListener("scroll",t,{passive:!0}),o&&E.addEventListener("resize",t)});const f=d&&a?Db(d,t):null;let g=-1,m=null;n&&(m=new ResizeObserver(E=>{let[b]=E;b&&b.target===d&&m&&(m.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var y;(y=m)==null||y.observe(e)})),t()}),d&&!l&&m.observe(d),m.observe(e));let x,v=l?st(r):null;l&&p();function p(){const E=st(r);v&&!ol(v,E)&&t(),v=E,x=requestAnimationFrame(p)}return t(),()=>{var E;u.forEach(b=>{s&&b.removeEventListener("scroll",t),o&&b.removeEventListener("resize",t)}),f==null||f(),(E=m)==null||E.disconnect(),m=null,l&&cancelAnimationFrame(x)}}const Ci=nb,bi=ab,Yr=rb,$b=ib,_i=(r,e,t)=>{const i=new Map,s={platform:Lb,...t},o={...s.platform,_c:i};return tb(r,e,{...s,platform:o})};let Mb=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)})}show(r){if(this.ctx.contextMenuIng||!r.overflowTooltipShow||this.ctx.mousedown)return;this.floatingEl.style.display="block";let e=r.getText();r.message&&(e=r.message);const t=this.ctx.containerElement.getBoundingClientRect();if(!t)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=e;const i=r.drawX+t.x,s=r.drawY+t.y;_i({getBoundingClientRect(){return{width:r.visibleWidth,height:r.visibleHeight,x:i,y:s,left:i,right:i+r.visibleWidth,top:s,bottom:s+r.visibleHeight}}},this.floatingEl,{placement:r.overflowTooltipPlacement,middleware:[bi(),Yr(),Ci(6),$b({element:this.arrowEl})]}).then(o=>{const{x:n,y:a,placement:l,middlewareData:d}=o;if(Object.assign(this.floatingEl.style,{top:`${a}px`,left:`${n}px`}),d.arrow){const u=d.arrow;["left","left-start","left-end"].includes(l)?Object.assign(this.arrowEl.style,{top:`${u.y}px`,bottom:"",left:"",right:"-5px"}):["right","right-start","right-end"].includes(l)?Object.assign(this.arrowEl.style,{top:`${u.y}px`,bottom:"",left:"-5px",right:""}):["bottom","bottom-start","bottom-end"].includes(l)?Object.assign(this.arrowEl.style,{top:"-5px",bottom:"",left:`${u.x}px`,right:""}):["top","top-start","top-end"].includes(l)&&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 Ab{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("cellHeaderMousedown",()=>{this.enable&&this.doneEdit(),this.cellTarget=null}),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)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.code==="Enter"&&this.ctx.editing&&this.inputEl){e.preventDefault();const a=this.inputEl.selectionStart,l=this.inputEl.value.substring(0,a),d=this.inputEl.value.substring(a);this.inputEl.value=l+`
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.code==="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.code==="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()}})}isInSelectorRange(e,t){const{xArr:i,yArr:s}=this.ctx.selector,[o,n]=i,[a,l]=s;return!(t<o||t>n||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(){this.inputEl.style.height="auto";let e=this.inputEl.scrollHeight,t=this.ctx.body.visibleHeight;e>t&&(e=t);const{stageHeight:i,footer:s,header:o,config:{SCROLLER_TRACK_SIZE:n}}=this.ctx,a=i-s.height-n;this.editorEl.style.bottom="auto",this.drawY<o.height&&(this.editorEl.style.top=`${o.height-1}px`),this.drawY+e>a&&(this.editorEl.style.left=`${this.drawX-1}px`,this.editorEl.style.top="auto",this.editorEl.style.bottom=`${i-a}px`),this.inputEl.style.height=`${e}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:l}=e;this.drawX=l,this.drawY=a;const{config:{CELL_PADDING:d},header:u}=this.ctx;let f=this.ctx.body.visibleHeight;o>f&&(o=f),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=`${f}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=`${f}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<u.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||this.ctx.adjustPositioning)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,l=this.ctx.database.getReadonly(n,a);o&&!l&&(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(){this.enable&&(this.doneEditByInput(),this.ctx.emit("doneEdit",this.cellTarget),this.enable=!1,this.ctx.editing=!1,this.inputEl.style.display="inline-block",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 Nb=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,l={display:i==="empty"?"block":"none",position:"absolute",fontSize:"14px",color:"#666",left:"50%",top:`${a}px`,transform:"translate(-50%, -50%)",...t};Object.assign(this.emptyEl.style,l)})}destroy(){this.emptyEl.remove()}};class Hb{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($r(()=>{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)||!(s instanceof HTMLElement)||s.offsetWidth===0)return;const a=`${o}​_${n}`;t.set(a,Math.round(s.offsetHeight))});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}),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 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),n.appendChild(l)}),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 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-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-f+1}px`,height:`${n}px`},cells:l},x={key:"right",style:{position:"absolute",top:"0px",right:"0px",overflow:"hidden",width:`${f+1}px`,height:`${n}px`},cells:u};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:l}}=this.ctx,{visibleWidth:d,visibleHeight:u}=this.ctx.body,f=n-a,g={key:"left",style:{position:"absolute",top:`${.5}px`,left:`${.5}px`,overflow:"hidden",width:`${o}px`,height:`${u}px`},cells:t},m={key:"center",style:{position:"absolute",top:`${.5}px`,left:`${o-.5}px`,overflow:"hidden",width:`${d-o-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:i};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=[],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:l,visibleHeight:d}=this.ctx.footer,u=o-n,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:i};return{type:"footer",class:`${a}-overlayer-footer`,style:{position:"relative",overflow:"hidden",width:`${l}px`,height:`${d}px`},views:[f,g,m]}}}class Ho{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=Ga,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(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=ur(e,t,async()=>{const s=this.container.getBoundingClientRect(),o=window.innerWidth,n=t.offsetWidth||200,a=o-s.right,l=s.left,d=a>=n||a>=l?"right-start":"left-start",{x:u,y:f}=await _i(e,t,{placement:d,middleware:[Ci(8),bi({padding:8})]});Object.assign(t.style,{left:`${u}px`,top:`${f}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};ur(t,this.container,()=>{_i(t,this.container,{placement:"right-start",middleware:[Ci(),bi(),Yr()]}).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 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(i=>{i._submenu&&this.cleanupSubmenuRecursively(i._submenu)}),e.remove()}}class Bb{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: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 Ho(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: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(),E=f.map(b=>b.value==="visible"?{...b,children:this.filterColumns(p)}:b);this.ctx.contextMenuIng=!0,this.currentDOMTreeMenu=new Ho(this.contextMenuEl,E,{onClick:(b,y)=>{const{xArr:C}=this.ctx.selector,[T,N]=C;if(y==="fixedLeft"||y==="fixedRight"||y==="fixedNone"){const B=this.ctx.header.allCellHeaders.filter(R=>R.colIndex>=T&&R.colIndex<=N).filter(R=>R.level===0).filter(R=>!R.column.fixedDisabled).map(R=>R.key);this.ctx.database.setCustomHeaderFixedData(B,y==="fixedLeft"?"left":y==="fixedRight"?"right":""),this.hide()}else if(y==="hide"){const B=this.ctx.header.leafCellHeaders.filter(R=>R.colIndex>=T&&R.colIndex<=N).filter(R=>!R.children.length).filter(R=>!R.column.hideDisabled).map(R=>R.key);B.length>0&&this.ctx.database.setCustomHeaderHideData(B,!0),this.hide()}else if(y!=="visible")if(y.startsWith("visible_")){const B=y.replace("visible_","");this.ctx.database.setCustomHeaderHideData([B],!1),this.currentDOMTreeMenu&&this.currentDOMTreeMenu.removeSubMenuItem(y);const R=this.ctx.database.getColumns();Nt(R).filter(_=>_.hide).length===0&&this.hide()}else y==="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};ur(t,this.contextMenuEl,()=>{_i(t,this.contextMenuEl,{placement:"right-start",middleware:[Ci(),bi(),Yr()]}).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,value:`visible_${i.key}`,disabled:!0,children:s})}else i.hide&&t.push({label:i.title,value:`visible_${i.key}`});return 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 Fb{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 Kb{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,"animationFrameId"),h(this,"animationFrameId2"),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 HC(a,this.options),this.header=new KC(this.ctx),this.footer=new YC(this.ctx),this.body=new PC(this.ctx),this.scroller=new BC(this.ctx),this.selector=new VC(this.ctx),this.autofill=new WC(this.ctx),this.tooltip=new Mb(this.ctx),this.empty=new Nb(this.ctx),this.editor=new Ab(this.ctx),this.overlayer=new Hb(this.ctx),this.contextMenu=new Bb(this.ctx),this.loading=new Fb(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"),l=t||document.createElement("div");n.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=i||document.createElement("div");d.className="e-virt-table-editor";const u=s,f=o;return n.appendChild(a),n.appendChild(l),e.appendChild(n),{containerElement:e,stageElement:n,canvasElement:a,overlayerElement:l,editorElement:d,emptyElement:u,contextMenuElement:f}}draw(e=!1){this.animationFrameId&&cancelAnimationFrame(this.animationFrameId),this.animationFrameId=requestAnimationFrame(()=>{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(),this.animationFrameId2&&cancelAnimationFrame(this.animationFrameId2),this.animationFrameId2=requestAnimationFrame(()=>{this.body.updateAutoHeight()})})}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()}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:l}=e[n],d=await this.ctx.database.getValidator(a,l);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:l,key:d}=a;this.scrollToRowkey(l),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:l}=n,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)}}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 l=this.ctx.database.getRowKeyByItem(i[n]),d=s[a].key,u=await this.ctx.database.getValidator(l,d);Array.isArray(u)&&u.length&&o.push(u)}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()}clearMaxRowHeight(){this.ctx.database.clearMaxRowHeight()}contextMenuHide(){this.contextMenu.hide()}getUtils(){return{mergeColCell:RC,mergeRowCell:_C,getSpanArrByRow:Wa,getSpanObjByColumn:Xa}}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.ctx.destroy(),this.ctx.containerElement.remove()}}const Pb=c.defineComponent((r,{emit:e})=>{const{cellRender:t,renderTableParams:i}=r,{row:s,field:o}=i;if(o){const n=c.ref(s[o]);return()=>{var a,l;return((l=(a=At.renders[t.name])==null?void 0:a.renderEdit)==null?void 0:l.call(a,n,t,i,e))??null}}else return()=>null},{name:"RenderEditCell",props:["cellRender","renderTableParams"],emits:["blur"]}),Vr=c.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=c.ref([]),o=r,n=Aa(),a=c.computed(()=>({...o,config:{AUTO_ROW_HEIGHT:!0,DISABLED:!0,...n,...o.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(),E={},b={},y=c.computed(()=>{const w=x.value;return w?{width:`${w.width}px`,height:`${w.height}px`}:{}}),C=w=>vt[w]||(({cellValue:A})=>A),T=w=>{var A;return(A=At.renders[w])==null?void 0:A.renderDefault},N=(w,...A)=>({row:$,rowIndex:Y,value:V})=>w({row:$,rowIndex:Y,cellValue:V},...A),B=w=>{var A,$,Y,V,P;if((A=w.slots)!=null&&A.default&&I.isFunction(($=w.slots)==null?void 0:$.default))return W=>{var G,q;return(q=(G=w.slots)==null?void 0:G.default)==null?void 0:q.call(G,{row:W.row,column:w,rowIndex:W.rowIndex})};if((Y=w.slots)!=null&&Y.default&&I.isString((V=w.slots)==null?void 0:V.default))return`slot:${(P=w.slots)==null?void 0:P.default}`;if(w.cellRender&&w.cellRender.name)return W=>{var G,q;return(q=T(w.cellRender.name))==null?void 0:q(w.cellRender,{data:o.data,row:W.row,rowIndex:W.rowIndex,field:w.field||W.column.key,title:((G=W.column)==null?void 0:G.title)??""},{})}},R=w=>{var A,$;if((A=w.slots)!=null&&A.title&&I.isFunction(($=w.slots)==null?void 0:$.title))return Y=>{var V,P;return(P=(V=w.slots)==null?void 0:V.title)==null?void 0:P.call(V,{column:w})}},_=w=>{var A,$,Y,V,P,W,G;return(A=w.slots)!=null&&A.edit&&(w.field||w.key)&&I.isFunction(($=w.slots)==null?void 0:$.edit)?E[`__slot:${w.field||w.key}`]=w:(Y=w.editRender)!=null&&Y.name&&(w.field||w.key)&&(b[w.field||w.key]=w.editRender),{...I.omit(w,["formatter"]),key:w.key||w.field||De(),formatter:I.isString(w.formatter)?N(C(w.formatter)):I.isArray(w.formatter)&&I.isString(w.formatter[0])?N(C(w.formatter[0]),...w.formatter.slice(1)):I.isFunction(w.formatter)?N(w.formatter):void 0,editorType:w.editorType??((V=w.slots)!=null&&V.edit&&(w.field||w.key)&&I.isFunction((P=w.slots)==null?void 0:P.edit)?`__slot:${w.field||w.key}`:(W=w.editRender)!=null&&W.name?w.editRender.name:void 0),render:B(w),renderHeader:R(w),children:(G=w.children)==null?void 0:G.map(q=>_(q))}};c.onMounted(()=>{u.value&&(l=new Kb(u.value,{config:a.value.config,columns:o.columns.map(w=>_(w)),data:o.data,footerData:o.footerData,emptyElement:g.value||void 0,overlayerElement:m.value||void 0,editorElement:f.value||void 0}),Object.keys(d).forEach(w=>{const A=d[w];if(typeof A=="function"&&w.startsWith("on")){const $=w.charAt(2).toLowerCase()+w.slice(3);l==null||l.on($,A)}}),l.on("change",w=>{i("change",w)}),l.on("overlayerChange",w=>{p.value=w,console.log("overlayerChange",w)}),l.on("startEdit",w=>{x.value=w,v.value=w.editorType,v.value}),l.on("doneEdit",()=>{v.value="text"}),l.on("selectionChange",w=>{s.value=w,i("selectionChange",w)}),i("ready",l))});function S(w){if(!l||!x.value)return;const{rowKey:A,key:$}=x.value;l==null||l.setItemValueByEditor(A,$,w)}const O=()=>document.body;return c.watch(()=>o.data,w=>{l==null||l.loadData(w)},{deep:!0}),Tr(()=>o.columns,(w,A)=>{I.isEqual(w,A)||l==null||l.loadColumns(w.map($=>_($)))},{deep:!0}),c.watch(()=>a.value.config,w=>{l==null||l.loadConfig(w)},{deep:!0}),c.watch(()=>o.footerData,w=>{l==null||l.loadFooterData(w||[])},{deep:!0}),c.watch(()=>o.loading,(w,A)=>{w!==A&&(l==null||l.setLoading(w))},{immediate:!0}),e({$table:l,selectedRecords:c.computed(()=>s.value),reloadData:()=>{l==null||l.loadData(o.data)}}),(w,A)=>{const $=c.resolveComponent("a-empty"),Y=c.resolveComponent("a-spin");return c.openBlock(),c.createBlock(Y,{spinning:w.loading},{default:c.withCtx(()=>{var V,P,W,G,q,He,lt;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(E[v.value].slots.edit({row:x.value.row,column:E[v.value],rowIndex:x.value.rowIndex})),{key:0,bordered:!1,style:c.normalizeStyle(y.value),class:"ev-editor-wrapper","get-popup-container":O,value:x.value.value,"onUpdate:value":A[0]||(A[0]=le=>x.value.value=le),cell:x.value,onBlur:S},null,40,["style","value","cell"])):(V=c.unref(At).renders[v.value])!=null&&V.renderEdit?(c.openBlock(),c.createBlock(c.unref(Pb),{key:1,"cell-render":b[x.value.key],class:"ev-editor-wrapper",style:c.normalizeStyle(y.value),"render-table-params":{data:o.data,row:(P=x.value)==null?void 0:P.row,rowIndex:((W=x.value)==null?void 0:W.rowIndex)??-1,field:((G=x.value)==null?void 0:G.key)??"",title:((He=(q=x.value)==null?void 0:q.column)==null?void 0:He.title)??""},bordered:!1,"get-popup-container":O,onBlur:S},null,8,["cell-render","style","render-table-params"])):c.createCommentVNode("",!0)],512),c.createElementVNode("div",{ref_key:"eVirtTableEmptyRef",ref:g},[c.renderSlot(w.$slots,"empty",{},()=>[c.createVNode($,{description:"空数据"})])],512),c.createElementVNode("div",{ref_key:"eVirtTableOverlayerRef",ref:m},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(((lt=p.value)==null?void 0:lt.views)||[],le=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(le.class),style:c.normalizeStyle(le.style),key:le.type},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(le.views,Ge=>(c.openBlock(),c.createElementBlock("div",{style:c.normalizeStyle(Ge.style),key:Ge.key},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(Ge.cells,J=>(c.openBlock(),c.createElementBlock("div",c.mergeProps({class:"canvas-cell",key:`${J.rowKey}_${J.key}`,style:{...J.style,height:J.height?`${J.height-2}px`:"auto"}},{ref_for:!0},J.domDataset),[typeof J.render=="function"?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(J.render(J)),{key:0,bordered:!1})):typeof J.render=="string"&&J.render.startsWith("slot:")?c.renderSlot(w.$slots,J.render.replace("slot:",""),c.mergeProps({key:1,ref_for:!0},J,{cell:J})):c.createCommentVNode("",!0)],16))),128))],4))),128))],6))),128))],512)],512)]}),_:3},8,["spinning"])}}}),Yb={key:0},Vb={key:1,class:"p-canvas-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"},Wb={class:"flex items-center flex-1 gap-4px"},Xb={key:2},zb={class:"flex items-center gap-4px"},Gb={class:c.normalizeClass("p-pane flex-1 h-0 p-inner-scroll")},Ub={key:0,class:"w-full text-slate-5 pl-4"},nl=c.defineComponent({__name:"PCanvasGrid",props:{staticConfig:{},manualFetch:{type:Boolean},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},config:{},lazyReset:{type:Boolean,default:()=>Mt().lazyReset??!1},fitHeight:{default:()=>Mt().fitCanvasHeight??100}},emits:["toolbarButtonClick","toolbarToolClick","pick","resetQuery"],setup(r,{expose:e,emit:t}){var Jt,Qt,jt,ei,ti;const i=r,s=c.useAttrs(),o=t,{formConfig:n,pageConfig:a,columns:l,toolbarConfig:d,proxyConfig:u,config:f,staticConfig:g}=c.toRefs(i),m=Aa(),x=c.ref(De()),v=c.ref({}),p=c.computed(()=>({...i,config:{...m,...i.config}})),E=c.computed(()=>u.value&&u.value.ajax?a.value?"pagination":"list":"bad");c.computed(()=>E.value==="pagination"?{current:C.page,total:N.value,pageSize:C.size,responsive:!1,showSizeChanger:!0,showTotal:D=>`共${D}条数据`}:!1);const b=c.computed(()=>I.omit({labelCol:Ir,...n.value},["items"])),y=c.reactive({toolbar:!1,form:!1,table:!1}),C=c.reactive({page:1,size:((Jt=a.value)==null?void 0:Jt.pageSize)??10}),T=c.ref(0),N=c.ref(0),B=c.ref([]),R=c.ref(),_=c.ref(),S=c.ref(),O=c.ref(),w=c.ref(500),A=c.ref({}),$=D=>{A.value[C.page]=D},Y=c.reactive([...(((jt=(Qt=i.toolbarConfig)==null?void 0:Qt.buttons)==null?void 0:jt.map(D=>D.code))??[]).filter(D=>D),...(((ti=(ei=i.toolbarConfig)==null?void 0:ei.tools)==null?void 0:ti.map(D=>D.code))??[]).filter(D=>D)].reduce((D,F)=>(D[F]=!1,D),{})),V=(D,F)=>{Y[D]=F},P=D=>{I.isObject(D)?(Object.prototype.hasOwnProperty.call(D,"toolbar")&&(y.toolbar=D.toolbar),Object.prototype.hasOwnProperty.call(D,"form")&&(y.form=D.form),Object.prototype.hasOwnProperty.call(D,"table")&&(y.table=D.table)):I.isBoolean(D)&&(y.form=D,y.toolbar=D,y.table=D)},W=c.computed(()=>I.uniq(Object.values(A.value).flat(),D=>{var F;return D[((F=p.value.config)==null?void 0:F.ROW_KEY)??"id"]})),G=()=>{Ue()},q=c.computed(()=>W.value.map(D=>{var F;return D[((F=p.value.config)==null?void 0:F.ROW_KEY)??"id"]})),He=(D,F)=>F?{list:I.isString(F.list)?I.get(D,F.list):I.isFunction(F.list)?F.list(D):void 0,total:I.isString(F.total)?I.get(D,F.total):I.isFunction(F.total)?F.total(D):void 0,result:I.isString(F.result)?I.get(D,F.result):I.isFunction(F.result)?F.result(D):void 0,message:I.isString(F.message)?I.get(D,F.message):I.isFunction(F.message)?F.message(D):void 0}:{list:D},lt=D=>{o("toolbarButtonClick",{data:B.value,code:D,selectedKeys:q.value,records:W.value}),ht(D)},le=I.debounce(lt,100),Ge=({key:D})=>le(D),J=D=>{o("toolbarToolClick",{data:B.value,code:D,selectedKeys:q.value,records:W.value}),ht(D)},Bi=I.debounce(J,100),ge=()=>new Promise(D=>{if(E.value!=="bad"){P({table:!0,form:!0});const{ajax:F}=u.value;F.query({form:v.value,page:C}).then(U=>{const{list:Le,total:Be,result:ce,message:ve}=He(U,u.value.response);Le?(B.value=Le,T.value++):ce?(B.value=ce,N.value=Be??ce.length,T.value++):(B.value=[],T.value++,ve&&pi(ve)),D(B.value)}).catch(U=>{console.error("fetchData error",U),D([])}).finally(()=>{P({table:!1,form:!1})})}}),Fi=(D,F)=>(C.page=D,C.size=F,ge()),Ue=()=>(C.page=1,A.value={},ge()),ct=I.debounce(ge,160),Zt=(D,F)=>(Object.assign(v.value,D),C.page=1,F?Promise.resolve():ct()),Ki=(D,F)=>(v.value=D,C.page=1,F?Promise.resolve():ct()),ht=D=>{const{ajax:F}=u.value;switch(D){case"multiDelete":F.multiDelete&&(q.value.length>0?Pa({title:"警告",content:"确认删除选中的数据吗?"}).then(()=>{P({table:!0,toolbar:!0}),F.multiDelete(q.value).then(()=>{cC("删除成功"),Ue()}).catch(()=>{hC("删除失败")}).finally(()=>{P({table:!1,toolbar:!1}),Y.multiDelete=!1})}):pi("请选择要删除的数据"));break}},Pi=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]),qe=D=>{if(n.value&&n.value.items.length>0){if(n.value.customReset)n.value.customReset();else{const F={};$t(n.value.items,U=>{U.field&&U.itemRender?he(U.itemRender.defaultValue)?F[U.field]=U.itemRender.defaultValue:F[U.field]=void 0:U.field&&U.slots&&(he(U.slots.defaultValue)?F[U.field]=U.slots.defaultValue:F[U.field]=void 0)}),v.value=F}o("resetQuery")}C.page=1,D||ct()},dt=()=>(A.value={},qe()),Ze=()=>{var ce,ve;const D=(ce=S.value)==null?void 0:ce.parentElement,F=D?window.getComputedStyle(D).height:"0px",U=O.value?window.getComputedStyle(O.value).height:"0px",Le=U.includes("px")?I.toNumber(U.replace("px","")):0,Be=(ve=g.value)!=null&&ve.showCount?22:0;w.value=I.toNumber(F.replace("px",""))-i.fitHeight-(i.toolbarConfig?30:0)-Le-Be};let It;return c.onMounted(()=>{Ze(),window.addEventListener("resize",Ze),It=new MutationObserver(D=>{D.forEach(F=>{if(F.type==="attributes"&&F.attributeName==="style"){const U=F.target;window.getComputedStyle(U).display!=="none"&&Ze()}})}),S.value&&It.observe(S.value,{attributes:!0,attributeFilter:["style"]}),qe(i.manualFetch)}),c.onBeforeUnmount(()=>{window.removeEventListener("resize",Ze),It.disconnect()}),e({commitProxy:{query:ct,reload:dt,reloadPage:Ue,passQuery:Zt,forcePassQuery:Ki},$canvasTable:c.computed(()=>_.value),selectedRowKeys:q,setBtnLoading:V,selectedRecords:W,$form:c.computed(()=>R.value),getFormData:()=>v.value,setLoadings:P,resizeTable:Ze}),(D,F)=>{var ce,ve,Tt;const U=c.resolveComponent("a-menu-item"),Le=c.resolveComponent("a-menu"),Be=c.resolveComponent("a-dropdown");return c.openBlock(),c.createElementBlock("div",c.mergeProps({ref_key:"boxEl",ref:S,class:"h-full p-wrapper flex flex-col gap-8px overflow-y-auto"},c.unref(s)),[E.value==="bad"?(c.openBlock(),c.createElementBlock("div",Yb,"请检查配置")):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[(ve=(ce=c.unref(n))==null?void 0:ce.items)!=null&&ve.some(K=>K.field&&K.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:y.form},{default:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.unref(M.Form),c.mergeProps({key:x.value,ref_key:"formEl",ref:R,model:v.value},b.value,{onSubmit:G}),{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).items,(K,k)=>(c.openBlock(),c.createBlock(kr,{key:`_col_${K.field||k}`,"form-data":v.value,item:K,onReset:F[0]||(F[0]=L=>qe(i.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",Vb,[c.createElementVNode("div",Wb,[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,(K,k)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:k},[K.dropdowns&&K.dropdowns.length?(c.openBlock(),c.createBlock(Be,{key:0},{overlay:c.withCtx(()=>[c.createVNode(Le,{onClick:Ge},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(K.dropdowns,L=>(c.openBlock(),c.createBlock(U,{key:L.code},{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(L.content),1)]),_:2},1024))),128))]),_:2},1024)]),default:c.withCtx(()=>[c.createVNode(c.unref(M.Button),{type:K.type,size:K.size??"middle",disabled:c.unref(d).disabled||K.disabled,loading:y.toolbar||!!K.code&&Y[K.code],danger:K.danger,shape:K.shape,ghost:K.ghost,block:K.block},{default:c.withCtx(()=>[K.icon?(c.openBlock(),c.createBlock(c.unref(oe),{key:0,icon:K.icon},null,8,["icon"])):c.createCommentVNode("",!0),c.createTextVNode(" "+c.toDisplayString(K.content)+" ",1),c.createVNode(c.unref(xt.DownOutlined))]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block"])]),_:2},1024)):K.code?(c.openBlock(),c.createBlock(c.unref(M.Button),{key:1,type:K.type,size:K.size??"middle",disabled:c.unref(d).disabled||K.disabled,loading:y.toolbar||!!K.code&&Y[K.code],danger:K.danger,shape:K.shape,ghost:K.ghost,block:K.block,onClick:L=>c.unref(le)(K.code)},{default:c.withCtx(()=>[K.icon?(c.openBlock(),c.createBlock(c.unref(oe),{key:0,icon:K.icon},null,8,["icon"])):c.createCommentVNode("",!0),c.createTextVNode(" "+c.toDisplayString(K.content),1)]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block","onClick"])):(c.openBlock(),c.createElementBlock("div",Xb))],64))),128)):c.createCommentVNode("",!0)]),c.createElementVNode("span",zb,[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,(K,k)=>(c.openBlock(),c.createBlock(c.unref(M.Button),{key:k,type:K.type,size:K.size??"middle",disabled:c.unref(d).disabled||K.disabled,danger:K.danger,shape:K.shape,ghost:K.ghost,block:K.block,onClick:L=>c.unref(Bi)(K.code),loading:y.toolbar||!!K.code&&Y[K.code]},{default:c.withCtx(()=>[K.icon?(c.openBlock(),c.createBlock(c.unref(oe),{key:0,icon:K.icon},null,8,["icon"])):c.createCommentVNode("",!0),c.createTextVNode(" "+c.toDisplayString(K.content),1)]),_:2},1032,["type","size","disabled","danger","shape","ghost","block","onClick","loading"]))),128)):c.createCommentVNode("",!0)])])):c.createCommentVNode("",!0),c.createElementVNode("div",Gb,[(Tt=c.unref(g))!=null&&Tt.selectable&&c.unref(g).showCount?(c.openBlock(),c.createElementBlock("div",Ub," 已选:"+c.toDisplayString(q.value.length),1)):c.createCommentVNode("",!0),c.createVNode(Vr,{ref_key:"canvasTableRef",ref:_,columns:Pi.value,config:{...p.value.config,HEIGHT:w.value},data:B.value,loading:y.table,onSelectionChange:$},c.createSlots({_:2},[c.renderList(D.$slots,(K,k)=>({name:k,fn:c.withCtx(L=>[c.renderSlot(D.$slots,k,c.normalizeProps(c.guardReactiveProps(L)))])}))]),1032,["columns","config","data","loading"]),E.value==="pagination"?(c.openBlock(),c.createBlock(c.unref(M.Pagination),{key:1,class:"p-canvas-pagination",size:"small",current:C.page,"page-size":C.size,total:N.value,onChange:Fi},null,8,["current","page-size","total"])):c.createCommentVNode("",!0)])],64))],16)}}}),Wr=c.defineComponent({__name:"PGroupBlock",props:{getFormSetting:{type:Function},source:{}},setup(r,{expose:e}){const t=r,i=c.ref(),{source:s}=c.toRefs(t),o=c.computed(()=>{var a;return(a=i.value)==null?void 0:a.$form}),n=c.computed(()=>t.getFormSetting(s.value));return e({$form:o}),(a,l)=>(c.openBlock(),c.createBlock(Lr,c.mergeProps({ref_key:"formEl",ref:i},n.value,{data:c.unref(s)}),null,16,["data"]))}}),qb=c.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=c.ref(t.defaultCollapsed?[]:["content"]);return e({collapse:()=>{i.value=[]},expand:()=>{i.value=["content"]}}),(s,o)=>{const n=c.resolveComponent("a-collapse-panel"),a=c.resolveComponent("a-collapse"),l=c.resolveComponent("a-card");return s.collapsible?(c.openBlock(),c.createBlock(a,{key:0,"active-key":i.value,"onUpdate:activeKey":o[0]||(o[0]=d=>i.value=d),class:"collapsible-card"},{default:c.withCtx(()=>[c.createVNode(n,{key:"content","force-render":"",header:s.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:s.title},c.createSlots({_:2},[c.renderList(s.$slots,(d,u)=>({name:u,fn:c.withCtx(()=>[c.renderSlot(s.$slots,u)])}))]),1032,["title"]))}}}),al=c.defineComponent({__name:"PFormGroup",props:c.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=M.Form.useForm,i=c.ref(),s=r,o=c.ref(),n=c.useModel(r,"modelValue"),a=c.ref(0),l=c.ref([]),d=c.ref([]),u=R=>{a.value=R},f=c.computed(()=>s.max??1/0),g=R=>{(s.createItem??(()=>Promise.resolve({})))({list:n.value}).then(S=>{var O;n.value=[...n.value,{...S,__index:(((O=I.max(n.value,w=>w.__index??-1))==null?void 0:O.__index)??-1)+1}],a.value=R})},m=s.itemMenus??[{content:"复制",code:"copy"},{content:"删除",code:"delete"}],x=R=>{var _,S,O,w,A,$;return((A=(w=(O=(S=(_=R==null?void 0:R.parentElement)==null?void 0:_.parentElement)==null?void 0:S.parentElement)==null?void 0:O.parentElement)==null?void 0:w.parentElement)==null?void 0:A.parentElement)??(($=o.value)==null?void 0:$.$el)??document.body},v=c.computed(()=>s.forceRender||n.value.length<=5),p=R=>{var S;const _=(S=n.value.find((O,w)=>w===R))==null?void 0:S.__index;Z(_)&&(l.value=l.value.filter(O=>O!==_))},E=()=>{c.nextTick().then(()=>{var R,_;p(a.value),(_=(R=d.value[a.value])==null?void 0:R.$form)==null||_.validate()})},b=(R,_)=>{var S;return((S=s.getTabLabel)==null?void 0:S.call(s,R,_))??`${s.tabLabel} ${s.keepSerial?_+1:(R.__index??0)+1}`};c.watch(()=>n.value,()=>{if(!s.keepSerial){const R=n.value.filter(_=>!Z(_.__index));R.length>0&&R.forEach(_=>{var S;_.__index=(((S=I.max(n.value,O=>O.__index??-1))==null?void 0:S.__index)??-1)+1})}},{immediate:!0});const y=({key:R},_,S)=>{var O;if(s.menuHandler&&I.isFunction(s.menuHandler))s.menuHandler({code:I.toString(R),data:_,index:S});else switch(R){case"delete":n.value=n.value.filter((w,A)=>A!==S),c.nextTick(()=>{d.value=d.value.filter(w=>!!w),S<=a.value&&a.value>0&&a.value--});break;case"copy":if(n.value.length>=f.value){pi("已达到最大数量");return}n.value=[...n.value,I.clone({...I.omit(_,["id","__index"]),__index:(((O=I.max(n.value,w=>w.__index??-1))==null?void 0:O.__index)??-1)+1})];break}},C=I.debounce(y,100);c.watchEffect(()=>{n.value.length===0?a.value=0:a.value>=n.value.length&&(a.value=n.value.length-1)});const T=I.debounce(p,50);c.watchEffect(()=>{var S;const R=n.value.map((O,w)=>l.value.includes(O.__index)?w:void 0).filter(Z),_=(S=i.value)==null?void 0:S.$el;_&&_.querySelectorAll(":scope >.ant-tabs-nav>.ant-tabs-nav-wrap>.ant-tabs-nav-list>.ant-tabs-tab>.ant-tabs-tab-btn").forEach((w,A)=>{R.includes(A)?w.classList.add("p-error-group-tab"):w.classList.remove("p-error-group-tab")})}),e({collapse:()=>{var R,_;(_=(R=o.value)==null?void 0:R.collapse)==null||_.call(R)},expand:()=>{var R,_;(_=(R=o.value)==null?void 0:R.expand)==null||_.call(R)},activeKey:c.computed(()=>a.value),setActiveKey:u,validateAll:()=>{const R=v.value?d.value.map(_=>{var S;return(S=_.$form)==null?void 0:S.validate()}):n.value.map(_=>{var S;return((S=t(_,s.getFormSetting(_).rules))==null?void 0:S.validate())??Promise.resolve()});return Promise.allSettled(R).then(_=>{if(l.value=_.map((S,O)=>{var w;return S.status==="rejected"&&typeof((w=n.value[O])==null?void 0:w.__index)=="number"?n.value[O].__index:void 0}).filter(S=>typeof S=="number"),!s.lazyErrorMark&&l.value.length){const S=l.value[0],O=n.value.findIndex(w=>w.__index===S);O!==-1&&(a.value=O)}return l.value.length?Promise.reject({error_indexes:l.value,results:_}):Promise.resolve(_)})},validate:async(R,_)=>{var O,w,A;const S=n.value.findIndex($=>$.__index===R);try{return await(v.value?((w=(O=d.value[S])==null?void 0:O.$form)==null?void 0:w.validate())??Promise.resolve():((A=t(n.value[S],s.getFormSetting(n.value[S]).rules))==null?void 0:A.validate())??Promise.resolve()),l.value=l.value.filter($=>$!==R),Promise.resolve()}catch($){return!l.value.includes(R)&&!_&&(l.value=[...l.value,R]),Promise.reject($)}},validateFields:async(R,_,S)=>{var Y,V;const O=n.value.findIndex(P=>P.__index===R),A=s.getFormSetting(n.value[O]).rules,$=t(n.value[O],A);try{return await(v.value?((V=(Y=d.value[O])==null?void 0:Y.$form)==null?void 0:V.validateFields(_))??Promise.resolve():Promise.allSettled(_.map(P=>$.validateField(P,n.value[O][P],A[P]??[])))),Promise.resolve()}catch(P){return!l.value.includes(R)&&!S&&(l.value=[...l.value,R]),Promise.reject(P)}}});const N=c.useSlots(),B=c.computed(()=>Object.keys(N).filter(R=>R.startsWith("group-")).map(R=>({original:R,target:R.replace("group-","")})));return(R,_)=>{const S=c.resolveComponent("a-spin");return c.openBlock(),c.createBlock(qb,{ref_key:"rootRef",ref:o,title:R.title,size:"small",collapsible:R.collapsible,"default-collapsed":R.defaultCollapsed},c.createSlots({default:c.withCtx(()=>[R.loading?(c.openBlock(),c.createBlock(S,{key:0,class:"w-full"})):(c.openBlock(),c.createBlock(c.unref(M.Tabs),{key:1,ref_key:"tabsRef",ref:i,type:"editable-card",activeKey:a.value,"onUpdate:activeKey":_[1]||(_[1]=O=>a.value=O),"hide-add":"",onChange:E},{rightExtra:c.withCtx(()=>[c.renderSlot(R.$slots,"rightExtra",{},()=>[R.showAdd&&n.value.length<f.value?(c.openBlock(),c.createBlock(c.unref(M.Button),{key:0,type:"link",onClick:_[0]||(_[0]=O=>g(n.value.length))},{default:c.withCtx(()=>_[2]||(_[2]=[c.createTextVNode(" + 新增 ",-1)])),_:1,__:[2]})):c.createCommentVNode("",!0)])]),default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(n.value,(O,w)=>(c.openBlock(),c.createBlock(c.unref(M.TabPane),{key:w,tab:b(O,w),"force-render":v.value},{closeIcon:c.withCtx(()=>{var A;return[R.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:$=>c.unref(C)($,O,w)},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(m).filter($=>{var Y;return((Y=$.visibleMethod)==null?void 0:Y.call($,{data:O,index:w}))??!0}),$=>(c.openBlock(),c.createBlock(c.unref(M.MenuItem),{key:$.code},{default:c.withCtx(()=>[c.createElementVNode("div",null,c.toDisplayString($.content),1)]),_:2},1024))),128))]),_:2},1032,["onClick"])]),default:c.withCtx(()=>[c.createVNode(c.unref(xt.MoreOutlined))]),_:2},1024)):c.createCommentVNode("",!0)]}),default:c.withCtx(()=>[(c.openBlock(),c.createBlock(Wr,{ref_for:!0,ref_key:"blockInstance",ref:d,key:w,source:O,"get-form-setting":R.getFormSetting,onFocusCapture:A=>c.unref(T)(w),onClickCapture:A=>c.unref(T)(w)},null,8,["source","get-form-setting","onFocusCapture","onClickCapture"]))]),_:2},1032,["tab","force-render"]))),128))]),_:3},8,["activeKey"]))]),_:2},[c.renderList(B.value,O=>({name:O.target,fn:c.withCtx(()=>[c.renderSlot(R.$slots,O.original)])}))]),1032,["title","collapsible","default-collapsed"])}}}),Zb={class:"w-full text-right p-2"},ll=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(r,{expose:e}){const t=c.ref(),i=c.ref(!1),s=r,o=c.computed(()=>{var x;return(x=s.gridSetting.selectConfig)==null?void 0:x.multiple});let n,a,l;const d=c.reactive({modal:!1}),u=()=>{l&&l()},f=()=>{d.modal=!1,l&&l()},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?pi("请选择数据"):s.beforePick(x).then(()=>{d.modal=!1,a(x)})};return c.onMounted(()=>{}),e({pick:()=>new Promise((x,v)=>{n=x,l=v,i.value=!1,d.modal=!0,c.nextTick(()=>{i.value=!0})}),pickMultiple:()=>new Promise((x,v)=>{a=x,l=v,i.value=!1,d.modal=!0,c.nextTick(()=>{i.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:x.title,width:x.width,footer:o.value?void 0:null,onCancel:u,"body-style":x.bodyStyle},c.createSlots({default:c.withCtx(()=>[c.createElementVNode("div",{style:c.normalizeStyle({minHeight:i.value?"unset":"642px"})},[c.createVNode(Dr,c.mergeProps(x.gridSetting,{ref_key:"gridEl",ref:t,onPick:g}),null,16)],4)]),_:2},[o.value?{name:"footer",fn:c.withCtx(()=>[c.createElementVNode("div",Zb,[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,__:[1]}),c.createVNode(c.unref(M.Button),{type:"primary",onClick:m},{default:c.withCtx(()=>v[2]||(v[2]=[c.createTextVNode(" 确定 ",-1)])),_:1,__:[2]})])])]),key:"0"}:void 0]),1032,["open","title","width","footer","body-style"]))}});function cl(r){r&&Ma(r)}const Jb={install(r){r.component("PForm",Lr),r.component("PGrid",Dr),r.component("PCanvasTable",Vr),r.component("PCanvasGrid",nl),r.component("PFormGroup",al),r.component("PGroupBlock",Wr),r.component("PromisePicker",ll)},addFormatter:Ha,addRender:Or,setup:cl};exports.PCanvasGrid=nl;exports.PCanvasTable=Vr;exports.PForm=Lr;exports.PFormGroup=al;exports.PGrid=Dr;exports.PGroupBlock=Wr;exports.PromisePicker=ll;exports.addFormatter=Ha;exports.addRender=Or;exports.cleanCol=Mi;exports.default=Jb;exports.defaultItemResponsive=Sr;exports.defaultLabelCol=Ir;exports.get24rest=Na;exports.getButtonResponsive=J2;exports.getUIKitConfig=U2;exports.labelColDict=Z2;exports.resetUIKitConfig=q2;exports.setUIKitConfig=Ma;exports.setup=cl;exports.watchPreviousDeep=Tr;
4
+ `);for(const a of o){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 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:l="#495060",maxLineClamp:d=1,cacheTextKey:u=""}=i;this.ctx.save(),this.ctx.font=o,this.ctx.fillStyle=l,this.ctx.textAlign=a;const f=parseInt(((s=o.match(/\d+/))==null?void 0:s[0])||"12"),g=f*(i.lineHeight||1.2),m=t-n*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+n*2),Math.floor(f+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 l=this.ctx.measureText(e).width,d=t-i*2;if(l&&l>=d){o=!0;let u=0;for(let f=0;f<e.length;f++)if(u+=this.ctx.measureText(e[f]).width,u>=d-a){n=e.slice(0,f)+"...",o=!0;break}}return this.ctx.restore(),{_text:n,ellipsis:o}}}class Io{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,"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,"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,"REMEMBER_MAX_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=SC(i);s&&(e[t]=s)}}),Object.assign(this,e,this._config)}}const Ga='<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>',To='<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>',Oo='<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>',Ar='<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>',$C=Ar.replace('fill="currentColor" p-id="2016"','fill="#bec4c7" p-id="2016"'),MC=Ar.replace('fill="currentColor" p-id="2015"','fill="#bec4c7" p-id="2015"');class AC{constructor(e){h(this,"ctx"),h(this,"list",[{name:"loading",configName:"LOADING_ICON_SVG",configColorName:"LOADING_ICON_COLOR",svg:'<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>',color:"#4E5969"},{name:"expand",configName:"EXPAND_ICON_SVG",configColorName:"EXPAND_ICON_COLOR",svg:Ga,color:"#4E5969"},{name:"shrink",configName:"SHRINK_ICON_SVG",configColorName:"SHRINK_ICON_COLOR",svg:Oo,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:To,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:To,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:Oo,color:"#4E5969"},{name:"sort-asc",configName:"SORT_ASC_ICON_SVG",configColorName:"SORT_ICON_COLOR",svg:$C,color:"rgb(82,146,247)"},{name:"sort-desc",configName:"SORT_DESC_ICON_SVG",configColorName:"SORT_ICON_COLOR",svg:MC,color:"rgb(82,146,247)"},{name:"sort-default",configName:"SORTABLE_ICON_SVG",svg:Ar,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 l=a.getAttribute("fill");(l==="currentColor"||l===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,l)=>{o.onerror=()=>l(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 lr extends za{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=Ya(),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 n=e,{backgroundColor:a,color:l,font:d}=n({colIndex:this.colIndex,column:this.column})||{};a&&(s=a),l&&(o=l),d&&(this.drawTextFont=d)}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 l=this.ctx.icons.get("checkbox-uncheck"),d="checkbox-uncheck";e?(l=this.ctx.icons.get("checkbox-indeterminate"),d="checkbox-indeterminate"):t&&i?(l=this.ctx.icons.get("checkbox-check"),d="checkbox-check"):t&&!i?(l=this.ctx.icons.get("checkbox-check-disabled"),d="checkbox-check-disabled"):!t&&i?(l=this.ctx.icons.get("checkbox-uncheck"),d="checkbox-uncheck"):(l=this.ctx.icons.get("checkbox-disabled"),d="checkbox-disabled"),l&&(this.drawSelectionImageX=n,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 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 NC{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(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.focusCell=void 0,this.ctx.emit("cellHeaderMousedown",n,e)}),this.handleBodyEvent(o,s,this.ctx.body.renderRows,n=>{this.ctx.setFocusCell(n),this.ctx.focusCellHeader=void 0,this.ctx.emit("cellMousedown",n,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 lr)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: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: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 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:i,offsetX:s}=this.ctx.getOffset(t),o=i,n=s;if(e instanceof lr){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 Mr){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 l of a){const d=l.getDrawX(),u=l.getDrawY();if(o){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,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 l of a){const d=l.getDrawX(),u=l.getDrawY();if(o){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 HC{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,"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,"database"),h(this,"history"),h(this,"config");const{containerElement:i,stageElement:s,canvasElement:o,overlayerElement:n,editorElement:a,emptyElement:l,loadingElement:d,contextMenuElement:u}=e;this.containerElement=i,s.tabIndex=0,this.stageElement=s,this.canvasElement=o,this.overlayerElement=n,this.editorElement=a,this.emptyElement=l,this.loadingElement=d,this.contextMenuElement=u,this.config=new Io(t.config||{}),this.eventBus=new LC,this.eventBrowser=new kC(this),this.eventTable=new NC(this),this.paint=new DC(this.canvasElement),this.database=new TC(this,t),this.history=new OC(this),this.icons=new AC(this)}setConfig(e){this.config=new Io(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:l}=a.getSpanInfo(),d=l.map(u=>({...u,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 l=this.database.getVirtualBodyCell(n,a);if(l){const{dataList:d}=l.getSpanInfo(),u=d.map(f=>({...f,value:o.value}));s.push(...u)}}),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 l=o+t[0],d=a+i[0],u=this.database.getVirtualBodyCell(l,d);u&&(u.selectorCellValueType==="displayText"?n.push(u.displayText):n.push(u.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 ko{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 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,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,l=s,d=i,u=t.height,f=t.width,g=e.height,m=this.ctx.footer.height;if(this.type==="vertical"){this.visibleDistance=d-o-u,this.distance=g-this.visibleDistance+m,this.trackX=l-o,this.trackY=0,this.splitPoints=[this.trackX,u,this.trackX+o,u],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=u+this.scroll/this.distance*(this.visibleDistance-this.barHeight),this.scroll=Math.max(0,Math.min(this.scroll,this.distance))}else{this.visibleDistance=l-o,this.distance=f-this.visibleDistance,this.splitPoints=[l-o,d-o,l-o,d];const x=a?0:.5;this.trackX=0,this.trackY=d-o+x,this.trackWidth=l,this.trackHeight=o;const v=this.distance?this.visibleDistance/f: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 BC{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 ko(e,"vertical"),this.horizontalScrollbar=new ko(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("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&&i.x>t.visibleWidth/2&&this.setScrollX(i.x-t.visibleWidth/2)}scrollToRowIndex(e){const{body:t,database:i}=this.ctx,{top:s}=i.getPositionForRowIndex(e);s>t.visibleHeight&&this.setScrollY(s-t.visibleHeight/2)}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 l=10*(n==="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 FC{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 f=o[this.childrenKey];f.splice(n,1),f.length===0&&delete o[this.childrenKey]}else this.root.splice(n,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;i==="before"?d?d[this.childrenKey].splice(u,0,a):this.root.splice(u,0,a):i==="after"&&(d?d[this.childrenKey].splice(u+1,0,a):this.root.splice(u+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 KC{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",$r(()=>{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 f=this.ctx.database.getColumns();this.columns=f}this.allCellHeaders=[],this.leafCellHeaders=[],this.fixedLeftCellHeaders=[],this.fixedRightCellHeaders=[],this.centerCellHeaders=[],this.visibleColumns=Va(this.columns);const s=fi(this.visibleColumns),o=Nt(this.visibleColumns);this.height=t*s,this.visibleHeight=this.height,this.width=o.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 n=yC(gi(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 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,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),l=n,d=a,u=o.getDrawX(),f=o.getDrawY();if(l>u+o.width-5&&l<u+o.width+4&&l<t-4&&d>f){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<u+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,u={})=>(d.forEach((f,g)=>{f.children&&e(f.children,u),u[f.key]=g}),u),t=this.ctx.database.getColumns(),i=gi(t,fi(t)),s=new FC(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 l={source:this.dragTarget,target:this.dragingCell,columns:i};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: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 l=a.width||100;a.width=l+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:gi(e,fi(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],l=o*(a.rowspan||0),d=o*(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=Nt(a.children).reduce((x,v)=>x+((v==null?void 0:v.width)||100),0));const m=new lr(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:i,RESIZE_COLUMN_TEXT_BG_COLOR:s,ENABLE_RESIZE_COLUMN_TEXT:o}}=this.ctx,n=this.resizeTarget.getDrawX(),a=this.resizeTarget.width,l=n+a+this.resizeDiff-.5,d=[l-.5,0,l-.5,e];if(this.ctx.paint.drawLine(d,{borderColor:t}),o){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: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 l=s,d=o;a>this.dragTarget.colIndex&&(l=s+n),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: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 l=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(l,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 Ua{constructor(e,t,i=0,s=0,o=0,n=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=i,this.y=s,this.width=o,this.height=n,this.rowIndex=t,this.rowKey=e.database.getRowKeyForRowIndex(t)||"",this.rowType=l,this.data=a,this.update()}update(){const{header:e}=this.ctx,t=[],i=[],s=[],o=[];e.renderLeafCellHeaders.forEach(n=>{const a=new Mr(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=>t.getAutoHeight());this.calculatedHeight=e.length?Math.max(...e):-1}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 PC{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: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"&&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=l:!this.data.length&&a&&(this.height=a-t.height-v-n);let p=this.height+t.height+n;p+=v;let E=p;const b=window.innerHeight,{top:y}=this.containerRect||this.ctx.containerElement.getBoundingClientRect();if(b>y&&u&&!a){const O=b-y-f;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 C=this.ctx.stageHeight-t.height-n;o?this.visibleHeight=C-v:this.visibleHeight=C,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 T=window.devicePixelRatio||1,N=this.ctx.stageWidth*T,B=this.ctx.stageHeight*T;e.width=Math.round(N),e.height=Math.round(B);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:l+v});const _=Math.round(e.width/T*1e4)/1e4,S=Math.round(e.height/T*1e4)/1e4;this.ctx.canvasElement.setAttribute("style",`height:${S}px;width:${_}px;`),this.ctx.paint.scale(T)}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:l,config:{RESIZE_ROW_MIN_HEIGHT:d=0}}=this.ctx;if(this.isResizing&&this.resizeTarget){const u=this.resizeTarget.height;let f=n-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(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 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];o>m.drawX+10&&o<m.drawX+m.width-10&&m.rowspan===1&&(this.ctx.stageElement.style.cursor="row-resize",this.resizeTarget=f)}}}})}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 l=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(l,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 l=this.binarySearch(a,o),d=this.binarySearch(a,o+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=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 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 Ua(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(i=>i.calculatedHeightCells.length>0))return;e.forEach(i=>{i.updateCalculatedHeight()});const t=e.map(i=>({height:i.calculatedHeight,rowIndex:i.rowIndex}));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 YC{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 l=this.y;if(this.ctx.config.FOOTER_FIXED||(l=this.y-this.ctx.scrollY),i>0&&e!==0&&this.ctx.paint.drawShadow(this.x,l,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,l,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 Ua(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 VC{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",$r(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){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: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[E,b]=o,[y,C]=n;if(E<m||b>x||y<v||C>p)return;if(this.ctx.config.ENABLE_MERGE_CELL_LINK){const N=this.adjustMergeCells(o,n);y=N.yArr[0],C=N.yArr[1],E=N.xArr[0],b=N.xArr[1],this.ctx.onlyMergeCell=N.onlyMergeCell}E===b&&y===C?this.ctx.selectOnlyOne=!0:this.ctx.selectOnlyOne=!1,o=[Math.max(m,E),Math.min(x,b)],n=[Math.max(v,y),Math.min(p,C)];const{BEFORE_SET_SELECTOR_METHOD:T}=this.ctx.config;if(typeof T=="function"){const N=T({focusCell:this.ctx.focusCell,xArr:o,yArr:n});if(!N)return;o=N.xArr,n=N.yArr}this.ctx.selector.xArr=o,this.ctx.selector.yArr=n,C===this.ctx.maxRowIndex&&y===0?this.ctx.selectColsIng=!0:this.ctx.selectColsIng=!1,b===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 l=[],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],b=p+e[0],y=this.ctx.database.getVirtualBodyCell(E,b);y&&((E===s||E===o)&&l.push(y),(b===n||b===a)&&d.push(y))}const u=l.reduce((v,p)=>{const{yArr:E}=p.getSpanInfo(),[b,y]=E;return v.minY=Math.min(v.minY,b),v.maxY=Math.max(v.maxY,y),v},{minY:s,maxY:o}),f=d.reduce((v,p)=>{const{xArr:E}=p.getSpanInfo(),[b,y]=E;return v.minX=Math.min(v.minX,b),v.maxX=Math.max(v.maxX,y),v},{minX:n,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=(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 l=[a,e.colIndex+e.colspan-1],d=[o,n];this.setSelector(l,d)}else{const l=[e.colIndex,a+e.colspan-1],d=[o,n];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: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:l}=this.ctx.config,d=i,u=s||this.ctx.maxColIndex-a,f=o,g=n||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: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 l=[a,n],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,n],u=[l,e.rowIndex];this.setSelector(d,u)}else{const d=[a,n],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: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),l=Math.min(i.rowIndex,s),d=Math.max(i.rowIndex,s),u=[n,a],f=[l,d];this.setSelector(u,f)}}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,l=Math.min(n,s),d=Math.max(n,s),u=Math.min(a,o),f=Math.max(a,o),g=[l,d],m=[u,f];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=bC(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 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)||(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(l=>{a.push(this.ctx.database.getRowDataItemForRowKey(l))}),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=CC(o);const a=[i,i+n[0].length-1],l=[t,t+n.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:n});const v=n.length===1&&n[0].length===1;if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(a,l)&&!v){const y={code:"ERR_MERGED_CELLS_PASTE",message:"Merged cells cannot span paste data"};this.ctx.hasEvent("error")?this.ctx.emit("error",y):alert(y.message);return}let p=[];for(let y=0;y<=n.length-1;y++){const C=n[y].length;for(let T=0;T<=C-1;T++){const N=y+t,B=T+i,R=n[y][T],_=this.ctx.database.getItemValueForRowIndexAndColIndex(N,B);if(_){const{rowKey:S,key:O}=_;this.ctx.database.getReadonly(S,O)||(s.add(S),p.push({rowKey:S,key:O,value:R,row:{}}))}}}if(this.isCut){const y=this.clearSelectedData(this.ctx.selector.xArrCopy,this.ctx.selector.yArrCopy,!0),C=p.map(T=>`${T.rowKey}-${T.key}`);y.forEach(T=>{C.includes(`${T.rowKey}-${T.key}`)||p.unshift(T)}),this.isCut=!1}if(!p.length)return;const{BEFORE_PASTE_DATA_METHOD:E}=this.ctx.config;if(typeof E=="function"){const y=E,C=p.map(T=>({rowKey:T.rowKey,key:T.key,value:T.value,oldValue:this.ctx.database.getItemValue(T.rowKey,T.key),row:this.ctx.database.getRowDataItemForRowKey(T.rowKey)}));if(p=await y(C,a,l,n),p&&!p.length)return}this.clearCopyLine(),this.ctx.batchSetItemValueByEditor(p,!0);let b=[];s.forEach(y=>{b.push(this.ctx.database.getRowDataItemForRowKey(y))}),this.ctx.emit("pasteChange",p,b),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,l=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<l&&s++;break}const d=[i,i],u=[s,s],f=this.getCell(s,i);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: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:l}=this.ctx.config,d=i,u=s||this.ctx.maxColIndex-a,f=o,g=n||this.ctx.maxRowIndex-l;return!(t<d||t>u||e<f||e>g)}adjustBoundaryPosition(){const{stageHeight:e,stageWidth:t,focusCell:i,fixedRightWidth:s,fixedLeftWidth:o,header:n,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(!i)return;x&&this.ctx.onlyMergeCell&&i.updateSpanInfo();const{drawX:v,drawY:p,width:E,height:b,fixed:y}=i,C=o-v+1,T=i.drawX+E-(t-s)+1;let N=n.height-p,B=b;B>l.visibleHeight&&(B=l.visibleHeight);let R=0;g&&(m==="top"?N=n.height+a.height-p:R=a.visibleHeight);const _=p+B-(e-R-f);let S=d,O=u;T>0&&!y?S=Math.floor(d+T):C>0&&!y&&(S=Math.floor(d-C)),N>0?O=Math.floor(u-N):_>0&&(O=Math.floor(u+_)),(Math.abs(d-S)>2||Math.abs(u-O)>2)&&(this.ctx.adjustPositioning=!0,this.ctx.emit("adjustBoundaryPosition",i),this.ctx.setScroll(S,O))}destroy(){}}class WC{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:l,height:d}=this.maxColRowCell,u=6,f=s===this.ctx.maxColIndex||o===this.ctx.maxRowIndex?0:2,g=n+l-u+f,m=a+d-u+f;t>g&&i>m&&t<g+u&&i<m+u&&(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 l=this.ctx.selector.xArr,d=this.ctx.selector.yArr;if(!(!o&&JSON.stringify(d)!==JSON.stringify(a))&&!(!s&&JSON.stringify(l)!==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: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,E=f||this.ctx.maxColIndex-x,b=g,y=m||this.ctx.maxRowIndex-v;let[C,T]=n,[N,B]=a;if(C<p||N<b)return;n=[Math.max(p,C),Math.min(E,T)],a=[Math.max(b,N),Math.min(y,B)];const{BEFORE_SET_AUTOFILL_METHOD:R}=this.ctx.config;if(typeof R=="function"){const _=R({focusCell:this.ctx.focusCell,xArr:n,yArr:a});if(!_)return;n=_.xArr,a=_.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,l=this.ctx.autofill.yArr,d=o===1&&n===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],E=s[m%n][x%o],b=this.ctx.database.getItemValueForRowIndexAndColIndex(p,v),y=`${p}-${v}`;if(b&&!i.has(y)){const{rowKey:C,key:T}=b;this.ctx.database.getReadonly(C,T)||(e.add(C),u.push({rowKey:C,key:T,value:E,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: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 wt=Math.min,it=Math.max,wi=Math.round,ui=Math.floor,Re=r=>({x:r,y:r}),XC={left:"right",right:"left",bottom:"top",top:"bottom"},zC={start:"end",end:"start"};function cr(r,e,t){return it(r,wt(e,t))}function Gt(r,e){return typeof r=="function"?r(e):r}function rt(r){return r.split("-")[0]}function Ut(r){return r.split("-")[1]}function qa(r){return r==="x"?"y":"x"}function Nr(r){return r==="y"?"height":"width"}const GC=new Set(["top","bottom"]);function Ye(r){return GC.has(rt(r))?"y":"x"}function Hr(r){return qa(Ye(r))}function UC(r,e,t){t===void 0&&(t=!1);const i=Ut(r),s=Hr(r),o=Nr(s);let n=s==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(n=yi(n)),[n,yi(n)]}function qC(r){const e=yi(r);return[hr(r),e,hr(e)]}function hr(r){return r.replace(/start|end/g,e=>zC[e])}const Lo=["left","right"],Do=["right","left"],ZC=["top","bottom"],JC=["bottom","top"];function QC(r,e,t){switch(r){case"top":case"bottom":return t?e?Do:Lo:e?Lo:Do;case"left":case"right":return e?ZC:JC;default:return[]}}function jC(r,e,t,i){const s=Ut(r);let o=QC(rt(r),t==="start",i);return s&&(o=o.map(n=>n+"-"+s),e&&(o=o.concat(o.map(hr)))),o}function yi(r){return r.replace(/left|right|bottom|top/g,e=>XC[e])}function eb(r){return{top:0,right:0,bottom:0,left:0,...r}}function Za(r){return typeof r!="number"?eb(r):{top:r,right:r,bottom:r,left:r}}function Ei(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 $o(r,e,t){let{reference:i,floating:s}=r;const o=Ye(e),n=Hr(e),a=Nr(n),l=rt(e),d=o==="y",u=i.x+i.width/2-s.width/2,f=i.y+i.height/2-s.height/2,g=i[a]/2-s[a]/2;let m;switch(l){case"top":m={x:u,y:i.y-s.height};break;case"bottom":m={x:u,y:i.y+i.height};break;case"right":m={x:i.x+i.width,y:f};break;case"left":m={x:i.x-s.width,y:f};break;default:m={x:i.x,y:i.y}}switch(Ut(e)){case"start":m[n]-=g*(t&&d?-1:1);break;case"end":m[n]+=g*(t&&d?-1:1);break}return m}const tb=async(r,e,t)=>{const{placement:i="bottom",strategy:s="absolute",middleware:o=[],platform:n}=t,a=o.filter(Boolean),l=await(n.isRTL==null?void 0:n.isRTL(e));let d=await n.getElementRects({reference:r,floating:e,strategy:s}),{x:u,y:f}=$o(d,i,l),g=i,m={},x=0;for(let v=0;v<a.length;v++){const{name:p,fn:E}=a[v],{x:b,y,data:C,reset:T}=await E({x:u,y:f,initialPlacement:i,placement:g,strategy:s,middlewareData:m,rects:d,platform:n,elements:{reference:r,floating:e}});u=b??u,f=y??f,m={...m,[p]:{...m[p],...C}},T&&x<=50&&(x++,typeof T=="object"&&(T.placement&&(g=T.placement),T.rects&&(d=T.rects===!0?await n.getElementRects({reference:r,floating:e,strategy:s}):T.rects),{x:u,y:f}=$o(d,g,l)),v=-1)}return{x:u,y:f,placement:g,strategy:s,middlewareData:m}};async function Ja(r,e){var t;e===void 0&&(e={});const{x:i,y:s,platform:o,rects:n,elements:a,strategy:l}=r,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:g=!1,padding:m=0}=Gt(e,r),x=Za(m),v=a[g?f==="floating"?"reference":"floating":f],p=Ei(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:u,strategy:l})),E=f==="floating"?{x:i,y:s,width:n.floating.width,height:n.floating.height}:n.reference,b=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),y=await(o.isElement==null?void 0:o.isElement(b))?await(o.getScale==null?void 0:o.getScale(b))||{x:1,y:1}:{x:1,y:1},C=Ei(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:E,offsetParent:b,strategy:l}):E);return{top:(p.top-C.top+x.top)/y.y,bottom:(C.bottom-p.bottom+x.bottom)/y.y,left:(p.left-C.left+x.left)/y.x,right:(C.right-p.right+x.right)/y.x}}const ib=r=>({name:"arrow",options:r,async fn(e){const{x:t,y:i,placement:s,rects:o,platform:n,elements:a,middlewareData:l}=e,{element:d,padding:u=0}=Gt(r,e)||{};if(d==null)return{};const f=Za(u),g={x:t,y:i},m=Hr(s),x=Nr(m),v=await n.getDimensions(d),p=m==="y",E=p?"top":"left",b=p?"bottom":"right",y=p?"clientHeight":"clientWidth",C=o.reference[x]+o.reference[m]-g[m]-o.floating[x],T=g[m]-o.reference[m],N=await(n.getOffsetParent==null?void 0:n.getOffsetParent(d));let B=N?N[y]:0;(!B||!await(n.isElement==null?void 0:n.isElement(N)))&&(B=a.floating[y]||o.floating[x]);const R=C/2-T/2,_=B/2-v[x]/2-1,S=wt(f[E],_),O=wt(f[b],_),w=S,A=B-v[x]-O,$=B/2-v[x]/2+R,Y=cr(w,$,A),V=!l.arrow&&Ut(s)!=null&&$!==Y&&o.reference[x]/2-($<w?S:O)-v[x]/2<0,P=V?$<w?$-w:$-A:0;return{[m]:g[m]+P,data:{[m]:Y,centerOffset:$-Y-P,...V&&{alignmentOffset:P}},reset:V}}}),rb=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:l,elements:d}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:g,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:v=!0,...p}=Gt(r,e);if((t=o.arrow)!=null&&t.alignmentOffset)return{};const E=rt(s),b=Ye(a),y=rt(a)===a,C=await(l.isRTL==null?void 0:l.isRTL(d.floating)),T=g||(y||!v?[yi(a)]:qC(a)),N=x!=="none";!g&&N&&T.push(...jC(a,v,x,C));const B=[a,...T],R=await Ja(e,p),_=[];let S=((i=o.flip)==null?void 0:i.overflows)||[];if(u&&_.push(R[E]),f){const $=UC(s,n,C);_.push(R[$[0]],R[$[1]])}if(S=[...S,{placement:s,overflows:_}],!_.every($=>$<=0)){var O,w;const $=(((O=o.flip)==null?void 0:O.index)||0)+1,Y=B[$];if(Y&&(!(f==="alignment"&&b!==Ye(Y))||S.every(P=>Ye(P.placement)===b?P.overflows[0]>0:!0)))return{data:{index:$,overflows:S},reset:{placement:Y}};let V=(w=S.filter(P=>P.overflows[0]<=0).sort((P,W)=>P.overflows[1]-W.overflows[1])[0])==null?void 0:w.placement;if(!V)switch(m){case"bestFit":{var A;const P=(A=S.filter(W=>{if(N){const G=Ye(W.placement);return G===b||G==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(G=>G>0).reduce((G,q)=>G+q,0)]).sort((W,G)=>W[1]-G[1])[0])==null?void 0:A[0];P&&(V=P);break}case"initialPlacement":V=a;break}if(s!==V)return{reset:{placement:V}}}return{}}}},sb=new Set(["left","top"]);async function ob(r,e){const{placement:t,platform:i,elements:s}=r,o=await(i.isRTL==null?void 0:i.isRTL(s.floating)),n=rt(t),a=Ut(t),l=Ye(t)==="y",d=sb.has(n)?-1:1,u=o&&l?-1:1,f=Gt(e,r);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 nb=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,l=await ob(e,r);return n===((t=a.offset)==null?void 0:t.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:s+l.x,y:o+l.y,data:{...l,placement:n}}}}},ab=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:b}=p;return{x:E,y:b}}},...l}=Gt(r,e),d={x:t,y:i},u=await Ja(e,l),f=Ye(rt(s)),g=qa(f);let m=d[g],x=d[f];if(o){const p=g==="y"?"top":"left",E=g==="y"?"bottom":"right",b=m+u[p],y=m-u[E];m=cr(b,m,y)}if(n){const p=f==="y"?"top":"left",E=f==="y"?"bottom":"right",b=x+u[p],y=x-u[E];x=cr(b,x,y)}const v=a.fn({...e,[g]:m,[f]:x});return{...v,data:{x:v.x-t,y:v.y-i,enabled:{[g]:o,[f]:n}}}}}};function Ai(){return typeof window<"u"}function It(r){return Qa(r)?(r.nodeName||"").toLowerCase():"#document"}function le(r){var e;return(r==null||(e=r.ownerDocument)==null?void 0:e.defaultView)||window}function ke(r){var e;return(e=(Qa(r)?r.ownerDocument:r.document)||window.document)==null?void 0:e.documentElement}function Qa(r){return Ai()?r instanceof Node||r instanceof le(r).Node:!1}function pe(r){return Ai()?r instanceof Element||r instanceof le(r).Element:!1}function Se(r){return Ai()?r instanceof HTMLElement||r instanceof le(r).HTMLElement:!1}function Mo(r){return!Ai()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof le(r).ShadowRoot}const lb=new Set(["inline","contents"]);function qt(r){const{overflow:e,overflowX:t,overflowY:i,display:s}=we(r);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!lb.has(s)}const cb=new Set(["table","td","th"]);function hb(r){return cb.has(It(r))}const db=[":popover-open",":modal"];function Ni(r){return db.some(e=>{try{return r.matches(e)}catch{return!1}})}const ub=["transform","translate","scale","rotate","perspective"],fb=["transform","translate","scale","rotate","perspective","filter"],gb=["paint","layout","strict","content"];function Br(r){const e=Fr(),t=pe(r)?we(r):r;return ub.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)||fb.some(i=>(t.willChange||"").includes(i))||gb.some(i=>(t.contain||"").includes(i))}function vb(r){let e=We(r);for(;Se(e)&&!yt(e);){if(Br(e))return e;if(Ni(e))return null;e=We(e)}return null}function Fr(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const mb=new Set(["html","body","#document"]);function yt(r){return mb.has(It(r))}function we(r){return le(r).getComputedStyle(r)}function Hi(r){return pe(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function We(r){if(It(r)==="html")return r;const e=r.assignedSlot||r.parentNode||Mo(r)&&r.host||ke(r);return Mo(e)?e.host:e}function ja(r){const e=We(r);return yt(e)?r.ownerDocument?r.ownerDocument.body:r.body:Se(e)&&qt(e)?e:ja(e)}function Ht(r,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const s=ja(r),o=s===((i=r.ownerDocument)==null?void 0:i.body),n=le(s);if(o){const a=dr(n);return e.concat(n,n.visualViewport||[],qt(s)?s:[],a&&t?Ht(a):[])}return e.concat(s,Ht(s,[],t))}function dr(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function el(r){const e=we(r);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const s=Se(r),o=s?r.offsetWidth:t,n=s?r.offsetHeight:i,a=wi(t)!==o||wi(i)!==n;return a&&(t=o,i=n),{width:t,height:i,$:a}}function Kr(r){return pe(r)?r:r.contextElement}function xt(r){const e=Kr(r);if(!Se(e))return Re(1);const t=e.getBoundingClientRect(),{width:i,height:s,$:o}=el(e);let n=(o?wi(t.width):t.width)/i,a=(o?wi(t.height):t.height)/s;return(!n||!Number.isFinite(n))&&(n=1),(!a||!Number.isFinite(a))&&(a=1),{x:n,y:a}}const xb=Re(0);function tl(r){const e=le(r);return!Fr()||!e.visualViewport?xb:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function pb(r,e,t){return e===void 0&&(e=!1),!t||e&&t!==le(r)?!1:e}function st(r,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const s=r.getBoundingClientRect(),o=Kr(r);let n=Re(1);e&&(i?pe(i)&&(n=xt(i)):n=xt(r));const a=pb(o,t,i)?tl(o):Re(0);let l=(s.left+a.x)/n.x,d=(s.top+a.y)/n.y,u=s.width/n.x,f=s.height/n.y;if(o){const g=le(o),m=i&&pe(i)?le(i):i;let x=g,v=dr(x);for(;v&&i&&m!==x;){const p=xt(v),E=v.getBoundingClientRect(),b=we(v),y=E.left+(v.clientLeft+parseFloat(b.paddingLeft))*p.x,C=E.top+(v.clientTop+parseFloat(b.paddingTop))*p.y;l*=p.x,d*=p.y,u*=p.x,f*=p.y,l+=y,d+=C,x=le(v),v=dr(x)}}return Ei({width:u,height:f,x:l,y:d})}function Pr(r,e){const t=Hi(r).scrollLeft;return e?e.left+t:st(ke(r)).left+t}function il(r,e,t){t===void 0&&(t=!1);const i=r.getBoundingClientRect(),s=i.left+e.scrollLeft-(t?0:Pr(r,i)),o=i.top+e.scrollTop;return{x:s,y:o}}function wb(r){let{elements:e,rect:t,offsetParent:i,strategy:s}=r;const o=s==="fixed",n=ke(i),a=e?Ni(e.floating):!1;if(i===n||a&&o)return t;let l={scrollLeft:0,scrollTop:0},d=Re(1);const u=Re(0),f=Se(i);if((f||!f&&!o)&&((It(i)!=="body"||qt(n))&&(l=Hi(i)),Se(i))){const m=st(i);d=xt(i),u.x=m.x+i.clientLeft,u.y=m.y+i.clientTop}const g=n&&!f&&!o?il(n,l,!0):Re(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 yb(r){return Array.from(r.getClientRects())}function Eb(r){const e=ke(r),t=Hi(r),i=r.ownerDocument.body,s=it(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),o=it(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let n=-t.scrollLeft+Pr(r);const a=-t.scrollTop;return we(i).direction==="rtl"&&(n+=it(e.clientWidth,i.clientWidth)-s),{width:s,height:o,x:n,y:a}}function Cb(r,e){const t=le(r),i=ke(r),s=t.visualViewport;let o=i.clientWidth,n=i.clientHeight,a=0,l=0;if(s){o=s.width,n=s.height;const d=Fr();(!d||d&&e==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}return{width:o,height:n,x:a,y:l}}const bb=new Set(["absolute","fixed"]);function _b(r,e){const t=st(r,!0,e==="fixed"),i=t.top+r.clientTop,s=t.left+r.clientLeft,o=Se(r)?xt(r):Re(1),n=r.clientWidth*o.x,a=r.clientHeight*o.y,l=s*o.x,d=i*o.y;return{width:n,height:a,x:l,y:d}}function Ao(r,e,t){let i;if(e==="viewport")i=Cb(r,t);else if(e==="document")i=Eb(ke(r));else if(pe(e))i=_b(e,t);else{const s=tl(r);i={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return Ei(i)}function rl(r,e){const t=We(r);return t===e||!pe(t)||yt(t)?!1:we(t).position==="fixed"||rl(t,e)}function Rb(r,e){const t=e.get(r);if(t)return t;let i=Ht(r,[],!1).filter(a=>pe(a)&&It(a)!=="body"),s=null;const o=we(r).position==="fixed";let n=o?We(r):r;for(;pe(n)&&!yt(n);){const a=we(n),l=Br(n);!l&&a.position==="fixed"&&(s=null),(o?!l&&!s:!l&&a.position==="static"&&s&&bb.has(s.position)||qt(n)&&!l&&rl(r,n))?i=i.filter(d=>d!==n):s=a,n=We(n)}return e.set(r,i),i}function Sb(r){let{element:e,boundary:t,rootBoundary:i,strategy:s}=r;const o=[...t==="clippingAncestors"?Ni(e)?[]:Rb(e,this._c):[].concat(t),i],n=o[0],a=o.reduce((l,d)=>{const u=Ao(e,d,s);return l.top=it(u.top,l.top),l.right=wt(u.right,l.right),l.bottom=wt(u.bottom,l.bottom),l.left=it(u.left,l.left),l},Ao(e,n,s));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Ib(r){const{width:e,height:t}=el(r);return{width:e,height:t}}function Tb(r,e,t){const i=Se(e),s=ke(e),o=t==="fixed",n=st(r,!0,o,e);let a={scrollLeft:0,scrollTop:0};const l=Re(0);function d(){l.x=Pr(s)}if(i||!i&&!o)if((It(e)!=="body"||qt(s))&&(a=Hi(e)),i){const m=st(e,!0,o,e);l.x=m.x+e.clientLeft,l.y=m.y+e.clientTop}else s&&d();o&&!i&&s&&d();const u=s&&!i&&!o?il(s,a):Re(0),f=n.left+a.scrollLeft-l.x-u.x,g=n.top+a.scrollTop-l.y-u.y;return{x:f,y:g,width:n.width,height:n.height}}function rr(r){return we(r).position==="static"}function No(r,e){if(!Se(r)||we(r).position==="fixed")return null;if(e)return e(r);let t=r.offsetParent;return ke(r)===t&&(t=t.ownerDocument.body),t}function sl(r,e){const t=le(r);if(Ni(r))return t;if(!Se(r)){let s=We(r);for(;s&&!yt(s);){if(pe(s)&&!rr(s))return s;s=We(s)}return t}let i=No(r,e);for(;i&&hb(i)&&rr(i);)i=No(i,e);return i&&yt(i)&&rr(i)&&!Br(i)?t:i||vb(r)||t}const Ob=async function(r){const e=this.getOffsetParent||sl,t=this.getDimensions,i=await t(r.floating);return{reference:Tb(r.reference,await e(r.floating),r.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function kb(r){return we(r).direction==="rtl"}const Lb={convertOffsetParentRelativeRectToViewportRelativeRect:wb,getDocumentElement:ke,getClippingRect:Sb,getOffsetParent:sl,getElementRects:Ob,getClientRects:yb,getDimensions:Ib,getScale:xt,isElement:pe,isRTL:kb};function ol(r,e){return r.x===e.x&&r.y===e.y&&r.width===e.width&&r.height===e.height}function Db(r,e){let t=null,i;const s=ke(r);function o(){var a;clearTimeout(i),(a=t)==null||a.disconnect(),t=null}function n(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const d=r.getBoundingClientRect(),{left:u,top:f,width:g,height:m}=d;if(a||e(),!g||!m)return;const x=ui(f),v=ui(s.clientWidth-(u+g)),p=ui(s.clientHeight-(f+m)),E=ui(u),b={rootMargin:-x+"px "+-v+"px "+-p+"px "+-E+"px",threshold:it(0,wt(1,l))||1};let y=!0;function C(T){const N=T[0].intersectionRatio;if(N!==l){if(!y)return n();N?n(!1,N):i=setTimeout(()=>{n(!1,1e-7)},1e3)}N===1&&!ol(d,r.getBoundingClientRect())&&n(),y=!1}try{t=new IntersectionObserver(C,{...b,root:s.ownerDocument})}catch{t=new IntersectionObserver(C,b)}t.observe(r)}return n(!0),o}function ur(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:l=!1}=i,d=Kr(r),u=s||o?[...d?Ht(d):[],...Ht(e)]:[];u.forEach(E=>{s&&E.addEventListener("scroll",t,{passive:!0}),o&&E.addEventListener("resize",t)});const f=d&&a?Db(d,t):null;let g=-1,m=null;n&&(m=new ResizeObserver(E=>{let[b]=E;b&&b.target===d&&m&&(m.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var y;(y=m)==null||y.observe(e)})),t()}),d&&!l&&m.observe(d),m.observe(e));let x,v=l?st(r):null;l&&p();function p(){const E=st(r);v&&!ol(v,E)&&t(),v=E,x=requestAnimationFrame(p)}return t(),()=>{var E;u.forEach(b=>{s&&b.removeEventListener("scroll",t),o&&b.removeEventListener("resize",t)}),f==null||f(),(E=m)==null||E.disconnect(),m=null,l&&cancelAnimationFrame(x)}}const Ci=nb,bi=ab,Yr=rb,$b=ib,_i=(r,e,t)=>{const i=new Map,s={platform:Lb,...t},o={...s.platform,_c:i};return tb(r,e,{...s,platform:o})};let Mb=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)})}show(r){if(this.ctx.contextMenuIng||!r.overflowTooltipShow||this.ctx.mousedown)return;this.floatingEl.style.display="block";let e=r.getText();r.message&&(e=r.message);const t=this.ctx.containerElement.getBoundingClientRect();if(!t)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=e;const i=r.drawX+t.x,s=r.drawY+t.y;_i({getBoundingClientRect(){return{width:r.visibleWidth,height:r.visibleHeight,x:i,y:s,left:i,right:i+r.visibleWidth,top:s,bottom:s+r.visibleHeight}}},this.floatingEl,{placement:r.overflowTooltipPlacement,middleware:[bi(),Yr(),Ci(6),$b({element:this.arrowEl})]}).then(o=>{const{x:n,y:a,placement:l,middlewareData:d}=o;if(Object.assign(this.floatingEl.style,{top:`${a}px`,left:`${n}px`}),d.arrow){const u=d.arrow;["left","left-start","left-end"].includes(l)?Object.assign(this.arrowEl.style,{top:`${u.y}px`,bottom:"",left:"",right:"-5px"}):["right","right-start","right-end"].includes(l)?Object.assign(this.arrowEl.style,{top:`${u.y}px`,bottom:"",left:"-5px",right:""}):["bottom","bottom-start","bottom-end"].includes(l)?Object.assign(this.arrowEl.style,{top:"-5px",bottom:"",left:`${u.x}px`,right:""}):["top","top-start","top-end"].includes(l)&&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 Ab{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("cellHeaderMousedown",()=>{this.enable&&this.doneEdit(),this.cellTarget=null}),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)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.code==="Enter"&&this.ctx.editing&&this.inputEl){e.preventDefault();const a=this.inputEl.selectionStart,l=this.inputEl.value.substring(0,a),d=this.inputEl.value.substring(a);this.inputEl.value=l+`
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.code==="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.code==="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()}})}isInSelectorRange(e,t){const{xArr:i,yArr:s}=this.ctx.selector,[o,n]=i,[a,l]=s;return!(t<o||t>n||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(){this.inputEl.style.height="auto";let e=this.inputEl.scrollHeight,t=this.ctx.body.visibleHeight;e>t&&(e=t);const{stageHeight:i,footer:s,header:o,config:{SCROLLER_TRACK_SIZE:n}}=this.ctx,a=i-s.height-n;this.editorEl.style.bottom="auto",this.drawY<o.height&&(this.editorEl.style.top=`${o.height-1}px`),this.drawY+e>a&&(this.editorEl.style.left=`${this.drawX-1}px`,this.editorEl.style.top="auto",this.editorEl.style.bottom=`${i-a}px`),this.inputEl.style.height=`${e}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:l}=e;this.drawX=l,this.drawY=a;const{config:{CELL_PADDING:d},header:u}=this.ctx;let f=this.ctx.body.visibleHeight;o>f&&(o=f),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=`${f}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=`${f}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<u.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||this.ctx.adjustPositioning)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,l=this.ctx.database.getReadonly(n,a);o&&!l&&(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(){this.enable&&(this.doneEditByInput(),this.ctx.emit("doneEdit",this.cellTarget),this.enable=!1,this.ctx.editing=!1,this.inputEl.style.display="inline-block",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 Nb=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,l={display:i==="empty"?"block":"none",position:"absolute",fontSize:"14px",color:"#666",left:"50%",top:`${a}px`,transform:"translate(-50%, -50%)",...t};Object.assign(this.emptyEl.style,l)})}destroy(){this.emptyEl.remove()}};class Hb{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($r(()=>{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)||!(s instanceof HTMLElement)||s.offsetWidth===0)return;const a=`${o}​_${n}`;t.set(a,Math.round(s.offsetHeight))});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}),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 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),n.appendChild(l)}),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 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-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-f+1}px`,height:`${n}px`},cells:l},x={key:"right",style:{position:"absolute",top:"0px",right:"0px",overflow:"hidden",width:`${f+1}px`,height:`${n}px`},cells:u};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:l}}=this.ctx,{visibleWidth:d,visibleHeight:u}=this.ctx.body,f=n-a,g={key:"left",style:{position:"absolute",top:`${.5}px`,left:`${.5}px`,overflow:"hidden",width:`${o}px`,height:`${u}px`},cells:t},m={key:"center",style:{position:"absolute",top:`${.5}px`,left:`${o-.5}px`,overflow:"hidden",width:`${d-o-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:i};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=[],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:l,visibleHeight:d}=this.ctx.footer,u=o-n,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:i};return{type:"footer",class:`${a}-overlayer-footer`,style:{position:"relative",overflow:"hidden",width:`${l}px`,height:`${d}px`},views:[f,g,m]}}}class Ho{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=Ga,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(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=ur(e,t,async()=>{const s=this.container.getBoundingClientRect(),o=window.innerWidth,n=t.offsetWidth||200,a=o-s.right,l=s.left,d=a>=n||a>=l?"right-start":"left-start",{x:u,y:f}=await _i(e,t,{placement:d,middleware:[Ci(8),bi({padding:8})]});Object.assign(t.style,{left:`${u}px`,top:`${f}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};ur(t,this.container,()=>{_i(t,this.container,{placement:"right-start",middleware:[Ci(),bi(),Yr()]}).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 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(i=>{i._submenu&&this.cleanupSubmenuRecursively(i._submenu)}),e.remove()}}class Bb{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: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 Ho(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: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(),E=f.map(b=>b.value==="visible"?{...b,children:this.filterColumns(p)}:b);this.ctx.contextMenuIng=!0,this.currentDOMTreeMenu=new Ho(this.contextMenuEl,E,{onClick:(b,y)=>{const{xArr:C}=this.ctx.selector,[T,N]=C;if(y==="fixedLeft"||y==="fixedRight"||y==="fixedNone"){const B=this.ctx.header.allCellHeaders.filter(R=>R.colIndex>=T&&R.colIndex<=N).filter(R=>R.level===0).filter(R=>!R.column.fixedDisabled).map(R=>R.key);this.ctx.database.setCustomHeaderFixedData(B,y==="fixedLeft"?"left":y==="fixedRight"?"right":""),this.hide()}else if(y==="hide"){const B=this.ctx.header.leafCellHeaders.filter(R=>R.colIndex>=T&&R.colIndex<=N).filter(R=>!R.children.length).filter(R=>!R.column.hideDisabled).map(R=>R.key);B.length>0&&this.ctx.database.setCustomHeaderHideData(B,!0),this.hide()}else if(y!=="visible")if(y.startsWith("visible_")){const B=y.replace("visible_","");this.ctx.database.setCustomHeaderHideData([B],!1),this.currentDOMTreeMenu&&this.currentDOMTreeMenu.removeSubMenuItem(y);const R=this.ctx.database.getColumns();Nt(R).filter(_=>_.hide).length===0&&this.hide()}else y==="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};ur(t,this.contextMenuEl,()=>{_i(t,this.contextMenuEl,{placement:"right-start",middleware:[Ci(),bi(),Yr()]}).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,value:`visible_${i.key}`,disabled:!0,children:s})}else i.hide&&t.push({label:i.title,value:`visible_${i.key}`});return 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 Fb{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 Kb{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,"animationFrameId"),h(this,"animationFrameId2"),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 HC(a,this.options),this.header=new KC(this.ctx),this.footer=new YC(this.ctx),this.body=new PC(this.ctx),this.scroller=new BC(this.ctx),this.selector=new VC(this.ctx),this.autofill=new WC(this.ctx),this.tooltip=new Mb(this.ctx),this.empty=new Nb(this.ctx),this.editor=new Ab(this.ctx),this.overlayer=new Hb(this.ctx),this.contextMenu=new Bb(this.ctx),this.loading=new Fb(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"),l=t||document.createElement("div");n.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=i||document.createElement("div");d.className="e-virt-table-editor";const u=s,f=o;return n.appendChild(a),n.appendChild(l),e.appendChild(n),{containerElement:e,stageElement:n,canvasElement:a,overlayerElement:l,editorElement:d,emptyElement:u,contextMenuElement:f}}draw(e=!1){this.animationFrameId&&cancelAnimationFrame(this.animationFrameId),this.animationFrameId=requestAnimationFrame(()=>{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(),this.animationFrameId2&&cancelAnimationFrame(this.animationFrameId2),this.animationFrameId2=requestAnimationFrame(()=>{this.body.updateAutoHeight()})})}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()}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:l}=e[n],d=await this.ctx.database.getValidator(a,l);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:l,key:d}=a;this.scrollToRowkey(l),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:l}=n,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)}}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 l=this.ctx.database.getRowKeyByItem(i[n]),d=s[a].key,u=await this.ctx.database.getValidator(l,d);Array.isArray(u)&&u.length&&o.push(u)}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()}clearMaxRowHeight(){this.ctx.database.clearMaxRowHeight()}contextMenuHide(){this.contextMenu.hide()}getUtils(){return{mergeColCell:RC,mergeRowCell:_C,getSpanArrByRow:Wa,getSpanObjByColumn:Xa}}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.ctx.destroy(),this.ctx.containerElement.remove()}}const Pb=c.defineComponent((r,{emit:e})=>{const{cellRender:t,renderTableParams:i}=r,{row:s,field:o}=i;if(o){const n=c.ref(s[o]);return()=>{var a,l;return((l=(a=At.renders[t.name])==null?void 0:a.renderEdit)==null?void 0:l.call(a,n,t,i,e))??null}}else return()=>null},{name:"RenderEditCell",props:["cellRender","renderTableParams"],emits:["blur"]}),Vr=c.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=c.ref([]),o=r,n=Aa(),a=c.computed(()=>({...o,config:{AUTO_ROW_HEIGHT:!0,DISABLED:!0,...n,...o.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(),E={},b={},y=c.computed(()=>{const w=x.value;return w?{width:`${w.width}px`,height:`${w.height}px`}:{}}),C=w=>mt[w]||(({cellValue:A})=>A),T=w=>{var A;return(A=At.renders[w])==null?void 0:A.renderDefault},N=(w,...A)=>({row:$,rowIndex:Y,value:V})=>w({row:$,rowIndex:Y,cellValue:V},...A),B=w=>{var A,$,Y,V,P;if((A=w.slots)!=null&&A.default&&I.isFunction(($=w.slots)==null?void 0:$.default))return W=>{var G,q;return(q=(G=w.slots)==null?void 0:G.default)==null?void 0:q.call(G,{row:W.row,column:w,rowIndex:W.rowIndex})};if((Y=w.slots)!=null&&Y.default&&I.isString((V=w.slots)==null?void 0:V.default))return`slot:${(P=w.slots)==null?void 0:P.default}`;if(w.cellRender&&w.cellRender.name)return W=>{var G,q;return(q=T(w.cellRender.name))==null?void 0:q(w.cellRender,{data:o.data,row:W.row,rowIndex:W.rowIndex,field:w.field||W.column.key,title:((G=W.column)==null?void 0:G.title)??""},{})}},R=w=>{var A,$;if((A=w.slots)!=null&&A.title&&I.isFunction(($=w.slots)==null?void 0:$.title))return Y=>{var V,P;return(P=(V=w.slots)==null?void 0:V.title)==null?void 0:P.call(V,{column:w})}},_=w=>{var A,$,Y,V,P,W,G;return(A=w.slots)!=null&&A.edit&&(w.field||w.key)&&I.isFunction(($=w.slots)==null?void 0:$.edit)?E[`__slot:${w.field||w.key}`]=w:(Y=w.editRender)!=null&&Y.name&&(w.field||w.key)&&(b[w.field||w.key]=w.editRender),{...I.omit(w,["formatter"]),key:w.key||w.field||De(),formatter:I.isString(w.formatter)?N(C(w.formatter)):I.isArray(w.formatter)&&I.isString(w.formatter[0])?N(C(w.formatter[0]),...w.formatter.slice(1)):I.isFunction(w.formatter)?N(w.formatter):void 0,editorType:w.editorType??((V=w.slots)!=null&&V.edit&&(w.field||w.key)&&I.isFunction((P=w.slots)==null?void 0:P.edit)?`__slot:${w.field||w.key}`:(W=w.editRender)!=null&&W.name?w.editRender.name:void 0),render:B(w),renderHeader:R(w),children:(G=w.children)==null?void 0:G.map(q=>_(q))}};c.onMounted(()=>{u.value&&(l=new Kb(u.value,{config:a.value.config,columns:o.columns.map(w=>_(w)),data:o.data,footerData:o.footerData,emptyElement:g.value||void 0,overlayerElement:m.value||void 0,editorElement:f.value||void 0}),Object.keys(d).forEach(w=>{const A=d[w];if(typeof A=="function"&&w.startsWith("on")){const $=w.charAt(2).toLowerCase()+w.slice(3);l==null||l.on($,A)}}),l.on("change",w=>{i("change",w)}),l.on("overlayerChange",w=>{p.value=w,console.log("overlayerChange",w)}),l.on("startEdit",w=>{x.value=w,v.value=w.editorType,v.value}),l.on("doneEdit",()=>{v.value="text"}),l.on("selectionChange",w=>{s.value=w,i("selectionChange",w)}),i("ready",l))});function S(w){if(!l||!x.value)return;const{rowKey:A,key:$}=x.value;l==null||l.setItemValueByEditor(A,$,w)}const O=()=>document.body;return c.watch(()=>o.data,w=>{l==null||l.loadData(w)},{deep:!0}),Tr(()=>o.columns,(w,A)=>{I.isEqual(w,A)||l==null||l.loadColumns(w.map($=>_($)))},{deep:!0}),c.watch(()=>a.value.config,w=>{l==null||l.loadConfig(w)},{deep:!0}),c.watch(()=>o.footerData,w=>{l==null||l.loadFooterData(w||[])},{deep:!0}),c.watch(()=>o.loading,(w,A)=>{w!==A&&(l==null||l.setLoading(w))},{immediate:!0}),e({$table:l,selectedRecords:c.computed(()=>s.value),reloadData:()=>{l==null||l.loadData(o.data)}}),(w,A)=>{const $=c.resolveComponent("a-empty"),Y=c.resolveComponent("a-spin");return c.openBlock(),c.createBlock(Y,{spinning:w.loading},{default:c.withCtx(()=>{var V,P,W,G,q,He,lt;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(E[v.value].slots.edit({row:x.value.row,column:E[v.value],rowIndex:x.value.rowIndex})),{key:0,bordered:!1,style:c.normalizeStyle(y.value),class:"ev-editor-wrapper","get-popup-container":O,value:x.value.value,"onUpdate:value":A[0]||(A[0]=he=>x.value.value=he),cell:x.value,onBlur:S},null,40,["style","value","cell"])):(V=c.unref(At).renders[v.value])!=null&&V.renderEdit?(c.openBlock(),c.createBlock(c.unref(Pb),{key:1,"cell-render":b[x.value.key],class:"ev-editor-wrapper",style:c.normalizeStyle(y.value),"render-table-params":{data:o.data,row:(P=x.value)==null?void 0:P.row,rowIndex:((W=x.value)==null?void 0:W.rowIndex)??-1,field:((G=x.value)==null?void 0:G.key)??"",title:((He=(q=x.value)==null?void 0:q.column)==null?void 0:He.title)??""},bordered:!1,"get-popup-container":O,onBlur:S},null,8,["cell-render","style","render-table-params"])):c.createCommentVNode("",!0)],512),c.createElementVNode("div",{ref_key:"eVirtTableEmptyRef",ref:g},[c.renderSlot(w.$slots,"empty",{},()=>[c.createVNode($,{description:"空数据"})])],512),c.createElementVNode("div",{ref_key:"eVirtTableOverlayerRef",ref:m},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(((lt=p.value)==null?void 0:lt.views)||[],he=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(he.class),style:c.normalizeStyle(he.style),key:he.type},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(he.views,Ge=>(c.openBlock(),c.createElementBlock("div",{style:c.normalizeStyle(Ge.style),key:Ge.key},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(Ge.cells,J=>(c.openBlock(),c.createElementBlock("div",c.mergeProps({class:"canvas-cell",key:`${J.rowKey}_${J.key}`,style:{...J.style,height:J.height?`${J.height-2}px`:"auto"}},{ref_for:!0},J.domDataset),[typeof J.render=="function"?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(J.render(J)),{key:0,bordered:!1})):typeof J.render=="string"&&J.render.startsWith("slot:")?c.renderSlot(w.$slots,J.render.replace("slot:",""),c.mergeProps({key:1,ref_for:!0},J,{cell:J})):c.createCommentVNode("",!0)],16))),128))],4))),128))],6))),128))],512)],512)]}),_:3},8,["spinning"])}}}),Yb={key:0},Vb={key:1,class:"p-canvas-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"},Wb={class:"flex items-center flex-1 gap-4px"},Xb={key:2},zb={class:"flex items-center gap-4px"},Gb={class:c.normalizeClass("p-pane flex-1 h-0 p-inner-scroll")},Ub={key:0,class:"w-full text-slate-5 pl-4"},nl=c.defineComponent({__name:"PCanvasGrid",props:{staticConfig:{},manualFetch:{type:Boolean},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},config:{},lazyReset:{type:Boolean,default:()=>vt().lazyReset??!1},fitHeight:{default:()=>vt().fitCanvasHeight??100}},emits:["toolbarButtonClick","toolbarToolClick","pick","resetQuery"],setup(r,{expose:e,emit:t}){var Jt,Qt,jt,ei,ti;const i=r,s=c.useAttrs(),o=t,{formConfig:n,pageConfig:a,columns:l,toolbarConfig:d,proxyConfig:u,config:f,staticConfig:g}=c.toRefs(i),m=Aa(),x=c.ref(De()),v=c.ref({}),p=c.computed(()=>({...i,config:{...m,...i.config}})),E=c.computed(()=>u.value&&u.value.ajax?a.value?"pagination":"list":"bad");c.computed(()=>E.value==="pagination"?{current:C.page,total:N.value,pageSize:C.size,responsive:!1,showSizeChanger:!0,showTotal:D=>`共${D}条数据`}:!1);const b=c.computed(()=>I.omit({labelCol:Ir,...n.value},["items"])),y=c.reactive({toolbar:!1,form:!1,table:!1}),C=c.reactive({page:1,size:((Jt=a.value)==null?void 0:Jt.pageSize)??10}),T=c.ref(0),N=c.ref(0),B=c.ref([]),R=c.ref(),_=c.ref(),S=c.ref(),O=c.ref(),w=c.ref(500),A=c.ref({}),$=D=>{A.value[C.page]=D},Y=c.reactive([...(((jt=(Qt=i.toolbarConfig)==null?void 0:Qt.buttons)==null?void 0:jt.map(D=>D.code))??[]).filter(D=>D),...(((ti=(ei=i.toolbarConfig)==null?void 0:ei.tools)==null?void 0:ti.map(D=>D.code))??[]).filter(D=>D)].reduce((D,F)=>(D[F]=!1,D),{})),V=(D,F)=>{Y[D]=F},P=D=>{I.isObject(D)?(Object.prototype.hasOwnProperty.call(D,"toolbar")&&(y.toolbar=D.toolbar),Object.prototype.hasOwnProperty.call(D,"form")&&(y.form=D.form),Object.prototype.hasOwnProperty.call(D,"table")&&(y.table=D.table)):I.isBoolean(D)&&(y.form=D,y.toolbar=D,y.table=D)},W=c.computed(()=>I.uniq(Object.values(A.value).flat(),D=>{var F;return D[((F=p.value.config)==null?void 0:F.ROW_KEY)??"id"]})),G=()=>{Ue()},q=c.computed(()=>W.value.map(D=>{var F;return D[((F=p.value.config)==null?void 0:F.ROW_KEY)??"id"]})),He=(D,F)=>F?{list:I.isString(F.list)?I.get(D,F.list):I.isFunction(F.list)?F.list(D):void 0,total:I.isString(F.total)?I.get(D,F.total):I.isFunction(F.total)?F.total(D):void 0,result:I.isString(F.result)?I.get(D,F.result):I.isFunction(F.result)?F.result(D):void 0,message:I.isString(F.message)?I.get(D,F.message):I.isFunction(F.message)?F.message(D):void 0}:{list:D},lt=D=>{o("toolbarButtonClick",{data:B.value,code:D,selectedKeys:q.value,records:W.value}),ht(D)},he=I.debounce(lt,100),Ge=({key:D})=>he(D),J=D=>{o("toolbarToolClick",{data:B.value,code:D,selectedKeys:q.value,records:W.value}),ht(D)},Bi=I.debounce(J,100),ve=()=>new Promise(D=>{if(E.value!=="bad"){P({table:!0,form:!0});const{ajax:F}=u.value;F.query({form:v.value,page:C}).then(U=>{const{list:Le,total:Be,result:de,message:me}=He(U,u.value.response);Le?(B.value=Le,T.value++):de?(B.value=de,N.value=Be??de.length,T.value++):(B.value=[],T.value++,me&&pi(me)),D(B.value)}).catch(U=>{console.error("fetchData error",U),D([])}).finally(()=>{P({table:!1,form:!1})})}}),Fi=(D,F)=>(C.page=D,C.size=F,ve()),Ue=()=>(C.page=1,A.value={},ve()),ct=I.debounce(ve,160),Zt=(D,F)=>(Object.assign(v.value,D),C.page=1,F?Promise.resolve():ct()),Ki=(D,F)=>(v.value=D,C.page=1,F?Promise.resolve():ct()),ht=D=>{const{ajax:F}=u.value;switch(D){case"multiDelete":F.multiDelete&&(q.value.length>0?Pa({title:"警告",content:"确认删除选中的数据吗?"}).then(()=>{P({table:!0,toolbar:!0}),F.multiDelete(q.value).then(()=>{cC("删除成功"),Ue()}).catch(()=>{hC("删除失败")}).finally(()=>{P({table:!1,toolbar:!1}),Y.multiDelete=!1})}):pi("请选择要删除的数据"));break}},Pi=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]),qe=D=>{if(n.value&&n.value.items.length>0){if(n.value.customReset)n.value.customReset();else{const F={};Mt(n.value.items,U=>{U.field&&U.itemRender?ue(U.itemRender.defaultValue)?F[U.field]=U.itemRender.defaultValue:F[U.field]=void 0:U.field&&U.slots&&(ue(U.slots.defaultValue)?F[U.field]=U.slots.defaultValue:F[U.field]=void 0)}),v.value=F}o("resetQuery")}C.page=1,D||ct()},dt=()=>(A.value={},qe()),Ze=()=>{var de,me;const D=(de=S.value)==null?void 0:de.parentElement,F=D?window.getComputedStyle(D).height:"0px",U=O.value?window.getComputedStyle(O.value).height:"0px",Le=U.includes("px")?I.toNumber(U.replace("px","")):0,Be=(me=g.value)!=null&&me.showCount?22:0;w.value=I.toNumber(F.replace("px",""))-i.fitHeight-(i.toolbarConfig?30:0)-Le-Be};let Tt;return c.onMounted(()=>{Ze(),window.addEventListener("resize",Ze),Tt=new MutationObserver(D=>{D.forEach(F=>{if(F.type==="attributes"&&F.attributeName==="style"){const U=F.target;window.getComputedStyle(U).display!=="none"&&Ze()}})}),S.value&&Tt.observe(S.value,{attributes:!0,attributeFilter:["style"]}),qe(i.manualFetch)}),c.onBeforeUnmount(()=>{window.removeEventListener("resize",Ze),Tt.disconnect()}),e({commitProxy:{query:ct,reload:dt,reloadPage:Ue,passQuery:Zt,forcePassQuery:Ki},$canvasTable:c.computed(()=>_.value),selectedRowKeys:q,setBtnLoading:V,selectedRecords:W,$form:c.computed(()=>R.value),getFormData:()=>v.value,setLoadings:P,resizeTable:Ze}),(D,F)=>{var de,me,Ot;const U=c.resolveComponent("a-menu-item"),Le=c.resolveComponent("a-menu"),Be=c.resolveComponent("a-dropdown");return c.openBlock(),c.createElementBlock("div",c.mergeProps({ref_key:"boxEl",ref:S,class:"h-full p-wrapper flex flex-col gap-8px overflow-y-auto"},c.unref(s)),[E.value==="bad"?(c.openBlock(),c.createElementBlock("div",Yb,"请检查配置")):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[(me=(de=c.unref(n))==null?void 0:de.items)!=null&&me.some(K=>K.field&&K.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:y.form},{default:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.unref(M.Form),c.mergeProps({key:x.value,ref_key:"formEl",ref:R,model:v.value},b.value,{onSubmit:G}),{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).items,(K,k)=>(c.openBlock(),c.createBlock(kr,{key:`_col_${K.field||k}`,"form-data":v.value,item:K,onReset:F[0]||(F[0]=L=>qe(i.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",Vb,[c.createElementVNode("div",Wb,[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,(K,k)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:k},[K.dropdowns&&K.dropdowns.length?(c.openBlock(),c.createBlock(Be,{key:0},{overlay:c.withCtx(()=>[c.createVNode(Le,{onClick:Ge},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(K.dropdowns,L=>(c.openBlock(),c.createBlock(U,{key:L.code},{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(L.content),1)]),_:2},1024))),128))]),_:2},1024)]),default:c.withCtx(()=>[c.createVNode(c.unref(M.Button),{type:K.type,size:K.size??"middle",disabled:c.unref(d).disabled||K.disabled,loading:y.toolbar||!!K.code&&Y[K.code],danger:K.danger,shape:K.shape,ghost:K.ghost,block:K.block},{default:c.withCtx(()=>[K.icon?(c.openBlock(),c.createBlock(c.unref(ae),{key:0,icon:K.icon},null,8,["icon"])):c.createCommentVNode("",!0),c.createTextVNode(" "+c.toDisplayString(K.content)+" ",1),c.createVNode(c.unref(pt.DownOutlined))]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block"])]),_:2},1024)):K.code?(c.openBlock(),c.createBlock(c.unref(M.Button),{key:1,type:K.type,size:K.size??"middle",disabled:c.unref(d).disabled||K.disabled,loading:y.toolbar||!!K.code&&Y[K.code],danger:K.danger,shape:K.shape,ghost:K.ghost,block:K.block,onClick:L=>c.unref(he)(K.code)},{default:c.withCtx(()=>[K.icon?(c.openBlock(),c.createBlock(c.unref(ae),{key:0,icon:K.icon},null,8,["icon"])):c.createCommentVNode("",!0),c.createTextVNode(" "+c.toDisplayString(K.content),1)]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block","onClick"])):(c.openBlock(),c.createElementBlock("div",Xb))],64))),128)):c.createCommentVNode("",!0)]),c.createElementVNode("span",zb,[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,(K,k)=>(c.openBlock(),c.createBlock(c.unref(M.Button),{key:k,type:K.type,size:K.size??"middle",disabled:c.unref(d).disabled||K.disabled,danger:K.danger,shape:K.shape,ghost:K.ghost,block:K.block,onClick:L=>c.unref(Bi)(K.code),loading:y.toolbar||!!K.code&&Y[K.code]},{default:c.withCtx(()=>[K.icon?(c.openBlock(),c.createBlock(c.unref(ae),{key:0,icon:K.icon},null,8,["icon"])):c.createCommentVNode("",!0),c.createTextVNode(" "+c.toDisplayString(K.content),1)]),_:2},1032,["type","size","disabled","danger","shape","ghost","block","onClick","loading"]))),128)):c.createCommentVNode("",!0)])])):c.createCommentVNode("",!0),c.createElementVNode("div",Gb,[(Ot=c.unref(g))!=null&&Ot.selectable&&c.unref(g).showCount?(c.openBlock(),c.createElementBlock("div",Ub," 已选:"+c.toDisplayString(q.value.length),1)):c.createCommentVNode("",!0),c.createVNode(Vr,{ref_key:"canvasTableRef",ref:_,columns:Pi.value,config:{...p.value.config,HEIGHT:w.value},data:B.value,loading:y.table,onSelectionChange:$},c.createSlots({_:2},[c.renderList(D.$slots,(K,k)=>({name:k,fn:c.withCtx(L=>[c.renderSlot(D.$slots,k,c.normalizeProps(c.guardReactiveProps(L)))])}))]),1032,["columns","config","data","loading"]),E.value==="pagination"?(c.openBlock(),c.createBlock(c.unref(M.Pagination),{key:1,class:"p-canvas-pagination",size:"small",current:C.page,"page-size":C.size,total:N.value,onChange:Fi},null,8,["current","page-size","total"])):c.createCommentVNode("",!0)])],64))],16)}}}),Wr=c.defineComponent({__name:"PGroupBlock",props:{getFormSetting:{type:Function},source:{}},setup(r,{expose:e}){const t=r,i=c.ref(),{source:s}=c.toRefs(t),o=c.computed(()=>{var a;return(a=i.value)==null?void 0:a.$form}),n=c.computed(()=>t.getFormSetting(s.value));return e({$form:o}),(a,l)=>(c.openBlock(),c.createBlock(Lr,c.mergeProps({ref_key:"formEl",ref:i},n.value,{data:c.unref(s)}),null,16,["data"]))}}),qb=c.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=c.ref(t.defaultCollapsed?[]:["content"]);return e({collapse:()=>{i.value=[]},expand:()=>{i.value=["content"]}}),(s,o)=>{const n=c.resolveComponent("a-collapse-panel"),a=c.resolveComponent("a-collapse"),l=c.resolveComponent("a-card");return s.collapsible?(c.openBlock(),c.createBlock(a,{key:0,"active-key":i.value,"onUpdate:activeKey":o[0]||(o[0]=d=>i.value=d),class:"collapsible-card"},{default:c.withCtx(()=>[c.createVNode(n,{key:"content","force-render":"",header:s.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:s.title},c.createSlots({_:2},[c.renderList(s.$slots,(d,u)=>({name:u,fn:c.withCtx(()=>[c.renderSlot(s.$slots,u)])}))]),1032,["title"]))}}}),al=c.defineComponent({__name:"PFormGroup",props:c.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=M.Form.useForm,i=c.ref(),s=r,o=c.ref(),n=c.useModel(r,"modelValue"),a=c.ref(0),l=c.ref([]),d=c.ref([]),u=R=>{a.value=R},f=c.computed(()=>s.max??1/0),g=R=>{(s.createItem??(()=>Promise.resolve({})))({list:n.value}).then(S=>{var O;n.value=[...n.value,{...S,__index:(((O=I.max(n.value,w=>w.__index??-1))==null?void 0:O.__index)??-1)+1}],a.value=R})},m=s.itemMenus??[{content:"复制",code:"copy"},{content:"删除",code:"delete"}],x=R=>{var _,S,O,w,A,$;return((A=(w=(O=(S=(_=R==null?void 0:R.parentElement)==null?void 0:_.parentElement)==null?void 0:S.parentElement)==null?void 0:O.parentElement)==null?void 0:w.parentElement)==null?void 0:A.parentElement)??(($=o.value)==null?void 0:$.$el)??document.body},v=c.computed(()=>s.forceRender||n.value.length<=5),p=R=>{var S;const _=(S=n.value.find((O,w)=>w===R))==null?void 0:S.__index;Z(_)&&(l.value=l.value.filter(O=>O!==_))},E=()=>{c.nextTick().then(()=>{var R,_;p(a.value),(_=(R=d.value[a.value])==null?void 0:R.$form)==null||_.validate()})},b=(R,_)=>{var S;return((S=s.getTabLabel)==null?void 0:S.call(s,R,_))??`${s.tabLabel} ${s.keepSerial?_+1:(R.__index??0)+1}`};c.watch(()=>n.value,()=>{if(!s.keepSerial){const R=n.value.filter(_=>!Z(_.__index));R.length>0&&R.forEach(_=>{var S;_.__index=(((S=I.max(n.value,O=>O.__index??-1))==null?void 0:S.__index)??-1)+1})}},{immediate:!0});const y=({key:R},_,S)=>{var O;if(s.menuHandler&&I.isFunction(s.menuHandler))s.menuHandler({code:I.toString(R),data:_,index:S});else switch(R){case"delete":n.value=n.value.filter((w,A)=>A!==S),c.nextTick(()=>{d.value=d.value.filter(w=>!!w),S<=a.value&&a.value>0&&a.value--});break;case"copy":if(n.value.length>=f.value){pi("已达到最大数量");return}n.value=[...n.value,I.clone({...I.omit(_,["id","__index"]),__index:(((O=I.max(n.value,w=>w.__index??-1))==null?void 0:O.__index)??-1)+1})];break}},C=I.debounce(y,100);c.watchEffect(()=>{n.value.length===0?a.value=0:a.value>=n.value.length&&(a.value=n.value.length-1)});const T=I.debounce(p,50);c.watchEffect(()=>{var S;const R=n.value.map((O,w)=>l.value.includes(O.__index)?w:void 0).filter(Z),_=(S=i.value)==null?void 0:S.$el;_&&_.querySelectorAll(":scope >.ant-tabs-nav>.ant-tabs-nav-wrap>.ant-tabs-nav-list>.ant-tabs-tab>.ant-tabs-tab-btn").forEach((w,A)=>{R.includes(A)?w.classList.add("p-error-group-tab"):w.classList.remove("p-error-group-tab")})}),e({collapse:()=>{var R,_;(_=(R=o.value)==null?void 0:R.collapse)==null||_.call(R)},expand:()=>{var R,_;(_=(R=o.value)==null?void 0:R.expand)==null||_.call(R)},activeKey:c.computed(()=>a.value),setActiveKey:u,validateAll:()=>{const R=v.value?d.value.map(_=>{var S;return(S=_.$form)==null?void 0:S.validate()}):n.value.map(_=>{var S;return((S=t(_,s.getFormSetting(_).rules))==null?void 0:S.validate())??Promise.resolve()});return Promise.allSettled(R).then(_=>{if(l.value=_.map((S,O)=>{var w;return S.status==="rejected"&&typeof((w=n.value[O])==null?void 0:w.__index)=="number"?n.value[O].__index:void 0}).filter(S=>typeof S=="number"),!s.lazyErrorMark&&l.value.length){const S=l.value[0],O=n.value.findIndex(w=>w.__index===S);O!==-1&&(a.value=O)}return l.value.length?Promise.reject({error_indexes:l.value,results:_}):Promise.resolve(_)})},validate:async(R,_)=>{var O,w,A;const S=n.value.findIndex($=>$.__index===R);try{return await(v.value?((w=(O=d.value[S])==null?void 0:O.$form)==null?void 0:w.validate())??Promise.resolve():((A=t(n.value[S],s.getFormSetting(n.value[S]).rules))==null?void 0:A.validate())??Promise.resolve()),l.value=l.value.filter($=>$!==R),Promise.resolve()}catch($){return!l.value.includes(R)&&!_&&(l.value=[...l.value,R]),Promise.reject($)}},validateFields:async(R,_,S)=>{var Y,V;const O=n.value.findIndex(P=>P.__index===R),A=s.getFormSetting(n.value[O]).rules,$=t(n.value[O],A);try{return await(v.value?((V=(Y=d.value[O])==null?void 0:Y.$form)==null?void 0:V.validateFields(_))??Promise.resolve():Promise.allSettled(_.map(P=>$.validateField(P,n.value[O][P],A[P]??[])))),Promise.resolve()}catch(P){return!l.value.includes(R)&&!S&&(l.value=[...l.value,R]),Promise.reject(P)}}});const N=c.useSlots(),B=c.computed(()=>Object.keys(N).filter(R=>R.startsWith("group-")).map(R=>({original:R,target:R.replace("group-","")})));return(R,_)=>{const S=c.resolveComponent("a-spin");return c.openBlock(),c.createBlock(qb,{ref_key:"rootRef",ref:o,title:R.title,size:"small",collapsible:R.collapsible,"default-collapsed":R.defaultCollapsed},c.createSlots({default:c.withCtx(()=>[R.loading?(c.openBlock(),c.createBlock(S,{key:0,class:"w-full"})):(c.openBlock(),c.createBlock(c.unref(M.Tabs),{key:1,ref_key:"tabsRef",ref:i,type:"editable-card",activeKey:a.value,"onUpdate:activeKey":_[1]||(_[1]=O=>a.value=O),"hide-add":"",onChange:E},{rightExtra:c.withCtx(()=>[c.renderSlot(R.$slots,"rightExtra",{},()=>[R.showAdd&&n.value.length<f.value?(c.openBlock(),c.createBlock(c.unref(M.Button),{key:0,type:"link",onClick:_[0]||(_[0]=O=>g(n.value.length))},{default:c.withCtx(()=>_[2]||(_[2]=[c.createTextVNode(" + 新增 ",-1)])),_:1,__:[2]})):c.createCommentVNode("",!0)])]),default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(n.value,(O,w)=>(c.openBlock(),c.createBlock(c.unref(M.TabPane),{key:w,tab:b(O,w),"force-render":v.value},{closeIcon:c.withCtx(()=>{var A;return[R.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:$=>c.unref(C)($,O,w)},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(m).filter($=>{var Y;return((Y=$.visibleMethod)==null?void 0:Y.call($,{data:O,index:w}))??!0}),$=>(c.openBlock(),c.createBlock(c.unref(M.MenuItem),{key:$.code},{default:c.withCtx(()=>[c.createElementVNode("div",null,c.toDisplayString($.content),1)]),_:2},1024))),128))]),_:2},1032,["onClick"])]),default:c.withCtx(()=>[c.createVNode(c.unref(pt.MoreOutlined))]),_:2},1024)):c.createCommentVNode("",!0)]}),default:c.withCtx(()=>[(c.openBlock(),c.createBlock(Wr,{ref_for:!0,ref_key:"blockInstance",ref:d,key:w,source:O,"get-form-setting":R.getFormSetting,onFocusCapture:A=>c.unref(T)(w),onClickCapture:A=>c.unref(T)(w)},null,8,["source","get-form-setting","onFocusCapture","onClickCapture"]))]),_:2},1032,["tab","force-render"]))),128))]),_:3},8,["activeKey"]))]),_:2},[c.renderList(B.value,O=>({name:O.target,fn:c.withCtx(()=>[c.renderSlot(R.$slots,O.original)])}))]),1032,["title","collapsible","default-collapsed"])}}}),Zb={class:"w-full text-right p-2"},ll=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(r,{expose:e}){const t=c.ref(),i=c.ref(!1),s=r,o=c.computed(()=>{var x;return(x=s.gridSetting.selectConfig)==null?void 0:x.multiple});let n,a,l;const d=c.reactive({modal:!1}),u=()=>{l&&l()},f=()=>{d.modal=!1,l&&l()},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?pi("请选择数据"):s.beforePick(x).then(()=>{d.modal=!1,a(x)})};return c.onMounted(()=>{}),e({pick:()=>new Promise((x,v)=>{n=x,l=v,i.value=!1,d.modal=!0,c.nextTick(()=>{i.value=!0})}),pickMultiple:()=>new Promise((x,v)=>{a=x,l=v,i.value=!1,d.modal=!0,c.nextTick(()=>{i.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:x.title,width:x.width,footer:o.value?void 0:null,onCancel:u,"body-style":x.bodyStyle},c.createSlots({default:c.withCtx(()=>[c.createElementVNode("div",{style:c.normalizeStyle({minHeight:i.value?"unset":"642px"})},[c.createVNode(Dr,c.mergeProps(x.gridSetting,{ref_key:"gridEl",ref:t,onPick:g}),null,16)],4)]),_:2},[o.value?{name:"footer",fn:c.withCtx(()=>[c.createElementVNode("div",Zb,[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,__:[1]}),c.createVNode(c.unref(M.Button),{type:"primary",onClick:m},{default:c.withCtx(()=>v[2]||(v[2]=[c.createTextVNode(" 确定 ",-1)])),_:1,__:[2]})])])]),key:"0"}:void 0]),1032,["open","title","width","footer","body-style"]))}});function cl(r){r&&Ma(r)}const Jb={install(r){r.component("PForm",Lr),r.component("PGrid",Dr),r.component("PCanvasTable",Vr),r.component("PCanvasGrid",nl),r.component("PFormGroup",al),r.component("PGroupBlock",Wr),r.component("PromisePicker",ll)},addFormatter:Ha,addRender:Or,setup:cl};exports.PCanvasGrid=nl;exports.PCanvasTable=Vr;exports.PForm=Lr;exports.PFormGroup=al;exports.PGrid=Dr;exports.PGroupBlock=Wr;exports.PromisePicker=ll;exports.addFormatter=Ha;exports.addRender=Or;exports.cleanCol=Mi;exports.default=Jb;exports.defaultItemResponsive=Sr;exports.defaultLabelCol=Ir;exports.get24rest=Na;exports.getButtonResponsive=J2;exports.getUIKitConfig=U2;exports.labelColDict=Z2;exports.resetUIKitConfig=q2;exports.setUIKitConfig=Ma;exports.setup=cl;exports.watchPreviousDeep=Tr;