@vue-ui-kit/ant 2.3.9 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +4 -4
- package/dist/declarations/antProxy.d.ts +3 -0
- package/dist/es/index.js +3846 -3799
- package/package.json +1 -1
- package/src/declarations/antProxy.ts +3 -0
- package/src/packages/components/PCanvasGrid.vue +50 -30
- package/src/packages/components/PForm.vue +8 -1
- package/src/packages/components/PFormGroup.vue +1 -0
- package/src/packages/components/PGrid.vue +44 -22
- package/src/packages/components/PGroupBlock.vue +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("vue"),A=require("ant-design-vue"),wt=require("@ant-design/icons-vue");function fl(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 gl=fl(wt);var vl={keyId:1,cookies:{path:"/"},treeOptions:{parentKey:"parentId",key:"id",children:"children"},parseDateFormat:"yyyy-MM-dd HH:mm:ss",firstDayOfWeek:1},Le=vl;function ml(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=ml,xl=Object.prototype.toString,Po=xl,pl=Po;function yl(r){return function(e){return"[object "+r+"]"===pl.call(e)}}var Kt=yl,wl=Kt,El=Array.isArray||wl("Array"),z=El;function Cl(r,e){return r&&r.hasOwnProperty?r.hasOwnProperty(e):!1}var be=Cl,bl=be;function _l(r,e,t){if(r)for(var i in r)bl(r,i)&&e.call(t,r[i],i,r)}var Pt=_l,Rl=z,Il=te,Sl=Pt;function Tl(r,e,t){return r&&(Rl(r)?Il:Sl)(r,e,t)}var J=Tl;function Ol(r){return function(e){return typeof e===r}}var bt=Ol,kl=bt,Ll=kl("function"),ie=Ll,Dl=J;function $l(r,e){var t=Object[r];return function(i){var s=[];if(i){if(t)return t(i);Dl(i,e>1?function(o){s.push([""+o,i[o]])}:function(){s.push(arguments[e])})}return s}}var mr=$l,Ml=mr,Al=Ml("keys",1),Ne=Al,Nl=Po,Bl=Pt,Hl=te;function zi(r,e){var t=r.__proto__.constructor;return e?new t(e):new t}function si(r,e){return e?Yo(r,e):r}function Yo(r,e){if(r)switch(Nl.call(r)){case"[object Object]":{var t=Object.create(Object.getPrototypeOf(r));return Bl(r,function(n,a){t[a]=si(n,e)}),t}case"[object Date]":case"[object RegExp]":return zi(r,r.valueOf());case"[object Array]":case"[object Arguments]":{var i=[];return Hl(r,function(n){i.push(si(n,e))}),i}case"[object Set]":{var s=zi(r);return s.forEach(function(n){s.add(si(n,e))}),s}case"[object Map]":{var o=zi(r);return o.forEach(function(n,a){o.set(a,si(n,e))}),o}}return r}function Fl(r,e){return r&&Yo(r,e)}var xr=Fl,Kl=te,Pl=Ne,Yl=z,Vl=xr,qr=Object.assign;function Zr(r,e,t){for(var i=e.length,s,o=1;o<i;o++)s=e[o],Kl(Pl(e[o]),t?function(n){r[n]=Vl(s[n],t)}:function(n){r[n]=s[n]});return r}var Wl=function(r){if(r){var e=arguments;if(r===!0){if(e.length>1)return r=Yl(r[1])?[]:{},Zr(r,e,!0)}else return qr?qr.apply(Object,e):Zr(r,e)}return r},ce=Wl,Vo=Le,Xl=te,zl=J,Gl=ie,Ul=ce,Te=function(){};function ql(){Xl(arguments,function(r){zl(r,function(e,t){Te[t]=Gl(e)?function(){var i=e.apply(Te.$context,arguments);return Te.$context=null,i}:e})})}function Wo(r){return Ul(Vo,r)}function Zl(){return Vo}var Xo="3.7.8";Te.VERSION=Xo;Te.version=Xo;Te.mixin=ql;Te.setup=Wo;Te.setConfig=Wo;Te.getConfig=Zl;var Jl=Te;function Ql(r,e,t){for(var i=r.length-1;i>=0;i--)e.call(t,r[i],i,r)}var pr=Ql,jl=pr,ec=Ne;function tc(r,e,t){jl(ec(r),function(i){e.call(t,r[i],i,r)})}var zo=tc;function ic(r){return r===null}var Be=ic,rc=Be;function sc(r,e){return function(t){return rc(t)?e:t[r]}}var _t=sc,oc=J,nc=ie,ac=_t;function lc(r,e,t){var i={};if(r)if(e)nc(e)||(e=ac(e)),oc(r,function(s,o){i[o]=e.call(t,s,o,r)});else return r;return i}var cc=lc;function hc(r){return r?r.constructor===Object:!1}var Rt=hc;function dc(r){return r!=="__proto__"&&r!=="constructor"}var Go=dc,Jr=z,Qr=Rt,uc=ie,fc=J,gc=Go;function Uo(r,e){return Qr(r)&&Qr(e)||Jr(r)&&Jr(e)?(fc(e,function(t,i){gc(i)&&(r[i]=uc(e)?t:Uo(r[i],t))}),r):e}var vc=function(r){r||(r={});for(var e=arguments,t=e.length,i,s=1;s<t;s++)i=e[s],i&&Uo(r,i);return r},mc=vc,xc=J;function pc(r,e,t){var i=[];if(r&&arguments.length>1){if(r.map)return r.map(e,t);xc(r,function(){i.push(e.apply(t,arguments))})}return i}var at=pc,yc=be,wc=z;function Ec(r,e,t,i,s){return function(o,n,a){if(o&&n){if(r&&o[r])return o[r](n,a);if(e&&wc(o)){for(var c=0,d=o.length;c<d;c++)if(!!n.call(a,o[c],c,o)===i)return[!0,!1,c,o[c]][t]}else for(var f in o)if(yc(o,f)&&!!n.call(a,o[f],f,o)===i)return[!0,!1,f,o[f]][t]}return s}}var Ti=Ec,Cc=Ti,bc=Cc("some",1,0,!0,!1),qo=bc,_c=Ti,Rc=_c("every",1,1,!1,!0),Zo=Rc,Ic=be;function Sc(r,e){if(r){if(r.includes)return r.includes(e);for(var t in r)if(Ic(r,t)&&e===r[t])return!0}return!1}var It=Sc,jr=z,es=It;function Tc(r,e){var t,i=0;if(jr(r)&&jr(e)){for(t=e.length;i<t;i++)if(!es(r,e[i]))return!1;return!0}return es(r,e)}var Jo=Tc,ts=J,Oc=It,kc=ie,Lc=_t;function Dc(r,e,t){var i=[];if(e){kc(e)||(e=Lc(e));var s,o={};ts(r,function(n,a){s=e.call(t,n,a,r),o[s]||(o[s]=1,i.push(n))})}else ts(r,function(n){Oc(i,n)||i.push(n)});return i}var Qo=Dc,$c=at;function Mc(r){return $c(r,function(e){return e})}var yr=Mc,Ac=Qo,Nc=yr;function Bc(){for(var r=arguments,e=[],t=0,i=r.length;t<i;t++)e=e.concat(Nc(r[t]));return Ac(e)}var Hc=Bc,Fc="undefined",_e=Fc,Kc=_e,Pc=bt,Yc=Pc(Kc),De=Yc,Vc=Be,Wc=De;function Xc(r){return Vc(r)||Wc(r)}var He=Xc,zc=/(.+)?\[(\d+)\]$/,jo=zc;function Gc(r){return r?r.splice&&r.join?r:(""+r).replace(/(\[\d+\])\.?/g,"$1.").replace(/\.$/,"").split("."):[]}var wr=Gc,Uc=jo,qc=wr,Zc=be,Jc=De,en=He;function Qc(r,e,t){if(en(r))return t;var i=eh(r,e);return Jc(i)?t:i}function jc(r,e){var t=e?e.match(Uc):"";return t?t[1]?r[t[1]]?r[t[1]][t[2]]:void 0:r[t[2]]:r[e]}function eh(r,e){if(r){var t,i,s,o=0;if(r[e]||Zc(r,e))return r[e];if(i=qc(e),s=i.length,s){for(t=r;o<s;o++)if(t=jc(t,i[o]),en(t))return o===s-1?t:void 0}return t}}var Yt=Qc,is=te,th=yr,rs=at,ss=z,ih=ie,rh=Rt,os=De,sh=Be,oh=He,nh=Yt,ah=_t,lh="asc",ch="desc";function ar(r,e){return os(r)?1:sh(r)?os(e)?-1:1:r&&r.localeCompare?r.localeCompare(e):r>e?1:-1}function hh(r,e,t){return function(i,s){var o=i[r],n=s[r];return o===n?t?t(i,s):0:e.order===ch?ar(n,o):ar(o,n)}}function dh(r,e,t,i){var s=[];return t=ss(t)?t:[t],is(t,function(o,n){if(o){var a=o,c;ss(o)?(a=o[0],c=o[1]):rh(o)&&(a=o.field,c=o.order),s.push({field:a,order:c||lh}),is(e,ih(a)?function(d,f){d[n]=a.call(i,d.data,f,r)}:function(d){d[n]=a?nh(d.data,a):d.data})}}),s}function uh(r,e,t){if(r){if(oh(e))return th(r).sort(ar);for(var i,s=rs(r,function(a){return{data:a}}),o=dh(r,s,e,t),n=o.length-1;n>=0;)i=hh(n,o[n],i),n--;return i&&(s=s.sort(i)),rs(s,ah("data"))}return[]}var Er=uh,fh=Er,gh=fh,vh=gh;function mh(r,e){return r>=e?r:(r=r>>0)+Math.round(Math.random()*((e||9)-r))}var tn=mh,xh=mr,ph=xh("values",0),St=ph,yh=tn,wh=St;function Eh(r){for(var e,t=[],i=wh(r),s=i.length-1;s>=0;s--)e=s>0?yh(0,s):0,t.push(i[e]),i.splice(e,1);return t}var rn=Eh,Ch=rn;function bh(r,e){var t=Ch(r);return arguments.length<=1?t[0]:(e<t.length&&(t.length=e||0),t)}var _h=bh;function Rh(r){return function(e){if(e){var t=r(e&&e.replace?e.replace(/,/g,""):e);if(!isNaN(t))return t}return 0}}var sn=Rh,Ih=sn,Sh=Ih(parseFloat),lt=Sh,ns=lt;function Th(r,e,t){var i=[],s=arguments.length;if(r){if(e=s>=2?ns(e):0,t=s>=3?ns(t):r.length,r.slice)return r.slice(e,t);for(;e<t;e++)i.push(r[e])}return i}var ct=Th,Oh=J;function kh(r,e,t){var i=[];if(r&&e){if(r.filter)return r.filter(e,t);Oh(r,function(s,o){e.call(t,s,o,r)&&i.push(s)})}return i}var Lh=kh,Dh=Ti,$h=Dh("",0,2,!0),Mh=$h,Ah=Ti,Nh=Ah("find",1,3,!0),Bh=Nh,Hh=z,Fh=St;function Kh(r,e,t){if(r){Hh(r)||(r=Fh(r));for(var i=r.length-1;i>=0;i--)if(e.call(t,r[i],i,r))return r[i]}}var Ph=Kh,Yh=Ne;function Vh(r,e,t){if(r){var i,s,o=0,n=null,a=t,c=arguments.length>2,d=Yh(r);if(r.length&&r.reduce)return s=function(){return e.apply(n,arguments)},c?r.reduce(s,a):r.reduce(s);for(c&&(o=1,a=r[d[0]]),i=d.length;o<i;o++)a=e.call(n,a,r[d[o]],o,r);return a}}var Wh=Vh,Xh=z;function zh(r,e,t,i){if(Xh(r)&&r.copyWithin)return r.copyWithin(e,t,i);var s,o,n=e>>0,a=t>>0,c=r.length,d=arguments.length>3?i>>0:c;if(n<c&&(n=n>=0?n:c+n,n>=0&&(a=a>=0?a:c+a,d=d>=0?d:c+d,a<d)))for(s=0,o=r.slice(a,d);n<c&&!(o.length<=s);n++)r[n]=o[s++];return r}var Gh=zh,Uh=z;function qh(r,e){var t,i=[],s=e>>0||1;if(Uh(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 Zh=qh,Jh=at,Qh=_t;function jh(r,e){return Jh(r,Qh(e))}var on=jh,ed=ie,as=He,td=Yt,id=te;function rd(r){return function(e,t){if(e&&e.length){var i,s;return id(e,function(o,n){t&&(o=ed(t)?t(o,n,e):td(o,t)),!as(o)&&(as(i)||r(i,o))&&(s=n,i=o)}),e[s]}return i}}var nn=rd,sd=nn,od=sd(function(r,e){return r<e}),an=od,nd=on,ad=an;function ld(r){var e,t,i,s=[];if(r&&r.length)for(e=0,t=ad(r,function(o){return o?o.length:0}),i=t?t.length:0;e<i;e++)s.push(nd(r,e));return s}var ln=ld,cd=ln;function hd(){return cd(arguments)}var dd=hd,ud=St,fd=J;function gd(r,e){var t={};return e=e||[],fd(ud(r),function(i,s){t[i]=e[s]}),t}var vd=gd,cn=z,md=te;function hn(r,e){var t=[];return md(r,function(i){t=t.concat(cn(i)?e?hn(i,e):i:[i])}),t}function xd(r,e){return cn(r)?hn(r,e):[]}var pd=xd,yd=at,wd=z;function Ed(r,e){for(var t=0,i=e.length;r&&t<i;)r=r[e[t++]];return i&&r?r:0}function Cd(r,e){for(var t,i=arguments,s=[],o=[],n=2,a=i.length;n<a;n++)s.push(i[n]);if(wd(e)){for(a=e.length-1,n=0;n<a;n++)o.push(e[n]);e=e[a]}return yd(r,function(c){if(o.length&&(c=Ed(c,o)),t=c[e]||e,t&&t.apply)return t.apply(c,s)})}var bd=Cd;function _d(r,e){return(console[r]||console.log)(e)}var Rd=_d;function Id(r,e){try{delete r[e]}catch{r[e]=void 0}}var dn=Id,Sd=z,Td=pr,Od=zo;function kd(r,e,t){return r&&(Sd(r)?Td:Od)(r,e,t)}var un=kd,Ld=bt,Dd=Ld("object"),Oi=Dd,$d=dn,Md=Rt,Ad=Oi,Nd=z,Bd=Be,Hd=ce,Fd=Pt;function Kd(r,e,t){if(r){var i,s=arguments.length>1&&(Bd(e)||!Ad(e)),o=s?t:e;if(Md(r))Fd(r,s?function(n,a){r[a]=e}:function(n,a){$d(r,a)}),o&&Hd(r,o);else if(Nd(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 fn=Kd,Pd=dn,Yd=ie,Vd=z,Wd=J,Xd=te,zd=un,Gd=fn,Ud=He;function qd(r){return function(e,t){return t===r}}function Zd(r,e,t){if(r){if(!Ud(e)){var i=[],s=[];return Yd(e)||(e=qd(e)),Wd(r,function(o,n,a){e.call(t,o,n,a)&&i.push(n)}),Vd(r)?zd(i,function(o,n){s.push(r[o]),r.splice(o,1)}):(s={},Xd(i,function(o){s[o]=r[o],Pd(r,o)})),s}return Gd(r)}return r}var gn=Zd,Jd=Le,ls=Rd,Qd=Er,jd=xr,eu=He,lr=J,tu=gn,iu=ce;function ru(r,e){lr(r,function(t){t[e]&&!t[e].length&&tu(t,e)})}function su(r,e){var t=iu({},Jd.treeOptions,e),i=t.strict,s=t.key,o=t.parentKey,n=t.children,a=t.mapChildren,c=t.sortKey,d=t.reverse,f=t.data,u=[],g={},m={},x,v,p;return c&&(r=Qd(jd(r),c),d&&(r=r.reverse())),lr(r,function(E){x=E[s],m[x]&&ls("warn","Duplicate primary key="+x),m[x]=!0}),lr(r,function(E){x=E[s],f?(v={},v[f]=E):v=E,p=E[o],g[x]=g[x]||[],v[s]=x,v[o]=p,x===p&&(p=null,ls("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&&eu(p))&&(m[p]||u.push(v))}),i&&ru(r,n),u}var ou=su,nu=Le,au=te,lu=ce;function vn(r,e,t,i){var s=i.key,o=i.parentKey,n=i.children,a=i.data,c=i.updated,d=i.clear;return au(t,function(f){var u=f[n];a&&(f=f[a]),c!==!1&&(f[o]=e?e[s]:null),r.push(f),u&&u.length&&vn(r,f,u,i),d&&delete f[n]}),r}function cu(r,e){return vn([],null,r,lu({},nu.treeOptions,e))}var hu=cu;function du(r){return function(e,t,i,s){var o=i||{},n=o.children||"children";return r(null,e,t,s,[],[],n,o)}}var ki=du,uu=ki;function mn(r,e,t,i,s,o,n,a){if(e){var c,d,f,u,g,m;for(d=0,f=e.length;d<f;d++){if(c=e[d],u=s.concat([""+d]),g=o.concat([c]),t.call(i,c,d,e,u,r,g))return{index:d,item:c,path:u,items:e,parent:r,nodes:g};if(n&&c&&(m=mn(c,c[n],t,i,u.concat([n]),g,n),m))return m}}}var fu=uu(mn),gu=fu,vu=ki,mu=J;function xn(r,e,t,i,s,o,n,a){var c,d;mu(e,function(f,u){c=s.concat([""+u]),d=o.concat([f]),t.call(i,f,u,e,c,r,d),f&&n&&(c.push(n),xn(f,f[n],t,i,c,d,n))})}var xu=vu(xn),pn=xu,pu=ki,yu=at;function yn(r,e,t,i,s,o,n,a){var c,d,f,u=a.mapChildren||n;return yu(e,function(g,m){return c=s.concat([""+m]),d=o.concat([g]),f=t.call(i,g,m,e,c,r,d),f&&g&&n&&g[n]&&(f[u]=yn(g,g[n],t,i,c,d,n,a)),f})}var wu=pu(yn),Eu=wu,Cu=pn;function bu(r,e,t,i){var s=[];return r&&e&&Cu(r,function(o,n,a,c,d,f){e.call(i,o,n,a,c,d,f)&&s.push(o)},t),s}var _u=bu,Ru=ki,Iu=te,Su=ce;function wn(r,e,t,i,s,o,n,a,c){var d,f,u,g,m,x=[],v=c.original,p=c.data,E=c.mapChildren||a,C=c.isEvery;return Iu(t,function(w,b){d=o.concat([""+b]),f=n.concat([w]),g=r&&!C||i.call(s,w,b,t,d,e,f),m=a&&w[a],g||m?(v?u=w:(u=Su({},w),p&&(u[p]=w)),u[E]=wn(g,w,w[a],i,s,d,f,a,c),(g||u[E].length)&&x.push(u)):g&&x.push(u)}),x}var Tu=Ru(function(r,e,t,i,s,o,n,a){return wn(0,r,e,t,i,s,o,n,a)}),Ou=Tu;function ku(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 En=ku;function Lu(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 Cn=Lu,Du=bt,$u=Du("number"),$e=$u,Mu=$e;function Au(r){return Mu(r)&&isNaN(r)}var Nu=Au,Bu=bt,Hu=Bu("string"),Fe=Hu,Fu=Kt,Ku=Fu("Date"),Ge=Ku,Pu=parseInt,Vt=Pu;function Yu(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 Vu=Yu;function Wu(r){return r.getTime()}var fe=Wu,xi=Vt,cs=Vu,Xu=fe,zu=Fe,Gu=Ge;function Wt(r){return"(\\d{"+r+"})"}function Uu(r){return r<10?r*100:r<100?r*10:r}function hs(r){return isNaN(r)?r:xi(r)}var gt=Wt(2),mt=Wt("1,2"),bn=Wt("1,7"),_n=Wt("3,4"),Rn=".{1}",Dt=Rn+mt,In="(([zZ])|([-+]\\d{2}:?\\d{2}))",ds=[_n,Dt,Dt,Dt,Dt,Dt,Rn+bn,In],cr=[];for(var Gi=ds.length-1;Gi>=0;Gi--){for(var us="",rt=0;rt<Gi+1;rt++)us+=ds[rt];cr.push(new RegExp("^"+us+"$"))}function qu(r){for(var e,t={},i=0,s=cr.length;i<s;i++)if(e=r.match(cr[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 fs=[["yyyy",_n],["yy",gt],["MM",gt],["M",mt],["dd",gt],["d",mt],["HH",gt],["H",mt],["mm",gt],["m",mt],["ss",gt],["s",mt],["SSS",Wt(3)],["S",bn],["Z",In]],Sn={},Tn=["\\[([^\\]]+)\\]"];for(var rt=0;rt<fs.length;rt++){var Ui=fs[rt];Sn[Ui[0]]=Ui[1]+"?",Tn.push(Ui[0])}var Zu=new RegExp(Tn.join("|"),"g"),gs={};function Ju(r,e){var t=gs[e];if(!t){var i=[],s=e.replace(/([$(){}*+.?\\^|])/g,"\\$1").replace(Zu,function(f,u){var g=f.charAt(0);return g==="["?u:(i.push(g),Sn[f])});t=gs[e]={_i:i,_r:new RegExp(s)}}var o={},n=r.match(t._r);if(n){for(var a=t._i,c=1,d=n.length;c<d;c++)o[a[c-1]]=n[c];return o}return o}function Qu(r){if(/^[zZ]/.test(r.Z))return new Date(cs(r));var e=r.Z.match(/([-+])(\d{2}):?(\d{2})/);return e?new Date(cs(r)-(e[1]==="-"?-1:1)*xi(e[2])*36e5+xi(e[3])*6e4):new Date("")}function ju(r,e){if(r){var t=Gu(r);if(t||!e&&/^[0-9]{11,15}$/.test(r))return new Date(t?Xu(r):xi(r));if(zu(r)){var i=e?Ju(r,e):qu(r);if(i.y)return i.M&&(i.M=hs(i.M)-1),i.S&&(i.S=Uu(hs(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=ju;function ef(){return new Date}var Li=ef,tf=Ge,rf=re,sf=Li;function of(r){var e,t=r?rf(r):sf();return tf(t)?(e=t.getFullYear(),e%4===0&&(e%100!==0||e%400===0)):!1}var On=of,nf=z,af=be;function lf(r,e,t){if(r){if(nf(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(af(r,o)&&e.call(t,r[o],o,r)===!1)break}}var cf=lf,hf=z,df=be;function uf(r,e,t){if(r){var i,s;if(hf(r))for(i=r.length-1;i>=0&&e.call(t,r[i],i,r)!==!1;i--);else for(s=df(r),i=s.length-1;i>=0&&e.call(t,r[s[i]],s[i],r)!==!1;i--);}}var ff=uf,gf=z,vf=Fe,mf=be;function xf(r,e){return function(t,i){if(t){if(t[r])return t[r](i);if(vf(t)||gf(t))return e(t,i);for(var s in t)if(mf(t,s)&&i===t[s])return s}return-1}}var kn=xf,pf=kn,yf=En,wf=pf("indexOf",yf),Ef=wf,Cf=kn,bf=Cn,_f=Cf("lastIndexOf",bf),Ln=_f,Rf=z,If=Fe,Sf=J;function Tf(r){var e=0;return If(r)||Rf(r)?r.length:(Sf(r,function(){e++}),e)}var Dn=Tf,Of=$e;function kf(r){return Of(r)&&isFinite(r)}var Lf=kf,Df=z,$f=Be,Mf=function(r){return!$f(r)&&!isNaN(r)&&!Df(r)&&r%1===0},$n=Mf,Af=z,Nf=$n,Bf=Be;function Hf(r){return!Bf(r)&&!isNaN(r)&&!Af(r)&&!Nf(r)}var Ff=Hf,Kf=bt,Pf=Kf("boolean"),Mn=Pf,Yf=Kt,Vf=Yf("RegExp"),Cr=Vf,Wf=Kt,Xf=Wf("Error"),An=Xf;function zf(r){return r?r.constructor===TypeError:!1}var Gf=zf;function Uf(r){for(var e in r)return!1;return!0}var Nn=Uf,qf=_e,Zf=typeof Symbol!==qf;function Jf(r){return Zf&&Symbol.isSymbol?Symbol.isSymbol(r):typeof r=="symbol"}var Bn=Jf,Qf=Kt,jf=Qf("Arguments"),eg=jf,tg=Fe,ig=$e;function rg(r){return!!(r&&tg(r.nodeName)&&ig(r.nodeType))}var sg=rg,og=_e,ng=typeof document===og?0:document,br=ng,ag=br;function lg(r){return!!(r&&ag&&r.nodeType===9)}var cg=lg,hg=_e,dg=typeof window===hg?0:window,Hn=dg,ug=Hn;function fg(r){return!!(ug&&(r&&r===r.window))}var gg=fg,vg=_e,mg=typeof FormData!==vg;function xg(r){return mg&&r instanceof FormData}var pg=xg,yg=_e,wg=typeof Map!==yg;function Eg(r){return wg&&r instanceof Map}var Cg=Eg,bg=_e,_g=typeof WeakMap!==bg;function Rg(r){return _g&&r instanceof WeakMap}var Ig=Rg,Sg=_e,Tg=typeof Set!==Sg;function Og(r){return Tg&&r instanceof Set}var kg=Og,Lg=_e,Dg=typeof WeakSet!==Lg;function $g(r){return Dg&&r instanceof WeakSet}var Mg=$g,Ag=ie,Ng=Fe,Bg=z,Hg=be;function Fg(r){return function(e,t,i){if(e&&Ag(t)){if(Bg(e)||Ng(e))return r(e,t,i);for(var s in e)if(Hg(e,s)&&t.call(i,e[s],s,e))return s}return-1}}var Fn=Fg,Kg=Fn,Pg=Kg(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}),_r=Pg,vs=$e,ms=z,xs=Fe,Yg=Cr,Vg=Ge,Wg=Mn,Xg=De,ps=Ne,zg=Zo;function Kn(r,e,t,i,s,o,n){if(r===e)return!0;if(r&&e&&!vs(r)&&!vs(e)&&!xs(r)&&!xs(e)){if(Yg(r))return t(""+r,""+e,s,o,n);if(Vg(r)||Wg(r))return t(+r,+e,s,o,n);var a,c,d,f=ms(r),u=ms(e);if(f||u?f&&u:r.constructor===e.constructor)return c=ps(r),d=ps(e),i&&(a=i(r,e,s)),c.length===d.length?Xg(a)?zg(c,function(g,m){return g===d[m]&&Kn(r[g],e[d[m]],t,i,f||u?m:g,r,e)}):!!a:!1}return t(r,e,s,o,n)}var Pn=Kn;function Gg(r,e){return r===e}var Yn=Gg,Ug=Pn,qg=Yn;function Zg(r,e){return Ug(r,e,qg)}var Vn=Zg,ys=Ne,Jg=_r,ws=Vn,Qg=qo,jg=Jo;function ev(r,e){var t=ys(r),i=ys(e);if(i.length){if(jg(t,i))return Qg(i,function(s){return Jg(t,function(o){return o===s&&ws(r[o],e[s])})>-1})}else return!0;return ws(r,e)}var tv=ev,Es=Pn,Cs=Yn,iv=ie,rv=De;function sv(r,e,t){return iv(t)?Es(r,e,function(i,s,o,n,a){var c=t(i,s,o,n,a);return rv(c)?Cs(i,s):!!c},t):Es(r,e,Cs)}var ov=sv,nv=Bn,av=Ge,lv=z,cv=Cr,hv=An,dv=Be;function uv(r){return dv(r)?"null":nv(r)?"symbol":av(r)?"date":lv(r)?"array":cv(r)?"regexp":hv(r)?"error":typeof r}var fv=uv,gv=Le,vv=He;function mv(r){return""+(vv(r)?"":r)+gv.keyId++}var xv=mv,pv=Fn,yv=pv(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}),wv=yv,Ev=Rt,Cv=Fe;function bv(r){if(Ev(r))return r;if(Cv(r))try{return JSON.parse(r)}catch{}return{}}var _v=bv,Rv=He;function Iv(r){return Rv(r)?"":JSON.stringify(r)}var Sv=Iv,Tv=mr,Ov=Tv("entries",2),kv=Ov,Lv=ie,Dv=z,$v=J,Mv=_r;function Av(r,e){return function(t,i){var s,o,n={},a=[],c=this,d=arguments,f=d.length;if(!Lv(i)){for(o=1;o<f;o++)s=d[o],a.push.apply(a,Dv(s)?s:[s]);i=0}return $v(t,function(u,g){((i?i.call(c,u,g,t):Mv(a,function(m){return m===g})>-1)?r:e)&&(n[g]=u)}),n}}var Wn=Av,Nv=Wn,Bv=Nv(1,0),Hv=Bv,Fv=Wn,Kv=Fv(0,1),Pv=Kv,Yv=St;function Vv(r){return Yv(r)[0]}var Wv=Vv,Xv=St;function zv(r){var e=Xv(r);return e[e.length-1]}var Gv=zv,Uv=jo,qv=wr,oi=be;function Zv(r,e){if(r){if(oi(r,e))return!0;var t,i,s,o,n,a,c=qv(e),d=0,f=c.length;for(n=r;d<f&&(a=!1,t=c[d],o=t?t.match(Uv):"",o?(i=o[1],s=o[2],i?n[i]&&oi(n[i],s)&&(a=!0,n=n[i][s]):oi(n,s)&&(a=!0,n=n[s])):oi(n,t)&&(a=!0,n=n[t]),a);d++)if(d===f-1)return!0}return!1}var Jv=Zv,bs=Vt,Qv=wr,jv=Go,em=be,_s=/(.+)?\[(\d+)\]$/;function tm(r,e,t,i,s){if(r[e])t&&(r[e]=s);else{var o,n,a=e?e.match(_s):null;if(t)n=s;else{var c=i?i.match(_s):null;c&&!c[1]?n=new Array(bs(c[2])+1):n={}}return a?a[1]?(o=bs(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 im(r,e,t){if(r&&jv(e)){if((r[e]||em(r,e))&&!Rs(e))r[e]=t;else for(var i=r,s=Qv(e),o=s.length,n=0;n<o;n++)if(!Rs(s[n])){var a=n===o-1;i=tm(i,s[n],a,a?null:s[n+1],t)}}return r}function Rs(r){return r==="__proto__"||r==="constructor"||r==="prototype"}var rm=im,sm=Nn,om=Oi,nm=ie,am=_t,lm=J;function cm(r){return function(){return sm(r)}}function hm(r,e,t){var i,s={};return r&&(e&&om(e)?e=cm(e):nm(e)||(e=am(e)),lm(r,function(o,n){i=e?e.call(t,o,n,r):o,s[i]?s[i].push(o):s[i]=[o]})),s}var Xn=hm,dm=Xn,um=Pt;function fm(r,e,t){var i=dm(r,e,t||this);return um(i,function(s,o){i[o]=s.length}),i}var gm=fm;function vm(r,e,t){var i,s,o=[],n=arguments;if(n.length<2&&(e=n[0],r=0),i=r>>0,s=e>>0,i<e)for(t=t>>0||1;i<s;i+=t)o.push(i);return o}var zn=vm,Is=Ne,mm=ct,xm=It,pm=te,ym=ce;function wm(r,e){if(r&&e){var t=ym.apply(this,[{}].concat(mm(arguments,1))),i=Is(t);pm(Is(r),function(s){xm(i,s)&&(r[s]=t[s])})}return r}var Em=wm,Cm=nn,bm=Cm(function(r,e){return r>e}),_m=bm;function Rm(r){return(r.split(".")[1]||"").length}var Di=Rm,Im=Vt;function Sm(r,e){if(r.repeat)return r.repeat(e);var t=isNaN(e)?[]:new Array(Im(e));return t.join(r)+(t.length>0?r:"")}var Xt=Sm;function Tm(r,e){return r.substring(0,e)+"."+r.substring(e,r.length)}var Gn=Tm,ni=Xt,qi=Gn;function Om(r){var e=""+r,t=e.match(/^([-+]?)((\d+)|((\d+)?[.](\d+)?))e([-+]{1})([0-9]+)$/);if(t){var i=r<0,s=i?"-":"",o=t[3]||"",n=t[5]||"",a=t[6]||"",c=t[7],d=t[8],f=d-a.length,u=d-o.length,g=d-n.length;return c==="+"?o?s+o+ni("0",d):f>0?s+n+a+ni("0",f):s+n+qi(a,d):o?u>0?s+"0."+ni("0",Math.abs(u))+o:s+qi(o,u):g>0?s+"0."+ni("0",Math.abs(g))+n+a:s+qi(n,g)+a}return e}var Ue=Om,Ss=Di,Ts=Ue;function km(r,e){var t=Ts(r),i=Ts(e);return parseInt(t.replace(".",""))*parseInt(i.replace(".",""))/Math.pow(10,Ss(t)+Ss(i))}var Un=km,Lm=Un,Os=lt,Dm=Ue;function $m(r){return function(e,t){var i=Os(e),s=i;if(i){t=t>>0;var o=Dm(i),n=o.split("."),a=n[0],c=n[1]||"",d=c.substring(0,t+1),f=a+(d?"."+d:"");if(t>=c.length)return Os(f);if(f=i,t>0){var u=Math.pow(10,t);s=Math[r](Lm(f,u))/u}else s=Math[r](f)}return s}}var Rr=$m,Mm=Rr,Am=Mm("round"),Ir=Am,Nm=Rr,Bm=Nm("ceil"),qn=Bm,Hm=Rr,Fm=Hm("floor"),Zn=Fm,Km=He,Pm=$e,Ym=Ue;function Vm(r){return Pm(r)?Ym(r):""+(Km(r)?"":r)}var se=Vm,Wm=Ir,Xm=se,zm=Xt,Gm=Gn;function Um(r,e){e=e>>0;var t=Xm(Wm(r,e)),i=t.split("."),s=i[0],o=i[1]||"",n=e-o.length;return e?n>0?s+"."+o+zm("0",n):s+Gm(o,Math.abs(n)):s}var Sr=Um,qm=Le,Zm=Ir,Jm=qn,Qm=Zn,jm=$e,ex=se,tx=Sr,ix=Ue,rx=ce;function sx(r,e){var t=rx({},qm.commafyOptions,e),i=t.digits,s=jm(r),o,n,a,c,d;return s?(o=(t.ceil?Jm:t.floor?Qm:Zm)(r,i),n=ix(i?tx(o,i):o).split("."),c=n[0],d=n[1],a=c&&o<0,a&&(c=c.substring(1,c.length))):(o=ex(r).replace(/,/g,""),n=o?[o]:[],c=n[0]),n.length?(a?"-":"")+c.replace(new RegExp("(?=(?!(\\b))(.{"+(t.spaceNumber||3)+"})+$)","g"),t.separator||",")+(d?"."+d:""):o}var ox=sx,nx=Vt,ax=sn,lx=ax(nx),cx=lx,hx=Un,ks=lt;function dx(r,e){var t=ks(r),i=ks(e);return hx(t,i)}var Tr=dx,Ls=Di,Ds=Ue,$s=Tr;function ux(r,e){var t=Ds(r),i=Ds(e),s=Math.pow(10,Math.max(Ls(t),Ls(i)));return($s(r,s)+$s(e,s))/s}var Jn=ux,fx=Jn,Ms=lt;function gx(r,e){return fx(Ms(r),Ms(e))}var vx=gx,As=Di,Ns=Ue,Bs=lt,mx=Sr;function xx(r,e){var t=Bs(r),i=Bs(e),s=Ns(t),o=Ns(i),n=As(s),a=As(o),c=Math.pow(10,Math.max(n,a)),d=n>=a?n:a;return parseFloat(mx((t*c-i*c)/c,d))}var px=xx,Hs=Di,Fs=Ue,yx=Tr;function wx(r,e){var t=Fs(r),i=Fs(e),s=Hs(t),o=Hs(i),n=o-s,a=n<0,c=Math.pow(10,a?Math.abs(n):n);return yx(t.replace(".","")/i.replace(".",""),a?1/c:c)}var Qn=wx,Ex=Qn,Ks=lt;function Cx(r,e){return Ex(Ks(r),Ks(e))}var bx=Cx,Zi=Jn,_x=ie,Rx=z,Ix=J,Sx=Yt;function Tx(r,e,t){var i=0;return Ix(r&&r.length>2&&Rx(r)?r.sort():r,e?_x(e)?function(){i=Zi(i,e.apply(t,arguments))}:function(s){i=Zi(i,Sx(s,e))}:function(s){i=Zi(i,s)}),i}var jn=Tx,Ox=Qn,kx=Dn,Lx=jn;function Dx(r,e,t){return Ox(Lx(r,e,t),kx(r))}var $x=Dx,Mx="first",zt=Mx,Ax="last",$i=Ax;function Nx(r){return r.getFullYear()}var Gt=Nx,Bx=864e5,Tt=Bx;function Hx(r){return r.getMonth()}var Mi=Hx,Fx=Ge,Kx=fe;function Px(r){return Fx(r)&&!isNaN(Kx(r))}var ge=Px,Ps=zt,Yx=$i,Vx=Tt,Wx=Gt,Ys=fe,Vs=Mi,Xx=re,zx=ge,Gx=$e;function ea(r,e,t){var i=e&&!isNaN(e)?e:0;if(r=Xx(r),zx(r)){if(t===Ps)return new Date(Wx(r),Vs(r)+i,1);if(t===Yx)return new Date(Ys(ea(r,i+1,Ps))-1);if(Gx(t)&&r.setDate(t),i){var s=r.getDate();if(r.setMonth(Vs(r)+i),s!==r.getDate())return r.setDate(1),new Date(Ys(r)-Vx)}}return r}var Ut=ea,Ux=zt,Ws=$i,Xs=Gt,qx=Ut,Zx=re,Jx=ge;function Qx(r,e,t){var i;if(r=Zx(r),Jx(r)&&(e&&(i=e&&!isNaN(e)?e:0,r.setFullYear(Xs(r)+i)),t||!isNaN(t))){if(t===Ux)return new Date(Xs(r),0,1);if(t===Ws)return r.setMonth(11),qx(r,0,Ws);r.setMonth(t)}return r}var Ai=Qx,jx=Ut,ep=re,tp=ge;function ip(r){var e=r.getMonth();return e<3?1:e<6?2:e<9?3:4}function rp(r,e,t){var i,s=e&&!isNaN(e)?e*3:0;return r=ep(r),tp(r)?(i=(ip(r)-1)*3,r.setMonth(i),jx(r,s,t)):r}var sp=rp,zs=zt,op=$i,np=Vt,ap=Gt,lp=Mi,cp=fe,hp=re,dp=ge;function ta(r,e,t){if(r=hp(r),dp(r)&&!isNaN(e)){if(r.setDate(r.getDate()+np(e)),t===zs)return new Date(ap(r),lp(r),r.getDate());if(t===op)return new Date(cp(ta(r,1,zs))-1)}return r}var ia=ta;function up(r){return r.toUpperCase()}var ra=up,fp=Tt,gp=fp*7,sa=gp,vp=Le,Ji=Tt,mp=sa,xp=fe,pp=re,yp=ge,Gs=$e;function wp(r,e,t,i){if(r=pp(r),yp(r)){var s=Gs(t),o=Gs(i),n=xp(r);if(s||o){var a=o?i:vp.firstDayOfWeek,c=r.getDay(),d=s?t:c;if(c!==d){var f=0;a>c?f=-(7-a+c):a<c&&(f=a-c),d>a?n+=((d===0?7:d)-a+f)*Ji:d<a?n+=(7-a+d+f)*Ji:n+=f*Ji}}return e&&!isNaN(e)&&(n+=e*mp),new Date(n)}return r}var oa=wp,Ep=Le,ai=Tt,Cp=sa,bp=$e,_p=It,Rp=re,Ip=ge,Us=oa,Sp=zn,Tp=at,li=fe,Op=Tp(Sp(0,7),function(r){return[(r+1)%7,(r+2)%7,(r+3)%7]});function qs(r,e){var t=new Date(r).getDay();return _p(Op[e],t)}function kp(r,e){return function(t,i){var s=bp(i)?i:Ep.firstDayOfWeek,o=Rp(t);if(Ip(o)){var n=Us(o,0,s,s),a=r(n),c=li(a),d=li(n),f=d+ai*6,u=new Date(f),g=Us(a,0,s,s),m=li(g),x;if(d===m)return 1;if(e(n,u)){for(x=li(r(u));x<f;x+=ai)if(qs(x,s))return 1}var v=m+ai*6,p=new Date(f),E=1;if(e(g,p)){for(E=0,x=c;x<v;x+=ai)if(qs(x,s)){E++;break}}return Math.floor((d-m)/Cp)+E}return NaN}}var na=kp,Lp=na,Dp=Lp(function(r){return new Date(r.getFullYear(),0,1)},function(r,e){return r.getFullYear()!==e.getFullYear()}),aa=Dp,$p=Gt,Mp=Mi;function Ap(r){return new Date($p(r),Mp(r),r.getDate())}var Np=Ap,Bp=fe,Hp=Np;function Fp(r){return Bp(Hp(r))}var Kp=Fp,Pp=Tt,Yp=zt,Zs=Kp,Vp=Ai,Wp=re,Xp=ge;function zp(r){return r=Wp(r),Xp(r)?Math.floor((Zs(r)-Zs(Vp(r,0,Yp)))/Pp)+1:NaN}var la=zp,Gp=se,Up=De,qp=Xt;function Zp(r,e,t){var i=Gp(r);return e=e>>0,t=Up(t)?" ":""+t,i.padStart?i.padStart(e,t):e>i.length?(e-=i.length,e>t.length&&(t+=qp(t,e/t.length)),t.slice(0,e)+i):i}var ca=Zp,$t=Le,Jp=ra,Qp=Gt,Js=Mi,jp=re,e0=aa,t0=la,i0=ce,r0=ge,s0=ie,Se=ca;function Pe(r,e,t,i){var s=e[t];return s?s0(s)?s(i,t,r):s[i]:i}var o0=/\[([^\]]+)]|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 n0(r,e,t){if(r){if(r=jp(r),r0(r)){var i=e||$t.parseDateFormat||$t.formatString,s=r.getHours(),o=s<12?"am":"pm",n=i0({},$t.parseDateRules||$t.formatStringMatchs,t?t.formats:null),a=function(w,b){return(""+Qp(r)).substr(4-b)},c=function(w,b){return Se(Js(r)+1,b,"0")},d=function(w,b){return Se(r.getDate(),b,"0")},f=function(w,b){return Se(s,b,"0")},u=function(w,b){return Se(s<=12?s:s-12,b,"0")},g=function(w,b){return Se(r.getMinutes(),b,"0")},m=function(w,b){return Se(r.getSeconds(),b,"0")},x=function(w,b){return Se(r.getMilliseconds(),b,"0")},v=function(w,b){var T=r.getTimezoneOffset()/60*-1;return Pe(r,n,w,(T>=0?"+":"-")+Se(T,2,"0")+(b===1?":":"")+"00")},p=function(w,b){return Se(Pe(r,n,w,e0(r,(t?t.firstDay:null)||$t.firstDayOfWeek)),b,"0")},E=function(w,b){return Se(Pe(r,n,w,t0(r)),b,"0")},C={yyyy:a,yy:a,MM:c,M:c,dd:d,d,HH:f,H:f,hh:u,h:u,mm:g,m:g,ss:m,s:m,SSS:x,S:x,ZZ:v,Z:v,WW:p,W:p,DDD:E,D:E,a:function(w){return Pe(r,n,w,o)},A:function(w){return Pe(r,n,w,Jp(o))},e:function(w){return Pe(r,n,w,r.getDay())},E:function(w){return Pe(r,n,w,r.getDay())},q:function(w){return Pe(r,n,w,Math.floor((Js(r)+3)/3))}};return i.replace(o0,function(w,b){return b||(C[w]?C[w](w,w.length):w)})}return"Invalid Date"}return""}var ha=n0,a0=fe,l0=Li,c0=Date.now||function(){return a0(l0())},da=c0,h0=fe,d0=da,u0=re,f0=Ge,g0=function(r,e){if(r){var t=u0(r,e);return f0(t)?h0(t):t}return d0()},v0=g0,Qs=ha;function m0(r,e,t){return r&&e?(r=Qs(r,t),r!=="Invalid Date"&&r===Qs(e,t)):!1}var x0=m0,p0=na,y0=p0(function(r){return new Date(r.getFullYear(),r.getMonth(),1)},function(r,e){return r.getMonth()!==e.getMonth()}),w0=y0,E0=Ai,C0=re,b0=ge,_0=On;function R0(r,e){return r=C0(r),b0(r)?_0(E0(r,e))?366:365:NaN}var I0=R0,S0=Tt,T0=zt,O0=$i,js=fe,eo=Ut,k0=re,L0=ge;function D0(r,e){return r=k0(r),L0(r)?Math.floor((js(eo(r,e,O0))-js(eo(r,e,T0)))/S0)+1:NaN}var $0=D0,to=fe,M0=Li,io=re,ro=ge,so=[["yyyy",31536e6],["MM",2592e6],["dd",864e5],["HH",36e5],["mm",6e4],["ss",1e3],["S",0]];function A0(r,e){var t,i,s,o,n,a,c={done:!1,time:0};if(r=io(r),e=e?io(e):M0(),ro(r)&&ro(e)&&(t=to(r),i=to(e),t<i))for(o=c.time=i-t,c.done=!0,a=0,n=so.length;a<n;a++)s=so[a],o>=s[1]?a===n-1?c[s[0]]=o||0:(c[s[0]]=Math.floor(o/s[1]),o-=c[s[0]]*s[1]):c[s[0]]=0;return c}var N0=A0,B0=se,H0=De,F0=Xt;function K0(r,e,t){var i=B0(r);return e=e>>0,t=H0(t)?" ":""+t,i.padEnd?i.padEnd(e,t):e>i.length?(e-=i.length,e>t.length&&(t+=F0(t,e/t.length)),i+t.slice(0,e)):i}var P0=K0,Y0=se,V0=Xt;function W0(r,e){return V0(Y0(r),e)}var X0=W0,z0=se;function G0(r){return r&&r.trimRight?r.trimRight():z0(r).replace(/[\s\uFEFF\xA0]+$/g,"")}var ua=G0,U0=se;function q0(r){return r&&r.trimLeft?r.trimLeft():U0(r).replace(/^[\s\uFEFF\xA0]+/g,"")}var fa=q0,Z0=ua,J0=fa;function Q0(r){return r&&r.trim?r.trim():Z0(J0(r))}var ga=Q0,j0={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},va=j0,e1=se,t1=Ne;function i1(r){var e=new RegExp("(?:"+t1(r).join("|")+")","g");return function(t){return e1(t).replace(e,function(i){return r[i]})}}var ma=i1,r1=va,s1=ma,o1=s1(r1),n1=o1,oo=va,a1=ma,l1=J,xa={};l1(oo,function(r,e){xa[oo[e]]=e});var c1=a1(xa),h1=c1;function d1(r,e,t){return r.substring(e,t)}var pa=d1;function u1(r){return r.toLowerCase()}var ya=u1,f1=se,Ye=pa,Mt=ra,g1=ya,Qi={};function v1(r){if(r=f1(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=g1(s),o?n>2&&o+n<e?Mt(Ye(s,0,1))+Ye(s,1,n-1)+Mt(Ye(s,n-1,n)):Mt(Ye(s,0,1))+Ye(s,1,n):n>1&&o+n<e?Ye(s,0,n-1)+Mt(Ye(s,n-1,n)):s}).replace(/(-[a-zA-Z])/g,function(i,s){return Mt(Ye(s,1,s.length))}),Qi[r]=t,t}var m1=v1,x1=se,vt=pa,Ve=ya,ji={};function p1(r){if(r=x1(r),ji[r])return ji[r];if(/^[A-Z]+$/.test(r))return Ve(r);var e=r.replace(/^([a-z])([A-Z]+)([a-z]+)$/,function(t,i,s,o){var n=s.length;return n>1?i+"-"+Ve(vt(s,0,n-1))+"-"+Ve(vt(s,n-1,n))+o:Ve(i+"-"+s+o)}).replace(/^([A-Z]+)([a-z]+)?$/,function(t,i,s){var o=i.length;return Ve(vt(i,0,o-1)+"-"+vt(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||"")+Ve(vt(s,0,a-1))+"-"+Ve(vt(s,a-1,a))+o:(i||"")+(n?"-":"")+Ve(s)+(o||"")});return e=e.replace(/([-]+)/g,function(t,i,s){return s&&s+i.length<e.length?"-":""}),ji[r]=e,e}var y1=p1,w1=se;function E1(r,e,t){var i=w1(r);return(arguments.length===1?i:i.substring(t)).indexOf(e)===0}var C1=E1,b1=se;function _1(r,e,t){var i=b1(r),s=arguments.length;return s>1&&(s>2?i.substring(0,t).indexOf(e)===t-1:i.indexOf(e)===i.length-1)}var R1=_1,I1=Le,S1=se,T1=ga,O1=Yt;function k1(r,e,t){return S1(r).replace((t||I1).tmplRE||/\{{2}([.\w[\]\s]+)\}{2}/g,function(i,s){return O1(e,T1(s))})}var wa=k1,L1=wa;function D1(r,e){return L1(r,e,{tmplRE:/\{([.\w[\]\s]+)\}/g})}var $1=D1;function M1(){}var A1=M1,no=ct;function N1(r,e){var t=no(arguments,2);return function(){return r.apply(e,no(arguments).concat(t))}}var B1=N1,ao=ct;function H1(r,e){var t=!1,i=null,s=ao(arguments,2);return function(){return t||(i=r.apply(e,ao(arguments).concat(s)),t=!0),i}}var F1=H1,K1=ct;function P1(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(K1(o)))}}var Y1=P1,V1=ct;function W1(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(V1(o))))}}var X1=W1,z1=ce;function G1(r,e,t){var i=null,s=null,o=!1,n=null,a=z1({leading:!0,trailing:!0},t),c=a.leading,d=a.trailing,f=function(){i=null,s=null},u=function(){o=!0,r.apply(s,i),n=setTimeout(g,e),f()},g=function(){if(n=null,o){f();return}if(d===!0){u();return}f()},m=function(){var v=n!==null;return v&&clearTimeout(n),f(),n=null,o=!1,v},x=function(){if(i=arguments,s=this,o=!1,n===null&&c===!0){u();return}d===!0&&(n=setTimeout(g,e))};return x.cancel=m,x}var U1=G1,q1=ce;function Z1(r,e,t){var i=null,s=null,o=typeof t=="boolean"?{leading:t,trailing:!t}:q1({leading:!1,trailing:!0},t),n=!1,a=null,c=o.leading,d=o.trailing,f=function(){i=null,s=null},u=function(){n=!0,r.apply(s,i),f()},g=function(){if(c===!0&&(a=null),n){f();return}if(d===!0){u();return}f()},m=function(){var v=a!==null;return v&&clearTimeout(a),f(),a=null,n=!1,v},x=function(){n=!1,i=arguments,s=this,a===null?c===!0&&u():clearTimeout(a),a=setTimeout(g,e)};return x.cancel=m,x}var J1=Z1,Q1=ct;function j1(r,e){var t=Q1(arguments,2),i=this;return setTimeout(function(){r.apply(i,t)},e)}var ey=j1,ty=decodeURIComponent,Ea=ty,lo=Ea,iy=te,ry=Fe;function sy(r){var e,t={};return r&&ry(r)&&iy(r.split("&"),function(i){e=i.split("="),t[lo(e[0])]=lo(e[1]||"")}),t}var Ca=sy,oy=encodeURIComponent,ba=oy,pi=ba,_a=J,Ra=z,Ia=Be,ny=De,Sa=Rt;function Ta(r,e,t){var i,s=[];return _a(r,function(o,n){i=Ra(o),Sa(o)||i?s=s.concat(Ta(o,e+"["+n+"]",i)):s.push(pi(e+"["+(t?"":n)+"]")+"="+pi(Ia(o)?"":o))}),s}function ay(r){var e,t=[];return _a(r,function(i,s){ny(i)||(e=Ra(i),Sa(i)||e?t=t.concat(Ta(i,s,e)):t.push(pi(s)+"="+pi(Ia(i)?"":i)))}),t.join("&").replace(/%20/g,"+")}var ly=ay,cy=_e,hy=typeof location===cy?0:location,Ni=hy,ci=Ni;function dy(){return ci?ci.origin||ci.protocol+"//"+ci.host:""}var Oa=dy,co=Ni,uy=Ca,fy=Oa;function ho(r){return uy(r.split("?")[1]||"")}function gy(r){var e,t,i,s,o=""+r;return o.indexOf("//")===0?o=(co?co.protocol:"")+o:o.indexOf("/")===0&&(o=fy()+o),i=o.replace(/#.*/,"").match(/(\?.*)/),s={href:o,hash:"",host:"",hostname:"",protocol:"",port:"",search:i&&i[1]&&i[1].length>1?i[1]:""},s.path=o.replace(/^([a-z0-9.+-]*:)\/\//,function(n,a){return s.protocol=a,""}).replace(/^([a-z0-9.+-]*)(:\d+)?\/?/,function(n,a,c){return t=c||"",s.port=t.replace(":",""),s.hostname=a,s.host=a+t,"/"}).replace(/(#.*)/,function(n,a){return s.hash=a.length>1?a:"",""}),e=s.hash.match(/#((.*)\?|(.*))/),s.pathname=s.path.replace(/(\?|#.*).*/,""),s.origin=s.protocol+"//"+s.host,s.hashKey=e&&(e[2]||e[1])||"",s.hashQuery=ho(s.hash),s.searchQuery=ho(s.search),s}var ka=gy,uo=Ni,vy=Oa,my=Ln;function xy(){if(uo){var r=uo.pathname,e=my(r,"/")+1;return vy()+(e===r.length?r:r.substring(0,e))}return""}var py=xy,fo=Ni,yy=ka;function wy(){return fo?yy(fo.href):{}}var Ey=wy,La=Le,er=br,go=Ea,vo=ba,Cy=z,mo=Oi,Da=Ge,by=De,_y=It,Ry=Ne,yi=ce,tr=te,Iy=Li,hi=fe,Sy=Ai,Ty=Ut,Oy=ia;function xo(r,e){var t=parseFloat(e),i=Iy(),s=hi(i);switch(r){case"y":return hi(Sy(i,t));case"M":return hi(Ty(i,t));case"d":return hi(Oy(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 ir(r){return(Da(r)?r:new Date(r)).toUTCString()}function Xe(r,e,t){if(er){var i,s,o,n,a,c,d=[],f=arguments;return Cy(r)?d=r:f.length>1?d=[yi({name:r,value:e},t)]:mo(r)&&(d=[r]),d.length>0?(tr(d,function(u){i=yi({},La.cookies,u),o=[],i.name&&(s=i.expires,o.push(vo(i.name)+"="+vo(mo(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 ir(xo(x,m))}):/^[0-9]{11,13}$/.test(s)||Da(s)?s=ir(s):s=ir(xo("d",s)),i.expires=s),tr(["expires","path","domain","secure"],function(g){by(i[g])||o.push(i[g]&&g==="secure"?g:g+"="+i[g])})),er.cookie=o.join("; ")}),!0):(n={},a=er.cookie,a&&tr(a.split("; "),function(u){c=u.indexOf("="),n[go(u.substring(0,c))]=go(u.substring(c+1)||"")}),f.length===1?n[r]:n)}return!1}function ky(r){return _y($a(),r)}function po(r){return Xe(r)}function yo(r,e,t){return Xe(r,e,t),Xe}function wo(r,e){Xe(r,"",yi({expires:-1},La.cookies,e))}function $a(){return Ry(Xe())}function Ly(){return Xe()}yi(Xe,{has:ky,set:yo,setItem:yo,get:po,getItem:po,remove:wo,removeItem:wo,keys:$a,getJSON:Ly});var Dy=Xe,$y=_e,rr=br,sr=Hn,My=ce,Ay=te;function Eo(r){try{var e="__xe_t";return r.setItem(e,1),r.removeItem(e),!0}catch{return!1}}function di(r){return navigator.userAgent.indexOf(r)>-1}function Ny(){var r,e,t,i=!1,s=!1,o=!1,n={isNode:!1,isMobile:i,isPC:!1,isDoc:!!rr};if(!sr&&typeof process!==$y)n.isNode=!0;else{t=di("Edge"),e=di("Chrome"),i=/(Android|webOS|iPhone|iPad|iPod|SymbianOS|BlackBerry|Windows Phone)/.test(navigator.userAgent),n.isDoc&&(r=rr.body||rr.documentElement,Ay(["webkit","khtml","moz","ms","o"],function(a){n["-"+a]=!!r[a+"MatchesSelector"]}));try{s=Eo(sr.localStorage)}catch{}try{o=Eo(sr.sessionStorage)}catch{}My(n,{edge:t,firefox:di("Firefox"),msie:!t&&n["-ms"],safari:!e&&!t&&di("Safari"),isMobile:i,isPC:!i,isLocalStorage:s,isSessionStorage:o})}return n}var By=Ny,Ma=Jl,Co=ce,Hy=Pt,Fy=zo,Ky=cc,Py=mc,Yy=at,Vy=qo,Wy=Zo,Xy=Jo,zy=te,Gy=pr,Uy=Qo,qy=Hc,Zy=yr,Jy=vh,Qy=Er,jy=rn,ew=_h,tw=ct,iw=Lh,rw=Mh,sw=It,ow=Bh,nw=Ph,aw=Wh,lw=Gh,cw=Zh,hw=dd,dw=ln,uw=vd,fw=pd,gw=on,vw=bd,mw=ou,xw=hu,pw=gu,yw=pn,ww=Eu,Ew=_u,Cw=Ou,bw=En,_w=Cn,Rw=be,Iw=z,Sw=Be,Tw=Nu,Ow=De,kw=ie,Lw=Oi,Dw=Fe,$w=Rt,Mw=On,Aw=Ge,Nw=He,Bw=J,Hw=cf,Fw=ff,Kw=Ef,Pw=Ln,Yw=Ne,Vw=St,Ww=xr,Xw=Dn,zw=un,Gw=gn,Uw=fn,qw=Lf,Zw=Ff,Jw=$n,Qw=Mn,jw=$e,eE=Cr,tE=An,iE=Gf,rE=Nn,sE=Bn,oE=eg,nE=sg,aE=cg,lE=gg,cE=pg,hE=Cg,dE=Ig,uE=kg,fE=Mg,gE=tv,vE=Vn,mE=ov,xE=fv,pE=xv,yE=_r,wE=wv,EE=_v,CE=Sv,bE=kv,_E=Hv,RE=Pv,IE=Wv,SE=Gv,TE=Jv,OE=Yt,kE=rm,LE=Xn,DE=gm,$E=zn,ME=Em,AE=tn,NE=an,BE=_m,HE=ox,FE=Ir,KE=qn,PE=Zn,YE=Sr,VE=cx,WE=lt,XE=Ue,zE=vx,GE=px,UE=Tr,qE=bx,ZE=jn,JE=$x,QE=Ai,jE=sp,e2=Ut,t2=ia,i2=re,r2=ha,s2=da,o2=v0,n2=ge,a2=x0,l2=oa,c2=la,h2=aa,d2=w0,u2=I0,f2=$0,g2=N0,v2=P0,m2=ca,x2=X0,p2=ga,y2=ua,w2=fa,E2=n1,C2=h1,b2=m1,_2=y1,R2=C1,I2=R1,S2=wa,T2=$1,bo=se,O2=A1,k2=_t,L2=B1,D2=F1,$2=Y1,M2=X1,A2=U1,N2=J1,B2=ey,H2=Ca,F2=ly,K2=ka,P2=py,Y2=Ey,V2=Dy,W2=By;Co(Ma,{assign:Co,objectEach:Hy,lastObjectEach:Fy,objectMap:Ky,merge:Py,uniq:Uy,union:qy,sortBy:Jy,orderBy:Qy,shuffle:jy,sample:ew,some:Vy,every:Wy,slice:tw,filter:iw,find:ow,findLast:nw,findKey:rw,includes:sw,arrayIndexOf:bw,arrayLastIndexOf:_w,map:Yy,reduce:aw,copyWithin:lw,chunk:cw,zip:hw,unzip:dw,zipObject:uw,flatten:fw,toArray:Zy,includeArrays:Xy,pluck:gw,invoke:vw,arrayEach:zy,lastArrayEach:Gy,toArrayTree:mw,toTreeArray:xw,findTree:pw,eachTree:yw,mapTree:ww,filterTree:Ew,searchTree:Cw,hasOwnProp:Rw,eqNull:Nw,isNaN:Tw,isFinite:qw,isUndefined:Ow,isArray:Iw,isFloat:Zw,isInteger:Jw,isFunction:kw,isBoolean:Qw,isString:Dw,isNumber:jw,isRegExp:eE,isObject:Lw,isPlainObject:$w,isDate:Aw,isError:tE,isTypeError:iE,isEmpty:rE,isNull:Sw,isSymbol:sE,isArguments:oE,isElement:nE,isDocument:aE,isWindow:lE,isFormData:cE,isMap:hE,isWeakMap:dE,isSet:uE,isWeakSet:fE,isLeapYear:Mw,isMatch:gE,isEqual:vE,isEqualWith:mE,getType:xE,uniqueId:pE,getSize:Xw,indexOf:Kw,lastIndexOf:Pw,findIndexOf:yE,findLastIndexOf:wE,toStringJSON:EE,toJSONString:CE,keys:Yw,values:Vw,entries:bE,pick:_E,omit:RE,first:IE,last:SE,each:Bw,forOf:Hw,lastForOf:Fw,lastEach:zw,has:TE,get:OE,set:kE,groupBy:LE,countBy:DE,clone:Ww,clear:Uw,remove:Gw,range:$E,destructuring:ME,random:AE,min:BE,max:NE,commafy:HE,round:FE,ceil:KE,floor:PE,toFixed:YE,toNumber:WE,toNumberString:XE,toInteger:VE,add:zE,subtract:GE,multiply:UE,divide:qE,sum:ZE,mean:JE,now:s2,timestamp:o2,isValidDate:n2,isDateSame:a2,toStringDate:i2,toDateString:r2,getWhatYear:QE,getWhatQuarter:jE,getWhatMonth:e2,getWhatWeek:l2,getWhatDay:t2,getYearDay:c2,getYearWeek:h2,getMonthWeek:d2,getDayOfYear:u2,getDayOfMonth:f2,getDateDiff:g2,trim:p2,trimLeft:w2,trimRight:y2,escape:E2,unescape:C2,camelCase:b2,kebabCase:_2,repeat:x2,padStart:m2,padEnd:v2,startsWith:R2,endsWith:I2,template:S2,toFormatString:T2,toString:bo,toValueString:bo,noop:O2,property:k2,bind:L2,once:D2,after:$2,before:M2,throttle:A2,debounce:N2,delay:B2,unserialize:H2,serialize:F2,parseUrl:K2,getBaseURL:P2,locat:Y2,browse:W2,cookie:V2});var S=Ma,j=[];for(var or=0;or<256;++or)j.push((or+256).toString(16).slice(1));function X2(r,e=0){return(j[r[e+0]]+j[r[e+1]]+j[r[e+2]]+j[r[e+3]]+"-"+j[r[e+4]]+j[r[e+5]]+"-"+j[r[e+6]]+j[r[e+7]]+"-"+j[r[e+8]]+j[r[e+9]]+"-"+j[r[e+10]]+j[r[e+11]]+j[r[e+12]]+j[r[e+13]]+j[r[e+14]]+j[r[e+15]]).toLowerCase()}var ui,z2=new Uint8Array(16);function G2(){if(!ui&&(ui=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ui))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ui(z2)}var U2=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const _o={randomUUID:U2};function Ae(r,e,t){if(_o.randomUUID&&!r)return _o.randomUUID();r=r||{};var i=r.random||(r.rng||G2)();return i[6]=i[6]&15|64,i[8]=i[8]&63|128,X2(i)}const q2=r=>r==null||r==="",Z=r=>!q2(r),it=r=>r==null,ue=r=>!it(r),Z2=r=>function(e,t,i,s){const o=i||{},n=o.children||"children";return r(null,e,t,s,[],[],n,o)},Aa=(r,e,t,i,s,o,n)=>{let a,c;e.forEach((d,f)=>{a=s.concat([""+f]),c=o.concat([d]),t.call(i,d,f,e,a,r,c),d&&n&&(a.push(n),Aa(d,d[n]||[],t,i,a,c,n))})},Nt=Z2(Aa),Na={form:{labelCol:{span:6},wrapperCol:{span:16}},grid:{align:"left",lazyReset:!1,fitHeight:170,striped:!1},canvasTable:{DISABLED:!0,ENABLE_FINDER:!0,AUTO_ROW_HEIGHT:!0}};let ne=S.clone(Na,!0);function Ba(r){ne={form:{...ne.form,...r.form},grid:{...ne.grid,...r.grid},canvasTable:{...ne.canvasTable,...r.canvasTable}}}function J2(){return ne}function Ro(){var r,e;return{labelCol:(r=ne.form)==null?void 0:r.labelCol,wrapperCol:(e=ne.form)==null?void 0:e.wrapperCol}}function xt(){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 Ha(){return ne.canvasTable||{}}function Q2(){ne=JSON.parse(JSON.stringify(Na))}const Bi=r=>{var e;return{dataIndex:r.field,key:r.field,title:r.title,...S.omit(r,["children","slots","cellRender","formatter"]),children:(e=r.children)==null?void 0:e.map(t=>Bi(t))}},Or={xs:24,sm:24,md:12,lg:8,xl:8,xxl:6},kr={xs:12,sm:5,md:6,lg:6,xl:5,xxl:4},j2={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}},Fa=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},Io=["xxs","xs","sm","md","lg","xl","xxl"],eC=r=>{const e=S.isArray(r)?r:S.isNumber(r)?Array.from({length:r},()=>Or):[];return S.zipObject(Io,Io.map(t=>e.every(i=>Z(i[t]))?Fa(e.map(i=>i[t])):24))};function Lr(r,e,t){const i=l.toValue(r);if(typeof i!="object"||i===null)return l.watch(r,e,t);let s=S.clone(i,!0);return l.watch(r,(o,n,a)=>{e(o,s,a),s=S.clone(o,!0)},t)}const tt="-",pt={toString:({cellValue:r})=>{var e;return r?((e=r.toString)==null?void 0:e.call(r))??tt:tt},formatByOptions:({cellValue:r},e,t=",")=>{if(r==null)return tt;if(S.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):tt}else return tt;const i=e.find(s=>s.value===r);return i?i.label:tt},formatSex:({cellValue:r})=>Z(r)?S.toNumber(r)===1?"男":"女":tt},tC=(r,{record:e,index:t,column:i,field:s})=>{if(S.isString(r)&&pt[r]){const o=pt[r];return o({row:e,rowIndex:t,cellValue:s?e[s]:null})}else if(S.isArray(r)&&pt[r[0]]&&r.length>1){const o=pt[r[0]];return o({row:e,rowIndex:t,cellValue:s?e[s]:null},...r.slice(1))}else return S.isFunction(r)?r({row:e,rowIndex:t,cellValue:s?e[s]:null,column:i}):s?e[s]:null},Ka=r=>{Object.assign(pt,r)},iC=l.defineComponent(r=>{const{cellRender:e,renderTableParams:t}=r,{data:i,row:s,field:o,rowIndex:n}=t;return()=>{var a,c;return((c=(a=Bt.renders[e.name])==null?void 0:a.renderDefault)==null?void 0:c.call(a,e,{data:i,row:s,field:o,rowIndex:n},r.defaultHandler))??null}},{name:"RenderAntCell",props:["cellRender","renderTableParams","defaultHandler"]}),Pa=l.defineComponent(r=>{const{tableData:e,row:t,column:i,rowIndex:s}=r,o=i.field?t[i.field]:null;return()=>{var n,a;return((a=(n=i.slots)==null?void 0:n.default)==null?void 0:a.call(n,{row:t,column:i,rowIndex:s,cellValue:o}))??(i.cellRender?l.createVNode(iC,{cellRender:i.cellRender,defaultHandler:r.defaultHandler,renderTableParams:{data:e,row:t,field:i.field,rowIndex:s}},null):i.formatter?tC(i.formatter,{record:t,index:s,field:i.field,column:i}):o)}},{name:"RenderAntDefaultCell",props:["tableData","row","column","rowIndex","defaultHandler"]}),rC={class:"text-right mt-4px"},sC=l.defineComponent({__name:"TableInput",props:{modelValue:{type:Array,default:()=>[]},tableConfig:{type:Object,default:()=>({})},editColumns:{type:Array,default:()=>[]}},emits:["update:modelValue","trigger"],setup(r,{emit:e}){const t=r,i={size:"small",pagination:!1};l.watch(()=>t.modelValue,()=>{o("trigger")},{deep:!0});const s=l.computed(()=>S.merge({},i,t.tableConfig)),o=e,n=l.computed({get:()=>t.modelValue??[],set:u=>{o("update:modelValue",u)}}),a=l.computed(()=>[...t.editColumns,{title:"操作",fixed:"right",width:100,cellRender:{name:"ButtonTree",children:[{content:"删除",type:"link",danger:!0,clickEvt:({rowIndex:u})=>d(u)}]}}]),c=()=>{n.value=[...n.value,{}]},d=u=>{n.value=n.value.filter((g,m)=>m!==u)},f=l.computed(()=>{let u=0;return a.value.filter(g=>g.slots&&g.slots.default||g.formatter||g.cellRender?(g.field||(g.field="__holder__"+u,u++),!0):!1)});return(u,g)=>{const m=l.resolveComponent("a-form-item-rest"),x=l.resolveComponent("a-table"),v=l.resolveComponent("a-button");return l.openBlock(),l.createElementBlock("div",null,[l.createVNode(x,l.mergeProps({"data-source":n.value},s.value,{columns:a.value.map(p=>l.unref(Bi)(p))}),l.createSlots({_:2},[f.value.length>0?{name:"bodyCell",fn:l.withCtx(({column:p,record:E,index:C})=>[l.createVNode(m,null,{default:l.withCtx(()=>[f.value.some(w=>p.key&&w.field===p.key)?(l.openBlock(),l.createBlock(l.unref(Pa),{key:C,"row-index":C,"default-handler":{},column:f.value.find(w=>p.key&&w.field===p.key),row:E,"table-data":n.value},null,8,["row-index","column","row","table-data"])):l.createCommentVNode("",!0)]),_:2},1024)]),key:"0"}:void 0]),1040,["data-source","columns"]),l.createElementVNode("div",rC,[l.createVNode(v,{type:"primary",onClick:c},{default:l.withCtx(()=>g[0]||(g[0]=[l.createTextVNode("+添加",-1)])),_:1,__:[0]})])])}}}),ae=r=>{const{icon:e}=r,t=gl;return t[e]?l.createVNode(t[e]):t[e]},At={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())}},fi={PercentInput:{controls:!1,min:0,max:100,addonAfter:"%"},autoComplete:{inputProps:{}}},Ya={$input:A.Input,AInput:A.Input,$textarea:A.Textarea,Textarea:A.Textarea,$number:A.InputNumber,AInputNumber:A.InputNumber,$select:A.Select,ASelect:A.Select,$date:A.DatePicker,ADatePicker:A.DatePicker,$range:A.RangePicker,ARangePicker:A.RangePicker,AAutoComplete:A.AutoComplete,$Cascader:A.Cascader,ACascader:A.Cascader,ACheckbox:A.Checkbox,AMentions:A.Mentions,ARate:A.Rate,ASlider:A.Slider,$time:A.TimePicker,ATimePicker:A.TimePicker,ATreeSelect:A.TreeSelect},oC=r=>{const e=Ya[r];return{renderItemContent({props:t={},attrs:i={},events:s={},defaultValue:o},{data:n,field:a}){return ue(o)&&Z(a)&&it(n[a])&&(n[a]=o),a?l.createVNode(e,l.mergeProps({is:r,value:n[a],"onUpdate:value":c=>n[a]=c},i,S.merge({},At[r],t),{onChange:(...c)=>{var d;(d=s.change)==null||d.call(s,{data:n,field:a},...c)}}),null):l.createVNode(e,l.mergeProps({is:r},t),null)},renderDefault({props:t=At[r]??{},attrs:i={},events:s={},defaultValue:o},{data:n,row:a,field:c}){return ue(o)&&Z(c)&&it(a[c])&&(a[c]=o),c?l.createVNode(e,l.mergeProps({is:r,value:a[c],"onUpdate:value":d=>a[c]=d},i,S.merge({},At[r],t),{onChange:(...d)=>{var f;(f=s.change)==null||f.call(s,{data:n,row:a,field:c},...d)}}),null):l.createVNode(e,l.mergeProps({is:r},t),null)},renderEdit(t,{props:i=At[r]??{},attrs:s={},events:o={}},n,a){return l.createVNode(e,l.mergeProps({is:r,value:t.value,"onUpdate:value":c=>t.value=c},s,S.merge({},At[r],i),{onBlur:(...c)=>{var d;a==null||a("blur",t.value),(d=o.blur)==null||d.call(o,n,...c)}}),null)}}},Va=(r,e,t)=>{var i,s;return r.dropdowns&&r.dropdowns.length>0&&r.dropdowns.filter(o=>{var n;return!((n=o.hiddenIf)!=null&&n.call(o,e))}).length>0?l.createVNode(A.Dropdown,{getPopupContainer:t??(()=>document.querySelector(".p-wrapper"))},{default:()=>{var o;return l.createVNode(A.Button,l.mergeProps(S.omit(r,["dynamicClassName","content","getContent","icon","clickEvt","dropdowns","getProps"]),{icon:r.icon?l.createVNode(ae,{icon:r.icon},null):l.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 l.createVNode("div",{class:`dropdown-wrapper ${((o=r==null?void 0:r.dynamicClassName)==null?void 0:o.call(r,e))??""}`},[r.dropdowns.filter(n=>{var a;return!((a=n.hiddenIf)!=null&&a.call(n,e))}).map(n=>Va(n,e,t))])}}):l.createVNode(A.Button,l.mergeProps({class:((i=r==null?void 0:r.dynamicClassName)==null?void 0:i.call(r,e))||""},S.omit(r,["dynamicClassName","content","getContent","icon","clickEvt","dropdowns","getProps"]),{disabled:!!r.dropdowns&&r.dropdowns.length>0||r.disabled,icon:r.icon?l.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))??"")]}})},hr={...Object.fromEntries(Object.keys(Ya).map(r=>[r,oC(r)])),$button:{renderItemContent({props:r={},events:e={}},{data:t,field:i},s){return l.createVNode(A.Button,l.mergeProps(S.omit(r,["content"]),{icon:r.icon?l.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&&S.isFunction(r.beforeClick)?r.beforeClick({data:t,field:i}).then(n=>{s.reset(n?{data:n,field:i}:{data:t,field:i})}):s.reset({data:t,field:i}))}}),{default:()=>{var o;return[r.content,((o=r.suffix)==null?void 0:o.call(r,{data:t,field:i}))??null]}})},renderDefault({props:r={},events:e={}},{row:t,field:i},s){return l.createVNode(A.Button,l.mergeProps(S.omit(r,["content"]),{icon:r.icon?l.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&&S.isFunction(r.beforeClick)?((n=s==null?void 0:s.setLoadings)==null||n.call(s,!0),r.beforeClick({row:t,field:i}).then(c=>{s.reset(c?{row:c,field:i}:{row:t,field:i})}).finally(()=>{var c;(c=s==null?void 0:s.setLoadings)==null||c.call(s,!1)})):s.reset({row:t,field:i})),r.htmlType==="pick"&&(s!=null&&s.pick)&&(r.beforeClick&&S.isFunction(r.beforeClick)?((a=s==null?void 0:s.setLoadings)==null||a.call(s,!0),r.beforeClick({row:t,field:i}).then(c=>{s.pick(c?{row:c,field:i}:{row:t,field:i})}).finally(()=>{var c;(c=s==null?void 0:s.setLoadings)==null||c.call(s,!1)})):s.pick({row:t,field:i}))}}),{default:()=>[r.content]})}},$buttons:{renderItemContent({props:r={},children:e=[]},{data:t,field:i},s){return l.createVNode("span",{class:"align-gap-box w-fit"},[e.map(o=>l.createVNode(A.Button,l.mergeProps(S.omit(Object.assign({},r,o.props),["content"]),{icon:o.props.icon?l.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&&S.isFunction(r.beforeClick)?r.beforeClick({data:t,field:i}).then(c=>{s.reset(c?{data:c,field:i}:{data:t,field:i})}):s.reset({data:t,field:i})),o.props.htmlType==="pick"&&(s!=null&&s.pick)&&(r.beforeClick&&S.isFunction(r.beforeClick)?r.beforeClick({data:t,field:i}).then(c=>{s.pick(c?{data:c,field:i}:{data:t,field:i})}):s.pick({data:t,field:i}))}}),{default:()=>[o.props.content]}))])},renderDefault({props:r={},children:e=[]},{data:t,row:i,field:s},o){return l.createVNode("span",{class:"align-gap-box w-fit"},[e.filter(n=>{var a,c;return!((c=(a=n==null?void 0:n.props)==null?void 0:a.hiddenIf)!=null&&c.call(a,{data:t,row:i,field:s}))}).map(n=>l.createVNode(A.Button,l.mergeProps(S.omit(Object.assign({},r,n.props),["content","hiddenIf"]),{icon:n.props.icon?l.createVNode(ae,{icon:n.props.icon},null):null,onClick:()=>{var a,c,d,f;(c=(a=n.events)==null?void 0:a.click)==null||c.call(a,{data:t,row:i,field:s}),n.props.htmlType==="reset"&&(o!=null&&o.reset)&&(r.beforeClick&&S.isFunction(r.beforeClick)?((d=o==null?void 0:o.setLoadings)==null||d.call(o,!0),r.beforeClick({row:i,field:s}).then(u=>{o.reset(u?{row:u,field:s}:{row:i,field:s})}).finally(()=>{var u;(u=o==null?void 0:o.setLoadings)==null||u.call(o,!1)})):o.reset({row:i,field:s})),n.props.htmlType==="pick"&&(o!=null&&o.pick)&&(r.beforeClick&&S.isFunction(r.beforeClick)?((f=o==null?void 0:o.setLoadings)==null||f.call(o,!0),r.beforeClick({row:i,field:s}).then(u=>{o.pick(u?{row:u,field:s}:{row:i,field:s})}).finally(()=>{var u;(u=o==null?void 0:o.setLoadings)==null||u.call(o,!1)})):o.pick({row:i,field:s}))}}),{default:()=>[n.props.content]}))])}},ButtonTree:{renderDefault({children:r=[],props:e={}},t){const i=l.ref(null);return l.createVNode("span",{ref:i,class:e.noGap?"align-no-gap-box":"align-gap-box"},[r.filter(s=>{var o;return!((o=s.hiddenIf)!=null&&o.call(s,t))}).map(s=>Va(s,t,()=>{var o,n,a,c;return((c=(a=(n=(o=i.value)==null?void 0:o.parentElement)==null?void 0:n.parentElement)==null?void 0:a.parentElement)==null?void 0:c.parentElement)||document.body}))??[]])}},$radio:{renderItemContent({props:r={},events:e={},options:t,defaultValue:i},{data:s,field:o}){return ue(i)&&Z(o)&&it(s[o])&&(s[o]=i),Z(o)?l.createVNode(A.RadioGroup,l.mergeProps({value:s[o],"onUpdate:value":n=>s[o]=n},r,{options:r.options??t??[],disabled:!!r.disabled,onChange:(...n)=>{var a;(a=e.change)==null||a.call(e,{data:s,field:o},...n)}}),null):null},renderDefault({props:r={},options:e},{row:t,field:i}){return Z(i)?l.createVNode(A.RadioGroup,l.mergeProps({value:t[i],"onUpdate:value":s=>t[i]=s},r,{options:r.options??e??[]}),null):null}},$autoComplete:{renderItemContent({props:r={},events:e={}},{data:t,field:i}){return Z(i)?l.createVNode(A.AutoComplete,l.mergeProps({value:t[i],"onUpdate:value":s=>t[i]=s},Object.assign({},{filterOption:fi.autoComplete.filterOption},r),{onChange:(...s)=>{var o;(o=e.change)==null||o.call(e,{data:t,field:i},...s)}}),{default:()=>l.createVNode(l.resolveComponent("a-input"),Object.assign({},fi.autoComplete.inputProps,r.inputProps??{}),null)}):null}},$switch:{renderItemContent({props:r={},events:e={},defaultValue:t},{data:i,field:s}){return ue(t)&&Z(s)&&it(i[s])&&(i[s]=t),Z(s)?l.createVNode(A.Switch,l.mergeProps({checked:i[s],"onUpdate:checked":o=>i[s]=o},r,{onChange:(...o)=>{var n;(n=e.change)==null||n.call(e,{data:i,field:s},...o)}}),null):null}},$checkbox:{renderItemContent({props:r={},options:e,events:t={},defaultValue:i},{data:s,field:o}){return ue(i)&&Z(o)&&it(s[o])&&(s[o]=i),Z(o)?l.createVNode(A.CheckboxGroup,l.mergeProps({value:s[o],"onUpdate:value":n=>s[o]=n},r,{options:r.options??e??[],onChange:(...n)=>{var a;(a=t.change)==null||a.call(t,{data:s,field:o},...n)}}),null):null},renderDefault({props:r={},options:e},{row:t,field:i}){return Z(i)?l.createVNode(A.CheckboxGroup,l.mergeProps({value:t[i],"onUpdate:value":s=>t[i]=s},r,{options:r.options??e??[]}),null):null}},$paragraph:{renderDefault({props:r={}},{row:e,field:t}){var o;const i={ellipsis:{expandable:!0,rows:3}},s=((o=r.getContent)==null?void 0:o.call(r,{row:e,field:t}))??(Z(t)?e[t]:"");return Z(t)?l.createVNode(A.TypographyParagraph,l.mergeProps(S.merge({},i,S.omit(r,["content","getContent"])),{content:s}),null):null}},$tableInput:{renderItemContent({props:r={},handleTrigger:e},{data:t,field:i}){return Z(i)?l.createVNode(sC,{modelValue:t[i],"onUpdate:modelValue":s=>t[i]=s,onTrigger:()=>{e&&S.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)&&it(i[s])&&(i[s]=t);const n=l.computed({get:()=>(i[s]??0)*o,set:a=>{i[s]=(a??0)/o}});return l.createVNode("div",{class:"flex items-center"},[r.info?l.createVNode("span",{class:"pr-4"},[r.info]):null,l.createVNode(l.resolveComponent("a-input-number"),l.mergeProps({class:"w-60px!"},e,{value:n.value,"onUpdate:value":a=>n.value=a},S.merge({},fi.PercentInput,S.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=l.computed({get:()=>(t[i]??0)*s,set:n=>{S.set(t,i,(n??0)/s)}});return[r.info?l.createVNode("span",{class:"pr-4"},[r.info]):null,l.createVNode(l.resolveComponent("a-input-number"),l.mergeProps({class:"w-60px!"},e,{value:o.value,"onUpdate:value":n=>o.value=n},S.merge({},fi.PercentInput,S.omit(r,["info"]))),null)]}else return null}},TreeSelect:{renderItemContent({props:r={}},{data:e,field:t}){return Z(t)?l.createVNode(A.TreeSelect,l.mergeProps({value:e[t],"onUpdate:value":i=>e[t]=i},r),null):null},renderDefault({props:r={}},{row:e,field:t}){return Z(t)?l.createVNode(A.TreeSelect,l.mergeProps({value:e[t],"onUpdate:value":i=>e[t]=i},r),null):null}}},Dr=(r,{renderItemContent:e,renderDefault:t,renderEdit:i})=>{hr.hasOwnProperty(r)&&console.warn(`render ${r} already exists, you are trying to override it`),hr[r]={renderItemContent:e,renderDefault:t,renderEdit:i}},Bt={renders:hr,addRender:Dr},nC=l.defineComponent((r,{emit:e})=>{const{itemRender:t,defaultHandler:i}=r,{renderFormParams:s}=l.toRefs(r),o=a=>{e("trigger",a)},n=(a,c)=>{e("delayTrigger",a,c)};return()=>{var a,c;return((c=(a=Bt.renders[t.name])==null?void 0:a.renderItemContent)==null?void 0:c.call(a,{...t,handleTrigger:o,handleDelayTrigger:n},s.value,i))??null}},{name:"RenderAntItem",props:{itemRender:{type:Object,required:!0},renderFormParams:{type:Object,required:!0},defaultHandler:{type:Object,required:!1}},emits:["trigger","delayTrigger"]}),aC=l.defineComponent(r=>{const{formData:e}=l.toRefs(r);return()=>{var t,i;return((i=(t=r.item.slots)==null?void 0:t.default)==null?void 0:i.call(t,{data:e.value,field:r.item.field},r.passTrigger,r.passDelayTrigger))??null}},{name:"RenderItemSlots",props:["formData","item","passTrigger","passDelayTrigger"]}),lC={key:2},cC=["innerHTML"],$r=l.defineComponent({__name:"PFormCol",props:{item:{},formData:{}},emits:["trigger","reset"],setup(r,{emit:e}){const t=r,i=e,s=l.ref(!1),o=l.ref(Ae()),n=(u,g)=>{const m=g??222;s.value=!0,setTimeout(()=>{s.value=!1,i("trigger",u)},m)},a=u=>{i("trigger",u)},c=()=>{i("reset")},d=()=>{o.value=Ae()},f=S.debounce(d,100);return Lr(()=>t.item,(u,g)=>{S.isEqual(u,g)||f()},{deep:!0}),(u,g)=>{const m=l.resolveComponent("a-tooltip"),x=l.resolveComponent("a-form-item"),v=l.resolveComponent("a-col");return l.openBlock(),l.createBlock(v,l.mergeProps({key:`_col_${o.value}`},u.item.col??(u.item.span?{span:u.item.span}:l.unref(Or))),{default:l.withCtx(()=>{var p;return[(l.openBlock(),l.createBlock(x,l.mergeProps({key:`_item_${o.value}`,class:[`p-content-align-${u.item.align??"left"} ${u.item.forceRequired?"p-required":""}`,{"p-error-hang-out":s.value}],colon:"",label:u.item.title,name:u.item.field,"wrapper-col":u.item.wrapperCol??(u.item.title?void 0:{span:24})},l.unref(S.omit)(u.item,["field","title","span","col","wrapperCol","itemRender","forceRequired","tooltip"])),l.createSlots({default:l.withCtx(()=>{var E,C;return[(E=u.item.slots)!=null&&E.default?(l.openBlock(),l.createBlock(l.unref(aC),{key:`_sl_${u.item.field??"_"}_${o.value}`,"form-data":u.formData,item:u.item,"pass-delay-trigger":n,"pass-trigger":a},null,8,["form-data","item"])):(C=u.item.itemRender)!=null&&C.name?(l.openBlock(),l.createBlock(l.unref(nC),{key:`_re_${u.item.field??"_"}_${o.value}`,"default-handler":{reset:c},"item-render":u.item.itemRender,"render-form-params":{data:u.formData,field:u.item.field},onDelayTrigger:n,onTrigger:a},null,8,["default-handler","item-render","render-form-params"])):(l.openBlock(),l.createElementBlock("span",lC))]}),_:2},[(p=u.item.slots)!=null&&p.title?{name:"label",fn:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(u.item.slots.title)))]),key:"0"}:void 0,u.item.tooltipConfig?{name:"tooltip",fn:l.withCtx(()=>[l.unref(S.isFunction)(u.item.tooltipConfig.title)?(l.openBlock(),l.createBlock(m,l.normalizeProps(l.mergeProps({key:0},l.unref(S.omit)(u.item.tooltipConfig,["title"]))),{title:l.withCtx(()=>[l.createElementVNode("div",{innerHTML:u.item.tooltipConfig.title()},null,8,cC)]),default:l.withCtx(()=>[l.createVNode(l.unref(wt.InfoCircleOutlined),{class:"cursor-pointer py-4 px-2"})]),_:1},16)):(l.openBlock(),l.createBlock(m,l.normalizeProps(l.mergeProps({key:1},u.item.tooltipConfig)),{default:l.withCtx(()=>[l.createVNode(l.unref(wt.InfoCircleOutlined),{class:"cursor-pointer py-4 px-2"})]),_:1},16))]),key:"1"}:void 0]),1040,["class","label","name","wrapper-col"]))]}),_:1},16)}}}),hC={key:0,class:"p-pane p-wrapper"},Mr=l.defineComponent({__name:"PForm",props:{items:{},customReset:{},layout:{},labelCol:{default:()=>Ro().labelCol??{span:6}},wrapperCol:{default:()=>Ro().wrapperCol??{span:16}},colon:{type:Boolean},labelAlign:{},labelWrap:{type:Boolean},prefixCls:{},requiredMark:{},hideRequiredMark:{type:Boolean},model:{},rules:{},validateMessages:{},validateOnRuleChange:{type:Boolean},scrollToFirstError:{},onSubmit:{},name:{},validateTrigger:{},size:{},disabled:{type:Boolean},onValuesChange:{},onFieldsChange:{},onFinish:{},onFinishFailed:{},onValidate:{},data:{}},emits:["apply","reset"],setup(r,{expose:e,emit:t}){const i=r,s=t,{items:o,data:n}=l.toRefs(i);function a(){s("apply",n.value)}const c=l.ref(),d=l.ref(Ae()),f=()=>{d.value=Ae()},u=()=>{if(i.customReset)i.customReset();else{const v={};Nt(o.value,p=>{p.field&&p.itemRender?ue(p.itemRender.defaultValue)?v[p.field]=p.itemRender.defaultValue:v[p.field]=void 0:p.field&&p.slots&&(ue(p.slots.defaultValue)?v[p.field]=p.slots.defaultValue:v[p.field]=void 0)}),Object.assign(n.value,v)}s("reset")},g=l.computed(()=>({...S.omit(i,["items","data","model","labelCol","wrapperCol"]),labelCol:i.labelCol,wrapperCol:i.wrapperCol})),m=v=>{var p;v&&((p=c.value)==null||p.validateFields(v))},x=v=>{m(v)};return e({reset:f,$form:l.computed(()=>c.value)}),(v,p)=>l.unref(o).some(E=>{var C;return E.field&&E.itemRender||((C=E.slots)==null?void 0:C.default)})?(l.openBlock(),l.createElementBlock("div",hC,[(l.openBlock(),l.createBlock(l.unref(A.Form),l.mergeProps({key:d.value,ref_key:"formEl",ref:c,model:l.unref(n)},g.value,{onSubmit:a}),{default:l.withCtx(()=>[l.createVNode(l.unref(A.Row),{gutter:[6,12]},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(o),(E,C)=>(l.openBlock(),l.createBlock($r,{key:`_col_${E.field||C}`,"form-data":l.unref(n),item:E,onReset:u,onTrigger:x},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["model"]))])):l.createCommentVNode("",!0)}}),dC=l.defineComponent(r=>{const{column:e}=r;return()=>{var t,i;return((i=(t=e.slots)==null?void 0:t.title)==null?void 0:i.call(t,{column:e}))??e.title}},{name:"RenderAntTitle",props:["column"]}),Wa=({title:r,content:e})=>new Promise((t,i)=>{A.Modal.confirm({title:r,content:e,onOk:()=>{t()},onCancel:()=>{i()}})}),uC=A.message.success,fC=A.message.error;A.message.info;const wi=A.message.warning,gC={key:0},vC={key:1,class:"p-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"},mC={class:"flex items-center flex-1 gap-4px"},xC={key:2},pC={class:"flex items-center gap-4px"},yC={key:0,class:"w-full text-slate-5 pl-4"},Ar=l.defineComponent({__name:"PGrid",props:{selectConfig:{},rowKey:{default:"id"},striped:{type:Boolean,default:()=>xt().striped??!1},manualFetch:{type:Boolean},align:{default:()=>xt().align??"left"},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},tableConfig:{},scrollMode:{default:"inner"},lazyReset:{type:Boolean,default:()=>xt().lazyReset??!1},fitHeight:{default:()=>xt().fitHeight??170},fitCanvasHeight:{},renderY:{}},emits:["toolbarButtonClick","toolbarToolClick","pick","resetQuery"],setup(r,{expose:e,emit:t}){var xe,Lt,F,pe,Re;const i=r,{formConfig:s,pageConfig:o,columns:n,toolbarConfig:a,proxyConfig:c,tableConfig:d,selectConfig:f,scrollMode:u}=l.toRefs(i),g=l.reactive({table:!1,toolbar:!1,form:!1}),m=k=>{S.isObject(k)?Object.keys(k).forEach(N=>{g[N]=k[N]}):S.isBoolean(k)&&(g.form=k,g.table=k,g.toolbar=k)},x=l.ref(),v=l.ref(),p=l.ref(500),E=l.ref([]),C=l.ref([]),w=k=>{const{ajax:N}=c.value;switch(k){case"multiDelete":N.multiDelete&&(E.value.length>0?Wa({title:"警告",content:"确认删除选中的数据吗?"}).then(()=>{g.table=!0,g.toolbar=!0,N.multiDelete(E.value).then(()=>{A.message.success("删除成功"),ut()}).catch(()=>{A.message.error("删除失败")}).finally(()=>{g.table=!1,g.toolbar=!1,I.multiDelete=!1})}):A.message.warn("请选择要删除的数据"));break}},b=l.computed(()=>{const k=[];return Nt(n.value??[],N=>{N.slots&&N.slots.title&&(N.field||(N.field="__holder__"+k.length),k.push(N))}),k}),T=l.ref(),B=l.ref(),K=l.ref(Ae()),R=l.ref(Ae()),I=l.reactive([...(((Lt=(xe=i.toolbarConfig)==null?void 0:xe.buttons)==null?void 0:Lt.map(k=>k.code))??[]).filter(k=>k),...(((pe=(F=i.toolbarConfig)==null?void 0:F.tools)==null?void 0:pe.map(k=>k.code))??[]).filter(k=>k)].reduce((k,N)=>(k[N]=!1,k),{})),_=(k,N)=>{I[k]=N},O=()=>{R.value=Ae()},y=S.debounce(O,100),D=l.computed(()=>{const k=[];return Nt(n.value??[],N=>{(N.slots&&N.slots.default||N.formatter||N.cellRender)&&(N.field||(N.field="__holder__"+k.length),k.push(N))}),k}),L=l.reactive({page:1,size:((Re=o.value)==null?void 0:Re.pageSize)??10}),Y=l.ref(0),W=l.ref(0),P=l.ref([]),X=l.computed(()=>c.value&&c.value.ajax?o.value?"pagination":"list":"bad"),U=l.useAttrs(),q=t,Ke=l.computed(()=>C.value.filter(k=>E.value.includes(k[i.rowKey??"id"]))),ht=k=>{q("toolbarButtonClick",{data:P.value,code:k,selectedKeys:E.value,records:Ke.value}),w(k)},he=S.debounce(ht,100),qe=({key:k})=>he(k),ee=k=>{q("toolbarToolClick",{data:P.value,code:k,selectedKeys:E.value,records:Ke.value}),w(k)},Pi=S.debounce(ee,100),ve=l.ref({}),Yi=({row:k,field:N})=>{q("pick",{row:k,field:N})},Ze=k=>{if(s.value&&s.value.items.length>0){if(s.value.customReset)s.value.customReset();else{const N={};Nt(s.value.items,G=>{G.field&&G.itemRender?ue(G.itemRender.defaultValue)?N[G.field]=G.itemRender.defaultValue:N[G.field]=void 0:G.field&&G.slots&&(ue(G.slots.defaultValue)?N[G.field]=G.slots.defaultValue:N[G.field]=void 0)}),ve.value=N}q("resetQuery")}L.page=1,k||ft()},dt=(k,N)=>N?{list:S.isString(N.list)?S.get(k,N.list):S.isFunction(N.list)?N.list(k):void 0,total:S.isString(N.total)?S.get(k,N.total):S.isFunction(N.total)?N.total(k):void 0,result:S.isString(N.result)?S.get(k,N.result):S.isFunction(N.result)?N.result(k):void 0,message:S.isString(N.message)?S.get(k,N.message):S.isFunction(N.message)?N.message(k):void 0}:{list:k},Qt=l.ref(!0),Vi=()=>(C.value=[],E.value=[],Ze()),ut=()=>(L.page=1,C.value=[],E.value=[],Je()),Wi=(k,N,G)=>(L.page=k.current,L.size=k.pageSize,Je()),Je=()=>new Promise(k=>{if(X.value!=="bad"){g.form=!0,g.table=!0;const{ajax:N}=c.value;N.query({form:ve.value,page:L}).then(G=>{const{list:ye,total:et,result:Q,message:Ie}=dt(G,c.value.response);ye?(P.value=ye,Y.value++):Q?(P.value=Q,W.value=et??Q.length,Y.value++):(P.value=[],Y.value++,Ie&&A.message.warn(Ie)),k(P.value)}).catch(G=>{console.error("fetchData error",G),k([])}).finally(()=>{g.form=!1,g.table=!1})}}),ft=S.debounce(Je,160),Qe=(k,N)=>(Object.assign(ve.value,k),L.page=1,N?Promise.resolve():ft()),kt=(k,N)=>(ve.value=k,L.page=1,N?Promise.resolve():ft()),jt=l.computed(()=>X.value==="pagination"?{current:L.page,total:W.value,pageSize:L.size,responsive:!1,showSizeChanger:!0,showTotal:k=>`共${k}条数据`}:!1),ei={size:"small",sticky:!0,transformCellText:({text:k})=>S.isArray(k)&&k.length===0?"-":k},ti=l.computed(()=>S.merge({},ei,(d==null?void 0:d.value)??{},f.value?{rowSelection:{type:f.value.multiple?"checkbox":"radio",preserveSelectedRowKeys:!0,selectedRowKeys:E.value,onChange:k=>{E.value=k;const N=i.rowKey??"id",G=C.value.map(Q=>Q[N]),et=k.filter(Q=>!G.includes(Q)).map(Q=>P.value.find(Ie=>Ie[N]===Q)).filter(Q=>!!Q);C.value=[...C.value,...et]},getCheckboxProps:f.value.getCheckboxProps}}:{})),ii=l.computed(()=>S.omit({labelCol:kr,...s.value},["items"])),ri=()=>{ut()};l.watch(()=>[n.value,c.value,a.value],()=>{y()},{deep:!0});const $=()=>{var Q,Ie;const k=(Q=x.value)==null?void 0:Q.parentElement,N=k?window.getComputedStyle(k).height:"0px",G=v.value?window.getComputedStyle(v.value).height:"0px",ye=G.includes("px")?S.toNumber(G.replace("px","")):0,et=(Ie=f.value)!=null&&Ie.showCount?22:0;p.value=i.renderY??S.toNumber(N.replace("px",""))-i.fitHeight-(i.toolbarConfig?30:0)-ye-et,Qt.value=S.toNumber(N.replace("px",""))>600};e({commitProxy:{query:ft,reload:Vi,reloadPage:ut,passQuery:Qe,forcePassQuery:kt},$table:l.computed(()=>B.value),selectedRowKeys:l.computed(()=>E.value),setBtnLoading:_,selectedRecords:Ke,$form:l.computed(()=>T.value),getFormData:()=>ve.value,setLoadings:m,resizeTable:$});let H;l.onMounted(()=>{$(),window.addEventListener("resize",$),H=new MutationObserver(k=>{k.forEach(N=>{if(N.type==="attributes"&&N.attributeName==="style"){const G=N.target;window.getComputedStyle(G).display!=="none"&&$()}})}),x.value&&H.observe(x.value,{attributes:!0,attributeFilter:["style"]}),Ze(i.manualFetch)});const V=k=>S.isFunction(k)?k():k,de=k=>S.isString(k),je=["align"],me=k=>k.map(N=>({...je.reduce((G,ye)=>({[ye]:i[ye]}),{}),...N}));return l.onBeforeUnmount(()=>{window.removeEventListener("resize",$),H.disconnect()}),(k,N)=>{var Q,Ie,Ur;const G=l.resolveComponent("a-menu-item"),ye=l.resolveComponent("a-menu"),et=l.resolveComponent("a-dropdown");return l.openBlock(),l.createElementBlock("div",l.mergeProps({ref_key:"boxEl",ref:x,class:"h-full p-wrapper flex flex-col gap-8px overflow-y-auto"},l.unref(U)),[X.value==="bad"?(l.openBlock(),l.createElementBlock("div",gC,"请检查配置")):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[(Ie=(Q=l.unref(s))==null?void 0:Q.items)!=null&&Ie.some(M=>M.field&&M.itemRender)?(l.openBlock(),l.createElementBlock("div",{key:0,class:"p-pane p-form-wrapper",ref_key:"pFormWrapper",ref:v},[l.createVNode(l.unref(A.Spin),{spinning:g.form},{default:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.unref(A.Form),l.mergeProps({key:K.value,ref_key:"formEl",ref:T,model:ve.value},ii.value,{onSubmit:ri}),{default:l.withCtx(()=>[l.createVNode(l.unref(A.Row),{gutter:[6,12]},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(s).items,(M,oe)=>(l.openBlock(),l.createBlock($r,{key:`_col_${M.field||oe}`,"form-data":ve.value,item:M,onReset:N[0]||(N[0]=we=>Ze(i.lazyReset))},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["model"]))]),_:1},8,["spinning"])],512)):l.createCommentVNode("",!0),l.unref(a)?(l.openBlock(),l.createElementBlock("div",vC,[l.createElementVNode("div",mC,[l.unref(a).buttons&&l.unref(a).buttons.length>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(a).buttons,(M,oe)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:oe},[M.dropdowns&&M.dropdowns.length?(l.openBlock(),l.createBlock(et,{key:0},{overlay:l.withCtx(()=>[l.createVNode(ye,{onClick:qe},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(M.dropdowns,we=>(l.openBlock(),l.createBlock(G,{key:we.code},{default:l.withCtx(()=>[we.content&&de(V(we.content))?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[l.createTextVNode(l.toDisplayString(V(we.content)),1)],64)):we.content?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(V(we.content)),{key:1})):l.createCommentVNode("",!0)]),_:2},1024))),128))]),_:2},1024)]),default:l.withCtx(()=>[l.createVNode(l.unref(A.Button),{type:M.type,size:M.size??"middle",disabled:l.unref(a).disabled||M.disabled,loading:g.toolbar||!!M.code&&I[M.code],danger:M.danger,shape:M.shape,ghost:M.ghost,block:M.block},{default:l.withCtx(()=>[M.icon?(l.openBlock(),l.createBlock(l.unref(ae),{key:0,icon:M.icon},null,8,["icon"])):l.createCommentVNode("",!0),M.content&&de(V(M.content))?(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[l.createTextVNode(l.toDisplayString(V(M.content)),1)],64)):M.content?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(V(M.content)),{key:2})):l.createCommentVNode("",!0),l.createVNode(l.unref(wt.DownOutlined))]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block"])]),_:2},1024)):M.code?(l.openBlock(),l.createBlock(l.unref(A.Button),{key:1,type:M.type,size:M.size??"middle",disabled:l.unref(a).disabled||M.disabled,loading:g.toolbar||!!M.code&&I[M.code],danger:M.danger,shape:M.shape,ghost:M.ghost,block:M.block,onClick:we=>l.unref(he)(M.code)},{default:l.withCtx(()=>[M.icon?(l.openBlock(),l.createBlock(l.unref(ae),{key:0,icon:M.icon},null,8,["icon"])):l.createCommentVNode("",!0),M.content&&de(V(M.content))?(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[l.createTextVNode(l.toDisplayString(V(M.content)),1)],64)):M.content?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(V(M.content)),{key:2})):l.createCommentVNode("",!0)]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block","onClick"])):(l.openBlock(),l.createElementBlock("div",xC))],64))),128)):l.createCommentVNode("",!0)]),l.createElementVNode("span",pC,[l.unref(a).tools&&l.unref(a).tools.length>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(a).tools,(M,oe)=>(l.openBlock(),l.createBlock(l.unref(A.Button),{key:oe,type:M.type,size:M.size??"middle",disabled:l.unref(a).disabled||M.disabled,danger:M.danger,shape:M.shape,ghost:M.ghost,block:M.block,onClick:we=>l.unref(Pi)(M.code),loading:g.toolbar||!!M.code&&I[M.code]},{default:l.withCtx(()=>[M.icon?(l.openBlock(),l.createBlock(l.unref(ae),{key:0,icon:M.icon},null,8,["icon"])):l.createCommentVNode("",!0),M.content&&de(V(M.content))?(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[l.createTextVNode(l.toDisplayString(V(M.content)),1)],64)):M.content?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(V(M.content)),{key:2})):l.createCommentVNode("",!0)]),_:2},1032,["type","size","disabled","danger","shape","ghost","block","onClick","loading"]))),128)):l.createCommentVNode("",!0)])])):l.createCommentVNode("",!0),l.createElementVNode("div",{class:l.normalizeClass(`p-pane flex-1 ${Qt.value?"h-0":""} p-${l.unref(u)??"inner"}-scroll`)},[(Ur=l.unref(f))!=null&&Ur.multiple&&l.unref(f).showCount?(l.openBlock(),l.createElementBlock("div",yC," 已选:"+l.toDisplayString(E.value.length),1)):l.createCommentVNode("",!0),(l.openBlock(),l.createBlock(l.unref(A.Table),l.mergeProps({key:R.value+"_table","row-key":k.rowKey??"id",ref_key:"tableEl",ref:B,"row-class-name":k.striped?(M,oe)=>oe%2===1?"p-grid-row-striped":"":"",columns:me(l.unref(n)??[]).map(M=>l.unref(Bi)(M)),"data-source":P.value,loading:g.table,pagination:jt.value},ti.value,{scroll:{x:"max-content",y:p.value},onChange:Wi}),l.createSlots({_:2},[b.value.length>0?{name:"headerCell",fn:l.withCtx(({column:M})=>[b.value.some(oe=>M.key&&oe.field===M.key)?(l.openBlock(),l.createBlock(l.unref(dC),{key:R.value+"_title_"+Y.value+"_slot_"+M.key,column:b.value.find(oe=>M.key&&oe.field===M.key)},null,8,["column"])):l.createCommentVNode("",!0)]),key:"0"}:void 0,D.value.length>0?{name:"bodyCell",fn:l.withCtx(({column:M,record:oe,index:we})=>[D.value.some(Xi=>M.key&&Xi.field===M.key)?(l.openBlock(),l.createBlock(l.unref(Pa),{key:R.value+"_cell_"+Y.value+"_slot_"+M.key,column:D.value.find(Xi=>M.key&&Xi.field===M.key),"default-handler":{pick:Yi,setLoadings:m},row:oe,"row-index":we,"table-data":P.value},null,8,["column","default-handler","row","row-index","table-data"])):l.createCommentVNode("",!0)]),key:"1"}:void 0]),1040,["row-key","row-class-name","columns","data-source","loading","pagination","scroll"]))],2)],64))],16)}}});(function(){try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode(":root{--evt-header-font: 12px normal Arial;--evt-body-font: 12px normal Arial;--evt-color-white: #fff;--evt-color-black: #000000;--evt-color-primary: rgb(82, 146, 247);--evt-text-color-primary: #333;--evt-text-color-regular: #666;--evt-text-color-secondary: #999;--evt-box-shadow: 0 2px 12px 0 #0000001a;--evt-editor-bg-color: #fff;--evt-editor-text-color: #333;--evt-border-color: #e1e6eb;--evt-body-bg-color: #fff;--evt-stripe-color: #fafafa;--evt-placeholder-color: #cdd0dc;--evt-header-bg-color: #f8faff;--evt-header-text-color: #1d2129;--evt-body-text-color: #4e5969;--evt-footer-text-color: #4e5969;--evt-loading-icon-color: #4e5969;--evt-expand-icon-color: #4e5969;--evt-shrink-icon-color: #4e5969;--evt-error-tip-icon-color: red;--evt-required-color: #f56c6c;--evt-cell-hover-icon-bg-color: #fff;--evt-cell-hover-icon-border-color: #dde0ea;--evt-scroller-color: #dee0e3;--evt-scroller-track-color: #fff;--evt-scroller-focus-color: #bbbec4;--evt-select-border-color: var(--evt-color-primary);--evt-select-area-color: rgba(82, 146, 247, .1);--evt-select-row-col-bg-color: rgba(82, 146, 247, .1);--evt-autofill-point-border-color: #fff;--evt-edit-bg-color: #fcf6ed;--evt-checkbox-color: var(--evt-color-primary);--evt-checkbox-uncheck-color: #dde0ea;--evt-checkbox-disabled-color: #f1f2f4;--evt-checkbox-check-disabled-color: #dde0ea;--evt-icon-edit-color: #4e5969;--evt-icon-select-color: #4e5969;--evt-readonly-color: #fff;--evt-readonly-text-color: var(--evt-body-text-color);--evt-error-tip-color: #ed3f14;--evt-footer-bg-color: #fafafa;--evt-highlight-hover-row-color: rgba(186, 203, 231, .1);--evt-highlight-selected-row-color: rgba(82, 146, 247, .1);--evt-tooltip-bg-color: #303133;--evt-tooltip-text-color: #fff;--evt-resize-row-line-color: #e1e6eb;--evt-resize-column-text-color: #fff;--evt-resize-column-text-bg-color: var(--evt-color-primary);--evt-resize-column-line-color: #e1e6eb;--evt-tree-line-color: #e1e6eb;--evt-sort-icon-color: var(--evt-color-primary);--evt-drag-tip-bg-color: rgba(82, 146, 247, .1);--evt-drag-tip-line-color: var(--evt-color-primary);--evt-context-menu-min-width: 150px;--evt-context-menu-max-width: 220px;--evt-context-menu-item-padding: 8px 12px;--evt-context-menu-bg-color: #fff;--evt-context-menu-text-color: #333;--evt-context-menu-item-hover-text-color: var(--evt-color-primary);--evt-context-menu-item-hover-bg-color: #f5f5f5;--evt-context-menu-text-size: 13px}.dark{--evt-border-color: #363637;--evt-header-bg-color: #141414;--evt-body-bg-color: #141414;--evt-header-text-color: #a3a6ad;--evt-body-text-color: #cfd3dc;--evt-readonly-text-color: #cfd3dc;--evt-footer-text-color: #cfd3dc;--evt-scroller-color: #414243;--evt-scroller-track-color: #141414;--evt-scroller-focus-color: #a3a6ad;--evt-edit-bg-color: #141414;--evt-footer-bg-color: #262727;--evt-autofill-point-border-color: #fff;--evt-editor-bg-color: #434343;--evt-editor-text-color: #cfd3dc;--evt-context-menu-bg-color: #141414;--evt-context-menu-text-color: #cfd3dc;--evt-context-menu-item-hover-text-color: var(--evt-color-primary);--evt-context-menu-item-hover-bg-color: #414243}.e-virt-table-container{position:relative;outline:none}.e-virt-table-stage{position:relative;overflow:hidden;outline:none;box-sizing:border-box;z-index:10;border-radius:8px;border:1px solid var(--evt-border-color)}.e-virt-table-canvas{position:absolute;left:0;top:0;box-sizing:border-box;background-color:var(--evt-body-bg-color);border:none;outline:none;z-index:10}.e-virt-table-editor{position:absolute;top:-10000px;left:-10000px;text-align:left;height:auto;line-height:0;z-index:100;overflow:hidden;background-color:var(--evt-editor-bg-color);border:2px solid var(--evt-color-primary);box-sizing:border-box;box-shadow:var(--evt-box-shadow);display:flex;align-items:center}.e-virt-table-overlayer{position:absolute;left:0;top:0;overflow:hidden;z-index:100;pointer-events:none}.e-virt-table-editor-textarea{width:100%;box-sizing:border-box;outline:none;font-weight:400;padding:8px;font-size:12px;color:inherit;white-space:pre-wrap;word-wrap:break-word;word-break:break-all;line-height:1.5;margin:0;border:none;vertical-align:middle;background:var(--evt-editor-bg-color);color:var(--evt-editor-text-color);overflow-y:auto;resize:none}.e-virt-table-context-menu{position:absolute;font-size:14px;color:var(--evt-text-color-regular);background-color:var(--evt-color-white);border-radius:4px;border:1px solid #e4e7ed;box-shadow:var(--evt-box-shadow);width:fit-content;padding:6px 0;z-index:9999;left:-99999px;top:-99999px}.e-virt-table-context-menu-item{cursor:pointer;padding:6px 24px;color:var(--evt-text-color-regular)}.e-virt-table-context-menu-item:hover{color:var(--evt-color-primary);background-color:#f5f7fa}.e-virt-table-loading{display:none;position:absolute;left:0;top:0;right:0;bottom:0;width:100%;height:100%;z-index:2000;background-color:#fff6;display:flex;align-items:center;justify-content:center}.e-virt-table-loading-spinner{opacity:1;display:flex;flex-direction:column;align-items:center;justify-content:center}.e-virt-table-loading-spinner svg{color:var(--evt-text-color-regular);animation:rotate 1s linear infinite}@keyframes rotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.e-virt-table-loading-text{margin:0;font-size:12px;color:var(--evt-text-color-regular)}.e-virt-table-main-menu,.e-virt-table-submenu{position:absolute;background:var(--evt-context-menu-bg-color);border-radius:4px;box-shadow:0 2px 8px #0000001a;min-width:var(--evt-context-menu-min-width);max-width:var(--evt-context-menu-max-width);color:var(--evt-text-color-primary)}.e-virt-table-main-menu{border:1px solid var(--evt-border-color);z-index:3000;left:-99999px;top:-99999px;display:none;position:fixed;background-color:var(--evt-body-bg-color)}.e-virt-table-submenu{border:1px solid var(--evt-border-color);z-index:1000;max-height:350px;overflow-y:auto;opacity:0;visibility:hidden;transform:translate(-10px);transition:opacity .2s,visibility .2s,transform .2s;-ms-overflow-style:none;scrollbar-width:none}.e-virt-table-submenu::-webkit-scrollbar{display:none}.e-virt-table-submenu.show{opacity:1;visibility:visible;transform:translate(0)}.e-virt-table-submenu:not(.show){transition:none}.e-virt-table-menu-item,.e-virt-table-submenu-item{position:relative;-webkit-user-select:none;user-select:none;padding:var(--evt-context-menu-item-padding);cursor:pointer;display:flex;justify-content:space-between;align-items:center;transition:background .2s,color .2s;color:var(--evt-context-menu-text-color);font-size:var(--evt-context-menu-text-size)}.e-virt-table-menu-item:last-child,.e-virt-table-submenu-item:last-child{border-bottom:none}.e-virt-table-menu-item:has(.e-virt-table-menu-item-icon){padding-left:8px}.e-virt-table-menu-item-content{display:flex;align-items:center;flex:1;min-width:0}.e-virt-table-menu-item-icon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;margin-right:8px;flex-shrink:0}.e-virt-table-menu-item-icon svg{width:100%;height:100%;fill:currentColor}.e-virt-table-menu-item-text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.e-virt-table-menu-arrow{display:inline-flex;align-items:center;justify-content:center;color:var(--evt-text-color-regular);transition:color .2s}.e-virt-table-menu-arrow svg{width:20px;height:20px;fill:currentColor}.e-virt-table-submenu-item:hover,.e-virt-table-menu-item:hover,.e-virt-table-menu-item.active{background:var(--evt-context-menu-item-hover-bg-color);color:var(--evt-context-menu-item-hover-text-color)}.e-virt-table-menu-item.disabled,.e-virt-table-submenu-item.disabled{cursor:not-allowed}.e-virt-table-finder-bar{position:absolute;top:8px;right:16px;display:none;z-index:10000;background:#fff;border:1px solid #dadce0;border-radius:12px;box-shadow:0 2px 6px #0003;padding:0 8px;height:48px;min-width:250px;align-items:center;font-size:12px}.e-virt-table-finder-bar.show{display:flex}.e-virt-table-finder-bar-input-wrapper{display:flex;align-items:center;flex:1;padding:0 8px;position:relative}.e-virt-table-finder-bar-input{border:none;outline:none;flex:1;font-size:12px;background:transparent;color:#333;min-width:150px;padding-left:0;position:relative}.e-virt-table-finder-bar-nav{display:flex;flex-direction:row;gap:8px;margin:0 8px;align-items:center}.e-virt-table-finder-bar-nav-btn{border:none;background:transparent;cursor:pointer;padding:0;color:#666;border-radius:50%;display:flex;align-items:center;justify-content:center}.e-virt-table-finder-bar-nav-btn svg{width:24px;height:24px}.e-virt-table-finder-bar-nav-btn.prev-btn{transform:rotate(-90deg)}.e-virt-table-finder-bar-nav-btn.next-btn{transform:rotate(90deg)}.e-virt-table-finder-bar-nav-btn.close-btn{font-size:24px;color:#666;line-height:1;width:24px;height:24px}.e-virt-table-finder-bar-nav-btn:hover{color:#666;background-color:#f0f0f0}.e-virt-table-finder-bar-count{color:#666;font-size:12px;margin:0 8px;white-space:nowrap;flex-shrink:0}.e-virt-table-finder-bar-count.no-results{color:#999}.e-virt-table-finder-bar-loading{display:none;position:absolute;left:8px;top:0;width:16px;height:16px;flex-shrink:0;pointer-events:none;z-index:0}.e-virt-table-finder-bar-loading.show{display:block}.e-virt-table-finder-bar-loading svg{width:100%;height:100%;color:#666;animation:rotate 1s linear infinite}.e-virt-table-empty{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);font-size:14px;color:#666;z-index:15}")),document.head.appendChild(r)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var wC=Object.defineProperty,EC=(r,e,t)=>e in r?wC(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,h=(r,e,t)=>EC(r,typeof e!="symbol"?e+"":e,t);class CC{constructor(e){h(this,"rules"),this.rules=e}validate(e){const t=[],{column:i,row:s,key:o,rowKey:n,colIndex:a,rowIndex:c,value:d,field:f,fieldValue:u}=e;Array.isArray(this.rules)||(this.rules=[this.rules]);for(const g of this.rules){if(g.validator){const m={field:f,fieldValue:u,value:d,column:i,colIndex:a,rowIndex:c,row:s,key:o,rowKey:n,...g};g.validator(m,d,x=>{x&&t.push({...m,message:x})})}if(!g.required&&(d==null||d===""))return t;g.pattern&&!g.pattern.test(d)&&t.push({value:d,column:i,row:s,key:o,rowKey:n,colIndex:a,rowIndex:c,field:f,fieldValue:u,message:g.message||`${o} is pattern validation error`}),g.required&&(d==null||d==="")&&t.push({value:d,column:i,row:s,key:o,rowKey:n,colIndex:a,rowIndex:c,field:f,fieldValue:u,message:g.message||`${o} is required`})}return t}}function Xa(){return"xxxxxxxxxxxxxxxxxx".replace(/[x]/g,function(r){const e=Math.random()*16|0;return(r==="x"?e:e&3|8).toString(16)})}function Nr(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 vi(r=[]){return r.length?r.map(e=>vi(e.children)+1).sort((e,t)=>t-e)[0]:0}function bC(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 mi(r=[],e=1,t=0,i=""){return r.sort((s,o)=>(s.sort??0)-(o.sort??0)).map(s=>{if(s.children){let o=0,n=s.fixed;s.children.forEach(c=>{c.fixed=n});const a=mi(s.children,e-1,t+1,s.key);return a&&a.forEach(c=>{o+=c.colspan??0}),{...s,width:s.width,level:t,rowspan:1,colspan:o,parentKey:i,children:a.sort((c,d)=>(c.sort??0)-(d.sort??0))}}return{...s,level:t,rowspan:e,colspan:1,parentKey:i}})}function Ht(r=[]){let e=[];return r.forEach(t=>{t.children?e=e.concat(Ht(t.children)):e.push(t)}),e}function za(r){return r.filter(e=>!e.hide).map(e=>Array.isArray(e.children)&&e.children.length>0?{...e,children:za(e.children)}:{...e})}const So=/^(\r\n|\n\r|\r|\n)/,_C=/^[^\t\r\n]+/,To=/^\t/;function RC(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(To))r=r.replace(To,""),t+=1,e[i][t]="";else if(r.match(So))r=r.replace(So,""),t=0,i+=1,e[i]=[""];else{let o="";if(r.startsWith('"')){let n=0,a=!0;for(;a;){const c=r.slice(0,1);c==='"'&&(n+=1),o+=c,r=r.slice(1),(r.length===0||r.match(/^[\t\r\n]/)&&n%2===0)&&(a=!1)}o=o.replace(/^"/,"").replace(/"$/,"").replace(/["]*/g,c=>new Array(Math.floor(c.length/2)).fill('"').join(""))}else{const n=r.match(_C);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 IC(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 l=require("vue"),A=require("ant-design-vue"),_t=require("@ant-design/icons-vue");function xl(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const pl=xl(_t);var yl={keyId:1,cookies:{path:"/"},treeOptions:{parentKey:"parentId",key:"id",children:"children"},parseDateFormat:"yyyy-MM-dd HH:mm:ss",firstDayOfWeek:1},ke=yl;function wl(r,e,t){if(r)if(r.forEach)r.forEach(e,t);else for(var i=0,s=r.length;i<s;i++)e.call(t,r[i],i,r)}var ee=wl,El=Object.prototype.toString,Xo=El,Cl=Xo;function bl(r){return function(e){return"[object "+r+"]"===Cl.call(e)}}var zt=bl,_l=zt,Rl=Array.isArray||_l("Array"),G=Rl;function Il(r,e){return r&&r.hasOwnProperty?r.hasOwnProperty(e):!1}var Ee=Il,Sl=Ee;function Tl(r,e,t){if(r)for(var i in r)Sl(r,i)&&e.call(t,r[i],i,r)}var Gt=Tl,Ol=G,kl=ee,Ll=Gt;function Dl(r,e,t){return r&&(Ol(r)?kl:Ll)(r,e,t)}var Z=Dl;function $l(r){return function(e){return typeof e===r}}var St=$l,Ml=St,Al=Ml("function"),se=Al,Nl=Z;function Bl(r,e){var t=Object[r];return function(i){var s=[];if(i){if(t)return t(i);Nl(i,e>1?function(o){s.push([""+o,i[o]])}:function(){s.push(arguments[e])})}return s}}var wr=Bl,Hl=wr,Fl=Hl("keys",1),Fe=Fl,Kl=Xo,Pl=Gt,Yl=ee;function Zi(r,e){var t=r.__proto__.constructor;return e?new t(e):new t}function li(r,e){return e?zo(r,e):r}function zo(r,e){if(r)switch(Kl.call(r)){case"[object Object]":{var t=Object.create(Object.getPrototypeOf(r));return Pl(r,function(n,a){t[a]=li(n,e)}),t}case"[object Date]":case"[object RegExp]":return Zi(r,r.valueOf());case"[object Array]":case"[object Arguments]":{var i=[];return Yl(r,function(n){i.push(li(n,e))}),i}case"[object Set]":{var s=Zi(r);return s.forEach(function(n){s.add(li(n,e))}),s}case"[object Map]":{var o=Zi(r);return o.forEach(function(n,a){o.set(a,li(n,e))}),o}}return r}function Vl(r,e){return r&&zo(r,e)}var Er=Vl,Wl=ee,Xl=Fe,zl=G,Gl=Er,jr=Object.assign;function es(r,e,t){for(var i=e.length,s,o=1;o<i;o++)s=e[o],Wl(Xl(e[o]),t?function(n){r[n]=Gl(s[n],t)}:function(n){r[n]=s[n]});return r}var Ul=function(r){if(r){var e=arguments;if(r===!0){if(e.length>1)return r=zl(r[1])?[]:{},es(r,e,!0)}else return jr?jr.apply(Object,e):es(r,e)}return r},he=Ul,Go=ke,ql=ee,Zl=Z,Jl=se,Ql=he,Se=function(){};function jl(){ql(arguments,function(r){Zl(r,function(e,t){Se[t]=Jl(e)?function(){var i=e.apply(Se.$context,arguments);return Se.$context=null,i}:e})})}function Uo(r){return Ql(Go,r)}function ec(){return Go}var qo="3.7.8";Se.VERSION=qo;Se.version=qo;Se.mixin=jl;Se.setup=Uo;Se.setConfig=Uo;Se.getConfig=ec;var tc=Se;function ic(r,e,t){for(var i=r.length-1;i>=0;i--)e.call(t,r[i],i,r)}var Cr=ic,rc=Cr,sc=Fe;function oc(r,e,t){rc(sc(r),function(i){e.call(t,r[i],i,r)})}var Zo=oc;function nc(r){return r===null}var Ke=nc,ac=Ke;function lc(r,e){return function(t){return ac(t)?e:t[r]}}var Tt=lc,cc=Z,hc=se,dc=Tt;function uc(r,e,t){var i={};if(r)if(e)hc(e)||(e=dc(e)),cc(r,function(s,o){i[o]=e.call(t,s,o,r)});else return r;return i}var fc=uc;function gc(r){return r?r.constructor===Object:!1}var Ot=gc;function mc(r){return r!=="__proto__"&&r!=="constructor"}var Jo=mc,ts=G,is=Ot,vc=se,xc=Z,pc=Jo;function Qo(r,e){return is(r)&&is(e)||ts(r)&&ts(e)?(xc(e,function(t,i){pc(i)&&(r[i]=vc(e)?t:Qo(r[i],t))}),r):e}var yc=function(r){r||(r={});for(var e=arguments,t=e.length,i,s=1;s<t;s++)i=e[s],i&&Qo(r,i);return r},wc=yc,Ec=Z;function Cc(r,e,t){var i=[];if(r&&arguments.length>1){if(r.map)return r.map(e,t);Ec(r,function(){i.push(e.apply(t,arguments))})}return i}var ut=Cc,bc=Ee,_c=G;function Rc(r,e,t,i,s){return function(o,n,a){if(o&&n){if(r&&o[r])return o[r](n,a);if(e&&_c(o)){for(var c=0,d=o.length;c<d;c++)if(!!n.call(a,o[c],c,o)===i)return[!0,!1,c,o[c]][t]}else for(var f in o)if(bc(o,f)&&!!n.call(a,o[f],f,o)===i)return[!0,!1,f,o[f]][t]}return s}}var Di=Rc,Ic=Di,Sc=Ic("some",1,0,!0,!1),jo=Sc,Tc=Di,Oc=Tc("every",1,1,!1,!0),en=Oc,kc=Ee;function Lc(r,e){if(r){if(r.includes)return r.includes(e);for(var t in r)if(kc(r,t)&&e===r[t])return!0}return!1}var kt=Lc,rs=G,ss=kt;function Dc(r,e){var t,i=0;if(rs(r)&&rs(e)){for(t=e.length;i<t;i++)if(!ss(r,e[i]))return!1;return!0}return ss(r,e)}var tn=Dc,os=Z,$c=kt,Mc=se,Ac=Tt;function Nc(r,e,t){var i=[];if(e){Mc(e)||(e=Ac(e));var s,o={};os(r,function(n,a){s=e.call(t,n,a,r),o[s]||(o[s]=1,i.push(n))})}else os(r,function(n){$c(i,n)||i.push(n)});return i}var rn=Nc,Bc=ut;function Hc(r){return Bc(r,function(e){return e})}var br=Hc,Fc=rn,Kc=br;function Pc(){for(var r=arguments,e=[],t=0,i=r.length;t<i;t++)e=e.concat(Kc(r[t]));return Fc(e)}var Yc=Pc,Vc="undefined",Ce=Vc,Wc=Ce,Xc=St,zc=Xc(Wc),Le=zc,Gc=Ke,Uc=Le;function qc(r){return Gc(r)||Uc(r)}var Pe=qc,Zc=/(.+)?\[(\d+)\]$/,sn=Zc;function Jc(r){return r?r.splice&&r.join?r:(""+r).replace(/(\[\d+\])\.?/g,"$1.").replace(/\.$/,"").split("."):[]}var _r=Jc,Qc=sn,jc=_r,eh=Ee,th=Le,on=Pe;function ih(r,e,t){if(on(r))return t;var i=sh(r,e);return th(i)?t:i}function rh(r,e){var t=e?e.match(Qc):"";return t?t[1]?r[t[1]]?r[t[1]][t[2]]:void 0:r[t[2]]:r[e]}function sh(r,e){if(r){var t,i,s,o=0;if(r[e]||eh(r,e))return r[e];if(i=jc(e),s=i.length,s){for(t=r;o<s;o++)if(t=rh(t,i[o]),on(t))return o===s-1?t:void 0}return t}}var Ut=ih,ns=ee,oh=br,as=ut,ls=G,nh=se,ah=Ot,cs=Le,lh=Ke,ch=Pe,hh=Ut,dh=Tt,uh="asc",fh="desc";function dr(r,e){return cs(r)?1:lh(r)?cs(e)?-1:1:r&&r.localeCompare?r.localeCompare(e):r>e?1:-1}function gh(r,e,t){return function(i,s){var o=i[r],n=s[r];return o===n?t?t(i,s):0:e.order===fh?dr(n,o):dr(o,n)}}function mh(r,e,t,i){var s=[];return t=ls(t)?t:[t],ns(t,function(o,n){if(o){var a=o,c;ls(o)?(a=o[0],c=o[1]):ah(o)&&(a=o.field,c=o.order),s.push({field:a,order:c||uh}),ns(e,nh(a)?function(d,f){d[n]=a.call(i,d.data,f,r)}:function(d){d[n]=a?hh(d.data,a):d.data})}}),s}function vh(r,e,t){if(r){if(ch(e))return oh(r).sort(dr);for(var i,s=as(r,function(a){return{data:a}}),o=mh(r,s,e,t),n=o.length-1;n>=0;)i=gh(n,o[n],i),n--;return i&&(s=s.sort(i)),as(s,dh("data"))}return[]}var Rr=vh,xh=Rr,ph=xh,yh=ph;function wh(r,e){return r>=e?r:(r=r>>0)+Math.round(Math.random()*((e||9)-r))}var nn=wh,Eh=wr,Ch=Eh("values",0),Lt=Ch,bh=nn,_h=Lt;function Rh(r){for(var e,t=[],i=_h(r),s=i.length-1;s>=0;s--)e=s>0?bh(0,s):0,t.push(i[e]),i.splice(e,1);return t}var an=Rh,Ih=an;function Sh(r,e){var t=Ih(r);return arguments.length<=1?t[0]:(e<t.length&&(t.length=e||0),t)}var Th=Sh;function Oh(r){return function(e){if(e){var t=r(e&&e.replace?e.replace(/,/g,""):e);if(!isNaN(t))return t}return 0}}var ln=Oh,kh=ln,Lh=kh(parseFloat),ft=Lh,hs=ft;function Dh(r,e,t){var i=[],s=arguments.length;if(r){if(e=s>=2?hs(e):0,t=s>=3?hs(t):r.length,r.slice)return r.slice(e,t);for(;e<t;e++)i.push(r[e])}return i}var gt=Dh,$h=Z;function Mh(r,e,t){var i=[];if(r&&e){if(r.filter)return r.filter(e,t);$h(r,function(s,o){e.call(t,s,o,r)&&i.push(s)})}return i}var Ah=Mh,Nh=Di,Bh=Nh("",0,2,!0),Hh=Bh,Fh=Di,Kh=Fh("find",1,3,!0),Ph=Kh,Yh=G,Vh=Lt;function Wh(r,e,t){if(r){Yh(r)||(r=Vh(r));for(var i=r.length-1;i>=0;i--)if(e.call(t,r[i],i,r))return r[i]}}var Xh=Wh,zh=Fe;function Gh(r,e,t){if(r){var i,s,o=0,n=null,a=t,c=arguments.length>2,d=zh(r);if(r.length&&r.reduce)return s=function(){return e.apply(n,arguments)},c?r.reduce(s,a):r.reduce(s);for(c&&(o=1,a=r[d[0]]),i=d.length;o<i;o++)a=e.call(n,a,r[d[o]],o,r);return a}}var Uh=Gh,qh=G;function Zh(r,e,t,i){if(qh(r)&&r.copyWithin)return r.copyWithin(e,t,i);var s,o,n=e>>0,a=t>>0,c=r.length,d=arguments.length>3?i>>0:c;if(n<c&&(n=n>=0?n:c+n,n>=0&&(a=a>=0?a:c+a,d=d>=0?d:c+d,a<d)))for(s=0,o=r.slice(a,d);n<c&&!(o.length<=s);n++)r[n]=o[s++];return r}var Jh=Zh,Qh=G;function jh(r,e){var t,i=[],s=e>>0||1;if(Qh(r))if(s>=0&&r.length>s)for(t=0;t<r.length;)i.push(r.slice(t,t+s)),t+=s;else i=r.length?[r]:r;return i}var ed=jh,td=ut,id=Tt;function rd(r,e){return td(r,id(e))}var cn=rd,sd=se,ds=Pe,od=Ut,nd=ee;function ad(r){return function(e,t){if(e&&e.length){var i,s;return nd(e,function(o,n){t&&(o=sd(t)?t(o,n,e):od(o,t)),!ds(o)&&(ds(i)||r(i,o))&&(s=n,i=o)}),e[s]}return i}}var hn=ad,ld=hn,cd=ld(function(r,e){return r<e}),dn=cd,hd=cn,dd=dn;function ud(r){var e,t,i,s=[];if(r&&r.length)for(e=0,t=dd(r,function(o){return o?o.length:0}),i=t?t.length:0;e<i;e++)s.push(hd(r,e));return s}var un=ud,fd=un;function gd(){return fd(arguments)}var md=gd,vd=Lt,xd=Z;function pd(r,e){var t={};return e=e||[],xd(vd(r),function(i,s){t[i]=e[s]}),t}var yd=pd,fn=G,wd=ee;function gn(r,e){var t=[];return wd(r,function(i){t=t.concat(fn(i)?e?gn(i,e):i:[i])}),t}function Ed(r,e){return fn(r)?gn(r,e):[]}var Cd=Ed,bd=ut,_d=G;function Rd(r,e){for(var t=0,i=e.length;r&&t<i;)r=r[e[t++]];return i&&r?r:0}function Id(r,e){for(var t,i=arguments,s=[],o=[],n=2,a=i.length;n<a;n++)s.push(i[n]);if(_d(e)){for(a=e.length-1,n=0;n<a;n++)o.push(e[n]);e=e[a]}return bd(r,function(c){if(o.length&&(c=Rd(c,o)),t=c[e]||e,t&&t.apply)return t.apply(c,s)})}var Sd=Id;function Td(r,e){return(console[r]||console.log)(e)}var Od=Td;function kd(r,e){try{delete r[e]}catch{r[e]=void 0}}var mn=kd,Ld=G,Dd=Cr,$d=Zo;function Md(r,e,t){return r&&(Ld(r)?Dd:$d)(r,e,t)}var vn=Md,Ad=St,Nd=Ad("object"),$i=Nd,Bd=mn,Hd=Ot,Fd=$i,Kd=G,Pd=Ke,Yd=he,Vd=Gt;function Wd(r,e,t){if(r){var i,s=arguments.length>1&&(Pd(e)||!Fd(e)),o=s?t:e;if(Hd(r))Vd(r,s?function(n,a){r[a]=e}:function(n,a){Bd(r,a)}),o&&Yd(r,o);else if(Kd(r)){if(s)for(i=r.length;i>0;)i--,r[i]=e;else r.length=0;o&&r.push.apply(r,o)}}return r}var xn=Wd,Xd=mn,zd=se,Gd=G,Ud=Z,qd=ee,Zd=vn,Jd=xn,Qd=Pe;function jd(r){return function(e,t){return t===r}}function eu(r,e,t){if(r){if(!Qd(e)){var i=[],s=[];return zd(e)||(e=jd(e)),Ud(r,function(o,n,a){e.call(t,o,n,a)&&i.push(n)}),Gd(r)?Zd(i,function(o,n){s.push(r[o]),r.splice(o,1)}):(s={},qd(i,function(o){s[o]=r[o],Xd(r,o)})),s}return Jd(r)}return r}var pn=eu,tu=ke,us=Od,iu=Rr,ru=Er,su=Pe,ur=Z,ou=pn,nu=he;function au(r,e){ur(r,function(t){t[e]&&!t[e].length&&ou(t,e)})}function lu(r,e){var t=nu({},tu.treeOptions,e),i=t.strict,s=t.key,o=t.parentKey,n=t.children,a=t.mapChildren,c=t.sortKey,d=t.reverse,f=t.data,u=[],g={},v={},x,m,p;return c&&(r=iu(ru(r),c),d&&(r=r.reverse())),ur(r,function(E){x=E[s],v[x]&&us("warn","Duplicate primary key="+x),v[x]=!0}),ur(r,function(E){x=E[s],f?(m={},m[f]=E):m=E,p=E[o],g[x]=g[x]||[],m[s]=x,m[o]=p,x===p&&(p=null,us("warn","Error infinite Loop. key="+x+" parentKey="+x)),g[p]=g[p]||[],g[p].push(m),m[n]=g[x],a&&(m[a]=g[x]),(!i||i&&su(p))&&(v[p]||u.push(m))}),i&&au(r,n),u}var cu=lu,hu=ke,du=ee,uu=he;function yn(r,e,t,i){var s=i.key,o=i.parentKey,n=i.children,a=i.data,c=i.updated,d=i.clear;return du(t,function(f){var u=f[n];a&&(f=f[a]),c!==!1&&(f[o]=e?e[s]:null),r.push(f),u&&u.length&&yn(r,f,u,i),d&&delete f[n]}),r}function fu(r,e){return yn([],null,r,uu({},hu.treeOptions,e))}var gu=fu;function mu(r){return function(e,t,i,s){var o=i||{},n=o.children||"children";return r(null,e,t,s,[],[],n,o)}}var Mi=mu,vu=Mi;function wn(r,e,t,i,s,o,n,a){if(e){var c,d,f,u,g,v;for(d=0,f=e.length;d<f;d++){if(c=e[d],u=s.concat([""+d]),g=o.concat([c]),t.call(i,c,d,e,u,r,g))return{index:d,item:c,path:u,items:e,parent:r,nodes:g};if(n&&c&&(v=wn(c,c[n],t,i,u.concat([n]),g,n),v))return v}}}var xu=vu(wn),pu=xu,yu=Mi,wu=Z;function En(r,e,t,i,s,o,n,a){var c,d;wu(e,function(f,u){c=s.concat([""+u]),d=o.concat([f]),t.call(i,f,u,e,c,r,d),f&&n&&(c.push(n),En(f,f[n],t,i,c,d,n))})}var Eu=yu(En),Cn=Eu,Cu=Mi,bu=ut;function bn(r,e,t,i,s,o,n,a){var c,d,f,u=a.mapChildren||n;return bu(e,function(g,v){return c=s.concat([""+v]),d=o.concat([g]),f=t.call(i,g,v,e,c,r,d),f&&g&&n&&g[n]&&(f[u]=bn(g,g[n],t,i,c,d,n,a)),f})}var _u=Cu(bn),Ru=_u,Iu=Cn;function Su(r,e,t,i){var s=[];return r&&e&&Iu(r,function(o,n,a,c,d,f){e.call(i,o,n,a,c,d,f)&&s.push(o)},t),s}var Tu=Su,Ou=Mi,ku=ee,Lu=he;function _n(r,e,t,i,s,o,n,a,c){var d,f,u,g,v,x=[],m=c.original,p=c.data,E=c.mapChildren||a,C=c.isEvery;return ku(t,function(w,_){d=o.concat([""+_]),f=n.concat([w]),g=r&&!C||i.call(s,w,_,t,d,e,f),v=a&&w[a],g||v?(m?u=w:(u=Lu({},w),p&&(u[p]=w)),u[E]=_n(g,w,w[a],i,s,d,f,a,c),(g||u[E].length)&&x.push(u)):g&&x.push(u)}),x}var Du=Ou(function(r,e,t,i,s,o,n,a){return _n(0,r,e,t,i,s,o,n,a)}),$u=Du;function Mu(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,i=r.length;t<i;t++)if(e===r[t])return t}var Rn=Mu;function Au(r,e){if(r.lastIndexOf)return r.lastIndexOf(e);for(var t=r.length-1;t>=0;t--)if(e===r[t])return t;return-1}var In=Au,Nu=St,Bu=Nu("number"),De=Bu,Hu=De;function Fu(r){return Hu(r)&&isNaN(r)}var Ku=Fu,Pu=St,Yu=Pu("string"),Ye=Yu,Vu=zt,Wu=Vu("Date"),et=Wu,Xu=parseInt,qt=Xu;function zu(r){return Date.UTC(r.y,r.M||0,r.d||1,r.H||0,r.m||0,r.s||0,r.S||0)}var Gu=zu;function Uu(r){return r.getTime()}var ge=Uu,Ei=qt,fs=Gu,qu=ge,Zu=Ye,Ju=et;function Zt(r){return"(\\d{"+r+"})"}function Qu(r){return r<10?r*100:r<100?r*10:r}function gs(r){return isNaN(r)?r:Ei(r)}var pt=Zt(2),wt=Zt("1,2"),Sn=Zt("1,7"),Tn=Zt("3,4"),On=".{1}",Ht=On+wt,kn="(([zZ])|([-+]\\d{2}:?\\d{2}))",ms=[Tn,Ht,Ht,Ht,Ht,Ht,On+Sn,kn],fr=[];for(var Ji=ms.length-1;Ji>=0;Ji--){for(var vs="",lt=0;lt<Ji+1;lt++)vs+=ms[lt];fr.push(new RegExp("^"+vs+"$"))}function ju(r){for(var e,t={},i=0,s=fr.length;i<s;i++)if(e=r.match(fr[i]),e){t.y=e[1],t.M=e[2],t.d=e[3],t.H=e[4],t.m=e[5],t.s=e[6],t.S=e[7],t.Z=e[8];break}return t}var xs=[["yyyy",Tn],["yy",pt],["MM",pt],["M",wt],["dd",pt],["d",wt],["HH",pt],["H",wt],["mm",pt],["m",wt],["ss",pt],["s",wt],["SSS",Zt(3)],["S",Sn],["Z",kn]],Ln={},Dn=["\\[([^\\]]+)\\]"];for(var lt=0;lt<xs.length;lt++){var Qi=xs[lt];Ln[Qi[0]]=Qi[1]+"?",Dn.push(Qi[0])}var ef=new RegExp(Dn.join("|"),"g"),ps={};function tf(r,e){var t=ps[e];if(!t){var i=[],s=e.replace(/([$(){}*+.?\\^|])/g,"\\$1").replace(ef,function(f,u){var g=f.charAt(0);return g==="["?u:(i.push(g),Ln[f])});t=ps[e]={_i:i,_r:new RegExp(s)}}var o={},n=r.match(t._r);if(n){for(var a=t._i,c=1,d=n.length;c<d;c++)o[a[c-1]]=n[c];return o}return o}function rf(r){if(/^[zZ]/.test(r.Z))return new Date(fs(r));var e=r.Z.match(/([-+])(\d{2}):?(\d{2})/);return e?new Date(fs(r)-(e[1]==="-"?-1:1)*Ei(e[2])*36e5+Ei(e[3])*6e4):new Date("")}function sf(r,e){if(r){var t=Ju(r);if(t||!e&&/^[0-9]{11,15}$/.test(r))return new Date(t?qu(r):Ei(r));if(Zu(r)){var i=e?tf(r,e):ju(r);if(i.y)return i.M&&(i.M=gs(i.M)-1),i.S&&(i.S=Qu(gs(i.S.substring(0,3)))),i.Z?rf(i):new Date(i.y,i.M||0,i.d||1,i.H||0,i.m||0,i.s||0,i.S||0)}}return new Date("")}var oe=sf;function of(){return new Date}var Ai=of,nf=et,af=oe,lf=Ai;function cf(r){var e,t=r?af(r):lf();return nf(t)?(e=t.getFullYear(),e%4===0&&(e%100!==0||e%400===0)):!1}var $n=cf,hf=G,df=Ee;function uf(r,e,t){if(r){if(hf(r))for(var i=0,s=r.length;i<s&&e.call(t,r[i],i,r)!==!1;i++);else for(var o in r)if(df(r,o)&&e.call(t,r[o],o,r)===!1)break}}var ff=uf,gf=G,mf=Ee;function vf(r,e,t){if(r){var i,s;if(gf(r))for(i=r.length-1;i>=0&&e.call(t,r[i],i,r)!==!1;i--);else for(s=mf(r),i=s.length-1;i>=0&&e.call(t,r[s[i]],s[i],r)!==!1;i--);}}var xf=vf,pf=G,yf=Ye,wf=Ee;function Ef(r,e){return function(t,i){if(t){if(t[r])return t[r](i);if(yf(t)||pf(t))return e(t,i);for(var s in t)if(wf(t,s)&&i===t[s])return s}return-1}}var Mn=Ef,Cf=Mn,bf=Rn,_f=Cf("indexOf",bf),Rf=_f,If=Mn,Sf=In,Tf=If("lastIndexOf",Sf),An=Tf,Of=G,kf=Ye,Lf=Z;function Df(r){var e=0;return kf(r)||Of(r)?r.length:(Lf(r,function(){e++}),e)}var Nn=Df,$f=De;function Mf(r){return $f(r)&&isFinite(r)}var Af=Mf,Nf=G,Bf=Ke,Hf=function(r){return!Bf(r)&&!isNaN(r)&&!Nf(r)&&r%1===0},Bn=Hf,Ff=G,Kf=Bn,Pf=Ke;function Yf(r){return!Pf(r)&&!isNaN(r)&&!Ff(r)&&!Kf(r)}var Vf=Yf,Wf=St,Xf=Wf("boolean"),Hn=Xf,zf=zt,Gf=zf("RegExp"),Ir=Gf,Uf=zt,qf=Uf("Error"),Fn=qf;function Zf(r){return r?r.constructor===TypeError:!1}var Jf=Zf;function Qf(r){for(var e in r)return!1;return!0}var Kn=Qf,jf=Ce,eg=typeof Symbol!==jf;function tg(r){return eg&&Symbol.isSymbol?Symbol.isSymbol(r):typeof r=="symbol"}var Pn=tg,ig=zt,rg=ig("Arguments"),sg=rg,og=Ye,ng=De;function ag(r){return!!(r&&og(r.nodeName)&&ng(r.nodeType))}var lg=ag,cg=Ce,hg=typeof document===cg?0:document,Sr=hg,dg=Sr;function ug(r){return!!(r&&dg&&r.nodeType===9)}var fg=ug,gg=Ce,mg=typeof window===gg?0:window,Yn=mg,vg=Yn;function xg(r){return!!(vg&&(r&&r===r.window))}var pg=xg,yg=Ce,wg=typeof FormData!==yg;function Eg(r){return wg&&r instanceof FormData}var Cg=Eg,bg=Ce,_g=typeof Map!==bg;function Rg(r){return _g&&r instanceof Map}var Ig=Rg,Sg=Ce,Tg=typeof WeakMap!==Sg;function Og(r){return Tg&&r instanceof WeakMap}var kg=Og,Lg=Ce,Dg=typeof Set!==Lg;function $g(r){return Dg&&r instanceof Set}var Mg=$g,Ag=Ce,Ng=typeof WeakSet!==Ag;function Bg(r){return Ng&&r instanceof WeakSet}var Hg=Bg,Fg=se,Kg=Ye,Pg=G,Yg=Ee;function Vg(r){return function(e,t,i){if(e&&Fg(t)){if(Pg(e)||Kg(e))return r(e,t,i);for(var s in e)if(Yg(e,s)&&t.call(i,e[s],s,e))return s}return-1}}var Vn=Vg,Wg=Vn,Xg=Wg(function(r,e,t){for(var i=0,s=r.length;i<s;i++)if(e.call(t,r[i],i,r))return i;return-1}),Tr=Xg,ys=De,ws=G,Es=Ye,zg=Ir,Gg=et,Ug=Hn,qg=Le,Cs=Fe,Zg=en;function Wn(r,e,t,i,s,o,n){if(r===e)return!0;if(r&&e&&!ys(r)&&!ys(e)&&!Es(r)&&!Es(e)){if(zg(r))return t(""+r,""+e,s,o,n);if(Gg(r)||Ug(r))return t(+r,+e,s,o,n);var a,c,d,f=ws(r),u=ws(e);if(f||u?f&&u:r.constructor===e.constructor)return c=Cs(r),d=Cs(e),i&&(a=i(r,e,s)),c.length===d.length?qg(a)?Zg(c,function(g,v){return g===d[v]&&Wn(r[g],e[d[v]],t,i,f||u?v:g,r,e)}):!!a:!1}return t(r,e,s,o,n)}var Xn=Wn;function Jg(r,e){return r===e}var zn=Jg,Qg=Xn,jg=zn;function em(r,e){return Qg(r,e,jg)}var Gn=em,bs=Fe,tm=Tr,_s=Gn,im=jo,rm=tn;function sm(r,e){var t=bs(r),i=bs(e);if(i.length){if(rm(t,i))return im(i,function(s){return tm(t,function(o){return o===s&&_s(r[o],e[s])})>-1})}else return!0;return _s(r,e)}var om=sm,Rs=Xn,Is=zn,nm=se,am=Le;function lm(r,e,t){return nm(t)?Rs(r,e,function(i,s,o,n,a){var c=t(i,s,o,n,a);return am(c)?Is(i,s):!!c},t):Rs(r,e,Is)}var cm=lm,hm=Pn,dm=et,um=G,fm=Ir,gm=Fn,mm=Ke;function vm(r){return mm(r)?"null":hm(r)?"symbol":dm(r)?"date":um(r)?"array":fm(r)?"regexp":gm(r)?"error":typeof r}var xm=vm,pm=ke,ym=Pe;function wm(r){return""+(ym(r)?"":r)+pm.keyId++}var Em=wm,Cm=Vn,bm=Cm(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}),_m=bm,Rm=Ot,Im=Ye;function Sm(r){if(Rm(r))return r;if(Im(r))try{return JSON.parse(r)}catch{}return{}}var Tm=Sm,Om=Pe;function km(r){return Om(r)?"":JSON.stringify(r)}var Lm=km,Dm=wr,$m=Dm("entries",2),Mm=$m,Am=se,Nm=G,Bm=Z,Hm=Tr;function Fm(r,e){return function(t,i){var s,o,n={},a=[],c=this,d=arguments,f=d.length;if(!Am(i)){for(o=1;o<f;o++)s=d[o],a.push.apply(a,Nm(s)?s:[s]);i=0}return Bm(t,function(u,g){((i?i.call(c,u,g,t):Hm(a,function(v){return v===g})>-1)?r:e)&&(n[g]=u)}),n}}var Un=Fm,Km=Un,Pm=Km(1,0),Ym=Pm,Vm=Un,Wm=Vm(0,1),Xm=Wm,zm=Lt;function Gm(r){return zm(r)[0]}var Um=Gm,qm=Lt;function Zm(r){var e=qm(r);return e[e.length-1]}var Jm=Zm,Qm=sn,jm=_r,ci=Ee;function ev(r,e){if(r){if(ci(r,e))return!0;var t,i,s,o,n,a,c=jm(e),d=0,f=c.length;for(n=r;d<f&&(a=!1,t=c[d],o=t?t.match(Qm):"",o?(i=o[1],s=o[2],i?n[i]&&ci(n[i],s)&&(a=!0,n=n[i][s]):ci(n,s)&&(a=!0,n=n[s])):ci(n,t)&&(a=!0,n=n[t]),a);d++)if(d===f-1)return!0}return!1}var tv=ev,Ss=qt,iv=_r,rv=Jo,sv=Ee,Ts=/(.+)?\[(\d+)\]$/;function ov(r,e,t,i,s){if(r[e])t&&(r[e]=s);else{var o,n,a=e?e.match(Ts):null;if(t)n=s;else{var c=i?i.match(Ts):null;c&&!c[1]?n=new Array(Ss(c[2])+1):n={}}return a?a[1]?(o=Ss(a[2]),r[a[1]]?t?r[a[1]][o]=n:r[a[1]][o]?n=r[a[1]][o]:r[a[1]][o]=n:(r[a[1]]=new Array(o+1),r[a[1]][o]=n)):r[a[2]]=n:r[e]=n,n}return r[e]}function nv(r,e,t){if(r&&rv(e)){if((r[e]||sv(r,e))&&!Os(e))r[e]=t;else for(var i=r,s=iv(e),o=s.length,n=0;n<o;n++)if(!Os(s[n])){var a=n===o-1;i=ov(i,s[n],a,a?null:s[n+1],t)}}return r}function Os(r){return r==="__proto__"||r==="constructor"||r==="prototype"}var av=nv,lv=Kn,cv=$i,hv=se,dv=Tt,uv=Z;function fv(r){return function(){return lv(r)}}function gv(r,e,t){var i,s={};return r&&(e&&cv(e)?e=fv(e):hv(e)||(e=dv(e)),uv(r,function(o,n){i=e?e.call(t,o,n,r):o,s[i]?s[i].push(o):s[i]=[o]})),s}var qn=gv,mv=qn,vv=Gt;function xv(r,e,t){var i=mv(r,e,t||this);return vv(i,function(s,o){i[o]=s.length}),i}var pv=xv;function yv(r,e,t){var i,s,o=[],n=arguments;if(n.length<2&&(e=n[0],r=0),i=r>>0,s=e>>0,i<e)for(t=t>>0||1;i<s;i+=t)o.push(i);return o}var Zn=yv,ks=Fe,wv=gt,Ev=kt,Cv=ee,bv=he;function _v(r,e){if(r&&e){var t=bv.apply(this,[{}].concat(wv(arguments,1))),i=ks(t);Cv(ks(r),function(s){Ev(i,s)&&(r[s]=t[s])})}return r}var Rv=_v,Iv=hn,Sv=Iv(function(r,e){return r>e}),Tv=Sv;function Ov(r){return(r.split(".")[1]||"").length}var Ni=Ov,kv=qt;function Lv(r,e){if(r.repeat)return r.repeat(e);var t=isNaN(e)?[]:new Array(kv(e));return t.join(r)+(t.length>0?r:"")}var Jt=Lv;function Dv(r,e){return r.substring(0,e)+"."+r.substring(e,r.length)}var Jn=Dv,hi=Jt,ji=Jn;function $v(r){var e=""+r,t=e.match(/^([-+]?)((\d+)|((\d+)?[.](\d+)?))e([-+]{1})([0-9]+)$/);if(t){var i=r<0,s=i?"-":"",o=t[3]||"",n=t[5]||"",a=t[6]||"",c=t[7],d=t[8],f=d-a.length,u=d-o.length,g=d-n.length;return c==="+"?o?s+o+hi("0",d):f>0?s+n+a+hi("0",f):s+n+ji(a,d):o?u>0?s+"0."+hi("0",Math.abs(u))+o:s+ji(o,u):g>0?s+"0."+hi("0",Math.abs(g))+n+a:s+ji(n,g)+a}return e}var tt=$v,Ls=Ni,Ds=tt;function Mv(r,e){var t=Ds(r),i=Ds(e);return parseInt(t.replace(".",""))*parseInt(i.replace(".",""))/Math.pow(10,Ls(t)+Ls(i))}var Qn=Mv,Av=Qn,$s=ft,Nv=tt;function Bv(r){return function(e,t){var i=$s(e),s=i;if(i){t=t>>0;var o=Nv(i),n=o.split("."),a=n[0],c=n[1]||"",d=c.substring(0,t+1),f=a+(d?"."+d:"");if(t>=c.length)return $s(f);if(f=i,t>0){var u=Math.pow(10,t);s=Math[r](Av(f,u))/u}else s=Math[r](f)}return s}}var Or=Bv,Hv=Or,Fv=Hv("round"),kr=Fv,Kv=Or,Pv=Kv("ceil"),jn=Pv,Yv=Or,Vv=Yv("floor"),ea=Vv,Wv=Pe,Xv=De,zv=tt;function Gv(r){return Xv(r)?zv(r):""+(Wv(r)?"":r)}var ne=Gv,Uv=kr,qv=ne,Zv=Jt,Jv=Jn;function Qv(r,e){e=e>>0;var t=qv(Uv(r,e)),i=t.split("."),s=i[0],o=i[1]||"",n=e-o.length;return e?n>0?s+"."+o+Zv("0",n):s+Jv(o,Math.abs(n)):s}var Lr=Qv,jv=ke,ex=kr,tx=jn,ix=ea,rx=De,sx=ne,ox=Lr,nx=tt,ax=he;function lx(r,e){var t=ax({},jv.commafyOptions,e),i=t.digits,s=rx(r),o,n,a,c,d;return s?(o=(t.ceil?tx:t.floor?ix:ex)(r,i),n=nx(i?ox(o,i):o).split("."),c=n[0],d=n[1],a=c&&o<0,a&&(c=c.substring(1,c.length))):(o=sx(r).replace(/,/g,""),n=o?[o]:[],c=n[0]),n.length?(a?"-":"")+c.replace(new RegExp("(?=(?!(\\b))(.{"+(t.spaceNumber||3)+"})+$)","g"),t.separator||",")+(d?"."+d:""):o}var cx=lx,hx=qt,dx=ln,ux=dx(hx),fx=ux,gx=Qn,Ms=ft;function mx(r,e){var t=Ms(r),i=Ms(e);return gx(t,i)}var Dr=mx,As=Ni,Ns=tt,Bs=Dr;function vx(r,e){var t=Ns(r),i=Ns(e),s=Math.pow(10,Math.max(As(t),As(i)));return(Bs(r,s)+Bs(e,s))/s}var ta=vx,xx=ta,Hs=ft;function px(r,e){return xx(Hs(r),Hs(e))}var yx=px,Fs=Ni,Ks=tt,Ps=ft,wx=Lr;function Ex(r,e){var t=Ps(r),i=Ps(e),s=Ks(t),o=Ks(i),n=Fs(s),a=Fs(o),c=Math.pow(10,Math.max(n,a)),d=n>=a?n:a;return parseFloat(wx((t*c-i*c)/c,d))}var Cx=Ex,Ys=Ni,Vs=tt,bx=Dr;function _x(r,e){var t=Vs(r),i=Vs(e),s=Ys(t),o=Ys(i),n=o-s,a=n<0,c=Math.pow(10,a?Math.abs(n):n);return bx(t.replace(".","")/i.replace(".",""),a?1/c:c)}var ia=_x,Rx=ia,Ws=ft;function Ix(r,e){return Rx(Ws(r),Ws(e))}var Sx=Ix,er=ta,Tx=se,Ox=G,kx=Z,Lx=Ut;function Dx(r,e,t){var i=0;return kx(r&&r.length>2&&Ox(r)?r.sort():r,e?Tx(e)?function(){i=er(i,e.apply(t,arguments))}:function(s){i=er(i,Lx(s,e))}:function(s){i=er(i,s)}),i}var ra=Dx,$x=ia,Mx=Nn,Ax=ra;function Nx(r,e,t){return $x(Ax(r,e,t),Mx(r))}var Bx=Nx,Hx="first",Qt=Hx,Fx="last",Bi=Fx;function Kx(r){return r.getFullYear()}var jt=Kx,Px=864e5,Dt=Px;function Yx(r){return r.getMonth()}var Hi=Yx,Vx=et,Wx=ge;function Xx(r){return Vx(r)&&!isNaN(Wx(r))}var me=Xx,Xs=Qt,zx=Bi,Gx=Dt,Ux=jt,zs=ge,Gs=Hi,qx=oe,Zx=me,Jx=De;function sa(r,e,t){var i=e&&!isNaN(e)?e:0;if(r=qx(r),Zx(r)){if(t===Xs)return new Date(Ux(r),Gs(r)+i,1);if(t===zx)return new Date(zs(sa(r,i+1,Xs))-1);if(Jx(t)&&r.setDate(t),i){var s=r.getDate();if(r.setMonth(Gs(r)+i),s!==r.getDate())return r.setDate(1),new Date(zs(r)-Gx)}}return r}var ei=sa,Qx=Qt,Us=Bi,qs=jt,jx=ei,ep=oe,tp=me;function ip(r,e,t){var i;if(r=ep(r),tp(r)&&(e&&(i=e&&!isNaN(e)?e:0,r.setFullYear(qs(r)+i)),t||!isNaN(t))){if(t===Qx)return new Date(qs(r),0,1);if(t===Us)return r.setMonth(11),jx(r,0,Us);r.setMonth(t)}return r}var Fi=ip,rp=ei,sp=oe,op=me;function np(r){var e=r.getMonth();return e<3?1:e<6?2:e<9?3:4}function ap(r,e,t){var i,s=e&&!isNaN(e)?e*3:0;return r=sp(r),op(r)?(i=(np(r)-1)*3,r.setMonth(i),rp(r,s,t)):r}var lp=ap,Zs=Qt,cp=Bi,hp=qt,dp=jt,up=Hi,fp=ge,gp=oe,mp=me;function oa(r,e,t){if(r=gp(r),mp(r)&&!isNaN(e)){if(r.setDate(r.getDate()+hp(e)),t===Zs)return new Date(dp(r),up(r),r.getDate());if(t===cp)return new Date(fp(oa(r,1,Zs))-1)}return r}var na=oa;function vp(r){return r.toUpperCase()}var aa=vp,xp=Dt,pp=xp*7,la=pp,yp=ke,tr=Dt,wp=la,Ep=ge,Cp=oe,bp=me,Js=De;function _p(r,e,t,i){if(r=Cp(r),bp(r)){var s=Js(t),o=Js(i),n=Ep(r);if(s||o){var a=o?i:yp.firstDayOfWeek,c=r.getDay(),d=s?t:c;if(c!==d){var f=0;a>c?f=-(7-a+c):a<c&&(f=a-c),d>a?n+=((d===0?7:d)-a+f)*tr:d<a?n+=(7-a+d+f)*tr:n+=f*tr}}return e&&!isNaN(e)&&(n+=e*wp),new Date(n)}return r}var ca=_p,Rp=ke,di=Dt,Ip=la,Sp=De,Tp=kt,Op=oe,kp=me,Qs=ca,Lp=Zn,Dp=ut,ui=ge,$p=Dp(Lp(0,7),function(r){return[(r+1)%7,(r+2)%7,(r+3)%7]});function js(r,e){var t=new Date(r).getDay();return Tp($p[e],t)}function Mp(r,e){return function(t,i){var s=Sp(i)?i:Rp.firstDayOfWeek,o=Op(t);if(kp(o)){var n=Qs(o,0,s,s),a=r(n),c=ui(a),d=ui(n),f=d+di*6,u=new Date(f),g=Qs(a,0,s,s),v=ui(g),x;if(d===v)return 1;if(e(n,u)){for(x=ui(r(u));x<f;x+=di)if(js(x,s))return 1}var m=v+di*6,p=new Date(f),E=1;if(e(g,p)){for(E=0,x=c;x<m;x+=di)if(js(x,s)){E++;break}}return Math.floor((d-v)/Ip)+E}return NaN}}var ha=Mp,Ap=ha,Np=Ap(function(r){return new Date(r.getFullYear(),0,1)},function(r,e){return r.getFullYear()!==e.getFullYear()}),da=Np,Bp=jt,Hp=Hi;function Fp(r){return new Date(Bp(r),Hp(r),r.getDate())}var Kp=Fp,Pp=ge,Yp=Kp;function Vp(r){return Pp(Yp(r))}var Wp=Vp,Xp=Dt,zp=Qt,eo=Wp,Gp=Fi,Up=oe,qp=me;function Zp(r){return r=Up(r),qp(r)?Math.floor((eo(r)-eo(Gp(r,0,zp)))/Xp)+1:NaN}var ua=Zp,Jp=ne,Qp=Le,jp=Jt;function e0(r,e,t){var i=Jp(r);return e=e>>0,t=Qp(t)?" ":""+t,i.padStart?i.padStart(e,t):e>i.length?(e-=i.length,e>t.length&&(t+=jp(t,e/t.length)),t.slice(0,e)+i):i}var fa=e0,Ft=ke,t0=aa,i0=jt,to=Hi,r0=oe,s0=da,o0=ua,n0=he,a0=me,l0=se,Ie=fa;function Ue(r,e,t,i){var s=e[t];return s?l0(s)?s(i,t,r):s[i]:i}var c0=/\[([^\]]+)]|y{2,4}|M{1,2}|d{1,2}|H{1,2}|h{1,2}|m{1,2}|s{1,2}|S{1,3}|Z{1,2}|W{1,2}|D{1,3}|[aAeEq]/g;function h0(r,e,t){if(r){if(r=r0(r),a0(r)){var i=e||Ft.parseDateFormat||Ft.formatString,s=r.getHours(),o=s<12?"am":"pm",n=n0({},Ft.parseDateRules||Ft.formatStringMatchs,t?t.formats:null),a=function(w,_){return(""+i0(r)).substr(4-_)},c=function(w,_){return Ie(to(r)+1,_,"0")},d=function(w,_){return Ie(r.getDate(),_,"0")},f=function(w,_){return Ie(s,_,"0")},u=function(w,_){return Ie(s<=12?s:s-12,_,"0")},g=function(w,_){return Ie(r.getMinutes(),_,"0")},v=function(w,_){return Ie(r.getSeconds(),_,"0")},x=function(w,_){return Ie(r.getMilliseconds(),_,"0")},m=function(w,_){var S=r.getTimezoneOffset()/60*-1;return Ue(r,n,w,(S>=0?"+":"-")+Ie(S,2,"0")+(_===1?":":"")+"00")},p=function(w,_){return Ie(Ue(r,n,w,s0(r,(t?t.firstDay:null)||Ft.firstDayOfWeek)),_,"0")},E=function(w,_){return Ie(Ue(r,n,w,o0(r)),_,"0")},C={yyyy:a,yy:a,MM:c,M:c,dd:d,d,HH:f,H:f,hh:u,h:u,mm:g,m:g,ss:v,s:v,SSS:x,S:x,ZZ:m,Z:m,WW:p,W:p,DDD:E,D:E,a:function(w){return Ue(r,n,w,o)},A:function(w){return Ue(r,n,w,t0(o))},e:function(w){return Ue(r,n,w,r.getDay())},E:function(w){return Ue(r,n,w,r.getDay())},q:function(w){return Ue(r,n,w,Math.floor((to(r)+3)/3))}};return i.replace(c0,function(w,_){return _||(C[w]?C[w](w,w.length):w)})}return"Invalid Date"}return""}var ga=h0,d0=ge,u0=Ai,f0=Date.now||function(){return d0(u0())},ma=f0,g0=ge,m0=ma,v0=oe,x0=et,p0=function(r,e){if(r){var t=v0(r,e);return x0(t)?g0(t):t}return m0()},y0=p0,io=ga;function w0(r,e,t){return r&&e?(r=io(r,t),r!=="Invalid Date"&&r===io(e,t)):!1}var E0=w0,C0=ha,b0=C0(function(r){return new Date(r.getFullYear(),r.getMonth(),1)},function(r,e){return r.getMonth()!==e.getMonth()}),_0=b0,R0=Fi,I0=oe,S0=me,T0=$n;function O0(r,e){return r=I0(r),S0(r)?T0(R0(r,e))?366:365:NaN}var k0=O0,L0=Dt,D0=Qt,$0=Bi,ro=ge,so=ei,M0=oe,A0=me;function N0(r,e){return r=M0(r),A0(r)?Math.floor((ro(so(r,e,$0))-ro(so(r,e,D0)))/L0)+1:NaN}var B0=N0,oo=ge,H0=Ai,no=oe,ao=me,lo=[["yyyy",31536e6],["MM",2592e6],["dd",864e5],["HH",36e5],["mm",6e4],["ss",1e3],["S",0]];function F0(r,e){var t,i,s,o,n,a,c={done:!1,time:0};if(r=no(r),e=e?no(e):H0(),ao(r)&&ao(e)&&(t=oo(r),i=oo(e),t<i))for(o=c.time=i-t,c.done=!0,a=0,n=lo.length;a<n;a++)s=lo[a],o>=s[1]?a===n-1?c[s[0]]=o||0:(c[s[0]]=Math.floor(o/s[1]),o-=c[s[0]]*s[1]):c[s[0]]=0;return c}var K0=F0,P0=ne,Y0=Le,V0=Jt;function W0(r,e,t){var i=P0(r);return e=e>>0,t=Y0(t)?" ":""+t,i.padEnd?i.padEnd(e,t):e>i.length?(e-=i.length,e>t.length&&(t+=V0(t,e/t.length)),i+t.slice(0,e)):i}var X0=W0,z0=ne,G0=Jt;function U0(r,e){return G0(z0(r),e)}var q0=U0,Z0=ne;function J0(r){return r&&r.trimRight?r.trimRight():Z0(r).replace(/[\s\uFEFF\xA0]+$/g,"")}var va=J0,Q0=ne;function j0(r){return r&&r.trimLeft?r.trimLeft():Q0(r).replace(/^[\s\uFEFF\xA0]+/g,"")}var xa=j0,e1=va,t1=xa;function i1(r){return r&&r.trim?r.trim():e1(t1(r))}var pa=i1,r1={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},ya=r1,s1=ne,o1=Fe;function n1(r){var e=new RegExp("(?:"+o1(r).join("|")+")","g");return function(t){return s1(t).replace(e,function(i){return r[i]})}}var wa=n1,a1=ya,l1=wa,c1=l1(a1),h1=c1,co=ya,d1=wa,u1=Z,Ea={};u1(co,function(r,e){Ea[co[e]]=e});var f1=d1(Ea),g1=f1;function m1(r,e,t){return r.substring(e,t)}var Ca=m1;function v1(r){return r.toLowerCase()}var ba=v1,x1=ne,qe=Ca,Kt=aa,p1=ba,ir={};function y1(r){if(r=x1(r),ir[r])return ir[r];var e=r.length,t=r.replace(/([-]+)/g,function(i,s,o){return o&&o+s.length<e?"-":""});return e=t.length,t=t.replace(/([A-Z]+)/g,function(i,s,o){var n=s.length;return s=p1(s),o?n>2&&o+n<e?Kt(qe(s,0,1))+qe(s,1,n-1)+Kt(qe(s,n-1,n)):Kt(qe(s,0,1))+qe(s,1,n):n>1&&o+n<e?qe(s,0,n-1)+Kt(qe(s,n-1,n)):s}).replace(/(-[a-zA-Z])/g,function(i,s){return Kt(qe(s,1,s.length))}),ir[r]=t,t}var w1=y1,E1=ne,yt=Ca,Ze=ba,rr={};function C1(r){if(r=E1(r),rr[r])return rr[r];if(/^[A-Z]+$/.test(r))return Ze(r);var e=r.replace(/^([a-z])([A-Z]+)([a-z]+)$/,function(t,i,s,o){var n=s.length;return n>1?i+"-"+Ze(yt(s,0,n-1))+"-"+Ze(yt(s,n-1,n))+o:Ze(i+"-"+s+o)}).replace(/^([A-Z]+)([a-z]+)?$/,function(t,i,s){var o=i.length;return Ze(yt(i,0,o-1)+"-"+yt(i,o-1,o)+(s||""))}).replace(/([a-z]?)([A-Z]+)([a-z]?)/g,function(t,i,s,o,n){var a=s.length;return a>1&&(i&&(i+="-"),o)?(i||"")+Ze(yt(s,0,a-1))+"-"+Ze(yt(s,a-1,a))+o:(i||"")+(n?"-":"")+Ze(s)+(o||"")});return e=e.replace(/([-]+)/g,function(t,i,s){return s&&s+i.length<e.length?"-":""}),rr[r]=e,e}var b1=C1,_1=ne;function R1(r,e,t){var i=_1(r);return(arguments.length===1?i:i.substring(t)).indexOf(e)===0}var I1=R1,S1=ne;function T1(r,e,t){var i=S1(r),s=arguments.length;return s>1&&(s>2?i.substring(0,t).indexOf(e)===t-1:i.indexOf(e)===i.length-1)}var O1=T1,k1=ke,L1=ne,D1=pa,$1=Ut;function M1(r,e,t){return L1(r).replace((t||k1).tmplRE||/\{{2}([.\w[\]\s]+)\}{2}/g,function(i,s){return $1(e,D1(s))})}var _a=M1,A1=_a;function N1(r,e){return A1(r,e,{tmplRE:/\{([.\w[\]\s]+)\}/g})}var B1=N1;function H1(){}var F1=H1,ho=gt;function K1(r,e){var t=ho(arguments,2);return function(){return r.apply(e,ho(arguments).concat(t))}}var P1=K1,uo=gt;function Y1(r,e){var t=!1,i=null,s=uo(arguments,2);return function(){return t||(i=r.apply(e,uo(arguments).concat(s)),t=!0),i}}var V1=Y1,W1=gt;function X1(r,e,t){var i=0,s=[];return function(){var o=arguments;i++,i<=r&&s.push(o[0]),i>=r&&e.apply(t,[s].concat(W1(o)))}}var z1=X1,G1=gt;function U1(r,e,t){var i=0,s=[];return t=t||this,function(){var o=arguments;i++,i<r&&(s.push(o[0]),e.apply(t,[s].concat(G1(o))))}}var q1=U1,Z1=he;function J1(r,e,t){var i=null,s=null,o=!1,n=null,a=Z1({leading:!0,trailing:!0},t),c=a.leading,d=a.trailing,f=function(){i=null,s=null},u=function(){o=!0,r.apply(s,i),n=setTimeout(g,e),f()},g=function(){if(n=null,o){f();return}if(d===!0){u();return}f()},v=function(){var m=n!==null;return m&&clearTimeout(n),f(),n=null,o=!1,m},x=function(){if(i=arguments,s=this,o=!1,n===null&&c===!0){u();return}d===!0&&(n=setTimeout(g,e))};return x.cancel=v,x}var Q1=J1,j1=he;function ey(r,e,t){var i=null,s=null,o=typeof t=="boolean"?{leading:t,trailing:!t}:j1({leading:!1,trailing:!0},t),n=!1,a=null,c=o.leading,d=o.trailing,f=function(){i=null,s=null},u=function(){n=!0,r.apply(s,i),f()},g=function(){if(c===!0&&(a=null),n){f();return}if(d===!0){u();return}f()},v=function(){var m=a!==null;return m&&clearTimeout(a),f(),a=null,n=!1,m},x=function(){n=!1,i=arguments,s=this,a===null?c===!0&&u():clearTimeout(a),a=setTimeout(g,e)};return x.cancel=v,x}var ty=ey,iy=gt;function ry(r,e){var t=iy(arguments,2),i=this;return setTimeout(function(){r.apply(i,t)},e)}var sy=ry,oy=decodeURIComponent,Ra=oy,fo=Ra,ny=ee,ay=Ye;function ly(r){var e,t={};return r&&ay(r)&&ny(r.split("&"),function(i){e=i.split("="),t[fo(e[0])]=fo(e[1]||"")}),t}var Ia=ly,cy=encodeURIComponent,Sa=cy,Ci=Sa,Ta=Z,Oa=G,ka=Ke,hy=Le,La=Ot;function Da(r,e,t){var i,s=[];return Ta(r,function(o,n){i=Oa(o),La(o)||i?s=s.concat(Da(o,e+"["+n+"]",i)):s.push(Ci(e+"["+(t?"":n)+"]")+"="+Ci(ka(o)?"":o))}),s}function dy(r){var e,t=[];return Ta(r,function(i,s){hy(i)||(e=Oa(i),La(i)||e?t=t.concat(Da(i,s,e)):t.push(Ci(s)+"="+Ci(ka(i)?"":i)))}),t.join("&").replace(/%20/g,"+")}var uy=dy,fy=Ce,gy=typeof location===fy?0:location,Ki=gy,fi=Ki;function my(){return fi?fi.origin||fi.protocol+"//"+fi.host:""}var $a=my,go=Ki,vy=Ia,xy=$a;function mo(r){return vy(r.split("?")[1]||"")}function py(r){var e,t,i,s,o=""+r;return o.indexOf("//")===0?o=(go?go.protocol:"")+o:o.indexOf("/")===0&&(o=xy()+o),i=o.replace(/#.*/,"").match(/(\?.*)/),s={href:o,hash:"",host:"",hostname:"",protocol:"",port:"",search:i&&i[1]&&i[1].length>1?i[1]:""},s.path=o.replace(/^([a-z0-9.+-]*:)\/\//,function(n,a){return s.protocol=a,""}).replace(/^([a-z0-9.+-]*)(:\d+)?\/?/,function(n,a,c){return t=c||"",s.port=t.replace(":",""),s.hostname=a,s.host=a+t,"/"}).replace(/(#.*)/,function(n,a){return s.hash=a.length>1?a:"",""}),e=s.hash.match(/#((.*)\?|(.*))/),s.pathname=s.path.replace(/(\?|#.*).*/,""),s.origin=s.protocol+"//"+s.host,s.hashKey=e&&(e[2]||e[1])||"",s.hashQuery=mo(s.hash),s.searchQuery=mo(s.search),s}var Ma=py,vo=Ki,yy=$a,wy=An;function Ey(){if(vo){var r=vo.pathname,e=wy(r,"/")+1;return yy()+(e===r.length?r:r.substring(0,e))}return""}var Cy=Ey,xo=Ki,by=Ma;function _y(){return xo?by(xo.href):{}}var Ry=_y,Aa=ke,sr=Sr,po=Ra,yo=Sa,Iy=G,wo=$i,Na=et,Sy=Le,Ty=kt,Oy=Fe,bi=he,or=ee,ky=Ai,gi=ge,Ly=Fi,Dy=ei,$y=na;function Eo(r,e){var t=parseFloat(e),i=ky(),s=gi(i);switch(r){case"y":return gi(Ly(i,t));case"M":return gi(Dy(i,t));case"d":return gi($y(i,t));case"h":case"H":return s+t*60*60*1e3;case"m":return s+t*60*1e3;case"s":return s+t*1e3}return s}function nr(r){return(Na(r)?r:new Date(r)).toUTCString()}function Qe(r,e,t){if(sr){var i,s,o,n,a,c,d=[],f=arguments;return Iy(r)?d=r:f.length>1?d=[bi({name:r,value:e},t)]:wo(r)&&(d=[r]),d.length>0?(or(d,function(u){i=bi({},Aa.cookies,u),o=[],i.name&&(s=i.expires,o.push(yo(i.name)+"="+yo(wo(i.value)?JSON.stringify(i.value):i.value)),s&&(isNaN(s)?s=s.replace(/^([0-9]+)(y|M|d|H|h|m|s)$/,function(g,v,x){return nr(Eo(x,v))}):/^[0-9]{11,13}$/.test(s)||Na(s)?s=nr(s):s=nr(Eo("d",s)),i.expires=s),or(["expires","path","domain","secure"],function(g){Sy(i[g])||o.push(i[g]&&g==="secure"?g:g+"="+i[g])})),sr.cookie=o.join("; ")}),!0):(n={},a=sr.cookie,a&&or(a.split("; "),function(u){c=u.indexOf("="),n[po(u.substring(0,c))]=po(u.substring(c+1)||"")}),f.length===1?n[r]:n)}return!1}function My(r){return Ty(Ba(),r)}function Co(r){return Qe(r)}function bo(r,e,t){return Qe(r,e,t),Qe}function _o(r,e){Qe(r,"",bi({expires:-1},Aa.cookies,e))}function Ba(){return Oy(Qe())}function Ay(){return Qe()}bi(Qe,{has:My,set:bo,setItem:bo,get:Co,getItem:Co,remove:_o,removeItem:_o,keys:Ba,getJSON:Ay});var Ny=Qe,By=Ce,ar=Sr,lr=Yn,Hy=he,Fy=ee;function Ro(r){try{var e="__xe_t";return r.setItem(e,1),r.removeItem(e),!0}catch{return!1}}function mi(r){return navigator.userAgent.indexOf(r)>-1}function Ky(){var r,e,t,i=!1,s=!1,o=!1,n={isNode:!1,isMobile:i,isPC:!1,isDoc:!!ar};if(!lr&&typeof process!==By)n.isNode=!0;else{t=mi("Edge"),e=mi("Chrome"),i=/(Android|webOS|iPhone|iPad|iPod|SymbianOS|BlackBerry|Windows Phone)/.test(navigator.userAgent),n.isDoc&&(r=ar.body||ar.documentElement,Fy(["webkit","khtml","moz","ms","o"],function(a){n["-"+a]=!!r[a+"MatchesSelector"]}));try{s=Ro(lr.localStorage)}catch{}try{o=Ro(lr.sessionStorage)}catch{}Hy(n,{edge:t,firefox:mi("Firefox"),msie:!t&&n["-ms"],safari:!e&&!t&&mi("Safari"),isMobile:i,isPC:!i,isLocalStorage:s,isSessionStorage:o})}return n}var Py=Ky,Ha=tc,Io=he,Yy=Gt,Vy=Zo,Wy=fc,Xy=wc,zy=ut,Gy=jo,Uy=en,qy=tn,Zy=ee,Jy=Cr,Qy=rn,jy=Yc,ew=br,tw=yh,iw=Rr,rw=an,sw=Th,ow=gt,nw=Ah,aw=Hh,lw=kt,cw=Ph,hw=Xh,dw=Uh,uw=Jh,fw=ed,gw=md,mw=un,vw=yd,xw=Cd,pw=cn,yw=Sd,ww=cu,Ew=gu,Cw=pu,bw=Cn,_w=Ru,Rw=Tu,Iw=$u,Sw=Rn,Tw=In,Ow=Ee,kw=G,Lw=Ke,Dw=Ku,$w=Le,Mw=se,Aw=$i,Nw=Ye,Bw=Ot,Hw=$n,Fw=et,Kw=Pe,Pw=Z,Yw=ff,Vw=xf,Ww=Rf,Xw=An,zw=Fe,Gw=Lt,Uw=Er,qw=Nn,Zw=vn,Jw=pn,Qw=xn,jw=Af,eE=Vf,tE=Bn,iE=Hn,rE=De,sE=Ir,oE=Fn,nE=Jf,aE=Kn,lE=Pn,cE=sg,hE=lg,dE=fg,uE=pg,fE=Cg,gE=Ig,mE=kg,vE=Mg,xE=Hg,pE=om,yE=Gn,wE=cm,EE=xm,CE=Em,bE=Tr,_E=_m,RE=Tm,IE=Lm,SE=Mm,TE=Ym,OE=Xm,kE=Um,LE=Jm,DE=tv,$E=Ut,ME=av,AE=qn,NE=pv,BE=Zn,HE=Rv,FE=nn,KE=dn,PE=Tv,YE=cx,VE=kr,WE=jn,XE=ea,zE=Lr,GE=fx,UE=ft,qE=tt,ZE=yx,JE=Cx,QE=Dr,jE=Sx,e2=ra,t2=Bx,i2=Fi,r2=lp,s2=ei,o2=na,n2=oe,a2=ga,l2=ma,c2=y0,h2=me,d2=E0,u2=ca,f2=ua,g2=da,m2=_0,v2=k0,x2=B0,p2=K0,y2=X0,w2=fa,E2=q0,C2=pa,b2=va,_2=xa,R2=h1,I2=g1,S2=w1,T2=b1,O2=I1,k2=O1,L2=_a,D2=B1,So=ne,$2=F1,M2=Tt,A2=P1,N2=V1,B2=z1,H2=q1,F2=Q1,K2=ty,P2=sy,Y2=Ia,V2=uy,W2=Ma,X2=Cy,z2=Ry,G2=Ny,U2=Py;Io(Ha,{assign:Io,objectEach:Yy,lastObjectEach:Vy,objectMap:Wy,merge:Xy,uniq:Qy,union:jy,sortBy:tw,orderBy:iw,shuffle:rw,sample:sw,some:Gy,every:Uy,slice:ow,filter:nw,find:cw,findLast:hw,findKey:aw,includes:lw,arrayIndexOf:Sw,arrayLastIndexOf:Tw,map:zy,reduce:dw,copyWithin:uw,chunk:fw,zip:gw,unzip:mw,zipObject:vw,flatten:xw,toArray:ew,includeArrays:qy,pluck:pw,invoke:yw,arrayEach:Zy,lastArrayEach:Jy,toArrayTree:ww,toTreeArray:Ew,findTree:Cw,eachTree:bw,mapTree:_w,filterTree:Rw,searchTree:Iw,hasOwnProp:Ow,eqNull:Kw,isNaN:Dw,isFinite:jw,isUndefined:$w,isArray:kw,isFloat:eE,isInteger:tE,isFunction:Mw,isBoolean:iE,isString:Nw,isNumber:rE,isRegExp:sE,isObject:Aw,isPlainObject:Bw,isDate:Fw,isError:oE,isTypeError:nE,isEmpty:aE,isNull:Lw,isSymbol:lE,isArguments:cE,isElement:hE,isDocument:dE,isWindow:uE,isFormData:fE,isMap:gE,isWeakMap:mE,isSet:vE,isWeakSet:xE,isLeapYear:Hw,isMatch:pE,isEqual:yE,isEqualWith:wE,getType:EE,uniqueId:CE,getSize:qw,indexOf:Ww,lastIndexOf:Xw,findIndexOf:bE,findLastIndexOf:_E,toStringJSON:RE,toJSONString:IE,keys:zw,values:Gw,entries:SE,pick:TE,omit:OE,first:kE,last:LE,each:Pw,forOf:Yw,lastForOf:Vw,lastEach:Zw,has:DE,get:$E,set:ME,groupBy:AE,countBy:NE,clone:Uw,clear:Qw,remove:Jw,range:BE,destructuring:HE,random:FE,min:PE,max:KE,commafy:YE,round:VE,ceil:WE,floor:XE,toFixed:zE,toNumber:UE,toNumberString:qE,toInteger:GE,add:ZE,subtract:JE,multiply:QE,divide:jE,sum:e2,mean:t2,now:l2,timestamp:c2,isValidDate:h2,isDateSame:d2,toStringDate:n2,toDateString:a2,getWhatYear:i2,getWhatQuarter:r2,getWhatMonth:s2,getWhatWeek:u2,getWhatDay:o2,getYearDay:f2,getYearWeek:g2,getMonthWeek:m2,getDayOfYear:v2,getDayOfMonth:x2,getDateDiff:p2,trim:C2,trimLeft:_2,trimRight:b2,escape:R2,unescape:I2,camelCase:S2,kebabCase:T2,repeat:E2,padStart:w2,padEnd:y2,startsWith:O2,endsWith:k2,template:L2,toFormatString:D2,toString:So,toValueString:So,noop:$2,property:M2,bind:A2,once:N2,after:B2,before:H2,throttle:F2,debounce:K2,delay:P2,unserialize:Y2,serialize:V2,parseUrl:W2,getBaseURL:X2,locat:z2,browse:U2,cookie:G2});var T=Ha,J=[];for(var cr=0;cr<256;++cr)J.push((cr+256).toString(16).slice(1));function q2(r,e=0){return(J[r[e+0]]+J[r[e+1]]+J[r[e+2]]+J[r[e+3]]+"-"+J[r[e+4]]+J[r[e+5]]+"-"+J[r[e+6]]+J[r[e+7]]+"-"+J[r[e+8]]+J[r[e+9]]+"-"+J[r[e+10]]+J[r[e+11]]+J[r[e+12]]+J[r[e+13]]+J[r[e+14]]+J[r[e+15]]).toLowerCase()}var vi,Z2=new Uint8Array(16);function J2(){if(!vi&&(vi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!vi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return vi(Z2)}var Q2=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const To={randomUUID:Q2};function He(r,e,t){if(To.randomUUID&&!r)return To.randomUUID();r=r||{};var i=r.random||(r.rng||J2)();return i[6]=i[6]&15|64,i[8]=i[8]&63|128,q2(i)}const j2=r=>r==null||r==="",q=r=>!j2(r),at=r=>r==null,fe=r=>!at(r),eC=r=>function(e,t,i,s){const o=i||{},n=o.children||"children";return r(null,e,t,s,[],[],n,o)},Fa=(r,e,t,i,s,o,n)=>{let a,c;e.forEach((d,f)=>{a=s.concat([""+f]),c=o.concat([d]),t.call(i,d,f,e,a,r,c),d&&n&&(a.push(n),Fa(d,d[n]||[],t,i,a,c,n))})},Yt=eC(Fa),Ka={form:{labelCol:{span:6},wrapperCol:{span:16}},grid:{align:"left",lazyReset:!1,fitHeight:170,striped:!1},canvasTable:{DISABLED:!0,ENABLE_FINDER:!0,AUTO_ROW_HEIGHT:!0}};let ae=T.clone(Ka,!0);function Pa(r){ae={form:{...ae.form,...r.form},grid:{...ae.grid,...r.grid},canvasTable:{...ae.canvasTable,...r.canvasTable}}}function tC(){return ae}function Oo(){var r,e;return{labelCol:(r=ae.form)==null?void 0:r.labelCol,wrapperCol:(e=ae.form)==null?void 0:e.wrapperCol}}function Et(){var r,e,t,i;return{align:(r=ae.grid)==null?void 0:r.align,lazyReset:(e=ae.grid)==null?void 0:e.lazyReset,fitHeight:(t=ae.grid)==null?void 0:t.fitHeight,striped:(i=ae.grid)==null?void 0:i.striped}}function Ya(){return ae.canvasTable||{}}function iC(){ae=JSON.parse(JSON.stringify(Ka))}const Pi=r=>{var e;return{dataIndex:r.field,key:r.field,title:r.title,...T.omit(r,["children","slots","cellRender","formatter"]),children:(e=r.children)==null?void 0:e.map(t=>Pi(t))}},$r={xs:24,sm:24,md:12,lg:8,xl:8,xxl:6},Mr={xs:12,sm:5,md:6,lg:6,xl:5,xxl:4},rC={1:{xs:12,sm:5,md:6,lg:6,xl:5,xxl:4},2:{xs:12,sm:5,md:6,lg:6,xl:5,xxl:4},3:{xs:12,sm:5,md:6,lg:6,xl:5,xxl:5},4:{xs:12,sm:4,md:6,lg:9,xl:7,xxl:6},5:{xs:12,sm:4,md:6,lg:9,xl:7,xxl:6},6:{xs:12,sm:6,md:8,lg:10,xl:7,xxl:8},7:{xs:12,sm:6,md:8,lg:10,xl:9,xxl:9},8:{xs:12,sm:6,md:8,lg:10,xl:7,xxl:9},9:{xs:12,sm:6,md:8,lg:10,xl:9,xxl:10}},Va=r=>{const t=(24-r.reduce((s,o)=>s+o,0))%24,i=t===0?24:t<0?24+t:t;return i>1?i:24},ko=["xxs","xs","sm","md","lg","xl","xxl"],sC=r=>{const e=T.isArray(r)?r:T.isNumber(r)?Array.from({length:r},()=>$r):[];return T.zipObject(ko,ko.map(t=>e.every(i=>q(i[t]))?Va(e.map(i=>i[t])):24))};function Ar(r,e,t){const i=l.toValue(r);if(typeof i!="object"||i===null)return l.watch(r,e,t);let s=T.clone(i,!0);return l.watch(r,(o,n,a)=>{e(o,s,a),s=T.clone(o,!0)},t)}const nt="-",Ct={toString:({cellValue:r})=>{var e;return r?((e=r.toString)==null?void 0:e.call(r))??nt:nt},formatByOptions:({cellValue:r},e,t=",")=>{if(r==null)return nt;if(T.isArray(r))if(r.length>0){const s=e.filter(o=>r.includes(o.value));return s.length?s.map(o=>o.label).join(t):nt}else return nt;const i=e.find(s=>s.value===r);return i?i.label:nt},formatSex:({cellValue:r})=>q(r)?T.toNumber(r)===1?"男":"女":nt},oC=(r,{record:e,index:t,column:i,field:s})=>{if(T.isString(r)&&Ct[r]){const o=Ct[r];return o({row:e,rowIndex:t,cellValue:s?e[s]:null})}else if(T.isArray(r)&&Ct[r[0]]&&r.length>1){const o=Ct[r[0]];return o({row:e,rowIndex:t,cellValue:s?e[s]:null},...r.slice(1))}else return T.isFunction(r)?r({row:e,rowIndex:t,cellValue:s?e[s]:null,column:i}):s?e[s]:null},Wa=r=>{Object.assign(Ct,r)},nC=l.defineComponent(r=>{const{cellRender:e,renderTableParams:t}=r,{data:i,row:s,field:o,rowIndex:n}=t;return()=>{var a,c;return((c=(a=Vt.renders[e.name])==null?void 0:a.renderDefault)==null?void 0:c.call(a,e,{data:i,row:s,field:o,rowIndex:n},r.defaultHandler))??null}},{name:"RenderAntCell",props:["cellRender","renderTableParams","defaultHandler"]}),Xa=l.defineComponent(r=>{const{tableData:e,row:t,column:i,rowIndex:s}=r,o=i.field?t[i.field]:null;return()=>{var n,a;return((a=(n=i.slots)==null?void 0:n.default)==null?void 0:a.call(n,{row:t,column:i,rowIndex:s,cellValue:o}))??(i.cellRender?l.createVNode(nC,{cellRender:i.cellRender,defaultHandler:r.defaultHandler,renderTableParams:{data:e,row:t,field:i.field,rowIndex:s}},null):i.formatter?oC(i.formatter,{record:t,index:s,field:i.field,column:i}):o)}},{name:"RenderAntDefaultCell",props:["tableData","row","column","rowIndex","defaultHandler"]}),aC={class:"text-right mt-4px"},lC=l.defineComponent({__name:"TableInput",props:{modelValue:{type:Array,default:()=>[]},tableConfig:{type:Object,default:()=>({})},editColumns:{type:Array,default:()=>[]}},emits:["update:modelValue","trigger"],setup(r,{emit:e}){const t=r,i={size:"small",pagination:!1};l.watch(()=>t.modelValue,()=>{o("trigger")},{deep:!0});const s=l.computed(()=>T.merge({},i,t.tableConfig)),o=e,n=l.computed({get:()=>t.modelValue??[],set:u=>{o("update:modelValue",u)}}),a=l.computed(()=>[...t.editColumns,{title:"操作",fixed:"right",width:100,cellRender:{name:"ButtonTree",children:[{content:"删除",type:"link",danger:!0,clickEvt:({rowIndex:u})=>d(u)}]}}]),c=()=>{n.value=[...n.value,{}]},d=u=>{n.value=n.value.filter((g,v)=>v!==u)},f=l.computed(()=>{let u=0;return a.value.filter(g=>g.slots&&g.slots.default||g.formatter||g.cellRender?(g.field||(g.field="__holder__"+u,u++),!0):!1)});return(u,g)=>{const v=l.resolveComponent("a-form-item-rest"),x=l.resolveComponent("a-table"),m=l.resolveComponent("a-button");return l.openBlock(),l.createElementBlock("div",null,[l.createVNode(x,l.mergeProps({"data-source":n.value},s.value,{columns:a.value.map(p=>l.unref(Pi)(p))}),l.createSlots({_:2},[f.value.length>0?{name:"bodyCell",fn:l.withCtx(({column:p,record:E,index:C})=>[l.createVNode(v,null,{default:l.withCtx(()=>[f.value.some(w=>p.key&&w.field===p.key)?(l.openBlock(),l.createBlock(l.unref(Xa),{key:C,"row-index":C,"default-handler":{},column:f.value.find(w=>p.key&&w.field===p.key),row:E,"table-data":n.value},null,8,["row-index","column","row","table-data"])):l.createCommentVNode("",!0)]),_:2},1024)]),key:"0"}:void 0]),1040,["data-source","columns"]),l.createElementVNode("div",aC,[l.createVNode(m,{type:"primary",onClick:c},{default:l.withCtx(()=>g[0]||(g[0]=[l.createTextVNode("+添加",-1)])),_:1,__:[0]})])])}}}),le=r=>{const{icon:e}=r,t=pl;return t[e]?l.createVNode(t[e]):t[e]},Pt={AInput:{autocomplete:"off"},$input:{autocomplete:"off",allowClear:!0},AInputNumber:{min:0,controls:!1,precision:0},$number:{min:0,controls:!1,precision:0},$date:{format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD"},ADatePicker:{format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD"},$range:{format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD"},ARangePicker:{format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD"},$select:{getPopupContainer:r=>r.parentNode,allowClear:!0,showSearch:!0,filterOption:(r,e)=>e.label&&e.label.toLowerCase().includes(r.toLowerCase())},ASelect:{getPopupContainer:r=>r.parentNode,allowClear:!0,showSearch:!0,filterOption:(r,e)=>e.label&&e.label.toLowerCase().includes(r.toLowerCase())}},xi={PercentInput:{controls:!1,min:0,max:100,addonAfter:"%"},autoComplete:{inputProps:{}}},za={$input:A.Input,AInput:A.Input,$textarea:A.Textarea,Textarea:A.Textarea,$number:A.InputNumber,AInputNumber:A.InputNumber,$select:A.Select,ASelect:A.Select,$date:A.DatePicker,ADatePicker:A.DatePicker,$range:A.RangePicker,ARangePicker:A.RangePicker,AAutoComplete:A.AutoComplete,$Cascader:A.Cascader,ACascader:A.Cascader,ACheckbox:A.Checkbox,AMentions:A.Mentions,ARate:A.Rate,ASlider:A.Slider,$time:A.TimePicker,ATimePicker:A.TimePicker,ATreeSelect:A.TreeSelect},cC=r=>{const e=za[r];return{renderItemContent({props:t={},attrs:i={},events:s={},defaultValue:o},{data:n,field:a}){return fe(o)&&q(a)&&at(n[a])&&(n[a]=o),a?l.createVNode(e,l.mergeProps({is:r,value:n[a],"onUpdate:value":c=>n[a]=c},i,T.merge({},Pt[r],t),{onChange:(...c)=>{var d;(d=s.change)==null||d.call(s,{data:n,field:a},...c)}}),null):l.createVNode(e,l.mergeProps({is:r},t),null)},renderDefault({props:t=Pt[r]??{},attrs:i={},events:s={},defaultValue:o},{data:n,row:a,field:c}){return fe(o)&&q(c)&&at(a[c])&&(a[c]=o),c?l.createVNode(e,l.mergeProps({is:r,value:a[c],"onUpdate:value":d=>a[c]=d},i,T.merge({},Pt[r],t),{onChange:(...d)=>{var f;(f=s.change)==null||f.call(s,{data:n,row:a,field:c},...d)}}),null):l.createVNode(e,l.mergeProps({is:r},t),null)},renderEdit(t,{props:i=Pt[r]??{},attrs:s={},events:o={}},n,a){return l.createVNode(e,l.mergeProps({is:r,value:t.value,"onUpdate:value":c=>t.value=c},s,T.merge({},Pt[r],i),{onBlur:(...c)=>{var d;a==null||a("blur",t.value),(d=o.blur)==null||d.call(o,n,...c)}}),null)}}},Ga=(r,e,t)=>{var i,s;return r.dropdowns&&r.dropdowns.length>0&&r.dropdowns.filter(o=>{var n;return!((n=o.hiddenIf)!=null&&n.call(o,e))}).length>0?l.createVNode(A.Dropdown,{getPopupContainer:t??(()=>document.querySelector(".p-wrapper"))},{default:()=>{var o;return l.createVNode(A.Button,l.mergeProps(T.omit(r,["dynamicClassName","content","getContent","icon","clickEvt","dropdowns","getProps"]),{icon:r.icon?l.createVNode(le,{icon:r.icon},null):l.createVNode(le,{icon:"DownOutlined"},null)},((o=r.getProps)==null?void 0:o.call(r,e))??{}),{default:()=>{var n;return[r.content||(((n=r==null?void 0:r.getContent)==null?void 0:n.call(r,e))??"")]}})},overlay:()=>{var o;return l.createVNode("div",{class:`dropdown-wrapper ${((o=r==null?void 0:r.dynamicClassName)==null?void 0:o.call(r,e))??""}`},[r.dropdowns.filter(n=>{var a;return!((a=n.hiddenIf)!=null&&a.call(n,e))}).map(n=>Ga(n,e,t))])}}):l.createVNode(A.Button,l.mergeProps({class:((i=r==null?void 0:r.dynamicClassName)==null?void 0:i.call(r,e))||""},T.omit(r,["dynamicClassName","content","getContent","icon","clickEvt","dropdowns","getProps"]),{disabled:!!r.dropdowns&&r.dropdowns.length>0||r.disabled,icon:r.icon?l.createVNode(le,{icon:r.icon},null):null},((s=r.getProps)==null?void 0:s.call(r,e))??{},{onClick:()=>{r!=null&&r.clickEvt&&r.clickEvt(e)}}),{default:()=>{var o;return[r.content||(((o=r==null?void 0:r.getContent)==null?void 0:o.call(r,e))??"")]}})},gr={...Object.fromEntries(Object.keys(za).map(r=>[r,cC(r)])),$button:{renderItemContent({props:r={},events:e={}},{data:t,field:i},s){return l.createVNode(A.Button,l.mergeProps(T.omit(r,["content"]),{icon:r.icon?l.createVNode(le,{icon:r.icon},null):null,onClick:()=>{var o;(o=e.click)==null||o.call(e,{data:t,field:i}),r.htmlType==="reset"&&(s!=null&&s.reset)&&(r.beforeClick&&T.isFunction(r.beforeClick)?r.beforeClick({data:t,field:i}).then(n=>{s.reset(n?{data:n,field:i}:{data:t,field:i})}):s.reset({data:t,field:i}))}}),{default:()=>{var o;return[r.content,((o=r.suffix)==null?void 0:o.call(r,{data:t,field:i}))??null]}})},renderDefault({props:r={},events:e={}},{row:t,field:i},s){return l.createVNode(A.Button,l.mergeProps(T.omit(r,["content"]),{icon:r.icon?l.createVNode(le,{icon:r.icon},null):null,onClick:()=>{var o,n,a;(o=e.click)==null||o.call(e,{row:t,field:i}),r.htmlType==="reset"&&(s!=null&&s.reset)&&(r.beforeClick&&T.isFunction(r.beforeClick)?((n=s==null?void 0:s.setLoadings)==null||n.call(s,!0),r.beforeClick({row:t,field:i}).then(c=>{s.reset(c?{row:c,field:i}:{row:t,field:i})}).finally(()=>{var c;(c=s==null?void 0:s.setLoadings)==null||c.call(s,!1)})):s.reset({row:t,field:i})),r.htmlType==="pick"&&(s!=null&&s.pick)&&(r.beforeClick&&T.isFunction(r.beforeClick)?((a=s==null?void 0:s.setLoadings)==null||a.call(s,!0),r.beforeClick({row:t,field:i}).then(c=>{s.pick(c?{row:c,field:i}:{row:t,field:i})}).finally(()=>{var c;(c=s==null?void 0:s.setLoadings)==null||c.call(s,!1)})):s.pick({row:t,field:i}))}}),{default:()=>[r.content]})}},$buttons:{renderItemContent({props:r={},children:e=[]},{data:t,field:i},s){return l.createVNode("span",{class:"align-gap-box w-fit"},[e.map(o=>l.createVNode(A.Button,l.mergeProps(T.omit(Object.assign({},r,o.props),["content"]),{icon:o.props.icon?l.createVNode(le,{icon:o.props.icon},null):null,onClick:()=>{var n,a;(a=(n=o.events)==null?void 0:n.click)==null||a.call(n,{data:t,field:i}),o.props.htmlType==="reset"&&(s!=null&&s.reset)&&(r.beforeClick&&T.isFunction(r.beforeClick)?r.beforeClick({data:t,field:i}).then(c=>{s.reset(c?{data:c,field:i}:{data:t,field:i})}):s.reset({data:t,field:i})),o.props.htmlType==="pick"&&(s!=null&&s.pick)&&(r.beforeClick&&T.isFunction(r.beforeClick)?r.beforeClick({data:t,field:i}).then(c=>{s.pick(c?{data:c,field:i}:{data:t,field:i})}):s.pick({data:t,field:i}))}}),{default:()=>[o.props.content]}))])},renderDefault({props:r={},children:e=[]},{data:t,row:i,field:s},o){return l.createVNode("span",{class:"align-gap-box w-fit"},[e.filter(n=>{var a,c;return!((c=(a=n==null?void 0:n.props)==null?void 0:a.hiddenIf)!=null&&c.call(a,{data:t,row:i,field:s}))}).map(n=>l.createVNode(A.Button,l.mergeProps(T.omit(Object.assign({},r,n.props),["content","hiddenIf"]),{icon:n.props.icon?l.createVNode(le,{icon:n.props.icon},null):null,onClick:()=>{var a,c,d,f;(c=(a=n.events)==null?void 0:a.click)==null||c.call(a,{data:t,row:i,field:s}),n.props.htmlType==="reset"&&(o!=null&&o.reset)&&(r.beforeClick&&T.isFunction(r.beforeClick)?((d=o==null?void 0:o.setLoadings)==null||d.call(o,!0),r.beforeClick({row:i,field:s}).then(u=>{o.reset(u?{row:u,field:s}:{row:i,field:s})}).finally(()=>{var u;(u=o==null?void 0:o.setLoadings)==null||u.call(o,!1)})):o.reset({row:i,field:s})),n.props.htmlType==="pick"&&(o!=null&&o.pick)&&(r.beforeClick&&T.isFunction(r.beforeClick)?((f=o==null?void 0:o.setLoadings)==null||f.call(o,!0),r.beforeClick({row:i,field:s}).then(u=>{o.pick(u?{row:u,field:s}:{row:i,field:s})}).finally(()=>{var u;(u=o==null?void 0:o.setLoadings)==null||u.call(o,!1)})):o.pick({row:i,field:s}))}}),{default:()=>[n.props.content]}))])}},ButtonTree:{renderDefault({children:r=[],props:e={}},t){const i=l.ref(null);return l.createVNode("span",{ref:i,class:e.noGap?"align-no-gap-box":"align-gap-box"},[r.filter(s=>{var o;return!((o=s.hiddenIf)!=null&&o.call(s,t))}).map(s=>Ga(s,t,()=>{var o,n,a,c;return((c=(a=(n=(o=i.value)==null?void 0:o.parentElement)==null?void 0:n.parentElement)==null?void 0:a.parentElement)==null?void 0:c.parentElement)||document.body}))??[]])}},$radio:{renderItemContent({props:r={},events:e={},options:t,defaultValue:i},{data:s,field:o}){return fe(i)&&q(o)&&at(s[o])&&(s[o]=i),q(o)?l.createVNode(A.RadioGroup,l.mergeProps({value:s[o],"onUpdate:value":n=>s[o]=n},r,{options:r.options??t??[],disabled:!!r.disabled,onChange:(...n)=>{var a;(a=e.change)==null||a.call(e,{data:s,field:o},...n)}}),null):null},renderDefault({props:r={},options:e},{row:t,field:i}){return q(i)?l.createVNode(A.RadioGroup,l.mergeProps({value:t[i],"onUpdate:value":s=>t[i]=s},r,{options:r.options??e??[]}),null):null}},$autoComplete:{renderItemContent({props:r={},events:e={}},{data:t,field:i}){return q(i)?l.createVNode(A.AutoComplete,l.mergeProps({value:t[i],"onUpdate:value":s=>t[i]=s},Object.assign({},{filterOption:xi.autoComplete.filterOption},r),{onChange:(...s)=>{var o;(o=e.change)==null||o.call(e,{data:t,field:i},...s)}}),{default:()=>l.createVNode(l.resolveComponent("a-input"),Object.assign({},xi.autoComplete.inputProps,r.inputProps??{}),null)}):null}},$switch:{renderItemContent({props:r={},events:e={},defaultValue:t},{data:i,field:s}){return fe(t)&&q(s)&&at(i[s])&&(i[s]=t),q(s)?l.createVNode(A.Switch,l.mergeProps({checked:i[s],"onUpdate:checked":o=>i[s]=o},r,{onChange:(...o)=>{var n;(n=e.change)==null||n.call(e,{data:i,field:s},...o)}}),null):null}},$checkbox:{renderItemContent({props:r={},options:e,events:t={},defaultValue:i},{data:s,field:o}){return fe(i)&&q(o)&&at(s[o])&&(s[o]=i),q(o)?l.createVNode(A.CheckboxGroup,l.mergeProps({value:s[o],"onUpdate:value":n=>s[o]=n},r,{options:r.options??e??[],onChange:(...n)=>{var a;(a=t.change)==null||a.call(t,{data:s,field:o},...n)}}),null):null},renderDefault({props:r={},options:e},{row:t,field:i}){return q(i)?l.createVNode(A.CheckboxGroup,l.mergeProps({value:t[i],"onUpdate:value":s=>t[i]=s},r,{options:r.options??e??[]}),null):null}},$paragraph:{renderDefault({props:r={}},{row:e,field:t}){var o;const i={ellipsis:{expandable:!0,rows:3}},s=((o=r.getContent)==null?void 0:o.call(r,{row:e,field:t}))??(q(t)?e[t]:"");return q(t)?l.createVNode(A.TypographyParagraph,l.mergeProps(T.merge({},i,T.omit(r,["content","getContent"])),{content:s}),null):null}},$tableInput:{renderItemContent({props:r={},handleTrigger:e},{data:t,field:i}){return q(i)?l.createVNode(lC,{modelValue:t[i],"onUpdate:modelValue":s=>t[i]=s,onTrigger:()=>{e&&T.isFunction(e)&&e(r.cusFields??i)},editColumns:r.editColumns??[],tableConfig:r.tableConfig??{}},null):null}},PercentInput:{renderItemContent({props:r={},attrs:e={},defaultValue:t},{data:i,field:s}){const o=r.parse?100:1;if(q(s)){fe(t)&&at(i[s])&&(i[s]=t);const n=l.computed({get:()=>(i[s]??0)*o,set:a=>{i[s]=(a??0)/o}});return l.createVNode("div",{class:"flex items-center"},[r.info?l.createVNode("span",{class:"pr-4"},[r.info]):null,l.createVNode(l.resolveComponent("a-input-number"),l.mergeProps({class:"w-60px!"},e,{value:n.value,"onUpdate:value":a=>n.value=a},T.merge({},xi.PercentInput,T.omit(r,["info"]))),null)])}else return null},renderDefault({props:r={},attrs:e={}},{row:t,field:i}){const s=r.parse?100:1;if(q(i)){const o=l.computed({get:()=>(t[i]??0)*s,set:n=>{T.set(t,i,(n??0)/s)}});return[r.info?l.createVNode("span",{class:"pr-4"},[r.info]):null,l.createVNode(l.resolveComponent("a-input-number"),l.mergeProps({class:"w-60px!"},e,{value:o.value,"onUpdate:value":n=>o.value=n},T.merge({},xi.PercentInput,T.omit(r,["info"]))),null)]}else return null}},TreeSelect:{renderItemContent({props:r={}},{data:e,field:t}){return q(t)?l.createVNode(A.TreeSelect,l.mergeProps({value:e[t],"onUpdate:value":i=>e[t]=i},r),null):null},renderDefault({props:r={}},{row:e,field:t}){return q(t)?l.createVNode(A.TreeSelect,l.mergeProps({value:e[t],"onUpdate:value":i=>e[t]=i},r),null):null}}},Nr=(r,{renderItemContent:e,renderDefault:t,renderEdit:i})=>{gr.hasOwnProperty(r)&&console.warn(`render ${r} already exists, you are trying to override it`),gr[r]={renderItemContent:e,renderDefault:t,renderEdit:i}},Vt={renders:gr,addRender:Nr},hC=l.defineComponent((r,{emit:e})=>{const{itemRender:t,defaultHandler:i}=r,{renderFormParams:s}=l.toRefs(r),o=a=>{e("trigger",a)},n=(a,c)=>{e("delayTrigger",a,c)};return()=>{var a,c;return((c=(a=Vt.renders[t.name])==null?void 0:a.renderItemContent)==null?void 0:c.call(a,{...t,handleTrigger:o,handleDelayTrigger:n},s.value,i))??null}},{name:"RenderAntItem",props:{itemRender:{type:Object,required:!0},renderFormParams:{type:Object,required:!0},defaultHandler:{type:Object,required:!1}},emits:["trigger","delayTrigger"]}),dC=l.defineComponent(r=>{const{formData:e}=l.toRefs(r);return()=>{var t,i;return((i=(t=r.item.slots)==null?void 0:t.default)==null?void 0:i.call(t,{data:e.value,field:r.item.field},r.passTrigger,r.passDelayTrigger))??null}},{name:"RenderItemSlots",props:["formData","item","passTrigger","passDelayTrigger"]}),uC={key:2},fC=["innerHTML"],Br=l.defineComponent({__name:"PFormCol",props:{item:{},formData:{}},emits:["trigger","reset"],setup(r,{emit:e}){const t=r,i=e,s=l.ref(!1),o=l.ref(He()),n=(u,g)=>{const v=g??222;s.value=!0,setTimeout(()=>{s.value=!1,i("trigger",u)},v)},a=u=>{i("trigger",u)},c=()=>{i("reset")},d=()=>{o.value=He()},f=T.debounce(d,100);return Ar(()=>t.item,(u,g)=>{T.isEqual(u,g)||f()},{deep:!0}),(u,g)=>{const v=l.resolveComponent("a-tooltip"),x=l.resolveComponent("a-form-item"),m=l.resolveComponent("a-col");return l.openBlock(),l.createBlock(m,l.mergeProps({key:`_col_${o.value}`},u.item.col??(u.item.span?{span:u.item.span}:l.unref($r))),{default:l.withCtx(()=>{var p;return[(l.openBlock(),l.createBlock(x,l.mergeProps({key:`_item_${o.value}`,class:[`p-content-align-${u.item.align??"left"} ${u.item.forceRequired?"p-required":""}`,{"p-error-hang-out":s.value}],colon:"",label:u.item.title,name:u.item.field,"wrapper-col":u.item.wrapperCol??(u.item.title?void 0:{span:24})},l.unref(T.omit)(u.item,["field","title","span","col","wrapperCol","itemRender","forceRequired","tooltip"])),l.createSlots({default:l.withCtx(()=>{var E,C;return[(E=u.item.slots)!=null&&E.default?(l.openBlock(),l.createBlock(l.unref(dC),{key:`_sl_${u.item.field??"_"}_${o.value}`,"form-data":u.formData,item:u.item,"pass-delay-trigger":n,"pass-trigger":a},null,8,["form-data","item"])):(C=u.item.itemRender)!=null&&C.name?(l.openBlock(),l.createBlock(l.unref(hC),{key:`_re_${u.item.field??"_"}_${o.value}`,"default-handler":{reset:c},"item-render":u.item.itemRender,"render-form-params":{data:u.formData,field:u.item.field},onDelayTrigger:n,onTrigger:a},null,8,["default-handler","item-render","render-form-params"])):(l.openBlock(),l.createElementBlock("span",uC))]}),_:2},[(p=u.item.slots)!=null&&p.title?{name:"label",fn:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(u.item.slots.title)))]),key:"0"}:void 0,u.item.tooltipConfig?{name:"tooltip",fn:l.withCtx(()=>[l.unref(T.isFunction)(u.item.tooltipConfig.title)?(l.openBlock(),l.createBlock(v,l.normalizeProps(l.mergeProps({key:0},l.unref(T.omit)(u.item.tooltipConfig,["title"]))),{title:l.withCtx(()=>[l.createElementVNode("div",{innerHTML:u.item.tooltipConfig.title()},null,8,fC)]),default:l.withCtx(()=>[l.createVNode(l.unref(_t.InfoCircleOutlined),{class:"cursor-pointer py-4 px-2"})]),_:1},16)):(l.openBlock(),l.createBlock(v,l.normalizeProps(l.mergeProps({key:1},u.item.tooltipConfig)),{default:l.withCtx(()=>[l.createVNode(l.unref(_t.InfoCircleOutlined),{class:"cursor-pointer py-4 px-2"})]),_:1},16))]),key:"1"}:void 0]),1040,["class","label","name","wrapper-col"]))]}),_:1},16)}}}),gC={key:0,class:"p-pane p-wrapper"},Hr=l.defineComponent({__name:"PForm",props:{name:{},items:{},customReset:{},layout:{},labelCol:{default:()=>Oo().labelCol??{span:6}},wrapperCol:{default:()=>Oo().wrapperCol??{span:16}},colon:{type:Boolean},labelAlign:{},labelWrap:{type:Boolean},prefixCls:{},requiredMark:{},hideRequiredMark:{type:Boolean},model:{},rules:{},validateMessages:{},validateOnRuleChange:{type:Boolean},scrollToFirstError:{},onSubmit:{},validateTrigger:{},size:{},disabled:{type:Boolean},onValuesChange:{},onFieldsChange:{},onFinish:{},onFinishFailed:{},onValidate:{},data:{}},emits:["apply","reset"],setup(r,{expose:e,emit:t}){const i=r,s=t,{items:o,data:n}=l.toRefs(i);function a(){s("apply",n.value)}const c=l.ref(),d=l.ref(He()),f=()=>{d.value=He()},u=()=>{if(i.customReset)i.customReset();else{const m={};Yt(o.value,p=>{p.field&&p.itemRender?fe(p.itemRender.defaultValue)?m[p.field]=p.itemRender.defaultValue:m[p.field]=void 0:p.field&&p.slots&&(fe(p.slots.defaultValue)?m[p.field]=p.slots.defaultValue:m[p.field]=void 0)}),Object.assign(n.value,m)}s("reset")},g=l.computed(()=>({...T.omit(i,["items","data","model","labelCol","wrapperCol"]),labelCol:i.labelCol,wrapperCol:i.wrapperCol})),v=m=>{var p;m&&((p=c.value)==null||p.validateFields(m))},x=m=>{v(m)};return e({reset:f,$form:l.computed(()=>c.value)}),(m,p)=>l.unref(o).some(E=>{var C;return E.field&&E.itemRender||((C=E.slots)==null?void 0:C.default)})?(l.openBlock(),l.createElementBlock("div",gC,[(l.openBlock(),l.createBlock(l.unref(A.Form),l.mergeProps({name:m.name,key:d.value,ref_key:"formEl",ref:c,model:l.unref(n)},g.value,{onSubmit:a}),{default:l.withCtx(()=>[l.createVNode(l.unref(A.Row),{gutter:[6,12]},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(o),(E,C)=>(l.openBlock(),l.createBlock(Br,{key:`_col_${E.field||C}`,"form-data":l.unref(n),item:E,onReset:u,onTrigger:x},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["name","model"]))])):l.createCommentVNode("",!0)}}),mC=l.defineComponent(r=>{const{column:e}=r;return()=>{var t,i;return((i=(t=e.slots)==null?void 0:t.title)==null?void 0:i.call(t,{column:e}))??e.title}},{name:"RenderAntTitle",props:["column"]}),Ua=({title:r,content:e})=>new Promise((t,i)=>{A.Modal.confirm({title:r,content:e,onOk:()=>{t()},onCancel:()=>{i()}})}),vC=A.message.success,xC=A.message.error;A.message.info;const _i=A.message.warning,pC={key:0},yC={key:1,class:"p-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"},wC={class:"flex items-center flex-1 gap-4px"},EC={key:2},CC={class:"flex items-center gap-4px"},bC={key:0,class:"w-full text-slate-5 pl-4"},Fr=l.defineComponent({__name:"PGrid",props:{selectConfig:{},rowKey:{default:"id"},striped:{type:Boolean,default:()=>Et().striped??!1},manualFetch:{type:Boolean},align:{default:()=>Et().align??"left"},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},tableConfig:{},scrollMode:{default:"inner"},lazyReset:{type:Boolean,default:()=>Et().lazyReset??!1},fitHeight:{default:()=>Et().fitHeight??170},fitCanvasHeight:{},renderY:{}},emits:["toolbarButtonClick","toolbarToolClick","pick","resetQuery"],setup(r,{expose:e,emit:t}){var ze,Nt,F,pe,Re;const i=r,{formConfig:s,pageConfig:o,columns:n,toolbarConfig:a,proxyConfig:c,tableConfig:d,selectConfig:f,scrollMode:u}=l.toRefs(i),g=l.reactive({table:!1,toolbar:!1,form:!1}),v=k=>{T.isObject(k)?Object.keys(k).forEach(N=>{g[N]=k[N]}):T.isBoolean(k)&&(g.form=k,g.table=k,g.toolbar=k)},x=l.ref(),m=l.ref(),p=l.ref(),E=l.ref(500),C=l.ref([]),w=l.ref([]),_=k=>{const{ajax:N}=c.value;switch(k){case"multiDelete":N.multiDelete&&(C.value.length>0?Ua({title:"警告",content:"确认删除选中的数据吗?"}).then(()=>{g.table=!0,g.toolbar=!0,N.multiDelete(C.value).then(()=>{A.message.success("删除成功"),vt()}).catch(()=>{A.message.error("删除失败")}).finally(()=>{g.table=!1,g.toolbar=!1,b.multiDelete=!1})}):A.message.warn("请选择要删除的数据"));break}},S=l.computed(()=>{const k=[];return Yt(n.value??[],N=>{N.slots&&N.slots.title&&(N.field||(N.field="__holder__"+k.length),k.push(N))}),k}),B=l.ref(),K=l.ref(),R=l.ref(He()),I=l.ref(He()),b=l.reactive([...(((Nt=(ze=i.toolbarConfig)==null?void 0:ze.buttons)==null?void 0:Nt.map(k=>k.code))??[]).filter(k=>k),...(((pe=(F=i.toolbarConfig)==null?void 0:F.tools)==null?void 0:pe.map(k=>k.code))??[]).filter(k=>k)].reduce((k,N)=>(k[N]=!1,k),{})),O=(k,N)=>{b[k]=N},y=()=>{I.value=He()},M=T.debounce(y,100),D=l.computed(()=>{const k=[];return Yt(n.value??[],N=>{(N.slots&&N.slots.default||N.formatter||N.cellRender)&&(N.field||(N.field="__holder__"+k.length),k.push(N))}),k}),P=l.reactive({page:1,size:((Re=o.value)==null?void 0:Re.pageSize)??10}),Y=l.ref(0),V=l.ref(0),W=l.ref([]),z=l.computed(()=>c.value&&c.value.ajax?o.value?"pagination":"list":"bad"),Q=l.useAttrs(),te=t,Ve=l.computed(()=>w.value.filter(k=>C.value.includes(k[i.rowKey??"id"]))),be=k=>{te("toolbarButtonClick",{data:W.value,code:k,selectedKeys:C.value,records:Ve.value}),_(k)},Me=T.debounce(be,100),j=({key:k})=>Me(k),Xi=k=>{te("toolbarToolClick",{data:W.value,code:k,selectedKeys:C.value,records:Ve.value}),_(k)},zi=T.debounce(Xi,100),ve=l.ref({}),Gi=({row:k,field:N})=>{te("pick",{row:k,field:N})},it=k=>{if(s.value&&s.value.items.length>0){if(s.value.customReset)s.value.customReset();else{const N={};Yt(s.value.items,U=>{U.field&&U.itemRender?fe(U.itemRender.defaultValue)?N[U.field]=U.itemRender.defaultValue:N[U.field]=void 0:U.field&&U.slots&&(fe(U.slots.defaultValue)?N[U.field]=U.slots.defaultValue:N[U.field]=void 0)}),ve.value=N}te("resetQuery")}P.page=1,k||xt()},mt=(k,N)=>N?{list:T.isString(N.list)?T.get(k,N.list):T.isFunction(N.list)?N.list(k):void 0,total:T.isString(N.total)?T.get(k,N.total):T.isFunction(N.total)?N.total(k):void 0,result:T.isString(N.result)?T.get(k,N.result):T.isFunction(N.result)?N.result(k):void 0,message:T.isString(N.message)?T.get(k,N.message):T.isFunction(N.message)?N.message(k):void 0}:{list:k},si=l.ref(!0),Ui=()=>(w.value=[],C.value=[],it()),vt=()=>(P.page=1,w.value=[],C.value=[],rt()),qi=(k,N,U)=>(P.page=k.current,P.size=k.pageSize,rt()),rt=()=>new Promise(k=>{if(z.value!=="bad"){g.form=!0,g.table=!0;const{ajax:N}=c.value;N.query({form:ve.value,page:P}).then(U=>{const{list:Ge,total:Bt,result:ie,message:ot}=mt(U,c.value.response);Ge?(W.value=Ge,Y.value++):ie?(W.value=ie,V.value=Bt??ie.length,Y.value++):(W.value=[],Y.value++,ot&&A.message.warn(ot)),k(W.value)}).catch(U=>{console.error("fetchData error",U),k([])}).finally(()=>{g.form=!1,g.table=!1})}}),xt=T.debounce(rt,160),We=(k,N)=>(Object.assign(ve.value,k),P.page=1,N?Promise.resolve():xt()),Ae=(k,N)=>(ve.value=k,P.page=1,N?Promise.resolve():xt()),xe=l.computed(()=>z.value==="pagination"?{current:P.page,total:V.value,pageSize:P.size,responsive:!1,showSizeChanger:!0,showTotal:k=>`共${k}条数据`}:!1),Mt={size:"small",sticky:!0,transformCellText:({text:k})=>T.isArray(k)&&k.length===0?"-":k},st=l.computed(()=>T.merge({},Mt,(d==null?void 0:d.value)??{},f.value?{rowSelection:{type:f.value.multiple?"checkbox":"radio",preserveSelectedRowKeys:!0,selectedRowKeys:C.value,onChange:k=>{C.value=k;const N=i.rowKey??"id",U=w.value.map(ie=>ie[N]),Bt=k.filter(ie=>!U.includes(ie)).map(ie=>W.value.find(ot=>ot[N]===ie)).filter(ie=>!!ie);w.value=[...w.value,...Bt]},getCheckboxProps:f.value.getCheckboxProps}}:{})),oi=l.computed(()=>T.omit({labelCol:Mr,...s.value},["items"])),ni=()=>{vt()};l.watch(()=>[n.value,c.value,a.value],()=>{M()},{deep:!0});let Ne=null;const _e=()=>{Ne&&cancelAnimationFrame(Ne),Ne=requestAnimationFrame(()=>{if(Ne=null,!p.value)return;const k=p.value.getBoundingClientRect();E.value=i.renderY??Math.max(window.innerHeight-k.top-i.fitHeight,100),si.value=window.innerHeight>600})};let de=null;l.watch(m,k=>{de==null||de.disconnect(),de=null,k&&(de=new ResizeObserver(()=>_e()),de.observe(k))},{immediate:!0}),e({commitProxy:{query:xt,reload:Ui,reloadPage:vt,passQuery:We,forcePassQuery:Ae},$table:l.computed(()=>K.value),selectedRowKeys:l.computed(()=>C.value),setBtnLoading:O,selectedRecords:Ve,$form:l.computed(()=>B.value),getFormData:()=>ve.value,setLoadings:v,resizeTable:_e});let L,H=null;l.onMounted(()=>{if(_e(),window.addEventListener("resize",_e),L=new MutationObserver(k=>{k.forEach(N=>{if(N.type==="attributes"&&N.attributeName==="style"){const U=N.target;window.getComputedStyle(U).display!=="none"&&_e()}})}),x.value){L.observe(x.value,{attributes:!0,attributeFilter:["style"]}),H=new ResizeObserver(()=>_e());let k=x.value.parentElement;for(let N=0;N<5&&k&&k!==document.body;N++)H.observe(k),k=k.parentElement}it(i.manualFetch)});const X=k=>T.isFunction(k)?k():k,Be=k=>T.isString(k),At=["align"],Xe=k=>k.map(N=>({...At.reduce((U,Ge)=>({[Ge]:i[Ge]}),{}),...N}));return l.onBeforeUnmount(()=>{Ne&&cancelAnimationFrame(Ne),window.removeEventListener("resize",_e),L.disconnect(),de==null||de.disconnect(),H==null||H.disconnect()}),(k,N)=>{var ie,ot,Qr;const U=l.resolveComponent("a-menu-item"),Ge=l.resolveComponent("a-menu"),Bt=l.resolveComponent("a-dropdown");return l.openBlock(),l.createElementBlock("div",l.mergeProps({ref_key:"boxEl",ref:x,class:"h-full p-wrapper flex flex-col gap-8px overflow-y-auto"},l.unref(Q)),[z.value==="bad"?(l.openBlock(),l.createElementBlock("div",pC,"请检查配置")):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[(ot=(ie=l.unref(s))==null?void 0:ie.items)!=null&&ot.some($=>$.field&&$.itemRender)?(l.openBlock(),l.createElementBlock("div",{key:0,class:"p-pane p-form-wrapper",ref_key:"pFormWrapper",ref:m},[l.createVNode(l.unref(A.Spin),{spinning:g.form},{default:l.withCtx(()=>{var $;return[(l.openBlock(),l.createBlock(l.unref(A.Form),l.mergeProps({name:($=l.unref(s))==null?void 0:$.name,key:R.value,ref_key:"formEl",ref:B,model:ve.value},oi.value,{onSubmit:ni}),{default:l.withCtx(()=>[l.createVNode(l.unref(A.Row),{gutter:[6,12]},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(s).items,(re,ue)=>(l.openBlock(),l.createBlock(Br,{key:`_col_${re.field||ue}`,"form-data":ve.value,item:re,onReset:N[0]||(N[0]=ai=>it(i.lazyReset))},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["name","model"]))]}),_:1},8,["spinning"])],512)):l.createCommentVNode("",!0),l.unref(a)?(l.openBlock(),l.createElementBlock("div",yC,[l.createElementVNode("div",wC,[l.unref(a).buttons&&l.unref(a).buttons.length>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(a).buttons,($,re)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:re},[$.dropdowns&&$.dropdowns.length?(l.openBlock(),l.createBlock(Bt,{key:0},{overlay:l.withCtx(()=>[l.createVNode(Ge,{onClick:j},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList($.dropdowns,ue=>(l.openBlock(),l.createBlock(U,{key:ue.code},{default:l.withCtx(()=>[ue.content&&Be(X(ue.content))?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[l.createTextVNode(l.toDisplayString(X(ue.content)),1)],64)):ue.content?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(X(ue.content)),{key:1})):l.createCommentVNode("",!0)]),_:2},1024))),128))]),_:2},1024)]),default:l.withCtx(()=>[l.createVNode(l.unref(A.Button),{type:$.type,size:$.size??"middle",disabled:l.unref(a).disabled||$.disabled,loading:g.toolbar||!!$.code&&b[$.code],danger:$.danger,shape:$.shape,ghost:$.ghost,block:$.block},{default:l.withCtx(()=>[$.icon?(l.openBlock(),l.createBlock(l.unref(le),{key:0,icon:$.icon},null,8,["icon"])):l.createCommentVNode("",!0),$.content&&Be(X($.content))?(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[l.createTextVNode(l.toDisplayString(X($.content)),1)],64)):$.content?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(X($.content)),{key:2})):l.createCommentVNode("",!0),l.createVNode(l.unref(_t.DownOutlined))]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block"])]),_:2},1024)):$.code?(l.openBlock(),l.createBlock(l.unref(A.Button),{key:1,type:$.type,size:$.size??"middle",disabled:l.unref(a).disabled||$.disabled,loading:g.toolbar||!!$.code&&b[$.code],danger:$.danger,shape:$.shape,ghost:$.ghost,block:$.block,onClick:ue=>l.unref(Me)($.code)},{default:l.withCtx(()=>[$.icon?(l.openBlock(),l.createBlock(l.unref(le),{key:0,icon:$.icon},null,8,["icon"])):l.createCommentVNode("",!0),$.content&&Be(X($.content))?(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[l.createTextVNode(l.toDisplayString(X($.content)),1)],64)):$.content?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(X($.content)),{key:2})):l.createCommentVNode("",!0)]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block","onClick"])):(l.openBlock(),l.createElementBlock("div",EC))],64))),128)):l.createCommentVNode("",!0)]),l.createElementVNode("span",CC,[l.unref(a).tools&&l.unref(a).tools.length>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(a).tools,($,re)=>(l.openBlock(),l.createBlock(l.unref(A.Button),{key:re,type:$.type,size:$.size??"middle",disabled:l.unref(a).disabled||$.disabled,danger:$.danger,shape:$.shape,ghost:$.ghost,block:$.block,onClick:ue=>l.unref(zi)($.code),loading:g.toolbar||!!$.code&&b[$.code]},{default:l.withCtx(()=>[$.icon?(l.openBlock(),l.createBlock(l.unref(le),{key:0,icon:$.icon},null,8,["icon"])):l.createCommentVNode("",!0),$.content&&Be(X($.content))?(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[l.createTextVNode(l.toDisplayString(X($.content)),1)],64)):$.content?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(X($.content)),{key:2})):l.createCommentVNode("",!0)]),_:2},1032,["type","size","disabled","danger","shape","ghost","block","onClick","loading"]))),128)):l.createCommentVNode("",!0)])])):l.createCommentVNode("",!0),l.createElementVNode("div",{ref_key:"tableWrapperEl",ref:p,class:l.normalizeClass(`p-pane flex-1 ${si.value?"h-0":""} p-${l.unref(u)??"inner"}-scroll`)},[(Qr=l.unref(f))!=null&&Qr.multiple&&l.unref(f).showCount?(l.openBlock(),l.createElementBlock("div",bC," 已选:"+l.toDisplayString(C.value.length),1)):l.createCommentVNode("",!0),(l.openBlock(),l.createBlock(l.unref(A.Table),l.mergeProps({key:I.value+"_table","row-key":k.rowKey??"id",ref_key:"tableEl",ref:K,"row-class-name":k.striped?($,re)=>re%2===1?"p-grid-row-striped":"":"",columns:Xe(l.unref(n)??[]).map($=>l.unref(Pi)($)),"data-source":W.value,loading:g.table,pagination:xe.value},st.value,{scroll:{x:"max-content",y:E.value},onChange:qi}),l.createSlots({_:2},[S.value.length>0?{name:"headerCell",fn:l.withCtx(({column:$})=>[S.value.some(re=>$.key&&re.field===$.key)?(l.openBlock(),l.createBlock(l.unref(mC),{key:I.value+"_title_"+Y.value+"_slot_"+$.key,column:S.value.find(re=>$.key&&re.field===$.key)},null,8,["column"])):l.createCommentVNode("",!0)]),key:"0"}:void 0,D.value.length>0?{name:"bodyCell",fn:l.withCtx(({column:$,record:re,index:ue})=>[D.value.some(ai=>$.key&&ai.field===$.key)?(l.openBlock(),l.createBlock(l.unref(Xa),{key:I.value+"_cell_"+Y.value+"_slot_"+$.key,column:D.value.find(ai=>$.key&&ai.field===$.key),"default-handler":{pick:Gi,setLoadings:v},row:re,"row-index":ue,"table-data":W.value},null,8,["column","default-handler","row","row-index","table-data"])):l.createCommentVNode("",!0)]),key:"1"}:void 0]),1040,["row-key","row-class-name","columns","data-source","loading","pagination","scroll"]))],2)],64))],16)}}});(function(){try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode(":root{--evt-header-font: 12px normal Arial;--evt-body-font: 12px normal Arial;--evt-color-white: #fff;--evt-color-black: #000000;--evt-color-primary: rgb(82, 146, 247);--evt-text-color-primary: #333;--evt-text-color-regular: #666;--evt-text-color-secondary: #999;--evt-box-shadow: 0 2px 12px 0 #0000001a;--evt-editor-bg-color: #fff;--evt-editor-text-color: #333;--evt-border-color: #e1e6eb;--evt-body-bg-color: #fff;--evt-stripe-color: #fafafa;--evt-placeholder-color: #cdd0dc;--evt-header-bg-color: #f8faff;--evt-header-text-color: #1d2129;--evt-body-text-color: #4e5969;--evt-footer-text-color: #4e5969;--evt-loading-icon-color: #4e5969;--evt-expand-icon-color: #4e5969;--evt-shrink-icon-color: #4e5969;--evt-error-tip-icon-color: red;--evt-required-color: #f56c6c;--evt-cell-hover-icon-bg-color: #fff;--evt-cell-hover-icon-border-color: #dde0ea;--evt-scroller-color: #dee0e3;--evt-scroller-track-color: #fff;--evt-scroller-focus-color: #bbbec4;--evt-select-border-color: var(--evt-color-primary);--evt-select-area-color: rgba(82, 146, 247, .1);--evt-select-row-col-bg-color: rgba(82, 146, 247, .1);--evt-autofill-point-border-color: #fff;--evt-edit-bg-color: #fcf6ed;--evt-checkbox-color: var(--evt-color-primary);--evt-checkbox-uncheck-color: #dde0ea;--evt-checkbox-disabled-color: #f1f2f4;--evt-checkbox-check-disabled-color: #dde0ea;--evt-icon-edit-color: #4e5969;--evt-icon-select-color: #4e5969;--evt-readonly-color: #fff;--evt-readonly-text-color: var(--evt-body-text-color);--evt-error-tip-color: #ed3f14;--evt-footer-bg-color: #fafafa;--evt-highlight-hover-row-color: rgba(186, 203, 231, .1);--evt-highlight-selected-row-color: rgba(82, 146, 247, .1);--evt-tooltip-bg-color: #303133;--evt-tooltip-text-color: #fff;--evt-resize-row-line-color: #e1e6eb;--evt-resize-column-text-color: #fff;--evt-resize-column-text-bg-color: var(--evt-color-primary);--evt-resize-column-line-color: #e1e6eb;--evt-tree-line-color: #e1e6eb;--evt-sort-icon-color: var(--evt-color-primary);--evt-drag-tip-bg-color: rgba(82, 146, 247, .1);--evt-drag-tip-line-color: var(--evt-color-primary);--evt-context-menu-min-width: 150px;--evt-context-menu-max-width: 220px;--evt-context-menu-item-padding: 8px 12px;--evt-context-menu-bg-color: #fff;--evt-context-menu-text-color: #333;--evt-context-menu-item-hover-text-color: var(--evt-color-primary);--evt-context-menu-item-hover-bg-color: #f5f5f5;--evt-context-menu-text-size: 13px}.dark{--evt-border-color: #363637;--evt-header-bg-color: #141414;--evt-body-bg-color: #141414;--evt-header-text-color: #a3a6ad;--evt-body-text-color: #cfd3dc;--evt-readonly-text-color: #cfd3dc;--evt-footer-text-color: #cfd3dc;--evt-scroller-color: #414243;--evt-scroller-track-color: #141414;--evt-scroller-focus-color: #a3a6ad;--evt-edit-bg-color: #141414;--evt-footer-bg-color: #262727;--evt-autofill-point-border-color: #fff;--evt-editor-bg-color: #434343;--evt-editor-text-color: #cfd3dc;--evt-context-menu-bg-color: #141414;--evt-context-menu-text-color: #cfd3dc;--evt-context-menu-item-hover-text-color: var(--evt-color-primary);--evt-context-menu-item-hover-bg-color: #414243}.e-virt-table-container{position:relative;outline:none}.e-virt-table-stage{position:relative;overflow:hidden;outline:none;box-sizing:border-box;z-index:10;border-radius:8px;border:1px solid var(--evt-border-color)}.e-virt-table-canvas{position:absolute;left:0;top:0;box-sizing:border-box;background-color:var(--evt-body-bg-color);border:none;outline:none;z-index:10}.e-virt-table-editor{position:absolute;top:-10000px;left:-10000px;text-align:left;height:auto;line-height:0;z-index:100;overflow:hidden;background-color:var(--evt-editor-bg-color);border:2px solid var(--evt-color-primary);box-sizing:border-box;box-shadow:var(--evt-box-shadow);display:flex;align-items:center}.e-virt-table-overlayer{position:absolute;left:0;top:0;overflow:hidden;z-index:100;pointer-events:none}.e-virt-table-editor-textarea{width:100%;box-sizing:border-box;outline:none;font-weight:400;padding:8px;font-size:12px;color:inherit;white-space:pre-wrap;word-wrap:break-word;word-break:break-all;line-height:1.5;margin:0;border:none;vertical-align:middle;background:var(--evt-editor-bg-color);color:var(--evt-editor-text-color);overflow-y:auto;resize:none}.e-virt-table-context-menu{position:absolute;font-size:14px;color:var(--evt-text-color-regular);background-color:var(--evt-color-white);border-radius:4px;border:1px solid #e4e7ed;box-shadow:var(--evt-box-shadow);width:fit-content;padding:6px 0;z-index:9999;left:-99999px;top:-99999px}.e-virt-table-context-menu-item{cursor:pointer;padding:6px 24px;color:var(--evt-text-color-regular)}.e-virt-table-context-menu-item:hover{color:var(--evt-color-primary);background-color:#f5f7fa}.e-virt-table-loading{display:none;position:absolute;left:0;top:0;right:0;bottom:0;width:100%;height:100%;z-index:2000;background-color:#fff6;display:flex;align-items:center;justify-content:center}.e-virt-table-loading-spinner{opacity:1;display:flex;flex-direction:column;align-items:center;justify-content:center}.e-virt-table-loading-spinner svg{color:var(--evt-text-color-regular);animation:rotate 1s linear infinite}@keyframes rotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.e-virt-table-loading-text{margin:0;font-size:12px;color:var(--evt-text-color-regular)}.e-virt-table-main-menu,.e-virt-table-submenu{position:absolute;background:var(--evt-context-menu-bg-color);border-radius:4px;box-shadow:0 2px 8px #0000001a;min-width:var(--evt-context-menu-min-width);max-width:var(--evt-context-menu-max-width);color:var(--evt-text-color-primary)}.e-virt-table-main-menu{border:1px solid var(--evt-border-color);z-index:3000;left:-99999px;top:-99999px;display:none;position:fixed;background-color:var(--evt-body-bg-color)}.e-virt-table-submenu{border:1px solid var(--evt-border-color);z-index:1000;max-height:350px;overflow-y:auto;opacity:0;visibility:hidden;transform:translate(-10px);transition:opacity .2s,visibility .2s,transform .2s;-ms-overflow-style:none;scrollbar-width:none}.e-virt-table-submenu::-webkit-scrollbar{display:none}.e-virt-table-submenu.show{opacity:1;visibility:visible;transform:translate(0)}.e-virt-table-submenu:not(.show){transition:none}.e-virt-table-menu-item,.e-virt-table-submenu-item{position:relative;-webkit-user-select:none;user-select:none;padding:var(--evt-context-menu-item-padding);cursor:pointer;display:flex;justify-content:space-between;align-items:center;transition:background .2s,color .2s;color:var(--evt-context-menu-text-color);font-size:var(--evt-context-menu-text-size)}.e-virt-table-menu-item:last-child,.e-virt-table-submenu-item:last-child{border-bottom:none}.e-virt-table-menu-item:has(.e-virt-table-menu-item-icon){padding-left:8px}.e-virt-table-menu-item-content{display:flex;align-items:center;flex:1;min-width:0}.e-virt-table-menu-item-icon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;margin-right:8px;flex-shrink:0}.e-virt-table-menu-item-icon svg{width:100%;height:100%;fill:currentColor}.e-virt-table-menu-item-text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.e-virt-table-menu-arrow{display:inline-flex;align-items:center;justify-content:center;color:var(--evt-text-color-regular);transition:color .2s}.e-virt-table-menu-arrow svg{width:20px;height:20px;fill:currentColor}.e-virt-table-submenu-item:hover,.e-virt-table-menu-item:hover,.e-virt-table-menu-item.active{background:var(--evt-context-menu-item-hover-bg-color);color:var(--evt-context-menu-item-hover-text-color)}.e-virt-table-menu-item.disabled,.e-virt-table-submenu-item.disabled{cursor:not-allowed}.e-virt-table-finder-bar{position:absolute;top:8px;right:16px;display:none;z-index:10000;background:#fff;border:1px solid #dadce0;border-radius:12px;box-shadow:0 2px 6px #0003;padding:0 8px;height:48px;min-width:250px;align-items:center;font-size:12px}.e-virt-table-finder-bar.show{display:flex}.e-virt-table-finder-bar-input-wrapper{display:flex;align-items:center;flex:1;padding:0 8px;position:relative}.e-virt-table-finder-bar-input{border:none;outline:none;flex:1;font-size:12px;background:transparent;color:#333;min-width:150px;padding-left:0;position:relative}.e-virt-table-finder-bar-nav{display:flex;flex-direction:row;gap:8px;margin:0 8px;align-items:center}.e-virt-table-finder-bar-nav-btn{border:none;background:transparent;cursor:pointer;padding:0;color:#666;border-radius:50%;display:flex;align-items:center;justify-content:center}.e-virt-table-finder-bar-nav-btn svg{width:24px;height:24px}.e-virt-table-finder-bar-nav-btn.prev-btn{transform:rotate(-90deg)}.e-virt-table-finder-bar-nav-btn.next-btn{transform:rotate(90deg)}.e-virt-table-finder-bar-nav-btn.close-btn{font-size:24px;color:#666;line-height:1;width:24px;height:24px}.e-virt-table-finder-bar-nav-btn:hover{color:#666;background-color:#f0f0f0}.e-virt-table-finder-bar-count{color:#666;font-size:12px;margin:0 8px;white-space:nowrap;flex-shrink:0}.e-virt-table-finder-bar-count.no-results{color:#999}.e-virt-table-finder-bar-loading{display:none;position:absolute;left:8px;top:0;width:16px;height:16px;flex-shrink:0;pointer-events:none;z-index:0}.e-virt-table-finder-bar-loading.show{display:block}.e-virt-table-finder-bar-loading svg{width:100%;height:100%;color:#666;animation:rotate 1s linear infinite}.e-virt-table-empty{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);font-size:14px;color:#666;z-index:15}")),document.head.appendChild(r)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var _C=Object.defineProperty,RC=(r,e,t)=>e in r?_C(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,h=(r,e,t)=>RC(r,typeof e!="symbol"?e+"":e,t);class IC{constructor(e){h(this,"rules"),this.rules=e}validate(e){const t=[],{column:i,row:s,key:o,rowKey:n,colIndex:a,rowIndex:c,value:d,field:f,fieldValue:u}=e;Array.isArray(this.rules)||(this.rules=[this.rules]);for(const g of this.rules){if(g.validator){const v={field:f,fieldValue:u,value:d,column:i,colIndex:a,rowIndex:c,row:s,key:o,rowKey:n,...g};g.validator(v,d,x=>{x&&t.push({...v,message:x})})}if(!g.required&&(d==null||d===""))return t;g.pattern&&!g.pattern.test(d)&&t.push({value:d,column:i,row:s,key:o,rowKey:n,colIndex:a,rowIndex:c,field:f,fieldValue:u,message:g.message||`${o} is pattern validation error`}),g.required&&(d==null||d==="")&&t.push({value:d,column:i,row:s,key:o,rowKey:n,colIndex:a,rowIndex:c,field:f,fieldValue:u,message:g.message||`${o} is required`})}return t}}function qa(){return"xxxxxxxxxxxxxxxxxx".replace(/[x]/g,function(r){const e=Math.random()*16|0;return(r==="x"?e:e&3|8).toString(16)})}function Kr(r,e){let t=0,i;return function(...s){const o=new Date().getTime(),n=o-t,a=typeof e=="function"?e():e;!t||n>=a?(r.apply(this,s),t=o):i||(i=setTimeout(()=>{r.apply(this,s),t=new Date().getTime(),i=void 0},a-n))}}function yi(r=[]){return r.length?r.map(e=>yi(e.children)+1).sort((e,t)=>t-e)[0]:0}function SC(r=[]){let e=[],t=[],i=[];return r.forEach(s=>{s.fixed==="left"?e.push(s):s.fixed==="right"?i.push(s):t.push(s)}),[...e.sort((s,o)=>(s.sort??0)-(o.sort??0)),...t.sort((s,o)=>(s.sort??0)-(o.sort??0)),...i.sort((s,o)=>(s.sort??0)-(o.sort??0))]}function wi(r=[],e=1,t=0,i=""){return r.sort((s,o)=>(s.sort??0)-(o.sort??0)).map(s=>{if(s.children){let o=0,n=s.fixed;s.children.forEach(c=>{c.fixed=n});const a=wi(s.children,e-1,t+1,s.key);return a&&a.forEach(c=>{o+=c.colspan??0}),{...s,width:s.width,level:t,rowspan:1,colspan:o,parentKey:i,children:a.sort((c,d)=>(c.sort??0)-(d.sort??0))}}return{...s,level:t,rowspan:e,colspan:1,parentKey:i}})}function Wt(r=[]){let e=[];return r.forEach(t=>{t.children?e=e.concat(Wt(t.children)):e.push(t)}),e}function Za(r){return r.filter(e=>!e.hide).map(e=>Array.isArray(e.children)&&e.children.length>0?{...e,children:Za(e.children)}:{...e})}const Lo=/^(\r\n|\n\r|\r|\n)/,TC=/^[^\t\r\n]+/,Do=/^\t/;function OC(r){let e=[[""]];if(r.length===0)return e;let t=0,i=0,s;for(;r.length>0&&s!==r.length;)if(s=r.length,r.match(Do))r=r.replace(Do,""),t+=1,e[i][t]="";else if(r.match(Lo))r=r.replace(Lo,""),t=0,i+=1,e[i]=[""];else{let o="";if(r.startsWith('"')){let n=0,a=!0;for(;a;){const c=r.slice(0,1);c==='"'&&(n+=1),o+=c,r=r.slice(1),(r.length===0||r.match(/^[\t\r\n]/)&&n%2===0)&&(a=!1)}o=o.replace(/^"/,"").replace(/"$/,"").replace(/["]*/g,c=>new Array(Math.floor(c.length/2)).fill('"').join(""))}else{const n=r.match(TC);o=n?n[0]:"",r=r.slice(o.length)}e[i][t]=o}return Array.isArray(e)&&e.length>1&&e[e.length-1].length===1&&e[e.length-1][0]===""&&(e=e.slice(0,e.length-1)),e}function kC(r){let e,t,i,s,o="",n;for(e=0,t=r.length;e<t;e+=1){for(s=r[e].length,i=0;i<s;i+=1)i>0&&(o+=" "),n=r[e][i],typeof n=="string"?n.indexOf(`
|
|
2
2
|
`)>-1?o+=`"${n.replace(/"/g,'""')}"`:o+=n:n==null?o+="":o+=n;e!==t-1&&(o+=`
|
|
3
|
-
`)}return o}function Ga(r,e,t=[]){let i=0;const s=[];return r.forEach((o,n)=>{if(n===0)s.push(1);else{const a=t.reduce((d,f)=>`${d}${o[f]??""}`,"")||o[e],c=t.reduce((d,f)=>`${d}${r[n-1][f]??""}`,"")||r[n-1][e];a===c?(s[i]+=1,s.push(0)):(s.push(1),i=n)}}),s}function Ua(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 SC(r,e,t=[]){const{visibleRows:i,rowIndex:s,headIndex:o}=r,n=Ga(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 TC(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=Ua(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 OC(r,e=document.documentElement){const t=r.startsWith("--")?r:`--${r}`;return getComputedStyle(e).getPropertyValue(t).trim()}function Oo(r){if(!r)return new Date(0);if(typeof r=="number")return new Date(r);const e=String(r).trim(),t=new Date(e);if(!isNaN(t.getTime()))return t;const i=[/^(\d{4})-(\d{1,2})-(\d{1,2})$/,/^(\d{4})\/(\d{1,2})\/(\d{1,2})$/,/^(\d{4})\.(\d{1,2})\.(\d{1,2})$/,/^(\d{1,2})-(\d{1,2})-(\d{4})$/,/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/,/^(\d{1,2})-(\d{1,2})-(\d{4})$/,/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/,/^(\d{4})(\d{2})(\d{2})$/,/^(\d{4})-(\d{1,2})-(\d{1,2})\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/,/^(\d{4})\/(\d{1,2})\/(\d{1,2})\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/];for(const s of i){const o=e.match(s);if(o){const n=o.slice(1).map(Number);if(s.source.includes("YYYY-MM-DD")||s.source.includes("YYYY/MM/DD")||s.source.includes("YYYY.MM.DD")){const[a,c,d,f=0,u=0,g=0]=n;return new Date(a,c-1,d,f,u,g)}else if(s.source.includes("DD-MM-YYYY")||s.source.includes("DD/MM/YYYY")||s.source.includes("DD.MM.YYYY")){const[a,c,d,f=0,u=0,g=0]=n;return new Date(d,c-1,a,f,u,g)}else if(s.source.includes("MM-DD-YYYY")||s.source.includes("MM/DD/YYYY")||s.source.includes("MM.DD.YYYY")){const[a,c,d,f=0,u=0,g=0]=n;return new Date(d,a-1,c,f,u,g)}else if(s.source.includes("YYYYMMDD")){const[a,c,d]=n;return new Date(a,c-1,d)}}}return new Date(NaN)}function kC(r,e){const t=Oo(r),i=Oo(e);return isNaN(t.getTime())&&isNaN(i.getTime())?0:isNaN(t.getTime())?-1:isNaN(i.getTime())?1:t.getTime()-i.getTime()}class qa{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 Br extends qa{constructor(e,t,i,s,o,n,a,c,d,f="body",u=!0){super(e,s,o,n,a,f,c.fixed),h(this,"formatter"),h(this,"formatterFooter"),h(this,"hoverIconName",""),h(this,"operation",!1),h(this,"align"),h(this,"verticalAlign"),h(this,"fixed"),h(this,"type"),h(this,"editorType"),h(this,"editorProps"),h(this,"cellType"),h(this,"level"),h(this,"colspan",1),h(this,"rowspan",1),h(this,"mergeRow",!1),h(this,"mergeCol",!1),h(this,"relationRowKeys",[]),h(this,"relationColKeys",[]),h(this,"key"),h(this,"column"),h(this,"rowIndex"),h(this,"colIndex"),h(this,"rowKey"),h(this,"row"),h(this,"value"),h(this,"render"),h(this,"renderFooter"),h(this,"style",{}),h(this,"domDataset",{}),h(this,"rules",[]),h(this,"message",""),h(this,"text",""),h(this,"displayText",""),h(this,"visibleWidth",0),h(this,"visibleHeight",0),h(this,"isHasChanged",!1),h(this,"drawX",0),h(this,"drawY",0),h(this,"drawCellBgColor",""),h(this,"drawCellSkyBgColor",""),h(this,"drawTextColor",""),h(this,"drawTextFont",""),h(this,"drawTextX",0),h(this,"drawTextY",0),h(this,"drawTextWidth",0),h(this,"drawTextHeight",0),h(this,"drawTreeImageX",0),h(this,"drawTreeImageY",0),h(this,"drawTreeImageWidth",0),h(this,"drawTreeImageHeight",0),h(this,"drawTreeImageName",""),h(this,"drawTreeImageSource"),h(this,"drawSelectionImageX",0),h(this,"drawSelectionImageY",0),h(this,"drawSelectionImageWidth",0),h(this,"drawSelectionImageHeight",0),h(this,"drawSelectionImageName",""),h(this,"drawSelectionImageSource"),h(this,"drawHoverImageX",0),h(this,"drawHoverImageY",0),h(this,"drawHoverImageWidth",0),h(this,"drawHoverImageHeight",0),h(this,"drawHoverImageName",""),h(this,"drawHoverImageSource"),h(this,"autoRowHeight",!1),h(this,"calculatedHeight",0),h(this,"ellipsis",!1),h(this,"rowExpand",!1),h(this,"rowHasChildren",!1),h(this,"overflowTooltipShow",!0),h(this,"selectorCellValueType","value"),h(this,"overflowTooltipMaxWidth",500),h(this,"overflowTooltipPlacement","top"),h(this,"maxLineClamp","auto"),this.visibleWidth=this.width,this.visibleHeight=this.height,this.colIndex=i,this.rowIndex=t,this.key=c.key,this.type=c.type||"",this.editorType=c.editorType||"text",this.selectorCellValueType=c.selectorCellValueType||this.ctx.config.SELECTOR_CELL_VALUE_TYPE||"value",this.editorProps=c.editorProps||{},this.cellType=f,this.align=c.align||this.ctx.config.COLUMNS_ALIGN,this.verticalAlign=c.verticalAlign||this.ctx.config.COLUMNS_VERTICAL_ALIGN,this.fixed=c.fixed||"",this.level=c.level||0,this.operation=c.operation||!1,this.column=c,this.rules=c.rules||[],this.row=d,this.rowKey=this.cellType==="body"?this.ctx.database.getRowKeyForRowIndex(t):`${this.cellType}_${this.rowIndex}`,this.value=this.getValue(),this.render=c.render,this.overflowTooltipShow=c.overflowTooltipShow!==!1,this.autoRowHeight=c.autoRowHeight!==void 0?c.autoRowHeight:this.ctx.config.AUTO_ROW_HEIGHT,this.overflowTooltipMaxWidth=c.overflowTooltipMaxWidth||500,this.overflowTooltipPlacement=c.overflowTooltipPlacement||"top",this.renderFooter=c.renderFooter,this.hoverIconName=c.hoverIconName,this.formatter=c.formatter,this.formatterFooter=c.formatterFooter,this.maxLineClamp=c.maxLineClamp||"auto",u&&this.update()}setWidthHeight(e,t){this.width=e,this.height=t}getValidationMessage(){const e=this.ctx.database.getValidationError(this.rowKey,this.key);if(Array.isArray(e)&&e.length){const[t]=e;this.message=t.message||""}return this.message}update(){this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawTextX=this.drawX,this.drawTextY=this.drawY,this.isHasChanged=this.ctx.database.isHasChangedData(this.rowKey,this.key),this.updateSpan(),this.drawTextWidth=this.visibleWidth,this.drawTextHeight=this.visibleHeight,this.updateStyle(),this.updateType(),this.updateHoverIcon(),this.updateSelection(),this.updateTree(),this.updateEditor(),this.updateRender(),this.getValidationMessage(),this.updateContainer(),this.text=this.getText(),this.displayText=this.getDisplayText()}updateSpan(){if(this.cellType==="footer")return;const{SPAN_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e,{colspan:i=1,rowspan:s=1,relationRowKeys:o,relationColKeys:n,mergeRow:a=!1,mergeCol:c=!1}=t({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue(),headIndex:this.ctx.body.headIndex,headPosition:this.ctx.database.getPositionForRowIndex(this.ctx.body.headIndex),visibleRows:this.ctx.body.visibleRows,visibleLeafColumns:this.ctx.header.visibleLeafColumns,rows:this.ctx.body.data})||{};Array.isArray(o)&&o.length>0?this.relationRowKeys=o:this.relationRowKeys=[this.key],Array.isArray(n)&&n.length>0?this.relationColKeys=n:this.relationColKeys=[this.key],this.mergeCol=c,this.mergeRow=a,this.colspan=i,this.rowspan=s,this.visibleWidth=this.getWidthByColIndexColSpan(this.colIndex,this.colspan),this.visibleHeight=this.ctx.database.getHeightByRowIndexRowSpan(this.rowIndex,this.rowspan)}}updateSpanInfo(){if(this.mergeRow||this.mergeCol){const e=this.getSpanInfo();this.height=e.height,this.width=e.width,this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawY-=e.offsetTop,this.drawX-=e.offsetLeft}}updateType(){const{BODY_CELL_TYPE_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});t!==void 0&&(this.type=t)}}updateEditor(){const{BODY_CELL_EDITOR_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});if(t!==void 0){const{type:i,props:s={}}=t;this.editorType=i,this.editorProps=s}}}updateRender(){const{BODY_CELL_RENDER_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});t!==void 0&&(this.render=t)}}validate(){this.ctx.database.getValidator(this.rowKey,this.key).then(()=>{this.ctx.database.setValidationError(this.rowKey,this.key,[]),this.message=""}).catch(e=>{if(Array.isArray(e)&&e.length){const[t]=e;this.message=t.message,this.ctx.database.setValidationError(this.rowKey,this.key,e)}}).finally(()=>{this.ctx.emit("draw")})}updateStyle(){this.autoRowHeight&&(this.domDataset={"data-auto-height":!0,"data-row-index":this.rowIndex,"data-col-index":this.colIndex}),this.style=this.getOverlayerViewsStyle()}updateTree(){const{CELL_PADDING:e=0}=this.ctx.config,{rowKey:t,cellType:i}=this;let s,o=0,n="";if(!(["tree","selection-tree","tree-selection"].includes(this.type)&&i==="body"))return;const a=this.ctx.database.getRowForRowKey(t),{expand:c=!1,hasChildren:d=!1,expandLoading:f=!1,level:u=0}=a||{};this.rowExpand=c,this.rowHasChildren=d;const{TREE_INDENT:g=16,CHECKBOX_SIZE:m,TREE_ICON_SIZE:x}=this.ctx.config;if(o=u*g,f){const T=this.ctx.icons.get("loading");n="loading",s=T}else if(d){const T=this.ctx.icons.get("expand"),B=this.ctx.icons.get("shrink");s=c?B:T,n=c?"shrink":"expand"}let v=x,p=x,E=this.drawX;(this.align==="center"||this.align==="right")&&(E=this.drawX+(this.visibleWidth-v-2*e)/2,this.align="left");let C=E+o+e,w=this.drawY+(this.visibleHeight-p)/2,b=o+this.drawX+v-.5;this.type==="selection-tree"?(C=o+this.drawSelectionImageX+this.drawSelectionImageWidth,b=C+v-e/2):this.type==="tree-selection"?b=C+m+v-e/2:b=C+v-e/2,this.drawTextX=b,this.drawTextWidth=this.drawX+this.visibleWidth-b,!(C+v+e>this.drawX+this.visibleWidth)&&(w+p+e>this.drawY+this.visibleHeight||(this.drawTreeImageX=C,this.drawTreeImageY=w,this.drawTreeImageWidth=v,this.drawTreeImageHeight=p,s?(this.drawTreeImageName=n,this.drawTreeImageSource=s):(this.drawTreeImageName="",this.drawTreeImageSource=void 0)))}drawTreeLine(){const{TREE_LINE:e,TREE_INDENT:t=16,TREE_ICON_SIZE:i=16,TREE_LINE_COLOR:s="#e1e6eb"}=this.ctx.config;if(!e||this.cellType!=="body"||!["tree","selection-tree","tree-selection"].includes(this.type)||this.rowspan===0||this.colspan===0)return;const o=this.ctx.database.getRowForRowKey(this.rowKey)||{},n=o.level??0,a=this.drawTreeImageX+this.drawTreeImageWidth/2,c=this.drawTreeImageY+this.drawTreeImageHeight/2;let d=this.drawTreeImageX-n*t;const f=Array.isArray(o.parentRowKeys)?o.parentRowKeys:[];if(n>0){for(let x=0;x<n-1;x+=1){const v=f[x+1];if((v?this.ctx.database.getRowForRowKey(v)||{}:{}).isLastChild)continue;const p=Math.round(this.drawTreeImageX-(n-x)*t+i/2);this.ctx.paint.drawLine([p,this.drawY,p,this.drawY+this.visibleHeight],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}const u=Math.round(this.drawTreeImageX-t+i/2),g=o.isLastChild?c:this.drawY+this.visibleHeight;this.ctx.paint.drawLine([u,this.drawY,u,g],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0});const m=Math.round(d+(n-1)*t+i/2);this.ctx.paint.drawLine([m,c,a,c],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}if(o.hasChildren&&o.expand){const u=this.drawTreeImageY+this.drawTreeImageHeight,g=this.drawY+this.visibleHeight;this.ctx.paint.drawLine([a,u,a,g],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}}updateContainer(){const{BODY_BG_COLOR:e,EDIT_BG_COLOR:t,BODY_CELL_STYLE_METHOD:i,FOOTER_CELL_STYLE_METHOD:s,READONLY_TEXT_COLOR:o,BODY_TEXT_COLOR:n,FOOTER_TEXT_COLOR:a,FOOTER_BG_COLOR:c,HIGHLIGHT_SELECTED_ROW:d,HIGHLIGHT_SELECTED_ROW_COLOR:f,HIGHLIGHT_HOVER_ROW:u,HIGHLIGHT_HOVER_ROW_COLOR:g,STRIPE:m,STRIPE_COLOR:x,FINDER_CELL_BG_COLOR:v}=this.ctx.config;if(this.cellType==="footer"){let _=c,O=a;if(typeof s=="function"){const y=s,{backgroundColor:D,color:L,font:Y}=y({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()})||{};D&&(_=D),L&&(O=L),Y&&(this.drawTextFont=Y)}this.drawCellSkyBgColor="transparent",this.drawCellBgColor=_,this.drawTextColor=O;return}let p="transparent";const E=this.ctx.hoverCell,C=this.ctx.currentCell;let w=this.rowIndex,b=this.rowIndex;if(this.rowspan!==1&&(u||d)){const _=this.getSpanInfo(),{yArr:O}=_;w=O[0],b=O[1]}u&&E&&(E.rowKey===this.rowKey&&(p=g),E.rowIndex>=w&&E.rowIndex<=b&&(p=g)),d&&C&&(C.rowKey===this.rowKey&&(p=f),C.rowIndex>=w&&C.rowIndex<=b&&(p=f)),this.drawCellSkyBgColor=p;let T=e,B=n;if(this.ctx.database.getReadonly(this.rowKey,this.key)||(T=t,B=o),m&&(this.rowIndex%2?T=x:T=e),typeof i=="function"){const _=i,{backgroundColor:O,color:y,font:D}=_({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,isHasChanged:this.isHasChanged,value:this.getValue()})||{};O&&(T=O),y&&(B=y),D&&(this.drawTextFont=D)}const{rowIndex:K,colIndex:R,type:I}=this.ctx.finderBar;K===this.rowIndex&&R===this.colIndex&&I==="body"&&(T=v),this.drawCellBgColor=T,this.drawTextColor=B}updateSelection(){const{visibleWidth:e,visibleHeight:t,rowspan:i,colspan:s,cellType:o,type:n,rowIndex:a,rowKey:c}=this;if(i===0||s===0||o==="footer"||!["index-selection","selection","selection-tree","tree-selection"].includes(n))return;const d=this.ctx.database.getRowSelectable(c),{CHECKBOX_SIZE:f=0,CELL_PADDING:u}=this.ctx.config;let g=this.drawX+u;(this.align==="center"||this.align==="right")&&(g=this.drawX+(e-f)/2);let m=g,x=this.drawY+(t-f)/2;if(n!=="selection-tree"&&n==="tree-selection"){const{TREE_INDENT:E=16,TREE_ICON_SIZE:C}=this.ctx.config,w=this.ctx.database.getRowForRowKey(c),{level:b=0}=w||{},T=b*E;m=g+C+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(c);E.indeterminate&&d?(v=this.ctx.icons.get("checkbox-indeterminate"),p="checkbox-indeterminate"):E.checked&&d?(v=this.ctx.icons.get("checkbox-check"),p="checkbox-check"):!E.checked&&d?(v=this.ctx.icons.get("checkbox-uncheck"),p="checkbox-uncheck"):(v=this.ctx.icons.get("checkbox-disabled"),p="checkbox-disabled")}else{const E=this.ctx.database.getRowSelection(c);E&&d?(v=this.ctx.icons.get("checkbox-check"),p="checkbox-check"):E&&!d?(v=this.ctx.icons.get("checkbox-check-disabled"),p="checkbox-check-disabled"):!E&&d?(v=this.ctx.icons.get("checkbox-uncheck"),p="checkbox-uncheck"):(v=this.ctx.icons.get("checkbox-disabled"),p="checkbox-disabled")}m+f+u>this.drawX+this.visibleWidth||x+f+u>this.drawY+this.visibleHeight||(n==="index-selection"?(this.ctx.hoverCell&&this.ctx.hoverCell.rowIndex===a||["checkbox-disabled","checkbox-check"].includes(p))&&(this.drawSelectionImageX=m,this.drawSelectionImageY=x,this.drawSelectionImageWidth=f,this.drawSelectionImageHeight=f,this.drawSelectionImageName=p,this.drawSelectionImageSource=v):(this.drawSelectionImageX=m,this.drawSelectionImageY=x,this.drawSelectionImageWidth=f,this.drawSelectionImageHeight=f,this.drawSelectionImageName=p,this.drawSelectionImageSource=v))}updateHoverIcon(){if(this.ctx.database.getReadonly(this.rowKey,this.key))return;const{BODY_CELL_HOVER_ICON_METHOD:e,CELL_HOVER_ICON_SIZE:t,CELL_PADDING:i,ENABLE_MERGE_CELL_LINK:s}=this.ctx.config;if(typeof e=="function"){const n=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});n!==void 0&&(this.hoverIconName=n)}const{hoverCell:o}=this.ctx;if(this.hoverIconName&&!this.ctx.editing&&o){let n=0,a=0;if(o.rowKey===this.rowKey&&(n=this.drawX+this.width-t-i,a=this.drawY+(this.height-t)/2),this.rowspan!==1&&s){const d=this.getSpanInfo(),{yArr:f}=d,u=f[0],g=f[1];if(o.rowIndex>=u&&o.rowIndex<=g){const{width:m,height:x,offsetTop:v,offsetLeft:p}=d;n=this.drawX-p+m-t-i,a=this.drawY-v+(x-t)/2}}const c=this.ctx.icons.get(this.hoverIconName);this.drawHoverImageX=n,this.drawHoverImageY=a,this.drawHoverImageWidth=t,this.drawHoverImageHeight=t,this.drawHoverImageName=this.hoverIconName,this.drawHoverImageSource=c}}getAutoHeight(){if(this.cellType!=="body"||!this.autoRowHeight||this.rowspan===0)return 0;if(this.render){const n=this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex);return this.rowspan>1?n<this.visibleHeight?0:Math.round(n-(this.visibleHeight-this.height)):Math.round(n)}if(!(this.displayText&&typeof this.displayText=="string"))return 0;const{BODY_FONT:e,CELL_PADDING:t,CELL_LINE_HEIGHT:i}=this.ctx.config,s=`${this.displayText}_${this.drawTextWidth}_${this.drawTextFont}`,o=this.ctx.paint.calculateTextHeight(this.displayText,this.drawTextWidth,{font:this.drawTextFont||e,padding:t,align:this.align,verticalAlign:this.verticalAlign,color:this.drawTextColor,autoRowHeight:this.autoRowHeight,lineHeight:i,maxLineClamp:this.maxLineClamp,cacheTextKey:s});return this.rowspan>1?o<this.visibleHeight?0:Math.round(o-(this.visibleHeight-this.height)):Math.round(o)}getSpanInfo(){return this.ctx.database.getSpanInfo(this)}getDisplayText(){return this.cellType==="footer"?this.renderFooter||this.text===null||this.text===void 0?"":this.text:this.rowspan===0||this.colspan===0||this.render||this.type==="index-selection"&&(this.ctx.hoverCell&&this.ctx.hoverCell.rowIndex===this.rowIndex||["checkbox-disabled","checkbox-check"].includes(this.drawSelectionImageName))||this.text===null||this.text===void 0?"":`${this.text}`}getText(){if(this.cellType==="footer")return typeof this.formatterFooter=="function"?this.formatterFooter({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.row[this.key]}):this.row[this.key];if(typeof this.formatter=="function")return this.formatter({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});const{BODY_CELL_FORMATTER_METHOD:e}=this.ctx.config;return typeof e=="function"?e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()}):["index-selection","index"].includes(this.type)?`${this.rowIndex+1}`:(this.value=this.ctx.database.getItemValue(this.rowKey,this.key),this.value)}getValue(){return this.ctx.database.getItemValue(this.rowKey,this.key)}setValue(e){this.ctx.setItemValueByEditor(this.rowKey,this.key,e)}getOverlayerViewsStyle(){let e=this.drawX-this.ctx.fixedLeftWidth,t=this.drawY-this.ctx.body.y;if(this.fixed==="left"?e=this.drawX:this.fixed==="right"&&(e=this.drawX-(this.ctx.stageWidth-this.ctx.fixedRightWidth)),this.cellType==="footer"&&this.ctx.config.FOOTER_FIXED&&(t=this.drawY-this.ctx.footer.y),this.autoRowHeight&&this.render&&this.verticalAlign==="middle"){const i=this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex);if(i<this.visibleHeight&&i>0){const s=(this.visibleHeight-i)/2;t=t+s}}return this.autoRowHeight&&this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex)===0&&(e=-99999,t=-99999),{position:"absolute",overflow:"hidden",left:`${Math.round(e-1)}px`,top:`${Math.round(t-1)}px`,width:`${this.visibleWidth}px`,height:this.autoRowHeight?"auto":`${this.visibleHeight}px`,pointerEvents:"initial",userSelect:"none"}}drawContainer(){const{paint:e,config:{BORDER_COLOR:t,BORDER:i}}=this.ctx,{drawX:s,drawY:o}=this;e.drawRect(s,o,this.visibleWidth,this.visibleHeight,{borderColor:i?t:"transparent",fillColor:this.drawCellBgColor}),e.drawRect(s,o,this.width,this.height,{borderColor:"transparent",fillColor:this.drawCellSkyBgColor}),i||this.ctx.paint.drawLine([s,o+this.visibleHeight,s+this.visibleWidth,o+this.visibleHeight],{borderColor:t,fillColor:t,borderWidth:1,lineCap:"round",lineJoin:"round"})}drawAutofillPiont(){if(this.cellType==="footer")return;const{SELECT_BORDER_COLOR:e,ENABLE_AUTOFILL:t,ENABLE_SELECTOR:i,AUTOFILL_POINT_BORDER_COLOR:s}=this.ctx.config;if(!i||!t||this.ctx.editing)return;const{xArr:o,yArr:n}=this.ctx.selector,a=o[1],c=n[1],{colIndex:d,rowIndex:f,drawX:u,drawY:g}=this;if(d===a&&f===c){const m=d===this.ctx.maxColIndex||f===this.ctx.maxRowIndex||d===this.ctx.lastCenterColIndex?6:4;this.ctx.paint.drawRect(u+this.width-m,g+this.height-m,6,6,{borderColor:s,fillColor:e})}}draw(){this.drawTreeLine(),this.drawText(),this.drawImage(),this.drawSelector(),this.drawAutofillPiont(),this.drawErrorTip()}getWidthByColIndexColSpan(e,t){if(t===0)return 0;let i=0;for(let s=e;s<e+t;s++){const o=this.ctx.header.leafCellHeaders[s];i+=o.width}return i}drawText(){const{CELL_PADDING:e,BODY_FONT:t,PLACEHOLDER_COLOR:i,CELL_LINE_HEIGHT:s}=this.ctx.config,{placeholder:o}=this.column;let n=this.displayText,a=this.drawTextColor;if(!this.ctx.database.getReadonly(this.rowKey,this.key)&&o&&["",null,void 0].includes(this.text)&&this.cellType==="body"&&!(this.rowspan===0||this.colspan===0)&&(n=o,a=i),["",null,void 0].includes(n))return!1;typeof n!="string"&&(n=`${n}`);const c=`${n}_${this.drawTextWidth}_${this.drawTextFont}`;return this.ellipsis=this.ctx.paint.drawText(n,this.drawTextX,this.drawTextY,this.drawTextWidth,this.drawTextHeight,{font:this.drawTextFont||t,padding:e,align:this.align,verticalAlign:this.verticalAlign,color:a,autoRowHeight:this.autoRowHeight,lineHeight:s,maxLineClamp:this.maxLineClamp,cacheTextKey:c}),this.ellipsis}drawImage(){if(this.drawSelectionImageSource&&this.ctx.paint.drawImage(this.drawSelectionImageSource,this.drawSelectionImageX,this.drawSelectionImageY,this.drawSelectionImageWidth,this.drawSelectionImageHeight),this.drawTreeImageSource&&this.ctx.paint.drawImage(this.drawTreeImageSource,this.drawTreeImageX,this.drawTreeImageY,this.drawTreeImageWidth,this.drawTreeImageHeight),this.drawHoverImageSource){const{CELL_HOVER_ICON_BG_COLOR:e,CELL_HOVER_ICON_BORDER_COLOR:t}=this.ctx.config;this.ctx.paint.drawRect(this.drawHoverImageX-2,this.drawHoverImageY-2,this.drawHoverImageWidth+4,this.drawHoverImageHeight+4,{borderColor:t,radius:4,borderWidth:1,fillColor:e}),this.ctx.paint.drawImage(this.drawHoverImageSource,this.drawHoverImageX,this.drawHoverImageY,this.drawHoverImageWidth,this.drawHoverImageHeight)}}drawSelector(){if(this.cellType==="footer")return;const{ENABLE_SELECTOR:e}=this.ctx.config;if(!e)return;const{xArr:t,yArr:i,xArrCopy:s,yArrCopy:o}=this.ctx.selector;this.drawBorder({xArr:s,yArr:o,borderColor:this.ctx.config.SELECT_BORDER_COLOR||"rgb(82,146,247)",fillColor:"transparent",borderWidth:1,lineDash:[4,4]}),this.drawBorder({xArr:this.ctx.autofill.xArr,yArr:this.ctx.autofill.yArr,borderColor:this.ctx.config.SELECT_BORDER_COLOR||"rgb(82,146,247)",fillColor:"transparent",borderWidth:1,lineDash:[4,4]}),this.drawBorder({xArr:t,yArr:i,borderColor:this.ctx.config.SELECT_BORDER_COLOR||"rgb(82,146,247)",fillColor:"transparent",borderWidth:1});const[n,a]=t,[c,d]=i;!(n===a&&c===d)&&this.colIndex>=n&&this.colIndex<=a&&this.rowIndex>=c&&this.rowIndex<=d&&this.ctx.paint.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:"transparent",fillColor:this.ctx.config.SELECT_AREA_COLOR||"rgba(82,146,247,0.1)"}),this.operation&&this.rowIndex>=c&&this.rowIndex<=d&&this.ctx.paint.drawRect(this.drawX,this.drawY,this.visibleWidth,this.visibleHeight,{borderColor:"transparent",fillColor:this.ctx.config.SELECT_ROW_COL_BG_COLOR||"transparent"})}drawErrorTip(){if(this.cellType==="footer"||!this.message||this.rowspan===0||this.colspan===0)return;const{ERROR_TIP_ICON_SIZE:e,ERROR_TIP_COLOR:t}=this.ctx.config,{width:i}=this,s=this.drawX,o=this.drawY,n=[s+i-e-.5,o,s+i-.5,o,s+i-.5,o+e];this.ctx.paint.drawLine(n,{borderColor:t,fillColor:t,borderWidth:1,lineCap:"round",lineJoin:"round"})}drawBorder(e){const{drawX:t,drawY:i,rowIndex:s,colIndex:o,height:n,width:a}=this;let c=t,d=i;const{xArr:f,yArr:u,lineDash:g=[],borderWidth:m=1,borderColor:x,fillColor:v}=e,p=f[0],E=f[1],C=u[0],w=u[1];if(o>=p&&o<=E&&s===C){const b=o===E?1:0,T=o===p?1:0;this.ctx.paint.drawLine([c+T,d+1,c+a-b,d+1],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}if(o===E&&s>=C&&s<=w){const b=s===C?1:0,T=s===w?1:0;this.ctx.paint.drawLine([c+a-1,d+b,c+a-1,d+n-T],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}if(o>=p&&o<=E&&s===w){const b=o===E?1:0,T=o===p?1:0;this.ctx.paint.drawLine([c+T,d+n-1,c+a-b,d+n-1],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}if(o===p&&s>=C&&s<=w){const b=s===w?1:0,T=s===C?1:0;this.ctx.paint.drawLine([c+1,d+T,c+1,d+n-b],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}}}class LC{constructor(e,t){h(this,"ctx"),h(this,"data"),h(this,"columns"),h(this,"footerData",[]),h(this,"rowKeyMap",new Map),h(this,"colIndexKeyMap",new Map),h(this,"headerMap",new Map),h(this,"rowIndexRowKeyMap",new Map),h(this,"rowKeyRowIndexMap",new Map),h(this,"checkboxKeyMap",new Map),h(this,"selectionMap",new Map),h(this,"expandMap",new Map),h(this,"originalDataMap",new Map),h(this,"changedDataMap",new Map),h(this,"validationErrorMap",new Map),h(this,"itemRowKeyMap",new WeakMap),h(this,"bufferData",[]),h(this,"customHeader",{fixedData:{},sortData:{},hideData:{},resizableData:{}}),h(this,"overlayerAutoHeightMap",new Map),h(this,"maxRowHeightCellMap",new Map),h(this,"bufferCheckState",{buffer:!1,check:!1,indeterminate:!1,selectable:!0}),h(this,"sumHeight",0),h(this,"filterMethod"),h(this,"positions",[]),h(this,"sortState",new Map),this.ctx=e;const{data:i=[],columns:s=[],footerData:o=[]}=t;this.data=i,this.footerData=o,this.columns=s,this.init()}init(e=!0){this.ctx.paint.clearTextCache(),this.clearBufferData(),this.rowKeyMap.clear(),this.checkboxKeyMap.clear(),this.colIndexKeyMap.clear(),this.rowIndexRowKeyMap.clear(),this.rowKeyRowIndexMap.clear(),this.maxRowHeightCellMap.clear();const t=this.getColumns(),i=Ht(t);if(this.ctx.hasSelection=i.some(s=>s.type==="selection"),this.ctx.hasTree=i.some(s=>s.type==="tree"),e){this.originalDataMap.clear(),this.changedDataMap.clear(),this.validationErrorMap.clear();const{ROW_KEY:s}=this.ctx.config;s?(this.ctx.hasSelection||this.selectionMap.clear(),this.ctx.hasTree||this.expandMap.clear()):(this.selectionMap.clear(),this.expandMap.clear())}this.itemRowKeyMap=new WeakMap,this.initData(this.data),this.getData(),this.bufferCheckState.buffer=!1}clearBufferData(){this.bufferData=[]}initData(e,t=0,i=[]){const s=e.length,{ROW_KEY:o="",DEFAULT_EXPAND_ALL:n,CELL_HEIGHT:a,SELECTABLE_METHOD:c,CHECKBOX_KEY:d,TREE_CHILDREN_KEY:f}=this.ctx.config;e.forEach((u,g)=>{var m;f!=="children"&&(u.children=u[f]);const x=u[o],v=x!=null?`${x}`:Xa();this.itemRowKeyMap.set(u,v);const p=u._height||a,E=u._readonly;let C=!0;if(typeof c=="function"&&(C=c),d){const b=u[d];if(this.checkboxKeyMap.has(b)){const T=this.checkboxKeyMap.get(b)||[];T.push(v),this.checkboxKeyMap.set(b,T)}else this.checkboxKeyMap.set(b,[v])}this.selectionMap.set(v,{key:d?u[d]:v,row:u,check:((m=this.selectionMap.get(v))==null?void 0:m.check)||!1});const w=n||this.expandMap.get(v)||u._expand||!1;this.expandMap.set(v,w),this.rowKeyMap.set(v,{readonly:E,index:g,rowIndex:g,level:t,height:p,calculatedHeight:-1,check:!1,selectable:C,expand:w,expandLazy:!1,hasChildren:u._hasChildren||(Array.isArray(u.children)?u.children.length>0:!1),expandLoading:!1,item:u,parentRowKeys:i,parentRowKey:i[i.length-1]||"",isLastChild:g===s-1}),Array.isArray(u.children)&&u.children.length&&this.initData(u.children,t+1,[...i,v])})}setRowHeight(e,t){const i=this.rowIndexRowKeyMap.get(e);if(i===void 0)return;const s=this.rowKeyMap.get(i);s.height=t,s.item._height=t,this.clearBufferData()}setBatchRowHeight(e){e.forEach(({rowIndex:t,height:i})=>{const s=this.rowIndexRowKeyMap.get(t);if(s){const o=this.rowKeyMap.get(s);o.height=i,o.item._height=i}}),this.clearBufferData()}setBatchCalculatedRowHeight(e){return e.every(({height:t,rowIndex:i})=>this.getPositionForRowIndex(i).calculatedHeight===t)?!1:(e.forEach(({rowIndex:t,height:i})=>{const s=this.rowIndexRowKeyMap.get(t);if(s){const o=this.rowKeyMap.get(s),{height:n=-1}=this.getMaxRowHeightItem(s)||{};o.calculatedHeight=Math.max(i,n)}}),this.clearBufferData(),this.getData(),!0)}getAllRowsData(){let e=[];const t=i=>{i.forEach(s=>{e.push(s),Array.isArray(s.children)&&t(s.children)})};return t(this.data),e}generateColumns(e){const t=i=>i.map(s=>{var o,n,a,c,d,f,u,g;const m=s.children&&Array.isArray(s.children)?t(s.children):void 0,x={hide:(n=(o=this.customHeader)==null?void 0:o.hideData)==null?void 0:n[s.key],fixed:(c=(a=this.customHeader)==null?void 0:a.fixedData)==null?void 0:c[s.key],sort:(f=(d=this.customHeader)==null?void 0:d.sortData)==null?void 0:f[s.key],width:(g=(u=this.customHeader)==null?void 0:u.resizableData)==null?void 0:g[s.key]},v={};for(const[E,C]of Object.entries(x))C!==void 0&&(v[E]=C);const p=m&&m.every(E=>E.hide);return{...s,children:m,hide:p||(typeof s.hide=="function"?s.hide(s):s.hide),...v}});return t(e)}getColumns(){return this.generateColumns(this.columns)}setColumns(e){this.columns=e,this.clearBufferData()}setData(e){this.data=e,this.init()}getData(){if(this.bufferData.length>0)return{data:this.bufferData,sumHeight:this.sumHeight,positions:this.positions};let e=[],t=0;this.sumHeight=0,this.positions=[];const i=o=>{o.forEach(n=>{e.push(n);const a=this.itemRowKeyMap.get(n),{expand:c,hasChildren:d,height:f,calculatedHeight:u}=this.rowKeyMap.get(a),g=this.sumHeight,m=Math.max(u,f);this.sumHeight+=m,this.rowIndexRowKeyMap.set(t,a),this.rowKeyRowIndexMap.set(a,t),this.positions.push({top:g,height:m,bottom:this.sumHeight,calculatedHeight:u}),t+=1,c&&d&&i(n.children)})};this.rowIndexRowKeyMap.clear(),this.rowKeyRowIndexMap.clear();let s=this.data;if(typeof this.filterMethod=="function"&&(s=this.filterMethod(s)),this.sortState.size){const o=Array.from(this.sortState.entries()).sort((n,a)=>n[1].timestamp-a[1].timestamp);s=this.sortDataRecursive(s,o)}return i(s),this.bufferData=e,{data:e,sumHeight:this.sumHeight,positions:this.positions}}setFooterData(e){this.footerData=e}getFooterData(){return this.footerData}setFilterMethod(e){this.filterMethod=e}clearFilterMethod(){this.filterMethod=void 0}getSortState(e){return this.sortState.get(e)||{direction:"none",timestamp:0}}setSortState(e,t){const i=Date.now();this.ctx.config.SORT_STRICTLY&&this.sortState.clear(),t==="none"?this.sortState.delete(e):this.sortState.set(e,{direction:t,timestamp:i}),this.ctx.emit("sortChange",this.sortState),this.clearBufferData(),this.ctx.emit("draw")}clearSort(){this.sortState.clear(),this.ctx.emit("sortChange",this.sortState),this.clearBufferData(),this.ctx.emit("draw")}sortDataRecursive(e,t){let i=[...e];for(const[s,{direction:o}]of t){if(o==="none")continue;const n=this.getColumnByKey(s);!n||!n.column.sortBy||(i=this.applySingleColumnSort(i,s,o,n.column.sortBy))}return i.map(s=>(s.children&&Array.isArray(s.children)&&(s.children=this.sortDataRecursive(s.children,t)),s))}applySingleColumnSort(e,t,i,s){return e.sort((o,n)=>{const a=o[t],c=n[t];let d=0;if(typeof s=="function")d=s(o,n);else if(s==="number"){const f=Number(a)||0,u=Number(c)||0;d=f-u}else if(s==="string"){const f=String(a||""),u=String(c||"");d=f.localeCompare(u)}else s==="date"&&(d=kC(a,c));return i==="asc"?d:-d})}expandItem(e,t=!1){const i=this.rowKeyMap.get(e);i.expand=t,this.expandMap.set(e,t),this.clearBufferData(),this.ctx.emit("draw")}setExpandRowKeys(e,t=!0){this.expandMap.clear(),e.forEach(i=>{const s=this.rowKeyMap.get(i);this.expandMap.set(i,t),s.expand=t}),this.clearBufferData(),this.ctx.emit("draw")}getExpandRowKeys(){let e=[];return this.rowKeyMap.forEach((t,i)=>{t.expand&&e.push(i)}),e}expandAll(e){this.expandMap.clear(),this.rowKeyMap.forEach(t=>{t.expand=e,this.expandMap.set(t.key,e)}),this.clearBufferData(),this.ctx.emit("draw")}expandLoading(e,t=!1){const i=this.rowKeyMap.get(e);i.expandLoading=t,this.clearBufferData(),this.ctx.emit("draw")}setExpandChildren(e,t){const i=this.rowKeyMap.get(e);i.expand=!0,this.expandMap.set(e,!0),i.expandLazy=!0,i.item.children=t,this.initData(i.item.children,i.level+1),this.clearBufferData()}getIsExpandLoading(e){return this.rowKeyMap.get(e).expandLoading}getIsExpandLazy(e){return this.rowKeyMap.get(e).expandLazy}getIsExpand(e){return this.rowKeyMap.get(e).expand}getRowForRowKey(e){return this.rowKeyMap.get(e)}getRowForRowIndex(e){const t=this.getRowKeyForRowIndex(e);return this.rowKeyMap.get(t)}getRowKeyForRowIndex(e){return this.rowIndexRowKeyMap.get(e)||""}getRowKeyByItem(e){return this.itemRowKeyMap.get(e)}getRowIndexForRowKey(e){return this.rowKeyRowIndexMap.get(e)}getItemValueForRowIndexAndColIndex(e,t){if(!(this.rowIndexRowKeyMap.has(e)&&this.colIndexKeyMap.get(t)))return null;const i=this.rowIndexRowKeyMap.get(e),s=this.colIndexKeyMap.get(t);return i===void 0||s===void 0?null:{rowKey:i,key:s,value:this.getItemValue(i,s)}}getItemValue(e,t){const i=this.rowKeyMap.get(e);return i&&i.item?i.item[t]===void 0?null:i.item[t]:null}async batchSetItemValue(e,t=!1,i=!0,s="none"){let o=[],n=i;const a=new Set;let c=[],d=e.map(x=>{const{rowKey:v,key:p}=x;let E=x.value,C=E;const w=this.getRowDataItemForRowKey(v),b=this.getItemValue(v,p),T=this.getVirtualBodyCellByKey(v,p);return(T==null?void 0:T.type)==="number"&&(["",void 0,null].includes(E)?C=null:/^-?\d+(\.\d+)?$/.test(`${E}`)?C=Number(E):(C=b,c.push({...x,value:C,oldValue:b,row:w}))),{...x,value:C,oldValue:b,row:w}});if(d=d.filter(x=>!c.some(v=>x.rowKey===v.rowKey&&x.key===v.key)),c.length){const x={code:"ERR_BATCH_SET_NUMBER_VALUE",message:"Assignment failed, not a numeric type",data:c};this.ctx.emit("error",x)}if(d=d.filter(x=>x.oldValue!==x.value),!d.length)return;const{BEFORE_VALUE_CHANGE_METHOD:f}=this.ctx.config;s==="none"&&typeof f=="function"&&(d=await f(d),n=!1),d.forEach(x=>{const{value:v,rowKey:p,key:E}=x,C=this.getItemValue(p,E);a.add(p),this.setItemValue(p,E,v,!1,!1,!1,n),o.push({rowKey:p,key:E,oldValue:C,newValue:v})});let u=[];a.forEach(x=>{u.push(this.ctx.database.getRowDataItemForRowKey(x))});const g=d.map(({rowKey:x,key:v})=>this.getValidator(x,v));Promise.all(g).then(()=>{this.validationErrorMap.size===0&&this.changedDataMap.size>0&&this.ctx.emit("validateChangedData",this.getChangedData())});const m=d.map(x=>{const v=!!this.getValidationError(x.rowKey,x.key).length;return{...x,errorTip:v}});this.ctx.emit("change",m,u),t&&this.ctx.history.pushState({changeList:o,scrollX:this.ctx.scrollX,scrollY:this.ctx.scrollY,type:"multiple"}),this.ctx.emit("draw")}async setItemValue(e,t,i,s=!1,o=!1,n=!1,a=!0){if(!this.rowKeyMap.has(e))return{};const{item:c}=this.rowKeyMap.get(e);let d=c[t],f=i;if(a&&this.ctx.database.getReadonly(e,t))return{oldValue:d,newValue:d};c[t]!==null&&typeof c[t]=="object"&&(d=JSON.parse(JSON.stringify(c[t])));const u=`${e}_${t}`;this.originalDataMap.has(u)||this.originalDataMap.set(u,d);const g=this.originalDataMap.get(u),m=this.getRowDataItemForRowKey(e);if(n){const x=this.getVirtualBodyCellByKey(e,t);if((x==null?void 0:x.type)==="number")if(["",void 0,null].includes(i))f=null;else if(/^-?\d+(\.\d+)?$/.test(`${i}`))f=Number(i);else{f=d;const p={code:"ERR_SET_NUMBER_VALUE",message:"Assignment failed, not a numeric type",data:[{rowKey:e,key:t,value:f,oldValue:d,row:m}]};this.ctx.emit("error",p)}if(f===d)return{oldValue:d,newValue:d};let v=[{rowKey:e,key:t,value:f,oldValue:d,row:m}];this.batchSetItemValue(v,s,!1),this.ctx.emit("editChange",{rowKey:e,key:t,oldValue:d,value:f,originalValue:g,row:m})}else this.changedDataMap.set(u,f),c[t]=f;return this.ctx.hasEvent("iterationChange")&&this.ctx.emit("iterationChange",{rowKey:e,key:t,oldValue:d,value:f,originalValue:this.originalDataMap.get(u),row:m}),o&&this.ctx.emit("draw"),{oldValue:d,newValue:f}}getRowDataItemForRowKey(e){if(!this.rowKeyMap.has(e))return{};const{item:t}=this.rowKeyMap.get(e);return t}setRowSelectionByCheckboxKey(e,t){const{CHECKBOX_KEY:i}=this.ctx.config;if(i){if(!this.rowKeyMap.has(e))return!1;const{item:s}=this.rowKeyMap.get(e),o=s[i];this.checkboxKeyMap.has(o)&&(this.checkboxKeyMap.get(o)||[]).forEach(n=>{const a=this.selectionMap.get(n);a&&(a.check=t)})}}toggleRowSelection(e,t){const i=this.rowKeyMap.get(e),s=this.selectionMap.get(e);if(!s)return;t==="selection-tree"||t==="tree-selection"?this.toggleTreeSelection(e):(s.check=!s.check,this.setRowSelectionByCheckboxKey(e,s.check)),this.ctx.emit("toggleRowSelection",i);const o=this.getSelectionRows();this.ctx.emit("selectionChange",o),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}toggleTreeSelection(e){const t=this.getTreeSelectionState(e),i=this.ctx.config.TREE_SELECT_MODE;if(i==="auto")t.checked&&!t.indeterminate?(this.clearTreeSelectionRecursive(e),this.setRowSelection(e,!1,!1)):(this.selectTreeSelectionRecursive(e),this.setRowSelection(e,!0,!1));else if(i==="cautious")t.checked&&!t.indeterminate?(this.clearTreeSelectionRecursive(e),this.setRowSelection(e,!1,!1)):(this.selectTreeSelectionRecursive(e),this.setRowSelection(e,!0,!1));else if(i==="strictly"){const s=this.selectionMap.get(e);s&&(s.check=!s.check,this.setRowSelectionByCheckboxKey(e,s.check))}this.ctx.emit("selectionChange",this.getSelectionRows()),this.ctx.emit("draw")}selectTreeSelectionRecursive(e){this.getTreeChildren(e).forEach(t=>{this.setRowSelectionByParent(t,!0),this.selectTreeSelectionRecursive(t)})}clearTreeSelectionRecursive(e){this.getTreeChildren(e).forEach(t=>{this.setRowSelectionByParent(t,!1),this.clearTreeSelectionRecursive(t)})}updateParentTreeSelection(e){const t=this.getTreeParent(e);if(!t)return;const i=this.getTreeChildren(t).map(c=>this.selectionMap.get(c)),s=i.filter(c=>c==null?void 0:c.check).length,o=i.length;let n=!1;o>0&&(s===0?n=!1:s===o||this.ctx.config.TREE_SELECT_MODE==="auto"?n=!0:this.ctx.config.TREE_SELECT_MODE==="cautious"&&(n=!1));const a=this.selectionMap.get(t);a&&a.check!==n&&(a.check=n,this.setRowSelectionByCheckboxKey(t,n),this.updateParentTreeSelection(t))}setRowSelection(e,t,i=!0){const s=this.selectionMap.get(e);s&&(s.check=t,this.setRowSelectionByCheckboxKey(e,s.check),this.ctx.emit("setRowSelection",t,s.row),(this.ctx.config.TREE_SELECT_MODE==="auto"||this.ctx.config.TREE_SELECT_MODE==="cautious")&&this.updateParentTreeSelection(e),i&&(this.bufferCheckState.buffer=!1,this.ctx.emit("draw")))}setRowSelectionByParent(e,t){const i=this.selectionMap.get(e);i&&(i.check=t,this.setRowSelectionByCheckboxKey(e,i.check))}getSelectionRows(){let e=[];return this.selectionMap.forEach(t=>{t.check&&e.push(t.row)}),e}getRowSelection(e){const t=this.selectionMap.get(e);return t?t.check:!1}getTreeSelectionState(e){if(!this.getRowForRowKey(e))return{checked:!1,indeterminate:!1};const t=this.selectionMap.get(e),i=(t==null?void 0:t.check)||!1;if(this.getTreeChildren(e).length===0)return{checked:i,indeterminate:!1};let s=!1,o=i;if(this.ctx.config.TREE_SELECT_MODE==="auto"){const n=u=>{const g=this.getTreeChildren(u);let m=[];for(const x of g)m.push(x),m.push(...n(x));return m},a=n(e).map(u=>this.selectionMap.get(u)),c=a.filter(u=>u==null?void 0:u.check).length,d=a.length,f=c>0;s=f&&c!==d,o=i||f,i&&d>0&&c===0&&(o=!1,s=!1)}else if(this.ctx.config.TREE_SELECT_MODE==="cautious"){const n=g=>{const m=this.getTreeChildren(g);let x=[];for(const v of m)x.push(v),x.push(...n(v));return x},a=n(e).map(g=>this.selectionMap.get(g)),c=a.filter(g=>g==null?void 0:g.check).length,d=a.length,f=c>0,u=c===d;s=f&&!u,o=i||u,i&&d>0&&c===0&&(o=!1,s=!1)}else this.ctx.config.TREE_SELECT_MODE==="strictly"&&(s=!1,o=i);return{checked:o,indeterminate:s}}getTreeChildren(e){const t=this.getRowForRowKey(e);if(!t||!t.item||!t.item.children)return[];const i=[],s=o=>{for(const n of o){const a=this.getRowKeyByItem(n);a&&i.push(a),n.children&&n.children.length>0&&s(n.children)}};return s(t.item.children),i}getTreeParent(e){const t=(i,s)=>{for(const o of i){const n=this.getRowKeyByItem(o);if(o.children)for(const a of o.children){if(this.getRowKeyByItem(a)===s)return n;const c=t(o.children,s);if(c)return c}}return null};return t(this.data,e)}getRowSelectable(e){const{selectable:t,item:i,rowIndex:s}=this.rowKeyMap.get(e);return typeof t=="function"?t({row:i,rowIndex:s}):t}toggleAllSelection(){this.ctx.config.TREE_SELECT_MODE==="auto"||this.ctx.config.TREE_SELECT_MODE==="cautious"?this.rowKeyMap.forEach((t,i)=>{let s=t.selectable;if(typeof s=="function"&&(s=s({row:t.item,rowIndex:t.rowIndex})),s){const o=this.selectionMap.get(i);o&&(o.check=!0,this.setRowSelectionByCheckboxKey(i,!0))}}):this.rowKeyMap.forEach((t,i)=>{let s=t.selectable;typeof s=="function"&&(s=s({row:t.item,rowIndex:t.rowIndex})),s&&this.setRowSelection(i,!0,!1)});const e=this.getSelectionRows();this.ctx.emit("toggleAllSelection",e),this.ctx.emit("selectionChange",e),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}clearSelection(e=!1){const t=this.ctx.config.TREE_SELECT_MODE==="auto"||this.ctx.config.TREE_SELECT_MODE==="cautious";e?t?this.rowKeyMap.forEach((s,o)=>{const n=this.selectionMap.get(o);n&&(n.check=!1,this.setRowSelectionByCheckboxKey(o,!1))}):this.rowKeyMap.forEach((s,o)=>{this.setRowSelection(o,!1,!1)}):(this.selectionMap.clear(),this.rowKeyMap.forEach((s,o)=>{this.selectionMap.set(o,{check:!1,row:s.item,key:o})}));const i=this.getSelectionRows();this.ctx.emit("clearSelection"),this.ctx.emit("selectionChange",i),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}getCheckedState(){const{buffer:e,...t}=this.bufferCheckState;if(e)return t;const i=this.rowKeyMap.size;let s=0,o=0;const n=this.selectionMap.size,a=Array.from(this.selectionMap.values()).some(g=>g.check);this.rowKeyMap.forEach((g,m)=>{var x;(x=this.selectionMap.get(m))!=null&&x.check&&(s+=1);let v=g.selectable;typeof v=="function"&&(v=v({row:g.item,rowIndex:g.rowIndex})),v&&(o+=1)});const c=n>i&&s===0&&a,d=o&&o>s&&s>0||c,f=o!==0,u=!!o&&o===s;return this.bufferCheckState={buffer:!0,check:u,indeterminate:d,selectable:f},{check:u,indeterminate:d,selectable:f}}updateColIndexKeyMap(e=[]){this.colIndexKeyMap.clear(),e.forEach(t=>{this.colIndexKeyMap.set(t.colIndex,t.key)})}getColumnByColIndex(e){var t;const i=this.colIndexKeyMap.get(e);if(i&&this.headerMap.has(i))return(t=this.headerMap.get(i))==null?void 0:t.column}getColumnByKey(e){const t=this.headerMap.get(e);if(t)return t}getColIndexForKey(e){var t;if(e&&this.headerMap.has(e))return(t=this.headerMap.get(e))==null?void 0:t.colIndex}getColHeaderByIndex(e){const t=this.colIndexKeyMap.get(e);if(t&&this.headerMap.has(t))return this.headerMap.get(t)}getChangedData(){let e=[];return this.changedDataMap.forEach((t,i)=>{const s=this.originalDataMap.get(i),o=i.split("_")[0],n=i.split("_")[1];s!==t&&e.push({rowKey:o,colKey:n,originalValue:s,row:this.ctx.database.getRowDataItemForRowKey(o),value:t})}),e}getChangedRows(){const e=new Set;this.changedDataMap.forEach((i,s)=>{const o=this.originalDataMap.get(s),n=s.split("_")[0];o!==i&&e.add(n)});let t=[];return e.forEach(i=>{t.push(this.ctx.database.getRowDataItemForRowKey(i))}),t}isHasChangedData(e,t){const i=`${e}_${t}`;if(!this.changedDataMap.has(i))return!1;const s=this.originalDataMap.get(i),o=this.changedDataMap.get(i);return s!==o}getPositionForRowIndex(e){return e<this.positions.length?this.positions[e]:{height:0,top:0,bottom:0,calculatedHeight:0}}setHeader(e,t){return e?(this.headerMap.set(e,t),!0):!1}getReadonly(e,t){const{DISABLED:i}=this.ctx.config;if(i)return!0;const s=this.rowKeyMap.get(e),o=this.headerMap.get(t);if(!s||!o)return!0;const n=s.readonly,a=o.readonly,{BODY_CELL_READONLY_METHOD:c}=this.ctx.config;if(typeof c=="function"&&o){const d=c({row:s.item,rowIndex:s.rowIndex,colIndex:o.colIndex,column:o.column,value:this.getItemValue(e,t)});if(d!==void 0)return d}return a||n}clearValidate(){this.validationErrorMap.clear()}hasValidationError(){return this.validationErrorMap.size!==0}getValidator(e,t){return new Promise(i=>{const s=this.rowKeyMap.get(e),o=this.headerMap.get(t),{BODY_CELL_RULES_METHOD:n}=this.ctx.config;if(s===void 0||o===void 0)return i([]);const a=o.column;let c=a.rules;if(typeof n=="function"){const d=n({row:s.item,rowIndex:s.rowIndex,colIndex:o.colIndex,column:a,value:this.getItemValue(e,t)});d&&(c=d)}if(c){const d={row:s.item,rowIndex:s.rowIndex,colIndex:o.colIndex,column:a,key:t,rowKey:e,value:this.getItemValue(e,t),field:t,fieldValue:this.getItemValue(e,t)},f=new CC(c).validate(d);this.setValidationError(e,t,f),i(f)}else this.clearValidationError(e,t),i([])})}getHeightByRowIndexRowSpan(e,t){let i=0;for(let s=0;s<t;s++){const o=this.positions[e+s];o&&(i+=o.height)}return i}getSpanInfo(e){const{rowIndex:t,key:i,rowKey:s,row:o,value:n,colIndex:a,relationRowKeys:c,relationColKeys:d,rowspan:f,height:u,width:g,colspan:m,mergeRow:x,mergeCol:v}=e;if(f===1&&m===1)return{xArr:[a,a],yArr:[t,t],rowspan:f,colspan:m,height:u,width:g,offsetTop:0,offsetLeft:0,dataList:[{rowKey:s,key:i,row:o,value:n}]};let p=t,E=t,C=a,w=a,b=[],T=0,B=0,K=0,R=0;if(f!==1&&x){R=g;const I=c.reduce((_,O)=>{const y=this.getItemValue(s,O)??"";return`${_}${y}`},"");for(let _=t-1;_>=0;_--){const O=this.rowIndexRowKeyMap.get(_)||"",y=c.reduce((D,L)=>{const Y=this.getItemValue(O,L)??"";return`${D}${Y}`},"");if(I===y)p=_;else break}for(let _=t;_<=this.ctx.maxRowIndex;_++){const O=this.rowIndexRowKeyMap.get(_)||"",y=c.reduce((D,L)=>{const Y=this.getItemValue(O,L)??"";return`${D}${Y}`},"");if(I===y)E=_;else break}for(let _=p;_<t;_++){const{height:O}=this.positions[_];T+=O}for(let _=p;_<=E;_++){const{height:O}=this.positions[_];K+=O;const y=this.rowIndexRowKeyMap.get(_)||"",{item:D}=this.rowKeyMap.get(y),L=this.getItemValue(y,i);b.push({rowKey:y,key:i,value:L,row:D})}}if(m!==1&&v){K=u;for(let I=a-1;I>=0;I--){const _=this.getColumnByColIndex(I);if(!_)break;const O=this.getItemValue(s,i),y=this.getItemValue(s,_.key);if(O===y&&d.includes(_.key))C=I;else break}for(let I=a;I<=this.ctx.maxColIndex;I++){const _=this.getColumnByColIndex(I);if(!_)break;const O=this.getItemValue(s,i),y=this.getItemValue(s,_.key);if(O===y&&d.includes(_.key))w=I;else break}for(let I=C;I<a;I++){const _=this.getColumnByColIndex(I);if(!_)break;B+=_.width||100}for(let I=C;I<=w;I++){const _=this.getColumnByColIndex(I);if(!_)break;R+=_.width||100,b.push({rowKey:s,key:_.key,value:this.getItemValue(s,_.key),row:o})}}return{xArr:[C,w],yArr:[p,E],rowspan:f,colspan:m,height:K,width:R,offsetTop:T,offsetLeft:B,dataList:b}}setValidationErrorByRowKey(e,t,i){const s=`${e}_${t}`,o=this.getRowForRowKey(e),n=o==null?void 0:o.rowIndex,a=this.getColumnByKey(t);if(!e||!a||!o)return;const c=this.getItemValue(e,t),d=[{key:t,rowKey:e,rowIndex:n,colIndex:a.colIndex,column:a.column,row:o,value:c,message:i,field:t,fieldValue:c}];this.validationErrorMap.set(s,d)}setValidationError(e,t,i){const s=`${e}_${t}`;this.validationErrorMap.set(s,i)}clearValidationError(e,t){const i=`${e}_${t}`;this.validationErrorMap.has(i)&&this.validationErrorMap.delete(i)}getValidationError(e,t){const i=`${e}_${t}`;return this.validationErrorMap.get(i)||[]}getVirtualBodyCell(e,t,i=!0){const s=this.getColumnByColIndex(t),o=this.getRowForRowIndex(e);return!s||!o?void 0:new Br(this.ctx,e,t,0,0,0,0,s,o.item,"body",i)}getVirtualBodyCellByKey(e,t){const i=this.getRowIndexForRowKey(e),s=this.getColIndexForKey(t);if(!(i===void 0||s===void 0))return this.getVirtualBodyCell(i,s)}hasMergeCell(e,t){let i=!1;for(let s=t[0];s<=t[1];s++)for(let o=e[0];o<=e[1];o++){const n=this.getVirtualBodyCell(s,o);if(n&&(n.rowspan!==1||n.colspan!==1)){i=!0;break}}return i}calculateMaxTreeDepth(e,t=0){let i=t;return e.forEach(s=>{if(Array.isArray(s.children)&&s.children.length>0){const o=this.calculateMaxTreeDepth(s.children,t+1);i=Math.max(i,o)}}),i}setOverlayerAutoHeightMap(e){this.overlayerAutoHeightMap=e}getOverlayerAutoHeightMap(){return this.overlayerAutoHeightMap}getOverlayerAutoHeight(e,t){const i=`${e}_${t}`;return this.overlayerAutoHeightMap.get(i)||0}setCustomHeader(e,t=!1){if(["fixedData","sortData","hideData","resizableData"].forEach(i=>{const s=e[i];s!==void 0&&(this.customHeader[i]=s)}),!t){const i=this.clearCustomHeaderInvalidValues(this.columns);this.ctx.emit("customHeaderChange",i)}}resetCustomHeader(){this.customHeader={},this.ctx.emit("resetHeader"),this.ctx.emit("customHeaderChange",this.customHeader)}getCustomHeader(){return this.customHeader}setCustomHeaderResizableData(e,t){let{resizableData:i={}}=this.customHeader;i[e]=t,this.setCustomHeader({resizableData:i})}setCustomHeaderHideData(e,t){let{hideData:i={}}=this.customHeader;e.forEach(s=>{i[s]=t}),this.setCustomHeader({hideData:i}),this.ctx.emit("resetHeader")}setCustomHeaderFixedData(e,t){let{fixedData:i={}}=this.customHeader;e.forEach(s=>{i[s]=t}),this.setCustomHeader({fixedData:i}),this.ctx.emit("resetHeader")}clearCustomHeaderInvalidValues(e){const t=(s,o={})=>{s.forEach(n=>{n.children&&n.children.length>0&&t(n.children,o);const a=(c,d)=>{var f,u;const g=(f=this.customHeader[c])==null?void 0:f[n.key];g!==void 0&&g!==d&&(o[c]||(o[c]={}),o[c][n.key]=g,c==="fixedData"&&!g&&!d&&((u=o[c])==null||delete u[n.key]))};a("fixedData",n.fixed),a("sortData",n.sort),a("hideData",n.hide),a("resizableData",n.width)})};let i={};return t(e,i),i}setMaxRowHeightItem(e,t,i){this.maxRowHeightCellMap.set(e,{key:t,height:i})}getMaxRowHeightItem(e){return this.maxRowHeightCellMap.get(e)}clearChangeData(){this.changedDataMap.clear()}}class DC{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 $C{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 MC{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 AC{constructor(e){h(this,"ctx"),h(this,"textCacheMap",new Map);const t=e.getContext("2d");if(!t)throw new Error("canvas context not found");this.ctx=t}clearTextCache(){this.textCacheMap.clear()}scale(e){this.ctx.setTransform(1,0,0,1,0,0),this.ctx.scale(e,e)}save(){this.ctx.save()}restore(){this.ctx.restore()}translate(e,t){this.ctx.translate(e,t)}setCursor(e="default"){this.ctx.canvas.style.cursor=e}clear(e=0,t=0,i,s){this.ctx.clearRect(e,t,i||this.ctx.canvas.width,s||this.ctx.canvas.height)}drawShadow(e,t,i,s,o){const{fillColor:n,side:a,shadowWidth:c,colorStart:d,colorEnd:f}=o;this.ctx.save(),n&&(this.ctx.fillStyle=n,this.ctx.fillRect(e,t,i,s));let u;switch(a){case"left":u=this.ctx.createLinearGradient(e-c,t,e,t),u.addColorStop(0,d),u.addColorStop(1,f),this.ctx.fillStyle=u,this.ctx.fillRect(e-c,t,c,s);break;case"right":u=this.ctx.createLinearGradient(e+i,t,e+i+c,t),u.addColorStop(0,d),u.addColorStop(1,f),this.ctx.fillStyle=u,this.ctx.fillRect(e+i,t,c,s);break;case"top":u=this.ctx.createLinearGradient(e,t-c,e,t),u.addColorStop(0,d),u.addColorStop(1,f),this.ctx.fillStyle=u,this.ctx.fillRect(e,t-c,i,c);break;case"bottom":u=this.ctx.createLinearGradient(e,t+s,e,t+s+c),u.addColorStop(0,d),u.addColorStop(1,f),this.ctx.fillStyle=u,this.ctx.fillRect(e,t+s,i,c);break;default:console.error("Invalid side specified for shadow");break}this.ctx.restore()}drawLine(e,t){if(e.length<4||e.length%2!==0)throw new Error("A valid array of points is required to draw a line");this.ctx.save();const{borderColor:i="black",borderWidth:s=1}=t;this.ctx.beginPath(),this.ctx.moveTo(e[0]-.5,e[1]-.5);for(let o=2;o<e.length;o+=2)this.ctx.lineTo(e[o]-.5,e[o+1]-.5);this.ctx.strokeStyle=i,this.ctx.lineWidth=s,t.lineDash&&(this.ctx.lineDashOffset=t.lineDashOffset??0,this.ctx.setLineDash(t.lineDash)),t.fillColor&&(this.ctx.fillStyle=t.fillColor,this.ctx.fill()),t.borderColor&&(this.ctx.strokeStyle=t.borderColor),this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()}drawImage(e,t,i,s,o){this.ctx.save(),this.ctx.drawImage(e,t,i,s,o),this.ctx.restore()}drawRect(e,t,i,s,{borderWidth:o=1,borderColor:n,fillColor:a,radius:c=0}={}){if(this.ctx.save(),this.ctx.beginPath(),a!==void 0&&(this.ctx.fillStyle=a),n!==void 0&&(this.ctx.lineWidth=o,this.ctx.strokeStyle=n),c===0)this.ctx.rect(e-.5,t-.5,i,s);else{const[d,f,u,g]=typeof c=="number"?[c,c,c,c]:c;this.ctx.moveTo(e+d,t),this.ctx.arcTo(e+i,t,e+i,t+f,f),this.ctx.arcTo(e+i,t+s,e+i-u,t+s,u),this.ctx.arcTo(e,t+s,e,t+s-g,g),this.ctx.arcTo(e,t,e+d,t,d)}a!==void 0&&this.ctx.fill(),n!==void 0&&this.ctx.stroke(),this.ctx.restore()}drawText(e="",t,i,s,o,n={}){var a;this.ctx.save();const{font:c="12px Arial",align:d="center",color:f="#495060",padding:u=0,verticalAlign:g="middle",maxLineClamp:m=1,autoRowHeight:x=!1,offsetLeft:v=0,offsetRight:p=0}=n;if(this.ctx.font=c,this.ctx.fillStyle=f,this.ctx.textAlign=d,["",null,void 0].includes(e))return this.ctx.restore(),!1;const E=parseInt(((a=c.match(/\d+/))==null?void 0:a[0])||"12")*(n.lineHeight||1.2),C=s-u*2-v-p;let w=!1;const b=Math.round((o-2*u)/E);let T=this.wrapText(e,C,n.cacheTextKey),B=Math.min(T.length,Math.max(b,1));m==="auto"&&x?B=T.length:typeof m=="number"&&m<B&&m!==1?B=m:(m===1&&(T=[e],B=1),m==="auto"&&b===1&&(T=[e],B=1));let K=i+u;const R=Math.round(B*E);g==="middle"?K=i+(o-R)/2:g==="bottom"&&(K=i+o-R-u);let I=t+u+v;d==="center"?I=t+s/2:d==="right"&&(I=t+s-u-p);for(let _=0;_<T.length;_++){const O=T[_],y=K+_*E;if(this.ctx.textBaseline="top",_===B-1){const D=T.slice(_).join(""),{_text:L,ellipsis:Y}=this.handleEllipsis(D,s,u,c);this.ctx.fillText(L,I,y),w=Y;break}this.ctx.fillText(O,I,y)}if(n.textCallback&&T.length){const _=T.reduce((Y,W)=>Math.max(Y,this.ctx.measureText(W).width),0),O=Math.round(_);let y=I,D=I+O;d==="center"?(y=I-O/2,D=I+O/2):d==="right"&&(y=I-O,D=I);const L={x:I,y:K,width:O,height:R,left:y,right:D,top:K,bottom:K+R};n.textCallback(L)}return this.ctx.restore(),w}wrapText(e,t,i=""){if(!e)return[""];if(i&&this.textCacheMap.has(i))return this.textCacheMap.get(i)||[""];const s=[],o=e.split(`
|
|
4
|
-
`);for(const a of o){if(a===""){s.push("");continue}const c=a.split("");let d="";for(const f of c){const u=d+f;this.ctx.measureText(u).width<=t?d=u:d?(s.push(d),d=f):(s.push(f),d="")}d&&s.push(d)}const n=s.length>0?s:[""];return i&&this.textCacheMap.set(i,n),n}calculateTextHeight(e="",t,i={}){var s;const{font:o="12px Arial",padding:n=0,align:a="center",color:c="#495060",maxLineClamp:d=1,cacheTextKey:f=""}=i;this.ctx.save(),this.ctx.font=o,this.ctx.fillStyle=c,this.ctx.textAlign=a;const u=parseInt(((s=o.match(/\d+/))==null?void 0:s[0])||"12"),g=u*(i.lineHeight||1.2),m=t-n*2,x=this.wrapText(e,m,f);let v=1;return d==="auto"?v=x.length:x.length>d?v=d:v=x.length,this.ctx.restore(),Math.max(Math.floor(v*g+n*2),Math.floor(u+n*2))}handleEllipsis(e,t,i=0,s="12px Arial"){this.ctx.save();let o=!1,n=e;if(this.ctx.font=s,e==null||e==="")return this.ctx.restore(),{_text:"",ellipsis:o};const a=this.ctx.measureText("...").width;if(t<=a+i*2)return this.ctx.restore(),{_text:"",ellipsis:!0};const c=this.ctx.measureText(e).width,d=t-i*2;if(c&&c>=d){o=!0;let f=0;for(let u=0;u<e.length;u++)if(f+=this.ctx.measureText(e[u]).width,f>=d-a){n=e.slice(0,u)+"...",o=!0;break}}return this.ctx.restore(),{_text:n,ellipsis:o}}}class ko{constructor(e){h(this,"_config",{}),h(this,"CSS_PREFIX","e-virt-table"),h(this,"ICONS",[]),h(this,"ROW_KEY",""),h(this,"DISABLED",!1),h(this,"HEADER_FONT","12px normal Arial"),h(this,"BODY_FONT","12px normal Arial"),h(this,"BORDER",!0),h(this,"STRIPE",!1),h(this,"STRIPE_COLOR","#fafafa"),h(this,"BORDER_COLOR","#e1e6eb"),h(this,"HEIGHT",0),h(this,"PLACEHOLDER_COLOR","#CDD0DC"),h(this,"EMPTY_BODY_HEIGHT",120),h(this,"EMPTY_CUSTOM_STYLE",{}),h(this,"NUMBER_ERROR_TIP","只允许输入数字"),h(this,"EMPTY_TEXT","暂无数据"),h(this,"LOADING_TEXT","加载中..."),h(this,"MAX_HEIGHT",1e3),h(this,"BORDER_RADIUS",8),h(this,"ENABLE_OFFSET_HEIGHT",!1),h(this,"OFFSET_HEIGHT",0),h(this,"HEADER_HEIGHT",36),h(this,"ENABLE_HEADER_STICKY",!1),h(this,"HEADER_BG_COLOR","#F8FAFF"),h(this,"BODY_BG_COLOR","#FFF"),h(this,"HEADER_TEXT_COLOR","#1D2129"),h(this,"REQUIRED_COLOR","#F56C6C"),h(this,"BODY_TEXT_COLOR","#4E5969"),h(this,"FOOTER_TEXT_COLOR","#4E5969"),h(this,"LOADING_ICON_SVG",""),h(this,"LOADING_ICON_COLOR","#4E5969"),h(this,"EXPAND_ICON_SVG",""),h(this,"SHRINK_ICON_SVG",""),h(this,"EXPAND_ICON_COLOR","#4E5969"),h(this,"SHRINK_ICON_COLOR","#4E5969"),h(this,"ERROR_TIP_ICON_COLOR","red"),h(this,"ERROR_TIP_ICON_SIZE",6),h(this,"COLUMNS_ALIGN","left"),h(this,"COLUMNS_VERTICAL_ALIGN","middle"),h(this,"EXPAND_LAZY",!0),h(this,"DEFAULT_EXPAND_ALL",!1),h(this,"CELL_WIDTH",100),h(this,"CELL_HEIGHT",36),h(this,"CELL_PADDING",8),h(this,"CELL_HOVER_ICON_SIZE",14),h(this,"CELL_HOVER_ICON_BG_COLOR","#fff"),h(this,"CELL_HOVER_ICON_BORDER_COLOR","#DDE0EA"),h(this,"SCROLLER_TRACK_SIZE",14),h(this,"SCROLLER_SIZE",8),h(this,"SCROLLER_COLOR","#dee0e3"),h(this,"SCROLLER_TRACK_COLOR","#fff"),h(this,"SCROLLER_FOCUS_COLOR","#bbbec4"),h(this,"SELECT_BORDER_COLOR","rgb(82,146,247)"),h(this,"SELECT_AREA_COLOR","rgba(82,146,247,0.1)"),h(this,"SELECT_ROW_COL_BG_COLOR","transparent"),h(this,"AUTOFILL_POINT_BORDER_COLOR","#fff"),h(this,"EDIT_BG_COLOR","#fcf6ed"),h(this,"CHECKBOX_KEY",""),h(this,"CHECKBOX_COLOR","rgb(82,146,247)"),h(this,"FINDER_CELL_BG_COLOR","rgb(255,229,144)"),h(this,"ENABLE_FINDER",!0),h(this,"CHECKBOX_SIZE",20),h(this,"CHECKBOX_DISABLED_SVG",""),h(this,"CHECKBOX_DISABLED_COLOR","#F1F2F4"),h(this,"CHECKBOX_CHECK_SVG",""),h(this,"CHECKBOX_UNCHECK_SVG",""),h(this,"CHECKBOX_UNCHECK_COLOR","#DDE0EA"),h(this,"CHECKBOX_INDETERMINATE_SVG",""),h(this,"CHECKBOX_CHECK_DISABLED_SVG",""),h(this,"CHECKBOX_CHECK_DISABLED_COLOR","#DDE0EA"),h(this,"ICON_EDIT_SVG",""),h(this,"ICON_EDIT_COLOR","#4E5969"),h(this,"ICON_SELECT_SVG",""),h(this,"ICON_SELECT_COLOR","#4E5969"),h(this,"SORT_STRICTLY",!0),h(this,"SORT_ASC_ICON_SVG",""),h(this,"SORT_DESC_ICON_SVG",""),h(this,"SORTABLE_ICON_SVG",""),h(this,"SORT_ICON_COLOR","rgb(82,146,247)"),h(this,"READONLY_COLOR","#fff"),h(this,"READONLY_TEXT_COLOR","#4E5969"),h(this,"ERROR_TIP_COLOR","#ED3F14"),h(this,"FOOTER_BG_COLOR","#fafafa"),h(this,"FOOTER_FIXED",!0),h(this,"FOOTER_POSITION","bottom"),h(this,"CELL_FOOTER_HEIGHT",36),h(this,"ENABLE_SELECTOR",!0),h(this,"TREE_SELECT_MODE","auto"),h(this,"TREE_CHILDREN_KEY","children"),h(this,"TREE_INDENT",20),h(this,"TREE_ICON_SIZE",20),h(this,"TREE_LINE",!1),h(this,"TREE_LINE_COLOR","#e1e6eb"),h(this,"ENABLE_EDIT_SINGLE_CLICK",!1),h(this,"ENABLE_EDIT_CLICK_SELECTOR",!0),h(this,"SELECTOR_AREA_MIN_X",0),h(this,"SELECTOR_AREA_MAX_X_OFFSET",0),h(this,"SELECTOR_AREA_MAX_X",0),h(this,"SELECTOR_AREA_MIN_Y",0),h(this,"SELECTOR_AREA_MAX_Y",0),h(this,"SELECTOR_AREA_MAX_Y_OFFSET",0),h(this,"SELECTOR_CELL_VALUE_TYPE","value"),h(this,"ENABLE_AUTO_THEME",!0),h(this,"ENABLE_SELECTOR_SINGLE",!1),h(this,"ENABLE_SELECTOR_SPAN_COL",!0),h(this,"ENABLE_SELECTOR_SPAN_ROW",!0),h(this,"ENABLE_SELECTOR_ALL_ROWS",!0),h(this,"ENABLE_SELECTOR_ALL_COLS",!0),h(this,"ENABLE_MERGE_CELL_LINK",!1),h(this,"ENABLE_AUTOFILL",!1),h(this,"ENABLE_AUTOFILL_SPAN_COL",!0),h(this,"ENABLE_AUTOFILL_SPAN_ROW",!0),h(this,"ENABLE_CONTEXT_MENU",!1),h(this,"ENABLE_HEADER_CONTEXT_MENU",!1),h(this,"ENABLE_COPY",!0),h(this,"ENABLE_PASTER",!0),h(this,"ENABLE_RESIZE_ROW",!0),h(this,"ENABLE_RESIZE_COLUMN",!0),h(this,"RESIZE_ROW_LINE_COLOR","#e1e6eb"),h(this,"RESIZE_COLUMN_LINE_COLOR","#e1e6eb"),h(this,"ENABLE_RESIZE_COLUMN_TEXT",!0),h(this,"RESIZE_COLUMN_TEXT_COLOR","#fff"),h(this,"RESIZE_COLUMN_TEXT_BG_COLOR","rgb(82,146,247)"),h(this,"RESIZE_ROW_MIN_HEIGHT",36),h(this,"RESIZE_COLUMN_MIN_WIDTH",40),h(this,"DRAG_TIP_BG_COLOR","rgba(82,146,247,0.1)"),h(this,"DRAG_TIP_LINE_COLOR","rgb(82,146,247)"),h(this,"ENABLE_KEYBOARD",!0),h(this,"ENABLE_HISTORY",!1),h(this,"ENABLE_VALIDATOR_IMMEDIATE",!0),h(this,"HISTORY_NUM",50),h(this,"HIGHLIGHT_HOVER_ROW",!1),h(this,"HIGHLIGHT_HOVER_ROW_COLOR","rgba(186,203,231,0.1)"),h(this,"HIGHLIGHT_SELECTED_ROW",!1),h(this,"HIGHLIGHT_SELECTED_ROW_COLOR","rgba(82,146,247,0.1)"),h(this,"TOOLTIP_BG_COLOR","#303133"),h(this,"TOOLTIP_TEXT_COLOR","#fff"),h(this,"TOOLTIP_ZINDEX",3e3),h(this,"TOOLTIP_CUSTOM_STYLE",{}),h(this,"CONTEXT_MENU",[{label:"复制",value:"copy"},{label:"剪切",value:"cut"},{label:"粘贴",value:"paste"},{label:"清空选中内容",value:"clearSelected"}]),h(this,"CUSTOM_BODY_CONTEXT_MENU",[]),h(this,"HEADER_CONTEXT_MENU",[{label:"左固定",value:"fixedLeft"},{label:"右固定",value:"fixedRight"},{label:"取消固定",value:"fixedNone"},{label:"隐藏",value:"hide"},{label:"显示",value:"visible"},{label:"恢复默认",value:"resetHeader"}]),h(this,"CUSTOM_HEADER_CONTEXT_MENU",[]),h(this,"CELL_LINE_HEIGHT",1.3),h(this,"AUTO_ROW_HEIGHT",!1),h(this,"ENABLE_DRAG_COLUMN",!1),h(this,"HEADER_CELL_STYLE_METHOD"),h(this,"BODY_CELL_STYLE_METHOD"),h(this,"FOOTER_CELL_STYLE_METHOD"),h(this,"BODY_CELL_READONLY_METHOD"),h(this,"BODY_CELL_FORMATTER_METHOD"),h(this,"BODY_CELL_RULES_METHOD"),h(this,"BODY_CELL_TYPE_METHOD"),h(this,"BODY_CELL_EDITOR_METHOD"),h(this,"BODY_CELL_RENDER_METHOD"),h(this,"BODY_CELL_HOVER_ICON_METHOD"),h(this,"SPAN_METHOD"),h(this,"SELECTABLE_METHOD"),h(this,"EXPAND_LAZY_METHOD"),h(this,"BEFORE_VALUE_CHANGE_METHOD"),h(this,"BEFORE_PASTE_DATA_METHOD"),h(this,"BEFORE_AUTOFILL_DATA_METHOD"),h(this,"BEFORE_SET_SELECTOR_METHOD"),h(this,"BEFORE_SET_AUTOFILL_METHOD"),h(this,"BEFORE_COPY_METHOD"),this._config=e,this.updateCssVar()}init(e){this._config=e,this.updateCssVar()}updateCssVar(){let e={};Object.keys(this).forEach(t=>{if(t.endsWith("_COLOR")||t.endsWith("_FONT")){const i=`--evt-${t.toLocaleLowerCase().replace(/_/g,"-")}`,s=OC(i);s&&(e[t]=s)}}),Object.assign(this,e,this._config)}}const Ei='<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>',Lo='<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>',Do='<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>',Hr='<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>',NC=Hr.replace('fill="currentColor" p-id="2016"','fill="#bec4c7" p-id="2016"'),BC=Hr.replace('fill="currentColor" p-id="2015"','fill="#bec4c7" p-id="2015"'),Za='<svg t="1724133395728" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2893" width="32" height="32"><path d="M512 226.8476541a19.82487759 19.82487759 0 0 1 14.66497778 5.70304692c3.80203107 3.82918865 5.70304692 8.71751457 5.70304693 14.66497779v122.20814825a19.82487759 19.82487759 0 0 1-5.70304693 14.66497778 19.82487759 19.82487759 0 0 1-14.66497778 5.70304691 19.82487759 19.82487759 0 0 1-14.66497778-5.70304691 19.82487759 19.82487759 0 0 1-5.70304693-14.66497778v-122.20814825a19.82487759 19.82487759 0 0 1 5.70304693-14.66497779 19.82487759 19.82487759 0 0 1 14.66497778-5.70304692z m0 407.36049415a19.82487759 19.82487759 0 0 1 14.66497778 5.70304691c3.80203107 3.82918865 5.70304692 8.71751457 5.70304693 14.66497778v122.20814827a19.82487759 19.82487759 0 0 1-5.70304693 14.66497776 19.82487759 19.82487759 0 0 1-14.66497778 5.70304693 19.82487759 19.82487759 0 0 1-14.66497778-5.70304693 19.82487759 19.82487759 0 0 1-5.70304693-14.66497776v-122.20814827a19.82487759 19.82487759 0 0 1 5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 14.66497778-5.70304691zM797.1523459 512a19.82487759 19.82487759 0 0 1-5.70304692 14.66497778 19.82487759 19.82487759 0 0 1-14.66497779 5.70304693h-122.20814825a19.82487759 19.82487759 0 0 1-14.66497778-5.70304693 19.82487759 19.82487759 0 0 1-5.70304691-14.66497778 19.82487759 19.82487759 0 0 1 5.70304691-14.66497778 19.82487759 19.82487759 0 0 1 14.66497778-5.70304693h122.20814825a19.82487759 19.82487759 0 0 1 14.66497779 5.70304693c3.80203107 3.82918865 5.70304692 8.71751457 5.70304692 14.66497778z m-407.36049415 0a19.82487759 19.82487759 0 0 1-5.70304691 14.66497778 19.82487759 19.82487759 0 0 1-14.66497778 5.70304693h-122.20814827a19.82487759 19.82487759 0 0 1-14.66497776-5.70304693 19.82487759 19.82487759 0 0 1-5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 14.66497776-5.70304693h122.20814827a19.82487759 19.82487759 0 0 1 14.66497778 5.70304693c3.80203107 3.82918865 5.70304692 8.71751457 5.70304691 14.66497778zM310.22076878 310.22076878a21.29137537 21.29137537 0 0 1 14.66497779-5.70304693c5.51294514 0 10.18401235 1.90101585 14.01320099 5.70304693l86.55052591 86.57768347a20.91117183 20.91117183 0 0 1 5.73020449 14.31193182 19.28172983 19.28172983 0 0 1-6.05609289 14.013201 19.11878565 19.11878565 0 0 1-14.013201 6.05609289 20.96548698 20.96548698 0 0 1-14.31193182-5.70304692L310.22076878 338.87178998a19.06447114 19.06447114 0 0 1-5.70304693-14.01320099c0-5.54010272 1.90101585-10.42842865 5.70304693-14.66497778z m288.32975775 288.32975775a19.79772001 19.79772001 0 0 1 14.3390894-6.35482371c5.29568642 0 10.04822572 2.11827457 14.31193182 6.38198066l86.57768347 86.55052651c3.80203107 3.80203107 5.70304692 8.47309828 5.70304691 14.01320102a19.55330372 19.55330372 0 0 1-6.05609225 14.31193182 19.66193339 19.66193339 0 0 1-14.31193245 6.05609288 19.01015661 19.01015661 0 0 1-14.01320099-5.70304692l-86.55052591-86.57768347a19.79772001 19.79772001 0 0 1-6.38198129-14.31193245c0-5.29568642 2.11827457-10.07538268 6.38198129-14.33908939zM713.77923122 310.22076878c3.80203107 4.26370672 5.70304692 9.15203265 5.70304693 14.66497779s-1.90101585 10.18401235-5.70304693 14.01320099l-86.57768347 86.55052591a20.91117183 20.91117183 0 0 1-14.31193182 5.73020449 19.28172983 19.28172983 0 0 1-14.013201-6.05609289 19.11878565 19.11878565 0 0 1-6.05609289-14.013201c0-5.29568642 1.90101585-10.07538268 5.70304692-14.31193182l86.57768348-86.57768347c3.80203107-3.80203107 8.50025585-5.70304692 14.01320099-5.70304693 5.54010272 0 10.40127108 1.90101585 14.66497779 5.70304693zM425.44947347 598.57768347a19.79772001 19.79772001 0 0 1 6.35482371 14.33908939c0 5.29568642-2.11827457 10.04822572-6.38198066 14.31193245L338.89894756 713.77923122a19.06447114 19.06447114 0 0 1-14.01320099 5.70304693 19.55330372 19.55330372 0 0 1-14.31193245-6.05609227 19.68909035 19.68909035 0 0 1-6.05609227-14.31193245 19.01015661 19.01015661 0 0 1 5.70304693-14.01320099l86.57768347-86.55052591a19.79772001 19.79772001 0 0 1 14.31193182-6.38198129c5.29568642 0 10.07538268 2.11827457 14.3390894 6.38198129z" fill="#000000" fill-opacity=".65" p-id="2894"></path></svg>';class HC{constructor(e){h(this,"ctx"),h(this,"list",[{name:"loading",configName:"LOADING_ICON_SVG",configColorName:"LOADING_ICON_COLOR",svg:Za,color:"#4E5969"},{name:"expand",configName:"EXPAND_ICON_SVG",configColorName:"EXPAND_ICON_COLOR",svg:Ei,color:"#4E5969"},{name:"shrink",configName:"SHRINK_ICON_SVG",configColorName:"SHRINK_ICON_COLOR",svg:Do,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:Lo,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:Lo,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:Do,color:"#4E5969"},{name:"sort-asc",configName:"SORT_ASC_ICON_SVG",configColorName:"SORT_ICON_COLOR",svg:NC,color:"rgb(82,146,247)"},{name:"sort-desc",configName:"SORT_DESC_ICON_SVG",configColorName:"SORT_ICON_COLOR",svg:BC,color:"rgb(82,146,247)"},{name:"sort-default",configName:"SORTABLE_ICON_SVG",svg:Hr,color:"#bec4c7"}]),h(this,"icons",new Map),this.ctx=e,this.init()}async init(){const e=[];for(let t=0;t<this.list.length;t++){const i=this.list[t];let s=i.color,o=i.svg;if(i.configColorName){const a=this.ctx.config[i.configColorName];a&&(s=a)}if(i.configName){const a=this.ctx.config[i.configName];a&&(o=a)}const n=this.createImageFromSVG(o,s).then(a=>{this.icons.set(i.name,a)});e.push(n)}for(let t=0;t<this.ctx.config.ICONS.length;t++){const i=this.ctx.config.ICONS[t];let s=i.color;const o=this.createImageFromSVG(i.svg,s,i.isBlob).then(n=>{this.icons.set(i.name,n)});e.push(o)}await Promise.all(e),this.ctx.emit("draw")}async createImageFromSVG(e,t,i=!1){const s=new DOMParser().parseFromString(e,"image/svg+xml").documentElement;t&&s.querySelectorAll("*").forEach(a=>{const c=a.getAttribute("fill");(c==="currentColor"||c===null)&&a.setAttribute("fill",t)});const o=new Image;let n="";if(i){const a=new Blob([new XMLSerializer().serializeToString(s)],{type:"image/svg+xml"});n=URL.createObjectURL(a)}else n="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(s));return o.src=n,new Promise((a,c)=>{o.onerror=()=>c(new Error("Failed to load image:"+e)),o.onload=()=>{a(o)}})}get(e){return this.icons.get(e)}getSvg(e){return this.list.find(t=>t.name===e)}}class dr extends qa{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=Xa(),this.overflowTooltipShow=a.overflowTooltipHeaderShow!==!1,this.hasChildren=a.children&&a.children.length>0||!1,this.render=a.renderHeader,this.maxLineClampHeader=a.maxLineClampHeader||"auto"}isVerticalVisible(){const{stageHeight:e}=this.ctx,t=e;return!(this.y+this.height<=0||this.y>=t)}updateStyle(){this.style=this.getOverlayerViewsStyle()}updateContainer(){const{HEADER_CELL_STYLE_METHOD:e,HEADER_BG_COLOR:t,HEADER_TEXT_COLOR:i}=this.ctx.config;let s=t,o=i;if(typeof e=="function"){const c=e,{backgroundColor:d,color:f,font:u}=c({colIndex:this.colIndex,column:this.column})||{};d&&(s=d),f&&(o=f),u&&(this.drawTextFont=u)}const{colKey:n,type:a}=this.ctx.finderBar;a==="header"&&n===this.key&&(s=this.ctx.config.FINDER_CELL_BG_COLOR),this.drawCellBgColor=s,this.drawTextColor=o}update(){this.updateContainer(),this.displayText=this.getText(),this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawTextX=this.drawX,this.drawTextY=this.drawY,this.drawTextWidth=this.width,this.drawTextHeight=this.height,this.updateStyle()}draw(){this.drawEdge(),this.drawSelection(),this.drawText(),this.drawBg(),this.drawSortIcon()}drawEdge(){const{paint:e,config:{BORDER_COLOR:t,BORDER:i}}=this.ctx;e.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:i?t:"transparent",fillColor:this.drawCellBgColor})}drawText(){const{paint:e,config:{HEADER_FONT:t,CELL_PADDING:i,REQUIRED_COLOR:s}}=this.ctx,o=`${this.displayText}_${this.drawTextWidth}_${this.drawTextFont}`;this.ellipsis=e.drawText(this.displayText,this.drawTextX,this.drawTextY,this.drawTextWidth,this.drawTextHeight,{font:this.drawTextFont||t,padding:i,color:this.drawTextColor,align:this.align,verticalAlign:this.verticalAlign,maxLineClamp:this.maxLineClampHeader,offsetRight:this.column.sortBy?16:0,offsetLeft:this.required?12:0,cacheTextKey:o,textCallback:n=>{this.column.sortBy&&(this.drawSortImageX=n.right+4,this.drawSortImageY=n.top+(n.height-16)/2),this.required&&e.drawText("*",n.left-18,n.top+(n.height-12)/2,24,24,{color:s,font:"18px Arial",align:"center",verticalAlign:"middle",padding:0})}})}drawBg(){if(this.ctx.dragHeaderIng)return;const{ENABLE_SELECTOR:e,ENABLE_SELECTOR_SINGLE:t}=this.ctx.config;let i=-1,s=-1;if(this.ctx.focusCellHeader&&(i=this.ctx.focusCellHeader.colIndex,s=this.ctx.focusCellHeader.colIndex+this.ctx.focusCellHeader.colspan-1),e&&!t){const{xArr:n}=this.ctx.selector;i=n[0],s=n[1]}const o=this.colspan+this.colIndex-1;this.colIndex>=i&&this.colIndex<=s&&o<=s&&this.ctx.paint.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:"transparent",fillColor:this.ctx.config.SELECT_ROW_COL_BG_COLOR||"transparent"})}drawSelection(){if(!this.hideHeaderSelection&&["index-selection","selection","selection-tree","tree-selection"].includes(this.type)){const{indeterminate:e,check:t,selectable:i}=this.ctx.database.getCheckedState(),{CHECKBOX_SIZE:s=0,CELL_PADDING:o}=this.ctx.config;let n=this.drawX+(this.width-s)/2,a=this.drawY+(this.height-s)/2;this.drawTextX=n+s-o/2,this.drawTextWidth=this.drawX+this.visibleWidth-this.drawTextX,(this.align==="left"||this.align==="right")&&(n=this.drawX+o,this.drawTextX=n+s-o/2,this.drawTextWidth=this.drawX+this.visibleWidth-this.drawTextX),this.verticalAlign==="top"?a=this.drawY+o/2:this.verticalAlign==="bottom"&&(a=this.drawY+this.height-s-o/2);let c=this.ctx.icons.get("checkbox-uncheck"),d="checkbox-uncheck";e?(c=this.ctx.icons.get("checkbox-indeterminate"),d="checkbox-indeterminate"):t&&i?(c=this.ctx.icons.get("checkbox-check"),d="checkbox-check"):t&&!i?(c=this.ctx.icons.get("checkbox-check-disabled"),d="checkbox-check-disabled"):!t&&i?(c=this.ctx.icons.get("checkbox-uncheck"),d="checkbox-uncheck"):(c=this.ctx.icons.get("checkbox-disabled"),d="checkbox-disabled"),c&&(this.drawSelectionImageX=n,this.drawSelectionImageY=a,this.drawSelectionImageWidth=s,this.drawSelectionImageHeight=s,this.drawSelectionImageName=d,this.drawSelectionImageSource=c,this.ctx.paint.drawImage(this.drawSelectionImageSource,this.drawSelectionImageX,this.drawSelectionImageY,this.drawSelectionImageWidth,this.drawSelectionImageHeight))}}drawSortIcon(){if(!this.column.sortBy)return;const e=16;let t=this.sortIconName;const i=this.ctx.database.getSortState(this.key);i.direction==="asc"?t=this.sortAscIconName:i.direction==="desc"&&(t=this.sortDescIconName);const s=this.ctx.icons.get(t);s&&(this.drawSortImageWidth=e,this.drawSortImageHeight=e,this.drawSortImageName=t,this.drawSortImageSource=s,this.ctx.paint.drawImage(this.drawSortImageSource,this.drawSortImageX,this.drawSortImageY,this.drawSortImageWidth,this.drawSortImageHeight))}getText(){return this.render||["",null,void 0].includes(this.text)?"":`${this.text}`}getOverlayerViewsStyle(){let e="";return this.fixed==="left"?e=`${this.drawX}px`:this.fixed==="right"?e=`${this.drawX-(this.ctx.stageWidth-this.ctx.fixedRightWidth)}px`:e=`${this.drawX-this.ctx.fixedLeftWidth}px`,{position:"absolute",overflow:"hidden",left:e,top:`${this.drawY+1}px`,width:`${this.width}px`,height:`${this.height-2}px`,pointerEvents:"initial",userSelect:"none"}}}class FC{constructor(e){h(this,"ctx"),h(this,"visibleHoverCell"),h(this,"resizeObserver"),h(this,"mutationObserver"),this.ctx=e,this.init()}init(){this.resizeObserver=new ResizeObserver(e=>{this.ctx.emit("resetHeader"),this.ctx.emit("resizeObserver",e),this.ctx.emit("containerResize",this.ctx.containerElement)}),this.resizeObserver.observe(this.ctx.containerElement),this.mutationObserver=new MutationObserver(e=>{for(const t of e)t.type==="attributes"&&t.attributeName==="class"&&(this.ctx.config.updateCssVar(),this.ctx.emit("draw"))}),this.ctx.config.ENABLE_AUTO_THEME&&this.mutationObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),this.ctx.on("mousedown",e=>{if(this.isBusy(e))return;const{offsetY:t,offsetX:i}=this.ctx.getOffset(e),s=t,o=i,{body:{height:n,visibleHeight:a,visibleWidth:c,y:d}}=this.ctx,f=Math.min(n,a);o>0&&o<c&&s>d&&s<d+f||this.ctx.emit("mousedownBodyOutside",e),e.button===0&&(this.handleHeaderEvent(o,s,this.ctx.header.renderCellHeaders,u=>{this.ctx.focusCellHeader=u,this.ctx.focusCell=void 0,this.ctx.emit("cellHeaderMousedown",u,e)}),this.handleBodyEvent(o,s,this.ctx.body.renderRows,u=>{this.ctx.setFocusCell(u),this.ctx.focusCellHeader=void 0,this.ctx.emit("cellMousedown",u,e)}))}),this.ctx.on("mouseup",e=>{if(e.button!==0||this.isBusy(e))return;const{offsetY:t,offsetX:i}=this.ctx.getOffset(e),s=t,o=i;this.handleHeaderEvent(o,s,this.ctx.header.renderCellHeaders,n=>{this.ctx.focusCellHeader=n,this.ctx.emit("cellHeaderMouseup",n,e)}),this.handleBodyEvent(o,s,this.ctx.body.renderRows,n=>{this.ctx.setFocusCell(n),this.ctx.emit("cellMouseup",n,e)})}),this.ctx.on("click",e=>{if(e.button!==0||this.isBusy(e))return;const t=this.ctx.getOffset(e).offsetY,i=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(i,t,this.ctx.header.renderCellHeaders,s=>{this.ctx.clickCellHeader=s,this.ctx.emit("cellHeaderClick",s,e),this.selectionClick(s,e),this.sortClick(s,e)}),this.handleBodyEvent(i,t,this.ctx.body.renderRows,s=>{this.ctx.clickCell=s,this.ctx.emit("cellClick",s,e),this.selectionClick(s,e),this.treeClick(s,e)},!0),this.handleBodyEvent(i,t,this.ctx.body.renderRows,s=>{this.hoverIconClick(s)},!1)}),this.ctx.on("dblclick",e=>{if(e.button!==0||this.isBusy(e))return;const t=this.ctx.getOffset(e).offsetY,i=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(i,t,this.ctx.header.renderCellHeaders,s=>{this.ctx.emit("cellHeaderDblclick",s,e)}),this.handleBodyEvent(i,t,this.ctx.body.renderRows,s=>{this.ctx.clickCell=s,this.ctx.emit("cellDblclick",s,e)})}),this.ctx.on("contextMenu",e=>{if(this.isBusy(e))return;const{offsetY:t,offsetX:i}=this.ctx.getOffset(e),s=t,o=i;this.handleHeaderEvent(o,s,this.ctx.header.renderCellHeaders,n=>{this.ctx.emit("cellHeaderContextMenuClick",n,e)}),this.handleBodyEvent(o,s,this.ctx.body.renderRows,n=>{this.ctx.emit("cellContextMenuClick",n,e)})}),this.ctx.on("mouseout",e=>{!this.ctx.containerElement.contains(e.relatedTarget)&&this.ctx.hoverCell!==void 0&&(this.ctx.hoverRow=void 0,this.ctx.hoverCell=void 0,this.ctx.emit("draw"))}),this.ctx.on("mousemove",e=>{if(this.isBusy(e))return;this.ctx.isPointer=!1,this.ctx.stageElement.style.cursor==="pointer"&&(this.ctx.stageElement.style.cursor="default");const t=this.ctx.getOffset(e).offsetY,i=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(i,t,this.ctx.header.renderCellHeaders,s=>{this.ctx.emit("cellHeaderMouseenter",s,e),this.ctx.hoverCellHeader&&this.ctx.hoverCellHeader!==s&&this.ctx.emit("cellHeaderMouseleave",this.ctx.hoverCellHeader,e),this.imageEnterAndLeave(s,e),this.ctx.hoverCellHeader!==s&&(this.ctx.hoverCellHeader=s,this.visibleHoverCell=void 0,this.ctx.emit("cellHeaderHoverChange",s,e))}),this.handleBodyEvent(i,t,this.ctx.body.renderRows,s=>{this.imageEnterAndLeave(s,e),this.visibleHoverCell!==s&&(this.ctx.emit("visibleCellMouseleave",s,e),this.visibleHoverCell=s,this.ctx.hoverCellHeader=void 0,this.ctx.emit("visibleCellHoverChange",s,e))},!0),this.handleBodyEvent(i,t,this.ctx.body.renderRows,s=>{var o;this.imageEnterAndLeave(s,e),this.ctx.emit("cellMouseenter",s,e),this.ctx.hoverCell&&this.ctx.hoverCell!==s&&this.ctx.emit("cellMouseleave",s,e),this.ctx.hoverCell!==s&&(((o=this.ctx.hoverCell)==null?void 0:o.rowKey)!==s.rowKey&&(this.ctx.hoverCell=s,this.ctx.hoverRow=this.ctx.body.renderRows.find(n=>n.rowKey===s.rowKey),this.ctx.emit("rowHoverChange",this.ctx.hoverRow,s,e),this.ctx.emit("draw")),this.ctx.hoverCell=s,this.ctx.emit("cellHoverChange",s,e))}),this.handleFooterEvent(i,t,this.ctx.footer.renderRows,s=>{this.ctx.emit("cellFooterMouseenter",s,e),this.ctx.hoverCell&&this.ctx.hoverCell!==s&&this.ctx.emit("cellFooterMouseleave",s,e),this.ctx.emit("cellFooterHoverChange",s,e)})})}hoverIconClick(e){e.hoverIconName&&this.ctx.isPointer&&this.ctx.emit("hoverIconClick",e)}selectionClick(e,t){if(!(["selection","index-selection","selection-tree","tree-selection"].includes(e.type)&&this.ctx.isPointer))return;const{offsetY:i,offsetX:s}=this.ctx.getOffset(t),o=i,n=s;if(this.isInsideElement(n,o,e.drawSelectionImageX,e.drawSelectionImageY,e.drawSelectionImageWidth,e.drawSelectionImageHeight))if(e instanceof dr)e.drawSelectionImageName==="checkbox-uncheck"||e.drawSelectionImageName==="checkbox-indeterminate"?this.ctx.database.toggleAllSelection():e.drawSelectionImageName==="checkbox-check"&&this.ctx.database.clearSelection(!0);else{if(!this.ctx.database.getRowSelectable(e.rowKey))return;this.ctx.database.toggleRowSelection(e.rowKey,e.type)}}treeClick(e,t){if(!(["tree","selection-tree","tree-selection"].includes(e.type)&&this.ctx.isPointer))return;const{offsetY:i,offsetX:s}=this.ctx.getOffset(t),o=i,n=s;if(!this.isInsideElement(n,o,e.drawTreeImageX,e.drawTreeImageY,e.drawTreeImageWidth,e.drawTreeImageHeight))return;const a=this.ctx.database.getRowForRowKey(e.rowKey),{expand:c=!1,expandLazy:d=!1}=a||{},{EXPAND_LAZY:f,EXPAND_LAZY_METHOD:u}=this.ctx.config;if(f&&u&&!c&&!d)typeof u=="function"&&(this.ctx.database.expandLoading(e.rowKey,!0),u({row:e.row,rowIndex:e.rowIndex,colIndex:e.colIndex,column:e.column,value:e.getValue()}).then(g=>{this.ctx.database.setExpandChildren(e.rowKey,g),this.ctx.database.expandLoading(e.rowKey,!1),this.ctx.emit("expandChange",this.ctx.database.getExpandRowKeys())}).catch(g=>{this.ctx.database.expandLoading(e.rowKey,!1),console.error(g)}));else{const g=this.ctx.database.getIsExpand(e.rowKey);this.ctx.database.expandItem(e.rowKey,!g),this.ctx.emit("expandChange",this.ctx.database.getExpandRowKeys())}}sortClick(e,t){const{offsetY:i,offsetX:s}=this.ctx.getOffset(t),o=i,n=s;if(!this.isInsideElement(n,o,e.drawSortImageX,e.drawSortImageY,e.drawSortImageWidth,e.drawSortImageHeight))return;const a=this.ctx.database.getSortState(e.key);let c;a.direction==="none"?c="asc":a.direction==="asc"?c="desc":c="none",this.ctx.database.setSortState(e.key,c)}imageEnterAndLeave(e,t){const{offsetY:i,offsetX:s}=this.ctx.getOffset(t),o=i,n=s;if(e instanceof dr){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 Br){if(e.drawSelectionImageSource&&this.isInsideElement(n,o,e.drawSelectionImageX,e.drawSelectionImageY,e.drawSelectionImageWidth,e.drawSelectionImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0,this.ctx.database.getRowSelectable(e.rowKey)||(this.ctx.stageElement.style.cursor="not-allowed");return}if(e.drawHoverImageSource&&this.isInsideElement(n,o,e.drawHoverImageX,e.drawHoverImageY,e.drawHoverImageWidth,e.drawHoverImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}if(e.drawTreeImageSource&&this.isInsideElement(n,o,e.drawTreeImageX,e.drawTreeImageY,e.drawTreeImageWidth,e.drawTreeImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}}}isInsideElement(e,t,i,s,o,n){return e>i&&e<i+o&&t>s&&t<s+n}isBusy(e){const{offsetY:t,offsetX:i}=this.ctx.getOffset(e),s=t,o=i;if(this.ctx.loading||!this.ctx.isTarget(e)||this.ctx.stageElement.style.cursor==="row-resize"||this.ctx.stageElement.style.cursor==="col-resize"||this.ctx.columnResizing||this.ctx.rowResizing)return!0;const{SCROLLER_TRACK_SIZE:n}=this.ctx.config;return!!(this.ctx.scrollerMove||this.ctx.scrollerFocus||s>this.ctx.stageHeight-n||o>this.ctx.stageWidth-n)}handleBodyEvent(e,t,i,s,o=!1){if(this.isInsideBody(t))for(const n of i){const a=n.fixedCells.concat(n.noFixedCells);for(const c of a){const d=c.getDrawX(),f=c.getDrawY();if(o){if(e>d&&e<d+c.visibleWidth&&t>f&&t<f+c.visibleHeight){s(c);return}}else if(e>d&&e<d+c.width&&t>f&&t<f+c.height){s(c);return}}}}handleHeaderEvent(e,t,i,s){for(const o of i){const n=o.getDrawX(),a=o.getDrawY();if(e>n&&e<n+o.width&&t>a&&t<a+o.height){s(o);return}}}handleFooterEvent(e,t,i,s,o=!1){for(const n of i){const a=n.fixedCells.concat(n.noFixedCells);for(const c of a){const d=c.getDrawX(),f=c.getDrawY();if(o){if(e>d&&e<d+c.visibleWidth&&t>f&&t<f+c.visibleHeight){s(c);return}}else if(e>d&&e<d+c.width&&t>f&&t<f+c.height){s(c);return}}}}isInsideBody(e){return e>this.ctx.body.y&&e<this.ctx.body.y+this.ctx.body.visibleHeight}destroy(){this.resizeObserver.unobserve(this.ctx.stageElement),this.mutationObserver.disconnect()}}class KC{constructor(e,t){h(this,"eventBus"),h(this,"eventBrowser"),h(this,"eventTable"),h(this,"containerElement"),h(this,"stageElement"),h(this,"canvasElement"),h(this,"overlayerElement"),h(this,"editorElement"),h(this,"emptyElement"),h(this,"contextMenuElement"),h(this,"loadingElement"),h(this,"stageWidth",0),h(this,"stageHeight",0),h(this,"paint"),h(this,"icons"),h(this,"domSelectionStr",""),h(this,"isMouseoverTargetContainer",!1),h(this,"mousedown",!1),h(this,"isPointer",!1),h(this,"isEmpty",!1),h(this,"rowResizing",!1),h(this,"columnResizing",!1),h(this,"scrollerMove",!1),h(this,"scrollerFocus",!1),h(this,"autofillMove",!1),h(this,"selectorMove",!1),h(this,"disableHoverIconClick",!1),h(this,"selectColsIng",!1),h(this,"selectRowsIng",!1),h(this,"dragHeaderIng",!1),h(this,"finding",!1),h(this,"adjustPositioning",!1),h(this,"contextMenuIng",!1),h(this,"editing",!1),h(this,"loading",!1),h(this,"onlyMergeCell",!1),h(this,"selectOnlyOne",!1),h(this,"hasSelection",!1),h(this,"hasTree",!1),h(this,"scrollY",0),h(this,"scrollX",0),h(this,"fixedLeftWidth",0),h(this,"fixedRightWidth",0),h(this,"lastCenterColIndex",0),h(this,"maxColIndex",0),h(this,"maxRowIndex",0),h(this,"hoverRow"),h(this,"clickCell"),h(this,"focusCell"),h(this,"currentCell"),h(this,"hoverCell"),h(this,"clickCellHeader"),h(this,"focusCellHeader"),h(this,"hoverCellHeader"),h(this,"mouseX",0),h(this,"mouseY",0),h(this,"body",{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,headIndex:0,tailIndex:0,visibleRows:[],renderRows:[],data:[]}),h(this,"footer",{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,renderRows:[]}),h(this,"header",{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,visibleLeafColumns:[],leafCellHeaders:[],allCellHeaders:[],renderLeafCellHeaders:[],renderCellHeaders:[],fixedLeftCellHeaders:[],fixedRightCellHeaders:[],renderCenterCellHeaders:[]}),h(this,"selector",{enable:!1,xArr:[-1,-1],yArr:[-1,-1],xArrCopy:[-1,-1],yArrCopy:[-1,-1]}),h(this,"autofill",{enable:!1,xArr:[-1,-1],yArr:[-1,-1]}),h(this,"finderBar",{text:"",rowIndex:-1,colIndex:-1,type:"body"}),h(this,"database"),h(this,"history"),h(this,"config");const{containerElement:i,stageElement:s,canvasElement:o,overlayerElement:n,editorElement:a,emptyElement:c,loadingElement:d,contextMenuElement:f}=e;this.containerElement=i,s.tabIndex=0,this.stageElement=s,this.canvasElement=o,this.overlayerElement=n,this.editorElement=a,this.emptyElement=c,this.loadingElement=d,this.contextMenuElement=f,this.config=new ko(t.config||{}),this.eventBus=new MC,this.eventBrowser=new $C(this),this.eventTable=new FC(this),this.paint=new AC(this.canvasElement),this.database=new LC(this,t),this.history=new DC(this),this.icons=new HC(this)}setConfig(e){this.config=new ko(e)}setItemValueByEditor(e,t,i,s=!0,o=!0,n=!0){if(this.config.ENABLE_MERGE_CELL_LINK){const a=this.database.getVirtualBodyCellByKey(e,t);if(a&&(a.mergeRow||a.mergeCol)){const{dataList:c}=a.getSpanInfo(),d=c.map(f=>({...f,value:i}));this.database.batchSetItemValue(d,s,n);return}}this.database.setItemValue(e,t,i,s,o,!0,n)}batchSetItemValueByEditor(e,t=!0,i=!0){if(this.config.ENABLE_MERGE_CELL_LINK){const s=[];e.forEach(o=>{const n=this.database.getRowIndexForRowKey(o.rowKey),a=this.database.getColIndexForKey(o.key);if(n===void 0||a===void 0)return;const c=this.database.getVirtualBodyCell(n,a);if(c){const{dataList:d}=c.getSpanInfo(),f=d.map(u=>({...u,value:o.value}));s.push(...f)}}),this.database.batchSetItemValue(s,t,i)}else this.database.batchSetItemValue(e,t,i)}setFocusCell(e){var t;if(this.focusCell!==e){if(((t=this.focusCell)==null?void 0:t.rowKey)!==e.rowKey){this.currentCell=e,this.emit("rowFocusChange",e);const i={rowIndex:e.rowIndex,rowKey:e.rowKey,row:e.row};this.emit("currentRowChange",i)}this.focusCell=e,this.emit("cellFocusChange",e)}}clearSelector(){this.selector.enable=!1,this.selector.xArr=[-1,-1],this.selector.yArr=[-1,-1],this.emit("clearSelector")}clearSelectorCopy(){this.selector.xArrCopy=[-1,-1],this.selector.yArrCopy=[-1,-1]}clearAutofill(){this.autofill={enable:!1,xArr:[-1,-1],yArr:[-1,-1]}}getSelectedData(){const e=[],t=this.selector.yArr,i=this.selector.xArr;let s="";for(let o=0;o<=t[1]-t[0];o++){const n=[];for(let a=0;a<=i[1]-i[0];a++){const c=o+t[0],d=a+i[0],f=this.database.getVirtualBodyCell(c,d);f&&(f.selectorCellValueType==="displayText"?n.push(f.displayText):n.push(f.getValue()))}s+=`${n.join(" ")}\r`,e.push(n)}return s=s?s.replace(/\r$/,""):" ",{xArr:i,yArr:t,text:s,value:e}}setScroll(e,t){let i=Math.floor(e);const s=this.body.width-this.body.visibleWidth;i<0?i=0:i>s&&(i=s);let o=Math.floor(t),n=this.body.height-this.body.visibleHeight;this.config.FOOTER_FIXED||(n=this.body.height+this.footer.height-this.body.visibleHeight),o<0?o=0:o>n&&(o=n),this.emit("setScroll",i,o)}setScrollX(e){let t=Math.floor(e);const i=this.body.width-this.body.visibleWidth;t<0?t=0:t>i&&(t=i),this.emit("setScrollX",t)}setScrollY(e){let t=Math.floor(e),i=0;this.config.FOOTER_FIXED||(i=this.footer.height);const s=this.body.height-this.body.visibleHeight+i;t<0?t=0:t>s&&(t=s),this.emit("setScrollY",t)}startAdjustPosition(e){this.emit("startAdjustPosition",e)}stopAdjustPosition(){this.emit("stopAdjustPosition")}isTarget(e){return!!this.containerElement.contains(e.target)}getOffset(e){const{left:t,top:i}=this.containerElement.getBoundingClientRect();return{offsetX:e.clientX-t,offsetY:e.clientY-i}}hasEvent(e){return this.eventBus.has(e)}on(e,t){this.eventBus.on(e,t)}once(e,t){this.eventBus.once(e,t)}off(e,t){this.eventBus.off(e,t)}emit(e,...t){this.eventBus.emit(e,...t)}destroy(){this.eventTable.destroy(),this.eventBrowser.destroy(),this.eventBus.destroy()}}class $o{constructor(e,t){h(this,"ctx"),h(this,"type"),h(this,"isFocus",!1),h(this,"trackX",0),h(this,"trackY",0),h(this,"trackWidth",0),h(this,"trackHeight",0),h(this,"splitPoints",[]),h(this,"barX",0),h(this,"barY",0),h(this,"barWidth",0),h(this,"barHeight",0),h(this,"distance",0),h(this,"visibleDistance",0),h(this,"clientX",0),h(this,"clientY",0),h(this,"dragStart",0),h(this,"isDragging",!1),h(this,"scroll",0),this.ctx=e,this.type=t,this.type==="vertical"?this.scroll=this.ctx.scrollY:this.scroll=this.ctx.scrollX}onWheel(e){this.updateScroll(e)}onTouchmove(e){const{clientY:t,clientX:i}=e.touches[0],s=t-this.clientY,o=i-this.clientX;let n=0;this.type==="vertical"?(n=Math.max(0,Math.min(this.dragStart-s,this.distance)),this.hasScrollbar()&&!(n===0&&s>0||n===this.distance&&s<0)&&e.preventDefault()):this.type==="horizontal"&&(n=Math.max(0,Math.min(this.dragStart-o,this.distance))),this.scroll=n}onTouchstart(e){const{clientY:t,clientX:i}=e.touches[0];this.clientX=i,this.clientY=t,this.dragStart=this.scroll}onMouseDown(e){if(!(e.target instanceof Element)||!this.ctx.isTarget(e))return;if(this.ctx.stageElement.style.cursor==="row-resize"||this.ctx.stageElement.style.cursor==="col-resize")return!0;const{offsetX:t,offsetY:i,clientX:s,clientY:o}=e;if(!(s==this.clientX&&o==this.clientY)){if(this.isOnScrollbar(t,i))this.clientX=s,this.clientY=o,this.isDragging=!0,this.ctx.scrollerMove=!0,this.isFocus=!0,this.dragStart=this.scroll,e.preventDefault();else if(this.isOnTrack(t,i)){let n=0;this.type==="vertical"?n=(i-this.ctx.header.height-this.barHeight/2)/(this.visibleDistance-this.barHeight)*this.distance:n=(t-this.barWidth/2)/(this.visibleDistance-this.barWidth)*this.distance,this.scroll=Math.max(0,Math.min(n,this.distance))}}}onMouseUp(){this.isDragging=!1,this.isFocus=!1,this.clientX=0,this.clientY=0}onMouseMove(e){const{offsetX:t,offsetY:i,clientX:s,clientY:o,buttons:n}=e;if(this.isOnScrollbar(t,i)&&e.target===this.ctx.canvasElement?this.isFocus=!0:this.isFocus=!1,n===0||s==this.clientX&&o==this.clientY)return;let a=0;if(this.type==="horizontal"?a=s-this.clientX:a=o-this.clientY,this.isDragging&&a!==0){let c=0;this.type==="vertical"?c=this.dragStart+a/(this.visibleDistance-this.barHeight)*this.distance:c=this.dragStart+a/(this.visibleDistance-this.barWidth)*this.distance,this.scroll=Math.max(0,Math.min(c,this.distance))}}isPointInElement(e,t,i,s,o,n){return e>=i&&e<=i+o&&t>=s&&t<=s+n}hasScrollbar(){return this.type==="vertical"?this.barHeight>0:this.type==="horizontal"?this.barWidth>0:!1}isOnScrollbar(e,t){return this.isPointInElement(e,t,this.barX,this.barY,this.barWidth,this.barHeight)}isOnTrack(e,t){return this.isPointInElement(e,t,this.trackX,this.trackY,this.trackWidth,this.trackHeight)}updateScroll(e){const t=e.deltaX,i=e.deltaY;this.type==="vertical"&&e.shiftKey===!1?(this.hasScrollbar()&&!(this.scroll===0&&i<0||this.scroll===this.distance&&i>0)&&e.preventDefault(),this.scroll=Math.max(0,Math.min(this.scroll+i,this.distance))):this.type==="horizontal"&&(e.shiftKey?this.scroll=Math.max(0,Math.min(this.scroll+i,this.distance)):this.scroll=Math.max(0,Math.min(this.scroll+t,this.distance)))}updatedSize(){const{body:e,header:t,stageHeight:i,stageWidth:s,config:{SCROLLER_TRACK_SIZE:o=0,SCROLLER_SIZE:n=0,BORDER:a}}=this.ctx,c=s,d=i,f=t.height,u=t.width,g=e.height,m=this.ctx.footer.height;if(this.type==="vertical"){this.visibleDistance=d-o-f,this.distance=g-this.visibleDistance+m,this.trackX=c-o,this.trackY=0,this.splitPoints=[this.trackX,f,this.trackX+o,f],this.trackWidth=o,this.trackHeight=d,this.barX=this.trackX-1+(o-n)/2,this.barWidth=n;const x=this.distance?this.visibleDistance/(g+m):0;let v=Math.floor(x*this.visibleDistance);v<30?v=30:v>this.visibleDistance&&(v=0),this.barHeight=v,this.barY=f+this.scroll/this.distance*(this.visibleDistance-this.barHeight),this.scroll=Math.max(0,Math.min(this.scroll,this.distance))}else{this.visibleDistance=c-o,this.distance=u-this.visibleDistance,this.splitPoints=[c-o,d-o,c-o,d];const x=a?0:.5;this.trackX=0,this.trackY=d-o+x,this.trackWidth=c,this.trackHeight=o;const v=this.distance?this.visibleDistance/u:0;let p=Math.floor(v*this.visibleDistance);this.barY=this.trackY-1+(o-n)/2,p<30?p=30:p>=this.visibleDistance&&(p=0),this.barWidth=p,this.barHeight=n,this.barX=this.scroll/this.distance*(this.visibleDistance-this.barWidth),this.scroll=Math.max(0,Math.min(this.scroll,this.distance))}}draw(){const{config:{SCROLLER_FOCUS_COLOR:e,SCROLLER_COLOR:t,BORDER_COLOR:i,BORDER:s,SCROLLER_TRACK_COLOR:o}}=this.ctx;this.updatedSize();let n=i;s||(n="transparent"),this.ctx.paint.drawRect(this.trackX,this.trackY,this.trackWidth,this.trackHeight,{borderColor:n,fillColor:o}),this.ctx.paint.drawRect(this.barX,this.barY,this.barWidth,this.barHeight,{fillColor:this.isFocus||this.isDragging?e:t,radius:4}),this.splitPoints.length>0&&this.ctx.paint.drawLine(this.splitPoints,{borderColor:n,borderWidth:1}),this.ctx.scrollerFocus=this.isFocus}}class PC{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 $o(e,"vertical"),this.horizontalScrollbar=new $o(e,"horizontal"),this.ctx.on("wheel",t=>this.onWheel(t)),this.ctx.on("mousedown",t=>this.onMouseDown(t)),this.ctx.on("mousemove",t=>this.onMouseMove(t)),this.ctx.on("mouseup",()=>this.onMouseUp()),this.ctx.on("touchmove",t=>this.onTouchmove(t)),this.ctx.on("touchstart",t=>{this.onTouchstart(t)}),this.ctx.on("setScroll",(t,i)=>{this.setScroll(t,i)}),this.ctx.on("setScrollX",t=>{this.setScrollX(t)}),this.ctx.on("setScrollY",t=>{this.setScrollY(t)}),this.ctx.on("scrollToIndex",(t,i)=>{this.scrollToIndex(t,i)}),this.ctx.on("cellHeaderMousedown",()=>{this.mousedownHeader=!0}),this.ctx.on("startAdjustPosition",t=>{this.startAdjustPosition(t)}),this.ctx.on("stopAdjustPosition",()=>{this.stopAdjustPosition()})}onWheel(e){this.verticalScrollbar.onWheel(e),this.horizontalScrollbar.onWheel(e),this.draw()}onTouchmove(e){this.verticalScrollbar.onTouchmove(e),this.horizontalScrollbar.onTouchmove(e),this.draw()}onTouchstart(e){this.verticalScrollbar.onTouchstart(e),this.horizontalScrollbar.onTouchstart(e),this.draw()}onMouseDown(e){this.verticalScrollbar.onMouseDown(e),this.horizontalScrollbar.onMouseDown(e),this.draw()}onMouseMove(e){this.verticalScrollbar.onMouseMove(e),this.horizontalScrollbar.onMouseMove(e),this.draw()}onMouseUp(){this.mousedownHeader=!1,this.verticalScrollbar.onMouseUp(),this.horizontalScrollbar.onMouseUp(),this.ctx.scrollerMove=!1}draw(){this.verticalScrollbar.draw(),this.horizontalScrollbar.draw();const e=Math.floor(this.horizontalScrollbar.scroll),t=Math.floor(this.verticalScrollbar.scroll);(e!==this.ctx.scrollX||t!==this.ctx.scrollY)&&(this.ctx.emit("onScroll",e,t),e!==this.ctx.scrollX&&this.ctx.emit("onScrollX",e),t!==this.ctx.scrollY&&this.ctx.emit("onScrollY",t),this.ctx.scrollX=e,this.ctx.scrollY=t,this.ctx.emit("draw"))}setScroll(e,t){this.horizontalScrollbar.scroll=e,this.verticalScrollbar.scroll=t,this.ctx.emit("draw"),this.ctx.emit("onScroll",e,t)}setScrollX(e){this.horizontalScrollbar.scroll=e,this.ctx.emit("draw")}setScrollY(e){this.verticalScrollbar.scroll=e,this.ctx.emit("draw")}scrollToColkey(e){const{header:t}=this.ctx,i=t.leafCellHeaders.find(s=>s.key===e);i&&this.setScrollX(i.x-t.visibleWidth/2)}scrollToColIndex(e){const{header:t}=this.ctx,i=t.leafCellHeaders.find(s=>s.colIndex===e);i&&this.setScrollX(i.x-t.visibleWidth/2)}scrollToRowIndex(e){const{body:t,database:i}=this.ctx,{top:s}=i.getPositionForRowIndex(e);this.setScrollY(s-t.visibleHeight/2)}scrollToIndex(e,t){this.scrollToRowIndex(e),this.scrollToColIndex(t)}scrollToRowKey(e){const{body:t,database:i}=this.ctx,s=i.getRowIndexForRowKey(e);if(s===void 0)return;const{top:o}=i.getPositionForRowIndex(s);this.setScrollY(o-t.visibleHeight/2)}startAdjustPosition(e){var t,i;const{offsetX:s,offsetY:o}=this.ctx.getOffset(e);let n="",a="";if(((t=this.ctx.focusCell)==null?void 0:t.fixed)!=="left"&&s<this.ctx.fixedLeftWidth?n="left":((i=this.ctx.focusCell)==null?void 0:i.fixed)!=="right"&&s>this.ctx.body.visibleWidth-this.ctx.fixedRightWidth?n="right":(n="",this.stopAdjustPosition(!0,!1)),!this.mousedownHeader&&o<this.ctx.header.visibleHeight?a="top":o>this.ctx.header.visibleHeight+this.ctx.body.visibleHeight?a="bottom":(a="",this.stopAdjustPosition(!1,!0)),n&&this.adjustPositionX!==n){this.adjustPositionX=n;let c=10*(n==="left"?-1:1);this.timerX&&(clearInterval(this.timerX),this.timerX=0),this.timerX=setInterval(()=>{c*=1.5;const{scrollX:d}=this.ctx,f=d+c;(f<0||f>this.ctx.body.width)&&(clearInterval(this.timerX),this.timerX=0),this.ctx.setScrollX(f)},100)}if(a&&this.adjustPositionY!==a){this.adjustPositionY=a;let c=10*(a==="top"?-1:1);this.timerY&&(clearInterval(this.timerY),this.timerY=0),this.timerY=setInterval(()=>{c*=1.5;const{scrollY:d}=this.ctx,f=d+c;(f<0||f>this.ctx.body.height)&&(clearInterval(this.timerY),this.timerY=0),this.ctx.setScrollY(f)},100)}}stopAdjustPosition(e=!0,t=!0){e&&(this.adjustPositionX="",this.timerX&&(clearInterval(this.timerX),this.timerX=0)),t&&(this.adjustPositionY="",this.timerY&&(clearInterval(this.timerY),this.timerY=0))}}class YC{constructor(e,t){h(this,"root"),h(this,"key"),h(this,"childrenKey"),this.root=e,this.key=(t==null?void 0:t.key)||"key",this.childrenKey=(t==null?void 0:t.childrenKey)||"children"}getTree(){return this.root}treeMove(e,t,i){const s=this.findNodeWithParent(this.root,e[this.key]);if(!s)throw new Error("Source node not found");const{parent:o,index:n,node:a}=s;if(o){const u=o[this.childrenKey];u.splice(n,1),u.length===0&&delete o[this.childrenKey]}else this.root.splice(n,1);const c=this.findNodeWithParent(this.root,t[this.key]);if(!c)throw new Error("Target node not found");const{parent:d,index:f}=c;i==="before"?d?d[this.childrenKey].splice(f,0,a):this.root.splice(f,0,a):i==="after"&&(d?d[this.childrenKey].splice(f+1,0,a):this.root.splice(f+1,0,a))}findNodeWithParent(e,t,i=null){for(let s=0;s<e.length;s++){const o=e[s];if(o[this.key]===t)return{parent:i,index:s,node:o};if(o[this.childrenKey]){const n=this.findNodeWithParent(o[this.childrenKey],t,o);if(n)return n}}return null}}class VC{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",Nr(()=>{this.init(),this.ctx.clearSelector(),this.ctx.emit("draw")},100)),this.init(),this.initResizeColumn(),this.initDragColumn()}init(e=!1){const{config:{HEADER_HEIGHT:t,SCROLLER_TRACK_SIZE:i}}=this.ctx;if(!e){const u=this.ctx.database.getColumns();this.columns=u}this.allCellHeaders=[],this.leafCellHeaders=[],this.fixedLeftCellHeaders=[],this.fixedRightCellHeaders=[],this.centerCellHeaders=[],this.visibleColumns=za(this.columns);const s=vi(this.visibleColumns),o=Ht(this.visibleColumns);this.height=t*s,this.visibleHeight=this.height,this.width=o.reduce((u,g)=>{const m=g.width||100,{maxWidth:x,minWidth:v}=g;return x&&m>x?u+x:v&&m<v?u+v:u+m},0),this.columnIndex=0,this.resizeNum=0;const n=bC(mi(this.visibleColumns,s));this.render(n,0),this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);const a=this.ctx.containerElement.getBoundingClientRect();this.resizeNum>0?this.ctx.stageWidth=Math.floor(a.width):this.ctx.stageWidth=Math.min(Math.floor(this.width+i),Math.floor(a.width)),this.ctx.stageElement.style.width=this.ctx.stageWidth+"px",this.visibleWidth=this.ctx.stageWidth-i;const c=this.visibleWidth-this.width;if(this.resizeNum&&c>0){const u=Math.floor(c/this.resizeNum*100)/100;this.resizeAllColumn(u)}const d=this.fixedLeftCellHeaders.filter(u=>!u.hasChildren);this.ctx.fixedLeftWidth=d.reduce((u,g)=>u+g.width,0);const f=this.fixedRightCellHeaders.filter(u=>!u.hasChildren);this.ctx.fixedRightWidth=f.reduce((u,g)=>u+g.width,i),this.ctx.maxColIndex=this.leafCellHeaders.length-1,this.ctx.header.x=this.x,this.ctx.header.y=this.y,this.ctx.header.width=this.width,this.ctx.header.height=this.height,this.ctx.header.allCellHeaders=this.allCellHeaders,this.ctx.header.visibleWidth=this.visibleWidth,this.ctx.header.visibleHeight=this.visibleHeight}initResizeColumn(){this.ctx.on("mousedown",e=>{this.ctx.config.ENABLE_RESIZE_COLUMN&&this.ctx.isTarget(e)&&(this.clientX=e.clientX,this.resizeTarget?(this.isResizing=!0,this.ctx.columnResizing=!0):this.isResizing=!1,this.isMouseDown=!0)}),this.ctx.on("mouseup",()=>{this.ctx.config.ENABLE_RESIZE_COLUMN&&(this.isMouseDown=!1,this.resizeDiff!==0&&this.resizeTarget&&this.resizeColumn(this.resizeTarget,this.resizeDiff),this.resizeTarget=null,this.isResizing=!1,this.isMouseDown=!1,this.ctx.columnResizing=!1,this.clientX=0,this.resizeDiff=0)}),this.ctx.on("mousemove",e=>{if(!this.ctx.config.ENABLE_RESIZE_COLUMN||this.ctx.editing)return;const{stageWidth:t,config:{RESIZE_COLUMN_MIN_WIDTH:i}}=this.ctx;if(this.isResizing&&this.resizeTarget){const s=this.resizeTarget.width,o=this.resizeTarget.minWidth,n=this.resizeTarget.maxWidth;let a=e.clientX-this.clientX;a+s<i&&(a=-(s-i)),o&&a+s<o&&(a=-(s-o)),n&&a+s>n&&(a=n-s),this.resizeDiff=a,this.ctx.emit("draw")}else{if(this.resizeTarget=null,this.isMouseDown)return;if(e.offsetX<0||e.offsetX>this.visibleWidth){this.ctx.stageElement.style.cursor==="col-resize"&&(this.ctx.stageElement.style.cursor="default");return}this.ctx.stageElement.style.cursor==="col-resize"&&(this.ctx.stageElement.style.cursor="default");const s=[...this.renderFixedCellHeaders,...this.renderCenterCellHeaders];for(const o of s){const{offsetX:n,offsetY:a}=this.ctx.getOffset(e),c=n,d=a,f=o.getDrawX(),u=o.getDrawY();if(c>f+o.width-5&&c<f+o.width+4&&c<t-4&&d>u){const g=o.colIndex+o.colspan-1,m=this.leafCellHeaders.find(x=>x.colIndex===g);if(!m||!m.fixed&&this.ctx.stageWidth-this.ctx.fixedRightWidth<f+o.width)return;this.ctx.isTarget(e)&&a<=this.height&&(this.ctx.stageElement.style.cursor="col-resize",this.resizeTarget=m)}}}})}initDragColumn(){this.ctx.on("cellHeaderMousedown",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(e.column.dragDisabled||(this.dragTarget===e?(this.ctx.dragHeaderIng=!0,this.dragCellDiff=this.ctx.mouseX-e.drawX,this.ctx.stageElement.style.cursor="grabbing"):(this.dragTarget=e,this.ctx.dragHeaderIng=!1)))}),this.ctx.on("cellMousedown",()=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(this.dragTarget=null,this.ctx.dragHeaderIng=!1)}),this.ctx.on("mouseup",()=>{if(this.ctx.config.ENABLE_DRAG_COLUMN){if(this.dragingCell&&this.dragTarget){const e=(d,f={})=>(d.forEach((u,g)=>{u.children&&e(u.children,f),f[u.key]=g}),f),t=this.ctx.database.getColumns(),i=mi(t,vi(t)),s=new YC(i,{key:"key",childrenKey:"children"}),o=this.dragTarget.colIndex>this.dragingCell.colIndex?"before":"after";s.treeMove(this.dragTarget.column,this.dragingCell.column,o);const n=s.getTree(),a=e(n);this.ctx.database.setCustomHeader({sortData:a}),this.init();const c={source:this.dragTarget,target:this.dragingCell,columns:i};this.ctx.emit("columnDragChange",c)}this.ctx.dragHeaderIng&&this.dragTarget&&(this.ctx.dragHeaderIng=!1,this.dragTarget=null,this.dragingCell=void 0,this.dragCellDiff=0,this.ctx.clearSelector(),this.ctx.focusCellHeader=void 0,this.ctx.stageElement.style.cursor="default",this.ctx.emit("draw"))}}),this.ctx.on("mousemove",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(!this.ctx.dragHeaderIng||!this.dragTarget||(this.dragTarget.fixed||this.ctx.startAdjustPosition(e),this.ctx.emit("draw")))}),this.ctx.on("cellHoverChange",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(e.column.dragDisabled||(this.dragingCell=this.getDragCellHeader(e.colIndex)))}),this.ctx.on("cellHeaderHoverChange",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(e.column.dragDisabled||(this.dragingCell=this.getDragCellHeader(e.colIndex)))})}getDragCellHeader(e){if(!this.dragTarget||!this.ctx.dragHeaderIng)return;const{column:{parentKey:t},key:i,level:s,fixed:o}=this.dragTarget,n=this.allCellHeaders.find(a=>a.key!==i&&a.fixed===o&&a.column.level===s&&a.column.parentKey===t&&a.colIndex<=e&&a.colIndex+a.colspan-1>=e);if(this.ctx.dragHeaderIng){const a=n?"grabbing":"not-allowed";this.ctx.stageElement.style.cursor=a}return n}resizeColumn(e,t){const i=n=>{n.forEach(a=>{if(a.children&&a.children.length>0&&i(a.children),a.key===e.key){const c=a.width||100;a.width=c+t}})};i(this.columns);let s=0;if(this.width<this.visibleWidth){const n=this.visibleWidth-this.width;s=Math.floor(n/this.resizeNum*100)/100,this.resizeAllColumn(s)}const o=e.width+t+s;this.ctx.emit("resizeColumnChange",{colIndex:e.colIndex,key:e.key,oldWidth:e.width,width:o,column:e.column,columns:this.columns}),this.ctx.database.setCustomHeaderResizableData(e.key,o),this.init(!0),this.ctx.emit("draw")}resizeAllColumn(e){if(e===0)return;const t=new Map;let i=!0;for(const o of this.allCellHeaders)if(o.widthFillDisable)t.set(o.key,o.width);else{const n=o.width+e*o.colspan;t.set(o.key,n),n<this.ctx.config.RESIZE_COLUMN_MIN_WIDTH&&(i=!1)}if(!i)return;const s=o=>{o.forEach(n=>{t.has(n.key)&&(n.width=t.get(n.key)),n.children&&n.children.length>0&&s(n.children)})};s(this.columns),this.init(!0),this.ctx.emit("draw")}getCustomHeader(){const e=this.ctx.database.getColumns(),t=this.ctx.database.getCustomHeader(),{sortData:i={}}=t;return Object.keys(i).length===0?{columns:e,customHeader:t}:{columns:mi(e,vi(e)),customHeader:t}}render(e,t){const i=e.length;let s=t;const{HEADER_HEIGHT:o=0}=this.ctx.config;for(let n=0;n<i;n++){const a=e[n],c=o*(a.rowspan||0),d=o*(a.level||0);let{minWidth:f,maxWidth:u}=a,g=a.width||100;f&&g<f&&(g=f),u&&g>u&&(g=u),a.children&&(g=Ht(a.children).reduce((x,v)=>x+((v==null?void 0:v.width)||100),0));const m=new dr(this.ctx,this.columnIndex,s,d,g,c,a);this.ctx.database.setHeader(a.key,m),this.allCellHeaders.push(m),a.children||(this.leafCellHeaders.push(m),m.column.widthFillDisable||this.resizeNum++),a.fixed==="left"?this.fixedLeftCellHeaders.push(m):a.fixed==="right"?this.fixedRightCellHeaders.push(m):this.centerCellHeaders.push(m),!a.children&&this.columnIndex++,a.children&&this.render(a.children,s),s+=g}}drawTipLine(){if(this.isResizing&&this.resizeTarget){const{stageHeight:e,config:{RESIZE_COLUMN_LINE_COLOR:t,RESIZE_COLUMN_TEXT_COLOR:i,RESIZE_COLUMN_TEXT_BG_COLOR:s,ENABLE_RESIZE_COLUMN_TEXT:o}}=this.ctx,n=this.resizeTarget.getDrawX(),a=this.resizeTarget.width,c=n+a+this.resizeDiff-.5,d=[c-.5,0,c-.5,e];if(this.ctx.paint.drawLine(d,{borderColor:t}),o){const f=`${Math.floor(a+this.resizeDiff)}px`,u=45,g=24;this.ctx.paint.drawRect(c+u/2,this.ctx.mouseY-g/2,u,g,{fillColor:s,borderWidth:0,borderColor:"transparent"}),this.ctx.paint.drawText(f,c+u/2,this.ctx.mouseY-g/2,u,g+2,{padding:0,color:i,align:"center",verticalAlign:"middle"})}}}drawDragTip(){if(this.dragTarget&&this.ctx.dragHeaderIng){const{DRAG_TIP_BG_COLOR:e,DRAG_TIP_LINE_COLOR:t}=this.ctx.config,i=this.dragTarget.width;if(this.ctx.paint.drawRect(this.ctx.mouseX-this.dragCellDiff,this.visibleHeight,i,this.ctx.body.visibleHeight,{fillColor:e,borderWidth:0,borderColor:"transparent"}),this.dragingCell){const{drawX:s,drawY:o,visibleWidth:n,colIndex:a}=this.dragingCell;let c=s,d=o;a>this.dragTarget.colIndex&&(c=s+n),a===0&&(c=c+1),a===this.ctx.maxColIndex&&(c=c-1);const f=[c,d,c,this.ctx.stageHeight],u=[c-4,d,c+4,d,c,d+6,c-4,d];this.ctx.paint.drawLine(u,{borderColor:t,borderWidth:1.2,fillColor:t}),this.ctx.paint.drawLine(f,{borderColor:t,borderWidth:1.2})}}}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:i,header:s,stageWidth:o,config:{HEADER_BG_COLOR:n,SCROLLER_TRACK_SIZE:a}}=this.ctx;if(i>0&&e!==0&&this.ctx.paint.drawShadow(this.x,this.y,e,this.height,{fillColor:n,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),i<Math.floor(s.width-o-1)&&t!==a){const c=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(c,this.y,t,this.height,{fillColor:n,side:"left",shadowWidth:4,colorStart:"rgba(0,0,0,0)",colorEnd:"rgba(0,0,0,0.1)"})}}update(){const e=[],t=[],i=[];if(this.centerCellHeaders.length){const s=this.centerCellHeaders[this.centerCellHeaders.length-1];this.ctx.lastCenterColIndex=s.colIndex}this.centerCellHeaders.forEach(s=>{s.isHorizontalVisible()&&s.isVerticalVisible()&&(t.push(s),s.hasChildren||e.push(s))}),this.fixedLeftCellHeaders.forEach(s=>{i.push(s),s.hasChildren||e.push(s)}),this.fixedRightCellHeaders.forEach(s=>{i.push(s),s.hasChildren||e.push(s)}),this.renderCenterCellHeaders=t,this.renderFixedCellHeaders=i,this.renderLeafCellHeaders=e.sort((s,o)=>s.x-o.x),this.visibleLeafColumns=this.renderLeafCellHeaders.map(s=>s.column),this.ctx.header.visibleLeafColumns=this.visibleLeafColumns,this.ctx.header.leafCellHeaders=this.leafCellHeaders,this.ctx.header.renderLeafCellHeaders=this.renderLeafCellHeaders,this.ctx.header.renderCellHeaders=this.renderFixedCellHeaders.concat(this.renderCenterCellHeaders)}drawBottomLine(){const{stageWidth:e,config:{BORDER_COLOR:t}}=this.ctx,i=[0,this.height,e,this.height];this.ctx.paint.drawLine(i,{borderColor:t,borderWidth:1})}draw(){this.renderCenterCellHeaders.forEach(e=>{e.update(),e.draw()}),this.drawFixedShadow(),this.renderFixedCellHeaders.forEach(e=>{e.update(),e.draw()}),this.drawBottomLine(),this.drawTipLine(),this.drawDragTip()}}class Ja{constructor(e,t,i=0,s=0,o=0,n=0,a,c="body"){h(this,"ctx"),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height"),h(this,"cells",[]),h(this,"fixedCells",[]),h(this,"noFixedCells",[]),h(this,"calculatedHeightCells",[]),h(this,"rowIndex",0),h(this,"rowKey",""),h(this,"rowType","body"),h(this,"data"),h(this,"calculatedHeight",-1),this.ctx=e,this.x=i,this.y=s,this.width=o,this.height=n,this.rowIndex=t,this.rowKey=e.database.getRowKeyForRowIndex(t)||"",this.rowType=c,this.data=a,this.update()}update(){const{header:e}=this.ctx,t=[],i=[],s=[],o=[];e.renderLeafCellHeaders.forEach(n=>{const a=new Br(this.ctx,this.rowIndex,n.colIndex,n.x,this.y,n.width,this.height,n.column,this.data,this.rowType);a.fixed?i.push(a):s.push(a),t.push(a),a.autoRowHeight&&o.push(a)}),this.cells=t,this.calculatedHeightCells=o,this.fixedCells=i,this.noFixedCells=s}updateCalculatedHeight(){const e=this.calculatedHeightCells.map(t=>{const i=t.getAutoHeight(),{key:s,height:o=-1}=this.ctx.database.getMaxRowHeightItem(this.rowKey)||{};return i>o?this.ctx.database.setMaxRowHeightItem(this.rowKey,t.key,i):i!==0&&t.key===s&&i<o&&this.ctx.database.setMaxRowHeightItem(this.rowKey,t.key,i),i});return this.calculatedHeight=e.length?Math.max(...e):-1,this.calculatedHeight}drawCenter(){this.noFixedCells.forEach(e=>{e.draw()})}drawFixed(){this.fixedCells.forEach(e=>{e.draw()})}drawContainer(){this.noFixedCells.forEach(e=>{e.drawContainer()})}drawFixedContainer(){this.fixedCells.forEach(e=>{e.drawContainer()})}}class WC{constructor(e){h(this,"resizeTarget",null),h(this,"isMouseDown",!1),h(this,"resizeDiff",0),h(this,"clientY",0),h(this,"ctx"),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"headIndex",0),h(this,"tailIndex",0),h(this,"isResizing",!1),h(this,"renderRows",[]),h(this,"visibleRows",[]),h(this,"visibleHeight",0),h(this,"visibleWidth",0),h(this,"containerRect"),h(this,"data",[]),this.ctx=e,this.init(),this.initResizeRow()}init(){const{canvasElement:e,header:t,footer:i,database:s,config:{FOOTER_FIXED:o,SCROLLER_TRACK_SIZE:n=0,HEIGHT:a,EMPTY_BODY_HEIGHT:c=0,MAX_HEIGHT:d=0,ENABLE_OFFSET_HEIGHT:f=0,OFFSET_HEIGHT:u=0,FOOTER_POSITION:g}}=this.ctx;if(!t.width)return;this.x=0,g==="top"&&o?this.y=t.height+i.height:this.y=t.height;const{data:m,sumHeight:x}=s.getData();this.height=x,this.data=m,this.width=t.width,this.visibleWidth=this.ctx.stageWidth-n;const v=this.ctx.footer.height;this.ctx.isEmpty=!this.data.length,!this.data.length&&!a?this.height=c:!this.data.length&&a&&(this.height=a-t.height-v-n);let p=this.height+t.height+n;p+=v;let E=p;const C=window.innerHeight,{top:w}=this.containerRect||this.ctx.containerElement.getBoundingClientRect();if(C>w&&f&&!a){const O=C-w-u;O>t.height+n?E=O:p>d&&(E=d)}else this.data.length&&a?E=a:this.data.length&&d&&p>d&&(E=d);E>0&&(this.ctx.stageHeight=Math.floor(E),this.ctx.stageElement.style.height=`${this.ctx.stageHeight}px`);let b=this.ctx.stageHeight-t.height-n;o?this.visibleHeight=b-v:this.visibleHeight=b,this.data.length||(this.height=this.visibleHeight),this.ctx.body.x=this.x,this.ctx.body.y=this.y,this.ctx.body.width=this.width,this.ctx.body.height=this.height,this.ctx.body.visibleWidth=this.visibleWidth,this.ctx.body.visibleHeight=this.visibleHeight,this.ctx.body.data=m;const T=window.devicePixelRatio||1,B=this.ctx.stageWidth*T,K=this.ctx.stageHeight*T;e.width=Math.round(B),e.height=Math.round(K);const R=this.data.length?"not-empty":"empty";this.ctx.emit("emptyChange",{isEmpty:R,type:R,headerHeight:t.height,bodyHeight:this.height,footerHeight:v,width:this.width,height:this.data.length?0:c+v});const I=Math.round(e.width/T*1e4)/1e4,_=Math.round(e.height/T*1e4)/1e4;this.ctx.canvasElement.setAttribute("style",`height:${_}px;width:${I}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:c,config:{RESIZE_ROW_MIN_HEIGHT:d=0}}=this.ctx;if(this.isResizing&&this.resizeTarget){const f=this.resizeTarget.height;let u=n-this.clientY;const{calculatedHeight:g}=this.resizeTarget,m=g===-1?d:g;u+f<m&&(u=-(f-m)),this.resizeDiff=u,this.ctx.emit("draw")}else{if(this.resizeTarget=null,this.isMouseDown)return;if(o<0||o>this.ctx.body.visibleWidth||s<0||s>this.ctx.header.visibleHeight+this.ctx.body.visibleHeight){this.ctx.stageElement.style.cursor==="row-resize"&&(this.ctx.stageElement.style.cursor="default");return}if(this.ctx.stageElement.style.cursor==="crosshair")return;this.ctx.stageElement.style.cursor==="row-resize"&&(this.ctx.stageElement.style.cursor="default");for(let f=0;f<this.renderRows.length;f++){const u=this.renderRows[f];if(s>u.y-c+u.height-1.5&&s<u.y-c+u.height+1.5&&s<a-4)for(let g=0;g<u.cells.length;g++){const m=u.cells[g];o>m.drawX+10&&o<m.drawX+m.width-10&&m.rowspan===1&&(this.ctx.stageElement.style.cursor="row-resize",this.resizeTarget=u)}}}})}resizeRow(e,t){const{rowIndex:i,height:s,rowKey:o,data:n}=e;this.ctx.database.setRowHeight(i,s+t),this.init(),this.ctx.emit("draw"),this.ctx.emit("resizeRowChange",{rowIndex:i,oldHeight:s,height:s+t,rowKey:o,row:n,data:this.data})}drawTipLine(){if(this.isResizing&&this.resizeTarget){const{stageWidth:e,scrollY:t,config:{RESIZE_ROW_LINE_COLOR:i}}=this.ctx,s=this.resizeTarget.y-t,o=this.resizeTarget.height,n=s+o+this.resizeDiff-.5,a=[0,n-.5,e,n-.5];this.ctx.paint.drawLine(a,{borderColor:i,borderWidth:1})}}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:i,header:s,stageWidth:o,config:{HEADER_BG_COLOR:n,SCROLLER_TRACK_SIZE:a}}=this.ctx;if(i>0&&e!==0&&!this.ctx.isEmpty&&this.ctx.paint.drawShadow(this.x,this.y,e,this.height,{fillColor:n,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),i<Math.floor(s.width-o-1)&&t!==a&&!this.ctx.isEmpty){const c=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(c,this.y,t,this.height,{fillColor:n,side:"left",shadowWidth:4,colorStart:"rgba(0,0,0,0)",colorEnd:"rgba(0,0,0,0.1)"})}}binarySearch(e,t){let i=0,s=e.length-1,o=-1;for(;i<=s;){let n=Math.floor((i+s)/2),a=e[n].bottom;if(a===t)return n;a<t?i=n+1:(o=n,s=n-1)}return o}update(){this.init();const{header:e,database:t,scrollY:i,config:{CELL_HEIGHT:s}}=this.ctx,o=i,{data:n,positions:a}=t.getData();this.ctx.maxRowIndex=n.length-1;let c=this.binarySearch(a,o),d=this.binarySearch(a,o+this.visibleHeight);if(d===-1&&(d=this.ctx.maxRowIndex),c===-1&&d===this.ctx.maxRowIndex){const u=Math.floor(this.visibleHeight/s);c=this.ctx.maxRowIndex-u}this.headIndex=Math.max(0,c),this.tailIndex=Math.min(this.ctx.maxRowIndex,d+1),this.visibleRows=n.slice(this.headIndex,this.tailIndex+1),this.ctx.body.headIndex=this.headIndex,this.ctx.body.tailIndex=this.tailIndex,this.ctx.body.visibleRows=this.visibleRows;const f=[];for(let u=0;u<this.visibleRows.length;u++){const g=this.headIndex+u,m=this.visibleRows[u],{height:x,top:v}=this.ctx.database.getPositionForRowIndex(g),p=new Ja(this.ctx,g,0,v+this.y,e.width,x,m);f.push(p)}this.renderRows=f,this.ctx.body.renderRows=f}updateAutoHeight(){const e=this.ctx.body.renderRows;if(!e.some(i=>i.calculatedHeightCells.length>0))return!1;e.forEach(i=>{i.updateCalculatedHeight()});const t=e.map(i=>({height:i.calculatedHeight,rowIndex:i.rowIndex}));return this.ctx.database.setBatchCalculatedRowHeight(t)}draw(){this.renderRows.forEach(e=>{e.drawContainer()}),this.renderRows.forEach(e=>{e.drawCenter()}),this.drawFixedShadow(),this.renderRows.forEach(e=>{e.drawFixedContainer()}),this.renderRows.forEach(e=>{e.drawFixed()}),this.drawTipLine()}}class XC{constructor(e){h(this,"ctx"),h(this,"renderRows",[]),h(this,"data",[]),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"visibleWidth",0),h(this,"visibleHeight",0),this.ctx=e,this.init()}init(){this.data=this.ctx.database.getFooterData();const{header:e,body:t,config:{CELL_FOOTER_HEIGHT:i,FOOTER_FIXED:s,SCROLLER_TRACK_SIZE:o,FOOTER_POSITION:n}}=this.ctx;this.width=e.width,this.visibleWidth=e.visibleWidth,this.height=this.data.reduce(a=>a+i,0),this.visibleHeight=this.height,s?n==="top"?this.y=this.ctx.header.height:this.y=this.ctx.stageHeight-this.height-o:this.y=t.y+t.height,this.ctx.footer.x=this.x,this.ctx.footer.y=this.y,this.ctx.footer.height=this.height,this.ctx.footer.width=this.width,this.ctx.footer.visibleWidth=this.visibleWidth,this.ctx.footer.visibleHeight=this.visibleHeight}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:i,header:s,stageWidth:o,config:{HEADER_BG_COLOR:n,SCROLLER_TRACK_SIZE:a}}=this.ctx;let c=this.y;if(this.ctx.config.FOOTER_FIXED||(c=this.y-this.ctx.scrollY),i>0&&e!==0&&this.ctx.paint.drawShadow(this.x,c,e,this.height,{fillColor:n,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),i<Math.floor(s.width-o-1)&&t!==a){const d=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(d,c,t,this.height,{fillColor:n,side:"left",shadowWidth:4,colorStart:"rgba(0,0,0,0)",colorEnd:"rgba(0,0,0,0.1)"})}}update(){this.init();const{CELL_FOOTER_HEIGHT:e}=this.ctx.config;let t=this.y;const i=[];this.data.forEach((s,o)=>{const n=new Ja(this.ctx,o,0,t,this.width,e,s,"footer");t+=e,i.push(n)}),this.renderRows=i,this.ctx.footer.renderRows=this.renderRows}drawTopLine(){const{stageWidth:e,config:{BORDER_COLOR:t}}=this.ctx,i=[0,this.y,e,this.y];this.ctx.paint.drawLine(i,{borderColor:t,borderWidth:1})}draw(){this.renderRows.forEach(e=>{e.drawContainer()}),this.renderRows.forEach(e=>{e.drawCenter()}),this.drawFixedShadow(),this.renderRows.forEach(e=>{e.drawFixedContainer()}),this.renderRows.forEach(e=>{e.drawFixed()}),this.drawTopLine()}}class zC{constructor(e){h(this,"isCut",!1),h(this,"isMultipleRow",!1),h(this,"ctx"),this.ctx=e,this.init()}init(){this.ctx.on("setMoveFocus",e=>{this.moveFocus(e)}),this.ctx.on("mousemove",Nr(e=>{var t,i;(t=this.ctx.focusCell)!=null&&t.fixed||(i=this.ctx.focusCellHeader)!=null&&i.fixed||!this.ctx.dragHeaderIng&&this.ctx.selectorMove&&this.ctx.startAdjustPosition(e)},100)),this.ctx.on("cellHoverChange",e=>{if(!this.ctx.autofillMove){if(e.operation){this.selectRows(e,!1);return}this.isMultipleRow||this.mouseenter()}}),this.ctx.on("cellMousedown",(e,t)=>{if(!(!this.ctx.isTarget(t)||this.ctx.stageElement.style.cursor==="pointer"||this.ctx.isPointer||this.ctx.stageElement.style.cursor==="crosshair")){if(e.operation){this.isMultipleRow=!0,this.selectRows(e);return}window.getComputedStyle(t.target).userSelect!=="text"&&t.preventDefault(),this.isMultipleRow=!1,this.click(t.shiftKey),this.ctx.emit("selectorClick",e)}}),this.ctx.on("mouseup",()=>{this.ctx.selectorMove=!1,this.ctx.stopAdjustPosition(),this.ctx.adjustPositioning=!1,this.ctx.disableHoverIconClick=!1}),this.ctx.on("cellHeaderHoverChange",e=>{this.ctx.mousedown&&this.selectCols(e)}),this.ctx.on("cellHoverChange",e=>{this.ctx.mousedown&&this.selectCols(e)}),this.ctx.on("cellHeaderMousedown",(e,t)=>{this.ctx.stageElement.style.cursor==="pointer"||this.ctx.isPointer||(window.getComputedStyle(t.target).userSelect!=="text"&&t.preventDefault(),this.ctx.clearSelector(),e.operation?this.selectAll():this.selectCols(e))}),this.ctx.on("keydown",e=>{if(!this.ctx.editing&&!this.ctx.finding){if(e.ctrlKey&&e.code==="KeyV"||e.metaKey&&e.code==="KeyV"){this.paste();return}if(e.ctrlKey&&e.code==="KeyC"||e.metaKey&&e.code==="KeyC"){this.copy(),this.isCut=!1;return}if(e.ctrlKey&&e.code==="KeyX"||e.metaKey&&e.code==="KeyX"){this.isCut=!0,this.copy();return}if((e.ctrlKey&&e.code==="KeyA"||e.metaKey&&e.code==="KeyA")&&(e.preventDefault(),this.selectAll()),e.code==="ArrowLeft"||e.shiftKey&&e.code==="Tab"){e.preventDefault(),this.moveFocus("LEFT");return}if(e.code==="ArrowUp"){e.preventDefault(),this.moveFocus("TOP");return}if(e.code==="ArrowRight"||e.code==="Tab"){e.preventDefault(),this.moveFocus("RIGHT");return}if(e.code==="ArrowDown"){e.preventDefault(),this.moveFocus("BOTTOM");return}if(e.code==="Delete"||e.code==="Backspace"){e.preventDefault();const{xArr:t,yArr:i}=this.ctx.selector;this.clearSelectedData(t,i);return}}}),this.ctx.on("contextMenuClearSelected",()=>{const{xArr:e,yArr:t}=this.ctx.selector;this.clearSelectedData(e,t)}),this.ctx.on("contextMenuCopy",()=>{this.copy()}),this.ctx.on("contextMenuPaste",()=>{this.paste()}),this.ctx.on("contextMenuCut",()=>{this.isCut=!0,this.copy()}),this.ctx.on("setSelectorCell",e=>{this.ctx.setFocusCell(e),this.click()}),this.ctx.on("selectCols",e=>{this.selectCols(e)})}setSelector(e,t){if(this.ctx.dragHeaderIng)return;const{ENABLE_SELECTOR_SPAN_COL:i,ENABLE_SELECTOR_SPAN_ROW:s}=this.ctx.config;let o=e,n=t;if(!s){const[a]=n;n=[a,a]}if(!i){const[a]=o;o=[a,a]}if(JSON.stringify(this.ctx.selector.xArr)!==JSON.stringify(o)||JSON.stringify(this.ctx.selector.yArr)!==JSON.stringify(n)){this.ctx.mousedown&&(this.ctx.selectorMove=!0,this.ctx.disableHoverIconClick=!0),this.ctx.selector.enable=!0;const{SELECTOR_AREA_MIN_X:a,SELECTOR_AREA_MAX_X:c,SELECTOR_AREA_MIN_Y:d,SELECTOR_AREA_MAX_Y:f,SELECTOR_AREA_MAX_X_OFFSET:u,SELECTOR_AREA_MAX_Y_OFFSET:g}=this.ctx.config,m=a,x=c||this.ctx.maxColIndex-u,v=d,p=f||this.ctx.maxRowIndex-g;let[E,C]=o,[w,b]=n;if(E<m||C>x||w<v||b>p)return;if(this.ctx.config.ENABLE_MERGE_CELL_LINK){const B=this.adjustMergeCells(o,n);w=B.yArr[0],b=B.yArr[1],E=B.xArr[0],C=B.xArr[1],this.ctx.onlyMergeCell=B.onlyMergeCell}E===C&&w===b?this.ctx.selectOnlyOne=!0:this.ctx.selectOnlyOne=!1,o=[Math.max(m,E),Math.min(x,C)],n=[Math.max(v,w),Math.min(p,b)];const{BEFORE_SET_SELECTOR_METHOD:T}=this.ctx.config;if(typeof T=="function"){const B=T({focusCell:this.ctx.focusCell,xArr:o,yArr:n});if(!B)return;o=B.xArr,n=B.yArr}this.ctx.selector.xArr=o,this.ctx.selector.yArr=n,b===this.ctx.maxRowIndex&&w===0?this.ctx.selectColsIng=!0:this.ctx.selectColsIng=!1,C===this.ctx.maxColIndex&&E===0?this.ctx.selectRowsIng=!0:this.ctx.selectRowsIng=!1,this.ctx.emit("setSelector",this.ctx.selector),this.ctx.emit("drawView")}}adjustMergeCells(e,t){var i;const[s,o]=t,[n,a]=e;if(o===this.ctx.maxRowIndex&&s===0||a===this.ctx.maxColIndex&&n===0)return{xArr:e,yArr:t,onlyMergeCell:!1};let c=[],d=[];for(let v=0;v<=t[1]-t[0];v++)for(let p=0;p<=e[1]-e[0];p++){const E=v+t[0],C=p+e[0],w=this.ctx.database.getVirtualBodyCell(E,C);w&&((E===s||E===o)&&c.push(w),(C===n||C===a)&&d.push(w))}const f=c.reduce((v,p)=>{const{yArr:E}=p.getSpanInfo(),[C,w]=E;return v.minY=Math.min(v.minY,C),v.maxY=Math.max(v.maxY,w),v},{minY:s,maxY:o}),u=d.reduce((v,p)=>{const{xArr:E}=p.getSpanInfo(),[C,w]=E;return v.minX=Math.min(v.minX,C),v.maxX=Math.max(v.maxX,w),v},{minX:n,maxX:a}),g=[u.minX,u.maxX],m=[f.minY,f.maxY];let x=!1;if(u.minX!==u.maxX||f.minY!==f.maxY){const v=JSON.stringify(g)+JSON.stringify(m),p=(i=this.ctx.focusCell)==null?void 0:i.getSpanInfo();x=(p&&JSON.stringify(p.xArr)+JSON.stringify(p.yArr))===v}return{xArr:g,yArr:m,onlyMergeCell:x}}selectCols(e){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||!this.ctx.config.ENABLE_SELECTOR_ALL_ROWS||this.ctx.autofillMove||this.ctx.columnResizing||this.ctx.editing)return;const{SELECTOR_AREA_MIN_Y:t,SELECTOR_AREA_MAX_Y:i,SELECTOR_AREA_MAX_Y_OFFSET:s}=this.ctx.config,o=t,n=i||this.ctx.maxRowIndex-s;if(this.ctx.focusCellHeader){const{colIndex:a}=this.ctx.focusCellHeader;if(this.ctx.clearSelector(),this.ctx.mousedown&&e.colIndex>=a){const c=[a,e.colIndex+e.colspan-1],d=[o,n];this.setSelector(c,d)}else{const c=[e.colIndex,a+e.colspan-1],d=[o,n];this.setSelector(c,d)}}}selectAll(){if(this.ctx.autofillMove||this.ctx.editing)return;const{ENABLE_SELECTOR_ALL_ROWS:e,ENABLE_SELECTOR_ALL_COLS:t}=this.ctx.config;if(e&&t){const{SELECTOR_AREA_MIN_X:i,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MIN_Y:o,SELECTOR_AREA_MAX_Y:n,SELECTOR_AREA_MAX_X_OFFSET:a,SELECTOR_AREA_MAX_Y_OFFSET:c}=this.ctx.config,d=i,f=s||this.ctx.maxColIndex-a,u=o,g=n||this.ctx.maxRowIndex-c,m=[d,f],x=[u,g];this.setSelector(m,x)}}selectRows(e,t=!0){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||!this.ctx.config.ENABLE_SELECTOR_ALL_COLS||this.ctx.autofillMove||this.ctx.editing)return;const{SELECTOR_AREA_MIN_X:i,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MAX_X_OFFSET:o}=this.ctx.config,n=s||this.ctx.maxColIndex-o,a=i;if(t){this.ctx.setFocusCell(e);const c=[a,n],d=[e.rowIndex,e.rowIndex];this.setSelector(c,d)}if(this.ctx.focusCell&&this.ctx.mousedown){const{rowIndex:c}=this.ctx.focusCell;if(e.rowIndex>=c){const d=[a,n],f=[c,e.rowIndex];this.setSelector(d,f)}else{const d=[a,n],f=[e.rowIndex,c];this.setSelector(d,f)}}}mouseenter(){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||this.ctx.editing)return;const{mousedown:e,focusCell:t,hoverCell:i}=this.ctx;if(e&&t&&i){const{rowIndex:s,colIndex:o}=t,n=Math.min(i.colIndex,o),a=Math.max(i.colIndex,o),c=Math.min(i.rowIndex,s),d=Math.max(i.rowIndex,s),f=[n,a],u=[c,d];this.setSelector(f,u)}}click(e=!1){const{focusCell:t,clickCell:i}=this.ctx;if(t&&this.isInSettingRange(t.rowIndex,t.colIndex))if(this.ctx.selector.enable=!0,i&&e){if(this.ctx.config.ENABLE_SELECTOR_SINGLE)return;const{colIndex:s,rowIndex:o}=i,{colIndex:n,rowIndex:a}=t,c=Math.min(n,s),d=Math.max(n,s),f=Math.min(a,o),u=Math.max(a,o),g=[c,d],m=[f,u];this.setSelector(g,m)}else{this.ctx.emit("cellSelectedClick",t);const s=[t.colIndex,t.colIndex],o=[t.rowIndex,t.rowIndex];this.setSelector(s,o),this.adjustBoundaryPosition()}}clearCopyLine(){this.ctx.selector.xArrCopy=[-1,-1],this.ctx.selector.yArrCopy=[-1,-1]}getCell(e,t){const i=this.ctx.body.renderRows.find(s=>s.rowIndex===e);return i==null?void 0:i.cells.find(s=>s.colIndex===t)}copy(){if(!this.ctx.config.ENABLE_COPY||this.ctx.domSelectionStr)return;let{value:e,xArr:t,yArr:i}=this.ctx.getSelectedData();if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(t,i))if(this.ctx.onlyMergeCell&&this.ctx.focusCell){const n=this.ctx.focusCell;e=[[n.getValue()]],t=[n.colIndex,n.colIndex],i=[n.rowIndex,n.rowIndex]}else{const n={code:"ERR_MERGED_CELLS_COPY",message:"Merged cells cannot span copy data"};this.ctx.hasEvent("error")?this.ctx.emit("error",n):alert(n.message);return}const{BEFORE_COPY_METHOD:s}=this.ctx.config;if(typeof s=="function"){const n=s({focusCell:this.ctx.focusCell,data:e,xArr:t,yArr:i});if(!n)return;e=n.data}const o=IC(e);navigator.clipboard?navigator.clipboard.writeText(o).then(()=>{this.ctx.selector.xArrCopy=this.ctx.selector.xArr.slice(),this.ctx.selector.yArrCopy=this.ctx.selector.yArr.slice(),this.ctx.emit("copyChange",{xArr:this.ctx.selector.xArrCopy,yArr:this.ctx.selector.yArrCopy,data:e}),this.ctx.emit("draw")}).catch(n=>console.error("Copy Failure:",n)):console.error("current browser does not support the Clipboard API")}clearSelectedData(e,t,i=!1,s=null){let o=[];const n=new Set;for(let c=0;c<=t[1]-t[0];c++)for(let d=0;d<=e[1]-e[0];d++){const f=c+t[0],u=d+e[0],g=this.ctx.database.getItemValueForRowIndexAndColIndex(f,u);if(g){const{rowKey:m,key:x}=g;this.ctx.database.getReadonly(m,x)||(n.add(m),o.push({rowKey:m,key:x,value:s,row:{}}))}}if(!o.length)return[];if(i)return o;this.ctx.database.batchSetItemValue(o,!0);let a=[];return n.forEach(c=>{a.push(this.ctx.database.getRowDataItemForRowKey(c))}),this.ctx.emit("clearSelectedDataChange",o,a),o}paste(){if(!navigator.clipboard){console.error("current browser does not support the Clipboard API");return}const{ENABLE_PASTER:e}=this.ctx.config;if(this.ctx.selector.enable&&e){const t=this.ctx.selector.yArr[0],i=this.ctx.selector.xArr[0],s=new Set;navigator.clipboard.readText().then(async o=>{let n=RC(o);const a=[i,i+n[0].length-1],c=[t,t+n.length-1],[d,f]=c,[u,g]=a,m=f-this.ctx.maxRowIndex,x=g-this.ctx.maxColIndex;(m>0||x>0)&&this.ctx.emit("onPastedDataOverflow",{maxY:f,maxX:g,minY:d,minX:u,overflowRowCount:m,overflowColCount:x,textArr:n});const v=n.length===1&&n[0].length===1;if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(a,c)&&!v){const w={code:"ERR_MERGED_CELLS_PASTE",message:"Merged cells cannot span paste data"};this.ctx.hasEvent("error")?this.ctx.emit("error",w):alert(w.message);return}let p=[];for(let w=0;w<=n.length-1;w++){const b=n[w].length;for(let T=0;T<=b-1;T++){const B=w+t,K=T+i,R=n[w][T],I=this.ctx.database.getItemValueForRowIndexAndColIndex(B,K);if(I){const{rowKey:_,key:O}=I;this.ctx.database.getReadonly(_,O)||(s.add(_),p.push({rowKey:_,key:O,value:R,row:{}}))}}}if(this.isCut){const w=this.clearSelectedData(this.ctx.selector.xArrCopy,this.ctx.selector.yArrCopy,!0),b=p.map(T=>`${T.rowKey}-${T.key}`);w.forEach(T=>{b.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 w=E,b=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 w(b,a,c,n),p&&!p.length)return}this.clearCopyLine(),this.ctx.batchSetItemValueByEditor(p,!0);let C=[];s.forEach(w=>{C.push(this.ctx.database.getRowDataItemForRowKey(w))}),this.ctx.emit("pasteChange",p,C),this.ctx.emit("draw")}).catch(o=>{console.error("Failed to get the clipboard content:",o)})}}moveFocus(e){if(this.ctx.editing)return;const{focusCell:t}=this.ctx;if(!t)return;let{colIndex:i=0,rowIndex:s=0}=t;const o=0,n=0,a=this.ctx.maxColIndex,c=this.ctx.maxRowIndex;switch(e){case"LEFT":i>o&&i--;break;case"TOP":s>n&&s--;break;case"RIGHT":i<a&&i++;break;case"BOTTOM":s<c&&s++;break}const d=[i,i],f=[s,s],u=this.getCell(s,i);u&&(u.operation||this.isInSettingRange(u.rowIndex,u.colIndex)&&(this.ctx.setFocusCell(u),this.setSelector(d,f),this.adjustBoundaryPosition(),this.ctx.emit("moveFocus",u),this.ctx.emit("draw")))}isInSettingRange(e,t){const{SELECTOR_AREA_MIN_X:i,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MIN_Y:o,SELECTOR_AREA_MAX_Y:n,SELECTOR_AREA_MAX_X_OFFSET:a,SELECTOR_AREA_MAX_Y_OFFSET:c}=this.ctx.config,d=i,f=s||this.ctx.maxColIndex-a,u=o,g=n||this.ctx.maxRowIndex-c;return!(t<d||t>f||e<u||e>g)}adjustBoundaryPosition(){const{stageHeight:e,stageWidth:t,focusCell:i,fixedRightWidth:s,fixedLeftWidth:o,header:n,footer:a,body:c,scrollX:d,scrollY:f,config:{SCROLLER_TRACK_SIZE:u,FOOTER_FIXED:g,FOOTER_POSITION:m,ENABLE_MERGE_CELL_LINK:x}}=this.ctx;if(!i)return;x&&this.ctx.onlyMergeCell&&i.updateSpanInfo();const{drawX:v,drawY:p,width:E,height:C,fixed:w}=i,b=o-v+1,T=i.drawX+E-(t-s)+1;let B=n.height-p,K=C;K>c.visibleHeight&&(K=c.visibleHeight);let R=0;g&&(m==="top"?B=n.height+a.height-p:R=a.visibleHeight);const I=p+K-(e-R-u);let _=d,O=f;T>0&&!w?_=Math.floor(d+T):b>0&&!w&&(_=Math.floor(d-b)),B>0?O=Math.floor(f-B):I>0&&(O=Math.floor(f+I)),(Math.abs(d-_)>2||Math.abs(f-O)>2)&&(this.ctx.adjustPositioning=!0,this.ctx.emit("adjustBoundaryPosition",i),this.ctx.setScroll(_,O))}destroy(){}}class GC{constructor(e){h(this,"ctx"),h(this,"maxColRowCell"),this.ctx=e,this.init()}init(){this.ctx.on("mousemove",e=>{if(this.ctx.stageElement.style.cursor==="crosshair"&&(this.ctx.stageElement.style.cursor="default"),this.ctx.editing||!this.ctx.focusCell||!this.maxColRowCell)return;const{offsetX:t,offsetY:i}=this.ctx.getOffset(e),{colIndex:s,rowIndex:o,drawX:n,drawY:a,width:c,height:d}=this.maxColRowCell,f=6,u=s===this.ctx.maxColIndex||o===this.ctx.maxRowIndex?0:2,g=n+c-f+u,m=a+d-f+u;t>g&&i>m&&t<g+f&&i<m+f&&(this.ctx.stageElement.style.cursor="crosshair"),this.ctx.autofillMove&&this.ctx.startAdjustPosition(e)}),this.ctx.on("cellMouseenter",e=>{const{xArr:t,yArr:i}=this.ctx.selector,s=t[1],o=i[1],{colIndex:n,rowIndex:a}=e;this.ctx.config.ENABLE_AUTOFILL&&n===s&&a===o&&(this.maxColRowCell=e),this.mouseenter(e)}),this.ctx.on("mousedown",()=>{this.ctx.stageElement.style.cursor==="crosshair"&&this.setMousedown()}),this.ctx.on("mouseup",()=>{this.setMouseUp(),this.ctx.stopAdjustPosition()})}isAutofillIng(){const{xArr:e,yArr:t}=this.ctx.selector;return!(JSON.stringify(this.ctx.autofill.xArr)===JSON.stringify(e)&&JSON.stringify(this.ctx.autofill.yArr)===JSON.stringify(t))}setMousedown(){this.ctx.autofill.enable=!0,this.ctx.autofillMove=!0,this.ctx.disableHoverIconClick=!0}setMouseUp(){this.ctx.autofill.enable&&(this.isAutofillIng()&&this.autofillData(),this.ctx.autofill.enable=!1,this.ctx.autofillMove=!1,this.ctx.autofill.xArr=[-1,-1],this.ctx.autofill.yArr=[-1,-1],setTimeout(()=>{this.ctx.disableHoverIconClick=!1},0))}setAutofill(e,t){const{ENABLE_AUTOFILL:i,ENABLE_AUTOFILL_SPAN_COL:s,ENABLE_AUTOFILL_SPAN_ROW:o}=this.ctx.config;if(!i)return;let n=e,a=t;const c=this.ctx.selector.xArr,d=this.ctx.selector.yArr;if(!(!o&&JSON.stringify(d)!==JSON.stringify(a))&&!(!s&&JSON.stringify(c)!==JSON.stringify(n))&&(JSON.stringify(this.ctx.autofill.xArr)!==JSON.stringify(n)||JSON.stringify(this.ctx.autofill.yArr)!==JSON.stringify(a))){const{SELECTOR_AREA_MIN_X:f,SELECTOR_AREA_MAX_X:u,SELECTOR_AREA_MIN_Y:g,SELECTOR_AREA_MAX_Y:m,SELECTOR_AREA_MAX_X_OFFSET:x,SELECTOR_AREA_MAX_Y_OFFSET:v}=this.ctx.config,p=f,E=u||this.ctx.maxColIndex-x,C=g,w=m||this.ctx.maxRowIndex-v;let[b,T]=n,[B,K]=a;if(b<p||B<C)return;n=[Math.max(p,b),Math.min(E,T)],a=[Math.max(C,B),Math.min(w,K)];const{BEFORE_SET_AUTOFILL_METHOD:R}=this.ctx.config;if(typeof R=="function"){const I=R({focusCell:this.ctx.focusCell,xArr:n,yArr:a});if(!I)return;n=I.xArr,a=I.yArr}this.ctx.autofill.xArr=n,this.ctx.autofill.yArr=a,this.ctx.emit("setAutofill",this.ctx.autofill),this.ctx.emit("draw")}}async autofillData(){const e=new Set,t=this.ctx.getSelectedData(),i=new Map;for(let m=0;m<=t.yArr[1]-t.yArr[0];m++)for(let x=0;x<=t.xArr[1]-t.xArr[0];x++){const v=m+t.yArr[0],p=x+t.xArr[0];i.set(`${v}-${p}`,!0)}const{value:s}=t,o=s[0].length,n=s.length,a=this.ctx.autofill.xArr,c=this.ctx.autofill.yArr,d=o===1&&n===1;if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(a,c)&&!d){const m={code:"ERR_MERGED_CELLS_AUTOFILL",message:"Merged cells cannot span autofill data"};this.ctx.hasEvent("error")?this.ctx.emit("error",m):alert(m.message);return}let f=[];for(let m=0;m<=c[1]-c[0];m++)for(let x=0;x<=a[1]-a[0];x++){const v=x+a[0],p=m+c[0],E=s[m%n][x%o],C=this.ctx.database.getItemValueForRowIndexAndColIndex(p,v),w=`${p}-${v}`;if(C&&!i.has(w)){const{rowKey:b,key:T}=C;this.ctx.database.getReadonly(b,T)||(e.add(b),f.push({rowKey:b,key:T,value:E,row:{}}))}}if(!f.length)return;this.ctx.selector.xArr=this.ctx.autofill.xArr,this.ctx.selector.yArr=this.ctx.autofill.yArr;const{BEFORE_AUTOFILL_DATA_METHOD:u}=this.ctx.config;if(typeof u=="function"){const m=u,x=f.map(v=>({rowKey:v.rowKey,key:v.key,value:v.value,oldValue:this.ctx.database.getItemValue(v.rowKey,v.key),row:this.ctx.database.getRowDataItemForRowKey(v.rowKey)}));if(f=await m(x,a,c),f&&!f.length)return}this.ctx.batchSetItemValueByEditor(f,!0);let g=[];e.forEach(m=>{g.push(this.ctx.database.getRowDataItemForRowKey(m))}),this.ctx.emit("autofillChange",f,g),this.ctx.emit("draw")}mouseenter(e){if(["index","selection","index-selection"].includes(e.type))return;const{selector:t,autofill:i}=this.ctx;if(this.ctx.mousedown&&t.enable&&i.enable){const{rowIndex:s,colIndex:o}=e,n=t.xArr.slice(),a=t.yArr.slice();s>=t.yArr[0]&&s<=t.yArr[1]?o>t.xArr[1]?n.splice(1,1,o):o<t.xArr[0]&&n.splice(0,1,o):s>t.yArr[1]?a.splice(1,1,s):s<t.yArr[0]&&a.splice(0,1,s),this.setAutofill(n,a)}}destroy(){}}const Et=Math.min,st=Math.max,Ci=Math.round,gi=Math.floor,Oe=r=>({x:r,y:r}),UC={left:"right",right:"left",bottom:"top",top:"bottom"},qC={start:"end",end:"start"};function ur(r,e,t){return st(r,Et(e,t))}function qt(r,e){return typeof r=="function"?r(e):r}function ot(r){return r.split("-")[0]}function Zt(r){return r.split("-")[1]}function Qa(r){return r==="x"?"y":"x"}function Fr(r){return r==="y"?"height":"width"}const ZC=new Set(["top","bottom"]);function We(r){return ZC.has(ot(r))?"y":"x"}function Kr(r){return Qa(We(r))}function JC(r,e,t){t===void 0&&(t=!1);const i=Zt(r),s=Kr(r),o=Fr(s);let n=s==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(n=bi(n)),[n,bi(n)]}function QC(r){const e=bi(r);return[fr(r),e,fr(e)]}function fr(r){return r.replace(/start|end/g,e=>qC[e])}const Mo=["left","right"],Ao=["right","left"],jC=["top","bottom"],eb=["bottom","top"];function tb(r,e,t){switch(r){case"top":case"bottom":return t?e?Ao:Mo:e?Mo:Ao;case"left":case"right":return e?jC:eb;default:return[]}}function ib(r,e,t,i){const s=Zt(r);let o=tb(ot(r),t==="start",i);return s&&(o=o.map(n=>n+"-"+s),e&&(o=o.concat(o.map(fr)))),o}function bi(r){return r.replace(/left|right|bottom|top/g,e=>UC[e])}function rb(r){return{top:0,right:0,bottom:0,left:0,...r}}function ja(r){return typeof r!="number"?rb(r):{top:r,right:r,bottom:r,left:r}}function _i(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 No(r,e,t){let{reference:i,floating:s}=r;const o=We(e),n=Kr(e),a=Fr(n),c=ot(e),d=o==="y",f=i.x+i.width/2-s.width/2,u=i.y+i.height/2-s.height/2,g=i[a]/2-s[a]/2;let m;switch(c){case"top":m={x:f,y:i.y-s.height};break;case"bottom":m={x:f,y:i.y+i.height};break;case"right":m={x:i.x+i.width,y:u};break;case"left":m={x:i.x-s.width,y:u};break;default:m={x:i.x,y:i.y}}switch(Zt(e)){case"start":m[n]-=g*(t&&d?-1:1);break;case"end":m[n]+=g*(t&&d?-1:1);break}return m}const sb=async(r,e,t)=>{const{placement:i="bottom",strategy:s="absolute",middleware:o=[],platform:n}=t,a=o.filter(Boolean),c=await(n.isRTL==null?void 0:n.isRTL(e));let d=await n.getElementRects({reference:r,floating:e,strategy:s}),{x:f,y:u}=No(d,i,c),g=i,m={},x=0;for(let v=0;v<a.length;v++){const{name:p,fn:E}=a[v],{x:C,y:w,data:b,reset:T}=await E({x:f,y:u,initialPlacement:i,placement:g,strategy:s,middlewareData:m,rects:d,platform:n,elements:{reference:r,floating:e}});f=C??f,u=w??u,m={...m,[p]:{...m[p],...b}},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:f,y:u}=No(d,g,c)),v=-1)}return{x:f,y:u,placement:g,strategy:s,middlewareData:m}};async function el(r,e){var t;e===void 0&&(e={});const{x:i,y:s,platform:o,rects:n,elements:a,strategy:c}=r,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:g=!1,padding:m=0}=qt(e,r),x=ja(m),v=a[g?u==="floating"?"reference":"floating":u],p=_i(await o.getClippingRect({element:(t=await(o.isElement==null?void 0:o.isElement(v)))==null||t?v:v.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:d,rootBoundary:f,strategy:c})),E=u==="floating"?{x:i,y:s,width:n.floating.width,height:n.floating.height}:n.reference,C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),w=await(o.isElement==null?void 0:o.isElement(C))?await(o.getScale==null?void 0:o.getScale(C))||{x:1,y:1}:{x:1,y:1},b=_i(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:E,offsetParent:C,strategy:c}):E);return{top:(p.top-b.top+x.top)/w.y,bottom:(b.bottom-p.bottom+x.bottom)/w.y,left:(p.left-b.left+x.left)/w.x,right:(b.right-p.right+x.right)/w.x}}const ob=r=>({name:"arrow",options:r,async fn(e){const{x:t,y:i,placement:s,rects:o,platform:n,elements:a,middlewareData:c}=e,{element:d,padding:f=0}=qt(r,e)||{};if(d==null)return{};const u=ja(f),g={x:t,y:i},m=Kr(s),x=Fr(m),v=await n.getDimensions(d),p=m==="y",E=p?"top":"left",C=p?"bottom":"right",w=p?"clientHeight":"clientWidth",b=o.reference[x]+o.reference[m]-g[m]-o.floating[x],T=g[m]-o.reference[m],B=await(n.getOffsetParent==null?void 0:n.getOffsetParent(d));let K=B?B[w]:0;(!K||!await(n.isElement==null?void 0:n.isElement(B)))&&(K=a.floating[w]||o.floating[x]);const R=b/2-T/2,I=K/2-v[x]/2-1,_=Et(u[E],I),O=Et(u[C],I),y=_,D=K-v[x]-O,L=K/2-v[x]/2+R,Y=ur(y,L,D),W=!c.arrow&&Zt(s)!=null&&L!==Y&&o.reference[x]/2-(L<y?_:O)-v[x]/2<0,P=W?L<y?L-y:L-D:0;return{[m]:g[m]+P,data:{[m]:Y,centerOffset:L-Y-P,...W&&{alignmentOffset:P}},reset:W}}}),nb=function(r){return r===void 0&&(r={}),{name:"flip",options:r,async fn(e){var t,i;const{placement:s,middlewareData:o,rects:n,initialPlacement:a,platform:c,elements:d}=e,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:g,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:v=!0,...p}=qt(r,e);if((t=o.arrow)!=null&&t.alignmentOffset)return{};const E=ot(s),C=We(a),w=ot(a)===a,b=await(c.isRTL==null?void 0:c.isRTL(d.floating)),T=g||(w||!v?[bi(a)]:QC(a)),B=x!=="none";!g&&B&&T.push(...ib(a,v,x,b));const K=[a,...T],R=await el(e,p),I=[];let _=((i=o.flip)==null?void 0:i.overflows)||[];if(f&&I.push(R[E]),u){const L=JC(s,n,b);I.push(R[L[0]],R[L[1]])}if(_=[..._,{placement:s,overflows:I}],!I.every(L=>L<=0)){var O,y;const L=(((O=o.flip)==null?void 0:O.index)||0)+1,Y=K[L];if(Y&&(!(u==="alignment"&&C!==We(Y))||_.every(P=>We(P.placement)===C?P.overflows[0]>0:!0)))return{data:{index:L,overflows:_},reset:{placement:Y}};let W=(y=_.filter(P=>P.overflows[0]<=0).sort((P,X)=>P.overflows[1]-X.overflows[1])[0])==null?void 0:y.placement;if(!W)switch(m){case"bestFit":{var D;const P=(D=_.filter(X=>{if(B){const U=We(X.placement);return U===C||U==="y"}return!0}).map(X=>[X.placement,X.overflows.filter(U=>U>0).reduce((U,q)=>U+q,0)]).sort((X,U)=>X[1]-U[1])[0])==null?void 0:D[0];P&&(W=P);break}case"initialPlacement":W=a;break}if(s!==W)return{reset:{placement:W}}}return{}}}},ab=new Set(["left","top"]);async function lb(r,e){const{placement:t,platform:i,elements:s}=r,o=await(i.isRTL==null?void 0:i.isRTL(s.floating)),n=ot(t),a=Zt(t),c=We(t)==="y",d=ab.has(n)?-1:1,f=o&&c?-1:1,u=qt(e,r);let{mainAxis:g,crossAxis:m,alignmentAxis:x}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof x=="number"&&(m=a==="end"?x*-1:x),c?{x:m*f,y:g*d}:{x:g*d,y:m*f}}const cb=function(r){return r===void 0&&(r=0),{name:"offset",options:r,async fn(e){var t,i;const{x:s,y:o,placement:n,middlewareData:a}=e,c=await lb(e,r);return n===((t=a.offset)==null?void 0:t.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:s+c.x,y:o+c.y,data:{...c,placement:n}}}}},hb=function(r){return r===void 0&&(r={}),{name:"shift",options:r,async fn(e){const{x:t,y:i,placement:s}=e,{mainAxis:o=!0,crossAxis:n=!1,limiter:a={fn:p=>{let{x:E,y:C}=p;return{x:E,y:C}}},...c}=qt(r,e),d={x:t,y:i},f=await el(e,c),u=We(ot(s)),g=Qa(u);let m=d[g],x=d[u];if(o){const p=g==="y"?"top":"left",E=g==="y"?"bottom":"right",C=m+f[p],w=m-f[E];m=ur(C,m,w)}if(n){const p=u==="y"?"top":"left",E=u==="y"?"bottom":"right",C=x+f[p],w=x-f[E];x=ur(C,x,w)}const v=a.fn({...e,[g]:m,[u]:x});return{...v,data:{x:v.x-t,y:v.y-i,enabled:{[g]:o,[u]:n}}}}}};function Hi(){return typeof window<"u"}function Ot(r){return tl(r)?(r.nodeName||"").toLowerCase():"#document"}function le(r){var e;return(r==null||(e=r.ownerDocument)==null?void 0:e.defaultView)||window}function Me(r){var e;return(e=(tl(r)?r.ownerDocument:r.document)||window.document)==null?void 0:e.documentElement}function tl(r){return Hi()?r instanceof Node||r instanceof le(r).Node:!1}function Ee(r){return Hi()?r instanceof Element||r instanceof le(r).Element:!1}function ke(r){return Hi()?r instanceof HTMLElement||r instanceof le(r).HTMLElement:!1}function Bo(r){return!Hi()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof le(r).ShadowRoot}const db=new Set(["inline","contents"]);function Jt(r){const{overflow:e,overflowX:t,overflowY:i,display:s}=Ce(r);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!db.has(s)}const ub=new Set(["table","td","th"]);function fb(r){return ub.has(Ot(r))}const gb=[":popover-open",":modal"];function Fi(r){return gb.some(e=>{try{return r.matches(e)}catch{return!1}})}const vb=["transform","translate","scale","rotate","perspective"],mb=["transform","translate","scale","rotate","perspective","filter"],xb=["paint","layout","strict","content"];function Pr(r){const e=Yr(),t=Ee(r)?Ce(r):r;return vb.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)||mb.some(i=>(t.willChange||"").includes(i))||xb.some(i=>(t.contain||"").includes(i))}function pb(r){let e=ze(r);for(;ke(e)&&!Ct(e);){if(Pr(e))return e;if(Fi(e))return null;e=ze(e)}return null}function Yr(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const yb=new Set(["html","body","#document"]);function Ct(r){return yb.has(Ot(r))}function Ce(r){return le(r).getComputedStyle(r)}function Ki(r){return Ee(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function ze(r){if(Ot(r)==="html")return r;const e=r.assignedSlot||r.parentNode||Bo(r)&&r.host||Me(r);return Bo(e)?e.host:e}function il(r){const e=ze(r);return Ct(e)?r.ownerDocument?r.ownerDocument.body:r.body:ke(e)&&Jt(e)?e:il(e)}function Ft(r,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const s=il(r),o=s===((i=r.ownerDocument)==null?void 0:i.body),n=le(s);if(o){const a=gr(n);return e.concat(n,n.visualViewport||[],Jt(s)?s:[],a&&t?Ft(a):[])}return e.concat(s,Ft(s,[],t))}function gr(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function rl(r){const e=Ce(r);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const s=ke(r),o=s?r.offsetWidth:t,n=s?r.offsetHeight:i,a=Ci(t)!==o||Ci(i)!==n;return a&&(t=o,i=n),{width:t,height:i,$:a}}function Vr(r){return Ee(r)?r:r.contextElement}function yt(r){const e=Vr(r);if(!ke(e))return Oe(1);const t=e.getBoundingClientRect(),{width:i,height:s,$:o}=rl(e);let n=(o?Ci(t.width):t.width)/i,a=(o?Ci(t.height):t.height)/s;return(!n||!Number.isFinite(n))&&(n=1),(!a||!Number.isFinite(a))&&(a=1),{x:n,y:a}}const wb=Oe(0);function sl(r){const e=le(r);return!Yr()||!e.visualViewport?wb:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Eb(r,e,t){return e===void 0&&(e=!1),!t||e&&t!==le(r)?!1:e}function nt(r,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const s=r.getBoundingClientRect(),o=Vr(r);let n=Oe(1);e&&(i?Ee(i)&&(n=yt(i)):n=yt(r));const a=Eb(o,t,i)?sl(o):Oe(0);let c=(s.left+a.x)/n.x,d=(s.top+a.y)/n.y,f=s.width/n.x,u=s.height/n.y;if(o){const g=le(o),m=i&&Ee(i)?le(i):i;let x=g,v=gr(x);for(;v&&i&&m!==x;){const p=yt(v),E=v.getBoundingClientRect(),C=Ce(v),w=E.left+(v.clientLeft+parseFloat(C.paddingLeft))*p.x,b=E.top+(v.clientTop+parseFloat(C.paddingTop))*p.y;c*=p.x,d*=p.y,f*=p.x,u*=p.y,c+=w,d+=b,x=le(v),v=gr(x)}}return _i({width:f,height:u,x:c,y:d})}function Wr(r,e){const t=Ki(r).scrollLeft;return e?e.left+t:nt(Me(r)).left+t}function ol(r,e,t){t===void 0&&(t=!1);const i=r.getBoundingClientRect(),s=i.left+e.scrollLeft-(t?0:Wr(r,i)),o=i.top+e.scrollTop;return{x:s,y:o}}function Cb(r){let{elements:e,rect:t,offsetParent:i,strategy:s}=r;const o=s==="fixed",n=Me(i),a=e?Fi(e.floating):!1;if(i===n||a&&o)return t;let c={scrollLeft:0,scrollTop:0},d=Oe(1);const f=Oe(0),u=ke(i);if((u||!u&&!o)&&((Ot(i)!=="body"||Jt(n))&&(c=Ki(i)),ke(i))){const m=nt(i);d=yt(i),f.x=m.x+i.clientLeft,f.y=m.y+i.clientTop}const g=n&&!u&&!o?ol(n,c,!0):Oe(0);return{width:t.width*d.x,height:t.height*d.y,x:t.x*d.x-c.scrollLeft*d.x+f.x+g.x,y:t.y*d.y-c.scrollTop*d.y+f.y+g.y}}function bb(r){return Array.from(r.getClientRects())}function _b(r){const e=Me(r),t=Ki(r),i=r.ownerDocument.body,s=st(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),o=st(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let n=-t.scrollLeft+Wr(r);const a=-t.scrollTop;return Ce(i).direction==="rtl"&&(n+=st(e.clientWidth,i.clientWidth)-s),{width:s,height:o,x:n,y:a}}function Rb(r,e){const t=le(r),i=Me(r),s=t.visualViewport;let o=i.clientWidth,n=i.clientHeight,a=0,c=0;if(s){o=s.width,n=s.height;const d=Yr();(!d||d&&e==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}return{width:o,height:n,x:a,y:c}}const Ib=new Set(["absolute","fixed"]);function Sb(r,e){const t=nt(r,!0,e==="fixed"),i=t.top+r.clientTop,s=t.left+r.clientLeft,o=ke(r)?yt(r):Oe(1),n=r.clientWidth*o.x,a=r.clientHeight*o.y,c=s*o.x,d=i*o.y;return{width:n,height:a,x:c,y:d}}function Ho(r,e,t){let i;if(e==="viewport")i=Rb(r,t);else if(e==="document")i=_b(Me(r));else if(Ee(e))i=Sb(e,t);else{const s=sl(r);i={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return _i(i)}function nl(r,e){const t=ze(r);return t===e||!Ee(t)||Ct(t)?!1:Ce(t).position==="fixed"||nl(t,e)}function Tb(r,e){const t=e.get(r);if(t)return t;let i=Ft(r,[],!1).filter(a=>Ee(a)&&Ot(a)!=="body"),s=null;const o=Ce(r).position==="fixed";let n=o?ze(r):r;for(;Ee(n)&&!Ct(n);){const a=Ce(n),c=Pr(n);!c&&a.position==="fixed"&&(s=null),(o?!c&&!s:!c&&a.position==="static"&&s&&Ib.has(s.position)||Jt(n)&&!c&&nl(r,n))?i=i.filter(d=>d!==n):s=a,n=ze(n)}return e.set(r,i),i}function Ob(r){let{element:e,boundary:t,rootBoundary:i,strategy:s}=r;const o=[...t==="clippingAncestors"?Fi(e)?[]:Tb(e,this._c):[].concat(t),i],n=o[0],a=o.reduce((c,d)=>{const f=Ho(e,d,s);return c.top=st(f.top,c.top),c.right=Et(f.right,c.right),c.bottom=Et(f.bottom,c.bottom),c.left=st(f.left,c.left),c},Ho(e,n,s));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function kb(r){const{width:e,height:t}=rl(r);return{width:e,height:t}}function Lb(r,e,t){const i=ke(e),s=Me(e),o=t==="fixed",n=nt(r,!0,o,e);let a={scrollLeft:0,scrollTop:0};const c=Oe(0);function d(){c.x=Wr(s)}if(i||!i&&!o)if((Ot(e)!=="body"||Jt(s))&&(a=Ki(e)),i){const m=nt(e,!0,o,e);c.x=m.x+e.clientLeft,c.y=m.y+e.clientTop}else s&&d();o&&!i&&s&&d();const f=s&&!i&&!o?ol(s,a):Oe(0),u=n.left+a.scrollLeft-c.x-f.x,g=n.top+a.scrollTop-c.y-f.y;return{x:u,y:g,width:n.width,height:n.height}}function nr(r){return Ce(r).position==="static"}function Fo(r,e){if(!ke(r)||Ce(r).position==="fixed")return null;if(e)return e(r);let t=r.offsetParent;return Me(r)===t&&(t=t.ownerDocument.body),t}function al(r,e){const t=le(r);if(Fi(r))return t;if(!ke(r)){let s=ze(r);for(;s&&!Ct(s);){if(Ee(s)&&!nr(s))return s;s=ze(s)}return t}let i=Fo(r,e);for(;i&&fb(i)&&nr(i);)i=Fo(i,e);return i&&Ct(i)&&nr(i)&&!Pr(i)?t:i||pb(r)||t}const Db=async function(r){const e=this.getOffsetParent||al,t=this.getDimensions,i=await t(r.floating);return{reference:Lb(r.reference,await e(r.floating),r.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function $b(r){return Ce(r).direction==="rtl"}const Mb={convertOffsetParentRelativeRectToViewportRelativeRect:Cb,getDocumentElement:Me,getClippingRect:Ob,getOffsetParent:al,getElementRects:Db,getClientRects:bb,getDimensions:kb,getScale:yt,isElement:Ee,isRTL:$b};function ll(r,e){return r.x===e.x&&r.y===e.y&&r.width===e.width&&r.height===e.height}function Ab(r,e){let t=null,i;const s=Me(r);function o(){var a;clearTimeout(i),(a=t)==null||a.disconnect(),t=null}function n(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),o();const d=r.getBoundingClientRect(),{left:f,top:u,width:g,height:m}=d;if(a||e(),!g||!m)return;const x=gi(u),v=gi(s.clientWidth-(f+g)),p=gi(s.clientHeight-(u+m)),E=gi(f),C={rootMargin:-x+"px "+-v+"px "+-p+"px "+-E+"px",threshold:st(0,Et(1,c))||1};let w=!0;function b(T){const B=T[0].intersectionRatio;if(B!==c){if(!w)return n();B?n(!1,B):i=setTimeout(()=>{n(!1,1e-7)},1e3)}B===1&&!ll(d,r.getBoundingClientRect())&&n(),w=!1}try{t=new IntersectionObserver(b,{...C,root:s.ownerDocument})}catch{t=new IntersectionObserver(b,C)}t.observe(r)}return n(!0),o}function vr(r,e,t,i){i===void 0&&(i={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=i,d=Vr(r),f=s||o?[...d?Ft(d):[],...Ft(e)]:[];f.forEach(E=>{s&&E.addEventListener("scroll",t,{passive:!0}),o&&E.addEventListener("resize",t)});const u=d&&a?Ab(d,t):null;let g=-1,m=null;n&&(m=new ResizeObserver(E=>{let[C]=E;C&&C.target===d&&m&&(m.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var w;(w=m)==null||w.observe(e)})),t()}),d&&!c&&m.observe(d),m.observe(e));let x,v=c?nt(r):null;c&&p();function p(){const E=nt(r);v&&!ll(v,E)&&t(),v=E,x=requestAnimationFrame(p)}return t(),()=>{var E;f.forEach(C=>{s&&C.removeEventListener("scroll",t),o&&C.removeEventListener("resize",t)}),u==null||u(),(E=m)==null||E.disconnect(),m=null,c&&cancelAnimationFrame(x)}}const Ri=cb,Ii=hb,Xr=nb,Nb=ob,Si=(r,e,t)=>{const i=new Map,s={platform:Mb,...t},o={...s.platform,_c:i};return sb(r,e,{...s,platform:o})};let Bb=class{constructor(r){h(this,"ctx"),h(this,"enable",!1),h(this,"contentEl"),h(this,"floatingEl"),h(this,"arrowEl"),this.ctx=r;const{TOOLTIP_BG_COLOR:e,TOOLTIP_TEXT_COLOR:t,TOOLTIP_ZINDEX:i,TOOLTIP_CUSTOM_STYLE:s,CSS_PREFIX:o}=this.ctx.config;this.contentEl=document.createElement("div"),this.arrowEl=document.createElement("div"),this.floatingEl=document.createElement("div"),this.floatingEl.className=`${o}-tooltip`,this.contentEl.className=`${o}-tooltip-content`,this.arrowEl.className=`${o}-tooltip-arrow`;const n={display:"none",position:"absolute",background:e,color:t,boxSizing:"border-box",zIndex:i,padding:"8px",borderRadius:"4px",fontSize:"12px",...s},a={position:"absolute",width:"10px",height:"10px",background:n.background,backgroundColor:n.backgroundColor,transform:"rotate(45deg)",zIndex:n.zIndex};Object.assign(this.arrowEl.style,a),Object.assign(this.floatingEl.style,n),this.floatingEl.appendChild(this.contentEl),this.floatingEl.appendChild(this.arrowEl),this.ctx.containerElement.appendChild(this.floatingEl),this.init()}init(){this.floatingEl.addEventListener("mouseleave",()=>{this.hide()}),this.ctx.on("mouseout",r=>{this.floatingEl.contains(r.relatedTarget)||this.hide()}),this.ctx.on("onScroll",()=>{this.hide()}),this.ctx.on("startEdit",()=>{this.hide()}),this.ctx.on("visibleCellHoverChange",(r,e)=>{this.floatingEl.contains(e.target)||(r.ellipsis||r.message)&&this.show(r)}),this.ctx.on("visibleCellMouseleave",(r,e)=>{this.floatingEl.contains(e.target)||this.hide()}),this.ctx.on("cellHeaderMouseleave",(r,e)=>{this.floatingEl.contains(e.target)||this.hide()}),this.ctx.on("cellHeaderHoverChange",(r,e)=>{this.floatingEl.contains(e.target)||r.ellipsis&&this.show(r)}),this.ctx.on("cellFooterMouseleave",(r,e)=>{this.floatingEl.contains(e.target)||this.hide()}),this.ctx.on("cellFooterHoverChange",(r,e)=>{this.floatingEl.contains(e.target)||r.ellipsis&&this.show(r)}),this.ctx.on("cellShowTooltip",(r,e)=>{this.show(r,e)}),this.ctx.on("cellHideTooltip",()=>{this.hide()})}show(r,e){if(this.ctx.contextMenuIng||!r.overflowTooltipShow||this.ctx.mousedown)return;this.floatingEl.style.display="block";let t=r.getText();r.message&&(t=r.message),e&&(t=e);const i=this.ctx.containerElement.getBoundingClientRect();if(!i)return;this.enable=!0,this.contentEl.style.maxWidth=`${r.overflowTooltipMaxWidth||500}px`,this.contentEl.style.minWidth="100px",this.contentEl.style.width="100%",this.contentEl.style.display="inline-block",this.contentEl.style.wordBreak="break-all",this.contentEl.style.lineHeight="1.5",this.contentEl.innerText=t;const s=r.drawX+i.x,o=r.drawY+i.y;Si({getBoundingClientRect(){return{width:r.visibleWidth,height:r.visibleHeight,x:s,y:o,left:s,right:s+r.visibleWidth,top:o,bottom:o+r.visibleHeight}}},this.floatingEl,{placement:r.overflowTooltipPlacement,middleware:[Ii(),Xr(),Ri(6),Nb({element:this.arrowEl})]}).then(n=>{const{x:a,y:c,placement:d,middlewareData:f}=n;if(Object.assign(this.floatingEl.style,{top:`${c}px`,left:`${a}px`}),f.arrow){const u=f.arrow;["left","left-start","left-end"].includes(d)?Object.assign(this.arrowEl.style,{top:`${u.y}px`,bottom:"",left:"",right:"-5px"}):["right","right-start","right-end"].includes(d)?Object.assign(this.arrowEl.style,{top:`${u.y}px`,bottom:"",left:"-5px",right:""}):["bottom","bottom-start","bottom-end"].includes(d)?Object.assign(this.arrowEl.style,{top:"-5px",bottom:"",left:`${u.x}px`,right:""}):["top","top-start","top-end"].includes(d)&&Object.assign(this.arrowEl.style,{top:"",bottom:"-5px",left:`${u.x}px`,right:""})}})}hide(){this.enable&&(this.enable=!1,this.floatingEl.style.display="none")}destroy(){this.contentEl.remove(),this.arrowEl.remove(),this.floatingEl.remove()}};class Hb{constructor(e){h(this,"editorEl"),h(this,"inputEl"),h(this,"enable",!1),h(this,"cellTarget",null),h(this,"selectorArrStr",""),h(this,"ctx"),h(this,"drawY",0),h(this,"drawX",0),h(this,"cancel",!1),this.ctx=e,this.initTextEditor(),this.init()}init(){this.ctx.on("outsideMousedown",()=>{this.cellTarget&&this.cellTarget.editorType==="text"&&this.clearEditor()}),this.ctx.on("moveFocus",e=>{this.cellTarget=e;const{xArr:t,yArr:i}=this.ctx.selector;this.selectorArrStr=JSON.stringify(t)+JSON.stringify(i)}),this.ctx.on("onScroll",()=>{this.enable&&this.doneEdit()}),this.ctx.on("hoverIconClick",e=>{this.ctx.disableHoverIconClick||this.editCell(e.rowIndex,e.colIndex)}),this.ctx.on("cellMousedown",()=>{this.inputEl.focus({preventScroll:!0})}),this.ctx.on("keydown",e=>{if(!this.ctx.isTarget(e)||!this.ctx.focusCell||this.ctx.finding)return;if(e.code==="Escape"&&this.ctx.editing){this.cancel=!0;const{focusCell:a}=this.ctx;a&&(this.ctx.emit("setSelectorCell",a),this.cellTarget=a),this.doneEdit();return}if((e.altKey||e.metaKey)&&e.key==="Enter"&&this.ctx.editing&&this.inputEl){e.preventDefault();const a=this.inputEl.selectionStart,c=this.inputEl.value.substring(0,a),d=this.inputEl.value.substring(a);this.inputEl.value=c+`
|
|
5
|
-
`+d,this.inputEl.selectionStart=this.inputEl.selectionEnd=a+1,this.autoSize();return}if(e.code==="Tab"&&this.ctx.editing){if(e.preventDefault(),this.doneEdit(),e.shiftKey){this.ctx.emit("setMoveFocus","LEFT");return}this.ctx.emit("setMoveFocus","RIGHT");return}if(e.key==="Enter"&&this.ctx.editing){if(e.preventDefault(),this.doneEdit(),e.shiftKey){this.ctx.emit("setMoveFocus","TOP");return}this.ctx.emit("setMoveFocus","BOTTOM");return}if(e.key==="Enter"&&!this.ctx.editing){e.preventDefault(),this.startEdit();return}const t=e.key,i=e.ctrlKey,s=e.altKey,o=e.shiftKey,n=e.metaKey;i||s||o||n||["Enter","Escape","Tab","Backspace","Delete","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown","Insert","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"].includes(t)||this.startEdit(!0)}),this.ctx.on("cellMouseup",e=>{if(this.ctx.isPointer||!this.isInSelectorRange(e.rowIndex,e.colIndex))return;const{xArr:t,yArr:i}=this.ctx.selector,s=JSON.stringify(t)+JSON.stringify(i);if(this.selectorArrStr===s&&this.cellTarget){if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.onlyMergeCell){this.startEdit();return}if(this.ctx.selectOnlyOne&&e.rowKey===this.cellTarget.rowKey&&e.key===this.cellTarget.key){this.startEdit();return}}if(this.selectorArrStr=s,this.doneEdit(),this.cellTarget=e,this.ctx.config.ENABLE_EDIT_SINGLE_CLICK){if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.onlyMergeCell){this.startEdit();return}this.ctx.selectOnlyOne&&this.startEdit()}}),this.ctx.on("mousedownBodyOutside",()=>{this.enable&&this.doneEdit(),this.cellTarget=null})}isInSelectorRange(e,t){const{xArr:i,yArr:s}=this.ctx.selector,[o,n]=i,[a,c]=s;return!(t<o||t>n||e<a||e>c)}initTextEditor(){this.inputEl=document.createElement("textarea"),this.inputEl.id="e-virt-table-editor-textarea",this.inputEl.setAttribute("rows","1"),this.inputEl.setAttribute("tabindex","-1"),this.inputEl.addEventListener("input",this.autoSize.bind(this)),this.editorEl=this.ctx.editorElement,this.inputEl.className="e-virt-table-editor-textarea",this.editorEl.appendChild(this.inputEl),this.ctx.containerElement.appendChild(this.editorEl)}autoSize(){const e=this.inputEl.value;this.cellTarget&&this.cellTarget.type==="number"&&e!==""&&(this.ctx.emit("cellHideTooltip"),/^-?\d+(\.\d+)?$/.test(e)||this.ctx.emit("cellShowTooltip",this.cellTarget,this.ctx.config.NUMBER_ERROR_TIP)),this.inputEl.style.height="auto";let t=this.inputEl.scrollHeight,i=this.ctx.body.visibleHeight;t>i&&(t=i);const{stageHeight:s,footer:o,header:n,config:{SCROLLER_TRACK_SIZE:a}}=this.ctx,c=s-o.height-a;this.editorEl.style.bottom="auto",this.drawY<n.height&&(this.editorEl.style.top=`${n.height-1}px`),this.drawY+t>c&&(this.editorEl.style.left=`${this.drawX-1}px`,this.editorEl.style.top="auto",this.editorEl.style.bottom=`${s-c}px`),this.inputEl.style.height=`${t}px`}startEditByInput(e,t=!1){const i=t?null:e.getValue(),{editorType:s}=e;if(s==="none")return;e.update(),this.ctx.config.ENABLE_MERGE_CELL_LINK&&e.updateSpanInfo();let{height:o,width:n,drawY:a,drawX:c}=e;this.drawX=c,this.drawY=a;const{config:{CELL_PADDING:d},header:f}=this.ctx;let u=this.ctx.body.visibleHeight;o>u&&(o=u),this.editorEl.style.display="inline-block",this.editorEl.style.zIndex="100",this.editorEl.style.left=`${this.drawX-1}px`,this.editorEl.style.top=`${this.drawY-1}px`,this.editorEl.style.bottom="auto",this.editorEl.style.maxHeight=`${u}px`,s==="text"?(this.inputEl.style.display="inline-block",this.inputEl.style.minWidth=`${n-1}px`,this.inputEl.style.minHeight=`${o-1}px`,this.inputEl.style.maxHeight=`${u}px`,this.inputEl.style.width=`${n-1}px`,this.inputEl.style.height="auto",this.inputEl.style.padding=`${d}px`,this.inputEl.value="",i!==null&&(this.inputEl.value=i,this.inputEl.focus({preventScroll:!0}))):this.inputEl.style.display="none",(this.inputEl.scrollHeight>o||this.drawY<f.height)&&this.autoSize()}doneEditByInput(){if(this.cellTarget&&this.cellTarget.editorType==="text"){const{rowKey:e,key:t}=this.cellTarget,i=this.cellTarget.getValue(),s=this.inputEl.value;s!==i&&!(s===""&&i===null)&&!this.cancel&&this.ctx.setItemValueByEditor(e,t,s,!0)}}startEdit(e=!1){this.cancel=!1;const{ENABLE_EDIT_CLICK_SELECTOR:t}=this.ctx.config;if(!t)return;const i=this.ctx.focusCell;if(!i||["index","index-selection","selection"].includes(i.type)||this.enable||!(i.isVerticalVisible()&&i.isHorizontalVisible()))return;const{rowKey:s,key:o}=i,n=this.ctx.database.getReadonly(s,o);i&&!n&&(this.enable=!0,this.ctx.editing=!0,this.cellTarget=i,this.startEditByInput(this.cellTarget,e),this.ctx.emit("startEdit",this.cellTarget),this.ctx.emit("draw"))}editCell(e,t){const i=this.ctx.body.renderRows.find(d=>d.rowIndex===e);if(!i)return;const s=i.cells.find(d=>d.colIndex===t);if(!s)return;this.ctx.emit("setSelectorCell",s);const o=this.ctx.focusCell;if(!o||["index","index-selection","selection"].includes(o.type)||this.enable)return;const{rowKey:n,key:a}=o,c=this.ctx.database.getReadonly(n,a);o&&!c&&(this.enable=!0,this.ctx.editing=!0,this.cellTarget=o,this.startEditByInput(this.cellTarget),this.ctx.emit("startEdit",this.cellTarget),this.ctx.emit("draw"))}doneEdit(){if(!this.enable)return;const{header:e,config:{CELL_HEIGHT:t}}=this.ctx;this.doneEditByInput(),this.ctx.emit("cellHideTooltip"),this.ctx.emit("doneEdit",this.cellTarget),this.enable=!1,this.ctx.editing=!1,this.inputEl.style.display="inline-block",this.editorEl.style.left="0px",this.editorEl.style.top=`${e.height}px`,this.editorEl.style.maxHeight=`${t}px`,this.editorEl.style.zIndex="-1",setTimeout(()=>{this.inputEl.focus({preventScroll:!0})},0),this.ctx.emit("draw")}clearEditor(){this.doneEdit(),this.cellTarget=null,this.selectorArrStr="",this.ctx.clearSelector(),this.ctx.focusCell=void 0,this.ctx.emit("draw")}destroy(){var e;(e=this.editorEl)==null||e.remove()}}let Fb=class{constructor(r){h(this,"ctx"),h(this,"emptyEl"),this.ctx=r;const{EMPTY_TEXT:e,EMPTY_CUSTOM_STYLE:t}=this.ctx.config;this.ctx.emptyElement?this.emptyEl=this.ctx.emptyElement:(this.emptyEl=document.createElement("div"),this.emptyEl.innerText=e),this.emptyEl.className="e-virt-table-empty",this.emptyEl.style.display="none",this.ctx.containerElement.appendChild(this.emptyEl),this.ctx.on("emptyChange",({type:i,headerHeight:s,bodyHeight:o,footerHeight:n})=>{const a=s+(o+n)/2,c={display:i==="empty"?"block":"none",top:`${a}px`,...t};Object.assign(this.emptyEl.style,c)})}destroy(){this.emptyEl.remove()}};class Kb{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(Nr(()=>{const e=this.ctx.overlayerElement.querySelectorAll('[data-auto-height="true"]'),t=new Map;e.forEach(s=>{const o=Number(s.getAttribute("data-row-index")),n=Number(s.getAttribute("data-col-index"));if(isNaN(o)||isNaN(n))return;const a=s.getBoundingClientRect(),c=`${o}_${n}`;t.set(c,Math.round(a.height))});const i=this.ctx.database.getOverlayerAutoHeightMap();if(!this.arerMapsEqual(i,t)){if(this.ctx.database.setOverlayerAutoHeightMap(t),i.size===0&&t.size===0)return;this.ctx.emit("draw")}},16.67)),this.observer.observe(this.ctx.overlayerElement,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),this.ctx.overlayerElement.getAttribute("data-overlayer")==="default"&&this.ctx.on("overlayerChange",e=>{const t=this.ctx.overlayerElement;t.replaceChildren(),Object.assign(t.style,e.style),e.views.forEach(i=>{const s=document.createElement("div");s.className=i.class,Object.assign(s.style,i.style),i.views.forEach(o=>{const n=document.createElement("div");Object.assign(n.style,o.style),o.cells.forEach(a=>{const c=document.createElement("div");Object.assign(c.style,a.style),Object.keys(a.domDataset).forEach(d=>{c.setAttribute(d,a.domDataset[d])}),typeof a.render=="function"&&a.render(c,a),n.appendChild(c)}),s.appendChild(n)}),t.appendChild(s)})})}draw(){const e=this.getContainer();this.ctx.emit("overlayerChange",e)}destroy(){this.observer&&this.observer.disconnect(),this.ctx.emit("overlayerChange",{style:{},views:[]})}getContainer(){const e=this.getHeader(),t=this.getBody(),i=this.getFooter();let s=[];const{FOOTER_FIXED:o,FOOTER_POSITION:n}=this.ctx.config;return o?n==="top"?s=[e,i,t]:s=[e,t,i]:s=[e,t],{views:s}}getHeader(){const{fixedLeftWidth:e,fixedRightWidth:t,config:{SCROLLER_TRACK_SIZE:i,CSS_PREFIX:s}}=this.ctx,{visibleWidth:o,visibleHeight:n,renderCellHeaders:a}=this.ctx.header;let c=[],d=[],f=[];a.forEach(v=>{v.render&&(v.fixed==="left"?d.push(v):v.fixed==="right"?f.push(v):c.push(v))});const u=t-i,g={key:"left",style:{position:"absolute",top:"0px",left:"0px",overflow:"hidden",width:`${e}px`,height:`${n}px`},cells:d},m={key:"center",style:{position:"absolute",top:"0px",left:`${e}px`,overflow:"hidden",width:`${o-e-u+1}px`,height:`${n}px`},cells:c},x={key:"right",style:{position:"absolute",top:"0px",right:"0px",overflow:"hidden",width:`${u+1}px`,height:`${n}px`},cells:f};return{type:"header",class:`${s}-overlayer-header`,style:{position:"relative",overflow:"hidden",width:`${o}px`,height:`${n}px`},views:[g,m,x]}}getBody(){const e=[],t=[],i=[];let s=this.ctx.body.renderRows;this.ctx.config.FOOTER_FIXED||(s=s.concat(this.ctx.footer.renderRows)),s.forEach(v=>{v.cells.forEach(p=>{p.cellType==="footer"&&(p.render=p.renderFooter),p.render&&(p.fixed==="left"?t.push(p):p.fixed==="right"?i.push(p):e.push(p))})});const{fixedLeftWidth:o,fixedRightWidth:n,config:{SCROLLER_TRACK_SIZE:a,CSS_PREFIX:c}}=this.ctx,{visibleWidth:d,visibleHeight:f}=this.ctx.body,u=n-a,g={key:"left",style:{position:"absolute",top:`${.5}px`,left:`${.5}px`,overflow:"hidden",width:`${o}px`,height:`${f}px`},cells:t},m={key:"center",style:{position:"absolute",top:`${.5}px`,left:`${o-.5}px`,overflow:"hidden",width:`${d-o-u}px`,height:`${f}px`},cells:e},x={key:"right",style:{position:"absolute",top:"0px",right:"0px",overflow:"hidden",width:`${u}px`,height:`${f}px`},cells:i};return{type:"body",class:`${c}-overlayer-body`,style:{position:"relative",overflow:"hidden",width:`${d}px`,height:`${f}px`},views:[g,m,x]}}getFooter(){const e=[],t=[],i=[];this.ctx.footer.renderRows.forEach(x=>{x.cells.forEach(v=>{v.cellType==="footer"&&v.renderFooter&&(v.render=v.renderFooter,v.fixed==="left"?t.push(v):v.fixed==="right"?i.push(v):e.push(v))})});const{fixedLeftWidth:s,fixedRightWidth:o,config:{SCROLLER_TRACK_SIZE:n,CSS_PREFIX:a}}=this.ctx,{visibleWidth:c,visibleHeight:d}=this.ctx.footer,f=o-n,u={key:"left",style:{position:"absolute",top:`${.5}px`,left:`${.5}px`,overflow:"hidden",width:`${s}px`,height:`${d}px`},cells:t},g={key:"center",style:{position:"absolute",top:`${.5}px`,left:`${s-.5}px`,overflow:"hidden",width:`${c-s-f}px`,height:`${d}px`},cells:e},m={key:"right",style:{position:"absolute",top:`${.5}px`,right:`${.5}px`,overflow:"hidden",width:`${f}px`,height:`${d}px`},cells:i};return{type:"footer",class:`${a}-overlayer-footer`,style:{position:"relative",overflow:"hidden",width:`${c}px`,height:`${d}px`},views:[u,g,m]}}}class Ko{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=Ei,s.appendChild(a);const c=this.createSubmenu(e.children);s._submenu=c,this.container.appendChild(c)}return s}createSubmenu(e){const t=this.createElement("div","e-virt-table-submenu");return e.forEach(i=>{t.appendChild(this.createMenuItem(i,!0))}),t}createElement(e,t=""){const i=document.createElement(e);return t&&(i.className=t),i}bindEvents(){this.container.addEventListener("mouseenter",this.boundMouseEnterHandler,!0),this.container.addEventListener("mouseleave",this.boundMouseLeaveHandler,!0),this.container.addEventListener("click",this.boundClickHandler)}handleMouseEvent(e,t){e.stopPropagation();const i=e.target.closest(".e-virt-table-menu-item, .e-virt-table-submenu-item");i&&(this.container.contains(i)||i.classList.contains("e-virt-table-submenu-item"))&&(t==="enter"?this.handleHover(i):this.handleLeave(i))}handleHover(e){e.classList.contains("e-virt-table-menu-item")&&(this.container.querySelectorAll(".e-virt-table-menu-item").forEach(i=>i.classList.remove("active")),e.classList.contains("disabled")||e.classList.add("active"));const t=e._submenu||e.querySelector(".e-virt-table-submenu");t&&(this.hideSiblingSubmenus(e),this.showSubmenu(e,t))}handleLeave(e){const t=e._submenu||e.querySelector(".e-virt-table-submenu");setTimeout(()=>{const i=t;i&&!i.matches(":hover")&&!e.matches(":hover")&&(this.hideSubmenu(i),e.classList.contains("e-virt-table-menu-item")&&e.classList.remove("active"))},150)}hideSiblingSubmenus(e){let t;if(e.classList.contains("e-virt-table-menu-item"))t=this.container.querySelectorAll(".e-virt-table-menu-item");else{const i=e.closest(".e-virt-table-submenu");if(i)t=i.querySelectorAll(".e-virt-table-submenu-item");else return}t.forEach(i=>{i!==e&&i._submenu&&this.hideSubmenu(i._submenu)})}async showSubmenu(e,t){if(this.activeSubmenus.has(t))return;this.activeSubmenus.add(t),t.classList.add("show");const i=vr(e,t,async()=>{const s=this.container.getBoundingClientRect(),o=window.innerWidth,n=t.offsetWidth||200,a=o-s.right,c=s.left,d=a>=n||a>=c?"right-start":"left-start",{x:f,y:u}=await Si(e,t,{placement:d,middleware:[Ri(8),Ii({padding:8})]});Object.assign(t.style,{left:`${f}px`,top:`${u}px`})});t._cleanup=i}hideSubmenu(e){if(!this.activeSubmenus.has(e))return;this.activeSubmenus.delete(e),e.classList.remove("show"),this.hideAllChildSubmenus(e);const t=e;t._cleanup&&(t._cleanup(),delete t._cleanup)}hideAllChildSubmenus(e){e.querySelectorAll(".e-virt-table-submenu-item").forEach(t=>{if(t._submenu){const i=t._submenu;if(this.activeSubmenus.has(i)){this.activeSubmenus.delete(i),i.classList.remove("show");const s=i;s._cleanup&&(s._cleanup(),delete s._cleanup),this.hideAllChildSubmenus(i)}}})}handleClick(e){e.stopPropagation();const t=e.target.closest(".e-virt-table-menu-item, .e-virt-table-submenu-item");if(!t||t.classList.contains("disabled"))return;if(t.classList.contains("e-virt-table-menu-item")){const o=t._submenu||t.querySelector(".e-virt-table-submenu");if(o){this.showSubmenu(t,o);return}}const i=t.getAttribute("data-menu")||(t==null?void 0:t.getAttribute("data-submenu")),s=this.findMenuItem(i||"");s&&(s.event&&s.event(e,this.hide.bind(this)),this.onClick&&this.onClick(s,i||""))}findMenuItem(e,t=this.menuData){for(const i of t){if(i.value===e)return i;if(i.children){const s=this.findMenuItem(e,i.children);if(s)return s}}return null}positionMenu(e){const t={getBoundingClientRect:()=>({width:0,height:0,top:e.clientY,left:e.clientX,right:e.clientX,bottom:e.clientY,x:e.clientX,y:e.clientY}),contextElement:document.body};vr(t,this.container,()=>{Si(t,this.container,{placement:"right-start",middleware:[Ri(),Ii(),Xr()]}).then(({x:i,y:s})=>{this.container&&Object.assign(this.container.style,{left:`${i}px`,top:`${s}px`})})})}hide(){this.cleanupAllSubmenus(this.container),this.container.style.display="none"}destroy(){this.container.removeEventListener("mouseenter",this.boundMouseEnterHandler,!0),this.container.removeEventListener("mouseleave",this.boundMouseLeaveHandler,!0),this.container.removeEventListener("click",this.boundClickHandler),this.cleanupAllSubmenus(this.container),this.container.style.display="none",this.container.replaceChildren()}removeMenuItem(e){const t=this.container.querySelector(`[data-menu="${e}"]`);if(!t)return!1;const i=t.querySelector(".e-virt-table-submenu");return i&&this.cleanupSubmenuRecursively(i),t.remove(),!0}removeSubMenuItem(e){const t=this.container.querySelector(`[data-submenu="${e}"]`);if(!t)return!1;const i=t.closest(".e-virt-table-submenu"),s=t._submenu;if(s&&this.cleanupSubmenuRecursively(s),t.remove(),i&&i.querySelectorAll(".e-virt-table-submenu-item").length===0){const o=this.container.querySelector("[data-menu]");if(o&&o._submenu===i)this.removeMenuItem(o.getAttribute("data-menu")||"");else{const n=this.container.querySelectorAll("[data-menu], [data-submenu]");for(const a of n)if(a._submenu===i){const c=a.getAttribute("data-menu")||a.getAttribute("data-submenu");c&&(a.hasAttribute("data-menu")?this.removeMenuItem(c):this.removeSubMenuItem(c));break}}}return!0}cleanupAllSubmenus(e){e.querySelectorAll(".e-virt-table-menu-item").forEach(t=>{t._submenu&&(this.cleanupSubmenuRecursively(t._submenu),t._submenu=void 0)})}cleanupSubmenuRecursively(e){const t=e;t._cleanup&&(t._cleanup(),delete t._cleanup),e.querySelectorAll(".e-virt-table-submenu-item").forEach(i=>{i._submenu&&this.cleanupSubmenuRecursively(i._submenu)}),e.remove()}}class Pb{constructor(e){h(this,"ctx"),h(this,"contextMenuEl"),h(this,"currentDOMTreeMenu"),h(this,"isCustom",!1),this.ctx=e,this.ctx.contextMenuElement?(this.contextMenuEl=this.ctx.contextMenuElement,this.contextMenuEl.className="e-virt-table-main-menu",this.isCustom=!0):(this.contextMenuEl=document.createElement("div"),this.isCustom=!1),this.ctx.containerElement.appendChild(this.contextMenuEl),this.init()}init(){this.ctx.on("outsideMousedown",()=>{this.hide()}),this.ctx.on("cellContextMenuClick",(e,t)=>{if(this.isCustom){this.contextMenuEl.style.display="block",this.positionMenu(t);return}const{ENABLE_CONTEXT_MENU:i,CUSTOM_BODY_CONTEXT_MENU:s,CONTEXT_MENU:o}=this.ctx.config,n=[...o,...s];if(!i||n.length===0)return;t.preventDefault();const{xArr:a,yArr:c}=this.ctx.selector,[d,f]=a,[u,g]=c,{rowIndex:m,colIndex:x}=e;m>=u&&m<=g&&x>=d&&x<=f||this.ctx.emit("setSelectorCell",e,t),this.currentDOMTreeMenu&&this.currentDOMTreeMenu.destroy(),this.ctx.contextMenuIng=!0,this.currentDOMTreeMenu=new Ko(this.contextMenuEl,n,{onClick:(v,p)=>{p==="copy"?(this.ctx.emit("contextMenuCopy"),this.hide()):p==="paste"?(this.ctx.emit("contextMenuPaste"),this.hide()):p==="cut"?(this.ctx.emit("contextMenuCut"),this.hide()):p==="clearSelected"&&(this.ctx.emit("contextMenuClearSelected"),this.hide())}}),this.currentDOMTreeMenu.positionMenu(t)}),this.ctx.on("cellHeaderContextMenuClick",(e,t)=>{if(this.isCustom){this.contextMenuEl.style.display="block",this.positionMenu(t);return}const{SELECTOR_AREA_MIN_X:i,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MAX_X_OFFSET:o}=this.ctx.config,n=i,a=s||this.ctx.maxColIndex-o;if(e.colIndex<n||e.colIndex>a)return;const{HEADER_CONTEXT_MENU:c,CUSTOM_HEADER_CONTEXT_MENU:d,ENABLE_HEADER_CONTEXT_MENU:f}=this.ctx.config,u=[...c,...d];if(!f||u.length===0)return;t.preventDefault();const{xArr:g}=this.ctx.selector,[m,x]=g,{colIndex:v}=e;v>=m&&v<=x||(this.ctx.focusCellHeader=e,this.ctx.emit("selectCols",e)),this.currentDOMTreeMenu&&this.currentDOMTreeMenu.destroy();const p=this.ctx.database.getColumns(),E=u.map(C=>C.value==="visible"?{...C,children:this.filterColumns(p)}:C);this.ctx.contextMenuIng=!0,this.currentDOMTreeMenu=new Ko(this.contextMenuEl,E,{onClick:(C,w)=>{const{xArr:b}=this.ctx.selector,[T,B]=b;if(w==="fixedLeft"||w==="fixedRight"||w==="fixedNone"){const K=this.ctx.header.allCellHeaders.filter(R=>R.colIndex>=T&&R.colIndex<=B).filter(R=>R.level===0).filter(R=>!R.column.fixedDisabled).map(R=>R.key);this.ctx.database.setCustomHeaderFixedData(K,w==="fixedLeft"?"left":w==="fixedRight"?"right":""),this.hide()}else if(w==="hide"){const K=this.ctx.header.leafCellHeaders.filter(R=>R.colIndex>=T&&R.colIndex<=B).filter(R=>!R.children.length).filter(R=>!R.column.hideDisabled).map(R=>R.key);K.length>0&&this.ctx.database.setCustomHeaderHideData(K,!0),this.hide()}else if(w!=="visible")if(w.startsWith("visible_")){if(!C.key)return;if(C.children){const R=this.getLeafKeys(C.children);this.ctx.database.setCustomHeaderHideData(R,!1)}else this.ctx.database.setCustomHeaderHideData([C.key],!1);this.currentDOMTreeMenu&&this.currentDOMTreeMenu.removeSubMenuItem(w);const K=this.ctx.database.getColumns();Ht(K).filter(R=>R.hide).length===0&&this.hide()}else w==="resetHeader"&&(this.ctx.database.resetCustomHeader(),this.hide())}}),this.positionMenu(t)}),this.ctx.on("click",()=>{this.hide()}),this.ctx.on("onScroll",this.hide.bind(this)),this.ctx.on("resize",this.hide.bind(this))}positionMenu(e){const t={getBoundingClientRect:()=>({width:0,height:0,top:e.clientY,left:e.clientX,right:e.clientX,bottom:e.clientY,x:e.clientX,y:e.clientY}),contextElement:document.body};vr(t,this.contextMenuEl,()=>{Si(t,this.contextMenuEl,{placement:"right-start",middleware:[Ri(),Ii(),Xr()]}).then(({x:i,y:s})=>{this.contextMenuEl&&Object.assign(this.contextMenuEl.style,{left:`${i}px`,top:`${s}px`})})})}filterColumns(e){const t=[];for(const i of e)if(i.children&&i.children.length>0){const s=this.filterColumns(i.children);s.length>0&&t.push({label:i.title,key:i.key,value:`visible_${i.key}`,children:s})}else i.hide&&t.push({label:i.title,value:`visible_${i.key}`,key:i.key});return t}getLeafKeys(e){return e.reduce((t,i)=>(!i.children||i.children.length===0?t.push(String(i.key)):t.push(...this.getLeafKeys(i.children)),t),[])}hide(){this.currentDOMTreeMenu&&(this.currentDOMTreeMenu.destroy(),this.currentDOMTreeMenu=void 0),this.contextMenuEl.style.display="none",this.ctx.contextMenuIng=!1}destroy(){var e;this.hide(),(e=this.contextMenuEl)==null||e.remove()}}class Yb{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 Vb{constructor(e){h(this,"ctx"),h(this,"container"),h(this,"input"),h(this,"prevBtn"),h(this,"nextBtn"),h(this,"closeBtn"),h(this,"countEl"),h(this,"loadingEl"),h(this,"isVisible",!1),h(this,"searchResults",[]),h(this,"currentIndex",-1),h(this,"searchData",[]),h(this,"isComposing",!1),this.ctx=e,this.container=this.createContainer(),this.ctx.containerElement.appendChild(this.container),this.bindEvents(),this.ctx.on("keydown",t=>{if(this.ctx.config.ENABLE_FINDER&&!this.ctx.editing){if((t.ctrlKey||t.metaKey)&&t.code==="KeyF"){t.preventDefault(),this.show();return}if(this.ctx.finding){if(t.code==="Escape"){t.preventDefault(),this.hide();return}if(t.code==="ArrowUp"||t.shiftKey&&t.key==="Enter"){t.preventDefault(),this.navigatePrevious();return}if(t.code==="ArrowDown"||t.key==="Enter"){t.preventDefault(),this.navigateNext();return}}}}),this.ctx.on("setSelector",()=>{this.hide()}),this.ctx.on("outsideMousedown",()=>{this.hide()})}async initSearchData(){this.showLoading(),this.searchData=[],setTimeout(()=>{const{allCellHeaders:e}=this.ctx.header;for(let s=0;s<e.length;s++){const o=e[s];o&&["string","number"].includes(typeof o.text)&&this.searchData.push({rowIndex:0,colIndex:o.colIndex,text:`${o.text}`,type:"header",colKey:o.key})}const{maxColIndex:t,maxRowIndex:i}=this.ctx;for(let s=0;s<i;s++)for(let o=0;o<t;o++){const n=this.ctx.database.getVirtualBodyCell(s,o,!1),a=n==null?void 0:n.getText();["string","number"].includes(typeof a)&&this.searchData.push({rowIndex:s,colIndex:o,text:`${a}`,type:"body"})}this.hideLoading()},0)}createContainer(){const e=document.createElement("div");e.className="e-virt-table-finder-bar";const t=document.createElement("div");t.className="e-virt-table-finder-bar-input-wrapper",this.input=document.createElement("input"),this.input.type="text",this.input.className="e-virt-table-finder-bar-input",this.input.placeholder="",t.appendChild(this.input),this.loadingEl=document.createElement("div"),this.loadingEl.className="e-virt-table-finder-bar-loading";const i=Za;this.loadingEl.innerHTML=i,t.appendChild(this.loadingEl),this.countEl=document.createElement("span"),this.countEl.className="e-virt-table-finder-bar-count";const s=document.createElement("div");return s.className="e-virt-table-finder-bar-nav",this.prevBtn=document.createElement("button"),this.prevBtn.className="e-virt-table-finder-bar-nav-btn prev-btn",this.prevBtn.innerHTML=Ei,this.nextBtn=document.createElement("button"),this.nextBtn.className="e-virt-table-finder-bar-nav-btn next-btn",this.nextBtn.innerHTML=Ei,s.appendChild(this.prevBtn),s.appendChild(this.nextBtn),this.closeBtn=document.createElement("button"),this.closeBtn.className="e-virt-table-finder-bar-nav-btn close-btn",this.closeBtn.innerHTML="×",e.appendChild(t),e.appendChild(this.countEl),e.appendChild(s),e.appendChild(this.closeBtn),e}bindEvents(){this.input.addEventListener("input",()=>{this.isComposing||this.performSearch()}),this.input.addEventListener("compositionstart",()=>{this.isComposing=!0}),this.input.addEventListener("compositionend",()=>{this.isComposing=!1,this.performSearch()}),this.prevBtn.addEventListener("click",()=>{this.navigatePrevious()}),this.nextBtn.addEventListener("click",()=>{this.navigateNext()}),this.closeBtn.addEventListener("click",()=>{this.hide()})}performSearch(){const e=this.input.value.trim();if(this.searchResults=[],this.currentIndex=-1,!e){this.cearFinderBar(),this.updateCount();return}this.showLoading(),setTimeout(()=>{this.searchResults=this.searchData.filter(t=>t.text.toLowerCase().includes(e.toLowerCase())),this.searchResults.length>0?(this.currentIndex=0,this.scrollToCurrentResult()):this.cearFinderBar(),this.updateCount(),this.hideLoading()},0)}scrollToCurrentResult(){if(this.currentIndex<0||this.currentIndex>=this.searchResults.length)return;const e=this.searchResults[this.currentIndex];this.ctx.finderBar=e;const{rowIndex:t,colIndex:i}=e;this.ctx.emit("scrollToIndex",t,i)}navigateNext(){this.searchResults.length!==0&&(this.currentIndex=(this.currentIndex+1)%this.searchResults.length,this.scrollToCurrentResult(),this.updateCount())}navigatePrevious(){this.searchResults.length!==0&&(this.currentIndex=this.currentIndex<=0?this.searchResults.length-1:this.currentIndex-1,this.scrollToCurrentResult(),this.updateCount())}updateCount(){if(this.searchResults.length===0)this.input.value.trim()?(this.countEl.textContent="0/0",this.countEl.classList.add("no-results")):(this.countEl.textContent="",this.countEl.classList.remove("no-results"));else{const e=this.currentIndex+1,t=this.searchResults.length;this.countEl.textContent=`${e}/${t}`,this.countEl.classList.remove("no-results")}}show(){this.isVisible||(this.isVisible=!0,this.ctx.finding=!0,this.container.classList.add("show"),this.input.focus(),this.initSearchData())}showLoading(){var e;this.loadingEl.classList.add("show"),(e=this.loadingEl.parentElement)==null||e.classList.add("loading"),this.input.readOnly=!0}hideLoading(){var e;this.loadingEl.classList.remove("show"),(e=this.loadingEl.parentElement)==null||e.classList.remove("loading"),this.input.readOnly=!1}cearFinderBar(){this.ctx.finderBar={rowIndex:-1,colIndex:-1,text:"",type:"header"},this.ctx.emit("draw")}hide(){this.isVisible&&(this.isVisible=!1,this.container.classList.remove("show"),this.ctx.finding=!1,this.input.value="",this.searchResults=[],this.searchData=[],this.currentIndex=-1,this.hideLoading(),this.ctx.finderBar={rowIndex:-1,colIndex:-1,text:"",type:"header"},this.updateCount(),this.ctx.emit("draw"))}destroy(){this.hide(),this.container.remove()}}class Wb{constructor(e,t){h(this,"options"),h(this,"scroller"),h(this,"header"),h(this,"body"),h(this,"footer"),h(this,"selector"),h(this,"autofill"),h(this,"tooltip"),h(this,"editor"),h(this,"empty"),h(this,"overlayer"),h(this,"contextMenu"),h(this,"loading"),h(this,"finderBar"),h(this,"animationFrameId"),h(this,"ctx"),this.options=t;const{overlayerElement:i,editorElement:s,emptyElement:o,contextMenuElement:n}=this.options,a=this.createContainer(e,i,s,o,n);this.ctx=new KC(a,this.options),this.header=new VC(this.ctx),this.footer=new XC(this.ctx),this.body=new WC(this.ctx),this.scroller=new PC(this.ctx),this.selector=new zC(this.ctx),this.autofill=new GC(this.ctx),this.tooltip=new Bb(this.ctx),this.empty=new Fb(this.ctx),this.editor=new Hb(this.ctx),this.overlayer=new Kb(this.ctx),this.contextMenu=new Pb(this.ctx),this.loading=new Yb(this.ctx),this.finderBar=new Vb(this.ctx),this.ctx.on("draw",()=>{this.draw()}),this.ctx.on("drawView",()=>{this.draw(!0)}),this.draw()}createContainer(e,t,i,s,o){e.className="e-virt-table-container";const n=document.createElement("div"),a=document.createElement("canvas"),c=t||document.createElement("div");n.className="e-virt-table-stage",e.tabIndex=0,a.className="e-virt-table-canvas",c.className="e-virt-table-overlayer",c.setAttribute("data-overlayer",t?"custom":"default");const d=i||document.createElement("div");d.className="e-virt-table-editor";const f=s,u=o;return n.appendChild(a),n.appendChild(c),e.appendChild(n),{containerElement:e,stageElement:n,canvasElement:a,overlayerElement:c,editorElement:d,emptyElement:f,contextMenuElement:u}}doDraw(e=!1){this.header.update(),this.footer.update(),this.body.update(),this.ctx.paint.clear(),this.body.draw(),this.footer.draw(),this.header.draw(),this.scroller.draw(),e||this.overlayer.draw()}draw(e=!1){this.animationFrameId&&cancelAnimationFrame(this.animationFrameId),this.animationFrameId=requestAnimationFrame(()=>{this.doDraw(e),this.body.updateAutoHeight()&&this.doDraw(e)})}loadConfig(e){this.ctx.config.init(e),this.ctx.database.init(!1),this.header.init(),this.ctx.emit("draw")}loadColumns(e){this.editor.doneEdit(),this.ctx.database.setColumns(e),this.header.init(),this.ctx.emit("draw")}loadData(e){this.editor.doneEdit(),this.ctx.database.setData(e),this.header.init(),this.tooltip.hide(),this.ctx.emit("draw")}loadFooterData(e){this.ctx.database.setFooterData(e),this.ctx.emit("draw")}setCustomHeader(e,t=!0){this.ctx.database.setCustomHeader(e,t),this.header.init(),this.ctx.emit("draw")}getCustomHeader(){return this.header.getCustomHeader()}showColumns(e,t=!0){this.ctx.database.setCustomHeaderHideData(e,!t),this.header.init(),this.ctx.emit("draw")}fixedColumns(e,t){this.ctx.database.setCustomHeaderFixedData(e,t),this.header.init(),this.ctx.emit("draw")}setLoading(e){this.ctx.loading=e,e?this.loading.show():this.loading.hide()}on(e,t){this.ctx.on(e,t)}emit(e,...t){this.ctx.emit(e,...t)}off(e,t){this.ctx.off(e,t)}filterMethod(e){this.ctx.database.setFilterMethod(e),this.ctx.database.init(!1),this.header.init(),this.ctx.emit("draw")}editCell(e,t){this.editor.editCell(e,t)}setItemValue(e,t,i,s=!0,o=!0,n=!1){this.ctx.database.setItemValue(e,t,i,s,o,n)}batchSetItemValue(e,t=!0){this.ctx.database.batchSetItemValue(e,t)}setItemValueByEditor(e,t,i,s=!0,o=!0){this.ctx.setItemValueByEditor(e,t,i,s,o),this.editor.doneEdit()}clearEditableData(e=null){const t=[0,this.ctx.maxColIndex],i=[0,this.ctx.maxRowIndex];return this.selector.clearSelectedData(t,i,!1,e)}clearEditor(){this.editor.clearEditor()}doLayout(){this.ctx.emit("draw")}getChangedData(){return this.ctx.database.getChangedData()}getChangedRows(){return this.ctx.database.getChangedRows()}setCurrentRowByRowIndex(e){this.ctx.currentCell=this.ctx.database.getVirtualBodyCell(e,0),this.ctx.emit("draw")}setCurrentRow(e){const t=this.ctx.database.getColumnByColIndex(0);t&&(this.ctx.currentCell=this.ctx.database.getVirtualBodyCellByKey(e,t.key),this.ctx.emit("draw"))}getCurrentRow(){const e=this.ctx.currentCell;return e?{row:e.row,rowIndex:e.rowIndex,rowKey:e.rowKey}:void 0}clearValidate(){this.ctx.database.clearValidate(),this.ctx.emit("draw")}validateFields(e,t=!0){return new Promise(async(i,s)=>{let o=[];for(let n=0;n<e.length;n++){const{rowKey:a,key:c}=e[n],d=await this.ctx.database.getValidator(a,c);Array.isArray(d)&&d.length&&o.push(d)}if(o.length){if(s(o),t){const[n]=o;if(Array.isArray(n)&&n.length){const[a]=n,{rowKey:c,key:d}=a;this.scrollToRowkey(c),this.scrollToColkey(d)}}this.ctx.emit("draw")}else i([]),this.ctx.emit("draw")})}async validate(e=!0){return new Promise(async(t,i)=>{try{const s=await this.getValidations();t(s)}catch(s){if(e&&Array.isArray(s)&&s.length){const[o]=s;if(Array.isArray(o)&&o.length){const[n]=o,{rowKey:a,key:c}=n,d=this.ctx.database.getRowForRowKey(a);if(d){const{parentRowKeys:f=[]}=d;f&&f.length&&this.setExpandRowKeys(f,!0)}this.scrollToRowkey(a),this.scrollToColkey(c)}}i(s)}})}setValidations(e){if(e.forEach(t=>{const{rowIndex:i,key:s,message:o,rowKey:n}=t;if(i!==void 0&&n===void 0){const a=this.ctx.database.getRowKeyForRowIndex(i);this.ctx.database.setValidationErrorByRowKey(a,s,o)}n&&this.ctx.database.setValidationErrorByRowKey(n,s,o)}),e&&Array.isArray(e)&&e.length){const[t]=e;if(t&&t.rowKey)this.scrollToRowkey(t.rowKey),this.scrollToColkey(t.key);else if(t&&t.rowIndex!==void 0&&t.rowIndex>=0&&t.key){const{rowIndex:i,key:s}=t;this.scrollToRowIndex(i),this.scrollToColkey(s)}}}getValidations(){return new Promise(async(e,t)=>{const i=this.ctx.database.getAllRowsData(),s=this.ctx.header.leafCellHeaders;let o=[];for(let n=0;n<i.length;n++)for(let a=0;a<s.length;a++){const c=this.ctx.database.getRowKeyByItem(i[n]),d=s[a].key,f=await this.ctx.database.getValidator(c,d);Array.isArray(f)&&f.length&&o.push(f)}o.length?(t(o),this.ctx.emit("draw")):(e([]),this.ctx.emit("draw"))})}hasValidationError(){return this.ctx.database.hasValidationError()}scrollTo(e,t){this.scroller.setScroll(e,t)}scrollXTo(e){this.scroller.setScrollX(e)}scrollToColkey(e){this.scroller.scrollToColkey(e)}scrollToRowkey(e){this.scroller.scrollToRowKey(e)}scrollToColIndex(e){this.scroller.scrollToColIndex(e)}scrollToRowIndex(e){this.scroller.scrollToRowIndex(e)}scrollYTo(e){this.scroller.setScrollY(e)}setExpandRowKeys(e,t=!0){this.ctx.database.setExpandRowKeys(e,t)}getExpandRowKeys(){return this.ctx.database.getExpandRowKeys()}clearSelection(){this.ctx.database.clearSelection(),this.ctx.emit("draw")}toggleRowSelection(e){const t=this.ctx.database.getRowKeyByItem(e);this.ctx.database.toggleRowSelection(t),this.ctx.emit("draw")}setSelectionByRows(e,t=!0){e.forEach(i=>{const s=this.ctx.database.getRowKeyByItem(i);this.ctx.database.setRowSelection(s,t,!1)}),this.ctx.emit("selectionChange",this.getSelectionRows()),this.ctx.emit("draw")}setSelectionByRowKeys(e,t=!0){e.forEach(i=>{this.ctx.database.setRowSelection(i,t,!1)}),this.ctx.emit("selectionChange",this.getSelectionRows()),this.ctx.emit("draw")}toggleAllSelection(){this.ctx.database.toggleAllSelection(),this.ctx.emit("draw")}toggleRowExpand(e,t){this.ctx.database.expandItem(e,t),this.ctx.emit("draw")}toggleExpandAll(e){this.ctx.database.expandAll(e),this.ctx.emit("draw")}getSelectionRows(){return this.ctx.database.getSelectionRows()}getPositionForRowIndex(e){return this.ctx.database.getPositionForRowIndex(e)}getCellValue(e,t){return this.ctx.database.getItemValue(e,t)}getCellValueByIndex(e,t){return this.ctx.database.getItemValueForRowIndexAndColIndex(e,t)}clearSort(){this.ctx.database.clearSort()}contextMenuHide(){this.contextMenu.hide()}getUtils(){return{mergeColCell:TC,mergeRowCell:SC,getSpanArrByRow:Ga,getSpanObjByColumn:Ua}}getColumnByKey(e){var t;return(t=this.ctx.database.getColumnByKey(e))==null?void 0:t.column}clearChangeData(){this.ctx.database.clearChangeData(),this.ctx.emit("draw")}destroy(){this.overlayer.destroy(),this.empty.destroy(),this.editor.destroy(),this.tooltip.destroy(),this.selector.destroy(),this.autofill.destroy(),this.contextMenu.destroy(),this.loading.destroy(),this.finderBar.destroy(),this.ctx.destroy(),this.ctx.containerElement.remove()}}const Xb=l.defineComponent((r,{emit:e})=>{const{cellRender:t,renderTableParams:i}=r,{row:s,field:o}=i;if(o){const n=l.ref(s[o]);return()=>{var a,c;return((c=(a=Bt.renders[t.name])==null?void 0:a.renderEdit)==null?void 0:c.call(a,n,t,i,e))??null}}else return()=>null},{name:"RenderEditCell",props:["cellRender","renderTableParams"],emits:["blur"]}),zr=l.defineComponent({__name:"PCanvasTable",props:{columns:{},data:{},config:{default:()=>({})},footerData:{},loading:{type:Boolean}},emits:["change","selectionChange","ready"],setup(r,{expose:e,emit:t}){const i=t,s=l.ref([]),o=r,n=Ha(),a=l.computed(()=>({...o,config:{AUTO_ROW_HEIGHT:!0,DISABLED:!0,...n,...o.config}}));let c=null;const d=l.useAttrs(),f=l.ref(null),u=l.ref(null),g=l.ref(null),m=l.ref(null),x=l.ref(),v=l.ref("text"),p=l.ref(),E={},C={},w=l.computed(()=>{const y=x.value;return y?{width:`${y.width}px`,height:`${y.height}px`}:{}}),b=y=>pt[y]||(({cellValue:D})=>D),T=y=>{var D;return(D=Bt.renders[y])==null?void 0:D.renderDefault},B=(y,...D)=>({row:L,rowIndex:Y,value:W})=>y({row:L,rowIndex:Y,cellValue:W},...D),K=y=>{var D,L,Y,W,P;if((D=y.slots)!=null&&D.default&&S.isFunction((L=y.slots)==null?void 0:L.default))return X=>{var U,q;return(q=(U=y.slots)==null?void 0:U.default)==null?void 0:q.call(U,{row:X.row,column:y,rowIndex:X.rowIndex})};if((Y=y.slots)!=null&&Y.default&&S.isString((W=y.slots)==null?void 0:W.default))return`slot:${(P=y.slots)==null?void 0:P.default}`;if(y.cellRender&&y.cellRender.name)return X=>{var U,q;return(q=T(y.cellRender.name))==null?void 0:q(y.cellRender,{data:o.data,row:X.row,rowIndex:X.rowIndex,field:y.field||X.column.key,title:((U=X.column)==null?void 0:U.title)??""},{})}},R=y=>{var D,L;if((D=y.slots)!=null&&D.title&&S.isFunction((L=y.slots)==null?void 0:L.title))return Y=>{var W,P;return(P=(W=y.slots)==null?void 0:W.title)==null?void 0:P.call(W,{column:y})}},I=y=>{var D,L,Y,W,P,X,U;return(D=y.slots)!=null&&D.edit&&(y.field||y.key)&&S.isFunction((L=y.slots)==null?void 0:L.edit)?E[`__slot:${y.field||y.key}`]=y:(Y=y.editRender)!=null&&Y.name&&(y.field||y.key)&&(C[y.field||y.key]=y.editRender),{...S.omit(y,["formatter"]),key:y.key||y.field||Ae(),formatter:S.isString(y.formatter)?B(b(y.formatter)):S.isArray(y.formatter)&&S.isString(y.formatter[0])?B(b(y.formatter[0]),...y.formatter.slice(1)):S.isFunction(y.formatter)?B(y.formatter):void 0,editorType:y.editorType??((W=y.slots)!=null&&W.edit&&(y.field||y.key)&&S.isFunction((P=y.slots)==null?void 0:P.edit)?`__slot:${y.field||y.key}`:(X=y.editRender)!=null&&X.name?y.editRender.name:void 0),render:K(y),renderHeader:R(y),children:(U=y.children)==null?void 0:U.map(q=>I(q))}};l.onMounted(()=>{f.value&&(c=new Wb(f.value,{config:a.value.config,columns:o.columns.map(y=>I(y)),data:o.data,footerData:o.footerData,emptyElement:g.value||void 0,overlayerElement:m.value||void 0,editorElement:u.value||void 0}),Object.keys(d).forEach(y=>{const D=d[y];if(typeof D=="function"&&y.startsWith("on")){const L=y.charAt(2).toLowerCase()+y.slice(3);c==null||c.on(L,D)}}),c.on("change",y=>{i("change",y)}),c.on("overlayerChange",y=>{p.value=y,console.log("overlayerChange",y)}),c.on("startEdit",y=>{x.value=y,v.value=y.editorType,v.value}),c.on("doneEdit",()=>{v.value="text"}),c.on("selectionChange",y=>{s.value=y,i("selectionChange",y)}),i("ready",c))});function _(y){if(!c||!x.value)return;const{rowKey:D,key:L}=x.value;c==null||c.setItemValueByEditor(D,L,y)}const O=()=>document.body;return l.watch(()=>o.data,y=>{c==null||c.loadData(y)},{deep:!0}),Lr(()=>o.columns,(y,D)=>{S.isEqual(y,D)||c==null||c.loadColumns(y.map(L=>I(L)))},{deep:!0}),l.watch(()=>a.value.config,y=>{c==null||c.loadConfig(y)},{deep:!0}),l.watch(()=>o.footerData,y=>{c==null||c.loadFooterData(y||[])},{deep:!0}),l.watch(()=>o.loading,(y,D)=>{y!==D&&(c==null||c.setLoading(y))},{immediate:!0}),e({$table:c,selectedRecords:l.computed(()=>s.value),reloadData:()=>{c==null||c.loadData(o.data)}}),(y,D)=>{const L=l.resolveComponent("a-empty"),Y=l.resolveComponent("a-spin");return l.openBlock(),l.createBlock(Y,{spinning:y.loading},{default:l.withCtx(()=>{var W,P,X,U,q,Ke,ht;return[l.createElementVNode("div",{ref_key:"eVirtTableRef",ref:f},[l.createElementVNode("div",{ref_key:"eVirtTableEditorRef",ref:u},[v.value.startsWith("__slot:")?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(E[v.value].slots.edit({row:x.value.row,column:E[v.value],rowIndex:x.value.rowIndex})),{key:0,bordered:!1,style:l.normalizeStyle(w.value),class:"ev-editor-wrapper","get-popup-container":O,value:x.value.value,"onUpdate:value":D[0]||(D[0]=he=>x.value.value=he),cell:x.value,onBlur:_},null,40,["style","value","cell"])):(W=l.unref(Bt).renders[v.value])!=null&&W.renderEdit?(l.openBlock(),l.createBlock(l.unref(Xb),{key:1,"cell-render":C[x.value.key],class:"ev-editor-wrapper",style:l.normalizeStyle(w.value),"render-table-params":{data:o.data,row:(P=x.value)==null?void 0:P.row,rowIndex:((X=x.value)==null?void 0:X.rowIndex)??-1,field:((U=x.value)==null?void 0:U.key)??"",title:((Ke=(q=x.value)==null?void 0:q.column)==null?void 0:Ke.title)??""},bordered:!1,"get-popup-container":O,onBlur:_},null,8,["cell-render","style","render-table-params"])):l.createCommentVNode("",!0)],512),l.createElementVNode("div",{ref_key:"eVirtTableEmptyRef",ref:g},[l.renderSlot(y.$slots,"empty",{},()=>[l.createVNode(L,{description:"空数据"})])],512),l.createElementVNode("div",{ref_key:"eVirtTableOverlayerRef",ref:m},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(((ht=p.value)==null?void 0:ht.views)||[],he=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(he.class),style:l.normalizeStyle(he.style),key:he.type},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(he.views,qe=>(l.openBlock(),l.createElementBlock("div",{style:l.normalizeStyle(qe.style),key:qe.key},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(qe.cells,ee=>(l.openBlock(),l.createElementBlock("div",l.mergeProps({class:"canvas-cell",key:`${ee.rowKey}_${ee.key}`,style:{...ee.style}},{ref_for:!0},ee.domDataset),[typeof ee.render=="function"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(ee.render(ee)),{key:0,bordered:!1})):typeof ee.render=="string"&&ee.render.startsWith("slot:")?l.renderSlot(y.$slots,ee.render.replace("slot:",""),l.mergeProps({key:1,ref_for:!0},ee,{cell:ee})):l.createCommentVNode("",!0)],16))),128))],4))),128))],6))),128))],512)],512)]}),_:3},8,["spinning"])}}}),zb={key:0},Gb={key:1,class:"p-canvas-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"},Ub={class:"flex items-center flex-1 gap-4px"},qb={key:2},Zb={class:"flex items-center gap-4px"},Jb={class:l.normalizeClass("p-pane flex-1 h-0 p-inner-scroll")},Qb={key:0,class:"w-full text-slate-5 pl-4"},cl=l.defineComponent({__name:"PCanvasGrid",props:{staticConfig:{},manualFetch:{type:Boolean},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},config:{},lazyReset:{type:Boolean,default:()=>xt().lazyReset??!1},fitHeight:{default:()=>xt().fitCanvasHeight??100}},emits:["toolbarButtonClick","toolbarToolClick","pick","resetQuery"],setup(r,{expose:e,emit:t}){var jt,ei,ti,ii,ri;const i=r,s=l.useAttrs(),o=t,{formConfig:n,pageConfig:a,columns:c,toolbarConfig:d,proxyConfig:f,config:u,staticConfig:g}=l.toRefs(i),m=Ha(),x=l.ref(Ae()),v=l.ref({}),p=l.computed(()=>({...i,config:{...m,...i.config}})),E=l.computed(()=>f.value&&f.value.ajax?a.value?"pagination":"list":"bad");l.computed(()=>E.value==="pagination"?{current:b.page,total:B.value,pageSize:b.size,responsive:!1,showSizeChanger:!0,showTotal:$=>`共${$}条数据`}:!1);const C=l.computed(()=>S.omit({labelCol:kr,...n.value},["items"])),w=l.reactive({toolbar:!1,form:!1,table:!1}),b=l.reactive({page:1,size:((jt=a.value)==null?void 0:jt.pageSize)??10}),T=l.ref(0),B=l.ref(0),K=l.ref([]),R=l.ref(),I=l.ref(),_=l.ref(),O=l.ref(),y=l.ref(500),D=l.ref({}),L=$=>{D.value[b.page]=$},Y=l.reactive([...(((ti=(ei=i.toolbarConfig)==null?void 0:ei.buttons)==null?void 0:ti.map($=>$.code))??[]).filter($=>$),...(((ri=(ii=i.toolbarConfig)==null?void 0:ii.tools)==null?void 0:ri.map($=>$.code))??[]).filter($=>$)].reduce(($,H)=>($[H]=!1,$),{})),W=($,H)=>{Y[$]=H},P=$=>{S.isObject($)?(Object.prototype.hasOwnProperty.call($,"toolbar")&&(w.toolbar=$.toolbar),Object.prototype.hasOwnProperty.call($,"form")&&(w.form=$.form),Object.prototype.hasOwnProperty.call($,"table")&&(w.table=$.table)):S.isBoolean($)&&(w.form=$,w.toolbar=$,w.table=$)},X=l.computed(()=>S.uniq(Object.values(D.value).flat(),$=>{var H;return $[((H=p.value.config)==null?void 0:H.ROW_KEY)??"id"]})),U=()=>{Ze()},q=l.computed(()=>X.value.map($=>{var H;return $[((H=p.value.config)==null?void 0:H.ROW_KEY)??"id"]})),Ke=($,H)=>H?{list:S.isString(H.list)?S.get($,H.list):S.isFunction(H.list)?H.list($):void 0,total:S.isString(H.total)?S.get($,H.total):S.isFunction(H.total)?H.total($):void 0,result:S.isString(H.result)?S.get($,H.result):S.isFunction(H.result)?H.result($):void 0,message:S.isString(H.message)?S.get($,H.message):S.isFunction(H.message)?H.message($):void 0}:{list:$},ht=$=>{o("toolbarButtonClick",{data:K.value,code:$,selectedKeys:q.value,records:X.value}),ut($)},he=S.debounce(ht,100),qe=({key:$})=>he($),ee=$=>{o("toolbarToolClick",{data:K.value,code:$,selectedKeys:q.value,records:X.value}),ut($)},Pi=S.debounce(ee,100),ve=()=>new Promise($=>{if(E.value!=="bad"){P({table:!0,form:!0});const{ajax:H}=f.value;H.query({form:v.value,page:b}).then(V=>{const{list:de,total:je,result:me,message:xe}=Ke(V,f.value.response);de?(K.value=de,T.value++):me?(K.value=me,B.value=je??me.length,T.value++):(K.value=[],T.value++,xe&&wi(xe)),$(K.value)}).catch(V=>{console.error("fetchData error",V),$([])}).finally(()=>{P({table:!1,form:!1})})}}),Yi=($,H)=>(b.page=$,b.size=H,ve()),Ze=()=>(b.page=1,D.value={},ve()),dt=S.debounce(ve,160),Qt=($,H)=>(Object.assign(v.value,$),b.page=1,H?Promise.resolve():dt()),Vi=($,H)=>(v.value=$,b.page=1,H?Promise.resolve():dt()),ut=$=>{const{ajax:H}=f.value;switch($){case"multiDelete":H.multiDelete&&(q.value.length>0?Wa({title:"警告",content:"确认删除选中的数据吗?"}).then(()=>{P({table:!0,toolbar:!0}),H.multiDelete(q.value).then(()=>{uC("删除成功"),Ze()}).catch(()=>{fC("删除失败")}).finally(()=>{P({table:!1,toolbar:!1}),Y.multiDelete=!1})}):wi("请选择要删除的数据"));break}},Wi=l.computed(()=>!g.value||!g.value.selectable&&!g.value.tree?c.value:[g.value.selectable&&g.value.tree?{type:"selection-tree",width:40,widthFillDisable:!0,title:""}:g.value.selectable?{type:"selection",width:40,widthFillDisable:!0,title:""}:g.value.tree?{type:"tree",width:40,widthFillDisable:!0,title:""}:{type:"index",width:40,widthFillDisable:!0,title:""},...c.value]),Je=$=>{if(n.value&&n.value.items.length>0){if(n.value.customReset)n.value.customReset();else{const H={};Nt(n.value.items,V=>{V.field&&V.itemRender?ue(V.itemRender.defaultValue)?H[V.field]=V.itemRender.defaultValue:H[V.field]=void 0:V.field&&V.slots&&(ue(V.slots.defaultValue)?H[V.field]=V.slots.defaultValue:H[V.field]=void 0)}),v.value=H}o("resetQuery")}b.page=1,$||dt()},ft=()=>(D.value={},Je()),Qe=()=>{var me,xe;const $=(me=_.value)==null?void 0:me.parentElement,H=$?window.getComputedStyle($).height:"0px",V=O.value?window.getComputedStyle(O.value).height:"0px",de=V.includes("px")?S.toNumber(V.replace("px","")):0,je=(xe=g.value)!=null&&xe.showCount?22:0;y.value=S.toNumber(H.replace("px",""))-i.fitHeight-(i.toolbarConfig?30:0)-de-je};let kt;return l.onMounted(()=>{Qe(),window.addEventListener("resize",Qe),kt=new MutationObserver($=>{$.forEach(H=>{if(H.type==="attributes"&&H.attributeName==="style"){const V=H.target;window.getComputedStyle(V).display!=="none"&&Qe()}})}),_.value&&kt.observe(_.value,{attributes:!0,attributeFilter:["style"]}),Je(i.manualFetch)}),l.onBeforeUnmount(()=>{window.removeEventListener("resize",Qe),kt.disconnect()}),e({commitProxy:{query:dt,reload:ft,reloadPage:Ze,passQuery:Qt,forcePassQuery:Vi},$canvasTable:l.computed(()=>I.value),selectedRowKeys:q,setBtnLoading:W,selectedRecords:X,$form:l.computed(()=>R.value),getFormData:()=>v.value,setLoadings:P,resizeTable:Qe}),($,H)=>{var me,xe,Lt;const V=l.resolveComponent("a-menu-item"),de=l.resolveComponent("a-menu"),je=l.resolveComponent("a-dropdown");return l.openBlock(),l.createElementBlock("div",l.mergeProps({ref_key:"boxEl",ref:_,class:"h-full p-wrapper flex flex-col gap-8px overflow-y-auto"},l.unref(s)),[E.value==="bad"?(l.openBlock(),l.createElementBlock("div",zb,"请检查配置")):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[(xe=(me=l.unref(n))==null?void 0:me.items)!=null&&xe.some(F=>F.field&&F.itemRender)?(l.openBlock(),l.createElementBlock("div",{key:0,class:"p-pane p-form-wrapper",ref_key:"pFormWrapper",ref:O},[l.createVNode(l.unref(A.Spin),{spinning:w.form},{default:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.unref(A.Form),l.mergeProps({key:x.value,ref_key:"formEl",ref:R,model:v.value},C.value,{onSubmit:U}),{default:l.withCtx(()=>[l.createVNode(l.unref(A.Row),{gutter:[6,12]},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(n).items,(F,pe)=>(l.openBlock(),l.createBlock($r,{key:`_col_${F.field||pe}`,"form-data":v.value,item:F,onReset:H[0]||(H[0]=Re=>Je(i.lazyReset))},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["model"]))]),_:1},8,["spinning"])],512)):l.createCommentVNode("",!0),l.unref(d)?(l.openBlock(),l.createElementBlock("div",Gb,[l.createElementVNode("div",Ub,[l.unref(d).buttons&&l.unref(d).buttons.length>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(d).buttons,(F,pe)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:pe},[F.dropdowns&&F.dropdowns.length?(l.openBlock(),l.createBlock(je,{key:0},{overlay:l.withCtx(()=>[l.createVNode(de,{onClick:qe},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(F.dropdowns,Re=>(l.openBlock(),l.createBlock(V,{key:Re.code},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(Re.content),1)]),_:2},1024))),128))]),_:2},1024)]),default:l.withCtx(()=>[l.createVNode(l.unref(A.Button),{type:F.type,size:F.size??"middle",disabled:l.unref(d).disabled||F.disabled,loading:w.toolbar||!!F.code&&Y[F.code],danger:F.danger,shape:F.shape,ghost:F.ghost,block:F.block},{default:l.withCtx(()=>[F.icon?(l.openBlock(),l.createBlock(l.unref(ae),{key:0,icon:F.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(F.content)+" ",1),l.createVNode(l.unref(wt.DownOutlined))]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block"])]),_:2},1024)):F.code?(l.openBlock(),l.createBlock(l.unref(A.Button),{key:1,type:F.type,size:F.size??"middle",disabled:l.unref(d).disabled||F.disabled,loading:w.toolbar||!!F.code&&Y[F.code],danger:F.danger,shape:F.shape,ghost:F.ghost,block:F.block,onClick:Re=>l.unref(he)(F.code)},{default:l.withCtx(()=>[F.icon?(l.openBlock(),l.createBlock(l.unref(ae),{key:0,icon:F.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(F.content),1)]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block","onClick"])):(l.openBlock(),l.createElementBlock("div",qb))],64))),128)):l.createCommentVNode("",!0)]),l.createElementVNode("span",Zb,[l.unref(d).tools&&l.unref(d).tools.length>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(d).tools,(F,pe)=>(l.openBlock(),l.createBlock(l.unref(A.Button),{key:pe,type:F.type,size:F.size??"middle",disabled:l.unref(d).disabled||F.disabled,danger:F.danger,shape:F.shape,ghost:F.ghost,block:F.block,onClick:Re=>l.unref(Pi)(F.code),loading:w.toolbar||!!F.code&&Y[F.code]},{default:l.withCtx(()=>[F.icon?(l.openBlock(),l.createBlock(l.unref(ae),{key:0,icon:F.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(F.content),1)]),_:2},1032,["type","size","disabled","danger","shape","ghost","block","onClick","loading"]))),128)):l.createCommentVNode("",!0)])])):l.createCommentVNode("",!0),l.createElementVNode("div",Jb,[(Lt=l.unref(g))!=null&&Lt.selectable&&l.unref(g).showCount?(l.openBlock(),l.createElementBlock("div",Qb," 已选:"+l.toDisplayString(q.value.length),1)):l.createCommentVNode("",!0),l.createVNode(zr,{ref_key:"canvasTableRef",ref:I,columns:Wi.value,config:{...p.value.config,HEIGHT:y.value},data:K.value,loading:w.table,onSelectionChange:L},l.createSlots({_:2},[l.renderList($.$slots,(F,pe)=>({name:pe,fn:l.withCtx(Re=>[l.renderSlot($.$slots,pe,l.normalizeProps(l.guardReactiveProps(Re)))])}))]),1032,["columns","config","data","loading"]),E.value==="pagination"?(l.openBlock(),l.createBlock(l.unref(A.Pagination),{key:1,class:"p-canvas-pagination",size:"small",current:b.page,"page-size":b.size,total:B.value,onChange:Yi},null,8,["current","page-size","total"])):l.createCommentVNode("",!0)])],64))],16)}}}),Gr=l.defineComponent({__name:"PGroupBlock",props:{getFormSetting:{type:Function},source:{}},setup(r,{expose:e}){const t=r,i=l.ref(),{source:s}=l.toRefs(t),o=l.computed(()=>{var a;return(a=i.value)==null?void 0:a.$form}),n=l.computed(()=>t.getFormSetting(s.value));return e({$form:o}),(a,c)=>(l.openBlock(),l.createBlock(Mr,l.mergeProps({ref_key:"formEl",ref:i},n.value,{data:l.unref(s)}),null,16,["data"]))}}),jb=l.defineComponent({__name:"CollapseCard",props:{defaultCollapsed:{type:Boolean,default:!1},title:{default:void 0},collapsible:{type:Boolean,default:!1}},setup(r,{expose:e}){const t=r,i=l.ref(t.defaultCollapsed?[]:["content"]);return e({collapse:()=>{i.value=[]},expand:()=>{i.value=["content"]}}),(s,o)=>{const n=l.resolveComponent("a-collapse-panel"),a=l.resolveComponent("a-collapse"),c=l.resolveComponent("a-card");return s.collapsible?(l.openBlock(),l.createBlock(a,{key:0,"active-key":i.value,"onUpdate:activeKey":o[0]||(o[0]=d=>i.value=d),class:"collapsible-card"},{default:l.withCtx(()=>[l.createVNode(n,{key:"content","force-render":"",header:s.title},l.createSlots({_:2},[l.renderList(s.$slots,(d,f)=>({name:f,fn:l.withCtx(()=>[l.renderSlot(s.$slots,f)])}))]),1032,["header"])]),_:3},8,["active-key"])):(l.openBlock(),l.createBlock(c,{key:1,size:"small",title:s.title},l.createSlots({_:2},[l.renderList(s.$slots,(d,f)=>({name:f,fn:l.withCtx(()=>[l.renderSlot(s.$slots,f)])}))]),1032,["title"]))}}}),hl=l.defineComponent({__name:"PFormGroup",props:l.mergeModels({getFormSetting:{type:Function},title:{},tabLabel:{},getTabLabel:{type:Function},editAble:{type:Boolean},showAdd:{type:Boolean},collapsible:{type:Boolean},defaultCollapsed:{type:Boolean},lazyErrorMark:{type:Boolean},forceRender:{type:Boolean},keepSerial:{type:Boolean},loading:{type:Boolean},itemMenus:{},createItem:{type:Function},max:{},menuHandler:{type:Function}},{modelValue:{type:Array,default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(r,{expose:e}){const t=A.Form.useForm,i=l.ref(),s=r,o=l.ref(),n=l.useModel(r,"modelValue"),a=l.ref(0),c=l.ref([]),d=l.ref([]),f=R=>{a.value=R},u=l.computed(()=>s.max??1/0),g=R=>{(s.createItem??(()=>Promise.resolve({})))({list:n.value}).then(_=>{var O;n.value=[...n.value,{..._,__index:(((O=S.max(n.value,y=>y.__index??-1))==null?void 0:O.__index)??-1)+1}],a.value=R})},m=s.itemMenus??[{content:"复制",code:"copy"},{content:"删除",code:"delete"}],x=R=>{var I,_,O,y,D,L;return((D=(y=(O=(_=(I=R==null?void 0:R.parentElement)==null?void 0:I.parentElement)==null?void 0:_.parentElement)==null?void 0:O.parentElement)==null?void 0:y.parentElement)==null?void 0:D.parentElement)??((L=o.value)==null?void 0:L.$el)??document.body},v=l.computed(()=>s.forceRender||n.value.length<=5),p=R=>{var _;const I=(_=n.value.find((O,y)=>y===R))==null?void 0:_.__index;Z(I)&&(c.value=c.value.filter(O=>O!==I))},E=()=>{l.nextTick().then(()=>{var R,I;p(a.value),(I=(R=d.value[a.value])==null?void 0:R.$form)==null||I.validate()})},C=(R,I)=>{var _;return((_=s.getTabLabel)==null?void 0:_.call(s,R,I))??`${s.tabLabel} ${s.keepSerial?I+1:(R.__index??0)+1}`};l.watch(()=>n.value,()=>{if(!s.keepSerial){const R=n.value.filter(I=>!Z(I.__index));R.length>0&&R.forEach(I=>{var _;I.__index=(((_=S.max(n.value,O=>O.__index??-1))==null?void 0:_.__index)??-1)+1})}},{immediate:!0});const w=({key:R},I,_)=>{var O;if(s.menuHandler&&S.isFunction(s.menuHandler))s.menuHandler({code:S.toString(R),data:I,index:_});else switch(R){case"delete":n.value=n.value.filter((y,D)=>D!==_),l.nextTick(()=>{d.value=d.value.filter(y=>!!y),_<=a.value&&a.value>0&&a.value--});break;case"copy":if(n.value.length>=u.value){wi("已达到最大数量");return}n.value=[...n.value,S.clone({...S.omit(I,["id","__index"]),__index:(((O=S.max(n.value,y=>y.__index??-1))==null?void 0:O.__index)??-1)+1})];break}},b=S.debounce(w,100);l.watchEffect(()=>{n.value.length===0?a.value=0:a.value>=n.value.length&&(a.value=n.value.length-1)});const T=S.debounce(p,50);l.watchEffect(()=>{var _;const R=n.value.map((O,y)=>c.value.includes(O.__index)?y:void 0).filter(Z),I=(_=i.value)==null?void 0:_.$el;I&&I.querySelectorAll(":scope >.ant-tabs-nav>.ant-tabs-nav-wrap>.ant-tabs-nav-list>.ant-tabs-tab>.ant-tabs-tab-btn").forEach((y,D)=>{R.includes(D)?y.classList.add("p-error-group-tab"):y.classList.remove("p-error-group-tab")})}),e({collapse:()=>{var R,I;(I=(R=o.value)==null?void 0:R.collapse)==null||I.call(R)},expand:()=>{var R,I;(I=(R=o.value)==null?void 0:R.expand)==null||I.call(R)},activeKey:l.computed(()=>a.value),setActiveKey:f,validateAll:()=>{const R=v.value?d.value.map(I=>{var _;return(_=I.$form)==null?void 0:_.validate()}):n.value.map(I=>{var _;return((_=t(I,s.getFormSetting(I).rules))==null?void 0:_.validate())??Promise.resolve()});return Promise.allSettled(R).then(I=>{if(c.value=I.map((_,O)=>{var y;return _.status==="rejected"&&typeof((y=n.value[O])==null?void 0:y.__index)=="number"?n.value[O].__index:void 0}).filter(_=>typeof _=="number"),!s.lazyErrorMark&&c.value.length){const _=c.value[0],O=n.value.findIndex(y=>y.__index===_);O!==-1&&(a.value=O)}return c.value.length?Promise.reject({error_indexes:c.value,results:I}):Promise.resolve(I)})},validate:async(R,I)=>{var O,y,D;const _=n.value.findIndex(L=>L.__index===R);try{return await(v.value?((y=(O=d.value[_])==null?void 0:O.$form)==null?void 0:y.validate())??Promise.resolve():((D=t(n.value[_],s.getFormSetting(n.value[_]).rules))==null?void 0:D.validate())??Promise.resolve()),c.value=c.value.filter(L=>L!==R),Promise.resolve()}catch(L){return!c.value.includes(R)&&!I&&(c.value=[...c.value,R]),Promise.reject(L)}},validateFields:async(R,I,_)=>{var Y,W;const O=n.value.findIndex(P=>P.__index===R),D=s.getFormSetting(n.value[O]).rules,L=t(n.value[O],D);try{return await(v.value?((W=(Y=d.value[O])==null?void 0:Y.$form)==null?void 0:W.validateFields(I))??Promise.resolve():Promise.allSettled(I.map(P=>L.validateField(P,n.value[O][P],D[P]??[])))),Promise.resolve()}catch(P){return!c.value.includes(R)&&!_&&(c.value=[...c.value,R]),Promise.reject(P)}}});const B=l.useSlots(),K=l.computed(()=>Object.keys(B).filter(R=>R.startsWith("group-")).map(R=>({original:R,target:R.replace("group-","")})));return(R,I)=>{const _=l.resolveComponent("a-spin");return l.openBlock(),l.createBlock(jb,{ref_key:"rootRef",ref:o,title:R.title,size:"small",collapsible:R.collapsible,"default-collapsed":R.defaultCollapsed},l.createSlots({default:l.withCtx(()=>[R.loading?(l.openBlock(),l.createBlock(_,{key:0,class:"w-full"})):(l.openBlock(),l.createBlock(l.unref(A.Tabs),{key:1,ref_key:"tabsRef",ref:i,type:"editable-card",activeKey:a.value,"onUpdate:activeKey":I[1]||(I[1]=O=>a.value=O),"hide-add":"",onChange:E},{rightExtra:l.withCtx(()=>[l.renderSlot(R.$slots,"rightExtra",{},()=>[R.showAdd&&n.value.length<u.value?(l.openBlock(),l.createBlock(l.unref(A.Button),{key:0,type:"link",onClick:I[0]||(I[0]=O=>g(n.value.length))},{default:l.withCtx(()=>I[2]||(I[2]=[l.createTextVNode(" + 新增 ",-1)])),_:1,__:[2]})):l.createCommentVNode("",!0)])]),default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(n.value,(O,y)=>(l.openBlock(),l.createBlock(l.unref(A.TabPane),{key:y,tab:C(O,y),"force-render":v.value},{closeIcon:l.withCtx(()=>{var D;return[R.editAble&&((D=l.unref(m))!=null&&D.length)?(l.openBlock(),l.createBlock(l.unref(A.Dropdown),{key:0,"get-popup-container":x},{overlay:l.withCtx(()=>[l.createVNode(l.unref(A.Menu),{onClick:L=>l.unref(b)(L,O,y)},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(m).filter(L=>{var Y;return((Y=L.visibleMethod)==null?void 0:Y.call(L,{data:O,index:y}))??!0}),L=>(l.openBlock(),l.createBlock(l.unref(A.MenuItem),{key:L.code},{default:l.withCtx(()=>[l.createElementVNode("div",null,l.toDisplayString(L.content),1)]),_:2},1024))),128))]),_:2},1032,["onClick"])]),default:l.withCtx(()=>[l.createVNode(l.unref(wt.MoreOutlined))]),_:2},1024)):l.createCommentVNode("",!0)]}),default:l.withCtx(()=>[(l.openBlock(),l.createBlock(Gr,{ref_for:!0,ref_key:"blockInstance",ref:d,key:y,source:O,"get-form-setting":R.getFormSetting,onFocusCapture:D=>l.unref(T)(y),onClickCapture:D=>l.unref(T)(y)},null,8,["source","get-form-setting","onFocusCapture","onClickCapture"]))]),_:2},1032,["tab","force-render"]))),128))]),_:3},8,["activeKey"]))]),_:2},[l.renderList(K.value,O=>({name:O.target,fn:l.withCtx(()=>[l.renderSlot(R.$slots,O.original)])}))]),1032,["title","collapsible","default-collapsed"])}}}),e_={class:"w-full text-right p-2"},dl=l.defineComponent({__name:"PromisePicker",props:{gridSetting:{},title:{default:"数据选择"},width:{default:"70%"},multipleAllowEmpty:{type:Boolean,default:!1},bodyStyle:{default:()=>({})},beforePick:{type:Function,default:()=>Promise.resolve()}},setup(r,{expose:e}){const t=l.ref(),i=l.ref(!1),s=r,o=l.computed(()=>{var x;return(x=s.gridSetting.selectConfig)==null?void 0:x.multiple});let n,a,c;const d=l.reactive({modal:!1}),f=()=>{c&&c()},u=()=>{d.modal=!1,c&&c()},g=({row:x,field:v})=>{n&&!o.value&&s.beforePick(x).then(()=>{d.modal=!1,n({row:x,field:v})})},m=()=>{var v;const x=((v=t.value)==null?void 0:v.selectedRecords)??[];x.length===0&&!s.multipleAllowEmpty?wi("请选择数据"):s.beforePick(x).then(()=>{d.modal=!1,a(x)})};return l.onMounted(()=>{}),e({pick:()=>new Promise((x,v)=>{n=x,c=v,i.value=!1,d.modal=!0,l.nextTick(()=>{i.value=!0})}),pickMultiple:()=>new Promise((x,v)=>{a=x,c=v,i.value=!1,d.modal=!0,l.nextTick(()=>{i.value=!0})}),grid:t,hide:()=>{d.modal=!1}}),(x,v)=>(l.openBlock(),l.createBlock(l.unref(A.Modal),{open:d.modal,"onUpdate:open":v[0]||(v[0]=p=>d.modal=p),"destroy-on-close":"",title:x.title,width:x.width,footer:o.value?void 0:null,onCancel:f,"body-style":x.bodyStyle},l.createSlots({default:l.withCtx(()=>[l.createElementVNode("div",{style:l.normalizeStyle({minHeight:i.value?"unset":"642px"})},[l.createVNode(Ar,l.mergeProps(x.gridSetting,{ref_key:"gridEl",ref:t,onPick:g}),null,16)],4)]),_:2},[o.value?{name:"footer",fn:l.withCtx(()=>[l.createElementVNode("div",e_,[l.createElementVNode("span",null,[l.createVNode(l.unref(A.Button),{class:"mr-4",onClick:u},{default:l.withCtx(()=>v[1]||(v[1]=[l.createTextVNode(" 取消 ",-1)])),_:1,__:[1]}),l.createVNode(l.unref(A.Button),{type:"primary",onClick:m},{default:l.withCtx(()=>v[2]||(v[2]=[l.createTextVNode(" 确定 ",-1)])),_:1,__:[2]})])])]),key:"0"}:void 0]),1032,["open","title","width","footer","body-style"]))}});function ul(r){r&&Ba(r)}const t_={install(r){r.component("PForm",Mr),r.component("PGrid",Ar),r.component("PCanvasTable",zr),r.component("PCanvasGrid",cl),r.component("PFormGroup",hl),r.component("PGroupBlock",Gr),r.component("PromisePicker",dl)},addFormatter:Ka,addRender:Dr,setup:ul};exports.PCanvasGrid=cl;exports.PCanvasTable=zr;exports.PForm=Mr;exports.PFormGroup=hl;exports.PGrid=Ar;exports.PGroupBlock=Gr;exports.PromisePicker=dl;exports.addFormatter=Ka;exports.addRender=Dr;exports.cleanCol=Bi;exports.default=t_;exports.defaultItemResponsive=Or;exports.defaultLabelCol=kr;exports.get24rest=Fa;exports.getButtonResponsive=eC;exports.getUIKitConfig=J2;exports.labelColDict=j2;exports.resetUIKitConfig=Q2;exports.setUIKitConfig=Ba;exports.setup=ul;exports.watchPreviousDeep=Lr;
|
|
3
|
+
`)}return o}function Ja(r,e,t=[]){let i=0;const s=[];return r.forEach((o,n)=>{if(n===0)s.push(1);else{const a=t.reduce((d,f)=>`${d}${o[f]??""}`,"")||o[e],c=t.reduce((d,f)=>`${d}${r[n-1][f]??""}`,"")||r[n-1][e];a===c?(s[i]+=1,s.push(0)):(s.push(1),i=n)}}),s}function Qa(r,e){let t="",i="";const s={};return e.forEach((o,n)=>{n===0?(t=o.key,i=o.key,s[o.key]=1):r[o.key]===r[t]?(s[o.key]=0,s[i]+=1):(s[o.key]=1,t=o.key,i=o.key)}),s}function LC(r,e,t=[]){const{visibleRows:i,rowIndex:s,headIndex:o}=r,n=Ja(i,e,t);return n[s-o]===0?{rowspan:0,colspan:0,relationRowKeys:t,mergeRow:!0}:{rowspan:n[s-o],colspan:1,relationRowKeys:t,mergeRow:!0}}function DC(r,e=[]){const{column:t,row:i,visibleLeafColumns:s}=r,o=s.filter(n=>e.includes(n.key));if(e.includes(t.key)){const n=Qa(i,o);return n[t.key]===0?{rowspan:0,colspan:0,relationColKeys:e,mergeCol:!0}:{rowspan:1,colspan:n[t.key],relationColKeys:e,mergeCol:!0}}}function $C(r,e=document.documentElement){const t=r.startsWith("--")?r:`--${r}`;return getComputedStyle(e).getPropertyValue(t).trim()}function $o(r){if(!r)return new Date(0);if(typeof r=="number")return new Date(r);const e=String(r).trim(),t=new Date(e);if(!isNaN(t.getTime()))return t;const i=[/^(\d{4})-(\d{1,2})-(\d{1,2})$/,/^(\d{4})\/(\d{1,2})\/(\d{1,2})$/,/^(\d{4})\.(\d{1,2})\.(\d{1,2})$/,/^(\d{1,2})-(\d{1,2})-(\d{4})$/,/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/,/^(\d{1,2})-(\d{1,2})-(\d{4})$/,/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/,/^(\d{4})(\d{2})(\d{2})$/,/^(\d{4})-(\d{1,2})-(\d{1,2})\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/,/^(\d{4})\/(\d{1,2})\/(\d{1,2})\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/];for(const s of i){const o=e.match(s);if(o){const n=o.slice(1).map(Number);if(s.source.includes("YYYY-MM-DD")||s.source.includes("YYYY/MM/DD")||s.source.includes("YYYY.MM.DD")){const[a,c,d,f=0,u=0,g=0]=n;return new Date(a,c-1,d,f,u,g)}else if(s.source.includes("DD-MM-YYYY")||s.source.includes("DD/MM/YYYY")||s.source.includes("DD.MM.YYYY")){const[a,c,d,f=0,u=0,g=0]=n;return new Date(d,c-1,a,f,u,g)}else if(s.source.includes("MM-DD-YYYY")||s.source.includes("MM/DD/YYYY")||s.source.includes("MM.DD.YYYY")){const[a,c,d,f=0,u=0,g=0]=n;return new Date(d,a-1,c,f,u,g)}else if(s.source.includes("YYYYMMDD")){const[a,c,d]=n;return new Date(a,c-1,d)}}}return new Date(NaN)}function MC(r,e){const t=$o(r),i=$o(e);return isNaN(t.getTime())&&isNaN(i.getTime())?0:isNaN(t.getTime())?-1:isNaN(i.getTime())?1:t.getTime()-i.getTime()}class ja{constructor(e,t,i,s,o,n,a){h(this,"ctx"),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"fixed"),h(this,"cellType"),this.ctx=e,this.x=t,this.y=i,this.width=s,this.height=o,this.fixed=a,this.cellType=n}isHorizontalVisible(){if(this.fixed)return!0;const{stageWidth:e,fixedLeftWidth:t,scrollX:i,fixedRightWidth:s}=this.ctx,o=e;return!(this.x+this.width-t-i<=0||this.x-i>=o-s)}isVerticalVisible(){const{stageHeight:e,scrollY:t}=this.ctx,i=e;return!(this.y+this.height-t<=0||this.y-t>=i)}getDrawX(){if(this.fixed==="left")return this.x;if(this.fixed==="right"){const{stageWidth:e,config:{SCROLLER_TRACK_SIZE:t}}=this.ctx;return e-(this.ctx.header.width-this.x)-t}return this.x-this.ctx.scrollX}getDrawY(){return this.cellType==="header"?this.y:this.cellType==="footer"&&this.ctx.config.FOOTER_FIXED?this.y:this.y-this.ctx.scrollY}getLeftFixedX(){return this.x-this.ctx.scrollX}getRightFixedX(){}}class Pr extends ja{constructor(e,t,i,s,o,n,a,c,d,f="body",u=!0){super(e,s,o,n,a,f,c.fixed),h(this,"formatter"),h(this,"formatterFooter"),h(this,"hoverIconName",""),h(this,"operation",!1),h(this,"align"),h(this,"verticalAlign"),h(this,"fixed"),h(this,"type"),h(this,"editorType"),h(this,"editorProps"),h(this,"cellType"),h(this,"level"),h(this,"colspan",1),h(this,"rowspan",1),h(this,"mergeRow",!1),h(this,"mergeCol",!1),h(this,"relationRowKeys",[]),h(this,"relationColKeys",[]),h(this,"key"),h(this,"column"),h(this,"rowIndex"),h(this,"colIndex"),h(this,"rowKey"),h(this,"row"),h(this,"value"),h(this,"render"),h(this,"renderFooter"),h(this,"style",{}),h(this,"domDataset",{}),h(this,"rules",[]),h(this,"message",""),h(this,"text",""),h(this,"displayText",""),h(this,"visibleWidth",0),h(this,"visibleHeight",0),h(this,"isHasChanged",!1),h(this,"drawX",0),h(this,"drawY",0),h(this,"drawCellBgColor",""),h(this,"drawCellSkyBgColor",""),h(this,"drawTextColor",""),h(this,"drawTextFont",""),h(this,"drawTextX",0),h(this,"drawTextY",0),h(this,"drawTextWidth",0),h(this,"drawTextHeight",0),h(this,"drawTreeImageX",0),h(this,"drawTreeImageY",0),h(this,"drawTreeImageWidth",0),h(this,"drawTreeImageHeight",0),h(this,"drawTreeImageName",""),h(this,"drawTreeImageSource"),h(this,"drawSelectionImageX",0),h(this,"drawSelectionImageY",0),h(this,"drawSelectionImageWidth",0),h(this,"drawSelectionImageHeight",0),h(this,"drawSelectionImageName",""),h(this,"drawSelectionImageSource"),h(this,"drawHoverImageX",0),h(this,"drawHoverImageY",0),h(this,"drawHoverImageWidth",0),h(this,"drawHoverImageHeight",0),h(this,"drawHoverImageName",""),h(this,"drawHoverImageSource"),h(this,"autoRowHeight",!1),h(this,"calculatedHeight",0),h(this,"ellipsis",!1),h(this,"rowExpand",!1),h(this,"rowHasChildren",!1),h(this,"overflowTooltipShow",!0),h(this,"selectorCellValueType","value"),h(this,"overflowTooltipMaxWidth",500),h(this,"overflowTooltipPlacement","top"),h(this,"maxLineClamp","auto"),this.visibleWidth=this.width,this.visibleHeight=this.height,this.colIndex=i,this.rowIndex=t,this.key=c.key,this.type=c.type||"",this.editorType=c.editorType||"text",this.selectorCellValueType=c.selectorCellValueType||this.ctx.config.SELECTOR_CELL_VALUE_TYPE||"value",this.editorProps=c.editorProps||{},this.cellType=f,this.align=c.align||this.ctx.config.COLUMNS_ALIGN,this.verticalAlign=c.verticalAlign||this.ctx.config.COLUMNS_VERTICAL_ALIGN,this.fixed=c.fixed||"",this.level=c.level||0,this.operation=c.operation||!1,this.column=c,this.rules=c.rules||[],this.row=d,this.rowKey=this.cellType==="body"?this.ctx.database.getRowKeyForRowIndex(t):`${this.cellType}_${this.rowIndex}`,this.value=this.getValue(),this.render=c.render,this.overflowTooltipShow=c.overflowTooltipShow!==!1,this.autoRowHeight=c.autoRowHeight!==void 0?c.autoRowHeight:this.ctx.config.AUTO_ROW_HEIGHT,this.overflowTooltipMaxWidth=c.overflowTooltipMaxWidth||500,this.overflowTooltipPlacement=c.overflowTooltipPlacement||"top",this.renderFooter=c.renderFooter,this.hoverIconName=c.hoverIconName,this.formatter=c.formatter,this.formatterFooter=c.formatterFooter,this.maxLineClamp=c.maxLineClamp||"auto",u&&this.update()}setWidthHeight(e,t){this.width=e,this.height=t}getValidationMessage(){const e=this.ctx.database.getValidationError(this.rowKey,this.key);if(Array.isArray(e)&&e.length){const[t]=e;this.message=t.message||""}return this.message}update(){this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawTextX=this.drawX,this.drawTextY=this.drawY,this.isHasChanged=this.ctx.database.isHasChangedData(this.rowKey,this.key),this.updateSpan(),this.drawTextWidth=this.visibleWidth,this.drawTextHeight=this.visibleHeight,this.updateStyle(),this.updateType(),this.updateHoverIcon(),this.updateSelection(),this.updateTree(),this.updateEditor(),this.updateRender(),this.getValidationMessage(),this.updateContainer(),this.text=this.getText(),this.displayText=this.getDisplayText()}updateSpan(){if(this.cellType==="footer")return;const{SPAN_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e,{colspan:i=1,rowspan:s=1,relationRowKeys:o,relationColKeys:n,mergeRow:a=!1,mergeCol:c=!1}=t({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue(),headIndex:this.ctx.body.headIndex,headPosition:this.ctx.database.getPositionForRowIndex(this.ctx.body.headIndex),visibleRows:this.ctx.body.visibleRows,visibleLeafColumns:this.ctx.header.visibleLeafColumns,rows:this.ctx.body.data})||{};Array.isArray(o)&&o.length>0?this.relationRowKeys=o:this.relationRowKeys=[this.key],Array.isArray(n)&&n.length>0?this.relationColKeys=n:this.relationColKeys=[this.key],this.mergeCol=c,this.mergeRow=a,this.colspan=i,this.rowspan=s,this.visibleWidth=this.getWidthByColIndexColSpan(this.colIndex,this.colspan),this.visibleHeight=this.ctx.database.getHeightByRowIndexRowSpan(this.rowIndex,this.rowspan)}}updateSpanInfo(){if(this.mergeRow||this.mergeCol){const e=this.getSpanInfo();this.height=e.height,this.width=e.width,this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawY-=e.offsetTop,this.drawX-=e.offsetLeft}}updateType(){const{BODY_CELL_TYPE_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});t!==void 0&&(this.type=t)}}updateEditor(){const{BODY_CELL_EDITOR_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});if(t!==void 0){const{type:i,props:s={}}=t;this.editorType=i,this.editorProps=s}}}updateRender(){const{BODY_CELL_RENDER_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});t!==void 0&&(this.render=t)}}validate(){this.ctx.database.getValidator(this.rowKey,this.key).then(()=>{this.ctx.database.setValidationError(this.rowKey,this.key,[]),this.message=""}).catch(e=>{if(Array.isArray(e)&&e.length){const[t]=e;this.message=t.message,this.ctx.database.setValidationError(this.rowKey,this.key,e)}}).finally(()=>{this.ctx.emit("draw")})}updateStyle(){this.autoRowHeight&&(this.domDataset={"data-auto-height":!0,"data-row-index":this.rowIndex,"data-col-index":this.colIndex}),this.style=this.getOverlayerViewsStyle()}updateTree(){const{CELL_PADDING:e=0}=this.ctx.config,{rowKey:t,cellType:i}=this;let s,o=0,n="";if(!(["tree","selection-tree","tree-selection"].includes(this.type)&&i==="body"))return;const a=this.ctx.database.getRowForRowKey(t),{expand:c=!1,hasChildren:d=!1,expandLoading:f=!1,level:u=0}=a||{};this.rowExpand=c,this.rowHasChildren=d;const{TREE_INDENT:g=16,CHECKBOX_SIZE:v,TREE_ICON_SIZE:x}=this.ctx.config;if(o=u*g,f){const S=this.ctx.icons.get("loading");n="loading",s=S}else if(d){const S=this.ctx.icons.get("expand"),B=this.ctx.icons.get("shrink");s=c?B:S,n=c?"shrink":"expand"}let m=x,p=x,E=this.drawX;(this.align==="center"||this.align==="right")&&(E=this.drawX+(this.visibleWidth-m-2*e)/2,this.align="left");let C=E+o+e,w=this.drawY+(this.visibleHeight-p)/2,_=o+this.drawX+m-.5;this.type==="selection-tree"?(C=o+this.drawSelectionImageX+this.drawSelectionImageWidth,_=C+m-e/2):this.type==="tree-selection"?_=C+v+m-e/2:_=C+m-e/2,this.drawTextX=_,this.drawTextWidth=this.drawX+this.visibleWidth-_,!(C+m+e>this.drawX+this.visibleWidth)&&(w+p+e>this.drawY+this.visibleHeight||(this.drawTreeImageX=C,this.drawTreeImageY=w,this.drawTreeImageWidth=m,this.drawTreeImageHeight=p,s?(this.drawTreeImageName=n,this.drawTreeImageSource=s):(this.drawTreeImageName="",this.drawTreeImageSource=void 0)))}drawTreeLine(){const{TREE_LINE:e,TREE_INDENT:t=16,TREE_ICON_SIZE:i=16,TREE_LINE_COLOR:s="#e1e6eb"}=this.ctx.config;if(!e||this.cellType!=="body"||!["tree","selection-tree","tree-selection"].includes(this.type)||this.rowspan===0||this.colspan===0)return;const o=this.ctx.database.getRowForRowKey(this.rowKey)||{},n=o.level??0,a=this.drawTreeImageX+this.drawTreeImageWidth/2,c=this.drawTreeImageY+this.drawTreeImageHeight/2;let d=this.drawTreeImageX-n*t;const f=Array.isArray(o.parentRowKeys)?o.parentRowKeys:[];if(n>0){for(let x=0;x<n-1;x+=1){const m=f[x+1];if((m?this.ctx.database.getRowForRowKey(m)||{}:{}).isLastChild)continue;const p=Math.round(this.drawTreeImageX-(n-x)*t+i/2);this.ctx.paint.drawLine([p,this.drawY,p,this.drawY+this.visibleHeight],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}const u=Math.round(this.drawTreeImageX-t+i/2),g=o.isLastChild?c:this.drawY+this.visibleHeight;this.ctx.paint.drawLine([u,this.drawY,u,g],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0});const v=Math.round(d+(n-1)*t+i/2);this.ctx.paint.drawLine([v,c,a,c],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}if(o.hasChildren&&o.expand){const u=this.drawTreeImageY+this.drawTreeImageHeight,g=this.drawY+this.visibleHeight;this.ctx.paint.drawLine([a,u,a,g],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}}updateContainer(){const{BODY_BG_COLOR:e,EDIT_BG_COLOR:t,BODY_CELL_STYLE_METHOD:i,FOOTER_CELL_STYLE_METHOD:s,READONLY_TEXT_COLOR:o,BODY_TEXT_COLOR:n,FOOTER_TEXT_COLOR:a,FOOTER_BG_COLOR:c,HIGHLIGHT_SELECTED_ROW:d,HIGHLIGHT_SELECTED_ROW_COLOR:f,HIGHLIGHT_HOVER_ROW:u,HIGHLIGHT_HOVER_ROW_COLOR:g,STRIPE:v,STRIPE_COLOR:x,FINDER_CELL_BG_COLOR:m}=this.ctx.config;if(this.cellType==="footer"){let b=c,O=a;if(typeof s=="function"){const y=s,{backgroundColor:M,color:D,font:P}=y({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()})||{};M&&(b=M),D&&(O=D),P&&(this.drawTextFont=P)}this.drawCellSkyBgColor="transparent",this.drawCellBgColor=b,this.drawTextColor=O;return}let p="transparent";const E=this.ctx.hoverCell,C=this.ctx.currentCell;let w=this.rowIndex,_=this.rowIndex;if(this.rowspan!==1&&(u||d)){const b=this.getSpanInfo(),{yArr:O}=b;w=O[0],_=O[1]}u&&E&&(E.rowKey===this.rowKey&&(p=g),E.rowIndex>=w&&E.rowIndex<=_&&(p=g)),d&&C&&(C.rowKey===this.rowKey&&(p=f),C.rowIndex>=w&&C.rowIndex<=_&&(p=f)),this.drawCellSkyBgColor=p;let S=e,B=n;if(this.ctx.database.getReadonly(this.rowKey,this.key)||(S=t,B=o),v&&(this.rowIndex%2?S=x:S=e),typeof i=="function"){const b=i,{backgroundColor:O,color:y,font:M}=b({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,isHasChanged:this.isHasChanged,value:this.getValue()})||{};O&&(S=O),y&&(B=y),M&&(this.drawTextFont=M)}const{rowIndex:K,colIndex:R,type:I}=this.ctx.finderBar;K===this.rowIndex&&R===this.colIndex&&I==="body"&&(S=m),this.drawCellBgColor=S,this.drawTextColor=B}updateSelection(){const{visibleWidth:e,visibleHeight:t,rowspan:i,colspan:s,cellType:o,type:n,rowIndex:a,rowKey:c}=this;if(i===0||s===0||o==="footer"||!["index-selection","selection","selection-tree","tree-selection"].includes(n))return;const d=this.ctx.database.getRowSelectable(c),{CHECKBOX_SIZE:f=0,CELL_PADDING:u}=this.ctx.config;let g=this.drawX+u;(this.align==="center"||this.align==="right")&&(g=this.drawX+(e-f)/2);let v=g,x=this.drawY+(t-f)/2;if(n!=="selection-tree"&&n==="tree-selection"){const{TREE_INDENT:E=16,TREE_ICON_SIZE:C}=this.ctx.config,w=this.ctx.database.getRowForRowKey(c),{level:_=0}=w||{},S=_*E;v=g+C+S}let m=this.ctx.icons.get("checkbox-uncheck"),p="checkbox-uncheck";if(n==="selection-tree"||n==="tree-selection"){const E=this.ctx.database.getTreeSelectionState(c);E.indeterminate&&d?(m=this.ctx.icons.get("checkbox-indeterminate"),p="checkbox-indeterminate"):E.checked&&d?(m=this.ctx.icons.get("checkbox-check"),p="checkbox-check"):!E.checked&&d?(m=this.ctx.icons.get("checkbox-uncheck"),p="checkbox-uncheck"):(m=this.ctx.icons.get("checkbox-disabled"),p="checkbox-disabled")}else{const E=this.ctx.database.getRowSelection(c);E&&d?(m=this.ctx.icons.get("checkbox-check"),p="checkbox-check"):E&&!d?(m=this.ctx.icons.get("checkbox-check-disabled"),p="checkbox-check-disabled"):!E&&d?(m=this.ctx.icons.get("checkbox-uncheck"),p="checkbox-uncheck"):(m=this.ctx.icons.get("checkbox-disabled"),p="checkbox-disabled")}v+f+u>this.drawX+this.visibleWidth||x+f+u>this.drawY+this.visibleHeight||(n==="index-selection"?(this.ctx.hoverCell&&this.ctx.hoverCell.rowIndex===a||["checkbox-disabled","checkbox-check"].includes(p))&&(this.drawSelectionImageX=v,this.drawSelectionImageY=x,this.drawSelectionImageWidth=f,this.drawSelectionImageHeight=f,this.drawSelectionImageName=p,this.drawSelectionImageSource=m):(this.drawSelectionImageX=v,this.drawSelectionImageY=x,this.drawSelectionImageWidth=f,this.drawSelectionImageHeight=f,this.drawSelectionImageName=p,this.drawSelectionImageSource=m))}updateHoverIcon(){if(this.ctx.database.getReadonly(this.rowKey,this.key))return;const{BODY_CELL_HOVER_ICON_METHOD:e,CELL_HOVER_ICON_SIZE:t,CELL_PADDING:i,ENABLE_MERGE_CELL_LINK:s}=this.ctx.config;if(typeof e=="function"){const n=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});n!==void 0&&(this.hoverIconName=n)}const{hoverCell:o}=this.ctx;if(this.hoverIconName&&!this.ctx.editing&&o){let n=0,a=0;if(o.rowKey===this.rowKey&&(n=this.drawX+this.width-t-i,a=this.drawY+(this.height-t)/2),this.rowspan!==1&&s){const d=this.getSpanInfo(),{yArr:f}=d,u=f[0],g=f[1];if(o.rowIndex>=u&&o.rowIndex<=g){const{width:v,height:x,offsetTop:m,offsetLeft:p}=d;n=this.drawX-p+v-t-i,a=this.drawY-m+(x-t)/2}}const c=this.ctx.icons.get(this.hoverIconName);this.drawHoverImageX=n,this.drawHoverImageY=a,this.drawHoverImageWidth=t,this.drawHoverImageHeight=t,this.drawHoverImageName=this.hoverIconName,this.drawHoverImageSource=c}}getAutoHeight(){if(this.cellType!=="body"||!this.autoRowHeight||this.rowspan===0)return 0;if(this.render){const n=this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex);return this.rowspan>1?n<this.visibleHeight?0:Math.round(n-(this.visibleHeight-this.height)):Math.round(n)}if(!(this.displayText&&typeof this.displayText=="string"))return 0;const{BODY_FONT:e,CELL_PADDING:t,CELL_LINE_HEIGHT:i}=this.ctx.config,s=`${this.displayText}_${this.drawTextWidth}_${this.drawTextFont}`,o=this.ctx.paint.calculateTextHeight(this.displayText,this.drawTextWidth,{font:this.drawTextFont||e,padding:t,align:this.align,verticalAlign:this.verticalAlign,color:this.drawTextColor,autoRowHeight:this.autoRowHeight,lineHeight:i,maxLineClamp:this.maxLineClamp,cacheTextKey:s});return this.rowspan>1?o<this.visibleHeight?0:Math.round(o-(this.visibleHeight-this.height)):Math.round(o)}getSpanInfo(){return this.ctx.database.getSpanInfo(this)}getDisplayText(){return this.cellType==="footer"?this.renderFooter||this.text===null||this.text===void 0?"":this.text:this.rowspan===0||this.colspan===0||this.render||this.type==="index-selection"&&(this.ctx.hoverCell&&this.ctx.hoverCell.rowIndex===this.rowIndex||["checkbox-disabled","checkbox-check"].includes(this.drawSelectionImageName))||this.text===null||this.text===void 0?"":`${this.text}`}getText(){if(this.cellType==="footer")return typeof this.formatterFooter=="function"?this.formatterFooter({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.row[this.key]}):this.row[this.key];if(typeof this.formatter=="function")return this.formatter({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});const{BODY_CELL_FORMATTER_METHOD:e}=this.ctx.config;return typeof e=="function"?e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()}):["index-selection","index"].includes(this.type)?`${this.rowIndex+1}`:(this.value=this.ctx.database.getItemValue(this.rowKey,this.key),this.value)}getValue(){return this.ctx.database.getItemValue(this.rowKey,this.key)}setValue(e){this.ctx.setItemValueByEditor(this.rowKey,this.key,e)}getOverlayerViewsStyle(){let e=this.drawX-this.ctx.fixedLeftWidth,t=this.drawY-this.ctx.body.y;if(this.fixed==="left"?e=this.drawX:this.fixed==="right"&&(e=this.drawX-(this.ctx.stageWidth-this.ctx.fixedRightWidth)),this.cellType==="footer"&&this.ctx.config.FOOTER_FIXED&&(t=this.drawY-this.ctx.footer.y),this.autoRowHeight&&this.render&&this.verticalAlign==="middle"){const i=this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex);if(i<this.visibleHeight&&i>0){const s=(this.visibleHeight-i)/2;t=t+s}}return this.autoRowHeight&&this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex)===0&&(e=-99999,t=-99999),{position:"absolute",overflow:"hidden",left:`${Math.round(e-1)}px`,top:`${Math.round(t-1)}px`,width:`${this.visibleWidth}px`,height:this.autoRowHeight?"auto":`${this.visibleHeight}px`,pointerEvents:"initial",userSelect:"none"}}drawContainer(){const{paint:e,config:{BORDER_COLOR:t,BORDER:i}}=this.ctx,{drawX:s,drawY:o}=this;e.drawRect(s,o,this.visibleWidth,this.visibleHeight,{borderColor:i?t:"transparent",fillColor:this.drawCellBgColor}),e.drawRect(s,o,this.width,this.height,{borderColor:"transparent",fillColor:this.drawCellSkyBgColor}),i||this.ctx.paint.drawLine([s,o+this.visibleHeight,s+this.visibleWidth,o+this.visibleHeight],{borderColor:t,fillColor:t,borderWidth:1,lineCap:"round",lineJoin:"round"})}drawAutofillPiont(){if(this.cellType==="footer")return;const{SELECT_BORDER_COLOR:e,ENABLE_AUTOFILL:t,ENABLE_SELECTOR:i,AUTOFILL_POINT_BORDER_COLOR:s}=this.ctx.config;if(!i||!t||this.ctx.editing)return;const{xArr:o,yArr:n}=this.ctx.selector,a=o[1],c=n[1],{colIndex:d,rowIndex:f,drawX:u,drawY:g}=this;if(d===a&&f===c){const v=d===this.ctx.maxColIndex||f===this.ctx.maxRowIndex||d===this.ctx.lastCenterColIndex?6:4;this.ctx.paint.drawRect(u+this.width-v,g+this.height-v,6,6,{borderColor:s,fillColor:e})}}draw(){this.drawTreeLine(),this.drawText(),this.drawImage(),this.drawSelector(),this.drawAutofillPiont(),this.drawErrorTip()}getWidthByColIndexColSpan(e,t){if(t===0)return 0;let i=0;for(let s=e;s<e+t;s++){const o=this.ctx.header.leafCellHeaders[s];i+=o.width}return i}drawText(){const{CELL_PADDING:e,BODY_FONT:t,PLACEHOLDER_COLOR:i,CELL_LINE_HEIGHT:s}=this.ctx.config,{placeholder:o}=this.column;let n=this.displayText,a=this.drawTextColor;if(!this.ctx.database.getReadonly(this.rowKey,this.key)&&o&&["",null,void 0].includes(this.text)&&this.cellType==="body"&&!(this.rowspan===0||this.colspan===0)&&(n=o,a=i),["",null,void 0].includes(n))return!1;typeof n!="string"&&(n=`${n}`);const c=`${n}_${this.drawTextWidth}_${this.drawTextFont}`;return this.ellipsis=this.ctx.paint.drawText(n,this.drawTextX,this.drawTextY,this.drawTextWidth,this.drawTextHeight,{font:this.drawTextFont||t,padding:e,align:this.align,verticalAlign:this.verticalAlign,color:a,autoRowHeight:this.autoRowHeight,lineHeight:s,maxLineClamp:this.maxLineClamp,cacheTextKey:c}),this.ellipsis}drawImage(){if(this.drawSelectionImageSource&&this.ctx.paint.drawImage(this.drawSelectionImageSource,this.drawSelectionImageX,this.drawSelectionImageY,this.drawSelectionImageWidth,this.drawSelectionImageHeight),this.drawTreeImageSource&&this.ctx.paint.drawImage(this.drawTreeImageSource,this.drawTreeImageX,this.drawTreeImageY,this.drawTreeImageWidth,this.drawTreeImageHeight),this.drawHoverImageSource){const{CELL_HOVER_ICON_BG_COLOR:e,CELL_HOVER_ICON_BORDER_COLOR:t}=this.ctx.config;this.ctx.paint.drawRect(this.drawHoverImageX-2,this.drawHoverImageY-2,this.drawHoverImageWidth+4,this.drawHoverImageHeight+4,{borderColor:t,radius:4,borderWidth:1,fillColor:e}),this.ctx.paint.drawImage(this.drawHoverImageSource,this.drawHoverImageX,this.drawHoverImageY,this.drawHoverImageWidth,this.drawHoverImageHeight)}}drawSelector(){if(this.cellType==="footer")return;const{ENABLE_SELECTOR:e}=this.ctx.config;if(!e)return;const{xArr:t,yArr:i,xArrCopy:s,yArrCopy:o}=this.ctx.selector;this.drawBorder({xArr:s,yArr:o,borderColor:this.ctx.config.SELECT_BORDER_COLOR||"rgb(82,146,247)",fillColor:"transparent",borderWidth:1,lineDash:[4,4]}),this.drawBorder({xArr:this.ctx.autofill.xArr,yArr:this.ctx.autofill.yArr,borderColor:this.ctx.config.SELECT_BORDER_COLOR||"rgb(82,146,247)",fillColor:"transparent",borderWidth:1,lineDash:[4,4]}),this.drawBorder({xArr:t,yArr:i,borderColor:this.ctx.config.SELECT_BORDER_COLOR||"rgb(82,146,247)",fillColor:"transparent",borderWidth:1});const[n,a]=t,[c,d]=i;!(n===a&&c===d)&&this.colIndex>=n&&this.colIndex<=a&&this.rowIndex>=c&&this.rowIndex<=d&&this.ctx.paint.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:"transparent",fillColor:this.ctx.config.SELECT_AREA_COLOR||"rgba(82,146,247,0.1)"}),this.operation&&this.rowIndex>=c&&this.rowIndex<=d&&this.ctx.paint.drawRect(this.drawX,this.drawY,this.visibleWidth,this.visibleHeight,{borderColor:"transparent",fillColor:this.ctx.config.SELECT_ROW_COL_BG_COLOR||"transparent"})}drawErrorTip(){if(this.cellType==="footer"||!this.message||this.rowspan===0||this.colspan===0)return;const{ERROR_TIP_ICON_SIZE:e,ERROR_TIP_COLOR:t}=this.ctx.config,{width:i}=this,s=this.drawX,o=this.drawY,n=[s+i-e-.5,o,s+i-.5,o,s+i-.5,o+e];this.ctx.paint.drawLine(n,{borderColor:t,fillColor:t,borderWidth:1,lineCap:"round",lineJoin:"round"})}drawBorder(e){const{drawX:t,drawY:i,rowIndex:s,colIndex:o,height:n,width:a}=this;let c=t,d=i;const{xArr:f,yArr:u,lineDash:g=[],borderWidth:v=1,borderColor:x,fillColor:m}=e,p=f[0],E=f[1],C=u[0],w=u[1];if(o>=p&&o<=E&&s===C){const _=o===E?1:0,S=o===p?1:0;this.ctx.paint.drawLine([c+S,d+1,c+a-_,d+1],{borderColor:x,fillColor:m,borderWidth:v,lineCap:"round",lineJoin:"round",lineDash:g})}if(o===E&&s>=C&&s<=w){const _=s===C?1:0,S=s===w?1:0;this.ctx.paint.drawLine([c+a-1,d+_,c+a-1,d+n-S],{borderColor:x,fillColor:m,borderWidth:v,lineCap:"round",lineJoin:"round",lineDash:g})}if(o>=p&&o<=E&&s===w){const _=o===E?1:0,S=o===p?1:0;this.ctx.paint.drawLine([c+S,d+n-1,c+a-_,d+n-1],{borderColor:x,fillColor:m,borderWidth:v,lineCap:"round",lineJoin:"round",lineDash:g})}if(o===p&&s>=C&&s<=w){const _=s===w?1:0,S=s===C?1:0;this.ctx.paint.drawLine([c+1,d+S,c+1,d+n-_],{borderColor:x,fillColor:m,borderWidth:v,lineCap:"round",lineJoin:"round",lineDash:g})}}}class AC{constructor(e,t){h(this,"ctx"),h(this,"data"),h(this,"columns"),h(this,"footerData",[]),h(this,"rowKeyMap",new Map),h(this,"colIndexKeyMap",new Map),h(this,"headerMap",new Map),h(this,"rowIndexRowKeyMap",new Map),h(this,"rowKeyRowIndexMap",new Map),h(this,"checkboxKeyMap",new Map),h(this,"selectionMap",new Map),h(this,"expandMap",new Map),h(this,"originalDataMap",new Map),h(this,"changedDataMap",new Map),h(this,"validationErrorMap",new Map),h(this,"itemRowKeyMap",new WeakMap),h(this,"bufferData",[]),h(this,"customHeader",{fixedData:{},sortData:{},hideData:{},resizableData:{}}),h(this,"overlayerAutoHeightMap",new Map),h(this,"maxRowHeightCellMap",new Map),h(this,"bufferCheckState",{buffer:!1,check:!1,indeterminate:!1,selectable:!0}),h(this,"sumHeight",0),h(this,"filterMethod"),h(this,"positions",[]),h(this,"sortState",new Map),this.ctx=e;const{data:i=[],columns:s=[],footerData:o=[]}=t;this.data=i,this.footerData=o,this.columns=s,this.init()}init(e=!0){this.ctx.paint.clearTextCache(),this.clearBufferData(),this.rowKeyMap.clear(),this.checkboxKeyMap.clear(),this.colIndexKeyMap.clear(),this.rowIndexRowKeyMap.clear(),this.rowKeyRowIndexMap.clear(),this.maxRowHeightCellMap.clear();const t=this.getColumns(),i=Wt(t);if(this.ctx.hasSelection=i.some(s=>s.type==="selection"),this.ctx.hasTree=i.some(s=>s.type==="tree"),e){this.originalDataMap.clear(),this.changedDataMap.clear(),this.validationErrorMap.clear();const{ROW_KEY:s}=this.ctx.config;s?(this.ctx.hasSelection||this.selectionMap.clear(),this.ctx.hasTree||this.expandMap.clear()):(this.selectionMap.clear(),this.expandMap.clear())}this.itemRowKeyMap=new WeakMap,this.initData(this.data),this.getData(),this.bufferCheckState.buffer=!1}clearBufferData(){this.bufferData=[]}initData(e,t=0,i=[]){const s=e.length,{ROW_KEY:o="",DEFAULT_EXPAND_ALL:n,CELL_HEIGHT:a,SELECTABLE_METHOD:c,CHECKBOX_KEY:d,TREE_CHILDREN_KEY:f}=this.ctx.config;e.forEach((u,g)=>{var v;f!=="children"&&(u.children=u[f]);const x=u[o],m=x!=null?`${x}`:qa();this.itemRowKeyMap.set(u,m);const p=u._height||a,E=u._readonly;let C=!0;if(typeof c=="function"&&(C=c),d){const _=u[d];if(this.checkboxKeyMap.has(_)){const S=this.checkboxKeyMap.get(_)||[];S.push(m),this.checkboxKeyMap.set(_,S)}else this.checkboxKeyMap.set(_,[m])}this.selectionMap.set(m,{key:d?u[d]:m,row:u,check:((v=this.selectionMap.get(m))==null?void 0:v.check)||!1});const w=n||this.expandMap.get(m)||u._expand||!1;this.expandMap.set(m,w),this.rowKeyMap.set(m,{readonly:E,index:g,rowIndex:g,level:t,height:p,calculatedHeight:-1,check:!1,selectable:C,expand:w,expandLazy:!1,hasChildren:u._hasChildren||(Array.isArray(u.children)?u.children.length>0:!1),expandLoading:!1,item:u,parentRowKeys:i,parentRowKey:i[i.length-1]||"",isLastChild:g===s-1}),Array.isArray(u.children)&&u.children.length&&this.initData(u.children,t+1,[...i,m])})}setRowHeight(e,t){const i=this.rowIndexRowKeyMap.get(e);if(i===void 0)return;const s=this.rowKeyMap.get(i);s.height=t,s.item._height=t,this.clearBufferData()}setBatchRowHeight(e){e.forEach(({rowIndex:t,height:i})=>{const s=this.rowIndexRowKeyMap.get(t);if(s){const o=this.rowKeyMap.get(s);o.height=i,o.item._height=i}}),this.clearBufferData()}setBatchCalculatedRowHeight(e){return e.every(({height:t,rowIndex:i})=>this.getPositionForRowIndex(i).calculatedHeight===t)?!1:(e.forEach(({rowIndex:t,height:i})=>{const s=this.rowIndexRowKeyMap.get(t);if(s){const o=this.rowKeyMap.get(s),{height:n=-1}=this.getMaxRowHeightItem(s)||{};o.calculatedHeight=Math.max(i,n)}}),this.clearBufferData(),this.getData(),!0)}getAllRowsData(){let e=[];const t=i=>{i.forEach(s=>{e.push(s),Array.isArray(s.children)&&t(s.children)})};return t(this.data),e}generateColumns(e){const t=i=>i.map(s=>{var o,n,a,c,d,f,u,g;const v=s.children&&Array.isArray(s.children)?t(s.children):void 0,x={hide:(n=(o=this.customHeader)==null?void 0:o.hideData)==null?void 0:n[s.key],fixed:(c=(a=this.customHeader)==null?void 0:a.fixedData)==null?void 0:c[s.key],sort:(f=(d=this.customHeader)==null?void 0:d.sortData)==null?void 0:f[s.key],width:(g=(u=this.customHeader)==null?void 0:u.resizableData)==null?void 0:g[s.key]},m={};for(const[E,C]of Object.entries(x))C!==void 0&&(m[E]=C);const p=v&&v.every(E=>E.hide);return{...s,children:v,hide:p||(typeof s.hide=="function"?s.hide(s):s.hide),...m}});return t(e)}getColumns(){return this.generateColumns(this.columns)}setColumns(e){this.columns=e,this.clearBufferData()}setData(e){this.data=e,this.init()}getData(){if(this.bufferData.length>0)return{data:this.bufferData,sumHeight:this.sumHeight,positions:this.positions};let e=[],t=0;this.sumHeight=0,this.positions=[];const i=o=>{o.forEach(n=>{e.push(n);const a=this.itemRowKeyMap.get(n),{expand:c,hasChildren:d,height:f,calculatedHeight:u}=this.rowKeyMap.get(a),g=this.sumHeight,v=Math.max(u,f);this.sumHeight+=v,this.rowIndexRowKeyMap.set(t,a),this.rowKeyRowIndexMap.set(a,t),this.positions.push({top:g,height:v,bottom:this.sumHeight,calculatedHeight:u}),t+=1,c&&d&&i(n.children)})};this.rowIndexRowKeyMap.clear(),this.rowKeyRowIndexMap.clear();let s=this.data;if(typeof this.filterMethod=="function"&&(s=this.filterMethod(s)),this.sortState.size){const o=Array.from(this.sortState.entries()).sort((n,a)=>n[1].timestamp-a[1].timestamp);s=this.sortDataRecursive(s,o)}return i(s),this.bufferData=e,{data:e,sumHeight:this.sumHeight,positions:this.positions}}setFooterData(e){this.footerData=e}getFooterData(){return this.footerData}setFilterMethod(e){this.filterMethod=e}clearFilterMethod(){this.filterMethod=void 0}getSortState(e){return this.sortState.get(e)||{direction:"none",timestamp:0}}setSortState(e,t){const i=Date.now();this.ctx.config.SORT_STRICTLY&&this.sortState.clear(),t==="none"?this.sortState.delete(e):this.sortState.set(e,{direction:t,timestamp:i}),this.ctx.emit("sortChange",this.sortState),this.clearBufferData(),this.ctx.emit("draw")}clearSort(){this.sortState.clear(),this.ctx.emit("sortChange",this.sortState),this.clearBufferData(),this.ctx.emit("draw")}sortDataRecursive(e,t){let i=[...e];for(const[s,{direction:o}]of t){if(o==="none")continue;const n=this.getColumnByKey(s);!n||!n.column.sortBy||(i=this.applySingleColumnSort(i,s,o,n.column.sortBy))}return i.map(s=>(s.children&&Array.isArray(s.children)&&(s.children=this.sortDataRecursive(s.children,t)),s))}applySingleColumnSort(e,t,i,s){return e.sort((o,n)=>{const a=o[t],c=n[t];let d=0;if(typeof s=="function")d=s(o,n);else if(s==="number"){const f=Number(a)||0,u=Number(c)||0;d=f-u}else if(s==="string"){const f=String(a||""),u=String(c||"");d=f.localeCompare(u)}else s==="date"&&(d=MC(a,c));return i==="asc"?d:-d})}expandItem(e,t=!1){const i=this.rowKeyMap.get(e);i.expand=t,this.expandMap.set(e,t),this.clearBufferData(),this.ctx.emit("draw")}setExpandRowKeys(e,t=!0){this.expandMap.clear(),e.forEach(i=>{const s=this.rowKeyMap.get(i);this.expandMap.set(i,t),s.expand=t}),this.clearBufferData(),this.ctx.emit("draw")}getExpandRowKeys(){let e=[];return this.rowKeyMap.forEach((t,i)=>{t.expand&&e.push(i)}),e}expandAll(e){this.expandMap.clear(),this.rowKeyMap.forEach(t=>{t.expand=e,this.expandMap.set(t.key,e)}),this.clearBufferData(),this.ctx.emit("draw")}expandLoading(e,t=!1){const i=this.rowKeyMap.get(e);i.expandLoading=t,this.clearBufferData(),this.ctx.emit("draw")}setExpandChildren(e,t){const i=this.rowKeyMap.get(e);i.expand=!0,this.expandMap.set(e,!0),i.expandLazy=!0,i.item.children=t,this.initData(i.item.children,i.level+1),this.clearBufferData()}getIsExpandLoading(e){return this.rowKeyMap.get(e).expandLoading}getIsExpandLazy(e){return this.rowKeyMap.get(e).expandLazy}getIsExpand(e){return this.rowKeyMap.get(e).expand}getRowForRowKey(e){return this.rowKeyMap.get(e)}getRowForRowIndex(e){const t=this.getRowKeyForRowIndex(e);return this.rowKeyMap.get(t)}getRowKeyForRowIndex(e){return this.rowIndexRowKeyMap.get(e)||""}getRowKeyByItem(e){return this.itemRowKeyMap.get(e)}getRowIndexForRowKey(e){return this.rowKeyRowIndexMap.get(e)}getItemValueForRowIndexAndColIndex(e,t){if(!(this.rowIndexRowKeyMap.has(e)&&this.colIndexKeyMap.get(t)))return null;const i=this.rowIndexRowKeyMap.get(e),s=this.colIndexKeyMap.get(t);return i===void 0||s===void 0?null:{rowKey:i,key:s,value:this.getItemValue(i,s)}}getItemValue(e,t){const i=this.rowKeyMap.get(e);return i&&i.item?i.item[t]===void 0?null:i.item[t]:null}async batchSetItemValue(e,t=!1,i=!0,s="none"){let o=[],n=i;const a=new Set;let c=[],d=e.map(x=>{const{rowKey:m,key:p}=x;let E=x.value,C=E;const w=this.getRowDataItemForRowKey(m),_=this.getItemValue(m,p),S=this.getVirtualBodyCellByKey(m,p);return(S==null?void 0:S.type)==="number"&&(["",void 0,null].includes(E)?C=null:/^-?\d+(\.\d+)?$/.test(`${E}`)?C=Number(E):(C=_,c.push({...x,value:C,oldValue:_,row:w}))),{...x,value:C,oldValue:_,row:w}});if(d=d.filter(x=>!c.some(m=>x.rowKey===m.rowKey&&x.key===m.key)),c.length){const x={code:"ERR_BATCH_SET_NUMBER_VALUE",message:"Assignment failed, not a numeric type",data:c};this.ctx.emit("error",x)}if(d=d.filter(x=>x.oldValue!==x.value),!d.length)return;const{BEFORE_VALUE_CHANGE_METHOD:f}=this.ctx.config;s==="none"&&typeof f=="function"&&(d=await f(d),n=!1),d.forEach(x=>{const{value:m,rowKey:p,key:E}=x,C=this.getItemValue(p,E);a.add(p),this.setItemValue(p,E,m,!1,!1,!1,n),o.push({rowKey:p,key:E,oldValue:C,newValue:m})});let u=[];a.forEach(x=>{u.push(this.ctx.database.getRowDataItemForRowKey(x))});const g=d.map(({rowKey:x,key:m})=>this.getValidator(x,m));Promise.all(g).then(()=>{this.validationErrorMap.size===0&&this.changedDataMap.size>0&&this.ctx.emit("validateChangedData",this.getChangedData())});const v=d.map(x=>{const m=!!this.getValidationError(x.rowKey,x.key).length;return{...x,errorTip:m}});this.ctx.emit("change",v,u),t&&this.ctx.history.pushState({changeList:o,scrollX:this.ctx.scrollX,scrollY:this.ctx.scrollY,type:"multiple"}),this.ctx.emit("draw")}async setItemValue(e,t,i,s=!1,o=!1,n=!1,a=!0){if(!this.rowKeyMap.has(e))return{};const{item:c}=this.rowKeyMap.get(e);let d=c[t],f=i;if(a&&this.ctx.database.getReadonly(e,t))return{oldValue:d,newValue:d};c[t]!==null&&typeof c[t]=="object"&&(d=JSON.parse(JSON.stringify(c[t])));const u=`${e}_${t}`;this.originalDataMap.has(u)||this.originalDataMap.set(u,d);const g=this.originalDataMap.get(u),v=this.getRowDataItemForRowKey(e);if(n){const x=this.getVirtualBodyCellByKey(e,t);if((x==null?void 0:x.type)==="number")if(["",void 0,null].includes(i))f=null;else if(/^-?\d+(\.\d+)?$/.test(`${i}`))f=Number(i);else{f=d;const p={code:"ERR_SET_NUMBER_VALUE",message:"Assignment failed, not a numeric type",data:[{rowKey:e,key:t,value:f,oldValue:d,row:v}]};this.ctx.emit("error",p)}if(f===d)return{oldValue:d,newValue:d};let m=[{rowKey:e,key:t,value:f,oldValue:d,row:v}];this.batchSetItemValue(m,s,!1),this.ctx.emit("editChange",{rowKey:e,key:t,oldValue:d,value:f,originalValue:g,row:v})}else this.changedDataMap.set(u,f),c[t]=f;return this.ctx.hasEvent("iterationChange")&&this.ctx.emit("iterationChange",{rowKey:e,key:t,oldValue:d,value:f,originalValue:this.originalDataMap.get(u),row:v}),o&&this.ctx.emit("draw"),{oldValue:d,newValue:f}}getRowDataItemForRowKey(e){if(!this.rowKeyMap.has(e))return{};const{item:t}=this.rowKeyMap.get(e);return t}setRowSelectionByCheckboxKey(e,t){const{CHECKBOX_KEY:i}=this.ctx.config;if(i){if(!this.rowKeyMap.has(e))return!1;const{item:s}=this.rowKeyMap.get(e),o=s[i];this.checkboxKeyMap.has(o)&&(this.checkboxKeyMap.get(o)||[]).forEach(n=>{const a=this.selectionMap.get(n);a&&(a.check=t)})}}toggleRowSelection(e,t){const i=this.rowKeyMap.get(e),s=this.selectionMap.get(e);if(!s)return;t==="selection-tree"||t==="tree-selection"?this.toggleTreeSelection(e):(s.check=!s.check,this.setRowSelectionByCheckboxKey(e,s.check)),this.ctx.emit("toggleRowSelection",i);const o=this.getSelectionRows();this.ctx.emit("selectionChange",o),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}toggleTreeSelection(e){const t=this.getTreeSelectionState(e),i=this.ctx.config.TREE_SELECT_MODE;if(i==="auto")t.checked&&!t.indeterminate?(this.clearTreeSelectionRecursive(e),this.setRowSelection(e,!1,!1)):(this.selectTreeSelectionRecursive(e),this.setRowSelection(e,!0,!1));else if(i==="cautious")t.checked&&!t.indeterminate?(this.clearTreeSelectionRecursive(e),this.setRowSelection(e,!1,!1)):(this.selectTreeSelectionRecursive(e),this.setRowSelection(e,!0,!1));else if(i==="strictly"){const s=this.selectionMap.get(e);s&&(s.check=!s.check,this.setRowSelectionByCheckboxKey(e,s.check))}this.ctx.emit("selectionChange",this.getSelectionRows()),this.ctx.emit("draw")}selectTreeSelectionRecursive(e){this.getTreeChildren(e).forEach(t=>{this.setRowSelectionByParent(t,!0),this.selectTreeSelectionRecursive(t)})}clearTreeSelectionRecursive(e){this.getTreeChildren(e).forEach(t=>{this.setRowSelectionByParent(t,!1),this.clearTreeSelectionRecursive(t)})}updateParentTreeSelection(e){const t=this.getTreeParent(e);if(!t)return;const i=this.getTreeChildren(t).map(c=>this.selectionMap.get(c)),s=i.filter(c=>c==null?void 0:c.check).length,o=i.length;let n=!1;o>0&&(s===0?n=!1:s===o||this.ctx.config.TREE_SELECT_MODE==="auto"?n=!0:this.ctx.config.TREE_SELECT_MODE==="cautious"&&(n=!1));const a=this.selectionMap.get(t);a&&a.check!==n&&(a.check=n,this.setRowSelectionByCheckboxKey(t,n),this.updateParentTreeSelection(t))}setRowSelection(e,t,i=!0){const s=this.selectionMap.get(e);s&&(s.check=t,this.setRowSelectionByCheckboxKey(e,s.check),this.ctx.emit("setRowSelection",t,s.row),(this.ctx.config.TREE_SELECT_MODE==="auto"||this.ctx.config.TREE_SELECT_MODE==="cautious")&&this.updateParentTreeSelection(e),i&&(this.bufferCheckState.buffer=!1,this.ctx.emit("draw")))}setRowSelectionByParent(e,t){const i=this.selectionMap.get(e);i&&(i.check=t,this.setRowSelectionByCheckboxKey(e,i.check))}getSelectionRows(){let e=[];return this.selectionMap.forEach(t=>{t.check&&e.push(t.row)}),e}getRowSelection(e){const t=this.selectionMap.get(e);return t?t.check:!1}getTreeSelectionState(e){if(!this.getRowForRowKey(e))return{checked:!1,indeterminate:!1};const t=this.selectionMap.get(e),i=(t==null?void 0:t.check)||!1;if(this.getTreeChildren(e).length===0)return{checked:i,indeterminate:!1};let s=!1,o=i;if(this.ctx.config.TREE_SELECT_MODE==="auto"){const n=u=>{const g=this.getTreeChildren(u);let v=[];for(const x of g)v.push(x),v.push(...n(x));return v},a=n(e).map(u=>this.selectionMap.get(u)),c=a.filter(u=>u==null?void 0:u.check).length,d=a.length,f=c>0;s=f&&c!==d,o=i||f,i&&d>0&&c===0&&(o=!1,s=!1)}else if(this.ctx.config.TREE_SELECT_MODE==="cautious"){const n=g=>{const v=this.getTreeChildren(g);let x=[];for(const m of v)x.push(m),x.push(...n(m));return x},a=n(e).map(g=>this.selectionMap.get(g)),c=a.filter(g=>g==null?void 0:g.check).length,d=a.length,f=c>0,u=c===d;s=f&&!u,o=i||u,i&&d>0&&c===0&&(o=!1,s=!1)}else this.ctx.config.TREE_SELECT_MODE==="strictly"&&(s=!1,o=i);return{checked:o,indeterminate:s}}getTreeChildren(e){const t=this.getRowForRowKey(e);if(!t||!t.item||!t.item.children)return[];const i=[],s=o=>{for(const n of o){const a=this.getRowKeyByItem(n);a&&i.push(a),n.children&&n.children.length>0&&s(n.children)}};return s(t.item.children),i}getTreeParent(e){const t=(i,s)=>{for(const o of i){const n=this.getRowKeyByItem(o);if(o.children)for(const a of o.children){if(this.getRowKeyByItem(a)===s)return n;const c=t(o.children,s);if(c)return c}}return null};return t(this.data,e)}getRowSelectable(e){const{selectable:t,item:i,rowIndex:s}=this.rowKeyMap.get(e);return typeof t=="function"?t({row:i,rowIndex:s}):t}toggleAllSelection(){this.ctx.config.TREE_SELECT_MODE==="auto"||this.ctx.config.TREE_SELECT_MODE==="cautious"?this.rowKeyMap.forEach((t,i)=>{let s=t.selectable;if(typeof s=="function"&&(s=s({row:t.item,rowIndex:t.rowIndex})),s){const o=this.selectionMap.get(i);o&&(o.check=!0,this.setRowSelectionByCheckboxKey(i,!0))}}):this.rowKeyMap.forEach((t,i)=>{let s=t.selectable;typeof s=="function"&&(s=s({row:t.item,rowIndex:t.rowIndex})),s&&this.setRowSelection(i,!0,!1)});const e=this.getSelectionRows();this.ctx.emit("toggleAllSelection",e),this.ctx.emit("selectionChange",e),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}clearSelection(e=!1){const t=this.ctx.config.TREE_SELECT_MODE==="auto"||this.ctx.config.TREE_SELECT_MODE==="cautious";e?t?this.rowKeyMap.forEach((s,o)=>{const n=this.selectionMap.get(o);n&&(n.check=!1,this.setRowSelectionByCheckboxKey(o,!1))}):this.rowKeyMap.forEach((s,o)=>{this.setRowSelection(o,!1,!1)}):(this.selectionMap.clear(),this.rowKeyMap.forEach((s,o)=>{this.selectionMap.set(o,{check:!1,row:s.item,key:o})}));const i=this.getSelectionRows();this.ctx.emit("clearSelection"),this.ctx.emit("selectionChange",i),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}getCheckedState(){const{buffer:e,...t}=this.bufferCheckState;if(e)return t;const i=this.rowKeyMap.size;let s=0,o=0;const n=this.selectionMap.size,a=Array.from(this.selectionMap.values()).some(g=>g.check);this.rowKeyMap.forEach((g,v)=>{var x;(x=this.selectionMap.get(v))!=null&&x.check&&(s+=1);let m=g.selectable;typeof m=="function"&&(m=m({row:g.item,rowIndex:g.rowIndex})),m&&(o+=1)});const c=n>i&&s===0&&a,d=o&&o>s&&s>0||c,f=o!==0,u=!!o&&o===s;return this.bufferCheckState={buffer:!0,check:u,indeterminate:d,selectable:f},{check:u,indeterminate:d,selectable:f}}updateColIndexKeyMap(e=[]){this.colIndexKeyMap.clear(),e.forEach(t=>{this.colIndexKeyMap.set(t.colIndex,t.key)})}getColumnByColIndex(e){var t;const i=this.colIndexKeyMap.get(e);if(i&&this.headerMap.has(i))return(t=this.headerMap.get(i))==null?void 0:t.column}getColumnByKey(e){const t=this.headerMap.get(e);if(t)return t}getColIndexForKey(e){var t;if(e&&this.headerMap.has(e))return(t=this.headerMap.get(e))==null?void 0:t.colIndex}getColHeaderByIndex(e){const t=this.colIndexKeyMap.get(e);if(t&&this.headerMap.has(t))return this.headerMap.get(t)}getChangedData(){let e=[];return this.changedDataMap.forEach((t,i)=>{const s=this.originalDataMap.get(i),o=i.split("_")[0],n=i.split("_")[1];s!==t&&e.push({rowKey:o,colKey:n,originalValue:s,row:this.ctx.database.getRowDataItemForRowKey(o),value:t})}),e}getChangedRows(){const e=new Set;this.changedDataMap.forEach((i,s)=>{const o=this.originalDataMap.get(s),n=s.split("_")[0];o!==i&&e.add(n)});let t=[];return e.forEach(i=>{t.push(this.ctx.database.getRowDataItemForRowKey(i))}),t}isHasChangedData(e,t){const i=`${e}_${t}`;if(!this.changedDataMap.has(i))return!1;const s=this.originalDataMap.get(i),o=this.changedDataMap.get(i);return s!==o}getPositionForRowIndex(e){return e<this.positions.length?this.positions[e]:{height:0,top:0,bottom:0,calculatedHeight:0}}setHeader(e,t){return e?(this.headerMap.set(e,t),!0):!1}getReadonly(e,t){const{DISABLED:i}=this.ctx.config;if(i)return!0;const s=this.rowKeyMap.get(e),o=this.headerMap.get(t);if(!s||!o)return!0;const n=s.readonly,a=o.readonly,{BODY_CELL_READONLY_METHOD:c}=this.ctx.config;if(typeof c=="function"&&o){const d=c({row:s.item,rowIndex:s.rowIndex,colIndex:o.colIndex,column:o.column,value:this.getItemValue(e,t)});if(d!==void 0)return d}return a||n}clearValidate(){this.validationErrorMap.clear()}hasValidationError(){return this.validationErrorMap.size!==0}getValidator(e,t){return new Promise(i=>{const s=this.rowKeyMap.get(e),o=this.headerMap.get(t),{BODY_CELL_RULES_METHOD:n}=this.ctx.config;if(s===void 0||o===void 0)return i([]);const a=o.column;let c=a.rules;if(typeof n=="function"){const d=n({row:s.item,rowIndex:s.rowIndex,colIndex:o.colIndex,column:a,value:this.getItemValue(e,t)});d&&(c=d)}if(c){const d={row:s.item,rowIndex:s.rowIndex,colIndex:o.colIndex,column:a,key:t,rowKey:e,value:this.getItemValue(e,t),field:t,fieldValue:this.getItemValue(e,t)},f=new IC(c).validate(d);this.setValidationError(e,t,f),i(f)}else this.clearValidationError(e,t),i([])})}getHeightByRowIndexRowSpan(e,t){let i=0;for(let s=0;s<t;s++){const o=this.positions[e+s];o&&(i+=o.height)}return i}getSpanInfo(e){const{rowIndex:t,key:i,rowKey:s,row:o,value:n,colIndex:a,relationRowKeys:c,relationColKeys:d,rowspan:f,height:u,width:g,colspan:v,mergeRow:x,mergeCol:m}=e;if(f===1&&v===1)return{xArr:[a,a],yArr:[t,t],rowspan:f,colspan:v,height:u,width:g,offsetTop:0,offsetLeft:0,dataList:[{rowKey:s,key:i,row:o,value:n}]};let p=t,E=t,C=a,w=a,_=[],S=0,B=0,K=0,R=0;if(f!==1&&x){R=g;const I=c.reduce((b,O)=>{const y=this.getItemValue(s,O)??"";return`${b}${y}`},"");for(let b=t-1;b>=0;b--){const O=this.rowIndexRowKeyMap.get(b)||"",y=c.reduce((M,D)=>{const P=this.getItemValue(O,D)??"";return`${M}${P}`},"");if(I===y)p=b;else break}for(let b=t;b<=this.ctx.maxRowIndex;b++){const O=this.rowIndexRowKeyMap.get(b)||"",y=c.reduce((M,D)=>{const P=this.getItemValue(O,D)??"";return`${M}${P}`},"");if(I===y)E=b;else break}for(let b=p;b<t;b++){const{height:O}=this.positions[b];S+=O}for(let b=p;b<=E;b++){const{height:O}=this.positions[b];K+=O;const y=this.rowIndexRowKeyMap.get(b)||"",{item:M}=this.rowKeyMap.get(y),D=this.getItemValue(y,i);_.push({rowKey:y,key:i,value:D,row:M})}}if(v!==1&&m){K=u;for(let I=a-1;I>=0;I--){const b=this.getColumnByColIndex(I);if(!b)break;const O=this.getItemValue(s,i),y=this.getItemValue(s,b.key);if(O===y&&d.includes(b.key))C=I;else break}for(let I=a;I<=this.ctx.maxColIndex;I++){const b=this.getColumnByColIndex(I);if(!b)break;const O=this.getItemValue(s,i),y=this.getItemValue(s,b.key);if(O===y&&d.includes(b.key))w=I;else break}for(let I=C;I<a;I++){const b=this.getColumnByColIndex(I);if(!b)break;B+=b.width||100}for(let I=C;I<=w;I++){const b=this.getColumnByColIndex(I);if(!b)break;R+=b.width||100,_.push({rowKey:s,key:b.key,value:this.getItemValue(s,b.key),row:o})}}return{xArr:[C,w],yArr:[p,E],rowspan:f,colspan:v,height:K,width:R,offsetTop:S,offsetLeft:B,dataList:_}}setValidationErrorByRowKey(e,t,i){const s=`${e}_${t}`,o=this.getRowForRowKey(e),n=o==null?void 0:o.rowIndex,a=this.getColumnByKey(t);if(!e||!a||!o)return;const c=this.getItemValue(e,t),d=[{key:t,rowKey:e,rowIndex:n,colIndex:a.colIndex,column:a.column,row:o,value:c,message:i,field:t,fieldValue:c}];this.validationErrorMap.set(s,d)}setValidationError(e,t,i){const s=`${e}_${t}`;this.validationErrorMap.set(s,i)}clearValidationError(e,t){const i=`${e}_${t}`;this.validationErrorMap.has(i)&&this.validationErrorMap.delete(i)}getValidationError(e,t){const i=`${e}_${t}`;return this.validationErrorMap.get(i)||[]}getVirtualBodyCell(e,t,i=!0){const s=this.getColumnByColIndex(t),o=this.getRowForRowIndex(e);return!s||!o?void 0:new Pr(this.ctx,e,t,0,0,0,0,s,o.item,"body",i)}getVirtualBodyCellByKey(e,t){const i=this.getRowIndexForRowKey(e),s=this.getColIndexForKey(t);if(!(i===void 0||s===void 0))return this.getVirtualBodyCell(i,s)}hasMergeCell(e,t){let i=!1;for(let s=t[0];s<=t[1];s++)for(let o=e[0];o<=e[1];o++){const n=this.getVirtualBodyCell(s,o);if(n&&(n.rowspan!==1||n.colspan!==1)){i=!0;break}}return i}calculateMaxTreeDepth(e,t=0){let i=t;return e.forEach(s=>{if(Array.isArray(s.children)&&s.children.length>0){const o=this.calculateMaxTreeDepth(s.children,t+1);i=Math.max(i,o)}}),i}setOverlayerAutoHeightMap(e){this.overlayerAutoHeightMap=e}getOverlayerAutoHeightMap(){return this.overlayerAutoHeightMap}getOverlayerAutoHeight(e,t){const i=`${e}_${t}`;return this.overlayerAutoHeightMap.get(i)||0}setCustomHeader(e,t=!1){if(["fixedData","sortData","hideData","resizableData"].forEach(i=>{const s=e[i];s!==void 0&&(this.customHeader[i]=s)}),!t){const i=this.clearCustomHeaderInvalidValues(this.columns);this.ctx.emit("customHeaderChange",i)}}resetCustomHeader(){this.customHeader={},this.ctx.emit("resetHeader"),this.ctx.emit("customHeaderChange",this.customHeader)}getCustomHeader(){return this.customHeader}setCustomHeaderResizableData(e,t){let{resizableData:i={}}=this.customHeader;i[e]=t,this.setCustomHeader({resizableData:i})}setCustomHeaderHideData(e,t){let{hideData:i={}}=this.customHeader;e.forEach(s=>{i[s]=t}),this.setCustomHeader({hideData:i}),this.ctx.emit("resetHeader")}setCustomHeaderFixedData(e,t){let{fixedData:i={}}=this.customHeader;e.forEach(s=>{i[s]=t}),this.setCustomHeader({fixedData:i}),this.ctx.emit("resetHeader")}clearCustomHeaderInvalidValues(e){const t=(s,o={})=>{s.forEach(n=>{n.children&&n.children.length>0&&t(n.children,o);const a=(c,d)=>{var f,u;const g=(f=this.customHeader[c])==null?void 0:f[n.key];g!==void 0&&g!==d&&(o[c]||(o[c]={}),o[c][n.key]=g,c==="fixedData"&&!g&&!d&&((u=o[c])==null||delete u[n.key]))};a("fixedData",n.fixed),a("sortData",n.sort),a("hideData",n.hide),a("resizableData",n.width)})};let i={};return t(e,i),i}setMaxRowHeightItem(e,t,i){this.maxRowHeightCellMap.set(e,{key:t,height:i})}getMaxRowHeightItem(e){return this.maxRowHeightCellMap.get(e)}clearChangeData(){this.changedDataMap.clear()}}class NC{constructor(e){h(this,"ctx"),h(this,"history",[]),h(this,"historyIndex",-1),this.ctx=e,this.init()}init(){this.ctx.on("keydown",e=>{if(!this.ctx.editing){if(e.ctrlKey&&!e.shiftKey&&e.code==="KeyZ"||e.metaKey&&!e.shiftKey&&e.code==="KeyZ"){e.preventDefault(),this.ctx.clearSelector(),this.ctx.clearAutofill(),this.backState();return}if(e.ctrlKey&&e.code==="KeyY"||e.ctrlKey&&e.shiftKey&&e.code==="KeyZ"||e.metaKey&&e.shiftKey&&e.code==="KeyZ"){e.preventDefault(),this.ctx.clearSelector(),this.ctx.clearAutofill(),this.forwardState();return}}})}pushState(e){const{HISTORY_NUM:t=0,ENABLE_HISTORY:i}=this.ctx.config;i&&(this.history.push(e),this.history.length>t&&this.history.splice(0,1),this.historyIndex=this.history.length-1)}backState(){if(this.historyIndex>=0){const{changeList:e,scrollX:t,scrollY:i}=this.history[this.historyIndex],s=e.map(o=>({rowKey:o.rowKey,key:o.key,value:o.oldValue,row:{}}));this.ctx.setScroll(t,i),this.ctx.database.batchSetItemValue(s,!1,!1,"back"),this.historyIndex-=1}}forwardState(){if(this.historyIndex<this.history.length-1){this.historyIndex+=1;const{changeList:e}=this.history[this.historyIndex],t=e.map(i=>({rowKey:i.rowKey,key:i.key,value:i.newValue,row:{}}));this.ctx.database.batchSetItemValue(t,!1,!1,"forward")}}clear(){this.history=[],this.historyIndex=-1}}class BC{constructor(e){h(this,"eventTasks",new Set),h(this,"ctx"),this.ctx=e,this.init()}init(){this.bind(window,"resize",this.handleResize.bind(this)),this.bind(window,"mouseup",this.handleMouseUp.bind(this)),this.bind(window,"mousemove",this.handleMousemove.bind(this)),this.bind(window,"blur",this.handleOutsideMousedown.bind(this)),this.bind(window,"mousedown",this.handleOutsideMousedown.bind(this)),this.bind(this.ctx.stageElement,"click",this.handleClick.bind(this)),this.bind(window,"keydown",this.handleKeydown.bind(this)),this.bind(this.ctx.stageElement,"wheel",this.handleWheel.bind(this),{passive:!1}),this.bind(this.ctx.stageElement,"touchstart",this.handleTouchstart.bind(this),{passive:!1}),this.bind(this.ctx.stageElement,"touchend",this.handleTouchend.bind(this)),this.bind(this.ctx.stageElement,"touchmove",this.handleTouchmove.bind(this),{passive:!1}),this.bind(this.ctx.stageElement,"contextmenu",this.handleContextMenu.bind(this)),this.bind(this.ctx.stageElement,"mousedown",this.handleMouseDown.bind(this)),this.bind(this.ctx.stageElement,"dblclick",this.handleDblclick.bind(this)),this.bind(this.ctx.stageElement,"mouseover",this.handleMouseover.bind(this)),this.bind(this.ctx.stageElement,"mouseout",this.handleMouseout.bind(this)),this.bind(document,"selectionchange",this.selectionchange.bind(this))}selectionchange(){this.ctx.domSelectionStr="";const e=window.getSelection();e&&e.toString()&&(this.ctx.domSelectionStr=e.toString())}clearDomSelection(){const e=window.getSelection();e&&!e.isCollapsed&&e.removeAllRanges()}destroy(){Array.from(this.eventTasks).forEach(({target:e,name:t,fn:i,options:s})=>{this.unbind(e,t,i,s)}),this.eventTasks.clear()}handleResize(e){this.ctx.emit("resetHeader",e),this.ctx.emit("resize",e)}handleMouseDown(e){this.clearDomSelection(),e.button===0&&(this.ctx.mousedown=!0),this.ctx.emit("mousedown",e)}handleMousemove(e){const t=e,i=this.ctx.containerElement.getBoundingClientRect(),s=t.clientX-i.left,o=t.clientY-i.top;this.ctx.mouseX=s,this.ctx.mouseY=o,this.ctx.emit("mousemove",e)}handleMouseUp(e){e.button===0&&(this.ctx.mousedown=!1),this.ctx.emit("mouseup",e)}handleClick(e){this.ctx.emit("click",e)}handleKeydown(e){const{ENABLE_KEYBOARD:t}=this.ctx.config;t&&this.ctx.isTarget(e)&&(this.ctx.dragHeaderIng||this.ctx.emit("keydown",e))}handleWheel(e){this.ctx.emit("wheel",e)}handleTouchstart(e){this.ctx.emit("touchstart",e)}handleTouchend(e){this.ctx.emit("touchend",e)}handleTouchmove(e){this.ctx.emit("touchmove",e)}handleContextMenu(e){e.preventDefault(),this.ctx.emit("contextMenu",e)}handleMouseover(e){this.ctx.isMouseoverTargetContainer=!0,this.ctx.emit("mouseover",e)}handleMouseout(e){this.ctx.isMouseoverTargetContainer=!1,this.ctx.emit("mouseout",e)}handleDblclick(e){this.ctx.emit("dblclick",e)}handleOutsideMousedown(e){this.ctx.selector.enable&&(e.target instanceof Window||e.target instanceof Node&&!this.ctx.containerElement.contains(e.target))&&this.ctx.emit("outsideMousedown",e)}bind(e,t,i,s){e.addEventListener(t,i,s),this.eventTasks.add({target:e,name:t,fn:i,options:s})}unbind(e,t,i,s){e.removeEventListener(t,i,s);for(const o of this.eventTasks)if(o.target===e&&o.name===t&&o.fn===i){this.eventTasks.delete(o);break}}}class HC{constructor(){h(this,"events",new Map)}has(e){return this.events.has(e)}on(e,t){const i=this.events.get(e)||[];i.push(t),this.events.set(e,i)}once(e,t){const i=(...s)=>{t(...s),this.off(e,i)};return this.on(e,i),this}off(e,t){const i=this.events.get(e);if(i){const s=i.indexOf(t);s>=0&&(i.splice(s,1),i.length===0?this.events.delete(e):this.events.set(e,i))}}emit(e,...t){const i=this.events.get(e);i&&i.forEach(s=>{s(...t)})}destroy(){this.events.clear()}}class FC{constructor(e){h(this,"ctx"),h(this,"textCacheMap",new Map);const t=e.getContext("2d");if(!t)throw new Error("canvas context not found");this.ctx=t}clearTextCache(){this.textCacheMap.clear()}scale(e){this.ctx.setTransform(1,0,0,1,0,0),this.ctx.scale(e,e)}save(){this.ctx.save()}restore(){this.ctx.restore()}translate(e,t){this.ctx.translate(e,t)}setCursor(e="default"){this.ctx.canvas.style.cursor=e}clear(e=0,t=0,i,s){this.ctx.clearRect(e,t,i||this.ctx.canvas.width,s||this.ctx.canvas.height)}drawShadow(e,t,i,s,o){const{fillColor:n,side:a,shadowWidth:c,colorStart:d,colorEnd:f}=o;this.ctx.save(),n&&(this.ctx.fillStyle=n,this.ctx.fillRect(e,t,i,s));let u;switch(a){case"left":u=this.ctx.createLinearGradient(e-c,t,e,t),u.addColorStop(0,d),u.addColorStop(1,f),this.ctx.fillStyle=u,this.ctx.fillRect(e-c,t,c,s);break;case"right":u=this.ctx.createLinearGradient(e+i,t,e+i+c,t),u.addColorStop(0,d),u.addColorStop(1,f),this.ctx.fillStyle=u,this.ctx.fillRect(e+i,t,c,s);break;case"top":u=this.ctx.createLinearGradient(e,t-c,e,t),u.addColorStop(0,d),u.addColorStop(1,f),this.ctx.fillStyle=u,this.ctx.fillRect(e,t-c,i,c);break;case"bottom":u=this.ctx.createLinearGradient(e,t+s,e,t+s+c),u.addColorStop(0,d),u.addColorStop(1,f),this.ctx.fillStyle=u,this.ctx.fillRect(e,t+s,i,c);break;default:console.error("Invalid side specified for shadow");break}this.ctx.restore()}drawLine(e,t){if(e.length<4||e.length%2!==0)throw new Error("A valid array of points is required to draw a line");this.ctx.save();const{borderColor:i="black",borderWidth:s=1}=t;this.ctx.beginPath(),this.ctx.moveTo(e[0]-.5,e[1]-.5);for(let o=2;o<e.length;o+=2)this.ctx.lineTo(e[o]-.5,e[o+1]-.5);this.ctx.strokeStyle=i,this.ctx.lineWidth=s,t.lineDash&&(this.ctx.lineDashOffset=t.lineDashOffset??0,this.ctx.setLineDash(t.lineDash)),t.fillColor&&(this.ctx.fillStyle=t.fillColor,this.ctx.fill()),t.borderColor&&(this.ctx.strokeStyle=t.borderColor),this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()}drawImage(e,t,i,s,o){this.ctx.save(),this.ctx.drawImage(e,t,i,s,o),this.ctx.restore()}drawRect(e,t,i,s,{borderWidth:o=1,borderColor:n,fillColor:a,radius:c=0}={}){if(this.ctx.save(),this.ctx.beginPath(),a!==void 0&&(this.ctx.fillStyle=a),n!==void 0&&(this.ctx.lineWidth=o,this.ctx.strokeStyle=n),c===0)this.ctx.rect(e-.5,t-.5,i,s);else{const[d,f,u,g]=typeof c=="number"?[c,c,c,c]:c;this.ctx.moveTo(e+d,t),this.ctx.arcTo(e+i,t,e+i,t+f,f),this.ctx.arcTo(e+i,t+s,e+i-u,t+s,u),this.ctx.arcTo(e,t+s,e,t+s-g,g),this.ctx.arcTo(e,t,e+d,t,d)}a!==void 0&&this.ctx.fill(),n!==void 0&&this.ctx.stroke(),this.ctx.restore()}drawText(e="",t,i,s,o,n={}){var a;this.ctx.save();const{font:c="12px Arial",align:d="center",color:f="#495060",padding:u=0,verticalAlign:g="middle",maxLineClamp:v=1,autoRowHeight:x=!1,offsetLeft:m=0,offsetRight:p=0}=n;if(this.ctx.font=c,this.ctx.fillStyle=f,this.ctx.textAlign=d,["",null,void 0].includes(e))return this.ctx.restore(),!1;const E=parseInt(((a=c.match(/\d+/))==null?void 0:a[0])||"12")*(n.lineHeight||1.2),C=s-u*2-m-p;let w=!1;const _=Math.round((o-2*u)/E);let S=this.wrapText(e,C,n.cacheTextKey),B=Math.min(S.length,Math.max(_,1));v==="auto"&&x?B=S.length:typeof v=="number"&&v<B&&v!==1?B=v:(v===1&&(S=[e],B=1),v==="auto"&&_===1&&(S=[e],B=1));let K=i+u;const R=Math.round(B*E);g==="middle"?K=i+(o-R)/2:g==="bottom"&&(K=i+o-R-u);let I=t+u+m;d==="center"?I=t+s/2:d==="right"&&(I=t+s-u-p);for(let b=0;b<S.length;b++){const O=S[b],y=K+b*E;if(this.ctx.textBaseline="top",b===B-1){const M=S.slice(b).join(""),{_text:D,ellipsis:P}=this.handleEllipsis(M,s,u,c);this.ctx.fillText(D,I,y),w=P;break}this.ctx.fillText(O,I,y)}if(n.textCallback&&S.length){const b=S.reduce((P,Y)=>Math.max(P,this.ctx.measureText(Y).width),0),O=Math.round(b);let y=I,M=I+O;d==="center"?(y=I-O/2,M=I+O/2):d==="right"&&(y=I-O,M=I);const D={x:I,y:K,width:O,height:R,left:y,right:M,top:K,bottom:K+R};n.textCallback(D)}return this.ctx.restore(),w}wrapText(e,t,i=""){if(!e)return[""];if(i&&this.textCacheMap.has(i))return this.textCacheMap.get(i)||[""];const s=[],o=e.split(`
|
|
4
|
+
`);for(const a of o){if(a===""){s.push("");continue}const c=a.split("");let d="";for(const f of c){const u=d+f;this.ctx.measureText(u).width<=t?d=u:d?(s.push(d),d=f):(s.push(f),d="")}d&&s.push(d)}const n=s.length>0?s:[""];return i&&this.textCacheMap.set(i,n),n}calculateTextHeight(e="",t,i={}){var s;const{font:o="12px Arial",padding:n=0,align:a="center",color:c="#495060",maxLineClamp:d=1,cacheTextKey:f=""}=i;this.ctx.save(),this.ctx.font=o,this.ctx.fillStyle=c,this.ctx.textAlign=a;const u=parseInt(((s=o.match(/\d+/))==null?void 0:s[0])||"12"),g=u*(i.lineHeight||1.2),v=t-n*2,x=this.wrapText(e,v,f);let m=1;return d==="auto"?m=x.length:x.length>d?m=d:m=x.length,this.ctx.restore(),Math.max(Math.floor(m*g+n*2),Math.floor(u+n*2))}handleEllipsis(e,t,i=0,s="12px Arial"){this.ctx.save();let o=!1,n=e;if(this.ctx.font=s,e==null||e==="")return this.ctx.restore(),{_text:"",ellipsis:o};const a=this.ctx.measureText("...").width;if(t<=a+i*2)return this.ctx.restore(),{_text:"",ellipsis:!0};const c=this.ctx.measureText(e).width,d=t-i*2;if(c&&c>=d){o=!0;let f=0;for(let u=0;u<e.length;u++)if(f+=this.ctx.measureText(e[u]).width,f>=d-a){n=e.slice(0,u)+"...",o=!0;break}}return this.ctx.restore(),{_text:n,ellipsis:o}}}class Mo{constructor(e){h(this,"_config",{}),h(this,"CSS_PREFIX","e-virt-table"),h(this,"ICONS",[]),h(this,"ROW_KEY",""),h(this,"DISABLED",!1),h(this,"HEADER_FONT","12px normal Arial"),h(this,"BODY_FONT","12px normal Arial"),h(this,"BORDER",!0),h(this,"STRIPE",!1),h(this,"STRIPE_COLOR","#fafafa"),h(this,"BORDER_COLOR","#e1e6eb"),h(this,"HEIGHT",0),h(this,"PLACEHOLDER_COLOR","#CDD0DC"),h(this,"EMPTY_BODY_HEIGHT",120),h(this,"EMPTY_CUSTOM_STYLE",{}),h(this,"NUMBER_ERROR_TIP","只允许输入数字"),h(this,"EMPTY_TEXT","暂无数据"),h(this,"LOADING_TEXT","加载中..."),h(this,"MAX_HEIGHT",1e3),h(this,"BORDER_RADIUS",8),h(this,"ENABLE_OFFSET_HEIGHT",!1),h(this,"OFFSET_HEIGHT",0),h(this,"HEADER_HEIGHT",36),h(this,"ENABLE_HEADER_STICKY",!1),h(this,"HEADER_BG_COLOR","#F8FAFF"),h(this,"BODY_BG_COLOR","#FFF"),h(this,"HEADER_TEXT_COLOR","#1D2129"),h(this,"REQUIRED_COLOR","#F56C6C"),h(this,"BODY_TEXT_COLOR","#4E5969"),h(this,"FOOTER_TEXT_COLOR","#4E5969"),h(this,"LOADING_ICON_SVG",""),h(this,"LOADING_ICON_COLOR","#4E5969"),h(this,"EXPAND_ICON_SVG",""),h(this,"SHRINK_ICON_SVG",""),h(this,"EXPAND_ICON_COLOR","#4E5969"),h(this,"SHRINK_ICON_COLOR","#4E5969"),h(this,"ERROR_TIP_ICON_COLOR","red"),h(this,"ERROR_TIP_ICON_SIZE",6),h(this,"COLUMNS_ALIGN","left"),h(this,"COLUMNS_VERTICAL_ALIGN","middle"),h(this,"EXPAND_LAZY",!0),h(this,"DEFAULT_EXPAND_ALL",!1),h(this,"CELL_WIDTH",100),h(this,"CELL_HEIGHT",36),h(this,"CELL_PADDING",8),h(this,"CELL_HOVER_ICON_SIZE",14),h(this,"CELL_HOVER_ICON_BG_COLOR","#fff"),h(this,"CELL_HOVER_ICON_BORDER_COLOR","#DDE0EA"),h(this,"SCROLLER_TRACK_SIZE",14),h(this,"SCROLLER_SIZE",8),h(this,"SCROLLER_COLOR","#dee0e3"),h(this,"SCROLLER_TRACK_COLOR","#fff"),h(this,"SCROLLER_FOCUS_COLOR","#bbbec4"),h(this,"SELECT_BORDER_COLOR","rgb(82,146,247)"),h(this,"SELECT_AREA_COLOR","rgba(82,146,247,0.1)"),h(this,"SELECT_ROW_COL_BG_COLOR","transparent"),h(this,"AUTOFILL_POINT_BORDER_COLOR","#fff"),h(this,"EDIT_BG_COLOR","#fcf6ed"),h(this,"CHECKBOX_KEY",""),h(this,"CHECKBOX_COLOR","rgb(82,146,247)"),h(this,"FINDER_CELL_BG_COLOR","rgb(255,229,144)"),h(this,"ENABLE_FINDER",!0),h(this,"CHECKBOX_SIZE",20),h(this,"CHECKBOX_DISABLED_SVG",""),h(this,"CHECKBOX_DISABLED_COLOR","#F1F2F4"),h(this,"CHECKBOX_CHECK_SVG",""),h(this,"CHECKBOX_UNCHECK_SVG",""),h(this,"CHECKBOX_UNCHECK_COLOR","#DDE0EA"),h(this,"CHECKBOX_INDETERMINATE_SVG",""),h(this,"CHECKBOX_CHECK_DISABLED_SVG",""),h(this,"CHECKBOX_CHECK_DISABLED_COLOR","#DDE0EA"),h(this,"ICON_EDIT_SVG",""),h(this,"ICON_EDIT_COLOR","#4E5969"),h(this,"ICON_SELECT_SVG",""),h(this,"ICON_SELECT_COLOR","#4E5969"),h(this,"SORT_STRICTLY",!0),h(this,"SORT_ASC_ICON_SVG",""),h(this,"SORT_DESC_ICON_SVG",""),h(this,"SORTABLE_ICON_SVG",""),h(this,"SORT_ICON_COLOR","rgb(82,146,247)"),h(this,"READONLY_COLOR","#fff"),h(this,"READONLY_TEXT_COLOR","#4E5969"),h(this,"ERROR_TIP_COLOR","#ED3F14"),h(this,"FOOTER_BG_COLOR","#fafafa"),h(this,"FOOTER_FIXED",!0),h(this,"FOOTER_POSITION","bottom"),h(this,"CELL_FOOTER_HEIGHT",36),h(this,"ENABLE_SELECTOR",!0),h(this,"TREE_SELECT_MODE","auto"),h(this,"TREE_CHILDREN_KEY","children"),h(this,"TREE_INDENT",20),h(this,"TREE_ICON_SIZE",20),h(this,"TREE_LINE",!1),h(this,"TREE_LINE_COLOR","#e1e6eb"),h(this,"ENABLE_EDIT_SINGLE_CLICK",!1),h(this,"ENABLE_EDIT_CLICK_SELECTOR",!0),h(this,"SELECTOR_AREA_MIN_X",0),h(this,"SELECTOR_AREA_MAX_X_OFFSET",0),h(this,"SELECTOR_AREA_MAX_X",0),h(this,"SELECTOR_AREA_MIN_Y",0),h(this,"SELECTOR_AREA_MAX_Y",0),h(this,"SELECTOR_AREA_MAX_Y_OFFSET",0),h(this,"SELECTOR_CELL_VALUE_TYPE","value"),h(this,"ENABLE_AUTO_THEME",!0),h(this,"ENABLE_SELECTOR_SINGLE",!1),h(this,"ENABLE_SELECTOR_SPAN_COL",!0),h(this,"ENABLE_SELECTOR_SPAN_ROW",!0),h(this,"ENABLE_SELECTOR_ALL_ROWS",!0),h(this,"ENABLE_SELECTOR_ALL_COLS",!0),h(this,"ENABLE_MERGE_CELL_LINK",!1),h(this,"ENABLE_AUTOFILL",!1),h(this,"ENABLE_AUTOFILL_SPAN_COL",!0),h(this,"ENABLE_AUTOFILL_SPAN_ROW",!0),h(this,"ENABLE_CONTEXT_MENU",!1),h(this,"ENABLE_HEADER_CONTEXT_MENU",!1),h(this,"ENABLE_COPY",!0),h(this,"ENABLE_PASTER",!0),h(this,"ENABLE_RESIZE_ROW",!0),h(this,"ENABLE_RESIZE_COLUMN",!0),h(this,"RESIZE_ROW_LINE_COLOR","#e1e6eb"),h(this,"RESIZE_COLUMN_LINE_COLOR","#e1e6eb"),h(this,"ENABLE_RESIZE_COLUMN_TEXT",!0),h(this,"RESIZE_COLUMN_TEXT_COLOR","#fff"),h(this,"RESIZE_COLUMN_TEXT_BG_COLOR","rgb(82,146,247)"),h(this,"RESIZE_ROW_MIN_HEIGHT",36),h(this,"RESIZE_COLUMN_MIN_WIDTH",40),h(this,"DRAG_TIP_BG_COLOR","rgba(82,146,247,0.1)"),h(this,"DRAG_TIP_LINE_COLOR","rgb(82,146,247)"),h(this,"ENABLE_KEYBOARD",!0),h(this,"ENABLE_HISTORY",!1),h(this,"ENABLE_VALIDATOR_IMMEDIATE",!0),h(this,"HISTORY_NUM",50),h(this,"HIGHLIGHT_HOVER_ROW",!1),h(this,"HIGHLIGHT_HOVER_ROW_COLOR","rgba(186,203,231,0.1)"),h(this,"HIGHLIGHT_SELECTED_ROW",!1),h(this,"HIGHLIGHT_SELECTED_ROW_COLOR","rgba(82,146,247,0.1)"),h(this,"TOOLTIP_BG_COLOR","#303133"),h(this,"TOOLTIP_TEXT_COLOR","#fff"),h(this,"TOOLTIP_ZINDEX",3e3),h(this,"TOOLTIP_CUSTOM_STYLE",{}),h(this,"CONTEXT_MENU",[{label:"复制",value:"copy"},{label:"剪切",value:"cut"},{label:"粘贴",value:"paste"},{label:"清空选中内容",value:"clearSelected"}]),h(this,"CUSTOM_BODY_CONTEXT_MENU",[]),h(this,"HEADER_CONTEXT_MENU",[{label:"左固定",value:"fixedLeft"},{label:"右固定",value:"fixedRight"},{label:"取消固定",value:"fixedNone"},{label:"隐藏",value:"hide"},{label:"显示",value:"visible"},{label:"恢复默认",value:"resetHeader"}]),h(this,"CUSTOM_HEADER_CONTEXT_MENU",[]),h(this,"CELL_LINE_HEIGHT",1.3),h(this,"AUTO_ROW_HEIGHT",!1),h(this,"ENABLE_DRAG_COLUMN",!1),h(this,"HEADER_CELL_STYLE_METHOD"),h(this,"BODY_CELL_STYLE_METHOD"),h(this,"FOOTER_CELL_STYLE_METHOD"),h(this,"BODY_CELL_READONLY_METHOD"),h(this,"BODY_CELL_FORMATTER_METHOD"),h(this,"BODY_CELL_RULES_METHOD"),h(this,"BODY_CELL_TYPE_METHOD"),h(this,"BODY_CELL_EDITOR_METHOD"),h(this,"BODY_CELL_RENDER_METHOD"),h(this,"BODY_CELL_HOVER_ICON_METHOD"),h(this,"SPAN_METHOD"),h(this,"SELECTABLE_METHOD"),h(this,"EXPAND_LAZY_METHOD"),h(this,"BEFORE_VALUE_CHANGE_METHOD"),h(this,"BEFORE_PASTE_DATA_METHOD"),h(this,"BEFORE_AUTOFILL_DATA_METHOD"),h(this,"BEFORE_SET_SELECTOR_METHOD"),h(this,"BEFORE_SET_AUTOFILL_METHOD"),h(this,"BEFORE_COPY_METHOD"),this._config=e,this.updateCssVar()}init(e){this._config=e,this.updateCssVar()}updateCssVar(){let e={};Object.keys(this).forEach(t=>{if(t.endsWith("_COLOR")||t.endsWith("_FONT")){const i=`--evt-${t.toLocaleLowerCase().replace(/_/g,"-")}`,s=$C(i);s&&(e[t]=s)}}),Object.assign(this,e,this._config)}}const Ri='<svg t="1724122015492" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4237" width="32" height="32"><path d="M401.472 316.992l159.04 217.664L591.488 512l-30.976-22.656-159.04 217.728q-2.24 3.008-3.84 6.464-1.6 3.456-2.496 7.104-0.896 3.648-1.024 7.424-0.192 3.84 0.384 7.552 0.64 3.712 1.92 7.296 1.28 3.52 3.2 6.784 1.984 3.2 4.544 6.016 2.56 2.752 5.632 4.992 3.072 2.24 6.464 3.84 3.456 1.6 7.168 2.496 3.648 0.896 7.424 1.024 3.776 0.192 7.488-0.448 3.776-0.576 7.296-1.856 3.584-1.28 6.784-3.264 3.2-1.92 6.016-4.48 2.816-2.56 5.056-5.632l159.04-217.728q3.584-4.928 5.504-10.752 1.92-5.76 1.92-11.904 0-6.08-1.92-11.904-1.92-5.76-5.504-10.752L463.488 271.68q-2.24-3.072-5.056-5.632-2.752-2.56-6.016-4.48-3.2-1.984-6.784-3.328-3.52-1.28-7.296-1.856-3.712-0.576-7.488-0.448-3.84 0.192-7.424 1.088-3.712 0.896-7.168 2.496-3.392 1.6-6.4 3.84-3.136 2.176-5.696 4.992-2.56 2.752-4.48 6.016-1.984 3.2-3.264 6.784-1.28 3.52-1.92 7.296-0.576 3.712-0.384 7.488 0.128 3.84 1.024 7.488 0.896 3.648 2.496 7.04 1.6 3.456 3.84 6.528z m30.976-61.056q-3.776 0-7.488 0.704-3.712 0.768-7.168 2.24-3.52 1.408-6.656 3.52-3.2 2.112-5.824 4.8-2.688 2.624-4.8 5.76-2.112 3.2-3.52 6.656-1.472 3.52-2.176 7.232-0.768 3.712-0.768 7.488 0 3.776 0.768 7.488 0.704 3.712 2.176 7.232 1.408 3.456 3.52 6.592 2.112 3.2 4.8 5.824 2.688 2.688 5.76 4.8 3.2 2.112 6.72 3.52 3.456 1.472 7.168 2.176 3.712 0.768 7.488 0.768 3.84 0 7.488-0.768 3.712-0.704 7.232-2.176 3.456-1.408 6.592-3.52 3.2-2.112 5.824-4.8 2.688-2.688 4.8-5.76 2.112-3.2 3.52-6.656 1.472-3.52 2.24-7.232 0.704-3.712 0.704-7.488 0-3.84-0.704-7.488-0.768-3.712-2.24-7.232-1.408-3.456-3.52-6.592-2.112-3.2-4.8-5.824-2.624-2.688-5.76-4.8-3.2-2.112-6.656-3.52-3.52-1.472-7.232-2.24Q436.224 256 432.448 256z m0 435.392q-3.776 0-7.488 0.704-3.712 0.768-7.168 2.176-3.52 1.472-6.656 3.584-3.2 2.112-5.824 4.736-2.688 2.688-4.8 5.824-2.112 3.2-3.52 6.656-1.472 3.52-2.176 7.232-0.768 3.712-0.768 7.488 0 3.776 0.768 7.488 0.704 3.712 2.176 7.168 1.408 3.52 3.52 6.656 2.112 3.2 4.8 5.76 2.688 2.752 5.76 4.8 3.2 2.112 6.72 3.584 3.456 1.472 7.168 2.176 3.712 0.768 7.488 0.768 3.84 0 7.488-0.768 3.712-0.704 7.232-2.176 3.456-1.472 6.592-3.584 3.2-2.048 5.824-4.736 2.688-2.688 4.8-5.824 2.112-3.2 3.52-6.656 1.472-3.456 2.24-7.168 0.704-3.712 0.704-7.488 0-3.84-0.704-7.488-0.768-3.712-2.24-7.232-1.408-3.52-3.52-6.656-2.112-3.136-4.8-5.76-2.624-2.688-5.76-4.8-3.2-2.112-6.656-3.584-3.52-1.408-7.232-2.176-3.712-0.704-7.488-0.704z" p-id="4238"></path></svg>',Ao='<svg t="1722595535853" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4551" width="32" height="32"><path d="M640 128H384c-170.496 0-256 85.504-256 256v256c0 170.496 85.504 256 256 256h256c170.496 0 256-85.504 256-256V384c0-170.496-85.504-256-256-256z m67.584 302.592c-2.048 4.608-4.608 8.704-8.192 12.288L506.88 634.88c-3.584 3.584-7.68 6.144-12.288 8.192-4.608 2.048-9.728 3.072-14.848 3.072s-10.24-1.024-14.848-3.072c-4.608-2.048-8.704-4.608-12.288-8.192l-96.256-96.256c-3.584-3.584-6.144-7.68-8.192-12.288-2.048-4.608-3.072-9.728-3.072-14.848 0-2.56 0-5.12 1.024-7.68 0.512-2.56 1.024-5.12 2.048-7.168 1.024-2.56 2.048-4.608 3.584-6.656 1.536-2.048 3.072-4.096 4.608-5.632 1.536-2.048 3.584-3.584 5.632-4.608 2.048-1.536 4.096-2.56 6.656-3.584 2.56-1.024 4.608-1.536 7.168-2.048 2.56-0.512 5.12-0.512 7.68-0.512 5.12 0 10.24 1.024 14.848 3.072 4.608 2.048 8.704 4.608 12.288 8.192l69.12 68.608L645.12 389.12c3.584-3.584 7.68-6.144 12.288-8.192 4.608-2.048 9.728-3.072 14.848-3.072 2.56 0 5.12 0 7.68 0.512s5.12 1.024 7.168 2.048c2.56 1.024 4.608 2.048 6.656 3.584 2.048 1.536 4.096 3.072 5.632 4.608 1.536 1.536 3.584 3.584 4.608 5.632 1.536 2.048 2.56 4.096 3.584 6.656 1.024 2.56 1.536 4.608 2.048 7.168 0.512 2.56 1.024 5.12 1.024 7.68 0 5.12-1.024 10.24-3.072 14.848z" p-id="4552"></path></svg>',No='<svg t="1724122044148" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4551" width="32" height="32"><path d="M707.648 401.28L489.28 560.704l22.656 30.976 22.656-30.976L316.16 401.216q-3.072-2.24-6.464-3.84-3.456-1.536-7.104-2.432-3.712-0.896-7.488-1.088-3.776-0.128-7.488 0.448-3.776 0.64-7.296 1.92-3.584 1.28-6.784 3.2-3.2 1.984-6.016 4.544-2.816 2.56-5.056 5.632-2.176 3.072-3.84 6.464-1.536 3.456-2.432 7.104-0.896 3.712-1.088 7.488-0.128 3.776 0.448 7.488 0.64 3.776 1.92 7.296 1.28 3.584 3.2 6.784 1.984 3.2 4.544 6.016 2.56 2.752 5.632 4.992l218.368 159.552q4.928 3.584 10.752 5.504 5.76 1.92 11.904 1.92 6.08 0 11.904-1.92 5.76-1.92 10.752-5.504l218.368-159.552q3.008-2.24 5.568-4.992 2.56-2.816 4.544-6.016 1.92-3.2 3.264-6.784 1.28-3.52 1.92-7.296 0.576-3.712 0.384-7.488-0.128-3.84-1.024-7.488-0.896-3.648-2.496-7.04-1.6-3.456-3.84-6.528-2.24-3.072-4.992-5.632-2.816-2.56-6.016-4.48-3.2-1.984-6.784-3.328-3.584-1.28-7.296-1.856-3.712-0.64-7.488-0.448-3.84 0.192-7.488 1.088-3.648 0.896-7.04 2.496-3.456 1.536-6.528 3.84z m61.056 30.976q0-3.84-0.768-7.488-0.704-3.712-2.176-7.232-1.472-3.456-3.52-6.656-2.112-3.136-4.8-5.76-2.688-2.688-5.76-4.8-3.2-2.112-6.72-3.584-3.456-1.408-7.168-2.176-3.712-0.704-7.488-0.704-3.84 0-7.488 0.704-3.712 0.768-7.232 2.176-3.456 1.472-6.656 3.584-3.136 2.112-5.76 4.8-2.688 2.624-4.8 5.76-2.112 3.2-3.584 6.656-1.408 3.52-2.176 7.232-0.704 3.712-0.704 7.488 0 3.776 0.704 7.488 0.768 3.712 2.176 7.168 1.472 3.52 3.584 6.656 2.112 3.2 4.8 5.824 2.624 2.688 5.76 4.8 3.2 2.112 6.656 3.52 3.52 1.472 7.232 2.176 3.712 0.768 7.488 0.768 3.776 0 7.488-0.768 3.712-0.704 7.168-2.176 3.52-1.408 6.656-3.52 3.2-2.112 5.824-4.8 2.688-2.688 4.8-5.76 2.048-3.2 3.52-6.72 1.472-3.456 2.176-7.168 0.768-3.712 0.768-7.488z m-436.736 0q0-3.84-0.768-7.488-0.704-3.712-2.176-7.232-1.408-3.456-3.52-6.656-2.112-3.136-4.8-5.76-2.688-2.688-5.76-4.8-3.2-2.112-6.656-3.584-3.52-1.408-7.232-2.176-3.712-0.704-7.488-0.704-3.84 0-7.488 0.704-3.712 0.768-7.232 2.176-3.456 1.472-6.592 3.584-3.2 2.112-5.824 4.8-2.688 2.624-4.8 5.76-2.112 3.2-3.52 6.656-1.472 3.52-2.24 7.232-0.704 3.712-0.704 7.488 0 3.776 0.704 7.488 0.768 3.712 2.24 7.168 1.408 3.52 3.52 6.656 2.112 3.2 4.8 5.824 2.624 2.688 5.76 4.8 3.2 2.112 6.656 3.52 3.52 1.472 7.232 2.176 3.712 0.768 7.488 0.768 3.776 0 7.488-0.768 3.712-0.704 7.232-2.176 3.456-1.408 6.592-3.52 3.2-2.112 5.824-4.8 2.688-2.688 4.8-5.76 2.112-3.2 3.52-6.72 1.472-3.456 2.176-7.168 0.768-3.712 0.768-7.488z" p-id="4552"></path></svg>',Yr='<svg t="1755138507987" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5079" width="200" height="200"><path d="M512 938.688a42.688 42.688 0 0 1-35.072-18.432l-192-277.312A42.56 42.56 0 0 1 320 576h384a42.752 42.752 0 0 1 35.072 66.944l-192 277.312a42.688 42.688 0 0 1-35.072 18.432" fill="currentColor" p-id="2016"></path><path d="M704 448H320a42.752 42.752 0 0 1-35.072-66.944l192-277.312c16-23.04 54.208-23.04 70.144 0l192 277.312A42.56 42.56 0 0 1 704 448" fill="currentColor" p-id="2015"></path></svg>',KC=Yr.replace('fill="currentColor" p-id="2016"','fill="#bec4c7" p-id="2016"'),PC=Yr.replace('fill="currentColor" p-id="2015"','fill="#bec4c7" p-id="2015"'),el='<svg t="1724133395728" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2893" width="32" height="32"><path d="M512 226.8476541a19.82487759 19.82487759 0 0 1 14.66497778 5.70304692c3.80203107 3.82918865 5.70304692 8.71751457 5.70304693 14.66497779v122.20814825a19.82487759 19.82487759 0 0 1-5.70304693 14.66497778 19.82487759 19.82487759 0 0 1-14.66497778 5.70304691 19.82487759 19.82487759 0 0 1-14.66497778-5.70304691 19.82487759 19.82487759 0 0 1-5.70304693-14.66497778v-122.20814825a19.82487759 19.82487759 0 0 1 5.70304693-14.66497779 19.82487759 19.82487759 0 0 1 14.66497778-5.70304692z m0 407.36049415a19.82487759 19.82487759 0 0 1 14.66497778 5.70304691c3.80203107 3.82918865 5.70304692 8.71751457 5.70304693 14.66497778v122.20814827a19.82487759 19.82487759 0 0 1-5.70304693 14.66497776 19.82487759 19.82487759 0 0 1-14.66497778 5.70304693 19.82487759 19.82487759 0 0 1-14.66497778-5.70304693 19.82487759 19.82487759 0 0 1-5.70304693-14.66497776v-122.20814827a19.82487759 19.82487759 0 0 1 5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 14.66497778-5.70304691zM797.1523459 512a19.82487759 19.82487759 0 0 1-5.70304692 14.66497778 19.82487759 19.82487759 0 0 1-14.66497779 5.70304693h-122.20814825a19.82487759 19.82487759 0 0 1-14.66497778-5.70304693 19.82487759 19.82487759 0 0 1-5.70304691-14.66497778 19.82487759 19.82487759 0 0 1 5.70304691-14.66497778 19.82487759 19.82487759 0 0 1 14.66497778-5.70304693h122.20814825a19.82487759 19.82487759 0 0 1 14.66497779 5.70304693c3.80203107 3.82918865 5.70304692 8.71751457 5.70304692 14.66497778z m-407.36049415 0a19.82487759 19.82487759 0 0 1-5.70304691 14.66497778 19.82487759 19.82487759 0 0 1-14.66497778 5.70304693h-122.20814827a19.82487759 19.82487759 0 0 1-14.66497776-5.70304693 19.82487759 19.82487759 0 0 1-5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 14.66497776-5.70304693h122.20814827a19.82487759 19.82487759 0 0 1 14.66497778 5.70304693c3.80203107 3.82918865 5.70304692 8.71751457 5.70304691 14.66497778zM310.22076878 310.22076878a21.29137537 21.29137537 0 0 1 14.66497779-5.70304693c5.51294514 0 10.18401235 1.90101585 14.01320099 5.70304693l86.55052591 86.57768347a20.91117183 20.91117183 0 0 1 5.73020449 14.31193182 19.28172983 19.28172983 0 0 1-6.05609289 14.013201 19.11878565 19.11878565 0 0 1-14.013201 6.05609289 20.96548698 20.96548698 0 0 1-14.31193182-5.70304692L310.22076878 338.87178998a19.06447114 19.06447114 0 0 1-5.70304693-14.01320099c0-5.54010272 1.90101585-10.42842865 5.70304693-14.66497778z m288.32975775 288.32975775a19.79772001 19.79772001 0 0 1 14.3390894-6.35482371c5.29568642 0 10.04822572 2.11827457 14.31193182 6.38198066l86.57768347 86.55052651c3.80203107 3.80203107 5.70304692 8.47309828 5.70304691 14.01320102a19.55330372 19.55330372 0 0 1-6.05609225 14.31193182 19.66193339 19.66193339 0 0 1-14.31193245 6.05609288 19.01015661 19.01015661 0 0 1-14.01320099-5.70304692l-86.55052591-86.57768347a19.79772001 19.79772001 0 0 1-6.38198129-14.31193245c0-5.29568642 2.11827457-10.07538268 6.38198129-14.33908939zM713.77923122 310.22076878c3.80203107 4.26370672 5.70304692 9.15203265 5.70304693 14.66497779s-1.90101585 10.18401235-5.70304693 14.01320099l-86.57768347 86.55052591a20.91117183 20.91117183 0 0 1-14.31193182 5.73020449 19.28172983 19.28172983 0 0 1-14.013201-6.05609289 19.11878565 19.11878565 0 0 1-6.05609289-14.013201c0-5.29568642 1.90101585-10.07538268 5.70304692-14.31193182l86.57768348-86.57768347c3.80203107-3.80203107 8.50025585-5.70304692 14.01320099-5.70304693 5.54010272 0 10.40127108 1.90101585 14.66497779 5.70304693zM425.44947347 598.57768347a19.79772001 19.79772001 0 0 1 6.35482371 14.33908939c0 5.29568642-2.11827457 10.04822572-6.38198066 14.31193245L338.89894756 713.77923122a19.06447114 19.06447114 0 0 1-14.01320099 5.70304693 19.55330372 19.55330372 0 0 1-14.31193245-6.05609227 19.68909035 19.68909035 0 0 1-6.05609227-14.31193245 19.01015661 19.01015661 0 0 1 5.70304693-14.01320099l86.57768347-86.55052591a19.79772001 19.79772001 0 0 1 14.31193182-6.38198129c5.29568642 0 10.07538268 2.11827457 14.3390894 6.38198129z" fill="#000000" fill-opacity=".65" p-id="2894"></path></svg>';class YC{constructor(e){h(this,"ctx"),h(this,"list",[{name:"loading",configName:"LOADING_ICON_SVG",configColorName:"LOADING_ICON_COLOR",svg:el,color:"#4E5969"},{name:"expand",configName:"EXPAND_ICON_SVG",configColorName:"EXPAND_ICON_COLOR",svg:Ri,color:"#4E5969"},{name:"shrink",configName:"SHRINK_ICON_SVG",configColorName:"SHRINK_ICON_COLOR",svg:No,color:"#4E5969"},{name:"checkbox-uncheck",configName:"CHECKBOX_UNCHECK_SVG",configColorName:"CHECKBOX_UNCHECK_COLOR",svg:'<svg t="1722595639920" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4708" width="32" height="32"><path d="M128 640V384a256 256 0 0 1 256-256h256a256 256 0 0 1 256 256v256a256 256 0 0 1-256 256H384a256 256 0 0 1-256-256z m64 0q0 79.552 56.256 135.744Q304.448 832 384 832h256q79.552 0 135.744-56.256Q832 719.552 832 640V384q0-79.552-56.256-135.744Q719.552 192 640 192H384q-79.552 0-135.744 56.256Q192 304.448 192 384v256z" p-id="4709"></path></svg>',color:""},{name:"checkbox-check",configName:"CHECKBOX_CHECK_SVG",configColorName:"CHECKBOX_COLOR",svg:Ao,color:"rgb(82,146,247)"},{name:"checkbox-indeterminate",configName:"CHECKBOX_INDETERMINATE_SVG",configColorName:"CHECKBOX_COLOR",svg:'<svg t="1722595280953" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4394" width="32" height="32"><path d="M128 384v256q0 12.608 1.28 25.088 1.216 12.544 3.648 24.832 2.432 12.352 6.08 24.384t8.448 23.68q4.864 11.584 10.752 22.72 5.952 11.072 12.928 21.504 7.04 10.496 14.976 20.224 8 9.728 16.896 18.56 8.896 8.96 18.56 16.896 9.728 8 20.224 14.976 10.432 7.04 21.504 12.928 11.136 5.888 22.72 10.688 11.648 4.864 23.68 8.512 12.032 3.648 24.32 6.08 12.352 2.432 24.896 3.712Q371.392 896 384 896h256q12.608 0 25.088-1.28 12.544-1.216 24.832-3.648 12.352-2.432 24.384-6.08t23.68-8.512q11.584-4.8 22.72-10.688 11.072-5.952 21.504-12.928 10.496-7.04 20.224-14.976 9.728-8 18.56-16.896 8.96-8.832 16.896-18.56 8-9.728 14.976-20.224 7.04-10.432 12.928-21.504 5.888-11.136 10.688-22.72 4.864-11.648 8.512-23.68 3.648-12.032 6.08-24.32 2.432-12.352 3.712-24.896Q896 652.608 896 640V384q0-12.608-1.28-25.088-1.216-12.544-3.648-24.832-2.432-12.352-6.08-24.384t-8.512-23.68q-4.8-11.584-10.688-22.72-5.952-11.072-12.928-21.504-7.04-10.496-14.976-20.224-8-9.664-16.896-18.56-8.832-8.96-18.56-16.896-9.728-8-20.224-14.976-10.432-7.04-21.504-12.928-11.136-5.888-22.72-10.752-11.648-4.8-23.68-8.448-12.032-3.648-24.32-6.08-12.352-2.432-24.896-3.712Q652.608 128 640 128H384q-12.608 0-25.088 1.28-12.544 1.216-24.832 3.648-12.352 2.432-24.384 6.08t-23.68 8.448q-11.584 4.864-22.72 10.752-11.072 5.952-21.504 12.928-10.496 7.04-20.224 14.976-9.664 8-18.56 16.896-8.96 8.896-16.896 18.56-8 9.728-14.976 20.224-7.04 10.432-12.928 21.504-5.888 11.136-10.752 22.72-4.8 11.648-8.448 23.68-3.648 12.032-6.08 24.32-2.432 12.352-3.712 24.896Q128 371.392 128 384z m566.016 166.336H330.112a38.4 38.4 0 0 1 0-76.8h363.904a38.4 38.4 0 0 1 0 76.8z" p-id="4395"></path></svg>',color:"rgb(82,146,247)"},{name:"checkbox-check-disabled",configName:"CHECKBOX_CHECK_DISABLED_SVG",svg:Ao,color:"#DDE0EA"},{name:"checkbox-disabled",configName:"CHECKBOX_DISABLED_SVG",configColorName:"CHECKBOX_DISABLED_COLOR",svg:'<svg t="1722595946663" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4865" width="32" height="32"><path d="M128 640V384a256 256 0 0 1 256-256h256a256 256 0 0 1 256 256v256a256 256 0 0 1-256 256H384a256 256 0 0 1-256-256z" p-id="4866"></path><path d="M128 640V384a256 256 0 0 1 256-256h256a256 256 0 0 1 256 256v256a256 256 0 0 1-256 256H384a256 256 0 0 1-256-256z m64 0q0 79.552 56.256 135.744Q304.448 832 384 832h256q79.552 0 135.744-56.256Q832 719.552 832 640V384q0-79.552-56.256-135.744Q719.552 192 640 192H384q-79.552 0-135.744 56.256Q192 304.448 192 384v256z" fill="#DDE0EA" p-id="4867"></path></svg>',color:"#F1F2F4"},{name:"icon-edit",configName:"ICON_EDIT_SVG",configColorName:"ICON_EDIT_COLOR",svg:'<svg t="1744798692576" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6606" width="200" height="200"><path d="M855.296 894.528H168.768v-76.8h686.528v76.8z m38.4-38.4q0 3.84-0.768 7.488-0.704 3.712-2.176 7.232-1.472 3.52-3.52 6.656-2.112 3.136-4.8 5.76-2.688 2.688-5.824 4.8-3.2 2.112-6.656 3.584-3.456 1.408-7.168 2.176-3.712 0.704-7.488 0.704-3.84 0-7.488-0.704-3.712-0.768-7.232-2.176-3.52-1.472-6.656-3.584-3.136-2.112-5.76-4.736-2.688-2.688-4.8-5.824-2.112-3.2-3.584-6.656-1.408-3.52-2.176-7.232-0.704-3.648-0.704-7.488 0-3.776 0.704-7.488 0.768-3.712 2.176-7.168 1.472-3.52 3.584-6.656 2.112-3.136 4.736-5.76 2.688-2.752 5.824-4.8 3.2-2.112 6.656-3.584 3.52-1.472 7.232-2.176 3.712-0.768 7.488-0.768 3.776 0 7.488 0.768 3.712 0.704 7.168 2.176 3.52 1.472 6.656 3.584 3.2 2.048 5.76 4.736 2.752 2.688 4.864 5.824 2.048 3.2 3.52 6.656 1.472 3.456 2.176 7.168 0.768 3.712 0.768 7.488z m-686.528 0q0 3.84-0.768 7.488-0.704 3.712-2.176 7.232-1.472 3.52-3.52 6.656-2.112 3.136-4.8 5.76-2.688 2.688-5.76 4.8-3.2 2.112-6.72 3.584-3.456 1.408-7.168 2.176-3.712 0.704-7.488 0.704-3.84 0-7.488-0.704-3.712-0.768-7.232-2.176-3.456-1.472-6.656-3.584-3.136-2.112-5.76-4.736-2.688-2.688-4.8-5.824-2.112-3.2-3.584-6.656-1.408-3.52-2.176-7.232-0.704-3.648-0.704-7.488 0-3.776 0.704-7.488 0.768-3.712 2.176-7.168 1.472-3.52 3.584-6.656 2.112-3.136 4.736-5.76 2.688-2.752 5.824-4.8 3.2-2.112 6.656-3.584 3.52-1.472 7.232-2.176 3.712-0.768 7.488-0.768 3.776 0 7.488 0.768 3.712 0.704 7.168 2.176 3.52 1.472 6.656 3.584 3.2 2.048 5.824 4.736 2.688 2.688 4.8 5.824 2.048 3.2 3.52 6.656 1.472 3.456 2.176 7.168 0.768 3.712 0.768 7.488zM652.032 211.2l-369.92 370.368v89.344h90.048l369.664-369.856L652.032 211.2z m-54.4-54.272q22.528-22.528 54.4-22.528 31.808 0 54.336 22.528l89.792 89.856q22.464 22.464 22.464 54.272t-22.464 54.272l-369.664 369.856q-22.464 22.528-54.336 22.528H282.24q-31.808 0-54.336-22.528-22.464-22.464-22.464-54.272V581.568q0-31.808 22.4-54.272l369.92-370.368z" p-id="6607"></path></svg>',color:"#4E5969"},{name:"icon-select",configName:"ICON_SELECT_SVG",configColorName:"ICON_SELECT_COLOR",svg:No,color:"#4E5969"},{name:"sort-asc",configName:"SORT_ASC_ICON_SVG",configColorName:"SORT_ICON_COLOR",svg:KC,color:"rgb(82,146,247)"},{name:"sort-desc",configName:"SORT_DESC_ICON_SVG",configColorName:"SORT_ICON_COLOR",svg:PC,color:"rgb(82,146,247)"},{name:"sort-default",configName:"SORTABLE_ICON_SVG",svg:Yr,color:"#bec4c7"}]),h(this,"icons",new Map),this.ctx=e,this.init()}async init(){const e=[];for(let t=0;t<this.list.length;t++){const i=this.list[t];let s=i.color,o=i.svg;if(i.configColorName){const a=this.ctx.config[i.configColorName];a&&(s=a)}if(i.configName){const a=this.ctx.config[i.configName];a&&(o=a)}const n=this.createImageFromSVG(o,s).then(a=>{this.icons.set(i.name,a)});e.push(n)}for(let t=0;t<this.ctx.config.ICONS.length;t++){const i=this.ctx.config.ICONS[t];let s=i.color;const o=this.createImageFromSVG(i.svg,s,i.isBlob).then(n=>{this.icons.set(i.name,n)});e.push(o)}await Promise.all(e),this.ctx.emit("draw")}async createImageFromSVG(e,t,i=!1){const s=new DOMParser().parseFromString(e,"image/svg+xml").documentElement;t&&s.querySelectorAll("*").forEach(a=>{const c=a.getAttribute("fill");(c==="currentColor"||c===null)&&a.setAttribute("fill",t)});const o=new Image;let n="";if(i){const a=new Blob([new XMLSerializer().serializeToString(s)],{type:"image/svg+xml"});n=URL.createObjectURL(a)}else n="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(s));return o.src=n,new Promise((a,c)=>{o.onerror=()=>c(new Error("Failed to load image:"+e)),o.onload=()=>{a(o)}})}get(e){return this.icons.get(e)}getSvg(e){return this.list.find(t=>t.name===e)}}class mr extends ja{constructor(e,t,i,s,o,n,a){super(e,i,s,o,n,"header",a.fixed),h(this,"align"),h(this,"hideHeaderSelection",!1),h(this,"verticalAlign","middle"),h(this,"fixed"),h(this,"minWidth"),h(this,"maxWidth"),h(this,"widthFillDisable"),h(this,"type"),h(this,"operation",!1),h(this,"editorType"),h(this,"level"),h(this,"text"),h(this,"hide",!1),h(this,"displayText",""),h(this,"colspan"),h(this,"rowspan"),h(this,"row"),h(this,"key"),h(this,"required",!1),h(this,"readonly",!1),h(this,"ellipsis",!1),h(this,"overflowTooltipShow",!0),h(this,"children",[]),h(this,"column"),h(this,"colIndex"),h(this,"rowKey"),h(this,"rules"),h(this,"hasChildren"),h(this,"render"),h(this,"style",{}),h(this,"drawX",0),h(this,"drawY",0),h(this,"sortIconName","sort-default"),h(this,"sortAscIconName","sort-asc"),h(this,"sortDescIconName","sort-desc"),h(this,"visibleWidth",0),h(this,"visibleHeight",0),h(this,"maxLineClampHeader","auto"),h(this,"domDataset",{}),h(this,"drawTextX",0),h(this,"drawTextY",0),h(this,"drawTextWidth",0),h(this,"drawTextHeight",0),h(this,"drawCellBgColor",""),h(this,"drawTextColor",""),h(this,"drawTextFont",""),h(this,"drawSelectionImageX",0),h(this,"drawSelectionImageY",0),h(this,"drawSelectionImageWidth",0),h(this,"drawSelectionImageHeight",0),h(this,"drawSelectionImageName",""),h(this,"drawSelectionImageSource"),h(this,"drawSortImageX",0),h(this,"drawSortImageY",0),h(this,"drawSortImageWidth",0),h(this,"drawSortImageHeight",0),h(this,"drawSortImageName",""),h(this,"drawSortImageSource"),this.ctx=e,this.x=i,this.y=s,this.width=o,this.height=n,this.visibleWidth=o,this.visibleHeight=n,this.colIndex=t,this.key=a.key,this.minWidth=a.minWidth,this.maxWidth=a.maxWidth,this.hide=(typeof a.hide=="function"?a.hide(a):a.hide)||!1,this.type=a.type||"",this.editorType=a.editorType||"text",this.hideHeaderSelection=a.hideHeaderSelection||!1,this.align=a.headerAlign||a.align||this.ctx.config.COLUMNS_ALIGN,this.verticalAlign=a.headerVerticalAlign||a.verticalAlign||this.ctx.config.COLUMNS_VERTICAL_ALIGN,this.fixed=a.fixed||"",this.level=a.level||0,this.operation=a.operation||!1,this.text=a.title,this.column=a,this.colspan=a.colspan||1,this.widthFillDisable=a.widthFillDisable||!1,this.rowspan=a.rowspan||1,this.rules=a.rules,this.readonly=a.readonly||!1,this.required=a.required||!1,this.sortIconName=a.sortIconName||"sort-default",this.sortAscIconName=a.sortAscIconName||"sort-asc",this.sortDescIconName=a.sortDescIconName||"sort-desc",this.rowKey=qa(),this.overflowTooltipShow=a.overflowTooltipHeaderShow!==!1,this.hasChildren=a.children&&a.children.length>0||!1,this.render=a.renderHeader,this.maxLineClampHeader=a.maxLineClampHeader||"auto"}isVerticalVisible(){const{stageHeight:e}=this.ctx,t=e;return!(this.y+this.height<=0||this.y>=t)}updateStyle(){this.style=this.getOverlayerViewsStyle()}updateContainer(){const{HEADER_CELL_STYLE_METHOD:e,HEADER_BG_COLOR:t,HEADER_TEXT_COLOR:i}=this.ctx.config;let s=t,o=i;if(typeof e=="function"){const c=e,{backgroundColor:d,color:f,font:u}=c({colIndex:this.colIndex,column:this.column})||{};d&&(s=d),f&&(o=f),u&&(this.drawTextFont=u)}const{colKey:n,type:a}=this.ctx.finderBar;a==="header"&&n===this.key&&(s=this.ctx.config.FINDER_CELL_BG_COLOR),this.drawCellBgColor=s,this.drawTextColor=o}update(){this.updateContainer(),this.displayText=this.getText(),this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawTextX=this.drawX,this.drawTextY=this.drawY,this.drawTextWidth=this.width,this.drawTextHeight=this.height,this.updateStyle()}draw(){this.drawEdge(),this.drawSelection(),this.drawText(),this.drawBg(),this.drawSortIcon()}drawEdge(){const{paint:e,config:{BORDER_COLOR:t,BORDER:i}}=this.ctx;e.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:i?t:"transparent",fillColor:this.drawCellBgColor})}drawText(){const{paint:e,config:{HEADER_FONT:t,CELL_PADDING:i,REQUIRED_COLOR:s}}=this.ctx,o=`${this.displayText}_${this.drawTextWidth}_${this.drawTextFont}`;this.ellipsis=e.drawText(this.displayText,this.drawTextX,this.drawTextY,this.drawTextWidth,this.drawTextHeight,{font:this.drawTextFont||t,padding:i,color:this.drawTextColor,align:this.align,verticalAlign:this.verticalAlign,maxLineClamp:this.maxLineClampHeader,offsetRight:this.column.sortBy?16:0,offsetLeft:this.required?12:0,cacheTextKey:o,textCallback:n=>{this.column.sortBy&&(this.drawSortImageX=n.right+4,this.drawSortImageY=n.top+(n.height-16)/2),this.required&&e.drawText("*",n.left-18,n.top+(n.height-12)/2,24,24,{color:s,font:"18px Arial",align:"center",verticalAlign:"middle",padding:0})}})}drawBg(){if(this.ctx.dragHeaderIng)return;const{ENABLE_SELECTOR:e,ENABLE_SELECTOR_SINGLE:t}=this.ctx.config;let i=-1,s=-1;if(this.ctx.focusCellHeader&&(i=this.ctx.focusCellHeader.colIndex,s=this.ctx.focusCellHeader.colIndex+this.ctx.focusCellHeader.colspan-1),e&&!t){const{xArr:n}=this.ctx.selector;i=n[0],s=n[1]}const o=this.colspan+this.colIndex-1;this.colIndex>=i&&this.colIndex<=s&&o<=s&&this.ctx.paint.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:"transparent",fillColor:this.ctx.config.SELECT_ROW_COL_BG_COLOR||"transparent"})}drawSelection(){if(!this.hideHeaderSelection&&["index-selection","selection","selection-tree","tree-selection"].includes(this.type)){const{indeterminate:e,check:t,selectable:i}=this.ctx.database.getCheckedState(),{CHECKBOX_SIZE:s=0,CELL_PADDING:o}=this.ctx.config;let n=this.drawX+(this.width-s)/2,a=this.drawY+(this.height-s)/2;this.drawTextX=n+s-o/2,this.drawTextWidth=this.drawX+this.visibleWidth-this.drawTextX,(this.align==="left"||this.align==="right")&&(n=this.drawX+o,this.drawTextX=n+s-o/2,this.drawTextWidth=this.drawX+this.visibleWidth-this.drawTextX),this.verticalAlign==="top"?a=this.drawY+o/2:this.verticalAlign==="bottom"&&(a=this.drawY+this.height-s-o/2);let c=this.ctx.icons.get("checkbox-uncheck"),d="checkbox-uncheck";e?(c=this.ctx.icons.get("checkbox-indeterminate"),d="checkbox-indeterminate"):t&&i?(c=this.ctx.icons.get("checkbox-check"),d="checkbox-check"):t&&!i?(c=this.ctx.icons.get("checkbox-check-disabled"),d="checkbox-check-disabled"):!t&&i?(c=this.ctx.icons.get("checkbox-uncheck"),d="checkbox-uncheck"):(c=this.ctx.icons.get("checkbox-disabled"),d="checkbox-disabled"),c&&(this.drawSelectionImageX=n,this.drawSelectionImageY=a,this.drawSelectionImageWidth=s,this.drawSelectionImageHeight=s,this.drawSelectionImageName=d,this.drawSelectionImageSource=c,this.ctx.paint.drawImage(this.drawSelectionImageSource,this.drawSelectionImageX,this.drawSelectionImageY,this.drawSelectionImageWidth,this.drawSelectionImageHeight))}}drawSortIcon(){if(!this.column.sortBy)return;const e=16;let t=this.sortIconName;const i=this.ctx.database.getSortState(this.key);i.direction==="asc"?t=this.sortAscIconName:i.direction==="desc"&&(t=this.sortDescIconName);const s=this.ctx.icons.get(t);s&&(this.drawSortImageWidth=e,this.drawSortImageHeight=e,this.drawSortImageName=t,this.drawSortImageSource=s,this.ctx.paint.drawImage(this.drawSortImageSource,this.drawSortImageX,this.drawSortImageY,this.drawSortImageWidth,this.drawSortImageHeight))}getText(){return this.render||["",null,void 0].includes(this.text)?"":`${this.text}`}getOverlayerViewsStyle(){let e="";return this.fixed==="left"?e=`${this.drawX}px`:this.fixed==="right"?e=`${this.drawX-(this.ctx.stageWidth-this.ctx.fixedRightWidth)}px`:e=`${this.drawX-this.ctx.fixedLeftWidth}px`,{position:"absolute",overflow:"hidden",left:e,top:`${this.drawY+1}px`,width:`${this.width}px`,height:`${this.height-2}px`,pointerEvents:"initial",userSelect:"none"}}}class VC{constructor(e){h(this,"ctx"),h(this,"visibleHoverCell"),h(this,"resizeObserver"),h(this,"mutationObserver"),this.ctx=e,this.init()}init(){this.resizeObserver=new ResizeObserver(e=>{this.ctx.emit("resetHeader"),this.ctx.emit("resizeObserver",e),this.ctx.emit("containerResize",this.ctx.containerElement)}),this.resizeObserver.observe(this.ctx.containerElement),this.mutationObserver=new MutationObserver(e=>{for(const t of e)t.type==="attributes"&&t.attributeName==="class"&&(this.ctx.config.updateCssVar(),this.ctx.emit("draw"))}),this.ctx.config.ENABLE_AUTO_THEME&&this.mutationObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),this.ctx.on("mousedown",e=>{if(this.isBusy(e))return;const{offsetY:t,offsetX:i}=this.ctx.getOffset(e),s=t,o=i,{body:{height:n,visibleHeight:a,visibleWidth:c,y:d}}=this.ctx,f=Math.min(n,a);o>0&&o<c&&s>d&&s<d+f||this.ctx.emit("mousedownBodyOutside",e),e.button===0&&(this.handleHeaderEvent(o,s,this.ctx.header.renderCellHeaders,u=>{this.ctx.focusCellHeader=u,this.ctx.focusCell=void 0,this.ctx.emit("cellHeaderMousedown",u,e)}),this.handleBodyEvent(o,s,this.ctx.body.renderRows,u=>{this.ctx.setFocusCell(u),this.ctx.focusCellHeader=void 0,this.ctx.emit("cellMousedown",u,e)}))}),this.ctx.on("mouseup",e=>{if(e.button!==0||this.isBusy(e))return;const{offsetY:t,offsetX:i}=this.ctx.getOffset(e),s=t,o=i;this.handleHeaderEvent(o,s,this.ctx.header.renderCellHeaders,n=>{this.ctx.focusCellHeader=n,this.ctx.emit("cellHeaderMouseup",n,e)}),this.handleBodyEvent(o,s,this.ctx.body.renderRows,n=>{this.ctx.setFocusCell(n),this.ctx.emit("cellMouseup",n,e)})}),this.ctx.on("click",e=>{if(e.button!==0||this.isBusy(e))return;const t=this.ctx.getOffset(e).offsetY,i=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(i,t,this.ctx.header.renderCellHeaders,s=>{this.ctx.clickCellHeader=s,this.ctx.emit("cellHeaderClick",s,e),this.selectionClick(s,e),this.sortClick(s,e)}),this.handleBodyEvent(i,t,this.ctx.body.renderRows,s=>{this.ctx.clickCell=s,this.ctx.emit("cellClick",s,e),this.selectionClick(s,e),this.treeClick(s,e)},!0),this.handleBodyEvent(i,t,this.ctx.body.renderRows,s=>{this.hoverIconClick(s)},!1)}),this.ctx.on("dblclick",e=>{if(e.button!==0||this.isBusy(e))return;const t=this.ctx.getOffset(e).offsetY,i=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(i,t,this.ctx.header.renderCellHeaders,s=>{this.ctx.emit("cellHeaderDblclick",s,e)}),this.handleBodyEvent(i,t,this.ctx.body.renderRows,s=>{this.ctx.clickCell=s,this.ctx.emit("cellDblclick",s,e)})}),this.ctx.on("contextMenu",e=>{if(this.isBusy(e))return;const{offsetY:t,offsetX:i}=this.ctx.getOffset(e),s=t,o=i;this.handleHeaderEvent(o,s,this.ctx.header.renderCellHeaders,n=>{this.ctx.emit("cellHeaderContextMenuClick",n,e)}),this.handleBodyEvent(o,s,this.ctx.body.renderRows,n=>{this.ctx.emit("cellContextMenuClick",n,e)})}),this.ctx.on("mouseout",e=>{!this.ctx.containerElement.contains(e.relatedTarget)&&this.ctx.hoverCell!==void 0&&(this.ctx.hoverRow=void 0,this.ctx.hoverCell=void 0,this.ctx.emit("draw"))}),this.ctx.on("mousemove",e=>{if(this.isBusy(e))return;this.ctx.isPointer=!1,this.ctx.stageElement.style.cursor==="pointer"&&(this.ctx.stageElement.style.cursor="default");const t=this.ctx.getOffset(e).offsetY,i=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(i,t,this.ctx.header.renderCellHeaders,s=>{this.ctx.emit("cellHeaderMouseenter",s,e),this.ctx.hoverCellHeader&&this.ctx.hoverCellHeader!==s&&this.ctx.emit("cellHeaderMouseleave",this.ctx.hoverCellHeader,e),this.imageEnterAndLeave(s,e),this.ctx.hoverCellHeader!==s&&(this.ctx.hoverCellHeader=s,this.visibleHoverCell=void 0,this.ctx.emit("cellHeaderHoverChange",s,e))}),this.handleBodyEvent(i,t,this.ctx.body.renderRows,s=>{this.imageEnterAndLeave(s,e),this.visibleHoverCell!==s&&(this.ctx.emit("visibleCellMouseleave",s,e),this.visibleHoverCell=s,this.ctx.hoverCellHeader=void 0,this.ctx.emit("visibleCellHoverChange",s,e))},!0),this.handleBodyEvent(i,t,this.ctx.body.renderRows,s=>{var o;this.imageEnterAndLeave(s,e),this.ctx.emit("cellMouseenter",s,e),this.ctx.hoverCell&&this.ctx.hoverCell!==s&&this.ctx.emit("cellMouseleave",s,e),this.ctx.hoverCell!==s&&(((o=this.ctx.hoverCell)==null?void 0:o.rowKey)!==s.rowKey&&(this.ctx.hoverCell=s,this.ctx.hoverRow=this.ctx.body.renderRows.find(n=>n.rowKey===s.rowKey),this.ctx.emit("rowHoverChange",this.ctx.hoverRow,s,e),this.ctx.emit("draw")),this.ctx.hoverCell=s,this.ctx.emit("cellHoverChange",s,e))}),this.handleFooterEvent(i,t,this.ctx.footer.renderRows,s=>{this.ctx.emit("cellFooterMouseenter",s,e),this.ctx.hoverCell&&this.ctx.hoverCell!==s&&this.ctx.emit("cellFooterMouseleave",s,e),this.ctx.emit("cellFooterHoverChange",s,e)})})}hoverIconClick(e){e.hoverIconName&&this.ctx.isPointer&&this.ctx.emit("hoverIconClick",e)}selectionClick(e,t){if(!(["selection","index-selection","selection-tree","tree-selection"].includes(e.type)&&this.ctx.isPointer))return;const{offsetY:i,offsetX:s}=this.ctx.getOffset(t),o=i,n=s;if(this.isInsideElement(n,o,e.drawSelectionImageX,e.drawSelectionImageY,e.drawSelectionImageWidth,e.drawSelectionImageHeight))if(e instanceof mr)e.drawSelectionImageName==="checkbox-uncheck"||e.drawSelectionImageName==="checkbox-indeterminate"?this.ctx.database.toggleAllSelection():e.drawSelectionImageName==="checkbox-check"&&this.ctx.database.clearSelection(!0);else{if(!this.ctx.database.getRowSelectable(e.rowKey))return;this.ctx.database.toggleRowSelection(e.rowKey,e.type)}}treeClick(e,t){if(!(["tree","selection-tree","tree-selection"].includes(e.type)&&this.ctx.isPointer))return;const{offsetY:i,offsetX:s}=this.ctx.getOffset(t),o=i,n=s;if(!this.isInsideElement(n,o,e.drawTreeImageX,e.drawTreeImageY,e.drawTreeImageWidth,e.drawTreeImageHeight))return;const a=this.ctx.database.getRowForRowKey(e.rowKey),{expand:c=!1,expandLazy:d=!1}=a||{},{EXPAND_LAZY:f,EXPAND_LAZY_METHOD:u}=this.ctx.config;if(f&&u&&!c&&!d)typeof u=="function"&&(this.ctx.database.expandLoading(e.rowKey,!0),u({row:e.row,rowIndex:e.rowIndex,colIndex:e.colIndex,column:e.column,value:e.getValue()}).then(g=>{this.ctx.database.setExpandChildren(e.rowKey,g),this.ctx.database.expandLoading(e.rowKey,!1),this.ctx.emit("expandChange",this.ctx.database.getExpandRowKeys())}).catch(g=>{this.ctx.database.expandLoading(e.rowKey,!1),console.error(g)}));else{const g=this.ctx.database.getIsExpand(e.rowKey);this.ctx.database.expandItem(e.rowKey,!g),this.ctx.emit("expandChange",this.ctx.database.getExpandRowKeys())}}sortClick(e,t){const{offsetY:i,offsetX:s}=this.ctx.getOffset(t),o=i,n=s;if(!this.isInsideElement(n,o,e.drawSortImageX,e.drawSortImageY,e.drawSortImageWidth,e.drawSortImageHeight))return;const a=this.ctx.database.getSortState(e.key);let c;a.direction==="none"?c="asc":a.direction==="asc"?c="desc":c="none",this.ctx.database.setSortState(e.key,c)}imageEnterAndLeave(e,t){const{offsetY:i,offsetX:s}=this.ctx.getOffset(t),o=i,n=s;if(e instanceof 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;return}if(e.drawSortImageSource&&this.isInsideElement(n,o,e.drawSortImageX,e.drawSortImageY,e.drawSortImageWidth,e.drawSortImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}}if(e instanceof Pr){if(e.drawSelectionImageSource&&this.isInsideElement(n,o,e.drawSelectionImageX,e.drawSelectionImageY,e.drawSelectionImageWidth,e.drawSelectionImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0,this.ctx.database.getRowSelectable(e.rowKey)||(this.ctx.stageElement.style.cursor="not-allowed");return}if(e.drawHoverImageSource&&this.isInsideElement(n,o,e.drawHoverImageX,e.drawHoverImageY,e.drawHoverImageWidth,e.drawHoverImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}if(e.drawTreeImageSource&&this.isInsideElement(n,o,e.drawTreeImageX,e.drawTreeImageY,e.drawTreeImageWidth,e.drawTreeImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}}}isInsideElement(e,t,i,s,o,n){return e>i&&e<i+o&&t>s&&t<s+n}isBusy(e){const{offsetY:t,offsetX:i}=this.ctx.getOffset(e),s=t,o=i;if(this.ctx.loading||!this.ctx.isTarget(e)||this.ctx.stageElement.style.cursor==="row-resize"||this.ctx.stageElement.style.cursor==="col-resize"||this.ctx.columnResizing||this.ctx.rowResizing)return!0;const{SCROLLER_TRACK_SIZE:n}=this.ctx.config;return!!(this.ctx.scrollerMove||this.ctx.scrollerFocus||s>this.ctx.stageHeight-n||o>this.ctx.stageWidth-n)}handleBodyEvent(e,t,i,s,o=!1){if(this.isInsideBody(t))for(const n of i){const a=n.fixedCells.concat(n.noFixedCells);for(const c of a){const d=c.getDrawX(),f=c.getDrawY();if(o){if(e>d&&e<d+c.visibleWidth&&t>f&&t<f+c.visibleHeight){s(c);return}}else if(e>d&&e<d+c.width&&t>f&&t<f+c.height){s(c);return}}}}handleHeaderEvent(e,t,i,s){for(const o of i){const n=o.getDrawX(),a=o.getDrawY();if(e>n&&e<n+o.width&&t>a&&t<a+o.height){s(o);return}}}handleFooterEvent(e,t,i,s,o=!1){for(const n of i){const a=n.fixedCells.concat(n.noFixedCells);for(const c of a){const d=c.getDrawX(),f=c.getDrawY();if(o){if(e>d&&e<d+c.visibleWidth&&t>f&&t<f+c.visibleHeight){s(c);return}}else if(e>d&&e<d+c.width&&t>f&&t<f+c.height){s(c);return}}}}isInsideBody(e){return e>this.ctx.body.y&&e<this.ctx.body.y+this.ctx.body.visibleHeight}destroy(){this.resizeObserver.unobserve(this.ctx.stageElement),this.mutationObserver.disconnect()}}class WC{constructor(e,t){h(this,"eventBus"),h(this,"eventBrowser"),h(this,"eventTable"),h(this,"containerElement"),h(this,"stageElement"),h(this,"canvasElement"),h(this,"overlayerElement"),h(this,"editorElement"),h(this,"emptyElement"),h(this,"contextMenuElement"),h(this,"loadingElement"),h(this,"stageWidth",0),h(this,"stageHeight",0),h(this,"paint"),h(this,"icons"),h(this,"domSelectionStr",""),h(this,"isMouseoverTargetContainer",!1),h(this,"mousedown",!1),h(this,"isPointer",!1),h(this,"isEmpty",!1),h(this,"rowResizing",!1),h(this,"columnResizing",!1),h(this,"scrollerMove",!1),h(this,"scrollerFocus",!1),h(this,"autofillMove",!1),h(this,"selectorMove",!1),h(this,"disableHoverIconClick",!1),h(this,"selectColsIng",!1),h(this,"selectRowsIng",!1),h(this,"dragHeaderIng",!1),h(this,"finding",!1),h(this,"adjustPositioning",!1),h(this,"contextMenuIng",!1),h(this,"editing",!1),h(this,"loading",!1),h(this,"onlyMergeCell",!1),h(this,"selectOnlyOne",!1),h(this,"hasSelection",!1),h(this,"hasTree",!1),h(this,"scrollY",0),h(this,"scrollX",0),h(this,"fixedLeftWidth",0),h(this,"fixedRightWidth",0),h(this,"lastCenterColIndex",0),h(this,"maxColIndex",0),h(this,"maxRowIndex",0),h(this,"hoverRow"),h(this,"clickCell"),h(this,"focusCell"),h(this,"currentCell"),h(this,"hoverCell"),h(this,"clickCellHeader"),h(this,"focusCellHeader"),h(this,"hoverCellHeader"),h(this,"mouseX",0),h(this,"mouseY",0),h(this,"body",{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,headIndex:0,tailIndex:0,visibleRows:[],renderRows:[],data:[]}),h(this,"footer",{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,renderRows:[]}),h(this,"header",{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,visibleLeafColumns:[],leafCellHeaders:[],allCellHeaders:[],renderLeafCellHeaders:[],renderCellHeaders:[],fixedLeftCellHeaders:[],fixedRightCellHeaders:[],renderCenterCellHeaders:[]}),h(this,"selector",{enable:!1,xArr:[-1,-1],yArr:[-1,-1],xArrCopy:[-1,-1],yArrCopy:[-1,-1]}),h(this,"autofill",{enable:!1,xArr:[-1,-1],yArr:[-1,-1]}),h(this,"finderBar",{text:"",rowIndex:-1,colIndex:-1,type:"body"}),h(this,"database"),h(this,"history"),h(this,"config");const{containerElement:i,stageElement:s,canvasElement:o,overlayerElement:n,editorElement:a,emptyElement:c,loadingElement:d,contextMenuElement:f}=e;this.containerElement=i,s.tabIndex=0,this.stageElement=s,this.canvasElement=o,this.overlayerElement=n,this.editorElement=a,this.emptyElement=c,this.loadingElement=d,this.contextMenuElement=f,this.config=new Mo(t.config||{}),this.eventBus=new HC,this.eventBrowser=new BC(this),this.eventTable=new VC(this),this.paint=new FC(this.canvasElement),this.database=new AC(this,t),this.history=new NC(this),this.icons=new YC(this)}setConfig(e){this.config=new Mo(e)}setItemValueByEditor(e,t,i,s=!0,o=!0,n=!0){if(this.config.ENABLE_MERGE_CELL_LINK){const a=this.database.getVirtualBodyCellByKey(e,t);if(a&&(a.mergeRow||a.mergeCol)){const{dataList:c}=a.getSpanInfo(),d=c.map(f=>({...f,value:i}));this.database.batchSetItemValue(d,s,n);return}}this.database.setItemValue(e,t,i,s,o,!0,n)}batchSetItemValueByEditor(e,t=!0,i=!0){if(this.config.ENABLE_MERGE_CELL_LINK){const s=[];e.forEach(o=>{const n=this.database.getRowIndexForRowKey(o.rowKey),a=this.database.getColIndexForKey(o.key);if(n===void 0||a===void 0)return;const c=this.database.getVirtualBodyCell(n,a);if(c){const{dataList:d}=c.getSpanInfo(),f=d.map(u=>({...u,value:o.value}));s.push(...f)}}),this.database.batchSetItemValue(s,t,i)}else this.database.batchSetItemValue(e,t,i)}setFocusCell(e){var t;if(this.focusCell!==e){if(((t=this.focusCell)==null?void 0:t.rowKey)!==e.rowKey){this.currentCell=e,this.emit("rowFocusChange",e);const i={rowIndex:e.rowIndex,rowKey:e.rowKey,row:e.row};this.emit("currentRowChange",i)}this.focusCell=e,this.emit("cellFocusChange",e)}}clearSelector(){this.selector.enable=!1,this.selector.xArr=[-1,-1],this.selector.yArr=[-1,-1],this.emit("clearSelector")}clearSelectorCopy(){this.selector.xArrCopy=[-1,-1],this.selector.yArrCopy=[-1,-1]}clearAutofill(){this.autofill={enable:!1,xArr:[-1,-1],yArr:[-1,-1]}}getSelectedData(){const e=[],t=this.selector.yArr,i=this.selector.xArr;let s="";for(let o=0;o<=t[1]-t[0];o++){const n=[];for(let a=0;a<=i[1]-i[0];a++){const c=o+t[0],d=a+i[0],f=this.database.getVirtualBodyCell(c,d);f&&(f.selectorCellValueType==="displayText"?n.push(f.displayText):n.push(f.getValue()))}s+=`${n.join(" ")}\r`,e.push(n)}return s=s?s.replace(/\r$/,""):" ",{xArr:i,yArr:t,text:s,value:e}}setScroll(e,t){let i=Math.floor(e);const s=this.body.width-this.body.visibleWidth;i<0?i=0:i>s&&(i=s);let o=Math.floor(t),n=this.body.height-this.body.visibleHeight;this.config.FOOTER_FIXED||(n=this.body.height+this.footer.height-this.body.visibleHeight),o<0?o=0:o>n&&(o=n),this.emit("setScroll",i,o)}setScrollX(e){let t=Math.floor(e);const i=this.body.width-this.body.visibleWidth;t<0?t=0:t>i&&(t=i),this.emit("setScrollX",t)}setScrollY(e){let t=Math.floor(e),i=0;this.config.FOOTER_FIXED||(i=this.footer.height);const s=this.body.height-this.body.visibleHeight+i;t<0?t=0:t>s&&(t=s),this.emit("setScrollY",t)}startAdjustPosition(e){this.emit("startAdjustPosition",e)}stopAdjustPosition(){this.emit("stopAdjustPosition")}isTarget(e){return!!this.containerElement.contains(e.target)}getOffset(e){const{left:t,top:i}=this.containerElement.getBoundingClientRect();return{offsetX:e.clientX-t,offsetY:e.clientY-i}}hasEvent(e){return this.eventBus.has(e)}on(e,t){this.eventBus.on(e,t)}once(e,t){this.eventBus.once(e,t)}off(e,t){this.eventBus.off(e,t)}emit(e,...t){this.eventBus.emit(e,...t)}destroy(){this.eventTable.destroy(),this.eventBrowser.destroy(),this.eventBus.destroy()}}class Bo{constructor(e,t){h(this,"ctx"),h(this,"type"),h(this,"isFocus",!1),h(this,"trackX",0),h(this,"trackY",0),h(this,"trackWidth",0),h(this,"trackHeight",0),h(this,"splitPoints",[]),h(this,"barX",0),h(this,"barY",0),h(this,"barWidth",0),h(this,"barHeight",0),h(this,"distance",0),h(this,"visibleDistance",0),h(this,"clientX",0),h(this,"clientY",0),h(this,"dragStart",0),h(this,"isDragging",!1),h(this,"scroll",0),this.ctx=e,this.type=t,this.type==="vertical"?this.scroll=this.ctx.scrollY:this.scroll=this.ctx.scrollX}onWheel(e){this.updateScroll(e)}onTouchmove(e){const{clientY:t,clientX:i}=e.touches[0],s=t-this.clientY,o=i-this.clientX;let n=0;this.type==="vertical"?(n=Math.max(0,Math.min(this.dragStart-s,this.distance)),this.hasScrollbar()&&!(n===0&&s>0||n===this.distance&&s<0)&&e.preventDefault()):this.type==="horizontal"&&(n=Math.max(0,Math.min(this.dragStart-o,this.distance))),this.scroll=n}onTouchstart(e){const{clientY:t,clientX:i}=e.touches[0];this.clientX=i,this.clientY=t,this.dragStart=this.scroll}onMouseDown(e){if(!(e.target instanceof Element)||!this.ctx.isTarget(e))return;if(this.ctx.stageElement.style.cursor==="row-resize"||this.ctx.stageElement.style.cursor==="col-resize")return!0;const{offsetX:t,offsetY:i,clientX:s,clientY:o}=e;if(!(s==this.clientX&&o==this.clientY)){if(this.isOnScrollbar(t,i))this.clientX=s,this.clientY=o,this.isDragging=!0,this.ctx.scrollerMove=!0,this.isFocus=!0,this.dragStart=this.scroll,e.preventDefault();else if(this.isOnTrack(t,i)){let n=0;this.type==="vertical"?n=(i-this.ctx.header.height-this.barHeight/2)/(this.visibleDistance-this.barHeight)*this.distance:n=(t-this.barWidth/2)/(this.visibleDistance-this.barWidth)*this.distance,this.scroll=Math.max(0,Math.min(n,this.distance))}}}onMouseUp(){this.isDragging=!1,this.isFocus=!1,this.clientX=0,this.clientY=0}onMouseMove(e){const{offsetX:t,offsetY:i,clientX:s,clientY:o,buttons:n}=e;if(this.isOnScrollbar(t,i)&&e.target===this.ctx.canvasElement?this.isFocus=!0:this.isFocus=!1,n===0||s==this.clientX&&o==this.clientY)return;let a=0;if(this.type==="horizontal"?a=s-this.clientX:a=o-this.clientY,this.isDragging&&a!==0){let c=0;this.type==="vertical"?c=this.dragStart+a/(this.visibleDistance-this.barHeight)*this.distance:c=this.dragStart+a/(this.visibleDistance-this.barWidth)*this.distance,this.scroll=Math.max(0,Math.min(c,this.distance))}}isPointInElement(e,t,i,s,o,n){return e>=i&&e<=i+o&&t>=s&&t<=s+n}hasScrollbar(){return this.type==="vertical"?this.barHeight>0:this.type==="horizontal"?this.barWidth>0:!1}isOnScrollbar(e,t){return this.isPointInElement(e,t,this.barX,this.barY,this.barWidth,this.barHeight)}isOnTrack(e,t){return this.isPointInElement(e,t,this.trackX,this.trackY,this.trackWidth,this.trackHeight)}updateScroll(e){const t=e.deltaX,i=e.deltaY;this.type==="vertical"&&e.shiftKey===!1?(this.hasScrollbar()&&!(this.scroll===0&&i<0||this.scroll===this.distance&&i>0)&&e.preventDefault(),this.scroll=Math.max(0,Math.min(this.scroll+i,this.distance))):this.type==="horizontal"&&(e.shiftKey?this.scroll=Math.max(0,Math.min(this.scroll+i,this.distance)):this.scroll=Math.max(0,Math.min(this.scroll+t,this.distance)))}updatedSize(){const{body:e,header:t,stageHeight:i,stageWidth:s,config:{SCROLLER_TRACK_SIZE:o=0,SCROLLER_SIZE:n=0,BORDER:a}}=this.ctx,c=s,d=i,f=t.height,u=t.width,g=e.height,v=this.ctx.footer.height;if(this.type==="vertical"){this.visibleDistance=d-o-f,this.distance=g-this.visibleDistance+v,this.trackX=c-o,this.trackY=0,this.splitPoints=[this.trackX,f,this.trackX+o,f],this.trackWidth=o,this.trackHeight=d,this.barX=this.trackX-1+(o-n)/2,this.barWidth=n;const x=this.distance?this.visibleDistance/(g+v):0;let m=Math.floor(x*this.visibleDistance);m<30?m=30:m>this.visibleDistance&&(m=0),this.barHeight=m,this.barY=f+this.scroll/this.distance*(this.visibleDistance-this.barHeight),this.scroll=Math.max(0,Math.min(this.scroll,this.distance))}else{this.visibleDistance=c-o,this.distance=u-this.visibleDistance,this.splitPoints=[c-o,d-o,c-o,d];const x=a?0:.5;this.trackX=0,this.trackY=d-o+x,this.trackWidth=c,this.trackHeight=o;const m=this.distance?this.visibleDistance/u:0;let p=Math.floor(m*this.visibleDistance);this.barY=this.trackY-1+(o-n)/2,p<30?p=30:p>=this.visibleDistance&&(p=0),this.barWidth=p,this.barHeight=n,this.barX=this.scroll/this.distance*(this.visibleDistance-this.barWidth),this.scroll=Math.max(0,Math.min(this.scroll,this.distance))}}draw(){const{config:{SCROLLER_FOCUS_COLOR:e,SCROLLER_COLOR:t,BORDER_COLOR:i,BORDER:s,SCROLLER_TRACK_COLOR:o}}=this.ctx;this.updatedSize();let n=i;s||(n="transparent"),this.ctx.paint.drawRect(this.trackX,this.trackY,this.trackWidth,this.trackHeight,{borderColor:n,fillColor:o}),this.ctx.paint.drawRect(this.barX,this.barY,this.barWidth,this.barHeight,{fillColor:this.isFocus||this.isDragging?e:t,radius:4}),this.splitPoints.length>0&&this.ctx.paint.drawLine(this.splitPoints,{borderColor:n,borderWidth:1}),this.ctx.scrollerFocus=this.isFocus}}class XC{constructor(e){h(this,"ctx"),h(this,"verticalScrollbar"),h(this,"horizontalScrollbar"),h(this,"mousedownHeader",!1),h(this,"adjustPositionX",""),h(this,"adjustPositionY",""),h(this,"timerX",0),h(this,"timerY",0),this.ctx=e,this.verticalScrollbar=new Bo(e,"vertical"),this.horizontalScrollbar=new Bo(e,"horizontal"),this.ctx.on("wheel",t=>this.onWheel(t)),this.ctx.on("mousedown",t=>this.onMouseDown(t)),this.ctx.on("mousemove",t=>this.onMouseMove(t)),this.ctx.on("mouseup",()=>this.onMouseUp()),this.ctx.on("touchmove",t=>this.onTouchmove(t)),this.ctx.on("touchstart",t=>{this.onTouchstart(t)}),this.ctx.on("setScroll",(t,i)=>{this.setScroll(t,i)}),this.ctx.on("setScrollX",t=>{this.setScrollX(t)}),this.ctx.on("setScrollY",t=>{this.setScrollY(t)}),this.ctx.on("scrollToIndex",(t,i)=>{this.scrollToIndex(t,i)}),this.ctx.on("cellHeaderMousedown",()=>{this.mousedownHeader=!0}),this.ctx.on("startAdjustPosition",t=>{this.startAdjustPosition(t)}),this.ctx.on("stopAdjustPosition",()=>{this.stopAdjustPosition()})}onWheel(e){this.verticalScrollbar.onWheel(e),this.horizontalScrollbar.onWheel(e),this.draw()}onTouchmove(e){this.verticalScrollbar.onTouchmove(e),this.horizontalScrollbar.onTouchmove(e),this.draw()}onTouchstart(e){this.verticalScrollbar.onTouchstart(e),this.horizontalScrollbar.onTouchstart(e),this.draw()}onMouseDown(e){this.verticalScrollbar.onMouseDown(e),this.horizontalScrollbar.onMouseDown(e),this.draw()}onMouseMove(e){this.verticalScrollbar.onMouseMove(e),this.horizontalScrollbar.onMouseMove(e),this.draw()}onMouseUp(){this.mousedownHeader=!1,this.verticalScrollbar.onMouseUp(),this.horizontalScrollbar.onMouseUp(),this.ctx.scrollerMove=!1}draw(){this.verticalScrollbar.draw(),this.horizontalScrollbar.draw();const e=Math.floor(this.horizontalScrollbar.scroll),t=Math.floor(this.verticalScrollbar.scroll);(e!==this.ctx.scrollX||t!==this.ctx.scrollY)&&(this.ctx.emit("onScroll",e,t),e!==this.ctx.scrollX&&this.ctx.emit("onScrollX",e),t!==this.ctx.scrollY&&this.ctx.emit("onScrollY",t),this.ctx.scrollX=e,this.ctx.scrollY=t,this.ctx.emit("draw"))}setScroll(e,t){this.horizontalScrollbar.scroll=e,this.verticalScrollbar.scroll=t,this.ctx.emit("draw"),this.ctx.emit("onScroll",e,t)}setScrollX(e){this.horizontalScrollbar.scroll=e,this.ctx.emit("draw")}setScrollY(e){this.verticalScrollbar.scroll=e,this.ctx.emit("draw")}scrollToColkey(e){const{header:t}=this.ctx,i=t.leafCellHeaders.find(s=>s.key===e);i&&this.setScrollX(i.x-t.visibleWidth/2)}scrollToColIndex(e){const{header:t}=this.ctx,i=t.leafCellHeaders.find(s=>s.colIndex===e);i&&this.setScrollX(i.x-t.visibleWidth/2)}scrollToRowIndex(e){const{body:t,database:i}=this.ctx,{top:s}=i.getPositionForRowIndex(e);this.setScrollY(s-t.visibleHeight/2)}scrollToIndex(e,t){this.scrollToRowIndex(e),this.scrollToColIndex(t)}scrollToRowKey(e){const{body:t,database:i}=this.ctx,s=i.getRowIndexForRowKey(e);if(s===void 0)return;const{top:o}=i.getPositionForRowIndex(s);this.setScrollY(o-t.visibleHeight/2)}startAdjustPosition(e){var t,i;const{offsetX:s,offsetY:o}=this.ctx.getOffset(e);let n="",a="";if(((t=this.ctx.focusCell)==null?void 0:t.fixed)!=="left"&&s<this.ctx.fixedLeftWidth?n="left":((i=this.ctx.focusCell)==null?void 0:i.fixed)!=="right"&&s>this.ctx.body.visibleWidth-this.ctx.fixedRightWidth?n="right":(n="",this.stopAdjustPosition(!0,!1)),!this.mousedownHeader&&o<this.ctx.header.visibleHeight?a="top":o>this.ctx.header.visibleHeight+this.ctx.body.visibleHeight?a="bottom":(a="",this.stopAdjustPosition(!1,!0)),n&&this.adjustPositionX!==n){this.adjustPositionX=n;let c=10*(n==="left"?-1:1);this.timerX&&(clearInterval(this.timerX),this.timerX=0),this.timerX=setInterval(()=>{c*=1.5;const{scrollX:d}=this.ctx,f=d+c;(f<0||f>this.ctx.body.width)&&(clearInterval(this.timerX),this.timerX=0),this.ctx.setScrollX(f)},100)}if(a&&this.adjustPositionY!==a){this.adjustPositionY=a;let c=10*(a==="top"?-1:1);this.timerY&&(clearInterval(this.timerY),this.timerY=0),this.timerY=setInterval(()=>{c*=1.5;const{scrollY:d}=this.ctx,f=d+c;(f<0||f>this.ctx.body.height)&&(clearInterval(this.timerY),this.timerY=0),this.ctx.setScrollY(f)},100)}}stopAdjustPosition(e=!0,t=!0){e&&(this.adjustPositionX="",this.timerX&&(clearInterval(this.timerX),this.timerX=0)),t&&(this.adjustPositionY="",this.timerY&&(clearInterval(this.timerY),this.timerY=0))}}class zC{constructor(e,t){h(this,"root"),h(this,"key"),h(this,"childrenKey"),this.root=e,this.key=(t==null?void 0:t.key)||"key",this.childrenKey=(t==null?void 0:t.childrenKey)||"children"}getTree(){return this.root}treeMove(e,t,i){const s=this.findNodeWithParent(this.root,e[this.key]);if(!s)throw new Error("Source node not found");const{parent:o,index:n,node:a}=s;if(o){const u=o[this.childrenKey];u.splice(n,1),u.length===0&&delete o[this.childrenKey]}else this.root.splice(n,1);const c=this.findNodeWithParent(this.root,t[this.key]);if(!c)throw new Error("Target node not found");const{parent:d,index:f}=c;i==="before"?d?d[this.childrenKey].splice(f,0,a):this.root.splice(f,0,a):i==="after"&&(d?d[this.childrenKey].splice(f+1,0,a):this.root.splice(f+1,0,a))}findNodeWithParent(e,t,i=null){for(let s=0;s<e.length;s++){const o=e[s];if(o[this.key]===t)return{parent:i,index:s,node:o};if(o[this.childrenKey]){const n=this.findNodeWithParent(o[this.childrenKey],t,o);if(n)return n}}return null}}class GC{constructor(e){h(this,"ctx"),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"resizeTarget",null),h(this,"dragTarget",null),h(this,"dragingCell"),h(this,"dragCellDiff",0),h(this,"resizeNum",0),h(this,"isResizing",!1),h(this,"clientX",0),h(this,"resizeDiff",0),h(this,"columnIndex",0),h(this,"isMouseDown",!1),h(this,"columns"),h(this,"visibleColumns"),h(this,"visibleLeafColumns",[]),h(this,"visibleHeight",0),h(this,"visibleWidth",0),h(this,"allCellHeaders",[]),h(this,"leafCellHeaders",[]),h(this,"renderLeafCellHeaders",[]),h(this,"fixedLeftCellHeaders",[]),h(this,"centerCellHeaders",[]),h(this,"fixedRightCellHeaders",[]),h(this,"renderCenterCellHeaders",[]),h(this,"renderFixedCellHeaders",[]),this.ctx=e,this.ctx.on("resetHeader",Kr(()=>{this.init(),this.ctx.clearSelector(),this.ctx.emit("draw")},100)),this.init(),this.initResizeColumn(),this.initDragColumn()}init(e=!1){const{config:{HEADER_HEIGHT:t,SCROLLER_TRACK_SIZE:i}}=this.ctx;if(!e){const u=this.ctx.database.getColumns();this.columns=u}this.allCellHeaders=[],this.leafCellHeaders=[],this.fixedLeftCellHeaders=[],this.fixedRightCellHeaders=[],this.centerCellHeaders=[],this.visibleColumns=Za(this.columns);const s=yi(this.visibleColumns),o=Wt(this.visibleColumns);this.height=t*s,this.visibleHeight=this.height,this.width=o.reduce((u,g)=>{const v=g.width||100,{maxWidth:x,minWidth:m}=g;return x&&v>x?u+x:m&&v<m?u+m:u+v},0),this.columnIndex=0,this.resizeNum=0;const n=SC(wi(this.visibleColumns,s));this.render(n,0),this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);const a=this.ctx.containerElement.getBoundingClientRect();this.resizeNum>0?this.ctx.stageWidth=Math.floor(a.width):this.ctx.stageWidth=Math.min(Math.floor(this.width+i),Math.floor(a.width)),this.ctx.stageElement.style.width=this.ctx.stageWidth+"px",this.visibleWidth=this.ctx.stageWidth-i;const c=this.visibleWidth-this.width;if(this.resizeNum&&c>0){const u=Math.floor(c/this.resizeNum*100)/100;this.resizeAllColumn(u)}const d=this.fixedLeftCellHeaders.filter(u=>!u.hasChildren);this.ctx.fixedLeftWidth=d.reduce((u,g)=>u+g.width,0);const f=this.fixedRightCellHeaders.filter(u=>!u.hasChildren);this.ctx.fixedRightWidth=f.reduce((u,g)=>u+g.width,i),this.ctx.maxColIndex=this.leafCellHeaders.length-1,this.ctx.header.x=this.x,this.ctx.header.y=this.y,this.ctx.header.width=this.width,this.ctx.header.height=this.height,this.ctx.header.allCellHeaders=this.allCellHeaders,this.ctx.header.visibleWidth=this.visibleWidth,this.ctx.header.visibleHeight=this.visibleHeight}initResizeColumn(){this.ctx.on("mousedown",e=>{this.ctx.config.ENABLE_RESIZE_COLUMN&&this.ctx.isTarget(e)&&(this.clientX=e.clientX,this.resizeTarget?(this.isResizing=!0,this.ctx.columnResizing=!0):this.isResizing=!1,this.isMouseDown=!0)}),this.ctx.on("mouseup",()=>{this.ctx.config.ENABLE_RESIZE_COLUMN&&(this.isMouseDown=!1,this.resizeDiff!==0&&this.resizeTarget&&this.resizeColumn(this.resizeTarget,this.resizeDiff),this.resizeTarget=null,this.isResizing=!1,this.isMouseDown=!1,this.ctx.columnResizing=!1,this.clientX=0,this.resizeDiff=0)}),this.ctx.on("mousemove",e=>{if(!this.ctx.config.ENABLE_RESIZE_COLUMN||this.ctx.editing)return;const{stageWidth:t,config:{RESIZE_COLUMN_MIN_WIDTH:i}}=this.ctx;if(this.isResizing&&this.resizeTarget){const s=this.resizeTarget.width,o=this.resizeTarget.minWidth,n=this.resizeTarget.maxWidth;let a=e.clientX-this.clientX;a+s<i&&(a=-(s-i)),o&&a+s<o&&(a=-(s-o)),n&&a+s>n&&(a=n-s),this.resizeDiff=a,this.ctx.emit("draw")}else{if(this.resizeTarget=null,this.isMouseDown)return;if(e.offsetX<0||e.offsetX>this.visibleWidth){this.ctx.stageElement.style.cursor==="col-resize"&&(this.ctx.stageElement.style.cursor="default");return}this.ctx.stageElement.style.cursor==="col-resize"&&(this.ctx.stageElement.style.cursor="default");const s=[...this.renderFixedCellHeaders,...this.renderCenterCellHeaders];for(const o of s){const{offsetX:n,offsetY:a}=this.ctx.getOffset(e),c=n,d=a,f=o.getDrawX(),u=o.getDrawY();if(c>f+o.width-5&&c<f+o.width+4&&c<t-4&&d>u){const g=o.colIndex+o.colspan-1,v=this.leafCellHeaders.find(x=>x.colIndex===g);if(!v||!v.fixed&&this.ctx.stageWidth-this.ctx.fixedRightWidth<f+o.width)return;this.ctx.isTarget(e)&&a<=this.height&&(this.ctx.stageElement.style.cursor="col-resize",this.resizeTarget=v)}}}})}initDragColumn(){this.ctx.on("cellHeaderMousedown",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(e.column.dragDisabled||(this.dragTarget===e?(this.ctx.dragHeaderIng=!0,this.dragCellDiff=this.ctx.mouseX-e.drawX,this.ctx.stageElement.style.cursor="grabbing"):(this.dragTarget=e,this.ctx.dragHeaderIng=!1)))}),this.ctx.on("cellMousedown",()=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(this.dragTarget=null,this.ctx.dragHeaderIng=!1)}),this.ctx.on("mouseup",()=>{if(this.ctx.config.ENABLE_DRAG_COLUMN){if(this.dragingCell&&this.dragTarget){const e=(d,f={})=>(d.forEach((u,g)=>{u.children&&e(u.children,f),f[u.key]=g}),f),t=this.ctx.database.getColumns(),i=wi(t,yi(t)),s=new zC(i,{key:"key",childrenKey:"children"}),o=this.dragTarget.colIndex>this.dragingCell.colIndex?"before":"after";s.treeMove(this.dragTarget.column,this.dragingCell.column,o);const n=s.getTree(),a=e(n);this.ctx.database.setCustomHeader({sortData:a}),this.init();const c={source:this.dragTarget,target:this.dragingCell,columns:i};this.ctx.emit("columnDragChange",c)}this.ctx.dragHeaderIng&&this.dragTarget&&(this.ctx.dragHeaderIng=!1,this.dragTarget=null,this.dragingCell=void 0,this.dragCellDiff=0,this.ctx.clearSelector(),this.ctx.focusCellHeader=void 0,this.ctx.stageElement.style.cursor="default",this.ctx.emit("draw"))}}),this.ctx.on("mousemove",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(!this.ctx.dragHeaderIng||!this.dragTarget||(this.dragTarget.fixed||this.ctx.startAdjustPosition(e),this.ctx.emit("draw")))}),this.ctx.on("cellHoverChange",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(e.column.dragDisabled||(this.dragingCell=this.getDragCellHeader(e.colIndex)))}),this.ctx.on("cellHeaderHoverChange",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(e.column.dragDisabled||(this.dragingCell=this.getDragCellHeader(e.colIndex)))})}getDragCellHeader(e){if(!this.dragTarget||!this.ctx.dragHeaderIng)return;const{column:{parentKey:t},key:i,level:s,fixed:o}=this.dragTarget,n=this.allCellHeaders.find(a=>a.key!==i&&a.fixed===o&&a.column.level===s&&a.column.parentKey===t&&a.colIndex<=e&&a.colIndex+a.colspan-1>=e);if(this.ctx.dragHeaderIng){const a=n?"grabbing":"not-allowed";this.ctx.stageElement.style.cursor=a}return n}resizeColumn(e,t){const i=n=>{n.forEach(a=>{if(a.children&&a.children.length>0&&i(a.children),a.key===e.key){const c=a.width||100;a.width=c+t}})};i(this.columns);let s=0;if(this.width<this.visibleWidth){const n=this.visibleWidth-this.width;s=Math.floor(n/this.resizeNum*100)/100,this.resizeAllColumn(s)}const o=e.width+t+s;this.ctx.emit("resizeColumnChange",{colIndex:e.colIndex,key:e.key,oldWidth:e.width,width:o,column:e.column,columns:this.columns}),this.ctx.database.setCustomHeaderResizableData(e.key,o),this.init(!0),this.ctx.emit("draw")}resizeAllColumn(e){if(e===0)return;const t=new Map;let i=!0;for(const o of this.allCellHeaders)if(o.widthFillDisable)t.set(o.key,o.width);else{const n=o.width+e*o.colspan;t.set(o.key,n),n<this.ctx.config.RESIZE_COLUMN_MIN_WIDTH&&(i=!1)}if(!i)return;const s=o=>{o.forEach(n=>{t.has(n.key)&&(n.width=t.get(n.key)),n.children&&n.children.length>0&&s(n.children)})};s(this.columns),this.init(!0),this.ctx.emit("draw")}getCustomHeader(){const e=this.ctx.database.getColumns(),t=this.ctx.database.getCustomHeader(),{sortData:i={}}=t;return Object.keys(i).length===0?{columns:e,customHeader:t}:{columns:wi(e,yi(e)),customHeader:t}}render(e,t){const i=e.length;let s=t;const{HEADER_HEIGHT:o=0}=this.ctx.config;for(let n=0;n<i;n++){const a=e[n],c=o*(a.rowspan||0),d=o*(a.level||0);let{minWidth:f,maxWidth:u}=a,g=a.width||100;f&&g<f&&(g=f),u&&g>u&&(g=u),a.children&&(g=Wt(a.children).reduce((x,m)=>x+((m==null?void 0:m.width)||100),0));const v=new mr(this.ctx,this.columnIndex,s,d,g,c,a);this.ctx.database.setHeader(a.key,v),this.allCellHeaders.push(v),a.children||(this.leafCellHeaders.push(v),v.column.widthFillDisable||this.resizeNum++),a.fixed==="left"?this.fixedLeftCellHeaders.push(v):a.fixed==="right"?this.fixedRightCellHeaders.push(v):this.centerCellHeaders.push(v),!a.children&&this.columnIndex++,a.children&&this.render(a.children,s),s+=g}}drawTipLine(){if(this.isResizing&&this.resizeTarget){const{stageHeight:e,config:{RESIZE_COLUMN_LINE_COLOR:t,RESIZE_COLUMN_TEXT_COLOR:i,RESIZE_COLUMN_TEXT_BG_COLOR:s,ENABLE_RESIZE_COLUMN_TEXT:o}}=this.ctx,n=this.resizeTarget.getDrawX(),a=this.resizeTarget.width,c=n+a+this.resizeDiff-.5,d=[c-.5,0,c-.5,e];if(this.ctx.paint.drawLine(d,{borderColor:t}),o){const f=`${Math.floor(a+this.resizeDiff)}px`,u=45,g=24;this.ctx.paint.drawRect(c+u/2,this.ctx.mouseY-g/2,u,g,{fillColor:s,borderWidth:0,borderColor:"transparent"}),this.ctx.paint.drawText(f,c+u/2,this.ctx.mouseY-g/2,u,g+2,{padding:0,color:i,align:"center",verticalAlign:"middle"})}}}drawDragTip(){if(this.dragTarget&&this.ctx.dragHeaderIng){const{DRAG_TIP_BG_COLOR:e,DRAG_TIP_LINE_COLOR:t}=this.ctx.config,i=this.dragTarget.width;if(this.ctx.paint.drawRect(this.ctx.mouseX-this.dragCellDiff,this.visibleHeight,i,this.ctx.body.visibleHeight,{fillColor:e,borderWidth:0,borderColor:"transparent"}),this.dragingCell){const{drawX:s,drawY:o,visibleWidth:n,colIndex:a}=this.dragingCell;let c=s,d=o;a>this.dragTarget.colIndex&&(c=s+n),a===0&&(c=c+1),a===this.ctx.maxColIndex&&(c=c-1);const f=[c,d,c,this.ctx.stageHeight],u=[c-4,d,c+4,d,c,d+6,c-4,d];this.ctx.paint.drawLine(u,{borderColor:t,borderWidth:1.2,fillColor:t}),this.ctx.paint.drawLine(f,{borderColor:t,borderWidth:1.2})}}}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:i,header:s,stageWidth:o,config:{HEADER_BG_COLOR:n,SCROLLER_TRACK_SIZE:a}}=this.ctx;if(i>0&&e!==0&&this.ctx.paint.drawShadow(this.x,this.y,e,this.height,{fillColor:n,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),i<Math.floor(s.width-o-1)&&t!==a){const c=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(c,this.y,t,this.height,{fillColor:n,side:"left",shadowWidth:4,colorStart:"rgba(0,0,0,0)",colorEnd:"rgba(0,0,0,0.1)"})}}update(){const e=[],t=[],i=[];if(this.centerCellHeaders.length){const s=this.centerCellHeaders[this.centerCellHeaders.length-1];this.ctx.lastCenterColIndex=s.colIndex}this.centerCellHeaders.forEach(s=>{s.isHorizontalVisible()&&s.isVerticalVisible()&&(t.push(s),s.hasChildren||e.push(s))}),this.fixedLeftCellHeaders.forEach(s=>{i.push(s),s.hasChildren||e.push(s)}),this.fixedRightCellHeaders.forEach(s=>{i.push(s),s.hasChildren||e.push(s)}),this.renderCenterCellHeaders=t,this.renderFixedCellHeaders=i,this.renderLeafCellHeaders=e.sort((s,o)=>s.x-o.x),this.visibleLeafColumns=this.renderLeafCellHeaders.map(s=>s.column),this.ctx.header.visibleLeafColumns=this.visibleLeafColumns,this.ctx.header.leafCellHeaders=this.leafCellHeaders,this.ctx.header.renderLeafCellHeaders=this.renderLeafCellHeaders,this.ctx.header.renderCellHeaders=this.renderFixedCellHeaders.concat(this.renderCenterCellHeaders)}drawBottomLine(){const{stageWidth:e,config:{BORDER_COLOR:t}}=this.ctx,i=[0,this.height,e,this.height];this.ctx.paint.drawLine(i,{borderColor:t,borderWidth:1})}draw(){this.renderCenterCellHeaders.forEach(e=>{e.update(),e.draw()}),this.drawFixedShadow(),this.renderFixedCellHeaders.forEach(e=>{e.update(),e.draw()}),this.drawBottomLine(),this.drawTipLine(),this.drawDragTip()}}class tl{constructor(e,t,i=0,s=0,o=0,n=0,a,c="body"){h(this,"ctx"),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height"),h(this,"cells",[]),h(this,"fixedCells",[]),h(this,"noFixedCells",[]),h(this,"calculatedHeightCells",[]),h(this,"rowIndex",0),h(this,"rowKey",""),h(this,"rowType","body"),h(this,"data"),h(this,"calculatedHeight",-1),this.ctx=e,this.x=i,this.y=s,this.width=o,this.height=n,this.rowIndex=t,this.rowKey=e.database.getRowKeyForRowIndex(t)||"",this.rowType=c,this.data=a,this.update()}update(){const{header:e}=this.ctx,t=[],i=[],s=[],o=[];e.renderLeafCellHeaders.forEach(n=>{const a=new Pr(this.ctx,this.rowIndex,n.colIndex,n.x,this.y,n.width,this.height,n.column,this.data,this.rowType);a.fixed?i.push(a):s.push(a),t.push(a),a.autoRowHeight&&o.push(a)}),this.cells=t,this.calculatedHeightCells=o,this.fixedCells=i,this.noFixedCells=s}updateCalculatedHeight(){const e=this.calculatedHeightCells.map(t=>{const i=t.getAutoHeight(),{key:s,height:o=-1}=this.ctx.database.getMaxRowHeightItem(this.rowKey)||{};return i>o?this.ctx.database.setMaxRowHeightItem(this.rowKey,t.key,i):i!==0&&t.key===s&&i<o&&this.ctx.database.setMaxRowHeightItem(this.rowKey,t.key,i),i});return this.calculatedHeight=e.length?Math.max(...e):-1,this.calculatedHeight}drawCenter(){this.noFixedCells.forEach(e=>{e.draw()})}drawFixed(){this.fixedCells.forEach(e=>{e.draw()})}drawContainer(){this.noFixedCells.forEach(e=>{e.drawContainer()})}drawFixedContainer(){this.fixedCells.forEach(e=>{e.drawContainer()})}}class UC{constructor(e){h(this,"resizeTarget",null),h(this,"isMouseDown",!1),h(this,"resizeDiff",0),h(this,"clientY",0),h(this,"ctx"),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"headIndex",0),h(this,"tailIndex",0),h(this,"isResizing",!1),h(this,"renderRows",[]),h(this,"visibleRows",[]),h(this,"visibleHeight",0),h(this,"visibleWidth",0),h(this,"containerRect"),h(this,"data",[]),this.ctx=e,this.init(),this.initResizeRow()}init(){const{canvasElement:e,header:t,footer:i,database:s,config:{FOOTER_FIXED:o,SCROLLER_TRACK_SIZE:n=0,HEIGHT:a,EMPTY_BODY_HEIGHT:c=0,MAX_HEIGHT:d=0,ENABLE_OFFSET_HEIGHT:f=0,OFFSET_HEIGHT:u=0,FOOTER_POSITION:g}}=this.ctx;if(!t.width)return;this.x=0,g==="top"&&o?this.y=t.height+i.height:this.y=t.height;const{data:v,sumHeight:x}=s.getData();this.height=x,this.data=v,this.width=t.width,this.visibleWidth=this.ctx.stageWidth-n;const m=this.ctx.footer.height;this.ctx.isEmpty=!this.data.length,!this.data.length&&!a?this.height=c:!this.data.length&&a&&(this.height=a-t.height-m-n);let p=this.height+t.height+n;p+=m;let E=p;const C=window.innerHeight,{top:w}=this.containerRect||this.ctx.containerElement.getBoundingClientRect();if(C>w&&f&&!a){const O=C-w-u;O>t.height+n?E=O:p>d&&(E=d)}else this.data.length&&a?E=a:this.data.length&&d&&p>d&&(E=d);E>0&&(this.ctx.stageHeight=Math.floor(E),this.ctx.stageElement.style.height=`${this.ctx.stageHeight}px`);let _=this.ctx.stageHeight-t.height-n;o?this.visibleHeight=_-m:this.visibleHeight=_,this.data.length||(this.height=this.visibleHeight),this.ctx.body.x=this.x,this.ctx.body.y=this.y,this.ctx.body.width=this.width,this.ctx.body.height=this.height,this.ctx.body.visibleWidth=this.visibleWidth,this.ctx.body.visibleHeight=this.visibleHeight,this.ctx.body.data=v;const S=window.devicePixelRatio||1,B=this.ctx.stageWidth*S,K=this.ctx.stageHeight*S;e.width=Math.round(B),e.height=Math.round(K);const R=this.data.length?"not-empty":"empty";this.ctx.emit("emptyChange",{isEmpty:R,type:R,headerHeight:t.height,bodyHeight:this.height,footerHeight:m,width:this.width,height:this.data.length?0:c+m});const I=Math.round(e.width/S*1e4)/1e4,b=Math.round(e.height/S*1e4)/1e4;this.ctx.canvasElement.setAttribute("style",`height:${b}px;width:${I}px;`),this.ctx.paint.scale(S)}initResizeRow(){this.ctx.on("resize",()=>{this.ctx.config.ENABLE_RESIZE_ROW&&(this.containerRect=this.ctx.containerElement.getBoundingClientRect())}),this.ctx.on("resizeObserver",()=>{this.ctx.config.ENABLE_RESIZE_ROW&&(this.containerRect=this.ctx.containerElement.getBoundingClientRect())}),this.ctx.on("mouseup",()=>{this.ctx.config.ENABLE_RESIZE_ROW&&(this.isMouseDown=!1,this.resizeDiff!==0&&this.resizeTarget&&this.resizeRow(this.resizeTarget,this.resizeDiff),this.resizeTarget=null,this.resizeDiff=0,this.isResizing=!1,setTimeout(()=>{this.ctx.rowResizing=!1},0),this.clientY=0)}),this.ctx.on("mousedown",e=>{this.ctx.config.ENABLE_RESIZE_ROW&&this.ctx.isTarget(e)&&(this.clientY=e.clientY,this.resizeTarget?(this.isResizing=!0,this.ctx.rowResizing=!0):(this.isResizing=!1,this.ctx.rowResizing=!1),this.isMouseDown=!0)}),this.ctx.on("mousemove",e=>{if(!this.ctx.config.ENABLE_RESIZE_ROW||this.ctx.editing)return;const{offsetY:t,offsetX:i}=this.ctx.getOffset(e),s=t,o=i,n=e.clientY,{stageHeight:a,scrollY:c,config:{RESIZE_ROW_MIN_HEIGHT:d=0}}=this.ctx;if(this.isResizing&&this.resizeTarget){const f=this.resizeTarget.height;let u=n-this.clientY;const{calculatedHeight:g}=this.resizeTarget,v=g===-1?d:g;u+f<v&&(u=-(f-v)),this.resizeDiff=u,this.ctx.emit("draw")}else{if(this.resizeTarget=null,this.isMouseDown)return;if(o<0||o>this.ctx.body.visibleWidth||s<0||s>this.ctx.header.visibleHeight+this.ctx.body.visibleHeight){this.ctx.stageElement.style.cursor==="row-resize"&&(this.ctx.stageElement.style.cursor="default");return}if(this.ctx.stageElement.style.cursor==="crosshair")return;this.ctx.stageElement.style.cursor==="row-resize"&&(this.ctx.stageElement.style.cursor="default");for(let f=0;f<this.renderRows.length;f++){const u=this.renderRows[f];if(s>u.y-c+u.height-1.5&&s<u.y-c+u.height+1.5&&s<a-4)for(let g=0;g<u.cells.length;g++){const v=u.cells[g];o>v.drawX+10&&o<v.drawX+v.width-10&&v.rowspan===1&&(this.ctx.stageElement.style.cursor="row-resize",this.resizeTarget=u)}}}})}resizeRow(e,t){const{rowIndex:i,height:s,rowKey:o,data:n}=e;this.ctx.database.setRowHeight(i,s+t),this.init(),this.ctx.emit("draw"),this.ctx.emit("resizeRowChange",{rowIndex:i,oldHeight:s,height:s+t,rowKey:o,row:n,data:this.data})}drawTipLine(){if(this.isResizing&&this.resizeTarget){const{stageWidth:e,scrollY:t,config:{RESIZE_ROW_LINE_COLOR:i}}=this.ctx,s=this.resizeTarget.y-t,o=this.resizeTarget.height,n=s+o+this.resizeDiff-.5,a=[0,n-.5,e,n-.5];this.ctx.paint.drawLine(a,{borderColor:i,borderWidth:1})}}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:i,header:s,stageWidth:o,config:{HEADER_BG_COLOR:n,SCROLLER_TRACK_SIZE:a}}=this.ctx;if(i>0&&e!==0&&!this.ctx.isEmpty&&this.ctx.paint.drawShadow(this.x,this.y,e,this.height,{fillColor:n,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),i<Math.floor(s.width-o-1)&&t!==a&&!this.ctx.isEmpty){const c=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(c,this.y,t,this.height,{fillColor:n,side:"left",shadowWidth:4,colorStart:"rgba(0,0,0,0)",colorEnd:"rgba(0,0,0,0.1)"})}}binarySearch(e,t){let i=0,s=e.length-1,o=-1;for(;i<=s;){let n=Math.floor((i+s)/2),a=e[n].bottom;if(a===t)return n;a<t?i=n+1:(o=n,s=n-1)}return o}update(){this.init();const{header:e,database:t,scrollY:i,config:{CELL_HEIGHT:s}}=this.ctx,o=i,{data:n,positions:a}=t.getData();this.ctx.maxRowIndex=n.length-1;let c=this.binarySearch(a,o),d=this.binarySearch(a,o+this.visibleHeight);if(d===-1&&(d=this.ctx.maxRowIndex),c===-1&&d===this.ctx.maxRowIndex){const u=Math.floor(this.visibleHeight/s);c=this.ctx.maxRowIndex-u}this.headIndex=Math.max(0,c),this.tailIndex=Math.min(this.ctx.maxRowIndex,d+1),this.visibleRows=n.slice(this.headIndex,this.tailIndex+1),this.ctx.body.headIndex=this.headIndex,this.ctx.body.tailIndex=this.tailIndex,this.ctx.body.visibleRows=this.visibleRows;const f=[];for(let u=0;u<this.visibleRows.length;u++){const g=this.headIndex+u,v=this.visibleRows[u],{height:x,top:m}=this.ctx.database.getPositionForRowIndex(g),p=new tl(this.ctx,g,0,m+this.y,e.width,x,v);f.push(p)}this.renderRows=f,this.ctx.body.renderRows=f}updateAutoHeight(){const e=this.ctx.body.renderRows;if(!e.some(i=>i.calculatedHeightCells.length>0))return!1;e.forEach(i=>{i.updateCalculatedHeight()});const t=e.map(i=>({height:i.calculatedHeight,rowIndex:i.rowIndex}));return this.ctx.database.setBatchCalculatedRowHeight(t)}draw(){this.renderRows.forEach(e=>{e.drawContainer()}),this.renderRows.forEach(e=>{e.drawCenter()}),this.drawFixedShadow(),this.renderRows.forEach(e=>{e.drawFixedContainer()}),this.renderRows.forEach(e=>{e.drawFixed()}),this.drawTipLine()}}class qC{constructor(e){h(this,"ctx"),h(this,"renderRows",[]),h(this,"data",[]),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"visibleWidth",0),h(this,"visibleHeight",0),this.ctx=e,this.init()}init(){this.data=this.ctx.database.getFooterData();const{header:e,body:t,config:{CELL_FOOTER_HEIGHT:i,FOOTER_FIXED:s,SCROLLER_TRACK_SIZE:o,FOOTER_POSITION:n}}=this.ctx;this.width=e.width,this.visibleWidth=e.visibleWidth,this.height=this.data.reduce(a=>a+i,0),this.visibleHeight=this.height,s?n==="top"?this.y=this.ctx.header.height:this.y=this.ctx.stageHeight-this.height-o:this.y=t.y+t.height,this.ctx.footer.x=this.x,this.ctx.footer.y=this.y,this.ctx.footer.height=this.height,this.ctx.footer.width=this.width,this.ctx.footer.visibleWidth=this.visibleWidth,this.ctx.footer.visibleHeight=this.visibleHeight}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:i,header:s,stageWidth:o,config:{HEADER_BG_COLOR:n,SCROLLER_TRACK_SIZE:a}}=this.ctx;let c=this.y;if(this.ctx.config.FOOTER_FIXED||(c=this.y-this.ctx.scrollY),i>0&&e!==0&&this.ctx.paint.drawShadow(this.x,c,e,this.height,{fillColor:n,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),i<Math.floor(s.width-o-1)&&t!==a){const d=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(d,c,t,this.height,{fillColor:n,side:"left",shadowWidth:4,colorStart:"rgba(0,0,0,0)",colorEnd:"rgba(0,0,0,0.1)"})}}update(){this.init();const{CELL_FOOTER_HEIGHT:e}=this.ctx.config;let t=this.y;const i=[];this.data.forEach((s,o)=>{const n=new tl(this.ctx,o,0,t,this.width,e,s,"footer");t+=e,i.push(n)}),this.renderRows=i,this.ctx.footer.renderRows=this.renderRows}drawTopLine(){const{stageWidth:e,config:{BORDER_COLOR:t}}=this.ctx,i=[0,this.y,e,this.y];this.ctx.paint.drawLine(i,{borderColor:t,borderWidth:1})}draw(){this.renderRows.forEach(e=>{e.drawContainer()}),this.renderRows.forEach(e=>{e.drawCenter()}),this.drawFixedShadow(),this.renderRows.forEach(e=>{e.drawFixedContainer()}),this.renderRows.forEach(e=>{e.drawFixed()}),this.drawTopLine()}}class ZC{constructor(e){h(this,"isCut",!1),h(this,"isMultipleRow",!1),h(this,"ctx"),this.ctx=e,this.init()}init(){this.ctx.on("setMoveFocus",e=>{this.moveFocus(e)}),this.ctx.on("mousemove",Kr(e=>{var t,i;(t=this.ctx.focusCell)!=null&&t.fixed||(i=this.ctx.focusCellHeader)!=null&&i.fixed||!this.ctx.dragHeaderIng&&this.ctx.selectorMove&&this.ctx.startAdjustPosition(e)},100)),this.ctx.on("cellHoverChange",e=>{if(!this.ctx.autofillMove){if(e.operation){this.selectRows(e,!1);return}this.isMultipleRow||this.mouseenter()}}),this.ctx.on("cellMousedown",(e,t)=>{if(!(!this.ctx.isTarget(t)||this.ctx.stageElement.style.cursor==="pointer"||this.ctx.isPointer||this.ctx.stageElement.style.cursor==="crosshair")){if(e.operation){this.isMultipleRow=!0,this.selectRows(e);return}window.getComputedStyle(t.target).userSelect!=="text"&&t.preventDefault(),this.isMultipleRow=!1,this.click(t.shiftKey),this.ctx.emit("selectorClick",e)}}),this.ctx.on("mouseup",()=>{this.ctx.selectorMove=!1,this.ctx.stopAdjustPosition(),this.ctx.adjustPositioning=!1,this.ctx.disableHoverIconClick=!1}),this.ctx.on("cellHeaderHoverChange",e=>{this.ctx.mousedown&&this.selectCols(e)}),this.ctx.on("cellHoverChange",e=>{this.ctx.mousedown&&this.selectCols(e)}),this.ctx.on("cellHeaderMousedown",(e,t)=>{this.ctx.stageElement.style.cursor==="pointer"||this.ctx.isPointer||(window.getComputedStyle(t.target).userSelect!=="text"&&t.preventDefault(),this.ctx.clearSelector(),e.operation?this.selectAll():this.selectCols(e))}),this.ctx.on("keydown",e=>{if(!this.ctx.editing&&!this.ctx.finding){if(e.ctrlKey&&e.code==="KeyV"||e.metaKey&&e.code==="KeyV"){this.paste();return}if(e.ctrlKey&&e.code==="KeyC"||e.metaKey&&e.code==="KeyC"){this.copy(),this.isCut=!1;return}if(e.ctrlKey&&e.code==="KeyX"||e.metaKey&&e.code==="KeyX"){this.isCut=!0,this.copy();return}if((e.ctrlKey&&e.code==="KeyA"||e.metaKey&&e.code==="KeyA")&&(e.preventDefault(),this.selectAll()),e.code==="ArrowLeft"||e.shiftKey&&e.code==="Tab"){e.preventDefault(),this.moveFocus("LEFT");return}if(e.code==="ArrowUp"){e.preventDefault(),this.moveFocus("TOP");return}if(e.code==="ArrowRight"||e.code==="Tab"){e.preventDefault(),this.moveFocus("RIGHT");return}if(e.code==="ArrowDown"){e.preventDefault(),this.moveFocus("BOTTOM");return}if(e.code==="Delete"||e.code==="Backspace"){e.preventDefault();const{xArr:t,yArr:i}=this.ctx.selector;this.clearSelectedData(t,i);return}}}),this.ctx.on("contextMenuClearSelected",()=>{const{xArr:e,yArr:t}=this.ctx.selector;this.clearSelectedData(e,t)}),this.ctx.on("contextMenuCopy",()=>{this.copy()}),this.ctx.on("contextMenuPaste",()=>{this.paste()}),this.ctx.on("contextMenuCut",()=>{this.isCut=!0,this.copy()}),this.ctx.on("setSelectorCell",e=>{this.ctx.setFocusCell(e),this.click()}),this.ctx.on("selectCols",e=>{this.selectCols(e)})}setSelector(e,t){if(this.ctx.dragHeaderIng)return;const{ENABLE_SELECTOR_SPAN_COL:i,ENABLE_SELECTOR_SPAN_ROW:s}=this.ctx.config;let o=e,n=t;if(!s){const[a]=n;n=[a,a]}if(!i){const[a]=o;o=[a,a]}if(JSON.stringify(this.ctx.selector.xArr)!==JSON.stringify(o)||JSON.stringify(this.ctx.selector.yArr)!==JSON.stringify(n)){this.ctx.mousedown&&(this.ctx.selectorMove=!0,this.ctx.disableHoverIconClick=!0),this.ctx.selector.enable=!0;const{SELECTOR_AREA_MIN_X:a,SELECTOR_AREA_MAX_X:c,SELECTOR_AREA_MIN_Y:d,SELECTOR_AREA_MAX_Y:f,SELECTOR_AREA_MAX_X_OFFSET:u,SELECTOR_AREA_MAX_Y_OFFSET:g}=this.ctx.config,v=a,x=c||this.ctx.maxColIndex-u,m=d,p=f||this.ctx.maxRowIndex-g;let[E,C]=o,[w,_]=n;if(E<v||C>x||w<m||_>p)return;if(this.ctx.config.ENABLE_MERGE_CELL_LINK){const B=this.adjustMergeCells(o,n);w=B.yArr[0],_=B.yArr[1],E=B.xArr[0],C=B.xArr[1],this.ctx.onlyMergeCell=B.onlyMergeCell}E===C&&w===_?this.ctx.selectOnlyOne=!0:this.ctx.selectOnlyOne=!1,o=[Math.max(v,E),Math.min(x,C)],n=[Math.max(m,w),Math.min(p,_)];const{BEFORE_SET_SELECTOR_METHOD:S}=this.ctx.config;if(typeof S=="function"){const B=S({focusCell:this.ctx.focusCell,xArr:o,yArr:n});if(!B)return;o=B.xArr,n=B.yArr}this.ctx.selector.xArr=o,this.ctx.selector.yArr=n,_===this.ctx.maxRowIndex&&w===0?this.ctx.selectColsIng=!0:this.ctx.selectColsIng=!1,C===this.ctx.maxColIndex&&E===0?this.ctx.selectRowsIng=!0:this.ctx.selectRowsIng=!1,this.ctx.emit("setSelector",this.ctx.selector),this.ctx.emit("drawView")}}adjustMergeCells(e,t){var i;const[s,o]=t,[n,a]=e;if(o===this.ctx.maxRowIndex&&s===0||a===this.ctx.maxColIndex&&n===0)return{xArr:e,yArr:t,onlyMergeCell:!1};let c=[],d=[];for(let m=0;m<=t[1]-t[0];m++)for(let p=0;p<=e[1]-e[0];p++){const E=m+t[0],C=p+e[0],w=this.ctx.database.getVirtualBodyCell(E,C);w&&((E===s||E===o)&&c.push(w),(C===n||C===a)&&d.push(w))}const f=c.reduce((m,p)=>{const{yArr:E}=p.getSpanInfo(),[C,w]=E;return m.minY=Math.min(m.minY,C),m.maxY=Math.max(m.maxY,w),m},{minY:s,maxY:o}),u=d.reduce((m,p)=>{const{xArr:E}=p.getSpanInfo(),[C,w]=E;return m.minX=Math.min(m.minX,C),m.maxX=Math.max(m.maxX,w),m},{minX:n,maxX:a}),g=[u.minX,u.maxX],v=[f.minY,f.maxY];let x=!1;if(u.minX!==u.maxX||f.minY!==f.maxY){const m=JSON.stringify(g)+JSON.stringify(v),p=(i=this.ctx.focusCell)==null?void 0:i.getSpanInfo();x=(p&&JSON.stringify(p.xArr)+JSON.stringify(p.yArr))===m}return{xArr:g,yArr:v,onlyMergeCell:x}}selectCols(e){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||!this.ctx.config.ENABLE_SELECTOR_ALL_ROWS||this.ctx.autofillMove||this.ctx.columnResizing||this.ctx.editing)return;const{SELECTOR_AREA_MIN_Y:t,SELECTOR_AREA_MAX_Y:i,SELECTOR_AREA_MAX_Y_OFFSET:s}=this.ctx.config,o=t,n=i||this.ctx.maxRowIndex-s;if(this.ctx.focusCellHeader){const{colIndex:a}=this.ctx.focusCellHeader;if(this.ctx.clearSelector(),this.ctx.mousedown&&e.colIndex>=a){const c=[a,e.colIndex+e.colspan-1],d=[o,n];this.setSelector(c,d)}else{const c=[e.colIndex,a+e.colspan-1],d=[o,n];this.setSelector(c,d)}}}selectAll(){if(this.ctx.autofillMove||this.ctx.editing)return;const{ENABLE_SELECTOR_ALL_ROWS:e,ENABLE_SELECTOR_ALL_COLS:t}=this.ctx.config;if(e&&t){const{SELECTOR_AREA_MIN_X:i,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MIN_Y:o,SELECTOR_AREA_MAX_Y:n,SELECTOR_AREA_MAX_X_OFFSET:a,SELECTOR_AREA_MAX_Y_OFFSET:c}=this.ctx.config,d=i,f=s||this.ctx.maxColIndex-a,u=o,g=n||this.ctx.maxRowIndex-c,v=[d,f],x=[u,g];this.setSelector(v,x)}}selectRows(e,t=!0){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||!this.ctx.config.ENABLE_SELECTOR_ALL_COLS||this.ctx.autofillMove||this.ctx.editing)return;const{SELECTOR_AREA_MIN_X:i,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MAX_X_OFFSET:o}=this.ctx.config,n=s||this.ctx.maxColIndex-o,a=i;if(t){this.ctx.setFocusCell(e);const c=[a,n],d=[e.rowIndex,e.rowIndex];this.setSelector(c,d)}if(this.ctx.focusCell&&this.ctx.mousedown){const{rowIndex:c}=this.ctx.focusCell;if(e.rowIndex>=c){const d=[a,n],f=[c,e.rowIndex];this.setSelector(d,f)}else{const d=[a,n],f=[e.rowIndex,c];this.setSelector(d,f)}}}mouseenter(){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||this.ctx.editing)return;const{mousedown:e,focusCell:t,hoverCell:i}=this.ctx;if(e&&t&&i){const{rowIndex:s,colIndex:o}=t,n=Math.min(i.colIndex,o),a=Math.max(i.colIndex,o),c=Math.min(i.rowIndex,s),d=Math.max(i.rowIndex,s),f=[n,a],u=[c,d];this.setSelector(f,u)}}click(e=!1){const{focusCell:t,clickCell:i}=this.ctx;if(t&&this.isInSettingRange(t.rowIndex,t.colIndex))if(this.ctx.selector.enable=!0,i&&e){if(this.ctx.config.ENABLE_SELECTOR_SINGLE)return;const{colIndex:s,rowIndex:o}=i,{colIndex:n,rowIndex:a}=t,c=Math.min(n,s),d=Math.max(n,s),f=Math.min(a,o),u=Math.max(a,o),g=[c,d],v=[f,u];this.setSelector(g,v)}else{this.ctx.emit("cellSelectedClick",t);const s=[t.colIndex,t.colIndex],o=[t.rowIndex,t.rowIndex];this.setSelector(s,o),this.adjustBoundaryPosition()}}clearCopyLine(){this.ctx.selector.xArrCopy=[-1,-1],this.ctx.selector.yArrCopy=[-1,-1]}getCell(e,t){const i=this.ctx.body.renderRows.find(s=>s.rowIndex===e);return i==null?void 0:i.cells.find(s=>s.colIndex===t)}copy(){if(!this.ctx.config.ENABLE_COPY||this.ctx.domSelectionStr)return;let{value:e,xArr:t,yArr:i}=this.ctx.getSelectedData();if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(t,i))if(this.ctx.onlyMergeCell&&this.ctx.focusCell){const n=this.ctx.focusCell;e=[[n.getValue()]],t=[n.colIndex,n.colIndex],i=[n.rowIndex,n.rowIndex]}else{const n={code:"ERR_MERGED_CELLS_COPY",message:"Merged cells cannot span copy data"};this.ctx.hasEvent("error")?this.ctx.emit("error",n):alert(n.message);return}const{BEFORE_COPY_METHOD:s}=this.ctx.config;if(typeof s=="function"){const n=s({focusCell:this.ctx.focusCell,data:e,xArr:t,yArr:i});if(!n)return;e=n.data}const o=kC(e);navigator.clipboard?navigator.clipboard.writeText(o).then(()=>{this.ctx.selector.xArrCopy=this.ctx.selector.xArr.slice(),this.ctx.selector.yArrCopy=this.ctx.selector.yArr.slice(),this.ctx.emit("copyChange",{xArr:this.ctx.selector.xArrCopy,yArr:this.ctx.selector.yArrCopy,data:e}),this.ctx.emit("draw")}).catch(n=>console.error("Copy Failure:",n)):console.error("current browser does not support the Clipboard API")}clearSelectedData(e,t,i=!1,s=null){let o=[];const n=new Set;for(let c=0;c<=t[1]-t[0];c++)for(let d=0;d<=e[1]-e[0];d++){const f=c+t[0],u=d+e[0],g=this.ctx.database.getItemValueForRowIndexAndColIndex(f,u);if(g){const{rowKey:v,key:x}=g;this.ctx.database.getReadonly(v,x)||(n.add(v),o.push({rowKey:v,key:x,value:s,row:{}}))}}if(!o.length)return[];if(i)return o;this.ctx.database.batchSetItemValue(o,!0);let a=[];return n.forEach(c=>{a.push(this.ctx.database.getRowDataItemForRowKey(c))}),this.ctx.emit("clearSelectedDataChange",o,a),o}paste(){if(!navigator.clipboard){console.error("current browser does not support the Clipboard API");return}const{ENABLE_PASTER:e}=this.ctx.config;if(this.ctx.selector.enable&&e){const t=this.ctx.selector.yArr[0],i=this.ctx.selector.xArr[0],s=new Set;navigator.clipboard.readText().then(async o=>{let n=OC(o);const a=[i,i+n[0].length-1],c=[t,t+n.length-1],[d,f]=c,[u,g]=a,v=f-this.ctx.maxRowIndex,x=g-this.ctx.maxColIndex;(v>0||x>0)&&this.ctx.emit("onPastedDataOverflow",{maxY:f,maxX:g,minY:d,minX:u,overflowRowCount:v,overflowColCount:x,textArr:n});const m=n.length===1&&n[0].length===1;if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(a,c)&&!m){const w={code:"ERR_MERGED_CELLS_PASTE",message:"Merged cells cannot span paste data"};this.ctx.hasEvent("error")?this.ctx.emit("error",w):alert(w.message);return}let p=[];for(let w=0;w<=n.length-1;w++){const _=n[w].length;for(let S=0;S<=_-1;S++){const B=w+t,K=S+i,R=n[w][S],I=this.ctx.database.getItemValueForRowIndexAndColIndex(B,K);if(I){const{rowKey:b,key:O}=I;this.ctx.database.getReadonly(b,O)||(s.add(b),p.push({rowKey:b,key:O,value:R,row:{}}))}}}if(this.isCut){const w=this.clearSelectedData(this.ctx.selector.xArrCopy,this.ctx.selector.yArrCopy,!0),_=p.map(S=>`${S.rowKey}-${S.key}`);w.forEach(S=>{_.includes(`${S.rowKey}-${S.key}`)||p.unshift(S)}),this.isCut=!1}if(!p.length)return;const{BEFORE_PASTE_DATA_METHOD:E}=this.ctx.config;if(typeof E=="function"){const w=E,_=p.map(S=>({rowKey:S.rowKey,key:S.key,value:S.value,oldValue:this.ctx.database.getItemValue(S.rowKey,S.key),row:this.ctx.database.getRowDataItemForRowKey(S.rowKey)}));if(p=await w(_,a,c,n),p&&!p.length)return}this.clearCopyLine(),this.ctx.batchSetItemValueByEditor(p,!0);let C=[];s.forEach(w=>{C.push(this.ctx.database.getRowDataItemForRowKey(w))}),this.ctx.emit("pasteChange",p,C),this.ctx.emit("draw")}).catch(o=>{console.error("Failed to get the clipboard content:",o)})}}moveFocus(e){if(this.ctx.editing)return;const{focusCell:t}=this.ctx;if(!t)return;let{colIndex:i=0,rowIndex:s=0}=t;const o=0,n=0,a=this.ctx.maxColIndex,c=this.ctx.maxRowIndex;switch(e){case"LEFT":i>o&&i--;break;case"TOP":s>n&&s--;break;case"RIGHT":i<a&&i++;break;case"BOTTOM":s<c&&s++;break}const d=[i,i],f=[s,s],u=this.getCell(s,i);u&&(u.operation||this.isInSettingRange(u.rowIndex,u.colIndex)&&(this.ctx.setFocusCell(u),this.setSelector(d,f),this.adjustBoundaryPosition(),this.ctx.emit("moveFocus",u),this.ctx.emit("draw")))}isInSettingRange(e,t){const{SELECTOR_AREA_MIN_X:i,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MIN_Y:o,SELECTOR_AREA_MAX_Y:n,SELECTOR_AREA_MAX_X_OFFSET:a,SELECTOR_AREA_MAX_Y_OFFSET:c}=this.ctx.config,d=i,f=s||this.ctx.maxColIndex-a,u=o,g=n||this.ctx.maxRowIndex-c;return!(t<d||t>f||e<u||e>g)}adjustBoundaryPosition(){const{stageHeight:e,stageWidth:t,focusCell:i,fixedRightWidth:s,fixedLeftWidth:o,header:n,footer:a,body:c,scrollX:d,scrollY:f,config:{SCROLLER_TRACK_SIZE:u,FOOTER_FIXED:g,FOOTER_POSITION:v,ENABLE_MERGE_CELL_LINK:x}}=this.ctx;if(!i)return;x&&this.ctx.onlyMergeCell&&i.updateSpanInfo();const{drawX:m,drawY:p,width:E,height:C,fixed:w}=i,_=o-m+1,S=i.drawX+E-(t-s)+1;let B=n.height-p,K=C;K>c.visibleHeight&&(K=c.visibleHeight);let R=0;g&&(v==="top"?B=n.height+a.height-p:R=a.visibleHeight);const I=p+K-(e-R-u);let b=d,O=f;S>0&&!w?b=Math.floor(d+S):_>0&&!w&&(b=Math.floor(d-_)),B>0?O=Math.floor(f-B):I>0&&(O=Math.floor(f+I)),(Math.abs(d-b)>2||Math.abs(f-O)>2)&&(this.ctx.adjustPositioning=!0,this.ctx.emit("adjustBoundaryPosition",i),this.ctx.setScroll(b,O))}destroy(){}}class JC{constructor(e){h(this,"ctx"),h(this,"maxColRowCell"),this.ctx=e,this.init()}init(){this.ctx.on("mousemove",e=>{if(this.ctx.stageElement.style.cursor==="crosshair"&&(this.ctx.stageElement.style.cursor="default"),this.ctx.editing||!this.ctx.focusCell||!this.maxColRowCell)return;const{offsetX:t,offsetY:i}=this.ctx.getOffset(e),{colIndex:s,rowIndex:o,drawX:n,drawY:a,width:c,height:d}=this.maxColRowCell,f=6,u=s===this.ctx.maxColIndex||o===this.ctx.maxRowIndex?0:2,g=n+c-f+u,v=a+d-f+u;t>g&&i>v&&t<g+f&&i<v+f&&(this.ctx.stageElement.style.cursor="crosshair"),this.ctx.autofillMove&&this.ctx.startAdjustPosition(e)}),this.ctx.on("cellMouseenter",e=>{const{xArr:t,yArr:i}=this.ctx.selector,s=t[1],o=i[1],{colIndex:n,rowIndex:a}=e;this.ctx.config.ENABLE_AUTOFILL&&n===s&&a===o&&(this.maxColRowCell=e),this.mouseenter(e)}),this.ctx.on("mousedown",()=>{this.ctx.stageElement.style.cursor==="crosshair"&&this.setMousedown()}),this.ctx.on("mouseup",()=>{this.setMouseUp(),this.ctx.stopAdjustPosition()})}isAutofillIng(){const{xArr:e,yArr:t}=this.ctx.selector;return!(JSON.stringify(this.ctx.autofill.xArr)===JSON.stringify(e)&&JSON.stringify(this.ctx.autofill.yArr)===JSON.stringify(t))}setMousedown(){this.ctx.autofill.enable=!0,this.ctx.autofillMove=!0,this.ctx.disableHoverIconClick=!0}setMouseUp(){this.ctx.autofill.enable&&(this.isAutofillIng()&&this.autofillData(),this.ctx.autofill.enable=!1,this.ctx.autofillMove=!1,this.ctx.autofill.xArr=[-1,-1],this.ctx.autofill.yArr=[-1,-1],setTimeout(()=>{this.ctx.disableHoverIconClick=!1},0))}setAutofill(e,t){const{ENABLE_AUTOFILL:i,ENABLE_AUTOFILL_SPAN_COL:s,ENABLE_AUTOFILL_SPAN_ROW:o}=this.ctx.config;if(!i)return;let n=e,a=t;const c=this.ctx.selector.xArr,d=this.ctx.selector.yArr;if(!(!o&&JSON.stringify(d)!==JSON.stringify(a))&&!(!s&&JSON.stringify(c)!==JSON.stringify(n))&&(JSON.stringify(this.ctx.autofill.xArr)!==JSON.stringify(n)||JSON.stringify(this.ctx.autofill.yArr)!==JSON.stringify(a))){const{SELECTOR_AREA_MIN_X:f,SELECTOR_AREA_MAX_X:u,SELECTOR_AREA_MIN_Y:g,SELECTOR_AREA_MAX_Y:v,SELECTOR_AREA_MAX_X_OFFSET:x,SELECTOR_AREA_MAX_Y_OFFSET:m}=this.ctx.config,p=f,E=u||this.ctx.maxColIndex-x,C=g,w=v||this.ctx.maxRowIndex-m;let[_,S]=n,[B,K]=a;if(_<p||B<C)return;n=[Math.max(p,_),Math.min(E,S)],a=[Math.max(C,B),Math.min(w,K)];const{BEFORE_SET_AUTOFILL_METHOD:R}=this.ctx.config;if(typeof R=="function"){const I=R({focusCell:this.ctx.focusCell,xArr:n,yArr:a});if(!I)return;n=I.xArr,a=I.yArr}this.ctx.autofill.xArr=n,this.ctx.autofill.yArr=a,this.ctx.emit("setAutofill",this.ctx.autofill),this.ctx.emit("draw")}}async autofillData(){const e=new Set,t=this.ctx.getSelectedData(),i=new Map;for(let v=0;v<=t.yArr[1]-t.yArr[0];v++)for(let x=0;x<=t.xArr[1]-t.xArr[0];x++){const m=v+t.yArr[0],p=x+t.xArr[0];i.set(`${m}-${p}`,!0)}const{value:s}=t,o=s[0].length,n=s.length,a=this.ctx.autofill.xArr,c=this.ctx.autofill.yArr,d=o===1&&n===1;if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(a,c)&&!d){const v={code:"ERR_MERGED_CELLS_AUTOFILL",message:"Merged cells cannot span autofill data"};this.ctx.hasEvent("error")?this.ctx.emit("error",v):alert(v.message);return}let f=[];for(let v=0;v<=c[1]-c[0];v++)for(let x=0;x<=a[1]-a[0];x++){const m=x+a[0],p=v+c[0],E=s[v%n][x%o],C=this.ctx.database.getItemValueForRowIndexAndColIndex(p,m),w=`${p}-${m}`;if(C&&!i.has(w)){const{rowKey:_,key:S}=C;this.ctx.database.getReadonly(_,S)||(e.add(_),f.push({rowKey:_,key:S,value:E,row:{}}))}}if(!f.length)return;this.ctx.selector.xArr=this.ctx.autofill.xArr,this.ctx.selector.yArr=this.ctx.autofill.yArr;const{BEFORE_AUTOFILL_DATA_METHOD:u}=this.ctx.config;if(typeof u=="function"){const v=u,x=f.map(m=>({rowKey:m.rowKey,key:m.key,value:m.value,oldValue:this.ctx.database.getItemValue(m.rowKey,m.key),row:this.ctx.database.getRowDataItemForRowKey(m.rowKey)}));if(f=await v(x,a,c),f&&!f.length)return}this.ctx.batchSetItemValueByEditor(f,!0);let g=[];e.forEach(v=>{g.push(this.ctx.database.getRowDataItemForRowKey(v))}),this.ctx.emit("autofillChange",f,g),this.ctx.emit("draw")}mouseenter(e){if(["index","selection","index-selection"].includes(e.type))return;const{selector:t,autofill:i}=this.ctx;if(this.ctx.mousedown&&t.enable&&i.enable){const{rowIndex:s,colIndex:o}=e,n=t.xArr.slice(),a=t.yArr.slice();s>=t.yArr[0]&&s<=t.yArr[1]?o>t.xArr[1]?n.splice(1,1,o):o<t.xArr[0]&&n.splice(0,1,o):s>t.yArr[1]?a.splice(1,1,s):s<t.yArr[0]&&a.splice(0,1,s),this.setAutofill(n,a)}}destroy(){}}const Rt=Math.min,ct=Math.max,Ii=Math.round,pi=Math.floor,Te=r=>({x:r,y:r}),QC={left:"right",right:"left",bottom:"top",top:"bottom"},jC={start:"end",end:"start"};function vr(r,e,t){return ct(r,Rt(e,t))}function ti(r,e){return typeof r=="function"?r(e):r}function ht(r){return r.split("-")[0]}function ii(r){return r.split("-")[1]}function il(r){return r==="x"?"y":"x"}function Vr(r){return r==="y"?"height":"width"}const eb=new Set(["top","bottom"]);function Je(r){return eb.has(ht(r))?"y":"x"}function Wr(r){return il(Je(r))}function tb(r,e,t){t===void 0&&(t=!1);const i=ii(r),s=Wr(r),o=Vr(s);let n=s==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(n=Si(n)),[n,Si(n)]}function ib(r){const e=Si(r);return[xr(r),e,xr(e)]}function xr(r){return r.replace(/start|end/g,e=>jC[e])}const Ho=["left","right"],Fo=["right","left"],rb=["top","bottom"],sb=["bottom","top"];function ob(r,e,t){switch(r){case"top":case"bottom":return t?e?Fo:Ho:e?Ho:Fo;case"left":case"right":return e?rb:sb;default:return[]}}function nb(r,e,t,i){const s=ii(r);let o=ob(ht(r),t==="start",i);return s&&(o=o.map(n=>n+"-"+s),e&&(o=o.concat(o.map(xr)))),o}function Si(r){return r.replace(/left|right|bottom|top/g,e=>QC[e])}function ab(r){return{top:0,right:0,bottom:0,left:0,...r}}function rl(r){return typeof r!="number"?ab(r):{top:r,right:r,bottom:r,left:r}}function Ti(r){const{x:e,y:t,width:i,height:s}=r;return{width:i,height:s,top:t,left:e,right:e+i,bottom:t+s,x:e,y:t}}function Ko(r,e,t){let{reference:i,floating:s}=r;const o=Je(e),n=Wr(e),a=Vr(n),c=ht(e),d=o==="y",f=i.x+i.width/2-s.width/2,u=i.y+i.height/2-s.height/2,g=i[a]/2-s[a]/2;let v;switch(c){case"top":v={x:f,y:i.y-s.height};break;case"bottom":v={x:f,y:i.y+i.height};break;case"right":v={x:i.x+i.width,y:u};break;case"left":v={x:i.x-s.width,y:u};break;default:v={x:i.x,y:i.y}}switch(ii(e)){case"start":v[n]-=g*(t&&d?-1:1);break;case"end":v[n]+=g*(t&&d?-1:1);break}return v}const lb=async(r,e,t)=>{const{placement:i="bottom",strategy:s="absolute",middleware:o=[],platform:n}=t,a=o.filter(Boolean),c=await(n.isRTL==null?void 0:n.isRTL(e));let d=await n.getElementRects({reference:r,floating:e,strategy:s}),{x:f,y:u}=Ko(d,i,c),g=i,v={},x=0;for(let m=0;m<a.length;m++){const{name:p,fn:E}=a[m],{x:C,y:w,data:_,reset:S}=await E({x:f,y:u,initialPlacement:i,placement:g,strategy:s,middlewareData:v,rects:d,platform:n,elements:{reference:r,floating:e}});f=C??f,u=w??u,v={...v,[p]:{...v[p],..._}},S&&x<=50&&(x++,typeof S=="object"&&(S.placement&&(g=S.placement),S.rects&&(d=S.rects===!0?await n.getElementRects({reference:r,floating:e,strategy:s}):S.rects),{x:f,y:u}=Ko(d,g,c)),m=-1)}return{x:f,y:u,placement:g,strategy:s,middlewareData:v}};async function sl(r,e){var t;e===void 0&&(e={});const{x:i,y:s,platform:o,rects:n,elements:a,strategy:c}=r,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:g=!1,padding:v=0}=ti(e,r),x=rl(v),m=a[g?u==="floating"?"reference":"floating":u],p=Ti(await o.getClippingRect({element:(t=await(o.isElement==null?void 0:o.isElement(m)))==null||t?m:m.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:d,rootBoundary:f,strategy:c})),E=u==="floating"?{x:i,y:s,width:n.floating.width,height:n.floating.height}:n.reference,C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),w=await(o.isElement==null?void 0:o.isElement(C))?await(o.getScale==null?void 0:o.getScale(C))||{x:1,y:1}:{x:1,y:1},_=Ti(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:E,offsetParent:C,strategy:c}):E);return{top:(p.top-_.top+x.top)/w.y,bottom:(_.bottom-p.bottom+x.bottom)/w.y,left:(p.left-_.left+x.left)/w.x,right:(_.right-p.right+x.right)/w.x}}const cb=r=>({name:"arrow",options:r,async fn(e){const{x:t,y:i,placement:s,rects:o,platform:n,elements:a,middlewareData:c}=e,{element:d,padding:f=0}=ti(r,e)||{};if(d==null)return{};const u=rl(f),g={x:t,y:i},v=Wr(s),x=Vr(v),m=await n.getDimensions(d),p=v==="y",E=p?"top":"left",C=p?"bottom":"right",w=p?"clientHeight":"clientWidth",_=o.reference[x]+o.reference[v]-g[v]-o.floating[x],S=g[v]-o.reference[v],B=await(n.getOffsetParent==null?void 0:n.getOffsetParent(d));let K=B?B[w]:0;(!K||!await(n.isElement==null?void 0:n.isElement(B)))&&(K=a.floating[w]||o.floating[x]);const R=_/2-S/2,I=K/2-m[x]/2-1,b=Rt(u[E],I),O=Rt(u[C],I),y=b,M=K-m[x]-O,D=K/2-m[x]/2+R,P=vr(y,D,M),Y=!c.arrow&&ii(s)!=null&&D!==P&&o.reference[x]/2-(D<y?b:O)-m[x]/2<0,V=Y?D<y?D-y:D-M:0;return{[v]:g[v]+V,data:{[v]:P,centerOffset:D-P-V,...Y&&{alignmentOffset:V}},reset:Y}}}),hb=function(r){return r===void 0&&(r={}),{name:"flip",options:r,async fn(e){var t,i;const{placement:s,middlewareData:o,rects:n,initialPlacement:a,platform:c,elements:d}=e,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:m=!0,...p}=ti(r,e);if((t=o.arrow)!=null&&t.alignmentOffset)return{};const E=ht(s),C=Je(a),w=ht(a)===a,_=await(c.isRTL==null?void 0:c.isRTL(d.floating)),S=g||(w||!m?[Si(a)]:ib(a)),B=x!=="none";!g&&B&&S.push(...nb(a,m,x,_));const K=[a,...S],R=await sl(e,p),I=[];let b=((i=o.flip)==null?void 0:i.overflows)||[];if(f&&I.push(R[E]),u){const D=tb(s,n,_);I.push(R[D[0]],R[D[1]])}if(b=[...b,{placement:s,overflows:I}],!I.every(D=>D<=0)){var O,y;const D=(((O=o.flip)==null?void 0:O.index)||0)+1,P=K[D];if(P&&(!(u==="alignment"&&C!==Je(P))||b.every(V=>Je(V.placement)===C?V.overflows[0]>0:!0)))return{data:{index:D,overflows:b},reset:{placement:P}};let Y=(y=b.filter(V=>V.overflows[0]<=0).sort((V,W)=>V.overflows[1]-W.overflows[1])[0])==null?void 0:y.placement;if(!Y)switch(v){case"bestFit":{var M;const V=(M=b.filter(W=>{if(B){const z=Je(W.placement);return z===C||z==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(z=>z>0).reduce((z,Q)=>z+Q,0)]).sort((W,z)=>W[1]-z[1])[0])==null?void 0:M[0];V&&(Y=V);break}case"initialPlacement":Y=a;break}if(s!==Y)return{reset:{placement:Y}}}return{}}}},db=new Set(["left","top"]);async function ub(r,e){const{placement:t,platform:i,elements:s}=r,o=await(i.isRTL==null?void 0:i.isRTL(s.floating)),n=ht(t),a=ii(t),c=Je(t)==="y",d=db.has(n)?-1:1,f=o&&c?-1:1,u=ti(e,r);let{mainAxis:g,crossAxis:v,alignmentAxis:x}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof x=="number"&&(v=a==="end"?x*-1:x),c?{x:v*f,y:g*d}:{x:g*d,y:v*f}}const fb=function(r){return r===void 0&&(r=0),{name:"offset",options:r,async fn(e){var t,i;const{x:s,y:o,placement:n,middlewareData:a}=e,c=await ub(e,r);return n===((t=a.offset)==null?void 0:t.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:s+c.x,y:o+c.y,data:{...c,placement:n}}}}},gb=function(r){return r===void 0&&(r={}),{name:"shift",options:r,async fn(e){const{x:t,y:i,placement:s}=e,{mainAxis:o=!0,crossAxis:n=!1,limiter:a={fn:p=>{let{x:E,y:C}=p;return{x:E,y:C}}},...c}=ti(r,e),d={x:t,y:i},f=await sl(e,c),u=Je(ht(s)),g=il(u);let v=d[g],x=d[u];if(o){const p=g==="y"?"top":"left",E=g==="y"?"bottom":"right",C=v+f[p],w=v-f[E];v=vr(C,v,w)}if(n){const p=u==="y"?"top":"left",E=u==="y"?"bottom":"right",C=x+f[p],w=x-f[E];x=vr(C,x,w)}const m=a.fn({...e,[g]:v,[u]:x});return{...m,data:{x:m.x-t,y:m.y-i,enabled:{[g]:o,[u]:n}}}}}};function Yi(){return typeof window<"u"}function $t(r){return ol(r)?(r.nodeName||"").toLowerCase():"#document"}function ce(r){var e;return(r==null||(e=r.ownerDocument)==null?void 0:e.defaultView)||window}function $e(r){var e;return(e=(ol(r)?r.ownerDocument:r.document)||window.document)==null?void 0:e.documentElement}function ol(r){return Yi()?r instanceof Node||r instanceof ce(r).Node:!1}function ye(r){return Yi()?r instanceof Element||r instanceof ce(r).Element:!1}function Oe(r){return Yi()?r instanceof HTMLElement||r instanceof ce(r).HTMLElement:!1}function Po(r){return!Yi()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof ce(r).ShadowRoot}const mb=new Set(["inline","contents"]);function ri(r){const{overflow:e,overflowX:t,overflowY:i,display:s}=we(r);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!mb.has(s)}const vb=new Set(["table","td","th"]);function xb(r){return vb.has($t(r))}const pb=[":popover-open",":modal"];function Vi(r){return pb.some(e=>{try{return r.matches(e)}catch{return!1}})}const yb=["transform","translate","scale","rotate","perspective"],wb=["transform","translate","scale","rotate","perspective","filter"],Eb=["paint","layout","strict","content"];function Xr(r){const e=zr(),t=ye(r)?we(r):r;return yb.some(i=>t[i]?t[i]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||wb.some(i=>(t.willChange||"").includes(i))||Eb.some(i=>(t.contain||"").includes(i))}function Cb(r){let e=je(r);for(;Oe(e)&&!It(e);){if(Xr(e))return e;if(Vi(e))return null;e=je(e)}return null}function zr(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const bb=new Set(["html","body","#document"]);function It(r){return bb.has($t(r))}function we(r){return ce(r).getComputedStyle(r)}function Wi(r){return ye(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function je(r){if($t(r)==="html")return r;const e=r.assignedSlot||r.parentNode||Po(r)&&r.host||$e(r);return Po(e)?e.host:e}function nl(r){const e=je(r);return It(e)?r.ownerDocument?r.ownerDocument.body:r.body:Oe(e)&&ri(e)?e:nl(e)}function Xt(r,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const s=nl(r),o=s===((i=r.ownerDocument)==null?void 0:i.body),n=ce(s);if(o){const a=pr(n);return e.concat(n,n.visualViewport||[],ri(s)?s:[],a&&t?Xt(a):[])}return e.concat(s,Xt(s,[],t))}function pr(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function al(r){const e=we(r);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const s=Oe(r),o=s?r.offsetWidth:t,n=s?r.offsetHeight:i,a=Ii(t)!==o||Ii(i)!==n;return a&&(t=o,i=n),{width:t,height:i,$:a}}function Gr(r){return ye(r)?r:r.contextElement}function bt(r){const e=Gr(r);if(!Oe(e))return Te(1);const t=e.getBoundingClientRect(),{width:i,height:s,$:o}=al(e);let n=(o?Ii(t.width):t.width)/i,a=(o?Ii(t.height):t.height)/s;return(!n||!Number.isFinite(n))&&(n=1),(!a||!Number.isFinite(a))&&(a=1),{x:n,y:a}}const _b=Te(0);function ll(r){const e=ce(r);return!zr()||!e.visualViewport?_b:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Rb(r,e,t){return e===void 0&&(e=!1),!t||e&&t!==ce(r)?!1:e}function dt(r,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const s=r.getBoundingClientRect(),o=Gr(r);let n=Te(1);e&&(i?ye(i)&&(n=bt(i)):n=bt(r));const a=Rb(o,t,i)?ll(o):Te(0);let c=(s.left+a.x)/n.x,d=(s.top+a.y)/n.y,f=s.width/n.x,u=s.height/n.y;if(o){const g=ce(o),v=i&&ye(i)?ce(i):i;let x=g,m=pr(x);for(;m&&i&&v!==x;){const p=bt(m),E=m.getBoundingClientRect(),C=we(m),w=E.left+(m.clientLeft+parseFloat(C.paddingLeft))*p.x,_=E.top+(m.clientTop+parseFloat(C.paddingTop))*p.y;c*=p.x,d*=p.y,f*=p.x,u*=p.y,c+=w,d+=_,x=ce(m),m=pr(x)}}return Ti({width:f,height:u,x:c,y:d})}function Ur(r,e){const t=Wi(r).scrollLeft;return e?e.left+t:dt($e(r)).left+t}function cl(r,e,t){t===void 0&&(t=!1);const i=r.getBoundingClientRect(),s=i.left+e.scrollLeft-(t?0:Ur(r,i)),o=i.top+e.scrollTop;return{x:s,y:o}}function Ib(r){let{elements:e,rect:t,offsetParent:i,strategy:s}=r;const o=s==="fixed",n=$e(i),a=e?Vi(e.floating):!1;if(i===n||a&&o)return t;let c={scrollLeft:0,scrollTop:0},d=Te(1);const f=Te(0),u=Oe(i);if((u||!u&&!o)&&(($t(i)!=="body"||ri(n))&&(c=Wi(i)),Oe(i))){const v=dt(i);d=bt(i),f.x=v.x+i.clientLeft,f.y=v.y+i.clientTop}const g=n&&!u&&!o?cl(n,c,!0):Te(0);return{width:t.width*d.x,height:t.height*d.y,x:t.x*d.x-c.scrollLeft*d.x+f.x+g.x,y:t.y*d.y-c.scrollTop*d.y+f.y+g.y}}function Sb(r){return Array.from(r.getClientRects())}function Tb(r){const e=$e(r),t=Wi(r),i=r.ownerDocument.body,s=ct(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),o=ct(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let n=-t.scrollLeft+Ur(r);const a=-t.scrollTop;return we(i).direction==="rtl"&&(n+=ct(e.clientWidth,i.clientWidth)-s),{width:s,height:o,x:n,y:a}}function Ob(r,e){const t=ce(r),i=$e(r),s=t.visualViewport;let o=i.clientWidth,n=i.clientHeight,a=0,c=0;if(s){o=s.width,n=s.height;const d=zr();(!d||d&&e==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}return{width:o,height:n,x:a,y:c}}const kb=new Set(["absolute","fixed"]);function Lb(r,e){const t=dt(r,!0,e==="fixed"),i=t.top+r.clientTop,s=t.left+r.clientLeft,o=Oe(r)?bt(r):Te(1),n=r.clientWidth*o.x,a=r.clientHeight*o.y,c=s*o.x,d=i*o.y;return{width:n,height:a,x:c,y:d}}function Yo(r,e,t){let i;if(e==="viewport")i=Ob(r,t);else if(e==="document")i=Tb($e(r));else if(ye(e))i=Lb(e,t);else{const s=ll(r);i={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return Ti(i)}function hl(r,e){const t=je(r);return t===e||!ye(t)||It(t)?!1:we(t).position==="fixed"||hl(t,e)}function Db(r,e){const t=e.get(r);if(t)return t;let i=Xt(r,[],!1).filter(a=>ye(a)&&$t(a)!=="body"),s=null;const o=we(r).position==="fixed";let n=o?je(r):r;for(;ye(n)&&!It(n);){const a=we(n),c=Xr(n);!c&&a.position==="fixed"&&(s=null),(o?!c&&!s:!c&&a.position==="static"&&s&&kb.has(s.position)||ri(n)&&!c&&hl(r,n))?i=i.filter(d=>d!==n):s=a,n=je(n)}return e.set(r,i),i}function $b(r){let{element:e,boundary:t,rootBoundary:i,strategy:s}=r;const o=[...t==="clippingAncestors"?Vi(e)?[]:Db(e,this._c):[].concat(t),i],n=o[0],a=o.reduce((c,d)=>{const f=Yo(e,d,s);return c.top=ct(f.top,c.top),c.right=Rt(f.right,c.right),c.bottom=Rt(f.bottom,c.bottom),c.left=ct(f.left,c.left),c},Yo(e,n,s));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Mb(r){const{width:e,height:t}=al(r);return{width:e,height:t}}function Ab(r,e,t){const i=Oe(e),s=$e(e),o=t==="fixed",n=dt(r,!0,o,e);let a={scrollLeft:0,scrollTop:0};const c=Te(0);function d(){c.x=Ur(s)}if(i||!i&&!o)if(($t(e)!=="body"||ri(s))&&(a=Wi(e)),i){const v=dt(e,!0,o,e);c.x=v.x+e.clientLeft,c.y=v.y+e.clientTop}else s&&d();o&&!i&&s&&d();const f=s&&!i&&!o?cl(s,a):Te(0),u=n.left+a.scrollLeft-c.x-f.x,g=n.top+a.scrollTop-c.y-f.y;return{x:u,y:g,width:n.width,height:n.height}}function hr(r){return we(r).position==="static"}function Vo(r,e){if(!Oe(r)||we(r).position==="fixed")return null;if(e)return e(r);let t=r.offsetParent;return $e(r)===t&&(t=t.ownerDocument.body),t}function dl(r,e){const t=ce(r);if(Vi(r))return t;if(!Oe(r)){let s=je(r);for(;s&&!It(s);){if(ye(s)&&!hr(s))return s;s=je(s)}return t}let i=Vo(r,e);for(;i&&xb(i)&&hr(i);)i=Vo(i,e);return i&&It(i)&&hr(i)&&!Xr(i)?t:i||Cb(r)||t}const Nb=async function(r){const e=this.getOffsetParent||dl,t=this.getDimensions,i=await t(r.floating);return{reference:Ab(r.reference,await e(r.floating),r.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function Bb(r){return we(r).direction==="rtl"}const Hb={convertOffsetParentRelativeRectToViewportRelativeRect:Ib,getDocumentElement:$e,getClippingRect:$b,getOffsetParent:dl,getElementRects:Nb,getClientRects:Sb,getDimensions:Mb,getScale:bt,isElement:ye,isRTL:Bb};function ul(r,e){return r.x===e.x&&r.y===e.y&&r.width===e.width&&r.height===e.height}function Fb(r,e){let t=null,i;const s=$e(r);function o(){var a;clearTimeout(i),(a=t)==null||a.disconnect(),t=null}function n(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),o();const d=r.getBoundingClientRect(),{left:f,top:u,width:g,height:v}=d;if(a||e(),!g||!v)return;const x=pi(u),m=pi(s.clientWidth-(f+g)),p=pi(s.clientHeight-(u+v)),E=pi(f),C={rootMargin:-x+"px "+-m+"px "+-p+"px "+-E+"px",threshold:ct(0,Rt(1,c))||1};let w=!0;function _(S){const B=S[0].intersectionRatio;if(B!==c){if(!w)return n();B?n(!1,B):i=setTimeout(()=>{n(!1,1e-7)},1e3)}B===1&&!ul(d,r.getBoundingClientRect())&&n(),w=!1}try{t=new IntersectionObserver(_,{...C,root:s.ownerDocument})}catch{t=new IntersectionObserver(_,C)}t.observe(r)}return n(!0),o}function yr(r,e,t,i){i===void 0&&(i={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=i,d=Gr(r),f=s||o?[...d?Xt(d):[],...Xt(e)]:[];f.forEach(E=>{s&&E.addEventListener("scroll",t,{passive:!0}),o&&E.addEventListener("resize",t)});const u=d&&a?Fb(d,t):null;let g=-1,v=null;n&&(v=new ResizeObserver(E=>{let[C]=E;C&&C.target===d&&v&&(v.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var w;(w=v)==null||w.observe(e)})),t()}),d&&!c&&v.observe(d),v.observe(e));let x,m=c?dt(r):null;c&&p();function p(){const E=dt(r);m&&!ul(m,E)&&t(),m=E,x=requestAnimationFrame(p)}return t(),()=>{var E;f.forEach(C=>{s&&C.removeEventListener("scroll",t),o&&C.removeEventListener("resize",t)}),u==null||u(),(E=v)==null||E.disconnect(),v=null,c&&cancelAnimationFrame(x)}}const Oi=fb,ki=gb,qr=hb,Kb=cb,Li=(r,e,t)=>{const i=new Map,s={platform:Hb,...t},o={...s.platform,_c:i};return lb(r,e,{...s,platform:o})};let Pb=class{constructor(r){h(this,"ctx"),h(this,"enable",!1),h(this,"contentEl"),h(this,"floatingEl"),h(this,"arrowEl"),this.ctx=r;const{TOOLTIP_BG_COLOR:e,TOOLTIP_TEXT_COLOR:t,TOOLTIP_ZINDEX:i,TOOLTIP_CUSTOM_STYLE:s,CSS_PREFIX:o}=this.ctx.config;this.contentEl=document.createElement("div"),this.arrowEl=document.createElement("div"),this.floatingEl=document.createElement("div"),this.floatingEl.className=`${o}-tooltip`,this.contentEl.className=`${o}-tooltip-content`,this.arrowEl.className=`${o}-tooltip-arrow`;const n={display:"none",position:"absolute",background:e,color:t,boxSizing:"border-box",zIndex:i,padding:"8px",borderRadius:"4px",fontSize:"12px",...s},a={position:"absolute",width:"10px",height:"10px",background:n.background,backgroundColor:n.backgroundColor,transform:"rotate(45deg)",zIndex:n.zIndex};Object.assign(this.arrowEl.style,a),Object.assign(this.floatingEl.style,n),this.floatingEl.appendChild(this.contentEl),this.floatingEl.appendChild(this.arrowEl),this.ctx.containerElement.appendChild(this.floatingEl),this.init()}init(){this.floatingEl.addEventListener("mouseleave",()=>{this.hide()}),this.ctx.on("mouseout",r=>{this.floatingEl.contains(r.relatedTarget)||this.hide()}),this.ctx.on("onScroll",()=>{this.hide()}),this.ctx.on("startEdit",()=>{this.hide()}),this.ctx.on("visibleCellHoverChange",(r,e)=>{this.floatingEl.contains(e.target)||(r.ellipsis||r.message)&&this.show(r)}),this.ctx.on("visibleCellMouseleave",(r,e)=>{this.floatingEl.contains(e.target)||this.hide()}),this.ctx.on("cellHeaderMouseleave",(r,e)=>{this.floatingEl.contains(e.target)||this.hide()}),this.ctx.on("cellHeaderHoverChange",(r,e)=>{this.floatingEl.contains(e.target)||r.ellipsis&&this.show(r)}),this.ctx.on("cellFooterMouseleave",(r,e)=>{this.floatingEl.contains(e.target)||this.hide()}),this.ctx.on("cellFooterHoverChange",(r,e)=>{this.floatingEl.contains(e.target)||r.ellipsis&&this.show(r)}),this.ctx.on("cellShowTooltip",(r,e)=>{this.show(r,e)}),this.ctx.on("cellHideTooltip",()=>{this.hide()})}show(r,e){if(this.ctx.contextMenuIng||!r.overflowTooltipShow||this.ctx.mousedown)return;this.floatingEl.style.display="block";let t=r.getText();r.message&&(t=r.message),e&&(t=e);const i=this.ctx.containerElement.getBoundingClientRect();if(!i)return;this.enable=!0,this.contentEl.style.maxWidth=`${r.overflowTooltipMaxWidth||500}px`,this.contentEl.style.minWidth="100px",this.contentEl.style.width="100%",this.contentEl.style.display="inline-block",this.contentEl.style.wordBreak="break-all",this.contentEl.style.lineHeight="1.5",this.contentEl.innerText=t;const s=r.drawX+i.x,o=r.drawY+i.y;Li({getBoundingClientRect(){return{width:r.visibleWidth,height:r.visibleHeight,x:s,y:o,left:s,right:s+r.visibleWidth,top:o,bottom:o+r.visibleHeight}}},this.floatingEl,{placement:r.overflowTooltipPlacement,middleware:[ki(),qr(),Oi(6),Kb({element:this.arrowEl})]}).then(n=>{const{x:a,y:c,placement:d,middlewareData:f}=n;if(Object.assign(this.floatingEl.style,{top:`${c}px`,left:`${a}px`}),f.arrow){const u=f.arrow;["left","left-start","left-end"].includes(d)?Object.assign(this.arrowEl.style,{top:`${u.y}px`,bottom:"",left:"",right:"-5px"}):["right","right-start","right-end"].includes(d)?Object.assign(this.arrowEl.style,{top:`${u.y}px`,bottom:"",left:"-5px",right:""}):["bottom","bottom-start","bottom-end"].includes(d)?Object.assign(this.arrowEl.style,{top:"-5px",bottom:"",left:`${u.x}px`,right:""}):["top","top-start","top-end"].includes(d)&&Object.assign(this.arrowEl.style,{top:"",bottom:"-5px",left:`${u.x}px`,right:""})}})}hide(){this.enable&&(this.enable=!1,this.floatingEl.style.display="none")}destroy(){this.contentEl.remove(),this.arrowEl.remove(),this.floatingEl.remove()}};class Yb{constructor(e){h(this,"editorEl"),h(this,"inputEl"),h(this,"enable",!1),h(this,"cellTarget",null),h(this,"selectorArrStr",""),h(this,"ctx"),h(this,"drawY",0),h(this,"drawX",0),h(this,"cancel",!1),this.ctx=e,this.initTextEditor(),this.init()}init(){this.ctx.on("outsideMousedown",()=>{this.cellTarget&&this.cellTarget.editorType==="text"&&this.clearEditor()}),this.ctx.on("moveFocus",e=>{this.cellTarget=e;const{xArr:t,yArr:i}=this.ctx.selector;this.selectorArrStr=JSON.stringify(t)+JSON.stringify(i)}),this.ctx.on("onScroll",()=>{this.enable&&this.doneEdit()}),this.ctx.on("hoverIconClick",e=>{this.ctx.disableHoverIconClick||this.editCell(e.rowIndex,e.colIndex)}),this.ctx.on("cellMousedown",()=>{this.inputEl.focus({preventScroll:!0})}),this.ctx.on("keydown",e=>{if(!this.ctx.isTarget(e)||!this.ctx.focusCell||this.ctx.finding)return;if(e.code==="Escape"&&this.ctx.editing){this.cancel=!0;const{focusCell:a}=this.ctx;a&&(this.ctx.emit("setSelectorCell",a),this.cellTarget=a),this.doneEdit();return}if((e.altKey||e.metaKey)&&e.key==="Enter"&&this.ctx.editing&&this.inputEl){e.preventDefault();const a=this.inputEl.selectionStart,c=this.inputEl.value.substring(0,a),d=this.inputEl.value.substring(a);this.inputEl.value=c+`
|
|
5
|
+
`+d,this.inputEl.selectionStart=this.inputEl.selectionEnd=a+1,this.autoSize();return}if(e.code==="Tab"&&this.ctx.editing){if(e.preventDefault(),this.doneEdit(),e.shiftKey){this.ctx.emit("setMoveFocus","LEFT");return}this.ctx.emit("setMoveFocus","RIGHT");return}if(e.key==="Enter"&&this.ctx.editing){if(e.preventDefault(),this.doneEdit(),e.shiftKey){this.ctx.emit("setMoveFocus","TOP");return}this.ctx.emit("setMoveFocus","BOTTOM");return}if(e.key==="Enter"&&!this.ctx.editing){e.preventDefault(),this.startEdit();return}const t=e.key,i=e.ctrlKey,s=e.altKey,o=e.shiftKey,n=e.metaKey;i||s||o||n||["Enter","Escape","Tab","Backspace","Delete","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown","Insert","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"].includes(t)||this.startEdit(!0)}),this.ctx.on("cellMouseup",e=>{if(this.ctx.isPointer||!this.isInSelectorRange(e.rowIndex,e.colIndex))return;const{xArr:t,yArr:i}=this.ctx.selector,s=JSON.stringify(t)+JSON.stringify(i);if(this.selectorArrStr===s&&this.cellTarget){if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.onlyMergeCell){this.startEdit();return}if(this.ctx.selectOnlyOne&&e.rowKey===this.cellTarget.rowKey&&e.key===this.cellTarget.key){this.startEdit();return}}if(this.selectorArrStr=s,this.doneEdit(),this.cellTarget=e,this.ctx.config.ENABLE_EDIT_SINGLE_CLICK){if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.onlyMergeCell){this.startEdit();return}this.ctx.selectOnlyOne&&this.startEdit()}}),this.ctx.on("mousedownBodyOutside",()=>{this.enable&&this.doneEdit(),this.cellTarget=null})}isInSelectorRange(e,t){const{xArr:i,yArr:s}=this.ctx.selector,[o,n]=i,[a,c]=s;return!(t<o||t>n||e<a||e>c)}initTextEditor(){this.inputEl=document.createElement("textarea"),this.inputEl.id="e-virt-table-editor-textarea",this.inputEl.setAttribute("rows","1"),this.inputEl.setAttribute("tabindex","-1"),this.inputEl.addEventListener("input",this.autoSize.bind(this)),this.editorEl=this.ctx.editorElement,this.inputEl.className="e-virt-table-editor-textarea",this.editorEl.appendChild(this.inputEl),this.ctx.containerElement.appendChild(this.editorEl)}autoSize(){const e=this.inputEl.value;this.cellTarget&&this.cellTarget.type==="number"&&e!==""&&(this.ctx.emit("cellHideTooltip"),/^-?\d+(\.\d+)?$/.test(e)||this.ctx.emit("cellShowTooltip",this.cellTarget,this.ctx.config.NUMBER_ERROR_TIP)),this.inputEl.style.height="auto";let t=this.inputEl.scrollHeight,i=this.ctx.body.visibleHeight;t>i&&(t=i);const{stageHeight:s,footer:o,header:n,config:{SCROLLER_TRACK_SIZE:a}}=this.ctx,c=s-o.height-a;this.editorEl.style.bottom="auto",this.drawY<n.height&&(this.editorEl.style.top=`${n.height-1}px`),this.drawY+t>c&&(this.editorEl.style.left=`${this.drawX-1}px`,this.editorEl.style.top="auto",this.editorEl.style.bottom=`${s-c}px`),this.inputEl.style.height=`${t}px`}startEditByInput(e,t=!1){const i=t?null:e.getValue(),{editorType:s}=e;if(s==="none")return;e.update(),this.ctx.config.ENABLE_MERGE_CELL_LINK&&e.updateSpanInfo();let{height:o,width:n,drawY:a,drawX:c}=e;this.drawX=c,this.drawY=a;const{config:{CELL_PADDING:d},header:f}=this.ctx;let u=this.ctx.body.visibleHeight;o>u&&(o=u),this.editorEl.style.display="inline-block",this.editorEl.style.zIndex="100",this.editorEl.style.left=`${this.drawX-1}px`,this.editorEl.style.top=`${this.drawY-1}px`,this.editorEl.style.bottom="auto",this.editorEl.style.maxHeight=`${u}px`,s==="text"?(this.inputEl.style.display="inline-block",this.inputEl.style.minWidth=`${n-1}px`,this.inputEl.style.minHeight=`${o-1}px`,this.inputEl.style.maxHeight=`${u}px`,this.inputEl.style.width=`${n-1}px`,this.inputEl.style.height="auto",this.inputEl.style.padding=`${d}px`,this.inputEl.value="",i!==null&&(this.inputEl.value=i,this.inputEl.focus({preventScroll:!0}))):this.inputEl.style.display="none",(this.inputEl.scrollHeight>o||this.drawY<f.height)&&this.autoSize()}doneEditByInput(){if(this.cellTarget&&this.cellTarget.editorType==="text"){const{rowKey:e,key:t}=this.cellTarget,i=this.cellTarget.getValue(),s=this.inputEl.value;s!==i&&!(s===""&&i===null)&&!this.cancel&&this.ctx.setItemValueByEditor(e,t,s,!0)}}startEdit(e=!1){this.cancel=!1;const{ENABLE_EDIT_CLICK_SELECTOR:t}=this.ctx.config;if(!t)return;const i=this.ctx.focusCell;if(!i||["index","index-selection","selection"].includes(i.type)||this.enable||!(i.isVerticalVisible()&&i.isHorizontalVisible()))return;const{rowKey:s,key:o}=i,n=this.ctx.database.getReadonly(s,o);i&&!n&&(this.enable=!0,this.ctx.editing=!0,this.cellTarget=i,this.startEditByInput(this.cellTarget,e),this.ctx.emit("startEdit",this.cellTarget),this.ctx.emit("draw"))}editCell(e,t){const i=this.ctx.body.renderRows.find(d=>d.rowIndex===e);if(!i)return;const s=i.cells.find(d=>d.colIndex===t);if(!s)return;this.ctx.emit("setSelectorCell",s);const o=this.ctx.focusCell;if(!o||["index","index-selection","selection"].includes(o.type)||this.enable)return;const{rowKey:n,key:a}=o,c=this.ctx.database.getReadonly(n,a);o&&!c&&(this.enable=!0,this.ctx.editing=!0,this.cellTarget=o,this.startEditByInput(this.cellTarget),this.ctx.emit("startEdit",this.cellTarget),this.ctx.emit("draw"))}doneEdit(){if(!this.enable)return;const{header:e,config:{CELL_HEIGHT:t}}=this.ctx;this.doneEditByInput(),this.ctx.emit("cellHideTooltip"),this.ctx.emit("doneEdit",this.cellTarget),this.enable=!1,this.ctx.editing=!1,this.inputEl.style.display="inline-block",this.editorEl.style.left="0px",this.editorEl.style.top=`${e.height}px`,this.editorEl.style.maxHeight=`${t}px`,this.editorEl.style.zIndex="-1",setTimeout(()=>{this.inputEl.focus({preventScroll:!0})},0),this.ctx.emit("draw")}clearEditor(){this.doneEdit(),this.cellTarget=null,this.selectorArrStr="",this.ctx.clearSelector(),this.ctx.focusCell=void 0,this.ctx.emit("draw")}destroy(){var e;(e=this.editorEl)==null||e.remove()}}let Vb=class{constructor(r){h(this,"ctx"),h(this,"emptyEl"),this.ctx=r;const{EMPTY_TEXT:e,EMPTY_CUSTOM_STYLE:t}=this.ctx.config;this.ctx.emptyElement?this.emptyEl=this.ctx.emptyElement:(this.emptyEl=document.createElement("div"),this.emptyEl.innerText=e),this.emptyEl.className="e-virt-table-empty",this.emptyEl.style.display="none",this.ctx.containerElement.appendChild(this.emptyEl),this.ctx.on("emptyChange",({type:i,headerHeight:s,bodyHeight:o,footerHeight:n})=>{const a=s+(o+n)/2,c={display:i==="empty"?"block":"none",top:`${a}px`,...t};Object.assign(this.emptyEl.style,c)})}destroy(){this.emptyEl.remove()}};class Wb{constructor(e){h(this,"ctx"),h(this,"observer"),this.ctx=e,this.init()}arerMapsEqual(e,t){if(e.size!==t.size)return!1;for(let[i,s]of e)if(!t.has(i)||t.get(i)!==s)return!1;return!0}init(){this.observer=new MutationObserver(Kr(()=>{const e=this.ctx.overlayerElement.querySelectorAll('[data-auto-height="true"]'),t=new Map;e.forEach(s=>{const o=Number(s.getAttribute("data-row-index")),n=Number(s.getAttribute("data-col-index"));if(isNaN(o)||isNaN(n))return;const a=s.getBoundingClientRect(),c=`${o}_${n}`;t.set(c,Math.round(a.height))});const i=this.ctx.database.getOverlayerAutoHeightMap();if(!this.arerMapsEqual(i,t)){if(this.ctx.database.setOverlayerAutoHeightMap(t),i.size===0&&t.size===0)return;this.ctx.emit("draw")}},16.67)),this.observer.observe(this.ctx.overlayerElement,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),this.ctx.overlayerElement.getAttribute("data-overlayer")==="default"&&this.ctx.on("overlayerChange",e=>{const t=this.ctx.overlayerElement;t.replaceChildren(),Object.assign(t.style,e.style),e.views.forEach(i=>{const s=document.createElement("div");s.className=i.class,Object.assign(s.style,i.style),i.views.forEach(o=>{const n=document.createElement("div");Object.assign(n.style,o.style),o.cells.forEach(a=>{const c=document.createElement("div");Object.assign(c.style,a.style),Object.keys(a.domDataset).forEach(d=>{c.setAttribute(d,a.domDataset[d])}),typeof a.render=="function"&&a.render(c,a),n.appendChild(c)}),s.appendChild(n)}),t.appendChild(s)})})}draw(){const e=this.getContainer();this.ctx.emit("overlayerChange",e)}destroy(){this.observer&&this.observer.disconnect(),this.ctx.emit("overlayerChange",{style:{},views:[]})}getContainer(){const e=this.getHeader(),t=this.getBody(),i=this.getFooter();let s=[];const{FOOTER_FIXED:o,FOOTER_POSITION:n}=this.ctx.config;return o?n==="top"?s=[e,i,t]:s=[e,t,i]:s=[e,t],{views:s}}getHeader(){const{fixedLeftWidth:e,fixedRightWidth:t,config:{SCROLLER_TRACK_SIZE:i,CSS_PREFIX:s}}=this.ctx,{visibleWidth:o,visibleHeight:n,renderCellHeaders:a}=this.ctx.header;let c=[],d=[],f=[];a.forEach(m=>{m.render&&(m.fixed==="left"?d.push(m):m.fixed==="right"?f.push(m):c.push(m))});const u=t-i,g={key:"left",style:{position:"absolute",top:"0px",left:"0px",overflow:"hidden",width:`${e}px`,height:`${n}px`},cells:d},v={key:"center",style:{position:"absolute",top:"0px",left:`${e}px`,overflow:"hidden",width:`${o-e-u+1}px`,height:`${n}px`},cells:c},x={key:"right",style:{position:"absolute",top:"0px",right:"0px",overflow:"hidden",width:`${u+1}px`,height:`${n}px`},cells:f};return{type:"header",class:`${s}-overlayer-header`,style:{position:"relative",overflow:"hidden",width:`${o}px`,height:`${n}px`},views:[g,v,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(m=>{m.cells.forEach(p=>{p.cellType==="footer"&&(p.render=p.renderFooter),p.render&&(p.fixed==="left"?t.push(p):p.fixed==="right"?i.push(p):e.push(p))})});const{fixedLeftWidth:o,fixedRightWidth:n,config:{SCROLLER_TRACK_SIZE:a,CSS_PREFIX:c}}=this.ctx,{visibleWidth:d,visibleHeight:f}=this.ctx.body,u=n-a,g={key:"left",style:{position:"absolute",top:`${.5}px`,left:`${.5}px`,overflow:"hidden",width:`${o}px`,height:`${f}px`},cells:t},v={key:"center",style:{position:"absolute",top:`${.5}px`,left:`${o-.5}px`,overflow:"hidden",width:`${d-o-u}px`,height:`${f}px`},cells:e},x={key:"right",style:{position:"absolute",top:"0px",right:"0px",overflow:"hidden",width:`${u}px`,height:`${f}px`},cells:i};return{type:"body",class:`${c}-overlayer-body`,style:{position:"relative",overflow:"hidden",width:`${d}px`,height:`${f}px`},views:[g,v,x]}}getFooter(){const e=[],t=[],i=[];this.ctx.footer.renderRows.forEach(x=>{x.cells.forEach(m=>{m.cellType==="footer"&&m.renderFooter&&(m.render=m.renderFooter,m.fixed==="left"?t.push(m):m.fixed==="right"?i.push(m):e.push(m))})});const{fixedLeftWidth:s,fixedRightWidth:o,config:{SCROLLER_TRACK_SIZE:n,CSS_PREFIX:a}}=this.ctx,{visibleWidth:c,visibleHeight:d}=this.ctx.footer,f=o-n,u={key:"left",style:{position:"absolute",top:`${.5}px`,left:`${.5}px`,overflow:"hidden",width:`${s}px`,height:`${d}px`},cells:t},g={key:"center",style:{position:"absolute",top:`${.5}px`,left:`${s-.5}px`,overflow:"hidden",width:`${c-s-f}px`,height:`${d}px`},cells:e},v={key:"right",style:{position:"absolute",top:`${.5}px`,right:`${.5}px`,overflow:"hidden",width:`${f}px`,height:`${d}px`},cells:i};return{type:"footer",class:`${a}-overlayer-footer`,style:{position:"relative",overflow:"hidden",width:`${c}px`,height:`${d}px`},views:[u,g,v]}}}class Wo{constructor(e,t=[],i={}){h(this,"container"),h(this,"menuData"),h(this,"onClick"),h(this,"activeSubmenus",new Set),h(this,"boundMouseEnterHandler"),h(this,"boundMouseLeaveHandler"),h(this,"boundClickHandler"),this.container=e,this.menuData=t,this.onClick=i.onClick,this.boundMouseEnterHandler=s=>this.handleMouseEvent(s,"enter"),this.boundMouseLeaveHandler=s=>this.handleMouseEvent(s,"leave"),this.boundClickHandler=s=>this.handleClick(s),this.createMenu(),this.bindEvents()}createMenu(){this.container.className="e-virt-table-main-menu",this.container.style.display="block";const e=document.createDocumentFragment();this.menuData.forEach(t=>{e.appendChild(this.createMenuItem(t))}),this.container.appendChild(e)}createMenuItem(e,t=!1){var i;const s=this.createElement("div",t?"e-virt-table-submenu-item":"e-virt-table-menu-item");s.setAttribute(t?"data-submenu":"data-menu",e.value),e.disabled&&s.classList.add("disabled");const o=this.createElement("div","e-virt-table-menu-item-content");if(e.icon){const a=this.createElement("span","e-virt-table-menu-item-icon");a.innerHTML=e.icon,o.appendChild(a)}else o.classList.add("menu-item-no-icon");const n=this.createElement("span","e-virt-table-menu-item-text");if(n.textContent=e.label,o.appendChild(n),s.appendChild(o),(i=e.children)!=null&&i.length){const a=this.createElement("span","e-virt-table-menu-arrow");a.innerHTML=Ri,s.appendChild(a);const c=this.createSubmenu(e.children);s._submenu=c,this.container.appendChild(c)}return s}createSubmenu(e){const t=this.createElement("div","e-virt-table-submenu");return e.forEach(i=>{t.appendChild(this.createMenuItem(i,!0))}),t}createElement(e,t=""){const i=document.createElement(e);return t&&(i.className=t),i}bindEvents(){this.container.addEventListener("mouseenter",this.boundMouseEnterHandler,!0),this.container.addEventListener("mouseleave",this.boundMouseLeaveHandler,!0),this.container.addEventListener("click",this.boundClickHandler)}handleMouseEvent(e,t){e.stopPropagation();const i=e.target.closest(".e-virt-table-menu-item, .e-virt-table-submenu-item");i&&(this.container.contains(i)||i.classList.contains("e-virt-table-submenu-item"))&&(t==="enter"?this.handleHover(i):this.handleLeave(i))}handleHover(e){e.classList.contains("e-virt-table-menu-item")&&(this.container.querySelectorAll(".e-virt-table-menu-item").forEach(i=>i.classList.remove("active")),e.classList.contains("disabled")||e.classList.add("active"));const t=e._submenu||e.querySelector(".e-virt-table-submenu");t&&(this.hideSiblingSubmenus(e),this.showSubmenu(e,t))}handleLeave(e){const t=e._submenu||e.querySelector(".e-virt-table-submenu");setTimeout(()=>{const i=t;i&&!i.matches(":hover")&&!e.matches(":hover")&&(this.hideSubmenu(i),e.classList.contains("e-virt-table-menu-item")&&e.classList.remove("active"))},150)}hideSiblingSubmenus(e){let t;if(e.classList.contains("e-virt-table-menu-item"))t=this.container.querySelectorAll(".e-virt-table-menu-item");else{const i=e.closest(".e-virt-table-submenu");if(i)t=i.querySelectorAll(".e-virt-table-submenu-item");else return}t.forEach(i=>{i!==e&&i._submenu&&this.hideSubmenu(i._submenu)})}async showSubmenu(e,t){if(this.activeSubmenus.has(t))return;this.activeSubmenus.add(t),t.classList.add("show");const i=yr(e,t,async()=>{const s=this.container.getBoundingClientRect(),o=window.innerWidth,n=t.offsetWidth||200,a=o-s.right,c=s.left,d=a>=n||a>=c?"right-start":"left-start",{x:f,y:u}=await Li(e,t,{placement:d,middleware:[Oi(8),ki({padding:8})]});Object.assign(t.style,{left:`${f}px`,top:`${u}px`})});t._cleanup=i}hideSubmenu(e){if(!this.activeSubmenus.has(e))return;this.activeSubmenus.delete(e),e.classList.remove("show"),this.hideAllChildSubmenus(e);const t=e;t._cleanup&&(t._cleanup(),delete t._cleanup)}hideAllChildSubmenus(e){e.querySelectorAll(".e-virt-table-submenu-item").forEach(t=>{if(t._submenu){const i=t._submenu;if(this.activeSubmenus.has(i)){this.activeSubmenus.delete(i),i.classList.remove("show");const s=i;s._cleanup&&(s._cleanup(),delete s._cleanup),this.hideAllChildSubmenus(i)}}})}handleClick(e){e.stopPropagation();const t=e.target.closest(".e-virt-table-menu-item, .e-virt-table-submenu-item");if(!t||t.classList.contains("disabled"))return;if(t.classList.contains("e-virt-table-menu-item")){const o=t._submenu||t.querySelector(".e-virt-table-submenu");if(o){this.showSubmenu(t,o);return}}const i=t.getAttribute("data-menu")||(t==null?void 0:t.getAttribute("data-submenu")),s=this.findMenuItem(i||"");s&&(s.event&&s.event(e,this.hide.bind(this)),this.onClick&&this.onClick(s,i||""))}findMenuItem(e,t=this.menuData){for(const i of t){if(i.value===e)return i;if(i.children){const s=this.findMenuItem(e,i.children);if(s)return s}}return null}positionMenu(e){const t={getBoundingClientRect:()=>({width:0,height:0,top:e.clientY,left:e.clientX,right:e.clientX,bottom:e.clientY,x:e.clientX,y:e.clientY}),contextElement:document.body};yr(t,this.container,()=>{Li(t,this.container,{placement:"right-start",middleware:[Oi(),ki(),qr()]}).then(({x:i,y:s})=>{this.container&&Object.assign(this.container.style,{left:`${i}px`,top:`${s}px`})})})}hide(){this.cleanupAllSubmenus(this.container),this.container.style.display="none"}destroy(){this.container.removeEventListener("mouseenter",this.boundMouseEnterHandler,!0),this.container.removeEventListener("mouseleave",this.boundMouseLeaveHandler,!0),this.container.removeEventListener("click",this.boundClickHandler),this.cleanupAllSubmenus(this.container),this.container.style.display="none",this.container.replaceChildren()}removeMenuItem(e){const t=this.container.querySelector(`[data-menu="${e}"]`);if(!t)return!1;const i=t.querySelector(".e-virt-table-submenu");return i&&this.cleanupSubmenuRecursively(i),t.remove(),!0}removeSubMenuItem(e){const t=this.container.querySelector(`[data-submenu="${e}"]`);if(!t)return!1;const i=t.closest(".e-virt-table-submenu"),s=t._submenu;if(s&&this.cleanupSubmenuRecursively(s),t.remove(),i&&i.querySelectorAll(".e-virt-table-submenu-item").length===0){const o=this.container.querySelector("[data-menu]");if(o&&o._submenu===i)this.removeMenuItem(o.getAttribute("data-menu")||"");else{const n=this.container.querySelectorAll("[data-menu], [data-submenu]");for(const a of n)if(a._submenu===i){const c=a.getAttribute("data-menu")||a.getAttribute("data-submenu");c&&(a.hasAttribute("data-menu")?this.removeMenuItem(c):this.removeSubMenuItem(c));break}}}return!0}cleanupAllSubmenus(e){e.querySelectorAll(".e-virt-table-menu-item").forEach(t=>{t._submenu&&(this.cleanupSubmenuRecursively(t._submenu),t._submenu=void 0)})}cleanupSubmenuRecursively(e){const t=e;t._cleanup&&(t._cleanup(),delete t._cleanup),e.querySelectorAll(".e-virt-table-submenu-item").forEach(i=>{i._submenu&&this.cleanupSubmenuRecursively(i._submenu)}),e.remove()}}class Xb{constructor(e){h(this,"ctx"),h(this,"contextMenuEl"),h(this,"currentDOMTreeMenu"),h(this,"isCustom",!1),this.ctx=e,this.ctx.contextMenuElement?(this.contextMenuEl=this.ctx.contextMenuElement,this.contextMenuEl.className="e-virt-table-main-menu",this.isCustom=!0):(this.contextMenuEl=document.createElement("div"),this.isCustom=!1),this.ctx.containerElement.appendChild(this.contextMenuEl),this.init()}init(){this.ctx.on("outsideMousedown",()=>{this.hide()}),this.ctx.on("cellContextMenuClick",(e,t)=>{if(this.isCustom){this.contextMenuEl.style.display="block",this.positionMenu(t);return}const{ENABLE_CONTEXT_MENU:i,CUSTOM_BODY_CONTEXT_MENU:s,CONTEXT_MENU:o}=this.ctx.config,n=[...o,...s];if(!i||n.length===0)return;t.preventDefault();const{xArr:a,yArr:c}=this.ctx.selector,[d,f]=a,[u,g]=c,{rowIndex:v,colIndex:x}=e;v>=u&&v<=g&&x>=d&&x<=f||this.ctx.emit("setSelectorCell",e,t),this.currentDOMTreeMenu&&this.currentDOMTreeMenu.destroy(),this.ctx.contextMenuIng=!0,this.currentDOMTreeMenu=new Wo(this.contextMenuEl,n,{onClick:(m,p)=>{p==="copy"?(this.ctx.emit("contextMenuCopy"),this.hide()):p==="paste"?(this.ctx.emit("contextMenuPaste"),this.hide()):p==="cut"?(this.ctx.emit("contextMenuCut"),this.hide()):p==="clearSelected"&&(this.ctx.emit("contextMenuClearSelected"),this.hide())}}),this.currentDOMTreeMenu.positionMenu(t)}),this.ctx.on("cellHeaderContextMenuClick",(e,t)=>{if(this.isCustom){this.contextMenuEl.style.display="block",this.positionMenu(t);return}const{SELECTOR_AREA_MIN_X:i,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MAX_X_OFFSET:o}=this.ctx.config,n=i,a=s||this.ctx.maxColIndex-o;if(e.colIndex<n||e.colIndex>a)return;const{HEADER_CONTEXT_MENU:c,CUSTOM_HEADER_CONTEXT_MENU:d,ENABLE_HEADER_CONTEXT_MENU:f}=this.ctx.config,u=[...c,...d];if(!f||u.length===0)return;t.preventDefault();const{xArr:g}=this.ctx.selector,[v,x]=g,{colIndex:m}=e;m>=v&&m<=x||(this.ctx.focusCellHeader=e,this.ctx.emit("selectCols",e)),this.currentDOMTreeMenu&&this.currentDOMTreeMenu.destroy();const p=this.ctx.database.getColumns(),E=u.map(C=>C.value==="visible"?{...C,children:this.filterColumns(p)}:C);this.ctx.contextMenuIng=!0,this.currentDOMTreeMenu=new Wo(this.contextMenuEl,E,{onClick:(C,w)=>{const{xArr:_}=this.ctx.selector,[S,B]=_;if(w==="fixedLeft"||w==="fixedRight"||w==="fixedNone"){const K=this.ctx.header.allCellHeaders.filter(R=>R.colIndex>=S&&R.colIndex<=B).filter(R=>R.level===0).filter(R=>!R.column.fixedDisabled).map(R=>R.key);this.ctx.database.setCustomHeaderFixedData(K,w==="fixedLeft"?"left":w==="fixedRight"?"right":""),this.hide()}else if(w==="hide"){const K=this.ctx.header.leafCellHeaders.filter(R=>R.colIndex>=S&&R.colIndex<=B).filter(R=>!R.children.length).filter(R=>!R.column.hideDisabled).map(R=>R.key);K.length>0&&this.ctx.database.setCustomHeaderHideData(K,!0),this.hide()}else if(w!=="visible")if(w.startsWith("visible_")){if(!C.key)return;if(C.children){const R=this.getLeafKeys(C.children);this.ctx.database.setCustomHeaderHideData(R,!1)}else this.ctx.database.setCustomHeaderHideData([C.key],!1);this.currentDOMTreeMenu&&this.currentDOMTreeMenu.removeSubMenuItem(w);const K=this.ctx.database.getColumns();Wt(K).filter(R=>R.hide).length===0&&this.hide()}else w==="resetHeader"&&(this.ctx.database.resetCustomHeader(),this.hide())}}),this.positionMenu(t)}),this.ctx.on("click",()=>{this.hide()}),this.ctx.on("onScroll",this.hide.bind(this)),this.ctx.on("resize",this.hide.bind(this))}positionMenu(e){const t={getBoundingClientRect:()=>({width:0,height:0,top:e.clientY,left:e.clientX,right:e.clientX,bottom:e.clientY,x:e.clientX,y:e.clientY}),contextElement:document.body};yr(t,this.contextMenuEl,()=>{Li(t,this.contextMenuEl,{placement:"right-start",middleware:[Oi(),ki(),qr()]}).then(({x:i,y:s})=>{this.contextMenuEl&&Object.assign(this.contextMenuEl.style,{left:`${i}px`,top:`${s}px`})})})}filterColumns(e){const t=[];for(const i of e)if(i.children&&i.children.length>0){const s=this.filterColumns(i.children);s.length>0&&t.push({label:i.title,key:i.key,value:`visible_${i.key}`,children:s})}else i.hide&&t.push({label:i.title,value:`visible_${i.key}`,key:i.key});return t}getLeafKeys(e){return e.reduce((t,i)=>(!i.children||i.children.length===0?t.push(String(i.key)):t.push(...this.getLeafKeys(i.children)),t),[])}hide(){this.currentDOMTreeMenu&&(this.currentDOMTreeMenu.destroy(),this.currentDOMTreeMenu=void 0),this.contextMenuEl.style.display="none",this.ctx.contextMenuIng=!1}destroy(){var e;this.hide(),(e=this.contextMenuEl)==null||e.remove()}}class zb{constructor(e){if(h(this,"ctx"),h(this,"loadingEl"),this.ctx=e,this.ctx.loadingElement)this.loadingEl=this.ctx.loadingElement;else{this.loadingEl=document.createElement("div");const t=document.createElement("div");t.className="e-virt-table-loading-spinner";const i=this.ctx.icons.getSvg("loading");if(i){const o=new DOMParser().parseFromString(i.svg,"image/svg+xml").documentElement;t.appendChild(o)}const s=document.createElement("p");s.className="e-virt-table-loading-text",s.innerText=this.ctx.config.LOADING_TEXT,t.appendChild(s),this.loadingEl.appendChild(t)}this.loadingEl.className="e-virt-table-loading",this.loadingEl.style.display="none",this.ctx.containerElement.appendChild(this.loadingEl)}show(){this.loadingEl.style.display="flex"}hide(){this.loadingEl.style.display="none"}destroy(){this.loadingEl.remove()}}class Gb{constructor(e){h(this,"ctx"),h(this,"container"),h(this,"input"),h(this,"prevBtn"),h(this,"nextBtn"),h(this,"closeBtn"),h(this,"countEl"),h(this,"loadingEl"),h(this,"isVisible",!1),h(this,"searchResults",[]),h(this,"currentIndex",-1),h(this,"searchData",[]),h(this,"isComposing",!1),this.ctx=e,this.container=this.createContainer(),this.ctx.containerElement.appendChild(this.container),this.bindEvents(),this.ctx.on("keydown",t=>{if(this.ctx.config.ENABLE_FINDER&&!this.ctx.editing){if((t.ctrlKey||t.metaKey)&&t.code==="KeyF"){t.preventDefault(),this.show();return}if(this.ctx.finding){if(t.code==="Escape"){t.preventDefault(),this.hide();return}if(t.code==="ArrowUp"||t.shiftKey&&t.key==="Enter"){t.preventDefault(),this.navigatePrevious();return}if(t.code==="ArrowDown"||t.key==="Enter"){t.preventDefault(),this.navigateNext();return}}}}),this.ctx.on("setSelector",()=>{this.hide()}),this.ctx.on("outsideMousedown",()=>{this.hide()})}async initSearchData(){this.showLoading(),this.searchData=[],setTimeout(()=>{const{allCellHeaders:e}=this.ctx.header;for(let s=0;s<e.length;s++){const o=e[s];o&&["string","number"].includes(typeof o.text)&&this.searchData.push({rowIndex:0,colIndex:o.colIndex,text:`${o.text}`,type:"header",colKey:o.key})}const{maxColIndex:t,maxRowIndex:i}=this.ctx;for(let s=0;s<i;s++)for(let o=0;o<t;o++){const n=this.ctx.database.getVirtualBodyCell(s,o,!1),a=n==null?void 0:n.getText();["string","number"].includes(typeof a)&&this.searchData.push({rowIndex:s,colIndex:o,text:`${a}`,type:"body"})}this.hideLoading()},0)}createContainer(){const e=document.createElement("div");e.className="e-virt-table-finder-bar";const t=document.createElement("div");t.className="e-virt-table-finder-bar-input-wrapper",this.input=document.createElement("input"),this.input.type="text",this.input.className="e-virt-table-finder-bar-input",this.input.placeholder="",t.appendChild(this.input),this.loadingEl=document.createElement("div"),this.loadingEl.className="e-virt-table-finder-bar-loading";const i=el;this.loadingEl.innerHTML=i,t.appendChild(this.loadingEl),this.countEl=document.createElement("span"),this.countEl.className="e-virt-table-finder-bar-count";const s=document.createElement("div");return s.className="e-virt-table-finder-bar-nav",this.prevBtn=document.createElement("button"),this.prevBtn.className="e-virt-table-finder-bar-nav-btn prev-btn",this.prevBtn.innerHTML=Ri,this.nextBtn=document.createElement("button"),this.nextBtn.className="e-virt-table-finder-bar-nav-btn next-btn",this.nextBtn.innerHTML=Ri,s.appendChild(this.prevBtn),s.appendChild(this.nextBtn),this.closeBtn=document.createElement("button"),this.closeBtn.className="e-virt-table-finder-bar-nav-btn close-btn",this.closeBtn.innerHTML="×",e.appendChild(t),e.appendChild(this.countEl),e.appendChild(s),e.appendChild(this.closeBtn),e}bindEvents(){this.input.addEventListener("input",()=>{this.isComposing||this.performSearch()}),this.input.addEventListener("compositionstart",()=>{this.isComposing=!0}),this.input.addEventListener("compositionend",()=>{this.isComposing=!1,this.performSearch()}),this.prevBtn.addEventListener("click",()=>{this.navigatePrevious()}),this.nextBtn.addEventListener("click",()=>{this.navigateNext()}),this.closeBtn.addEventListener("click",()=>{this.hide()})}performSearch(){const e=this.input.value.trim();if(this.searchResults=[],this.currentIndex=-1,!e){this.cearFinderBar(),this.updateCount();return}this.showLoading(),setTimeout(()=>{this.searchResults=this.searchData.filter(t=>t.text.toLowerCase().includes(e.toLowerCase())),this.searchResults.length>0?(this.currentIndex=0,this.scrollToCurrentResult()):this.cearFinderBar(),this.updateCount(),this.hideLoading()},0)}scrollToCurrentResult(){if(this.currentIndex<0||this.currentIndex>=this.searchResults.length)return;const e=this.searchResults[this.currentIndex];this.ctx.finderBar=e;const{rowIndex:t,colIndex:i}=e;this.ctx.emit("scrollToIndex",t,i)}navigateNext(){this.searchResults.length!==0&&(this.currentIndex=(this.currentIndex+1)%this.searchResults.length,this.scrollToCurrentResult(),this.updateCount())}navigatePrevious(){this.searchResults.length!==0&&(this.currentIndex=this.currentIndex<=0?this.searchResults.length-1:this.currentIndex-1,this.scrollToCurrentResult(),this.updateCount())}updateCount(){if(this.searchResults.length===0)this.input.value.trim()?(this.countEl.textContent="0/0",this.countEl.classList.add("no-results")):(this.countEl.textContent="",this.countEl.classList.remove("no-results"));else{const e=this.currentIndex+1,t=this.searchResults.length;this.countEl.textContent=`${e}/${t}`,this.countEl.classList.remove("no-results")}}show(){this.isVisible||(this.isVisible=!0,this.ctx.finding=!0,this.container.classList.add("show"),this.input.focus(),this.initSearchData())}showLoading(){var e;this.loadingEl.classList.add("show"),(e=this.loadingEl.parentElement)==null||e.classList.add("loading"),this.input.readOnly=!0}hideLoading(){var e;this.loadingEl.classList.remove("show"),(e=this.loadingEl.parentElement)==null||e.classList.remove("loading"),this.input.readOnly=!1}cearFinderBar(){this.ctx.finderBar={rowIndex:-1,colIndex:-1,text:"",type:"header"},this.ctx.emit("draw")}hide(){this.isVisible&&(this.isVisible=!1,this.container.classList.remove("show"),this.ctx.finding=!1,this.input.value="",this.searchResults=[],this.searchData=[],this.currentIndex=-1,this.hideLoading(),this.ctx.finderBar={rowIndex:-1,colIndex:-1,text:"",type:"header"},this.updateCount(),this.ctx.emit("draw"))}destroy(){this.hide(),this.container.remove()}}class Ub{constructor(e,t){h(this,"options"),h(this,"scroller"),h(this,"header"),h(this,"body"),h(this,"footer"),h(this,"selector"),h(this,"autofill"),h(this,"tooltip"),h(this,"editor"),h(this,"empty"),h(this,"overlayer"),h(this,"contextMenu"),h(this,"loading"),h(this,"finderBar"),h(this,"animationFrameId"),h(this,"ctx"),this.options=t;const{overlayerElement:i,editorElement:s,emptyElement:o,contextMenuElement:n}=this.options,a=this.createContainer(e,i,s,o,n);this.ctx=new WC(a,this.options),this.header=new GC(this.ctx),this.footer=new qC(this.ctx),this.body=new UC(this.ctx),this.scroller=new XC(this.ctx),this.selector=new ZC(this.ctx),this.autofill=new JC(this.ctx),this.tooltip=new Pb(this.ctx),this.empty=new Vb(this.ctx),this.editor=new Yb(this.ctx),this.overlayer=new Wb(this.ctx),this.contextMenu=new Xb(this.ctx),this.loading=new zb(this.ctx),this.finderBar=new Gb(this.ctx),this.ctx.on("draw",()=>{this.draw()}),this.ctx.on("drawView",()=>{this.draw(!0)}),this.draw()}createContainer(e,t,i,s,o){e.className="e-virt-table-container";const n=document.createElement("div"),a=document.createElement("canvas"),c=t||document.createElement("div");n.className="e-virt-table-stage",e.tabIndex=0,a.className="e-virt-table-canvas",c.className="e-virt-table-overlayer",c.setAttribute("data-overlayer",t?"custom":"default");const d=i||document.createElement("div");d.className="e-virt-table-editor";const f=s,u=o;return n.appendChild(a),n.appendChild(c),e.appendChild(n),{containerElement:e,stageElement:n,canvasElement:a,overlayerElement:c,editorElement:d,emptyElement:f,contextMenuElement:u}}doDraw(e=!1){this.header.update(),this.footer.update(),this.body.update(),this.ctx.paint.clear(),this.body.draw(),this.footer.draw(),this.header.draw(),this.scroller.draw(),e||this.overlayer.draw()}draw(e=!1){this.animationFrameId&&cancelAnimationFrame(this.animationFrameId),this.animationFrameId=requestAnimationFrame(()=>{this.doDraw(e),this.body.updateAutoHeight()&&this.doDraw(e)})}loadConfig(e){this.ctx.config.init(e),this.ctx.database.init(!1),this.header.init(),this.ctx.emit("draw")}loadColumns(e){this.editor.doneEdit(),this.ctx.database.setColumns(e),this.header.init(),this.ctx.emit("draw")}loadData(e){this.editor.doneEdit(),this.ctx.database.setData(e),this.header.init(),this.tooltip.hide(),this.ctx.emit("draw")}loadFooterData(e){this.ctx.database.setFooterData(e),this.ctx.emit("draw")}setCustomHeader(e,t=!0){this.ctx.database.setCustomHeader(e,t),this.header.init(),this.ctx.emit("draw")}getCustomHeader(){return this.header.getCustomHeader()}showColumns(e,t=!0){this.ctx.database.setCustomHeaderHideData(e,!t),this.header.init(),this.ctx.emit("draw")}fixedColumns(e,t){this.ctx.database.setCustomHeaderFixedData(e,t),this.header.init(),this.ctx.emit("draw")}setLoading(e){this.ctx.loading=e,e?this.loading.show():this.loading.hide()}on(e,t){this.ctx.on(e,t)}emit(e,...t){this.ctx.emit(e,...t)}off(e,t){this.ctx.off(e,t)}filterMethod(e){this.ctx.database.setFilterMethod(e),this.ctx.database.init(!1),this.header.init(),this.ctx.emit("draw")}editCell(e,t){this.editor.editCell(e,t)}setItemValue(e,t,i,s=!0,o=!0,n=!1){this.ctx.database.setItemValue(e,t,i,s,o,n)}batchSetItemValue(e,t=!0){this.ctx.database.batchSetItemValue(e,t)}setItemValueByEditor(e,t,i,s=!0,o=!0){this.ctx.setItemValueByEditor(e,t,i,s,o),this.editor.doneEdit()}clearEditableData(e=null){const t=[0,this.ctx.maxColIndex],i=[0,this.ctx.maxRowIndex];return this.selector.clearSelectedData(t,i,!1,e)}clearEditor(){this.editor.clearEditor()}doLayout(){this.ctx.emit("draw")}getChangedData(){return this.ctx.database.getChangedData()}getChangedRows(){return this.ctx.database.getChangedRows()}setCurrentRowByRowIndex(e){this.ctx.currentCell=this.ctx.database.getVirtualBodyCell(e,0),this.ctx.emit("draw")}setCurrentRow(e){const t=this.ctx.database.getColumnByColIndex(0);t&&(this.ctx.currentCell=this.ctx.database.getVirtualBodyCellByKey(e,t.key),this.ctx.emit("draw"))}getCurrentRow(){const e=this.ctx.currentCell;return e?{row:e.row,rowIndex:e.rowIndex,rowKey:e.rowKey}:void 0}clearValidate(){this.ctx.database.clearValidate(),this.ctx.emit("draw")}validateFields(e,t=!0){return new Promise(async(i,s)=>{let o=[];for(let n=0;n<e.length;n++){const{rowKey:a,key:c}=e[n],d=await this.ctx.database.getValidator(a,c);Array.isArray(d)&&d.length&&o.push(d)}if(o.length){if(s(o),t){const[n]=o;if(Array.isArray(n)&&n.length){const[a]=n,{rowKey:c,key:d}=a;this.scrollToRowkey(c),this.scrollToColkey(d)}}this.ctx.emit("draw")}else i([]),this.ctx.emit("draw")})}async validate(e=!0){return new Promise(async(t,i)=>{try{const s=await this.getValidations();t(s)}catch(s){if(e&&Array.isArray(s)&&s.length){const[o]=s;if(Array.isArray(o)&&o.length){const[n]=o,{rowKey:a,key:c}=n,d=this.ctx.database.getRowForRowKey(a);if(d){const{parentRowKeys:f=[]}=d;f&&f.length&&this.setExpandRowKeys(f,!0)}this.scrollToRowkey(a),this.scrollToColkey(c)}}i(s)}})}setValidations(e){if(e.forEach(t=>{const{rowIndex:i,key:s,message:o,rowKey:n}=t;if(i!==void 0&&n===void 0){const a=this.ctx.database.getRowKeyForRowIndex(i);this.ctx.database.setValidationErrorByRowKey(a,s,o)}n&&this.ctx.database.setValidationErrorByRowKey(n,s,o)}),e&&Array.isArray(e)&&e.length){const[t]=e;if(t&&t.rowKey)this.scrollToRowkey(t.rowKey),this.scrollToColkey(t.key);else if(t&&t.rowIndex!==void 0&&t.rowIndex>=0&&t.key){const{rowIndex:i,key:s}=t;this.scrollToRowIndex(i),this.scrollToColkey(s)}}}getValidations(){return new Promise(async(e,t)=>{const i=this.ctx.database.getAllRowsData(),s=this.ctx.header.leafCellHeaders;let o=[];for(let n=0;n<i.length;n++)for(let a=0;a<s.length;a++){const c=this.ctx.database.getRowKeyByItem(i[n]),d=s[a].key,f=await this.ctx.database.getValidator(c,d);Array.isArray(f)&&f.length&&o.push(f)}o.length?(t(o),this.ctx.emit("draw")):(e([]),this.ctx.emit("draw"))})}hasValidationError(){return this.ctx.database.hasValidationError()}scrollTo(e,t){this.scroller.setScroll(e,t)}scrollXTo(e){this.scroller.setScrollX(e)}scrollToColkey(e){this.scroller.scrollToColkey(e)}scrollToRowkey(e){this.scroller.scrollToRowKey(e)}scrollToColIndex(e){this.scroller.scrollToColIndex(e)}scrollToRowIndex(e){this.scroller.scrollToRowIndex(e)}scrollYTo(e){this.scroller.setScrollY(e)}setExpandRowKeys(e,t=!0){this.ctx.database.setExpandRowKeys(e,t)}getExpandRowKeys(){return this.ctx.database.getExpandRowKeys()}clearSelection(){this.ctx.database.clearSelection(),this.ctx.emit("draw")}toggleRowSelection(e){const t=this.ctx.database.getRowKeyByItem(e);this.ctx.database.toggleRowSelection(t),this.ctx.emit("draw")}setSelectionByRows(e,t=!0){e.forEach(i=>{const s=this.ctx.database.getRowKeyByItem(i);this.ctx.database.setRowSelection(s,t,!1)}),this.ctx.emit("selectionChange",this.getSelectionRows()),this.ctx.emit("draw")}setSelectionByRowKeys(e,t=!0){e.forEach(i=>{this.ctx.database.setRowSelection(i,t,!1)}),this.ctx.emit("selectionChange",this.getSelectionRows()),this.ctx.emit("draw")}toggleAllSelection(){this.ctx.database.toggleAllSelection(),this.ctx.emit("draw")}toggleRowExpand(e,t){this.ctx.database.expandItem(e,t),this.ctx.emit("draw")}toggleExpandAll(e){this.ctx.database.expandAll(e),this.ctx.emit("draw")}getSelectionRows(){return this.ctx.database.getSelectionRows()}getPositionForRowIndex(e){return this.ctx.database.getPositionForRowIndex(e)}getCellValue(e,t){return this.ctx.database.getItemValue(e,t)}getCellValueByIndex(e,t){return this.ctx.database.getItemValueForRowIndexAndColIndex(e,t)}clearSort(){this.ctx.database.clearSort()}contextMenuHide(){this.contextMenu.hide()}getUtils(){return{mergeColCell:DC,mergeRowCell:LC,getSpanArrByRow:Ja,getSpanObjByColumn:Qa}}getColumnByKey(e){var t;return(t=this.ctx.database.getColumnByKey(e))==null?void 0:t.column}clearChangeData(){this.ctx.database.clearChangeData(),this.ctx.emit("draw")}destroy(){this.overlayer.destroy(),this.empty.destroy(),this.editor.destroy(),this.tooltip.destroy(),this.selector.destroy(),this.autofill.destroy(),this.contextMenu.destroy(),this.loading.destroy(),this.finderBar.destroy(),this.ctx.destroy(),this.ctx.containerElement.remove()}}const qb=l.defineComponent((r,{emit:e})=>{const{cellRender:t,renderTableParams:i}=r,{row:s,field:o}=i;if(o){const n=l.ref(s[o]);return()=>{var a,c;return((c=(a=Vt.renders[t.name])==null?void 0:a.renderEdit)==null?void 0:c.call(a,n,t,i,e))??null}}else return()=>null},{name:"RenderEditCell",props:["cellRender","renderTableParams"],emits:["blur"]}),Zr=l.defineComponent({__name:"PCanvasTable",props:{columns:{},data:{},config:{default:()=>({})},footerData:{},loading:{type:Boolean}},emits:["change","selectionChange","ready"],setup(r,{expose:e,emit:t}){const i=t,s=l.ref([]),o=r,n=Ya(),a=l.computed(()=>({...o,config:{AUTO_ROW_HEIGHT:!0,DISABLED:!0,...n,...o.config}}));let c=null;const d=l.useAttrs(),f=l.ref(null),u=l.ref(null),g=l.ref(null),v=l.ref(null),x=l.ref(),m=l.ref("text"),p=l.ref(),E={},C={},w=l.computed(()=>{const y=x.value;return y?{width:`${y.width}px`,height:`${y.height}px`}:{}}),_=y=>Ct[y]||(({cellValue:M})=>M),S=y=>{var M;return(M=Vt.renders[y])==null?void 0:M.renderDefault},B=(y,...M)=>({row:D,rowIndex:P,value:Y})=>y({row:D,rowIndex:P,cellValue:Y},...M),K=y=>{var M,D,P,Y,V;if((M=y.slots)!=null&&M.default&&T.isFunction((D=y.slots)==null?void 0:D.default))return W=>{var z,Q;return(Q=(z=y.slots)==null?void 0:z.default)==null?void 0:Q.call(z,{row:W.row,column:y,rowIndex:W.rowIndex})};if((P=y.slots)!=null&&P.default&&T.isString((Y=y.slots)==null?void 0:Y.default))return`slot:${(V=y.slots)==null?void 0:V.default}`;if(y.cellRender&&y.cellRender.name)return W=>{var z,Q;return(Q=S(y.cellRender.name))==null?void 0:Q(y.cellRender,{data:o.data,row:W.row,rowIndex:W.rowIndex,field:y.field||W.column.key,title:((z=W.column)==null?void 0:z.title)??""},{})}},R=y=>{var M,D;if((M=y.slots)!=null&&M.title&&T.isFunction((D=y.slots)==null?void 0:D.title))return P=>{var Y,V;return(V=(Y=y.slots)==null?void 0:Y.title)==null?void 0:V.call(Y,{column:y})}},I=y=>{var M,D,P,Y,V,W,z;return(M=y.slots)!=null&&M.edit&&(y.field||y.key)&&T.isFunction((D=y.slots)==null?void 0:D.edit)?E[`__slot:${y.field||y.key}`]=y:(P=y.editRender)!=null&&P.name&&(y.field||y.key)&&(C[y.field||y.key]=y.editRender),{...T.omit(y,["formatter"]),key:y.key||y.field||He(),formatter:T.isString(y.formatter)?B(_(y.formatter)):T.isArray(y.formatter)&&T.isString(y.formatter[0])?B(_(y.formatter[0]),...y.formatter.slice(1)):T.isFunction(y.formatter)?B(y.formatter):void 0,editorType:y.editorType??((Y=y.slots)!=null&&Y.edit&&(y.field||y.key)&&T.isFunction((V=y.slots)==null?void 0:V.edit)?`__slot:${y.field||y.key}`:(W=y.editRender)!=null&&W.name?y.editRender.name:void 0),render:K(y),renderHeader:R(y),children:(z=y.children)==null?void 0:z.map(Q=>I(Q))}};l.onMounted(()=>{f.value&&(c=new Ub(f.value,{config:a.value.config,columns:o.columns.map(y=>I(y)),data:o.data,footerData:o.footerData,emptyElement:g.value||void 0,overlayerElement:v.value||void 0,editorElement:u.value||void 0}),Object.keys(d).forEach(y=>{const M=d[y];if(typeof M=="function"&&y.startsWith("on")){const D=y.charAt(2).toLowerCase()+y.slice(3);c==null||c.on(D,M)}}),c.on("change",y=>{i("change",y)}),c.on("overlayerChange",y=>{p.value=y,console.log("overlayerChange",y)}),c.on("startEdit",y=>{x.value=y,m.value=y.editorType,m.value}),c.on("doneEdit",()=>{m.value="text"}),c.on("selectionChange",y=>{s.value=y,i("selectionChange",y)}),i("ready",c))});function b(y){if(!c||!x.value)return;const{rowKey:M,key:D}=x.value;c==null||c.setItemValueByEditor(M,D,y)}const O=()=>document.body;return l.watch(()=>o.data,y=>{c==null||c.loadData(y)},{deep:!0}),Ar(()=>o.columns,(y,M)=>{T.isEqual(y,M)||c==null||c.loadColumns(y.map(D=>I(D)))},{deep:!0}),l.watch(()=>a.value.config,y=>{c==null||c.loadConfig(y)},{deep:!0}),l.watch(()=>o.footerData,y=>{c==null||c.loadFooterData(y||[])},{deep:!0}),l.watch(()=>o.loading,(y,M)=>{y!==M&&(c==null||c.setLoading(y))},{immediate:!0}),e({$table:c,selectedRecords:l.computed(()=>s.value),reloadData:()=>{c==null||c.loadData(o.data)}}),(y,M)=>{const D=l.resolveComponent("a-empty"),P=l.resolveComponent("a-spin");return l.openBlock(),l.createBlock(P,{spinning:y.loading},{default:l.withCtx(()=>{var Y,V,W,z,Q,te,Ve;return[l.createElementVNode("div",{ref_key:"eVirtTableRef",ref:f},[l.createElementVNode("div",{ref_key:"eVirtTableEditorRef",ref:u},[m.value.startsWith("__slot:")?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(E[m.value].slots.edit({row:x.value.row,column:E[m.value],rowIndex:x.value.rowIndex})),{key:0,bordered:!1,style:l.normalizeStyle(w.value),class:"ev-editor-wrapper","get-popup-container":O,value:x.value.value,"onUpdate:value":M[0]||(M[0]=be=>x.value.value=be),cell:x.value,onBlur:b},null,40,["style","value","cell"])):(Y=l.unref(Vt).renders[m.value])!=null&&Y.renderEdit?(l.openBlock(),l.createBlock(l.unref(qb),{key:1,"cell-render":C[x.value.key],class:"ev-editor-wrapper",style:l.normalizeStyle(w.value),"render-table-params":{data:o.data,row:(V=x.value)==null?void 0:V.row,rowIndex:((W=x.value)==null?void 0:W.rowIndex)??-1,field:((z=x.value)==null?void 0:z.key)??"",title:((te=(Q=x.value)==null?void 0:Q.column)==null?void 0:te.title)??""},bordered:!1,"get-popup-container":O,onBlur:b},null,8,["cell-render","style","render-table-params"])):l.createCommentVNode("",!0)],512),l.createElementVNode("div",{ref_key:"eVirtTableEmptyRef",ref:g},[l.renderSlot(y.$slots,"empty",{},()=>[l.createVNode(D,{description:"空数据"})])],512),l.createElementVNode("div",{ref_key:"eVirtTableOverlayerRef",ref:v},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(((Ve=p.value)==null?void 0:Ve.views)||[],be=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(be.class),style:l.normalizeStyle(be.style),key:be.type},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(be.views,Me=>(l.openBlock(),l.createElementBlock("div",{style:l.normalizeStyle(Me.style),key:Me.key},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(Me.cells,j=>(l.openBlock(),l.createElementBlock("div",l.mergeProps({class:"canvas-cell",key:`${j.rowKey}_${j.key}`,style:{...j.style}},{ref_for:!0},j.domDataset),[typeof j.render=="function"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(j.render(j)),{key:0,bordered:!1})):typeof j.render=="string"&&j.render.startsWith("slot:")?l.renderSlot(y.$slots,j.render.replace("slot:",""),l.mergeProps({key:1,ref_for:!0},j,{cell:j})):l.createCommentVNode("",!0)],16))),128))],4))),128))],6))),128))],512)],512)]}),_:3},8,["spinning"])}}}),Zb={key:0},Jb={key:1,class:"p-canvas-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"},Qb={class:"flex items-center flex-1 gap-4px"},jb={key:2},e_={class:"flex items-center gap-4px"},t_={key:0,class:"w-full text-slate-5 pl-4"},fl=l.defineComponent({__name:"PCanvasGrid",props:{staticConfig:{},manualFetch:{type:Boolean},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},config:{},lazyReset:{type:Boolean,default:()=>Et().lazyReset??!1},fitHeight:{default:()=>Et().fitCanvasHeight??100}},emits:["toolbarButtonClick","toolbarToolClick","pick","resetQuery"],setup(r,{expose:e,emit:t}){var oi,ni,Ne,_e,de;const i=r,s=l.useAttrs(),o=t,{formConfig:n,pageConfig:a,columns:c,toolbarConfig:d,proxyConfig:f,config:u,staticConfig:g}=l.toRefs(i),v=Ya(),x=l.ref(He()),m=l.ref({}),p=l.computed(()=>({...i,config:{...v,...i.config}})),E=l.computed(()=>f.value&&f.value.ajax?a.value?"pagination":"list":"bad");l.computed(()=>E.value==="pagination"?{current:_.page,total:B.value,pageSize:_.size,responsive:!1,showSizeChanger:!0,showTotal:L=>`共${L}条数据`}:!1);const C=l.computed(()=>T.omit({labelCol:Mr,...n.value},["items"])),w=l.reactive({toolbar:!1,form:!1,table:!1}),_=l.reactive({page:1,size:((oi=a.value)==null?void 0:oi.pageSize)??10}),S=l.ref(0),B=l.ref(0),K=l.ref([]),R=l.ref(),I=l.ref(),b=l.ref(),O=l.ref(),y=l.ref(),M=l.ref(500),D=l.ref({}),P=L=>{D.value[_.page]=L},Y=l.reactive([...(((Ne=(ni=i.toolbarConfig)==null?void 0:ni.buttons)==null?void 0:Ne.map(L=>L.code))??[]).filter(L=>L),...(((de=(_e=i.toolbarConfig)==null?void 0:_e.tools)==null?void 0:de.map(L=>L.code))??[]).filter(L=>L)].reduce((L,H)=>(L[H]=!1,L),{})),V=(L,H)=>{Y[L]=H},W=L=>{T.isObject(L)?(Object.prototype.hasOwnProperty.call(L,"toolbar")&&(w.toolbar=L.toolbar),Object.prototype.hasOwnProperty.call(L,"form")&&(w.form=L.form),Object.prototype.hasOwnProperty.call(L,"table")&&(w.table=L.table)):T.isBoolean(L)&&(w.form=L,w.toolbar=L,w.table=L)},z=l.computed(()=>T.uniq(Object.values(D.value).flat(),L=>{var H;return L[((H=p.value.config)==null?void 0:H.ROW_KEY)??"id"]})),Q=()=>{it()},te=l.computed(()=>z.value.map(L=>{var H;return L[((H=p.value.config)==null?void 0:H.ROW_KEY)??"id"]})),Ve=(L,H)=>H?{list:T.isString(H.list)?T.get(L,H.list):T.isFunction(H.list)?H.list(L):void 0,total:T.isString(H.total)?T.get(L,H.total):T.isFunction(H.total)?H.total(L):void 0,result:T.isString(H.result)?T.get(L,H.result):T.isFunction(H.result)?H.result(L):void 0,message:T.isString(H.message)?T.get(L,H.message):T.isFunction(H.message)?H.message(L):void 0}:{list:L},be=L=>{o("toolbarButtonClick",{data:K.value,code:L,selectedKeys:te.value,records:z.value}),vt(L)},Me=T.debounce(be,100),j=({key:L})=>Me(L),Xi=L=>{o("toolbarToolClick",{data:K.value,code:L,selectedKeys:te.value,records:z.value}),vt(L)},zi=T.debounce(Xi,100),ve=()=>new Promise(L=>{if(E.value!=="bad"){W({table:!0,form:!0});const{ajax:H}=f.value;H.query({form:m.value,page:_}).then(X=>{const{list:Be,total:At,result:Xe,message:ze}=Ve(X,f.value.response);Be?(K.value=Be,S.value++):Xe?(K.value=Xe,B.value=At??Xe.length,S.value++):(K.value=[],S.value++,ze&&_i(ze)),L(K.value)}).catch(X=>{console.error("fetchData error",X),L([])}).finally(()=>{W({table:!1,form:!1})})}}),Gi=(L,H)=>(_.page=L,_.size=H,ve()),it=()=>(_.page=1,D.value={},ve()),mt=T.debounce(ve,160),si=(L,H)=>(Object.assign(m.value,L),_.page=1,H?Promise.resolve():mt()),Ui=(L,H)=>(m.value=L,_.page=1,H?Promise.resolve():mt()),vt=L=>{const{ajax:H}=f.value;switch(L){case"multiDelete":H.multiDelete&&(te.value.length>0?Ua({title:"警告",content:"确认删除选中的数据吗?"}).then(()=>{W({table:!0,toolbar:!0}),H.multiDelete(te.value).then(()=>{vC("删除成功"),it()}).catch(()=>{xC("删除失败")}).finally(()=>{W({table:!1,toolbar:!1}),Y.multiDelete=!1})}):_i("请选择要删除的数据"));break}},qi=l.computed(()=>!g.value||!g.value.selectable&&!g.value.tree?c.value:[g.value.selectable&&g.value.tree?{type:"selection-tree",width:40,widthFillDisable:!0,title:""}:g.value.selectable?{type:"selection",width:40,widthFillDisable:!0,title:""}:g.value.tree?{type:"tree",width:40,widthFillDisable:!0,title:""}:{type:"index",width:40,widthFillDisable:!0,title:""},...c.value]),rt=L=>{if(n.value&&n.value.items.length>0){if(n.value.customReset)n.value.customReset();else{const H={};Yt(n.value.items,X=>{X.field&&X.itemRender?fe(X.itemRender.defaultValue)?H[X.field]=X.itemRender.defaultValue:H[X.field]=void 0:X.field&&X.slots&&(fe(X.slots.defaultValue)?H[X.field]=X.slots.defaultValue:H[X.field]=void 0)}),m.value=H}o("resetQuery")}_.page=1,L||mt()},xt=()=>(D.value={},rt());let We=null;const Ae=()=>{We&&cancelAnimationFrame(We),We=requestAnimationFrame(()=>{if(We=null,!y.value)return;const L=y.value.getBoundingClientRect();M.value=Math.max(window.innerHeight-L.top-i.fitHeight,100)})};let xe=null;l.watch(O,L=>{xe==null||xe.disconnect(),xe=null,L&&(xe=new ResizeObserver(()=>Ae()),xe.observe(L))},{immediate:!0});let Mt,st=null;return l.onMounted(()=>{if(Ae(),window.addEventListener("resize",Ae),Mt=new MutationObserver(L=>{L.forEach(H=>{if(H.type==="attributes"&&H.attributeName==="style"){const X=H.target;window.getComputedStyle(X).display!=="none"&&Ae()}})}),b.value){Mt.observe(b.value,{attributes:!0,attributeFilter:["style"]}),st=new ResizeObserver(()=>Ae());let L=b.value.parentElement;for(let H=0;H<5&&L&&L!==document.body;H++)st.observe(L),L=L.parentElement}rt(i.manualFetch)}),l.onBeforeUnmount(()=>{We&&cancelAnimationFrame(We),window.removeEventListener("resize",Ae),Mt.disconnect(),xe==null||xe.disconnect(),st==null||st.disconnect()}),e({commitProxy:{query:mt,reload:xt,reloadPage:it,passQuery:si,forcePassQuery:Ui},$canvasTable:l.computed(()=>I.value),selectedRowKeys:te,setBtnLoading:V,selectedRecords:z,$form:l.computed(()=>R.value),getFormData:()=>m.value,setLoadings:W,resizeTable:Ae}),(L,H)=>{var Xe,ze,Nt;const X=l.resolveComponent("a-menu-item"),Be=l.resolveComponent("a-menu"),At=l.resolveComponent("a-dropdown");return l.openBlock(),l.createElementBlock("div",l.mergeProps({ref_key:"boxEl",ref:b,class:"h-full p-wrapper flex flex-col gap-8px overflow-y-auto"},l.unref(s)),[E.value==="bad"?(l.openBlock(),l.createElementBlock("div",Zb,"请检查配置")):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[(ze=(Xe=l.unref(n))==null?void 0:Xe.items)!=null&&ze.some(F=>F.field&&F.itemRender)?(l.openBlock(),l.createElementBlock("div",{key:0,class:"p-pane p-form-wrapper",ref_key:"pFormWrapper",ref:O},[l.createVNode(l.unref(A.Spin),{spinning:w.form},{default:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.unref(A.Form),l.mergeProps({key:x.value,ref_key:"formEl",ref:R,model:m.value},C.value,{onSubmit:Q}),{default:l.withCtx(()=>[l.createVNode(l.unref(A.Row),{gutter:[6,12]},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(n).items,(F,pe)=>(l.openBlock(),l.createBlock(Br,{key:`_col_${F.field||pe}`,"form-data":m.value,item:F,onReset:H[0]||(H[0]=Re=>rt(i.lazyReset))},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["model"]))]),_:1},8,["spinning"])],512)):l.createCommentVNode("",!0),l.unref(d)?(l.openBlock(),l.createElementBlock("div",Jb,[l.createElementVNode("div",Qb,[l.unref(d).buttons&&l.unref(d).buttons.length>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(d).buttons,(F,pe)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:pe},[F.dropdowns&&F.dropdowns.length?(l.openBlock(),l.createBlock(At,{key:0},{overlay:l.withCtx(()=>[l.createVNode(Be,{onClick:j},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(F.dropdowns,Re=>(l.openBlock(),l.createBlock(X,{key:Re.code},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(Re.content),1)]),_:2},1024))),128))]),_:2},1024)]),default:l.withCtx(()=>[l.createVNode(l.unref(A.Button),{type:F.type,size:F.size??"middle",disabled:l.unref(d).disabled||F.disabled,loading:w.toolbar||!!F.code&&Y[F.code],danger:F.danger,shape:F.shape,ghost:F.ghost,block:F.block},{default:l.withCtx(()=>[F.icon?(l.openBlock(),l.createBlock(l.unref(le),{key:0,icon:F.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(F.content)+" ",1),l.createVNode(l.unref(_t.DownOutlined))]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block"])]),_:2},1024)):F.code?(l.openBlock(),l.createBlock(l.unref(A.Button),{key:1,type:F.type,size:F.size??"middle",disabled:l.unref(d).disabled||F.disabled,loading:w.toolbar||!!F.code&&Y[F.code],danger:F.danger,shape:F.shape,ghost:F.ghost,block:F.block,onClick:Re=>l.unref(Me)(F.code)},{default:l.withCtx(()=>[F.icon?(l.openBlock(),l.createBlock(l.unref(le),{key:0,icon:F.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(F.content),1)]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block","onClick"])):(l.openBlock(),l.createElementBlock("div",jb))],64))),128)):l.createCommentVNode("",!0)]),l.createElementVNode("span",e_,[l.unref(d).tools&&l.unref(d).tools.length>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(d).tools,(F,pe)=>(l.openBlock(),l.createBlock(l.unref(A.Button),{key:pe,type:F.type,size:F.size??"middle",disabled:l.unref(d).disabled||F.disabled,danger:F.danger,shape:F.shape,ghost:F.ghost,block:F.block,onClick:Re=>l.unref(zi)(F.code),loading:w.toolbar||!!F.code&&Y[F.code]},{default:l.withCtx(()=>[F.icon?(l.openBlock(),l.createBlock(l.unref(le),{key:0,icon:F.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(F.content),1)]),_:2},1032,["type","size","disabled","danger","shape","ghost","block","onClick","loading"]))),128)):l.createCommentVNode("",!0)])])):l.createCommentVNode("",!0),l.createElementVNode("div",{ref_key:"tableWrapperEl",ref:y,class:l.normalizeClass("p-pane flex-1 h-0 p-inner-scroll")},[(Nt=l.unref(g))!=null&&Nt.selectable&&l.unref(g).showCount?(l.openBlock(),l.createElementBlock("div",t_," 已选:"+l.toDisplayString(te.value.length),1)):l.createCommentVNode("",!0),l.createVNode(Zr,{ref_key:"canvasTableRef",ref:I,columns:qi.value,config:{...p.value.config,HEIGHT:M.value},data:K.value,loading:w.table,onSelectionChange:P},l.createSlots({_:2},[l.renderList(L.$slots,(F,pe)=>({name:pe,fn:l.withCtx(Re=>[l.renderSlot(L.$slots,pe,l.normalizeProps(l.guardReactiveProps(Re)))])}))]),1032,["columns","config","data","loading"]),E.value==="pagination"?(l.openBlock(),l.createBlock(l.unref(A.Pagination),{key:1,class:"p-canvas-pagination",size:"small",current:_.page,"page-size":_.size,total:B.value,onChange:Gi},null,8,["current","page-size","total"])):l.createCommentVNode("",!0)],512)],64))],16)}}}),Jr=l.defineComponent({__name:"PGroupBlock",props:{name:{},getFormSetting:{type:Function},source:{}},setup(r,{expose:e}){const t=r,i=l.ref(),{source:s}=l.toRefs(t),o=l.computed(()=>{var a;return(a=i.value)==null?void 0:a.$form}),n=l.computed(()=>t.getFormSetting(s.value));return e({$form:o}),(a,c)=>(l.openBlock(),l.createBlock(Hr,l.mergeProps({name:a.name,ref_key:"formEl",ref:i},n.value,{data:l.unref(s)}),null,16,["name","data"]))}}),i_=l.defineComponent({__name:"CollapseCard",props:{defaultCollapsed:{type:Boolean,default:!1},title:{default:void 0},collapsible:{type:Boolean,default:!1}},setup(r,{expose:e}){const t=r,i=l.ref(t.defaultCollapsed?[]:["content"]);return e({collapse:()=>{i.value=[]},expand:()=>{i.value=["content"]}}),(s,o)=>{const n=l.resolveComponent("a-collapse-panel"),a=l.resolveComponent("a-collapse"),c=l.resolveComponent("a-card");return s.collapsible?(l.openBlock(),l.createBlock(a,{key:0,"active-key":i.value,"onUpdate:activeKey":o[0]||(o[0]=d=>i.value=d),class:"collapsible-card"},{default:l.withCtx(()=>[l.createVNode(n,{key:"content","force-render":"",header:s.title},l.createSlots({_:2},[l.renderList(s.$slots,(d,f)=>({name:f,fn:l.withCtx(()=>[l.renderSlot(s.$slots,f)])}))]),1032,["header"])]),_:3},8,["active-key"])):(l.openBlock(),l.createBlock(c,{key:1,size:"small",title:s.title},l.createSlots({_:2},[l.renderList(s.$slots,(d,f)=>({name:f,fn:l.withCtx(()=>[l.renderSlot(s.$slots,f)])}))]),1032,["title"]))}}}),gl=l.defineComponent({__name:"PFormGroup",props:l.mergeModels({name:{},getFormSetting:{type:Function},title:{},tabLabel:{},getTabLabel:{type:Function},editAble:{type:Boolean},showAdd:{type:Boolean},collapsible:{type:Boolean},defaultCollapsed:{type:Boolean},lazyErrorMark:{type:Boolean},forceRender:{type:Boolean},keepSerial:{type:Boolean},loading:{type:Boolean},itemMenus:{},createItem:{type:Function},max:{},menuHandler:{type:Function}},{modelValue:{type:Array,default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(r,{expose:e}){const t=A.Form.useForm,i=l.ref(),s=r,o=l.ref(),n=l.useModel(r,"modelValue"),a=l.ref(0),c=l.ref([]),d=l.ref([]),f=R=>{a.value=R},u=l.computed(()=>s.max??1/0),g=R=>{(s.createItem??(()=>Promise.resolve({})))({list:n.value}).then(b=>{var O;n.value=[...n.value,{...b,__index:(((O=T.max(n.value,y=>y.__index??-1))==null?void 0:O.__index)??-1)+1}],a.value=R})},v=s.itemMenus??[{content:"复制",code:"copy"},{content:"删除",code:"delete"}],x=R=>{var I,b,O,y,M,D;return((M=(y=(O=(b=(I=R==null?void 0:R.parentElement)==null?void 0:I.parentElement)==null?void 0:b.parentElement)==null?void 0:O.parentElement)==null?void 0:y.parentElement)==null?void 0:M.parentElement)??((D=o.value)==null?void 0:D.$el)??document.body},m=l.computed(()=>s.forceRender||n.value.length<=5),p=R=>{var b;const I=(b=n.value.find((O,y)=>y===R))==null?void 0:b.__index;q(I)&&(c.value=c.value.filter(O=>O!==I))},E=()=>{l.nextTick().then(()=>{var R,I;p(a.value),(I=(R=d.value[a.value])==null?void 0:R.$form)==null||I.validate()})},C=(R,I)=>{var b;return((b=s.getTabLabel)==null?void 0:b.call(s,R,I))??`${s.tabLabel} ${s.keepSerial?I+1:(R.__index??0)+1}`};l.watch(()=>n.value,()=>{if(!s.keepSerial){const R=n.value.filter(I=>!q(I.__index));R.length>0&&R.forEach(I=>{var b;I.__index=(((b=T.max(n.value,O=>O.__index??-1))==null?void 0:b.__index)??-1)+1})}},{immediate:!0});const w=({key:R},I,b)=>{var O;if(s.menuHandler&&T.isFunction(s.menuHandler))s.menuHandler({code:T.toString(R),data:I,index:b});else switch(R){case"delete":n.value=n.value.filter((y,M)=>M!==b),l.nextTick(()=>{d.value=d.value.filter(y=>!!y),b<=a.value&&a.value>0&&a.value--});break;case"copy":if(n.value.length>=u.value){_i("已达到最大数量");return}n.value=[...n.value,T.clone({...T.omit(I,["id","__index"]),__index:(((O=T.max(n.value,y=>y.__index??-1))==null?void 0:O.__index)??-1)+1})];break}},_=T.debounce(w,100);l.watchEffect(()=>{n.value.length===0?a.value=0:a.value>=n.value.length&&(a.value=n.value.length-1)});const S=T.debounce(p,50);l.watchEffect(()=>{var b;const R=n.value.map((O,y)=>c.value.includes(O.__index)?y:void 0).filter(q),I=(b=i.value)==null?void 0:b.$el;I&&I.querySelectorAll(":scope >.ant-tabs-nav>.ant-tabs-nav-wrap>.ant-tabs-nav-list>.ant-tabs-tab>.ant-tabs-tab-btn").forEach((y,M)=>{R.includes(M)?y.classList.add("p-error-group-tab"):y.classList.remove("p-error-group-tab")})}),e({collapse:()=>{var R,I;(I=(R=o.value)==null?void 0:R.collapse)==null||I.call(R)},expand:()=>{var R,I;(I=(R=o.value)==null?void 0:R.expand)==null||I.call(R)},activeKey:l.computed(()=>a.value),setActiveKey:f,validateAll:()=>{const R=m.value?d.value.map(I=>{var b;return(b=I.$form)==null?void 0:b.validate()}):n.value.map(I=>{var b;return((b=t(I,s.getFormSetting(I).rules))==null?void 0:b.validate())??Promise.resolve()});return Promise.allSettled(R).then(I=>{if(c.value=I.map((b,O)=>{var y;return b.status==="rejected"&&typeof((y=n.value[O])==null?void 0:y.__index)=="number"?n.value[O].__index:void 0}).filter(b=>typeof b=="number"),!s.lazyErrorMark&&c.value.length){const b=c.value[0],O=n.value.findIndex(y=>y.__index===b);O!==-1&&(a.value=O)}return c.value.length?Promise.reject({error_indexes:c.value,results:I}):Promise.resolve(I)})},validate:async(R,I)=>{var O,y,M;const b=n.value.findIndex(D=>D.__index===R);try{return await(m.value?((y=(O=d.value[b])==null?void 0:O.$form)==null?void 0:y.validate())??Promise.resolve():((M=t(n.value[b],s.getFormSetting(n.value[b]).rules))==null?void 0:M.validate())??Promise.resolve()),c.value=c.value.filter(D=>D!==R),Promise.resolve()}catch(D){return!c.value.includes(R)&&!I&&(c.value=[...c.value,R]),Promise.reject(D)}},validateFields:async(R,I,b)=>{var P,Y;const O=n.value.findIndex(V=>V.__index===R),M=s.getFormSetting(n.value[O]).rules,D=t(n.value[O],M);try{return await(m.value?((Y=(P=d.value[O])==null?void 0:P.$form)==null?void 0:Y.validateFields(I))??Promise.resolve():Promise.allSettled(I.map(V=>D.validateField(V,n.value[O][V],M[V]??[])))),Promise.resolve()}catch(V){return!c.value.includes(R)&&!b&&(c.value=[...c.value,R]),Promise.reject(V)}}});const B=l.useSlots(),K=l.computed(()=>Object.keys(B).filter(R=>R.startsWith("group-")).map(R=>({original:R,target:R.replace("group-","")})));return(R,I)=>{const b=l.resolveComponent("a-spin");return l.openBlock(),l.createBlock(i_,{ref_key:"rootRef",ref:o,title:R.title,size:"small",collapsible:R.collapsible,"default-collapsed":R.defaultCollapsed},l.createSlots({default:l.withCtx(()=>[R.loading?(l.openBlock(),l.createBlock(b,{key:0,class:"w-full"})):(l.openBlock(),l.createBlock(l.unref(A.Tabs),{key:1,ref_key:"tabsRef",ref:i,type:"editable-card",activeKey:a.value,"onUpdate:activeKey":I[1]||(I[1]=O=>a.value=O),"hide-add":"",onChange:E},{rightExtra:l.withCtx(()=>[l.renderSlot(R.$slots,"rightExtra",{},()=>[R.showAdd&&n.value.length<u.value?(l.openBlock(),l.createBlock(l.unref(A.Button),{key:0,type:"link",onClick:I[0]||(I[0]=O=>g(n.value.length))},{default:l.withCtx(()=>I[2]||(I[2]=[l.createTextVNode(" + 新增 ",-1)])),_:1,__:[2]})):l.createCommentVNode("",!0)])]),default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(n.value,(O,y)=>(l.openBlock(),l.createBlock(l.unref(A.TabPane),{key:y,tab:C(O,y),"force-render":m.value},{closeIcon:l.withCtx(()=>{var M;return[R.editAble&&((M=l.unref(v))!=null&&M.length)?(l.openBlock(),l.createBlock(l.unref(A.Dropdown),{key:0,"get-popup-container":x},{overlay:l.withCtx(()=>[l.createVNode(l.unref(A.Menu),{onClick:D=>l.unref(_)(D,O,y)},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(v).filter(D=>{var P;return((P=D.visibleMethod)==null?void 0:P.call(D,{data:O,index:y}))??!0}),D=>(l.openBlock(),l.createBlock(l.unref(A.MenuItem),{key:D.code},{default:l.withCtx(()=>[l.createElementVNode("div",null,l.toDisplayString(D.content),1)]),_:2},1024))),128))]),_:2},1032,["onClick"])]),default:l.withCtx(()=>[l.createVNode(l.unref(_t.MoreOutlined))]),_:2},1024)):l.createCommentVNode("",!0)]}),default:l.withCtx(()=>[(l.openBlock(),l.createBlock(Jr,{ref_for:!0,ref_key:"blockInstance",ref:d,key:y,source:O,name:R.name?`${R.name}_${y}`:void 0,"get-form-setting":R.getFormSetting,onFocusCapture:M=>l.unref(S)(y),onClickCapture:M=>l.unref(S)(y)},null,8,["source","name","get-form-setting","onFocusCapture","onClickCapture"]))]),_:2},1032,["tab","force-render"]))),128))]),_:3},8,["activeKey"]))]),_:2},[l.renderList(K.value,O=>({name:O.target,fn:l.withCtx(()=>[l.renderSlot(R.$slots,O.original)])}))]),1032,["title","collapsible","default-collapsed"])}}}),r_={class:"w-full text-right p-2"},ml=l.defineComponent({__name:"PromisePicker",props:{gridSetting:{},title:{default:"数据选择"},width:{default:"70%"},multipleAllowEmpty:{type:Boolean,default:!1},bodyStyle:{default:()=>({})},beforePick:{type:Function,default:()=>Promise.resolve()}},setup(r,{expose:e}){const t=l.ref(),i=l.ref(!1),s=r,o=l.computed(()=>{var x;return(x=s.gridSetting.selectConfig)==null?void 0:x.multiple});let n,a,c;const d=l.reactive({modal:!1}),f=()=>{c&&c()},u=()=>{d.modal=!1,c&&c()},g=({row:x,field:m})=>{n&&!o.value&&s.beforePick(x).then(()=>{d.modal=!1,n({row:x,field:m})})},v=()=>{var m;const x=((m=t.value)==null?void 0:m.selectedRecords)??[];x.length===0&&!s.multipleAllowEmpty?_i("请选择数据"):s.beforePick(x).then(()=>{d.modal=!1,a(x)})};return l.onMounted(()=>{}),e({pick:()=>new Promise((x,m)=>{n=x,c=m,i.value=!1,d.modal=!0,l.nextTick(()=>{i.value=!0})}),pickMultiple:()=>new Promise((x,m)=>{a=x,c=m,i.value=!1,d.modal=!0,l.nextTick(()=>{i.value=!0})}),grid:t,hide:()=>{d.modal=!1}}),(x,m)=>(l.openBlock(),l.createBlock(l.unref(A.Modal),{open:d.modal,"onUpdate:open":m[0]||(m[0]=p=>d.modal=p),"destroy-on-close":"",title:x.title,width:x.width,footer:o.value?void 0:null,onCancel:f,"body-style":x.bodyStyle},l.createSlots({default:l.withCtx(()=>[l.createElementVNode("div",{style:l.normalizeStyle({minHeight:i.value?"unset":"642px"})},[l.createVNode(Fr,l.mergeProps(x.gridSetting,{ref_key:"gridEl",ref:t,onPick:g}),null,16)],4)]),_:2},[o.value?{name:"footer",fn:l.withCtx(()=>[l.createElementVNode("div",r_,[l.createElementVNode("span",null,[l.createVNode(l.unref(A.Button),{class:"mr-4",onClick:u},{default:l.withCtx(()=>m[1]||(m[1]=[l.createTextVNode(" 取消 ",-1)])),_:1,__:[1]}),l.createVNode(l.unref(A.Button),{type:"primary",onClick:v},{default:l.withCtx(()=>m[2]||(m[2]=[l.createTextVNode(" 确定 ",-1)])),_:1,__:[2]})])])]),key:"0"}:void 0]),1032,["open","title","width","footer","body-style"]))}});function vl(r){r&&Pa(r)}const s_={install(r){r.component("PForm",Hr),r.component("PGrid",Fr),r.component("PCanvasTable",Zr),r.component("PCanvasGrid",fl),r.component("PFormGroup",gl),r.component("PGroupBlock",Jr),r.component("PromisePicker",ml)},addFormatter:Wa,addRender:Nr,setup:vl};exports.PCanvasGrid=fl;exports.PCanvasTable=Zr;exports.PForm=Hr;exports.PFormGroup=gl;exports.PGrid=Fr;exports.PGroupBlock=Jr;exports.PromisePicker=ml;exports.addFormatter=Wa;exports.addRender=Nr;exports.cleanCol=Pi;exports.default=s_;exports.defaultItemResponsive=$r;exports.defaultLabelCol=Mr;exports.get24rest=Va;exports.getButtonResponsive=sC;exports.getUIKitConfig=tC;exports.labelColDict=rC;exports.resetUIKitConfig=iC;exports.setUIKitConfig=Pa;exports.setup=vl;exports.watchPreviousDeep=Ar;
|