UNPKG

ag-grid-enterprise

Version:

Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue

254 lines • 1.57 MB
var zw=OA,Ww=IA,Kw=ZA,$w=UA,jw=gE,Yw=RE,qw=LE,Zw=EE,Xw=YE,Jw=WE,Qw=fh,ex=zE,tx=TD,sx=CD,rx=pD,ix=MD,nx=ID,ox=HD,ax=KD,bd=r1,lx=P1,cx=ok,ux=ZL,dx=qL,hx=KL,px=Fk,gx=Dk,fx=g_,mx=p_,vx=M_,Cx=Xk,bx=V_,Sx=Nk,yx=Z_,wx=nG,xx=dG,Fx=j_,Tx=Ik,Ax=BL,Px=LL,Rx=DG,Mx=CO,Ix=pO,Ex=DO,Dx=EO,Lx=oO,kx=eO,_x=tN,Gx=vN,Ox=KN,Nx=QN,Bx=TN,Vx=uB,Hx=cN,Ux=qO,zx=KO,Wx=KB,Kx=aV,$x=JB,jx=bV,Yx=EB,qx=FV,Zx=xV,Xx=VV,Jx=$V,Qx=qV,e0=n3,Sd=p3,t0=g3,s0=T3,r0=O3,i0=V3,n0=K3,o0=c5,a0=t5,l0=I5,c0=D5,u0=F5,d0=N5,h0=W5,p0=Z5,g0=p4,f0=a4,m0=E4,v0=O4,C0=q4,b0=o6,S0=f6,y0=b6,w0=x6,x0=T6,F0=M6,T0=V6,A0=B6,P0=fU,R0=CU,M0=wU,I0=DU,E0=UU,D0=KU,L0=t9,k0=l9,_0=m9,G0=S9,O0=R9,N0=O9,B0=J9,V0=oz,H0=cz,U0=fz,z0=Fz,W0=Rz,K0=kz,$0=zz,j0=Vz,Y0=Jz,q0=tW,Z0=lW,X0=rW,J0=vW,Q0=DW,eF=GW,tF=HW,sF=$W,rF=YW,iF=QW,nF=nK,oF=mK,aF=kK,lF=jK,cF=e$,uF=f$,dF=R$,hF=G$,pF=w$,gF=h$,fF=Y$,mF=J$,vF=mj,CF=Mj,bF=Dj,SF=Tj,yF=pj,wF=lj,xF=Xj,FF=$j,TF=dY,AF=IY,PF=Fq,RF=Aq,MF=Rq,IF=eq,EF=Uq,DF=oZ,LF=CZ,kF=TZ,_F=IZ,GF=GZ,OF=HZ,NF=KZ,BF=YZ,VF=ZZ,HF=eX,UF=nX,zF=AX,WF=PX,KF=DX,$F=kX,jF=MX,YF=OX,qF=BX,ZF=qX,XF=KX,JF=WX,QF=iJ,eT=oJ,tT=wJ,sT=AJ,rT=OJ,iT=dJ,nT=cJ,oT=JJ,aT=tQ,lT=iQ,cT=Eee,uT=jee,dT=$ee,hT=kee,pT=mte,gT=fte,fT=lte,mT=Rte,vT=Hte,CT=mse,bT=wse,ST=nre,yT=rre,wT=Kse,xT=Mre,FT=Gre,TT=Mie,AT=kie,PT=Oie,RT=xie,MT=Nre,IT=Zie,ET=Jie,DT=tne,LT=ine,kT=lne,_T=Yie,GT=Kie,OT=$ie,NT=Cne,BT=bne,VT=Fne,HT=Mne,UT=Dne,zT=jne,WT=yoe,KT=Boe,$T=koe,jT=qoe,YT=Yoe,qT=sae,ZT=Ioe,XT=mae,JT=xae,QT=Aae,eA=Rae,tA=hae,sA=Lae,rA=Oae,iA=Vae,nA=Gae,oA=zae,aA=jae,lA=tle,cA=rle,uA=nle,dA=ale,hA=ule,pA=fle,gA=vle,fA=ble,mA=xle,vA=Ale,CA=Jae,bA=Dle,SA=Ile,yA=lae,wA=Wle,xA=Vle,FA=Aoe,TA=Coe,AA=hce,PA=zne,RA=One;import{_getDocument as MA}from"ag-stack";import{BeanStub as IA}from"ag-grid-community";import{_exists as EA,_splitBracketed as DA}from"ag-stack";import{_logPreInitWarn as LA}from"ag-grid-community";var kA=class{constructor(){this.ieCompatibility=!1}init(){this.ieCompatibility=this.md5("hello")!="5d41402abc4b2a76b9719d911017c592"}md5cycle(e,t){let s=e[0],r=e[1],i=e[2],n=e[3];s=this.ff(s,r,i,n,t[0],7,-680876936),n=this.ff(n,s,r,i,t[1],12,-389564586),i=this.ff(i,n,s,r,t[2],17,606105819),r=this.ff(r,i,n,s,t[3],22,-1044525330),s=this.ff(s,r,i,n,t[4],7,-176418897),n=this.ff(n,s,r,i,t[5],12,1200080426),i=this.ff(i,n,s,r,t[6],17,-1473231341),r=this.ff(r,i,n,s,t[7],22,-45705983),s=this.ff(s,r,i,n,t[8],7,1770035416),n=this.ff(n,s,r,i,t[9],12,-1958414417),i=this.ff(i,n,s,r,t[10],17,-42063),r=this.ff(r,i,n,s,t[11],22,-1990404162),s=this.ff(s,r,i,n,t[12],7,1804603682),n=this.ff(n,s,r,i,t[13],12,-40341101),i=this.ff(i,n,s,r,t[14],17,-1502002290),r=this.ff(r,i,n,s,t[15],22,1236535329),s=this.gg(s,r,i,n,t[1],5,-165796510),n=this.gg(n,s,r,i,t[6],9,-1069501632),i=this.gg(i,n,s,r,t[11],14,643717713),r=this.gg(r,i,n,s,t[0],20,-373897302),s=this.gg(s,r,i,n,t[5],5,-701558691),n=this.gg(n,s,r,i,t[10],9,38016083),i=this.gg(i,n,s,r,t[15],14,-660478335),r=this.gg(r,i,n,s,t[4],20,-405537848),s=this.gg(s,r,i,n,t[9],5,568446438),n=this.gg(n,s,r,i,t[14],9,-1019803690),i=this.gg(i,n,s,r,t[3],14,-187363961),r=this.gg(r,i,n,s,t[8],20,1163531501),s=this.gg(s,r,i,n,t[13],5,-1444681467),n=this.gg(n,s,r,i,t[2],9,-51403784),i=this.gg(i,n,s,r,t[7],14,1735328473),r=this.gg(r,i,n,s,t[12],20,-1926607734),s=this.hh(s,r,i,n,t[5],4,-378558),n=this.hh(n,s,r,i,t[8],11,-2022574463),i=this.hh(i,n,s,r,t[11],16,1839030562),r=this.hh(r,i,n,s,t[14],23,-35309556),s=this.hh(s,r,i,n,t[1],4,-1530992060),n=this.hh(n,s,r,i,t[4],11,1272893353),i=this.hh(i,n,s,r,t[7],16,-155497632),r=this.hh(r,i,n,s,t[10],23,-1094730640),s=this.hh(s,r,i,n,t[13],4,681279174),n=this.hh(n,s,r,i,t[0],11,-358537222),i=this.hh(i,n,s,r,t[3],16,-722521979),r=this.hh(r,i,n,s,t[6],23,76029189),s=this.hh(s,r,i,n,t[9],4,-640364487),n=this.hh(n,s,r,i,t[12],11,-421815835),i=this.hh(i,n,s,r,t[15],16,530742520),r=this.hh(r,i,n,s,t[2],23,-995338651),s=this.ii(s,r,i,n,t[0],6,-198630844),n=this.ii(n,s,r,i,t[7],10,1126891415),i=this.ii(i,n,s,r,t[14],15,-1416354905),r=this.ii(r,i,n,s,t[5],21,-57434055),s=this.ii(s,r,i,n,t[12],6,1700485571),n=this.ii(n,s,r,i,t[3],10,-1894986606),i=this.ii(i,n,s,r,t[10],15,-1051523),r=this.ii(r,i,n,s,t[1],21,-2054922799),s=this.ii(s,r,i,n,t[8],6,1873313359),n=this.ii(n,s,r,i,t[15],10,-30611744),i=this.ii(i,n,s,r,t[6],15,-1560198380),r=this.ii(r,i,n,s,t[13],21,1309151649),s=this.ii(s,r,i,n,t[4],6,-145523070),n=this.ii(n,s,r,i,t[11],10,-1120210379),i=this.ii(i,n,s,r,t[2],15,718787259),r=this.ii(r,i,n,s,t[9],21,-343485551),e[0]=this.add32(s,e[0]),e[1]=this.add32(r,e[1]),e[2]=this.add32(i,e[2]),e[3]=this.add32(n,e[3])}cmn(e,t,s,r,i,n){return t=this.add32(this.add32(t,e),this.add32(r,n)),this.add32(t<<i|t>>>32-i,s)}ff(e,t,s,r,i,n,o){return this.cmn(t&s|~t&r,e,t,i,n,o)}gg(e,t,s,r,i,n,o){return this.cmn(t&r|s&~r,e,t,i,n,o)}hh(e,t,s,r,i,n,o){return this.cmn(t^s^r,e,t,i,n,o)}ii(e,t,s,r,i,n,o){return this.cmn(s^(t|~r),e,t,i,n,o)}md51(e){const t=e.length,s=[1732584193,-271733879,-1732584194,271733878];let r;for(r=64;r<=e.length;r+=64)this.md5cycle(s,this.md5blk(e.substring(r-64,r)));e=e.substring(r-64);const i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(r=0;r<e.length;r++)i[r>>2]|=e.charCodeAt(r)<<(r%4<<3);if(i[r>>2]|=128<<(r%4<<3),r>55)for(this.md5cycle(s,i),r=0;r<16;r++)i[r]=0;return i[14]=t*8,this.md5cycle(s,i),s}md5blk(e){const t=[];for(let s=0;s<64;s+=4)t[s>>2]=e.charCodeAt(s)+(e.charCodeAt(s+1)<<8)+(e.charCodeAt(s+2)<<16)+(e.charCodeAt(s+3)<<24);return t}rhex(e){const t="0123456789abcdef".split("");let s="",r=0;for(;r<4;r++)s+=t[e>>r*8+4&15]+t[e>>r*8&15];return s}hex(e){for(let t=0;t<e.length;t++)e[t]=this.rhex(e[t]);return e.join("")}md5(e){return this.hex(this.md51(e))}add32(e,t){return this.ieCompatibility?this.add32Compat(e,t):this.add32Std(e,t)}add32Std(e,t){return e+t&4294967295}add32Compat(e,t){const s=(e&65535)+(t&65535);return(e>>16)+(t>>16)+(s>>16)<<16|s&65535}},Bi={"01":"GRID","02":"CHARTS","0102":"BOTH"},yd="https://www.ag-grid.com/licensing/";function _A(e){return e==="BOTH"?"Grid and AG Charts":e==="GRID"?"Grid":"Charts"}var wd=class Ne{constructor(t){this.watermarkMessage=void 0,this.totalMessageLength=124,this.document=t,this.md5=new kA,this.md5.init()}validateLicense(){const t=this.getLicenseDetails(Ne.licenseKey),s=`AG Grid ${t.currentLicenseType==="BOTH"?"and AG Charts ":""}Enterprise`,r=t.suppliedLicenseType===void 0?"":`AG ${_A(t.suppliedLicenseType)} Enterprise`;if(t.missing)(!this.isWebsiteUrl()||this.isForceWatermark())&&this.outputMissingLicenseKey(s);else if(t.expired){const i=Ne.getGridReleaseDate(),n=Ne.formatDate(i);this.outputExpiredKey(t.expiry,n,s,r)}else t.valid?t.isTrial&&t.trialExpired&&this.outputExpiredTrialKey(t.expiry,s,r):this.outputInvalidLicenseKey(!!t.incorrectLicenseType,s,r)}static extractExpiry(t){const s=t.substring(t.lastIndexOf("_")+1,t.length);return new Date(Number.parseInt(Ne.decode(s),10))}static extractLicenseComponents(t){let s=t.replace(/[\u200B-\u200D\uFEFF]/g,"");if(s=s.replace(/\r?\n|\r/g,""),t.length<=32)return{md5:null,license:t,version:null,isTrial:null};const r=s.length-32,i=s.substring(r),n=s.substring(0,r),[o,a,l]=Ne.extractBracketedInformation(s);return{md5:i,license:n,version:o,isTrial:a,type:l}}getLicenseDetails(t){const s=Ne.chartsLicenseManager?"BOTH":"GRID";if(!t?.length)return{licenseKey:t,valid:!1,missing:!0,currentLicenseType:s};const r=Ne.getGridReleaseDate(),{md5:i,license:n,version:o,isTrial:a,type:l}=Ne.extractLicenseComponents(t);let c=i===this.md5.md5(n)&&!t.includes("For_Trialing_ag-Grid_Only"),u,d,h=null,p=!1,g;function f(){u=h<new Date,d=void 0}if(c&&(h=Ne.extractExpiry(n),c=!Number.isNaN(h.getTime()),c))switch(d=r>h,o){case"legacy":case"2":{a&&f();break}case"3":l?.length?(g=l,l!==Bi["01"]&&l!==Bi["0102"]||s==="BOTH"&&g!=="BOTH"?(c=!1,p=!0):a&&f()):c=!1}return c?{licenseKey:t,valid:c,expiry:Ne.formatDate(h),expired:d,version:o,isTrial:a,trialExpired:u,incorrectLicenseType:p,currentLicenseType:s,suppliedLicenseType:g}:{licenseKey:t,valid:c,incorrectLicenseType:p,currentLicenseType:s,suppliedLicenseType:g}}isDisplayWatermark(){return this.isForceWatermark()||!this.isLocalhost()&&!this.isWebsiteUrl()&&!!this.watermarkMessage?.length}getWatermarkMessage(){return this.watermarkMessage||""}getHostname(){const s=(this.document.defaultView??window).location,{hostname:r=""}=s;return r}isForceWatermark(){const s=(this.document.defaultView??window).location,{pathname:r}=s;return r?r.includes("forceWatermark"):!1}isWebsiteUrl(){const t=this.getHostname();return/^(?:[\w-]+\.)?(ag-grid|bryntum)\.com$/.exec(t)!==null}isLocalhost(){const t=this.getHostname();return/^(?:127\.0\.0\.1|localhost)$/.exec(t)!==null}static formatDate(t){const s=["January","February","March","April","May","June","July","August","September","October","November","December"],r=t.getDate(),i=t.getMonth(),n=t.getFullYear();return r+" "+s[i]+" "+n}static getGridReleaseDate(){return new Date(Number.parseInt(Ne.decode(Ne.RELEASE_INFORMATION),10))}static decode(t){const s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let r="",i,n,o,a,l,c,u,d=0;const h=t.replace(/[^A-Za-z0-9+/=]/g,"");for(;d<h.length;)a=s.indexOf(h.charAt(d++)),l=s.indexOf(h.charAt(d++)),c=s.indexOf(h.charAt(d++)),u=s.indexOf(h.charAt(d++)),i=a<<2|l>>4,n=(l&15)<<4|c>>2,o=(c&3)<<6|u,r=r+String.fromCharCode(i),c!=64&&(r=r+String.fromCharCode(n)),u!=64&&(r=r+String.fromCharCode(o));return r=Ne.utf8_decode(r),r}static utf8_decode(t){t=t.replace(/rn/g,"n");let s="";for(let r=0;r<t.length;r++){const i=t.charCodeAt(r);i<128?s+=String.fromCharCode(i):i>127&&i<2048?(s+=String.fromCharCode(i>>6|192),s+=String.fromCharCode(i&63|128)):(s+=String.fromCharCode(i>>12|224),s+=String.fromCharCode(i>>6&63|128),s+=String.fromCharCode(i&63|128))}return s}static setChartsLicenseManager(t){this.chartsLicenseManager=t,this.chartsLicenseManager?.setLicenseKey(this.licenseKey,!0)}static setLicenseKey(t){EA(this.licenseKey)&&this.licenseKey!==t&&LA(291,void 0,"AG Grid: License Key being set multiple times with different values. This can result in an incorrect license key being used."),this.licenseKey=t,this.chartsLicenseManager?.setLicenseKey(t,!0)}static extractBracketedInformation(t){if(!t.includes("["))return["legacy",!1,void 0];const s=DA(t,!0),r=[];for(let l=1,c=s.length;l<c;l+=2)r.push(s[l].slice(1,-1));if(r.length===0)return["legacy",!1,void 0];const i=r.filter(l=>l==="TRIAL").length===1,n=r.filter(l=>l.indexOf("v")===0)[0],o=n?n.replace("v",""):"legacy",a=Bi[r.filter(l=>Bi[l])[0]];return[o,i,a]}centerPadAndOutput(t){const s=this.totalMessageLength-t.length;console.error(t.padStart(s/2+t.length,"*").padEnd(this.totalMessageLength,"*"))}padAndOutput(t,s="*",r=""){console.error(t.padEnd(this.totalMessageLength-r.length,s)+r)}outputInvalidLicenseKey(t,s,r){t?(this.centerPadAndOutput(""),this.centerPadAndOutput(` ${s} License `),this.centerPadAndOutput(" Incompatible License Key "),this.padAndOutput(`* Your license key is for ${r} only and does not cover you for ${s}.`," ","*"),this.padAndOutput(`* To troubleshoot your license key visit ${yd}.`," ","*"),this.centerPadAndOutput(""),this.centerPadAndOutput("")):(this.centerPadAndOutput(""),this.centerPadAndOutput(` ${s} License `),this.centerPadAndOutput(" Invalid License Key "),this.padAndOutput("* Your license key is not valid."," ","*"),this.padAndOutput(`* To troubleshoot your license key visit ${yd}.`," ","*"),this.centerPadAndOutput(""),this.centerPadAndOutput("")),this.watermarkMessage="Invalid License"}outputExpiredTrialKey(t,s,r){this.centerPadAndOutput(""),this.centerPadAndOutput(` ${s} License `),this.centerPadAndOutput(" Trial Period Expired. "),this.padAndOutput(`* Your trial only license for ${r} expired on ${t}.`," ","*"),this.padAndOutput("* Please email info@ag-grid.com to purchase a license."," ","*"),this.centerPadAndOutput(""),this.centerPadAndOutput(""),this.watermarkMessage="Trial Period Expired"}outputMissingLicenseKey(t){this.centerPadAndOutput(""),this.centerPadAndOutput(` ${t} License `),this.centerPadAndOutput(" License Key Not Found "),this.padAndOutput(`* All ${t} features are unlocked for trial.`," ","*"),this.padAndOutput("* If you want to hide the watermark please email info@ag-grid.com for a trial license key."," ","*"),this.centerPadAndOutput(""),this.centerPadAndOutput(""),this.watermarkMessage="For Trial Use Only"}outputExpiredKey(t,s,r,i){this.centerPadAndOutput(""),this.centerPadAndOutput(` ${r} License `),this.centerPadAndOutput(" Incompatible Software Version "),this.padAndOutput(`* Your license key works with versions${i==""?"":` of ${i}`} released before ${t}.`," ","*"),this.padAndOutput(`* The version you are trying to use was released on ${s}.`," ","*"),this.padAndOutput("* Please contact info@ag-grid.com to renew your license key."," ","*"),this.centerPadAndOutput(""),this.centerPadAndOutput(""),this.watermarkMessage="License Expired"}};wd.RELEASE_INFORMATION="MTc5Mzc4NDIzNzk4Mg==";var mr=wd;import{RefPlaceholder as GA}from"ag-stack";import{Component as OA}from"ag-grid-community";var NA='.ag-watermark{bottom:20px;color:#9b9b9b;opacity:.7;position:absolute;transition:opacity 1s ease-out 3s}:where(.ag-ltr) .ag-watermark{right:25px}:where(.ag-rtl) .ag-watermark{left:25px}.ag-watermark:before{background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMDkiIGhlaWdodD0iMzYiIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAyMDkgMzYiPjxwYXRoIGZpbGw9IiM5YjliOWIiIGQ9Ik0xOTIuOTkzIDIzLjY1OHYtNy45NDZoLTEzLjU0MWwtNy45NDcgNy45NDZ6TTIwOC4yNSAzLjk1aC0xNi45NzRsLTguMDEgNy45NDdoMjQuOTg0ek0xNjMuNjIyIDMxLjYwNWw0LjA2OS00LjA2OWgxMy43MzJ2Ny45NDdoLTE3LjgwMXoiLz48cGF0aCBmaWxsPSIjOWI5YjliIiBkPSJNMTY2LjYxIDE5Ljc4aDguNzczbDguMDEtNy45NDZIMTY2LjYxek0xNTcuMDExIDMxLjYwNWg2LjYxMWw3Ljg4My03Ljk0N2gtMTQuNDk0ek0xOTEuMjc2IDMuOTVsLTQuMDY4IDQuMDdIMTYxLjI3Vi4wNzJoMzAuMDA2ek0yMC44NCAzMC4yMDZIOC4zNzhsLTIuMTYyIDUuMzRILjc1TDEyLjI1NyA4LjU5Mmg0Ljc2OEwyOC41MyAzNS41NDZoLTUuNTN6bS0xLjcxNy00LjI2TDE0LjYwOSAxNC45NWwtNC41MTQgMTAuOTk4ek0xMDQuNDM3IDE4LjUwOWMxLjU4OS0yLjM1MiA1LjU5NC0yLjYwNyA3LjI0Ny0yLjYwN3Y0LjU3OGMtMi4wMzQgMC00LjA2OS4wNjMtNS4yNzcuOTUzLTEuMjA3Ljg5LTEuODQzIDIuMDk4LTEuODQzIDMuNTZ2MTAuNTUzaC00Ljk1OVYxNS45MDJoNC43Njh6TTExOS4zNzYgMTUuOTAyaC00Ljk1OHYxOS42NDRoNC45NTh6TTExOS4zNzYgNy4xM2gtNC45NTh2NS44NDhoNC45NTh6TTE0My45NzkgNy4xM3YyOC40MTZoLTQuNzY4bC0uMTI3LTIuOTg4YTguMyA4LjMgMCAwIDEtMi42NyAyLjQ4Yy0xLjA4MS41NzItMi40MTYuODktMy45NDIuODktMS4zMzUgMC0yLjYwNi0uMjU1LTMuNjg3LS43LTEuMTQ0LS41MDgtMi4xNjItMS4xNDQtMi45ODgtMi4wMzRhOS42IDkuNiAwIDAgMS0xLjk3MS0zLjE3OWMtLjUwOC0xLjIwNy0uNjk5LTIuNjA2LS42OTktNC4xMzJzLjI1NC0yLjkyNC42OTktNC4xOTZjLjUwOS0xLjI3MSAxLjE0NS0yLjM1MiAxLjk3MS0zLjI0MnMxLjg0NC0xLjU4OSAyLjk4OC0yLjA5OCAyLjM1Mi0uNzYzIDMuNjg3LS43NjNjMS41MjYgMCAyLjc5Ny4yNTUgMy44NzguODI3czEuOTcxIDEuMzM1IDIuNjcgMi40MTZWNy4xOTNoNC45NTl6bS0xMC40MjYgMjQuNTM4YzEuNjUzIDAgMi45MjQtLjU3MiAzLjk0MS0xLjY1M3MxLjUyNi0yLjU0MyAxLjUyNi00LjMyMy0uNTA5LTMuMTc4LTEuNTI2LTQuMzIyYy0xLjAxNy0xLjA4MS0yLjI4OC0xLjY1My0zLjk0MS0xLjY1My0xLjU5IDAtMi45MjUuNTcyLTMuODc4IDEuNjUzLTEuMDE3IDEuMDgtMS41MjYgMi41NDMtMS41MjYgNC4zMjIgMCAxLjc4LjUwOSAzLjE4IDEuNTI2IDQuMjYgMS4wMTcgMS4xNDQgMi4yODggMS43MTYgMy44NzggMS43MTZNNTcuMjAyIDIwLjM1M0g0NC45MzN2NC4yNTloNi45OTNjLS4xOSAyLjE2MS0xLjAxNyAzLjgxNC0yLjQxNiA1LjE1LTEuMzk4IDEuMjctMy4xNzggMS45MDYtNS40NjcgMS45MDYtMS4yNzEgMC0yLjQ4LS4yNTQtMy40OTYtLjY5OWE3IDcgMCAwIDEtMi43MzQtMS45N2MtLjc2My0uODI3LTEuMzM1LTEuODQ0LTEuNzgtMy4wNTJzLS42MzYtMi40OC0uNjM2LTMuOTQyLjE5LTIuNzMzLjYzNi0zLjk0MWMuMzgxLTEuMjA4IDEuMDE3LTIuMTYyIDEuNzgtMy4wNTIuNzYzLS44MjYgMS42NTMtMS40NjIgMi43MzMtMS45N2E5LjEgOS4xIDAgMCAxIDMuNTYtLjdxNC4wMDUgMCA2LjEwMyAxLjkwN2wzLjMwNi0zLjMwNWMtMi40OC0xLjkwNy01LjY1OC0yLjkyNS05LjQwOS0yLjkyNS0yLjA5NyAwLTQuMDA0LjMxOC01LjcyMSAxLjAxOC0xLjcxNi42OTktMy4xNzkgMS41ODktNC4zODYgMi43OTdBMTIuMSAxMi4xIDAgMCAwIDMxLjIgMTYuMjJjLS42MzUgMS43MTctLjk1MyAzLjYyNC0uOTUzIDUuNjU4cy4zMTggMy45NDIgMS4wMTcgNS42NThjLjcgMS43MTcgMS41OSAzLjE3OSAyLjc5NyA0LjM4N2ExMi4xIDEyLjEgMCAwIDAgNC4zODcgMi43OTdjMS43MTYuNyAzLjYyMyAxLjAxNyA1LjY1NyAxLjAxNyAyLjAzNSAwIDMuODc4LS4zMTggNS41MzEtMS4wMTcgMS42NTMtLjcgMy4wNTItMS41OSA0LjE5Ni0yLjc5N3ExLjcxNi0xLjgxMiAyLjY3LTQuMzg3Yy42MzYtMS43MTYuOTU0LTMuNjIzLjk1NC01LjY1OHYtLjgyNmMtLjE5MS0uMTI3LS4yNTUtLjQ0NS0uMjU1LS43TTk1Ljk4MiAyMC4zNTNoLTEyLjI3djQuMjU5aDYuOTkzYy0uMTkgMi4xNjEtMS4wMTcgMy44MTQtMi40MTYgNS4xNS0xLjM5OCAxLjI3LTMuMTc4IDEuOTA2LTUuNDY3IDEuOTA2LTEuMjcxIDAtMi40OC0uMjU0LTMuNDk2LS42OTlhNyA3IDAgMCAxLTIuNzM0LTEuOTdjLS43NjMtLjgyNy0xLjMzNS0xLjg0NC0xLjc4LTMuMDUycy0uNjM2LTIuNDgtLjYzNi0zLjk0Mi4xOS0yLjczMy42MzYtMy45NDFjLjM4MS0xLjIwOCAxLjAxNy0yLjE2MiAxLjc4LTMuMDUyLjc2My0uODI2IDEuNjUzLTEuNDYyIDIuNzM0LTEuOTdhOS4xIDkuMSAwIDAgMSAzLjU2LS43cTQuMDA1IDAgNi4xMDMgMS45MDdsMy4zMDUtMy4zMDVjLTIuNDc5LTEuOTA3LTUuNjU4LTIuOTI1LTkuNDA4LTIuOTI1LTIuMDk4IDAtNC4wMDUuMzE4LTUuNzIyIDEuMDE4LTEuNzE2LjY5OS0zLjE3OCAxLjU4OS00LjM4NiAyLjc5N2ExMi4xIDEyLjEgMCAwIDAtMi43OTcgNC4zODZjLS42MzYgMS43MTctLjk1NCAzLjYyNC0uOTU0IDUuNjU4cy4zMTggMy45NDIgMS4wMTcgNS42NThjLjcgMS43MTcgMS41OSAzLjE3OSAyLjc5NyA0LjM4N2ExMi4xIDEyLjEgMCAwIDAgNC4zODcgMi43OTdjMS43MTYuNyAzLjYyMyAxLjAxNyA1LjY1OCAxLjAxNyAyLjAzNCAwIDMuODc4LS4zMTggNS41My0xLjAxNyAxLjY1My0uNyAzLjA1Mi0xLjU5IDQuMTk2LTIuNzk3cTEuNzE4LTEuODEyIDIuNjctNC4zODdjLjYzNi0xLjcxNi45NTQtMy42MjMuOTU0LTUuNjU4di0uODI2Yy0uMTktLjEyNy0uMjU1LS40NDUtLjI1NS0uNyIvPjwvc3ZnPg==");background-repeat:no-repeat;background-size:170px 40px;content:"";display:block;height:40px;width:170px}.ag-watermark-text{font-family:Impact,sans-serif;font-size:19px;font-weight:700;opacity:.5}:where(.ag-ltr) .ag-watermark-text{padding-left:.7rem}:where(.ag-rtl) .ag-watermark-text{padding-right:.7rem}',BA={tag:"div",cls:"ag-watermark",children:[{tag:"div",ref:"eLicenseTextRef",cls:"ag-watermark-text"}]},VA=class extends zw{constructor(){super(BA),this.eLicenseTextRef=GA,this.registerCSS(NA)}wireBeans(e){this.licenseManager=e.licenseManager}postConstruct(){const e=this.shouldDisplayWatermark();this.setDisplayed(e),e&&(this.eLicenseTextRef.textContent=this.licenseManager.getWatermarkMessage(),window.setTimeout(()=>this.addCss("ag-opacity-zero"),0),window.setTimeout(()=>this.setDisplayed(!1),5e3))}shouldDisplayWatermark(){return this.licenseManager.isDisplayWatermark()}},HA={selector:"AG-WATERMARK",component:VA},Qo=class extends Ww{constructor(){super(...arguments),this.beanName="licenseManager"}postConstruct(){this.validateLicense()}validateLicense(){const e=this.beans;if(e.studio)this.licenseManager={isDisplayWatermark:()=>!1,getWatermarkMessage:()=>""};else{const t=new mr(MA(e));this.licenseManager=t,t.validateLicense()}}static getLicenseDetails(e){return new mr(null).getLicenseDetails(e)}getWatermarkSelector(){return HA}isDisplayWatermark(){return this.licenseManager.isDisplayWatermark()}getWatermarkMessage(){return this.licenseManager.getWatermarkMessage()}static setLicenseKey(e){mr.setLicenseKey(e)}static setChartsLicenseManager(e){mr.setChartsLicenseManager(e)}};import{_downloadFile as ea}from"ag-stack";import{BaseCreator as UA,_addGridCommonParams as zA,_clamp as WA,_getHeaderClassesFromColDef as KA,_warnForGrid as $A,_warnWithoutAttribution as jA}from"ag-grid-community";import{_isExpressionString as YA,_last as qA}from"ag-stack";import{BaseGridSerializingSession as ZA,_addGridCommonParams as Vi,_getDrawnColSpan as XA,_isHiddenSingleChildGroup as JA,_mergeDeep as QA}from"ag-grid-community";import{_escapeString as eP}from"ag-stack";var tP=9525,xd={0:1,"0.00":2,"#,##0":3,"#,##0.00":4,"0%":9,"0.00%":10,"0.00E+00":11,"# ?/?":12,"# ??/??":13,"mm-dd-yy":14,"d-mmm-yy":15,"d-mmm":16,"mmm-yy":17,"h:mm AM/PM":18,"h:mm:ss AM/PM":19,"h:mm":20,"h:mm:ss":21,"m/d/yy h:mm":22,"#,##0 ;(#,##0)":37,"#,##0 ;[Red](#,##0)":38,"#,##0.00;(#,##0.00)":39,"#,##0.00;[Red](#,##0.00)":40,"mm:ss":45,"[h]:mm:ss":46,"mmss.0":47,"##0.0E+0":48,"@":49},Hi=`\r
`,sP=65536;function Fd(e,t,s){if(!t&&t!==""&&t!==0)return"";let r=t;return typeof t=="boolean"&&s&&(r=s(t)),` ${e}="${r}"`}function rP(e={}){const r=["version"];return e.version||(e.version="1.0"),e.encoding&&r.push("encoding"),e.standalone&&r.push("standalone"),`<?xml ${r.map(n=>`${n}="${e[n]}"`).join(" ")} ?>`}function iP(e,t){let s="";if(e.properties){if(e.properties.prefixedAttributes)for(const r of e.properties.prefixedAttributes)for(const i of Object.keys(r.map))s+=Fd(r.prefix+i,r.map[i],t);if(e.properties.rawMap)for(const r of Object.keys(e.properties.rawMap))s+=Fd(r,e.properties.rawMap[r],t)}return s}var nP=class{constructor(e){this.booleanTransformer=e,this.chunks=[],this.currentChunk=[],this.currentChunkSize=0}writeElement(e){const{name:t,children:s,textNode:r}=e,i="<"+t+iP(e,this.booleanTransformer);if(!s&&r==null)this.write(i+"/>"+Hi);else if(r!=null)this.write(i+">"+r+"</"+t+">"+Hi);else{if(this.write(i+">"+Hi),s)for(const n of s)this.writeElement(n);this.write("</"+t+">"+Hi)}}toString(){return this.flush(),this.chunks.join("")}write(e){this.currentChunk.push(e),this.currentChunkSize+=e.length,this.currentChunkSize>=sP&&this.flush()}flush(){this.chunks.push(this.currentChunk.join("")),this.currentChunk.length=0,this.currentChunkSize=0}};function oP(e,t){const s=new nP(t);return s.writeElement(e),s.toString()}var aP=e=>Math.round(e*96/72),Rs=e=>Math.ceil(e*tP),lP=e=>{if(e===void 0)return;const s=["Automatic","Roman","Swiss","Modern","Script","Decorative"].indexOf(e||"Automatic");return Math.max(s,0)},Ui=(e,t)=>{if(!t)return;let s;return typeof t=="number"?s=t:s=t({rowIndex:e}),s},cP=(e,t)=>{const{colSpan:s,column:r}=e.position;if(e.width)if(s){const i=t.slice(r-1,r+s-1);let n=0;for(let o=0;o<i.length;o++){const a=i[o].getActualWidth();if(e.width<n+a){e.position.colSpan=o+1,e.totalWidth=e.width,e.width=e.totalWidth-n;break}n+=a}}else e.totalWidth=e.width},uP=(e,t)=>{const{rowSpan:s,row:r}=e.position;if(e.height)if(s){let i=0,n=0;for(let o=r;o<r+s;o++){const a=aP(Ui(o,t)||20);if(e.height<i+a){e.position.rowSpan=n+1,e.totalHeight=e.height,e.height=e.totalHeight-i;break}i+=a,n++}}else e.totalHeight=e.height},ve=(e,t)=>{const s=rP({encoding:"UTF-8",standalone:"yes"}),r=oP(e);return t?r:`${s}${r}`},as=e=>{const r=String.fromCharCode,i=Math.floor(e/26),n=e%26;return!i||e===26?r(65+e-1):n?i<26?r(65+i-1)+r(65+n-1):as(i)+r(65+n-1):as(i-1)+"Z"},dP=e=>e.replaceAll(`
`,"_x000a_"),vr=e=>{if(e==null)return null;let t="";for(let s=0;s<e.length;s++){const r=e.charCodeAt(s);if(r>=0&&r<=31&&r!==10){const o=`_x${r.toString(16).toUpperCase().padStart(4,"0")}_`;t+=o}else t+=e[s]}return t};function*hP(e){for(const t of e.keys()){const s=t.toString(),r={name:"t",textNode:eP(vr(s))};s.trim().length!==s.length&&(r.properties={rawMap:{"xml:space":"preserve"}}),yield{name:"si",children:[r]}}}var ta="_agSpanningHeader",pP=class extends Kw{constructor(e){super(e),this.useGridHeaderLayout=!0,this.mixedStyles={},this.mixedStyleCounter=0,this.rows=[],this.verticallySpannedHeaderStyles=new Map,this.frozenRowCount=0,this.emittedHeaderRowCount=0,this.spanningHeaderStyleRegistered=!1,this.skipFrozenRows=!1,this.frozenColumnCount=0,this.formulaSvc=e.formulaSvc,this.notesSvc=e.notesSvc,this.config={...e},this.workbook=e.workbook,this.stylesByIds={};for(const r of this.config.baseExcelStyles)this.stylesByIds[r.id]=r;const t={id:"_quotePrefix",quotePrefix:1};this.stylesByIds[t.id]=t;const s={id:ta,alignment:{vertical:"Center"}};this.stylesByIds[s.id]=s,this.excelStyles=[...this.config.baseExcelStyles,t]}addCustomContent(e){for(const t of e){const s=this.rows.length+1;let r;!this.config.suppressRowOutline&&t.outlineLevel!=null&&(r=t.outlineLevel);const i={height:Ui(s,t.height||this.config.rowHeight),cells:(t.cells||[]).map((n,o)=>{const a=this.addImage(s,this.columnsToExport[o],n.data?.value);let l=null;n.styleId&&(l=typeof n.styleId=="string"?[n.styleId]:n.styleId);const c=this.getStyleId(l);if(a)return this.createCell(c,this.getDataTypeForValue(a.value),a.value??"",void 0,n.note);const u=n.data?.value??"",d=this.getDataTypeForValue(u);return n.mergeAcross?this.createMergedCell(c,d,u,n.mergeAcross,n.note):this.createCell(c,d,u,void 0,n.note)}),outlineLevel:r};t.collapsed!=null&&(i.collapsed=t.collapsed),t.hidden!=null&&(i.hidden=t.hidden),this.rows.push(i)}}isSpanColumnHeader(){const{exportAsExcelTable:e,pivotModeActive:t}=this.config;return!e||!!t}onNewHeaderGroupingRow(){return this.createHeaderRow()}onNewHeaderRow(){return this.createHeaderRow()}createHeaderRow(){const e=[],{freezeRows:t,headerRowHeight:s}=this.config;return this.emittedHeaderRowCount+=1,this.rows.push({cells:e,height:Ui(this.rows.length+1,s)}),t&&this.frozenRowCount++,{onCell:r=>{const{columnSpan:i,rowSpan:n}=r;if(r.type==="covered"){const c=this.verticallySpannedHeaderStyles.get(r.columnIndex);e.push({styleId:c?.styleId,data:{type:"empty",value:null}}),c&&(c.remainingRows-=1,c.remainingRows||this.verticallySpannedHeaderStyles.delete(r.columnIndex));return}if(r.type==="column"){const c=r.column,u=this.extractHeaderValue(c),d=this.config.styleLinker({rowType:"HEADER",rowIndex:this.rows.length,value:u,column:c});n>1&&this.registerSpanningHeaderStyle();const h=n>1?[ta,...d]:d,p=this.getStyleId(h)??void 0;e.push({...this.createCell(p,this.getDataTypeForValue("string"),u),mergeDown:n>1?n-1:void 0}),n>1&&this.verticallySpannedHeaderStyles.set(r.columnIndex,{styleId:p,remainingRows:n-1});return}const o=r.column,a=o?this.extractGroupHeaderValue(o):"",l=this.config.styleLinker({rowType:"HEADER_GROUPING",rowIndex:1,value:`grouping-${a}`,columnGroup:o});e.push({...this.createMergedCell(this.getStyleId(l),this.getDataTypeForValue("string"),a,i-1),collapsibleRanges:r.collapsibleGroupRanges})}}}onNewBodyRow(e){const{freezeRows:t,rowHeight:s}=this.config;this.skipFrozenRows||(t==="headersAndPinnedRows"&&e?.rowPinned==="top"?this.frozenRowCount++:typeof t=="function"?t(Vi(this.gos,{node:e}))?this.frozenRowCount++:this.skipFrozenRows=!0:this.skipFrozenRows=!0);const r=this.onNewRow(this.onNewBodyColumn,s);return e&&this.addRowOutlineIfNecessary(e),r}prepare(e){super.prepare(e),this.emittedHeaderRowCount=0,this.columnsToExport=[...e],this.cols=e.map((t,s)=>this.convertColumnToExcel(t,s)),this.frozenColumnCount=this.countFrozenColumns(e)}countFrozenColumns(e){const{freezeColumns:t,rightToLeft:s}=this.config;if(!t)return 0;const r=s?2:0,i=e.length;for(let n=0;n<i;++n){const o=e[n];if(!(t==="pinned"?o.pinnedLane===r:typeof t=="function"&&t(Vi(this.gos,{column:o}))))return n}return i}registerSpanningHeaderStyle(){this.spanningHeaderStyleRegistered||(this.excelStyles.push(this.stylesByIds[ta]),this.spanningHeaderStyleRegistered=!0)}parse(){this.config.headerRowCount=this.emittedHeaderRowCount;const e=this.rows.reduce((s,r)=>Math.max(s,r.cells.length),0);for(;this.cols.length<e;)this.cols.push(this.convertColumnToExcel(null,this.cols.length+1));const t=this.createWorksheet();return this.addWorksheetToWorkbook(t)}createWorksheet(){const{sheetName:e}=this.config;let t;if(e!=null){const s=typeof e=="function"?e(Vi(this.gos,{})):e;t=String(s).substring(0,31)}else t="ag-grid";return{name:t,table:{columns:this.cols,rows:this.rows}}}addRowOutlineIfNecessary(e){const{gos:t,suppressRowOutline:s,rowGroupExpandState:r="expanded"}=this.config;if(t.get("groupHideOpenParents")||s||e.level==null)return;const n=e.footer&&e.level!==-1?1:0,o=qA(this.rows);if(o.outlineLevel=Math.min(this.getExportedLevel(e)+n,7),r==="expanded")return;const a=r==="collapsed";if(e.isExpandable()){const l=!a&&e.expanded;o.collapsed=!l}o.hidden=!!e.parent&&e.parent.level!==-1&&(a||this.isAnyParentCollapsed(e.parent))}getExportedLevel(e){const t=this.gos;let s=0,r=e.parent;for(;r&&r.level!==-1;)JA(t,r)||s++,r=r.parent;return s}isAnyParentCollapsed(e){for(;e&&e.level!==-1;){if(!e.expanded)return!0;e=e.parent}return!1}convertColumnToExcel(e,t){const s=this.config.columnWidth,i=(e?this.extractHeaderValue(e):void 0)??"",n=e?e.isFilterAllowed():!1;return s?typeof s=="number"?{width:s,displayName:i,filterAllowed:n}:{width:s({column:e,index:t}),displayName:i,filterAllowed:n}:e?{width:Math.max(e.getActualWidth(),75),displayName:i,filterAllowed:n}:{displayName:i,filterAllowed:n}}onNewBodyColumn(e,t){let s=0;return(r,i,n)=>{if(s>0){s-=1;return}const{value:o,valueFormatted:a}=this.extractRowCellValue({column:r,node:n,currentColumnIndex:i,accumulatedRowIndex:e,type:"excel",useRawFormula:!0}),l=o,c=typeof l=="bigint"?l.toString():l,u=this.config.styleLinker({rowType:"BODY",rowIndex:e,value:l,column:r,node:n}),d=this.getStyleId(u),h=XA(this.columnsToExport,i,n),p=this.addImage(e,r,c),g=this.resolveBodyCellNote({accumulatedRowIndex:e,column:r,node:n}),f=!p&&this.transformValues&&r.showValuesAs!=null&&(!n.group||!this.valueSvc.displayIgnoresAggData(n));if(p)t.push(this.createCell(d,this.getDataTypeForValue(p.value),p.value??"",void 0,g));else if(h>1)s=h-1,t.push(this.createMergedCell(d,f?"s":this.getDataTypeForValue(l),f?a??c:c,h-1,g));else{const m=!f&&r.allowFormula&&this.formulaSvc?.isFormula(c),v=f?"s":this.getDataTypeForValue(l);let C=c;m?C=this.formulaSvc?.updateFormulaByOffset({value:c,rowDelta:e-(n.formulaRowIndex+1),useRefFormat:!1}):f&&(C=a??c);const b=this.createCell(d,m?"f":v,C,a,g);t.push(b)}}}onNewRow(e,t){const s=[];return this.rows.push({cells:s,height:Ui(this.rows.length+1,t)}),{onColumn:e.bind(this,this.rows.length,s)()}}addWorksheetToWorkbook(e){const{excelStyles:t,config:s}=this;return this.mapSharedStrings(e),this.frozenColumnCount&&(s.frozenColumnCount=this.frozenColumnCount),this.frozenRowCount&&(s.frozenRowCount=this.frozenRowCount),this.workbook.addWorksheet(t,e,s)}mapSharedStrings(e){for(const t of e.table.rows)for(const s of t.cells){const r=s.data;if(r?.type!=="s")continue;const i=r.value;i==null||i===""||(r.value=this.workbook.getStringPosition(String(i)).toString())}}getDataTypeForValue(e){if(e===void 0)return"empty";if(typeof e=="number")return Number.isFinite(e)?"n":"s";let t="s";try{this.isNumerical(e)&&(t="n")}catch{}return t}getTypeFromStyle(e,t){if(this.isFormula(t))return"f";if(e?.dataType)switch(e.dataType.toLocaleLowerCase()){case"formula":return"f";case"string":return"s";case"number":return"n";case"datetime":return"d";case"error":return"e";case"boolean":return"b";default:this.log.warn(162,{id:e.id,dataType:e.dataType})}return null}addImage(e,t,s){if(!this.config.addImageToCell)return;const r=this.config.addImageToCell(e,t,s);if(r)return this.workbook.addBodyImageToMap(r.image,e,t,this.columnsToExport,this.config.rowHeight),r}createCell(e,t,s,r,i){const n=this.getStyleById(e);!n?.dataType&&t==="s"&&r!=null&&(s=r);const o=this.getTypeFromStyle(n,s)||t,{type:a,value:l,escaped:c}=this.getCellValue(o,s);return e=n?e:void 0,c&&(e=e==null?"_quotePrefix":this.getStyleId([e,"_quotePrefix"])),{styleId:e||void 0,data:{type:a,value:l},note:i?.text?i:void 0}}createMergedCell(e,t,s,r,i){const n=this.getStyleById(e),o=s??"",a=this.getTypeFromStyle(n,o)||t,{type:l,value:c}=this.getCellValue(a,o);return{styleId:n?e:void 0,data:{type:l,value:c},mergeAcross:r,note:i?.text?i:void 0}}resolveBodyCellNote(e){const{processNoteCallback:t,suppressGridNotesExport:s}=this.config,r=!s&&!!this.notesSvc?.hasDataSource(),n=!!this.notesSvc&&(r||!!t)?this.notesSvc?.getNote({rowNode:e.node,column:e.column,location:"cell"}):void 0;let o;if(r&&n?.text!=null&&n.text!==""&&(o={text:n.text,author:n.author}),!t)return o;const a=t(this.getCellNoteExportParams(e,n,o));if(a===void 0)return o;if(!(a?.text==null||a.text===""))return{text:a.text,author:a.author}}getCellNoteExportParams(e,t,s){const{column:r,node:i,accumulatedRowIndex:n}=e,o=this.valueSvc,a=this.valueFrom,l=o.getDisplayValue(r,i,a,this.transformValues);return Vi(this.gos,{accumulatedRowIndex:n,column:r,node:i,value:l,type:"excel",parseValue:c=>o.parseValue(r,i,c,o.getValue(r,i,a)),formatValue:c=>(this.transformValues?o.formatTransformedValue(r,i,c):void 0)??o.formatValue(r,i,c)??c,gridNote:t,excelNote:s})}getCellValue(e,t){let s=!1;if(t==null||t===""||e==="empty")return{type:"empty",value:null,escaped:!1};if(e==="s"){if(t=String(t),t[0]==="'"&&(s=!0,t=t.slice(1),t===""))return{type:"empty",value:null,escaped:!1}}else if(e==="f")t=this.addXlfnPrefix(t).slice(1);else if(e==="n"){const r=Number(t);if(Number.isNaN(r))return{type:"empty",value:null,escaped:!1};t=r.toString()}return{type:e,value:t,escaped:s}}addXlfnPrefix(e){if(!e)return e;const t=/(^|[^A-Z0-9._])(CONCAT)(\s*\()/gi;return e.replace(t,(s,r,i,n)=>`${r}_xlfn.${i}${n}`)}getStyleId(e){if(!e?.length)return null;let t=null,s;const r=this.stylesByIds;for(let n=0,o=e.length;n<o;++n){const a=e[n];r[a]!=null&&(t===null?t=a:(s??(s=[t]),s.push(a)))}if(!s)return t;const i=s.join("-");return this.mixedStyles[i]||this.addNewMixedStyle(s),this.mixedStyles[i].excelID}addNewMixedStyle(e){this.mixedStyleCounter+=1;const t=`mixedStyle${this.mixedStyleCounter}`,s={};for(const i of e){const n=this.stylesByIds[i];n&&QA(s,n,!0,!0)}s.id=t;const r=e.join("-");this.mixedStyles[r]={excelID:t,key:r,result:s},this.excelStyles.push(s),this.stylesByIds[t]=s}isFormula(e){return!this.config.autoConvertFormulas||e==null?!1:YA(String(e))}isNumerical(e){return typeof e=="bigint"?!1:Number.isFinite(Number(e))&&e!==""&&!Number.isNaN(Number.parseFloat(e))}getStyleById(e){return e==null?null:this.stylesByIds[e]||null}};import{_escapeString as gP}from"ag-stack";import{_escapeString as Td}from"ag-stack";var Ad={name:"rPr",children:[{name:"sz",properties:{rawMap:{val:"10"}}},{name:"color",properties:{rawMap:{rgb:"FF000000"}}},{name:"rFont",properties:{rawMap:{val:"Tahoma"}}},{name:"family",properties:{rawMap:{val:"2"}}}]},fP={name:"rPr",children:[{name:"b"},...Ad.children]},mP=(e,t)=>({name:"t",properties:t?{rawMap:{"xml:space":"preserve"}}:void 0,textNode:Td(vr(e)??"")}),sa=(e,t,s)=>({name:"r",children:[t?fP:Ad,mP(e,s)]}),vP=(e,t,s)=>!t||!s?[sa(e,!1,e.includes(`
`)||e.trim().length!==e.length)]:[sa(`${t}:
`,!0,!0),sa(e,!1,e.includes(`
`)||e.trim().length!==e.length)],CP={getTemplate(e){const t=new Map,s=[],r=e.comments.map(i=>{const n=i.author||e.defaultAuthor;let o=t.get(n);return o==null&&(o=s.length,s.push(n),t.set(n,o)),{name:"comment",properties:{rawMap:{ref:i.ref,authorId:o}},children:[{name:"text",children:vP(i.text,n,e.prependAuthor)}]}});return{name:"comments",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main"}},children:[{name:"authors",children:s.map(i=>({name:"author",textNode:Td(i)}))},{name:"commentList",children:r}]}}},bP=CP,SP={getTemplate(e){const{name:t,ContentType:s,Extension:r,PartName:i}=e;return{name:t,properties:{rawMap:{Extension:r,PartName:i,ContentType:s}}}}},yP=SP,zi=e=>e==="jpg"?"jpeg":e,wP={getTemplate({sheetLen:e,hasCustomProperties:t}){const s=new Array(e).fill(void 0).map((p,g)=>({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",PartName:`/xl/worksheets/sheet${g+1}.xml`})),r=Vt.size,i=We.size,n=Je.size,o={};Is.forEach(p=>{o[zi(p.type)]=!0});const a=new Array(r).fill(void 0).map((p,g)=>({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.drawing+xml",PartName:`/xl/drawings/drawing${g+1}.xml`})),l=[],c=new Array(n).fill(void 0).map((p,g)=>({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",PartName:`/xl/comments${g+1}.xml`}));Ke.forEach(({name:p})=>{l.push({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml",PartName:`/xl/tables/${p}.xml`})});const u=t?[{name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.custom-properties+xml",PartName:"/docProps/custom.xml"}]:[],d=Object.keys(o).map(p=>({name:"Default",ContentType:`image/${p}`,Extension:p}));(i||n)&&d.push({name:"Default",Extension:"vml",ContentType:"application/vnd.openxmlformats-officedocument.vmlDrawing"});const h=[...d,{name:"Default",Extension:"rels",ContentType:"application/vnd.openxmlformats-package.relationships+xml"},{name:"Default",ContentType:"application/xml",Extension:"xml"},{name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",PartName:"/xl/workbook.xml"},...s,{name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.theme+xml",PartName:"/xl/theme/theme1.xml"},{name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",PartName:"/xl/styles.xml"},{name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",PartName:"/xl/sharedStrings.xml"},...a,...c,...l,{name:"Override",ContentType:"application/vnd.openxmlformats-package.core-properties+xml",PartName:"/docProps/core.xml"},...u].map(p=>yP.getTemplate(p));return{name:"Types",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"}},children:h}}},xP=wP,FP={getTemplate(e){const s=new Date().toJSON();return{name:"cp:coreProperties",properties:{prefixedAttributes:[{prefix:"xmlns:",map:{cp:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",dc:"http://purl.org/dc/elements/1.1/",dcterms:"http://purl.org/dc/terms/",dcmitype:"http://purl.org/dc/dcmitype/",xsi:"http://www.w3.org/2001/XMLSchema-instance"}}]},children:[{name:"dc:creator",textNode:e},{name:"dc:title",textNode:"Workbook"},{name:"dcterms:created",properties:{rawMap:{"xsi:type":"dcterms:W3CDTF"}},textNode:s},{name:"dcterms:modified",properties:{rawMap:{"xsi:type":"dcterms:W3CDTF"}},textNode:s}]}}},TP=FP;import{_escapeString as Pd}from"ag-stack";var AP="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",PP=e=>Object.keys(e).filter(s=>s&&e[s]!=null).map((s,r)=>({name:"property",properties:{rawMap:{fmtid:AP,pid:(r+2).toString(),name:Pd(s)??""}},children:[{name:"vt:lpwstr",textNode:Pd(vr(String(e[s])))??""}]})),RP={getTemplate(e){return{name:"Properties",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties","xmlns:vt":"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"}},children:PP(e)}}},MP=RP;import{_clamp as Rd}from"ag-grid-community";var Md=(e,t)=>({name:`xdr:${e}`,children:[{name:"xdr:col",textNode:t.col.toString()},{name:"xdr:colOff",textNode:t.offsetX.toString()},{name:"xdr:row",textNode:t.row.toString()},{name:"xdr:rowOff",textNode:t.offsetY.toString()}]}),IP=e=>{const t=[{name:"a:ext",properties:{rawMap:{uri:"{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}"}},children:[{name:"a16:creationId",properties:{rawMap:{id:"{822E6D20-D7BC-2841-A643-D49A6EF008A2}","xmlns:a16":"http://schemas.microsoft.com/office/drawing/2014/main"}}}]}];switch(e.recolor?.toLowerCase()){case"grayscale":case"sepia":case"washout":t.push({name:"a:ext",properties:{rawMap:{uri:"{C183D7F6-B498-43B3-948B-1728B52AA6E4}"}},children:[{name:"adec:decorative",properties:{rawMap:{val:"0","xmlns:adec":"http://schemas.microsoft.com/office/drawing/2017/decorative"}}}]})}return{name:"a:extLst",children:t}},EP=(e,t)=>({name:"xdr:nvPicPr",children:[{name:"xdr:cNvPr",properties:{rawMap:{id:t,name:e.id,descr:e.altText??void 0}},children:[IP(e)]},{name:"xdr:cNvPicPr",properties:{rawMap:{preferRelativeResize:"0"}},children:[{name:"a:picLocks"}]}]}),Id=e=>{if(!e.saturation&&!e.tint)return;const t=[];return e.saturation&&t.push({name:"a:satMod",properties:{rawMap:{val:e.saturation*1e3}}}),e.tint&&t.push({name:"a:tint",properties:{rawMap:{val:e.tint*1e3}}}),t},DP=(e,t)=>({name:"a:duotone",children:[{name:"a:prstClr",properties:{rawMap:{val:e.color}},children:Id(e)},{name:"a:srgbClr",properties:{rawMap:{val:t.color}},children:Id(t)}]}),LP=(e,t)=>{let s;if(e.transparency){const r=Rd(e.transparency,0,100);s=[{name:"a:alphaModFix",properties:{rawMap:{amt:1e5-Math.round(r*1e3)}}}]}if(e.recolor)switch(s??(s=[]),e.recolor.toLocaleLowerCase()){case"grayscale":s.push({name:"a:grayscl"});break;case"sepia":s.push(DP({color:"black"},{color:"D9C3A5",tint:50,saturation:180}));break;case"washout":s.push({name:"a:lum",properties:{rawMap:{bright:"70000",contrast:"-70000"}}});break;default:}return{name:"xdr:blipFill",children:[{name:"a:blip",properties:{rawMap:{cstate:"print","r:embed":`rId${t}`,"xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships"}},children:s},{name:"a:stretch",children:[{name:"a:fillRect"}]}]}},kP=(e,t)=>{const s={name:"a:xfrm",children:[{name:"a:off",properties:{rawMap:{x:0,y:0}}},{name:"a:ext",properties:{rawMap:{cx:t.width,cy:t.height}}}]};if(e.rotation){const n=e.rotation;s.properties={rawMap:{rot:Rd(n,0,360)*6e4}}}return{name:"xdr:spPr",children:[s,{name:"a:prstGeom",properties:{rawMap:{prst:"rect"}},children:[{name:"a:avLst"}]}]}},_P=e=>{e.fitCell=!!e.fitCell||!e.width||!e.height;const{position:t={},fitCell:s,width:r=0,height:i=0,totalHeight:n,totalWidth:o}=e,{offsetX:a=0,offsetY:l=0,row:c=1,rowSpan:u=1,column:d=1,colSpan:h=1}=t;return{from:{row:c-1,col:d-1,offsetX:Rs(a),offsetY:Rs(l)},to:{row:c-1+(s?1:u-1),col:d-1+(s?1:h-1),offsetX:Rs(r+a),offsetY:Rs(i+l)},height:Rs(n||i),width:Rs(o||r)}},GP=(e,t,s,r)=>({name:"xdr:pic",children:[EP(e,t+1),LP(e,s+1),kP(e,r)]});function*OP(e){const t=Vt.get(e),s=Es.get(e);for(let r=0,i=t.length;r<i;++r){const n=t[r],o=_P(n);yield{name:"xdr:twoCellAnchor",properties:{rawMap:{editAs:"absolute"}},children:[Md("from",o.from),Md("to",o.to),GP(n,r,s.get(n.id).index,o),{name:"xdr:clientData"}]}}}var NP={getTemplate(e){return{name:"xdr:wsDr",properties:{rawMap:{"xmlns:a":"http://schemas.openxmlformats.org/drawingml/2006/main","xmlns:xdr":"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"}},children:OP(e.sheetIndex)}}},BP=NP,Ed=e=>{let t=0,s=0;for(;s<e.length;){const i=e.charCodeAt(s);if(i<65||i>90)break;t=t*26+(i-64),s++}return{row:Number(e.slice(s))-1,column:t-1}},VP=()=>({name:"o:shapelayout",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}]},children:[{name:"o:idmap",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}],rawMap:{data:"1"}}}]}),HP=()=>({name:"v:shapetype",properties:{prefixedAttributes:[{prefix:"o:",map:{spt:"202"}}],rawMap:{id:"_x0000_t202",coordsize:"21600,21600",path:"m0,0l0,21600,21600,21600,21600,0xe"}},children:[{name:"v:stroke",properties:{rawMap:{joinstyle:"miter"}}},{name:"v:path",properties:{prefixedAttributes:[{prefix:"o:",map:{connecttype:"rect"}}],rawMap:{gradientshapeok:"t"}}}]}),UP=e=>{const{row:t,column:s}=Ed(e.ref);return`${s+1},0,${t+1},0,${s+3},20,${t+5},20`},zP=e=>{const{row:t,column:s}=Ed(e.ref);return{name:"x:ClientData",properties:{rawMap:{ObjectType:"Note"}},children:[{name:"x:MoveWithCells"},{name:"x:SizeWithCells"},{name:"x:Anchor",textNode:UP(e)},{name:"x:AutoFill",textNode:"False"},{name:"x:Row",textNode:String(t)},{name:"x:Column",textNode:String(s)}]}},WP=(e,t)=>({name:"v:shape",properties:{prefixedAttributes:[{prefix:"o:",map:{insetmode:"auto"}}],rawMap:{id:`_x0000_s${1025+t}`,type:"#_x0000_t202",style:"position:absolute;margin-left:80pt;margin-top:5pt;width:104pt;height:64pt;z-index:10;visibility:hidden",fillcolor:"#ffffe1",strokecolor:"#000000"}},children:[{name:"v:fill",properties:{rawMap:{color2:"#ffffe1"}}},{name:"v:shadow",properties:{rawMap:{color:"black",obscured:"t"}}},{name:"v:path",properties:{prefixedAttributes:[{prefix:"o:",map:{connecttype:"none"}}]}},{name:"v:textbox",properties:{rawMap:{style:"mso-direction-alt:auto"}},children:[{name:"div",properties:{rawMap:{style:"text-align:left"}}}]},zP(e)]}),KP={getTemplate(e){const t=Je.get(e.sheetIndex)??[];return{name:"xml",properties:{prefixedAttributes:[{prefix:"xmlns:",map:{v:"urn:schemas-microsoft-com:vml",o:"urn:schemas-microsoft-com:office:office",x:"urn:schemas-microsoft-com:office:excel"}}]},children:[VP(),HP(),...t.map((s,r)=>WP(s,r))]}}},$P=KP,jP={getTemplate(e){const{Id:t,Type:s,Target:r}=e;return{name:"Relationship",properties:{rawMap:{Id:t,Type:s,Target:r}}}}},YP=jP,qP={getTemplate(e){const t=e.map(s=>YP.getTemplate(s));return{name:"Relationships",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"}},children:t}}},Cr=qP,ZP={getTemplate(e){return{name:"sst",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main",count:e.size,uniqueCount:e.size}},children:hP(e)}}},XP=ZP,JP=e=>{switch(e){case 1:return"thin";case 2:return"medium";case 3:return"thick";default:return"hair"}},QP={None:"None",Dot:"Dotted",Dash:"Dashed",Double:"Double",DashDot:"DashDot",DashDotDot:"DashDotDot",SlantDashDot:"SlantDashDot",Continuous:"Continuous"},eR=["Dashed","DashDot","DashDotDot"],tR={None:"none",Solid:"solid",Gray50:"mediumGray",Gray75:"darkGray",Gray25:"lightGray",HorzStripe:"darkHorizontal",VertStripe:"darkVertical",ReverseDiagStripe:"darkDown",DiagStripe:"darkUp",DiagCross:"darkGrid",ThickDiagCross:"darkTrellis",ThinHorzStripe:"lightHorizontal",ThinVertStripe:"lightVertical",ThinReverseDiagStripe:"lightDown",ThinDiagStripe:"lightUp",ThinHorzCross:"lightGrid",ThinDiagCross:"lightTrellis",Gray125:"gray125",Gray0625:"gray0625"},sR={Automatic:"general",Left:"left",Center:"center",Right:"right",Fill:"fill",Justify:"justify",CenterAcrossSelection:"centerContinuous",Distributed:"distributed",JustifyDistributed:"justify"},rR={Automatic:void 0,Top:"top",Bottom:"bottom",Center:"center",Justify:"justify",Distributed:"distributed",JustifyDistributed:"justify"},iR=e=>e?tR[e]||e:"none",Bt=e=>e==null?e:(e.charAt(0)==="#"&&(e=e.substring(1)),e.length===6?"FF"+e:e),Wi=(e,t)=>{if(!e)return"thin";const s=JP(t);if(e==="Continuous")return s;const r=QP[e];return s==="medium"&&eR.some(i=>i===r)?`medium${r}`:`${r.charAt(0).toLowerCase()}${r.substring(1)}`},nR=e=>sR[e]||"general",oR=e=>rR[e]||void 0,br=e=>({name:"color",properties:{rawMap:{rgb:Bt(e||"#000000")}}}),aR={getTemplate(e){const{left:t,right:s,top:r,bottom:i,diagonal:n}=e,o=t?[br(t.color)]:void 0,a=s?[br(s.color)]:void 0,l=r?[br(r.color)]:void 0,c=i?[br(i.color)]:void 0,u=n?[br(n.color)]:void 0;return{name:"border",children:[{name:"left",properties:{rawMap:{style:t?.style}},children:o},{name:"right",properties:{rawMap:{style:s?.style}},children:a},{name:"top",properties:{rawMap:{style:r?.style}},children:l},{name:"bottom",properties:{rawMap:{style:i?.style}},children:c},{name:"diagonal",properties:{rawMap:{style:n?.style}},children:u}]}}},lR=aR,cR={getTemplate(e){return{name:"borders",properties:{rawMap:{count:e.length}},children:e.map(t=>lR.getTemplate(t))}}},uR=cR,dR=e=>{const s=["Context","LeftToRight","RightToLeft"].indexOf(e);return Math.max(s,0)},hR={getTemplate(e){const{horizontal:t,indent:s,readingOrder:r,rotate:i,shrinkToFit:n,vertical:o,wrapText:a}=e;return{name:"alignment",properties:{rawMap:{horizontal:t&&nR(t),indent:s,readingOrder:r&&dR(r),textRotation:i,shrinkToFit:n,vertical:o&&oR(o),wrapText:a}}}}},pR=hR,gR={getTemplate(e){const t=e.protected===!1?0:1;return{name:"protection",properties:{rawMap:{hidden:e.hideFormula===!0?1:0,locked:t}}}}},fR=gR,mR={getTemplate(e){const{alignment:t,borderId:s,fillId:r,fontId:i,numFmtId:n,protection:o,quotePrefix:a,xfId:l}=e,c=[];return t&&c.push(pR.getTemplate(t)),o&&c.push(fR.getTemplate(o)),{name:"xf",properties:{rawMap:{applyAlignment:t?1:void 0,applyProtection:o?1:void 0,applyBorder:s?1:void 0,applyFill:r?1:void 0,borderId:s,fillId:r,applyFont:i?1:void 0,fontId:i,applyNumberFormat:n?1:void 0,numFmtId:n,quotePrefix:a?1:void 0,xfId:l}},children:c.length?c:void 0}}},Dd=mR,vR={getTemplate(e){return{name:"cellStyleXfs",properties:{rawMap:{count:e.length}},children:e.map(t=>Dd.getTemplate(t))}}},CR=vR,bR={getTemplate(e){const{builtinId:t,name:s,xfId:r}=e;return{name:"cellStyle",properties:{rawMap:{builtinId:t,name:s,xfId:r}}}}},SR=bR,yR={getTemplate(e){return{name:"cellStyles",properties:{rawMap:{count:e.length}},children:e.map(t=>SR.getTemplate(t))}}},wR=yR,xR={getTemplate(e){return{name:"cellXfs",properties:{rawMap:{count:e.length}},children:e.map(t=>Dd.getTemplate(t))}}},FR=xR,TR={getTemplate(e){const{patternType:t,fgTheme:s,fgTint:r,fgRgb:i,bgRgb:n,bgIndexed:o}=e,a={name:"patternFill",properties:{rawMap:{patternType:t}}};return(s||r||i)&&(a.children=[{name:"fgColor",properties:{rawMap:{theme:s,tint:r,rgb:i}}}]),(o||n)&&(a.children??(a.children=[]),a.children.push({name:"bgColor",properties:{rawMap:{indexed:o,rgb:n}}})),{name:"fill",children:[a]}}},AR=TR,PR={getTemplate(e){return{name:"fills",properties:{rawMap:{count:e.length}},children:e.map(t=>AR.getTemplate(t))}}},RR=PR,MR={getTemplate(e){const{size:t,colorTheme:s,color:r="FF000000",fontName:i="Calibri",family:n,scheme:o,italic:a,bold:l,strikeThrough:c,outline:u,shadow:d,underline:h,verticalAlign:p}=e,g=[{name:"sz",properties:{rawMap:{val:t}}},{name:"color",properties:{rawMap:{theme:s,rgb:r}}},{name:"name",properties:{rawMap:{val:i}}}];return n&&g.push({name:"family",properties:{rawMap:{val:n}}}),o&&g.push({name:"scheme",properties:{rawMap:{val:o}}}),a&&g.push({name:"i"}),l&&g.push({name:"b"}),c&&g.push({name:"strike"}),u&&g.push({name:"outline"}),d&&g.push({name:"shadow"}),h&&g.push({name:"u",properties:{rawMap:{val:h}}}),p&&g.push({name:"vertAlign",properties:{rawMap:{val:p}}}),{name:"font",children:g}}},IR=MR,ER={getTemplate(e){return{name:"fonts",properties:{rawMap:{count:e.length}},children:e.map(t=>IR.getTemplate(t))}}},DR=ER;import{_escapeString as LR,_splitBracketed as kR}from"ag-stack";function _R(e){const t=kR(e);for(let s=0;s<t.length;s++){let r=t[s];r.length&&(r.startsWith("[")||(r=r.replace(/\$/g,'"$"')),t[s]=LR(r))}return t.join("")}var GR={getTemplate(e){let{formatCode:t,numFmtId:s}=e;return t.length&&(t=_R(t)),{name:"numFmt",properties:{rawMap:{formatCode:t,numFmtId:s}}}}},OR=GR,NR={getTemplate(e){return{name:"numFmts",properties:{rawMap:{count:e.length}},children:e.map(t=>OR.getTemplate(t))}}},BR=NR,Ki,Ms,Sr,yr,wr,Ld,$i,kd,ra,_d=(e,t)=>(e.includes("mixedStyle")&&t>1&&(e+=`_${t}`),e),Gd=()=>{Ki={base:0},Ms=[],Sr=[{fontName:"Calibri",colorTheme:"1",family:"2",scheme:"minor"}],yr=[{patternType:"none"},{patternType:"gray125"}],wr=[{left:void 0,right:void 0,top:void 0,bottom:void 0,diagonal:void 0}],Ld=[{borderId:0,fillId:0,fontId:0,numFmtId:0}],$i=[{borderId:0,fillId:0,fontId:0,numFmtId:0,xfId:0}],kd=[{builtinId:0,name:"Normal",xfId:0}]},VR=e=>{const t=iR(e.pattern),s=Bt(e.color),r=Bt(e.patternColor);let i=yr.findIndex(n=>{const{patternType:o,fgRgb:a,bgRgb:l}=n;return!(o!=t||a!=s||l!=r)});return i===-1&&(i=yr.length,yr.push({patternType:t,fgRgb:s,bgRgb:r})),i},HR=e=>{if(xd[e])return xd[e];let t=Ms.findIndex(s=>s.formatCode===e);return t===-1?(t=Ms.length+164,Ms.push({formatCode:e,numFmtId:t})):t=Ms[t].numFmtId,t},UR=e=>{const{borderBottom:t,borderTop:s,borderLeft:r,borderRight:i}=e;let n,o,a,l,c,u,d,h;r&&(a=Wi(r.lineStyle,r.weight),d=Bt(r.color)),i&&(l=Wi(i.lineStyle,i.weight),h=Bt(i.color)),t&&(n=Wi(t.lineStyle,t.weight),c=Bt(t.color)),s&&(o=Wi(s.lineStyle,s.weight),u=Bt(s.color));let p=wr.findIndex(g=>{const{left:f,right:m,top:v,bottom:C}=g;if(!f&&(a||d)||!m&&(l||h)||!v&&(o||u)||!C&&(n||c))return!1;const{style:b,color:y}=f??{},{style:S,color:w}=m??{},{style:F,color:T}=v??{},{style:x,color:P}=C??{};return!(b!=a||y!=d||S!=l||w!=h||F!=o||T!=u||x!=n||P!=c)});return p===-1&&(p=wr.length,wr.push({left:{style:a,color:d},right:{style:l,color:h},top:{style:o,color:u},bottom:{style:n,color:c},diagonal:{style:void 0,color:void 0}})),p},zR=e=>{const{fontName:t="Calibri",color:s,size:r,bold:i,italic:n,outline:o,shadow:a,strikeThrough:l,underline:c,family:u,verticalAlign:d}=e,h=Bt(s),p=lP(u),g=c?c.toLocaleLowerCase():void 0,f=d?d.toLocaleLowerCase():void 0;let m=Sr.findIndex(v=>!(v.fontName!=t||v.color!=h||v.size!=r||v.bold!=i||v.italic!=n||v.outline!=o||v.shadow!=a||v.strikeThrough!=l||v.underline!=g||v.verticalAlign!=f||v.family!=p));return m===-1&&(m=Sr.length,Sr.push({fontName:t,color:h,size:r,bold:i,italic:n,outline:o,shadow:a,strikeThrough:l,underline:g,verticalAlign:f,family:p?.toString()})),m},WR=e=>{const{alignment:t,borders:s,font:r,interior:i,numberFormat:n,protection:o,quotePrefix:a}=e;let{id:l}=e,c=0,u=0,d=0,h=0;l&&(l=_d(l,ra),Ki[l]==null&&(i&&(c=VR(i)),s&&(u=UR(s)),r&&(d=zR(r)),n&&(h=HR(n.format)),Ki[l]=$i.length,$i.push({alignment:t,borderId:u||0,fillId:c||0,fontId:d||0,numFmtId:h||0,protection:o,quotePrefix:a,xfId:0})))},KR={getTemplate(e){const t=BR.getTemplate(Ms),s=DR.getTemplate(Sr.map(l=>({...l,size:l.size??e}))),r=RR.getTemplate(yr),i=uR.getTemplate(wr),n=CR.getTemplate(Ld),o=FR.getTemplate($i),a=wR.getTemplate(kd);return Gd(),{name:"styleSheet",properties:{rawMap:{"mc:Ignorable":"x14ac x16r2 xr",xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:x14ac":"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac","xmlns:x16r2":"http://schemas.microsoft.com/office/spreadsheetml/2015/02/main","xmlns:xr":"http://schemas.microsoft.com/office/spreadsheetml/2014/revision"}},children:[t,s,r,i,n,o,a,{name:"tableStyles",properties:{rawMap:{count:0,defaultPivotStyle:"PivotStyleLight16",defaultTableStyle:"TableStyleMedium2"}}}]}}},$R=(e,t)=>Ki[_d(e,t)]||0,jR=(e,t)=>{ra=t,ra===1&&Gd(),e.forEach(WR)},YR=KR;import{_escapeString as qR}from"ag-stack";var ZR={getTemplate(e,t){const{name:s,columns:r,rowRange:i,displayName:n,showRowStripes:o,showColumnStripes:a,showFilterButtons:l,highlightFirstColumn:c,highlightLastColumn:u}=e||{},d=!i||i[0]-i[1]===0;if(!e||!s||!Array.isArray(r)||!r.length||d)return{name:"table"};const h=r.map((C,b)=>({name:"filterColumn",properties:{rawMap:{colId:b.toString(),hiddenButton:l[b]?0:1}}})),p=`A${i[0]}`,g=`${as(r.length)}${i[1]}`,f=`${p}:${g}`,m=`${t+1}`,v=t?`${n}_${m}`:n;return{name:"table",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","mc:Ignorable":"xr xr3","xmlns:xr":"http://schemas.microsoft.com/office/spreadsheetml/2014/revision","xmlns:xr3":"http://schemas.microsoft.com/office/spreadsheetml/2016/revision3",name:v,displayName:v,ref:f,totalsRowShown:0,id:m}},children:[{name:"autoFilter",properties:{rawMap:{ref:f}},children:h},{name:"tableColumns",properties:{rawMap:{count:r.length}},children:r.map((C,b)=>({name:"tableColumn",properties:{rawMap:{id:(b+1).toString(),name:qR(dP(C)),dataCellStyle:"Normal"}}}))},{name:"tableStyleInfo",properties:{rawMap:{name:"TableStyleLight1",showFirstColumn:c?1:0,showLastColumn:u?1:0,showRowStripes:o?1:0,showColumnStripes:a?1:0}}}]}}},XR=ZR,ze=e=>{const[t,s,r,i]=e;return{name:`a:${t}`,children:[{name:`a:${s}`,properties:{rawMap:{val:r,lastClr:i}}}]}},JR={getTemplate(){return{name:"a:clrScheme",properties:{rawMap:{name:"Office"}},children:[ze(["dk1","sysClr","windowText","000000"]),ze(["lt1","sysClr","window","FFFFFF"]),ze(["dk2","srgbClr","44546A"]),ze(["lt2","srgbClr","E7E6E6"]),ze(["accent1","srgbClr","4472C4"]),ze(["accent2","srgbClr","ED7D31"]),ze(["accent3","srgbClr","A5A5A5"]),ze(["accent4","srgbClr","FFC000"]),ze(["accent5","srgbClr","5B9BD5"]),ze(["accent6","srgbClr","70AD47"]),ze(["hlink","srgbClr","0563C1"]),ze(["folHlink","srgbClr","954F72"])]}}},QR=JR,R=e=>{const[t,s,r,i]=e;return{name:`a:${t}`,properties:{rawMap:{script:r,typeface:s,panose:i}}}},eM={getTemplate(){return{name:"a:fontScheme",properties:{rawMap:{name:"Office"}},children:[{name:"a:majorFont",children:[R(["latin","Calibri Light",void 0,"020F0302020204030204"]),R(["ea",""]),R(["cs",""]),R(["font","\u6E38\u30B4\u30B7\u30C3\u30AF Light","Jpan"]),R(["font","\uB9D1\uC740 \uACE0\uB515","Hang"]),R(["font","\u7B49\u7EBF Light","Hans"]),R(["font","\u65B0\u7D30\u660E\u9AD4","Hant"]),R(["font","Times New Roman","Arab"]),R(["font","Times New Roman","Hebr"]),R(["font","Tahoma","Thai"]),R(["font","Nyala","Ethi"]),R(["font","Vrinda","Beng"]),R(["font","Shruti","Gujr"]),R(["font","MoolBoran","Khmr"]),R(["font","Tunga","Knda"]),R(["font","Raavi","Guru"]),R(["font","Euphemia","Cans"]),R(["font","Plantagenet Cherokee","Cher"]),R(["font","Microsoft Yi Baiti","Yiii"]),R(["font","Microsoft Himalaya","Tibt"]),R(["font","MV Boli","Thaa"]),R(["font","Mangal","Deva"]),R(["font","Gautami","Telu"]),R(["font","Latha","Taml"]),R(["font","Estrangelo Edessa","Syrc"]),R(["font","Kalinga","Orya"]),R(["font","Kartika","Mlym"]),R(["font","DokChampa","Laoo"]),R(["font","Iskoola Pota","Sinh"]),R(["font","Mongolian Baiti","Mong"]),R(["font","Times New Roman","Viet"]),R(["font","Microsoft Uighur","Uigh"]),R(["font","Sylfaen","Geor"]),R(["font","Arial","Armn"]),R(["font","Leelawadee UI","Bugi"]),R(["font","Microsoft JhengHei","Bopo"]),R(["font","Javanese Text","Java"]),R(["font","Segoe UI","Lisu"]),R(["font","Myanmar Text","Mymr"]),R(["font","Ebrima","Nkoo"]),R(["font","Nirmala UI","Olck"]),R(["font","Ebrima","Osma"]),R(["font","Phagspa","Phag"]),R(["font","Estrangelo Edessa","Syrn"]),R(["font","Estrangelo Edessa","Syrj"]),R(["font","Estrangelo Edessa","Syre"]),R(["font","Nirmala UI","Sora"]),R(["font","Microsoft Tai Le","Tale"]),R(["font","Microsoft New Tai Lue","Talu"]),R(["font","Ebrima","Tfng"])]},{name:"a:minorFont",children:[R(["latin","Calibri",void 0,"020F0502020204030204"]),R(["ea",""]),R(["cs",""]),R(["font","\u6E38\u30B4\u30B7\u30C3\u30AF","Jpan"]),R(["font","\uB9D1\uC740 \uACE0\uB515","Hang"]),R(["font","\u7B49\u7EBF","Hans"]),R(["font","\u65B0\u7D30\u660E\u9AD4","Hant"]),R(["font","Arial","Arab"]),R(["font","Arial","Hebr"]),R(["font","Tahoma","Thai"]),R(["font","Nyala","Ethi"]),R(["font","Vrinda","Beng"]),R(["font","Shruti","Gujr"]),R(["font","DaunPenh","Khmr"]),R(["font","Tunga","Knda"]),R(["font","Raavi","Guru"]),R(["font","Euphemia","Cans"]),R(["font","Plantagenet Cherokee","Cher"]),R(["font","Microsoft Yi Baiti","Yiii"]),R(["font","Microsoft Himalaya","Tibt"]),R(["font","MV Boli","Thaa"]),R(["font","Mangal","Deva"]),R(["font","Gautami","Telu"]),R(["font","Latha","Taml"]),R(["font","Estrangelo Edessa","Syrc"]),R(["font","Kalinga","Orya"]),R(["font","Kartika","Mlym"]),R(["font","DokChampa","Laoo"]),R(["font","Iskoola Pota","Sinh"]),R(["font","Mongolian Baiti","Mong"]),R(["font","Arial","Viet"]),R(["font","Microsoft Uighur","Uigh"]),R(["font","Sylfaen","Geor"]),R(["font","Arial","Armn"]),R(["font","Leelawadee UI","Bugi"]),R(["font","Microsoft JhengHei","Bopo"]),R(["font","Javanese Text","Java"]),R(["font","Segoe UI","Lisu"]),R(["font","Myanmar Text","Mymr"]),R(["font","Ebrima","Nkoo"]),R(["font","Nirmala UI","Olck"]),R(["font","Ebrima","Osma"]),R(["font","Phagspa","Phag"]),R(["font","Estrangelo Edessa","Syrn"]),R(["font","Estrangelo Edessa","Syrj"]),R(["font","Estrangelo Edessa","Syre"]),R(["font","Nirmala UI","Sora"]),R(["font","Microsoft Tai Le","Tale"]),R(["font","Microsoft New Tai Lue","Talu"]),R(["font","Ebrima","Tfng"])]}]}}},tM=eM,ct=(e,t,s)=>({name:`a:${e}`,properties:{rawMap:{val:t}},children:s}),ia=e=>{const[t,s,r,i,n,o]=e,a=[];return a.push(ct("satMod",r)),i&&a.push(ct("lumMod",i)),n&&a.push(ct("tint",n)),o&&a.push(ct("shade",o)),{name:"a:gs",properties:{rawMap:{pos:t}},children:[{name:"a:schemeClr",properties:{rawMap:{val:s}},children:a}]}},ji=(e,t)=>({name:"a:solidFill",children:[ct("schemeClr",e,t)]}),na=e=>{const[t,s,r,i,n]=e,[o,a]=n;return{name:"a:gradFill",properties:{rawMap:{rotWithShape:t}},children:[{name:"a:gsLst",children:[ia(s),ia(r),ia(i)]},{name:"a:lin",properties:{rawMap:{ang:o,scaled:a}}}]}},oa=e=>{const[t,s,r,i]=e;return{name:"a:ln",properties:{rawMap:{w:t,cap:s,cmpd:r,algn:i}},children:[ji("phClr"),ct("prstDash","solid"),{name:"a:miter",properties:{rawMap:{lim:"800000"}}}]}},aa=e=>{const t=[];if(e){const[s,r,i,n,o]=e;t.push({name:"a:outerShdw",properties:{rawMap:{blurRad:s,dist:r,dir:i,algn:n,rotWithShape:o}},children:[ct("srgbClr","000000",[ct("alpha","63000")])]})}return{name:"a:effectStyle",children:[{name:"a:effectLst",...t.length?{children:t}:{}}]}},sM=()=>({name:"a:fillStyleLst",children:[ji("phClr"),na(["1",["0","phClr","105000","110000","67000"],["50000","phClr","103000","105000","73000"],["100000","phClr","109000","105000","81000"],["5400000","0"]]),na(["1",["0","phClr","103000","102000","94000"],["50000","phClr","110000","100000",void 0,"100000"],["100000","phClr","120000","99000",void 0,"78000"],["5400000","0"]])]}),rM=()=>({name:"a:lnStyleLst",children:[oa(["6350","flat","sng","ctr"]),oa(["12700","flat","sng","ctr"]),oa(["19050","flat","sng","ctr"])]}),iM=()=>({name:"a:effectStyleLst",children:[aa(),aa(),aa(["57150","19050","5400000","ctr","0"])]}),nM=()=>({name:"a:bgFillStyleLst",children:[ji("phClr"),ji("phClr",[ct("tint","95000"),ct("satMod","170000")]),na(["1",["0","phClr","150000","102000","93000","98000"],["50000","phClr","130000","103000","98000","90000"],["100000","phClr","120000",void 0,void 0,"63000"],["5400000","0"]])]}),oM={getTemplate(){return{name:"a:fmtScheme",properties:{rawMap:{name:"Office"}},children:[sM(),rM(),iM(),nM()]}}},aM=oM,lM={getTemplate(){return{name:"a:themeElements",children:[QR.getTemplate(),tM.getTemplate(),aM.getTemplate()]}}},cM=lM,uM={getTemplate(){return{name:"a:theme",properties:{prefixedAttributes:[{prefix:"xmlns:",map:{a:"http://schemas.openxmlformats.org/drawingml/2006/main"}}],rawMap:{name:"Office Theme"}},children:[cM.getTemplate(),{name:"a:objectDefaults"},{name:"a:extraClrSchemeLst"}]}}},dM=uM,hM=()=>({name:"o:shapelayout",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}]},children:[{name:"o:idmap",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}],rawMap:{data:"1"}}}]}),pM=()=>({name:"v:stroke",properties:{rawMap:{joinstyle:"miter"}}}),gM=e=>({name:"v:formulas",children:e.map(t=>({name:"v:f",properties:{rawMap:{eqn:t}}}))}),fM=()=>({name:"v:path",properties:{prefixedAttributes:[{prefix:"o:",map:{connecttype:"rect",extrusionok:"f"}}],rawMap:{gradientshapeok:"t"}}}),Od=e=>{const{aspectratio:t,rotation:s}=e??{},r={};return t&&(r.aspectratio="t"),s&&(r.rotation="t"),{name:"o:lock",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}],rawMap:r}}};function mM(e,t,s,r,i){return(e-t)/(s-t)*(i-r)+r}var vM=(e,t)=>{let s;const{recolor:r,brightness:i,contrast:n,id:o}=e;if(r&&(s={},(r==="Washout"||r==="Grayscale")&&(s.gain="19661f",s.blacklevel="22938f"),(r==="Black & White"||r==="Grayscale")&&(s.grayscale="t",r==="Black & White"&&(s.bilevel="t"))),!r||r==="Grayscale"){if(s||(s={}),n!=null&&n!==50){let a="1";n>=0&&(n<50?a=String(n/50):n<100?a=String(50/(100-n)):n===100&&(a="2147483647f")),s.gain=a}i!=null&&i!==50&&(s.blacklevel=mM(i,0,100,-.5,.5).toString())}return{name:"v:imagedata",properties:{prefixedAttributes:[{prefix:"o:",map:{relid:`rId${t}`,title:o}}],rawMap:s}}},CM=()=>{const e=["if lineDrawn pixelLineWidth 0","sum @0 1 0","sum 0 0 @1","prod @2 1 2","prod @3 21600 pixelWidth","prod @3 21600 pixelHeight","sum @0 0 1","prod @6 1 2","prod @7 21600 pixelWidth","sum @8 21600 0","prod @7 21600 pixelHeight","sum @10 21600 0"];return{name:"v:shapetype",properties:{prefixedAttributes:[{prefix:"o:",map:{spt:"75",preferrelative:"t"}}],rawMap:{coordsize:"21600,21600",filled:"f",id:"_x0000_t75",path:"m@4@5l@4@11@9@11@9@5xe",stroked:"f"}},children:[pM(),gM(e),fM(),Od({aspectratio:!0})]}},Nd=e=>Math.floor((e??0)*.74999943307122),bM=(e,t)=>{const{width:s=0,height:r=0,altText:i}=e,n=Nd(s),o=Nd(r);return{name:"v:shape",properties:{rawMap:{id:e.headerFooterPosition,"o:spid":"_x0000_s1025",style:`position: absolute; margin-left: 0; margin-top: 10in; margin-bottom: 0; margin-right: 0; width: ${n}pt; height: ${o}pt; z-index: ${t+1}`,type:"#_x0000_t75",alt:i}},children:[vM(e,t+1),Od({rotation:!0})]}},SM={getTemplate(e){const t=We.get(e.sheetIndex)??[],s=[hM(),CM(),...t.map((r,i)=>bM(r,i))];return{name:"xml",properties:{prefixedAttributes:[{prefix:"xmlns:",map:{v:"urn:schemas-microsoft-com:vml",o:"urn:schemas-microsoft-com:office:office",x:"urn:schemas-microsoft-com:office:excel"}}]},children:s}}},yM=SM,wM={getTemplate(e,t){const s=(t+1).toString();return{name:"sheet",properties:{rawMap:{name:e,sheetId:s,"r:id":`rId${s}`}}}}},xM=wM,FM={getTemplate(e){return{name:"sheets",children:e.map((t,s)=>xM.getTemplate(t,s))}}},TM=FM,AM={getTemplate(e,t){return{name:"workbook",properties:{prefixedAttributes:[{prefix:"xmlns:",map:{r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships"}}],rawMap:{xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main"}},children:[{name:"bookViews",children:[{name:"workbookView",properties:{rawMap:{activeTab:t}}}]},TM.getTemplate(e)]}}},PM=AM;import{_escapeString as RM}from"ag-stack";var MM=e=>Math.ceil((e-12)/7+1),IM={getTemplate(e){const{min:t,max:s,outlineLevel:r,s:i,width:n,hidden:o,bestFit:a}=e;let l=1,c="0";return n>1&&(l=MM(n),c="1"),{name:"col",properties:{rawMap:{min:t,max:s,outlineLevel:r??void 0,width:l,style:i,hidden:o?"1":"0",bestFit:a?"1":"0",customWidth:c}}}}},EM=IM,DM={getTemplate(e){return{name:"mergeCell",properties:{rawMap:{ref:e}}}}},LM=DM;import{_escapeString as Bd}from"ag-stack";var kM=e=>{const t=e.charAt(0).toLowerCase();return t==="s"?"inlineStr":t},_M={getTemplate(e,t,s){const{ref:r,data:i,styleId:n}=e,{type:o,value:a}=i??{type:"empty",value:null};let l=o;o==="f"?l="str":o.charAt(0)===o.charAt(0).toUpperCase()&&(l=kM(o));const c={name:"c",properties:{rawMap:{r,t:l==="empty"?void 0:l,s:n?$R(n,s):void 0}}};if(l==="empty")return c;let u;return l==="str"&&o==="f"?u=[{name:"f",textNode:Bd(vr(a))}]:l==="inlineStr"?u=[{name:"is",children:[{name:"t",textNode:Bd(vr(a))}]}]:u=[{name:"v",textNode:a}],{...c,children:u}}},GM=_M,OM=(e,t)=>{const s=[];let r=0;for(let i=0;i<e.length;i++){const n=e[i];n.mergeAcross&&(s.push({pos:i,excelPos:r}),r+=n.mergeAcross),r++}if(s.length)for(let i=s.length-1;i>=0;i--){const n=[],o=e[s[i].pos];for(let a=1;a<=o.mergeAcross;a++)n.push({ref:`${as(s[i].excelPos+1+a)}${t+1}`,styleId:o.styleId,data:{type:"empty",value:null}});n.length&&e.splice(s[i].pos+1,0,...n)}},NM=e=>e.mergeAcross!=null||e.styleId!==void 0||e.note!==void 0?!0:!!e.data&&e.data.type!=="empty"&&e.data.value!=="",BM={getTemplate(e,t,s){const{collapsed:r,hidden:i,height:n,outlineLevel:o,cells:a=[]}=e;OM(a,t);const l=a.filter(NM).map((c,u)=>GM.getTemplate(c,u,s));return{name:"row",properties:{rawMap:{r:t+1,collapsed:r?"1":"0",hidden:i?"1":"0",ht:n,customHeight:n!=null?"1":"0",spans:"1:1",outlineLevel:o||void 0}},children:l}}},VM=BM,HM=(e,t,s)=>{const r=[],i=[];return e.forEach((n,o)=>{const a=n.cells;let l=0,c;a.forEach((u,d)=>{const h=d+l+1,p=as(h),g=o+1,f=u.mergeAcross??0,m=u.mergeDown??0;if(f||m){l+=f;const C=as(d+l+1);r.push(`${p}${g}:${C}${g+m}`)}t[h-1]||(t[h-1]={});const{collapsibleRanges:v}=u;v&&v.forEach(C=>{i.push([h+C[0],h+C[1]])}),c=t[h-1],c.min=h,c.max=h,u.ref=`${p}${g}`})}),s||UM(t,i),r},UM=(e,t)=>{const s=new Map;for(let r=0,i=t.length;r<i;++r){const[n,o]=t[r];for(let a=n;a<=o;++a)s.set(a,(s.get(a)??0)+1)}s.forEach((r,i)=>{e[i-1]||(e[i-1]={min:i,max:i}),e[i-1].outlineLevel=Math.min(r,7)})},zM=e=>!e||e!=="Portrait"&&e!=="Landscape"?"portrait":e.toLocaleLowerCase(),WM=e=>{if(e==null)return 1;const s=["Letter","Letter Small","Tabloid","Ledger","Legal","Statement","Executive","A3","A4","A4 Small","A5","A6","B4","B5","Folio","Envelope","Envelope DL","Envelope C5","Envelope B5","Envelope C3","Envelope C4","Envelope C6","Envelope Monarch","Japanese Postcard","Japanese Double Postcard"].indexOf(e);return s===-1?1:s+1},KM=e=>{const t={"&[Page]":"&P","&[Pages]":"&N","&[Date]":"&D","&[Time]":"&T","&[Tab]":"&A","&[Path]":"&Z","&[File]":"&F","&[Picture]":"&G"};for(const s of Object.keys(t))e=e.replace(s,t[s]);return e},$M=e=>e==="Center"?"C":e==="Right"?"R":"L",jM=(e,t)=>(t&&(e+="&amp;&quot;",e+=t.fontName||"Calibri",t.bold!==t.italic?e+=t.bold?",Bold":",Italic":t.bold?e+=",Bold Italic":e+=",Regular",e+="&quot;",t.size&&(e+=`&amp;${t.size}`),t.strikeThrough&&(e+="&amp;S"),t.underline&&(e+=`&amp;${t.underline==="Double"?"E":"U"}`),t.color&&(e+=`&amp;K${t.color.replace("#","").toUpperCase()}`)),e),YM=(e,t,s)=>e.reduce((r,i,n)=>{const o=$M(i.position),a=jM(`${r}&amp;${o}`,i.font),l=["Left","Center","Right"];i.position||(i.position=l[n]);const{image:c}=i;if(i.value==="&[Picture]"&&c){const u=`${o}${t}${s}`;Vd(c,u)}return`${a}${RM(KM(i.value))}`},""),qM=e=>{const t=["all","first","even"],s=[];return t.forEach(r=>{const i=e[r],n=r==="all"?"odd":r;if(i)for(const o of Object.keys(i)){const a=i[o],l=`${o.charAt(0).toUpperCase()}${o.slice(1)}`,c=o[0].toUpperCase();if(a){const u=r==="all"?"":r.toUpperCase();s.push({name:`${n}${l}`,properties:{rawMap:{"xml:space":"preserve"}},textNode:YM(a,c,u)})}}}),s},ZM=e=>t=>(e.length&&t.children.push({name:"cols",children:e.map(s=>EM.getTemplate(s))}),t),XM=(e,t)=>{const s=[];for(let r=0;r<t.length;r++){const i=t[r].cells;for(let n=0;n<i.length;n++){const o=i[n];!o.note||!o.ref||s.push({ref:o.ref,text:o.note.text,author:o.note.author})}}s.length?Je.set(e,s):Je.delete(e)};function*JM(e,t){for(let s=0,r=e.length;s<r;++s)yield VM.getTemplate(e[s],s,t)}var QM=(e,t)=>s=>(e.length&&s.children.push({name:"sheetData",children:JM(e,t)}),s),eI=e=>{const t=e.length;if(!t)return"";const s=new Array(t+1);s[0]=t;for(let i=1;i<=t;i++)s[i]=e.charCodeAt(i-1)&255;let r=0;for(let i=s.length-1;i>=0;i--){const n=s[i],o=(r&16384)===0?0:1,a=r<<1&32767;r=(o|a)^n}return(r^52811).toString(16).toUpperCase().padStart(4,"0")},tI=e=>t=>{if(!e)return t;const s=typeof e=="boolean"?{}:e,r={sheet:1},i=s.password?eI(s.password):"";i&&(r.password=i);const n={autoFilter:!1,deleteColumns:!1,deleteRows:!1,formatCells:!1,formatColumns:!1,formatRows:!1,insertColumns:!1,insertHyperlinks:!1,insertRows:!1,pivotTables:!1,selectLockedCells:!0,selectUnlockedCells:!0};return Object.keys(n).forEach(o=>{const a=s[o];a==null||a===n[o]||(r[o]=a?0:1)}),t.children.push({name:"sheetProtection",properties:{rawMap:r}}),t},sI=e=>t=>(e.length&&t.children.push({name:"mergeCells",properties:{rawMap:{count:e.length}},children:e.map(s=>LM.getTemplate(s))}),t),rI=e=>t=>{const{top:s=.75,right:r=.7,bottom:i=.75,left:n=.7,header:o=.3,footer:a=.3}=e;return t.children.push({name:"pageMargins",properties:{rawMap:{bottom:i,footer:a,header:o,left:n,right:r,top:s}}}),t},iI=e=>t=>(e&&t.children.push({name:"pageSetup",properties:{rawMap:{horizontalDpi:0,verticalDpi:0,orientation:zM(e.orientation),paperSize:WM(e.pageSize)}}}),t),nI=e=>t=>{if(!e)return t;const s=e.first!=null?1:0,r=e.even!=null?1:0;return t.children.push({name:"headerFooter",properties:{rawMap:{differentFirst:s,differentOddEven:r}},children:qM(e)}),t},oI=e=>t=>(e&&t.children.push({name:"tableParts",properties:{rawMap:{count:"1"}},children:[{name:"tablePart",properties:{rawMap:{"r:id":`rId${++t.rIdCounter}`}}}]}),t),aI=e=>t=>(Vt.get(e)?.length&&t.children.push({name:"drawing",properties:{rawMap:{"r:id":`rId${++t.rIdCounter}`}}}),t),lI=e=>t=>(Je.get(e)?.length&&t.children.push({name:"legacyDrawing",properties:{rawMap:{"r:id":`rId${++t.rIdCounter}`}}}),t),cI=e=>t=>(We.get(e)&&t.children.push({name:"legacyDrawingHF",properties:{rawMap:{"r:id":`rId${++t.rIdCounter}`}}}),t),uI=(e=0,t=0)=>{const s=e>0||t>0;return s?[{name:"pane",properties:{rawMap:{state:s?"frozen":void 0,topLeftCell:s?`${as(e+1)}${t+1}`:void 0,xSplit:e===0?void 0:e,ySplit:t===0?void 0:t}}}]:void 0},dI=(e=!1,t,s)=>r=>(r.children.push({name:"sheetViews",children:[{name:"sheetView",properties:{rawMap:{rightToLeft:e?"1":"0",workbookViewId:"0"}},children:uI(t,s)}]}),r),hI=()=>e=>(e.children.push({name:"sheetPr",children:[{name:"outlinePr",properties:{rawMap:{summaryBelow:0}}}]}),e),pI=(e,t)=>s=>{const r=e.reduce((n,o)=>o.outlineLevel&&o.outlineLevel>n?o.outlineLevel:n,0),i=t.reduce((n,o)=>o.outlineLevel&&o.outlineLevel>n?o.outlineLevel:n,0);return s.children.push({name:"sheetFormatPr",properties:{rawMap:{baseColWidth:10,defaultRowHeight:16,outlineLevelRow:r||void 0,outlineLevelCol:i||void 0}}}),s},gI={getTemplate(e){const{worksheet:t,currentSheet:s,config:r}=e,{margins:i={},pageSetup:n,headerFooterConfig:o,suppressColumnOutline:a,rightToLeft:l,frozenRowCount:c,frozenColumnCount:u,protectSheet:d}=r,{table:h}=t,{rows:p,columns:g}=h,f=g?.length?HM(p,g,!!a):[];XM(s,p);const m=Ke.get(s),{children:v}=[hI(),dI(l,u,c),pI(p,g??[]),ZM(g),QM(p,s+1),tI(d),sI(f),rI(i),iI(n),nI(o),aI(s),lI(s),cI(s),oI(m)].reduce((C,b)=>b(C),{children:[],rIdCounter:0});return{name:"worksheet",properties:{prefixedAttributes:[{prefix:"xmlns:",map:{r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships"}}],rawMap:{xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main"}},children:v}}},fI=gI,ls=new Map,Be=[],cs=[],us=new Map,Xe=new Map,Vt=new Map,We=new Map,Is=new Map,Es=new Map,Ke=new Map,Je=new Map,mI="AG-GRID-TABLE",la="SINGLE_SHEET";function vI(){return la}function CI(e){la=e}function bI(e,t,s){FI(t),jR(e,Be.length);const r={...s};s.exportAsExcelTable&&s.pivotModeActive&&(s.log.warn(163,{featureName:"pivot mode"}),r.exportAsExcelTable=!1),wI(t,r);const i=WI(t,r);return KI(i),i}function SI(e){return e.replace(/^[^a-zA-Z_]+/,"_").replace(/\s/g,"_").replace(/[^a-zA-Z0-9_]/g,"_")}function yI(e,t,s){if(Ke.has(e)){s.warn(164);return}Ke.set(e,t)}function wI(e,t){const{exportAsExcelTable:s,prependContent:r,appendContent:i,headerRowCount:n=0}=t;if(!s)return;const o=typeof s=="boolean"?{}:s,{name:a,showColumnStripes:l,showRowStripes:c,showFilterButton:u,highlightFirstColumn:d,highlightLastColumn:h}=o,p=SI(a||mI),g=Be.length-1,{table:f}=e,{rows:m,columns:v}=f,C=r?r.length:0,b=i?i.length:0,y=m.length,S=v.length,w=[],F=[];for(let T=0;T<S;T++){const x=v[T];w.push(x.displayName||""),F.push(u==="match"||u===void 0?x.filterAllowed??!1:u)}if(!w?.length||!y||!p){t.log.warn(165);return}yI(g,{name:`table${Ke.size+1}`,displayName:p,columns:w,showFilterButtons:F,rowRange:[n+C,n+(y-n)-b],showRowStripes:c??!0,showColumnStripes:l??!1,highlightFirstColumn:d??!1,highlightLastColumn:h??!1},t.log)}function Vd(e,t){const s=Be.length-1,r=e;r.headerFooterPosition=t,Hd({imageToAdd:r,idx:s});let i=We.get(s);i||(i=[],We.set(s,i)),i.some(n=>n.id===e.id)||i.push(e)}function xI(e,t,s,r,i){const n=Be.length,{row:o,column:a}=e.position??{},l=e;r&&(t!=null&&s!=null&&(!o||!a)&&(e.position??(e.position={}),e.position={...e.position,row:t,column:r.indexOf(s)+1}),cP(l,r),uP(l,i)),Hd({imageToAdd:l,idx:n});let c=Es.get(n);c||(c=new Map,Es.set(n,c));const u=Vt.get(n);u?u.push(l):Vt.set(n,[l]),c.get(e.id)||c.set(e.id,{index:c.size,type:e.imageType})}function Hd(e){const{imageToAdd:t,idx:s}=e,r=Xe.get(t.id);if(r){const i=r.find(n=>n.sheetId===s);i?i.image.push(t):r.push({sheetId:s,image:[t]})}else Xe.set(t.id,[{sheetId:s,image:[t]}]),Is.set(t.id,{type:t.imageType,index:Is.size})}function FI(e){const t=gP(e.name)||"";let s="";for(;Be.indexOf(`${t}${s}`)!==-1;)s===""?s="_1":s=`_${Number.parseInt(s.slice(1),10)+1}`;e.name=`${t}${s}`,Be.push(e.name)}function TI(e){return ls.has(e)?ls.get(e):(ls.set(e,ls.size),ls.size-1)}function AI(){ls.clear(),Xe.clear(),Vt.clear(),We.clear(),Is.clear(),Es.clear(),Ke.clear(),Je.clear(),Be=[],cs=[],us=new Map,la="SINGLE_SHEET"}function PI(e){return ve(PM.getTemplate(Be,e))}function RI(e){return ve(YR.getTemplate(e))}function MI(){return ve(XP.getTemplate(ls))}function II(e){return ve(TP.getTemplate(e))}function EI(e){return ve(MP.getTemplate(e))}function DI(e,t){return ve(xP.getTemplate({sheetLen:e,hasCustomProperties:t}))}function LI(e){const t=[{Id:"rId1",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",Target:"xl/workbook.xml"},{Id:"rId2",Type:"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",Target:"docProps/core.xml"}];e&&t.push({Id:"rId3",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties",Target:"docProps/custom.xml"});const s=Cr.getTemplate(t);return ve(s)}function kI(){return ve(dM.getTemplate())}function _I(e,t){return ve(XR.getTemplate(e,t))}function GI(e){const t=new Array(e).fill(void 0).map((r,i)=>({Id:`rId${i+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet",Target:`worksheets/sheet${i+1}.xml`})),s=Cr.getTemplate([...t,{Id:`rId${e+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",Target:"theme/theme1.xml"},{Id:`rId${e+2}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",Target:"styles.xml"},{Id:`rId${e+3}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings",Target:"sharedStrings.xml"}]);return ve(s)}function OI(e){return ve(BP.getTemplate({sheetIndex:e}))}function NI(e,t,s){const r=Je.get(e)??[],i=t||"AG Grid",n=!s;return ve(bP.getTemplate({comments:r,defaultAuthor:i,prependAuthor:n}))}function BI(e){const t=Es.get(e)??[],s=[];for(const[r,i]of t){const{index:n,type:o}=i;s.push({Id:`rId${n+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",Target:`../media/image${Is.get(r).index+1}.${zi(o)}`})}return ve(Cr.getTemplate(s))}function VI(e){return ve(yM.getTemplate({sheetIndex:e}),!0)}function HI(e){return ve($P.getTemplate({sheetIndex:e}),!0)}function UI(e){const t=We.get(e)??[],s=[];for(let r=0;r<t.length;r++){const i=t[r],n=Is.get(i.id);if(!n)continue;const{index:o,type:a}=n;s.push({Id:`rId${r+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",Target:`../media/image${o+1}.${zi(a)}`})}return ve(Cr.getTemplate(s))}function zI({drawingIndex:e,noteVmlDrawingIndex:t,headerFooterVmlDrawingIndex:s,commentsIndex:r,tableName:i}={}){if(e===void 0&&t===void 0&&s===void 0&&r===void 0&&i===void 0)return"";const n=[];e!=null&&n.push({Id:`rId${n.length+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing",Target:`../drawings/drawing${e+1}.xml`}),t!=null&&n.push({Id:`rId${n.length+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing",Target:`../drawings/vmlDrawing${t+1}.vml`}),s!=null&&n.push({Id:`rId${n.length+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing",Target:`../drawings/vmlDrawing${s+1}.vml`}),i!=null&&n.push({Id:`rId${n.length+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/table",Target:`../tables/${i}.xml`}),r!=null&&n.push({Id:`rId${n.length+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",Target:`../comments${r+1}.xml`});const o=Cr.getTemplate(n);return ve(o)}function WI(e,t){return ve(fI.getTemplate({worksheet:e,currentSheet:Be.length-1,config:t}))}var xr=(e,t)=>{if(!e.size)return;const s=new Map;t.forEach((r,i)=>{e.has(r)&&s.set(i,e.get(r))}),e.clear(),s.forEach((r,i)=>e.set(i,r))},KI=e=>{const t=us.get(e)??[];t.push(Be.length-1),us.set(e,t),cs.push(e)},$I=e=>{const t=new Map(us),s=[];for(const r of e){const i=t.get(r);if(!i?.length)return null;const n=i.shift();s.push(n),t.set(r,i)}return s},jI=e=>{if(!e.length||cs.length===0)return null;const t=new Set,s=[];for(const r of e){const i=cs.findIndex((n,o)=>!t.has(o)&&n===r);if(i===-1)return null;t.add(i),s.push(i)}return s},YI=e=>{const t=new Map;e.forEach((s,r)=>t.set(s,r)),Be=e.map(s=>Be[s]),cs=e.map(s=>cs[s]),xr(Vt,e),xr(We,e),xr(Ke,e),xr(Je,e),xr(Es,e),Xe.forEach(s=>{s.forEach(r=>{const i=t.get(r.sheetId);i!=null&&(r.sheetId=i)})}),us=new Map,cs.forEach((s,r)=>{const i=us.get(s)??[];i.push(r),us.set(s,i)})},qI=e=>{if(e.length<=1)return;const t=$I(e)??jI(e);t&&YI(t)},Yi=class{getStringPosition(e){return TI(e)}addBodyImageToMap(e,t,s,r,i){xI(e,t,s,r,i)}addHeaderFooterImageToMap(e,t){Vd(e,t)}addWorksheet(e,t,s){return bI(e,t,s)}syncOrderWithSheetData(e){qI(e)}reset(){AI()}setFactoryMode(e){CI(e)}getFactoryMode(){return vI()}getSheetNames(){return[...Be]}};import{_errorToThrowWithoutAttribution as ZI}from"ag-grid-community";var XI=65536,JI=async e=>{const t=typeof e=="string"?new TextEncoder().encode(e):e;let s=0,r=0;const i=[],n=new WritableStream({write:u=>{i.push(u),r+=u.length}}),o=new ReadableStream({pull:u=>{if(s===t.length){u.close();return}const d=Math.min(s+XI,t.length);u.enqueue(t.slice(s,d)),s=d}}),a=new CompressionStream("deflate-raw");await o.pipeThrough(a).pipeTo(n);const l=new Uint8Array(r);let c=0;for(let u=0,d=i.length;u<d;++u){const h=i[u];l.set(h,c),c+=h.length}return{size:r,content:l}},QI=e=>{let t=e.getHours();return t<<=6,t=t|e.getMinutes(),t<<=5,t=t|e.getSeconds()/2,t},eE=e=>{let t=e.getFullYear()-1980;return t<<=4,t=t|e.getMonth()+1,t<<=5,t=t|e.getDate(),t};function Fe(e,t){let s="";for(let r=0;r<t;r++)s+=String.fromCharCode(e&255),e>>>=8;return s}var Ud=e=>{if(!e.length)return 0;let t=-1;const s=e.length;let r=0;for(;r+8<=s;r+=8)t^=e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24,t=Ht[1792+(t&255)]^Ht[1536+(t>>>8&255)]^Ht[1280+(t>>>16&255)]^Ht[1024+(t>>>24)]^Ht[768+e[r+4]]^Ht[512+e[r+5]]^Ht[256+e[r+6]]^Ht[e[r+7]];for(;r<s;++r)t=t>>>8^ca[(t^e[r])&255];return t^-1},zd=e=>e.length?Ud(typeof e=="string"?new TextEncoder().encode(e):e):0,ca=new Uint32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]),Ht=(()=>{const e=new Uint32Array(2048);e.set(ca);for(let t=1;t<8;++t)for(let s=0;s<256;++s){const r=e[(t-1)*256+s];e[t*256+s]=r>>>8^ca[r&255]}return e})();function tE(e){const t=String.fromCharCode;function s(d){const h=[];if(!d)return[];const p=d.length;let g=0,f,m;for(;g<p;)f=d.charCodeAt(g++),f>=55296&&f<=56319&&g<p?(m=d.charCodeAt(g++),(m&64512)==56320?h.push(((f&1023)<<10)+(m&1023)+65536):(h.push(f),g--)):h.push(f);return h}function r(d){if(d>=55296&&d<=57343)throw ZI(255,{point:d})}function i(d,h){return t(d>>h&63|128)}function n(d){if((d&4294967168)==0)return t(d);let h="";return(d&4294965248)==0?h=t(d>>6&31|192):(d&4294901760)==0?(r(d),h=t(d>>12&15|224),h+=i(d,6)):(d&4292870144)==0&&(h=t(d>>18&7|240),h+=i(d,12),h+=i(d,6)),h+=t(d&63|128),h}const o=s(e),a=o.length;let l=-1,c,u="";for(;++l<a;)c=o[l],u+=n(c);return u}var Wd=(e,t,s,r,i,n)=>{const{content:o,path:a,created:l}=e,c=QI(l),u=eE(l),d=zd(i),h=n??r,p=tE(a),g=p!==a;let f="";if(g){const b=Fe(1,1)+Fe(zd(p),4)+p;f="up"+Fe(b.length,2)+b}const m="\0"+(g?"\0\b":"\0\0")+Fe(t?8:0,2)+Fe(c,2)+Fe(u,2)+Fe(h?d:0,4)+Fe(n??r,4)+Fe(r,4)+Fe(p.length,2)+Fe(f.length,2),v="PK"+m+p+f,C="PK\0"+m+"\0\0\0\0\0\0"+(o?"\0\0\0\0":"\0\0\0")+Fe(s,4)+p+f;return{localFileHeader:Uint8Array.from(v,b=>b.charCodeAt(0)),centralDirectoryHeader:Uint8Array.from(C,b=>b.charCodeAt(0))}},Kd=e=>{let t;if(typeof e=="string"){const s=atob(e.split(";base64,")[1]);t=Uint8Array.from(s,r=>r.charCodeAt(0))}else t=e;return{size:t.length,content:t}},sE=async e=>{const{content:t}=e,{size:s,content:r}=t?Kd(t):{size:0,content:Uint8Array.from([])};let i,n,o=!1;if(e.type==="file"&&r&&s>0){const l=await JI(r);i=l.content,n=l.size,o=!0}return{rawContent:r,rawSize:s,deflatedContent:i,deflatedSize:n,isCompressed:o}},rE=(e,t)=>{const{content:s}=e,{content:r}=s?Kd(s):{content:Uint8Array.from([])};return{...Wd(e,!1,t,r.length,r,void 0),content:r,isCompressed:!1}},iE=(e,t,s)=>{const r="PK\0\0\0\0"+Fe(e,2)+Fe(e,2)+Fe(t,4)+Fe(s,4)+"\0\0";return Uint8Array.from(r,i=>i.charCodeAt(0))},$d=4,jd=class{constructor(){this.folders=[],this.files=[]}addFolders(e){e.forEach(this.addFolder.bind(this))}addFolder(e){this.folders.push({path:e,created:new Date,isBase64:!1,type:"folder"})}addFile(e,t,s=!1){this.files.push({path:e,created:new Date,content:s?t:new TextEncoder().encode(t),isBase64:s,type:"file"})}async getZipFile(e="application/zip"){try{return await this.buildCompressedFileStream(e)}finally{this.clearStream()}}getUncompressedZipFile(e="application/zip"){try{return this.buildFileStream(e)}finally{this.clearStream()}}clearStream(){this.folders=[],this.files=[]}packageFiles(e,t){let s=0,r=0;const i=[],n=[];for(const a of e){const{localFileHeader:l,centralDirectoryHeader:c,content:u}=a;s+=l.length+u.length,r+=c.length,i.push(l,u),n.push(c)}const o=iE(e.length,r,s);return new Blob([...i,...n,o],{type:t})}async buildCompressedFileStream(e){const t=[...this.folders,...this.files],s=[];let r=0;for(let i=0,n=t.length;i<n;i+=$d){const o=t.slice(i,i+$d),a=await Promise.all(o.map(sE));for(let l=0,c=o.length;l<c;++l){const u=o[l],{rawContent:d,rawSize:h,deflatedContent:p,deflatedSize:g,isCompressed:f}=a[l],m=Wd(u,f,r,h,d,g),v=p??d;s.push({...m,content:v,isCompressed:f}),r+=m.localFileHeader.length+v.length,u.content=void 0}}return this.packageFiles(s,e)}buildFileStream(e){const t=[...this.folders,...this.files],s=[];let r=0;for(const i of t){const n=rE(i,r),{localFileHeader:o,content:a}=n;s.push(n),r+=o.length+a.length}return this.packageFiles(s,e)}},nE=e=>{if(e.addFolders(["_rels/","docProps/","xl/","xl/theme/","xl/_rels/","xl/worksheets/"]),(Xe.size||Ke.size||We.size||Je.size)&&e.addFolders(["xl/worksheets/_rels"]),(Xe.size||We.size||Je.size)&&e.addFolders(["xl/drawings/"]),(Xe.size||We.size)&&e.addFolders(["xl/drawings/_rels"]),Ke.size&&e.addFolders(["xl/tables/"]),!Xe.size)return;e.addFolders(["xl/media/"]);let t=0;Xe.forEach(s=>{const r=s[0].image[0],{base64:i,imageType:n}=r;e.addFile(`xl/media/image${++t}.${zi(n)}`,i,!0)})},oE=(e,t,s,r)=>{let i=0,n=0,o=0;for(let a=0;a<t.length;a++){const l=t[a];e.addFile(`xl/worksheets/sheet${a+1}.xml`,l,!1);const c=Xe.size>0&&Vt.has(a),u=Ke.size>0&&Ke.get(a),d=Xe.size&&We.has(a),h=!!Je.get(a)?.length;if(!c&&!u&&!d&&!h)continue;let p,g,f,m,v;c&&(aE(e,a,i),g=i,i++),h&&(lE(e,a,n,o,s,r),v=n,f=o,n++,o++),d&&(cE(e,a,o),m=o,o++),u&&(p=u.name);const C=`xl/worksheets/_rels/sheet${a+1}.xml.rels`;e.addFile(C,zI({tableName:p,drawingIndex:g,noteVmlDrawingIndex:f,headerFooterVmlDrawingIndex:m,commentsIndex:v}))}},aE=(e,t,s)=>{const r="xl/drawings",i=`${r}/drawing${s+1}.xml`,n=`${r}/_rels/drawing${s+1}.xml.rels`;e.addFile(n,BI(t)),e.addFile(i,OI(t))},lE=(e,t,s,r,i,n)=>{const o="xl/drawings";e.addFile(`xl/comments${s+1}.xml`,NI(t,i,n)),e.addFile(`${o}/vmlDrawing${r+1}.vml`,HI(t))},cE=(e,t,s)=>{const r="xl/drawings",i=`${r}/vmlDrawing${s+1}.vml`,n=`${r}/_rels/vmlDrawing${s+1}.vml.rels`;e.addFile(i,VI(t)),e.addFile(n,UI(t))},uE=e=>{const t=Ke,s=Array.from(t.keys());for(let r=0;r<s.length;r++){const i=s[r],n=t.get(i);n&&e.addFile(`xl/tables/${n.name}.xml`,_I(n,r))}},dE=(e,t,s,r,i,n)=>{const o=!!n&&Object.keys(n).some(a=>n[a]!=null);e.addFile("xl/workbook.xml",PI(i)),e.addFile("xl/styles.xml",RI(t)),e.addFile("xl/sharedStrings.xml",MI()),e.addFile("xl/theme/theme1.xml",kI()),e.addFile("xl/_rels/workbook.xml.rels",GI(r)),e.addFile("docProps/core.xml",II(s)),o&&e.addFile("docProps/custom.xml",EI(n)),e.addFile("[Content_Types].xml",DI(r,o)),e.addFile("_rels/.rels",LI(o))},Yd=(e,t,s={},r,i)=>{if(!t||t.length===0)return i?$A(i,159):jA(159),r.reset(),!1;r.syncOrderWithSheetData(t);const{fontSize:n=11,author:o="AG Grid",activeTab:a=0,customMetadata:l,suppressPrependAuthorToNotes:c}=s,u=t.length,d=WA(a,0,u-1);return nE(e),uE(e),oE(e,t,o,c),dE(e,n,o,u,d,l),r.reset(),!0},ua=(e,t=new Yi,s)=>{const{data:r,fontSize:i,author:n,activeSheetIndex:o,customMetadata:a,suppressPrependAuthorToNotes:l}=e,c=e.mimeType||"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",u=new jd;return Yd(u,r,{author:n,fontSize:i,activeTab:o,customMetadata:a,suppressPrependAuthorToNotes:l},t,s)?u.getZipFile(c):Promise.resolve(void 0)},da=(e,t=new Yi,s)=>{const{data:r,fontSize:i,author:n,activeSheetIndex:o,customMetadata:a,suppressPrependAuthorToNotes:l}=e,c=e.mimeType||"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",u=new jd;if(Yd(u,r,{author:n,fontSize:i,activeTab:o,customMetadata:a,suppressPrependAuthorToNotes:l},t,s))return u.getUncompressedZipFile(c)},hE=e=>{const{fileName:t="export.xlsx"}=e,s=new Yi;ua(e,s).then(r=>{if(r){const i=typeof t=="function"?t():t;ea(i,r)}})},pE=class extends $w{constructor(){super(...arguments),this.beanName="excelCreator",this.workbook=new Yi}getMergedParams(e){return{...this.gos.get("defaultExcelExportParams"),...e}}export(e){if(this.isExportSuppressed()){this.warn(160);return}this.runExport(()=>{const t=this.getMergedParams(e),s=this.getData(t),{fontSize:r,author:i,mimeType:n,customMetadata:o,suppressPrependAuthorToNotes:a}=t,l={data:[s],fontSize:r,author:i,mimeType:n,customMetadata:o,suppressPrependAuthorToNotes:a};this.packageCompressedFile(l).then(c=>{c&&ea(this.resolveFileName(t),c)})})}exportDataAsExcel(e){this.export(e)}getDataAsExcel(e){const t=this.getMergedParams(e),s=this.getData(t),{fontSize:r,author:i,mimeType:n,customMetadata:o,suppressPrependAuthorToNotes:a}=t,l={data:[s],fontSize:r,author:i,mimeType:n,customMetadata:o,suppressPrependAuthorToNotes:a};return this.packageFile(l)}setFactoryMode(e){this.workbook.setFactoryMode(e)}getFactoryMode(){return this.workbook.getFactoryMode()}getSheetDataForExcel(e){const t=this.getMergedParams(e);return this.getData(t)}getMultipleSheetsAsExcel(e){return da(e,this.workbook,this.beans.context.getId())}exportMultipleSheetsAsExcel(e){ua(e,this.workbook,this.beans.context.getId()).then(t=>{const{fileName:s="export.xlsx"}=e;if(t){const r=typeof s=="function"?s():s;ea(r,t)}})}getDefaultFileExtension(){return"xlsx"}createSerializingSession(e){const{colModel:t,colNames:s,rowGroupColsSvc:r,valueSvc:i,formula:n,gos:o,notesSvc:a,log:l}=this.beans,c=o.get("excelStyles")??[],u=this.createStyleLinker(c),d={...e,colModel:t,colNames:s,rowGroupColsSvc:r,valueSvc:i,formulaSvc:n,gos:o,log:l,suppressRowOutline:e.suppressRowOutline||e.skipRowGroups,headerRowHeight:e.headerRowHeight||e.rowHeight,baseExcelStyles:c,rightToLeft:e.rightToLeft??o.get("enableRtl"),styleLinker:u,notesSvc:a,pivotModeActive:t.isPivotActive(),workbook:this.workbook};return new pP(d)}createStyleLinker(e){const t=[],s=new Set,r=new Map;e.forEach((a,l)=>{t.push(a.id),s.add(a.id),r.set(a.id,l)});const{gos:i,cellStyles:n}=this.beans,o=["cell"];return a=>{const{rowType:l,rowIndex:c,value:u,column:d,columnGroup:h,node:p}=a,g=l==="HEADER",f=l==="HEADER_GROUPING",m=g?d:h;let v=[];if(g||f)return v.push("header"),f&&v.push("headerGroup"),m&&(v=v.concat(KA(m.getDefinition(),this.beans,d||null,h||null))),v;if(!t.length)return o;const C=d.getColDef();if(!C.cellClass&&!C.cellClassRules)return o;const b=["cell"];return n?.processAllCellClasses(C,zA(i,{value:u,data:p.data,node:p,colDef:C,column:d,rowIndex:c}),y=>{s.has(y)&&b.push(y)}),b.length<2?b:b.sort((y,S)=>{const w=r.get(y)??-1,F=r.get(S)??-1;return w===F?0:w<F?-1:1})}}isExportSuppressed(){return this.gos.get("suppressExcelExport")}packageCompressedFile(e){return ua(e,this.workbook,this.beans.context.getId())}packageFile(e){return da(e,this.workbook,this.beans.context.getId())}};import{AgTabGuardComp as gE,RefPlaceholder as fE,_createAgElement as mE,_getAriaPosInSet as vE,_observeResize as CE,_requestAnimationFrame as bE,_setAriaLabel as SE,_setAriaPosInSet as yE,_setAriaRole as wE,_setAriaSetSize as xE}from"ag-stack";import{KeyCode as Qe}from"ag-grid-community";var FE=":where(.ag-virtual-list-viewport) .ag-tab-guard{position:sticky}.ag-virtual-list-viewport{flex:1 1 auto;height:100%;min-width:0;overflow:auto;position:relative;width:100%}.ag-virtual-list-container{overflow:var(--ag-internal-virtual-list-overflow,hidden);position:relative}.ag-virtual-list-item{height:var(--ag-list-item-height);position:absolute;width:100%}:where(.ag-virtual-list-grow-to-content) .ag-virtual-list-item{min-width:100%;width:-moz-max-content;width:max-content}",TE=100,AE=10;function PE(e){return{tag:"div",cls:`ag-virtual-list-viewport ag-${e}-virtual-list-viewport`,role:"presentation",children:[{tag:"div",ref:"eContainer",cls:`ag-virtual-list-container ag-${e}-virtual-list-container`}]}}var qd=class extends jw{constructor(e,t){super(PE(t?.cssIdentifier||"default")),this.stopPropagationCallbacks=e,this.renderedRows=new Map,this.rowHeight=20,this.pageSize=-1,this.isScrolling=!1,this.isHeightFromTheme=!0,this.eContainer=fE,this.awaitStableCallbacks=[],this.awaitStableInterval=0,this.registerCSS(FE);const{cssIdentifier:s="default",ariaRole:r="listbox",listName:i,moveItemCallback:n}=t??{};this.cssIdentifier=s,this.ariaRole=r,this.retainRoleWhenEmpty=t?.retainRoleWhenEmpty??!1,this.listName=i,this.moveItemCallback=n}postConstruct(){this.addScrollListener(),this.rowHeight=this.getItemHeight(),this.addResizeObserver(),this.initialiseTabGuard({onFocusIn:e=>this.onFocusIn(e),onFocusOut:e=>this.onFocusOut(e),focusInnerElement:e=>this.focusInnerElement(e),onTabKeyDown:e=>this.onTabKeyDown(e),handleKeyDown:e=>this.handleKeyDown(e)},this.stopPropagationCallbacks),this.refreshAriaProperties(),this.addManagedEventListeners({stylesChanged:this.onStylesChanged.bind(this)})}onStylesChanged(e){e.listItemHeightChanged&&(this.rowHeight=this.getItemHeight(),this.refresh())}refreshAriaProperties(){const t=this.getLocaleTextFunc()("ariaDefaultListName",this.listName||"List"),s=this.eContainer;wE(s,this.retainRoleWhenEmpty||this.model?.getRowCount()>0?this.ariaRole:"presentation"),SE(s,t)}addResizeObserver(){const e=CE(this.beans,this.getGui(),this.throttleToFrame(()=>this.drawVirtualRows()));this.addDestroyFunc(e)}focusInnerElement(e){return this.focusRow(e?this.model.getRowCount()-1:0),!0}onFocusIn(e){const t=e.target;t.classList.contains("ag-virtual-list-item")&&(this.lastFocusedRowIndex=vE(t)-1)}onFocusOut(e){this.getFocusableElement().contains(e.relatedTarget)||(this.lastFocusedRowIndex=null)}handleKeyDown(e){const{key:t,shiftKey:s}=e;switch(t){case Qe.UP:case Qe.DOWN:{const r=t===Qe.UP;e.preventDefault(),s?this.moveItem(r):this.navigate(r)}break;case Qe.PAGE_HOME:case Qe.PAGE_END:case Qe.PAGE_UP:case Qe.PAGE_DOWN:this.navigateToPage(t)!==null&&e.preventDefault();break}}onTabKeyDown(e){this.stopPropagationCallbacks?.stopPropagation(e),this.forceFocusOutOfContainer(e.shiftKey)}getNextRow(e){if(this.lastFocusedRowIndex==null)return;const t=this.lastFocusedRowIndex+(e?-1:1);if(!(t<0||t>=this.model.getRowCount()))return t}moveItem(e){if(!this.moveItemCallback)return;const t=this.getComponentAt(this.lastFocusedRowIndex);t&&this.moveItemCallback(t,e)}navigate(e){const t=this.getNextRow(e);t!==void 0&&this.focusRow(t)}navigateToPage(e,t="focused"){let s=!1;t==="focused"&&(t=this.getLastFocusedRow(),s=!0);const r=this.model.getRowCount()-1;let i=-1;return e===Qe.PAGE_HOME?i=0:e===Qe.PAGE_END?i=r:e===Qe.PAGE_DOWN?i=Math.min(t+this.pageSize,r):e===Qe.PAGE_UP&&(i=Math.max(t-this.pageSize,0)),i===-1?null:(s?this.focusRow(i):this.ensureIndexVisible(i),i)}getLastFocusedRow(){return this.lastFocusedRowIndex}focusRow(e){this.isScrolling||(this.isScrolling=!0,this.ensureIndexVisible(e),bE(this.beans,()=>{if(this.isScrolling=!1,!this.isAlive())return;const t=this.renderedRows.get(e);t&&t.eDiv.focus()}))}getComponentAt(e){return this.renderedRows.get(e)?.rowComponent}forEachRenderedRow(e){this.renderedRows.forEach((t,s)=>e(t.rowComponent,s))}getItemHeight(){return this.isHeightFromTheme?this.beans.environment.getDefaultListItemHeight():this.rowHeight}ensureIndexVisible(e,t=!0){const s=this.model.getRowCount();if(typeof e!="number"||e<0||e>=s)return!1;const r=this.eContainer.offsetTop+e*this.rowHeight,i=r+this.rowHeight,n=this.getGui(),o=n.scrollTop,a=n.offsetHeight,l=o+a,c=t?0:this.rowHeight,u=o>r+c,d=l<i-c;if(u)return n.scrollTop=r,!0;if(d){const h=i-a;return n.scrollTop=h,!0}return!1}setComponentCreator(e){this.componentCreator=e}setComponentUpdater(e){this.componentUpdater=e}getRowHeight(){return this.rowHeight}getScrollTop(){return this.getGui().scrollTop}setRowHeight(e){this.isHeightFromTheme=!1,this.rowHeight=e,this.refresh()}refresh(e){if(this.model==null||!this.isAlive())return;const t=this.model.getRowCount();this.eContainer.style.height=`${t*this.rowHeight}px`,this.refreshAriaProperties(),this.awaitStable(()=>{this.isAlive()&&(this.canSoftRefresh(e)?this.drawVirtualRows(!0):(this.clearVirtualRows(),this.drawVirtualRows()))})}awaitStable(e){if(!this.isAlive()||(this.awaitStableCallbacks.push(e),this.awaitStableCallbacks.length>1))return;const t=this.model.getRowCount(),s=Date.now(),r=()=>{if(this.eContainer.clientHeight<t*this.rowHeight&&Date.now()-s<=TE)return!1;window.clearInterval(this.awaitStableInterval),this.awaitStableInterval=0;const i=this.awaitStableCallbacks;this.awaitStableCallbacks=[];for(let n=0,o=i.length;n<o;++n)i[n]();return!0};r()||(this.awaitStableInterval=window.setInterval(r,AE))}canSoftRefresh(e){return!!(e&&this.renderedRows.size&&typeof this.model.areRowsEqual=="function"&&this.componentUpdater)}clearVirtualRows(){this.renderedRows.forEach((e,t)=>this.removeRow(t))}drawVirtualRows(e){if(!this.isAlive()||!this.model)return;const t=this.getGui(),s=t.scrollTop,r=s+t.offsetHeight;if(s===r)this.clearVirtualRows();else{const i=Math.floor(s/this.rowHeight),n=Math.floor(r/this.rowHeight);this.pageSize=Math.floor((r-s)/this.rowHeight),this.ensureRowsRendered(i,n,e)}}ensureRowsRendered(e,t,s){this.renderedRows.forEach((r,i)=>{(i<e||i>t)&&i!==this.lastFocusedRowIndex&&this.removeRow(i)}),s&&this.refreshRows();for(let r=e;r<=t;r++)this.renderedRows.has(r)||r<this.model.getRowCount()&&this.insertRow(r)}insertRow(e){const{model:t}=this;if(e<0||e>=t.getRowCount())return;const{cssIdentifier:s,ariaRole:r,renderedRows:i,eContainer:n}=this,o=t.getRow(e),a=r==="tree"?"treeitem":"option",l=mE({tag:"div",cls:`ag-virtual-list-item ag-${s}-virtual-list-item`,role:a,attrs:{tabindex:"-1"}});xE(l,t.getRowCount()),yE(l,e+1);const c=this.rowHeight;l.style.height=`${c}px`,l.style.top=`${c*e}px`;const u=this.componentCreator(o,l,e);u.addGuiEventListener("focusin",()=>this.lastFocusedRowIndex=e),l.appendChild(u.getGui()),i.has(e-1)?i.get(e-1).eDiv.insertAdjacentElement("afterend",l):i.has(e+1)?i.get(e+1).eDiv.insertAdjacentElement("beforebegin",l):n.appendChild(l),i.set(e,{rowComponent:u,eDiv:l,value:o})}removeRow(e){const t=this.renderedRows.get(e);t.eDiv.remove(),this.destroyBean(t.rowComponent),this.renderedRows.delete(e)}refreshRows(){const e=this.model.getRowCount();this.renderedRows.forEach((t,s)=>{if(s>=e)this.removeRow(s);else{const r=this.model.getRow(s);this.model.areRowsEqual?.(t.value,r)?this.componentUpdater(r,t.rowComponent):this.removeRow(s)}})}addScrollListener(){this.addGuiEventListener("scroll",()=>this.drawVirtualRows(),{passive:!0})}setModel(e){this.model=e}getAriaElement(){return this.eContainer}destroy(){this.isAlive()&&(this.clearVirtualRows(),window.clearInterval(this.awaitStableInterval),this.awaitStableInterval=0,this.awaitStableCallbacks.length=0,super.destroy())}};import{AgBeanStub as RE,AutoScrollService as ME,_radioCssClass as Zd}from"ag-stack";var IE='.ag-list-item-hovered:after{background-color:var(--ag-accent-color);content:"";height:1px;left:0;position:absolute;right:0}.ag-item-highlight-top:after{top:0}.ag-item-highlight-bottom:after{bottom:0}',ha="ag-list-item-hovered",Xd=class extends Yw{constructor(e,t,s){super(),this.comp=e,this.virtualList=t,this.params=s,this.currentDragValue=null,this.lastHoveredListItem=null}postConstruct(){this.beans.environment.addGlobalCSS(IE,"component-AgVirtualListDragFeature"),this.params.addListeners(this,this.listItemDragStart.bind(this),this.listItemDragEnd.bind(this)),this.createDropTarget(),this.createAutoScrollService()}listItemDragStart(e){this.currentDragValue=this.params.getCurrentDragValue(e),this.moveBlocked=this.params.isMoveBlocked(this.currentDragValue)}listItemDragEnd(){window.setTimeout(()=>{this.currentDragValue=null,this.moveBlocked=!1},10)}createDropTarget(){const e={isInterestedIn:t=>t===this.params.dragSourceType,getIconName:()=>this.moveBlocked?"pinned":"move",getContainer:()=>this.comp.getGui(),onDragging:t=>this.onDragging(t),onDragStop:()=>this.onDragStop(),onDragLeave:()=>this.onDragLeave(),onDragCancel:()=>this.onDragCancel()};this.beans.dragAndDrop?.addDropTarget(e)}createAutoScrollService(){const e=this.virtualList.getGui();this.autoScrollService=new ME({scrollContainer:e,scrollAxis:"y",getVerticalPosition:()=>e.scrollTop,setVerticalPosition:t=>e.scrollTop=t})}onDragging(e){if(!this.currentDragValue||this.moveBlocked)return;const t=this.getListDragItem(e),s=this.virtualList.getComponentAt(t.rowIndex);if(!s)return;const r=s.getGui().parentElement;this.lastHoveredListItem?.rowIndex===t.rowIndex&&this.lastHoveredListItem.position===t.position||(this.autoScrollService.check(e.event),this.clearHoveredItems(),this.lastHoveredListItem=t,Zd(r,ha),Zd(r,`ag-item-highlight-${t.position}`))}getListDragItem(e){const t=this.virtualList.getGui(),s=Number.parseFloat(window.getComputedStyle(t).paddingTop),r=this.virtualList.getRowHeight(),i=this.virtualList.getScrollTop(),n=Math.max(0,(e.y-s+i)/r),o=this.params.getNumRows(this.comp)-1,a=Math.min(o,n)|0;return{rowIndex:a,position:Math.round(n)>n||n>o?"bottom":"top",component:this.virtualList.getComponentAt(a)}}onDragStop(){this.moveBlocked||(this.params.moveItem(this.currentDragValue,this.lastHoveredListItem),this.clearDragProperties())}onDragCancel(){this.clearDragProperties()}onDragLeave(){this.clearDragProperties()}clearDragProperties(){this.clearHoveredItems(),this.autoScrollService.ensureCleared()}clearHoveredItems(){const e=this.virtualList.getGui();for(const t of e.querySelectorAll(`.${ha}`))for(const s of[ha,"ag-item-highlight-top","ag-item-highlight-bottom"])t.classList.remove(s);this.lastHoveredListItem=null}};import{RefPlaceholder as pa,_setAriaLabelledBy as Jd}from"ag-stack";import{AgAbstractLabel as EE,AgInputNumberFieldSelector as DE}from"ag-grid-community";import{AgAbstractInputField as LE}from"ag-grid-community";var Qd=class extends qw{constructor(e){super(e,"ag-range-field","range")}postConstruct(){super.postConstruct();const{min:e,max:t,step:s}=this.config;e!=null&&this.setMinValue(e),t!=null&&this.setMaxValue(t),this.setStep(s||1)}addInputListeners(){this.addManagedElementListeners(this.eInput,{input:e=>{const t=e.target.value;this.setValue(t)}})}setMinValue(e){return this.min=e,this.eInput.setAttribute("min",e.toString()),this}setMaxValue(e){return this.max=e,this.eInput.setAttribute("max",e.toString()),this}setStep(e){return this.eInput.setAttribute("step",e.toString()),this}setValue(e,t){this.min!=null&&(e=Math.max(Number.parseFloat(e),this.min).toString()),this.max!=null&&(e=Math.min(Number.parseFloat(e),this.max).toString());const s=super.setValue(e,t);return this.eInput.value=e,s}},eh={selector:"AG-INPUT-RANGE",component:Qd},kE=".ag-slider-wrapper{display:flex;:where(.ag-input-field){flex:1 1 auto}}:where(.ag-ltr) .ag-slider-field{margin-right:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-slider-field{margin-left:calc(var(--ag-spacing)*2)}",Te=class extends Zw{constructor(e){super(e,`<div class="ag-slider">
            <label data-ref="eLabel"></label>
            <div class="ag-wrapper ag-slider-wrapper">
                <ag-input-range data-ref="eSlider"></ag-input-range>
                <ag-input-number-field data-ref="eText"></ag-input-number-field>
            </div>
        </div>`,[eh,DE]),this.eLabel=pa,this.eSlider=pa,this.eText=pa,this.labelAlignment="top",this.registerCSS(kE)}postConstruct(){super.postConstruct(),this.eSlider.addCss("ag-slider-field");const{minValue:e,maxValue:t,textFieldWidth:s,step:r,value:i,onValueChange:n}=this.config;e!=null&&this.setMinValue(e),t!=null&&this.setMaxValue(t),s!=null&&this.setTextFieldWidth(s),r!=null&&this.setStep(r),i!=null&&this.setValue(i),n!=null&&this.onValueChange(n)}setLabel(e){return super.setLabel(e),this.refreshInputsLabelledBy(),this}refreshInputsLabelledBy(){const t=this.getLabel()===""?"":this.getLabelId();Jd(this.eSlider.getInputElement(),t),Jd(this.eText.getInputElement(),t)}onValueChange(e){return this.addManagedListeners(this.eText,{fieldValueChanged:()=>{const t=Number.parseFloat(this.eText.getValue());this.eSlider.setValue(t.toString(),!0),e(t||0)}}),this.addManagedListeners(this.eSlider,{fieldValueChanged:()=>{const t=this.eSlider.getValue();this.eText.setValue(t,!0),e(Number.parseFloat(t))}}),this}setSliderWidth(e){return this.eSlider.setWidth(e),this}setTextFieldWidth(e){return this.eText.setWidth(e),this}setMinValue(e){return this.eSlider.setMinValue(e),this.eText.setMin(e),this}setMaxValue(e){return this.eSlider.setMaxValue(e),this.eText.setMax(e),this}getValue(){return this.eText.getValue()}setValue(e,t){return this.getValue()===e?this:(this.eText.setValue(e,!0),this.eSlider.setValue(e,!0),t||this.dispatchLocalEvent({type:"fieldValueChanged"}),this)}setStep(e){return this.eSlider.setStep(e),this.eText.setStep(e),this}},Ie={selector:"AG-SLIDER",component:Te};import{_createElement as _E}from"ag-grid-community";var Ds=(e,t,s)=>Math.min(s,Math.max(e,t)),qi=e=>Ds(0,Number.isNaN(e)?0:e,1),ga=e=>{const t=e<0?-1:1,s=Math.abs(e);return s>.0031308?t*(1.055*s**(1/2.4)-.055):12.92*e},GE=new Set(["currentcolor","inherit","initial","unset","revert"]);function th(e,t){const s=_E({tag:"span"});if(s.style.color=e,!s.style.color&&!/\bvar\(/i.test(e))return"";s.style.position="absolute",s.style.left="-99999px",s.style.top="-99999px",s.style.visibility="hidden",t.appendChild(s);const r=getComputedStyle(s).color;return s.remove(),r||""}function sh(e,t){if(!/^[a-z]+$/i.test(e)||GE.has(e.toLowerCase()))return;const s=fa(th(e,t.body));if(s?.length===3||s?.length===4)return s}function rh(e){e=e.replaceAll(" ","").slice(1);let t;switch(e.length){case 6:case 8:t=[];for(let s=0;s<e.length;s+=2)t.push(Number.parseInt(`${e[s]}${e[s+1]}`,16));break;case 3:case 4:t=e.split("").map(s=>Number.parseInt(s,16)).map(s=>s+s*16);break}if(t&&t.length>=3&&t.every(s=>s>=0))return t.length===3&&t.push(255),t}function ih(e){const t=e.indexOf("("),s=e.indexOf(")");if(t===-1||s===-1||s<t)return;const r=e.substring(t+1,s),i=r.indexOf("/"),o=(i===-1?r:r.substring(0,i)).trim().split(/[\s,]+/);return i!==-1&&o.push(r.substring(i+1).trim()),o}function fa(e){const t=ih(e);if(!t)return;const s=[];for(let r=0;r<t.length;r++){const i=t[r];let n=Number.parseFloat(i);if(!Number.isFinite(n))return;i.includes("%")?n=Ds(0,n,100)/100:r===3?n=Ds(0,n,1):n=Ds(0,n,255)/255,s.push(n)}return s}function nh(e){const t=Number.parseFloat(e);if(Number.isFinite(t))return e.includes("turn")?t*360:e.includes("grad")?t*.9:e.includes("rad")?t*180/Math.PI:t}function oh(e){const t=Number.parseFloat(e);if(Number.isFinite(t))return Ds(0,t/100,1)}function ah(e){const t=Number.parseFloat(e);if(Number.isFinite(t))return Ds(0,e.includes("%")?t/100:t,1)}function OE(e){const t=Number.parseFloat(e);if(Number.isFinite(t))return Math.max(0,e.includes("%")?t/100*.4:t)}function lh(e,t){const s=ih(e);if(!s||s.length<3||s.length>4)return;const r=[];for(let i=0;i<3;i++){const n=t[i](s[i]);if(n===void 0)return;r.push(n)}if(s.length===4){const i=ah(s[3]);if(i===void 0)return;r.push(i)}return r}var ch=e=>lh(e,[nh,oh,oh]),uh=e=>lh(e,[ah,OE,nh]);function NE(e,t,s){if(e=(e%360+360)%360,t===0)return[s,s,s];const r=s<.5?s*(1+t):s+t-s*t,i=2*s-r,n=o=>(o<0&&(o+=1),o>1&&(o-=1),o<1/6?i+(r-i)*6*o:o<1/2?r:o<2/3?i+(r-i)*(2/3-o)*6:i);return[n(e/360+1/3),n(e/360),n(e/360-1/3)]}function BE(e,t,s){const r=t*Math.cos(s*Math.PI/180),i=t*Math.sin(s*Math.PI/180),n=(e+.3963377774*r+.2158037573*i)**3,o=(e-.1055613458*r-.0638541728*i)**3,a=(e-.0894841775*r-1.291485548*i)**3;return[ga(4.0767416621*n-3.3077115913*o+.2309699292*a),ga(-1.2684380046*n+2.6097574011*o-.3413193965*a),ga(-.0041960863*n-.7034186147*o+1.707614701*a)]}function VE(e,t,s){if(e=(e%360+360)%360/360,t===0)return[s,s,s];const r=(e-Math.floor(e))*6,i=r-Math.floor(r),n=s*(1-t),o=s*(1-t*i),a=s*(1-t*(1-i));switch(Math.trunc(r)){case 0:return[s,a,n];case 1:return[o,s,n];case 2:return[n,s,a];case 3:return[n,o,s];case 4:return[a,n,s];case 5:return[s,n,o]}return[0,0,0]}var Zi=e=>{const t=Math.round(e*255).toString(16);return t.length===1?"0"+t:t},Ae=class gr{constructor(t,s,r,i=1){this.r=qi(t),this.g=qi(s),this.b=qi(r),this.a=qi(i)}static validColorString(t,s){if(t.includes("#"))return!!rh(t);const r=t.toLowerCase();if(r.includes("hsl"))return!!ch(t);if(r.includes("oklch"))return!!uh(t);if(r.includes("rgb")){const i=fa(t);return i!=null&&(i.length===3||i.length===4)}return!!sh(t,s)}static fromString(t,s){if(t.includes("#"))return HE(t);const r=t.toLowerCase();if(r.includes("hsl")){const n=ch(t);if(n){const[o,a,l,c=1]=n,[u,d,h]=NE(o,a,l);return new gr(u,d,h,c)}throw new Error(`Malformed hsl/hsla color string: '${t}'`)}if(r.includes("oklch")){const n=uh(t);if(n){const[o,a,l,c=1]=n,[u,d,h]=BE(o,a,l);return new gr(u,d,h,c)}throw new Error(`Malformed oklch color string: '${t}'`)}if(r.includes("rgb")){const n=fa(t);if(n&&(n.length===3||n.length===4)){const[o,a,l,c=1]=n;return new gr(o,a,l,c)}throw new Error(`Malformed rgb/rgba color string: '${t}'`)}const i=sh(t,s);if(i){const[n,o,a,l=1]=i;return new gr(n,o,a,l)}throw new Error(`Invalid color string: '${t}'`)}static fromHSB(t,s,r,i=1){const[n,o,a]=VE(t,s,r);return new gr(n,o,a,i)}toHexString(){const t="#"+Zi(this.r)+Zi(this.g)+Zi(this.b);return this.a<1?t+Zi(this.a):t}toRgbaString(){const t=[Math.round(this.r*255),Math.round(this.g*255),Math.round(this.b*255)];return this.a!==1?(t.push(Math.round(this.a*1e3)/1e3),`rgba(${t.join(", ")})`):`rgb(${t.join(", ")})`}toHSB(){const{r:t,g:s,b:r}=this,i=Math.min(t,s,r),n=Math.max(t,s,r),o=n===0?0:(n-i)/n;let a=0;if(i!==n){const l=n-i,c=(n-t)/l,u=(n-s)/l,d=(n-r)/l;t===n?a=d-u:s===n?a=2+c-d:a=4+u-c,a/=6,a<0&&(a+=1)}return[a*360,o,n]}};function HE(e){const t=rh(e);if(t){const[s,r,i,n]=t;return new Ae(s/255,r/255,i/255,n/255)}throw new Error(`Malformed hexadecimal color string: '${e}'`)}import{_getDocument as UE}from"ag-stack";import{AgPickerField as zE,_createElement as dh}from"ag-grid-community";import{AgComponentStub as WE,RefPlaceholder as At,_exists as KE,_getDocument as hh,_setDisplayed as $E}from"ag-stack";import{KeyCode as Pt}from"ag-grid-community";import{RefPlaceholder as jE,_getDocument as ma}from"ag-stack";import{AgInputTextField as YE}from"ag-grid-community";var qE=class extends Xw{constructor(){super({template:{tag:"div",cls:"ag-color-input",role:"presentation",children:[{tag:"div",ref:"eLabel",cls:"ag-input-field-label"},{tag:"div",ref:"eWrapper",cls:"ag-wrapper ag-input-wrapper",role:"presentation",children:[{tag:"input",ref:"eInput",cls:"ag-input-field-input"},{tag:"div",ref:"eColor",cls:"ag-color-input-color"}]}]}}),this.eColor=jE}setColor(e){const t=e.toRgbaString();this.setValue(Ae.fromString(t,ma(this.beans)).toHexString().toUpperCase(),!0),this.eColor.style.backgroundColor=t}setValue(e,t){const s=Ae.validColorString(e??"",ma(this.beans));return this.eInput.setCustomValidity(s?"":this.getLocaleTextFunc()("invalidColor","Color value is invalid")),super.setValue(e,t),s&&!t&&this.dispatchLocalEvent({type:"colorChanged"}),this}onColorChanged(e){this.addManagedListeners(this,{colorChanged:()=>e(Ae.fromString(this.value,ma(this.beans)))})}},ZE={selector:"AG-COLOR-INPUT",component:qE},ph=8,Xi=[],XE=class extends Jw{constructor(e){super(`<div class="ag-color-panel" tabindex="-1">
            <div data-ref="spectrumColor" class="ag-spectrum-color">
                <div class="ag-spectrum-sat ag-spectrum-fill">
                    <div data-ref="spectrumVal" class="ag-spectrum-val ag-spectrum-fill">
                        <div data-ref="spectrumDragger" class="ag-spectrum-dragger"></div>
                    </div>
                </div>
            </div>
            <div class="ag-spectrum-tools">
                <div data-ref="spectrumHue" class="ag-spectrum-hue ag-spectrum-tool">
                    <div class="ag-spectrum-hue-background"></div>
                    <div data-ref="spectrumHueSlider" class="ag-spectrum-slider"></div>
                </div>
                <div data-ref="spectrumAlpha" class="ag-spectrum-alpha ag-spectrum-tool">
                    <div class="ag-spectrum-alpha-background"></div>
                    <div data-ref="spectrumAlphaSlider" class="ag-spectrum-slider"></div>
                </div>
                <ag-color-input data-ref="colorInput"></ag-color-input>
                <div data-ref="recentColors" class="ag-recent-colors"></div>
            </div>
        </div>`,[ZE]),this.H=1,this.S=1,this.B=1,this.A=1,this.isSpectrumDragging=!1,this.isSpectrumHueDragging=!1,this.isSpectrumAlphaDragging=!1,this.colorChanged=!1,this.spectrumColor=At,this.spectrumVal=At,this.spectrumDragger=At,this.spectrumHue=At,this.spectrumHueSlider=At,this.spectrumAlpha=At,this.spectrumAlphaSlider=At,this.colorInput=At,this.recentColors=At,this.picker=e.picker}postConstruct(){this.initTabIndex(),this.initRecentColors(),this.addGuiEventListener("focus",()=>this.spectrumColor.focus()),this.addGuiEventListener("keydown",e=>{e.key===Pt.ENTER&&!e.defaultPrevented&&this.destroy()}),this.addManagedListeners(this.spectrumColor,{keydown:e=>this.moveDragger(e)}),this.addManagedListeners(this.spectrumAlphaSlider,{keydown:e=>this.moveAlphaSlider(e)}),this.addManagedListeners(this.spectrumHueSlider,{keydown:e=>this.moveHueSlider(e)}),this.addManagedListeners(this.spectrumVal,{mousedown:this.onSpectrumDraggerDown.bind(this)}),this.addManagedListeners(this.spectrumHue,{mousedown:this.onSpectrumHueDown.bind(this)}),this.addManagedListeners(this.spectrumAlpha,{mousedown:this.onSpectrumAlphaDown.bind(this)}),this.addGuiEventListener("mousemove",e=>{this.onSpectrumDraggerMove(e),this.onSpectrumHueMove(e),this.onSpectrumAlphaMove(e)}),this.addManagedListeners(document,{mouseup:this.onMouseUp.bind(this)}),this.colorInput.onColorChanged(this.setColor.bind(this)),this.addManagedListeners(this.recentColors,{click:this.onRecentColorClick.bind(this),keydown:e=>{(e.key===Pt.ENTER||e.key===Pt.SPACE)&&(e.preventDefault(),this.onRecentColorClick(e))}})}initTabIndex(){const e=this.tabIndex=this.gos.get("tabIndex").toString();this.spectrumColor.setAttribute("tabindex",e),this.spectrumHueSlider.setAttribute("tabindex",e),this.spectrumAlphaSlider.setAttribute("tabindex",e)}refreshSpectrumRect(){return this.spectrumValRect=this.spectrumVal.getBoundingClientRect()}refreshHueRect(){return this.spectrumHueRect=this.spectrumHue.getBoundingClientRect()}refreshAlphaRect(){return this.spectrumAlphaRect=this.spectrumAlpha.getBoundingClientRect()}onSpectrumDraggerDown(e){e.preventDefault(),this.refreshSpectrumRect(),this.isSpectrumDragging=!0,this.moveDragger(e)}onSpectrumDraggerMove(e){this.isSpectrumDragging&&this.moveDragger(e)}onSpectrumHueDown(e){this.refreshHueRect(),this.isSpectrumHueDragging=!0,this.moveHueSlider(e)}onSpectrumHueMove(e){this.isSpectrumHueDragging&&this.moveHueSlider(e)}onSpectrumAlphaDown(e){this.refreshAlphaRect(),this.isSpectrumAlphaDragging=!0,this.moveAlphaSlider(e)}onSpectrumAlphaMove(e){this.isSpectrumAlphaDragging&&this.moveAlphaSlider(e)}onMouseUp(){this.isSpectrumDragging=!1,this.isSpectrumHueDragging=!1,this.isSpectrumAlphaDragging=!1}moveDragger(e){const t=this.spectrumValRect;if(!t)return;let s,r;if(e instanceof MouseEvent)s=e.clientX-t.left,r=e.clientY-t.top;else{const i=e.key===Pt.LEFT,n=e.key===Pt.RIGHT,o=e.key===Pt.UP,a=e.key===Pt.DOWN,l=o||a,c=i||n;if(!l&&!c)return;e.preventDefault();const{x:u,y:d}=this.getSpectrumValue(),h=i?-5:5,p=o?-5:5;s=u+(c?h:0),r=d+(l?p:0)}s=Math.max(s,0),s=Math.min(s,t.width),r=Math.max(r,0),r=Math.min(r,t.height),this.setSpectrumValue(s/t.width,1-r/t.height)}moveHueSlider(e){const t=this.spectrumHueRect;if(!t)return;const s=this.moveSlider(this.spectrumHueSlider,e);s!=null&&(this.H=1-s/t.width,this.update())}moveAlphaSlider(e){const t=this.spectrumAlphaRect;if(!t)return;const s=this.moveSlider(this.spectrumAlphaSlider,e);s!=null&&(this.A=s/t.width,this.update())}moveSlider(e,t){const s=e.getBoundingClientRect(),r=e.parentElement?.getBoundingClientRect();if(!e||!r)return null;const i=s.width/2;let n;if(t instanceof MouseEvent)n=Math.floor(t.clientX-r.left);else{const o=t.key===Pt.LEFT,a=t.key===Pt.RIGHT;if(!o&&!a)return null;t.preventDefault();const l=o?-5:5;n=Number.parseFloat(e.style.left)+i+l}return n=Math.max(n,0),n=Math.min(n,r.width),e.style.left=n-i+"px",n}update(e){const{A:t,S:s,B:r,H:i}=this,n=i*360,o=Ae.fromHSB(n,s,r,t),a=o.toRgbaString(),c=Ae.fromHSB(n,s,r).toRgbaString(),d=Ae.fromHSB(n,1,1).toRgbaString(),h=this.picker;Ae.fromString(h.getValue(),hh(this.beans)).toRgbaString()!==a&&(this.colorChanged=!0),h.setValue(a),this.spectrumColor.style.backgroundColor=d,this.spectrumDragger.style.backgroundColor=c,this.spectrumHueSlider.style.backgroundColor=d,this.spectrumAlpha.style.setProperty("--ag-internal-spectrum-alpha-color-from",Ae.fromHSB(n,s,r,0).toRgbaString()),this.spectrumAlpha.style.setProperty("--ag-internal-spectrum-alpha-color-to",c),this.spectrumAlpha.style.setProperty("--ag-internal-spectrum-alpha-color",a),e||this.colorInput.setColor(o)}setSpectrumValue(e,t,s){const r=this.spectrumValRect??this.refreshSpectrumRect();if(r==null)return;const i=this.spectrumDragger,n=i.getBoundingClientRect();e=Math.max(0,e),e=Math.min(1,e),t=Math.max(0,t),t=Math.min(1,t),this.S=e,this.B=t,i.style.left=e*r.width-n.width/2+"px",i.style.top=(1-t)*r.height-n.height/2+"px",this.update(s)}getSpectrumValue(){const e=this.spectrumDragger,t=e.getBoundingClientRect(),s=Number.parseFloat(e.style.left)+t.width/2,r=Number.parseFloat(e.style.top)+t.height/2;return{x:s,y:r}}initRecentColors(){const e=Xi,t=e.map((s,r)=>`<div class="ag-recent-color" id=${r} style="background-color: ${s}; width: 15px; height: 15px;" recent-color="${s}" tabIndex="${this.tabIndex}"></div>`);this.recentColors.innerHTML=t.join(""),$E(this.recentColors,!!e.length)}setValue(e){const t=Ae.fromString(e,hh(this.beans));this.setColor(t,!0)}setColor(e,t){const[s,r,i]=e.toHSB();this.H=(Number.isNaN(s)?0:s)/360,this.A=e.a;const n=this.spectrumHueRect??this.refreshHueRect(),o=this.spectrumAlphaRect??this.refreshAlphaRect();this.spectrumHueSlider.style.left=`${(this.H-1)*-n.width-this.spectrumHueSlider.getBoundingClientRect().width/2}px`,this.spectrumAlphaSlider.style.left=`${this.A*o.width-this.spectrumAlphaSlider.getBoundingClientRect().width/2}px`,this.setSpectrumValue(r,i,!t)}onRecentColorClick(e){const t=e.target;if(!KE(t.id))return;const s=Number.parseInt(t.id,10);this.setValue(Xi[s]),this.destroy()}addRecentColor(){const t=Ae.fromHSB(this.H*360,this.S,this.B,this.A).toRgbaString();let s=Xi;!this.colorChanged||s[0]===t||(s=s.filter(r=>r!=t),s=[t].concat(s),s.length>ph&&(s=s.slice(0,ph)),Xi=s)}destroy(){this.addRecentColor(),super.destroy()}},JE=`.ag-color-panel{display:flex;flex-direction:column;padding:var(--ag-spacing);text-align:center;width:100%}.ag-spectrum-color{cursor:default;flex:1 1 auto;overflow:visible;position:relative}.ag-spectrum-color,.ag-spectrum-fill{border-radius:var(--ag-border-radius)}.ag-spectrum-fill{inset:0;position:absolute}.ag-spectrum-val{background-image:linear-gradient(0deg,#000,rgba(204,154,129,0));cursor:pointer}.ag-spectrum-dragger{background:#000;border:var(--ag-color-picker-thumb-border-width) solid #fff;border-radius:var(--ag-color-picker-thumb-size);box-shadow:0 0 2px 0 rgba(0,0,0,.24);cursor:pointer;height:var(--ag-color-picker-thumb-size);pointer-events:none;position:absolute;width:var(--ag-color-picker-thumb-size)}.ag-spectrum-alpha,.ag-spectrum-hue{cursor:default}.ag-spectrum-hue-background{background:linear-gradient(270deg,red 3%,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);height:100%;width:100%}.ag-spectrum-alpha-background{background:linear-gradient(to right,var(--ag-internal-spectrum-alpha-color-from),var(--ag-internal-spectrum-alpha-color-to)),url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="4" height="4"><rect x="0" y="0" width="4" height="4" fill="%23fff"/><path d="M0 0H2V4H4V2H0Z" fill="%23b2b2b2"/></svg>') 0 0 /4px 4px;height:100%;width:100%}.ag-spectrum-tool{cursor:pointer;height:var(--ag-color-picker-track-size);margin-bottom:10px;position:relative}.ag-spectrum-slider,.ag-spectrum-tool{border-radius:var(--ag-color-picker-thumb-size)}.ag-spectrum-slider{border:var(--ag-color-picker-thumb-border-width) solid #fff;box-shadow:0 1px 4px 0 rgba(0,0,0,.37);height:var(--ag-color-picker-thumb-size);margin-top:calc(var(--ag-color-picker-track-size)/2*-1 + var(--ag-color-picker-thumb-size)/2*-1);pointer-events:none;position:absolute;width:var(--ag-color-picker-thumb-size)}:where(.ag-spectrum-alpha) .ag-spectrum-slider{background:linear-gradient(to bottom,var(--ag-internal-spectrum-alpha-color),var(--ag-internal-spectrum-alpha-color)) var(--ag-background-color)}.ag-recent-colors{display:flex;gap:6px;margin:10px var(--ag-spacing) 2px}.ag-recent-color{border:solid var(--ag-border-width) var(--ag-border-color);cursor:pointer}.ag-color-dialog{border-radius:5px}:where(.ag-color-picker){.ag-picker-field-wrapper{padding-left:var(--ag-spacing);padding-right:var(--ag-spacing)}.ag-picker-field-display{align-items:center;display:flex;flex-direction:row;min-height:var(--ag-list-item-height)}}:where(.ag-ltr) .ag-color-picker-color,:where(.ag-ltr) .ag-color-picker-value{margin-right:var(--ag-spacing)}:where(.ag-rtl) .ag-color-picker-color,:where(.ag-rtl) .ag-color-picker-value{margin-left:var(--ag-spacing)}.ag-spectrum-tools{padding:10px 0 0}.ag-spectrum-alpha-background,.ag-spectrum-hue-background{border-radius:var(--ag-color-picker-track-border-radius)}.ag-color-input-color,.ag-color-picker-color,.ag-recent-color{border-radius:var(--ag-color-picker-color-border-radius)}.ag-spectrum-sat{background-image:linear-gradient(90deg,#fff,rgba(204,154,129,0))}.ag-recent-color,.ag-spectrum-color,.ag-spectrum-slider{&:where(:not(:disabled,[readonly])):focus-visible{box-shadow:var(--ag-focus-shadow)}}.ag-color-input-color,.ag-color-picker-color{border:solid var(--ag-border-width) var(--ag-border-color);height:var(--ag-icon-size);width:var(--ag-icon-size)}:where(.ag-ltr) .ag-color-input .ag-input-field-input{padding-left:calc(var(--ag-icon-size) + var(--ag-spacing)*2)}:where(.ag-rtl) .ag-color-input .ag-input-field-input{padding-right:calc(var(--ag-icon-size) + var(--ag-spacing)*2)}:where(.ag-color-input) .ag-color-input-color{position:absolute}:where(.ag-ltr) :where(.ag-color-input) .ag-color-input-color{margin-left:var(--ag-spacing)}:where(.ag-rtl) :where(.ag-color-input) .ag-color-input-color{margin-right:var(--ag-spacing)}.ag-color-input-color,.ag-color-picker-color,.ag-recent-color,.ag-spectrum-color,.ag-spectrum-tool{forced-color-adjust:none}`;import{AgComponentStub as QE,AgTabGuardFeature as eD,_setAriaLabel as tD,_setDisplayed as gh}from"ag-stack";import{AgComponentStub as fh,AgPositionableFeature as sD,RefPlaceholder as Ji,_getActiveDomElement as rD,_getInnerHeight as iD,_getInnerWidth as nD,_isVisible as oD,_setAriaLabel as aD,_setDisplayed as lD}from"ag-stack";import{_clamp as cD}from"ag-grid-community";var uD=".ag-panel{background-color:var(--ag-panel-background-color);display:flex;flex-direction:column;overflow:hidden;position:relative}.ag-dialog{border:var(--ag-dialog-border);border-radius:var(--ag-border-radius);box-shadow:var(--ag-dialog-shadow);position:absolute}.ag-panel-title-bar{align-items:center;background-color:var(--ag-panel-title-bar-background-color);border-bottom:var(--ag-panel-title-bar-border);color:var(--ag-panel-title-bar-text-color);cursor:default;display:flex;flex:none;font-family:var(--ag-panel-title-bar-font-family);font-size:var(--ag-panel-title-bar-font-size);font-weight:var(--ag-panel-title-bar-font-weight);height:var(--ag-panel-title-bar-height);padding:var(--ag-spacing) var(--ag-cell-horizontal-padding)}.ag-panel-title-bar-button{cursor:pointer;:where(.ag-icon){color:var(--ag-panel-title-bar-icon-color)}}:where(.ag-ltr) .ag-panel-title-bar-button{margin-left:calc(var(--ag-spacing)*1.5)}:where(.ag-rtl) .ag-panel-title-bar-button{margin-right:calc(var(--ag-spacing)*1.5)}.ag-panel-title-bar-title{flex:1 1 auto}.ag-panel-title-bar-buttons{display:flex}.ag-panel-content-wrapper{display:flex;flex:1 1 auto;overflow:hidden;position:relative}:where(.ag-dragging-fill-handle) .ag-dialog,:where(.ag-dragging-range-handle) .ag-dialog{opacity:.7;pointer-events:none}";function dD(e){return e??(e="default"),{tag:"div",cls:`ag-panel ag-${e}-panel`,attrs:{tabindex:"-1"},children:[{tag:"div",ref:"eTitleBar",cls:`ag-panel-title-bar ag-${e}-panel-title-bar ag-unselectable`,children:[{tag:"span",ref:"eTitle",cls:`ag-panel-title-bar-title ag-${e}-panel-title-bar-title`},{tag:"div",ref:"eTitleBarButtons",cls:`ag-panel-title-bar-buttons ag-${e}-panel-title-bar-buttons`}]},{tag:"div",ref:"eContentWrapper",cls:`ag-panel-content-wrapper ag-${e}-panel-content-wrapper`}]}}var va=class extends Qw{constructor(e){super(dD(e.cssIdentifier)),this.config=e,this.closable=!0,this.eContentWrapper=Ji,this.eTitleBar=Ji,this.eTitleBarButtons=Ji,this.eTitle=Ji,this.registerCSS(uD)}postConstruct(){const{component:e,closable:t,hideTitleBar:s,title:r,minWidth:i=250,width:n,minHeight:o=250,height:a,centered:l,popup:c,x:u,y:d,postProcessPopupParams:h}=this.config,p=this.beans,g=this.createManagedBean(new sD(this.getGui(),{minWidth:i,width:n,minHeight:o,height:a,centered:l,x:u,y:d,popup:c,calculateTopBuffer:()=>this.positionableFeature.getHeight()-this.getBodyHeight()}));this.positionableFeature=g;const f=this.getGui();if(e&&this.setBodyComponent(e),s?lD(this.eTitleBar,!1):(r&&this.setTitle(r),this.setClosable(t??this.closable)),this.addManagedElementListeners(this.eTitleBar,{mousedown:v=>{if(f.contains(v.relatedTarget)||f.contains(rD(p))||this.eTitleBarButtons.contains(v.target)){v.preventDefault();return}const C=this.eContentWrapper.querySelector("button, [href], input, select, textarea, [tabindex]");C&&C.focus()}}),c&&g.isPositioned())return;this.renderComponent&&this.renderComponent();let m;if(h){const{type:v,eventSource:C,mouseEvent:b}=h;m=()=>p.popupSvc?.callPostProcessPopup(h,v,f,C,b)}g.initialisePosition(m),this.eContentWrapper.style.height="0"}renderComponent(){const e=this.getGui();e.focus(),this.close=()=>{e.remove(),this.destroy()}}getHeight(){return this.positionableFeature.getHeight()}setHeight(e){this.positionableFeature.setHeight(e)}getWidth(){return this.positionableFeature.getWidth()}get isResizing(){return this.positionableFeature.isResizing}setWidth(e){this.positionableFeature.setWidth(e)}setClosable(e){if(e!==this.closable&&(this.closable=e),e){const t=this.closeButtonComp=new fh({tag:"button",cls:"ag-button",attrs:{type:"button"}});this.createBean(t);const s=t.getGui();aD(s,this.getLocaleTextFunc()("ariaLabelClose","Close"));const r=this.beans.iconSvc.createIconNoSpan("close",this.beans);r.classList.add("ag-panel-title-bar-button-icon"),s.appendChild(r),this.addTitleBarButton(t),t.addManagedElementListeners(s,{click:this.onBtClose.bind(this)})}else this.closeButtonComp&&(this.closeButtonComp.getGui().remove(),this.closeButtonComp=this.destroyBean(this.closeButtonComp))}setBodyComponent(e){e.setParentComponent(this),this.eContentWrapper.appendChild(e.getGui())}addTitleBarButton(e,t){const s=this.eTitleBarButtons,r=s.children,i=r.length;t??(t=i),t=cD(t,0,i),e.addCss("ag-panel-title-bar-button");const n=e.getGui();t===0?s.prepend(n):t===i?s.append(n):r[t-1].after(n),e.setParentComponent(this)}getBodyHeight(){return iD(this.eContentWrapper)}getBodyWidth(){return nD(this.eContentWrapper)}setTitle(e){this.eTitle.innerText=e}onBtClose(){this.close()}destroy(){this.closeButtonComp&&(this.closeButtonComp=this.destroyBean(this.closeButtonComp));const e=this.getGui();e&&oD(e)&&this.close(),super.destroy()}},Ca=class extends va{constructor(e,t){super({...e,popup:!0}),this.callbacks=t,this.isMaximizable=!1,this.isMaximized=!1,this.maximizeListeners=[],this.resizeListenerDestroy=null,this.lastPosition={x:0,y:0,width:0,height:0}}wireBeans(e){this.popupSvc=e.popupSvc}postConstruct(){const e=this.getGui(),{movable:t,resizable:s,maximizable:r,modal:i}=this.config;this.addCss("ag-dialog"),super.postConstruct(),this.tabGuardFeature=this.createManagedBean(new eD(this,this.callbacks?.stopPropagationCallbacks)),this.tabGuardFeature.initialiseTabGuard({isFocusableContainer:!0,onFocusIn:()=>{this.popupSvc?.bringPopupToFront(e)},onGuardFocusedFromInside:i?void 0:n=>this.callbacks?.focusNextContainer(this.beans,!n),onTabKeyDown:()=>{}}),t&&this.setMovable(t),r&&this.setMaximizable(r),s&&this.setResizable(s),i||this.callbacks?.configureFocusableContainer(this.beans,this)}setAllowFocus(e){this.tabGuardFeature.getTabGuardCtrl().setAllowFocus(e)}renderComponent(){const e=this.getGui(),{alwaysOnTop:t,modal:s,title:r,afterGuiAttached:i}=this.config,n=this.getLocaleTextFunc(),o=this.popupSvc?.addPopup({modal:s,eChild:e,closeOnEsc:!0,closedCallback:this.onClosed.bind(this),alwaysOnTop:t,ariaLabel:r||n("ariaLabelDialog","Dialog"),afterGuiAttached:i});o&&(this.close=o.hideFunc)}onClosed(e){this.destroy(),this.config.closedCallback?.(e)}setMaximized(e){this.isMaximizable&&e!==this.isMaximized&&this.toggleMaximize()}toggleMaximize(){const e=this.positionableFeature.getPosition();if(this.isMaximized){const{x:t,y:s,width:r,height:i}=this.lastPosition;this.setWidth(r),this.setHeight(i),this.positionableFeature.offsetElement(t,s)}else this.lastPosition.width=this.getWidth(),this.lastPosition.height=this.getHeight(),this.lastPosition.x=e.x,this.lastPosition.y=e.y,this.positionableFeature.offsetElement(0,0),this.setHeight("100%"),this.setWidth("100%");this.isMaximized=!this.isMaximized,this.refreshMaximizeIcon()}refreshMaximizeIcon(){gh(this.maximizeIcon,!this.isMaximized),gh(this.minimizeIcon,this.isMaximized);const e=this.getLocaleTextFunc(),t=this.isMaximized?e("ariaLabelRestore","Restore"):e("ariaLabelMaximize","Maximize");tD(this.maximizeButtonComp.getGui(),t)}clearMaximizebleListeners(){if(this.maximizeListeners.length){for(const e of this.maximizeListeners)e();this.maximizeListeners.length=0}this.resizeListenerDestroy&&(this.resizeListenerDestroy(),this.resizeListenerDestroy=null)}destroy(){this.maximizeButtonComp=this.destroyBean(this.maximizeButtonComp),this.clearMaximizebleListeners(),super.destroy()}setResizable(e){this.positionableFeature.setResizable(e)}setMovable(e){this.positionableFeature.setMovable(e,this.eTitleBar)}setMaximizable(e){if(!e){this.clearMaximizebleListeners(),this.maximizeButtonComp&&(this.destroyBean(this.maximizeButtonComp),this.maximizeButtonComp=this.maximizeIcon=this.minimizeIcon=void 0);return}const t=this.eTitleBar;if(!t||e===this.isMaximizable)return;this.isMaximizable=e;const s=this.buildMaximizeAndMinimizeElements();this.refreshMaximizeIcon(),s.addManagedElementListeners(s.getGui(),{click:this.toggleMaximize.bind(this)}),this.addTitleBarButton(s,0),this.maximizeListeners.push(...this.addManagedElementListeners(t,{dblclick:this.toggleMaximize.bind(this)})),[this.resizeListenerDestroy]=this.addManagedListeners(this.positionableFeature,{resize:()=>{this.isMaximized=!1,this.refreshMaximizeIcon()}})}buildMaximizeAndMinimizeElements(){const e=this.maximizeButtonComp=this.createBean(new QE({tag:"button",cls:"ag-button ag-dialog-button",attrs:{type:"button"}})),t=e.getGui(),s=this.beans.iconSvc;return this.maximizeIcon=s.createIconNoSpan("maximize"),t.appendChild(this.maximizeIcon),this.maximizeIcon.classList.add("ag-panel-title-bar-button-icon"),this.minimizeIcon=s.createIconNoSpan("minimize"),t.appendChild(this.minimizeIcon),this.minimizeIcon.classList.add("ag-panel-title-bar-button-icon"),e}},ba=class extends ex{constructor(e){super({pickerAriaLabelKey:"ariaLabelColorPicker",pickerAriaLabelValue:"Color Picker",pickerType:"ag-list",className:"ag-color-picker",pickerIcon:"chartsColorPicker",...e}),this.registerCSS(JE)}postConstruct(){this.eDisplayFieldColor=dh({tag:"span",cls:"ag-color-picker-color"}),this.eDisplayFieldText=dh({tag:"span",cls:"ag-color-picker-value"}),this.eDisplayField.append(this.eDisplayFieldColor,this.eDisplayFieldText),super.postConstruct(),this.value&&this.setValue(this.value)}createPickerComponent(){const e=this.eWrapper.getBoundingClientRect(),t=this.beans.popupSvc.getParentRect();return this.createBean(new Ca({closable:!1,modal:!0,hideTitleBar:!0,minWidth:190,width:190,height:250,x:e.right-t.left-190,y:e.top-t.top-250-(this.config.pickerGap??0),postProcessPopupParams:{type:"colorPicker",eventSource:this.eWrapper}},this.config.dialogCallbacks))}renderAndPositionPicker(){const e=this.pickerComponent,t=this.createBean(new XE({picker:this}));return e.addCss("ag-color-dialog"),t.addDestroyFunc(()=>{e.isAlive()&&this.destroyBean(e)}),e.setParentComponent(this),e.setBodyComponent(t),t.setValue(this.getValue()),t.getGui().focus(),e.addDestroyFunc(()=>{this.isDestroyingPicker?this.isDestroyingPicker=!1:(this.beforeHidePicker(),this.isDestroyingPicker=!0,t.isAlive()&&this.destroyBean(t),this.isAlive()&&this.getFocusableElement().focus())}),()=>this.pickerComponent?.close()}setValue(e){return this.value===e?this:(this.eDisplayFieldColor.style.backgroundColor=e,this.eDisplayFieldText.textContent=Ae.fromString(e,UE(this.beans)).toHexString().toUpperCase(),super.setValue(e))}getValue(){return this.value}},hD={selector:"AG-COLOR-PICKER",component:ba};import{AgTabGuardComp as pD,_createAgElement as gD,_focusInto as fD,_getActiveDomElement as mD,_isNothingFocused as mh,_last as vD}from"ag-stack";import{AgPromise as Sa,KeyCode as ut}from"ag-grid-community";import{AgBeanStub as CD,FAST_TEST_TIMINGS as vh,_setAriaDisabled as bD,_setAriaExpanded as SD,_setAriaHasPopup as yD,_setAriaRole as wD}from"ag-stack";import{KeyCode as Ch,TouchListener as xD,_createElement as FD}from"ag-grid-community";import{AgTabGuardComp as TD}from"ag-stack";import{KeyCode as AD}from"ag-grid-community";var PD=class extends tx{constructor(e){super(),this.setTemplateFromElement(e.getGui(),void 0,void 0,!0)}postConstruct(){this.initialiseTabGuard({onTabKeyDown:e=>this.onTabKeyDown(e),handleKeyDown:e=>this.handleKeyDown(e)})}handleKeyDown(e){e.key===AD.ESCAPE&&this.closePanel()}onTabKeyDown(e){e.defaultPrevented||(this.closePanel(),e.preventDefault())}closePanel(){const e=this.parentComponent;e.closeSubMenu(),setTimeout(()=>e.getGui().focus(),0)}},bh=vh?0:80,RD=vh?0:300,Fr=class extends sx{constructor(e){super(),this.callbacks=e,this.isActive=!1,this.isMouseActivation=!1,this.subMenuIsOpen=!1,this.subMenuIsOpening=!1,this.suppressRootStyles=!0,this.suppressAria=!0,this.suppressFocus=!0}init(e){const{menuItemDef:t,isAnotherSubMenuOpen:s,level:r,childComponent:i,contextParams:n}=e;return this.params=e.menuItemDef,this.level=r,this.isAnotherSubMenuOpen=s,this.shouldDisplayTooltipOnFocus=e.shouldDisplayTooltipOnFocus,this.childComponent=i,this.contextParams=n,this.cssClassPrefix=this.params.menuItemParams?.cssClassPrefix??"ag-menu-option",this.callbacks.getMenuItemComp(this.beans,this.params,{...t,level:r,isAnotherSubMenuOpen:s,openSubMenu:o=>this.openSubMenu(o),closeSubMenu:()=>this.closeSubMenu(),closeMenu:o=>this.closeMenu(o),updateTooltip:(o,a)=>this.refreshTooltip(o,a),onItemActivated:()=>this.onItemActivated()}).then(o=>{if(!o)return;this.menuItemComp=o;const a=o.configureDefaults?.();a&&this.configureDefaults(a===!0?void 0:a)})}addListeners(e,t){if(!t?.suppressClick){this.addManagedElementListeners(e,{click:r=>this.onItemSelected(r)});const s=new xD(e,!0);this.addManagedListeners(s,{tap:r=>this.onItemSelected(r.touchStart)}),this.addDestroyFunc(()=>s.destroy())}t?.suppressKeyboardSelect||this.addManagedElementListeners(e,{keydown:s=>{(s.key===Ch.ENTER||s.key===Ch.SPACE)&&(s.preventDefault(),this.onItemSelected(s))}}),t?.suppressMouseDown||this.addManagedElementListeners(e,{mousedown:s=>{s.stopPropagation(),s.preventDefault()}}),t?.suppressMouseOver||this.addManagedElementListeners(e,{mouseenter:()=>this.onMouseEnter(),mouseleave:()=>this.onMouseLeave()})}isDisabled(){return!!this.params.disabled}openSubMenu(e=!1,t){if(this.closeSubMenu(),!this.params.subMenu)return;this.subMenuIsOpening=!0;const s=FD({tag:"div",cls:"ag-menu",role:"presentation"});this.eSubMenuGui=s;let r,i=()=>{this.subMenuIsOpening=!1};if(this.childComponent){const c=this.createBean(new PD(this.childComponent));c.setParentComponent(this);const u=c.getGui(),d="mouseenter",h=()=>this.cancelDeactivate();u.addEventListener(d,h),r=()=>{u.removeEventListener(d,h),this.destroyBean(c)},s.appendChild(u),this.childComponent.afterGuiAttached&&(i=()=>{this.childComponent.afterGuiAttached(),this.subMenuIsOpening=!1})}else if(this.params.subMenu){const c=this.createBean(new Qi(this.level+1,this.contextParams,this.callbacks));c.setParentComponent(this),c.addMenuItems(this.params.subMenu),s.appendChild(c.getGui()),this.addManagedListeners(c,{closeMenu:u=>this.dispatchLocalEvent(u)}),c.addGuiEventListener("mouseenter",()=>this.cancelDeactivate()),r=()=>this.destroyBean(c),e&&(i=()=>{c.activateFirstItem(),this.subMenuIsOpening=!1})}const n=this.beans.popupSvc,o=()=>{const c=this.eGui;n?.positionPopupForMenu({eventSource:c,ePopup:s,event:t instanceof KeyboardEvent?void 0:t,additionalParams:this.callbacks.getPostProcessPopupParams(this.contextParams)})},a=this.getLocaleTextFunc(),l=n?.addPopup({modal:!0,eChild:s,positionCallback:o,anchorToElement:this.eGui,ariaLabel:a("ariaLabelSubMenu","SubMenu"),afterGuiAttached:i});this.subMenuIsOpen=!0,this.setAriaExpanded(!0),this.hideSubMenu=()=>{l&&l.hideFunc(),this.subMenuIsOpen=!1,this.setAriaExpanded(!1),r(),this.menuItemComp.setExpanded?.(!1),this.eSubMenuGui=void 0},this.menuItemComp.setExpanded?.(!0)}setAriaExpanded(e){this.suppressAria||SD(this.eGui,e)}closeSubMenu(){this.hideSubMenu&&(this.hideSubMenu(),this.hideSubMenu=null,this.setAriaExpanded(!1))}isSubMenuOpen(){return this.subMenuIsOpen}isSubMenuOpening(){return this.subMenuIsOpening}activate(e,t){this.cancelActivate(),!(this.params.disabled&&!t)&&(this.isActive=!0,this.suppressRootStyles||this.eGui.classList.add(`${this.cssClassPrefix}-active`),this.onItemActivated(),this.menuItemComp.setActive?.(!0),this.suppressFocus||this.callbacks.preserveRangesWhile(this.beans,()=>this.eGui.focus({preventScroll:!t})),e&&this.params.subMenu&&window.setTimeout(()=>{this.isAlive()&&this.isActive&&this.openSubMenu()},RD))}deactivate(){this.cancelDeactivate(),this.suppressRootStyles||this.eGui.classList.remove(`${this.cssClassPrefix}-active`),this.menuItemComp.setActive?.(!1),this.isActive=!1,this.subMenuIsOpen&&this.closeSubMenu()}getGui(){return this.menuItemComp.getGui()}getParentComponent(){return this.parentComponent}setParentComponent(e){this.parentComponent=e}getSubMenuGui(){return this.eSubMenuGui}onItemSelected(e){this.menuItemComp.select?.(),this.params.action?this.beans.frameworkOverrides.wrapOutgoing(()=>this.params.action(this.gos.addCommon({...this.contextParams}))):this.openSubMenu(e instanceof KeyboardEvent&&e.type==="keydown",e),!(this.params.subMenu&&!this.params.action||this.params.suppressCloseOnSelect)&&this.closeMenu(e instanceof MouseEvent||e instanceof KeyboardEvent?e:void 0)}closeMenu(e){const t={type:"closeMenu"};e&&(e instanceof MouseEvent?t.mouseEvent=e:t.keyboardEvent=e),this.dispatchLocalEvent(t)}onItemActivated(){const e={type:"menuItemActivated",menuItem:this};this.dispatchLocalEvent(e)}cancelActivate(){this.activateTimeoutId&&(window.clearTimeout(this.activateTimeoutId),this.activateTimeoutId=0)}cancelDeactivate(){this.deactivateTimeoutId&&(window.clearTimeout(this.deactivateTimeoutId),this.deactivateTimeoutId=0)}onMouseEnter(){this.cancelDeactivate(),this.isAnotherSubMenuOpen()?this.activateTimeoutId=window.setTimeout(()=>this.activateOnMouseEnter(),bh):this.activateOnMouseEnter()}activateOnMouseEnter(){this.isMouseActivation=!0;try{this.activate(!0)}finally{this.isMouseActivation=!1}}onMouseLeave(){this.cancelActivate(),this.isSubMenuOpen()?this.deactivateTimeoutId=window.setTimeout(()=>this.deactivate(),bh):this.deactivate()}refreshRootElementGui(e){let t=this.menuItemComp.getGui();const{cssClassPrefix:s,params:{cssClasses:r,disabled:i}}=this,n=this.menuItemComp.getRootElement?.();if(n&&(e||t.classList.add("ag-menu-option-custom"),t=n),this.suppressRootStyles=!!e,!this.suppressRootStyles){t.classList.add(s);for(const o of r??[])t.classList.add(o);i&&t.classList.add(`${s}-disabled`)}return t}applyAriaProperties(e){const{params:{checked:t,menuItemRole:s,subMenu:r,subMenuRole:i,disabled:n}}=this;wD(e,t==null?"menuitem":s??"menuitemcheckbox"),r&&yD(e,i??"menu"),n&&bD(e,!0)}configureDefaults(e){if(!this.menuItemComp){setTimeout(()=>this.configureDefaults(e));return}const{suppressRootStyles:t,suppressTooltip:s,suppressAria:r,suppressTabIndex:i,suppressFocus:n}=e??{},{params:{tooltip:o,disabled:a}}=this,l=this.eGui=this.refreshRootElementGui(!!t);this.suppressAria=!!r,r||this.applyAriaProperties(l),i||l.setAttribute("tabindex","-1"),s||this.refreshTooltip(o),a||this.addListeners(l,e),this.suppressFocus=!!n}refreshTooltip(e,t){if(this.tooltip=e,this.tooltipFeature=this.destroyBean(this.tooltipFeature),!e||!this.menuItemComp)return;const s=this.beans.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.getGui(),getTooltipComponentDefinition:()=>{},getTooltipValue:()=>this.tooltip,getLocation:()=>"menu",shouldDisplayTooltip:t,shouldDisplayTooltipOnFocus:()=>!this.isMouseActivation&&this.shouldDisplayTooltipOnFocus?.()!==!1});s&&(this.tooltipFeature=this.createBean(s))}destroy(){this.tooltipFeature=this.destroyBean(this.tooltipFeature),this.menuItemComp?.destroy?.(),super.destroy()}},Sh="ag-menu-list-no-focus-ring",Qi=class Vw extends rx{constructor(t=0,s,r,i="menu"){super({tag:"div",cls:"ag-menu-list",role:i}),this.level=t,this.menuActionParams=s,this.callbacks=r,this.menuItems=[],this.suppressFocusTooltip=!1}postConstruct(){this.initialiseTabGuard({onTabKeyDown:t=>this.onTabKeyDown(t),handleKeyDown:t=>this.callbacks.preserveRangesWhile(this.beans,()=>this.handleKeyDown(t)),onFocusIn:t=>this.handleFocusIn(t),onFocusOut:t=>this.handleFocusOut(t)})}onTabKeyDown(t){this.getParentComponent()?.getGui()?.classList.contains("ag-focus-managed")||t.preventDefault(),t.shiftKey&&this.closeIfIsChild(t)}handleKeyDown(t){switch(t.key){case ut.UP:case ut.RIGHT:case ut.DOWN:case ut.LEFT:t.preventDefault(),this.clearNoFocusRing(),this.handleNavKey(t.key);break;case ut.ESCAPE:this.closeIfIsChild()&&this.callbacks.stopPropagationCallbacks.stopPropagation(t);break}}handleFocusIn(t){const s=t.relatedTarget;!this.tabGuardFeature.getTabGuardCtrl().isTabGuard(s)&&(this.getGui().contains(s)||this.activeMenuItem?.getSubMenuGui()?.contains(s))||(this.activeMenuItem?this.activeMenuItem.activate():this.activateFirstItem())}handleFocusOut(t){const s=t.relatedTarget;!this.activeMenuItem||this.getGui().contains(s)||this.activeMenuItem.getSubMenuGui()?.contains(s)||this.activeMenuItem.isSubMenuOpening()||this.activeMenuItem.deactivate()}clearActiveItem(){this.activeMenuItem&&(this.activeMenuItem.deactivate(),this.activeMenuItem=null)}addMenuItems(t){t!=null&&(this.itemsReady=Sa.all(t.map(s=>s==="separator"?Sa.resolve({eGui:this.createSeparator()}):typeof s=="string"?(this.callbacks.warnNoItem?.(this.beans,s),Sa.resolve({eGui:null})):this.addItem(s))).then(s=>{for(const r of s??[])r?.eGui&&(this.appendChild(r.eGui),r.comp&&this.menuItems.push(r.comp))}))}addItem(t){const s=this.createManagedBean(new Fr(this.callbacks));return s.init({menuItemDef:t,isAnotherSubMenuOpen:()=>this.menuItems.some(r=>r.isSubMenuOpen()),shouldDisplayTooltipOnFocus:()=>!this.suppressFocusTooltip,level:this.level,contextParams:this.menuActionParams}).then(()=>(s.setParentComponent(this),this.addManagedListeners(s,{closeMenu:r=>{this.dispatchLocalEvent(r)},menuItemActivated:r=>{this.activeMenuItem&&this.activeMenuItem!==r.menuItem&&this.activeMenuItem.deactivate(),this.activeMenuItem=r.menuItem}}),{comp:s,eGui:s.getGui()}))}focusInto(t=!1){this.getGui().classList.toggle(Sh,mh(this.beans));const s=this.withFocusTooltipSuppressed(t,()=>fD(this.getGui()));return this.itemsReady?.then(()=>{if(!this.isAlive()||this.activeMenuItem)return;const r=mD(this.beans);(mh(this.beans)||this.getGui().contains(r))&&this.withFocusTooltipSuppressed(t,()=>this.activateFirstItem())}),s}withFocusTooltipSuppressed(t,s){const r=this.suppressFocusTooltip;this.suppressFocusTooltip=t;try{return s()}finally{this.suppressFocusTooltip=r}}activateFirstItem(){const t=this.menuItems.filter(s=>!s.isDisabled())[0];t&&t.activate()}createSeparator(){const t={tag:"div",cls:"ag-menu-separator-part"};return gD({tag:"div",cls:"ag-menu-separator",attrs:{"aria-hidden":"true"},children:[t,t,t,t]})}handleNavKey(t){switch(t){case ut.UP:case ut.DOWN:{const r=this.findNextItem(t===ut.UP);r&&r!==this.activeMenuItem&&r.activate(!1,!0);return}}const s=this.gos.get("enableRtl")?ut.RIGHT:ut.LEFT;t===s?this.closeIfIsChild():this.openChild()}clearNoFocusRing(){this.getGui().classList.remove(Sh);const t=this.getParentComponent();if(t instanceof Fr){const s=t.getParentComponent();s instanceof Vw&&s.clearNoFocusRing()}}closeIfIsChild(t){const s=this.getParentComponent();return s&&s instanceof Fr?(t&&t.preventDefault(),s.closeSubMenu(),s.getGui().focus(),!0):!1}openChild(){this.activeMenuItem&&this.activeMenuItem.openSubMenu(!0)}findNextItem(t){const s=[...this.menuItems];if(!s.length)return;if(!this.activeMenuItem)return t?vD(s):s[0];t&&s.reverse();let r,i=!1;for(const n of s){if(!i){n===this.activeMenuItem&&(i=!0);continue}r=n;break}return i&&!r?s[0]:r||this.activeMenuItem}destroy(){this.clearActiveItem(),super.destroy()}};import{AgBeanStub as MD,AgComponentStub as ID,_anchorElementToMouseMoveEvent as yh,_createAgElement as ED,_getPageBody as DD,_getRootNode as LD,_initStyledRoot as kD,_isKeyboardMode as _D,_isPromise as GD,_isVisible as OD}from"ag-stack";var ND="ag-menu",BD="ag-context-menu-loading-icon",wh=class extends ix{constructor(e){super(),this.params=e,this.destroyLoadingSpinner=null,this.lastPromise=0}hideActiveMenu(){this.destroyBean(this.activeMenu)}showMenu(e,t,s){const{getMenuItems:r,shouldBlockMenuOpen:i}=this.params,n=t instanceof MouseEvent?t.target!=null&&!_D():!0,o=r(e,t);if(GD(o)){const a=this.lastPromise+1;return this.lastPromise=a,this.destroyLoadingSpinner||this.createLoadingIcon(t),o.then(c=>{if(this.lastPromise!==a)return;const{target:u}=t,d=!u;c?.length&&(d||OD(u))&&!i?.()&&this.createContextMenu({menuItems:c,menuActionParams:e,mouseEvent:t,anchorToElement:s,suppressInitialTooltip:n}),this.destroyLoadingSpinner?.()}).catch(c=>{throw this.lastPromise===a&&this.destroyLoadingSpinner?.(),c}),!0}return o?.length?(this.createContextMenu({menuItems:o,menuActionParams:e,mouseEvent:t,anchorToElement:s,suppressInitialTooltip:n}),!0):!1}createLoadingIcon(e){const{beans:t}=this,s=this.getLocaleTextFunc(),r=t.iconSvc.createIconNoSpan("loadingMenuItems"),i=ED({tag:"div",cls:BD});i.appendChild(r);const n=LD(t),o=DD(t);if(!o)return;const a=kD(t.environment,o,i);t.ariaAnnounce?.announceValue(s("ariaLabelLoadingContextMenu","Loading Context Menu"),"contextmenu"),yh(i,e,t);const l=c=>{yh(i,c,t)};n.addEventListener("mousemove",l),this.destroyLoadingSpinner=()=>{n.removeEventListener("mousemove",l),a(),this.destroyLoadingSpinner=null}}createContextMenu(e){const{mapMenuItems:t,menuItemCallbacks:s,beforeMenuOpen:r,onMenuClose:i,afterMenuDestroyed:n,onVisibleChanged:o,onMenuOpen:a}=this.params,{menuItems:l,menuActionParams:c,mouseEvent:u,anchorToElement:d,suppressInitialTooltip:h}=e,p=this.beans.popupSvc,g=t?S=>t(l,c,S):()=>l,f=new VD(g,c,s,h);this.createBean(f);const m=f.getGui();r?.(c);const v={additionalParams:s.getPostProcessPopupParams(c),type:"contextMenu",mouseEvent:u,ePopup:m,nudgeY:1},C=this.getLocaleTextFunc(),b=p?.addPopup({modal:!0,eChild:m,closeOnEsc:!0,closedCallback:S=>{s.preserveRangesWhile(this.beans,()=>{i?.(),this.destroyBean(f),n?.(),o?.(!1,S===void 0?"api":"ui")})},click:u,positionCallback:()=>{const S=this.gos.get("enableRtl");p?.positionPopupUnderMouseEvent({...v,nudgeX:S?(m.offsetWidth+1)*-1:1})},anchorToElement:d,ariaLabel:C("ariaLabelContextMenu","Context Menu")});b&&(a?.(),f.afterGuiAttached({container:"contextMenu",hidePopup:b.hideFunc})),this.activeMenu&&this.hideActiveMenu(),this.activeMenu=f,f.addEventListener("destroyed",()=>{this.activeMenu===f&&(this.activeMenu=null)}),b&&f.addEventListener("closeMenu",S=>b.hideFunc({mouseEvent:S.mouseEvent??void 0,keyboardEvent:S.keyboardEvent??void 0,forceHide:!0}));const y=u&&u instanceof MouseEvent&&u.type==="mousedown";o?.(!0,y?"api":"ui")}destroy(){this.destroyLoadingSpinner?.(),super.destroy()}},VD=class extends nx{constructor(e,t,s,r){super({tag:"div",cls:ND,role:"menu"}),this.getMenuItems=e,this.menuActionParams=t,this.callbacks=s,this.suppressInitialTooltip=r,this.menuList=null}postConstruct(){const e=this.createManagedBean(new Qi(0,this.menuActionParams,this.callbacks,"presentation")),t=this.getMenuItems(()=>this.getGui());e.addMenuItems(t),this.appendChild(e),this.menuList=e,e.addEventListener("closeMenu",s=>this.dispatchLocalEvent(s))}afterGuiAttached({hidePopup:e}){e&&this.addDestroyFunc(e);const t=this.menuList;t&&this.callbacks.preserveRangesWhile(this.beans,()=>t.focusInto(this.suppressInitialTooltip))}};import{AgComponentStub as HD,_createAgElement as en,_isNodeOrElement as UD,_setAriaChecked as zD,_setAriaExpanded as WD}from"ag-stack";var xh=class extends ox{constructor(e){super({tag:"div"}),this.callbacks=e}init(e){this.params=e,this.cssClassPrefix=this.params.cssClassPrefix??"ag-menu-option",this.addAriaAttributes(),this.addIcon(),this.addName(),this.addShortcut(),this.addSubMenu()}configureDefaults(){return!0}addAriaAttributes(){const{checked:e,menuItemRole:t,subMenu:s}=this.params,r=this.getGui();e!=null&&t!=="menuitem"&&zD(r,e),s&&WD(r,!1)}addIcon(){if(this.params.isCompact)return;const e=en({tag:"span",ref:"eIcon",cls:`${this.getClassName("part")} ${this.getClassName("icon")}`,role:"presentation"}),{checked:t,icon:s}=this.params;t?e.appendChild(this.beans.iconSvc.createIconNoSpan("check")):s&&(UD(s)?e.appendChild(s):typeof s=="string"?e.innerHTML=s:this.callbacks?.warnNoIcon?.()),this.getGui().appendChild(e)}addName(){const e=en({tag:"span",ref:"eName",cls:`${this.getClassName("part")} ${this.getClassName("text")}`,children:this.params.name||""});this.getGui().appendChild(e)}addShortcut(){if(this.params.isCompact)return;const e=en({tag:"span",ref:"eShortcut",cls:`${this.getClassName("part")} ${this.getClassName("shortcut")}`,children:this.params.shortcut||""});this.getGui().appendChild(e)}addSubMenu(){const e=en({tag:"span",ref:"ePopupPointer",cls:`${this.getClassName("part")} ${this.getClassName("popup-pointer")}`}),t=this.getGui();if(this.params.subMenu){const s=this.gos.get("enableRtl")?"subMenuOpenRtl":"subMenuOpen";e.appendChild(this.beans.iconSvc.createIconNoSpan(s))}t.appendChild(e)}getClassName(e){return`${this.cssClassPrefix}-${e}`}};import{AgTabGuardComp as KD,RefPlaceholder as Fh,_clearElement as $D,_createAgElement as tn,_findNextFocusableElement as jD,_focusInto as Th,_getActiveDomElement as Ah,_getDocument as YD,_isKeyboardMode as qD,_setAriaControls as ZD,_setAriaControlsAndLabel as XD,_setAriaLabel as Ph,_setAriaRole as JD,_setAriaSelected as Rh}from"ag-stack";import{KeyCode as Tr}from"ag-grid-community";import{FOCUS_MANAGED_CLASS as QD,TabGuardClassNames as e1,_findFocusableElements as t1}from"ag-stack";function ya(e,t){if(!t)return null;const s=t1(e),r=s.indexOf(t);if(r===-1)return null;let i=-1;for(let n=r-1;n>=0;n--)if(s[n].classList.contains(e1.TAB_GUARD_TOP)){i=n;break}return i<=0?null:s[i-1]}function Mh(e,t){if(!t)return!1;const s=e.querySelectorAll(`.${QD}`);if(!s.length)return!1;for(let r=0;r<s.length;r++)if(s[r].contains(t))return!0;return!1}function s1(e){return{tag:"div",cls:`ag-tabs ${e}`,children:[{tag:"div",ref:"eHeader"},{tag:"div",ref:"eBody",role:"tabpanel",cls:"ag-tabs-body"+e?` ${e}-body`:""}]}}var wa=class extends ax{constructor(e){super(s1(e.cssClass)),this.eHeader=Fh,this.eBody=Fh,this.items=[],this.tabbedItemScrollMap=new Map,this.params=e}postConstruct(){if(this.setupHeader(),this.eBody.id=`ag-${this.getCompId()}-tabpanel`,this.params.items)for(const e of this.params.items)this.addItem(e);this.initialiseTabGuard({onTabKeyDown:this.onTabKeyDown.bind(this),handleKeyDown:this.handleKeyDown.bind(this),focusInnerElement:this.focusInnerElement.bind(this),focusTrapActive:!0}),this.addDestroyFunc(()=>this.activeItem?.tabbedItem?.afterDetachedCallback?.())}setupHeader(){const{enableCloseButton:e,cssClass:t}=this.params,s=(r,i)=>{r.classList.add(`ag-tabs-${i}`),t&&r.classList.add(`${t}-${i}`)};e?(this.setupCloseButton(s),this.eTabHeader=tn({tag:"div",role:"presentation"}),s(this.eHeader,"header-wrapper"),this.eHeader.appendChild(this.eTabHeader)):this.eTabHeader=this.eHeader,JD(this.eTabHeader,"tablist"),s(this.eTabHeader,"header")}setupCloseButton(e){const t=tn({tag:"button"});e(t,"close-button");const s=this.beans.iconSvc.createIconNoSpan("close");Ph(t,this.params.closeButtonAriaLabel),t.appendChild(s),this.addManagedElementListeners(t,{click:()=>this.params.onCloseClicked?.()});const r=tn({tag:"div",role:"presentation"});e(r,"close-button-wrapper"),r.appendChild(t),this.eHeader.appendChild(r),this.eCloseButton=t}handleKeyDown(e){switch(e.key){case Tr.RIGHT:case Tr.LEFT:{if(!this.eTabHeader.contains(Ah(this.beans)))return;const t=e.key===Tr.RIGHT,s=this.gos.get("enableRtl"),r=this.items.indexOf(this.activeItem),i=t!==s?Math.min(r+1,this.items.length-1):Math.max(r-1,0);if(r===i)return;e.preventDefault();const n=this.items[i];this.showItemWrapper(n),n.eHeaderButton.focus();break}case Tr.UP:case Tr.DOWN:e.stopPropagation();break}}onTabKeyDown(e){if(e.defaultPrevented)return;const{beans:t,eHeader:s,eBody:r,activeItem:i,params:n}=this,{suppressTrapFocus:o,enableCloseButton:a}=n,l=Ah(t),c=e.target,u=e.shiftKey;if(s.contains(l)){e.preventDefault(),a&&u&&!this.eCloseButton?.contains(l)?this.eCloseButton?.focus():o&&u?ya(YD(t).body,c)?.focus():this.focusBody(e.shiftKey);return}let d=null;if(Mh(r,c)&&(u&&(d=ya(r,c)),!d&&!o&&(d=i.eHeaderButton)),!d&&r.contains(l)&&(d=jD({beans:t,rootNode:r,backwards:u}),!d)){o&&!u?this.forceFocusOutOfContainer(u):a&&!u?(e.preventDefault(),this.eCloseButton?.focus()):(e.preventDefault(),this.focusHeader());return}d&&(e.preventDefault(),d.focus())}focusInnerElement(e){return e?this.focusBody(!0):(this.focusHeader(),!0)}focusHeader(e){this.activeItem.eHeaderButton.focus({preventScroll:e})}focusBody(e){return Th(this.eBody,e)}setAfterAttachedParams(e){this.afterAttachedParams=e}showFirstItem(){this.items.length>0&&this.showItemWrapper(this.items[0])}addItem(e){const t=tn({tag:"span",cls:"ag-tab",role:"tab",attrs:{id:`ag-${this.getCompId()}-tab-${this.items.length}`,tabindex:"-1","aria-selected":"false"}});t.appendChild(e.title),this.eTabHeader.appendChild(t),Ph(t,e.titleLabel);const s={tabbedItem:e,eHeaderButton:t};this.items.push(s),t.addEventListener("click",this.showItemWrapper.bind(this,s))}showItem(e){const t=this.items.find(s=>s.tabbedItem===e);t&&this.showItemWrapper(t)}showItemWrapper(e){const{tabbedItem:t,eHeaderButton:s}=e;if(this.params.onItemClicked?.({item:t}),this.activeItem===e){this.params.onActiveItemClicked?.();return}if(this.lastScrollListener&&(this.lastScrollListener=this.lastScrollListener()),$D(this.eBody),t.bodyPromise.then(r=>{this.eBody.appendChild(r);const i=!qD();if(this.params.suppressFocusBodyOnOpen||Th(this.eBody,!1,i),t.afterAttachedCallback&&t.afterAttachedCallback(this.afterAttachedParams),this.params.keepScrollPosition){const n=t.getScrollableContainer?.()??r;[this.lastScrollListener]=this.addManagedElementListeners(n,{scroll:()=>{this.tabbedItemScrollMap.set(t.name,n.scrollTop)}});const o=this.tabbedItemScrollMap.get(t.name);o!==void 0&&setTimeout(()=>{n.scrollTop=o},0)}}),this.activeItem){const r=this.activeItem.eHeaderButton;r.classList.remove("ag-tab-selected"),Rh(r,!1),ZD(r,null),this.activeItem.tabbedItem.afterDetachedCallback?.()}s.classList.add("ag-tab-selected"),Rh(s,!0),XD(s,this.eBody),this.activeItem=e}};import{AgComponentStub as r1,RefPlaceholder as Ls,_isComponent as xa,_removeAriaExpanded as i1,_removeFromParent as n1,_setAriaControls as o1,_setAriaExpanded as a1,_setAriaRole as l1,_setDisplayed as ds}from"ag-stack";import{AgCheckboxSelector as c1,AgToggleButton as u1,KeyCode as d1}from"ag-grid-community";var h1=".ag-group{position:relative;width:100%}.ag-group-title-bar{align-items:center;display:flex;padding:var(--ag-spacing)}.ag-group-title{display:inline;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:where(.ag-group-title-bar) .ag-group-title{cursor:default}.ag-group-toolbar{align-items:center;display:flex;padding:var(--ag-spacing)}.ag-group-container{display:flex}.ag-disabled .ag-group-container{pointer-events:none}.ag-disabled-group-container,.ag-disabled-group-title-bar{opacity:.5}.ag-group-container-horizontal{flex-flow:row wrap}.ag-group-container-vertical{flex-direction:column}.ag-group-title-bar-icon{cursor:pointer;flex:none}:where(.ag-ltr) .ag-group-title-bar-icon{margin-right:var(--ag-spacing)}:where(.ag-rtl) .ag-group-title-bar-icon{margin-left:var(--ag-spacing)}:where(.ag-group-item-alignment-stretch) .ag-group-item{align-items:stretch}:where(.ag-group-item-alignment-start) .ag-group-item{align-items:flex-start}:where(.ag-group-item-alignment-end) .ag-group-item{align-items:flex-end}";function p1(e){const t=e.cssIdentifier||"default",s=e.direction||"vertical";return{tag:"div",cls:`ag-group ag-${t}-group`,role:"presentation",children:[{tag:"div",ref:"eToolbar",cls:`ag-group-toolbar ag-${t}-group-toolbar`,children:[{tag:"ag-checkbox",ref:"cbGroupEnabled"}]},{tag:"div",ref:"eContainer",cls:`ag-group-container ag-group-container-${s} ag-${t}-group-container`}]}}var dt=class extends bd{constructor(e={}){super(p1(e),[c1]),this.params=e,this.suppressEnabledCheckbox=!0,this.suppressToggleExpandOnEnableChange=!1,this.eToolbar=Ls,this.cbGroupEnabled=Ls,this.eContainer=Ls,this.registerCSS(h1);const{enabled:t,items:s,suppressEnabledCheckbox:r,expanded:i,suppressToggleExpandOnEnableChange:n,useToggle:o}=e;this.cssIdentifier=e.cssIdentifier||"default",this.enabled=t??!0,this.items=s??[],this.useToggle=o??!1,this.alignItems=e.alignItems||"center",this.expanded=i??!0,r!=null&&(this.suppressEnabledCheckbox=r),n!=null&&(this.suppressToggleExpandOnEnableChange=n)}postConstruct(){if(this.setupTitleBar(),this.items.length){const i=this.items;this.items=[],this.addItems(i)}const e=this.getLocaleTextFunc();this.cbGroupEnabled.setLabel(e("enabled","Enabled")),this.enabled&&this.setEnabled(this.enabled,void 0,!0),this.setAlignItems(this.alignItems);const{onEnableChange:t,onExpandedChange:s,suppressOpenCloseIcons:r}=this.params;this.hideEnabledCheckbox(this.suppressEnabledCheckbox),this.hideOpenCloseIcons(r??!1),this.refreshChildDisplay(),ds(this.eContainer,this.expanded),this.cbGroupEnabled.onValueChange(i=>{this.setEnabled(i,!0,this.suppressToggleExpandOnEnableChange),this.dispatchEnableChangeEvent(i)}),t!=null&&this.onEnableChange(t),s!=null&&this.onExpandedChange(s)}refreshChildDisplay(){ds(this.eToolbar,this.expanded&&!this.suppressEnabledCheckbox),this.eTitleBar?.refreshOnExpand(this.expanded)}isExpanded(){return this.expanded}setAlignItems(e){this.alignItems!==e&&this.removeCss(`ag-group-item-alignment-${this.alignItems}`),this.alignItems=e;const t=`ag-group-item-alignment-${this.alignItems}`;return this.addCss(t),this}toggleGroupExpand(e,t){if(this.eTitleBar?.isSuppressCollapse()&&!this.useToggle)e=!0,t=!0;else if(e=e??!this.expanded,this.expanded===e)return this;return this.expanded=e,this.refreshChildDisplay(),ds(this.eContainer,e),t||this.dispatchLocalEvent({type:e?"expanded":"collapsed"}),this}addItems(e){for(const t of e)this.addItem(t)}prependItem(e){this.insertItem(e,!0)}addItem(e){this.insertItem(e,!1)}updateItems(e){const t=this.items;let s=0;for(let r=0;r<t.length;++r){const i=t[r];if(i===e[s])s++;else{const n=xa(i)?i.getGui():i;n1(n)}}for(;s<e.length;)this.insertItem(e[s++]);this.items=e}setDirection(e){return this.eContainer.classList.toggle("ag-group-container-horizontal",e==="horizontal"),this.eContainer.classList.toggle("ag-group-container-vertical",e==="vertical"),this}insertItem(e,t){const s=this.eContainer,r=xa(e)?e.getGui():e;r.classList.add("ag-group-item",`ag-${this.cssIdentifier}-group-item`),t?(s.prepend(r),this.items.unshift(r)):(s.appendChild(r),this.items.push(r))}hideItem(e,t){const s=this.items[t];ds(s,!e)}getItemIndex(e){const t=xa(e)?e.getGui():e;return this.items.indexOf(t)}setTitle(e){return this.eTitleBar?.setTitle(e),this}addTitleBarWidget(e){return this.eTitleBar?.addWidget(e),this}addCssClassToTitleBar(e){this.eTitleBar?.addCss(e)}getTitleBarGui(){return this.eTitleBar?.getGui()??this.eToggle?.getGui()??this.getGui()}dispatchEnableChangeEvent(e){const t={type:"enableChange",enabled:e};this.dispatchLocalEvent(t)}setEnabled(e,t,s){return this.enabled=e,this.refreshDisabledStyles(),s||this.toggleGroupExpand(e),t||(this.cbGroupEnabled.setValue(e),this.eToggle?.setValue(e)),this}isEnabled(){return this.enabled}onEnableChange(e){return this.addManagedListeners(this,{enableChange:t=>e(t.enabled)}),this}onExpandedChange(e){return this.addManagedListeners(this,{expanded:()=>e(!0),collapsed:()=>e(!1)}),this}hideEnabledCheckbox(e){return this.suppressEnabledCheckbox=e,this.refreshChildDisplay(),this.refreshDisabledStyles(),this}hideOpenCloseIcons(e){return this.eTitleBar?.hideOpenCloseIcons(e),this}refreshDisabledStyles(){const e=!this.enabled;this.eContainer.classList.toggle("ag-disabled",e),this.eTitleBar?.refreshDisabledStyles(this.suppressEnabledCheckbox&&e),this.eContainer.classList.toggle("ag-disabled-group-container",e)}setupTitleBar(){const e=this.useToggle?this.createToggleTitleBar():this.createDefaultTitleBar();this.eToolbar.insertAdjacentElement("beforebegin",e.getGui())}createDefaultTitleBar(){const e=`ag-${this.getCompId()}-group-container`;this.eContainer.id=e;const t=this.createManagedBean(new m1(this.params,e));return this.eTitleBar=t,t.refreshOnExpand(this.expanded),this.addManagedListeners(t,{expandedChanged:s=>this.toggleGroupExpand(s.expanded)}),t}createToggleTitleBar(){const e=this.createManagedBean(new u1({value:this.enabled,label:this.params.title,labelAlignment:"left",labelWidth:"flex",onValueChange:t=>{this.setEnabled(t,!0),this.dispatchEnableChangeEvent(t)}}));return e.addCss("ag-group-title-bar"),e.addCss(`ag-${this.params.cssIdentifier??"default"}-group-title-bar ag-unselectable`),this.eToggle=e,this.toggleGroupExpand(this.enabled),e}},g1="ag-disabled-group-title-bar";function f1(e){const{cssIdentifier:t,suppressOpenCloseIcons:s}=e,r=t??"default",i=s?"group":"button";return{tag:"div",cls:`ag-group-title-bar ag-${r}-group-title-bar ag-unselectable`,role:e.suppressKeyboardNavigation?"presentation":i,children:[{tag:"span",ref:"eGroupOpenedIcon",cls:`ag-group-title-bar-icon ag-${r}-group-title-bar-icon`,role:"presentation"},{tag:"span",ref:"eGroupClosedIcon",cls:`ag-group-title-bar-icon ag-${r}-group-title-bar-icon`,role:"presentation"},{tag:"span",ref:"eTitle",cls:`ag-group-title ag-${r}-group-title`}]}}var m1=class extends bd{constructor(e={},t){super(f1(e)),this.containerId=t,this.suppressOpenCloseIcons=!1,this.suppressKeyboardNavigation=!1,this.expanded=!0,this.disabled=!1,this.eGroupOpenedIcon=Ls,this.eGroupClosedIcon=Ls,this.eTitle=Ls;const{title:s,suppressOpenCloseIcons:r,suppressKeyboardNavigation:i}=e;s&&s.length>0&&(this.title=s),r!=null&&(this.suppressOpenCloseIcons=r),this.suppressKeyboardNavigation=i??!1}postConstruct(){this.setTitle(this.title),this.hideOpenCloseIcons(this.suppressOpenCloseIcons),this.setupExpandContract()}setupExpandContract(){const e=this.beans.iconSvc;this.eGroupClosedIcon.appendChild(e.createIconNoSpan("accordionClosed")),this.eGroupOpenedIcon.appendChild(e.createIconNoSpan("accordionOpen")),this.addManagedElementListeners(this.getGui(),{click:()=>this.dispatchExpandChanged(),keydown:t=>{const{ENTER:s,SPACE:r,RIGHT:i,LEFT:n,UP:o,DOWN:a,PAGE_UP:l,PAGE_DOWN:c,PAGE_HOME:u,PAGE_END:d}=d1;switch(t.key){case o:case a:case l:case c:case u:case d:t.preventDefault();return;case s:case r:t.preventDefault(),this.dispatchExpandChanged();break;case i:case n:t.preventDefault(),this.dispatchExpandChanged(t.key===i);break}}})}refreshOnExpand(e){this.expanded=e,this.refreshAriaState(),this.refreshOpenCloseIcons(e)}refreshAriaState(){const e=this.getGui(),t=this.title!=null&&!this.suppressKeyboardNavigation&&!this.disabled,s=t&&!this.suppressOpenCloseIcons;let r="presentation";s?r="button":t&&(r="group"),l1(e,r),t?this.activateTabIndex([e]):e.removeAttribute("tabindex"),s?a1(e,this.expanded):i1(e),o1(e,s?this.containerId:null)}refreshOpenCloseIcons(e){const t=!this.suppressOpenCloseIcons;ds(this.eGroupOpenedIcon,t&&e),ds(this.eGroupClosedIcon,t&&!e)}isSuppressCollapse(){return this.suppressOpenCloseIcons}dispatchExpandChanged(e){const t={type:"expandedChanged",expanded:e};this.dispatchLocalEvent(t)}setTitle(e){const t=this.getGui(),s=!!e&&e.length>0;return e=s?e:void 0,this.eTitle.textContent=e??"",ds(t,s),e!==this.title&&(this.title=e),this.refreshAriaState(),this}addWidget(e){return this.getGui().appendChild(e),this}hideOpenCloseIcons(e){return this.suppressOpenCloseIcons=e,e&&this.dispatchExpandChanged(!0),this.refreshAriaState(),this}refreshDisabledStyles(e){this.disabled=e,this.getGui().classList.toggle(g1,e),this.refreshAriaState()}},ee={selector:"AG-GROUP-COMPONENT",component:dt};import{TooltipModule as v1,_FilterCoreModule as C1,_FilterValueModule as b1,_PopupModule as S1,_SharedDragAndDropModule as y1}from"ag-grid-community";var _="36.3.0",$={moduleName:"EnterpriseCore",version:_,beans:[Qo],icons:{accordionOpen:"tree-open",accordionClosed:"tree-closed",accordionIndeterminate:"tree-indeterminate",close:"cross",cancel:"cancel",maximize:"maximize",minimize:"minimize",columnDrag:"grip"},dependsOn:[],setLicenseKey:Qo.setLicenseKey},w1='.ag-advanced-filter-header{align-items:center;background-color:var(--ag-header-background-color);border-bottom:var(--ag-header-row-border);display:flex;position:relative;z-index:1}.ag-advanced-filter{align-items:center;display:flex;width:100%}.ag-advanced-filter-buttons{display:contents}.ag-advanced-filter-header-cell{height:100%;padding-left:var(--ag-cell-horizontal-padding);padding-right:var(--ag-cell-horizontal-padding)}.ag-advanced-filter-apply-button,.ag-advanced-filter-builder-button{align-items:center;background-color:unset;border:0;display:flex;font-size:var(--ag-font-size);font-weight:600;line-height:normal;padding:var(--ag-spacing);white-space:nowrap;&:where(.ag-standard-button):where(:not(:disabled)){cursor:pointer;&:where(.ag-standard-button):hover{background-color:var(--ag-row-hover-color)}}}:where(.ag-ltr) .ag-advanced-filter-apply-button,:where(.ag-ltr) .ag-advanced-filter-builder-button{margin-left:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-advanced-filter-apply-button,:where(.ag-rtl) .ag-advanced-filter-builder-button{margin-right:calc(var(--ag-spacing)*2)}:where(.ag-advanced-filter-builder-button:disabled) .ag-advanced-filter-builder-button-label{color:var(--ag-button-disabled-text-color)}:where(.ag-ltr) .ag-advanced-filter-builder-button-label{margin-left:var(--ag-spacing)}:where(.ag-rtl) .ag-advanced-filter-builder-button-label{margin-right:var(--ag-spacing)}.ag-advanced-filter-builder{display:flex;flex-direction:column;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%}.ag-advanced-filter-builder-list{flex:1;overflow:auto}.ag-advanced-filter-builder-button-panel{border-top:var(--ag-advanced-filter-builder-button-bar-border);display:flex;justify-content:flex-end;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding)}:where(.ag-ltr) .ag-advanced-filter-builder-apply-button,:where(.ag-ltr) .ag-advanced-filter-builder-cancel-button{margin-left:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-advanced-filter-builder-apply-button,:where(.ag-rtl) .ag-advanced-filter-builder-cancel-button{margin-right:calc(var(--ag-spacing)*2)}.ag-advanced-filter-builder-item-wrapper{align-items:center;display:flex;flex:1 1 auto;justify-content:space-between;overflow:hidden}:where(.ag-ltr) .ag-advanced-filter-builder-item-wrapper{padding-left:calc(var(--ag-icon-size)/2);padding-right:var(--ag-icon-size)}:where(.ag-rtl) .ag-advanced-filter-builder-item-wrapper{padding-left:var(--ag-icon-size);padding-right:calc(var(--ag-icon-size)/2)}:where(.ag-virtual-list-viewport) .ag-advanced-filter-builder-item-wrapper .ag-tab-guard{position:absolute}.ag-advanced-filter-builder-item-tree-line{width:var(--ag-advanced-filter-builder-indent-size)}.ag-advanced-filter-builder-item-tree-line-root{width:var(--ag-icon-size)}.ag-advanced-filter-builder-item-tree-line-root:before{height:50%;top:50%}.ag-advanced-filter-builder-item-tree-line-horizontal,.ag-advanced-filter-builder-item-tree-line-vertical,.ag-advanced-filter-builder-item-tree-line-vertical-bottom,.ag-advanced-filter-builder-item-tree-line-vertical-top{align-items:center;display:flex;height:100%;position:relative}.ag-advanced-filter-builder-item-tree-line-horizontal:after,.ag-advanced-filter-builder-item-tree-line-horizontal:before,.ag-advanced-filter-builder-item-tree-line-vertical-bottom:after,.ag-advanced-filter-builder-item-tree-line-vertical-bottom:before,.ag-advanced-filter-builder-item-tree-line-vertical-top:after,.ag-advanced-filter-builder-item-tree-line-vertical-top:before,.ag-advanced-filter-builder-item-tree-line-vertical:after,.ag-advanced-filter-builder-item-tree-line-vertical:before{content:"";height:100%;position:absolute}.ag-advanced-filter-builder-item-tree-line-horizontal:after{border-bottom:var(--ag-border-width) solid var(--ag-border-color);height:50%;top:0;width:calc(var(--ag-advanced-filter-builder-indent-size) - var(--ag-icon-size))}:where(.ag-ltr) .ag-advanced-filter-builder-item-tree-line-horizontal:after{left:calc(var(--ag-icon-size)/2)}:where(.ag-rtl) .ag-advanced-filter-builder-item-tree-line-horizontal:after{right:calc(var(--ag-icon-size)/2)}.ag-advanced-filter-builder-item-tree-line-vertical:before{top:0;width:calc(var(--ag-advanced-filter-builder-indent-size) - var(--ag-icon-size)/2)}:where(.ag-ltr) .ag-advanced-filter-builder-item-tree-line-vertical:before{border-left:var(--ag-border-width) solid var(--ag-border-color);left:calc(var(--ag-icon-size)/2)}:where(.ag-rtl) .ag-advanced-filter-builder-item-tree-line-vertical:before{border-right:var(--ag-border-width) solid var(--ag-border-color);right:calc(var(--ag-icon-size)/2)}.ag-advanced-filter-builder-item-tree-line-vertical-top:before{height:50%;top:0;width:calc(var(--ag-advanced-filter-builder-indent-size) - var(--ag-icon-size)/2)}:where(.ag-ltr) .ag-advanced-filter-builder-item-tree-line-vertical-top:before{border-left:var(--ag-border-width) solid var(--ag-border-color);left:calc(var(--ag-icon-size)/2)}:where(.ag-rtl) .ag-advanced-filter-builder-item-tree-line-vertical-top:before{border-right:var(--ag-border-width) solid var(--ag-border-color);right:calc(var(--ag-icon-size)/2)}.ag-advanced-filter-builder-item-tree-line-vertical-bottom:before{height:calc(50% - var(--ag-icon-size)*1.5/2);top:calc(50% + var(--ag-icon-size)*1.5/2);width:calc(var(--ag-icon-size)/2)}:where(.ag-ltr) .ag-advanced-filter-builder-item-tree-line-vertical-bottom:before{border-left:var(--ag-border-width) solid var(--ag-border-color);left:calc(var(--ag-icon-size)/2)}:where(.ag-rtl) .ag-advanced-filter-builder-item-tree-line-vertical-bottom:before{border-right:var(--ag-border-width) solid var(--ag-border-color);right:calc(var(--ag-icon-size)/2)}.ag-advanced-filter-builder-item-condition{padding-bottom:var(--ag-spacing);padding-top:var(--ag-spacing)}.ag-advanced-filter-builder-item,.ag-advanced-filter-builder-item-buttons,.ag-advanced-filter-builder-item-condition,.ag-advanced-filter-builder-item-tree-lines,.ag-advanced-filter-builder-pill,.ag-advanced-filter-builder-pill-wrapper{align-items:center;display:flex;height:100%}.ag-advanced-filter-builder-pill-wrapper{margin:0 var(--ag-spacing)}.ag-advanced-filter-builder-pill{border-radius:var(--ag-border-radius);min-height:calc(100% - var(--ag-spacing)*3);min-width:calc(var(--ag-spacing)*2);padding:var(--ag-spacing) calc(var(--ag-spacing)*2);position:relative}:where(.ag-advanced-filter-builder-pill){.ag-advanced-filter-builder-value-number{font-family:monospace;font-weight:700}.ag-advanced-filter-builder-value-empty{color:var(--ag-subtle-text-color)}}:where(.ag-ltr) :where(.ag-advanced-filter-builder-pill){.ag-picker-field-display{margin-right:var(--ag-spacing)}}:where(.ag-rtl) :where(.ag-advanced-filter-builder-pill){.ag-picker-field-display{margin-left:var(--ag-spacing)}}.ag-advanced-filter-builder-pill-display{font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ag-advanced-filter-builder-join-pill{background-color:var(--ag-advanced-filter-builder-join-pill-color);cursor:pointer}.ag-advanced-filter-builder-column-pill{background-color:var(--ag-advanced-filter-builder-column-pill-color);cursor:pointer}.ag-advanced-filter-builder-option-pill{background-color:var(--ag-advanced-filter-builder-option-pill-color);cursor:pointer}.ag-advanced-filter-builder-value-pill{background-color:var(--ag-advanced-filter-builder-value-pill-color);cursor:text;max-width:140px;:where(.ag-advanced-filter-builder-pill-display){display:block}}.ag-advanced-filter-builder-set-values-pill-wrapper{flex:1 1 152px;max-width:100%;min-width:152px;width:152px}.ag-advanced-filter-builder-set-values-pill{cursor:pointer;max-width:100%;min-width:152px;width:-moz-max-content;width:max-content;:where(.ag-advanced-filter-builder-pill-display){min-width:0}}.ag-advanced-filter-builder-set-values-pill-empty{width:152px}.ag-advanced-filter-builder-item-buttons{display:flex;gap:var(--ag-spacing);padding:0 calc(var(--ag-spacing)*.5)}.ag-advanced-filter-builder-item-button{color:var(--ag-subtle-text-color);cursor:pointer;position:relative}.ag-advanced-filter-builder-item-button,.ag-advanced-filter-builder-pill{&:focus-visible{box-shadow:var(--ag-focus-shadow)}}.ag-advanced-filter-builder-item-button-disabled{cursor:default;opacity:.5}.ag-advanced-filter-builder-virtual-list-viewport{scrollbar-width:var(--ag-scrollbar-width,thin)}.ag-advanced-filter-builder-virtual-list-container{--ag-internal-virtual-list-overflow:visible;top:var(--ag-spacing)}.ag-advanced-filter-builder-virtual-list-item{cursor:default;display:flex;height:var(--ag-list-item-height);min-width:-moz-max-content;min-width:max-content}.ag-advanced-filter-builder-set-value-list{:where(.ag-advanced-filter-builder-item){flex:1 1 auto;min-width:0}:where(.ag-advanced-filter-builder-item-condition){flex:1 1 auto;min-width:0}:where(.ag-advanced-filter-builder-item-wrapper){-moz-column-gap:max(0px,calc(24px - var(--ag-spacing)*1.5));column-gap:max(0px,calc(24px - var(--ag-spacing)*1.5))}:where(.ag-advanced-filter-builder-invalid.ag-invisible){display:none}}.ag-advanced-filter-builder-virtual-list-item:hover{background-color:var(--ag-row-hover-color);:where(.ag-advanced-filter-builder-item-button){opacity:1}}.ag-advanced-filter-builder-invalid{color:var(--ag-subtle-text-color);cursor:default;margin:0 var(--ag-spacing)}:where(.ag-advanced-filter-builder-validation) .ag-advanced-filter-builder-invalid{color:var(--ag-invalid-color)}:where(.ag-advanced-filter-builder-virtual-list-item-highlight) .ag-advanced-filter-builder-item-button:focus-visible{opacity:1}.ag-advanced-filter-builder-set-picker{background-color:var(--ag-menu-background-color);border:var(--ag-border-width) solid var(--ag-border-color);border-radius:var(--ag-border-radius);min-width:240px;position:absolute;width:auto}';function x1(e){return e.filterManager?.getAdvFilterModel()??null}function F1(e,t){e.filterManager?.setAdvFilterModel(t)}function T1(e){e.filterManager?.toggleAdvFilterBuilder(!0,"api")}function A1(e){e.filterManager?.toggleAdvFilterBuilder(!1,"api")}import{_getOwn as sn,_parseBigIntOrNull as Fa,_parseDateTimeFromString as Ih,_serialiseDate as Eh,_toStringOrNull as Ar}from"ag-stack";import{BeanStub as P1,_addGridCommonParams as R1,_bindFilterCallback as Pr,_classifyFilterOptions as M1,_filterCallbackParams as I1,_getDefaultSimpleFilter as E1,_isGridSuppliedFilterParam as Dh,_resolveFilter as rn,_toFiniteNumber as D1}from"ag-grid-community";import{_areEqual as L1}from"ag-stack";import{ProvidedFilter as k1,_resolveFilter as _1}from"ag-grid-community";function hs(e){const t=e?.filters;return t&&t.length>0?t:[{filter:"agTextColumnFilter"},{filter:"agSetColumnFilter"}]}var ht="agTextColumnFilter";function Ta(e,t,s){return s.key==="agMultiColumnFilter"?Lh(e,t,s,ps(e,t,s.def)):void 0}function Lh(e,t,s,r){return hs(r).map(i=>_1(e,t,i,ht,s))}function ps(e,t,s){const r=e.colFilter;return r?r.resolveFilterParams(t,s):s.filterParams}function Aa(e){const t=e.filter;return t===!0?ht:t}function G1(e,t){const s=Aa(e),r=Aa(t);return s===r?!0:typeof s!="object"||typeof r!="object"?!1:s.component===r.component&&s.handler===r.handler&&s.doesFilterPass===r.doesFilterPass}function kh(e,t){return!L1(e,t,G1)}function nn(e,t){if(e!=null)for(let s=e.length-1;s>=0;s--)t(e[s],s)}function O1(e,t){return t.title!=null?t.title:e instanceof k1?e.getFilterTitle():"Filter"}function on(e,t,s,r){const i=[],n=e?.filterModels;for(let o=0;o<t;o++)i[o]=(o===r?s:n?.[o])??null;return i.every(o=>o==null)?null:{filterType:"multi",filterModels:i}}function pt(e,t){return e?.filterModels?.[t]??null}var N1={ariaAdvancedFilterBuilderItem:e=>`${e[0]}. Level ${e[1]}. Press ENTER to edit`,ariaAdvancedFilterBuilderItemValidation:e=>`${e[0]}. Level ${e[1]}. ${e[2]} Press ENTER to edit`,ariaAdvancedFilterBuilderList:"Advanced Filter Builder List",ariaAdvancedFilterBuilderFilterItem:"Filter Condition",ariaAdvancedFilterBuilderGroupItem:"Filter Group",ariaAdvancedFilterBuilderColumn:"Column",ariaAdvancedFilterBuilderOption:"Option",ariaAdvancedFilterBuilderValue:"Value",ariaAdvancedFilterBuilderJoinOperator:"Join Operator",ariaAdvancedFilterInput:"Advanced Filter Input",ariaLabelAdvancedFilterAutocomplete:"Advanced Filter Autocomplete",advancedFilterContains:"contains",advancedFilterNotContains:"does not contain",advancedFilterTextEquals:"equals",advancedFilterTextNotEqual:"does not equal",advancedFilterStartsWith:"begins with",advancedFilterEndsWith:"ends with",advancedFilterBlank:"is blank",advancedFilterNotBlank:"is not blank",advancedFilterEquals:"=",advancedFilterNotEqual:"!=",advancedFilterGreaterThan:">",advancedFilterGreaterThanOrEqual:">=",advancedFilterLessThan:"<",advancedFilterLessThanOrEqual:"<=",advancedFilterInRange:"is between",advancedFilterYesterday:"is yesterday",advancedFilterToday:"is today",advancedFilterTomorrow:"is tomorrow",advancedFilterLast7Days:"is in last 7 days",advancedFilterLastWeek:"is in last week",advancedFilterThisWeek:"is in this week",advancedFilterNextWeek:"is in next week",advancedFilterLast30Days:"is in last 30 days",advancedFilterLastMonth:"is in last month",advancedFilterThisMonth:"is in this month",advancedFilterNextMonth:"is in next month",advancedFilterLast90Days:"is in last 90 days",advancedFilterLastQuarter:"is in last quarter",advancedFilterThisQuarter:"is in this quarter",advancedFilterNextQuarter:"is in next quarter",advancedFilterLastYear:"is in last year",advancedFilterThisYear:"is in this year",advancedFilterYearToDate:"is in year to date",advancedFilterNextYear:"is in next year",advancedFilterLast6Months:"is in last 6 months",advancedFilterLast12Months:"is in last 12 months",advancedFilterLast24Months:"is in last 24 months",advancedFilterTrue:"is true",advancedFilterFalse:"is false",advancedFilterIsAnyOf:"is any of",advancedFilterIsNoneOf:"is none of",advancedFilterSetMore:e=>`+${e[0]} more`,advancedFilterAnd:"AND",advancedFilterOr:"OR",advancedFilterApply:"Apply",advancedFilterReset:"Reset",advancedFilterCancel:"Cancel",advancedFilterClear:"Clear",advancedFilterBuilder:"Builder",advancedFilterValidationMissingColumn:"Column is missing",advancedFilterValidationMissingOption:"Option is missing",advancedFilterValidationMissingValue:"Value is missing",advancedFilterValidationInvalidColumn:"Column not found",advancedFilterValidationInvalidOption:"Option not found",advancedFilterValidationInvalidValue:"Value not found",advancedFilterValidationMissingQuote:"Value is missing an end quote",advancedFilterValidationNotANumber:"Value is not a number",advancedFilterValidationNotABigInt:"Value is not a BigInt",advancedFilterValidationInvalidDate:"Value is not a valid date",advancedFilterValidationMissingCondition:"Condition is missing",advancedFilterValidationJoinOperatorMismatch:"Join operators within a condition must be the same",advancedFilterValidationInvalidJoinOperator:"Join operator not found",advancedFilterValidationMissingListStartBracket:"Missing opening square bracket",advancedFilterValidationMissingListEndBracket:"Missing closing square bracket",advancedFilterValidationMissingEndBracket:"Missing end bracket",advancedFilterValidationExtraEndBracket:"Too many end brackets",advancedFilterValidationMessage:e=>`Expression has an error. ${e[0]} - ${e[1]}.`,advancedFilterValidationMessageAtEnd:e=>`Expression has an error. ${e[0]} at end of expression.`,advancedFilterValidationMessageOnly:e=>`Expression has an error. ${e[0]}.`,advancedFilterValidationMustBeGreaterThan:e=>`${e[0]} must be greater than ${e[1]}`,advancedFilterValidationMustBeGreaterThanOrEqualTo:e=>`${e[0]} must be greater than or equal to ${e[1]}`,advancedFilterValidationMustBeAfter:e=>`${e[0]} must be after ${e[1]}`,advancedFilterValidationMustBeOnOrAfter:e=>`${e[0]} must be on or after ${e[1]}`,advancedFilterBuilderTitle:"Advanced Filter",advancedFilterBuilderApply:"Apply",advancedFilterBuilderCancel:"Cancel",advancedFilterBuilderClear:"Clear",advancedFilterBuilderReset:"Reset",advancedFilterBuilderAddButtonTooltip:"Add Filter or Group",advancedFilterBuilderRemoveButtonTooltip:"Remove",advancedFilterBuilderMoveUpButtonTooltip:"Move Up",advancedFilterBuilderMoveDownButtonTooltip:"Move Down",advancedFilterBuilderAddJoin:"Add Group",advancedFilterBuilderAddCondition:"Add Filter",advancedFilterBuilderSelectColumn:"Select a column",advancedFilterBuilderSelectOption:"Select an option",advancedFilterBuilderEnterValue:"Enter a value...",advancedFilterBuilderValidationAlreadyApplied:"Current filter already applied.",advancedFilterBuilderValidationIncomplete:"Not all conditions are complete.",advancedFilterBuilderValidationSelectColumn:"Must select a column.",advancedFilterBuilderValidationSelectOption:"Must select an option.",advancedFilterBuilderValidationEnterValue:"Must enter a value."};import{_trimInputForFilter as B1}from"ag-grid-community";import{_getOwn as V1}from"ag-stack";import{_PRESET_DATE_FILTER_RANGES as H1,_PRESET_DATE_FILTER_TYPES as _h,_RelativeDateRangeCache as U1,_TEXT_COMPARISONS as z1,_defaultLowercaseFormatter as W1,_hasValue as Pa,_isBlank as ks}from"ag-grid-community";function gs(e){return e instanceof Date?new Date(e.getTime()):e}var Rr={none:0,one:1,range:2,list:0};function K1(e,t,s){let r=!1;const i=e.toLocaleLowerCase(),n=i+" ",o=Object.keys(t).find(a=>{const l=t[a],c=s(l).toLocaleLowerCase();return c.startsWith(n)&&(r=!0),c===i});return o||(r?null:void 0)}function Mr(e,t){const s=t??Object.keys(e),r=s.length,i=new Array(r);let n=0;for(let o=0;o<r;++o){const a=s[o],l=V1(e,a);l&&(i[n++]={key:a,displayValue:l.displayValue})}return n<r&&(i.length=n),i}var $1=e=>e??null,Gh=class{constructor(e){this.params=e,this.initOperators()}getEntries(e){return Mr(this.operators,e)}initOperators(){const{translate:e}=this.params;this.operators={contains:{displayValue:e("advancedFilterContains"),evaluator:this.createEvaluator("contains",!1),operands:"one"},notContains:{displayValue:e("advancedFilterNotContains"),evaluator:this.createEvaluator("notContains",!0),operands:"one"},equals:{displayValue:e("advancedFilterTextEquals"),evaluator:this.createEvaluator("equals",!1),operands:"one"},notEqual:{displayValue:e("advancedFilterTextNotEqual"),evaluator:this.createEvaluator("notEqual",!0),operands:"one"},startsWith:{displayValue:e("advancedFilterStartsWith"),evaluator:this.createEvaluator("startsWith",!1),operands:"one"},endsWith:{displayValue:e("advancedFilterEndsWith"),evaluator:this.createEvaluator("endsWith",!1),operands:"one"},blank:{displayValue:e("advancedFilterBlank"),evaluator:ks,operands:"none"},notBlank:{displayValue:e("advancedFilterNotBlank"),evaluator:Pa,operands:"none"}}}createEvaluator(e,t){const s=z1[e];return(r,i,n,o)=>{if(r==null)return t;const a=n.textFormatter??(n.caseSensitive?$1:W1),l=a(n.valueConverter(r,i)),c=a(o),u=n.textMatcher;return u?u(e,l,c,i):l==null||c==null?!1:s(l,c)}}},j1=e=>e===0,Y1=e=>e!==0,q1=e=>e>0,Z1=e=>e>=0,X1=e=>e<0,J1=e=>e<=0,_s=class{constructor(e){this.params=e,this.initOperators()}getEntries(e){return Mr(this.operators,e)}initOperators(){const{translate:e,equals:t,relativeDates:s}=this.params;this.operators={equals:{displayValue:e("advancedFilterEquals"),evaluator:(r,i,n,o)=>this.evaluateSingleOperandExpression(r,i,n,o,!!n.includeBlanksInEquals,t,j1),operands:"one"},notEqual:{displayValue:e("advancedFilterNotEqual"),evaluator:(r,i,n,o)=>this.evaluateSingleOperandExpression(r,i,n,o,!!n.includeBlanksInNotEqual,(a,l)=>!t(a,l),Y1,!0),operands:"one"},greaterThan:{displayValue:e("advancedFilterGreaterThan"),evaluator:(r,i,n,o)=>this.evaluateSingleOperandExpression(r,i,n,o,!!n.includeBlanksInGreaterThan,(a,l)=>a>l,q1),operands:"one"},greaterThanOrEqual:{displayValue:e("advancedFilterGreaterThanOrEqual"),evaluator:(r,i,n,o)=>this.evaluateSingleOperandExpression(r,i,n,o,!!n.includeBlanksInGreaterThan,(a,l)=>a>=l,Z1),operands:"one"},lessThan:{displayValue:e("advancedFilterLessThan"),evaluator:(r,i,n,o)=>this.evaluateSingleOperandExpression(r,i,n,o,!!n.includeBlanksInLessThan,(a,l)=>a<l,X1),operands:"one"},lessThanOrEqual:{displayValue:e("advancedFilterLessThanOrEqual"),evaluator:(r,i,n,o)=>this.evaluateSingleOperandExpression(r,i,n,o,!!n.includeBlanksInLessThan,(a,l)=>a<=l,J1),operands:"one"},inRange:{displayValue:e("advancedFilterInRange"),evaluator:(r,i,n,o,a)=>this.evaluateRangeExpression(r,i,n,o,a),operands:"range"},blank:{displayValue:e("advancedFilterBlank"),evaluator:ks,operands:"none"},notBlank:{displayValue:e("advancedFilterNotBlank"),evaluator:Pa,operands:"none"}},s&&(this.defaultOperators=Object.keys(this.operators),eL(this.operators,e))}evaluateRangeExpression(e,t,s,r,i){if(e==null||ks(e))return!!s.includeBlanksInRange;const{comparator:n,isValid:o}=s;if(o&&!o(e))return!1;if(n){const l=n(gs(r),e);return s.inRangeInclusive?l>=0&&n(gs(i),e)<=0:l>0&&n(gs(i),e)<0}const a=s.valueConverter(e,t);return a==null?!1:s.inRangeInclusive?a>=r&&a<=i:a>r&&a<i}evaluateSingleOperandExpression(e,t,s,r,i,n,o,a){if(e==null||ks(e))return i;const{comparator:l,isValid:c}=s;if(c&&!c(e))return!!a;if(l)return o(l(gs(r),e));const u=s.valueConverter(e,t);return u==null?!!a:n(u,r)}},Q1={yesterday:"advancedFilterYesterday",today:"advancedFilterToday",tomorrow:"advancedFilterTomorrow",last7Days:"advancedFilterLast7Days",lastWeek:"advancedFilterLastWeek",thisWeek:"advancedFilterThisWeek",nextWeek:"advancedFilterNextWeek",last30Days:"advancedFilterLast30Days",lastMonth:"advancedFilterLastMonth",thisMonth:"advancedFilterThisMonth",nextMonth:"advancedFilterNextMonth",last90Days:"advancedFilterLast90Days",lastQuarter:"advancedFilterLastQuarter",thisQuarter:"advancedFilterThisQuarter",nextQuarter:"advancedFilterNextQuarter",lastYear:"advancedFilterLastYear",thisYear:"advancedFilterThisYear",yearToDate:"advancedFilterYearToDate",nextYear:"advancedFilterNextYear",last6Months:"advancedFilterLast6Months",last12Months:"advancedFilterLast12Months",last24Months:"advancedFilterLast24Months"};function eL(e,t){const s=new U1;for(let r=0,i=_h.length;r<i;++r){const n=_h[r],o=H1[n];e[n]={displayValue:t(Q1[n]),evaluator:(a,l,c)=>{if(a==null||ks(a))return!1;const{comparator:u,isValid:d}=c;if(d&&!d(a))return!1;if(u){const{fromTime:m,toTime:v}=s.getRange(n,o);return u(new Date(m),a)>=0&&u(new Date(v),a)<0}const h=c.valueConverter(a,l);if(h==null)return!1;const{fromTime:p,toTime:g}=s.getRange(n,o),f=+h;return f>=p&&f<g},operands:"none"}}}var tL=class{constructor(e){this.params=e,this.initOperators()}getEntries(e){return Mr(this.operators,e)}initOperators(){const{translate:e}=this.params;this.operators={true:{displayValue:e("advancedFilterTrue"),evaluator:t=>!!t,operands:"none"},false:{displayValue:e("advancedFilterFalse"),evaluator:t=>t===!1,operands:"none"},blank:{displayValue:e("advancedFilterBlank"),evaluator:ks,operands:"none"},notBlank:{displayValue:e("advancedFilterNotBlank"),evaluator:Pa,operands:"none"}}}};import{_parseDateTimeFromString as sL,_toStringOrNull as Oh}from"ag-stack";import{_getDefaultSimpleFilter as rL,_isRangeOutOfOrder as iL,_toFiniteNumber as nL}from"ag-grid-community";var an=["filter","filterTo"];function oL(e,t,s){const r=[];for(let i=0;i<s;++i){const n=e.formatOperand(t,t[an[i]],!0);if(!n)return null;r.push(n)}return r}function Nh(e,t,s,r,i){const n=t.colId;if(!n)return e.translate("advancedFilterBuilderValidationSelectColumn");if(!t.type)return e.translate("advancedFilterBuilderValidationSelectOption");const o=t,a=i?.operands;if(a==="list")return o.values?.length?null:e.translate("advancedFilterBuilderValidationEnterValue");const l=oL(e,o,Rr[a??"none"]);if(!l)return e.translate("advancedFilterBuilderValidationEnterValue");if(a!=="range")return null;const c=h=>aL(s,e,r,h),{filter:u,filterTo:d}=t;return Bh(e,n,r,c(u),c(d),l[0])}function Bh(e,t,s,r,i,n){if(rL(s)==="agTextColumnFilter")return null;const{inRangeInclusive:o}=e.getExpressionEvaluatorParams(t);if(!iL(r,i,o))return null;const a=r instanceof Date;let l;return o?l=a?"advancedFilterValidationMustBeOnOrAfter":"advancedFilterValidationMustBeGreaterThanOrEqualTo":l=a?"advancedFilterValidationMustBeAfter":"advancedFilterValidationMustBeGreaterThan",e.translate(l,[e.getColumnDisplayValue(t)??t,n])}function aL(e,t,s,r){return r==null?null:s==="bigint"?t.getBigIntParser(e)(Oh(r)):s==="number"?typeof r=="number"?nL(r):t.getNumberParser(e)(r):sL(Oh(r))}var Vh=class{constructor(e,t){this.params=e,this.startPosition=t,this.message=null}reject(e,t){this.message??(this.message=this.params.advFilterExpSvc.translate(e)),t!=null&&(this.endPosition??(this.endPosition=t))}isRejected(){return this.endPosition!=null}getErrorPosition(){return this.endPosition}getError(){const e=this.message;if(!e)return null;const t=this.endPosition,s=this.params.expression.length;return{message:e,startPosition:t==null?s:this.startPosition,endPosition:t??s}}};function ln(e,t,s){if(!e)return"";const r=s-t;return r?e.slice(0,e.length-r):e}function fs(e,t,s,r,i,n,o,a){let l=s+(!e.length||o?0:1),c=0;if(i){const d=e[l]===" ";d&&!a&&!n?c=1:(r+=" ",a&&(r+=a),n&&(r+='"'),d&&l++)}return{updatedValue:e.slice(0,t)+r+e.slice(l),updatedPosition:t+r.length+c}}function Ra(e,t,s){let r=t;for(;r<s&&e[r]===" ";)r++;return r}function Ma(e,t,s,r){let i=t,n=!1;for(;i<e.length;){const o=e[i];if(o==="("){r&&e[i-1]===" "?n=!0:i=i-1;break}else if(o===" "||s&&o===")"){i=i-1;break}i++}return{endPosition:i,isEmpty:n}}function Ia(e,t,s,r){s!==t&&(e.expression=fs(e.expression,r-t.length+1,r,s).updatedValue)}var cn="[",Ea="]",Hh="\u203A",Uh=">",lL=` ${Hh} `,cL=` ${Uh} `,Ir=e=>e.join(lL),zh=e=>e.join(cL),uL=class{constructor(e,t,s){this.params=e,this.column=s,this.values=[],this.hasOpenBracket=!1,this.hasCloseBracket=!1,this.closeBracketPosition=-1,this.pendingQuoteClose=!1,this.expectSeparator=!1,this.separatorPosition=-1,this.validation=new Vh(e,t)}parse(e,t){return this.hasCloseBracket||this.validation.isRejected()?!0:this.quotes?this.parseInQuotes(e,t):this.segment?this.parseInSegment(e,t):this.parseBetweenSegments(e,t)}complete(e){this.pendingQuoteClose?this.closeQuotes(e):this.quotes&&this.validation.reject("advancedFilterValidationMissingQuote"),this.finishValue(e,!1),this.values.length?this.hasCloseBracket||this.validation.reject("advancedFilterValidationMissingListEndBracket"):this.validation.reject("advancedFilterValidationMissingValue")}isComplete(){return this.values.length>0&&this.hasCloseBracket}getKeys(){const e=this.values,t=[];for(let s=0,r=e.length;s<r;++s){const i=e[s].keys;for(let n=0,o=i?.length??0;n<o;++n)t.push(i[n])}return t}getUsedKeys(e){const t=this.values,s=new Set;for(let r=0,i=t.length;r<i;++r){const n=t[r];if(n!==e&&n.resolved){const o=n.keys;for(let a=0,l=o.length;a<l;++a)s.add(o[a])}}return s}getValidationError(){const e=this.values;for(let t=0,s=e.length;t<s;++t){const r=e[t];if(r.judged&&!r.resolved)return{message:this.params.advFilterExpSvc.translate("advancedFilterValidationInvalidValue"),startPosition:r.startPosition,endPosition:r.endPosition,advisory:!0}}return this.validation.getError()}getValueAt(e){const t=this.values;for(let s=0,r=t.length;s<r;++s){const i=t[s];if(e<=i.startPosition||e>i.endPosition+1)continue;const n=i.segments;if(i.expectsSegment&&e>(n[n.length-1]?.endPosition??-1)+1)return{value:i,segmentIndex:n.length};let o=n.length-1;for(let a=0;a<n.length;++a)if(e<=n[a].endPosition+1){o=a;break}return{value:i,segmentIndex:o}}}isInList(e){const t=this.validation.getErrorPosition();return t!=null?e<=t:!this.hasCloseBracket||e<=this.closeBracketPosition}parseInQuotes(e,t){if(this.pendingQuoteClose){if(this.pendingQuoteClose=!1,e===this.quotes){this.segment.text+=e;return}return this.closeQuotes(t-1),this.parseBetweenSegments(e,t)}if(e===this.quotes){this.pendingQuoteClose=!0;return}this.segment.text+=e}closeQuotes(e){this.pendingQuoteClose=!1,this.quotes=void 0,this.finishSegment(e,!0)}parseInSegment(e,t){if(e===","||Da(e)||e===Ea)return this.finishSegment(t-1,!0),this.parseBetweenSegments(e,t);this.segment.text+=e}parseBetweenSegments(e,t){var s;if(!this.hasOpenBracket){if(e===" ")return;if(e!==cn)return this.validation.reject("advancedFilterValidationMissingListStartBracket",t);this.hasOpenBracket=!0;return}if(e!==" "){if(e===Ea)return this.hasCloseBracket=!0,this.closeBracketPosition=t,this.finishValue(t-1,!0),this.values.length?this.separatorPosition>=0&&((s=this.params).redundantSeparators??(s.redundantSeparators=[])).push({startPosition:this.separatorPosition,endPosition:t-1}):this.validation.reject("advancedFilterValidationMissingValue",t),!1;if(e===","){if(!this.value)return this.validation.reject("advancedFilterValidationMissingValue",t);this.finishValue(t-1,!0),this.separatorPosition=t;return}if(Da(e)){if(!this.value)return this.validation.reject("advancedFilterValidationMissingValue",t);this.expectSeparator=!1,this.value.expectsSegment=!0;return}if(this.expectSeparator)return this.validation.reject("advancedFilterValidationMissingListEndBracket",t);this.startSegment(e,t)}}startSegment(e,t){this.separatorPosition=-1,this.value||(this.value={segments:[],startPosition:t,endPosition:t,terminated:!1,expectsSegment:!1,judged:!1,resolved:!1},this.values.push(this.value)),this.value.expectsSegment=!1;const s=dL(e);this.quotes=s?e:void 0,this.segment={text:s?"":e,startPosition:t,endPosition:t,closed:!1,quoted:s},this.value.segments.push(this.segment)}finishSegment(e,t){const s=this.segment;if(s){if(!s.quoted){const r=s.text,i=r.trimEnd();s.text=i,e-=r.length-i.length}s.endPosition=e,s.closed=t,this.segment=void 0,this.value.endPosition=e,this.expectSeparator=!0}}finishValue(e,t){const s=this.value;if(!s)return;this.finishSegment(e,!1),s.endPosition=Math.max(s.endPosition,Math.min(e,this.params.expression.length-1)),s.terminated=t,s.judged=!s.expectsSegment&&(t||!!s.segments[s.segments.length-1]?.closed),this.expectSeparator=!1,this.value=void 0;const r=this.column;if(!r)return;const i=s.segments.map(c=>c.text),n=this.params.advFilterSetSvc,o=n.getKeys(r,i)??this.getKeysForWholeValue(s,r)??this.getKeysForJoinedPath(r,i);s.resolved=o!==void 0;const a=Ir(i),l=i.length===1&&a===n.getBlankLabel(r);s.keys=o??[l?null:a]}getKeysForWholeValue(e,t){const s=e.segments;if(s.length<2)return;for(let i=0,n=s.length;i<n;++i)if(s[i].quoted)return;const r=this.params.expression.slice(e.startPosition,s[s.length-1].endPosition+1);return this.params.advFilterSetSvc.getKeys(t,[r])}getKeysForJoinedPath(e,t){if(t.length!==1)return;const s=un(t[0]);return s.length>1?this.params.advFilterSetSvc.getKeys(e,s):void 0}},Da=e=>e===Hh||e===Uh,un=e=>{const t=[];let s=0;for(let r=0,i=e.length;r<i;++r)Da(e[r])&&(t.push(e.slice(s,r).trim()),s=r+1);return t.push(e.slice(s).trim()),t},dL=e=>e==="'"||e==='"',hL=class{constructor(e,t){this.params=e,this.startPosition=t,this.valid=!0,this.hasStartChar=!1,this.hasEndChar=!1,this.colName=""}parse(e,t){if(e===La&&!this.colName)this.hasStartChar=!0;else if(e===ka&&this.hasStartChar){if(this.parseColumn(!1,t))return this.hasEndChar=!0,!1;this.colName+=e}else this.colName+=e}getDisplayValue(){return(this.hasStartChar?La:"")+this.colName+(this.hasEndChar?ka:"")}getColId(){return this.colId}complete(e){this.parseColumn(!0,e)}getValidationError(){return this.valid?null:{message:this.params.advFilterExpSvc.translate("advancedFilterValidationInvalidColumn"),startPosition:this.startPosition,endPosition:this.endPosition??this.params.expression.length-1}}parseColumn(e,t){this.endPosition=t;const s=this.params.advFilterExpSvc.getColId(this.colName);return s&&this.hasStartChar&&(this.colId=s.colId,Ia(this.params,this.colName,s.columnName,t-1),this.colName=s.columnName,this.column=this.params.colModel.getNonPivotCol(this.colId),this.column)?(this.baseCellDataType=this.params.dataTypeSvc?.getBaseDataType(this.column)??"text",!0):(e&&(this.valid=!1),this.baseCellDataType="text",!1)}},pL=class{constructor(e,t,s,r){this.params=e,this.startPosition=t,this.baseCellDataType=s,this.column=r,this.valid=!0,this.operands="none",this.operator=""}parse(e,t){if(this.matchEndPosition==null&&(!(e===" "||e===")")||!this.parseOperator(!1,t-1))){this.operator+=e;return}return t<=this.matchEndPosition?void 0:!0}complete(e){this.matchEndPosition==null&&this.parseOperator(!0,e)}getValidationError(){return this.valid?null:{message:this.params.advFilterExpSvc.translate("advancedFilterValidationInvalidOption"),startPosition:this.startPosition,endPosition:this.endPosition??this.params.expression.length-1}}getDisplayValue(){return this.operator}getOperatorKey(){return this.parsedOperator}matchOperatorName(e,t,s){const{params:r,startPosition:i}=this,n=r.expression;let o,a=0,l=!1;for(let c=0,u=e.length;c<u;++c){const d=e[c],{displayValue:h,lowerCaseDisplayValue:p}=d,g=h.length;g>a&&g>=t&&gL(n,i,h,p)&&(o=d.key,a=g),p.startsWith(s)&&(l=!0)}return{key:o,length:a,isPartialMatch:l}}parseOperator(e,t){const{params:s,startPosition:r,baseCellDataType:i,column:n}=this,o=s.expression,a=s.advFilterExpSvc,l=a.getOperatorNames(i,n);this.endPosition=t;const c=t-r+1,u=o.slice(r,t+1).toLocaleLowerCase()+" ";let d=this.matchOperatorName(l?.offered??[],c,u);const h=l?.all;if(h){const f=this.matchOperatorName(h,c,u);(f.length>d.length||!d.key&&f.isPartialMatch)&&(d=f)}const{key:p,isPartialMatch:g}=d;if(p){const f=r+d.length-1;this.parsedOperator=p,this.endPosition=f,this.matchEndPosition=f;const m=a.getExpressionOperator(i,p,n);this.operands=m.operands;const v=m.displayValue,C=o.slice(r,f+1);return Ia(s,C,v,f),this.operator=v,!0}return(e||!g)&&(this.valid=!1),!1}};function gL(e,t,s,r){const i=t+s.length,n=e[i];return(n===void 0||n===" "||n===")")&&e.slice(t,i).toLocaleLowerCase()===r}var fL={number:"advancedFilterValidationNotANumber",bigint:"advancedFilterValidationNotABigInt",date:"advancedFilterValidationInvalidDate",dateString:"advancedFilterValidationInvalidDate",dateTime:"advancedFilterValidationInvalidDate",dateTimeString:"advancedFilterValidationInvalidDate",boolean:void 0,object:void 0,text:void 0},mL=class{constructor(e,t,s,r){this.params=e,this.startPosition=t,this.baseCellDataType=s,this.column=r,this.operand="",this.validationMessage=null}parse(e,t){if(e===" ")if(this.quotes)this.operand+=e;else return this.parseOperand(!1,t),!0;else if(e===")")if(this.quotes)this.operand+=e;else return this.parseOperand(!1,t-1),!0;else if(!this.operand&&!this.quotes&&(e==="'"||e==='"'))this.quotes=e;else{if(this.quotes&&e===this.quotes)return this.parseOperand(!1,t),this.quotes=void 0,!1;this.operand+=e}}complete(e){this.parseOperand(!0,e)}getValidationError(){return this.validationMessage?{message:this.validationMessage,startPosition:this.startPosition,endPosition:this.endPosition??this.params.expression.length-1}:null}isInsideQuotes(){return this.quotes!=null}getRawValue(){return this.operand}getModelValue(){return this.modelValue}getBuilderValue(){return this.params.advFilterExpSvc.isOperandModelValueEditable(this.baseCellDataType,this.column)?this.modelValue:this.operand}parseOperand(e,t){const s=this.params.advFilterExpSvc,{baseCellDataType:r,column:i}=this;this.endPosition=t;let n=this.operand;if(s.isOperandTrimmed(i,r)&&(n=B1(n)??n,this.operand=n),this.modelValue=n,e&&this.quotes)this.validationMessage=s.translate("advancedFilterValidationMissingQuote");else if(n==="")this.validationMessage=s.translate("advancedFilterValidationMissingValue");else{const o=s.getOperandModelValue(n,r,i);o!=null&&(this.modelValue=o);const a=fL[r];a&&(o==null||Number.isNaN(o))&&(this.validationMessage=s.translate(a))}}},vL=class{constructor(e,t,s,r,i){this.params=e,this.baseCellDataType=s,this.column=r,this.expectedNumOperands=i,this.parsers=[],this.expectSeparator=!1,this.hasOpenBracket=!1,this.validation=new Vh(e,t)}parse(e,t){return this.expectedNumOperands>1?this.parseSeveral(e,t):(this.startOperand(t),this.parser.parse(e,t))}complete(e){this.parser&&!this.expectSeparator&&this.finishOperand(e),!(this.expectedNumOperands<2)&&(this.parsers.length<this.expectedNumOperands?this.validation.reject("advancedFilterValidationMissingValue"):this.hasOpenBracket&&this.validation.reject("advancedFilterValidationMissingEndBracket"))}getValidationError(){const e=this.parsers;for(let t=0,s=e.length;t<s;++t){const r=e[t].getValidationError();if(r)return r}return this.validation.getError()}isComplete(){return this.parsers.length>=this.expectedNumOperands}getParsers(){return this.parsers}parseSeveral(e,t){const s=this.parser;if(!this.validation.isRejected()){if(s&&!this.expectSeparator&&s.isInsideQuotes())return this.delegate(e,t);if(e===" ")return s&&!this.expectSeparator&&this.finishOperand(t-1),this.expectSeparator&&this.isComplete()&&!this.hasOpenBracket?!0:void 0;if(e==="("&&!s&&!this.hasOpenBracket&&!this.parsers.length){this.hasOpenBracket=!0;return}return e===","?s?(this.expectSeparator||this.finishOperand(t-1),this.isComplete()&&!this.hasOpenBracket?!0:(this.parser=void 0,this.expectSeparator=!1,this.isComplete()?this.validation.reject("advancedFilterValidationMissingEndBracket",t):void 0)):this.validation.reject("advancedFilterValidationMissingValue",t):e===")"?(s&&!this.expectSeparator&&this.finishOperand(t-1),this.hasOpenBracket?this.isComplete()?!1:this.validation.reject("advancedFilterValidationMissingValue",t):(this.isComplete()||this.validation.reject("advancedFilterValidationMissingValue"),!0)):this.expectSeparator?this.validation.reject(this.isComplete()?"advancedFilterValidationMissingEndBracket":"advancedFilterValidationMissingValue",t):(this.startOperand(t),this.delegate(e,t))}}delegate(e,t){this.parser.parse(e,t)!=null&&(this.expectSeparator=!0)}startOperand(e){this.parser||(this.parser=new mL(this.params,e,this.baseCellDataType,this.column),this.parsers.push(this.parser))}finishOperand(e){this.parser.complete(e),this.expectSeparator=!0}},La="[",ka="]",CL=class{constructor(e,t){this.params=e,this.startPosition=t,this.isAwaiting=!0,this.operandValueGetters={number:s=>this.params.advFilterExpSvc.getNumberParser(this.columnParser.column)(s),bigint:s=>this.params.advFilterExpSvc.getBigIntParser(this.columnParser.column)(s),date:s=>this.params.valueSvc.parseValue(this.columnParser.column,null,s,void 0),dateString:s=>this.operandValueGetters.date(s),dateTime:s=>this.operandValueGetters.date(s),dateTimeString:s=>this.operandValueGetters.date(s),boolean:s=>s,object:s=>s,text:s=>s}}parseExpression(){let e=this.startPosition;const{expression:t}=this.params;for(;e<t.length;){const s=t[e];if(!(s===" "&&this.isAwaiting)){if(this.isAwaiting=!1,!this.parser){let i;this.columnParser?this.operatorParser?this.operatorParser.operands==="list"?(this.setOperandsParser??(this.setOperandsParser=new uL(this.params,e,this.columnParser.column)),i=this.setOperandsParser):(this.operandsParser??(this.operandsParser=new vL(this.params,e,this.columnParser.baseCellDataType,this.columnParser.column,Rr[this.operatorParser.operands])),i=this.operandsParser):(this.operatorParser=new pL(this.params,e,this.columnParser.baseCellDataType,this.columnParser.column),i=this.operatorParser):(this.columnParser=new hL(this.params,e),i=this.columnParser),this.parser=i}const r=this.parser.parse(s,e);if(r!=null){if(this.isComplete())return this.returnEndPosition(r?e-1:e,!0);this.parser=void 0,this.isAwaiting=!0}}e++}return this.parser?.complete?.(e-1),this.returnEndPosition(e)}isValid(){const e=this.getValidationError();return this.isComplete()&&(!e||!!e.advisory)}getValidationError(){const e=this.columnParser?.getValidationError()??this.operatorParser?.getValidationError()??this.operandsParser?.getValidationError()??this.setOperandsParser?.getValidationError();if(e)return e;const t=this.params.expression.length;let s;return this.columnParser?this.operatorParser?this.operatorParser.operands!=="none"&&!this.operandsParser&&!this.setOperandsParser&&(s="advancedFilterValidationMissingValue"):s="advancedFilterValidationMissingOption":s="advancedFilterValidationMissingColumn",s?{message:this.params.advFilterExpSvc.translate(s),startPosition:t,endPosition:t}:this.getRangeOrderError()}getRangeOrderError(){const[e,t]=this.getOperandParsers();if(this.operatorParser.operands!=="range"||!t)return null;const s=this.params,r=this.columnParser,i=Bh(s.advFilterExpSvc,r.getColId(),r.baseCellDataType,this.getOperandValue(e),this.getOperandValue(t),e.getRawValue());return i?{message:i,startPosition:t.startPosition,endPosition:t.endPosition??s.expression.length-1,selfContained:!0}:null}getFunction(e){const t=this.columnParser,s=t.getColId(),{operators:r,evaluatorParams:i,operands:n}=e,o=this.params.advFilterExpSvc,a=Er(r,o.getExpressionOperator(t.baseCellDataType,this.operatorParser?.getOperatorKey(),t.column)),l=Er(i,o.getExpressionEvaluatorParams(s)),c=this.setOperandsParser;if(c){const g=Er(n,this.params.advFilterSetSvc.createMatcher(t.column,c.getKeys()));return(f,m,v)=>v.operators[a].evaluator(void 0,m,v.evaluatorParams[l],v.operands[g])}const[u,d]=this.getOperandParsers(),h=u?Er(n,this.getOperandValue(u)):-1,p=d?Er(n,this.getOperandValue(d)):-1;return(g,f,m)=>m.operators[a].evaluator(g.getValue(s,f),f,m.evaluatorParams[l],h<0?void 0:m.operands[h],p<0?void 0:m.operands[p])}getAutocompleteListParams(e){if(this.isColumnPosition(e))return this.getColumnAutocompleteListParams(e);if(this.isOperatorPosition(e))return this.getOperatorAutocompleteListParams(e);if(!this.isBeyondEndPosition(e))return this.setOperandsParser?this.getSetValueAutocompleteListParams(e):{enabled:!1}}updateExpression(e,t,s){const{expression:r}=this.params,i=this.columnParser;if(this.isColumnPosition(e))return fs(r,this.startPosition,i?.getColId()?i.endPosition:Ma(r,e).endPosition,this.params.advFilterExpSvc.getColumnValue(t),!0);const n=this.setOperandsParser;if(n&&this.params.advFilterSetSvc.isSetValueType(s))return this.updateSetExpression(n,e,t);if(!this.isOperatorPosition(e))return null;const o=i.baseCellDataType,a=this.getOperandsKindFor(o,t.key),l=a==="list",c=a!=="none",u=this.operatorParser;let d=e,h=e,p=!1;if(u?.startPosition==null||e>=u.startPosition){if(u?.getOperatorKey())h=u.endPosition;else{const y=Ma(r,e,!0,!0);h=y.endPosition,p=y.isEmpty}d=Ra(r,i.endPosition+1,h)}let g;l?g=cn:a==="range"&&(g="(");const f=bL(r,h+(p?0:1)),m=c&&(g?f===g:!!f),v=c&&!m,C=fs(r,d,h,t.displayValue??t.key,c,v&&!l&&this.doesOperandNeedQuotes(o),p,v?g:void 0),b=C.updatedValue;return{...C,updatedPosition:m?Ra(b,C.updatedPosition,b.length)+1:C.updatedPosition,hideAutocomplete:!c}}getModel(e){const t=this.columnParser,s=this.setOperandsParser,r={colId:t.getColId(),type:this.operatorParser.getOperatorKey()};if(s)return{filterType:"set",...r,values:s.getKeys()};const[i,n]=this.getOperandParsers(),o={};return i&&(o.filter=e?i.getBuilderValue():i.getModelValue()),n&&(o.filterTo=e?n.getBuilderValue():n.getModelValue()),{filterType:t.baseCellDataType,...r,...o}}getOperandValue(e){const{baseCellDataType:t,column:s}=this.columnParser,r=this.operandValueGetters[t](e.getRawValue());return t==="dateString"||t==="dateTimeString"?this.params.dataTypeSvc?.getDateParserFunction(s)(r)??r:r}getOperandParsers(){return this.operandsParser?.getParsers()??[]}isComplete(){const e=this.operatorParser;return!!e&&(e.operands==="none"||!!(this.operandsParser??this.setOperandsParser)?.isComplete())}isColumnPosition(e){return this.columnParser?.endPosition==null||e<=this.columnParser.endPosition+1}isOperatorPosition(e){return this.operatorParser?.endPosition==null||e<=this.operatorParser.endPosition+1}isBeyondEndPosition(e){return this.isComplete()&&this.endPosition!=null&&e>this.endPosition+1&&this.endPosition+1<this.params.expression.length}returnEndPosition(e,t){return this.endPosition=t?e:e-1,e}getColumnAutocompleteListParams(e){return this.params.advFilterExpSvc.generateAutocompleteListParams(this.params.advFilterExpSvc.getColumnAutocompleteEntries(),"column",this.getColumnSearchString(e))}getColumnSearchString(e){const t=this.columnParser?.getDisplayValue()??"",s=ln(t,e,this.columnParser?.endPosition==null?this.params.expression.length:this.columnParser.endPosition+1),r=this.columnParser?.hasStartChar&&s.length>0,i=this.columnParser?.hasEndChar&&s.length===t.length+2;return r?s.slice(1,i?-1:void 0):s}getOperatorAutocompleteListParams(e){const t=this.columnParser?.column;if(!t)return{enabled:!1};const s=this.columnParser.baseCellDataType,r=this.operatorParser?.startPosition!=null&&e<this.operatorParser.startPosition?"":ln(this.operatorParser?.getDisplayValue()??"",e,this.operatorParser?.endPosition==null?this.params.expression.length:this.operatorParser.endPosition+1);return this.params.advFilterExpSvc.generateAutocompleteListParams(this.params.advFilterExpSvc.getOperatorAutocompleteEntries(t,s),`operator-${s}-${t?.getColId()}`,r)}getSetValueAutocompleteListParams(e){const t=this.columnParser?.column,s=this.setOperandsParser;if(!t)return{enabled:!1};const r=s.getValueAt(e);if(!r&&!s.isInList(e))return{enabled:!1};const i=s.getUsedKeys(r?.value),{advFilterSetSvc:n,advFilterExpSvc:o}=this.params,a=n.getAutocompleteList(t,i);let l="";if(r){const u=r.value.segments,d=r.segmentIndex,h=u[d],p=h?ln(h.text,e,h.endPosition+1):"",g=[];for(let f=0;f<=d;++f){const m=f===d?p:u[f].text;a.isTree?g.push(...un(m)):g.push(m)}l=Ir(g)}const c=o.generateAutocompleteListParams(a.entries,a.type,l);return c.rowComponentCreator=a.rowComponentCreator,c.loading=a.loading,c.suggestFirstMatch=!0,c}updateSetExpression(e,t,s){const r=this.params.expression,i=e.getValueAt(t),n=i?.value.startPosition??t,o=i?.value.endPosition??t-1,l=this.params.advFilterSetSvc.writeEntry(this.columnParser.column,s)+(i?.value.terminated?"":", ");return{updatedValue:r.slice(0,n)+l+r.slice(o+1),updatedPosition:n+l.length}}getOperandsKindFor(e,t){if(!t)return"one";const s=this.columnParser?.column;return this.params.advFilterExpSvc.getExpressionOperator(e,t,s)?.operands??"none"}doesOperandNeedQuotes(e){return e!=="number"&&e!=="bigint"}};function Er(e,t){return e.push(t)-1}function bL(e,t){const s=e[Ra(e,t,e.length)];return s===cn||s==="("||s==='"'||s==="'"?s:void 0}import{_getCustomOptionDisplayName as SL,_getCustomOptionNumberOfInputs as yL,_isGridSuppliedFilterOptions as wL}from"ag-grid-community";function Wh(e){const t=e?.filterOptions;return!t?.length||wL(t)?void 0:t}function xL(e,t,s,r){const i=Object.assign(Object.create(null),e.operators);return t.forEach((n,o)=>{i[o]=FL(n,s,r)}),{operators:i,getEntries:n=>Mr(i,n)}}function FL(e,t,s){const r=e.predicate;let i,n;switch(yL(e)){case 0:i=o=>r([],o,s()),n="none";break;case 1:i=(o,a,l,c)=>r([gs(c)],o,s()),n="one";break;default:i=(o,a,l,c,u)=>r([gs(c),gs(u)],o,s()),n="range";break}return{displayValue:SL(e,t),evaluator:i,operands:n}}var TL=["isAnyOf","isNoneOf"];function AL(e){for(let t=0,s=e?.length??0;t<s;++t){const r=e[t];if(r==="isAnyOf"||r==="isNoneOf")return!0}return!1}function PL(e,t){const s={isAnyOf:{displayValue:t("advancedFilterIsAnyOf"),evaluator:(i,n,o,a)=>a(n)===!0,operands:"list"},isNoneOf:{displayValue:t("advancedFilterIsNoneOf"),evaluator:(i,n,o,a)=>a(n)===!1,operands:"list"}},r=Object.assign(Object.create(null),e.operators,s);return{operators:r,getEntries:i=>Mr(r,i)}}function RL(e){return[...e,...TL]}function ML(e,t){return e.includes(" ")||e.includes(")")||e.startsWith("'")||e.startsWith('"')||!!t&&e.includes(",")}function Kh(e){return e.includes('"')?e.includes("'")?null:"'":'"'}function Dr(e){const t=Kh(e);return t?`${t}${e}${t}`:`"${e.replaceAll('"','""')}"`}var $h=["caseSensitive","includeBlanksInEquals","includeBlanksInNotEqual","includeBlanksInLessThan","includeBlanksInGreaterThan","includeBlanksInRange","inRangeInclusive"],IL=e=>zh(e.map(Dr)),jh="agDateColumnFilter",EL=e=>e?.trim()?Number(e):null,Yh=e=>e.map(({key:t,displayValue:s=""})=>({key:t,displayValue:s,lowerCaseDisplayValue:s.toLocaleLowerCase()})),DL=class extends lx{constructor(){super(...arguments),this.beanName="advFilterExpSvc",this.wroteUnresolvedSetValue=!1,this.filterOperandGetters={number:e=>{const t=this.colModel.getNonPivotCol(e.colId),s=this.getCustomNumberParams(t);return this.applyOperandFormatter(e.filter,Pr(s?.numberFormatter,this.gos,t,"advancedFilter"),D1,this.bindNumberParser(t,s))},bigint:e=>{const t=this.colModel.getNonPivotCol(e.colId),s=this.getOwnFilterParams(t,"agBigIntColumnFilter",void 0);return this.applyOperandFormatter(e.filter,Pr(s?.bigintFormatter,this.gos,t,"advancedFilter"),Fa,this.bindBigIntParser(t,s))},date:e=>{const t=this.colModel.getNonPivotCol(e.colId);return t?this.valueSvc.formatValue(t,null,Ih(Ar(e.filter)??""),void 0,!0):null},dateTime:e=>this.filterOperandGetters.date(e),dateString:e=>{const t=this.colModel.getNonPivotCol(e.colId);if(!t)return null;const{filter:s}=e,i=this.dataTypeSvc?.getDateFormatterFunction(t)?.(Ih(Ar(e.filter)??"")??void 0)??s;return this.valueSvc.formatValue(t,null,i)},dateTimeString:e=>this.filterOperandGetters.dateString(e),boolean:()=>null,object:()=>null,text:()=>null},this.operandModelValueGetters={number:(e,t)=>e!=null&&e!==""?this.getNumberParser(t)(e):null,bigint:(e,t)=>{const s=this.getBigIntParser(t)(e);return s==null?null:String(s)},date:(e,t,s)=>Eh(this.valueSvc.parseValue(t,null,e,void 0),!!this.dataTypeSvc?.getDateIncludesTimeFlag(s)),dateTime:(...e)=>this.operandModelValueGetters.date(...e),dateString:(e,t,s)=>{const r=this.valueSvc.parseValue(t,null,e,void 0);return this.dataTypeSvc?Eh(this.dataTypeSvc.getDateParserFunction(t)(r)??null,this.dataTypeSvc.getDateIncludesTimeFlag(s)):r},dateTimeString:(...e)=>this.operandModelValueGetters.dateString(...e),boolean:e=>e,object:e=>e,text:e=>e},this.columnNameToIdMap=Object.create(null),this.columnAutocompleteEntries=null,this.expressionEvaluatorParams=Object.create(null),this.columnExpressionOperators=new WeakMap}wireBeans(e){this.valueSvc=e.valueSvc,this.colModel=e.colModel,this.colNames=e.colNames,this.dataTypeSvc=e.dataTypeSvc,this.advFilterSetSvc=e.advFilterSetSvc}postConstruct(){this.expressionJoinOperators=this.generateExpressionJoinOperators(),this.expressionOperators=this.generateExpressionOperators();const e=this.resetColumnCaches.bind(this);this.addManagedEventListeners({newColumnsLoaded:e,columnVisible:e,columnRowGroupChanged:e,columnPivotModeChanged:e,columnPivotChanged:e,columnHeaderNameChanged:e})}parseJoinOperator(e){const{type:t}=e;return this.expressionJoinOperators[t]??t}getColumnDisplayValue(e){const s=this.getColumnAutocompleteEntries().find(({key:i})=>i===e);let r;return s?(r=s.displayValue,this.columnNameToIdMap[r.toLocaleUpperCase()]={colId:e,columnName:r}):r=e,r}applyOperandFormatter(e,t,s,r){const i=Ar(e);if(i==null||i.trim()==="")return"";if(!t)return i;const n=s(i),o=n==null?null:t(n);if(o==null||o.trim()==="")return i;const a=r(o);return a!=null&&String(a)===String(n)?o:i}getOperatorDisplayValue(e){return this.getModelOperator(e)?.displayValue??e.type}getModelOperator(e){const t=e.filterType,{column:s,baseCellDataType:r}=this.getColumnDetails(e.colId);return this.getExpressionOperator(t==="set"?r:t,e.type,s)}getOperandModelValue(e,t,s){return this.operandModelValueGetters[t](e,s,t)}isOperandModelValueEditable(e,t){return e==="number"?this.getCustomNumberParams(t)==null:e!=="bigint"}getOperandDisplayValue(e){if(e.filterType==="set")return this.getSetOperandDisplayValue(e);const{filter:t,filterTo:s}=e,r=this.getModelOperator(e),i=r?Rr[r.operands]:void 0;return i===0?"":i!==2?t==null?"":` ${this.formatOperand(e,t)}`:` (${this.formatOperand(e,t,!1,!0)}, ${this.formatOperand(e,s,!1,!0)})`}getSetOperandDisplayValue(e){const t=e.values;if(!t?.length)return"";const s=this.colModel.getNonPivotColById(e.colId),r=new Set;for(let i=0,n=t.length;i<n;++i){const o=t[i],a=s?this.advFilterSetSvc.getPath(s,o):void 0;if(s&&a){r.add(this.advFilterSetSvc.writePath(s,a));continue}this.wroteUnresolvedSetValue=!0,r.add(Dr(o??(s?this.advFilterSetSvc.getBlankLabel(s):void 0)??""))}return` ${cn}${Array.from(r).join(", ")}${Ea}`}formatOperand(e,t,s,r){if(t==null)return"";const{filterType:i,colId:n}=e,o=Ar(t)??"";let a=sn(this.filterOperandGetters,i)?.({filter:t,colId:n})??o;const l=i==="number"||i==="bigint";if(!s&&(!l||ML(a,r))){const c=Kh(a);c?a=`${c}${a}${c}`:l?a=o:a=`"${a}"`}return a}parseColumnFilterModel(e){const t=this.getColumnDisplayValue(e.colId)??"",s=this.getOperatorDisplayValue(e)??"",r=this.getOperandDisplayValue(e);return`[${t}] ${s}${r}`}updateAutocompleteCache(e,t){if(t==="column"){const{key:s,displayValue:r}=e;this.columnNameToIdMap[e.displayValue.toLocaleUpperCase()]={colId:s,columnName:r}}}translate(e,t){let s=N1[e];return typeof s=="function"&&(s=s(t)),this.getLocaleTextFunc()(e,s,t)}generateAutocompleteListParams(e,t,s){return{enabled:!0,type:t,searchString:s,entries:e}}getColumnAutocompleteEntries(){const e=this.columnAutocompleteEntries;if(e)return e;const t=this.colModel.colDefList,s=[],r=this.gos.get("includeHiddenColumnsInAdvancedFilter");for(const i of t)i.colDef.filter&&(r||i.isVisible()||i.isRowGroupActive())&&s.push({key:i.colId,displayValue:this.colNames.getDisplayNameForColumn(i,"advancedFilter")});return s.sort((i,n)=>{const o=i.displayValue??"",a=n.displayValue??"";return o<a?-1:o>a?1:0}),this.columnAutocompleteEntries=s,s}getOperatorAutocompleteEntries(e,t){const s=this.getColumnOperators(t,e);return s?s.operators.getEntries(s.activeOperators):[]}getJoinOperatorAutocompleteEntries(){return Object.entries(this.expressionJoinOperators).map(([e,t])=>({key:e,displayValue:t}))}getDefaultAutocompleteListParams(e){return this.generateAutocompleteListParams(this.getColumnAutocompleteEntries(),"column",e)}getOperatorNames(e,t){const s=this.getColumnOperators(e,t);if(!s)return;let r=s.names;if(!r){const{operators:i,activeOperators:n}=s;r={offered:Yh(i.getEntries(n)),all:n?Yh(i.getEntries()):void 0},s.names=r}return r}getExpressionOperator(e,t,s){return sn(this.getColumnOperators(e,s)?.operators.operators,t)}isOperatorOffered(e,t,s){const r=this.getColumnOperators(e,s);if(!t||!sn(r?.operators.operators,t))return!1;const i=r.activeOperators;return!i||i.includes(t)}getColumnOperators(e,t){const s=this.expressionOperators[e];if(!s)return;if(!t)return{operators:s,activeOperators:s.defaultOperators};const r=this.columnExpressionOperators;let i=r.get(t);i||(i=Object.create(null),r.set(t,i));let n=i[e];return n||(n=this.createColumnOperators(s,t),i[e]=n),n}createColumnOperators(e,t){const s=this.advFilterSetSvc.offersSetOperators(t);let r=s?PL(e,o=>this.translate(o)):e,i=e.defaultOperators;s&&i&&(i=RL(i));const n=this.getColumnFilterOptions(t,rn(this.beans,t));if(n){const{offered:o,customOptions:a}=M1(n,u=>this.warn(72,{keys:u}),null);if(a.size){const u=this.gos;r=xL(r,a,this.getLocaleTextFunc(),()=>I1(u,t,"advancedFilter"))}const l=r.operators,c=[];for(const u of o.keys())sn(l,u)&&c.push(u);c.length&&(i=c)}return{operators:r,activeOperators:i}}getColumnFilterOptions(e,t){const s=this.beans,r=ps(s,e,t.def);if(t.key==="agMultiColumnFilter"){const i=Lh(s,e,t,r);for(let n=0,o=i.length;n<o;++n){const a=Wh(ps(s,e,i[n].def));if(a)return a}}return Wh(r)}getBigIntParser(e){return this.bindBigIntParser(e,this.getOwnFilterParams(e,"agBigIntColumnFilter",void 0))}bindBigIntParser(e,t){return Pr(t?.bigintParser,this.gos,e,"advancedFilter")??Fa}getNumberParser(e){return this.bindNumberParser(e,this.getCustomNumberParams(e))}bindNumberParser(e,t){return Pr(t?.numberParser,this.gos,e,"advancedFilter")??EL}getCustomNumberParams(e){const t=this.getOwnFilterParams(e,"agNumberColumnFilter",void 0);return t?.numberParser!=null&&t.numberFormatter!=null?t:void 0}getOwnFilterParams(e,t,s){if(!e)return;const r=this.beans,i=s??rn(r,e),n=Ta(r,e,i),o=n?n.find(a=>a.key===t):i;return o&&ps(r,e,o.def)}isOperandTrimmed(e,t){const s=e?this.getColumnOperators(t,e):void 0;if(!s)return!1;let r=s.trimInput;return r===void 0&&(r=!!this.getTextFilterParams(e,t,void 0)?.trimInput,s.trimInput=r),r}getTextFilterParams(e,t,s){if(!e||t!=null&&t!=="text"&&t!=="object")return;const r=s??rn(this.beans,e),i=r.key;return r.def.filter==null||i==="agTextColumnFilter"||i==="agMultiColumnFilter"?this.getOwnFilterParams(e,"agTextColumnFilter",r):void 0}getExpressionJoinOperators(){return this.expressionJoinOperators}getColId(e){const t=e.toLocaleUpperCase(),s=this.columnNameToIdMap[t];if(s)return s;const i=this.getColumnAutocompleteEntries().find(({displayValue:n})=>n.toLocaleUpperCase()===t);if(i){const{key:n,displayValue:o}=i,a={colId:n,columnName:o};return this.columnNameToIdMap[t]=a,a}return null}getExpressionEvaluatorParams(e){let t=this.expressionEvaluatorParams[e];if(t)return t;const s=this.colModel.getNonPivotColById(e);if(!s)return{valueConverter:h=>h};const r=this.dataTypeSvc,i=r?.getBaseDataType(s);let n=!1;switch(i){case"dateTimeString":case"dateString":t={valueConverter:r?.getDateParserFunction(s)??(h=>h)},n=!0;break;case"object":s.colDef.filterValueGetter?t={valueConverter:h=>h}:t={valueConverter:(h,p)=>this.valueSvc.formatValue(s,p,h)??(typeof h.toString=="function"?h.toString():"")};break;case"bigint":t={valueConverter:h=>Fa(h)};break;case"text":case void 0:t={valueConverter:h=>Ar(h)};break;default:t={valueConverter:h=>h};break}const o=rn(this.beans,s),a=o.key,l=this.advFilterSetSvc.hasSetFilter(o),c=E1(i),u=this.getOwnFilterParams(s,c,o);if(u)for(let h=0,p=$h.length;h<p;++h){const g=$h[h],f=u[g];f&&(t[g]=f)}this.addTextFilterParams(t,s,i,o);const d=c===jh&&(a===jh||l||a==="agMultiColumnFilter")?u:void 0;if(d){const{comparator:h,isValidDate:p}=d,g=h&&!Dh(h)&&!l?h:void 0,f=n&&!g;t.comparator=g,t.isValid=f&&Dh(p)?void 0:p}return this.expressionEvaluatorParams[e]=t,t}addTextFilterParams(e,t,s,r){const i=this.getTextFilterParams(t,s,r);if(!i)return;const{textFormatter:n,textMatcher:o}=i,a=this.gos,l=Pr(n,a,t,"advancedFilter");e.textFormatter=l,o&&(e.textMatcher=(c,u,d,h)=>o(R1(a,{colDef:t.colDef,column:t,node:h,data:h.data,filterOption:c,value:u,filterText:d,textFormatter:l,source:"advancedFilter"})))}getColumnDetails(e){const t=this.colModel.getNonPivotColById(e),s=(t?this.dataTypeSvc?.getBaseDataType(t):void 0)??"text";return{column:t,baseCellDataType:s}}generateExpressionOperators(){const t={translate:(r,i)=>this.translate(r,i)},s={...t,equals:(r,i)=>r.getTime()===i.getTime(),relativeDates:!0};return{text:new Gh(t),boolean:new tL(t),object:new Gh(t),number:new _s({...t,equals:(r,i)=>r===i}),bigint:new _s({...t,equals:(r,i)=>r===i}),date:new _s(s),dateString:new _s(s),dateTime:new _s(s),dateTimeString:new _s(s)}}getColumnValue({displayValue:e}){return`${La}${e}${ka}`}generateExpressionJoinOperators(){return{AND:this.translate("advancedFilterAnd"),OR:this.translate("advancedFilterOr")}}resetColumnCaches(){this.columnAutocompleteEntries=null,this.columnNameToIdMap=Object.create(null),this.expressionEvaluatorParams=Object.create(null),this.columnExpressionOperators=new WeakMap}};import{BeanStub as LL,_isClientSideRowModel as kL,_isServerSideRowModel as _L}from"ag-grid-community";import{_getAbsoluteHeight as GL,_getAbsoluteWidth as OL,_initStyledRoot as NL}from"ag-stack";import{BeanStub as BL,_clamp as VL}from"ag-grid-community";import{_STOP_PROPAGATION_CALLBACKS as HL,_focusNextGridCoreContainer as UL}from"ag-grid-community";var qh={stopPropagationCallbacks:HL,focusNextContainer:(e,t)=>UL(e,t,"direct"),configureFocusableContainer:(e,t)=>{const s=e.ctrlsSvc.get("gridCtrl");s&&(s.addFocusableContainer(t),t.addDestroyFunc(()=>s.removeFocusableContainer(t)))}},ms=class extends Ca{constructor(e){super(e,qh)}getFocusableContainerName(){return"dialog"}};import{RefPlaceholder as Lr,_makeNull as zL,_setDisabled as Zh,_setDisplayed as Xh}from"ag-stack";import{AgFilterButtonSelector as WL,Component as KL,_createIconNoSpan as $L}from"ag-grid-community";import{RefPlaceholder as jL,_makeNull as Jh}from"ag-stack";import{AgInputTextFieldSelector as YL,Component as qL,KeyCode as $e}from"ag-grid-community";var _a=".ag-autocomplete{align-items:center;display:flex;width:100%;>:where(.ag-text-field){flex:1 1 auto}}.ag-autocomplete-row-path-parent{opacity:.5}.ag-autocomplete-list-popup{background-color:var(--ag-background-color);border-radius:var(--ag-border-radius);box-shadow:var(--ag-dropdown-shadow);padding:0;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}.ag-autocomplete-list{height:calc(var(--ag-row-height)*6.5);min-width:200px;position:relative;width:100%}.ag-autocomplete-virtual-list-item{cursor:default;display:flex;height:var(--ag-list-item-height);&:focus-visible:after{content:none}}.ag-autocomplete-virtual-list-item:hover{background-color:var(--ag-row-hover-color)}.ag-autocomplete-row{align-items:center;display:flex;flex:1 1 auto;overflow:hidden}.ag-autocomplete-row-label{margin:0 var(--ag-widget-container-horizontal-padding);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ag-autocomplete-row-selected{background-color:var(--ag-selected-row-background-color);@media (forced-colors:active){background-color:SelectedItem}}.ag-autocomplete-loading{min-width:200px;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding);:where(.ag-loading-text){overflow:hidden;text-overflow:ellipsis;white-space:nowrap}}";import{AgPopupComponent as ZL,RefPlaceholder as Ga,_exists as XL,_isVisible as JL,_setAriaActiveDescendant as QL,_setAriaSelected as ek}from"ag-stack";import{KeyCode as dn,_clamp as tk,_createIconNoSpan as sk}from"ag-grid-community";import{_STOP_PROPAGATION_CALLBACKS as rk}from"ag-grid-community";var Gs=class extends qd{constructor(e){super(rk,e)}};import{_clearElement as ik,_exists as nk}from"ag-stack";import{Component as ok,_createElement as ak}from"ag-grid-community";var lk={tag:"div",cls:"ag-autocomplete-row",role:"presentation",children:[{tag:"div",cls:"ag-autocomplete-row-label"}]},Qh=class extends cx{constructor(){super(lk),this.hasHighlighting=!1}getLabel(){return this.getGui().lastElementChild}afterLabelRendered(){}setState(e,t){this.value=e,this.render(),this.updateSelected(t)}updateSelected(e){this.toggleCss("ag-autocomplete-row-selected",e)}setSearchString(e){let t=!1;const{value:s}=this;if(s&&nk(e)){const r=s.toLocaleLowerCase().indexOf(e.toLocaleLowerCase());if(r>=0){t=!0,this.hasHighlighting=!0;const i=r+e.length,n=this.getLabel();ik(n),n.append(s.slice(0,r),ak({tag:"b",children:s.slice(r,i)}),s.slice(i)),this.afterLabelRendered()}}!t&&this.hasHighlighting&&(this.hasHighlighting=!1,this.render())}render(){this.getLabel().textContent=this.value??"\xA0",this.afterLabelRendered()}},ck=e=>({tag:"div",cls:"ag-autocomplete-list-popup",children:[e?{tag:"div",cls:"ag-loading ag-autocomplete-loading",children:[{tag:"span",ref:"eLoadingIcon",cls:"ag-loading-icon"},{tag:"span",ref:"eLoadingLabel",cls:"ag-loading-text"}]}:null,{tag:"div",ref:"eList",cls:`ag-autocomplete-list${e?" ag-hidden":""}`,attrs:e?{"aria-hidden":"true"}:void 0}]}),Oa=class extends ux{constructor(e){super(ck(!!e.loading)),this.params=e,this.eList=Ga,this.eLoadingIcon=Ga,this.eLoadingLabel=Ga,this.selectedIndex=-1,this.searchString="",this.lastAutoListHeight=null,this.registerCSS(_a)}postConstruct(){this.setupLoading(),this.autocompleteEntries=this.params.autocompleteEntries,this.virtualList=this.createManagedBean(new Gs({cssIdentifier:"autocomplete",retainRoleWhenEmpty:this.params.retainRoleWhenEmpty}));const e=this.virtualList,t=e.getGui();e.getAriaElement().id=this.getListId(),e.setComponentCreator(this.createRowComponent.bind(this)),this.eList.appendChild(t),e.setModel({getRowCount:()=>this.autocompleteEntries.length,getRow:r=>this.autocompleteEntries[r]});const s=r=>{r.type==="mousedown"&&r.preventDefault(),this.selectRowUnderMouse(r)};this.addManagedListeners(t,{click:()=>this.params.onConfirmed(),mousemove:s,mousedown:s}),this.setSelectedValue(0),this.updateListHeight()}setupLoading(){if(!this.params.loading)return;this.eLoadingLabel.textContent=this.getLocaleTextFunc()("loadingOoo","Loading...");const e=sk("setFilterLoading",this.beans,null);e&&this.eLoadingIcon.appendChild(e)}getActiveOptionId(){const e=this.selectedIndex;return e>=0&&this.autocompleteEntries[e]===this.selectedValue?this.getOptionId(e):null}getListId(){return`ag-autocomplete-list-${this.getCompId()}`}onNavigationKeyDown(e,t){if(e.preventDefault(),!this.autocompleteEntries.length)return;const s=this.selectedIndex,r=this.autocompleteEntries[s]===this.selectedValue?s:-1;let i=0;if(r>=0){const a=t===dn.PAGE_UP||t===dn.PAGE_DOWN?this.getPageSize():1;i=t===dn.UP||t===dn.PAGE_UP?r-a:r+a}const n=this.autocompleteEntries.length-1;this.setSelectedValue(tk(i,0,n))}getPageSize(){const e=this.virtualList,t=e.getRowHeight(),s=e.getGui().getBoundingClientRect().height;return t>0?Math.max(1,Math.floor(s/t)):1}setSearch(e){this.searchString=e,XL(e)?this.runSearch():(this.autocompleteEntries=this.params.autocompleteEntries,this.refreshVirtualList(),this.checkSetSelectedValue(0),this.updateListHeight())}runContainsSearch(e){const t=this.params.autocompleteEntries,s=e.toLocaleLowerCase(),r=this.getLowerCaseTexts(),i=[];let n=-1,o=0,a=!1;for(let l=0,c=t.length;l<c;++l){const u=r[l].indexOf(s);if(u<0)continue;const d=t[l],h=(d.searchValue??d.displayValue??d.key).length,p=u===0;(n<0||!a&&p||a===p&&h<o)&&(n=i.length,o=h,a=p),i.push(d)}return{matches:i,topIndex:n}}runStartsWithSearch(e){const t=this.params.autocompleteEntries,s=e.toLocaleLowerCase(),r=this.getLowerCaseTexts(),i=[];for(let n=0,o=t.length;n<o;++n)r[n].startsWith(s)&&i.push(t[n]);return i}getLowerCaseTexts(){let e=this.lowerCaseTexts;if(!e){const t=this.params.autocompleteEntries,s=t.length;e=new Array(s);for(let r=0;r<s;++r){const i=t[r];e[r]=(i.searchValue??i.displayValue??i.key).toLocaleLowerCase()}this.lowerCaseTexts=e}return e}runSearch(){const{useStartsWithSearch:e,suggestFirstMatch:t,forceLastSelection:s}=this.params,r=this.searchString;let i,n=0;e?i=this.runStartsWithSearch(r):({matches:i,topIndex:n}=this.runContainsSearch(r),t&&(n=0));const o=this.selectedValue;!i.length&&o&&s?.(o,r)&&(i=[o],n=0),this.autocompleteEntries=i,this.refreshVirtualList(),this.updateListHeight(),this.checkSetSelectedValue(n)}updateListHeight(){if(!this.params.autoSizeList)return;const e=this.autocompleteEntries.length,t=this.virtualList.getRowHeight(),s=this.params.maxVisibleItems??e;let i=Math.min(e,s)*t;e===0&&(i=t),this.lastAutoListHeight!==i&&(this.lastAutoListHeight=i,this.eList.style.height=`${i}px`,JL(this.eList)&&this.params.onListHeightChanged?.())}checkSetSelectedValue(e){e>=0&&e<this.autocompleteEntries.length&&this.setSelectedValue(e)}refreshVirtualList(){this.virtualList.refresh(),this.virtualList.awaitStable(()=>{this.refreshRenderedRowsAria(),this.refreshActiveDescendant()})}setSelectedValue(e){const t=this.autocompleteEntries[e];if(this.selectedIndex=t===void 0?-1:e,this.selectedValue===t){this.refreshRenderedRowsAria(),this.refreshActiveDescendant();return}this.selectedValue=t,this.virtualList.ensureIndexVisible(e),this.refreshRenderedRowsAria(),this.refreshActiveDescendant()}refreshRenderedRowsAria(){this.virtualList.forEachRenderedRow((e,t)=>{const r=e.getGui().parentElement;r instanceof HTMLElement&&this.updateRowAriaProperties(e,r,t)})}refreshActiveDescendant(){const e=this.getActiveOptionId();QL(this.virtualList.getAriaElement(),e),this.params.onActiveOptionChanged?.(e)}updateRowAriaProperties(e,t,s){const r=this.autocompleteEntries[s]===this.selectedValue;e.updateSelected(r),ek(t,r),t.setAttribute("id",this.getOptionId(s))}getOptionId(e){return`${this.getListId()}-option-${e}`}createRowComponent(e,t,s){const r=e===this.selectedValue;let i=this.params.rowComponentCreator?.(e,r);if(i)this.createBean(i);else{const n=new Qh;this.createBean(n),n.setState(e.displayValue??e.key,r),i=n}return i.setSearchString(this.searchString),this.updateRowAriaProperties(i,t,s),i}selectRowUnderMouse(e){const t=this.virtualList,s=t.getGui().getBoundingClientRect(),r=t.getScrollTop(),i=e.clientY-s.top+r,n=Math.floor(i/t.getRowHeight());this.checkSetSelectedValue(n)}afterGuiAttached(){this.refreshVirtualList(),this.updateListHeight()}getSelectedValue(){return this.autocompleteEntries.length?this.selectedValue??null:null}},uk={tag:"div",cls:"ag-autocomplete",role:"presentation",children:[{tag:"ag-input-text-field",ref:"eAutocompleteInput"}]},dk=class extends dx{constructor(){super(uk,[YL]),this.eAutocompleteInput=jL,this.isListOpen=!1,this.lastPosition=0,this.valid=!0,this.registerCSS(_a)}wireBeans(e){this.popupSvc=e.popupSvc}postConstruct(){this.eAutocompleteInput.onValueChange(e=>this.onValueChanged(e)),this.eAutocompleteInput.setAutoComplete(!1),this.addGuiEventListener("keydown",this.onKeyDown.bind(this)),this.addGuiEventListener("click",this.updatePositionAndList.bind(this)),this.addDestroyFunc(()=>{this.destroyBean(this.autocompleteList)}),this.addGuiEventListener("focusout",()=>this.onFocusOut())}onValueChanged(e){const t=Jh(e);this.updateValue(t),this.updateAutocompleteList(t)}updateValue(e){this.updateLastPosition(),this.dispatchLocalEvent({type:"eventValueChanged",value:e}),this.validate(e)}updateAutocompleteList(e){const t=this.listGenerator?.(e,this.lastPosition)??{enabled:!1};(!t.type||t.type!==this.autocompleteListParams?.type)&&this.isListOpen&&this.closeList();const s=this.isListOpen;if(this.autocompleteListParams=t,t?.enabled){s||this.openList();const{searchString:r}=t;this.autocompleteList.setSearch(r??"")}else s&&this.closeList()}onKeyDown(e){const t=e.key;switch(this.updateLastPosition(),t){case $e.ENTER:this.onEnterKeyDown(e);break;case $e.TAB:this.onTabKeyDown(e);break;case $e.DOWN:case $e.UP:case $e.PAGE_DOWN:case $e.PAGE_UP:this.onUpDownKeyDown(e,t);break;case $e.LEFT:case $e.RIGHT:case $e.PAGE_HOME:case $e.PAGE_END:setTimeout(()=>{this.updatePositionAndList()});break;case $e.ESCAPE:this.onEscapeKeyDown(e);break;case $e.SPACE:e.ctrlKey&&!this.isListOpen&&(e.preventDefault(),this.forceOpenList());break}}confirmSelection(){const e=this.autocompleteList?.getSelectedValue();e&&(this.closeList(),this.dispatchLocalEvent({type:"eventOptionSelected",value:this.getValue(),position:this.lastPosition,updateEntry:e,autocompleteType:this.autocompleteListParams.type}))}onTabKeyDown(e){this.isListOpen&&(e.preventDefault(),e.stopPropagation(),this.confirmSelection())}onEnterKeyDown(e){e.preventDefault(),this.isListOpen?this.confirmSelection():this.onCompleted()}onUpDownKeyDown(e,t){e.preventDefault(),this.isListOpen?this.autocompleteList?.onNavigationKeyDown(e,t):this.forceOpenList()}onEscapeKeyDown(e){this.isListOpen&&(e.preventDefault(),e.stopPropagation(),this.closeList(),this.setCaret(this.lastPosition,!0))}onFocusOut(){this.isListOpen&&this.closeList()}updatePositionAndList(){this.updateLastPosition(),this.updateAutocompleteList(this.eAutocompleteInput.getValue()??null)}setCaret(e,t){t&&this.eAutocompleteInput.getFocusableElement().focus();const s=this.eAutocompleteInput.getInputElement();s.setSelectionRange(e,e),this.updateLastPosition(),e===s.value.length&&(s.scrollLeft=s.scrollWidth)}forceOpenList(){this.onValueChanged(this.eAutocompleteInput.getValue())}updateLastPosition(){this.lastPosition=this.eAutocompleteInput.getInputElement().selectionStart??0}validate(e){if(!this.validator)return;const t=this.validator(e);this.eAutocompleteInput.getInputElement().setCustomValidity(t??""),this.valid=!t,this.dispatchLocalEvent({type:"eventValidChanged",isValid:this.valid,validationMessage:t})}openList(){this.isListOpen=!0,this.autocompleteList=this.createBean(new Oa({autocompleteEntries:this.autocompleteListParams.entries,onConfirmed:()=>this.confirmSelection(),forceLastSelection:this.forceLastSelection,rowComponentCreator:this.autocompleteListParams.rowComponentCreator,suggestFirstMatch:this.autocompleteListParams.suggestFirstMatch,loading:this.autocompleteListParams.loading}));const e=this.autocompleteList.getGui(),t={ePopup:e,type:"autocomplete",eventSource:this.getGui(),position:"under",alignSide:this.gos.get("enableRtl")?"right":"left",keepWithinBounds:!0},s=this.popupSvc.addPopup({eChild:e,anchorToElement:this.getGui(),positionCallback:()=>this.popupSvc.positionPopupByComponent(t),ariaLabel:this.listAriaLabel});this.hidePopup=s.hideFunc,this.autocompleteList.afterGuiAttached()}closeList(){this.isListOpen=!1,this.hidePopup(),this.destroyBean(this.autocompleteList),this.autocompleteList=null}onCompleted(){this.isListOpen&&this.closeList(),this.dispatchLocalEvent({type:"eventValueConfirmed",value:this.getValue(),isValid:this.isValid()})}getValue(){return Jh(this.eAutocompleteInput.getValue())}getCaretPosition(){return this.lastPosition}setInputPlaceholder(e){return this.eAutocompleteInput.setInputPlaceholder(e),this}setInputAriaLabel(e){return this.eAutocompleteInput.setInputAriaLabel(e),this}setListAriaLabel(e){return this.listAriaLabel=e,this}setListGenerator(e){return this.listGenerator=e,this}setValidator(e){return this.validator=e,this}isValid(){return this.valid}setValue(e){const{value:t,position:s,silent:r,updateListOnlyIfOpen:i,restoreFocus:n}=e;this.eAutocompleteInput.setValue(t,!0),this.setCaret(s??this.lastPosition,n),r||this.updateValue(t),(!i||this.isListOpen)&&this.updateAutocompleteList(t)}refresh(e){const t=this.getValue();e&&this.updateValue(t),this.isListOpen&&this.updateAutocompleteList(t)}setForceLastSelection(e){return this.forceLastSelection=e,this}setInputDisabled(e){return this.eAutocompleteInput.setDisabled(e),this}},hk={selector:"AG-AUTOCOMPLETE",component:dk},Na={buttons:["apply"],suppressBuilderButton:!1},ep={apply:"advancedFilterApply",clear:"advancedFilterClear",cancel:"advancedFilterCancel",reset:"advancedFilterReset"},pk={tag:"div",cls:"ag-advanced-filter",role:"presentation",attrs:{tabindex:"-1"},children:[{tag:"ag-autocomplete",ref:"eAutocomplete"},{tag:"ag-filter-button",ref:"eButtons",cls:"ag-advanced-filter-buttons"},{tag:"button",ref:"eBuilderFilterButton",cls:"ag-button ag-advanced-filter-builder-button",children:[{tag:"span",ref:"eBuilderFilterButtonIcon",attrs:{"aria-hidden":"true"}},{tag:"span",ref:"eBuilderFilterButtonLabel",cls:"ag-advanced-filter-builder-button-label"}]}]},tp=class extends hx{constructor(){super(pk,[hk,WL]),this.eAutocomplete=Lr,this.eButtons=Lr,this.eBuilderFilterButton=Lr,this.eBuilderFilterButtonIcon=Lr,this.eBuilderFilterButtonLabel=Lr,this.expressionParser=null,this.isApplyDisabled=!0,this.builderOpen=!1}wireBeans(e){this.advFilterExpSvc=e.advFilterExpSvc,this.advancedFilter=e.advancedFilter,this.advFilterSetSvc=e.advFilterSetSvc,this.filterManager=e.filterManager}postConstruct(){if(this.tooltipFeature=this.createOptionalManagedBean(this.beans.tooltipSvc?.createTooltip({getGui:()=>this.getGui(),getTooltipComponentDefinition:()=>{},getTooltipShowDelayOverride:()=>1e3,getLocation:()=>"advancedFilter"})),this.eAutocomplete.setListGenerator((s,r)=>this.generateAutocompleteListParams(r)).setValidator(()=>this.validateValue()).setForceLastSelection((s,r)=>this.forceLastSelection(s,r)).setInputAriaLabel(this.advFilterExpSvc.translate("ariaAdvancedFilterInput")).setListAriaLabel(this.advFilterExpSvc.translate("ariaLabelAdvancedFilterAutocomplete")),this.refresh(),this.advFilterSetSvc){const s=this.advFilterSetSvc;this.addManagedListeners(s,{valuesChanged:()=>this.eAutocomplete.refresh(!this.advancedFilter.isCurrentExpressionApplied())}),this.addManagedElementListeners(this.eAutocomplete.getGui(),{focusin:()=>s.refreshValuesOnFocus()})}this.addManagedListeners(this.eAutocomplete,{eventValueChanged:({value:s})=>this.onValueChanged(s),eventValueConfirmed:({isValid:s})=>this.onValueConfirmed(s),eventOptionSelected:({position:s,updateEntry:r,autocompleteType:i})=>this.onOptionSelected(s,r,i),eventValidChanged:({isValid:s,validationMessage:r})=>this.onValidChanged(s,r)});const{buttons:e,suppressBuilderButton:t}={...Na,...this.gos.get("advancedFilterParams")};this.setupButtons(e),this.setupBuilderButton(t),this.addManagedPropertyListener("advancedFilterParams",s=>{const r={...Na,...s.currentValue},i={...Na,...s.previousValue};if(r.buttons!==i.buttons){const n=r.buttons.map(o=>({type:o,label:this.advFilterExpSvc.translate(ep[o])}));this.eButtons.updateButtons(n)}r.suppressBuilderButton!==i.suppressBuilderButton&&Xh(this.eBuilderFilterButton,!r.suppressBuilderButton)})}refresh(){const e=this.advancedFilter.getExpressionDisplayValue();this.eAutocomplete.setValue({value:e??"",position:e?.length,updateListOnlyIfOpen:!0})}setInputDisabled(e){this.eAutocomplete.setInputDisabled(e),this.eButtons.updateValidity(!e&&!this.isApplyDisabled&&!this.advancedFilter.isCurrentExpressionApplied())}setupButtons(e){const t=e.map(r=>({type:r,label:this.advFilterExpSvc.translate(ep[r])})),s=r=>()=>{this.updateModel(r)};this.eButtons.addManagedListeners(this.eButtons,{apply:s("apply"),clear:s("clear"),reset:s("reset"),cancel:s("cancel")}),this.eButtons.updateButtons(t),this.eButtons.updateValidity(!this.isApplyDisabled)}updateModel(e){switch(e){case"apply":this.onValueConfirmed(this.eAutocomplete.isValid());break;case"reset":this.advancedFilter.setModel(null),this.filterManager?.onFilterChanged({source:"advancedFilter"});break;case"cancel":this.advancedFilter.restoreAppliedExpression(),this.filterManager?.onFilterChanged({source:"advancedFilter"});break;case"clear":this.eAutocomplete.setValue({value:"",restoreFocus:!0});break}}setupBuilderButton(e){this.eBuilderFilterButtonIcon.appendChild($L("advancedFilterBuilder",this.beans)),this.eBuilderFilterButtonLabel.textContent=this.advFilterExpSvc.translate("advancedFilterBuilder"),this.activateTabIndex([this.eBuilderFilterButton]),this.addManagedElementListeners(this.eBuilderFilterButton,{click:()=>this.openBuilder()}),this.addManagedListeners(this.advancedFilter.getCtrl(),{advancedFilterBuilderClosed:()=>this.closeBuilder()}),Xh(this.eBuilderFilterButton,!e)}onValueChanged(e){e=zL(e),this.expressionParser=this.advancedFilter.createExpressionParser(e);let t=this.expressionParser?.parseExpression()??null;const s=this.eAutocomplete.getCaretPosition(),r=this.stripRedundantSeparators(s);let i;r!=null&&(i=s-(t.length-r.length),t=r),t!=null&&t!==e&&(e=t,this.eAutocomplete.setValue({value:e,position:i,silent:!0,restoreFocus:!0})),this.advancedFilter.setExpressionDisplayValue(e)}stripRedundantSeparators(e){const t=this.expressionParser?.stripRedundantSeparators(e)??null;return t!=null&&(this.expressionParser=this.advancedFilter.createExpressionParser(t),this.expressionParser.parseExpression()),t}onValueConfirmed(e){if(!e){this.advancedFilter.submitExpression();return}if(this.isApplyDisabled)return;this.eButtons?.updateValidity(!1);const{eAutocomplete:t,advancedFilter:s}=this,r=this.stripRedundantSeparators(t.getValue()?.length??0);r!=null&&(t.setValue({value:r,position:r.length,silent:!0,updateListOnlyIfOpen:!0}),s.setExpressionDisplayValue(r)),s.applyExpression(),this.filterManager?.onFilterChanged({source:"advancedFilter"})}onOptionSelected(e,t,s){const{updatedValue:r,updatedPosition:i,hideAutocomplete:n}=this.updateExpression(e,t,s);this.eAutocomplete.setValue({value:r,position:i,updateListOnlyIfOpen:n,restoreFocus:!0})}validateValue(){return this.expressionParser?.getValidationMessage()??null}onValidChanged(e,t){this.isApplyDisabled=!e||this.advancedFilter.isCurrentExpressionApplied(),this.eButtons.updateValidity(!this.isApplyDisabled),this.tooltipFeature?.setTooltipAndRefresh(t)}generateAutocompleteListParams(e){return this.expressionParser?this.expressionParser.getAutocompleteListParams(e):this.advFilterExpSvc.getDefaultAutocompleteListParams("")}updateExpression(e,t,s){return this.advFilterExpSvc.updateAutocompleteCache(t,s),this.expressionParser?.updateExpression(e,t,s)??this.advancedFilter.getDefaultExpression(t)}forceLastSelection({key:e,displayValue:t},s){return!!s.toLocaleLowerCase().match(String.raw`^${(t??e).toLocaleLowerCase()}\s*$`)}openBuilder(){this.builderOpen||(this.builderOpen=!0,Zh(this.eBuilderFilterButton,!0),this.advancedFilter.getCtrl().toggleFilterBuilder({source:"ui",eventSource:this.eBuilderFilterButton}))}closeBuilder(){this.builderOpen&&(this.builderOpen=!1,Zh(this.eBuilderFilterButton,!1),this.eBuilderFilterButton.focus())}};import{RefPlaceholder as gk,_clearElement as fk,_findNextFocusableElement as mk,_focusInto as vk,_getActiveDomElement as Ck,_setAriaColIndex as bk,_setAriaColSpan as Sk,_setAriaRole as yk,_setAriaRowIndex as wk,_setDisplayed as xk}from"ag-stack";import{Component as Fk,KeyCode as kr,_getFloatingFiltersHeight as Tk}from"ag-grid-community";var Ak={tag:"div",cls:"ag-row ag-full-width-row ag-advanced-filter-header",role:"row",children:[{tag:"div",cls:"ag-full-width-anchor",role:"presentation",ref:"eFullWidthAnchor"}]},Pk=class extends px{constructor(e){super(Ak),this.enabled=e,this.eFullWidthAnchor=gk}wireBeans(e){this.colModel=e.colModel,this.focusSvc=e.focusSvc,this.ctrlsSvc=e.ctrlsSvc}postConstruct(){this.setupAdvancedFilter(this.enabled),this.addDestroyFunc(()=>this.destroyBean(this.eAdvancedFilter));const e=this.refreshLayout.bind(this);this.addManagedEventListeners({gridColumnsChanged:()=>this.onGridColumnsChanged(),headerRowsChanged:()=>this.setAriaRowIndex(),columnHeaderHeightChanged:e,stylesChanged:e}),this.addManagedPropertyListener("headerHeight",e),this.addManagedPropertyListener("floatingFiltersHeight",e),this.addGuiEventListener("keydown",t=>this.onKeyDown(t)),this.addGuiEventListener("focusout",t=>{this.getFocusableElement().contains(t.relatedTarget)||this.focusSvc.clearAdvancedFilterColumn()})}getFocusableElement(){return this.eAdvancedFilter?.getGui()??this.getGui()}setEnabled(e){e!==this.enabled&&this.setupAdvancedFilter(e)}refresh(){this.eAdvancedFilter?.refresh()}refreshLayout(){this.enabled&&this.setEnabledHeight()}getHeight(){return this.height}setInputDisabled(e){this.eAdvancedFilter?.setInputDisabled(e)}setupAdvancedFilter(e){if(e){this.eAdvancedFilter=this.createBean(new tp);const t=this.eAdvancedFilter.getGui();this.eAdvancedFilter.addCss("ag-advanced-filter-header-cell"),this.setEnabledHeight(),this.setAriaRowIndex(),yk(t,"gridcell"),bk(t,1),this.setAriaColumnCount(t),this.eFullWidthAnchor.appendChild(t)}else fk(this.eFullWidthAnchor),this.destroyBean(this.eAdvancedFilter),this.height=0;xk(this.getGui(),e),this.enabled=e}setEnabledHeight(){const e=this.getGui();this.height=Tk(this.beans);const t=`${this.height}px`;e.style.height=t,e.style.minHeight=t}setAriaColumnCount(e){Sk(e,this.colModel.getCols().length)}setAriaRowIndex(){const e=this.ctrlsSvc.getHeaderRowContainerCtrl()?.getRowCount()??0;wk(this.getGui(),e+1)}onGridColumnsChanged(){this.eAdvancedFilter&&(this.setAriaColumnCount(this.eAdvancedFilter.getGui()),this.setAriaRowIndex())}onKeyDown(e){switch(e.key){case kr.ENTER:{this.hasFocus()&&vk(this.getFocusableElement())&&e.preventDefault();break}case kr.ESCAPE:this.hasFocus()||this.getFocusableElement().focus();break;case kr.UP:this.navigateUpDown(!0,e);break;case kr.DOWN:this.navigateUpDown(!1,e);break;case kr.TAB:if(this.hasFocus())this.navigateLeftRight(e);else{const t=mk({beans:this.beans,rootNode:this.getFocusableElement(),backwards:e.shiftKey});t?(e.preventDefault(),t.focus()):this.navigateLeftRight(e)}break}}navigateUpDown(e,t){this.hasFocus()&&this.focusSvc.focusNextFromAdvancedFilter(e)&&t.preventDefault()}navigateLeftRight(e){(e.shiftKey?this.focusSvc.focusLastHeader():this.focusSvc.focusNextFromAdvancedFilter(!1,!0))&&e.preventDefault()}hasFocus(){return Ck(this.beans)===this.getFocusableElement()}};import{RefPlaceholder as Rk,_removeFromParent as Mk}from"ag-stack";import{Component as Ik,FilterButtonComp as Ek}from"ag-grid-community";import{BeanStub as Dk,DragSourceType as Lk}from"ag-grid-community";var sp=class extends Xd{},kk=class extends gx{constructor(e,t){super(),this.comp=e,this.virtualList=t}postConstruct(){this.createManagedBean(new sp(this.comp,this.virtualList,{dragSourceType:Lk.AdvancedFilterBuilder,addListeners:(e,t,s)=>{e.addManagedListeners(this,{advancedFilterBuilderDragStarted:t,advancedFilterBuilderDragEnded:s})},getCurrentDragValue:e=>this.getCurrentDragValue(e),isMoveBlocked:()=>!1,getNumRows:e=>e.getNumItems(),moveItem:(e,t)=>this.moveItem(e,t)}))}getCurrentDragValue(e){return e.item}moveItem(e,t){this.comp.moveItem(e,t)}};import{RefPlaceholder as _k,_setAriaLabel as Gk,_setAriaLevel as Ok}from"ag-stack";import{Component as Nk}from"ag-grid-community";import{_setAriaLabel as Bk,_setAriaLabelledBy as Vk,_setDisplayed as Hk}from"ag-stack";import{AgInputTextFieldSelector as Uk,_stopPropagationForAgGrid as zk}from"ag-grid-community";import{RefPlaceholder as rp,_addOrRemoveAttribute as Wk,_clearElement as Ba,_debounce as Va,_exists as Kk,_fuzzySuggestions as $k,_getActiveDomElement as ip,_isElementOverflowingCallback as jk,_isEventFromPrintableCharacter as Yk,_isVisible as qk,_setAriaActiveDescendant as Zk,_setScrollLeft as np}from"ag-stack";import{AgInputTextFieldSelector as op,AgPickerField as Xk,ComponentInstanceGuard as Jk,KeyCode as pe,_addGridCommonParams as Qk,_clamp as e_,_createIconNoSpan as t_,_getEditorRendererDetails as s_,_stopPropagationForAgGrid as r_}from"ag-grid-community";import{_consoleError as Ha}from"ag-grid-community";var i_=100;function n_(e){const{host:t,source:s,useAsyncSearch:r,onMisconfiguredSearchSource:i,onFirstValuesPageLoaded:n}=e,o=new o_({host:t,source:s,onMisconfiguredSearchSource:i,onFirstValuesPageLoaded:n??(()=>{})}),a=typeof s.loadValuesPage=="function";return{controller:o,hasPagedSource:a,onSearch:r?l=>o.onSearch(l):void 0,onLoadMoreRows:a?l=>o.loadValuesPage(l??"down"):void 0}}var o_=class{constructor(e){this.ctrlParams=e,this.currentSearchRequest=0,this.currentValuesPageRequest=0,this.valuesPageLoading=!1,this.valuesPageHasMoreNext=!1,this.valuesPageHasMorePrev=!1,this.valuesPageLoadedValues=[],this.valuesPageSearch="",this.valuesPageWindowStartRow=0,this.destroyed=!1}destroy(){this.destroyed=!0,this.currentSearchRequest++,this.currentValuesPageRequest++}onSearch(e){if(this.destroyed)return;if(this.isValuesPaged()){this.resetValuesPage(e);return}const t=++this.currentSearchRequest,{host:s,source:r,onMisconfiguredSearchSource:i}=this.ctrlParams;if(s.setValueList({refresh:!0,valueList:void 0}),!e)return;if(typeof r.searchValues!="function"){i?.();return}let n;try{n=r.searchValues(e)}catch(o){Ha("Rich Select",o),t===this.currentSearchRequest&&s.setValueList({refresh:!0,valueList:[]});return}if(Array.isArray(n)){i?.(),s.setValueList({refresh:!0,valueList:n});return}s.setValueList({valueList:n.then(o=>{if(t===this.currentSearchRequest)return o}).catch(o=>{if(Ha("Rich Select",o),t===this.currentSearchRequest)return[]}),refresh:!0})}resetValuesPage(e){this.destroyed||(this.valuesPageSearch=e,this.valuesPageLoadedValues=[],this.valuesPageWindowStartRow=this.resolveValuesPageStartRow(e),this.valuesPageNextCursor=void 0,this.valuesPageHasMoreNext=!0,this.valuesPageHasMorePrev=this.valuesPageWindowStartRow>0,this.valuesPageLoading=!1,this.currentValuesPageRequest++,this.ctrlParams.host.setValueList({valueList:void 0,refresh:!0,isInitial:!0}),this.loadValuesPage("down"))}loadValuesPage(e){if(this.destroyed)return;const t=this.ctrlParams.source.loadValuesPage;if(typeof t!="function"||this.valuesPageLoading||e==="up"&&!this.valuesPageHasMorePrev||e==="down"&&!this.valuesPageHasMoreNext)return;const s=Math.max(this.ctrlParams.source.valuesPageSize??i_,1),r=e==="up"?Math.max(this.valuesPageWindowStartRow-s,0):this.valuesPageWindowStartRow+this.valuesPageLoadedValues.length,i=e==="up"?this.valuesPageWindowStartRow:r+s;if(r>=i){e==="up"?this.valuesPageHasMorePrev=!1:this.valuesPageHasMoreNext=!1;return}const n=this.currentValuesPageRequest,o={search:this.valuesPageSearch,startRow:r,endRow:i,cursor:e==="down"?this.valuesPageNextCursor:void 0};this.valuesPageLoading=!0,this.valuesPageLoadedValues.length===0&&this.ctrlParams.host.setIsLoading();let a;try{a=t(o)}catch(l){this.handleValuesPageError(l,n);return}Promise.resolve(a).then(l=>this.applyValuesPageResult(l,s,n,e,r,i)).catch(l=>this.handleValuesPageError(l,n))}applyValuesPageResult(e,t,s,r,i,n){if(this.destroyed||s!==this.currentValuesPageRequest)return;this.valuesPageLoading=!1;const o=this.valuesPageLoadedValues.length===0,a=e?.values??[];if(r==="up"){a.length&&(this.valuesPageLoadedValues=[...a,...this.valuesPageLoadedValues],this.valuesPageWindowStartRow=i);const l=n-i;this.valuesPageHasMorePrev=i>0&&a.length>=l}else{a.length&&(this.valuesPageLoadedValues=[...this.valuesPageLoadedValues,...a]),this.valuesPageNextCursor=e?.cursor;const l=this.valuesPageLoadedValues.length;typeof e?.lastRow=="number"?this.valuesPageHasMoreNext=this.valuesPageWindowStartRow+l<e.lastRow:e?.cursor!==void 0?this.valuesPageHasMoreNext=!!e.cursor:this.valuesPageHasMoreNext=a.length>=t}this.ctrlParams.host.setValueList({valueList:this.valuesPageLoadedValues,refresh:!0,isInitial:!0,scrollToCurrentValue:o,prependedRowCount:r==="up"?a.length:void 0}),o&&this.ctrlParams.onFirstValuesPageLoaded()}handleValuesPageError(e,t){Ha("Rich Select",e),!(this.destroyed||t!==this.currentValuesPageRequest)&&(this.valuesPageLoading=!1,this.valuesPageHasMoreNext=!1,this.valuesPageHasMorePrev=!1,this.ctrlParams.host.setValueList({valueList:this.valuesPageLoadedValues,refresh:!0,isInitial:!0}))}resolveValuesPageStartRow(e){if(e)return 0;const t=this.ctrlParams.source.valuesPageInitialStartRow?.(e);return Math.max(Math.floor(t??0),0)}isValuesPaged(){return typeof this.ctrlParams.source.loadValuesPage=="function"}};import{_clearElement as a_,_findFocusableElements as l_,_findNextFocusableElement as c_,_getActiveDomElement as Ua,_setAriaPosInSet as u_,_setAriaRole as d_,_setAriaSetSize as h_}from"ag-stack";import{Component as p_,KeyCode as Ut}from"ag-grid-community";import{RefPlaceholder as ap}from"ag-stack";import{Component as g_}from"ag-grid-community";var f_={tag:"div",cls:"ag-pill",role:"option",children:[{tag:"span",ref:"eText",cls:"ag-pill-text"},{tag:"span",ref:"eButton",cls:"ag-button ag-pill-button",role:"presentation"}]},m_=class extends fx{constructor(e){super(f_),this.config=e,this.eText=ap,this.eButton=ap}postConstruct(){const{config:e,eButton:t}=this,{onKeyDown:s,onButtonClick:r}=e;this.getGui().setAttribute("tabindex",String(this.gos.get("tabIndex"))),this.addGuiEventListener("focus",()=>{this.eButton.focus()}),s&&this.addGuiEventListener("keydown",s),r&&this.addManagedElementListeners(t,{click:r})}toggleCloseButtonClass(e,t){this.eButton.classList.toggle(e,t)}setText(e){this.eText.textContent=e}getText(){return this.eText.textContent}},v_={tag:"div",cls:"ag-pill-container"},C_=class extends mx{constructor(){super(v_),this.pills=[]}init(e){this.params=e,this.getKey=e.valueFormatter??String,this.refresh()}refresh(){this.clearPills();const{params:e,onPillKeyDown:t,getKey:s}=this;let r=e.getValue();if(!Array.isArray(r)){if(r==null)return;r=[r]}const i=e.valueFormatter??String,n=r.length;d_(this.getGui(),n===0?"presentation":"listbox");for(let o=0;o<n;o++){const a=r[o],l=this.createBean(new m_({onButtonClick:()=>this.onPillButtonClick(l),onKeyDown:t.bind(this)})),c=l.getGui();u_(c,o+1),h_(c,n),e.onPillMouseDown&&l.addGuiEventListener("mousedown",e.onPillMouseDown),e.announceItemFocus&&l.addGuiEventListener("focus",e.announceItemFocus),l.setText(i(a)??""),l.toggleCloseButtonClass("ag-icon-cancel",!0),this.appendChild(c),this.pills.push({key:s(a)??o.toString(),pill:l})}}onNavigationKeyDown(e){const{key:t}=e,s=this.gos.get("enableRtl"),r=!s&&t===Ut.LEFT||s&&t===Ut.RIGHT,i=!s&&t===Ut.RIGHT||s&&t===Ut.LEFT;if(!this.pills.length||!r&&!i)return;e.preventDefault();const{beans:n,params:o}=this,a=Ua(n),l=this.getGui(),c=l_(l);if(l.contains(a)){const u=c.find(h=>h.contains(a));u&&u!==a&&u.focus();const d=c_({beans:n,rootNode:l,backwards:r});d?d.focus():i&&o.focusAfterForwardBoundary?.()}else c.length>0&&c[i?0:c.length-1].focus()}clearPills(){const e=this.getGui();e.contains(Ua(this.beans))&&this.params.eWrapper&&this.params.eWrapper.focus(),a_(e),this.destroyBeans(this.pills.map(({pill:t})=>t)),this.pills=[]}onPillButtonClick(e){this.deletePill(e)}onPillKeyDown(e){const t=e.key;if(t===Ut.LEFT||t===Ut.RIGHT){e.stopPropagation(),this.params.onHorizontalArrowKeyDown?this.params.onHorizontalArrowKeyDown(e):this.onNavigationKeyDown(e);return}if(t!==Ut.DELETE&&t!==Ut.BACKSPACE)return;e.preventDefault();const s=Ua(this.beans),r=this.pills.findIndex(n=>n.pill.getGui().contains(s));if(r===-1)return;const i=this.pills[r];i?.pill&&this.deletePill(i.pill,r)}deletePill(e,t){const{getKey:s,pills:r,params:i}=this,n=(r[t??-1]??r.find(({pill:a})=>a===e))?.key,o=(i.getValue()??[]).filter(a=>s(a)!==n);if(i.setValue(o),!o.length)i.focusAfterDelete?i.focusAfterDelete():i.eWrapper?.focus();else if(t!=null){const a=this.pills;a[Math.min(t,a.length-1)]?.pill.getFocusableElement().focus()}}destroy(){this.clearPills(),super.destroy()}},b_=".ag-rich-select{cursor:default;height:100%}.ag-rich-select-value{align-items:center;background-color:var(--ag-picker-button-background-color);display:flex;height:100%;padding:var(--ag-spacing);:where(.ag-picker-field-display){overflow:hidden;text-overflow:ellipsis;&:where(.ag-display-as-placeholder){opacity:.5}}}.ag-virtual-list-viewport.ag-rich-select-list{background-color:var(--ag-picker-list-background-color);border:var(--ag-picker-list-border);border-radius:var(--ag-input-border-radius);box-shadow:var(--ag-dropdown-shadow);height:auto;position:relative;width:100%;:where(.ag-rich-select-loading){display:flex;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding);:where(.ag-loading-text){overflow:hidden;text-overflow:ellipsis}}}.ag-rich-select-no-matches{justify-content:center}.ag-rich-select-row{align-items:center;display:flex;flex:1 1 auto;height:100%;overflow:hidden;padding:0 var(--ag-spacing);white-space:nowrap}.ag-rich-select-row-selected{background-color:var(--ag-selected-row-background-color);@media (forced-colors:active){background-color:SelectedItem}}.ag-rich-select-row-highlighted,.ag-rich-select-row:hover{background-image:linear-gradient(var(--ag-row-hover-color),var(--ag-row-hover-color));@media (forced-colors:active){outline:2px solid CanvasText;outline-offset:-2px}}.ag-rich-select-row-text-highlight{font-weight:700}.ag-rich-select-field-input{flex:1 1 auto;:where(.ag-input-field-input){text-overflow:ellipsis;&::-moz-placeholder{opacity:.8}&::placeholder{opacity:.8}}}:where(.ag-ltr) .ag-rich-select-field-input{left:var(--ag-spacing)}:where(.ag-rtl) .ag-rich-select-field-input{right:var(--ag-spacing)}.ag-rich-select-typing-single{padding-inline-start:0}.ag-rich-select-typing-multi{:where(.ag-picker-field-display){flex:0 1 auto;max-width:100%;min-width:0}:where(.ag-rich-select-pill-display){align-items:center;display:flex;flex:0 1 auto;max-width:100%;min-width:0;overflow:hidden;:where(.ag-pill-container){flex:0 1 auto;max-width:100%;min-width:0;overflow:hidden}}:where(.ag-rich-select-field-input){--ag-input-padding-start:0;flex:0 0 auto;max-width:100%;min-width:0;:where(.ag-input-wrapper){flex:0 0 auto;max-width:100%}:where(.ag-input-field-input){max-width:100%;min-width:1ch;width:auto}}}:where(.ag-ltr) .ag-rich-select-typing-multi{:where(.ag-rich-select-field-input){margin-left:.25rem}:where(.ag-rich-select-deselect-button){margin-left:auto}:where(.ag-rich-select-deselect-button.ag-hidden+.ag-picker-field-icon){margin-left:auto}}:where(.ag-rtl) .ag-rich-select-typing-multi{:where(.ag-rich-select-field-input){margin-right:.25rem}:where(.ag-rich-select-deselect-button){margin-right:auto}:where(.ag-rich-select-deselect-button.ag-hidden+.ag-picker-field-icon){margin-right:auto}}:where(.ag-popup-editor) .ag-rich-select-value{height:var(--ag-row-height);min-width:200px}.ag-rich-select-virtual-list-item{cursor:default;height:var(--ag-list-item-height)}.ag-pill-container{display:flex;flex-wrap:nowrap;gap:.25rem;min-width:0}.ag-pill{align-items:center;background:var(--ag-select-cell-background-color);border:var(--ag-select-cell-border);border-radius:var(--ag-border-radius);display:flex;padding:0 .25rem;white-space:nowrap}.ag-pill-button{border:none;padding:0}:where(.ag-ltr) .ag-pill-button{margin-left:var(--ag-spacing)}:where(.ag-rtl) .ag-pill-button{margin-right:var(--ag-spacing)}.ag-pill-button:hover{color:var(--ag-accent-color);cursor:pointer}";import{_addOrRemoveAttribute as S_,_requestAnimationFrame as za,_setAriaActiveDescendant as y_,_setAriaLabel as w_,_setAriaLabelledBy as x_,_setDisplayed as hn}from"ag-stack";import{KeyCode as F_,_clamp as lp,_createElement as Wa,_createIconNoSpan as T_}from"ag-grid-community";import{_clearElement as cp,_exists as _r,_isElementOverflowingCallback as A_,_setAriaSelected as P_,_toString as R_}from"ag-stack";import{Component as M_,ComponentInstanceGuard as I_,_addGridCommonParams as E_,_createElement as up,_getEditorRendererDetails as D_}from"ag-grid-community";var L_={tag:"div",cls:"ag-rich-select-row",role:"presentation"},k_=class extends vx{constructor(e){super(L_),this.params=e,this.rendererGuard=new I_,this.valueFormatter=$a(e.valueFormatter)}wireBeans(e){this.userCompFactory=e.userCompFactory}postConstruct(){this.tooltipFeature=this.createOptionalManagedBean(this.beans.tooltipSvc?.createHighlightTooltip({getGui:()=>this.getGui(),getTooltipComponentDefinition:()=>{},getLocation:()=>"richSelectListItem",shouldDisplayTooltip:()=>this.shouldDisplayTooltip?.()??!0},this))}setState(e){const t=this.valueFormatter(e),s=this.rendererGuard.claim();this.cellRenderer=this.destroyBean(this.cellRenderer),this.shouldDisplayTooltip=void 0,this.tooltipFeature?.setTooltipAndRefresh(null),cp(this.getGui()),this.populateWithRenderer(e,t,s)||this.populateWithoutRenderer(e,t),this.value=e}highlightString(e){const{parsedValue:t,params:s}=this;if(s.cellRenderer||!_r(t))return;let r=_r(e);if(r){const i=t?.toLocaleLowerCase().indexOf(e.toLocaleLowerCase());if(i>=0){const n=i+e.length,o=this.getGui().querySelector("span");o&&(cp(o),o.append(t.slice(0,i),up({tag:"span",cls:"ag-rich-select-row-text-highlight",children:t.slice(i,n)}),t.slice(n)))}else r=!1}r||this.renderValueWithoutRenderer(t)}updateSelected(e){const t=this.getGui();P_(t.parentElement,e),this.toggleCss("ag-rich-select-row-selected",e)}getValue(){return this.value}toggleHighlighted(e){this.toggleCss("ag-rich-select-row-highlighted",e),this.dispatchLocalEvent({type:"itemHighlighted",highlighted:e})}populateWithoutRenderer(e,t){const s=this.getGui(),r=up({tag:"span"});r.style.overflow="hidden",r.style.textOverflow="ellipsis";const i=R_(_r(t)?t:e);this.parsedValue=_r(i)?i:null,s.appendChild(r),this.renderValueWithoutRenderer(i),this.shouldDisplayTooltip=A_(()=>r),this.tooltipFeature?.setTooltipAndRefresh(this.parsedValue)}renderValueWithoutRenderer(e){const t=this.getGui().querySelector("span");t&&(t.textContent=_r(e)?e:"\xA0")}populateWithRenderer(e,t,s){let r,i;const{cellRenderer:n,cellRendererParams:o}=this.params;if(n){const a=this.getParentComponent()?.getParentComponent();i=D_(this.userCompFactory,this.params,E_(this.gos,{value:e,valueFormatted:t,cellRendererParams:o,getValue:()=>a?.getValue(),setValue:l=>{a?.setValue(l,!0)},setTooltip:(l,c)=>{this.gos.assertModuleRegistered("Tooltip",3),s.isCurrent()&&(this.shouldDisplayTooltip=c,this.tooltipFeature?.setTooltipAndRefresh(l))}}))}return i&&(r=i.newAgStackInstance()),r?(gp(r,this.getGui(),a=>!this.isAlive()||!s.isCurrent()?(this.destroyBean(a),!1):(this.cellRenderer=a,!0)),!0):!1}destroy(){this.rendererGuard.invalidate(),this.cellRenderer=this.destroyBean(this.cellRenderer),super.destroy()}},dp="ag-rich-select-list",hp="ag-rich-select-row",pn=0,__=1,gn=2,Ka=3,G_=class extends Gs{constructor(e,t,s){super({cssIdentifier:"rich-select"}),this.params=e,this.richSelectWrapper=t,this.getSearchString=s,this.lastRowHovered=-1,this.selectedItems=new Set,this.loadingState=Ka,this.loadMoreRowsThreshold=10,this.valueFormatter=$a(e.valueFormatter),this.setComponentCreator(this.createRowComponent.bind(this)),this.setComponentUpdater(()=>{})}postConstruct(){super.postConstruct();const e=this.getLocaleTextFunc();this.loadingLabel=e("loadingOoo","Loading..."),this.noMatchesLabel=e("noMatches","No matches");const t=T_("richSelectLoading",this.beans,null);this.eLoadingIcon=Wa({tag:"span",cls:"ag-loading-icon",children:[t?()=>t:void 0]}),this.eStateCompLabel=Wa({tag:"span",cls:"ag-loading-text",children:this.loadingLabel}),this.eStateComp=Wa({tag:"div",cls:"ag-rich-select-loading",children:[()=>this.eLoadingIcon,{tag:"span",cls:"ag-loading-text",children:[()=>this.eStateCompLabel]}]}),this.appendChild(this.eStateComp);const{cellRowHeight:s,pickerAriaLabelKey:r,pickerAriaLabelValue:i}=this.params;s&&this.setRowHeight(s);const n=this.getGui(),o=this.getAriaElement();this.addManagedListeners(n,{mousemove:this.onMouseMove.bind(this),mouseout:this.onMouseOut.bind(this),mousedown:this.onMouseDown.bind(this),click:this.onClick.bind(this),scroll:this.onGuiScroll.bind(this)}),n.classList.add(dp);const a=`${dp}-${this.getCompId()}`;o.setAttribute("id",a);const l=e(r,i);w_(o,l),x_(o,this.richSelectWrapper.id)}setIsLoading(){this.setLoadingState(pn)}setLoadingState(e){const t=this.loadingState!==e,s=this.getStateAnnouncementText(this.loadingState),r=this.getStateAnnouncementText(e);this.loadingState=e,this.toggleStateComp(),this.toggleVisibility(),t&&(r||s)&&this.stateAnnouncementCallback?.(r)}toggleStateComp(){const{eStateComp:e,eStateCompLabel:t,eLoadingIcon:s,loadingState:r,loadingLabel:i,noMatchesLabel:n,params:o}=this;if(!e)return;const a=r===pn,l=r===gn&&!!o.allowNoResultsCopy;t.textContent=a?i:n,hn(s,a),e.classList.toggle("ag-rich-select-no-matches",l),hn(e,a||l)}shouldBeVisible(){return this.loadingState===gn?!!this.params.allowNoResultsCopy:this.loadingState!==Ka}toggleVisibility(e){const t=this.getGui();e===void 0?hn(t,this.shouldBeVisible()):hn(t,e),this.scheduleMaybeRequestMoreRows()}setLoadMoreRowsCallback(e,t=10){this.loadMoreRowsCallback=e,this.loadMoreRowsThreshold=Math.max(t,1),this.maybeRequestMoreRows()}setStateAnnouncementCallback(e){this.stateAnnouncementCallback=e}cancelStateAnnouncement(){this.getStateAnnouncementText(this.loadingState)&&this.stateAnnouncementCallback?.(void 0)}navigateToPage(e){const t=super.navigateToPage(e,this.lastRowHovered);return t!=null&&za(this.beans,()=>{if(!this.isAlive())return null;this.highlightIndex(t)}),t}drawVirtualRows(e){super.drawVirtualRows(e),this.refreshSelectedItems(),this.lastRowHovered!==-1&&this.updateRenderedHighlightState(this.lastRowHovered),this.reportContentWidth()}setContentWidthCallback(e){this.contentWidthCallback=e,this.getGui().classList.add("ag-virtual-list-grow-to-content")}reportContentWidth(){const e=this.contentWidthCallback;if(!e)return;let t=0;if(this.forEachRenderedRow(i=>{t=Math.max(t,i.getGui().getBoundingClientRect().width)}),t===0)return;const s=this.eContainer.getBoundingClientRect().width;if(t<=s)return;const r=this.getGui();e(Math.ceil(t+r.getBoundingClientRect().width-s))||(this.contentWidthCallback=void 0,r.classList.remove("ag-virtual-list-grow-to-content"))}highlightFilterMatch(e){this.forEachRenderedRow(t=>{t.highlightString(e)})}onNavigationKeyDown(e,t){za(this.beans,()=>{if(!this.currentList||!this.isAlive())return;const s=this.currentList.length,r=this.lastRowHovered,i=e===F_.DOWN?1:-1,n=lp(r===-1?0:r+i,0,s-1);this.highlightIndex(n),t()})}selectValue(e){if(!this.currentList||e==null)return!1;const t=this.getIndicesForValues(e),s=t.length>0;return s&&(this.refresh(),this.ensureIndexVisible(t[0]),this.refresh(!0)),this.selectListItems(Array.isArray(e)?e:[e]),s&&this.highlightIndex(t[0],!0),s}selectListItems(e,t=!1){t||this.selectedItems.clear();for(let s=0;s<e.length;s++){const r=e[s];this.findItemInSelected(r)===void 0&&this.selectedItems.add(r)}this.refreshSelectedItems()}getCurrentList(){return this.currentList}setCurrentList(e){const t=O_(e);this.setLoadingState(t),e??(e=[]),this.currentList=e,this.setModel({getRowCount:()=>e.length,getRow:s=>e[s],areRowsEqual:(s,r)=>s===r})}offsetHoveredIndexOnPrependedRows(e){e<=0||this.lastRowHovered<0||(this.lastRowHovered+=e)}restoreScrollOnPrependedRows(e,t){if(t<=0)return;const s=this.getGui(),r=this.getRowHeight(),i=e+t*r;this.awaitStable(()=>{this.isAlive()&&(s.scrollTop=i)})}getSelectedItems(){return this.selectedItems}getLastItemHovered(){return this.currentList?.[this.lastRowHovered]}highlightIndex(e,t){this.currentList&&(e<0||e>=this.currentList.length?(this.lastRowHovered=-1,this.setActiveOption()):(this.lastRowHovered=e,this.ensureIndexVisible(e,!t)&&!t&&this.refresh(!0)),this.updateRenderedHighlightState(e))}updateRenderedHighlightState(e){let t;this.forEachRenderedRow((s,r)=>{const i=e===r;s.toggleHighlighted(i),i&&(t=`${hp}-${s.getCompId()}`)}),this.setActiveOption(t)}setActiveOption(e){y_(this.richSelectWrapper,e??null),S_(this.richSelectWrapper,"data-active-option",e)}getIndicesForValues(e){const{currentList:t}=this;if(!t||t.length===0||e===void 0)return[];const s=Array.isArray(e)?e:[e];if(s.length===0)return[];const r=[];let i;for(const n of s){let o=t.indexOf(n);if(o===-1&&n!=null){i??(i=t.map(l=>this.valueFormatter(l)));const a=this.getComparableFormattedValue(n);o=i.indexOf(a)}o>=0&&r.push(o)}return r}toggleListItemSelection(e){const t=this.findItemInSelected(e);t!==void 0?this.selectedItems.delete(t):this.selectedItems.add(e),this.refreshSelectedItems(),this.dispatchValueSelected()}refreshSelectedItems(){this.forEachRenderedRow(e=>{const t=this.findItemInSelected(e.getValue())!==void 0;e.updateSelected(t)})}findItemInSelected(e){if(typeof e=="object"){if(this.selectedItems.has(e))return e;const t=this.valueFormatter(e);for(const s of this.selectedItems)if(this.valueFormatter(s)===t)return s}else return this.selectedItems.has(e)?e:void 0}getComparableFormattedValue(e){return e!=null&&typeof e=="object"?this.valueFormatter(e):String(e??"")}createRowComponent(e,t){const s=new k_(this.params);t.setAttribute("id",`${hp}-${s.getCompId()}`),s.setParentComponent(this),this.createBean(s),s.setState(e);const{highlightMatch:r,searchType:i="fuzzy"}=this.params;return r&&i!=="fuzzy"&&s.highlightString(this.getSearchString()),s}getRowForMouseEvent(e){if(!this.model)return-1;const s=this.getGui().getBoundingClientRect(),r=this.getScrollTop(),i=e.clientY-s.top+r;return lp(Math.floor(i/this.getRowHeight()),0,this.model.getRowCount()-1)}onMouseMove(e){const t=this.getRowForMouseEvent(e);t!==-1&&t!=this.lastRowHovered&&(this.lastRowHovered=t,this.highlightIndex(t,!0))}onGuiScroll(){this.maybeRequestMoreRows(!0)}scheduleMaybeRequestMoreRows(){if(this.beans){za(this.beans,()=>this.maybeRequestMoreRows(!1));return}this.maybeRequestMoreRows(!1)}maybeRequestMoreRows(e=!1){const t=this.loadMoreRowsCallback,s=this.currentList;if(!t||!s||this.loadingState===pn)return;const r=this.getGui();if(r.clientHeight<=0)return;const n=(r.scrollHeight-(r.scrollTop+r.clientHeight))/this.getRowHeight(),o=r.scrollTop/this.getRowHeight(),a=r.scrollHeight>r.clientHeight;o<=this.loadMoreRowsThreshold&&(e||!a)&&t("up"),n<=this.loadMoreRowsThreshold&&t("down")}getStateAnnouncementText(e){if(e===pn)return this.loadingLabel;if(e===gn&&this.params.allowNoResultsCopy)return this.noMatchesLabel}onMouseDown(e){e.preventDefault()}onMouseOut(e){this.getGui().contains(e.relatedTarget)||this.highlightIndex(-1)}onClick(e){const{multiSelect:t}=this.params;if(!this.currentList?.length)return;const s=this.getRowForMouseEvent(e),r=this.currentList[s];t?this.toggleListItemSelection(r):(this.selectListItems([r]),this.dispatchValueSelected())}dispatchValueSelected(){this.dispatchLocalEvent({type:"richSelectListRowSelected",fromEnterKey:!1,value:this.selectedItems})}destroy(){this.cancelStateAnnouncement(),super.destroy(),this.eStateComp=void 0}};function O_(e){return e?e.length?__:gn:Ka}var pp=300,N_={tag:"div",cls:"ag-picker-field",role:"presentation",children:[{tag:"div",ref:"eLabel"},{tag:"div",ref:"eWrapper",cls:"ag-wrapper ag-picker-field-wrapper ag-rich-select-value ag-picker-collapsed",children:[{tag:"span",ref:"eDisplayField",cls:"ag-picker-field-display"},{tag:"ag-input-text-field",ref:"eInput",cls:"ag-rich-select-field-input"},{tag:"span",ref:"eDeselect",cls:"ag-rich-select-deselect-button ag-picker-field-icon",role:"presentation"},{tag:"span",ref:"eIcon",cls:"ag-picker-field-icon",attrs:{"aria-hidden":"true"}}]}]},fn=class extends Cx{constructor(e){const t=$a(e?.valueFormatter),s=e?.agComponents?.includes(op)?e.agComponents:[op,...e?.agComponents??[]];super({...e,pickerAriaLabelKey:e?.pickerAriaLabelKey??"ariaLabelRichSelectField",pickerAriaLabelValue:e?.pickerAriaLabelValue??"Rich Select Field",pickerType:e?.pickerType??"ag-list",className:e?.className??"ag-rich-select",pickerIcon:e?.pickerIcon??"richSelectOpen",ariaRole:e?.ariaRole??"combobox",template:e?.template??N_,agComponents:s,modalPicker:e?.modalPicker??!1,valueFormatter:t,maxPickerHeight:e?.maxPickerHeight??"calc(var(--ag-row-height) * 6.5)"}),this.searchString="",this.loadMoreRowsThreshold=10,this.hasPagedAsyncSource=!1,this.searchStringCreator=null,this.eInput=rp,this.eDeselect=rp,this.skipWrapperAnnouncement=!1,this.selectedValueRendererGuard=new Jk,this.onPillHorizontalArrowKeyDown=l=>{this.handleHorizontalNavigationKey(l)},this.valueFormatter=t;const{value:r,valueList:i,searchStringCreator:n,onSearch:o}=e??{};r!==void 0&&(this.value=r),n&&(this.searchStringCreator=n),i!=null&&this.setValueList({valueList:i,isInitial:!0});const{searchDebounceDelay:a=pp}=this.config;o&&(this.onSearchCallbackDebounced=Va(this,o,a)),this.registerCSS(b_)}wireBeans(e){this.userCompFactory=e.userCompFactory,this.ariaAnnounce=e.ariaAnnounce}postConstruct(){this.tooltipFeature=this.createOptionalManagedBean(this.beans.tooltipSvc?.createTooltip({getGui:()=>this.getGui(),getTooltipComponentDefinition:()=>{},getLocation:()=>"richSelectValue",shouldDisplayTooltip:()=>this.shouldDisplayTooltip?.()??!0})),super.postConstruct(),this.createListComponent(),this.eDeselect.appendChild(t_("richSelectRemove",this.beans));const{allowTyping:e,placeholder:t,multiSelect:s,searchIcon:r,suppressDeselectAll:i,suppressMultiSelectPillRenderer:n}=this.config;this.eDeselect.classList.add("ag-hidden"),e?(this.eInput.setAutoComplete(!1).setInputPlaceholder(t).setSearchIcon(!!r).setFrameless(!0),s?(this.eWrapper.classList.add("ag-rich-select-typing-multi"),n||this.eDisplayField.classList.add("ag-rich-select-pill-display")):(this.eDisplayField.classList.add("ag-hidden"),this.eWrapper.classList.add("ag-rich-select-typing-single"))):this.eInput.setDisplayed(!1),this.setupAriaProperties();const{searchDebounceDelay:o=300}=this.config;this.clearSearchString=Va(this,this.clearSearchString.bind(this),o),this.renderSelectedValue(),e&&this.eInput.onValueChange(a=>{this.openPickerOnTypingIfNeeded(a),this.updateTypingMultiSelectPlaceholder(a),this.searchTextFromString(a)}),this.addManagedElementListeners(this.eWrapper,{focus:this.onWrapperFocus.bind(this)}),this.addManagedElementListeners(this.eWrapper,{focusout:this.onWrapperFocusOut.bind(this)}),i||this.addManagedElementListeners(this.eDeselect,{mousedown:this.onDeselectAllMouseDown.bind(this),click:this.onDeselectAllClick.bind(this)})}setupAriaProperties(){const{eWrapper:e,gos:t}=this;e.tabIndex=t.get("tabIndex");const s=this.getLocaleTextFunc();this.ariaDeleteSelection=s("ariaLabelRichSelectDeleteSelection","Press DELETE to deselect item"),this.ariaDeselectAllItems=s("ariaLabelRichSelectDeselectAllItems","Press DELETE to deselect all items"),this.ariaToggleSelection=s("ariaLabelRichSelectToggleSelection","Press SPACE to toggle selection")}createListComponent(){this.listComponent=this.createBean(new G_(this.config,this.getFocusableElement(),()=>this.searchString)),this.listComponent.setLoadMoreRowsCallback(this.loadMoreRowsCallback,this.loadMoreRowsThreshold),this.listComponent.setStateAnnouncementCallback(e=>{e?this.ariaAnnounce?.announceValue(e,"richSelectState"):this.ariaAnnounce?.cancelAnnouncement("richSelectState")}),this.listComponent.setParentComponent(this),this.setAriaControlsId(this.listComponent.getAriaElement().id),this.addManagedListeners(this.listComponent,{richSelectListRowSelected:e=>{this.onListValueSelected(e.value,e.fromEnterKey)}})}renderSelectedValue(e){const{value:t,eDisplayField:s,config:r,gos:i}=this,{allowTyping:n,cellRenderer:o,cellRendererParams:a,initialInputValue:l,multiSelect:c,suppressDeselectAll:u,suppressMultiSelectPillRenderer:d,onSearch:h}=r,p=this.valueFormatter(t),g=!!(n&&c),f=this.selectedValueRendererGuard.claim();if(this.destroySelectedValueRenderer(),this.shouldDisplayTooltip=void 0,this.tooltipFeature?.setTooltipAndRefresh(null),n){const C=g?l??this.eInput.getValue()??"":l??(t===""?"":p);if(this.eInput.setValue(C,!!e&&!!h),!g)return;this.updateTypingMultiSelectPlaceholder(C)}if(c&&!u){const C=t==null||Array.isArray(t)&&t.length===0;this.eDeselect.classList.toggle("ag-hidden",C)}let m;if(c&&!d){this.createOrUpdatePillContainer(s);return}o&&!n&&(m=s_(this.userCompFactory,r,Qk(this.gos,{value:t,valueFormatted:p,cellRendererParams:a,getValue:()=>this.getValue(),setValue:C=>{this.setValue(C,!0)},setTooltip:(C,b)=>{i.assertModuleRegistered("Tooltip",3),f.isCurrent()&&(this.shouldDisplayTooltip=b,this.tooltipFeature?.setTooltipAndRefresh(C))}})));let v;if(m&&(v=m.newAgStackInstance()),v)Ba(s),gp(v,s,C=>!this.isAlive()||!f.isCurrent()?(this.destroyBean(C),!1):(this.selectedValueRenderer=C,!0));else{if(t!=null)s.innerText=p,s.classList.remove("ag-display-as-placeholder");else{const{placeholder:C}=r;Kk(C)?(s.textContent=C,s.classList.add("ag-display-as-placeholder")):Ba(s)}this.shouldDisplayTooltip=jk(()=>this.eDisplayField),this.tooltipFeature?.setTooltipAndRefresh(p??null)}}destroySelectedValueRenderer(){this.selectedValueRenderer&&(this.selectedValueRenderer=this.destroyBean(this.selectedValueRenderer))}createPickerComponent(){const{values:e}=this;return e&&this.setValueList({valueList:e}),this.listComponent}setSearchStringCreator(e){this.searchStringCreator=e}setAsyncValuesSource(e){const{source:t,thresholdRows:s,useAsyncSearch:r,onMisconfiguredSearchSource:i,onFirstValuesPageLoaded:n}=e;this.asyncRequests?.destroy();const o=n_({host:{setValueList:a=>this.setValueList(a),setIsLoading:()=>this.setIsLoading()},source:t,useAsyncSearch:r,onMisconfiguredSearchSource:i,onFirstValuesPageLoaded:n});if(this.asyncRequests=o.controller,this.hasPagedAsyncSource=o.hasPagedSource,o.onSearch){const{searchDebounceDelay:a=pp}=this.config;this.onSearchCallbackDebounced=Va(this,o.onSearch,a)}else this.config.onSearch||(this.onSearchCallbackDebounced=void 0);this.setLoadMoreRowsCallback(o.onLoadMoreRows,s??this.loadMoreRowsThreshold)}resetAsyncValues(e=""){this.hasPagedAsyncSource&&this.asyncRequests?.resetValuesPage(e)}setLoadMoreRowsCallback(e,t=10){this.loadMoreRowsCallback=e,this.loadMoreRowsThreshold=Math.max(t,1),this.listComponent?.setLoadMoreRowsCallback(this.loadMoreRowsCallback,this.loadMoreRowsThreshold)}setIsLoading(){this.listComponent?.setIsLoading()}setValueListInternal(e){const{listComponent:t,isPickerDisplayed:s,value:r}=this,{valueList:i,refresh:n,isInitial:o,scrollToCurrentValue:a=!0,prependedRowCount:l=0}=e;if(o&&this.setValues(i),!t)return;const c=l>0?t.getScrollTop():void 0;if(l>0&&t.offsetHoveredIndexOnPrependedRows(l),t.setCurrentList(i),!!n){if(s&&c!=null&&l>0&&t.restoreScrollOnPrependedRows?.(c,l),this.values){t.refresh(!0);const u=r!=null&&t.getIndicesForValues(r).length>0;s&&u&&a&&t.selectValue(r)}else s&&(t.selectValue(r)||t.refresh());this.alignPickerToComponent()}}setValueList(e){const{valueList:t}=e;if(!t||Array.isArray(t)){this.setValueListInternal(e);return}this.listComponent?.setIsLoading(),t.then(s=>{s!==void 0&&this.setValueListInternal({...e,valueList:s})}).catch(()=>{this.setValueListInternal({...e,valueList:[],refresh:!0})})}setValues(e){this.values=e,this.searchStrings=this.getSearchStringsFromValues(e??[])}showPicker(){const{listComponent:e,value:t}=this;if(!e)return;super.showPicker();const s=t??null;e.selectValue(s);const r=e.getIndicesForValues(s)[0];r!=null?(this.tooltipFeature?.attemptToHideTooltip(),e.highlightIndex(r)):e.refresh()}beforeHidePicker(){super.beforeHidePicker(),this.listComponent?.cancelStateAnnouncement()}createOrUpdatePillContainer(e){if(!this.pillContainer){const s=this.pillContainer=this.createBean(new C_);this.addDestroyFunc(()=>{this.destroyBean(this.pillContainer),this.pillContainer=null}),Ba(e),e.appendChild(s.getGui());const{config:r,eWrapper:i,ariaDeleteSelection:n}=this;s.init({eWrapper:i,valueFormatter:this.valueFormatter,onPillMouseDown:o=>{o.stopImmediatePropagation()},announceItemFocus:()=>{this.announceAriaValue(n)},focusAfterDelete:r.allowTyping?()=>this.focusTypingInputAtBoundary():void 0,focusAfterForwardBoundary:r.allowTyping?()=>this.focusTypingInputAtBoundary():void 0,onHorizontalArrowKeyDown:this.onPillHorizontalArrowKeyDown,getValue:()=>this.getValue(),setValue:o=>this.setValue(o,!0)})}const t=this.pillContainer.getGui().childElementCount;this.doWhileBlockingAnnouncement(()=>this.pillContainer?.refresh()),this.scrollTypingMultiSelectPillsToEndOnAdd(t)}scrollTypingMultiSelectPillsToEndOnAdd(e){const{allowTyping:t,multiSelect:s,suppressMultiSelectPillRenderer:r}=this.config;if(!t||!s||r)return;const i=this.pillContainer?.getGui();!i||i.childElementCount<=e||np(i,i.scrollWidth,this.isRtl())}doWhileBlockingAnnouncement(e){this.skipWrapperAnnouncement=!0,e(),this.skipWrapperAnnouncement=!1}isPreviousHorizontalNavigation(e){return e===pe.LEFT!==this.isRtl()}isRtl(){return!!this.gos?.get("enableRtl")}isTypingInputAtPillBoundary(){const e=this.eInput.getInputElement(),{selectionStart:t,selectionEnd:s,value:r}=e;return t==null||s==null||t!==s?!1:this.isRtl()?t===(r??"").length:t===0}focusTypingInputAtBoundary(){const e=this.eInput.getInputElement();e.focus();const t=this.isRtl()?e.value.length:0;e.setSelectionRange(t,t)}getActiveElementForKeyboardNavigation(){if(this.beans?.eRootDiv)return ip(this.beans);const e=this.getTypingInputElement();return e?e.ownerDocument?.activeElement??document.activeElement:document.activeElement}onWrapperFocus(){const{eInput:e,config:t}=this,{allowTyping:s,multiSelect:r,suppressDeselectAll:i}=t;if(s){const n=e.getFocusableElement();n.focus(),n.select()}else r&&!i&&!this.skipWrapperAnnouncement&&this.announceAriaValue(this.ariaDeselectAllItems)}onWrapperFocusOut(e){this.eWrapper.contains(e.relatedTarget)||this.hidePicker()}onDeselectAllMouseDown(e){e.stopImmediatePropagation()}onDeselectAllClick(){this.setValue([],!0)}buildSearchStringFromKeyboardEvent(e){let{key:t}=e;if(t===pe.BACKSPACE)this.searchString=this.searchString.slice(0,-1),t="";else if(!Yk(e))return;e.preventDefault(),this.searchTextFromCharacter(t)}searchTextFromCharacter(e){this.searchString+=e,this.runSearch(),this.clearSearchString()}searchTextFromString(e){e??(e=""),this.searchString=e,this.onSearchCallbackDebounced&&this.setValueList({valueList:void 0,refresh:!0}),this.runSearch()}getSearchStringsFromValues(e){return typeof e[0]=="object"&&this.searchStringCreator?this.searchStringCreator(e):e.map(t=>t===""?"":this.valueFormatter(t))}filterListModel(e){const{filterList:t}=this.config;t&&this.setValueList({valueList:e,refresh:!0})}runSearch(){if(!this.listComponent)return;if(this.onSearchCallbackDebounced){this.onSearchCallbackDebounced(this.searchString);return}const e=this.searchStrings;if(!e){this.listComponent.highlightIndex(-1);return}const{suggestions:t,filteredValues:s}=this.getSuggestionsAndFilteredValues(this.searchString,e),{filterList:r,highlightMatch:i,searchType:n="fuzzy"}=this.config,o=!!(r&&this.searchString!=="");this.filterListModel(o?s:this.values??[]),this.highlightEmptyValue()||this.highlightListValue(t,s,o),i&&n!=="fuzzy"&&this.listComponent?.highlightFilterMatch(this.searchString),this.listComponent?.toggleVisibility()}highlightEmptyValue(){if(this.searchString===""){const e=this.searchStrings?.indexOf("");if(e!==void 0&&e!==-1)return this.listComponent?.highlightIndex(e),!0}return!1}highlightListValue(e,t,s){if(e.length){const r=s?0:this.searchStrings?.indexOf(e[0]);r!==void 0&&this.listComponent?.highlightIndex(r)}else if(this.listComponent?.highlightIndex(-1),!s||t.length)this.listComponent?.ensureIndexVisible(0);else if(s){const r=this.getFocusableElement();Wk(r,"data-active-option",null),Zk(r,null)}}getSuggestionsAndFilteredValues(e,t){let s=[];const r=[];if(!e.length)return{suggestions:s,filteredValues:r};const{searchType:i="fuzzy",filterList:n}=this.config,o=this.values??[];if(i==="fuzzy"){const a=$k({inputValue:e,allSuggestions:t,hideIrrelevant:!0});s=a.values;const l=a.indices;if(n&&l.length)for(let c=0;c<l.length;c++)r.push(o[l[c]])}else s=t.filter((a,l)=>{const c=a.toLocaleLowerCase(),u=this.searchString.toLocaleLowerCase(),d=i==="match"?c.startsWith(u):c.includes(u);return n&&d&&r.push(o[l]),d});return{suggestions:s,filteredValues:r}}clearSearchString(){this.searchString=""}setValue(e,t,s,r){if(this.value===e)return this.updateTypingMultiSelectPlaceholder(),this;const i=Array.isArray(e);if(e!=null){if(!i&&!this.listComponent?.getIndicesForValues(e)?.length)return this;s||this.listComponent?.selectValue(e)}return super.setValue(e,t),r?this.updateTypingMultiSelectPlaceholder():this.renderSelectedValue(s),this}onNavigationKeyDown(e,t,s){e.preventDefault();const r=t===pe.DOWN;if(!this.isPickerDisplayed&&r){this.showPicker();return}this.listComponent?.onNavigationKeyDown(t,s)}onEnterKeyDown(e){const t=!!(this.config.allowTyping&&this.config.multiSelect);if(!this.isPickerDisplayed){t&&(e.preventDefault(),this.dispatchPickerEventAndHidePicker(this.value,!0,e));return}if(e.preventDefault(),this.listComponent?.getCurrentList()){const s=this.listComponent.getLastItemHovered();if(t){if(s!==void 0){const r=this.getCurrentSelectionWithAppendedItem(s);this.listComponent.selectValue(r),this.setValue(r,!1,!0),this.resetTypingMultiSelectSearchState(),this.hidePicker()}return}this.config.multiSelect||s===void 0?this.dispatchPickerEventAndHidePicker(this.value,!0,e):this.onListValueSelected(new Set([s]),!0,e)}}getCurrentSelectionWithAppendedItem(e){const t=this.getValue(),s=Array.isArray(t)?[...t]:t!=null?[t]:[];return s.some(r=>this.areValuesEquivalent(r,e))||s.push(e),s}areValuesEquivalent(e,t){return e===t?!0:typeof e=="object"&&typeof t=="object"&&e!=null&&t!=null?this.valueFormatter(e)===this.valueFormatter(t):!1}resetTypingMultiSelectSearchState(){if(this.searchString="",this.eInput.setValue("",!0),this.onSearchCallbackDebounced){this.setValueList({valueList:void 0,refresh:!0});return}this.config.filterList&&this.values&&this.setValueList({valueList:this.values,refresh:!0})}updateTypingMultiSelectPlaceholder(e){const{allowTyping:t,multiSelect:s,placeholder:r}=this.config;if(!t||!s)return;const i=e??this.eInput.getValue()??"",n=i.length>0,o=this.value,a=(Array.isArray(o)?o.length>0:o!=null)||(this.listComponent?.getSelectedItems().size??0)>0,l=!n&&!a?r:"";this.eInput.setInputPlaceholder(l),this.updateTypingMultiSelectInputSize(i,l)}updateTypingMultiSelectInputSize(e,t){const s=this.getTypingInputElement();if(!s)return;const i=e_((e||t||"").length+1,1,32);if(s.size!==i&&(s.size=i),e){const n=this.pillContainer?.getGui();n&&np(n,n.scrollWidth,this.isRtl())}}getTypingInputElement(){const e=this.eInput.getInputElement;if(typeof e=="function")return e.call(this.eInput)}openPickerOnTypingIfNeeded(e){const{isPickerDisplayed:t,config:{allowTyping:s,multiSelect:r}}=this;s&&r&&!t&&e&&this.showPicker()}onDeleteKeyDown(e){const{eWrapper:t,beans:s}=this;ip(s)===t&&(e.preventDefault(),this.setValue([],!0))}onBackspaceKeyDown(e){if(!this.isTypingInputAtPillBoundary())return;const t=this.getValue(),s=Array.isArray(t)?t:t!=null?[t]:Array.from(this.listComponent?.getSelectedItems()??[]);s.length&&(e.preventDefault(),this.setValue(s.slice(0,-1),!0))}onTabKeyDown(){const{config:e,isPickerDisplayed:t,listComponent:s}=this,{multiSelect:r}=e;if(!(!t||!s)){if(r){const i=this.getValueFromSet(s.getSelectedItems());i&&this.setValue(i,!1,!0,!0)}else{const i=s.getLastItemHovered();i!==void 0&&this.setValue(i,!1,!0)}this.hidePicker()}}getValueFromSet(e){const{multiSelect:t}=this.config;if(!t)return e.size?e.values().next().value:null;const s=Array.from(e);return s.length?s:null}onListValueSelected(e,t,s){const r=this.getValueFromSet(e);this.setValue(r,!1,!0);const{multiSelect:i,allowTyping:n}=this.config;i&&n?(this.resetTypingMultiSelectSearchState(),this.hidePicker()):i||this.dispatchPickerEventAndHidePicker(r,t,s)}dispatchPickerEventAndHidePicker(e,t,s){const r={type:"fieldPickerValueSelected",fromEnterKey:t,value:e,keyboardEvent:s};this.dispatchLocalEvent(r),this.hidePicker()}getFocusableElement(){const{allowTyping:e}=this.config;return e?this.eInput.getFocusableElement():super.getFocusableElement()}handleHorizontalNavigationKey(e){const{allowTyping:t,multiSelect:s}=this.config;if(!t){e.preventDefault(),this.listComponent?.highlightIndex(-1),this.pillContainer?.onNavigationKeyDown(e);return}const r=this.pillContainer;if(!r||!s)return;const i=this.getActiveElementForKeyboardNavigation(),n=this.isPreviousHorizontalNavigation(e.key),o=this.eInput.getInputElement();if(i===o){n&&this.isTypingInputAtPillBoundary()&&(this.listComponent?.highlightIndex(-1),r.onNavigationKeyDown(e));return}if(r.getGui().contains(i)){this.listComponent?.highlightIndex(-1);const a=i;r.onNavigationKeyDown(e),!n&&this.getActiveElementForKeyboardNavigation()===a&&this.focusTypingInputAtBoundary()}}handlePageNavigationKey(e,t){const{allowTyping:s}=this.config;if(s&&(t===pe.PAGE_HOME||t===pe.PAGE_END)){e.preventDefault();const r=this.eInput.getInputElement(),i=t===pe.PAGE_HOME?0:r.value.length;r.setSelectionRange(i,i);return}e.preventDefault(),this.pickerComponent&&this.listComponent?.navigateToPage(t)}handleVerticalNavigationKey(e,t,s){s||this.onNavigationKeyDown(e,t,()=>{this.config.multiSelect&&(this.doWhileBlockingAnnouncement(()=>this.eWrapper.focus()),this.announceAriaValue(this.ariaToggleSelection))})}handleEscapeKey(e){this.isPickerDisplayed&&(qk(this.listComponent.getGui())&&(e.preventDefault(),r_(e)),this.hidePicker())}handleEnterKey(e,t){if(t){e.preventDefault();return}this.onEnterKeyDown(e)}handleSpaceKey(e,t){const{allowTyping:s,multiSelect:r}=this.config,{isPickerDisplayed:i,listComponent:n}=this,o=!t&&i&&r&&!!n&&(!s||(this.eInput.getValue()??"")==="");if((!s||t||o)&&e.preventDefault(),o&&n){const a=n.getLastItemHovered();a!==void 0&&n.toggleListItemSelection(a)}}handleBackspaceKey(e,t){!t&&this.config.allowTyping&&this.config.multiSelect&&this.onBackspaceKeyDown(e)}handleDeleteKey(e){this.config.multiSelect&&!this.config.suppressDeselectAll&&this.onDeleteKeyDown(e)}handleSearchWithoutTyping(e){this.config.allowTyping||this.buildSearchStringFromKeyboardEvent(e)}onKeyDown(e){const{key:t,isComposing:s}=e;switch(t){case pe.LEFT:case pe.RIGHT:this.handleHorizontalNavigationKey(e);break;case pe.PAGE_HOME:case pe.PAGE_END:case pe.PAGE_UP:case pe.PAGE_DOWN:this.handlePageNavigationKey(e,t);break;case pe.DOWN:case pe.UP:this.handleVerticalNavigationKey(e,t,s);break;case pe.ESCAPE:this.handleEscapeKey(e);break;case pe.ENTER:this.handleEnterKey(e,s);break;case pe.SPACE:this.handleSpaceKey(e,s);break;case pe.BACKSPACE:this.handleBackspaceKey(e,s);break;case pe.TAB:this.onTabKeyDown();break;case pe.DELETE:this.handleDeleteKey(e);break;default:this.handleSearchWithoutTyping(e)}}announceAriaValue(e){this.ariaAnnounce?.announceValue(e,"richSelect")}destroy(){this.selectedValueRendererGuard.invalidate(),this.destroySelectedValueRenderer(),this.asyncRequests?.destroy(),this.asyncRequests=void 0,this.hasPagedAsyncSource=!1,this.listComponent&&(this.listComponent=this.destroyBean(this.listComponent)),this.searchStrings=void 0,super.destroy()}};function gp(e,t,s){e.then(r=>{if(!r||s&&!s(r))return;const i=r.getGui();i!=null&&t.appendChild(i)})}function $a(e){return t=>e?.(t)??String(t??"")}var B_={tag:"div",cls:"ag-picker-field",role:"presentation",children:[{tag:"div",ref:"eLabel"},{tag:"div",ref:"eWrapper",cls:"ag-wrapper ag-picker-collapsed",children:[{tag:"div",ref:"eDisplayField",cls:"ag-picker-field-display"},{tag:"ag-input-text-field",ref:"eInput",cls:"ag-rich-select-field-input"},{tag:"span",ref:"eDeselect",cls:"ag-rich-select-deselect-button ag-picker-field-icon",role:"presentation"},{tag:"div",ref:"eIcon",cls:"ag-picker-field-icon",attrs:{"aria-hidden":"true"}}]}]},fp=class extends fn{constructor(e){super({...e,template:B_,agComponents:[Uk]}),this.params=e}showPicker(){setTimeout(()=>super.showPicker())}hidePicker(){setTimeout(()=>super.hidePicker())}postConstruct(){super.postConstruct();const{wrapperClassName:e,ariaLabel:t}=this.params;Hk(this.eDisplayField,!1),e&&this.eWrapper.classList.add(e),Vk(this.eWrapper,""),Bk(this.eWrapper,t)}onEnterKeyDown(e){zk(e),this.isPickerDisplayed?super.onEnterKeyDown(e):(e.preventDefault(),this.showPicker())}};import{_getActiveDomElement as mp}from"ag-stack";import{BeanStub as V_,KeyCode as Gr,_isStopPropagationForAgGrid as vp,_stopPropagationForAgGrid as mn}from"ag-grid-community";var Cp=class extends bx{constructor(e,t,s){super(),this.eGui=e,this.focusWrapper=t,this.eFocusableComp=s}postConstruct(){this.addManagedElementListeners(this.eGui,{keydown:t=>{switch(t.key){case Gr.TAB:t.defaultPrevented||mn(t);break;case Gr.UP:case Gr.DOWN:mn(t);break;case Gr.ESCAPE:if(vp(t))return;this.eGui.contains(mp(this.beans))&&(t.preventDefault(),mn(t),this.focusWrapper.focus());break}}});const e="ag-advanced-filter-builder-virtual-list-item-highlight";this.addManagedListeners(this.focusWrapper,{keydown:t=>{if(t.key===Gr.ENTER){if(vp(t))return;mp(this.beans)===this.focusWrapper&&(t.preventDefault(),mn(t),this.eFocusableComp.getFocusableElement().focus())}},focusin:()=>{this.focusWrapper.classList.add(e)},focusout:t=>{this.focusWrapper.contains(t.relatedTarget)||this.focusWrapper.classList.remove(e)}})}};function bp(e,t){return{pickerAriaLabelKey:"ariaLabelAdvancedFilterBuilderAddField",pickerAriaLabelValue:"Advanced Filter Builder Add Field",pickerType:"ag-list",valueList:[{key:"condition",displayValue:e("advancedFilterBuilderAddCondition")},{key:"join",displayValue:e("advancedFilterBuilderAddJoin")}],valueFormatter:s=>s==null?"":s.displayValue??s.key,pickerIcon:"advancedFilterBuilderAdd",maxPickerWidth:`${t??120}px`,wrapperClassName:"ag-advanced-filter-builder-item-button",ariaLabel:e("advancedFilterBuilderAddButtonTooltip")}}var H_={tag:"div",cls:"ag-advanced-filter-builder-item-wrapper",role:"presentation",children:[{tag:"div",ref:"eItem",cls:"ag-advanced-filter-builder-item",role:"presentation",children:[{tag:"div",cls:"ag-advanced-filter-builder-item-tree-lines",attrs:{"aria-hidden":"true"},children:[{tag:"div",cls:"ag-advanced-filter-builder-item-tree-line ag-advanced-filter-builder-item-tree-line-vertical-top ag-advanced-filter-builder-item-tree-line-horizontal"}]}]}]},U_=class extends Sx{constructor(e,t){super(H_),this.item=e,this.focusWrapper=t,this.eItem=_k}wireBeans(e){this.advFilterExpSvc=e.advFilterExpSvc}postConstruct(){Ok(this.focusWrapper,2);const e=bp(s=>this.advFilterExpSvc.translate(s),this.gos.get("advancedFilterBuilderParams")?.addSelectWidth),t=this.createManagedBean(new fp(e));this.addManagedListeners(t,{fieldPickerValueSelected:({value:s})=>{this.dispatchLocalEvent({type:"advancedFilterBuilderAdded",item:this.item,isJoin:s.key==="join"})}}),this.eItem.appendChild(t.getGui()),this.createOptionalManagedBean(this.beans.tooltipSvc?.createTooltip({getGui:()=>t.getGui(),getTooltipComponentDefinition:()=>{},getLocation:()=>"advancedFilter",getTooltipValue:()=>this.advFilterExpSvc.translate("advancedFilterBuilderAddButtonTooltip")})),this.createManagedBean(new Cp(this.getGui(),this.focusWrapper,t)),Gk(this.focusWrapper,this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderItem",[this.advFilterExpSvc.translate("advancedFilterBuilderAddButtonTooltip"),`${this.item.level+1}`]))}afterAdd(){}};import{RefPlaceholder as zt,_removeAriaExpanded as z_,_setAriaDisabled as Sp,_setAriaExpanded as yp,_setAriaLabel as vn,_setAriaLevel as W_,_setDisplayed as Cn,_setVisible as K_}from"ag-stack";import{DragSourceType as $_,KeyCode as ja,TabGuardComp as j_,_createElement as wp,_createIconNoSpan as Or,_stopPropagationForAgGrid as Ya}from"ag-grid-community";import{RefPlaceholder as qa,_setAriaDescribedBy as Y_,_setAriaLabel as q_}from"ag-stack";import{Component as Z_,KeyCode as X_,_stopPropagationForAgGrid as J_}from"ag-grid-community";var xp="ag-advanced-filter-builder-value-empty",Q_="ag-advanced-filter-builder-value-number",eG="ag-advanced-filter-builder-value-text",tG=({cssClass:e,wrapperClassName:t,displayClassName:s,pickerIcon:r})=>{const i=[{tag:"span",cls:`ag-advanced-filter-builder-pill-display ${s??""}`,ref:"eLabel"}];return r&&i.push({tag:"span",ref:"eIcon",cls:"ag-picker-field-icon",attrs:{"aria-hidden":"true"}}),{tag:"div",cls:`ag-advanced-filter-builder-pill-wrapper ${t??""}`,role:"presentation",children:[{tag:"div",ref:"ePill",cls:`ag-advanced-filter-builder-pill ${e}`,role:"button",children:i}]}},Fp=class extends yx{constructor(e){super(tG(e)),this.pillParams=e,this.ePill=qa,this.eLabel=qa,this.eIcon=qa}wireBeans(e){this.advFilterExpSvc=e.advFilterExpSvc}writeLabel(e,t){const s=this.eLabel,r=s.classList;if(r.remove(xp,Q_,eG),e===null){s.textContent=this.advFilterExpSvc.translate("advancedFilterBuilderEnterValue"),r.add(xp);return}s.textContent=e,t&&r.add(t)}postConstruct(){const{ariaLabel:e,pickerIcon:t}=this.pillParams,s=this.ePill,r=this.eLabel;if(this.activateTabIndex([s]),t){const i=this.beans.iconSvc.createIconNoSpan(t);i&&this.eIcon.appendChild(i)}r.id=`${this.getCompId()}`,Y_(s,r.id),q_(s,e),this.renderValue(),this.addManagedListeners(s,{click:i=>{i.preventDefault(),this.open()},keydown:i=>{i.key===X_.ENTER&&(i.preventDefault(),J_(i),this.open())}})}getFocusableElement(){return this.ePill}},Za=3,sG="ag-advanced-filter-builder-set-values-pill-empty",rG=class extends Fp{constructor(e){super({...e,cssClass:`${e.cssClass} ag-advanced-filter-builder-set-values-pill`,wrapperClassName:"ag-advanced-filter-builder-set-values-pill-wrapper",displayClassName:"ag-picker-field-display",pickerIcon:"advancedFilterBuilderSelectOpen"}),this.params=e,this.opening=!1,this.values=e.values}wireBeans(e){super.wireBeans(e),this.popupSvc=e.popupSvc,this.advFilterSetSvc=e.advFilterSetSvc}postConstruct(){super.postConstruct(),this.addDestroyFunc(()=>this.hidePicker())}renderValue(){const e=this.values;this.ePill.classList.toggle(sG,e.length===0),this.writeLabel(e.length?this.summarise(e,this.params.column):null)}summarise(e,t){const s=e.length,r=[];for(let i=0,n=Math.min(s,Za);i<n;++i){const o=e[i],a=this.advFilterSetSvc.getPath(t,o);r.push(a?Ir(a):String(o??""))}return s>Za&&r.push(this.advFilterExpSvc.translate("advancedFilterSetMore",[String(s-Za)])),`(${s}) ${r.join(", ")}`}open(){if(this.opening)return;if(this.filterUi){this.hidePicker(!0);return}const{column:e,update:t}=this.params,s={filterType:"set",values:this.values},r=this.advFilterSetSvc.createFilterUi(e,s,i=>{this.values=i?.values??this.advFilterSetSvc.getAllKeys(e)??this.values,this.renderValue(),t(this.values)});r&&(this.opening=!0,r.newAgStackInstance().then(i=>{if(this.opening=!1,!this.isAlive()){this.destroyBean(i);return}this.filterUi=i;const n=i.getGui();n.classList.add("ag-advanced-filter-builder-set-picker");const o={ePopup:n,type:"advancedFilterBuilderSet",eventSource:this.ePill,position:"under",alignSide:this.gos.get("enableRtl")?"right":"left",keepWithinBounds:!0},a=this.popupSvc.addPopup({modal:!0,eChild:n,closeOnEsc:!0,closedCallback:l=>this.hidePicker(l instanceof KeyboardEvent),anchorToElement:this.ePill,eventSourceToIgnore:this.ePill,positionCallback:()=>this.popupSvc.positionPopupByComponent(o),ariaLabel:this.params.ariaLabel});this.hidePopup=a.hideFunc,this.filterUi.afterGuiAttached?.({container:"columnFilter"})}))}hidePicker(e){const{filterUi:t,hidePopup:s}=this;t&&(this.filterUi=void 0,this.hidePopup=void 0,s?.(),this.destroyBean(t),e&&this.ePill.focus())}};import{_removeFromParent as Tp,_toStringOrNull as iG}from"ag-stack";import{Component as nG}from"ag-grid-community";var oG=class extends wx{constructor(){super({tag:"div",cls:"ag-advanced-filter-builder-item-condition",role:"presentation"}),this.eOperandPills=[],this.hasSetValuesPill=!1,this.validationMessage=null}wireBeans(e){this.advFilterExpSvc=e.advFilterExpSvc}init(e){const{item:t,createPill:s}=e;this.item=t,this.createPill=s,this.filterModel=t.filterModel,this.setupColumnCondition(this.filterModel),this.validate(),this.addDestroyFunc(()=>this.destroyBeans([this.eColumnPill,this.eOperatorPill,...this.eOperandPills]))}getDragName(){return this.filterModel.colId?this.advFilterExpSvc.parseColumnFilterModel(this.filterModel):this.getDefaultColumnDisplayValue()}getAriaLabel(){return`${this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderFilterItem")} ${this.getDragName()}`}getValidationMessage(){return this.validationMessage}getFocusableElement(){return this.eColumnPill.getFocusableElement()}setupColumnCondition(e){const t=this.advFilterExpSvc.getColumnDetails(e.colId);this.baseCellDataType=t.baseCellDataType,this.column=t.column,this.setOperands(e.type),this.eColumnPill=this.createPill({key:e.colId,displayValue:this.advFilterExpSvc.getColumnDisplayValue(e.colId)??this.getDefaultColumnDisplayValue(),cssClass:"ag-advanced-filter-builder-column-pill",isSelect:!0,getEditorParams:()=>({values:this.advFilterExpSvc.getColumnAutocompleteEntries()}),update:s=>this.setColumnKey(s),pickerAriaLabelKey:"ariaLabelAdvancedFilterBuilderColumnSelectField",pickerAriaLabelValue:"Advanced Filter Builder Column Select Field",ariaLabel:this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderColumn")}),this.getGui().appendChild(this.eColumnPill.getGui()),e.colId&&(this.createOperatorPill(),this.syncOperandPills())}createOperatorPill(){this.eOperatorPill=this.createPill({key:this.filterModel.type,displayValue:this.advFilterExpSvc.getOperatorDisplayValue(this.filterModel)??this.advFilterExpSvc.translate("advancedFilterBuilderSelectOption"),cssClass:"ag-advanced-filter-builder-option-pill",isSelect:!0,getEditorParams:()=>({values:this.getOperatorAutocompleteEntries()}),update:e=>this.setOperatorKey(e),pickerAriaLabelKey:"ariaLabelAdvancedFilterBuilderOptionSelectField",pickerAriaLabelValue:"Advanced Filter Builder Option Select Field",ariaLabel:this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderOption")}),this.eColumnPill.getGui().insertAdjacentElement("afterend",this.eOperatorPill.getGui())}createOperandPill(e){const t=this.getOperandModelValue(e),s=(typeof t=="number"||typeof t=="bigint"?iG(t):t)??"",r=()=>this.advFilterExpSvc.formatOperand(this.filterModel,this.getOperandModelValue(e),!0),i=this.createPill({key:s,valueFormatter:r,editValueFormatter:this.advFilterExpSvc.isOperandModelValueEditable(this.baseCellDataType,this.column)?void 0:r,baseCellDataType:this.baseCellDataType,cssClass:"ag-advanced-filter-builder-value-pill",isSelect:!1,update:n=>this.setOperand(n,e),ariaLabel:this.getOperandAriaLabel(e)});this.eOperandPills.push(i),this.getGui().appendChild(i.getGui())}getOperandAriaLabel(e){if(this.operands!=="range")return this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderValue");const t=this.getLocaleTextFunc();return e===0?t("ariaFilterFromValue","Filter from value"):t("ariaFilterToValue","Filter to value")}destroyOperandPills(){this.hasSetValuesPill=!1;const e=this.eOperandPills;for(let t=0,s=e.length;t<s;++t){const r=e[t];Tp(r.getGui()),this.destroyBean(r)}e.length=0}syncOperandPills(){const{eOperandPills:e,operands:t}=this,s=Rr[t];for(let r=s,i=an.length;r<i;++r)this.setOperandModelValue(r,void 0);if(t==="list"){this.hasSetValuesPill||(this.destroyOperandPills(),this.createSetValuesPill());return}if(delete this.filterModel.values,!(e.length===s&&!this.hasSetValuesPill)){this.destroyOperandPills();for(let r=0;r<s;++r)this.createOperandPill(r)}}createSetValuesPill(){const e=this.column;if(!e)return;this.hasSetValuesPill=!0;const t=this.filterModel;t.values??(t.values=[]);const s=this.createPill({key:"",column:e,values:t.values,cssClass:"ag-advanced-filter-builder-value-pill",isSelect:"set",update:r=>{t.values=r,this.validate()},ariaLabel:this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderValue")});this.eOperandPills.push(s),this.getGui().appendChild(s.getGui())}getOperandModelValue(e){return this.filterModel[an[e]]}setOperandModelValue(e,t){const s=this.filterModel,r=an[e];t===void 0?delete s[r]:s[r]=t}getOperatorAutocompleteEntries(){return this.column?this.advFilterExpSvc.getOperatorAutocompleteEntries(this.column,this.baseCellDataType):[]}setColumnKey(e){this.eOperatorPill||this.createOperatorPill();const{column:t,baseCellDataType:s}=this.advFilterExpSvc.getColumnDetails(e),r=this.column,i=this.baseCellDataType!==s,n=this.filterModel.type,o=this.advFilterExpSvc.getOperatorDisplayValue(this.filterModel);this.column=t,this.baseCellDataType=s,this.filterModel.colId=e,!i&&this.advFilterExpSvc.isOperatorOffered(s,this.filterModel.type,t)||delete this.filterModel.type,(r!==t||this.filterModel.type!==n||this.advFilterExpSvc.getOperatorDisplayValue(this.filterModel)!==o)&&(Tp(this.eOperatorPill.getGui()),this.destroyBean(this.eOperatorPill),this.createOperatorPill()),r!==t&&(this.destroyOperandPills(),delete this.filterModel.values),this.setOperands(this.filterModel.type),this.syncOperandPills(),this.validate()}setOperatorKey(e){const t=this.operands;this.setOperands(e),this.operands!==t&&this.syncOperandPills(),this.filterModel.type=e,this.validate()}setOperands(e){const t=this.getExpressionOperator(e)?.operands??"none";this.operands=t,this.filterModel.filterType=t==="list"?"set":this.baseCellDataType}setOperand(e,t){const s=this.baseCellDataType==="number"&&e?this.advFilterExpSvc.getNumberParser(this.column)(e)??"":e;this.setOperandModelValue(t,s===""?void 0:s),this.validate()}getExpressionOperator(e){return this.advFilterExpSvc.getExpressionOperator(this.baseCellDataType,e,this.column)}validate(){const e=this.filterModel,t=Nh(this.advFilterExpSvc,e,this.column,this.baseCellDataType,this.getExpressionOperator(e.type));this.item.valid=!t,t!==this.validationMessage&&(this.validationMessage=t,this.dispatchLocalEvent({type:"advancedFilterBuilderValidChanged"}))}getDefaultColumnDisplayValue(){return this.advFilterExpSvc.translate("advancedFilterBuilderSelectColumn")}};import{_exists as aG,_setDisplayed as Ap}from"ag-stack";import{AgInputDateField as bn,AgInputNumberField as lG,AgInputTextField as Sn,KeyCode as Pp,_stopPropagationForAgGrid as Rp}from"ag-grid-community";var cG={number:[lG],bigint:[Sn],boolean:[Sn],object:[Sn],text:[Sn],date:[bn],dateString:[bn],dateTime:[bn,e=>e.setIncludeTime(!0)],dateTimeString:[bn,e=>e.setIncludeTime(!0)]},uG=class extends Fp{constructor(e){super(e),this.params=e;const{value:t,valueFormatter:s}=e;this.value=t,this.displayValue=s(t)}postConstruct(){super.postConstruct(),this.addDestroyFunc(()=>this.destroyBean(this.eEditor))}open(){if(this.eEditor)return;Ap(this.ePill,!1),this.eEditor=this.createEditorComp();const{editValueFormatter:e}=this.params;this.editorOpenedWith=e?.(this.value)??this.value,this.eEditor.setValue(this.editorOpenedWith);const t=this.eEditor.getGui();this.eEditor.addManagedElementListeners(t,{keydown:s=>{switch(s.key){case Pp.ENTER:s.preventDefault(),Rp(s),this.updateValue(!0);break;case Pp.ESCAPE:s.preventDefault(),Rp(s),this.hideEditor(!0);break}},focusout:()=>this.updateValue(!1)}),this.getGui().appendChild(t),this.eEditor.getFocusableElement().focus()}createEditorComp(){const e=this.params.editValueFormatter?"text":this.params.type,[t,s]=cG[e],r=this.createBean(new t);return s?.(r),r}hideEditor(e){const{eEditor:t}=this;t&&(this.eEditor=void 0,t.getGui().remove(),this.destroyBean(t),Ap(this.ePill,!0),e&&this.ePill.focus())}renderValue(){const e=this.displayValue;if(!aG(e)){this.writeLabel(null);return}const t=this.params.type;if(t==="number"||t==="bigint"){this.writeLabel(e,"ag-advanced-filter-builder-value-number");return}this.writeLabel(`"${e}"`,"ag-advanced-filter-builder-value-text")}updateValue(e){if(!this.eEditor)return;const t=this.eEditor.getValue()??"";if(t===this.editorOpenedWith){this.hideEditor(e);return}this.dispatchLocalEvent({type:"fieldValueChanged",value:t}),this.value=t,this.displayValue=this.params.valueFormatter(t),this.renderValue(),this.hideEditor(e)}};import{Component as dG}from"ag-grid-community";var hG=class extends xx{wireBeans(e){this.advFilterExpSvc=e.advFilterExpSvc}constructor(){super({tag:"div",cls:"ag-advanced-filter-builder-item-condition",role:"presentation"})}init(e){const{item:t,createPill:s}=e,r=t.filterModel;this.filterModel=r,this.ePill=s({key:r.type,displayValue:this.advFilterExpSvc.parseJoinOperator(r),cssClass:"ag-advanced-filter-builder-join-pill",isSelect:!0,getEditorParams:()=>({values:this.advFilterExpSvc.getJoinOperatorAutocompleteEntries()}),update:i=>r.type=i,pickerAriaLabelKey:"ariaLabelAdvancedFilterBuilderJoinSelectField",pickerAriaLabelValue:"Advanced Filter Builder Join Operator Select Field",ariaLabel:this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderJoinOperator")}),this.getGui().appendChild(this.ePill.getGui()),this.addDestroyFunc(()=>this.destroyBean(this.ePill))}getDragName(){return this.advFilterExpSvc.parseJoinOperator(this.filterModel)}getAriaLabel(){return`${this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderGroupItem")} ${this.getDragName()}`}getValidationMessage(){return null}getFocusableElement(){return this.ePill.getFocusableElement()}};import{_getInnerWidth as pG,_setAriaLabel as gG,_setAriaLabelledBy as fG}from"ag-stack";import{AgInputTextFieldSelector as mG,_stopPropagationForAgGrid as vG}from"ag-grid-community";var CG={tag:"div",cls:"ag-picker-field ag-advanced-filter-builder-pill-wrapper",role:"presentation",children:[{tag:"div",ref:"eLabel"},{tag:"div",ref:"eWrapper",cls:"ag-wrapper ag-advanced-filter-builder-pill ag-picker-collapsed",children:[{tag:"div",ref:"eDisplayField",cls:"ag-picker-field-display ag-advanced-filter-builder-pill-display"},{tag:"ag-input-text-field",ref:"eInput",cls:"ag-rich-select-field-input"},{tag:"span",ref:"eDeselect",cls:"ag-rich-select-deselect-button ag-picker-field-icon",role:"presentation"},{tag:"div",ref:"eIcon",cls:"ag-picker-field-icon",attrs:{"aria-hidden":"true"}}]}]},bG=class extends fn{constructor(e){super({...e,template:CG,agComponents:[mG]}),this.params=e}getFocusableElement(){return this.eWrapper}showPicker(){setTimeout(()=>super.showPicker())}hidePicker(){setTimeout(()=>super.hidePicker())}postConstruct(){super.postConstruct();const{wrapperClassName:e,ariaLabel:t}=this.params;this.eWrapper.classList.add(e),fG(this.eWrapper,""),gG(this.eWrapper,t)}createPickerComponent(){if(!this.values){const{values:s}=this.params.getEditorParams();this.values=s;const r=this.value.key,i=s.find(n=>n.key===r)??{key:r,displayValue:this.value.displayValue};this.value=i}const e=super.createPickerComponent(),t=Math.min(this.params.maxPickerWidth??1/0,pG(this.params.eBuilder));return e.setContentWidthCallback(s=>this.growPickerToContent(s,t)),e}growPickerToContent(e,t){const s=this.pickerComponent?.getGui();if(!s)return!0;const r=Math.min(e,t);return r>Number.parseFloat(s.style.minWidth||"0")&&(s.style.minWidth=`${r}px`,this.alignPickerToComponent()),r<t}onEnterKeyDown(e){vG(e),this.isPickerDisplayed?super.onEnterKeyDown(e):(e.preventDefault(),this.showPicker())}},Mp="ag-advanced-filter-builder-set-value-list",SG={tag:"div",cls:"ag-advanced-filter-builder-item-wrapper",role:"presentation",children:[{tag:"div",cls:"ag-advanced-filter-builder-item",role:"presentation",children:[{tag:"div",ref:"eTreeLines",cls:"ag-advanced-filter-builder-item-tree-lines",attrs:{"aria-hidden":"true"}},{tag:"span",ref:"eDragHandle",cls:"ag-drag-handle",attrs:{"aria-hidden":"true"}},{tag:"span",ref:"eValidation",cls:"ag-advanced-filter-builder-item-button ag-advanced-filter-builder-invalid",attrs:{"aria-hidden":"true"}}]},{tag:"div",ref:"eButtons",cls:"ag-advanced-filter-builder-item-buttons",children:[{tag:"span",ref:"eMoveUpButton",cls:"ag-advanced-filter-builder-item-button",role:"button"},{tag:"span",ref:"eMoveDownButton",cls:"ag-advanced-filter-builder-item-button",role:"button"},{tag:"div",ref:"eAddButton",role:"presentation"},{tag:"span",ref:"eRemoveButton",cls:"ag-advanced-filter-builder-item-button",role:"button"}]}]},Xa=class extends Fx{constructor(e,t,s,r){super(SG),this.item=e,this.dragFeature=t,this.focusWrapper=s,this.eBuilder=r,this.eTreeLines=zt,this.eDragHandle=zt,this.eButtons=zt,this.eValidation=zt,this.eMoveUpButton=zt,this.eMoveDownButton=zt,this.eAddButton=zt,this.eRemoveButton=zt,this.moveUpDisabled=!1,this.moveDownDisabled=!1}wireBeans(e){this.dragAndDrop=e.dragAndDrop,this.advFilterExpSvc=e.advFilterExpSvc}postConstruct(){const{filterModel:e,level:t,showMove:s}=this.item,r=e.filterType==="join";if(this.ePillWrapper=this.createManagedBean(r?new hG:new oG),this.ePillWrapper.init({item:this.item,createPill:i=>this.createPill(i)}),this.eDragHandle.insertAdjacentElement("afterend",this.ePillWrapper.getGui()),t===0){const i=wp({tag:"div",cls:"ag-advanced-filter-builder-item-tree-line ag-advanced-filter-builder-item-tree-line-vertical-bottom ag-advanced-filter-builder-item-tree-line-root"});this.eTreeLines.appendChild(i),Cn(this.eDragHandle,!1),Cn(this.eButtons,!1),yp(this.focusWrapper,!0)}else this.setupTreeLines(t),this.eDragHandle.appendChild(Or("advancedFilterBuilderDrag",this.beans)),this.setupValidation(),this.setupMoveButtons(s),this.setupAddButton(),this.setupRemoveButton(),this.setupDragging(),this.updateAriaExpanded();W_(this.focusWrapper,t+1),this.initialiseTabGuard({}),this.createManagedBean(new Cp(this.getGui(),this.focusWrapper,this.ePillWrapper)),this.updateAriaLabel(),this.addManagedListeners(this.ePillWrapper,{advancedFilterBuilderValueChanged:()=>this.dispatchLocalEvent({type:"advancedFilterBuilderValueChanged"}),advancedFilterBuilderValidChanged:()=>this.updateValidity()})}setState(e){const{level:t}=this.item;if(t===0)return;const{showMove:s}=this.item,{disableMoveUp:r,disableMoveDown:i,treeLines:n,showStartTreeLine:o}=e;this.updateTreeLines(n,o),this.updateAriaExpanded(),s&&(this.moveUpDisabled=!!r,this.moveDownDisabled=!!i,this.eMoveUpButton.classList.toggle("ag-advanced-filter-builder-item-button-disabled",r),this.eMoveDownButton.classList.toggle("ag-advanced-filter-builder-item-button-disabled",i),Sp(this.eMoveUpButton,!!r),Sp(this.eMoveDownButton,!!i),this.moveUpTooltipFeature?.refreshTooltip(),this.moveDownTooltipFeature?.refreshTooltip())}focusMoveButton(e){(e?this.eMoveUpButton:this.eMoveDownButton).focus()}afterAdd(){this.ePillWrapper.getFocusableElement().focus()}setupTreeLines(e){for(let t=0;t<e;t++)this.eTreeLines.appendChild(wp({tag:"div",cls:"ag-advanced-filter-builder-item-tree-line"}))}updateTreeLines(e,t){const s=e.length-1,{children:r}=this.eTreeLines;for(let n=0;n<s;n++){const o=r.item(n);o&&o.classList.toggle("ag-advanced-filter-builder-item-tree-line-vertical",!e[n])}const i=r.item(s);if(i){i.classList.add("ag-advanced-filter-builder-item-tree-line-horizontal");const n=e[s];i.classList.toggle("ag-advanced-filter-builder-item-tree-line-vertical-top",n),i.classList.toggle("ag-advanced-filter-builder-item-tree-line-vertical",!n)}this.eDragHandle.classList.toggle("ag-advanced-filter-builder-item-tree-line-vertical-bottom",t)}setupValidation(){this.eValidation.appendChild(Or("advancedFilterBuilderInvalid",this.beans)),this.validationTooltipFeature=this.createOptionalManagedBean(this.beans.tooltipSvc?.createTooltip({getGui:()=>this.eValidation,getTooltipComponentDefinition:()=>{},getLocation:()=>"advancedFilter",getTooltipValue:()=>this.ePillWrapper.getValidationMessage(),getTooltipShowDelayOverride:()=>1e3})),this.updateValidity()}setupAddButton(){const e=bp(s=>this.advFilterExpSvc.translate(s),this.gos.get("advancedFilterBuilderParams")?.addSelectWidth),t=this.createManagedBean(new fp(e));this.addManagedListeners(t,{fieldPickerValueSelected:({value:s})=>this.dispatchLocalEvent({type:"advancedFilterBuilderAdded",item:this.item,isJoin:s.key==="join"})}),this.eAddButton.appendChild(t.getGui()),this.createOptionalManagedBean(this.beans.tooltipSvc?.createTooltip({getGui:()=>this.eAddButton,getTooltipComponentDefinition:()=>{},getLocation:()=>"advancedFilter",getTooltipValue:()=>this.advFilterExpSvc.translate("advancedFilterBuilderAddButtonTooltip")}))}setupRemoveButton(){this.eRemoveButton.appendChild(Or("advancedFilterBuilderRemove",this.beans)),this.addManagedListeners(this.eRemoveButton,{click:()=>this.removeItem(),keydown:e=>{e.key===ja.ENTER&&(e.preventDefault(),Ya(e),this.removeItem())}}),this.createOptionalManagedBean(this.beans.tooltipSvc?.createTooltip({getGui:()=>this.eRemoveButton,getTooltipComponentDefinition:()=>{},getLocation:()=>"advancedFilter",getTooltipValue:()=>this.advFilterExpSvc.translate("advancedFilterBuilderRemoveButtonTooltip")})),vn(this.eRemoveButton,this.advFilterExpSvc.translate("advancedFilterBuilderRemoveButtonTooltip")),this.activateTabIndex([this.eRemoveButton])}setupMoveButtons(e){e?(this.eMoveUpButton.appendChild(Or("advancedFilterBuilderMoveUp",this.beans)),this.addManagedListeners(this.eMoveUpButton,{click:()=>this.moveItem(!0),keydown:t=>{t.key===ja.ENTER&&(t.preventDefault(),Ya(t),this.moveItem(!0))}}),this.moveUpTooltipFeature=this.createOptionalManagedBean(this.beans.tooltipSvc?.createTooltip({getGui:()=>this.eMoveUpButton,getTooltipComponentDefinition:()=>{},getLocation:()=>"advancedFilter",getTooltipValue:()=>this.moveUpDisabled?null:this.advFilterExpSvc.translate("advancedFilterBuilderMoveUpButtonTooltip")})),vn(this.eMoveUpButton,this.advFilterExpSvc.translate("advancedFilterBuilderMoveUpButtonTooltip")),this.eMoveDownButton.appendChild(Or("advancedFilterBuilderMoveDown",this.beans)),this.addManagedListeners(this.eMoveDownButton,{click:()=>this.moveItem(!1),keydown:t=>{t.key===ja.ENTER&&(t.preventDefault(),Ya(t),this.moveItem(!1))}}),this.moveDownTooltipFeature=this.createOptionalManagedBean(this.beans.tooltipSvc?.createTooltip({getGui:()=>this.eMoveDownButton,getTooltipComponentDefinition:()=>{},getLocation:()=>"advancedFilter",getTooltipValue:()=>this.moveDownDisabled?null:this.advFilterExpSvc.translate("advancedFilterBuilderMoveDownButtonTooltip")})),vn(this.eMoveDownButton,this.advFilterExpSvc.translate("advancedFilterBuilderMoveDownButtonTooltip")),this.activateTabIndex([this.eMoveUpButton,this.eMoveDownButton])):(Cn(this.eMoveUpButton,!1),Cn(this.eMoveDownButton,!1))}updateValidity(){K_(this.eValidation,!this.item.valid),this.validationTooltipFeature?.refreshTooltip(),this.updateAriaLabel()}createPill(e){const{key:t,cssClass:s,ariaLabel:r}=e;if(e.isSelect==="set"){const n=this.focusWrapper.classList,o=this.createBean(new rG({...e,update:this.onPillUpdated(e.update)}));return n.add(Mp),o.addDestroyFunc(()=>n.remove(Mp)),o}const i=this.onPillUpdated(e.update);if(e.isSelect){const{getEditorParams:n,pickerAriaLabelKey:o,pickerAriaLabelValue:a,displayValue:l}=e,{pillSelectMinWidth:c,pillSelectMaxWidth:u}=this.gos.get("advancedFilterBuilderParams")??{},d=this.createBean(new bG({pickerAriaLabelKey:o,pickerAriaLabelValue:a,pickerType:"ag-list",value:{key:t,displayValue:l},valueFormatter:h=>h==null?"":h.displayValue??h.key,variableWidth:!0,minPickerWidth:c??140,maxPickerWidth:u,eBuilder:this.eBuilder,getEditorParams:n,wrapperClassName:s,ariaLabel:r,pickerIcon:"advancedFilterBuilderSelectOpen"}));return this.addManagedListeners(d,{fieldPickerValueSelected:({value:h})=>i(h?.key)}),d}else{const{baseCellDataType:n,valueFormatter:o,editValueFormatter:a}=e,l=this.createBean(new uG({value:t,valueFormatter:o,editValueFormatter:a,cssClass:s,type:n,ariaLabel:r}));return this.addManagedListeners(l,{fieldValueChanged:({value:c})=>i(c)}),l}}onPillUpdated(e){return t=>{t!=null&&(e(t),this.dispatchLocalEvent({type:"advancedFilterBuilderValueChanged"}))}}setupDragging(){const e={type:$_.AdvancedFilterBuilder,eElement:this.eDragHandle,dragItemName:()=>this.ePillWrapper.getDragName(),getDefaultIconName:()=>"notAllowed",getDragItem:()=>({}),onDragStarted:()=>this.dragFeature.dispatchLocalEvent({type:"advancedFilterBuilderDragStarted",item:this.item}),onDragStopped:()=>this.dragFeature.dispatchLocalEvent({type:"advancedFilterBuilderDragEnded"})};this.dragAndDrop.addDragSource(e,!0),this.addDestroyFunc(()=>this.dragAndDrop.removeDragSource(e))}updateAriaLabel(){const e=this.ePillWrapper.getAriaLabel(),t=`${this.item.level+1}`,s=this.ePillWrapper.getValidationMessage();let r;s?r=this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderItemValidation",[e,t,s]):r=this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderItem",[e,t]),vn(this.focusWrapper,r)}updateAriaExpanded(){z_(this.focusWrapper);const{filterModel:e}=this.item;e?.filterType==="join"&&e.conditions.length&&yp(this.focusWrapper,!0)}removeItem(){this.dispatchLocalEvent({type:"advancedFilterBuilderRemoved",item:this.item})}moveItem(e){this.dispatchLocalEvent({type:"advancedFilterBuilderMoved",item:this.item,backwards:e})}},yG={apply:"advancedFilterBuilderApply",clear:"advancedFilterBuilderClear",cancel:"advancedFilterBuilderCancel",reset:"advancedFilterBuilderReset"},wG={tag:"div",cls:"ag-advanced-filter-builder",role:"presentation",attrs:{tabindex:"-1"},children:[{tag:"div",ref:"eList",cls:"ag-advanced-filter-builder-list",role:"presentation"}]},xG=class extends Tx{constructor(){super(wG),this.eList=Rk}wireBeans(e){this.filterManager=e.filterManager,this.advancedFilter=e.advancedFilter,this.advFilterExpSvc=e.advFilterExpSvc}postConstruct(){const e=this.gos.get("advancedFilterBuilderParams");this.params={buttons:["apply","cancel"],...e},this.addManagedPropertyListener("advancedFilterBuilderParams",({currentValue:t})=>{this.params.showMoveButtons=!!t?.showMoveButtons,this.params.buttons=t?.buttons??["apply","cancel"],this.refreshList(!1)}),this.filterModel=this.setupFilterModel(),this.setupVirtualList(),this.dragFeature=this.createManagedBean(new kk(this,this.virtualList)),this.resetButtonsPanel(this.params.buttons)}refresh(){const e=this.virtualList;let t=e.getLastFocusedRow();this.setupFilterModel(),this.validateItems(),this.refreshList(!1),t!=null&&(e.getComponentAt(t)||(t=0),e.focusRow(t))}getNumItems(){return this.items.length}moveItem(e,t){!t||!e||this.moveItemToIndex(e,t.rowIndex,t.position)}afterGuiAttached(){this.virtualList.awaitStable(()=>this.virtualList.focusRow(0))}setupVirtualList(){const e=this.virtualList=this.createManagedBean(new Gs({cssIdentifier:"advanced-filter-builder",ariaRole:"tree",listName:this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderList"),moveItemCallback:this.virtualListMoveItemCallback.bind(this)}));e.setComponentCreator(this.createItemComponent.bind(this)),e.setComponentUpdater(this.updateItemComponent.bind(this)),e.setRowHeight(40),this.eList.appendChild(e.getGui()),e.setModel({getRowCount:()=>this.items?.length||0,getRow:t=>this.items[t],areRowsEqual:(t,s)=>t===s}),this.buildList(),e.refresh()}resetButtonsPanel(e){const t=e&&e.length>0;let s=this.eButtons;if(t){const r=e.map(n=>({type:n,label:this.advFilterExpSvc.translate(yG[n])}));if(!s){s=this.createBean(new Ek),this.appendChild(s.getGui());const n=o=>({event:a})=>{this.updateModel(o),this.afterAction(o,a)};s.addManagedListeners(s,{apply:n("apply"),clear:n("clear"),reset:n("reset"),cancel:n("cancel")}),this.eButtons=s}s.updateButtons(r);const i=s.getApplyButton();if(i){const n=o=>this.toggleCss("ag-advanced-filter-builder-validation",o);this.addManagedElementListeners(i,{mouseenter:()=>n(!0),mouseleave:()=>n(!1)})}}else s&&(Mk(s.getGui()),this.eButtons=this.destroyBean(s))}updateModel(e){switch(e){case"apply":this.advancedFilter.setModel(this.filterModel),this.filterManager?.onFilterChanged({source:"advancedFilter"});break;case"reset":this.advancedFilter.setModel(null),this.filterManager?.onFilterChanged({source:"advancedFilter"});break;case"cancel":break;case"clear":this.filterModel=this.formatFilterModel(null),this.refreshList(!1);break}}afterAction(e,t){switch(e){case"apply":{t?.preventDefault(),this.close();break}case"reset":{this.close();break}case"cancel":{this.close();break}}}removeItemFromParent(e){const t=e.parent.conditions.indexOf(e.filterModel);return e.parent.conditions.splice(t,1),t}moveItemToIndex(e,t,s){const r=this.items[t],i=r.filterModel?.filterType==="join"&&s==="bottom",n=i?r.filterModel:r.parent;if(!n||this.isChildOrSelf(n,e.filterModel)||r===e)return;this.removeItemFromParent(e);let o;i?o=0:(o=n.conditions.indexOf(r.filterModel),o===-1?o=n.conditions.length:s==="bottom"&&(o+=1)),n.conditions.splice(o,0,e.filterModel),this.refreshList(!1)}isChildOrSelf(e,t){return e===t||t.filterType==="join"&&t.conditions.some(s=>this.isChildOrSelf(e,s))}setupFilterModel(){const e=this.formatFilterModel(this.advancedFilter.getBuilderModel());return this.stringifiedModel=JSON.stringify(e),e}formatFilterModel(e){return e=e??{filterType:"join",type:"AND",conditions:[]},e.filterType!=="join"&&(e={filterType:"join",type:"AND",conditions:[e]}),e}buildList(){const e=(t,s,r,i)=>{if(s.push({filterModel:t,level:r,parent:i,valid:!0,showMove:this.params.showMoveButtons}),t.filterType==="join"){for(const n of t.conditions)e(n,s,r+1,t);r===0&&s.push({filterModel:null,level:r+1,parent:t,valid:!0})}};this.items=[],e(this.filterModel,this.items,0)}refreshList(e){if(!e){const t=new Map;for(const s of this.items)s.valid||t.set(s.filterModel,s.validationMessage);if(this.buildList(),t.size)for(const s of this.items)s.filterModel&&t.has(s.filterModel)&&(s.valid=!1,s.validationMessage=t.get(s.filterModel))}this.virtualList.refresh(e),this.validate()}updateItemComponent(e,t){const s=this.items.indexOf(e),r=(a,l)=>{const u=this.items.find(d=>d.filterModel===a)?.parent;if(u){const{conditions:d}=u;r(u,l),l.push(d[d.length-1]===a)}},i=[],{filterModel:n}=e;n&&(r(n,i),i[0]=!1);const o=n?.filterType==="join"&&!!n.conditions.length;t.setState({disableMoveUp:s===1,disableMoveDown:!this.canMoveDown(e,s),treeLines:i,showStartTreeLine:o})}createItemComponent(e,t){const s=this.createBean(e.filterModel?new Xa(e,this.dragFeature,t,this.getGui()):new U_(e,t));return s.addManagedListeners(s,{advancedFilterBuilderRemoved:({item:r})=>this.removeItem(r),advancedFilterBuilderValueChanged:()=>this.validate(),advancedFilterBuilderAdded:({item:r,isJoin:i})=>this.addItem(r,i),advancedFilterBuilderMoved:({item:r,backwards:i})=>this.moveItemUpDown(r,i)}),s instanceof Xa&&this.updateItemComponent(e,s),s}addItem(e,t){const{parent:s,level:r,filterModel:i}=e,n=i?.filterType==="join",o=t?{filterType:"join",type:"AND",conditions:[]}:{},a=n?i:s;let l=n?0:a.conditions.indexOf(i);l>=0?(n||(l+=1),a.conditions.splice(l,0,o)):a.conditions.push(o);let c=this.items.indexOf(e);const u=c>=0;if(u){e.filterModel&&c++;const d=[{filterModel:o,level:n?r+1:r,parent:a,valid:t,showMove:this.params.showMoveButtons}];this.items.splice(c,0,...d)}this.refreshList(u),u&&this.virtualList.getComponentAt(c)?.afterAdd()}removeItem(e){const t=e.parent,{filterModel:s}=e,r=t.conditions.indexOf(s);t.conditions.splice(r,1);const i=e.filterModel?.filterType==="join",n=this.items.indexOf(e),o=!i&&n>=0;o&&this.items.splice(n,1),this.refreshList(o),n>=0&&this.virtualList.focusRow(n)}moveItemUpDown(e,t,s){const r=this.items.indexOf(e),i=t?r-1:r+1;if(i===0||!t&&!this.canMoveDown(e,r))return;const n=this.items[i],o=this.removeItemFromParent(e),{level:a,filterModel:l,parent:c}=e,{level:u,filterModel:d,parent:h}=n;if(t)if(u===a&&d.filterType==="join")d.conditions.push(l);else if(u<=a){const f=h.conditions.indexOf(d);h.conditions.splice(f,0,l)}else c.conditions[o-1].conditions.push(l);else if(u===a)if(d.filterType==="join")d.conditions.splice(0,0,l);else{const f=h.conditions.indexOf(d);h.conditions.splice(f+1,0,l)}else if(o<c.conditions.length)c.conditions.splice(o+1,0,l);else{const f=this.items.find(v=>v.filterModel===c),m=f.parent.conditions.indexOf(f.filterModel)+1;f.parent.conditions.splice(m,0,l)}this.refreshList(!1);const p=this.items.findIndex(({filterModel:f})=>f===l);if(p<0)return;const g=this.virtualList.getComponentAt(p);g instanceof Xa&&(s||g.focusMoveButton(t))}virtualListMoveItemCallback(e,t){const s=e.item,r=this.items.indexOf(s);r<=0||r===this.items.length-1||t&&r===1||!t&&!this.canMoveDown(s,r)||(this.moveItemUpDown(s,t,!0),this.virtualList.focusRow(r+(t?-1:1)))}canMoveDown(e,t){return!(e.level===1&&t===this.items.length-2||e.level===1&&e.parent.conditions[e.parent.conditions.length-1]===e.filterModel)}close(){this.advancedFilter.getCtrl().toggleFilterBuilder({source:"ui"})}validate(){let e=this.items.every(({valid:s})=>s),t=null;e?(e=JSON.stringify(this.filterModel)!==this.stringifiedModel,e||(t=this.advFilterExpSvc.translate("advancedFilterBuilderValidationAlreadyApplied"))):t=this.items.find(s=>!s.valid)?.validationMessage??this.advFilterExpSvc.translate("advancedFilterBuilderValidationIncomplete"),this.eButtons?.updateValidity(e,t)}validateItems(){const e=this.advFilterExpSvc;for(const t of this.items){const s=t.filterModel;if(!s||s.filterType==="join")continue;t.validationMessage=null;const{colId:r}=s,i=e.getColumnAutocompleteEntries().find(({key:c})=>c===r),{column:n,baseCellDataType:o}=e.getColumnDetails(r);if(!i||!n){t.valid=!1,delete s.colId,Ip(s);continue}const a=e.getExpressionOperator(o,s.type,n);if(!a){t.valid=!1,Ip(s);continue}const l=Nh(e,s,n,o,a);t.validationMessage=l,t.valid=!l}}},Ip=e=>{delete e.type,delete e.filter,delete e.filterTo,delete e.values,delete e.filterType},FG=class extends Ax{constructor(e){super(),this.enabled=e}wireBeans(e){this.ctrlsSvc=e.ctrlsSvc,this.popupSvc=e.popupSvc,this.advFilterExpSvc=e.advFilterExpSvc,this.environment=e.environment}postConstruct(){this.hasAdvancedFilterParent=!!this.gos.get("advancedFilterParent"),this.ctrlsSvc.whenReady(this,()=>this.setAdvancedFilterComp()),this.addManagedEventListeners({advancedFilterEnabledChanged:({enabled:e})=>this.onEnabledChanged(e)}),this.addManagedPropertyListener("advancedFilterParent",()=>this.updateComps()),this.addManagedPropertyListener("advancedFilterBuilderParams",e=>{e.currentValue?.suppressFullScreenButton!==e.previousValue?.suppressFullScreenButton&&this.eBuilderDialog?.setMaximizable(e.currentValue?.suppressFullScreenButton??!0)}),this.addDestroyFunc(()=>{this.destroyFilterComp(),this.eHeaderComp&&(this.headerCompHost?.unmountComp(this.eHeaderComp.getGui()),this.destroyBean(this.eHeaderComp),this.eHeaderComp=void 0,this.headerCompHost=void 0),this.destroyBean(this.eBuilderComp),this.eBuilderDialog?.isAlive()&&this.destroyBean(this.eBuilderDialog)})}mountTopSectionComp(e){this.headerCompHost=e,this.syncHeaderComp()}focusHeaderComp(){return this.eHeaderComp?(this.eHeaderComp.getFocusableElement().focus(),!0):!1}refreshComp(){this.eFilterComp?.refresh(),this.eHeaderComp?.refresh()}refreshBuilderComp(){this.eBuilderComp?.refresh()}getHeaderHeight(){return this.eHeaderComp?.getHeight()??0}setInputDisabled(e){this.eFilterComp?.setInputDisabled(e),this.eHeaderComp?.setInputDisabled(e)}toggleFilterBuilder(e){const{source:t,force:s,eventSource:r}=e,i=this.eBuilderDialog;if(s&&i||s===!1&&!i)return;if(i){this.builderDestroySource=t,this.destroyBean(i);return}this.setInputDisabled(!0);const{width:n,height:o,minWidth:a}=this.getBuilderDialogSize(),{suppressFullScreenButton:l}={suppressFullScreenButton:!1,...this.gos.get("advancedFilterBuilderParams")},c=this.createBean(new xG);this.eBuilderComp=c;const u=this.createBean(new ms({title:this.advFilterExpSvc.translate("advancedFilterBuilderTitle"),component:c,width:n,height:o,resizable:!0,movable:!0,maximizable:!l,centered:!0,closable:!0,minWidth:a,afterGuiAttached:()=>this.eBuilderComp?.afterGuiAttached(),postProcessPopupParams:{type:"advancedFilterBuilder",eventSource:r}}));this.eBuilderDialog=u,this.dispatchFilterBuilderVisibleChangedEvent(t,!0),u.addEventListener("destroyed",()=>{this.eBuilderDialog===u&&(this.destroyBean(this.eBuilderComp),this.eBuilderComp=void 0,this.eBuilderDialog=void 0,this.setInputDisabled(!1),this.dispatchLocalEvent({type:"advancedFilterBuilderClosed"}),this.dispatchFilterBuilderVisibleChangedEvent(this.builderDestroySource??"ui",!1),this.builderDestroySource=void 0)})}dispatchFilterBuilderVisibleChangedEvent(e,t){this.eventSvc.dispatchEvent({type:"advancedFilterBuilderVisibleChanged",source:e,visible:t})}getBuilderDialogSize(){const e=this.gos.get("advancedFilterBuilderParams")?.minWidth??500,t=this.popupSvc.getPopupParent(),s=Math.round(OL(t))-2,r=Math.round(GL(t)*.75)-2,i=VL(700,e,s),n=Math.min(600,r);return{width:i,height:n,minWidth:e}}onEnabledChanged(e){this.enabled=e,e||this.toggleFilterBuilder({source:"api",force:!1}),this.updateComps()}updateComps(){this.setAdvancedFilterComp(),this.syncHeaderComp(),this.eventSvc.dispatchEvent({type:"headerHeightChanged"})}setAdvancedFilterComp(){if(this.destroyFilterComp(),!this.enabled)return;const e=this.gos.get("advancedFilterParent");if(this.hasAdvancedFilterParent=!!e,e){const t=this.createBean(new tp),s=t.getGui();this.disconnectFilterComp=NL(this.environment,e,s),this.eFilterComp=t}}syncHeaderComp(){const e=this.headerCompHost;if(!e)return;if(!(this.enabled&&!this.hasAdvancedFilterParent)){if(!this.eHeaderComp)return;e.unmountComp(this.eHeaderComp.getGui()),this.destroyBean(this.eHeaderComp),this.eHeaderComp=void 0;return}this.eHeaderComp||(this.eHeaderComp=this.createManagedBean(new Pk(!0)),e.mountComp(this.eHeaderComp.getGui())),this.eHeaderComp.refreshLayout()}destroyFilterComp(){this.disconnectFilterComp?.(),this.destroyBean(this.eFilterComp)}},TG=class{constructor(e){this.params=e,this.operators=[],this.operatorStartPositions=[],this.operatorEndPositions=[],this.activeOperator=0,this.validationError=null}parseExpression(e){this.operators.push(""),this.operatorStartPositions.push(e),this.operatorEndPositions.push(void 0);const{expression:t}=this.params;for(;e<t.length;){const s=t[e];if(s===" "){if(this.parseOperator(e-1))return this.activeOperator++,e-1;this.operators[this.activeOperator]+=s}else this.operators[this.activeOperator]+=s;e++}return this.parseOperator(e-1),e}isValid(){return!this.validationError&&(!this.operators.length||!!this.parsedOperator)}getValidationError(){return this.validationError}getFunction(){return this.parsedOperator==="OR"?"||":"&&"}getModel(){return this.parsedOperator==="OR"?"OR":"AND"}getAutocompleteListParams(e,t){let s;if(t==null)s="";else{const i=this.operators[t],n=this.operatorEndPositions[t];s=ln(i,e,n==null?this.params.expression.length:n+1)}let r=this.params.advFilterExpSvc.getJoinOperatorAutocompleteEntries();return(t||t==null&&this.activeOperator)&&(r=r.filter(({key:i})=>i===this.parsedOperator)),this.params.advFilterExpSvc.generateAutocompleteListParams(r,"join",s)}updateExpression(e,t,s){let{expression:r}=this.params;const i=t.displayValue??t.key;if(s===0)for(let a=this.operatorEndPositions.length-1;a>0;a--){const l=this.operatorEndPositions[a];l!=null&&(r=fs(r,this.operatorStartPositions[a],l,i).updatedValue)}const n=this.operatorStartPositions.length>s?this.operatorStartPositions[s]:e,o=(this.operatorEndPositions.length>s?this.operatorEndPositions[s]:void 0)??Ma(r,e,!0).endPosition;return fs(r,n,o,i,!0)}getNumOperators(){return this.operators.length}getLastOperatorEndPosition(){return this.operatorEndPositions[this.operatorEndPositions.length-1]}parseOperator(e){const t=this.operators.length>this.activeOperator?this.operators[this.activeOperator]:"",s=this.params.advFilterExpSvc.getExpressionJoinOperators(),r=K1(t,s,i=>i);if(r){this.operatorEndPositions[this.activeOperator]=e;const i=s[r];if(this.activeOperator){if(r!==this.parsedOperator)return this.validationError??(this.validationError={message:this.params.advFilterExpSvc.translate("advancedFilterValidationJoinOperatorMismatch"),startPosition:e-t.length+1,endPosition:e}),!1}else this.parsedOperator=r;return t!==i&&(Ia(this.params,t,i,e),this.operators[this.activeOperator]=i),!0}else return r===null?!1:(this.validationError??(this.validationError={message:this.params.advFilterExpSvc.translate("advancedFilterValidationInvalidJoinOperator"),startPosition:e-t.length+1,endPosition:e}),!0)}},AG=class Hw{constructor(t,s){this.params=t,this.startPosition=s,this.expectingExpression=!0,this.expectingOperator=!1,this.expressionParsers=[],this.operatorParser=new TG(this.params),this.missingEndBracket=!1,this.extraEndBracket=!1}parseExpression(){let t=this.startPosition;const{expression:s}=this.params;for(;t<s.length;){const r=s[t];if(r==="("&&!this.expectingOperator){const i=new Hw(this.params,t+1);t=i.parseExpression(),this.expressionParsers.push(i),this.expectingExpression=!1,this.expectingOperator=!0}else{if(r===")")return this.endPosition=t-1,this.startPosition===0&&(this.extraEndBracket=!0),t;if(r!==" ")if(this.expectingExpression){const i=new CL(this.params,t);t=i.parseExpression(),this.expressionParsers.push(i),this.expectingExpression=!1,this.expectingOperator=!0}else this.expectingOperator&&(t=this.operatorParser.parseExpression(t),this.expectingOperator=!1,this.expectingExpression=!0)}t++}return this.startPosition>0&&(this.missingEndBracket=!0),t}isValid(){return!this.missingEndBracket&&!this.extraEndBracket&&this.expressionParsers.length===this.operatorParser.getNumOperators()+1&&this.operatorParser.isValid()&&this.expressionParsers.every(t=>t.isValid())}getValidationError(){const t=this.operatorParser.getValidationError();for(let r=0;r<this.expressionParsers.length;r++){const i=this.expressionParsers[r].getValidationError();if(i)return t&&t.startPosition<i.startPosition?t:i}if(t)return t;if(this.extraEndBracket)return{message:this.params.advFilterExpSvc.translate("advancedFilterValidationExtraEndBracket"),startPosition:this.endPosition+1,endPosition:this.endPosition+1};let s;return this.expressionParsers.length===this.operatorParser.getNumOperators()?s="advancedFilterValidationMissingCondition":this.missingEndBracket&&(s="advancedFilterValidationMissingEndBracket"),s?{message:this.params.advFilterExpSvc.translate(s),startPosition:this.params.expression.length,endPosition:this.params.expression.length}:null}getFunction(t){const s=this.operatorParser.getFunction(),r=this.expressionParsers.map(n=>n.getFunction(t)),i=s==="&&"?"every":"some";return(n,o,a)=>r[i](l=>l(n,o,a))}getAutocompleteListParams(t){if(this.endPosition!=null&&t>this.endPosition+1)return;if(!this.expressionParsers.length)return this.getColumnAutocompleteListParams();const s=this.getExpressionParserIndex(t);if(s==null)return this.params.expression[t]==="("?{enabled:!1}:this.getColumnAutocompleteListParams();const i=this.expressionParsers[s].getAutocompleteListParams(t);if(!i){if(s<this.expressionParsers.length-1)return this.operatorParser.getAutocompleteListParams(t,s);if(this.expressionParsers.length===this.operatorParser.getNumOperators()){const n=this.operatorParser.getLastOperatorEndPosition();return n==null||t<=n+1?this.operatorParser.getAutocompleteListParams(t,this.operatorParser.getNumOperators()-1):this.getColumnAutocompleteListParams()}return this.params.expression[t-1]===")"?{enabled:!1}:this.operatorParser.getAutocompleteListParams(t)}return i}updateExpression(t,s,r){const i=this.params.expression,n=this.getExpressionParserIndex(t);if(n==null){const l=r==="column"?this.params.advFilterExpSvc.getColumnValue(s):s.displayValue??s.key;return fs(i,this.startPosition,this.startPosition,l,!0)}const a=this.expressionParsers[n].updateExpression(t,s,r);return a??(r==="column"?fs(i,t,i.length-1,this.params.advFilterExpSvc.getColumnValue(s),!0):this.endPosition!=null&&t>this.endPosition+1?null:this.operatorParser.updateExpression(t,s,n))}getModel(t){return this.expressionParsers.length>1?{filterType:"join",type:this.operatorParser.getModel(),conditions:this.expressionParsers.map(s=>s.getModel(t))}:this.expressionParsers[0].getModel(t)}getColumnAutocompleteListParams(){return this.params.advFilterExpSvc.generateAutocompleteListParams(this.params.advFilterExpSvc.getColumnAutocompleteEntries(),"column","")}getExpressionParserIndex(t){let s;for(let r=0;r<this.expressionParsers.length&&!(this.expressionParsers[r].startPosition>t);r++)s=r;return s}},PG=class{constructor(e){this.params=e,this.valid=!1}parseExpression(){this.joinExpressionParser=new AG(this.params,0);const e=this.joinExpressionParser.parseExpression();return this.valid=e>=this.params.expression.length-1&&this.joinExpressionParser.isValid(),this.params.expression}isValid(){return this.valid}getValidationMessage(){const e=this.joinExpressionParser.getValidationError();if(!e)return null;const{message:t,startPosition:s,endPosition:r,selfContained:i}=e;return i?this.params.advFilterExpSvc.translate("advancedFilterValidationMessageOnly",[t]):s<this.params.expression.length?this.params.advFilterExpSvc.translate("advancedFilterValidationMessage",[t,this.params.expression.slice(s,r+1).trim()]):this.params.advFilterExpSvc.translate("advancedFilterValidationMessageAtEnd",[t])}getFunction(){const e=this.createFunctionParams();return{expressionFunction:this.joinExpressionParser.getFunction(e),params:e}}stripRedundantSeparators(e){const t=this.params.redundantSeparators;if(!t)return null;let s=this.params.expression,r=!1;for(let i=t.length-1;i>=0;--i){const{startPosition:n,endPosition:o}=t[i];e>o+1&&(s=s.slice(0,n)+s.slice(o+1),r=!0)}return r?s:null}getAutocompleteListParams(e){return this.joinExpressionParser.getAutocompleteListParams(e)??{enabled:!1}}updateExpression(e,t,s){return this.joinExpressionParser.updateExpression(e,t,s)}getModel(e){return this.isValid()?this.joinExpressionParser.getModel(e):null}createFunctionParams(){return{operands:[],operators:[],evaluatorParams:[]}}},RG=class extends Px{constructor(){super(...arguments),this.beanName="advancedFilter",this.appliedExpression=null,this.requestedExpression=null,this.expressionConfirmed=!1,this.appliedModel=null,this.appliedBuilderModel=null,this.appliedTextUnresolved=!1,this.expression=null,this.pendingModels=[]}wireBeans(e){this.valueSvc=e.valueSvc,this.colModel=e.colModel,this.dataTypeSvc=e.dataTypeSvc,this.advFilterExpSvc=e.advFilterExpSvc,this.advFilterSetSvc=e.advFilterSetSvc,this.filterValueSvc=e.filterValueSvc,this.filterManager=e.filterManager}postConstruct(){this.setEnabled(this.gos.get("enableAdvancedFilter"),!0),this.ctrl=this.createManagedBean(new FG(this.enabled)),this.expressionProxy={getValue:(t,s)=>{const r=this.colModel.getNonPivotColById(t);return r?this.filterValueSvc.getValue(r,s):void 0}},this.addManagedPropertyListener("enableAdvancedFilter",t=>this.setEnabled(!!t.currentValue)),this.addManagedPropertyListener("includeHiddenColumnsInAdvancedFilter",()=>this.revalidateAndApply()),this.addManagedEventListeners({dataTypesInferred:()=>this.onDataTypesInferred()}),this.addManagedListeners(this.advFilterSetSvc,{valuesChanged:()=>this.refreshAppliedExpressionText()});const e=this.beans.selectableFilter;e&&this.addManagedListeners(e,{selectedFilterChanged:()=>{this.advFilterExpSvc.resetColumnCaches(),this.advFilterSetSvc.refreshColumns(),(this.updateValidity()||this.isFilterPresent())&&this.filterManager?.onFilterChanged({source:"advancedFilter"})}})}onDataTypesInferred(){const e=this.pendingModels;this.pendingModels=[];for(let t=0,s=e.length;t<s;++t){const{model:r,source:i}=e[t];this.applyModel(r),this.filterManager?.onFilterChanged({source:i})}this.revalidateAndApply()}revalidateAndApply(){this.updateValidity()&&this.filterManager?.onFilterChanged({source:"advancedFilter"})}isEnabled(){return this.enabled}isFilterPresent(){return!!this.expressionFunction}doesFilterPass(e){return this.expressionFunction(this.expressionProxy,e,this.expressionParams)}getModel(){return Nr(this.appliedModel)}getLatestModel(){const e=this.pendingModels.at(-1);return Nr(e?e.model:this.appliedModel)}getBuilderModel(){return Nr(this.appliedBuilderModel)}modelToExpression(e,t){if(e.filterType==="join"){const s=this.advFilterExpSvc.parseJoinOperator(e),r=e.conditions.map(i=>this.modelToExpression(i)).filter(i=>i!=null&&i!=="").join(` ${s} `);return t||e.conditions.length<=1?r:`(${r})`}return this.advFilterExpSvc.parseColumnFilterModel(e)}writeExpression(e){const t=this.advFilterExpSvc;t.wroteUnresolvedSetValue=!1;const s=e?this.modelToExpression(e,!0):null;return this.appliedTextUnresolved=t.wroteUnresolvedSetValue,s}refreshAppliedExpressionText(){if(!this.appliedTextUnresolved)return;const e=this.appliedModel;if(!e||this.expression!==this.appliedExpression)return;const t=this.writeExpression(e);t!==this.expression&&(this.expression=t,this.appliedExpression=t,this.requestedExpression=t),this.ctrl.refreshComp()}setModelOrDefer(e,t){if(this.dataTypeSvc?.isPendingInference){this.pendingModels.push({model:Nr(e),source:t});return}this.setModel(e),this.filterManager?.onFilterChanged({source:t})}setModel(e){this.pendingModels.length=0,this.applyModel(e)}restoreAppliedExpression(){this.applyModel(this.appliedModel)}applyModel(e){const t=this.writeExpression(e),s=this.appliedTextUnresolved;this.setExpressionDisplayValue(t),this.applyText(),this.appliedTextUnresolved=s,this.ctrl.refreshComp(),this.ctrl.refreshBuilderComp()}getExpressionDisplayValue(){return this.expression}setExpressionDisplayValue(e){e!==this.expression&&(this.expressionConfirmed=!1),this.expression=e}submitExpression(){this.pendingModels.length=0,this.expressionConfirmed=!0}isCurrentExpressionApplied(){return this.appliedExpression===this.expression}createExpressionParser(e){return e?new PG({expression:e,colModel:this.colModel,dataTypeSvc:this.dataTypeSvc,valueSvc:this.valueSvc,advFilterExpSvc:this.advFilterExpSvc,advFilterSetSvc:this.advFilterSetSvc}):null}getDefaultExpression(e){const t=this.advFilterExpSvc.getColumnValue(e)+" ";return{updatedValue:t,updatedPosition:t.length}}isHeaderActive(){return!this.gos.get("advancedFilterParent")}getCtrl(){return this.ctrl}setEnabled(e,t){const s=this.enabled,r=this.gos,i=kL(r)||_L(r);e&&!i&&this.warn(123);const n=e&&i;this.enabled=n,n||(this.expressionConfirmed=!1,this.requestedExpression=null,this.pendingModels.length=0),!t&&n!==s&&this.eventSvc.dispatchEvent({type:"advancedFilterEnabledChanged",enabled:n})}applyExpression(){this.pendingModels.length=0,this.applyText()}applyText(){const e=this.expression;this.expressionConfirmed=!0,this.applyExpressionFromParser(this.parseExpression(e),e),this.requestedExpression=this.appliedExpression}parseExpression(e){const t=this.createExpressionParser(e);return t?.parseExpression(),t}getAppliedExpressionDisplayValue(){return this.appliedExpression}applyExpressionFromParser(e,t){if(this.appliedTextUnresolved=!1,!e?.isValid()){this.expressionFunction=null,this.expressionParams=null,this.appliedExpression=null,this.appliedModel=null,this.appliedBuilderModel=null;return}const{expressionFunction:s,params:r}=e.getFunction();this.expressionFunction=s,this.expressionParams=r,this.appliedExpression=t,this.appliedModel=e.getModel(),this.appliedBuilderModel=e.getModel(!0)}updateValidity(){if(!this.enabled)return!1;this.advFilterExpSvc.resetColumnCaches();const e=this.appliedExpression,t=!!this.expressionFunction,s=this.expression,r=this.expressionConfirmed&&s!==e?this.parseExpression(s):null;if(r?.isValid()&&!r.getValidationMessage())this.applyExpressionFromParser(r,s),this.requestedExpression=s;else{const n=this.requestedExpression,o=this.parseExpression(n);o?.isValid()&&o.getValidationMessage()?this.reapplyKeepingSetValues(o):this.applyExpressionFromParser(o,n)}const i=this.ctrl;return i.refreshComp(),i.refreshBuilderComp(),this.appliedExpression!==e||!!this.expressionFunction!==t}reapplyKeepingSetValues(e){const t=this.expressionParams;if(!t)return;const{expressionFunction:s,params:r}=e.getFunction(),i=r.operands,n=t.operands,o=i.length;if(o===n.length){for(let a=0;a<o;++a){const l=n[a],c=i[a];if(typeof l=="function"&&typeof c=="function")i[a]=l;else if(!MG(l,c))return}this.expressionFunction=s,this.expressionParams=r}}},MG=(e,t)=>e===t||e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime(),Nr=e=>{if(!e)return null;if(e.filterType==="join"){const t=e.conditions,s=t.length,r=new Array(s);for(let i=0;i<s;++i)r[i]=Nr(t[i]);return{...e,conditions:r}}return e.filterType==="set"?{...e,values:e.values?.slice()}:{...e}};import{_areEqual as IG,_last as EG,_pushToMapArray as Ep}from"ag-stack";import{BeanStub as DG,_addGridCommonParams as LG,_getCellRendererDetails as kG,_getFilterDetails as _G,_isClientSideRowModel as GG,_mergeFilterParamsWithApplicationProvidedParams as OG,_resolveFilter as Br}from"ag-grid-community";import{_defaultComparator as NG,_last as BG,_toStringOrNull as VG,_translate as HG}from"ag-stack";import{_isBlank as UG}from"ag-grid-community";var zG={loadingOoo:"Loading...",blanks:"(Blanks)",searchOoo:"Search...",selectAll:"(Select All)",selectAllSearchResults:"(Select All Search Results)",addCurrentSelectionToFilter:"Add current selection to filter",ariaSearchFilterValues:"Search filter values",ariaFilterList:"Filter List",ariaNotInCurrentData:"not in current data",filterSummaryListInactive:"is (All)",filterSummaryListSeparator:", ",filterSummaryListShort:e=>`is (${e[0]})`,filterSummaryListLong:e=>`is (${e[0]}) and ${e[1]} more`};function Dp(e,t){const s=e.keys;if(s){for(let i=0,n=s.length;i<n;++i)if(!t.has(s[i]))return!1}const r=e.children;if(r){for(const i of r.values())if(!Dp(i,t))return!1}return!0}function Ja(e,t){return t&&!e.keyOnly?t(e.treeKey,e.depth,e.parentTreeKeys):e.treeKey}var Qa=e=>e??null;function el(e,t,s){let r=e;return r?(r=r.map(i=>VG(Rt(i))),!t&&s&&r.some(i=>i==null)?BG(r)==null?null:r.filter(i=>i!=null):r):null}function Lp(e,t){const s=t.cellDataType;return typeof s=="string"?e.dataTypeSvc?.getFormatValue(s):void 0}function Rt(e){return e==null||UG(e)?null:e}function tl(e,t){const s=new Map;for(const r of e)s.set(t(r),r);return s}function kp(e,t,s,r){return e.valueSvc.formatValue(t,null,s,r,!1)}function Ce(e,t,s){return HG(e,zG,t,s)}function WG(e,t){e.excelMode==="windows"?(e.buttons??(e.buttons=["apply","cancel"]),e.closeOnApply??(e.closeOnApply=!0)):e.excelMode==="mac"&&(e.buttons??(e.buttons=["reset"]),e.applyMiniFilterWhileTyping??(e.applyMiniFilterWhileTyping=!0),e.debounceMs??(e.debounceMs=500)),e.excelMode&&e.defaultToNothingSelected&&(e.defaultToNothingSelected=!1,t.log.warn(207))}function KG(e,t){if(e==null)return t==null?0:-1;if(t==null)return 1;for(let s=0;s<e.length;s++){if(s>=t.length)return 1;const r=NG(e[s],t[s]);if(r!==0)return r}return 0}import{_createElement as _p}from"ag-grid-community";var $G=(e,t)=>{const s=_p({tag:"span",cls:"ag-autocomplete-row-path-parent"});let r=t;for(;r>0&&e.firstChild;){const i=e.firstChild,n=i.textContent??"";if(n.length<=r){r-=n.length,s.appendChild(i);continue}const o=i.cloneNode(!1);o.textContent=n.slice(0,r),i.textContent=n.slice(r),s.appendChild(o),r=0}e.prepend(s)},jG=class extends Qh{constructor(e,t,s){super(),this.parentLength=t,this.createCellRenderer=s,this.rendererOwnsLabel=!1,this.value=e}postConstruct(){this.render()}setSearchString(e){this.rendererOwnsLabel||super.setSearchString(e)}render(){const e=this.createCellRenderer?.();if(!e){super.render();return}const t=this.getLabel();t.textContent="",this.rendererOwnsLabel=!0,e.newAgStackInstance().then(s=>{if(!this.isAlive()){this.destroyBean(s);return}this.addDestroyFunc(()=>this.destroyBean(s)),t.appendChild(s.getGui()),this.afterLabelRendered()})}afterLabelRendered(){const e=this.parentLength;if(!e)return;const t=this.getLabel();if(!this.rendererOwnsLabel){$G(t,e);return}t.prepend(_p({tag:"span",cls:"ag-autocomplete-row-path-parent",children:this.value.slice(0,e)}))}},Gp=e=>"path"in e,vs="agSetColumnFilter",YG={filter:vs},Op="set-value",qG="\0",ZG=[],XG=class extends Rx{constructor(){super(...arguments),this.beanName="advFilterSetSvc",this.columns=new Map,this.listCount=0}wireBeans(e){this.registry=e.registry,this.userCompFactory=e.userCompFactory,this.advFilterExpSvc=e.advFilterExpSvc}postConstruct(){const e=()=>this.refreshColumns(),t=()=>{this.refreshColumns(),this.createPreservingColumns()};this.addManagedEventListeners({newColumnsLoaded:t,dataTypesInferred:t,advancedFilterEnabledChanged:s=>{s.enabled?this.createPreservingColumns():this.reset()},filterChanged:()=>this.refreshAppliedValues(),columnRowGroupChanged:e,columnPivotModeChanged:e,columnPivotChanged:e,rowDataUpdated:()=>this.onNewRowsLoaded()}),this.addManagedPropertyListeners(["treeData"],e),this.addDestroyFunc(()=>this.reset())}refreshColumns(){const e=this.columns,t=this.beans.colModel;for(const[s,r]of e){const i=t.getNonPivotColById(s);if(r&&i&&this.offersSetOperators(i)){const n=r.handler;n.refresh(this.createHandlerParams(i,"colDef")),n.onNewRowsLoadedForColDef(),r.values=null;continue}r&&this.destroyColumn(r),e.delete(s)}this.invalidateList()}createPreservingColumns(){const{colModel:e,filterManager:t,dataTypeSvc:s}=this.beans;if(!t?.isAdvFilterEnabled()||s?.isPendingInference)return;const r=e.getColsInStateOrder();for(let i=0,n=r.length;i<n;++i){const o=r[i];o.primary&&!this.columns.has(o.getColId())&&this.isPreserving(o)&&this.getSetColumn(o)}}isPreserving(e){const t=this.getSetFilter(e,Br(this.beans,e));return!!(t&&ps(this.beans,e,this.getSetColDef(e,t)))?.preservePreviousValues}refreshAppliedValues(){if(!this.columns.size)return;const e=this.beans.advancedFilter?.getModel();for(const[t,s]of this.columns)s?.handler.holdKeys(rl(e,t))}onNewRowsLoaded(){for(const e of this.columns.values())e?.handler.onNewRowsLoaded()}offersSetOperators(e){if(!e)return!1;const t=Br(this.beans,e);if(AL(this.advFilterExpSvc.getColumnFilterOptions(e,t)))return this.gos.assertModuleRegistered("SetFilter",4);if(!this.gos.isModuleRegistered("SetFilter"))return!1;const s=this.getSetFilter(e,t);return!!s&&this.hasSetFilterValues(e,s)}hasSetFilterValues(e,t){return GG(this.gos)?!0:!!ps(this.beans,e,this.getSetColDef(e,t))?.values}hasSetFilter(e){return this.gos.isModuleRegistered("SetFilter")&&e.key===vs}getSetFilter(e,t){return t.key===vs?t:Ta(this.beans,e,t)?.find(s=>s.key===vs)}getKeys(e,t){const s=this.getSetColumn(e),r=s&&this.getValues(s);if(!r)return;const i=s.handler.caseFormat(sl(t)),n=r.keysByPath.get(i);if(n===void 0)return;const o=r.sharedKeysByPath.get(i);return o?[n,...o]:[n]}getPath(e,t){const s=this.getSetColumn(e);return(s&&this.getValues(s))?.pathsByKey.get(s.handler.caseFormat(t))}getAllKeys(e){const t=this.getSetColumn(e);return t&&this.getValues(t)?t.keys:void 0}refreshValuesOnFocus(){for(const[e,t]of this.columns)t?.handler.params.filterParams.refreshValuesOnOpen&&(t.handler.refreshFilterValues(),this.invalidateValues(e))}getBlankLabel(e){const t=this.getSetColumn(e);return t?Ce(t.handler,"blanks"):void 0}getAutocompleteList(e,t){const s=e.getColId(),r=this.list;if(r?.colId===s&&t2(r.usedKeys,t))return r;const i=this.getSetColumn(e),n=i&&this.getValues(i),o=n?.entries??ZG,a=i?.handler.valueModel.missingKeys;let l=o;if(t.size||a?.size){l=[];for(let u=0,d=o.length;u<d;++u){const h=o[u],p=h.setKey;!t.has(p)&&!a?.has(p)&&l.push(h)}}const c={type:`${Op}-${++this.listCount}`,colId:s,usedKeys:t,entries:l,isTree:!!i?.handler.params.filterParams.treeList,loading:!!i&&!n,rowComponentCreator:n?this.createRowCreator(e,i.handler):void 0};return n&&(this.list=c),c}writePath(e,t){if(t.length<2)return Dr(t[0]);const s=zh(t);return IG(un(s),t)&&!this.getKeys(e,[s])?Dr(s):IL(t)}writeEntry(e,t){return Gp(t)?this.writePath(e,t.path):Dr(t.key)}isSetValueType(e){return!!e?.startsWith(`${Op}-`)}createRowCreator(e,t){const s=t.params.filterParams,r=s.cellRenderer;if(!r&&!s.treeList)return;const i=e.getColDef(),n=!!s.treeList;return o=>{const a=o.displayValue??o.key,l=Gp(o)?o:void 0,c=l?EG(l.path):a,u=n&&l&&l.path.length>1?a.length-c.length:0,d=r?()=>kG(this.userCompFactory,s,LG(this.gos,{value:n||!l?c:t.valueModel.allValues.get(l.setKey),valueFormatted:c,colDef:i,column:e})):void 0;return new jG(a,u,d)}}createMatcher(e,t){const s=this.getSetColumn(e)?.handler;return s?s.createKeysMatcher(t):()=>{}}getValues(e){if(e.values)return e.values;const t=e.handler.valueModel.allKeys;if(e.keysPromise!==t){e.keysPromise=t,e.keys=void 0;let r=!1;t.then(i=>{e.keys=i??[],r&&this.invalidateList()}),r=!0}const s=e.keys;return s?(e.values=e.handler.params.filterParams.treeList?e2(e,s):QG(e,s),e.values):null}getSetColumn(e){const t=e.getColId(),s=this.columns,r=s.get(t);if(r!==void 0)return r;const i=this.createSetColumn(e);return s.set(t,i),i}createSetColumn(e){if(!this.offersSetOperators(e))return null;const t=this.registry.createDynamicBean("agSetColumnFilterHandler",!1);if(!t)return null;const s=this.createBean(t);s.init(this.createHandlerParams(e,"init"));const r=e.getColId();s.holdKeys(rl(this.beans.advancedFilter?.getModel(),r));const[i]=this.addManagedListeners(s,{dataChanged:()=>this.invalidateValues(r)});return{handler:s,values:null,removeListener:i}}destroyColumn(e){e.removeListener(),this.destroyBean(e.handler)}createFilterUi(e,t,s){const r=this.getSetColumn(e)?.handler;if(!r)return;const i={...this.createSharedParams(e),buttons:[],model:t,state:{model:t},onStateChange:o=>{i.model=o.model,s(o.model)},onModelChange:()=>{},onAction:()=>{},onUiChange:()=>{},getHandler:()=>r,filterChangedCallback:()=>{},filterModifiedCallback:()=>{},source:"init"},n=this.getSetColDef(e,this.getSetFilter(e,Br(this.beans,e)));return _G(this.userCompFactory,n,i,vs)}createSharedParams(e){return this.beans.colFilter.createBaseFilterParams(e,!0)}getSetColDef(e,t){const s=e.getColDef(),r=t?.def;if(r===s)return s;const i=r?r.filterParams:this.getKeyFormatterParams(s);return{...s,filter:vs,filterParams:i}}getKeyFormatterParams(e){const t=Lp(this.beans,e);if(!(!t||e.keyCreator!==t))return{valueFormatter:s=>t(s)||Ce(this,"blanks")}}createHandlerParams(e,t){const s=this.beans,r=s.colFilter,i=Br(s,e),n=this.getSetFilter(e,i),o=this.getSetColDef(e,n),a=n?.filterValueGetter??Br(s,e,YG,vs,i).filterValueGetter,l={...this.createSharedParams(e),filterValueGetter:a,getValue:r.createHandlerGetValue(e,a),model:null,source:t,onModelChange:()=>{},onModelAsStringChange:()=>{},filterChangedCallback:()=>{},filterModifiedCallback:()=>{},filterParams:o.filterParams};return l.filterParams=OG(this.userCompFactory,o,l),l}invalidateValues(e){const t=this.columns.get(e);t&&(t.values=null,this.invalidateList())}invalidateList(){this.list=void 0,this.dispatchLocalEvent({type:"valuesChanged"})}reset(){for(const e of this.columns.values())e&&this.destroyColumn(e);this.columns.clear(),this.list=void 0}},sl=e=>e.join(qG),rl=(e,t,s=[])=>{if(e?.filterType==="join"){const r=e.conditions;for(let i=0,n=r.length;i<n;++i)rl(r[i],t,s)}else if(e?.filterType==="set"&&e.colId===t){const r=e.values;for(let i=0,n=r.length;i<n;++i)s.push(r[i])}return s},Np=()=>({keysByPath:new Map,sharedKeysByPath:new Map,pathsByKey:new Map}),JG=(e,t,s)=>{const r=Ir(e),i=s?Ir(un(r)):r;return{key:r,setKey:t,path:e,searchValue:i===r?void 0:i}},il=(e,t,s,r,i,n)=>{const{keysByPath:o,sharedKeysByPath:a,pathsByKey:l}=t,c=s.length-1,u=r[0];let d=e.caseFormat(sl(s));o.has(d)&&(s[c]=u??"",d=e.caseFormat(sl(s))),l.set(e.caseFormat(u),s),o.has(d)?Ep(a,d,u):(o.set(d,u),i?.push(JG(s,u,n)));for(let h=1,p=r.length;h<p;++h){const g=r[h];l.set(e.caseFormat(g),s),Ep(a,d,g)}},QG=(e,t)=>{const s=e.handler,r=[],i=Np();for(let n=0,o=t.length;n<o;++n){const a=t[n];il(s,i,[s.getFormattedValue(a)],[a],r,!1)}return{entries:r,...i}},e2=(e,t)=>{const s=e.handler,r=s.params.filterParams.treeListFormatter,i=[],n=Np(),o=(a,l)=>{for(const c of a.values()){const u=Ja(c,r)??Ce(s,"blanks"),d=[...l,u],h=c.children,p=c.keys;if(h?.size){o(h,d),p&&il(s,n,d,p,null,!0);continue}p&&il(s,n,d,p,i,!0)}};return o(s.createDisplayValueTree(t),[]),{entries:i,...n}},t2=(e,t)=>{if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0},Bp={moduleName:"AdvancedFilter",version:_,beans:[RG,DL,XG],icons:{advancedFilterBuilder:"group",advancedFilterBuilderDrag:"grip",advancedFilterBuilderInvalid:"not-allowed",advancedFilterBuilderMoveUp:"up",advancedFilterBuilderMoveDown:"down",advancedFilterBuilderAdd:"plus",advancedFilterBuilderRemove:"minus",advancedFilterBuilderSelectOpen:"small-down",richSelectRemove:"cancel",richSelectLoading:"loading"},apiFunctions:{getAdvancedFilterModel:x1,setAdvancedFilterModel:F1,showAdvancedFilterBuilder:T1,hideAdvancedFilterBuilder:A1},dependsOn:[$,C1,y1,S1,b1,v1],css:[w1]};import{ColumnApiModule as s2}from"ag-grid-community";import{STRUCTURED_SCHEMA_FEATURES as r2}from"ag-grid-community";var Os=class{constructor(e){this._defs={},this._nullable=!1,this.description=e}_collectNestedDefs(e){const t={...this._defs};for(const s of e)s&&typeof s=="object"&&"$defs"in s&&(Object.assign(t,s.$defs),delete s.$defs);return t}_toJSON(e={}){const t={type:this._nullable?[this.type,"null"]:this.type,description:this.description,...e};return Object.keys(this._defs).length>0&&(t.$defs=this._defs),t}nullable(){return this._nullable=!0,this}define(e,t){return this._defs[e]=t,this}},i2=class extends Os{constructor(e){super(typeof e=="string"?e:e?.description),this.type="string",typeof e=="object"&&e&&(this._pattern=e.pattern,this._format=e.format)}pattern(e){return this._pattern=e,this}format(e){return this._format=e,this}toJSON(){return this._toJSON({pattern:this._pattern,format:this._format})}},n2=class extends Os{constructor(e){super(typeof e=="string"?e:e?.description),this.type="number",typeof e=="object"&&e&&(this._minimum=e.minimum,this._maximum=e.maximum,this._exclusiveMinimum=e.exclusiveMinimum,this._exclusiveMaximum=e.exclusiveMaximum,this._multipleOf=e.multipleOf)}minimum(e){return this._minimum=e,this}exclusiveMinimum(e){return this._exclusiveMinimum=e,this}maximum(e){return this._maximum=e,this}exclusiveMaximum(e){return this._exclusiveMaximum=e,this}multipleOf(e){return this._multipleOf=e,this}toJSON(){return this._toJSON({minimum:this._minimum,exclusiveMinimum:this._exclusiveMinimum,maximum:this._maximum,exclusiveMaximum:this._exclusiveMaximum,multipleOf:this._multipleOf})}},Vp=class extends Os{constructor(e,t){super(t),this._enum=e,this.type="string"}toJSON(){return this._toJSON({enum:this._enum})}},o2=class extends Vp{constructor(e,t){super([e],t)}},a2=class extends Os{constructor(e){super(e),this.type="boolean"}toJSON(){return this._toJSON()}},l2=class extends Os{constructor(e,t){super(typeof t=="string"?t:t?.description),this.items=e,this.type="array",typeof t=="object"&&t&&(this._minItems=t.minItems,this._maxItems=t.maxItems)}minItems(e){return this._minItems=e,this}maxItems(e){return this._maxItems=e,this}toJSON(){const e=this.items.toJSON(),t=this._collectNestedDefs([e]);return this._defs=t,this._toJSON({items:e,minItems:this._minItems,maxItems:this._maxItems})}},c2=class extends Os{constructor(e,t){super(t),this.properties=e,this.type="object"}toJSON(){const e=Object.fromEntries(Object.keys(this.properties).map(s=>[s,this.properties[s].toJSON()])),t=this._collectNestedDefs(Object.values(e));return this._defs=t,this._toJSON({required:Object.keys(this.properties),additionalProperties:!1,properties:e})}},u2=class{constructor(e,t){this.schemas=e,this._nullable=!1,this._defs={},this.description=t}nullable(){return this._nullable=!0,this}define(e,t){return this._defs[e]=t,this}_collectNestedDefs(e){const t=this._defs;for(const s of e)s&&typeof s=="object"&&"$defs"in s&&(Object.assign(t,s.$defs),delete s.$defs);return t}toJSON(){const e=this.schemas.map(r=>r.toJSON()),t=this._collectNestedDefs(e),s={anyOf:this._nullable?[...e,{type:"null"}]:e};return this.description&&(s.description=this.description),Object.keys(t).length>0&&(s.$defs=t),s}},d2=class{constructor(e){this.id=e}nullable(){return this}toJSON(){return{$ref:`#/$defs/${this.id}`}}},M={string:e=>new i2(e),number:e=>new n2(e),enum:(e,t)=>new Vp(e,t),boolean:e=>new a2(e),array:(e,t)=>new l2(e,t),object:(e,t)=>new c2(e,t),union:(e,t)=>new u2(e,t),literal:(e,t)=>new o2(e,t),ref:e=>new d2(e)},h2=e=>{const{aggFuncSvc:t}=e;if(!t)return;const r=e.colModel.getCols().filter(i=>i.isAllowValue()&&t.getFuncNames(i).length>0);if(r.length!==0)return M.object({aggregationModel:M.array(M.union(r.map(i=>M.object({colId:M.literal(i.colId,"Column identifier"),aggFunc:M.enum(e.aggFuncSvc?.getFuncNames(i)??[],"Aggregation function")}))),"Array of column aggregations")},"Aggregation configuration for the grid").nullable()},p2=e=>{const s=e.colModel.getCols().filter(i=>i.isResizable());if(s.length===0)return;const r=s.map(i=>i.colId);return M.object({columnSizingModel:M.array(M.union([M.object({colId:M.ref("resizableColumnId"),width:M.number("Fixed width in pixels").minimum(20)}),M.object({colId:M.ref("resizableColumnId"),flex:M.number("Flex sizing ratio").minimum(0)})]),"Array of column sizing configurations")},"Column sizing configuration for the grid").define("resizableColumnId",M.enum(r,"Column ID that supports resizing"))},g2=()=>M.object({hiddenColIds:M.array(M.ref("allColumnIds"),"Array of column IDs to hide")},"Column visibility configuration for the grid").nullable();import{_ADVANCED_FILTER_ONLY_OPTIONS as f2,_classifyFilterOptions as m2,_getDisplayHandler as Hp,_resolveFilter as v2}from"ag-grid-community";import{_getOwn as C2}from"ag-stack";function b2(e,t,s){const r=e.getColumnOperators(s,t),i=r?.operators.getEntries(r.activeOperators)??[],n=new Map;for(let o=0,a=i.length;o<a;++o){const l=i[o].key,c=C2(r.operators.operators,l)?.operands??"none",u=n.get(c);u?u.push(l):n.set(c,[l])}return n}var S2=({colModel:e,dataTypeSvc:t,advFilterExpSvc:s})=>{if(!t||!s)return;const r=s,i=e.getCols(),n=new Map;for(const u of i){const d=t.getBaseDataType(u);if(!d)continue;b2(r,u,d).forEach((p,g)=>{const f=g==="list"?"set":d,m=`${f} ${g} ${JSON.stringify(p)}`,v=n.get(m);v?v.colIds.push(u.colId):n.set(m,{schemaName:f,operatorKeys:p,operands:g,colIds:[u.colId]})})}const o=[],a={},l={};for(const u of n.values()){const d=u.schemaName,h=(l[d]??0)+1;l[d]=h;const p=`${d}AdvancedFilterModel${h>1?h:""}`;a[p]=w2(u).toJSON(),o.push({$ref:`#/$defs/${p}`})}a.joinAdvancedFilterModel=M.object({filterType:M.literal("join","Filter type identifier for joining multiple advanced filter conditions"),type:M.enum(["AND","OR"],"Logical operator to combine multiple advanced filter conditions"),conditions:M.array(M.ref("advancedFilterModel"),"Array of advanced filter conditions to be combined")}),a.advancedFilterModel={anyOf:[...o,{$ref:"#/$defs/joinAdvancedFilterModel"}]};const c=M.object({advancedFilterModel:M.ref("advancedFilterModel")},"Advanced filter configuration for the grid").nullable();for(const u of Object.keys(a))c.define(u,a[u]);return c},Up=()=>M.string({pattern:String.raw`^\d{4}-\d{2}-\d{2}$`,description:"Date value in YYYY-MM-DD format"}),y2={boolean:{filterType:"boolean",noun:"boolean",titleNoun:"Boolean",value:()=>M.string("Filter value to compare against boolean column values")},object:{filterType:"object",noun:"object",titleNoun:"Object",value:()=>M.string("Filter value to compare against object column values")},date:{filterType:"date",noun:"date",titleNoun:"Date",value:Up},dateString:{filterType:"dateString",noun:"date string",titleNoun:"Date string",value:Up},dateTime:{filterType:"dateTime",noun:"datetime",titleNoun:"DateTime",value:()=>M.string({pattern:String.raw`^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$`,description:"DateTime value in YYYY-MM-DDTHH:mm:ss format"})},dateTimeString:{filterType:"dateTimeString",noun:"datetime string",titleNoun:"DateTime string",value:()=>M.string({pattern:String.raw`^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$`,description:"DateTime value in YYYY-MM-DD HH:mm:ss format"})},number:{filterType:"number",noun:"number",titleNoun:"Number",value:()=>M.number("Numeric value to filter by")},bigint:{filterType:"bigint",noun:"bigint",titleNoun:"BigInt",value:()=>M.string({pattern:String.raw`^-?\d+$`,description:"BigInt value to filter by"})},text:{filterType:"text",noun:"text",titleNoun:"Text",value:()=>M.string("Text value to filter by")}};function w2(e){const t=e.schemaName;if(t==="set")return M.object({filterType:M.literal("set","Filter type identifier for set column filters"),colId:M.enum(e.colIds,"Column identifier for the Set Filter column to filter"),type:M.enum(e.operatorKeys,"Set filter operation type"),values:M.array(M.string().nullable(),"The values to filter on; null matches blank cells").minItems(1)});const{filterType:s,noun:r,titleNoun:i,value:n}=y2[t],o={filterType:M.literal(s,`Filter type identifier for ${r} column filters`),colId:M.enum(e.colIds,`Column identifier for the ${r} column to filter`),type:M.enum(e.operatorKeys,`${i} filter operation type`)},a=Rr[e.operands];return a>0&&(o.filter=n().nullable()),a>1&&(o.filterTo=n().nullable()),M.object(o)}var x2="agTextColumnFilter",zp="agNumberColumnFilter",Wp="agBigIntColumnFilter",Kp="agDateColumnFilter",F2="agSetColumnFilter",T2="agMultiColumnFilter",A2=[x2,zp,Wp,Kp],P2=(e,t)=>{const{advancedFilter:s}=e;return s?.isEnabled()?S2(e):R2(e,t)},R2=(e,t)=>{const{gos:s,colFilter:r,colModel:i}=e;if(!r)return;const o=i.getCols().filter(c=>c.isFilterAllowed());if(o.length===0)return;const a={},l=s.get("enableFilterHandlers");for(const c of o){const u=c.colId,h=t?.columns?.[u]?.includeSetValues??!1,p=$p(e,c,v2(e,c),(g=!1,f=0)=>{if(!h)return[];let m;return g?l&&(m=Hp(r.getHandler(c,!0)).getChildDisplayHandler(f)):m=Hp(r.getHandler(c,!0)),m?m.getFilterKeys():[]});p&&(a[u]=p.nullable())}return M.object({filterModel:M.object(a)}).nullable()};function $p(e,t,s,r){const i=s.key;if(i&&A2.includes(i)){const n=e.colFilter.resolveFilterParams(t,s.def),o=n?.maxNumConditions,a=n?.filterOptions,l=a?[...m2(a,()=>{},f2).offered.keys()]:void 0,c=n?.useIsoSeparator||!1;return M2(i,{maxConditions:o,filterOptions:l,useIsoSeparator:c})}else{if(i===F2)return D2(r);if(i===T2)return L2(e,t,Ta(e,t,s),r)}return null}var M2=(e,t)=>e===Kp?E2(t):e===zp?jp("number","Number",s=>M.number(s),t):e===Wp?jp("bigint","BigInt",r=>M.string({pattern:String.raw`^-?\d+$`,description:r}),t):I2(t),nl=(e,t,s=2)=>s===1?e:M.object({filterType:M.literal(t,`Filter type identifier for ${t} filters with multiple conditions`),operator:M.enum(["AND","OR"],"Logical operator to combine multiple filter conditions. Must be included even with a single filter to adhere to the API."),conditions:M.array(e,"Array of filter conditions to be combined").minItems(2).maxItems(s)}),I2=e=>{const t=e.filterOptions??["contains","notContains","equals","notEqual","startsWith","endsWith","blank","notBlank"],s=M.object({filterType:M.literal("text","Filter type identifier for text filters"),type:M.enum(t,"Text filter operation type"),filter:M.string("Primary filter value").nullable(),filterTo:M.string("Secondary filter value for range operations").nullable()});return nl(s,"text",e.maxConditions)},jp=(e,t,s,r)=>{const i=r.filterOptions??["equals","notEqual","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual","inRange","blank","notBlank"],n=M.object({filterType:M.literal(e,`Filter type identifier for ${e} filters`),type:M.enum(i,`${t} filter operation type`),filter:s("Primary filter value").nullable(),filterTo:s("Secondary filter value for range operations").nullable()});return nl(n,e,r.maxConditions)},E2=e=>{const t=e.filterOptions??["equals","notEqual","lessThan","greaterThan","inRange","blank","notBlank"],s=e.useIsoSeparator?String.raw`^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$`:String.raw`^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$`,r=M.object({filterType:M.literal("date","Filter type identifier for date filters"),type:M.enum(t,"Date filter operation type"),dateFrom:M.string({pattern:s,description:"Primary date filter value in YYYY-MM-DD HH:mm:ss format"}).nullable(),dateTo:M.string({pattern:s,description:"Secondary date filter value for range operations in YYYY-MM-DD HH:mm:ss format"}).nullable()});return nl(r,"date",e.maxConditions)},D2=e=>{const t=e?e().filter(Boolean):[];return M.object({filterType:M.literal("set","Filter type identifier for set filters"),values:M.array(t.length>0?M.enum(t,"Available values to filter by"):M.string("Filter values"),"Array of values to include in the filter")})},L2=(e,t,s,r=()=>[])=>{const i=s.map((n,o)=>$p(e,t,n,()=>r(!0,o))).filter(n=>n!==null);return i.length===0?null:M.object({filterType:M.literal("multi","Filter type identifier for multi-condition filters"),filterModels:M.array(M.union(i,"Union of different filter types that can be combined").nullable(),"Array of filter conditions to be combined with AND/OR logic")})},k2=e=>{const s=e.colModel.getCols().filter(r=>r.isAllowPivot()).map(r=>r.colId);if(s.length!==0)return M.object({pivotMode:M.boolean("Whether pivot mode is enabled"),pivotColIds:M.array(M.enum(s,"Column ID that supports pivoting"),"Array of column IDs to use as pivot columns")},"Pivot configuration for the grid").nullable()},_2=e=>{const s=e.colModel.getCols().filter(i=>i.isAllowRowGroup());if(s.length===0)return;const r=s.map(i=>i.colId);return M.object({groupColIds:M.array(M.enum(r,"Column ID that supports row grouping"),"Array of column IDs to group by")},"Row grouping configuration for the grid")},G2=e=>{const{sortSvc:t}=e;if(!t)return;const r=e.colModel.getCols().filter(n=>n.isSortable());if(r.length===0)return;const i=r.map(n=>n.colId);return M.object({sortModel:M.array(M.object({colId:M.enum(i,"Column ID that supports sorting"),sort:M.enum(["asc","desc"],"Sort direction: ascending or descending"),type:M.enum(["default","absolute"],"Sort type: default or absolute values")}),"Array of sort configurations")},"Sort configuration for the grid").nullable()},O2={aggregation:h2,filter:P2,sort:G2,pivot:k2,columnVisibility:g2,columnSizing:p2,rowGroup:_2};function N2(e,t){const s={};for(const a of r2){if(t?.exclude?.includes(a))continue;const l=O2[a](e,t);l&&(s[a]=l.nullable())}const r=e.colModel.colsList,i=t?.columns??{},n=new Array(r.length);let o="";for(let a=0,l=r.length;a<l;++a){const c=r[a].colId;n[a]=c;const u=i[c]?.description;a>0&&(o+=`
`),o+=u?`${c}: ${u}`:c}return M.object(s).define("allColumnIds",M.enum(n,o)).toJSON()}var Yp={moduleName:"AiToolkit",version:_,beans:[],dependsOn:[$,s2],apiFunctions:{getStructuredSchema:N2}};import{_ColumnMoveModule as B2,_PopupModule as V2,_SharedDragAndDropModule as H2}from"ag-grid-community";import{_HorizontalResizeModule as U2}from"ag-grid-community";import{_unwrapUserComp as z2}from"ag-grid-community";function W2(e){return e.sideBar?.comp.isDisplayed()??!1}function K2(e,t){e.sideBar?.comp.setDisplayed(t)}function $2(e,t){e.sideBar?.comp.setSideBarPosition(t)}function j2(e,t,s){e.sideBar?.comp.openToolPanel(t,"api",s)}function Y2(e){e.sideBar?.comp.close("api")}function q2(e){return e.sideBar?.comp.openedItem()??null}function Z2(e){e.sideBar?.comp.refresh()}function X2(e){return e.sideBar?.comp.isToolPanelShowing()??!1}function J2(e,t){const s=e.sideBar?.comp.getToolPanelInstance(t);return z2(s)}function Q2(e){return e.sideBar?.comp.getDef()}import{BeanStub as eO}from"ag-grid-community";import{RefPlaceholder as tO,_findNextFocusableElement as sO,_focusInto as rO,_getActiveDomElement as qp,_isVisible as iO,_removeFromParent as Zp,_setAriaControlsAndLabel as nO}from"ag-stack";import{Component as oO,KeyCode as yn,ManagedFocusFeature as aO,_addFocusableContainerListener as lO,_addGridCommonParams as Xp,_focusNextGridCoreContainer as cO,_skipFocusableContainerListenerForAgGrid as uO}from"ag-grid-community";var dO='.ag-tool-panel-wrapper{overflow:hidden;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:var(--ag-horizontal-size,var(--ag-side-bar-panel-width))}.ag-tool-panel-content{display:flex;height:100%;overflow:hidden auto}.ag-tool-panel-wrapper.ag-tool-panel-animating{display:block!important;transition:width var(--ag-side-bar-panel-animation-duration) ease-in-out}@media (prefers-reduced-motion:reduce){.ag-tool-panel-wrapper.ag-tool-panel-animating{transition:none}}.ag-tool-panel-external{background-color:var(--ag-wrapper-background-color);display:flex;flex-direction:row;width:100%}:where(.ag-tool-panel-external) .ag-tool-panel-wrapper{flex-grow:1}.ag-select-agg-func-item{align-items:center;display:flex;flex:1 1 auto;flex-flow:row nowrap;height:100%;overflow:hidden;position:relative;text-overflow:ellipsis;white-space:nowrap}.ag-tool-panel-horizontal-resize{cursor:ew-resize;height:100%;position:absolute;top:0;width:5px;z-index:1}.ag-side-bar{background-color:var(--ag-side-bar-background-color);display:flex;flex-direction:row-reverse;position:relative}:where(.ag-ltr) :where(.ag-side-bar-left) .ag-tool-panel-horizontal-resize{right:-3px}:where(.ag-rtl) :where(.ag-side-bar-left) .ag-tool-panel-horizontal-resize{left:-3px}:where(.ag-ltr) :where(.ag-side-bar-right) .ag-tool-panel-horizontal-resize{left:-3px}:where(.ag-rtl) :where(.ag-side-bar-right) .ag-tool-panel-horizontal-resize{right:-3px}.ag-side-bar-left{flex-direction:row;order:-1}.ag-side-buttons{background-color:var(--ag-side-button-bar-background-color);overflow:hidden auto;padding-top:var(--ag-side-button-bar-top-padding);position:relative;scrollbar-width:var(--ag-scrollbar-width,thin)}.ag-side-button{background-color:var(--ag-side-button-background-color);border-bottom:var(--ag-side-button-border);border-top:var(--ag-side-button-border);color:var(--ag-side-button-text-color);margin-top:-1px;position:relative}.ag-side-button:before{background-color:transparent;bottom:0;content:"";display:block;position:absolute;top:0;transition:background-color var(--ag-side-button-selected-underline-transition-duration);width:var(--ag-side-button-selected-underline-width)}:where(.ag-ltr) .ag-side-button:before{left:0}:where(.ag-rtl) .ag-side-button:before{right:0}.ag-side-button:hover{background-color:var(--ag-side-button-hover-background-color);color:var(--ag-side-button-hover-text-color)}.ag-side-button.ag-selected{background-color:var(--ag-side-button-selected-background-color);border-bottom:var(--ag-side-button-selected-border);border-top:var(--ag-side-button-selected-border);color:var(--ag-side-button-selected-text-color);@media (forced-colors:active){background-color:SelectedItem}}.ag-side-button.ag-selected:before{background-color:var(--ag-side-button-selected-underline-color)}.ag-side-button-button{align-items:center;display:flex;flex-direction:column;gap:var(--ag-spacing);position:relative;white-space:nowrap;width:100%;&:focus{box-shadow:none}}:where(.ag-ltr) .ag-side-button-button{padding:var(--ag-side-button-vertical-padding) var(--ag-side-button-right-padding) var(--ag-side-button-vertical-padding) var(--ag-side-button-left-padding)}:where(.ag-rtl) .ag-side-button-button{padding:var(--ag-side-button-vertical-padding) var(--ag-side-button-left-padding) var(--ag-side-button-vertical-padding) var(--ag-side-button-right-padding)}.ag-side-button-button:focus-visible{box-shadow:inset var(--ag-focus-shadow)}.ag-side-button-label{writing-mode:vertical-lr}@media (resolution <= 1.5x){.ag-side-button-label{font-family:"Segoe UI",var(--ag-font-family)}:where(.ag-ltr) .ag-side-button-label{transform:rotate(.05deg)}:where(.ag-rtl) .ag-side-button-label{transform:rotate(-.05deg)}}:where(.ag-ltr) .ag-side-bar-left,:where(.ag-rtl) .ag-side-bar-right{border-right:var(--ag-side-panel-border);:where(.ag-tool-panel-wrapper){border-left:var(--ag-side-panel-border)}}:where(.ag-ltr) .ag-side-bar-right,:where(.ag-rtl) .ag-side-bar-left{border-left:var(--ag-side-panel-border);:where(.ag-tool-panel-wrapper){border-right:var(--ag-side-panel-border)}}';import{_clearElement as hO}from"ag-stack";import{Component as pO,KeyCode as gO,_focusNextGridCoreContainer as fO,_stopPropagationForAgGrid as mO}from"ag-grid-community";import{RefPlaceholder as ol,_setAriaExpanded as vO}from"ag-stack";import{Component as CO,_createIconNoSpan as bO}from"ag-grid-community";var SO={tag:"div",cls:"ag-side-button",role:"presentation",children:[{tag:"button",ref:"eToggleButton",cls:"ag-button ag-side-button-button",role:"tab",attrs:{type:"button",tabindex:"-1","aria-expanded":"false"},children:[{tag:"div",ref:"eIconWrapper",cls:"ag-side-button-icon-wrapper",attrs:{"aria-hidden":"true"}},{tag:"span",ref:"eLabel",cls:"ag-side-button-label"}]}]},yO=class extends Mx{constructor(e){super(),this.toolPanelDef=e,this.eToggleButton=ol,this.eIconWrapper=ol,this.eLabel=ol}getToolPanelId(){return this.toolPanelDef.id}postConstruct(){this.setTemplate(SO,[]),this.setLabel(),this.setIcon(),this.addManagedElementListeners(this.eToggleButton,{click:this.onButtonPressed.bind(this)}),this.eToggleButton.setAttribute("id",`ag-${this.getCompId()}-button`)}setLabel(){const e=this.toolPanelDef,t=this.getLocaleTextFunc()(e.labelKey,e.labelDefault);this.eLabel.textContent=t}setIcon(){this.eIconWrapper.insertAdjacentElement("afterbegin",bO(this.toolPanelDef.iconKey,this.beans))}onButtonPressed(){this.dispatchLocalEvent({type:"toggleButtonClicked"})}setSelected(e){this.toggleCss("ag-selected",e),vO(this.eToggleButton,e)}},wO={tag:"div",cls:"ag-side-buttons",role:"tablist"},xO=class extends Ix{constructor(){super(wO),this.buttonComps=[]}postConstruct(){this.addManagedElementListeners(this.getFocusableElement(),{keydown:this.handleKeyDown.bind(this)})}handleKeyDown(e){if(!(e.key!==gO.TAB||!e.shiftKey)){if(fO(this.beans,!0)){e.preventDefault();return}mO(e)}}setActiveButton(e){for(const t of this.buttonComps)t.setSelected(e===t.getToolPanelId())}addButtonComp(e){const t=this.createBean(new yO(e));return this.buttonComps.push(t),this.appendChild(t),t.addEventListener("toggleButtonClicked",()=>{this.dispatchLocalEvent({type:"sideBarButtonClicked",toolPanelId:e.id})}),t}clearButtons(){this.buttonComps=this.destroyBeans(this.buttonComps),hO(this.getGui())}destroy(){this.clearButtons(),super.destroy()}},FO={selector:"AG-SIDE-BAR-BUTTONS",component:xO},Jp={id:"columns",labelDefault:"Columns",labelKey:"columns",iconKey:"columnsToolPanel",toolPanel:"agColumnsToolPanel"},Qp={id:"filters",labelDefault:"Filters",labelKey:"filters",iconKey:"filtersToolPanel",toolPanel:"agFiltersToolPanel"},TO={id:"filters-new",labelDefault:"Filters",labelKey:"filters",iconKey:"filtersToolPanel",toolPanel:"agNewFiltersToolPanel"},Vr={columns:Jp,filters:Qp,"filters-new":TO};function al(e,t){if(e){if(e===!0)return{toolPanels:[Jp,Qp],defaultToolPanel:"columns"};if(typeof e=="string")return al([e],t);if(Array.isArray(e)){const s=[];for(const r of e){const i=Vr[r];if(!i){t.warn(215,{key:r,validKeys:Object.keys(Vr)});continue}s.push(i)}return s.length===0?void 0:{toolPanels:s,defaultToolPanel:s[0].id}}return{toolPanels:AO(e.toolPanels,t),defaultToolPanel:e.defaultToolPanel,hiddenByDefault:e.hiddenByDefault,position:e.position,hideButtons:e.hideButtons}}}function AO(e,t){const s=[];return e&&e.forEach(r=>{const i=PO(r,t);i&&s.push(i)}),s}function PO(e,t){return typeof e!="string"?e:Vr[e]?Vr[e]:(t.warn(215,{key:e,validKeys:Object.keys(Vr)}),null)}import{RefPlaceholder as RO,_initDetachedStyledRoot as MO,_setDisplayed as IO}from"ag-stack";import{Component as EO}from"ag-grid-community";import{Component as DO}from"ag-grid-community";var LO=class extends Ex{constructor(){super({tag:"div",cls:"ag-tool-panel-horizontal-resize"}),this.minWidth=100,this.maxWidth=null}postConstruct(){const e=this.beans.horizontalResizeSvc.addResizeBar({eResizeBar:this.getGui(),dragStartPixels:1,onResizeStart:this.onResizeStart.bind(this),onResizing:this.onResizing.bind(this),onResizeEnd:this.onResizeEnd.bind(this)});this.addDestroyFunc(e),this.inverted=this.gos.get("enableRtl")}dispatchResizeEvent(e,t,s){this.eventSvc.dispatchEvent({type:"toolPanelSizeChanged",width:s,started:e,ended:t})}onResizeStart(){this.startingWidth=this.elementToResize.offsetWidth,this.dispatchResizeEvent(!0,!1,this.startingWidth)}onResizeEnd(e){return this.onResizing(e,!0)}onResizing(e,t=!1){const s=this.inverted?-1:1;let r=Math.max(this.minWidth,Math.floor(this.startingWidth-e*s));this.maxWidth!=null&&(r=Math.min(this.maxWidth,r)),this.elementToResize.style.setProperty("--ag-horizontal-size",`${r}px`),this.dispatchResizeEvent(!1,t,r)}};function kO(e,t,s){return e.getCompDetails(t,_O,void 0,s,!0)}var _O={name:"toolPanel",optionalMethods:["refresh","getState"]},GO={tag:"div",cls:"ag-tool-panel-wrapper",role:"tabpanel",children:[{tag:"div",cls:"ag-tool-panel-content",ref:"eContent"}]},OO=class extends Dx{constructor(){super(GO),this.eContent=RO,this.animationId=0,this.defParent=null,this.hasStyledRoot=!1}postConstruct(){const e=this.getGui(),t=this.resizeBar=this.createManagedBean(new LO);e.setAttribute("id",`ag-${this.getCompId()}`),t.elementToResize=e,this.appendChild(t)}ensureStyledRoot(){if(this.hasStyledRoot)return;this.hasStyledRoot=!0;const e=this.getGui(),[t,s]=MO(this.beans.environment,e);this.addDestroyFunc(s);const r=this.isDisplayed();IO(e,!0),this.setGui(t),this.setDisplayed(r)}getToolPanelId(){return this.toolPanelId}getDefParent(){return this.defParent}setDefParent(e){this.defParent=e}setToolPanelDef(e,t){const{id:s,minWidth:r,maxWidth:i,width:n,parent:o}=e;this.toolPanelId=s,this.defParent=o??null,n&&this.getGui().style.setProperty("--ag-side-bar-panel-width",`${n}px`);const a=kO(this.beans.userCompFactory,e,t);if(a==null)return!1;const l=a.newAgStackInstance();this.params=a.params,l.then(this.setToolPanelComponent.bind(this));const c=this.resizeBar;return r!=null&&(c.minWidth=r),i!=null&&(c.maxWidth=i),!0}setToolPanelComponent(e){this.toolPanelCompInstance=e;const{eContent:t}=this;t.appendChild(e.getGui()),this.addDestroyFunc(()=>{this.destroyBean(e)})}getToolPanelInstance(){return this.toolPanelCompInstance}setResizerSizerSide(e){const t=this.gos.get("enableRtl"),s=e==="left",r=t?s:!s;this.resizeBar.inverted=r}refresh(){this.toolPanelCompInstance?.refresh?.(this.params)}refreshWithParams(e){return this.params=e,this.toolPanelCompInstance?.refresh?.(e)}animateDisplayed(e){if(this.isDisplayed()===e)return;const t=++this.animationId,{eContent:s}=this,r=()=>{this.animationId===t&&(i.classList.remove("ag-tool-panel-animating"),s.style.width="",i.style.width="")},i=this.getGui(),n=i.offsetWidth;this.setDisplayed(e),i.classList.add("ag-tool-panel-animating");const o=getComputedStyle(i).transitionDuration;if(!Number.parseFloat(o)){r();return}i.style.transition="none",i.style.width="",s.style.width=`${s.offsetWidth}px`,i.style.width=`${n}px`;const a=i.offsetWidth;i.style.transition="",i.style.width=e?"":"0";const l=setTimeout(r,100);i.addEventListener("transitionstart",()=>clearTimeout(l),{once:!0}),i.addEventListener("transitionend",r,{once:!0})}},NO={tag:"div",cls:"ag-side-bar ag-unselectable",children:[{tag:"ag-side-bar-buttons",ref:"sideBarButtons"}]},BO=class extends Lx{constructor(){super(NO,[FO]),this.sideBarButtons=tO,this.toolPanelWrappers=[],this.registerCSS(dO)}postConstruct(){this.sideBarButtons.addEventListener("sideBarButtonClicked",this.onToolPanelButtonClicked.bind(this));const{beans:e,gos:t}=this,{sideBar:s}=t.get("initialState")??{};this.setSideBarDef({sideBarDef:al(t.get("sideBar"),e.log),sideBarState:s}),this.addManagedPropertyListener("sideBar",()=>this.setState()),e.sideBar.comp=this;const r=this.getFocusableElement();this.createManagedBean(new aO(r,{onTabKeyDown:this.onTabKeyDown.bind(this),handleKeyDown:this.handleKeyDown.bind(this)})),lO(e,this,r),this.addManagedPropertyListener("enableAdvancedFilter",this.onAdvancedFilterChanged.bind(this))}getFocusableContainerName(){return"sideBar"}onTabKeyDown(e){if(e.defaultPrevented)return;const{beans:t,sideBarButtons:s}=this,r=this.getGui(),i=s.getGui(),n=qp(t),o=r.querySelector(".ag-tool-panel-wrapper:not(.ag-hidden)"),a=e.target,l=e.shiftKey;if(!o)return cO(t,l,"force")?(e.preventDefault(),!0):(uO(e),!1);if(i.contains(n)){rO(o,l)&&e.preventDefault();return}if(!l)return;let c=null;if(o.contains(n)){if(c=sO({beans:t,rootNode:o,backwards:!0}),c&&c.tabIndex>=0)return}else Mh(o,a)&&(c=ya(o,a));c||(c=i.querySelector(".ag-selected button"),c=iO(c)?c:null),c&&c!==e.target&&(e.preventDefault(),c.focus())}handleKeyDown(e){const t=qp(this.beans),s=this.sideBarButtons;if(!s.getGui().contains(t))return;const r=s.getGui(),i=Array.prototype.slice.call(r.querySelectorAll(".ag-side-button")),n=i.findIndex(l=>l.contains(t));let o=null;switch(e.key){case yn.LEFT:case yn.UP:o=Math.max(0,n-1);break;case yn.RIGHT:case yn.DOWN:o=Math.min(n+1,i.length-1);break}if(o===null)return;const a=i[o].querySelector("button");a&&(a.focus(),e.preventDefault())}onToolPanelButtonClicked(e){const t=e.toolPanelId;this.openedItem()===t?this.openToolPanel(void 0,"sideBarButtonClicked"):this.openToolPanel(t,"sideBarButtonClicked")}clearDownUi(){this.sideBarButtons.clearButtons(),this.destroyToolPanelWrappers()}setSideBarDef({sideBarDef:e,sideBarState:t,existingToolPanelWrappers:s}){if(this.setDisplayed(!1),this.sideBar=e,e&&this.sideBarButtons.setDisplayed(!e.hideButtons),e?.toolPanels){const r=e.toolPanels;if(this.createToolPanelsAndSideButtons(r,t,s),!this.toolPanelWrappers.length)return;const i=t?t.visible:!e.hiddenByDefault;if(this.setDisplayed(i),this.setSideBarPosition(t?t.position:e.position),i)if(t){const{openToolPanel:n}=t;n&&this.openToolPanel(n,"sideBarInitializing")}else this.openToolPanel(e.defaultToolPanel,"sideBarInitializing")}}getDef(){return this.sideBar}setSideBarPosition(e){e||(e="right"),this.position=e;const t=e==="left",s=t?"right":"left";this.toggleCss("ag-side-bar-left",t),this.toggleCss("ag-side-bar-right",!t);for(const r of this.toolPanelWrappers)r.setResizerSizerSide(s);return this.dispatchSideBarUpdated(),this}setDisplayed(e,t){super.setDisplayed(e,t),this.dispatchSideBarUpdated()}getState(){const e={};for(const t of this.toolPanelWrappers)e[t.getToolPanelId()]=t.getToolPanelInstance()?.getState?.();return{visible:this.isDisplayed(),position:this.position,openToolPanel:this.openedItem(),toolPanels:e}}createToolPanelsAndSideButtons(e,t,s){for(const r of e)this.createToolPanelAndSideButton(r,t?.toolPanels?.[r.id],s?.[r.id])}validateDef(e){const{id:t,toolPanel:s}=e;return t==null?(this.beans.log.warn(212),!1):eg(s)&&this.beans.filterManager?.isAdvFilterEnabled()?(this.beans.log.warn(213),!1):!0}createToolPanelAndSideButton(e,t,s){if(!this.validateDef(e)){this.destroyBean(s);return}let r;if(s)r=s,r.setDefParent(e.parent??null);else if(r=this.createBean(new OO),!r.setToolPanelDef(e,Xp(this.gos,{initialState:t,onStateUpdated:()=>this.dispatchSideBarUpdated()})))return;r.setDisplayed(!1),this.renderToolPanelUnderParent(r,e.parent),this.toolPanelWrappers.push(r);const i=this.sideBarButtons.addButtonComp(e);nO(i.eToggleButton,r.getGui())}refresh(){for(const e of this.toolPanelWrappers)e.refresh()}renderToolPanelUnderParent(e,t){const s=t??e.getDefParent()??this.getGui();s!==this.getGui()&&(e.ensureStyledRoot(),s.classList.add("ag-tool-panel-external"));const r=e.getGui();r.parentElement!==s&&s.appendChild(r)}getWrapper(e){return this.toolPanelWrappers.find(t=>t.getToolPanelId()===e)}openToolPanel(e,t="api",s){const r=this.openedItem(),n=!!e&&!!r||t==="sideBarInitializing";for(const l of this.toolPanelWrappers){const c=e===l.getToolPanelId();c&&this.renderToolPanelUnderParent(l,s??null),n?l.setDisplayed(c):l.animateDisplayed(c)}const o=this.openedItem();r!==o&&(this.sideBarButtons.setActiveButton(e),this.raiseToolPanelVisibleEvent(e,r??void 0,t))}getToolPanelInstance(e){const t=this.getWrapper(e);if(!t){this.beans.log.warn(214,{key:e});return}return t.getToolPanelInstance()}raiseToolPanelVisibleEvent(e,t,s){const r=!!e&&!!t,i=this.eventSvc;t&&i.dispatchEvent({type:"toolPanelVisibleChanged",source:s,key:t,visible:!1,switchingToolPanel:r}),e&&i.dispatchEvent({type:"toolPanelVisibleChanged",source:s,key:e,visible:!0,switchingToolPanel:r})}close(e="api"){this.openToolPanel(void 0,e)}isToolPanelShowing(){return!!this.openedItem()}openedItem(){let e=null;for(const t of this.toolPanelWrappers)t.isDisplayed()&&(e=t.getToolPanelId());return e}setState(e){const t=al(this.gos.get("sideBar"),this.beans.log),s={};t&&this.sideBar&&t.toolPanels?.forEach(r=>{const{id:i}=r;if(!i)return;const n=this.sideBar.toolPanels?.find(c=>c.id===i);if(!n||r.toolPanel!==n.toolPanel)return;const o=this.getWrapper(i);if(!o)return;const a=Xp(this.gos,{...r.toolPanelParams,initialState:e?.toolPanels?.[i],onStateUpdated:()=>this.dispatchSideBarUpdated()});o.refreshWithParams(a)===!0&&(this.toolPanelWrappers=this.toolPanelWrappers.filter(c=>c!==o),Zp(o.getGui()),s[i]=o)}),this.clearDownUi(),this.setSideBarDef({sideBarDef:t,sideBarState:e,existingToolPanelWrappers:s})}dispatchSideBarUpdated(){this.eventSvc.dispatchEvent({type:"sideBarUpdated"})}destroyToolPanelWrappers(){for(const e of this.toolPanelWrappers)Zp(e.getGui()),this.destroyBean(e);this.toolPanelWrappers.length=0}onAdvancedFilterChanged(){this.sideBar?.toolPanels?.some(t=>eg(typeof t=="string"?t:t.toolPanel))&&this.setState()}destroy(){this.destroyToolPanelWrappers(),super.destroy()}};function eg(e){return e==="agFiltersToolPanel"||e==="agNewFiltersToolPanel"}var VO={selector:"AG-SIDE-BAR",component:BO},HO=class extends kx{constructor(){super(...arguments),this.beanName="sideBar"}getSelector(){return VO}},Hr={moduleName:"SideBar",version:_,beans:[HO],apiFunctions:{isSideBarVisible:W2,setSideBarVisible:K2,setSideBarPosition:$2,openToolPanel:j2,closeToolPanel:Y2,getOpenedToolPanel:q2,refreshToolPanel:Z2,isToolPanelShowing:X2,getToolPanelInstance:J2,getSideBar:Q2},dependsOn:[$,U2]},UO='.ag-menu-list{cursor:default;display:table;padding:var(--ag-spacing) 0;width:100%}.ag-menu-option,.ag-menu-separator{display:table-row}.ag-menu-option-part,.ag-menu-separator-part{display:table-cell;vertical-align:middle}.ag-menu-option{cursor:pointer;font-weight:500}:where(.ag-ltr) :where(.ag-menu-option-popup-pointer) .ag-icon{text-align:right}:where(.ag-rtl) :where(.ag-menu-option-popup-pointer) .ag-icon{text-align:left}.ag-menu-option-text{white-space:nowrap}.ag-menu-option-custom{display:contents}.ag-compact-menu-option{display:flex;flex-wrap:nowrap;width:100%}.ag-compact-menu-option-text{flex:1 1 auto;white-space:nowrap}.ag-menu-separator{height:calc(var(--ag-spacing)*2 + 1px)}.ag-menu-separator-part:after{border-top:solid var(--ag-border-width) var(--ag-menu-separator-color);content:"";display:block}.ag-compact-menu-option-active,.ag-menu-option-active{background-color:var(--ag-row-hover-color)}:where(.ag-menu-list-no-focus-ring) .ag-compact-menu-option:focus-visible,:where(.ag-menu-list-no-focus-ring) .ag-menu-option:focus-visible{box-shadow:none}.ag-compact-menu-option-part,.ag-menu-option-part{line-height:var(--ag-icon-size);padding:calc(var(--ag-spacing) + 2px) 0}.ag-compact-menu-option-disabled,.ag-menu-option-disabled{cursor:not-allowed;opacity:.5}.ag-compact-menu-option-icon,.ag-menu-option-icon{width:var(--ag-icon-size)}:where(.ag-ltr) .ag-compact-menu-option-icon,:where(.ag-ltr) .ag-menu-option-icon{padding-left:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-compact-menu-option-icon,:where(.ag-rtl) .ag-menu-option-icon{padding-right:calc(var(--ag-spacing)*2)}.ag-compact-menu-option-text,.ag-menu-option-text{padding-left:calc(var(--ag-spacing)*2);padding-right:calc(var(--ag-spacing)*2)}:where(.ag-ltr) .ag-compact-menu-option-shortcut,:where(.ag-ltr) .ag-menu-option-shortcut{padding-right:var(--ag-spacing)}:where(.ag-rtl) .ag-compact-menu-option-shortcut,:where(.ag-rtl) .ag-menu-option-shortcut{padding-left:var(--ag-spacing)}:where(.ag-ltr) .ag-compact-menu-option-popup-pointer,:where(.ag-ltr) .ag-menu-option-popup-pointer{padding-right:var(--ag-spacing)}:where(.ag-rtl) .ag-compact-menu-option-popup-pointer,:where(.ag-rtl) .ag-menu-option-popup-pointer{padding-left:var(--ag-spacing)}.ag-menu-column-select-wrapper{height:265px;overflow:auto;:where(.ag-column-select){height:100%}}.ag-menu:where(.ag-tabs){min-width:290px}.ag-context-menu-loading-icon{pointer-events:none;position:absolute}',tg=class extends xh{constructor(){super({warnNoIcon:()=>this.beans.log.warn(227)})}},Ur={moduleName:"MenuItem",version:_,userComponents:{agMenuItem:tg},icons:{check:"tick",subMenuOpen:"small-right",subMenuOpenRtl:"small-left"},css:[UO]};import{_areEqual as Wt,_clearElement as zO,_last as WO}from"ag-stack";import{Component as KO,FilterButtonComp as $O,_addGridCommonParams as jO,_resetColumnState as YO}from"ag-grid-community";import{RefPlaceholder as sg}from"ag-stack";import{Component as qO,PositionableFeature as ZO}from"ag-grid-community";var XO=".ag-column-select{display:flex;flex:3 1 0px;flex-direction:column;overflow:hidden;position:relative}.ag-column-select-header{flex:none;height:var(--ag-header-height);padding-left:var(--ag-widget-container-horizontal-padding);padding-right:var(--ag-widget-container-horizontal-padding)}.ag-column-select-column,.ag-column-select-column-group,.ag-column-select-header{align-items:center;display:flex;gap:var(--ag-widget-horizontal-spacing);position:relative}.ag-column-select-column,.ag-column-select-column-group{height:100%}:where(.ag-ltr) .ag-column-select-column,:where(.ag-ltr) .ag-column-select-column-group{padding-left:calc(var(--ag-indentation-level)*var(--ag-column-select-indent-size))}:where(.ag-rtl) .ag-column-select-column,:where(.ag-rtl) .ag-column-select-column-group{padding-right:calc(var(--ag-indentation-level)*var(--ag-column-select-indent-size))}.ag-column-select-column-group:where(:not(:last-child)),.ag-column-select-column:where(:not(:last-child)){margin-bottom:var(--ag-widget-vertical-spacing)}.ag-column-select-header-icon{border-radius:var(--ag-border-radius);cursor:pointer;height:var(--ag-icon-size);position:relative;width:var(--ag-icon-size);&:focus-visible{box-shadow:var(--ag-focus-shadow)}}.ag-column-select-header-filter-wrapper{flex:1 1 auto}.ag-column-select-header-filter{width:100%}.ag-column-select-list{flex:1 1 0px;overflow:hidden}:where(.ag-ltr) .ag-column-select-add-group-indent{margin-left:calc(var(--ag-icon-size) + var(--ag-spacing)*1.5)}:where(.ag-rtl) .ag-column-select-add-group-indent{margin-right:calc(var(--ag-icon-size) + var(--ag-spacing)*1.5)}.ag-column-select-column-group-readonly,.ag-column-select-column-readonly{opacity:.5;pointer-events:none;.ag-icon{opacity:.5}&.ag-icon-grip{opacity:.35}}.ag-column-select-column-readonly{&.ag-icon-grip,.ag-icon-grip{opacity:.35}}.ag-column-select-virtual-list-viewport{padding:calc(var(--ag-widget-container-vertical-padding)*.5) 0}.ag-column-select-virtual-list-item{padding:0 var(--ag-widget-container-horizontal-padding)}.ag-column-select-column-label{flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ag-column-select-checkbox{display:flex}";import{RefPlaceholder as ll,_debounce as JO,_setDisplayed as Ns}from"ag-stack";import{AgCheckboxSelector as QO,AgInputTextFieldSelector as eN,Component as tN,KeyCode as sN,_createIconNoSpan as cl}from"ag-grid-community";var rN=300,iN={tag:"div",cls:"ag-column-select-header",role:"presentation",children:[{tag:"div",ref:"eExpand",cls:"ag-column-select-header-icon"},{tag:"ag-checkbox",ref:"eSelect",cls:"ag-column-select-header-checkbox"},{tag:"ag-input-text-field",ref:"eFilterTextField",cls:"ag-column-select-header-filter-wrapper"}]},nN=class extends _x{constructor(){super(iN,[QO,eN]),this.eExpand=ll,this.eSelect=ll,this.eFilterTextField=ll}postConstruct(){this.createExpandIcons(),this.addManagedListeners(this.eExpand,{click:this.onExpandClicked.bind(this),keydown:t=>{t.key===sN.SPACE&&(t.preventDefault(),this.onExpandClicked())}}),this.addManagedElementListeners(this.eSelect.getInputElement(),{click:this.onSelectClicked.bind(this)}),this.addManagedPropertyListener("functionsReadOnly",()=>this.onFunctionsReadOnlyPropChanged()),this.eFilterTextField.setClearButtonEnabled(!0).setSearchIcon(!0).onValueChange(()=>this.onFilterTextChanged()).onValueClear(()=>this.onFilterTextCleared()),this.addManagedEventListeners({newColumnsLoaded:this.showOrHideOptions.bind(this)});const e=this.getLocaleTextFunc();this.eSelect.setInputAriaLabel(e("ariaColumnSelectAll","Toggle All Columns Visibility")),this.eFilterTextField.setInputAriaLabel(e("ariaFilterColumnsInput","Filter Columns Input")),this.activateTabIndex([this.eExpand])}onFunctionsReadOnlyPropChanged(){const e=this.gos.get("functionsReadOnly");this.eSelect.setReadOnly(e),this.eSelect.toggleCss("ag-column-select-column-readonly",e)}init(e){this.params=e,this.eFilterTextField.setAutoComplete(e.browserAutoComplete);const t=this.gos.get("functionsReadOnly");this.eSelect.setReadOnly(t),this.eSelect.toggleCss("ag-column-select-column-readonly",t),this.beans.colModel.ready&&this.showOrHideOptions()}createExpandIcons(){const e=this.beans;this.eExpand.appendChild(this.eExpandChecked=cl("columnSelectOpen",e)),this.eExpand.appendChild(this.eExpandUnchecked=cl("columnSelectClosed",e)),this.eExpand.appendChild(this.eExpandIndeterminate=cl("columnSelectIndeterminate",e)),this.setExpandState(0)}showOrHideOptions(){const e=this.params,t=!e.suppressColumnFilter,s=!e.suppressColumnSelectAll,r=!e.suppressColumnExpandAll,i=!!this.beans.colModel.colDefTreeDepth,n=this.getLocaleTextFunc();this.eFilterTextField.setInputPlaceholder(n("searchOoo","Search...")),Ns(this.eFilterTextField.getGui(),t),Ns(this.eSelect.getGui(),s),Ns(this.eExpand,r&&i)}onFilterTextChanged(){this.onFilterTextChangedDebounced||(this.onFilterTextChangedDebounced=JO(this,()=>{const e=this.eFilterTextField.getValue();this.dispatchLocalEvent({type:"filterChanged",filterText:e})},rN)),this.filterTextChangedTimeout=this.onFilterTextChangedDebounced()}onFilterTextCleared(){clearTimeout(this.filterTextChangedTimeout),this.dispatchLocalEvent({type:"filterChanged",filterText:this.eFilterTextField.getValue()})}onSelectClicked(){this.dispatchLocalEvent({type:this.selectState?"unselectAll":"selectAll"})}onExpandClicked(){this.dispatchLocalEvent({type:this.expandState===0?"collapseAll":"expandAll"})}setExpandState(e){this.expandState=e,Ns(this.eExpandChecked,e===0),Ns(this.eExpandUnchecked,e===1),Ns(this.eExpandIndeterminate,e===2)}setSelectionState(e){this.selectState=e,this.eSelect.setValue(this.selectState)}},oN={selector:"AG-PRIMARY-COLS-HEADER",component:nN};import{_exists as rg,_setAriaLabel as aN,_setAriaLevel as lN}from"ag-stack";import{Component as cN,DragSourceType as uN,isProvidedColumnGroup as dN}from"ag-grid-community";import{AgProvidedColumnGroup as hN,isProvidedColumnGroup as pN}from"ag-grid-community";import{_last as gN}from"ag-stack";function Bs(e){return!!e&&e.children!==void 0}function Kt(e){return Bs(e)?e.groupId:e.colId}function ig(e,t,s){const r=(o,a)=>{const c=o.children.map(Kt).includes(Kt(a)),u=gN(o.children),d=u&&Kt(u)!==Kt(a);return c&&d};if(!Bs(e))return!0;const i=e,n=s;if(r(i,n)||i.groupId===t&&!i.children.map(Kt).includes(Kt(n)))return i.children.push(n),!0;for(let o=i.children.length-1;o>=0&&!ig(i.children[o],t,s);o--);return!1}function ng(e){const t=(i,n)=>Bs(i)&&Bs(n)&&Kt(i)===Kt(n),s=(i,n)=>{if(!Bs(n))return i;const o=i,a=n;if(a.children&&a.groupId&&ig(o,a.groupId,a.children[0]))return o;for(const l of a.children)s(o,l);return o},r=[];for(let i=1;i<=e.length;i++){const n=e[i-1],o=e[i];t(n,o)?e[i]=s(n,o):r.push(n)}return r}function og(e,t){const{colModel:s}=e,r=[],i=(o,a)=>{if(Bs(o)){const l=o,c=l.groupId!==void 0?l.groupId:l.headerName,u=new hN(l,c,!1,a),d=[];for(const h of l.children){const p=i(h,a+1);p&&d.push(p)}return u.children=d,u}else{const l=o,c=l.colId?l.colId:l.field,u=s.getNonPivotCol(c);return u||r.push(l),u}},n=[];for(const o of t){const a=i(o,0);a&&n.push(a)}return r.length>0&&e.log.warn(217,{invalidColIds:r}),n}function ag(e,t){const s=lg(mN(e)),r=ng(s);t(r)}function fN(e,t){const s=lg(e),r=ng(s);t(r)}function lg(e){const t=(s,r)=>{let i;if(pN(s))if(s.isPadding())i=r;else{const o={...s.getColGroupDef()};o.groupId=s.getGroupId(),o.children=[r],i=o}else{const o={...s.colDef};o.colId=s.colId,i=o}const n=s.getOriginalParent();return n?t(n,i):i};return e.map(s=>t(s,s.colDef))}function mN(e){return e.colsList.filter(t=>t.primary&&!t.showRowGroup)}function Vs(e,t){return e.colModel.colDefGroupsById.get(t.groupId)??t}function wn(e,t,s){return e.colNames.getDisplayNameForProvidedColumnGroup(null,Vs(e,t),s,t.colGroupDef)}function cg(e,t){const{groupId:s}=t;let r=e.colModel.groupHeaderNameOverrides.get(s)??null;return()=>{const i=e.colModel.groupHeaderNameOverrides.get(s)??null;i!==r&&(r=i,Vs(e,t)===t&&t.dispatchLocalEvent({type:"headerNameChanged"}))}}import{Component as vN}from"ag-grid-community";var CN=".ag-no-matches{padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding);text-align:center}",ul=class extends Gx{constructor(e){super({tag:"div",cls:`ag-no-matches ${e}`}),this.announced=!1,this.registerCSS(CN)}postConstruct(){this.getGui().textContent=this.getLocaleTextFunc()("noMatches","No matches"),this.setDisplayed(!1);const e=this.cancelIfHidden.bind(this);this.addManagedEventListeners({toolPanelVisibleChanged:e,sideBarUpdated:e})}setNoMatches(e,t){this.setDisplayed(e),e?t&&!this.announced&&this.isShown()&&(this.beans.ariaAnnounce.announceValue(this.getGui().textContent??"","noMatches"),this.announced=!0):this.cancelAnnouncement()}cancelAnnouncement(){this.announced&&(this.beans.ariaAnnounce.cancelAnnouncement("noMatches"),this.announced=!1)}isShown(){const e=this.getGui();return e.isConnected&&!e.closest(".ag-hidden")}cancelIfHidden(){this.isShown()||this.cancelAnnouncement()}destroy(){this.cancelAnnouncement(),super.destroy()}};import{LocalEventService as bN}from"ag-stack";var ug=class{constructor(e,t,s,r=!1,i){this.beans=e,this.depth=s,this.group=r,this.localEventService=new bN,this.cachedName=null,this.cachedNameVersion=-1,this.cachedNameOverride=null,r?(this.columnGroup=t,this._expanded=i,this.children=[]):this.column=t}get displayName(){const{beans:e,group:t,columnGroup:s,column:r}=this,{colNames:i,colModel:n}=e,o=n.colDefsVersion,a=t?n.groupHeaderNameOverrides.get(s.groupId)??null:r.headerNameOverride;return(o!==this.cachedNameVersion||a!==this.cachedNameOverride)&&(this.cachedNameVersion=o,this.cachedNameOverride=a,this.cachedName=t?wn(e,s,"columnToolPanel"):i.getDisplayNameForColumn(r,"columnToolPanel")),this.cachedName}get expanded(){return!!this._expanded}set expanded(e){e!==this._expanded&&(this._expanded=e,this.localEventService.dispatchEvent({type:"expandedChanged"}))}addEventListener(e,t){this.localEventService.addEventListener(e,t)}removeEventListener(e,t){this.localEventService.removeEventListener(e,t)}};import{isProvidedColumnGroup as SN}from"ag-grid-community";import{RefPlaceholder as zr,_setAriaDescribedBy as yN,_setAriaExpanded as wN,_setAriaLabel as xN,_setDisplayed as dl}from"ag-stack";import{AgCheckboxSelector as FN,Component as TN,DragSourceType as AN,KeyCode as hl,TouchListener as dg,_addGridCommonParams as PN,_createIcon as hg,_createIconNoSpan as RN,_getHeaderTooltipComponentDefinition as MN,_getShouldDisplayTooltip as IN,_getToolPanelClassesFromColDef as EN,_isHeaderNameChangeForGroup as DN,_resolveHeaderTooltipValue as LN}from"ag-grid-community";import{_createElement as kN}from"ag-grid-community";import{AgPromise as _N,_STOP_PROPAGATION_CALLBACKS as GN,_addGridCommonParams as ON}from"ag-grid-community";import{_getRootNode as NN,_isBrowserFirefox as BN,_isBrowserSafari as VN}from"ag-stack";function HN(e){const t=NN(e),s="getSelection"in t?t.getSelection():null,r=[];for(let i=0;i<(s?.rangeCount??0);i++){const n=s?.getRangeAt(i);n&&r.push(n)}return{selection:s,ranges:r}}function UN(e,t){if(!e.gos.get("enableCellTextSelection")||!BN()&&!VN())return t();const{selection:r,ranges:i}=HN(e);t(),r?.removeAllRanges();for(const n of i)r?.addRange(n)}var zN={name:"menuItem",optionalMethods:["setActive","select","setExpanded","configureDefaults"]},pl={getMenuItemComp:(e,t,s)=>e.userCompFactory.getCompDetails(t,zN,"agMenuItem",ON(e.gos,s),!0)?.newAgStackInstance()??_N.resolve(),getPostProcessPopupParams:({column:e,node:t})=>({column:e,rowNode:t}),preserveRangesWhile:UN,stopPropagationCallbacks:GN,warnNoItem:(e,t)=>{e.log.warn(228,{menuItemOrString:t})}},WN=class extends Fr{constructor(){super(pl)}},xn=class extends Qi{constructor(e,t={column:null,columnGroup:null,node:null,value:null},s){super(e,t,pl,s)}};function gl(e){return e.key==="ContextMenu"||e.shiftKey&&e.key==="F10"}function pg(e,t,s){const{menuItems:r,menuContext:i,positionBy:n,restoreFocus:o,onClosed:a}=s,l=e.createBean(new xn(0,i));l.addMenuItems(r);const c=s.ePopup??kN({tag:"div",cls:"ag-menu"});c.appendChild(l.getGui());const u=t.popupSvc,h=u.addPopup({modal:!0,eChild:c,closeOnEsc:!0,afterGuiAttached:()=>l.focusInto(),ariaLabel:e.getLocaleTextFunc()("ariaLabelContextMenu","Context Menu"),closedCallback:p=>{a?.(),e.destroyBean(l),p instanceof KeyboardEvent&&o()}})?.hideFunc;return l.addManagedListeners(l,{closeMenu:()=>{o(),h?.()}}),n instanceof HTMLElement?u.positionPopupByComponent({type:"columnContextMenu",eventSource:n,ePopup:c,position:"under",keepWithinBounds:!0}):u.positionPopupUnderMouseEvent({type:"columnContextMenu",mouseEvent:n,ePopup:c}),h}import{BeanStub as KN,_addGridCommonParams as $N}from"ag-grid-community";var jN={name:"columnLabelRenderer",optionalMethods:["refresh"],supportsJsFunction:!0};function gg(e){return e.columnLabelRenderer!=null||e.columnLabelRendererSelector!=null}var fg=class extends Ox{constructor(e,t,s,r,i,n){super(),this.eLabel=e,this.definition=t,this.source=s,this.column=r,this.columnGroup=i,this.getDisplayName=n,this.renderer=null,this.rendererClass=null,this.rendererVersion=0}postConstruct(){this.refresh()}refresh(){const e=this.getParams();this.renderer==null&&this.setFallback(e.displayName);const t=this.beans.userCompFactory.getCompDetails(this.definition,jN,void 0,e);if(!t){this.destroyRenderer(e.displayName);return}const{renderer:s}=this;if(s!=null&&this.rendererClass===t.componentClass&&s.refresh?.(t.params)===!0){this.rendererVersion++;return}this.createRenderer(t)}createRenderer(e){const t=++this.rendererVersion;e.newAgStackInstance().then(s=>{if(t!==this.rendererVersion||!this.isAlive()){this.destroyBean(s);return}if(s==null)return;const r=this.renderer;this.renderer=s,this.rendererClass=e.componentClass,this.eLabel.replaceChildren(s.getGui()),this.destroyBean(r)})}getParams(){const{gos:e,column:t,columnGroup:s,source:r}=this;return $N(e,{displayName:this.getDisplayName(),column:t,columnGroup:s,source:r})}setFallback(e){this.eLabel.textContent=e??""}destroyRenderer(e){this.rendererVersion++,this.destroyBean(this.renderer),this.renderer=null,this.rendererClass=null,e===void 0?this.eLabel.replaceChildren():this.setFallback(e)}destroy(){this.destroyRenderer(),super.destroy()}};function H(e){return!!e?.buttons?.includes("apply")}function be(e,t){if(!H(t))return;const s=e.sideBar?.comp.openedItem();if(!s)return;e.sideBar?.comp.getToolPanelInstance(s)?.refreshDeferredUi()}function mg(e,t,s,r,i){const n=YN(t);vg(e,n,s,r,i)}function vg(e,t,s,r,i){e.columnStateUpdateStrategy.getPivotMode(H(i))?ZN(e,t,s,r,i):qN(e,t,s,r,i)}function YN(e){const t=[],s=r=>{for(const i of r)i.passesFilter&&(i.group?s(i.children):t.push(i.column))};return s(e),t}function qN(e,t,s,r,i){const n=e.columnStateUpdateStrategy,o=[];for(const a of t)a.colDef.lockVisible||n.isColumnVisibleInToolPanel(H(i),a)!==s&&o.push({colId:a.getId(),hide:!s});n.applyColumnState(H(i),o,r),be(e,i)}function ZN(e,t,s,r,i){XN(e,t,s,r,i)}function XN(e,t,s,r,i){const n=e.columnStateUpdateStrategy,o=[],c=s?u=>{if(!n.isColumnSelectedInPivotModeToolPanel(H(i),u))if(u.isAllowValue()){const d=typeof u.aggFunc=="string"?u.aggFunc:e.aggFuncSvc?.getDefaultAggFunc(u);o.push({colId:u.getId(),aggFunc:d})}else u.isAllowRowGroup()?o.push({colId:u.getId(),rowGroup:!0}):u.isAllowPivot()&&o.push({colId:u.getId(),pivot:!0})}:u=>{n.isColumnSelectedInPivotModeToolPanel(H(i),u)&&o.push({colId:u.getId(),pivot:!1,rowGroup:!1,aggFunc:null})};t.forEach(c),n.applyColumnState(H(i),o,r),be(e,i)}function Cg(e,t){const{columns:s,visibleState:r,pivotState:i,eventType:n}=t,o=e.columnStateUpdateStrategy,a=o.getPivotMode(H(t)),l=s.map(c=>{const u=c.colId;if(a){const d=i?.[u];return{colId:u,pivot:d?.pivot,rowGroup:d?.rowGroup,aggFunc:d?.aggFunc}}else return{colId:u,hide:!r?.[u]}});o.applyColumnState(H(t),l,n),be(e,t)}function JN(e){return{pivot:e.isPivotActive(),rowGroup:e.isRowGroupActive(),aggFunc:e.isValueActive()?e.aggFunc:void 0}}function bg(e,t,s){if(!s)return JN(e);const r=t.getRowGroupColumns(s).includes(e),i=t.getPivotColumns(s).includes(e),n=t.getValueColumns(s).includes(e);return{pivot:i,rowGroup:r,aggFunc:n?t.getColumnAggFunc(s,e):void 0}}import{Component as QN,_createIconNoSpan as fl,isProvidedColumnGroup as Sg}from"ag-grid-community";import{_addGridCommonParams as yg}from"ag-grid-community";function wg(e,t,s,r,i,n=t?.colDef??s?.getColGroupDef()){const o=n?.columnMenuItems;if(Array.isArray(o))return o;if(typeof o=="function")return o(yg(e,{column:t,columnGroup:s,defaultItems:i,source:r}));const a=e.getCallback("getColumnMenuItems");if(a)return a({column:t,columnGroup:s,defaultItems:i,source:r});if(r==="columnMenu"){const l=i,c=n?.mainMenuItems;if(Array.isArray(c))return c;if(typeof c=="function")return c(yg(e,{column:t,columnGroup:s,defaultItems:l}));const u=e.getCallback("getMainMenuItems");if(u)return u({column:t,columnGroup:s,defaultItems:l})}return i}var et={addKey:"addToValues",addDefault:e=>`Add ${e} to values`,removeKey:"removeFromValues",removeDefault:e=>`Remove ${e} from values`,icon:"valuePanel"},tt={addKey:"addToLabels",addDefault:e=>`Add ${e} to labels`,removeKey:"removeFromLabels",removeDefault:e=>`Remove ${e} from labels`,icon:"pivotPanel"},Hs={key:"scrollColumnIntoView",default:e=>`Scroll ${e} into View`,icon:"ensureColumnVisible"};function gt(e,t,s,r){return e(t,s(r),[r])}var ue="separator";function Wr(e,t){if(!e?.length)return;let s=0,r=!0;for(const i of e){const n=i===t;n&&r||(e[s++]=i,r=n)}s>0&&e[s-1]===t&&s--,e.length=s}var xg=(e,t)=>{if(!t)return[];let s=e;for(let r=0,i=t.length;r<i&&s;++r)s=s[t[r]];return Array.isArray(s)?s:[]},Us=(e,t,s,r)=>{const i=e.aggData;i!==t&&(e.aggData=t,e.__localEventService&&eB(e,i,t,s,r))},Fg=(e,t,s,r)=>{Us(e,t,s,r);const i=e.pinnedSibling;i&&Us(i,t,s,r);const n=e.sibling;if(n){Us(n,t,s,r);const o=n.pinnedSibling;o&&Us(o,t,s,r)}},eB=(e,t,s,r,i)=>{if(!s){if(!t)return;const o=Object.keys(t);for(let a=0,l=o.length;a<l;++a){const c=o[a],u=r.colsById[c];u&&e.dispatchCellChangedEvent(u,void 0,t[c])}return}if(i){const o=i.cols;for(let a=0,l=o.length;a<l;++a){const{colId:c,column:u}=o[a],d=s[c],h=t?t[c]:void 0;d!==h&&e.dispatchCellChangedEvent(u,d,h)}if(!t||!i.checkRemoved)return;Tg(e,t,s,r);return}const n=Object.keys(s);for(let o=0,a=n.length;o<a;++o){const l=n[o],c=s[l],u=t?t[l]:void 0;if(c===u)continue;const d=r.colsById[l];d&&e.dispatchCellChangedEvent(d,c,u)}t&&Tg(e,t,s,r)},Tg=(e,t,s,r)=>{const i=Object.keys(t);for(let n=0,o=i.length;n<o;++n){const a=i[n];if(a in s)continue;const l=r.colsById[a];l&&e.dispatchCellChangedEvent(l,void 0,t[a])}},Ag=(e,t,s,r)=>{const i=t.getCol(s);let n=e._groupData;n||(n={},e._groupData=n);const o=i.colId,a=n[o];a!==r&&(n[o]=r,e.dispatchCellChangedEvent(i,r,a))},Pg=(e,t,s)=>{if(!e)return;const r=e.group;r!==s&&(e.group=s,e.updateHasChildren(),r&&!s&&(Us(e,null,t.colModel),e.setAllChildrenCount(null)),e.dispatchRowEvent("groupChanged"))},ml=(e,t,s)=>{Pg(e,t,s),Pg(e.pinnedSibling,t,s)},Kr=(e,t,s=t.rowGroupColsSvc?.columns)=>{const r=t.gos.get("groupLockGroupColumns");if(!s||!e||r===0)return!1;const i=s.findIndex(n=>n.colId===e.colId);return i>=0&&(r===-1||r>i)},$r=(e,t,s)=>{const i=e(t,`${t==="groupBy"?"Group by":"Un-Group by"} ${s}`,[s]);return i.indexOf(s)>=0?i:`${i} ${s}`},Rg=class extends Nx{constructor(e,t,s,r,i,n,o){super({tag:"div",cls:"ag-menu"}),this.column=e,this.trigger=t,this.parentEl=s,this.params=r,this.eventType=i,this.source=n,this.columnMove=o,this.displayName=null}postConstruct(){const{column:e,gos:t,source:s,beans:{colNames:r}}=this;this.initializeProperties(e);let i;e.isColumn?i=r.getDisplayNameForColumn(e,"columnToolPanel"):i=wn(this.beans,e,"columnToolPanel"),this.displayName=i,this.buildMenuItemMap();let n=null,o=null,a;Sg(e)?(o=Vs(this.beans,e),a=e.getColGroupDef()):(n=e,a=e.colDef);const l=t.get("functionsReadOnly");let c;this.isActive()?l?c=this.getDefaultTokens().filter(p=>p===ue||!this.menuItemMap.get(p)?.mutatesState):c=this.getDefaultTokens():c=[],Wr(c,ue);const u=wg(t,n,o,s,c,a),d=this.mapMenuItems(u,n);if(this.allowEditHeaderName){const p=this.beans.colHeaderEditSvc.getEditColumnNameMenuItem(this.column);p&&d.unshift(p)}if(d.length>0||a?.columnMenuItems!=null){const p=this.trigger;"preventDefault"in p&&p.preventDefault()}d.length!==0&&this.displayContextMenu(d,n,o)}mapMenuItems(e,t){const{menuItemMap:s}=this,r=[];for(let o=0,a=e.length;o<a;++o){const l=e[o];if(l==="moveUp"||l==="moveDown"){const c=l==="moveUp";if(!this.isMoveSuppressed()){const u=()=>!this.columnMove?.canMove(c);r.push({name:this.getLocaleTextFunc()(l,c?"Move Up":"Move Down"),icon:fl(c?"menuMoveUp":"menuMoveDown",this.beans,t),disabled:u(),action:()=>{u()||this.columnMove?.move(c)}})}continue}if(typeof l=="string"){const c=l;if(s.has(c)){r.push(...this.resolveToolPanelToken(c));continue}}r.push(l)}const i=this.beans.menuItemMapper,n=i?i.mapWithStockItems(r,t,null,void 0,()=>this.getGui(),this.eventType):r.filter(o=>typeof o!="string"||o===ue);return Wr(n,ue),n}initializeProperties(e){const t=this.beans.columnStateUpdateStrategy;let s;Sg(e)?s=e.getLeafColumns():s=[e],this.columns=s;const r=t.getPivotMode(H(this.params));this.allowScrollIntoView=!r&&s.some(this.isColumnValidForScrollIntoView),this.allowGrouping=s.some(n=>n.primary&&n.isAllowRowGroup()),this.allowValues=s.some(n=>n.primary&&n.isAllowValue()),this.allowPivoting=r&&s.some(n=>n.isPrimary()&&n.isAllowPivot());const i=this.beans.colHeaderEditSvc;this.allowEditHeaderName=!!i?.isEditable(e)}buildMenuItemMap(){const e=this.getLocaleTextFunc(),{beans:t,displayName:s}=this,r=this.beans.columnStateUpdateStrategy,i=new Map;this.menuItemMap=i;const n=H(this.params),o=r.getPivotMode(n),a=new Set(r.getRowGroupColumns(n).map(p=>p.colId)),l=new Set(r.getValueColumns(n).map(p=>p.colId)),c=new Set(r.getPivotColumns(n).map(p=>p.colId));i.set("scrollIntoView",{allowedFunction:p=>!p.isPinned()&&!o&&this.isColumnValidForScrollIntoView(p),activeFunction:()=>!1,activateLabel:()=>gt(e,Hs.key,Hs.default,s),activateFunction:()=>{const p=this.columns.find(this.isColumnValidForScrollIntoView);p&&this.beans.ctrlsSvc.getScrollFeature().ensureColumnVisible(p)},deActivateFunction:()=>{},addIcon:Hs.icon});const u=p=>p.primary&&p.isAllowRowGroup()&&!Kr(p,t);i.set("rowGroup",{allowedFunction:u,activeFunction:p=>a.has(p.colId),activateLabel:()=>$r(e,"groupBy",s),deactivateLabel:()=>$r(e,"ungroupBy",s),activateFunction:()=>{const p=this.addColumnsToList(r.getRowGroupColumns(n),u);r.setRowGroupColumns(n,p,this.eventType),be(this.beans,this.params)},deActivateFunction:()=>{const p=this.removeColumnsFromList(r.getRowGroupColumns(n),u);r.setRowGroupColumns(n,p,this.eventType),be(this.beans,this.params)},addIcon:"menuAddRowGroup",removeIcon:"menuRemoveRowGroup",mutatesState:!0});const d=p=>p.primary&&p.isAllowValue();i.set("value",{allowedFunction:d,activeFunction:p=>l.has(p.colId),activateLabel:()=>gt(e,et.addKey,et.addDefault,s),deactivateLabel:()=>gt(e,et.removeKey,et.removeDefault,s),activateFunction:()=>{const p=this.addColumnsToList(r.getValueColumns(n),d);r.setValueColumns(n,p,this.eventType),be(this.beans,this.params)},deActivateFunction:()=>{const p=this.removeColumnsFromList(r.getValueColumns(n),d);r.setValueColumns(n,p,this.eventType),be(this.beans,this.params)},addIcon:et.icon,removeIcon:et.icon,mutatesState:!0});const h=p=>o&&p.primary&&p.isAllowPivot();i.set("pivot",{allowedFunction:h,activeFunction:p=>c.has(p.colId),activateLabel:()=>gt(e,tt.addKey,tt.addDefault,s),deactivateLabel:()=>gt(e,tt.removeKey,tt.removeDefault,s),activateFunction:()=>{const p=this.addColumnsToList(r.getPivotColumns(n),h);r.setPivotColumns(n,p,this.eventType),be(this.beans,this.params)},deActivateFunction:()=>{const p=this.removeColumnsFromList(r.getPivotColumns(n),h);r.setPivotColumns(n,p,this.eventType),be(this.beans,this.params)},addIcon:tt.icon,removeIcon:tt.icon,mutatesState:!0})}isColumnValidForScrollIntoView(e){if(!e.isVisible())return!1;const s=e.getParent();return s?s.getDisplayedChildren()?.includes(e)??!0:!0}addColumnsToList(e,t){const s=new Set(e),r=[];for(let i=0,n=this.columns.length;i<n;++i){const o=this.columns[i];t(o)&&!s.has(o)&&r.push(o)}return e.concat(r)}removeColumnsFromList(e,t){const s=new Set(this.columns);return e.filter(r=>!t(r)||!s.has(r))}displayContextMenu(e,t,s){pg(this,this.beans,{menuItems:e,menuContext:{column:t,columnGroup:s,node:null,value:null},ePopup:this.getGui(),positionBy:this.trigger instanceof KeyboardEvent?this.parentEl:this.trigger,restoreFocus:()=>this.parentEl.focus()})}isActive(){return!!this.columnMove||this.allowScrollIntoView||this.allowGrouping||this.allowValues||this.allowPivoting||this.allowEditHeaderName}isMoveSuppressed(){return!this.columnMove||vl(this.beans,this.columns,this.params)}getDefaultTokens(){const e=[],{menuItemMap:t,columns:s}=this;for(const[r,i]of t)s.some(n=>i.allowedFunction(n))&&e.push(r);return this.isMoveSuppressed()||e.push(ue,"moveUp","moveDown"),e}resolveToolPanelToken(e){const{menuItemMap:t,columns:s,displayName:r,beans:i}=this,n=t.get(e);if(!n)return[];const o=[],a=s.some(u=>n.allowedFunction(u)&&!n.activeFunction(u)),l=s.some(u=>n.allowedFunction(u)&&n.activeFunction(u)),c=!!n.mutatesState&&this.gos.get("functionsReadOnly");return a&&o.push({name:n.activateLabel(r),icon:fl(n.addIcon,i,null),disabled:c,action:()=>n.activateFunction()}),l&&n.removeIcon&&n.deactivateLabel&&o.push({name:n.deactivateLabel(r),icon:fl(n.removeIcon,i,null),disabled:c,action:()=>n.deActivateFunction?.()}),o}},tB={tag:"div",cls:"ag-column-select-column-group",children:[{tag:"span",ref:"eColumnGroupIcons",cls:"ag-column-group-icons",children:[{tag:"span",ref:"eGroupClosedIcon",cls:"ag-column-group-closed-icon"},{tag:"span",ref:"eGroupOpenedIcon",cls:"ag-column-group-opened-icon"}]},{tag:"ag-checkbox",ref:"cbSelect",cls:"ag-column-select-checkbox"},{tag:"span",ref:"eLabel",cls:"ag-column-select-column-label"}]},Mg=class extends Bx{constructor(e,t,s,r,i,n,o){super(),this.modelItem=e,this.allowDragging=t,this.eventType=s,this.focusWrapper=r,this.params=i,this.source=n,this.columnMove=o,this.cbSelect=zr,this.eLabel=zr,this.eGroupOpenedIcon=zr,this.eGroupClosedIcon=zr,this.eColumnGroupIcons=zr,this.processingColumnStateChange=!1;const{columnGroup:a,depth:l}=e;this.columnGroup=a,this.columnDepth=l}get displayName(){return this.modelItem.displayName}get gridColumnGroup(){return Vs(this.beans,this.columnGroup)}postConstruct(){this.setTemplate(tB,[FN]);const{beans:e,cbSelect:t,eLabel:s,columnDepth:r,modelItem:i,focusWrapper:n,columnGroup:o,params:a,source:l}=this,{gos:c}=e,u=RN("columnDrag",e);this.eDragHandle=u,u.classList.add("ag-drag-handle","ag-column-select-column-group-drag-handle");const d=t.getGui(),h=t.getInputElement();d.after(u),h.setAttribute("tabindex","-1"),gg(a)?this.labelRendererFeature=this.createManagedBean(new fg(s,a,l,null,this.gridColumnGroup,()=>this.displayName)):s.textContent=this.displayName??"",this.setupExpandContract(),this.addCss("ag-column-select-indent-"+r),this.getGui().style.setProperty("--ag-indentation-level",String(r)),this.tooltipFeature=this.createOptionalManagedBean(this.beans.tooltipSvc?.createTooltip({getGui:()=>this.focusWrapper,getTooltipComponentDefinition:()=>MN(o.getColGroupDef()),getLocation:()=>"columnToolPanelColumnGroup",getTooltipValue:()=>{const f=o.getColGroupDef(),m=this.displayName;return LN(f,PN(c,{location:"columnToolPanelColumnGroup",colDef:f,column:this.gridColumnGroup,value:m,valueFormatted:m}))},shouldDisplayTooltip:IN(c,()=>s),getAdditionalParams:()=>{const f=o.getColGroupDef();return{...f?{colDef:f}:{},column:this.gridColumnGroup,valueFormatted:this.displayName}}})),this.addManagedEventListeners({columnPivotModeChanged:this.onColumnStateChanged.bind(this)}),this.addManagedElementListeners(s,{click:this.onLabelClicked.bind(this)}),this.addManagedListeners(t,{fieldValueChanged:this.onCheckboxChanged.bind(this)}),this.addManagedListeners(i,{expandedChanged:this.onExpandChanged.bind(this)}),this.addManagedEventListeners({columnHeaderNameChanged:this.onHeaderNameChanged.bind(this)});const p=new dg(this.getGui(),!1);this.addManagedListeners(p,{longTap:f=>this.onContextMenu(f.touchStart)}),this.addDestroyFunc(p.destroy.bind(p)),this.addManagedListeners(n,{keydown:this.handleKeyDown.bind(this),contextmenu:this.onContextMenu.bind(this)}),this.setOpenClosedIcons(),this.setupDragging(),this.onColumnStateChanged(),this.addVisibilityListenersToAllChildren(),this.refreshAriaExpanded(),this.refreshAriaLabel(),this.setupTooltip();const g=EN(o.getColGroupDef(),this.beans,null,this.gridColumnGroup);for(const f of g)this.toggleCss(f,!0)}getColumns(){return this.columnGroup.getLeafColumns()}setupTooltip(){if(!this.columnGroup.getColGroupDef())return;const t=()=>this.tooltipFeature?.refreshTooltip();t(),this.addManagedEventListeners({newColumnsLoaded:t})}handleKeyDown(e){if(gl(e)){this.onContextMenu(e);return}switch(e.key){case hl.LEFT:e.preventDefault(),this.modelItem.expanded=!1;break;case hl.RIGHT:e.preventDefault(),this.modelItem.expanded=!0;break;case hl.SPACE:e.preventDefault(),this.isSelectable()&&this.onSelectAllChanged(!this.isSelected());break}}onContextMenu(e){const t=this.createBean(new Rg(this.columnGroup,e,this.focusWrapper,this.params,this.eventType,this.source,this.columnMove));this.addDestroyFunc(()=>{t.isAlive()&&this.destroyBean(t)})}addVisibilityListenersToAllChildren(){const e=this.onColumnStateChanged.bind(this);for(const t of this.columnGroup.getLeafColumns())this.addManagedListeners(t,{visibleChanged:e,columnValueChanged:e,columnPivotChanged:e,columnRowGroupChanged:e})}setupDragging(){if(!this.allowDragging){dl(this.eDragHandle,!1);return}const e=this.beans,{gos:t,eventSvc:s,dragAndDrop:r}=e;let i=!t.get("suppressDragLeaveHidesColumns");const n={type:AN.ToolPanel,eElement:this.eDragHandle,dragItemName:()=>this.displayName,getDefaultIconName:()=>i?"hide":"notAllowed",getDragItem:()=>this.createDragItem(),onDragStarted:()=>{i=!t.get("suppressDragLeaveHidesColumns"),s.dispatchEvent({type:"columnPanelItemDragStart",column:this.columnGroup})},onDragStopped:()=>{s.dispatchEvent({type:"columnPanelItemDragEnd"})},onGridEnter:o=>{i&&Cg(e,{columns:this.columnGroup.getLeafColumns(),visibleState:o?.visibleState,pivotState:o?.pivotState,eventType:this.eventType,buttons:this.params.buttons})},onGridExit:()=>{i&&this.onChangeCommon(!1)}};r.addDragSource(n,!0),this.addDestroyFunc(()=>r.removeDragSource(n))}createDragItem(){const e=this.columnGroup.getLeafColumns(),t={},s={},r=this.beans.columnStateUpdateStrategy,i=H(this.params);for(const n of e){const o=n.getId();t[o]=n.isVisible(),s[o]=bg(n,r,i)}return{columns:e,visibleState:t,pivotState:s}}setupExpandContract(){const{beans:e,eGroupClosedIcon:t,eGroupOpenedIcon:s,eColumnGroupIcons:r}=this;t.appendChild(hg("columnSelectClosed",e,null)),s.appendChild(hg("columnSelectOpen",e,null));const i=this.onExpandOrContractClicked.bind(this);this.addManagedElementListeners(t,{click:i}),this.addManagedElementListeners(s,{click:i});const n=new dg(r,!0);this.addManagedListeners(n,{tap:i}),this.addDestroyFunc(n.destroy.bind(n))}onLabelClicked(){const e=!this.cbSelect.getValue();this.onChangeCommon(e)}onCheckboxChanged(e){this.onChangeCommon(e.selected)}getVisibleLeafColumns(){const e=[],t=s=>{for(const r of s)r.passesFilter&&(r.group?t(r.children):e.push(r.column))};return t(this.modelItem.children),e}onChangeCommon(e){this.refreshAriaLabel(),!this.processingColumnStateChange&&mg(this.beans,this.modelItem.children,e,this.eventType,this.params)}onHeaderNameChanged(e){DN(e,this.columnGroup.groupId)&&(this.labelRendererFeature?this.labelRendererFeature.refresh():this.eLabel.textContent=this.displayName??"",this.refreshAriaLabel())}refreshAriaLabel(){const{cbSelect:e,focusWrapper:t,displayName:s}=this,r=this.getLocaleTextFunc(),i=r("ariaColumnGroup","Column Group"),n=e.getValue(),o=n===void 0?r("ariaIndeterminate","indeterminate"):n?r("ariaVisible","visible"):r("ariaHidden","hidden"),a=r("ariaToggleVisibility","Press SPACE to toggle visibility");xN(t,`${s} ${i}`),e.setInputAriaLabel(`${a} (${o})`),yN(t,e.getInputElement().id)}onColumnStateChanged(){const e=this.workOutSelectedValue(),t=this.workOutReadOnlyValue();this.processingColumnStateChange=!0;const s=this.cbSelect;s.setValue(e),s.setReadOnly(t),this.toggleCss("ag-column-select-column-group-readonly",t),this.processingColumnStateChange=!1}workOutSelectedValue(){const t=this.beans.columnStateUpdateStrategy.getPivotMode(H(this.params)),s=this.getVisibleLeafColumns();let r=0,i=0;for(const n of s)(t||!n.colDef.lockVisible)&&(this.isColumnChecked(n)?r++:i++);if(!(r>0&&i>0))return r>0}workOutReadOnlyValue(){const e=this.beans.columnStateUpdateStrategy.getPivotMode(H(this.params));let t=0;for(const s of this.columnGroup.getLeafColumns())e?s.isAnyFunctionAllowed()&&t++:s.colDef.lockVisible||t++;return t===0}isColumnChecked(e){const t=this.beans.columnStateUpdateStrategy;return t.getPivotMode(H(this.params))?t.isColumnSelectedInPivotModeToolPanel(H(this.params),e):t.isColumnVisibleInToolPanel(H(this.params),e)}onExpandOrContractClicked(){const e=this.modelItem,t=e.expanded;e.expanded=!t}onExpandChanged(){this.setOpenClosedIcons(),this.refreshAriaExpanded()}setOpenClosedIcons(){const e=this.modelItem.expanded;dl(this.eGroupClosedIcon,!e),dl(this.eGroupOpenedIcon,e)}refreshAriaExpanded(){wN(this.focusWrapper,this.modelItem.expanded)}getDisplayName(){return this.displayName}onSelectAllChanged(e){const t=this.cbSelect,s=t.getValue();!t.isReadOnly()&&(e&&!s||!e&&s)&&t.toggle()}isSelected(){return this.cbSelect.getValue()}isSelectable(){return!this.cbSelect.isReadOnly()}setSelected(e){this.cbSelect.setValue(e,!0)}},Fn=e=>SN(e)?e.getLeafColumns():e?[e]:[],sB=(e,t,s,r)=>{if(!t||!e)return null;const i=r.indexOf(t),n=s?i:i+1,o=rB(r,e,n);return n-o},rB=(e,t,s)=>{if(!t)return 0;const r=t[0],i=t.length;return e.indexOf(r)<s?i:0},vl=(e,t,s)=>{const{colMoves:r,columnStateUpdateStrategy:i}=e;return!r||r.isMovingSuppressed(t)||i.getPivotMode(H(s))},iB=(e,t,s,r,i)=>{if(!s)return;const{component:n}=s;let o=null,a=s.position==="top";if(n instanceof Mg?(o=n.getColumns()[0],a=!0):n&&(o=n.column),!o)return;const l=H(r),c=l?e.columnStateUpdateStrategy.getPrimaryColumns(l):e.colModel.getCols(),u=sB(t,o,a,c);u!=null&&(e.columnStateUpdateStrategy.moveColumns(l,t,u,i),be(e,r))},nB=e=>e.column;import{RefPlaceholder as Ig,_setAriaDescribedBy as oB,_setAriaLabel as aB,_setDisplayed as lB}from"ag-stack";import{AgCheckboxSelector as cB,Component as uB,DragSourceType as dB,KeyCode as hB,TouchListener as pB,_addGridCommonParams as gB,_createIconNoSpan as fB,_getHeaderTooltipComponentDefinition as mB,_getShouldDisplayTooltip as vB,_getToolPanelClassesFromColDef as CB,_resolveHeaderTooltipValue as bB}from"ag-grid-community";var SB={tag:"div",cls:"ag-column-select-column",children:[{tag:"ag-checkbox",ref:"cbSelect",cls:"ag-column-select-checkbox"},{tag:"span",ref:"eLabel",cls:"ag-column-select-column-label"}]},yB=class extends Vx{constructor(e,t,s,r,i,n,o,a){super(),this.modelItem=e,this.allowDragging=t,this.groupsExist=s,this.focusWrapper=r,this.params=i,this.eventType=n,this.source=o,this.columnMove=a,this.eLabel=Ig,this.cbSelect=Ig,this.processingColumnStateChange=!1;const{column:l,depth:c}=e;this.column=l,this.columnDepth=c}get displayName(){return this.modelItem.displayName}postConstruct(){this.setTemplate(SB,[cB]);const{beans:e,cbSelect:t,eLabel:s,columnDepth:r,groupsExist:i,column:n,gos:o,focusWrapper:a}=this,l=fB("columnDrag",e);this.eDragHandle=l,l.classList.add("ag-drag-handle","ag-column-select-column-drag-handle");const c=t.getGui(),u=t.getInputElement();c.after(l),u.setAttribute("tabindex","-1"),gg(this.params)?this.labelRendererFeature=this.createManagedBean(new fg(s,this.params,this.source,this.column,null,()=>this.displayName)):s.textContent=this.displayName,i&&this.addCss("ag-column-select-add-group-indent"),this.addCss(`ag-column-select-indent-${r}`),this.getGui().style.setProperty("--ag-indentation-level",String(r)),this.tooltipFeature=this.createOptionalManagedBean(e.tooltipSvc?.createTooltip({getGui:()=>this.focusWrapper,getTooltipComponentDefinition:()=>mB(n.colDef),getLocation:()=>"columnToolPanelColumn",getTooltipValue:()=>{const g=this.displayName;return bB(n.colDef,gB(o,{location:"columnToolPanelColumn",colDef:n.colDef,column:n,value:g,valueFormatted:g}))},shouldDisplayTooltip:vB(o,()=>s),getAdditionalParams:()=>({colDef:n.colDef,column:n,valueFormatted:this.displayName})})),this.setupDragging();const d=this.onColumnStateChanged.bind(this);this.addManagedEventListeners({columnPivotModeChanged:d}),this.addManagedListeners(n,{columnValueChanged:d,columnPivotChanged:d,columnRowGroupChanged:d,visibleChanged:d,colDefChanged:this.onColDefChanged.bind(this),headerNameChanged:this.onColDefChanged.bind(this)}),this.addManagedListeners(a,{keydown:this.handleKeyDown.bind(this),contextmenu:this.onContextMenu.bind(this)});const h=new pB(a);this.addManagedListeners(h,{longTap:g=>this.onContextMenu(g.touchStart)}),this.addDestroyFunc(h.destroy.bind(h)),this.addManagedPropertyListener("functionsReadOnly",this.onColumnStateChanged.bind(this)),this.addManagedListeners(t,{fieldValueChanged:this.onCheckboxChanged.bind(this)}),this.addManagedElementListeners(s,{click:this.onLabelClicked.bind(this)}),this.onColumnStateChanged(),this.refreshAriaLabel(),this.setupTooltip();const p=CB(n.colDef,this.beans,n,null);for(const g of p)this.toggleCss(g,!0)}getColumn(){return this.column}setupTooltip(){const e=()=>this.tooltipFeature?.refreshTooltip();e(),this.addManagedEventListeners({newColumnsLoaded:e})}onContextMenu(e){const t=this.createBean(new Rg(this.column,e,this.focusWrapper,this.params,this.eventType,this.source,this.columnMove));this.addDestroyFunc(()=>{t.isAlive()&&this.destroyBean(t)})}handleKeyDown(e){gl(e)?this.onContextMenu(e):e.key===hB.SPACE&&(e.preventDefault(),this.isSelectable()&&this.onSelectAllChanged(!this.isSelected()))}onLabelClicked(){if(this.gos.get("functionsReadOnly"))return;const e=!this.cbSelect.getValue();this.onChangeCommon(e)}onCheckboxChanged(e){this.onChangeCommon(e.selected)}onChangeCommon(e){this.cbSelect.isReadOnly()||(this.refreshAriaLabel(),!this.processingColumnStateChange&&vg(this.beans,[this.column],e,this.eventType,this.params))}onColDefChanged(){this.labelRendererFeature?this.labelRendererFeature.refresh():this.eLabel.textContent=this.displayName,this.refreshAriaLabel()}refreshAriaLabel(){const{cbSelect:e,focusWrapper:t,displayName:s}=this,r=this.getLocaleTextFunc(),i=r("ariaColumn","Column"),n=e.getValue()?r("ariaVisible","visible"):r("ariaHidden","hidden"),o=r("ariaToggleVisibility","Press SPACE to toggle visibility");aB(t,`${s} ${i}`),this.cbSelect.setInputAriaLabel(`${o} (${n})`),oB(t,e.getInputElement().id)}setupDragging(){const e=this.eDragHandle;if(!this.allowDragging){lB(e,!1);return}const t=this.beans,{gos:s,eventSvc:r,dragAndDrop:i}=t;H(this.params)&&(e.dataset.columnToolPanelDeferred="");let n=!s.get("suppressDragLeaveHidesColumns");const o={type:dB.ToolPanel,eElement:e,dragItemName:()=>this.displayName,getDefaultIconName:()=>n&&!H(this.params)?"hide":"notAllowed",getDragItem:()=>this.createDragItem(),onDragStarted:()=>{n=!s.get("suppressDragLeaveHidesColumns"),r.dispatchEvent({type:"columnPanelItemDragStart",column:this.column})},onDragStopped:()=>{r.dispatchEvent({type:"columnPanelItemDragEnd"})},onGridEnter:a=>{n&&!H(this.params)&&Cg(t,{columns:[this.column],visibleState:a?.visibleState,pivotState:a?.pivotState,eventType:this.eventType,buttons:this.params.buttons})},onGridExit:()=>{n&&!H(this.params)&&this.onChangeCommon(!1)}};i.addDragSource(o,!0),this.addDestroyFunc(()=>i.removeDragSource(o))}createDragItem(){const e=this.column.colId,t={[e]:this.column.isVisible()},s=this.beans.columnStateUpdateStrategy,r={[e]:bg(this.column,s,H(this.params))};return{columns:[this.column],visibleState:t,pivotState:r}}onColumnStateChanged(){this.processingColumnStateChange=!0;const e=this.beans.columnStateUpdateStrategy,t=e.getPivotMode(H(this.params));if(t){const i=e.isColumnSelectedInPivotModeToolPanel(H(this.params),this.column);this.cbSelect.setValue(i)}else this.cbSelect.setValue(e.isColumnVisibleInToolPanel(H(this.params),this.column));let s,r;if(t){const i=this.gos.get("functionsReadOnly"),n=!this.column.isAnyFunctionAllowed();s=!i&&!n,r=s}else{const{enableRowGroup:i,enableValue:n,lockPosition:o,suppressMovable:a,lockVisible:l}=this.column.colDef,c=!!i||!!n,u=!!o||!!a;s=!l,r=c||!u}this.cbSelect.setReadOnly(!s),this.eDragHandle.classList.toggle("ag-column-select-column-readonly",!r),this.toggleCss("ag-column-select-column-readonly",!r&&!s),this.cbSelect.setPassive(!1),this.processingColumnStateChange=!1}getDisplayName(){return this.displayName}onSelectAllChanged(e){const t=this.cbSelect;e!==t.getValue()&&(t.isReadOnly()||t.toggle())}isSelected(){return this.cbSelect.getValue()}isSelectable(){return!this.cbSelect.isReadOnly()}isExpandable(){return!1}setExpanded(e){this.beans.log.warn(158)}},wB=class{constructor(e){this.items=e}getRowCount(){return this.items.length}getRow(e){return this.items[e]}},xB="ag-column-select-list",FB=class extends Hx{constructor(){super({tag:"div",cls:xB,role:"presentation"}),this.destroyColumnItemFuncs=[],this.layoutGroupRenameNotifiers=[],this.hasLoadedInitialState=!1,this.restoredExpandedGroupIds=null,this.skipRefocus=!1,this.customColumnLayout=null,this.isPreventMove=!1}wireBeans(e){this.colModel=e.colModel}destroy(){this.destroyColumnTree(),super.destroy()}destroyColumnTree(){this.allColsTree=[],this.layoutGroupRenameNotifiers=[];for(const e of this.destroyColumnItemFuncs)e();this.destroyColumnItemFuncs=[]}init(e,t,s,r){this.params=e;const{suppressSyncLayoutWithGrid:i,contractColumnSelection:n,suppressColumnMove:o}=e;this.allowDragging=t&&!(i&&H(e)),this.eventType=s,this.source=r,i||this.addManagedEventListeners({columnMoved:this.onColumnsChanged.bind(this)}),this.addManagedEventListeners({newColumnsLoaded:this.onColumnsChanged.bind(this),columnHeaderNameChanged:this.onHeaderNameChanged.bind(this)});const a=this.fireSelectionChangedEvent.bind(this);this.addManagedEventListeners({columnPivotChanged:a,columnPivotModeChanged:a,columnRowGroupChanged:a,columnValueChanged:a,columnVisible:a,newColumnsLoaded:a}),this.expandGroupsByDefault=!n,this.isPreventMove=!!o||!!i,this.noMatchesComp=this.createManagedBean(new ul("ag-column-select-no-matches")),this.appendChild(this.noMatchesComp);const l=this.createManagedBean(new Gs({cssIdentifier:"column-select",ariaRole:"tree",moveItemCallback:(c,u)=>this.moveItems(c.modelItem,u)}));this.virtualList=l,this.appendChild(l.getGui()),l.setComponentCreator((c,u)=>(lN(u,c.depth+1),this.createComponentFromItem(c,u))),this.colModel.ready&&this.onColumnsChanged(),!this.isPreventMove&&this.createItemDragFeature()}createItemDragFeature(){const{beans:e,virtualList:t}=this;this.createManagedBean(new sp(this,t,{dragSourceType:uN.ToolPanel,addListeners:(s,r,i)=>{s.addManagedEventListeners({columnPanelItemDragStart:r,columnPanelItemDragEnd:i})},getCurrentDragValue:s=>nB(s),isMoveBlocked:s=>vl(e,Fn(s),this.params),getNumRows:s=>s.getDisplayedColsList().length,moveItem:(s,r)=>iB(e,Fn(s),r,this.params,this.eventType)}))}getMoveTarget(e,t){const{beans:s,params:r,displayedColsList:i}=this,n=Fn(e.group?e.columnGroup:e.column),o=i.indexOf(e);if(!this.isAlive()||o<0||this.isPreventMove||vl(s,n,r))return null;const a=H(r)?s.columnStateUpdateStrategy.getPrimaryColumns(!0):s.colModel.colsList,l=t?-1:1;for(let c=o+l;c>=0&&c<i.length;c+=l){const u=i[c];if(u.group&&u.expanded)continue;const d=Fn(u.group?u.columnGroup:u.column),h=s.colMoves?.getColumnMoveTarget(n,d,t,a);if(h)return h}return null}moveItems(e,t){const s=this.getMoveTarget(e,t);if(!s)return;this.skipRefocus=!0,this.beans.columnStateUpdateStrategy.moveColumns(H(this.params),s.columns,s.toIndex,this.eventType),be(this.beans,this.params);const r=this.displayedColsList.findIndex(i=>e.group?i.group&&i.columnGroup.groupId===e.columnGroup.groupId&&i.columnGroup.getLeafColumns().includes(s.columns[0]):!i.group&&i.column===e.column);this.focusRowIfAlive(r).then(()=>{this.skipRefocus=!1})}createComponentFromItem(e,t){const{allowDragging:s,eventType:r,params:i,source:n,groupsExist:o}=this,a=this.isPreventMove?void 0:{canMove:c=>!!this.getMoveTarget(e,c),move:c=>this.moveItems(e,c)};if(e.group){const c=new Mg(e,s,r,t,i,n,a);return this.createBean(c),c}const l=new yB(e,s,o,t,i,r,n,a);return this.createBean(l),l}onColumnsChanged(){const e=this.params;this.loadInitialState();const t=this.getExpandedStates(),s=this.colModel.pivotMode,r=H(e),i=r&&this.beans.columnStateUpdateStrategy.hasDeferredColumnOrder(r);if((!e.suppressSyncLayoutWithGrid||r)&&!s||i)this.buildTreeFromWhatGridIsDisplaying();else{if(this.customColumnLayout&&!s)return;this.buildTreeFromProvidedColumnDefs()}this.setExpandedStates(t),this.markFilteredColumns(),this.flattenAndFilterModel()}loadInitialState(){if(this.hasLoadedInitialState)return;this.hasLoadedInitialState=!0;const e=this.params.initialState;e&&(this.restoredExpandedGroupIds=new Set(e.expandedGroupIds))}getDisplayedColsList(){return this.displayedColsList}getExpandedStates(){const e={};this.allColsTree&&this.forEachItem(s=>{if(!s.group)return;const r=s.columnGroup;r&&(e[r.groupId]=s.expanded)});const t=this.restoredExpandedGroupIds;if(t)for(const s of t)e[s]??(e[s]=!0);return e}setExpandedStates(e){if(!this.allColsTree)return;const t=!!this.restoredExpandedGroupIds;this.forEachItem(s=>{if(!s.group)return;const r=s.columnGroup;if(r){const i=e[r.groupId];(i!=null||t)&&(s.expanded=!!i)}})}buildTreeFromWhatGridIsDisplaying(){const e=H(this.params);if(e&&this.beans.columnStateUpdateStrategy.hasDeferredColumnOrder(e)){const t=this.beans.columnStateUpdateStrategy.getPrimaryColumns(e);if(t.length>0){fN(t,this.applyColumnLayout.bind(this));return}}if(this.params.suppressSyncLayoutWithGrid){this.buildTreeFromProvidedColumnDefs();return}ag(this.colModel,this.applyColumnLayout.bind(this))}setColumnLayout(e){this.customColumnLayout=e,this.loadInitialState();const t=this.getExpandedStates();this.applyColumnLayout(e),this.setExpandedStates(t),this.flattenAndFilterModel()}applyColumnLayout(e){const t=og(this.beans,e);this.buildListModel(t),this.groupsExist=e.some(s=>s&&s.children!==void 0),this.markFilteredColumns(),this.flattenAndFilterModel()}buildTreeFromProvidedColumnDefs(){const e=this.colModel;this.buildListModel(e.colDefTree),this.groupsExist=!!e.colDefTreeDepth}buildListModel(e){const t=this.onColumnExpanded.bind(this),s=a=>{a.addEventListener("expandedChanged",t);const l=a.removeEventListener.bind(a,"expandedChanged",t);this.destroyColumnItemFuncs.push(l)},r=this.beans,i=(a,l,c)=>{for(const u of a)dN(u)?n(u,l,c):o(u,l,c)},n=(a,l,c)=>{if(a.getColGroupDef()?.suppressColumnsToolPanel)return;if(a.padding){i(a.children,l,c);return}const h=new ug(r,a,l,!0,this.expandGroupsByDefault);c.push(h),s(h),this.layoutGroupRenameNotifiers.push(cg(r,a)),i(a.children,l+1,h.children)},o=(a,l,c)=>{a.colDef?.suppressColumnsToolPanel||c.push(new ug(r,a,l))};this.destroyColumnTree(),i(e,0,this.allColsTree)}onHeaderNameChanged(){for(const e of this.layoutGroupRenameNotifiers)e()}onColumnExpanded(){this.flattenAndFilterModel()}flattenAndFilterModel(e=!1){this.displayedColsList=[];const t=o=>{if(o.passesFilter&&(this.displayedColsList.push(o),o.group&&o.expanded)){const a=o.children;for(let l=0,c=a.length;l<c;++l)t(a[l])}},s=this.virtualList,r=this.allColsTree;for(let o=0,a=r.length;o<a;++o)t(r[o]);s.setModel(new wB(this.displayedColsList));const i=this.filterText!=null&&this.displayedColsList.length===0;this.noMatchesComp.setNoMatches(i,e),s.setDisplayed(!i);let n=null;this.skipRefocus||(n=s.getLastFocusedRow()),s.refresh(),n!=null&&this.focusRowIfAlive(n),this.notifyListeners(),this.refreshAriaLabel()}refreshAriaLabel(){const e=this.getLocaleTextFunc(),t=e("ariaColumnPanelList","Column List"),s=e("columns","Columns"),r=this.displayedColsList.length;aN(this.virtualList.getAriaElement(),`${t} ${r} ${s}`)}focusRowIfAlive(e){return e===-1?Promise.resolve():new Promise(t=>{window.setTimeout(()=>{this.isAlive()&&this.virtualList.focusRow(e),t()},0)})}forEachItem(e){const t=r=>{for(const i of r)e(i),i.group&&t(i.children)},s=this.allColsTree;s&&t(s)}doSetExpandedAll(e){this.forEachItem(t=>{t.group&&(t.expanded=e)})}setGroupsExpanded(e,t){if(!t){this.doSetExpandedAll(e);return}const s=new Set(t),r=new Set;this.forEachItem(n=>{if(!n.group)return;const o=n.columnGroup.groupId;s.has(o)&&(n.expanded=e,r.add(o))});const i=t.filter(n=>!r.has(n));i.length>0&&this.beans.log.warn(157,{unrecognisedGroupIds:i})}getExpandState(){let e=0,t=0;return this.forEachItem(s=>{s.group&&(s.expanded?e++:t++)}),e>0&&t>0?2:t>0?1:0}doSetSelectedAll(e){mg(this.beans,this.allColsTree,e,this.eventType,this.params),this.syncVisibleSelectionState(),this.fireSelectionChangedEvent()}syncVisibleSelectionState(){for(let e=0;e<this.displayedColsList.length;e++)this.virtualList.getComponentAt(e)?.onColumnStateChanged?.()}getSelectionState(){let e=0,t=0;const s=this.beans.columnStateUpdateStrategy,r=s.getPivotMode(H(this.params));if(this.forEachItem(i=>{if(i.group||!i.passesFilter)return;const n=i.column,o=n.colDef;let a;if(r){if(!n.isAllowPivot()&&!n.isAllowRowGroup()&&!n.isAllowValue())return;a=s.isColumnSelectedInPivotModeToolPanel(H(this.params),n)??!1}else{if(o.lockVisible)return;a=s.isColumnVisibleInToolPanel(H(this.params),n)??!1}a?e++:t++}),!(e>0&&t>0))return!(e===0||t>0)}setFilterText(e){this.filterText=rg(e)?e.toLowerCase():null,this.markFilteredColumns(),this.flattenAndFilterModel(!0)}markFilteredColumns(){const e=s=>rg(this.filterText)?s.displayName?.toLowerCase().indexOf(this.filterText)!==-1:!0,t=(s,r)=>{let i=!1;if(s.group){const o=e(s);for(const a of s.children){const l=t(a,o||r);l&&(i=l)}}const n=r||i?!0:e(s);return s.passesFilter=n,n};for(const s of this.allColsTree)t(s,!1)}notifyListeners(){this.fireGroupExpandedEvent(),this.fireSelectionChangedEvent()}fireGroupExpandedEvent(){const e=this.getExpandState();this.dispatchLocalEvent({type:"groupExpanded",state:e})}fireSelectionChangedEvent(){if(!this.allColsTree)return;const e=this.getSelectionState();this.dispatchLocalEvent({type:"selectionChanged",state:e})}getExpandedGroups(){const e=[];return this.allColsTree&&this.forEachItem(t=>{t.group&&t.expanded&&e.push(t.columnGroup.groupId)}),e}},TB={selector:"AG-PRIMARY-COLS-LIST",component:FB},AB={tag:"div",cls:"ag-column-select",children:[{tag:"ag-primary-cols-header",ref:"primaryColsHeaderPanel"},{tag:"ag-primary-cols-list",ref:"primaryColsListPanel"}]},Eg=class extends Ux{constructor(){super(AB,[oN,TB]),this.primaryColsHeaderPanel=sg,this.primaryColsListPanel=sg,this.registerCSS(XO)}init(e,t,s,r){const{primaryColsHeaderPanel:i,primaryColsListPanel:n}=this;i.init(t);const o=t.suppressColumnFilter,a=t.suppressColumnSelectAll;t.suppressColumnExpandAll&&o&&a&&i.setDisplayed(!1),this.addManagedListeners(n,{groupExpanded:c=>{i.setExpandState(c.state),t.onStateUpdated()},selectionChanged:c=>i.setSelectionState(c.state)}),n.init(t,e,s,r),this.addManagedListeners(i,{expandAll:n.doSetExpandedAll.bind(n,!0),collapseAll:n.doSetExpandedAll.bind(n,!1),selectAll:n.doSetSelectedAll.bind(n,!0),unselectAll:n.doSetSelectedAll.bind(n,!1),filterChanged:c=>n.setFilterText(c.filterText)}),this.positionableFeature=this.createManagedBean(new ZO(this.getGui(),{minHeight:100}))}toggleResizable(e){this.positionableFeature.setResizable(e?{bottom:!0}:!1)}expandGroups(e){this.primaryColsListPanel.setGroupsExpanded(!0,e)}collapseGroups(e){this.primaryColsListPanel.setGroupsExpanded(!1,e)}setColumnLayout(e){this.primaryColsListPanel.setColumnLayout(e)}syncLayoutWithGrid(){this.primaryColsListPanel.onColumnsChanged()}getExpandedGroups(){return this.primaryColsListPanel.getExpandedGroups()}},PB=".ag-column-panel{display:flex;flex:1 1 auto;flex-direction:column;overflow:hidden}.ag-pivot-mode-panel{display:flex;height:var(--ag-header-height)}.ag-pivot-mode-select{align-items:center;display:flex}:where(.ag-ltr) .ag-pivot-mode-select{margin-left:var(--ag-widget-container-horizontal-padding)}:where(.ag-rtl) .ag-pivot-mode-select{margin-right:var(--ag-widget-container-horizontal-padding)}.ag-column-panel-column-select:where(:not(.ag-last-visible-child)){border-bottom:var(--ag-tool-panel-separator-border)}.ag-column-panel-column-select:where(:nth-child(n+2 of :not(.ag-hidden))){border-top:var(--ag-tool-panel-separator-border)}:where(.ag-column-panel) .ag-column-drop-vertical{flex:1 1 0px;min-height:50px}:where(.ag-column-panel) .ag-column-drop-vertical:where(:not(.ag-last-column-drop)){border-bottom:var(--ag-tool-panel-separator-border)}.ag-column-panel-buttons{display:flex;flex-wrap:wrap;gap:var(--ag-widget-vertical-spacing) var(--ag-widget-horizontal-spacing);justify-content:flex-end;overflow:hidden;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding) 0;:where(.ag-standard-button){transition:background-color .25s ease-in-out,color .25s ease-in-out}}.ag-column-panel-buttons:where(:last-child){padding-bottom:var(--ag-widget-container-vertical-padding)}.ag-column-panel-buttons-button{line-height:1.5}:where(.ag-column-panel) .ag-column-panel-buttons-apply-button:not(:disabled){background-color:var(--ag-column-panel-apply-button-background-color);color:var(--ag-column-panel-apply-button-color)}",RB="ag-column-panel-deferred",MB={apply:["applyColumnToolPanel","Apply"],cancel:["cancelColumnToolPanel","Cancel"],reset:["resetColumnToolPanel","Reset"]},IB=class extends zx{constructor(){super({tag:"div",cls:"ag-column-panel"}),this.initialised=!1,this.childDestroyFuncs=[],this.isDeferModeEnabled=!1,this.isCommitting=!1,this.onDeferredApply=()=>{this.isCommitting=!0;try{this.beans.columnStateUpdateStrategy.commit(this.isDeferModeEnabled)}finally{this.isCommitting=!1}this.buttonsComp?.updateValidity(!1),this.lastKnownGridState=this.captureGridState()},this.onDeferredCancel=()=>{this.beans.columnStateUpdateStrategy.reset(this.isDeferModeEnabled),this.buttonsComp?.updateValidity(!1),this.refreshToolPanelLayouts(),this.pivotModePanel?.refreshEditStrategy(),this.lastKnownGridState=this.captureGridState()},this.onReset=()=>{YO(this.beans,"toolPanelUi"),this.onDeferredCancel()},this.onPivotModePanelValueChanged=()=>{this.refreshToolPanelLayouts(),this.setLastVisible(),this.buttonsComp?.updateValidity(this.beans.columnStateUpdateStrategy.hasPendingChanges(this.isDeferModeEnabled))},this.onColumnEverythingChanged=()=>{if(!this.isDeferModeEnabled||this.isCommitting)return;const e=this.captureGridState();if(!this.beans.columnStateUpdateStrategy.hasPendingChanges(this.isDeferModeEnabled)){this.lastKnownGridState=e;return}const t=this.lastKnownGridState&&this.isGridStateEqual(this.lastKnownGridState,e);this.lastKnownGridState=e,t&&this.resetDeferredState()},this.onExternalGridChange=()=>{!this.isDeferModeEnabled||this.isCommitting||this.beans.columnStateUpdateStrategy.hasPendingChanges(this.isDeferModeEnabled)&&(this.resetDeferredState(),this.lastKnownGridState=this.captureGridState())},this.registerCSS(PB)}wireBeans(e){this.colToolPanelFactory=e.colToolPanelFactory}setVisible(e){super.setDisplayed(e),e&&!this.initialised&&this.init(this.params)}init(e){const s={...jO(this.gos,{suppressColumnMove:!1,suppressColumnSelectAll:!1,suppressColumnFilter:!1,suppressColumnExpandAll:!1,contractColumnSelection:!1,suppressPivotMode:!1,suppressRowGroups:!1,suppressValues:!1,suppressPivots:!1,suppressSyncLayoutWithGrid:!1}),...e,eWrapperPanel:this.getGui()};this.params=s,this.appliedParams=e;const{childDestroyFuncs:r,colToolPanelFactory:i,gos:n}=this,o=n.isModuleRegistered("SharedPivot"),a=o||n.isModuleRegistered("SharedRowGrouping");this.isDeferModeEnabled=H(s),this.toggleCss(RB,this.isDeferModeEnabled),!s.suppressPivotMode&&i&&o&&(this.pivotModePanel=i.createPivotModePanel(this,r,s,this.onPivotModePanelValueChanged));const l=this.createBean(new Eg);if(this.primaryColsPanel=l,r.push(()=>this.destroyBean(this.primaryColsPanel)),l.init(!0,s,"toolPanelUi","columnsToolPanel"),l.addCss("ag-column-panel-column-select"),this.appendChild(l),i){!s.suppressRowGroups&&a&&(this.rowGroupDropZonePanel=i.createRowGroupPanel(this,r,s)),!s.suppressValues&&a&&(this.valuesDropZonePanel=i.createValuesPanel(this,r,s)),!s.suppressPivots&&o&&(this.pivotDropZonePanel=i.createPivotPanel(this,r,s)),this.setLastVisible();const[u]=this.addManagedEventListeners({columnPivotModeChanged:()=>{this.resetChildrenHeight(),this.setLastVisible()}});r.push(()=>u())}if(this.isDeferModeEnabled){const u=this.onExternalGridChange;r.push(...this.addManagedEventListeners({columnEverythingChanged:this.onColumnEverythingChanged,sortChanged:u,columnVisible:u,columnRowGroupChanged:u,columnValueChanged:u,columnPivotChanged:u,columnPivotModeChanged:u,newColumnsLoaded:u,...s.suppressSyncLayoutWithGrid?{}:{columnMoved:u}}))}const c=s.buttons;c?.length&&(c.includes("cancel")&&!this.isDeferModeEnabled&&this.beans.log.warn(298),this.initButtons(c)),this.initialised=!0}initButtons(e){const t=this.createBean(new $O({className:"ag-column-panel-buttons"}));this.buttonsComp=t,this.childDestroyFuncs.push(()=>{this.buttonsComp=this.destroyBean(this.buttonsComp)});const s=this.getLocaleTextFunc(),r=e.map(i=>({type:i,label:s(...MB[i])}));t.updateButtons(r),t.updateValidity(!1),t.addManagedListeners(t,{apply:this.onDeferredApply,cancel:this.onDeferredCancel,reset:this.onReset}),this.appendChild(t)}resetDeferredState(){this.beans.columnStateUpdateStrategy.reset(this.isDeferModeEnabled),this.buttonsComp?.updateValidity(!1),this.refreshToolPanelLayouts(),this.pivotModePanel?.refreshEditStrategy()}captureGridState(){const{beans:e}=this,t=s=>(s??[]).map(r=>r.getColId());return{rowGroupColIds:t(e.rowGroupColsSvc?.columns),valueColIds:t(e.valueColsSvc?.columns),pivotColIds:t(e.pivotColsSvc?.columns),pivotMode:e.colModel.pivotMode,columnOrder:e.colModel.getCols().map(s=>s.colId),visibleColIds:e.colModel.getCols().filter(s=>s.isVisible()).map(s=>s.colId),sortState:e.colModel.getCols().filter(s=>s.getSort()).map(s=>`${s.colId}:${s.getSort()}:${s.getSortIndex()}`),aggFuncState:(e.valueColsSvc?.columns??[]).map(s=>s.aggFunc),widthState:e.colModel.getCols().map(s=>`${s.colId}:${s.getActualWidth()}`)}}isGridStateEqual(e,t){return Wt(e.rowGroupColIds,t.rowGroupColIds)&&Wt(e.valueColIds,t.valueColIds)&&Wt(e.pivotColIds,t.pivotColIds)&&e.pivotMode===t.pivotMode&&Wt(e.columnOrder,t.columnOrder)&&Wt(e.visibleColIds,t.visibleColIds)&&Wt(e.sortState,t.sortState)&&Wt(e.aggFuncState,t.aggFuncState)&&Wt(e.widthState,t.widthState)}refreshDeferredUi(){this.refreshToolPanelLayouts(),this.setLastVisible(),this.pivotModePanel?.refreshEditStrategy(),this.buttonsComp?.updateValidity(this.beans.columnStateUpdateStrategy.hasPendingChanges(this.isDeferModeEnabled))}refreshToolPanelLayouts(){this.primaryColsPanel.syncLayoutWithGrid(),this.rowGroupDropZonePanel?.refreshGui(),this.valuesDropZonePanel?.refreshGui(),this.pivotDropZonePanel?.refresh()}setPivotModeSectionVisible(e){const t=this.colToolPanelFactory;t&&(this.pivotModePanel=t.setPanelVisible(this.pivotModePanel,e,t.createPivotModePanel.bind(t,this,this.childDestroyFuncs,this.params,this.onPivotModePanelValueChanged,!0)),this.setLastVisible())}setRowGroupsSectionVisible(e){const t=this.colToolPanelFactory;t&&(this.rowGroupDropZonePanel=t.setPanelVisible(this.rowGroupDropZonePanel,e,t.createRowGroupPanel.bind(t,this,this.childDestroyFuncs,this.params)),this.setLastVisible())}setValuesSectionVisible(e){const t=this.colToolPanelFactory;t&&(this.valuesDropZonePanel=t.setPanelVisible(this.valuesDropZonePanel,e,t.createValuesPanel.bind(t,this,this.childDestroyFuncs,this.params)),this.setLastVisible())}setPivotSectionVisible(e){const t=this.colToolPanelFactory;t&&(this.pivotDropZonePanel=t.setPanelVisible(this.pivotDropZonePanel,e,t.createPivotPanel.bind(t,this,this.childDestroyFuncs,this.params)),this.pivotDropZonePanel?.setDisplayed(e),this.setLastVisible())}setResizers(){for(const e of[this.primaryColsPanel,this.rowGroupDropZonePanel,this.valuesDropZonePanel,this.pivotDropZonePanel]){if(!e)continue;const t=e.getGui();e.toggleResizable(!t.classList.contains("ag-last-column-drop")&&!t.classList.contains("ag-hidden")&&!t.classList.contains("ag-last-visible-child"))}}setLastVisible(){const e=this.getGui(),t=Array.prototype.slice.call(e.querySelectorAll(".ag-column-drop"));for(const i of t)i.classList.remove("ag-last-column-drop");const s=e.querySelectorAll(".ag-column-drop:not(.ag-hidden)"),r=WO(s);r&&r.classList.add("ag-last-column-drop"),this.primaryColsPanel.getGui().classList.toggle("ag-last-visible-child",!r),this.setResizers()}resetChildrenHeight(){const t=this.getGui().children;for(let s=0;s<t.length;s++){const r=t[s]?.style;r?.removeProperty("height"),r?.removeProperty("flex")}}expandColumnGroups(e){this.primaryColsPanel.expandGroups(e)}collapseColumnGroups(e){this.primaryColsPanel.collapseGroups(e)}setColumnLayout(e){this.primaryColsPanel.setColumnLayout(e)}syncLayoutWithGrid(){this.primaryColsPanel.syncLayoutWithGrid()}destroyChildren(){const e=this.childDestroyFuncs;for(const t of e)t();e.length=0,zO(this.getGui())}refresh(e){const s=!!e.initialState&&e!==this.appliedParams?e.initialState:this.getState();return this.destroyChildren(),this.init({...e,initialState:s}),this.appliedParams=e,!0}getState(){return{expandedGroupIds:this.primaryColsPanel.getExpandedGroups()}}destroy(){this.destroyChildren(),super.destroy()}};import{BeanStub as EB}from"ag-grid-community";import{_addFocusableContainerListener as DB,_createIconNoSpan as LB}from"ag-grid-community";import{DragSourceType as Dg,_createIconNoSpan as kB,_shouldUpdateColVisibilityAfterGroup as _B}from"ag-grid-community";import{_areEqual as GB,_clearElement as Lg,_findFocusableElements as OB,_findNextFocusableElement as Cl,_getActiveDomElement as kg,_isKeyboardMode as NB,_last as BB,_scrollHorizontallyToShow as _g,_setAriaHidden as VB,_setAriaLabel as HB,_setAriaPosInSet as UB,_setAriaRole as zB,_setAriaSetSize as WB}from"ag-stack";import{Component as KB,KeyCode as zs,ManagedFocusFeature as $B,PositionableFeature as jB,_createElement as Tn,_createIconNoSpan as YB}from"ag-grid-community";var qB=".ag-column-drop{align-items:center;display:inline-flex;overflow:auto;position:relative;width:100%}.ag-column-drop-list{align-items:center;display:flex}.ag-column-drop-cell{align-items:center;background-color:var(--ag-column-drop-cell-background-color);border:var(--ag-column-drop-cell-border);border-radius:500px;color:var(--ag-column-drop-cell-text-color);display:flex;font-weight:400;padding:calc(var(--ag-spacing)*.25);position:relative;&:focus-visible{box-shadow:var(--ag-focus-shadow)}:where(.ag-drag-handle){color:var(--ag-column-drop-cell-drag-handle-color)}}:where(.ag-ltr) .ag-column-drop-cell{padding-left:calc(var(--ag-spacing)*.75)}:where(.ag-rtl) .ag-column-drop-cell{padding-right:calc(var(--ag-spacing)*.75)}.ag-column-drop-cell-text{flex:1 1 auto;margin:0 var(--ag-spacing);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ag-column-drop-vertical{align-items:stretch;display:flex;flex-direction:column;min-height:75px;overflow:hidden}.ag-column-drop-vertical-title-bar{align-items:center;display:flex;flex:none;padding:var(--ag-widget-container-vertical-padding) calc(var(--ag-spacing)*2) 0}.ag-column-drop-vertical-list{align-items:stretch;flex-direction:column;flex-grow:1;overflow-x:auto;padding-bottom:var(--ag-spacing);padding-left:var(--ag-spacing);padding-right:var(--ag-spacing);position:relative}:where(.ag-column-drop-empty) .ag-column-drop-vertical-list{overflow:hidden}.ag-column-drop-cell-button{cursor:pointer;min-width:0;opacity:.75}:where(.ag-ltr) .ag-column-drop-cell-button{margin-right:calc(var(--ag-spacing)/4)}:where(.ag-rtl) .ag-column-drop-cell-button{margin-left:calc(var(--ag-spacing)/4)}.ag-column-drop-cell-button:hover{opacity:1}:where(.ag-ltr) .ag-column-drop-cell-drag-handle{margin-left:calc(var(--ag-spacing)/4)}:where(.ag-rtl) .ag-column-drop-cell-drag-handle{margin-right:calc(var(--ag-spacing)/4)}.ag-column-drop-cell-drag-handle.ag-column-select-column-readonly{opacity:.5;pointer-events:none;:where(.ag-icon){opacity:.35}}.ag-column-drop-wrapper{display:flex}.ag-column-drop-horizontal-half-width{width:50%!important}.ag-column-drop-cell-ghost{opacity:.5}.ag-column-drop-horizontal{background-color:var(--ag-header-background-color);border-bottom:var(--ag-header-row-border);gap:var(--ag-cell-widget-spacing);height:var(--ag-header-height);overflow:auto hidden;scrollbar-width:var(--ag-scrollbar-width,thin);white-space:nowrap}:where(.ag-ltr) .ag-column-drop-horizontal{padding-left:var(--ag-cell-horizontal-padding)}:where(.ag-rtl) .ag-column-drop-horizontal{padding-right:var(--ag-cell-horizontal-padding)}.ag-column-drop-horizontal-list{gap:var(--ag-cell-widget-spacing)}.ag-column-drop-vertical-cell{margin-top:var(--ag-spacing)}:where(.ag-ltr) .ag-column-drop-vertical-icon{margin-right:var(--ag-widget-horizontal-spacing)}:where(.ag-rtl) .ag-column-drop-vertical-icon{margin-left:var(--ag-widget-horizontal-spacing)}.ag-select-agg-func-popup{background:var(--ag-background-color);border:solid var(--ag-border-width) var(--ag-border-color);border-radius:var(--ag-border-radius);box-shadow:var(--ag-dropdown-shadow);height:calc(var(--ag-spacing)*5*3.5);padding:0;position:absolute}.ag-select-agg-func-virtual-list-item{cursor:default}:where(.ag-ltr) .ag-select-agg-func-virtual-list-item{padding-left:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-select-agg-func-virtual-list-item{padding-right:calc(var(--ag-spacing)*2)}.ag-select-agg-func-virtual-list-item:hover{background-color:var(--ag-selected-row-background-color)}:where(.ag-ltr) .ag-column-drop-horizontal-half-width:where(:not(:last-child)){border-right:solid var(--ag-border-width) var(--ag-border-color)}:where(.ag-rtl) .ag-column-drop-horizontal-half-width:where(:not(:last-child)){border-left:solid var(--ag-border-width) var(--ag-border-color)}";function Gg(e,t,s){e==null||t==null||e.splice(s,0,...t)}var ZB={tag:"div",cls:"ag-unselectable",role:"presentation"},Og=class extends Wx{constructor(e,t){super(ZB),this.horizontal=e,this.eWrapperPanel=t,this.state="notDragging",this.guiDestroyFunctions=[],this.childPillComponents=[],this.resizeEnabled=!1,this.addElementClasses(this.getGui()),this.ePillDropList=Tn({tag:"div"}),this.addElementClasses(this.ePillDropList,"list"),this.registerCSS(qB)}toggleResizable(e){this.positionableFeature.setResizable(e?{bottom:!0}:!1),this.resizeEnabled=e}isSourceEventFromTarget(e){const{dropZoneTarget:t,dragSource:s}=e;return t.contains(s.eElement)}destroy(){this.destroyGui(),super.destroy()}destroyGui(){for(const e of this.guiDestroyFunctions)e();this.guiDestroyFunctions.length=0,this.childPillComponents.length=0,Lg(this.getGui()),Lg(this.ePillDropList)}init(e){this.params=e??{},this.createManagedBean(new $B(this.getFocusableElement(),{onTabKeyDown:this.onTabKeyDown.bind(this),handleKeyDown:this.onKeyDown.bind(this)})),this.setupDropTarget(),this.positionableFeature=new jB(this.getGui()),this.createManagedBean(this.positionableFeature),this.refreshGui(),this.addManagedElementListeners(this.getFocusableElement(),{focusin:this.onFocusIn.bind(this)})}onTabKeyDown(e){const t=OB(this.getFocusableElement(),null,!0),s=t.length;if(s===0)return;const{shiftKey:r}=e,i=kg(this.beans),n=i===t[0],o=i===BB(t);s===1||n&&r||o&&!r||t[r?0:s-1].focus({preventScroll:!0})}onFocusIn(e){if(this.getFocusableElement().contains(e.relatedTarget))return;const s=e.target;s&&_g(s)}onKeyDown(e){const{key:t}=e,{beans:s,horizontal:r,gos:i}=this,n=!r;let o=t===zs.DOWN,a=t===zs.UP;if(!n){const l=i.get("enableRtl");o=!l&&t===zs.RIGHT||l&&t===zs.LEFT,a=!l&&t===zs.LEFT||l&&t===zs.RIGHT}if(!(!o&&!a))if(e.preventDefault(),e.shiftKey)this.moveFocusedItem(a);else{const l=this.getFocusableElement(),c=Cl({beans:s,rootNode:l,backwards:a});c&&(c.focus(),_g(c))}}moveFocusedItem(e){const t=this.childPillComponents[this.getFocusedItem()];t&&this.moveItem(t,e)}getItemMoveIndex(e,t){const s=this.getExistingItems(),r=s.indexOf(e.getItem()),i=r+(t?-1:1),n=this.minimumAllowedNewInsertIndex();return e.isAlive()&&r>=n&&e.isMovable()&&i>=n&&i<s.length?i:null}moveItem(e,t){const s=this.getItemMoveIndex(e,t);s!==null&&(this.insertIndex=s,this.rearrangeItems([e.getItem()],!0),this.focusItemAtIndex(s))}addElementClasses(e,t){t=t?`-${t}`:"";const s=this.horizontal?"horizontal":"vertical";e.classList.add(`ag-column-drop${t}`,`ag-column-drop-${s}${t}`)}setupDropTarget(){this.dropTarget={getContainer:this.getGui.bind(this),getIconName:this.getIconName.bind(this),onDragging:this.onDragging.bind(this),onDragEnter:this.onDragEnter.bind(this),onDragLeave:this.onDragLeave.bind(this),onDragStop:this.onDragStop.bind(this),onDragCancel:this.onDragCancel.bind(this),isInterestedIn:this.isInterestedIn.bind(this)},this.beans.dragAndDrop?.addDropTarget(this.dropTarget)}minimumAllowedNewInsertIndex(){return 0}checkInsertIndex(e){const t=this.getNewInsertIndex(e);return t<0?!1:this.normalizeAndUpdateInsertIndex(this.insertIndex,t)}normalizeAndUpdateInsertIndex(e,t){const s=this.minimumAllowedNewInsertIndex(),r=Math.max(s,t),i=r!==e;return i&&(this.insertIndex=r),i}getNewInsertIndex(e){const t=e.event,s=this.horizontal?t.clientX:t.clientY,r=this.childPillComponents.map(n=>n.getGui().getBoundingClientRect()),i=r.findIndex(n=>this.horizontal?n.right>s&&n.left<s:n.top<s&&n.bottom>s);if(i===-1){const n=this.gos.get("enableRtl");return r.every(l=>s>(this.horizontal?l.right:l.bottom))?n&&this.horizontal?0:this.childPillComponents.length:r.every(l=>s<(this.horizontal?l.left:l.top))?n&&this.horizontal?this.childPillComponents.length:0:this.insertIndex}return this.insertIndex<=i?i+1:i}checkDragStartedBySelf(e){this.state==="notDragging"&&(this.state="rearrangeItems",this.potentialDndItems=this.getItems(e.dragSource.getDragItem()),this.refreshGui(),this.checkInsertIndex(e),this.refreshGui())}onDragging(e){this.checkDragStartedBySelf(e),this.checkInsertIndex(e)&&this.refreshGui()}handleDragEnterEnd(e){}onDragEnter(e){const t=this.getItems(e.dragSource.getDragItem());this.state="newItemsIn";const s=t.filter(i=>this.isItemDroppable(i,e)),r=s.every(i=>this.childPillComponents.map(n=>n.getItem()).indexOf(i)!==-1);if(s.length!==0){if(this.potentialDndItems=s,r){this.state="notDragging";return}this.handleDragEnterEnd(e),this.checkInsertIndex(e),this.refreshGui()}}isPotentialDndItems(){return!!this.potentialDndItems?.length}handleDragLeaveEnd(e){}onDragLeave(e){if(this.state==="rearrangeItems"){const t=this.getItems(e.dragSource.getDragItem());this.removeItems(t)}this.isPotentialDndItems()&&(this.handleDragLeaveEnd(e),this.potentialDndItems=[],this.refreshGui()),this.state="notDragging"}onDragCancel(e){this.isPotentialDndItems()&&(this.state==="newItemsIn"&&this.handleDragLeaveEnd(e),this.potentialDndItems=[],this.refreshGui()),this.state="notDragging"}onDragStop(){this.isPotentialDndItems()&&(this.state==="newItemsIn"?this.addItems(this.potentialDndItems):this.rearrangeItems(this.potentialDndItems),this.potentialDndItems=[],this.refreshGui()),this.state="notDragging"}removeItemsFromModel(e,t){this.updateItems(t)}removeItems(e){const t=this.getExistingItems().filter(s=>!e.includes(s));try{this.removeItemsFromModel(e,t)}finally{this.refreshGui()}}addItems(e){if(!e)return;const t=this.getExistingItems().slice(),s=e.filter(r=>t.indexOf(r)<0);Gg(t,s,this.insertIndex),this.updateItems(t),this.refreshGui()}addItem(e){this.insertIndex=this.getExistingItems().length,this.addItems([e])}rearrangeItems(e,t){let s;return t?s=this.getExistingItems().filter(r=>e.indexOf(r)===-1):s=this.getNonGhostItems().slice(),Gg(s,e,this.insertIndex),GB(s,this.getExistingItems())?!1:(this.updateItems(s),this.refreshGui(),!0)}refreshGui(){let e=0;this.horizontal||(e=this.ePillDropList.scrollTop);const t=this.resizeEnabled,s=this.getFocusedItem(),r=this.beans,i=NB();let n=null;if(i){const o=this.eWrapperPanel??r.eGridDiv;n=Cl({beans:r,rootNode:o})??Cl({beans:r,rootNode:o,backwards:!0})}this.toggleResizable(!1),this.destroyGui(),this.addIconAndTitleToGui(),this.addEmptyMessageToGui(),this.addItemsToGui(),e!==0&&(this.ePillDropList.scrollTop=e),t&&this.toggleResizable(t),i&&this.restoreFocus(s,n)}getFocusedItem(){const e=this.getGui(),t=kg(this.beans);return e.contains(t)?Array.from(e.querySelectorAll(".ag-column-drop-cell")).indexOf(t):-1}focusItemAtIndex(e){const t=this.getGui(),r=Array.from(t.querySelectorAll(".ag-column-drop-cell"))[e];r&&r.focus({preventScroll:!0})}restoreFocus(e,t){const s=this.getGui(),r=Array.from(s.querySelectorAll(".ag-column-drop-cell"));if(e===-1)return;r.length===0&&t?.focus();const i=Math.min(r.length-1,e),n=r[i];n&&n.focus()}focusList(e){const t=e?this.childPillComponents.length-1:0;this.restoreFocus(t,this.getFocusableElement())}getNonGhostItems(){const e=this.getExistingItems();return this.isPotentialDndItems()?e.filter(t=>!this.potentialDndItems.includes(t)):e}addItemsToGui(){const t=this.getNonGhostItems().map(s=>this.createItemComponent(s,!1));if(this.isPotentialDndItems()){const s=this.potentialDndItems.map(r=>this.createItemComponent(r,!0));this.insertIndex>=t.length?t.push(...s):t.splice(this.insertIndex,0,...s)}this.appendChild(this.ePillDropList),t.forEach((s,r)=>{r>0&&this.addArrow(this.ePillDropList),this.ePillDropList.appendChild(s.getGui())}),this.addAriaLabelsToComponents()}addAriaLabelsToComponents(){const{childPillComponents:e,ePillDropList:t}=this,s=e.length,r=s===0;zB(t,r?"presentation":"listbox"),HB(t,r?null:this.getAriaLabel());for(let i=0;i<s;i++){const o=e[i].getGui();UB(o,i+1),WB(o,s)}}createItemComponent(e,t){const s=this.createPillComponent(e,this.dropTarget,t,this.horizontal);return s.addEventListener("columnRemove",this.removeItems.bind(this,[e])),this.createBean(s),this.guiDestroyFunctions.push(()=>this.destroyBean(s)),t||this.childPillComponents.push(s),s}addIconAndTitleToGui(){const{title:e,icon:t}=this.params;if(!e||!t)return;const s=Tn({tag:"div"});if(VB(s,!0),this.addElementClasses(s,"title-bar"),this.addElementClasses(t,"icon"),this.toggleCss("ag-column-drop-empty",this.isExistingItemsEmpty()),s.appendChild(t),!this.horizontal){const r=Tn({tag:"span"});this.addElementClasses(r,"title"),r.textContent=e,s.appendChild(r)}this.appendChild(s)}isExistingItemsEmpty(){return this.getExistingItems().length===0}addEmptyMessageToGui(){const{emptyMessage:e}=this.params;if(!e||!this.isExistingItemsEmpty()||this.isPotentialDndItems())return;const t=Tn({tag:"span"});t.textContent=e,this.addElementClasses(t,"empty-message"),this.ePillDropList.appendChild(t)}addArrow(e){if(this.horizontal){const t=this.gos.get("enableRtl"),s=YB(t?"panelDelimiterRtl":"panelDelimiter",this.beans);this.addElementClasses(s,"cell-separator"),e.appendChild(s)}}};import{RefPlaceholder as XB}from"ag-stack";import{Component as JB,DragSourceType as QB,KeyCode as An,_addGridCommonParams as eV,_createElement as tV,_getHeaderTooltipComponentDefinition as sV,_resolveHeaderTooltipValue as rV,_resolvePivotSort as iV}from"ag-grid-community";import{RefPlaceholder as bl,_setAriaLabel as nV,_setDisplayed as oV}from"ag-stack";import{Component as aV,KeyCode as lV,TouchListener as cV,_createIconNoSpan as Ng}from"ag-grid-community";var uV={tag:"span",role:"option",children:[{tag:"span",ref:"eDragHandle",cls:"ag-drag-handle ag-column-drop-cell-drag-handle",role:"presentation"},{tag:"span",ref:"eText",cls:"ag-column-drop-cell-text",attrs:{"aria-hidden":"true"}},{tag:"span",ref:"eButton",cls:"ag-column-drop-cell-button",role:"presentation"}]},Bg=class extends Kx{constructor(e,t,s,r,i){super(),this.dragSourceDropTarget=e,this.ghost=t,this.horizontal=s,this.template=r,this.agComponents=i,this.eText=bl,this.eDragHandle=bl,this.eButton=bl}postConstruct(){this.setTemplate(this.template??uV,this.agComponents);const e=this.getGui(),{beans:t,eDragHandle:s,eText:r,eButton:i}=this;this.addElementClasses(e),this.addElementClasses(s,"drag-handle"),this.addElementClasses(r,"text"),this.addElementClasses(i,"button"),s.appendChild(Ng("columnDrag",t)),i.appendChild(Ng("cancel",t)),this.tooltipFeature=this.createOptionalManagedBean(t.tooltipSvc?.createTooltip({getGui:()=>this.getGui(),getTooltipComponentDefinition:()=>this.getTooltipComponentDefinition(),getTooltipValue:()=>this.getTooltip(),getLocation:()=>this.getTooltipLocation(),getAdditionalParams:()=>this.getTooltipParams()})),this.setupComponents(),!this.ghost&&this.isDraggable()&&this.addDragSource(),this.setupAria(),this.setupTooltip(),this.activateTabIndex(),this.refreshDraggable()}isDraggable(){return!0}refreshDraggable(){this.eDragHandle.classList.toggle("ag-column-select-column-readonly",!this.isDraggable())}setupAria(){const e=this.getLocaleTextFunc(),t=[this.getAriaDisplayName()];this.addAdditionalAriaInstructions(t,e),nV(this.getGui(),t.join(". "))}addAdditionalAriaInstructions(e,t){if(this.isRemovable()){const s=t("ariaDropZoneColumnComponentDescription","Press DELETE to remove");e.push(s)}}setupTooltip(){const e=()=>this.tooltipFeature?.refreshTooltip();e(),this.addManagedEventListeners({newColumnsLoaded:e})}getTooltipLocation(){return"UNKNOWN"}getTooltipParams(){return{}}getTooltipComponentDefinition(){}getDragSourceId(){}getDefaultIconName(){return"notAllowed"}addDragSource(){const{beans:{dragAndDrop:e},eDragHandle:t}=this,s=this.createGetDragItem(),r=this.getDefaultIconName(),i={type:this.getDragSourceType(),sourceId:this.getDragSourceId(),eElement:t,getDefaultIconName:()=>r,getDragItem:s,dragItemName:this.getDisplayName()};e?.addDragSource(i,!0),this.addDestroyFunc(()=>e?.removeDragSource(i))}setupComponents(){this.eText.textContent=this.getDisplayValue(),this.setupRemove(),this.ghost&&this.addCss("ag-column-drop-cell-ghost")}refreshDisplay(){this.eText.textContent=this.getDisplayValue(),this.setupAria(),this.tooltipFeature?.refreshTooltip()}isRemovable(){return!0}refreshRemove(){oV(this.eButton,this.isRemovable())}setupRemove(){this.refreshRemove();const e={type:"columnRemove"};this.addGuiEventListener("keydown",s=>this.onKeyDown(s)),this.addManagedElementListeners(this.eButton,{click:s=>{s.stopPropagation(),this.dispatchLocalEvent(e)}});const t=new cV(this.eButton);this.addManagedListeners(t,{tap:()=>this.dispatchLocalEvent(e)}),this.addDestroyFunc(t.destroy.bind(t))}onKeyDown(e){e.key===lV.DELETE&&this.isRemovable()&&(e.preventDefault(),this.dispatchLocalEvent({type:"columnRemove"}))}getDisplayValue(){return this.getDisplayName()}addElementClasses(e,t){t=t?`-${t}`:"";const s=this.horizontal?"horizontal":"vertical";e.classList.add(`ag-column-drop-cell${t}`,`ag-column-drop-${s}-cell${t}`)}destroy(){super.destroy(),this.dragSourceDropTarget=null}},dV=class extends Bg{constructor(e,t,s,r,i,n){super(t,s,i),this.column=e,this.dropZonePurpose=r,this.updateParams=n,this.eSortIndicator=XB,this.popupShowing=!1,this.deferApply=H(n)}postConstruct(){const{sortSvc:e,colNames:t}=this.beans;this.template={tag:"span",role:"option",children:[{tag:"span",ref:"eDragHandle",cls:"ag-drag-handle ag-column-drop-cell-drag-handle",role:"presentation"},{tag:"span",ref:"eText",cls:"ag-column-drop-cell-text",attrs:{"aria-hidden":"true"}},e?{tag:"ag-sort-indicator",ref:"eSortIndicator"}:void 0,{tag:"span",ref:"eButton",cls:"ag-column-drop-cell-button",role:"presentation"}]},e&&(this.agComponents=[e.SortIndicatorSelector]),this.displayName=t.getDisplayNameForColumn(this.column,"columnDrop"),super.postConstruct(),this.deferApply&&(this.eDragHandle.dataset.columnToolPanelDeferred=""),this.addManagedListeners(this.column,{headerNameChanged:()=>{this.displayName=t.getDisplayNameForColumn(this.column,"columnDrop"),this.refreshDisplay()}}),e&&(this.setupSort(),this.addManagedEventListeners({sortChanged:()=>{this.setupAria()}})),this.isGroupingZone()&&this.addManagedPropertyListener("groupLockGroupColumns",()=>{this.refreshRemove(),this.refreshDraggable(),this.setupAria()})}getItem(){return this.column}getDisplayName(){return this.displayName}getTooltip(){const e=this.column.colDef;return rV(e,eV(this.gos,{location:this.getTooltipLocation(),colDef:e,column:this.column,value:this.displayName,valueFormatted:this.displayName}))}getTooltipLocation(){switch(this.dropZonePurpose){case"rowGroup":return"rowGroupColumnsList";case"pivot":return"pivotColumnsList";case"aggregation":return"valueColumnsList"}}getTooltipParams(){return{colDef:this.column.colDef,column:this.column,valueFormatted:this.displayName}}getTooltipComponentDefinition(){return sV(this.column.colDef)}addAdditionalAriaInstructions(e,t){const s=this.gos.get("functionsReadOnly");if(this.isAggregationZone()&&!s){const o=t("ariaDropZoneColumnValueItemDescription","Press ENTER to change the aggregation type");e.push(o)}const r=this.column.isSortable(),i=r&&this.isGroupingZone()&&!this.gos.get("rowGroupPanelSuppressSort"),n=r&&this.isPivotZone()&&!this.gos.get("pivotPanelSuppressSort");if(i||n){const o=t("ariaDropZoneColumnGroupItemDescription","Press ENTER to sort");e.push(o)}super.addAdditionalAriaInstructions(e,t)}isMovable(){if(!this.isDraggable()||!this.column.primary)return!1;switch(this.dropZonePurpose){case"rowGroup":return this.column.isAllowRowGroup();case"pivot":return this.column.isAllowPivot();case"aggregation":return this.column.isAllowValue()}}isDraggable(){return this.isReadOnly()}isRemovable(){return this.isReadOnly()}isReadOnly(){return!this.isGroupingAndLocked()&&!this.gos.get("functionsReadOnly")}getAriaDisplayName(){const e=this.getLocaleTextFunc(),{name:t,aggFuncName:s}=this.getColumnAndAggFuncName(),r=e("ariaDropZoneColumnComponentAggFuncSeparator"," of "),i={asc:e("ariaDropZoneColumnComponentSortAscending","ascending"),desc:e("ariaDropZoneColumnComponentSortDescending","descending")},n=this.getCurrentSortDirection(this.column),o=this.gos.get("rowGroupPanelSuppressSort");return[s&&`${s}${r}`,t,this.isGroupingZone()&&!o&&n&&`, ${i[n]}`].filter(a=>!!a).join("")}getColumnAndAggFuncName(){const e=this.displayName;let t="";if(this.isAggregationZone()){const s=this.beans.columnStateUpdateStrategy.getColumnAggFunc(this.deferApply,this.column),r=typeof s=="string"?s:"agg";t=this.getLocaleTextFunc()(r,r)}return{name:e,aggFuncName:t}}setupSort(){this.column.isSortable()&&(this.isGroupingZone()?this.setupGroupSort():this.isPivotZone()&&this.setupPivotSort())}setupGroupSort(){this.gos.get("rowGroupPanelSuppressSort")||this.bindSort(this.getSortDefOverride.bind(this),(e,t)=>this.beans.columnStateUpdateStrategy.progressSortFromEvent(this.deferApply,e,t))}setupPivotSort(){this.gos.get("pivotPanelSuppressSort")||(this.bindSort(this.getPivotSortDefOverride.bind(this),e=>this.beans.columnStateUpdateStrategy.progressPivotSortFromEvent(this.deferApply,e)),this.addManagedEventListeners({gridColumnsChanged:()=>{this.eSortIndicator.refresh(),this.setupAria()}}))}bindSort(e,t){const{column:s,eSortIndicator:r}=this;r.setupSort(s,!0,e);const i=n=>{n.preventDefault(),t(s,n),this.column&&(r.refresh(),this.setupAria(),be(this.beans,this.updateParams))};this.addGuiEventListener("click",i),this.addGuiEventListener("keydown",n=>{n.key===An.ENTER&&i(n)})}getCurrentSortDirection(e){return this.beans.columnStateUpdateStrategy.getSortDef(this.deferApply,e)?.direction??null}getSortDefOverride(){if(this.deferApply)return this.beans.columnStateUpdateStrategy.getSortDef(this.deferApply,this.column)}getPivotSortDefOverride(){const e=this.beans,t=iV(e,e.columnStateUpdateStrategy.getPivotSort(this.deferApply,this.column));return t===null?null:{type:"default",direction:t}}getDefaultIconName(){return"hide"}createGetDragItem(){const{column:e}=this;return()=>{const t={};return t[e.getId()]=e.isVisible(),{columns:[e],visibleState:t}}}setupComponents(){super.setupComponents(),this.isAggregationZone()&&!this.gos.get("functionsReadOnly")&&this.addGuiEventListener("click",this.onShowAggFuncSelection.bind(this))}onKeyDown(e){super.onKeyDown(e),e.key===An.ENTER&&this.isAggregationZone()&&!this.gos.get("functionsReadOnly")&&(e.preventDefault(),this.onShowAggFuncSelection())}getDisplayValue(){const{name:e,aggFuncName:t}=this.getColumnAndAggFuncName();return this.isAggregationZone()?`${t}(${e})`:e}onShowAggFuncSelection(){if(this.popupShowing)return;this.popupShowing=!0;const{aggFuncSvc:e,popupSvc:t}=this.beans,s=new Gs({cssIdentifier:"select-agg-func"}),r=e.getFuncNames(this.column),i=this.getGui(),n=s.getGui();s.setModel({getRow:function(p){return r[p]},getRowCount:function(){return r.length}}),this.createBean(s);const o=tV({tag:"div",cls:"ag-select-agg-func-popup"});o.style.top="0px",o.style.left="0px",o.appendChild(n),o.style.width=`${i.clientWidth}px`;const[a]=this.addManagedElementListeners(o,{focusout:p=>{!o.contains(p.relatedTarget)&&u&&u.hideFunc()}}),l=p=>{this.destroyBean(s),this.popupShowing=!1,p?.key==="Escape"&&i.focus(),a&&a()},c=this.getLocaleTextFunc(),u=t.addPopup({modal:!0,eChild:o,closeOnEsc:!0,closedCallback:l,ariaLabel:c("ariaLabelAggregationFunction","Aggregation Function")});u&&s.setComponentCreator(this.createAggSelect.bind(this,u.hideFunc)),s.addGuiEventListener("keydown",p=>{if(p.key===An.ENTER||p.key===An.SPACE){const g=s.getLastFocusedRow();if(g==null)return;const f=s.getComponentAt(g);f&&f.selectItem()}}),t.positionPopupByComponent({type:"aggFuncSelect",eventSource:i,ePopup:o,keepWithinBounds:!0,additionalParams:{column:this.column},position:"under"}),s.refresh();const d=this.beans.columnStateUpdateStrategy.getColumnAggFunc(this.deferApply,this.column);let h=r.findIndex(p=>p===d);h===-1&&(h=0),s.focusRow(h)}createAggSelect(e,t){const s=()=>{e(),this.getGui().focus(),this.beans.columnStateUpdateStrategy.setColumnAggFunc(this.deferApply,this.column,t,"toolPanelDragAndDrop"),this.column&&this.refreshDisplay(),be(this.beans,this.updateParams)},r=this.getLocaleTextFunc(),i=(t||"").toString(),n=r(i,i);return new hV(s,n)}isGroupingAndLocked(){return this.isGroupingZone()&&Kr(this.column,this.beans,this.beans.columnStateUpdateStrategy.getRowGroupColumns(this.deferApply))}isAggregationZone(){return this.dropZonePurpose==="aggregation"}isGroupingZone(){return this.dropZonePurpose==="rowGroup"}isPivotZone(){return this.dropZonePurpose==="pivot"}getDragSourceType(){return QB.ToolPanel}destroy(){super.destroy(),this.column=null}},hV=class extends $x{constructor(e,t){super({tag:"div",cls:"ag-select-agg-func-item",children:t}),this.selectItem=e,this.addGuiEventListener("click",this.selectItem)}},Sl=class extends Og{constructor(e,t,s,r=!1){super(e,s?.eWrapperPanel),this.dropZonePurpose=t,this.updateParams=s,this.embedded=r,this.addElementClasses(this.getGui(),this.dropZonePurpose.toLowerCase())}init(e){super.init(e),this.addDestroyFunc(()=>this.hideMoveMenu?.()),this.addManagedEventListeners({newColumnsLoaded:this.refreshGui.bind(this)}),this.addManagedPropertyListeners(["functionsReadOnly","rowGroupPanelSuppressSort","groupLockGroupColumns","getColumnDropZoneMenuItems"],this.refreshGui.bind(this))}getItems(e){return e.columns??[]}isInterestedIn(e,t){return e===Dg.HeaderCell?!0:e!==Dg.ToolPanel?!1:this.horizontal?t.dataset.columnToolPanelDeferred===void 0:!0}minimumAllowedNewInsertIndex(){if(!this.isRowGroupPanel())return 0;const e=this.gos.get("groupLockGroupColumns"),t=this.getExistingItems().length;return e===-1?t:Math.min(e,t)}refreshGui(){this.hideMoveMenu?.(),super.refreshGui()}createItemComponent(e,t){const s=super.createItemComponent(e,t);return t||(this.getMenuConfig(s).menuItems.length&&s.getGui().setAttribute("aria-haspopup","menu"),s.addGuiEventListener("contextmenu",r=>this.showMoveMenu(s,r)),s.addGuiEventListener("keydown",r=>{gl(r)&&this.showMoveMenu(s,r)})),s}getMenuConfig(e){const{horizontal:t,gos:s}=this,r=e.getItem(),i=t&&s.get("enableRtl"),n=t?["Left","Right"]:["Up","Down"],o=new Map,a=e.isMovable();for(let d=0;a&&d<n.length;++d){const h=n[d],g=d===0!==i;o.set(`move${h}`,{direction:h,isPrevious:g})}const l=Array.from(o.keys()),u=(s.getCallback("getColumnDropZoneMenuItems")?.({column:r,source:this.dropZonePurpose,defaultItems:l})??l).filter(d=>typeof d!="string"||d===ue||o.has(d));return Wr(u,ue),{menuItems:u,moveItems:o}}showMoveMenu(e,t){this.hideMoveMenu?.();const{menuItems:s,moveItems:r}=this.getMenuConfig(e);if(!s.length)return;t.preventDefault(),t.stopPropagation();const i=this.getLocaleTextFunc(),n=e.getItem();this.hideMoveMenu=pg(this,this.beans,{menuItems:s.map(o=>{if(typeof o!="string"||o===ue)return o;const{direction:a,isPrevious:l}=r.get(o);return{name:i(o,`Move ${a}`),icon:kB(`menuMove${a}`,this.beans,n),disabled:this.getItemMoveIndex(e,l)===null,action:()=>{this.hideMoveMenu?.(),this.moveItem(e,l)}}}),menuContext:{column:n,columnGroup:null,node:null,value:null},positionBy:t instanceof MouseEvent?t:e.getGui(),restoreFocus:()=>{e.isAlive()&&e.getGui().focus({preventScroll:!0})},onClosed:()=>{this.hideMoveMenu=void 0}})}shouldToggleColumnVisibility(e,t){return this.isRowGroupPanel()&&_B(this.gos,t)&&!e.fromNudge}handleDragEnterEnd(e){if(this.shouldToggleColumnVisibility(e,!0)){const s=e.dragSource.getDragItem().columns;this.setColumnsVisible(s,!1,"uiColumnDragged")}}handleDragLeaveEnd(e){if(this.shouldToggleColumnVisibility(e,!1)){const t=e.dragSource.getDragItem();this.setColumnsVisible(t.columns,!0,"uiColumnDragged")}}setColumnsVisible(e,t,s){if(!e||H(this.updateParams))return;const r=e.filter(i=>!i.colDef.lockVisible);this.beans.columnStateUpdateStrategy.setColumnsVisible(!1,r,t,s)}isRowGroupPanel(){return this.dropZonePurpose==="rowGroup"}createPillComponent(e,t,s,r){return new dV(e,t,s,this.dropZonePurpose,r,this.updateParams)}},yl=class extends Sl{constructor(e,t,s=!1){super(e,"pivot",t,s)}postConstruct(){const e=this.getLocaleTextFunc(),t=e("pivotColumnsEmptyMessage","Drag here to set column labels"),s=e("pivots","Column Labels");super.init({icon:LB("pivotPanel",this.beans,null),emptyMessage:t,title:s}),this.horizontal&&!this.embedded&&DB(this.beans,this,this.getGui()),this.addManagedEventListeners({newColumnsLoaded:this.refresh.bind(this),columnPivotChanged:this.refresh.bind(this),columnPivotModeChanged:this.checkVisibility.bind(this)}),this.refresh()}getAriaLabel(){return this.getLocaleTextFunc()("ariaPivotDropZonePanelLabel","Column Labels")}refresh(){this.checkVisibility(),this.refreshGui()}checkVisibility(){const e=this.beans.colModel,t=e.pivotMode;if(this.horizontal)switch(this.gos.get("pivotPanelShow")){case"always":this.setDisplayed(t);break;case"onlyWhenPivoting":{const s=e.isPivotActive();this.setDisplayed(t&&s);break}default:this.setDisplayed(!1);break}else this.setDisplayed(this.beans.columnStateUpdateStrategy.getPivotMode(H(this.updateParams)))}isItemDroppable(e,t){if(this.gos.get("functionsReadOnly")||!e.primary)return!1;const s=this.beans.columnStateUpdateStrategy.getPivotColumns(H(this.updateParams)).includes(e);return e.isAllowPivot()&&(!s||this.isSourceEventFromTarget(t))}updateItems(e){this.beans.columnStateUpdateStrategy.setPivotColumns(H(this.updateParams),e,"toolPanelUi"),be(this.beans,this.updateParams)}removeItemsFromModel(e){this.beans.columnStateUpdateStrategy.removePivotColumns(H(this.updateParams),e,"toolPanelUi"),be(this.beans,this.updateParams)}getIconName(){return this.isPotentialDndItems()?"pivot":"notAllowed"}getExistingItems(){return this.beans.columnStateUpdateStrategy.getPivotColumns(H(this.updateParams))}getFocusableContainerName(){return"pivotToolbar"}};import{_addFocusableContainerListener as pV,_createIconNoSpan as gV}from"ag-grid-community";var wl=class extends Sl{constructor(e,t,s=!1){super(e,"rowGroup",t,s)}postConstruct(){const e=this.getLocaleTextFunc(),t=e("rowGroupColumnsEmptyMessage","Drag here to set row groups"),s=e("groups","Row Groups");super.init({icon:gV("rowGroupPanel",this.beans,null),emptyMessage:t,title:s}),this.horizontal&&!this.embedded&&pV(this.beans,this,this.getGui()),this.addManagedEventListeners({columnRowGroupChanged:this.refreshGui.bind(this)})}getAriaLabel(){return this.getLocaleTextFunc()("ariaRowGroupDropZonePanelLabel","Row Groups")}isItemDroppable(e,t){if(this.gos.get("functionsReadOnly")||!e.primary||e.showRowGroup)return!1;const s=this.beans.columnStateUpdateStrategy.getRowGroupColumns(H(this.updateParams)).includes(e);return e.isAllowRowGroup()&&(!s||this.isSourceEventFromTarget(t))}updateItems(e){this.beans.columnStateUpdateStrategy.setRowGroupColumns(H(this.updateParams),e,"toolPanelUi"),be(this.beans,this.updateParams)}removeItemsFromModel(e){this.beans.columnStateUpdateStrategy.removeRowGroupColumns(H(this.updateParams),e,"toolPanelUi"),be(this.beans,this.updateParams)}getIconName(){return this.isPotentialDndItems()?"group":"notAllowed"}getExistingItems(){return this.beans.columnStateUpdateStrategy.getRowGroupColumns(H(this.updateParams))}getFocusableContainerName(){return"rowGroupToolbar"}};import{_createIconNoSpan as fV}from"ag-grid-community";var mV=class extends Sl{constructor(e,t){super(e,"aggregation",t)}postConstruct(){const e=this.getLocaleTextFunc(),t=e("valueColumnsEmptyMessage","Drag here to aggregate"),s=e("values","Values");super.init({icon:fV("valuePanel",this.beans,null),emptyMessage:t,title:s}),this.addManagedEventListeners({columnValueChanged:this.refreshGui.bind(this)})}getAriaLabel(){return this.getLocaleTextFunc()("ariaValuesDropZonePanelLabel","Values")}getIconName(){return this.isPotentialDndItems()?"aggregate":"notAllowed"}isItemDroppable(e,t){if(this.gos.get("functionsReadOnly")||!e.primary)return!1;const s=this.beans.columnStateUpdateStrategy.getValueColumns(H(this.updateParams)).includes(e);return e.isAllowValue()&&(!s||this.isSourceEventFromTarget(t))}updateItems(e){this.beans.columnStateUpdateStrategy.setValueColumns(H(this.updateParams),e,"toolPanelUi"),be(this.beans,this.updateParams)}getExistingItems(){return this.beans.columnStateUpdateStrategy.getValueColumns(H(this.updateParams))}};import{RefPlaceholder as vV}from"ag-stack";import{AgToggleButtonSelector as CV,Component as bV}from"ag-grid-community";var SV={tag:"div",cls:"ag-pivot-mode-panel",children:[{tag:"ag-toggle-button",ref:"cbPivotMode",cls:"ag-pivot-mode-select"}]},yV=class extends jx{constructor(e,t){super(),this.params=e,this.onPivotModeValueChanged=t,this.cbPivotMode=vV}getCurrentPivotMode(){return this.beans.columnStateUpdateStrategy.getPivotMode(H(this.params))}syncFromGrid(){this.cbPivotMode.setValue(this.getCurrentPivotMode())}refreshEditStrategy(){this.syncFromGrid()}postConstruct(){const{columnStateUpdateStrategy:e,ctrlsSvc:t}=this.beans;this.setTemplate(SV,[CV]);const s=this.cbPivotMode;s.setValue(this.getCurrentPivotMode());const r=this.getLocaleTextFunc();s.setLabel(r("pivotMode","Pivot Mode"));const i=()=>{const o=!!s.getValue();e.setPivotMode(H(this.params),o,"toolPanelUi"),this.onPivotModeValueChanged?.()},n=()=>{s.setValue(this.getCurrentPivotMode()),t.getHeaderRowContainerCtrl()?.refresh()};this.addManagedListeners(s,{fieldValueChanged:i}),this.addManagedEventListeners({newColumnsLoaded:n,columnPivotModeChanged:n})}},wV=class extends Yx{constructor(){super(...arguments),this.beanName="colToolPanelFactory"}setPanelVisible(e,t,s){return e?e.setDisplayed(t):t&&(e=s()),e}createRowGroupPanel(e,t,s){return this.createPanel(e,t,new wl(!1,s))}createValuesPanel(e,t,s){return this.createPanel(e,t,new mV(!1,s))}createPivotPanel(e,t,s){return this.createPanel(e,t,new yl(!1,s))}createPivotModePanel(e,t,s,r,i){return this.createPanel(e,t,new yV(s,r),i)}createPanel(e,t,s,r){return s=e.createBean(s),t.push(()=>e.destroyBean(s)),r?e.prependChild(s):e.appendChild(s),s}};import{BeanStub as xV}from"ag-grid-community";import{_areEqual as Pn}from"ag-stack";import{BeanStub as FV,_applyColumnState as jr,_dispatchColumnChangedEvent as TV,_resolvePivotSort as Vg,_setColsVisible as AV,isColumnGroupAutoCol as PV,isSpecialCol as RV}from"ag-grid-community";var Hg=()=>{};function Ug(e,t){const s=new Set(t);return e.filter(r=>!s.has(r))}function MV(e,t,s,r,i){const n=e.map(a=>a.colId),o=new Set(s);for(const a of t)o.add(a.colId);for(const a of n)o.delete(a);return{colIds:n,removedColIds:o.size>0?Array.from(o):void 0,eventType:r,seq:i}}function zg(e,t){e?.setColumns(t.colIds,t.eventType),e?.removeColumns(t.removedColIds,t.eventType)}function Wg(e){return e==="desc"?null:e===null?"asc":"desc"}var IV=class extends qx{constructor(){super(...arguments),this.beanName="columnStateUpdateExecutionStrategy"}applyColumnState(e,t,s){this.getUpdateStrategy(e).applyColumnState(t,s)}commit(e){this.getUpdateStrategy(e).commit()}hasPendingChanges(e){return this.getUpdateStrategy(e).hasPendingChanges()}moveColumns(e,t,s,r){this.getUpdateStrategy(e).moveColumns(t,s,r)}reset(e){this.getUpdateStrategy(e).reset()}setColumnsVisible(e,t,s,r){this.getUpdateStrategy(e).setColumnsVisible(t,s,r)}isColumnVisibleInToolPanel(e,t){return this.getUpdateStrategy(e).isColumnVisibleInToolPanel(t)}setRowGroupColumns(e,t,s){this.getUpdateStrategy(e).setRowGroupColumns(t,s)}removeRowGroupColumns(e,t,s){this.getUpdateStrategy(e).removeRowGroupColumns(t,s)}getRowGroupColumns(e){return this.getUpdateStrategy(e).getRowGroupColumns()}getPrimaryColumns(e){return this.getUpdateStrategy(e).getPrimaryColumns()}hasDeferredColumnOrder(e){return this.getUpdateStrategy(e).hasDeferredColumnOrder()}setValueColumns(e,t,s){this.getUpdateStrategy(e).setValueColumns(t,s)}getValueColumns(e){return this.getUpdateStrategy(e).getValueColumns()}setColumnAggFunc(e,t,s,r){this.getUpdateStrategy(e).setColumnAggFunc(t,s,r)}getColumnAggFunc(e,t){return this.getUpdateStrategy(e).getColumnAggFunc(t)}setPivotColumns(e,t,s){this.getUpdateStrategy(e).setPivotColumns(t,s)}removePivotColumns(e,t,s){this.getUpdateStrategy(e).removePivotColumns(t,s)}getPivotColumns(e){return this.getUpdateStrategy(e).getPivotColumns()}setPivotMode(e,t,s){this.getUpdateStrategy(e).setPivotMode(t,s)}getPivotMode(e){return this.getUpdateStrategy(e).getPivotMode()}isColumnSelectedInPivotModeToolPanel(e,t){return this.getUpdateStrategy(e).isColumnSelectedInPivotModeToolPanel(t)}progressSortFromEvent(e,t,s){this.getUpdateStrategy(e).progressSortFromEvent(t,s)}getSortDef(e,t){return this.getUpdateStrategy(e).getSortDef(t)}progressPivotSortFromEvent(e,t){this.getUpdateStrategy(e).progressPivotSortFromEvent(t)}getPivotSort(e,t){return this.getUpdateStrategy(e).getPivotSort(t)}getUpdateStrategy(e){return e?this.getDeferredUpdateStrategy():this.getSyncUpdateStrategy()}getSyncUpdateStrategy(){return this.syncUpdateStrategy??(this.syncUpdateStrategy=new EV(this.beans))}getDeferredUpdateStrategy(){return this.deferredUpdateStrategy??(this.deferredUpdateStrategy=new DV(this.beans))}},EV=class{constructor(e){this.beans=e,this.lastPivotColIds=[],this.reset=Hg,this.commit=Hg,this.hasPendingChanges=()=>!1,this.hasDeferredColumnOrder=()=>!1}applyColumnState(e,t){e.length&&jr(this.beans,{state:e},t)}moveColumns(e,t,s){this.beans.colMoves?.moveColumns(e,t,s),kV(this.beans)}setColumnsVisible(e,t,s){AV(this.beans,e,t,s,!0)}setRowGroupColumns(e,t){this.beans.rowGroupColsSvc?.setColumns(e,t)}removeRowGroupColumns(e,t){this.beans.rowGroupColsSvc?.removeColumns(e,t)}getRowGroupColumns(){return this.beans.rowGroupColsSvc?.columns??[]}getPrimaryColumns(){return Tl(this.beans)}setValueColumns(e,t){this.beans.valueColsSvc?.setColumns(e,t)}getValueColumns(){return this.beans.valueColsSvc?.columns??[]}setColumnAggFunc(e,t,s){this.beans.valueColsSvc?.setColumnAggFunc(e,t,s)}getColumnAggFunc(e){return e.aggFunc}setPivotColumns(e,t){this.lastPivotColIds=e.map(s=>s.colId),this.beans.pivotColsSvc?.setColumns(e,t)}removePivotColumns(e,t){const s=this.beans.pivotColsSvc;s?.removeColumns(e,t),this.lastPivotColIds=s?.columns.map(r=>r.colId)??[]}getPivotColumns(){return this.beans.pivotColsSvc?.columns??[]}setPivotMode(e,t){const{gos:s,colModel:r,ctrlsSvc:i}=this.beans;if(e===r.pivotMode)return;const n=this.beans.pivotColsSvc?.columns.map(o=>o.colId)??[];if(n.length>0&&(this.lastPivotColIds=n),!e){const o=this.beans.colModel.colDefList;jr(this.beans,{state:o.map(a=>({colId:a.colId,pivot:!1,pivotIndex:null}))},t)}s.updateGridOptions({options:{pivotMode:e},source:t}),e&&this.lastPivotColIds.length>0&&this.beans.pivotColsSvc?.setColumns(this.lastPivotColIds,t),i.getHeaderRowContainerCtrl()?.refresh()}progressSortFromEvent(e,t){this.beans.sortSvc?.progressSortFromEvent(e,t)}isColumnVisibleInToolPanel(e){return e.isVisible()}isColumnSelectedInPivotModeToolPanel(e){return e.isAnyFunctionActive()}getPivotMode(){return this.beans.colModel.pivotMode}getSortDef(e){return e.getSortDef()}progressPivotSortFromEvent(e){e.pivotSort=Wg(Vg(this.beans,e.pivotSort)),TV(this.beans.eventSvc,"columnPivotChanged",[e],"uiColumnSorted")}getPivotSort(e){return e.pivotSort}},DV=class{constructor(e){this.beans=e,this.state={},this.sequence=0,this.lastPivotColIds=[]}reset(){this.sequence=0,this.state={}}hasPendingChanges(){const{state:e,beans:t}=this,{columnState:s,columnOrder:r,rowGroup:i,aggregation:n,pivot:o,pivotMode:a,sort:l,aggFuncs:c}=e,u=d=>(d??[]).map(h=>h.colId);if(s)for(const[d,h]of s.patches){const p=t.colModel.getNonPivotColById(d);if(p&&(h.hide!==void 0&&h.hide!==!p.visible||h.rowGroup!==void 0&&!!h.rowGroup!==p.rowGroupActive||h.pivot!==void 0&&!!h.pivot!==p.pivotActive||h.aggFunc!==void 0&&((h.aggFunc??null)!==(p.aggFunc??null)||h.aggFunc!=null!==p.isValueActive())))return!0}if(r&&!Pn(r.colIds,Fl(t))||i&&!Pn(i.colIds,u(t.rowGroupColsSvc?.columns))||n&&!Pn(n.colIds,u(t.valueColsSvc?.columns))||o&&!Pn(o.colIds,u(t.pivotColsSvc?.columns))||a&&a.pivotMode!==t.colModel.pivotMode)return!0;if(l){for(const[d,h]of l.sortDefsByColId){const p=t.colModel.getNonPivotColById(d);if(p&&(h?.direction??null)!==(p.getSortDef()?.direction??null))return!0}if(l.baselineCleared){const d=Tl(t);for(const h of d)if(!l.sortDefsByColId.has(h.colId)&&h.getSortDef()!==null)return!0}}if(c)for(const[d,h]of c.values){const p=t.colModel.getNonPivotColById(d);if(p&&h!==p.aggFunc)return!0}return!1}commit(){const{beans:e,state:t}=this,s=[];for(const l of Object.keys(t)){const c=t[l];c&&s.push({type:l,...c})}const r=s.sort((l,c)=>l.seq-c.seq),i=e.colModel;let n=!1,o;const a=()=>{try{i.endColUpdate()}catch(l){o=n?o:l,n=!0}};try{i.beginColUpdate();try{for(const l of r)LV(l)||(a(),i.beginColUpdate()),this.applyOperation(l)}finally{a()}}finally{this.reset()}if(n)throw o}applyOperation(e){const{beans:t}=this;switch(e.type){case"columnState":{jr(t,{state:[...e.patches.values()]},e.eventType);break}case"columnOrder":{const s=e.colIds.map(r=>t.colModel.getNonPivotColById(r)).filter(r=>!!r&&qr(r));if(!t.colModel.pivotMode){const r=t.colModel.colsList,i=Math.max(0,r.findIndex(qr));s.some((n,o)=>r[i+o]!==n)&&t.colMoves?.moveColumns(s,i,e.eventType,!0)}Kg(t,s);break}case"rowGroup":{zg(t.rowGroupColsSvc,e);break}case"aggregation":{t.valueColsSvc?.setColumns(e.colIds,e.eventType);break}case"pivot":{this.lastPivotColIds=e.colIds,zg(t.pivotColsSvc,e);break}case"pivotMode":{const{colModel:s,ctrlsSvc:r,gos:i}=t;if(e.pivotMode!==s.pivotMode){const n=t.pivotColsSvc?.columns.map(o=>o.colId)??[];if(n.length>0&&(this.lastPivotColIds=n),!e.pivotMode){const a=t.colModel.colDefList.map(l=>({colId:l.colId,pivot:!1,pivotIndex:null}));jr(t,{state:a},e.eventType)}if(i.updateGridOptions({options:{pivotMode:e.pivotMode},source:e.eventType}),e.pivotMode){const o=this.state.pivot?.colIds??this.lastPivotColIds;o.length>0&&t.pivotColsSvc?.setColumns(o,e.eventType)}r.getHeaderRowContainerCtrl()?.refresh()}break}case"sort":{const s=[];let r=0;for(const[i,n]of e.sortDefsByColId)s.push({colId:i,sort:n?.direction??null,sortIndex:n?.direction?r++:null,sortType:n?.type??void 0});jr(t,{state:s,defaultState:e.baselineCleared?{sort:null,sortIndex:null,sortType:void 0}:void 0},e.eventType);break}case"aggFuncs":{for(const[s,r]of e.values){const i=t.colModel.getNonPivotColById(s);i&&t.valueColsSvc?.setColumnAggFunc(i,r,e.eventType)}break}}}applyColumnState(e,t){for(const r of e)Rn(this.state,r);const s=Zr(this.state);s.seq=Mt(this.sequence),this.sequence=s.seq,s.eventType=t}moveColumns(e,t,s){const r=new Set(e.map(l=>l.colId)),n=(this.state.columnOrder?.colIds??Fl(this.beans)).filter(l=>!r.has(l)),o=e.map(l=>l.colId),a=Mt(this.sequence);this.sequence=a,this.state.columnOrder={colIds:[...n.slice(0,t),...o,...n.slice(t)],eventType:s,seq:a}}setColumnsVisible(e,t,s){for(const i of e)i.colDef.lockVisible||Rn(this.state,{colId:i.colId,hide:!t});const r=Zr(this.state);r.seq=Mt(this.sequence),this.sequence=r.seq,r.eventType=s}setRowGroupColumns(e,t){this.state.rowGroup=this.nextRoleDraft("rowGroup",e,[],t)}removeRowGroupColumns(e,t){this.state.rowGroup=this.nextRoleDraft("rowGroup",Ug(this.getRowGroupColumns(),e),e,t)}nextRoleDraft(e,t,s,r){$g(this.state,e);const i=Mt(this.sequence);return this.sequence=i,MV(t,s,this.state[e]?.removedColIds,r,i)}setValueColumns(e,t){$g(this.state,"aggFunc");const s=new Set((this.beans.valueColsSvc?.columns??[]).map(n=>n.colId)),r=jg(this.state);for(const n of e)if(!s.has(n.colId)&&!r.values.has(n.colId)){const a=n.aggFunc??this.beans.aggFuncSvc?.getDefaultAggFunc(n);a!=null&&r.values.set(n.colId,a)}const i=Mt(this.sequence);this.sequence=i,r.seq=i,r.eventType=t,this.state.aggregation={colIds:e.map(n=>n.colId),eventType:t,seq:i}}setColumnAggFunc(e,t,s){Rn(this.state,{colId:e.colId,aggFunc:t});const r=Zr(this.state);r.seq=Mt(this.sequence),this.sequence=r.seq,r.eventType=s;const i=jg(this.state);i.seq=r.seq,i.eventType=s,i.values.set(e.colId,t)}getColumnAggFunc(e){const t=e.colId;return this.state.aggFuncs?.values.has(t)?this.state.aggFuncs.values.get(t):e.aggFunc}isColumnVisibleInToolPanel(e){const t=this.state.columnState?.patches.get(e.colId);return t?.hide!==void 0?!t.hide:e.visible}isColumnSelectedInPivotModeToolPanel(e){const t=e.colId,s=this.state.columnState?.patches.get(t);let r;s?.rowGroup!==void 0?r=!!s.rowGroup:this.state.rowGroup?r=this.state.rowGroup.colIds.includes(t):r=e.rowGroupActive;let i;s?.pivot!==void 0?i=!!s.pivot:this.state.pivot?i=this.state.pivot.colIds.includes(t):i=e.pivotActive;let n;return s?.aggFunc!==void 0?n=s.aggFunc!=null:this.state.aggregation?n=this.state.aggregation.colIds.includes(t):n=e.isValueActive(),r||i||n}setPivotColumns(e,t){this.state.pivot=this.nextRoleDraft("pivot",e,[],t)}removePivotColumns(e,t){this.state.pivot=this.nextRoleDraft("pivot",Ug(this.getPivotColumns(),e),e,t)}setPivotMode(e,t){const s=Mt(this.sequence);this.sequence=s,this.state.pivotMode={pivotMode:e,eventType:t,seq:s}}getRowGroupColumns(){return Yr(this.beans,xl(this.state.rowGroup?.colIds,this.beans.rowGroupColsSvc?.columns,this.state.columnState?.patches,e=>e.rowGroup==null?void 0:!!e.rowGroup))}getPrimaryColumns(){return Yr(this.beans,this.state.columnOrder?.colIds??Fl(this.beans))}hasDeferredColumnOrder(){return!!this.state.columnOrder}getValueColumns(){return Yr(this.beans,xl(this.state.aggregation?.colIds,this.beans.valueColsSvc?.columns,this.state.columnState?.patches,e=>e.aggFunc===void 0?void 0:e.aggFunc!=null))}getPivotColumns(){if(!this.getPivotMode())return[];const e=this.beans.pivotColsSvc?.columns,t=e?.length?e:Yr(this.beans,this.lastPivotColIds);return Yr(this.beans,xl(this.state.pivot?.colIds,t,this.state.columnState?.patches,s=>s.pivot==null?void 0:!!s.pivot))}getPivotMode(){return this.state.pivotMode?.pivotMode??this.beans.colModel.pivotMode}getSortDef(e){const t=this.state.sort,s=e.colId,r=t?.sortDefsByColId;return r?.has(s)?r.get(s)??null:t?.baselineCleared?null:e.getSortDef()}progressPivotSortFromEvent(e){const t=Wg(Vg(this.beans,this.getPivotSort(e)));Rn(this.state,{colId:e.colId,pivotSort:t});const s=Zr(this.state);s.seq=Mt(this.sequence),this.sequence=s.seq,s.eventType="uiColumnSorted"}getPivotSort(e){const t=this.state.columnState?.patches.get(e.colId);return t?.pivotSort!==void 0?t.pivotSort:e.pivotSort}progressSortFromEvent(e,t){const s=this.state.sort??{sortDefsByColId:new Map,baselineCleared:!1,seq:0,eventType:"toolPanelUi"},{sortSvc:r}=this.beans,i=e.colId;let n;s.sortDefsByColId.has(i)?n=s.sortDefsByColId.get(i):s.baselineCleared?n=null:n=e.getSortDef();const o=r?.getNextSortDirection(e,n);if(!o)return;const{gos:a}=this.beans;((a.get("multiSortKey")==="ctrl"?t.ctrlKey||t.metaKey:t.shiftKey)||a.get("alwaysMultiSort"))&&!a.get("suppressMultiSort")||(s.sortDefsByColId.clear(),s.baselineCleared=!0),s.sortDefsByColId.set(i,o.direction?o:null),s.seq=Mt(this.sequence),this.sequence=s.seq,this.state.sort=s}};function LV(e){const t=e.type;return t==="rowGroup"||t==="aggregation"||t==="pivot"}function Yr(e,t){return t?t.map(s=>e.colModel.getNonPivotColById(s)).filter(s=>!!s):[]}function xl(e,t,s,r){const i=[...e??t?.map(o=>o.colId)??[]];if(!s?.size)return i;const n=new Set(i);for(const[o,a]of s){const l=r(a);if(l===void 0)continue;if(l){n.has(o)||(i.push(o),n.add(o));continue}if(!n.has(o))continue;n.delete(o);const c=i.indexOf(o);c>=0&&i.splice(c,1)}return i}function kV(e){const t=e.colModel.colsList.filter(s=>qr(s)).map(s=>e.colModel.getNonPivotCol(s.colId)).filter(s=>!!s);Kg(e,t)}function Kg(e,t){const s=e.colModel.colDefList;if(s.length===0)return;const r=new Set(t);e.colModel.replaceColDefList([...t,...s.filter(i=>qr(i)&&!r.has(i))])}function Fl(e){return Tl(e).map(t=>t.colId)}function Tl(e){return e.colModel.colDefList.filter(qr)}function qr(e){return e.primary?!PV(e)&&!RV(e):!1}function Mt(e){return e+1}function Rn(e,t){const s=Zr(e),r=s.patches.get(t.colId);s.patches.set(t.colId,r?{...r,...t}:t)}function $g(e,t){const s=e.columnState?.patches;if(s?.size)for(const[r,i]of s){if(!(t in i))continue;const n={...i};if(delete n[t],Object.keys(n).length===1){s.delete(r);continue}s.set(r,n)}}function Zr(e){let{columnState:t}=e;return t||(t={patches:new Map,seq:0,eventType:"toolPanelUi"},e.columnState=t),t}function jg(e){let{aggFuncs:t}=e;return t||(t={values:new Map,seq:0,eventType:"toolPanelUi"},e.aggFuncs=t),t}var _V=class extends Zx{constructor(){super(...arguments),this.beanName="columnStateUpdateStrategy"}applyColumnState(e,t,s){this.delegate("applyColumnState",e,t,s)}commit(e){this.delegate("commit",e)}hasPendingChanges(e){return this.delegate("hasPendingChanges",e)}moveColumns(e,t,s,r){this.delegate("moveColumns",e,t,s,r)}reset(e){this.delegate("reset",e)}setColumnsVisible(e,t,s,r){this.delegate("setColumnsVisible",e,t,s,r)}isColumnVisibleInToolPanel(e,t){return this.delegate("isColumnVisibleInToolPanel",e,t)}setRowGroupColumns(e,t,s){this.delegate("setRowGroupColumns",e,t,s)}removeRowGroupColumns(e,t,s){this.delegate("removeRowGroupColumns",e,t,s)}getRowGroupColumns(e){return this.delegate("getRowGroupColumns",e)}getPrimaryColumns(e){return this.delegate("getPrimaryColumns",e)}hasDeferredColumnOrder(e){return this.delegate("hasDeferredColumnOrder",e)}setValueColumns(e,t,s){this.delegate("setValueColumns",e,t,s)}getValueColumns(e){return this.delegate("getValueColumns",e)}setColumnAggFunc(e,t,s,r){this.delegate("setColumnAggFunc",e,t,s,r)}getColumnAggFunc(e,t){return this.delegate("getColumnAggFunc",e,t)}setPivotColumns(e,t,s){this.delegate("setPivotColumns",e,t,s)}removePivotColumns(e,t,s){this.delegate("removePivotColumns",e,t,s)}getPivotColumns(e){return this.delegate("getPivotColumns",e)}setPivotMode(e,t,s){this.delegate("setPivotMode",e,t,s)}getPivotMode(e){return this.delegate("getPivotMode",e)}isColumnSelectedInPivotModeToolPanel(e,t){return this.delegate("isColumnSelectedInPivotModeToolPanel",e,t)}progressSortFromEvent(e,t,s){this.delegate("progressSortFromEvent",e,t,s)}getSortDef(e,t){return this.delegate("getSortDef",e,t)}progressPivotSortFromEvent(e,t){this.delegate("progressPivotSortFromEvent",e,t)}getPivotSort(e,t){return this.delegate("getPivotSort",e,t)}getUpdateStrategy(){return this.executionStrategy??(this.executionStrategy=this.createManagedBean(new IV))}delegate(e,...t){const s=this.getUpdateStrategy();return s[e].bind(s)(...t)}},Al={moduleName:"SharedColumnStateUpdateStrategy",version:_,beans:[_V],dependsOn:[$]},Yg={moduleName:"ColumnsToolPanel",version:_,beans:[wV],userComponents:{agColumnsToolPanel:IB},icons:{menuMoveUp:"up",menuMoveDown:"down",ensureColumnVisible:"column-arrow",columnsToolPanel:"columns",menuAddRowGroup:"group",menuRemoveRowGroup:"group",pivotPanel:"pivot",rowGroupPanel:"group",valuePanel:"aggregation",columnSelectClosed:"tree-closed",columnSelectOpen:"tree-open",columnSelectIndeterminate:"tree-indeterminate"},dependsOn:[$,Al,Hr,B2,H2,V2,Ur]};import{_ColumnMoveModule as GV,_PopupModule as OV,_SharedDragAndDropModule as NV,_SharedMenuModule as BV}from"ag-grid-community";import{BeanStub as VV,_createIconNoSpan as qg}from"ag-grid-community";var HV=class extends Xx{constructor(){super(...arguments),this.beanName="chartMenuItemMapper"}getChartItems(e){const t=this.beans,s=t.chartSvc,r=e==="pivotChart";if(!s)return null;const i=this.getLocaleTextFunc.bind(this),n=r?new UV(t,s,i):new zV(t,s,i),o=s.isEnterprise();let a=n.getMenuItem();if(a?.subMenu&&!o){const c=u=>({...u,subMenu:u.subMenu?.filter(d=>!d._enterprise).map(d=>c(d))});a=c(a)}const l=this.gos.get("chartToolPanelsDef")?.settingsPanel?.chartGroupsDef;return l&&(a=this.filterAndOrderChartMenu(a,l,n.getConfigLookup())),this.cleanInternals(a)}cleanInternals(e){if(!e)return e;const t=s=>{delete s?._key,delete s?._enterprise;for(const r of s?.subMenu??[])t(r);return s};return t(e)}buildLookup(e){const t={},s=r=>{if(t[r._key]=r,r.subMenu)for(const i of r.subMenu)s(i)};return s(e),t}filterAndOrderChartMenu(e,t,s){const r=this.buildLookup(e),i={...e,subMenu:[]};for(const n of Object.keys(t)){const o=t[n],a=s[n];if(a===null)continue;if(a==null){this.warn(173,{group:n});continue}const l=r[a._key];if(l)if(l.subMenu){const c=o.map(u=>{const d=a[u];if(d==null){this.warn(174,{group:n,chartType:u});return}return r[d]}).filter(u=>u!==void 0);c.length>0&&(l.subMenu=c,i.subMenu?.push(l))}else i.subMenu?.push(l)}return i.subMenu?.length==0?null:i}},UV=class{constructor(e,t,s){this.beans=e,this.chartSvc=t,this.getLocaleTextFunc=s}getMenuItem(){const e=this.getLocaleTextFunc(),t=(s,r,i,n,o=!1)=>({name:e(s,r+"\u200E"),action:()=>this.chartSvc.createPivotChart({chartType:i}),_key:n,_enterprise:o});return{name:e("pivotChart","Pivot Chart"),_key:"pivotChart",subMenu:[{_key:"pivotColumnChart",name:e("columnChart","Column"),subMenu:[t("groupedColumn","Grouped","groupedColumn","pivotGroupedColumn"),t("stackedColumn","Stacked","stackedColumn","pivotStackedColumn"),t("normalizedColumn","100% Stacked","normalizedColumn","pivotNormalizedColumn")]},{_key:"pivotBarChart",name:e("barChart","Bar"),subMenu:[t("groupedBar","Grouped","groupedBar","pivotGroupedBar"),t("stackedBar","Stacked","stackedBar","pivotStackedBar"),t("normalizedBar","100% Stacked","normalizedBar","pivotNormalizedBar")]},{_key:"pivotPieChart",name:e("pieChart","Pie"),subMenu:[t("pie","Pie","pie","pivotPie"),t("donut","Donut","donut","pivotDonut")]},{_key:"pivotLineChart",name:e("lineChart","Line"),subMenu:[t("lineChart","Line","line","pivotLineChart"),t("stackedLine","Stacked","stackedLine","pivotStackedLine"),t("normalizedLine","100% Stacked","normalizedLine","pivotNormalizedLine")]},{_key:"pivotAreaChart",name:e("areaChart","Area"),subMenu:[t("areaChart","Area","area","pivotArea"),t("stackedArea","Stacked","stackedArea","pivotStackedArea"),t("normalizedArea","100% Stacked","normalizedArea","pivotNormalizedArea")]},{_key:"pivotXYChart",name:e("xyChart","X Y (Scatter)"),subMenu:[t("scatter","Scatter","scatter","pivotScatter"),t("bubble","Bubble","bubble","pivotBubble")]},{_key:"pivotStatisticalChart",_enterprise:!1,name:e("statisticalChart","Statistical"),subMenu:[t("histogramChart","Histogram","histogram","pivotHistogram",!1)]},{_key:"pivotHierarchicalChart",_enterprise:!0,name:e("hierarchicalChart","Hierarchical"),subMenu:[t("treemapChart","Treemap","treemap","pivotTreemap",!0),t("sunburstChart","Sunburst","sunburst","pivotSunburst",!0)]},{_key:"pivotFunnel",name:e("funnel","Funnel"),subMenu:[t("funnel","Funnel","funnel","pivotFunnel"),t("coneFunnel","Cone Funnel","coneFunnel","pivotConeFunnel"),t("pyramid","Pyramid","pyramid","pivotPyramid")]},{_key:"pivotCombinationChart",name:e("combinationChart","Combination"),subMenu:[t("columnLineCombo","Column & Line","columnLineCombo","pivotColumnLineCombo"),t("AreaColumnCombo","Area & Column","areaColumnCombo","pivotAreaColumnCombo")]}],icon:qg("chart",this.beans,void 0)}}getConfigLookup(){return{columnGroup:{_key:"pivotColumnChart",column:"pivotGroupedColumn",stackedColumn:"pivotStackedColumn",normalizedColumn:"pivotNormalizedColumn"},barGroup:{_key:"pivotBarChart",bar:"pivotGroupedBar",stackedBar:"pivotStackedBar",normalizedBar:"pivotNormalizedBar"},pieGroup:{_key:"pivotPieChart",pie:"pivotPie",donut:"pivotDonut",doughnut:"pivotDonut"},lineGroup:{_key:"pivotLineChart",line:"pivotLineChart",stackedLine:"pivotStackedLine",normalizedLine:"pivotNormalizedLine"},areaGroup:{_key:"pivotAreaChart",area:"pivotArea",stackedArea:"pivotStackedArea",normalizedArea:"pivotNormalizedArea"},scatterGroup:{_key:"pivotXYChart",bubble:"pivotBubble",scatter:"pivotScatter"},combinationGroup:{_key:"pivotCombinationChart",columnLineCombo:"pivotColumnLineCombo",areaColumnCombo:"pivotAreaColumnCombo",customCombo:null},hierarchicalGroup:{_key:"pivotHierarchicalChart",treemap:"pivotTreemap",sunburst:"pivotSunburst"},statisticalGroup:{_key:"pivotStatisticalChart",histogram:"pivotHistogram",rangeBar:null,rangeArea:null,boxPlot:null},funnelGroup:{_key:"pivotFunnel",funnel:"pivotFunnel",coneFunnel:"pivotConeFunnel",pyramid:"pivotPyramid"},polarGroup:null,specializedGroup:null}}},zV=class{constructor(e,t,s){this.beans=e,this.chartSvc=t,this.getLocaleTextFunc=s}getMenuItem(){const e=this.getLocaleTextFunc(),t=(s,r,i,n,o=!1)=>({name:e(s,r),action:()=>this.chartSvc.createChartFromCurrentRange(i),_key:n,_enterprise:o});return{name:e("chartRange","Chart Range"),_key:"chartRange",subMenu:[{name:e("columnChart","Column"),subMenu:[t("groupedColumn","Grouped","groupedColumn","rangeGroupedColumn"),t("stackedColumn","Stacked","stackedColumn","rangeStackedColumn"),t("normalizedColumn","100% Stacked","normalizedColumn","rangeNormalizedColumn")],_key:"rangeColumnChart"},{name:e("barChart","Bar"),subMenu:[t("groupedBar","Grouped","groupedBar","rangeGroupedBar"),t("stackedBar","Stacked","stackedBar","rangeStackedBar"),t("normalizedBar","100% Stacked","normalizedBar","rangeNormalizedBar")],_key:"rangeBarChart"},{name:e("pieChart","Pie"),subMenu:[t("pie","Pie","pie","rangePie"),t("donut","Donut","donut","rangeDonut")],_key:"rangePieChart"},{name:e("lineChart","Line"),subMenu:[t("lineChart","Line","line","rangeLineChart"),t("stackedLine","Stacked","stackedLine","rangeStackedLine"),t("normalizedLine","100% Stacked","normalizedLine","rangeNormalizedLine")],_key:"rangeLineChart"},{name:e("areaChart","Area"),subMenu:[t("areaChart","Area","area","rangeArea"),t("stackedArea","Stacked","stackedArea","rangeStackedArea"),t("normalizedArea","100% Stacked","normalizedArea","rangeNormalizedArea")],_key:"rangeAreaChart"},{name:e("xyChart","X Y (Scatter)"),subMenu:[t("scatter","Scatter","scatter","rangeScatter"),t("bubble","Bubble","bubble","rangeBubble")],_key:"rangeXYChart"},{name:e("polarChart","Polar"),subMenu:[t("radarLine","Radar Line","radarLine","rangeRadarLine"),t("radarArea","Radar Area","radarArea","rangeRadarArea"),t("nightingale","Nightingale","nightingale","rangeNightingale"),t("radialColumn","Radial Column","radialColumn","rangeRadialColumn"),t("radialBar","Radial Bar","radialBar","rangeRadialBar")],_key:"rangePolarChart",_enterprise:!0},{name:e("statisticalChart","Statistical"),subMenu:[t("boxPlot","Box Plot","boxPlot","rangeBoxPlot",!0),t("histogramChart","Histogram","histogram","rangeHistogram",!1),t("rangeBar","Range Bar","rangeBar","rangeRangeBar",!0),t("rangeArea","Range Area","rangeArea","rangeRangeArea",!0)],_key:"rangeStatisticalChart",_enterprise:!1},{name:e("hierarchicalChart","Hierarchical"),subMenu:[t("treemap","Treemap","treemap","rangeTreemap"),t("sunburst","Sunburst","sunburst","rangeSunburst")],_key:"rangeHierarchicalChart",_enterprise:!0},{name:e("specializedChart","Specialized"),subMenu:[t("heatmap","Heatmap","heatmap","rangeHeatmap"),t("waterfall","Waterfall","waterfall","rangeWaterfall")],_key:"rangeSpecializedChart",_enterprise:!0},{name:e("funnel","Funnel"),subMenu:[t("funnel","Funnel","funnel","rangeFunnel"),t("coneFunnel","Cone Funnel","coneFunnel","rangeConeFunnel"),t("pyramid","Pyramid","pyramid","rangePyramid")],_key:"rangeFunnel",_enterprise:!0},{name:e("combinationChart","Combination"),subMenu:[t("columnLineCombo","Column & Line","columnLineCombo","rangeColumnLineCombo"),t("AreaColumnCombo","Area & Column","areaColumnCombo","rangeAreaColumnCombo")],_key:"rangeCombinationChart"}],icon:qg("chart",this.beans,void 0)}}getConfigLookup(){return{columnGroup:{_key:"rangeColumnChart",column:"rangeGroupedColumn",stackedColumn:"rangeStackedColumn",normalizedColumn:"rangeNormalizedColumn"},barGroup:{_key:"rangeBarChart",bar:"rangeGroupedBar",stackedBar:"rangeStackedBar",normalizedBar:"rangeNormalizedBar"},pieGroup:{_key:"rangePieChart",pie:"rangePie",donut:"rangeDonut",doughnut:"rangeDonut"},lineGroup:{_key:"rangeLineChart",line:"rangeLineChart",stackedLine:"rangeStackedLine",normalizedLine:"rangeNormalizedLine"},areaGroup:{_key:"rangeAreaChart",area:"rangeArea",stackedArea:"rangeStackedArea",normalizedArea:"rangeNormalizedArea"},scatterGroup:{_key:"rangeXYChart",bubble:"rangeBubble",scatter:"rangeScatter"},polarGroup:{_key:"rangePolarChart",radarLine:"rangeRadarLine",radarArea:"rangeRadarArea",nightingale:"rangeNightingale",radialColumn:"rangeRadialColumn",radialBar:"rangeRadialBar"},statisticalGroup:{_key:"rangeStatisticalChart",boxPlot:"rangeBoxPlot",histogram:"rangeHistogram",rangeBar:"rangeRangeBar",rangeArea:"rangeRangeArea"},hierarchicalGroup:{_key:"rangeHierarchicalChart",treemap:"rangeTreemap",sunburst:"rangeSunburst"},specializedGroup:{_key:"rangeSpecializedChart",heatmap:"rangeHeatmap",waterfall:"rangeWaterfall"},funnelGroup:{_key:"rangeFunnel",funnel:"rangeFunnel",coneFunnel:"rangeConeFunnel",pyramid:"rangePyramid"},combinationGroup:{_key:"rangeCombinationChart",columnLineCombo:"rangeColumnLineCombo",areaColumnCombo:"rangeAreaColumnCombo",customCombo:null}}}};import{_findNextFocusableElement as WV,_getDeepActiveElement as KV}from"ag-stack";import{BeanStub as $V,_addGridCommonParams as jV}from"ag-grid-community";var YV=class extends Jx{constructor(){super(...arguments),this.beanName="colChooserFactory"}createColumnSelectPanel(e,t,s,r){const i=e.createManagedBean(new Eg),n=r??t?.colDef.columnChooserParams??{},{columnLabelRenderer:o,columnLabelRendererParams:a,columnLabelRendererSelector:l,contractColumnSelection:c,suppressColumnExpandAll:u,suppressColumnFilter:d,suppressColumnSelectAll:h,suppressSyncLayoutWithGrid:p,columnLayout:g}=n;return i.init(!!s,jV(this.gos,{suppressColumnMove:!1,suppressValues:!1,suppressPivots:!1,suppressRowGroups:!1,suppressPivotMode:!1,contractColumnSelection:!!c,suppressColumnExpandAll:!!u,suppressColumnFilter:!!d,suppressColumnSelectAll:!!h,suppressSyncLayoutWithGrid:!!g||!!p,columnLabelRenderer:o,columnLabelRendererParams:a,columnLabelRendererSelector:l,onStateUpdated:()=>{}}),"columnMenu","columnChooser"),g&&i.setColumnLayout(g),i}showColumnChooser({column:e,chooserParams:t,eventSource:s,headerPosition:r}){this.hideActiveColumnChooser();const i=this.createColumnSelectPanel(this,e,!0,t),n=this.getLocaleTextFunc(),o=this.beans,{focusSvc:a,menuUtils:l}=o,c=KV(o),u=s??(c instanceof HTMLElement?c:void 0),d=e??void 0,h=e?.allColsIndex??-1,p=e?a.focusedHeader??r??null:null;this.activeColumnChooserDialog=this.createBean(new ms({title:n("chooseColumns","Choose Columns"),component:i,width:300,height:300,resizable:!0,movable:!0,centered:!0,closable:!0,afterGuiAttached:()=>{WV({beans:o,rootNode:i.getGui()})?.focus({preventScroll:!0}),this.dispatchVisibleChangedEvent(!0,e)},closedCallback:g=>{const f=this.activeColumnChooser.getGui();this.destroyBean(this.activeColumnChooser),this.activeColumnChooser=void 0,this.activeColumnChooserDialog=void 0,this.dispatchVisibleChangedEvent(!1,e),(d||u)&&l.restoreFocusOnClose({column:d,headerPosition:p,columnIndex:h,getEventSource:u?()=>u:void 0},f,g,!0)},postProcessPopupParams:{type:"columnChooser",column:e,eventSource:u}})),this.activeColumnChooser=i}hideActiveColumnChooser(){this.activeColumnChooserDialog=this.destroyBean(this.activeColumnChooserDialog)}destroy(){this.hideActiveColumnChooser(),super.destroy()}dispatchVisibleChangedEvent(e,t){this.eventSvc.dispatchEvent({type:"columnMenuVisibleChanged",visible:e,switchingTab:!1,key:"columnChooser",column:t??null})}};import{BeanStub as qV,_getDisplaySortForColumn as ZV,_getGrandTotalRow as XV,_isClientSideRowModel as JV,_isLegacyMenuEnabled as QV,_isSortTypeAvailable as Zg}from"ag-grid-community";import{_createIconNoSpan as e3,_getDomData as t3}from"ag-grid-community";var Xg=(e,t)=>{const s=t?.closest(".ag-header-cell, .ag-header-group-cell");return s?t3(e.gos,s,"headerCtrl"):void 0},s3=(e,t,s,r,i,n,o)=>{const{colMoves:a,gos:l,focusSvc:c,ctrlsSvc:u}=e,d=Xg(e,r),h=d?.column;if(!a||!d||!h||!t&&!s)return null;const p=d.rowCtrl.rowIndex,g=n==="moveLeft"!==l.get("enableRtl"),f=()=>{const C=h.isColumn?[h]:h.getLeafColumns(),b=e.colModel.colsList.filter(x=>x.pinned===C[0]?.pinned),y=b.flatMap((x,P)=>C.includes(x)?[P]:[]);if(!y.length)return null;let S=y[0],w=y[y.length-1];const F=h.isColumn?C:h.getProvidedColumnGroup().getLeafColumns();if(!h.isColumn){for(;S>0&&F.includes(b[S-1]);)S--;for(;w+1<b.length&&F.includes(b[w+1]);)w++}return{columns:b.slice(S,w+1).filter(x=>F.includes(x)),order:b,first:S,last:w}},m=f();if(!m||a.isMovingSuppressed(m.columns))return null;const v=()=>{const C=f();if(!C)return null;const{columns:b,order:y,first:S,last:w}=C,F=g?-1:1,T=g?S:w;let x=!1;for(let P=T+F;P>=0&&P<y.length;P+=F){if(x||(x=y[P].displayed),!x)continue;const L=a.getColumnMoveTarget(b,[y[P]],g);if(L)return L}return null};return{name:o(n,n==="moveLeft"?"Move Left":"Move Right"),icon:e3(n==="moveLeft"?"menuMoveLeft":"menuMoveRight",e,t),disabled:!v(),action:()=>{const C=v();if(!C)return;a.moveColumns(C.columns,C.toIndex,i);const b=C.columns.find(S=>S.isVisible());if(!b)return;u.getScrollFeature().ensureColumnVisible(b,"auto");let y=b;if(!h.isColumn){let S=b.parent;for(;S&&S.getGroupId()!==h.getGroupId();)S=S.parent;y=S??b}c.focusHeaderPosition({headerPosition:{headerRowIndex:p,column:y}})}}},r3=class extends Qx{constructor(){super(...arguments),this.beanName="colMenuFactory"}createMenu(e,t,s,r,i,n){const o=e.createManagedBean(new xn(0,{column:s??null,columnGroup:i??null,node:null,value:null},n)),a=this.beans.menuItemMapper.mapWithStockItems(t,s??null,null,void 0,r,"columnMenu",i??null);return o.addMenuItems(a),o}getMenuItems(e=null,t=null,s){const r=this.getDefaultMenuOptions(e,t,s),i=[...wg(this.gos,e,t,"columnMenu",r)];return Wr(i,ue),i}getDefaultMenuOptions(e,t=null,s){const r=[],{beans:i,gos:n}=this,{colChooserFactory:o,rowGroupColsSvc:a,colModel:l,expansionSvc:c,sortSvc:u,menuSvc:d,pinnedCols:h,aggFuncSvc:p,colAutosize:g}=i,f=QV(n),m=()=>{const x=Xg(i,s)?.column,P=x&&!x.isColumn?x:t,L=e?[e]:P?.getLeafColumns();L&&i.colMoves&&!i.colMoves.isMovingSuppressed(L)&&r.push("moveLeft","moveRight",ue),!f&&o&&r.push("columnChooser"),r.push("resetColumns")};if(!e)return t&&i.colHeaderEditSvc?.isEditable(t)&&r.push("editColumnName",ue),m(),r;const{colDef:v}=e,C=h&&!v.lockPinned,b=a?.columns.length??0,y=b>0,S=XV(n),w=n.get("treeData"),F=e.primary,T=!F||p&&e.isAllowValue()&&(y||S||w);if(u&&!f&&e.isSortable()){const{isAbsoluteSort:x,isDefaultSort:P,isAscending:L,isDescending:G,direction:O}=ZV(e,i);Zg(n,e,"default")&&(L&&P||r.push("sortAscending"),G&&P||r.push("sortDescending")),Zg(n,e,"absolute")&&(L&&x||r.push("sortAbsoluteAscending"),G&&x||r.push("sortAbsoluteDescending")),O&&r.push("sortUnSort"),r.push(ue)}if(d?.isFilterMenuItemEnabled(e)&&r.push("columnFilter",ue),C&&r.push("pinSubMenu"),T&&r.push("valueAggSubMenu"),i.showValuesAsSvc?.isMenuEligible(e)&&r.push("showValuesAsSubMenu"),i.calculatedColsSvc?.isEnabled()===!0&&F&&(r.push(ue),l.pivotMode||r.push("calculatedColumn"),e?.isCalculatedCol&&r.push("editCalculatedColumn","removeCalculatedColumn"),r.push(ue)),e&&i.colHeaderEditSvc?.isEditable(e)&&r.push(ue,"editColumnName",ue),(C||T)&&r.push(ue),g&&(v.suppressAutoSize||r.push("autoSizeThis"),r.push("autoSizeAll",ue)),a&&n.isModuleRegistered("SharedRowGrouping")){const x=r.length;v.showRowGroup?r.push("rowUnGroup"):e.isAllowRowGroup()&&F&&(e.isRowGroupActive()?Kr(e,i)||r.push("rowUnGroup"):r.push("rowGroup")),r.length>x&&r.push(ue)}return m(),c&&(JV(n)||n.get("ssrmExpandAllAffectsAllRows"))&&(w||b>(l.pivotMode?1:0))&&r.push("expandAll","contractAll"),r}};import{_exists as Mn,_isPromise as i3}from"ag-stack";import{BeanStub as n3,_addGridCommonParams as o3,_attemptToRestoreCellFocus as a3,_getGrandTotalRow as l3,isRowNumberCol as c3}from"ag-grid-community";var Jg="ag-context-menu-open",u3=new Set(["cut","copy","copyWithHeaders","copyWithGroupHeaders","paste"]),Qg=e=>e.flatMap(t=>{if(typeof t=="string")return u3.has(t)?[]:[t];const{subMenu:s,...r}=t;if(!Array.isArray(s))return[t];const i=Qg(s);return i.length===s.length||i.some(n=>n!=="separator")?[{...t,subMenu:i}]:r.action||r.menuItem?[r]:[]}),d3=class extends e0{constructor(){super(...arguments),this.beanName="contextMenuSvc",this.focusedCell=null}postConstruct(){this.menu=this.createManagedBean(new wh({menuItemCallbacks:pl,getMenuItems:this.getMenuItems.bind(this),mapMenuItems:this.mapWithStockItems.bind(this),beforeMenuOpen:this.beforeMenuOpen.bind(this),onMenuOpen:this.onMenuOpen.bind(this),onMenuClose:this.onMenuClose.bind(this),afterMenuDestroyed:this.afterMenuDestroyed.bind(this),onVisibleChanged:this.dispatchVisibleChangedEvent.bind(this),shouldBlockMenuOpen:()=>!!this.beans.overlays?.exclusive}))}hideActiveMenu(){this.menu.hideActiveMenu()}getMenuItems(e,t){const{column:s,node:r,value:i}=e,n=[],{clipboardSvc:o,chartSvc:a,csvCreator:l,excelCreator:c,colModel:u,rangeSvc:d,gos:h,notesSvc:p,pdfCreator:g}=this.beans,f=!!s?.isCalculatedCol,m=!!s&&c3(s),v=m&&!o?.copiesRangeOrSelectedRows();if(Mn(r)&&o&&s&&!v&&(h.get("suppressCutToClipboard")||n.push("cut"),n.push("copy","copyWithHeaders","copyWithGroupHeaders","paste","separator")),Mn(r)&&f&&n.push("separator","removeCalculatedColumn","separator"),Mn(r)&&s&&p?.hasDataSource()&&n.push("note"),h.get("enableCharts")&&a&&(u.pivotMode&&n.push("pivotChart"),d&&!d.isEmpty()&&n.push("chartRange")),Mn(r)){const F=h.get("enableRowPinning"),T=h.get("isRowPinnable");if(F){const O=r.level>-1&&r.footer,z=r.level===-1&&r.footer,B=l3(h);(z&&!(B==="pinnedBottom"||B==="pinnedTop")||!z&&!O)&&(T?.(r)??!0)&&n.push("pinRowSubMenu")}const x=h.get("suppressExcelExport")||!c,P=h.get("suppressCsvExport")||!l,L=h.get("suppressPdfExport")||!g;(!x||!P||!L)&&n.push("export")}const C=n.length?n:void 0,b=s?.getColDef().contextMenuItems;if(Array.isArray(b))return b;if(typeof b=="function")return b(o3(h,{column:s,node:r,value:i,defaultItems:C,event:t}));const S=h.getCallback("getContextMenuItems")?.({column:s,node:r,value:i,defaultItems:C,event:t});if(!m)return S??n;const w=F=>o?.copiesRangeOrSelectedRows()?F:Qg(F);return S?i3(S)?S.then(w):w(S):w(n)}getContextMenuPosition(e,t){const s=this.getRowCtrl(e),r=this.getCellGui(s,t);if(!r)return{x:0,y:s?.getRowYPosition()??0};const i=r.getBoundingClientRect();return{x:i.x+i.width/2,y:i.y+i.height/2}}showContextMenu(e){const t=e.rowNode??null,s=e.column??null;let{anchorToElement:r,value:i,source:n,noteParams:o}=e;t&&s&&i==null&&(i=this.beans.valueSvc.getDisplayValue(s,t,"edit",!1)),r??(r=this.getContextMenuAnchorElement(t,s)),this.beans.menuUtils.onContextMenu({mouseEvent:e.mouseEvent??null,touchEvent:e.touchEvent??null,showMenuCallback:a=>this.menu.showMenu({node:t,column:s,columnGroup:null,value:i,noteParams:o},a,r),source:n})}handleContextMenuMouseEvent(e,t,s,r){const i=s?.findInfoForEvent(e??t),n=r?.rowNode??s?.rowNode??null,o=r?.column??i?.column??(s?.isFullWidth()?s.getNavigationColumn():null),a=r?{rowNode:r.rowNode,column:r.column}:s&&i?{rowNode:s.rowNode,location:"fullWidthRow",pinned:i.pinned==="left"||i.pinned==="right"?i.pinned:void 0}:void 0,{valueSvc:l,ctrlsSvc:c}=this.beans,u=o?l.getValue(o,n,"edit"):null,d=c.getGridBodyCtrl(),h=r?r.eGui:d.eGridBody;this.showContextMenu({mouseEvent:e,touchEvent:t,rowNode:n,column:o,value:u,anchorToElement:h,noteParams:a,source:"ui"})}beforeMenuOpen(e){e.column||this.beans.focusSvc.clearFocusedCell()}onMenuOpen(){const{ctrlsSvc:e,focusSvc:t}=this.beans;e.getGridBodyCtrl().eGridBody.classList.add(Jg),this.focusedCell=t.getFocusedCell()}onMenuClose(){this.beans.ctrlsSvc.getGridBodyCtrl().eGridBody.classList.remove(Jg)}afterMenuDestroyed(){const{beans:e,focusedCell:t}=this;a3(e,t)}dispatchVisibleChangedEvent(e,t){this.eventSvc.dispatchEvent({type:"contextMenuVisibleChanged",visible:e,source:t})}getRowCtrl(e){const{rowIndex:t,rowPinned:s}=e??{};if(t!=null)return this.beans.rowRenderer.getRowByPosition({rowIndex:t,rowPinned:s})??void 0}getCellGui(e,t){return!e||!t?void 0:e.getCellCtrl(t)?.eGui??void 0}getContextMenuAnchorElement(e,t){const s=this.beans.ctrlsSvc.getGridBodyCtrl().eGridBody,r=this.getRowCtrl(e);if(!r)return s;const i=this.getCellGui(r,t);return i||(r.isFullWidth()?r.getRowContentElement():s)}mapWithStockItems(e,t,s){const{column:r,node:i}=t;return this.beans.menuItemMapper.mapWithStockItems(e,r,i,t.noteParams,s,"contextMenu")}};import{RefPlaceholder as h3}from"ag-stack";import{AgPromise as Pl,BeanStub as p3,Component as g3,FilterComp as f3,_createElement as m3,_createIconNoSpan as Rl,_isColumnMenuAnchoringEnabled as v3,_isLegacyMenuEnabled as In,_setColMenuVisible as ef}from"ag-grid-community";var $t="filterMenuTab",jt="generalMenuTab",Cs="columnsMenuTab",En=[jt,$t,Cs],C3=class extends Sd{constructor(){super(...arguments),this.beanName="enterpriseMenuFactory"}hideActiveMenu(){this.destroyBean(this.activeMenu)}showMenuAfterMouseEvent(e,t,s,r,i,n){const{column:o,columnGroup:a}=this.splitColumnOrGroup(e),l=i?"filterMenuTab":void 0;this.showMenu(o,a,c=>{const u=c.getGui();this.beans.popupSvc.positionPopupUnderMouseEvent({type:s,additionalParams:{column:o},mouseEvent:t,ePopup:u}),l&&c.showTab?.(l),this.dispatchVisibleChangedEvent(!0,!1,o,a,l)},s,l,void 0,t.target,r,void 0,n)}splitColumnOrGroup(e){if(e?.isColumn)return{column:e,columnGroup:void 0};let t=e??null;for(;t?.isPadding();)t=t.originalParent;return{column:void 0,columnGroup:t??void 0}}showMenuAfterButtonClick(e,t,s,r,i){let n=-1,o="left";this.gos.get("enableRtl")&&(n=1,o="right");const a=i?.filtersOnly?"filterMenuTab":void 0,l=a?[a]:void 0,c=In(this.gos),u=(c?9:4)*n,d=c?-23:4,{column:h,columnGroup:p}=this.splitColumnOrGroup(e);return this.showMenu(h,p,g=>{const f=g.getGui();this.beans.popupSvc.positionPopupByComponent({type:s,additionalParams:{column:h},eventSource:t,ePopup:f,alignSide:o,nudgeX:u,nudgeY:d,position:"under",keepWithinBounds:!0}),a&&g.showTab?.(a),this.dispatchVisibleChangedEvent(!0,!1,h,p,a)},s,a,l,t,r,i?.suppressCloseOnEventSource,i?.getEventSource)}showMenu(e,t,s,r,i,n,o,a,l,c){const u=c??(o?()=>o:void 0),d=this.getMenuParams(e,t,n,o,u);if(!d)return!1;const{menu:h,eMenuGui:p,restoreFocusParams:g}=d,f=[],{menuUtils:m,popupSvc:v}=this.beans;f.push(b=>{const y=h.getGui();this.destroyBean(h),e&&ef(e,!1,"contextMenu"),(e||t)&&m.restoreFocusOnClose(g,y,b),a?.(b)});const C=this.getLocaleTextFunc();if(v.addPopup({modal:!0,eChild:p,closeOnEsc:!0,closedCallback:b=>{for(const y of f)y(b);this.dispatchVisibleChangedEvent(!1,!1,e,t,i)},afterGuiAttached:b=>h.afterGuiAttached({...b,container:r}),positionCallback:i?()=>s(h):void 0,eventSourceToIgnore:l?u:void 0,ariaLabel:C("ariaLabelColumnMenu","Column Menu")}),i||(h.showTabBasedOnPreviousSelection?.(),s(h)),v3(this.gos)){const b=v.setPopupPositionRelatedToElement(p,u??this.beans.ctrlsSvc.getGridBodyCtrl().eGridBody);b&&e&&this.addStopAnchoring(b,e,f)}return h.addEventListener("tabSelected",b=>{this.dispatchVisibleChangedEvent(!1,!0,e),this.lastSelectedTab=b.key,this.dispatchVisibleChangedEvent(!0,!0,e)}),e&&ef(e,!0,"contextMenu"),this.activeMenu=h,h.addEventListener("destroyed",()=>{this.activeMenu===h&&(this.activeMenu=null)}),!0}addStopAnchoring(e,t,s){e.then(r=>{t.__addEventListener("leftChanged",r),t.__addEventListener("visibleChanged",r),s.push(()=>{t.__removeEventListener("leftChanged",r),t.__removeEventListener("visibleChanged",r)})})}getMenuParams(e,t,s,r,i){const n=this.beans.focusSvc,o={column:e,headerPosition:n.focusedHeader,columnIndex:e?.allColsIndex??-1,getEventSource:i},a=this.createMenu(e,t,o,s,r);return a?{menu:a,eMenuGui:a.getGui(),restoreFocusParams:o}:void 0}createMenu(e,t,s,r,i){if(In(this.gos))return this.createBean(new b3(e,s,this.lastSelectedTab,r));{const n=this.beans.colMenuFactory.getMenuItems(e,t,i);return n.length?this.createBean(new S3(n,e,t,s)):void 0}}dispatchVisibleChangedEvent(e,t,s,r,i){this.eventSvc.dispatchEvent({type:"columnMenuVisibleChanged",visible:e,switchingTab:t,key:this.lastSelectedTab??i??(In(this.gos)?jt:"columnMenu"),column:s??null,columnGroup:r??null})}isMenuEnabled(e){if(!In(this.gos))return!0;const t=!this.beans.filterManager?.isFilterAllowed(e),s=e.colDef.menuTabs??En;return(t&&s.includes($t)?s.length-1:s.length)>0}showMenuAfterContextMenuEvent(e,t,s,r){this.beans.menuUtils.onContextMenu({mouseEvent:t,touchEvent:s,source:"ui",showMenuCallback:i=>(this.showMenuAfterMouseEvent(e,i,"columnMenu",void 0,void 0,r),!0)})}},b3=class extends Sd{constructor(e,t,s,r){super(),this.column=e,this.restoreFocusParams=t,this.initialSelection=s,this.restrictTo=r,this.tabFactories={},this.includeChecks={};const{tabFactories:i,includeChecks:n}=this;i[jt]=this.createMainPanel.bind(this),i[$t]=this.createFilterPanel.bind(this),i[Cs]=this.createColumnsPanel.bind(this),n[jt]=()=>!0,n[$t]=()=>e?!!this.beans.filterManager?.isFilterAllowed(e):!1,n[Cs]=()=>!0}postConstruct(){const e=this.getTabsToCreate().map(s=>this.createTab(s)),t=new wa({items:e,cssClass:"ag-menu",onActiveItemClicked:this.onHidePopup.bind(this),onItemClicked:this.onTabItemClicked.bind(this)});this.tabbedLayout=this.createBean(t),this.mainMenuList?.setParentComponent(t),this.addDestroyFunc(()=>this.destroyBean(t))}getTabsToCreate(){return this.restrictTo?this.restrictTo:(this.column?.colDef.menuTabs??En).filter(e=>this.isValidMenuTabItem(e)&&this.isNotSuppressed(e))}isValidMenuTabItem(e){let t=!0,s=En;return this.restrictTo!=null&&(t=this.restrictTo.indexOf(e)>-1,s=this.restrictTo),t=t&&En.indexOf(e)>-1,t||this.warn(175,{menuTabName:e,itemsToConsider:s}),t}isNotSuppressed(e){return this.includeChecks[e]()}createTab(e){return this.tabFactories[e]()}showTabBasedOnPreviousSelection(){this.showTab(this.initialSelection)}showTab(e){const{tabItemColumns:t,tabbedLayout:s,tabItemFilter:r,tabItemGeneral:i}=this;t&&e===Cs?s.showItem(t):r&&e===$t?s.showItem(r):i&&e===jt?s.showItem(i):s.showFirstItem()}onTabItemClicked(e){let t=null;switch(e.item){case this.tabItemColumns:t=Cs;break;case this.tabItemFilter:t=$t;break;case this.tabItemGeneral:t=jt;break}t&&this.activateTab(t)}activateTab(e){const t={type:"tabSelected",key:e};this.dispatchLocalEvent(t)}createMainPanel(){const{beans:e,column:t}=this,s=e.colMenuFactory,r=s.createMenu(this,s.getMenuItems(t),this.column,()=>this.restoreFocusParams.getEventSource?.()??this.getGui());this.mainMenuList=r,r.addEventListener("closeMenu",this.onHidePopup.bind(this));const i={title:Rl("legacyMenu",e,t),titleLabel:jt.replace("MenuTab",""),bodyPromise:Pl.resolve(r.getGui()),name:jt};return this.tabItemGeneral=i,i}onHidePopup(e){this.beans.menuUtils.closePopupAndRestoreFocusOnSelect(this.hidePopupFunc,this.restoreFocusParams,e)}createFilterPanel(){const e=this.column?this.createBean(new f3(this.column,"COLUMN_MENU")):null;this.filterComp=e,e?.hasFilter()||this.error(119);const t=r=>e?.afterGuiAttached(r),s=()=>e?.afterGuiDetached();return this.tabItemFilter={title:Rl("filterTab",this.beans,this.column),titleLabel:$t.replace("MenuTab",""),bodyPromise:Pl.resolve(e?.getGui()),afterAttachedCallback:t,afterDetachedCallback:s,name:$t},this.tabItemFilter}createColumnsPanel(){const e=m3({tag:"div",cls:"ag-menu-column-select-wrapper"}),{beans:t,column:s}=this,i=t.colChooserFactory.createColumnSelectPanel(this,s).getGui();i.classList.add("ag-menu-column-select"),e.appendChild(i);const n={title:Rl("columns",t,s),titleLabel:Cs.replace("MenuTab",""),bodyPromise:Pl.resolve(e),name:Cs};return this.tabItemColumns=n,n}afterGuiAttached(e){const{container:t,hidePopup:s}=e;this.tabbedLayout.setAfterAttachedParams({container:t,hidePopup:s}),s&&(this.hidePopupFunc=s,this.addDestroyFunc(s))}getGui(){return this.tabbedLayout.getGui()}destroy(){super.destroy(),this.destroyBean(this.filterComp)}},S3=class extends t0{constructor(e,t,s,r){super({tag:"div",ref:"eColumnMenu",cls:"ag-menu ag-column-menu",role:"menu"}),this.menuItems=e,this.column=t,this.columnGroup=s,this.restoreFocusParams=r,this.eColumnMenu=h3}postConstruct(){const e=this.beans.colMenuFactory.createMenu(this,this.menuItems,this.column,()=>this.restoreFocusParams.getEventSource?.()??this.getGui(),this.columnGroup,"presentation");this.mainMenuList=e,e.addEventListener("closeMenu",this.onHidePopup.bind(this)),this.eColumnMenu.appendChild(e.getGui())}onHidePopup(e){this.beans.menuUtils.closePopupAndRestoreFocusOnSelect(this.hidePopupFunc,this.restoreFocusParams,e)}afterGuiAttached({hidePopup:e}){e&&(this.hidePopupFunc=e,this.addDestroyFunc(e)),this.mainMenuList.focusInto()}};function y3(e,t){const{contextMenuSvc:s}=e;if(!s)return;const{rowNode:r,column:i,value:n,x:o,y:a}=t??{};let{x:l,y:c}=s.getContextMenuPosition(r,i);o!=null&&(l=o),a!=null&&(c=a),s.showContextMenu({mouseEvent:new MouseEvent("mousedown",{clientX:l,clientY:c}),rowNode:r,column:i,value:n,source:"api"})}function w3(e,t){e.colChooserFactory?.showColumnChooser({chooserParams:t})}function x3(e){e.colChooserFactory?.hideActiveColumnChooser()}import{_exists as F3}from"ag-stack";import{BeanStub as T3,_createIconNoSpan as ie,_getRowNode as tf,_normalizeSortType as A3,_resetColumnState as P3}from"ag-grid-community";var R3={moveLeft:"ColumnMove",moveRight:"ColumnMove",pinSubMenu:"PinnedColumn",pinLeft:"PinnedColumn",pinRight:"PinnedColumn",clearPinned:"PinnedColumn",pinRowSubMenu:"PinnedRow",pinBottom:"PinnedRow",pinTop:"PinnedRow",unpinRow:"PinnedRow",valueAggSubMenu:"SharedAggregation",showValuesAsSubMenu:"ShowValuesAs",autoSizeThis:"ColumnAutoSize",autoSizeAll:"ColumnAutoSize",rowGroup:"SharedRowGrouping",rowUnGroup:"SharedRowGrouping",resetColumns:"CommunityCore",expandAll:["CsrmHierarchy","ServerSideRowModel"],contractAll:["CsrmHierarchy","ServerSideRowModel"],copy:"Clipboard",copyWithHeaders:"Clipboard",copyWithGroupHeaders:"Clipboard",cut:"Clipboard",paste:"Clipboard",export:["CsvExport","ExcelExport","PdfExport"],note:"Notes",csvExport:"CsvExport",excelExport:"ExcelExport",pdfExport:"PdfExport",separator:"CommunityCore",pivotChart:"IntegratedCharts",chartRange:"IntegratedCharts",columnFilter:"ColumnFilter",columnChooser:"ColumnMenu",calculatedColumn:"CalculatedColumns",editCalculatedColumn:"CalculatedColumns",removeCalculatedColumn:"CalculatedColumns",editColumnName:"ColumnHeaderEdit",sortAscending:"Sort",sortDescending:"Sort",sortAbsoluteAscending:"Sort",sortAbsoluteDescending:"Sort",sortUnSort:"Sort"};function M3(e,t){const s=R3[t];s&&e.assertModuleRegistered(s,`menu item \`${t}\``)}var I3={sortAscending:{fallback:"Sort Ascending",getSortDef:()=>({type:"default",direction:"asc"})},sortDescending:{fallback:"Sort Descending",getSortDef:()=>({type:"default",direction:"desc"})},sortAbsoluteAscending:{fallback:"Sort Absolute Ascending",getSortDef:()=>({type:"absolute",direction:"asc"})},sortAbsoluteDescending:{fallback:"Sort Absolute Descending",getSortDef:()=>({type:"absolute",direction:"desc"})},sortUnSort:{fallback:"Clear Sort",getSortDef:e=>({type:A3(e.getSortDef()?.type),direction:null})}},E3=class extends s0{constructor(){super(...arguments),this.beanName="menuItemMapper"}mapWithStockItems(e,t,s,r,i,n,o=null){if(!e)return[];const a=[],l=this.getLocaleTextFunc(),{beans:c,gos:u}=this,{aggFuncSvc:d,chartMenuItemMapper:h,clipboardSvc:p,colAutosize:g,colChooserFactory:f,colHeaderEditSvc:m,colModel:v,colNames:C,ctrlsSvc:b,csvCreator:y,excelCreator:S,expansionSvc:w,focusSvc:F,menuSvc:T,notesSvc:x,calculatedColsSvc:P,pdfCreator:L,pinnedCols:G,pinnedRowModel:O,pivotColsSvc:z,rangeSvc:B,rowGroupColsSvc:W,showValuesAsSvc:J,sortSvc:Q,valueColsSvc:de}=c,me=D=>({node:A,column:ne})=>{if(A){O.pinRow(A,D??null,ne);return}B?.getCellRanges()?.forEach(K=>{B.forEachRowInRange(K,I=>{const V=tf(c,I);V&&O.pinRow(V,D??null,null)})})},Z=(D,A,ne,K)=>{switch(M3(u,D),D){case"moveLeft":case"moveRight":return s3(c,A,o,ne(),K,D,l);case"moveUp":case"moveDown":return null;case"pinSubMenu":return G&&A?{name:l("pinColumn","Pin Column"),icon:ie("menuPin",c,null),subMenu:["clearPinned","pinLeft","pinRight"]}:null;case"pinLeft":return G&&A?{name:l("pinLeft","Pin Left"),action:()=>G.setColsPinned([A],"left",K),checked:!!A&&A.isPinnedLeft(),menuItemRole:"menuitemradio"}:null;case"pinRight":return G&&A?{name:l("pinRight","Pin Right"),action:()=>G.setColsPinned([A],"right",K),checked:!!A&&A.isPinnedRight(),menuItemRole:"menuitemradio"}:null;case"clearPinned":return G&&A?{name:l("noPin","No Pin"),action:()=>G.setColsPinned([A],null,K),checked:!!A&&!A.isPinned(),menuItemRole:"menuitemradio"}:null;case"pinRowSubMenu":{const I=u.get("enableRowPinning"),V=[],q=s?.rowPinned??s?.pinnedSibling?.rowPinned;return q&&V.push("unpinRow"),I&&I!=="bottom"&&q!="top"&&V.push("pinTop"),I&&I!=="top"&&q!="bottom"&&V.push("pinBottom"),O?.isManual()?{name:l("pinRow","Pin Row"),icon:ie("rowPin",c,A),subMenu:V}:null}case"pinTop":return O?.isManual()?{name:l("pinTop","Pin to Top"),icon:ie("rowPinTop",c,A),action:me("top")}:null;case"pinBottom":return O?.isManual()?{name:l("pinBottom","Pin to Bottom"),icon:ie("rowPinBottom",c,A),action:me("bottom")}:null;case"unpinRow":return O?.isManual()?{name:l("unpinRow","Unpin Row"),icon:ie("rowUnpin",c,A),action:me(null)}:null;case"valueAggSubMenu":return d&&de&&(A?.primary||A?.pivotValueColumn)?{name:l("valueAggregation","Value Aggregation"),icon:ie("menuValue",c,null),subMenu:D3(A,d,de,l),disabled:u.get("functionsReadOnly")}:null;case"showValuesAsSubMenu":return J&&A&&J.isMenuEligible(A)?{name:l("showValuesAs","Show Values As"),icon:ie("showValuesAs",c,null),subMenu:J.getMenuItems(A,l)}:null;case"autoSizeThis":return g?{name:l("autosizeThisColumn","Autosize This Column"),action:()=>A&&g.autoSizeColumn(A,K,u.get("skipHeaderOnAutoSize"))}:null;case"autoSizeAll":return g?{name:l("autosizeAllColumns","Autosize All Columns"),action:()=>g.autoSizeAllColumns({source:K,skipHeader:u.get("skipHeaderOnAutoSize")})}:null;case"rowGroup":return W?{name:$r(l,"groupBy",C.getDisplayNameForColumn(A,"header")),disabled:u.get("functionsReadOnly")||A?.isRowGroupActive()||!A?.colDef.enableRowGroup,action:()=>W.addColumns([A],K),icon:ie("menuAddRowGroup",c,null)}:null;case"rowUnGroup":if(W&&u.isModuleRegistered("SharedRowGrouping")){const I=A?.showRowGroup,V=u.get("groupLockGroupColumns");let q,ae,xe;if(I===!0)q=l("ungroupAll","Un-Group All"),ae=u.get("functionsReadOnly")||V===-1||V>=(W.columns.length??0),xe=()=>W.setColumns(W.columns.slice(0,V),K);else if(typeof I=="string"){const he=v.getNonPivotCol(I),ke=he!=null?C.getDisplayNameForColumn(he,"header"):I;q=$r(l,"ungroupBy",ke),ae=u.get("functionsReadOnly")||Kr(he,c),xe=()=>{W.removeColumns([I],K)}}else q=$r(l,"ungroupBy",C.getDisplayNameForColumn(A,"header")),ae=u.get("functionsReadOnly")||!A?.isRowGroupActive()||!A?.colDef.enableRowGroup||Kr(A,c),xe=()=>W.removeColumns([A],K);return{name:q,disabled:ae,action:xe,icon:ie("menuRemoveRowGroup",c,null)}}else return null;case"scrollIntoView":{if(!b||!A||A.isPinned())return null;const I=C.getDisplayNameForColumn(A,"header");return{name:gt(l,Hs.key,Hs.default,I),icon:ie(Hs.icon,c,null),action:()=>b.getScrollFeature().ensureColumnVisible(A)}}case"value":{if(!de||!A?.primary||!A.isAllowValue())return null;const I=A.isValueActive(),V=C.getDisplayNameForColumn(A,"header");return{name:I?gt(l,et.removeKey,et.removeDefault,V):gt(l,et.addKey,et.addDefault,V),icon:ie(et.icon,c,null),disabled:u.get("functionsReadOnly"),action:()=>I?de.removeColumns([A],K):de.addColumns([A],K)}}case"pivot":{if(!z||!v.pivotMode||!A?.primary||!A.isAllowPivot())return null;const I=A.isPivotActive(),V=C.getDisplayNameForColumn(A,"header");return{name:I?gt(l,tt.removeKey,tt.removeDefault,V):gt(l,tt.addKey,tt.addDefault,V),icon:ie(tt.icon,c,null),disabled:u.get("functionsReadOnly"),action:()=>I?z.removeColumns([A],K):z.addColumns([A],K)}}case"resetColumns":return{name:l("resetColumns","Reset Columns"),action:()=>P3(c,K)};case"expandAll":return w?{name:l("expandAll","Expand All Row Groups"),action:()=>w.expandAll(!0)}:null;case"contractAll":return w?{name:l("collapseAll","Collapse All Row Groups"),action:()=>w.expandAll(!1)}:null;case"copy":return p?{name:l("copy","Copy"),shortcut:l("ctrlC","Ctrl+C"),icon:ie("clipboardCopy",c,null),action:()=>p.copyToClipboard()}:null;case"copyWithHeaders":return p?{name:l("copyWithHeaders","Copy with Headers"),icon:ie("clipboardCopy",c,null),action:()=>p.copyToClipboard({includeHeaders:!0})}:null;case"copyWithGroupHeaders":return p?{name:l("copyWithGroupHeaders","Copy with Group Headers"),icon:ie("clipboardCopy",c,null),action:()=>p.copyToClipboard({includeHeaders:!0,includeGroupHeaders:!0})}:null;case"cut":if(p){const I=F.getFocusedCell(),V=I?tf(c,I):null,q=V?I?.column.isCellEditable(V):!1;return{name:l("cut","Cut"),shortcut:l("ctrlX","Ctrl+X"),icon:ie("clipboardCut",c,null),disabled:!q||u.get("suppressCutToClipboard"),action:()=>p.cutToClipboard(void 0,"contextMenu")}}else return null;case"paste":if(p){const I=u.get("suppressClipboardApi")||u.get("suppressClipboardPaste")||!A||!s||!A.isCellEditable(s)||A.isSuppressPaste(s);return{name:l("paste","Paste"),shortcut:l("ctrlV","Ctrl+V"),icon:ie("clipboardPaste",c,null),disabled:I,action:()=>p.pasteFromClipboard()}}else return null;case"export":{const I=[];return!u.get("suppressCsvExport")&&y&&I.push("csvExport"),!u.get("suppressExcelExport")&&S&&I.push("excelExport"),!u.get("suppressPdfExport")&&L&&I.push("pdfExport"),I.length?{name:l("export","Export"),subMenu:I,icon:ie("save",c,null)}:null}case"csvExport":return y?{name:l("csvExport","CSV Export"),icon:ie("csvExport",c,null),action:()=>y.exportDataAsCsv()}:null;case"excelExport":return S?{name:l("excelExport","Excel Export"),icon:ie("excelExport",c,null),action:()=>S.exportDataAsExcel()}:null;case"pdfExport":return L?{name:l("pdfExport","PDF Export"),icon:ie("pdfExport",c,null),action:()=>L.exportDataAsPdf()}:null;case"separator":return D;case"pivotChart":case"chartRange":return h.getChartItems(D);case"columnFilter":return T&&A?{name:l("columnFilter","Column Filter"),icon:ie("filter",c,null),action:()=>T.showFilterMenu({column:A,buttonElement:ne(),containerType:"columnFilter",positionBy:"button"})}:null;case"columnChooser":{const I=F.focusedHeader;return f?{name:l("columnChooser","Choose Columns"),icon:ie("columns",c,null),action:()=>f.showColumnChooser({column:A,eventSource:ne(),headerPosition:I})}:null}case"calculatedColumn":{if(!P?.isEnabled())return null;const I=F.focusedHeader??(A?{headerRowIndex:0,column:A}:null);return{name:l("calculatedColumnAdd","Add Calculated Column"),icon:ie("calculatedColumnAdd",c,null),action:()=>P.openCalculatedColumnDialog(A,"add",!0,{eventSource:ne(),headerPosition:I})}}case"editCalculatedColumn":{if(!P?.isEnabled()||!A?.isCalculatedCol)return null;const I=F.focusedHeader??{headerRowIndex:0,column:A};return{name:!!A.colDef.calculatedColumnReadOnly?l("calculatedColumnView","View Calculated Column"):l("calculatedColumnEdit","Edit Calculated Column"),icon:ie("calculatedColumnEdit",c,null),action:()=>P.openCalculatedColumnDialog(A,"edit",!0,{eventSource:ne(),headerPosition:I})}}case"removeCalculatedColumn":return P?.isEnabled()&&A?.isCalculatedCol?{name:l("calculatedColumnRemove","Remove Calculated Column"),icon:ie("calculatedColumnRemove",c,null),disabled:!!A.colDef.calculatedColumnReadOnly,action:()=>P.removeCalculatedColumn(A)}:null;case"editColumnName":{const I=A??o;return I?m?.getEditColumnNameMenuItem(I)??null:null}case"sortUnSort":case"sortAscending":case"sortDescending":case"sortAbsoluteAscending":case"sortAbsoluteDescending":{if(!Q||!A)return null;const{fallback:I,getSortDef:V}=I3[D];return{name:l(D,I),icon:ie(D,c,null),action:()=>Q.setSortForColumn(A,V(A),!1,K)}}default:return this.warn(176,{key:D}),null}};for(const D of e){let A;if(typeof D=="string"){if(D==="note"){const I=r??(t&&s?{rowNode:s,column:t}:void 0),V=I?x?.getMenuItems(I)??[]:[];V.length&&a.push(ue,...V,ue);continue}A=Z(D,t,i,n)}else A={...D};if(!A)continue;const ne=A,{subMenu:K}=ne;K&&K instanceof Array&&(ne.subMenu=this.mapWithStockItems(K,t,s,r,i,n,o)),A!=null&&a.push(A)}return Wr(a,ue),a}};function D3(e,t,s,r){let i;if(e.primary)i=e;else{const o=e.pivotValueColumn;i=F3(o)?o:void 0}const n=[];if(i){const o=i.isValueActive(),a=t.getFuncNames(i);n.push({name:r("noAggregation","None"),action:()=>s.removeColumns([i],"contextMenu"),checked:!o,menuItemRole:"menuitemradio"});for(const l of a)n.push({name:r(l,t.getDefaultFuncLabel(l)),action:()=>s.setColumnAggFunc(i,l,"contextMenu"),checked:o&&i.aggFunc===l,menuItemRole:"menuitemradio"})}return n}import{_findTabbableParent as L3,_getActiveDomElement as k3,_isNothingFocused as sf,_isVisible as _3,_last as G3}from"ag-stack";import{BeanStub as O3}from"ag-grid-community";var N3=class extends r0{constructor(){super(...arguments),this.beanName="menuUtils"}restoreFocusOnClose(e,t,s,r){const i=e.getEventSource?.(),n=s instanceof KeyboardEvent;if(!r&&!n||!i)return;const o=k3(this.beans);!t.contains(o)&&!sf(this.beans)||this.focusEventSourceOrHeaderCell(e)}closePopupAndRestoreFocusOnSelect(e,t,s){let r;s?.keyboardEvent&&(r=s.keyboardEvent),e(r&&{keyboardEvent:r});const i=this.beans,n=i.focusSvc,o=n.getFocusedCell();if(sf(i))if(o){const{rowIndex:a,rowPinned:l,column:c}=o;n.setFocusedCell({rowIndex:a,column:c,rowPinned:l,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!0})}else this.focusEventSourceOrHeaderCell(t)}onContextMenu(e){const{mouseEvent:t,touchEvent:s,showMenuCallback:r,source:i}=e;if(!this.gos.get("allowContextMenuWithControlKey")&&t&&(t.ctrlKey||t.metaKey)||(t&&this.blockMiddleClickScrollsIfNeeded(t),i==="ui"&&this.gos.get("suppressContextMenu")))return;const n=t??s.touches[0];if(r(n)){const o=t??s;o?.cancelable&&o.preventDefault()}}async focusEventSourceOrHeaderCell(e){const{column:t,columnIndex:s,headerPosition:r,getEventSource:i}=e,{visibleCols:n,headerNavigation:o,focusSvc:a}=this.beans,l=await n.allCols.some(u=>u===t);if(!this.isAlive())return;const c=i?.();if(c&&_3(c)){const u=L3(c);if(u){t?.isAlive()&&l&&o?.scrollToColumn(t),a.focusGridElement(u);return}}else if(r&&s!==-1){const u=n.allCols,d=u[s]||G3(u);d&&a.focusHeaderPosition({headerPosition:{headerRowIndex:r.headerRowIndex,column:d}})}}blockMiddleClickScrollsIfNeeded(e){this.gos.get("suppressMiddleClickScrolls")&&e.which===2&&e.preventDefault()}};import{_focusInto as B3}from"ag-stack";import{BeanStub as V3,_createElement as H3}from"ag-grid-community";var U3=class extends i0{constructor(){super(...arguments),this.beanName="toolbarMenuBuilder"}showMenu(e){const{anchorElement:t,menuItems:s,ariaLabel:r,onClose:i}=e,{popupSvc:n,menuItemMapper:o}=this.beans;if(!n||!o)return;const a=H3({tag:"div",cls:"ag-menu"}),l=this.createBean(new xn);a.appendChild(l.getGui()),l.addMenuItems(o.mapWithStockItems(s,null,null,void 0,()=>t,"contextMenu"));let c;l.addManagedListeners(l,{closeMenu:()=>c?.()}),n.addPopup({modal:!0,eChild:a,closeOnEsc:!0,afterGuiAttached:u=>{c=u.hidePopup,B3(l.getGui())},ariaLabel:r,closedCallback:()=>{this.destroyBean(l),i?.()}}),n.positionPopupByComponent({type:"toolbar",eventSource:t,ePopup:a,position:"under",nudgeY:4,keepWithinBounds:!0})}},rf={moduleName:"MenuCore",version:_,beans:[E3,HV,N3,U3],icons:{chart:"chart",columns:"columns",loadingMenuItems:"loading",menuPin:"pin",menuValue:"aggregation",menuAddRowGroup:"group",menuRemoveRowGroup:"group",clipboardCopy:"copy",clipboardCut:"cut",clipboardPaste:"paste",save:"save",csvExport:"csv",excelExport:"excel",pdfExport:"pdf",sortAscending:"asc",sortDescending:"desc",sortAbsoluteAscending:"aasc",sortAbsoluteDescending:"adesc",sortUnSort:"none"},dependsOn:[$,OV,BV,Ur]},Ml={moduleName:"ColumnMenu",version:_,beans:[C3,r3,YV],icons:{menuMoveLeft:"left",menuMoveRight:"right",menuMoveUp:"up",menuMoveDown:"down",ensureColumnVisible:"column-arrow",legacyMenu:"menu",filterTab:"filter",columnSelectClosed:"tree-closed",columnSelectOpen:"tree-open",columnSelectIndeterminate:"tree-indeterminate"},apiFunctions:{showColumnChooser:w3,hideColumnChooser:x3},dependsOn:[rf,Al,NV,GV]},Il={moduleName:"ContextMenu",version:_,beans:[d3],apiFunctions:{showContextMenu:y3},dependsOn:[rf]},z3={moduleName:"Menu",version:_,dependsOn:[Ml,Il]};import{_EditCoreModule as W3}from"ag-grid-community";import{_missing as nf}from"ag-stack";import{AgAbstractCellEditor as K3,KeyCode as of,_addGridCommonParams as $3,_consoleError as j3}from"ag-grid-community";var Y3=10,af=class extends n0{constructor(){super({tag:"div",cls:"ag-cell-edit-wrapper"}),this.pendingInitialEventKey=null,this.initialEventKeyProcessed=!1,this.cachedRaw=this,this.seededValue=this}initialiseEditor(e){const{cellStartedEdit:t,values:s,valuesPage:r,eventKey:i}=this.params;this.pendingInitialEventKey=null,this.initialEventKeyProcessed=!1,nf(s)&&nf(r)&&this.beans.log.warn(180);const n=this.resolveAsyncMode(),{params:o,valueList:a}=this.buildRichSelectParams(n),l=this.createManagedBean(new fn(o));this.eEditor=l,this.seededValue=this.params.value,l.addCss("ag-cell-editor"),this.appendChild(l);const c=this.getAsyncValuesSource(n);c&&l.setAsyncValuesSource({source:c,thresholdRows:this.params.valuesPageLoadThreshold??Y3,useAsyncSearch:n.isFullAsync,onMisconfiguredSearchSource:n.isFullAsync?()=>this.beans.log.warn(294):void 0,onFirstValuesPageLoaded:()=>{this.pendingInitialEventKey!=null&&(this.consumeInitialEventKey(this.pendingInitialEventKey),this.pendingInitialEventKey=null)}}),this.eEditor.setValueList({valueList:a,refresh:!0,isInitial:!0}),n.isValuesPaged?(this.eEditor.resetAsyncValues(""),n.isFullAsync?this.consumeInitialEventKey(i):this.pendingInitialEventKey=i):a&&!Array.isArray(a)&&a.then(u=>{const d=this.getSearchStringCallback(u);d&&l.setSearchStringCreator(d),this.consumeInitialEventKey(i)}).catch(u=>{j3("Rich Select",u),this.consumeInitialEventKey(i)}),this.addManagedListeners(l,{fieldPickerValueSelected:this.onEditorPickerValueSelected.bind(this)}),this.focusAfterAttached=t}onEditorPickerValueSelected(e){if(this.gos.get("editType")!=="fullRow"){const{fromEnterKey:t,keyboardEvent:s}=e;setTimeout(()=>{this.isAlive()&&this.params.stopEditing(!t,s)})}}getPlaceholderText(e=this.isFullAsync()){const{valuePlaceholder:t}=this.params;if(t!==void 0)return t;const s=this.getLocaleTextFunc();return e?s("typeToSearchOoo","Type to search..."):s("advancedFilterBuilderSelectOption","Select an option...")}isFullAsync(){const{allowTyping:e,filterListAsync:t,values:s,valuesPage:r}=this.params,i=typeof s=="function"||typeof r=="function";return t&&!e?(this.beans.log.warn(294),!1):!i&&t?(this.beans.log.warn(294),!1):!!(e&&t&&i)}isValuesPaged(){return typeof this.params.valuesPage=="function"}resolveAsyncMode(){return{isValuesPaged:this.isValuesPaged(),isFullAsync:this.isFullAsync()}}getInitialValueList(e=this.resolveAsyncMode()){const t=this.params,{values:s}=t;if(!e.isValuesPaged){if(!s)return[];if(Array.isArray(s))return s;if(typeof s!="function")return[];if(!e.isFullAsync)return s({...t})}}buildRichSelectParams(e=this.resolveAsyncMode()){const t=this.params,{cellRenderer:s,cellRendererParams:r,cellHeight:i,value:n,values:o,formatValue:a,searchDebounceDelay:l,valueListGap:c,valueListMaxHeight:u,valueListMaxWidth:d,allowTyping:h,filterList:p,searchType:g,highlightMatch:f,eventKey:m,multiSelect:v,suppressDeselectAll:C,suppressMultiSelectPillRenderer:b}=t,{isValuesPaged:y,isFullAsync:S}=e,w=a??(G=>String(G??"")),T={value:n,cellRenderer:s,cellRendererParams:r,cellRowHeight:i,searchDebounceDelay:l,valueFormatter:G=>Array.isArray(G)?G.map(O=>w(O)).join(", "):w(G),pickerAriaLabelKey:"ariaLabelRichSelectField",pickerAriaLabelValue:"Rich Select Field",pickerType:"virtual-list",pickerGap:c,allowTyping:h,filterList:p,searchType:g,highlightMatch:f,maxPickerHeight:u,maxPickerWidth:d,placeholder:this.getPlaceholderText(S),initialInputValue:m?.length===1?m:m===of.BACKSPACE?"":void 0,multiSelect:v,suppressDeselectAll:C,suppressMultiSelectPillRenderer:b},x=this.getInitialValueList(e),P=Array.isArray(o);return y?(x&&(T.valueList=x),S&&(T.allowNoResultsCopy=!0,T.filterList=!0)):P?(T.valueList=x,T.searchStringCreator=this.getSearchStringCallback(x)):typeof o=="function"&&S&&(T.allowNoResultsCopy=!0,T.filterList=!0),{params:T,valueList:x}}getAsyncValuesSource(e=this.resolveAsyncMode()){const{isFullAsync:t,isValuesPaged:s}=e;if(!(!t&&!s))return{searchValues:t?r=>this.getAsyncSearchValues(r):void 0,loadValuesPage:s?r=>this.getAsyncValuesPage(r):void 0,valuesPageInitialStartRow:s?r=>this.resolveValuesPageInitialStartRow(r):void 0,valuesPageSize:s?this.params.valuesPageSize:void 0}}getAsyncSearchValues(e){const{values:t}=this.params;return typeof t!="function"?[]:t({...this.params,search:e})}getAsyncValuesPage(e){const{valuesPage:t}=this.params;return typeof t!="function"?{values:[]}:t({...this.params,search:e.search,startRow:e.startRow,endRow:e.endRow,cursor:e.cursor})}resolveValuesPageInitialStartRow(e){if(e)return 0;const{valuesPageInitialStartRow:t,value:s}=this.params,r=typeof t=="function"?t(s):t;return Math.max(Math.floor(r??0),0)}getSearchStringCallback(e){if(typeof e[0]!="object")return;const t=this.params,{colDef:s,formatValue:r}=t,i=r??(o=>String(o??""));if(s.cellEditorParams?.formatValue)return o=>o.map(i);const{keyCreator:n}=s;if(n){this.beans.log.warn(266);const{column:o,node:a,data:l}=t;return c=>c.map(u=>{const d=$3(this.gos,{value:u,colDef:s,column:o,node:a,data:l});return n(d)})}return o=>o.map(i)}afterGuiAttached(){const{focusAfterAttached:e,params:t}=this;setTimeout(()=>{if(!this.isAlive())return;const s=this.eEditor,{allowTyping:r,eventKey:i,cellStartedEdit:n}=t;if(e){const o=s.getFocusableElement();o.focus({preventScroll:!0}),r&&i?.length!==1&&o.select()}n&&s.showPicker(),this.pendingInitialEventKey==null&&this.consumeInitialEventKey(i)})}consumeInitialEventKey(e){!e||this.initialEventKeyProcessed||(this.initialEventKeyProcessed=!0,this.processEventKey(e))}processEventKey(e){e&&(e===of.BACKSPACE?this.eEditor.searchTextFromString(null):e?.length===1&&this.eEditor.searchTextFromString(e))}focusIn(){this.eEditor.getFocusableElement().focus()}agSetEditValue(e){this.params.value=e,this.eEditor.setValue(e??null,!0),this.seededValue=e??null}getValue(){const e=this.eEditor.getValue();if(e===this.seededValue)return this.params.value;if(Object.is(this.cachedRaw,e))return this.cachedParsed;const t=this.params.parseValue?.(e)??e;return this.cachedRaw=e,this.cachedParsed=t,t}isPopup(){return!1}getValidationElement(){return this.eEditor.getAriaElement()}getValidationErrors(){const{params:e}=this,{getValidationErrors:t}=e;return t?t({value:this.getValue(),internalErrors:null,cellEditorParams:e}):null}},lf={moduleName:"RichSelect",version:_,beans:[],userComponents:{agRichSelect:af,agRichSelectCellEditor:af},icons:{richSelectOpen:"small-down",richSelectRemove:"cancel",richSelectLoading:"loading"},dependsOn:[$,W3]};import{_ColumnFilterModule as q3}from"ag-grid-community";import{RefPlaceholder as Dn,_areEqual as Z3,_exists as X3,_getActiveDomElement as cf,_makeNull as J3,_setDisplayed as uf}from"ag-stack";import{AgInputTextFieldSelector as Q3,KeyCode as Xr,ManagedFocusFeature as e5,ProvidedFilter as t5,_bindFilterCallback as df,_createIconNoSpan as s5}from"ag-grid-community";var Ln="__AG_SELECT_ALL__",kn="__AG_ADD_SELECTION_TO_FILTER__",Jr=[],r5=class{constructor(e,t,s,r,i){this.valueSvc=e,this.getValueFormatter=t,this.formatter=s,this.column=r,this.getKeyOnlyKeys=i,this.displayedKeys=[]}updateDisplayedValuesToAllAvailable(e,t,s){this.displayedKeys=Array.from(s)}updateDisplayedValuesToMatchMiniFilter(e,t,s,r,i){this.displayedKeys=[];const n=this.getValueFormatter(),o=this.getKeyOnlyKeys();for(const a of s)if(a==null)i&&this.displayedKeys.push(a);else{const l=o.has(a)?a:this.valueSvc.formatValue(this.column,null,e(a),n,!1),c=this.formatter(l);r(c)&&this.displayedKeys.push(a)}}getDisplayedValueCount(){return this.displayedKeys.length}getDisplayedItem(e){return this.displayedKeys[e]}getSelectAllItem(){return Ln}getAddSelectionToFilterItem(){return kn}getDisplayedKeys(){return this.displayedKeys}forEachDisplayedKey(e){this.displayedKeys.forEach(e)}someDisplayedKey(e){return this.displayedKeys.some(e)}hasGroups(){return!1}refresh(){}};import{RefPlaceholder as _n,_setAriaChecked as i5,_setAriaDescribedBy as hf,_setAriaExpanded as n5,_setAriaLabel as El,_setAriaLabelledBy as o5,_setAriaLevel as a5,_setDisplayed as Dl,_toStringOrNull as pf}from"ag-stack";import{AgCheckboxSelector as l5,Component as c5,ComponentInstanceGuard as u5,_addGridCommonParams as d5,_createElement as Ll,_createIcon as kl,_getCellRendererDetails as gf,_getShouldDisplayTooltip as h5,_isShowTooltipWhenTruncated as p5}from"ag-grid-community";var g5={tag:"div",cls:"ag-set-filter-item",attrs:{"aria-hidden":"true"},children:[{tag:"span",cls:"ag-set-filter-group-icons",children:[{tag:"span",ref:"eGroupClosedIcon",cls:"ag-set-filter-group-closed-icon"},{tag:"span",ref:"eGroupOpenedIcon",cls:"ag-set-filter-group-opened-icon"},{tag:"span",ref:"eGroupIndeterminateIcon",cls:"ag-set-filter-group-indeterminate-icon"}]},{tag:"ag-checkbox",ref:"eCheckbox",cls:"ag-set-filter-item-checkbox"}]},f5={tag:"div",cls:"ag-set-filter-item",children:[{tag:"ag-checkbox",ref:"eCheckbox",cls:"ag-set-filter-item-checkbox"}]},m5=class extends o0{constructor(e){super(e.isGroup?g5:f5,[l5]),this.eCheckbox=_n,this.eGroupOpenedIcon=_n,this.eGroupClosedIcon=_n,this.eGroupIndeterminateIcon=_n,this.rendererSetTooltip=!1,this.rendererGuard=new u5,this.formattedValue=null,this.focusWrapper=e.focusWrapper,this.value=e.value,this.params=e.params,this.translate=e.translate,this.valueFormatter=e.valueFormatter,this.item=e.item,this.isSelected=e.isSelected,this.isTree=e.isTree,this.depth=e.depth??0,this.isGroup=e.isGroup,this.groupsExist=e.groupsExist,this.isExpanded=e.isExpanded,this.hasIndeterminateExpandState=e.hasIndeterminateExpandState,this.isMissing=e.isMissing,this.isKeyOnly=e.isKeyOnly}postConstruct(){this.tooltipFeature=this.createOptionalManagedBean(this.beans.tooltipSvc?.createTooltip({getGui:()=>this.focusWrapper,getTooltipComponentDefinition:()=>this.params.colDef,getLocation:()=>"setFilterValue",shouldDisplayTooltip:()=>this.shouldDisplayTooltip?.()??!0,getAdditionalParams:()=>{const{colDef:e,column:t}=this.params,s={colDef:e,column:t,valueFormatted:this.formattedValue??void 0};return this.isTree&&(s.level=this.depth),s}})),this.addDestroyFunc(()=>this.destroyCellRendererComponent?.()),this.render(),this.eCheckbox.setLabelEllipsis(!0).setValue(this.isSelected,!0).setDisabled(!!this.params.readOnly).getInputElement().setAttribute("tabindex","-1"),this.refreshVariableAriaLabels(),this.isTree&&(this.depth>0&&(this.addCss("ag-set-filter-indent-"+this.depth),this.getGui().style.setProperty("--ag-indentation-level",String(this.depth))),this.isGroup?this.setupExpansion():this.groupsExist&&this.addCss("ag-set-filter-add-group-indent"),a5(this.getAriaElement(),this.depth+1)),this.refreshAriaChecked(),this.isMissing&&this.applyMissing(),!this.params.readOnly&&this.eCheckbox.onValueChange(e=>this.onCheckboxChanged(!!e))}getFocusableElement(){return this.focusWrapper}setupExpansion(){const{eGroupClosedIcon:e,eGroupOpenedIcon:t,eGroupIndeterminateIcon:s,hasIndeterminateExpandState:r,beans:i}=this;e.appendChild(kl("setFilterGroupClosed",i,null)),t.appendChild(kl("setFilterGroupOpen",i,null));const n=this.onExpandOrContractClicked.bind(this);this.addManagedElementListeners(e,{click:n}),this.addManagedElementListeners(t,{click:n}),r&&(s.appendChild(kl("setFilterGroupIndeterminate",i,null)),this.addManagedElementListeners(s,{click:n})),this.setExpandedIcons(),this.refreshAriaExpanded()}onExpandOrContractClicked(){this.setExpanded(!this.isExpanded)}setExpanded(e,t){if(this.isGroup&&e!==this.isExpanded){this.isExpanded=e;const s={type:"expandedChanged",isExpanded:!!e,item:this.item};t||this.dispatchLocalEvent(s),this.setExpandedIcons(),this.refreshAriaExpanded()}}setExpandedIcons(){const{isExpanded:e,hasIndeterminateExpandState:t,eGroupClosedIcon:s,eGroupOpenedIcon:r,eGroupIndeterminateIcon:i}=this;Dl(s,t?e===!1:!e),Dl(r,e===!0),t&&Dl(i,e===void 0)}onCheckboxChanged(e){this.isSelected=e;const t={type:"selectionChanged",isSelected:e,item:this.item};this.dispatchLocalEvent(t),this.refreshVariableAriaLabels(),this.refreshAriaChecked()}toggleSelected(){this.params.readOnly||this.setSelected(!this.isSelected)}setSelected(e,t){this.isSelected=e,this.eCheckbox.setValue(e,t),this.refreshAriaChecked()}refreshVariableAriaLabels(){if(!this.isTree)return;const e=this.getLocaleTextFunc(),t=this.eCheckbox.getValue(),s=t===void 0?e("ariaIndeterminate","indeterminate"):t?e("ariaVisible","visible"):e("ariaHidden","hidden"),r=e("ariaToggleVisibility","Press SPACE to toggle visibility");o5(this.eCheckbox.getInputElement(),void 0),this.eCheckbox.setInputAriaLabel(`${r} (${s})`)}setupFixedAriaLabels(e){if(!this.isTree)return;const s=this.getLocaleTextFunc()("ariaFilterValue","Filter Value"),r=this.getAriaElement();El(r,`${e} ${s}${this.getMissingSuffix()}`),hf(r,this.eCheckbox.getInputElement().id)}applyMissing(){const e=this.isMissing;this.toggleCss("ag-set-filter-item-missing",e);const t=this.getAriaElement();this.isTree&&(e||!this.cellRendererComponent)?this.setupFixedAriaLabels(this.formattedValue):this.isTree?(El(t,null),hf(t)):El(t,e?this.getDefaultTooltipText(this.cellRendererParams.value,this.formattedValue):null)}getMissingSuffix(){return this.isMissing?`, ${this.translate("ariaNotInCurrentData")}`:""}refreshAriaChecked(){const e=this.getAriaElement();i5(e,this.eCheckbox.getValue())}refreshAriaExpanded(){n5(this.getAriaElement(),!!this.isExpanded)}refresh(e,t,s,r){this.item=e;const i=r!==this.isMissing;i&&(this.isMissing=r,this.applyMissing(),this.refreshCheckboxLabel()),t!==this.isSelected&&this.setSelected(t,!0),this.setExpanded(s,!0);let n=this.cellRendererParams.value,o=this.formattedValue,a=!1;if(this.valueFunction){const g=this.valueFunction();n=g,o=g,a=!this.cellRendererComponent}const l=!!this.cellRendererComponent,c=this.pendingCellRendererClaim!=null;this.setTooltipAndCellRendererParams(n,o,!l||i&&!this.rendererSetTooltip),c&&this.renderCell(),a&&this.renderCellWithoutCellRenderer();const{cellRendererComponent:u,cellRendererParams:d,beans:h,params:p}=this;if(u){const g=gf(h.userCompFactory,p,d);if(!u.refresh?.(g?.params??d)){const m=u;this.cellRendererComponent=void 0,this.destroyCellRendererComponent=void 0,this.setTooltipAndCellRendererParams(n,o),this.renderCell(),this.destroyBean(m)}}}render(){const{params:{column:e}}=this;let{value:t}=this,s;typeof t=="function"?(this.valueFunction=t,s=this.valueFunction(),t=s):this.isTree?s=pf(t):s=this.getFormattedValue(e,t),s==null&&t==null&&(s=this.translate("blanks")),this.formattedValue=s,this.setTooltipAndCellRendererParams(t,s),this.renderCell()}setTooltipAndCellRendererParams(e,t,s=!0){const r=this.gos,i=this.rendererGuard.claim();this.rendererClaim=i,this.formattedValue=t,s&&(this.rendererSetTooltip=!1,this.hasDefaultTooltip()?(this.shouldDisplayTooltip=h5(r,()=>{const n=this.eCheckbox.getGui();return n.querySelector(".ag-set-filter-item-missing-value")??n.querySelector(".ag-label")}),this.tooltipFeature?.setTooltipAndRefresh(this.getDefaultTooltipText(e,t))):(this.shouldDisplayTooltip=void 0,this.tooltipFeature?.setTooltipAndRefresh(null))),this.cellRendererParams=d5(r,{value:e,valueFormatted:t,colDef:this.params.colDef,column:this.params.column,setTooltip:(n,o)=>{r.assertModuleRegistered("Tooltip",3),i.isCurrent()&&(this.rendererSetTooltip=!0,this.shouldDisplayTooltip=o,this.tooltipFeature?.setTooltipAndRefresh(n))}})}hasDefaultTooltip(){const e=this.params;return!!e.showTooltips&&(!p5(this.gos)||!e.cellRenderer)}getDefaultTooltipText(e,t){const s=t??pf(e);return this.isMissing?`${s??""}${this.getMissingSuffix()}`:s}getFormattedValue(e,t){return kp(this.beans,e,t,this.valueFormatter)}renderCell(){const t=(this.isKeyOnly?void 0:gf(this.beans.userCompFactory,this.params,this.cellRendererParams))?.newAgStackInstance(),s=this.rendererClaim;if(t==null){this.pendingCellRendererClaim=void 0,this.renderCellWithoutCellRenderer();return}this.pendingCellRendererClaim=s,t.then(r=>{if(this.pendingCellRendererClaim===s&&(this.pendingCellRendererClaim=void 0),r){if(!this.isAlive()||!s.isCurrent()){this.destroyBean(r);return}this.cellRendererComponent=r,this.setCheckboxLabel(r.getGui()),this.destroyCellRendererComponent=()=>this.destroyBean(r)}})}renderCellWithoutCellRenderer(){const{valueFormatted:e,value:t}=this.cellRendererParams;let s=e??t;typeof s!="string"&&(this.beans.log.warn(208),s=""),this.setCheckboxLabel(s),this.setupFixedAriaLabels(s)}setCheckboxLabel(e){this.labelContent=e,this.refreshCheckboxLabel()}refreshCheckboxLabel(){const e=this.labelContent;if(e===void 0)return;const t=this.isMissing?this.params.preservePreviousValuesLabel:void 0;if(!t){this.eCheckbox.setLabel(e);return}const s=Ll({tag:"span",cls:"ag-set-filter-item-missing-value"});s.append(e);const r=Ll({tag:"span",cls:"ag-set-filter-item-missing-content"});r.append(s," ",Ll({tag:"span",cls:"ag-set-filter-item-missing-label",children:t})),this.eCheckbox.setLabel(r)}destroy(){this.rendererGuard.invalidate(),this.pendingCellRendererClaim=void 0,super.destroy()}getComponentHolder(){return this.params.column.getColDef()}};import{_getDateParts as v5}from"ag-stack";var _l=class{constructor(e,t,s,r,i,n){this.log=e,this.formatter=t,this.treeListPathGetter=s,this.treeListFormatter=r,this.treeDataOrGrouping=i,this.getKeyOnlyKeys=n,this.allDisplayedItemsTree=new Map,this.activeDisplayedItemsFlat=[],this.selectAllItem={depth:0,filterPasses:!0,available:!0,treeKey:Ln,children:this.allDisplayedItemsTree,expanded:!0,parentTreeKeys:[]},this.addSelectionToFilterItem={depth:0,filterPasses:!0,available:!0,treeKey:kn,expanded:!0,parentTreeKeys:[]}}updateParams(e,t){this.treeListPathGetter=e,this.treeListFormatter=t}updateDisplayedValuesToAllAvailable(e,t,s,r){r==="reload"?this.generateItemTree(e,t,s):r==="otherFilter"?(this.updateAvailable(s),this.updateExpandAll()):r==="miniFilter"&&(this.resetFilter(),this.updateExpandAll()),this.flattenItems()}updateDisplayedValuesToMatchMiniFilter(e,t,s,r,i,n){n==="reload"?this.generateItemTree(e,t,s):n==="otherFilter"&&this.updateAvailable(s),this.updateFilter(r,i),this.updateExpandAll(),this.flattenItems()}generateItemTree(e,t,s){const r=new Map;this.allDisplayedItemsTree=r;let i=!1;const n=this.getTreeListPathGetter(e,s),o=this.getKeyOnlyKeys();for(const a of t){const l=s.has(a);if(o.has(a)){const g={treeKey:a,depth:0,filterPasses:!0,expanded:!1,available:l,parentTreeKeys:[],keys:[a],keyOnly:!0};r.set(g,g);continue}const c=n(e(a))??[null],u=c.length;u>1&&(i=!0);let d=r,h,p=[];for(let g=0;g<u;g++){const f=c[g];d||(d=new Map,h.children=d);const m=f?.toUpperCase()??null;if(h=d.get(m),h||(h={treeKey:f,depth:g,filterPasses:!0,expanded:!1,available:l,parentTreeKeys:p},d.set(m,h)),g===u-1){const v=h.keys;v?v.push(a):h.keys=[a]}d=h.children,p=[...p,f]}}this.groupsExist=i,this.updateAvailable(s),this.selectAllItem.children=r,this.selectAllItem.expanded=!1}getTreeListPathGetter(e,t){if(this.treeListPathGetter)return this.treeListPathGetter;if(this.treeDataOrGrouping)return r=>r;let s=!1;for(const r of t){const i=e(r);if(i instanceof Date){s=!0;break}else if(i!=null)break}return s?r=>v5(r,!1):(this.log.warn(211),r=>[String(r)])}flattenItems(){this.activeDisplayedItemsFlat=[];const e=t=>{for(const s of t.values())!s.filterPasses||!s.available||(this.activeDisplayedItemsFlat.push(s),s.children&&s.expanded&&e(s.children))};e(this.allDisplayedItemsTree)}resetFilter(){const e=t=>{const s=t.children;if(s)for(const r of s.values())e(r);t.filterPasses=!0};for(const t of this.allDisplayedItemsTree.values())e(t)}updateFilter(e,t){const s=this.treeListFormatter,r=i=>i.available?i.treeKey==null?t:e(this.formatter(Ja(i,s))):!1;for(const i of this.allDisplayedItemsTree.values())this.recursiveItemCheck(i,!1,r,"filterPasses")}getDisplayedValueCount(){return this.activeDisplayedItemsFlat.length}getDisplayedItem(e){return this.activeDisplayedItemsFlat[e]}getSelectAllItem(){return this.selectAllItem}getAddSelectionToFilterItem(){return this.addSelectionToFilterItem}getDisplayedKeys(){const e=[];return this.forEachDisplayedKey(t=>e.push(t)),e}forEachDisplayedKey(e){const t=(s,r)=>{const i=s.keys??Jr;for(let o=0,a=i.length;o<a;++o)e(i[o]);const n=s.children;if(n&&(!s.expanded||!r))for(const o of n.values())o.filterPasses&&t(o,!1)};for(const s of this.activeDisplayedItemsFlat)t(s,!0)}someDisplayedKey(e){const t=(s,r)=>{const i=s.keys??Jr;for(let o=0,a=i.length;o<a;++o)if(e(i[o]))return!0;const n=s.children;if(n&&(!s.expanded||!r)){for(const o of n.values())if(o.filterPasses&&t(o,!1))return!0}return!1};return this.activeDisplayedItemsFlat.some(s=>t(s,!0))}hasGroups(){return this.groupsExist}refresh(){this.updateExpandAll(),this.flattenItems()}updateExpandAll(){const e=(s,r,i)=>{for(const n of s.values()){if(!n.filterPasses||!n.available||!n.children)continue;if(r=r||!!n.expanded,i=i||!n.expanded,r&&i)return;const o=e(n.children,r,i);if(o===void 0)return;o?r=!0:i=!0}return r&&i?void 0:r},t=this.getSelectAllItem();t.expanded=e(t.children,!1,!1)}recursiveItemCheck(e,t,s,r){let i=!1;const n=e.children;if(n)for(const a of n.values()){const l=this.recursiveItemCheck(a,t||s(e),s,r);i=i||l}const o=t||i||s(e);return e[r]=o,o}updateAvailable(e){const t=s=>{const r=s.keys??Jr;for(let i=0,n=r.length;i<n;++i)if(e.has(r[i]))return!0;return!1};for(const s of this.allDisplayedItemsTree.values())this.recursiveItemCheck(s,!1,t,"available")}},ff=class extends a0{constructor(){super("setFilter","set-filter"),this.filterType="set",this.eMiniFilter=Dn,this.eFilterLoading=Dn,this.eFilterLoadingIcon=Dn,this.eSetFilterList=Dn,this.hardRefreshVirtualList=!1,this.keyOnlyVersion=0,this.miniFilterText=null,this.addCurrentSelectionToFilter=!1,this.selectedKeys=new Set}setParams(e){super.setParams(e);const t=this.updateHandler(e.getHandler()),{column:s,textFormatter:r,treeList:i,treeListPathGetter:n,treeListFormatter:o}=e,a=this.beans;this.formatter=df(r,a.gos,s,"columnFilter")??Qa;const l=()=>this.handler.valueModel.keyOnlyKeys;this.displayValueModel=i?new _l(a.log,this.formatter,n,o,t.isTreeDataOrGrouping(),l):new r5(a.valueSvc,()=>this.handler.valueFormatter,this.formatter,s,l),t.valueModel.allKeys.then(c=>{this.isAlive()&&(this.updateDisplayedValues("reload",c??[]),this.resetSelectionState(c??[]))}),this.initialiseFilterBodyUi()}refresh(e){return this.params.treeList!==e.treeList?!1:(this.updateHandler(e.getHandler()),super.refresh(e))}updateParams(e,t){super.updateParams(e,t),this.updateMiniFilter(),this.eMiniFilter.setAutoComplete(e.browserAutoComplete),e.suppressSelectAll!==t.suppressSelectAll&&this.createVirtualListModel(e);const{column:s,textFormatter:r,treeListPathGetter:i,treeListFormatter:n}=e;this.formatter=df(r,this.beans.gos,s,"columnFilter")??Qa;const o=this.displayValueModel;o instanceof _l&&o.updateParams(i,n),this.redisplayValues(!0)}redisplayValues(e){const t=this.handler.valueModel;t.allKeys.then(s=>{if(this.isAlive()){this.updateDisplayedValues("reload",s??[]),this.setSelectedModel(this.state.model?.values??null);const r=t.keyOnlyVersion;(e||r!==this.keyOnlyVersion)&&(this.keyOnlyVersion=r,this.hardRefreshVirtualList=!0),this.checkAndRefreshVirtualList(),this.showOrHideResults()}})}updateHandler(e){const t=this.handler;if(t!==e){for(const i of this.handlerDestroyFuncs??[])i();const s=e.valueModel;this.handlerDestroyFuncs=[...this.addManagedListeners(e,{anyFilterChanged:i=>{e.valueModel.allKeys.then(n=>{this.isAlive()&&(this.updateDisplayedValues("otherFilter",n??[]),i.updated&&(this.checkAndRefreshVirtualList(),this.showOrHideResults()))})},dataChanged:({hardRefresh:i})=>this.redisplayValues(i)}),...this.addManagedListeners(s,{loadingStart:()=>this.setIsLoading(!0),loadingEnd:()=>this.setIsLoading(!1)})],this.handler=e,this.keyOnlyVersion=s.keyOnlyVersion;const r=s.isLoading();(t||r)&&this.setIsLoading(r)}return e}updateUiVisibility(){}createBodyTemplate(){return{tag:"div",cls:"ag-set-filter",children:[{tag:"div",ref:"eFilterLoading",cls:"ag-filter-loading ag-loading ag-hidden",role:"status",attrs:{tabindex:"-1"},children:[{tag:"span",ref:"eFilterLoadingIcon",cls:"ag-loading-icon"},{tag:"span",cls:"ag-loading-text",children:Ce(this,"loadingOoo")}]},{tag:"ag-input-text-field",ref:"eMiniFilter",cls:"ag-mini-filter"},{tag:"div",ref:"eSetFilterList",cls:"ag-set-filter-list",role:"presentation"}]}}getAgComponents(){return[Q3]}postConstruct(){super.postConstruct(),this.noMatchesComp=this.createManagedBean(new ul("ag-filter-no-matches")),this.eSetFilterList.insertAdjacentElement("beforebegin",this.noMatchesComp.getGui()),this.createManagedBean(new e5(this.getFocusableElement(),{handleKeyDown:this.handleKeyDown.bind(this)}))}handleKeyDown(e){if(e.defaultPrevented)return;const t=()=>{if(!this.eSetFilterList.contains(cf(this.beans)))return;const s=this.virtualList.getLastFocusedRow();if(s==null)return;const r=this.virtualList.getComponentAt(s);if(r==null)return;e.preventDefault();const{readOnly:i}=this.params;if(!i)return r};switch(e.key){case Xr.SPACE:t()?.toggleSelected();break;case Xr.ENTER:this.handleKeyEnter(e);break;case Xr.LEFT:t()?.setExpanded(!1);break;case Xr.RIGHT:t()?.setExpanded(!0);break}}handleKeyEnter(e){e.preventDefault();const{excelMode:t,readOnly:s}=this.params;!t||s||(this.params.onAction("apply",void 0,e),this.params.excelMode==="mac"&&this.eMiniFilter.getInputElement().select())}setModelAndRefresh(e){return this.setSelectedModel(e).then(()=>{this.isAlive()&&(this.checkAndRefreshVirtualList(),this.showOrHideResults())})}setModelIntoUi(e){this.setMiniFilter(this.params.state.state?.miniFilterValue??null,!0);const t=e==null?null:e.values;return this.setModelAndRefresh(t)}getModelFromUi(){const e=this.getSelectedModel();return e?{values:e,filterType:this.filterType}:null}areNonNullModelsEqual(e,t){return Z3(e.values,t.values)}setIsLoading(e){const t=this.eFilterLoading,s=!e&&cf(this.beans)===t;uf(t,e),e||(this.hardRefreshVirtualList=!0),s&&this.focusFirstElement()}initialiseFilterBodyUi(){this.initVirtualList(),this.initMiniFilter(),this.initLoading()}initLoading(){const e=s5("setFilterLoading",this.beans,this.params.column);e&&this.eFilterLoadingIcon.appendChild(e)}initVirtualList(){const e=Ce(this,"ariaFilterList"),t=!!this.params.treeList,s=this.virtualList=this.createBean(new Gs({cssIdentifier:"filter",ariaRole:t?"tree":"listbox",listName:e})),r=this.eSetFilterList;t&&r.classList.add("ag-set-filter-tree-list"),r.appendChild(s.getGui());const{cellHeight:i}=this.params;i!=null&&s.setRowHeight(i);const n=(a,l)=>this.createSetListItem(a,t,l);s.setComponentCreator(n);const o=(a,l)=>this.updateSetListItem(a,l);s.setComponentUpdater(o),this.createVirtualListModel(this.params)}createVirtualListModel(e){let t;e.suppressSelectAll?t=new C5(this.displayValueModel):t=new b5(this.displayValueModel,this.showAddCurrentSelectionToFilter.bind(this)),e.treeList&&(t=new S5(t)),this.virtualList.setModel(t)}getSelectAllLabel(){const e=this.miniFilterText==null||!this.params.excelMode?"selectAll":"selectAllSearchResults";return Ce(this,e)}getAddSelectionToFilterLabel(){return Ce(this,"addCurrentSelectionToFilter")}createSetListItem(e,t,s){const r=this.displayValueModel.hasGroups(),{isSelected:i,isExpanded:n}=this.isSelectedExpanded(e),{value:o,depth:a,isGroup:l,hasIndeterminateExpandState:c,isKeyOnly:u,selectedListener:d,expandedListener:h}=this.newSetListItemAttributes(e),p={focusWrapper:s,value:o,params:this.params,translate:f=>Ce(this,f),valueFormatter:this.handler.valueFormatter,item:e,isSelected:i,isTree:t,depth:a,groupsExist:r,isGroup:l,isExpanded:n,hasIndeterminateExpandState:c,isMissing:this.isItemMissing(e),isKeyOnly:!!u},g=this.createBean(new m5(p));return g.addEventListener("selectionChanged",d),h&&g.addEventListener("expandedChanged",h),g}newSetTreeItemAttributes(e){const t=this.displayValueModel,s=t.hasGroups();if(e===t.getSelectAllItem())return{value:()=>this.getSelectAllLabel(),isGroup:s,depth:e.depth,hasIndeterminateExpandState:!0,selectedListener:i=>this.onSelectAll(i.isSelected),expandedListener:i=>this.onExpandAll(i.item,i.isExpanded)};if(e===t.getAddSelectionToFilterItem())return{value:()=>this.getAddSelectionToFilterLabel(),depth:e.depth,isGroup:!1,hasIndeterminateExpandState:!1,selectedListener:i=>{this.addCurrentSelectionToFilter=i.isSelected,this.refreshAfterSelection()}};const r=e.children;return{value:Ja(e,this.params.treeListFormatter)??e.treeKey,depth:e.depth,isGroup:!!r,isKeyOnly:e.keyOnly,selectedListener:i=>this.onTreeItemSelected(i.item,i.isSelected),expandedListener:r?i=>this.onExpandedChanged(i.item,i.isExpanded):void 0}}newSetListItemAttributes(e){if(this.isSetFilterModelTreeItem(e))return this.newSetTreeItemAttributes(e);if(e===Ln)return{value:()=>this.getSelectAllLabel(),selectedListener:r=>this.onSelectAll(r.isSelected)};if(e===kn)return{value:()=>this.getAddSelectionToFilterLabel(),selectedListener:r=>{this.addCurrentSelectionToFilter=r.isSelected,this.refreshAfterSelection()}};const t=this.handler.valueModel,s=t.keyOnlyKeys.has(e);return{value:s?()=>this.handler.getFormattedValue(e):t.allValues.get(e)??null,isKeyOnly:s,selectedListener:r=>this.onItemSelected(r.item,r.isSelected)}}updateSetListItem(e,t){const{isSelected:s,isExpanded:r}=this.isSelectedExpanded(e);t.refresh(e,s,r,this.isItemMissing(e))}isItemMissing(e){const t=this.handler.valueModel.missingKeys;if(!t.size)return!1;if(this.isSetFilterModelTreeItem(e)){const s=this.displayValueModel;return e!==s.getSelectAllItem()&&e!==s.getAddSelectionToFilterItem()&&Dp(e,t)}return t.has(e)}isSelectedExpanded(e){let t,s;if(this.isSetFilterModelTreeItem(e)){const r=this.displayValueModel;s=e.expanded,e===r.getSelectAllItem()?t=this.isSelectAllSelected():e===r.getAddSelectionToFilterItem()?t=this.isAddCurrentSelectionToFilterChecked():t=this.isTreeItemSelected(e)}else e===Ln?t=this.isSelectAllSelected():e===kn?t=this.isAddCurrentSelectionToFilterChecked():t=this.selectedKeys.has(e);return{isSelected:t,isExpanded:s}}isSetFilterModelTreeItem(e){return e?.treeKey!==void 0}initMiniFilter(){const{eMiniFilter:e,params:t}=this;e.setClearButtonEnabled(!0).setSearchIcon(!0).setAutoComplete(t.browserAutoComplete),this.updateMiniFilter(),e.onValueChange(()=>this.onMiniFilterInput()).onValueClear(()=>this.onMiniFilterInput(!0)),e.setInputAriaLabel(Ce(this,"ariaSearchFilterValues")),this.addManagedElementListeners(e.getInputElement(),{keydown:s=>this.onMiniFilterKeyDown(s)})}updateMiniFilter(){const{eMiniFilter:e,miniFilterText:t,params:s}=this;e.setDisplayed(!s.suppressMiniFilter),e.setValue(t)}afterGuiAttached(e){super.afterGuiAttached(e),this.resetExpansion(),this.refreshVirtualList(),this.eMiniFilter.setInputPlaceholder(Ce(this,"searchOoo")),e?.suppressFocus||this.focusFirstElement()}focusFirstElement(){const{eMiniFilter:e,eFilterLoading:t}=this;this.handler.valueModel.isLoading()?t.focus():e.isDisplayed()?e.getFocusableElement().focus():this.virtualList.awaitStable(()=>this.virtualList.focusRow(0))}afterGuiDetached(){super.afterGuiDetached(),this.noMatchesComp.cancelAnnouncement();const{column:e,excelMode:t,model:s,onStateChange:r}=this.params;this.beans.colFilter?.shouldKeepStateOnDetach(e)||(t&&this.resetMiniFilter(),(t||s!==this.state.model)&&(r({model:s,state:this.getState()}),this.showOrHideResults()))}canApply(e){return this.params.excelMode?e==null||e.values.length>0:!0}onNewRowsLoaded(){}setFilterValues(e){this.beans.log.warn(283),this.handler.setFilterValues(e)}resetFilterValues(){this.beans.log.warn(283),this.handler.resetFilterValues()}refreshFilterValues(){this.beans.log.warn(283),this.doRefreshFilterValues()}doRefreshFilterValues(){this.handler.refreshFilterValues()}onAnyFilterChanged(){}onMiniFilterInput(e=!1,t="ui"){if(!this.doSetMiniFilter(this.eMiniFilter.getValue()))return;if(t==="state"){this.showOrHideResults();return}const{applyMiniFilterWhileTyping:s,readOnly:r,excelMode:i}=this.params,n=!r&&(s||!!i),o=e&&n?"immediately":s&&!r?"debounce":void 0;this.updateUiAfterMiniFilterChange(n,o,t==="ui")}updateUiAfterMiniFilterChange(e,t,s){let r=t;if(e){const{excelMode:i,readOnly:n,model:o}=this.params;i&&!n&&this.miniFilterText==null?(this.setModelAndRefresh(o?.values??null),r==="immediately"&&(r=void 0)):this.selectAllMatchingMiniFilter(!0)}this.checkAndRefreshVirtualList(),this.onUiChanged(e?r:"prevent"),this.showOrHideResults(s)}showOrHideResults(e=!1){const t=this.miniFilterText!=null&&this.displayValueModel.getDisplayedValueCount()<1;this.noMatchesComp.setNoMatches(t,e),uf(this.eSetFilterList,!t)}resetMiniFilter(){this.eMiniFilter.setValue(null,!0),this.doSetMiniFilter(null)}onMiniFilterKeyDown(e){const{excelMode:t,readOnly:s}=this.params;e.key===Xr.ENTER&&!t&&!s&&this.updateUiAfterMiniFilterChange(!0,"immediately",!0)}focusRowIfAlive(e){return e==null?Promise.resolve():new Promise(t=>{window.setTimeout(()=>{this.isAlive()&&this.virtualList.focusRow(e),t()},0)})}onSelectAll(e){e?this.selectAllMatchingMiniFilter():this.deselectAllMatchingMiniFilter(),this.refreshAfterSelection()}onTreeItemSelected(e,t){const s=r=>{if(!r.filterPasses)return;const i=r.keys??Jr;for(let o=0,a=i.length;o<a;++o)this.setKeySelected(i[o],t);const n=r.children;if(n)for(const o of n.values())s(o)};s(e),this.refreshAfterSelection()}onItemSelected(e,t){this.setKeySelected(e,t),this.refreshAfterSelection()}onExpandAll(e,t){const s=r=>{if(r.filterPasses&&r.available&&r.children){for(const i of r.children.values())s(i);r.expanded=t}};s(e),this.refreshAfterExpansion()}onExpandedChanged(e,t){e.expanded=t,this.refreshAfterExpansion()}refreshAfterExpansion(){const e=this.virtualList.getLastFocusedRow();this.updateDisplayedValues("expansion"),this.checkAndRefreshVirtualList(),this.focusRowIfAlive(e)}refreshAfterSelection(){const e=this.virtualList.getLastFocusedRow();this.checkAndRefreshVirtualList(),this.onUiChanged(),this.focusRowIfAlive(e)}setMiniFilter(e,t){this.eMiniFilter.setValue(e,!0),this.onMiniFilterInput(!1,t?"state":"api")}doSetMiniFilter(e){return e=J3(e),this.miniFilterText===e?!1:(e===null&&(this.addCurrentSelectionToFilter=!1),this.miniFilterText=e,this.updateDisplayedValues("miniFilter"),!0)}getMiniFilter(){return this.miniFilterText}getUiChangeEventParams(){return{miniFilterValue:this.miniFilterText}}getState(){const e=this.miniFilterText;return e?{miniFilterValue:e}:void 0}checkAndRefreshVirtualList(){this.virtualList.refresh(!this.hardRefreshVirtualList),this.hardRefreshVirtualList&&(this.hardRefreshVirtualList=!1)}getFilterKeys(){return this.beans.log.warn(283),this.handler.getFilterKeys()}getFilterValues(){return this.beans.log.warn(283),this.handler.getFilterValues()}refreshVirtualList(){this.params.refreshValuesOnOpen?this.doRefreshFilterValues():this.checkAndRefreshVirtualList()}isSelectAllSelected(){if(this.params.defaultToNothingSelected){if(this.hasSelections()&&this.isEverythingVisibleSelected())return!0;if(this.isNothingVisibleSelected())return!1}else{if(this.hasSelections()&&this.isNothingVisibleSelected())return!1;if(this.isEverythingVisibleSelected())return!0}}isTreeItemSelected(e){const t=s=>{let r=!1,i=!1;const n=s.keys??Jr;for(let a=0,l=n.length;a<l;++a)this.selectedKeys.has(n[a])?r=!0:i=!0;const o=s.children;if(o)for(const a of o.values()){if(!a.filterPasses||!a.available)continue;const l=t(a);if(l===void 0)return;l?r=!0:i=!0}return r&&i?void 0:r};return this.params.defaultToNothingSelected?this.hasSelections()&&t(e):t(e)}resetExpansion(){if(!this.params.treeList)return;const e=this.displayValueModel.getSelectAllItem();if(this.isSetFilterModelTreeItem(e)){const t=s=>{const r=s.children;if(r){for(const i of r.values())t(i);s.expanded=!1}};t(e),this.updateDisplayedValues("expansion")}}getModelAsString(e){return this.handler.getModelAsString(e)}getPositionableElement(){return this.eSetFilterList}updateDisplayedValues(e,t){if(e==="expansion"){this.displayValueModel.refresh();return}const s=this.handler,r=s.valueModel;if(this.miniFilterText==null){this.displayValueModel.updateDisplayedValuesToAllAvailable(a=>r.allValues.get(a)??null,t,r.displayableKeys,e);return}const i=s.caseFormat(this.formatter(this.miniFilterText)||""),n=a=>a!=null&&s.caseFormat(a).includes(i),o=!!this.params.excelMode&&n(Ce(this,"blanks"));this.displayValueModel.updateDisplayedValuesToMatchMiniFilter(a=>r.allValues.get(a)??null,t,r.displayableKeys,n,o,e)}hasSelections(){return this.params.defaultToNothingSelected?this.selectedKeys.size>0:this.handler.valueModel.allValues.size!==this.selectedKeys.size}isInWindowsExcelMode(){return this.params.excelMode==="windows"}isAddCurrentSelectionToFilterChecked(){return this.isInWindowsExcelMode()&&this.addCurrentSelectionToFilter}showAddCurrentSelectionToFilter(){return this.isInWindowsExcelMode()&&X3(this.miniFilterText)&&this.miniFilterText.length>0}selectAllMatchingMiniFilter(e=!1){this.miniFilterText==null?this.selectedKeys=new Set(this.handler.valueModel.allValues.keys()):(e&&this.selectedKeys.clear(),this.displayValueModel.forEachDisplayedKey(t=>this.selectedKeys.add(t)))}deselectAllMatchingMiniFilter(){this.miniFilterText==null?this.selectedKeys.clear():this.displayValueModel.forEachDisplayedKey(e=>this.selectedKeys.delete(e))}setKeySelected(e,t){t?this.selectedKeys.add(e):(this.params.excelMode&&this.isEverythingVisibleSelected()&&this.resetSelectionState(this.displayValueModel.getDisplayedKeys()),this.selectedKeys.delete(e))}isEverythingVisibleSelected(){return!this.displayValueModel.someDisplayedKey(e=>!this.selectedKeys.has(e))}isNothingVisibleSelected(){return!this.displayValueModel.someDisplayedKey(e=>this.selectedKeys.has(e))}getSelectedModel(){if(!this.hasSelections())return null;const e=this.isAddCurrentSelectionToFilterChecked()?this.params.model?.values:void 0;if(e?.length){if(this.selectedKeys){const t=new Set([...e,...this.selectedKeys]);return Array.from(t)}return Array.from(e)}return Array.from(this.selectedKeys)}setSelectedModel(e){const t=this.handler,s=t.valueModel;return s.allKeys.then(r=>{if(e==null)this.resetSelectionState(r??[]);else{const i=this.selectedKeys;i.clear();const n=s.mapFormattedKeys();e.forEach(o=>{const a=t.caseFormat(Rt(o)),l=n.get(a);l!==void 0&&i.add(l)})}})}resetSelectionState(e){this.params.defaultToNothingSelected?this.selectedKeys.clear():this.selectedKeys=new Set(e)}getFilterHandler(){return this.handler}destroy(){this.virtualList=this.destroyBean(this.virtualList);for(const e of this.handlerDestroyFuncs??[])e();this.handler=void 0,this.displayValueModel=void 0,this.selectedKeys.clear(),super.destroy()}},C5=class{constructor(e){this.model=e}getRowCount(){return this.model.getDisplayedValueCount()}getRow(e){return this.model.getDisplayedItem(e)}areRowsEqual(e,t){return e===t}},b5=class{constructor(e,t){this.model=e,this.showAddCurrentSelectionToFilter=t}getRowCount(){const t=this.showAddCurrentSelectionToFilter()?2:1;return this.model.getDisplayedValueCount()+t}getRow(e){if(e===0)return this.model.getSelectAllItem();const t=this.showAddCurrentSelectionToFilter(),s=t?2:1;return e===1&&t?this.model.getAddSelectionToFilterItem():this.model.getDisplayedItem(e-s)}areRowsEqual(e,t){return e===t}},S5=class{constructor(e){this.model=e}getRowCount(){return this.model.getRowCount()}getRow(e){return this.model.getRow(e)}areRowsEqual(e,t){return e==null&&t==null?!0:e?.treeKey===t?.treeKey&&e?.depth===t?.depth&&e?.keyOnly===t?.keyOnly}};import{_areEqual as y5,_debounce as w5,_last as x5,_toStringOrNull as Gl}from"ag-stack";import{BeanStub as F5,_addGridCommonParams as T5,_bindFilterCallback as A5,_getFilterValueSource as P5,_isBlank as R5,_isClientSideRowModel as M5}from"ag-grid-community";import{BeanStub as I5}from"ag-grid-community";var E5=class extends l0{constructor(e,t,s){super(),this.caseFormat=e,this.isTreeDataOrGrouping=t,this.isTreeData=s}extractUniqueValues(e,t){const s=new Map,r=this.caseFormat,i=t&&tl(t.keys(),r),n=new Set,o=this.isTreeData(),a=this.isTreeDataOrGrouping(),l=this.beans,c=l.rowGroupColsSvc?.columns,u=this.gos.get("groupAllowUnbalanced"),d=(h,p)=>{const g=r(h);if(!n.has(g)){n.add(g);let f=h,m=Rt(p);const v=i?.get(g);v!=null&&(f=v,m=t.get(v)),s.set(f,m)}};return l.rowModel.forEachLeafNode(h=>{if(!h.data||e&&!e(h))return;if(a){this.addValueForTreeDataOrGrouping(h,o,c,d,u);return}const p=this.getValue(h);if(p!=null&&Array.isArray(p)){for(const g of p)d(this.createKey(g,h),g);p.length===0&&d(null,null)}else d(this.createKey(p,h),p)}),s}addValueForTreeDataOrGrouping(e,t,s=[],r,i){let n;if(t){if(e.childrenAfterGroup?.length)return;n=e.getRoute()??[e.key??e.id]}else n=s.map(a=>this.beans.valueSvc.getKeyForNode(a,e)),n.push(this.getValue(e));const o=el(n,t,i);r(this.createKey(o),o)}},Ol=class{constructor(e){this.caseFormat=e,this.keys=null}isNull(){return this.keys==null}isEmpty(){return!this.keys?.size}update(e){const t=new Set;this.keys=t;const s=e?.values;if(s){const r=this.caseFormat;for(let i=0,n=s.length;i<n;i++)t.add(r(s[i]))}}has(e){return!!this.keys?.has(this.caseFormat(e))}destroy(){this.keys=null}};import{_defaultComparator as Nl}from"ag-stack";import{AgPromise as Bl,BeanStub as D5,_addGridCommonParams as L5}from"ag-grid-community";var k5=1e3,_5=class extends c0{constructor(e,t,s,r,i){super(),this.csrmValuesExtractor=e,this.caseFormat=t,this.isTreeDataOrGrouping=s,this.isKeyChecked=r,this.params=i,this.allValues=new Map,this.availableKeys=new Set,this.missingKeys=new Set,this.keyOnlyKeys=new Set,this.valuesSeen=!1,this.keyOnlyVersion=0,this.displayableKeys=this.availableKeys,this.providedValues=null,this.initialised=!1}postConstruct(){this.csrmValuesExtractor&&this.addManagedEventListeners({rowCountReady:()=>this.readRowsWhenReady?.()});const e=this.params;this.updateParams(e),this.setProvidedValues(e.handlerParams.filterParams.values),this.updateAllValues()}refresh(e,t){const s=e.handlerParams;if(s.source!=="colDef")return!1;this.colDefLoad=void 0;const r=s.filterParams.values,i=this.params.handlerParams,n=(r??null)!==(i.filterParams.values??null);if(this.updateParams(e),n)return this.setProvidedValues(r),this.colDefLoad=this.updateAllValues(t),!0;if(t){const o=this.current;return o&&!o.answered&&this.isPreserving()?(o.replace=!0,this.colDefLoad=this.allKeys,!1):(this.colDefLoad=this.updateAllValues(!0),!0)}if(this.current?.answered&&G5(i,s)){const o=this.sortKeys(this.allValues),a=this.availableKeys,l=new Set;for(let c=0,u=o.length;c<u;++c){const d=o[c];a.has(d)&&l.add(d)}this.allKeys=Bl.resolve(o),this.availableKeys=l,this.updateDisplayableKeys(o)}return!1}setProvidedValues(e){this.providedValues=e??null,mf(e)?Array.isArray(e)?this.valuesType=0:this.valuesType=1:this.valuesType=2}refreshValues(e){if(!e)return this.updateAllValues();let t=this.colDefLoad;return t||(t=this.updateAllValues(),this.colDefLoad=t),t}updateParams(e){this.params=e;const{handlerParams:{colDef:t,getValue:s,filterParams:{comparator:r,treeList:i,treeListPathGetter:n}},createKey:o,usingComplexObjects:a}=e,l=this.csrmValuesExtractor;l&&(l.createKey=o,l.getValue=s);const c=r??t.comparator,u=this.isTreeDataOrGrouping();let d;u&&!c?d=KG:i&&!n&&!c?d=Nl:d=c,this.valueComparator=d,this.keyComparator=c??Nl,this.compareByValue=!!(a&&c||u||i&&!n)}updateAllValues(e=!1){const{valuesType:t,providedValues:s}=this,r=this.current,i=this.isLoading(),n=t===1,o={settle:()=>{},answered:!1,fromCallback:n,replace:e||!!r&&!r.answered&&r.replace};return this.current=o,this.readRowsWhenReady=void 0,i!==n&&this.dispatchLocalEvent({type:n?"loadingStart":"loadingEnd"}),this.allKeys=new Bl(a=>{o.settle=a;const l=c=>{o.answered=!0,n&&this.dispatchLocalEvent({type:"loadingEnd"}),a(this.processAllValues(c,o.replace))};switch(t){case 2:{const c=()=>{this.readRowsWhenReady=void 0,l(this.getValuesFromRows(null))};!this.csrmValuesExtractor||this.beans.rowModel.rowCountReady?c():this.readRowsWhenReady=c;break}case 0:{l(this.uniqueValues(this.validateProvidedValues(s)));break}case 1:{const c=s,{column:u,colDef:d}=this.params.handlerParams,h=L5(this.gos,{success:p=>{this.current===o&&this.isAlive()&&!o.answered&&l(this.uniqueValues(this.validateProvidedValues(p)))},colDef:d,column:u});window.setTimeout(()=>{this.current===o&&this.isAlive()&&c(h)},0);break}}}),this.allKeys.then(a=>{this.current===o&&(this.updateAvailableKeys(a??[]),this.initialised=!0)}),r&&!r.answered&&this.allKeys.then(r.settle),this.allKeys}getAvailableValues(e){return this.sortKeys(this.getValuesFromRows(e))}refreshAvailable(){return new Bl(e=>{if(this.isValuesTakenFromGrid()){this.allKeys.then(t=>{const s=t??[];this.updateAvailableKeys(s),e(!0)});return}e(!1)})}isLoading(){const e=this.current;return!!e&&!e.answered&&e.fromCallback}getValueForFormatter(e){return this.initialised?this.allValues.get(e):e}getDisplayableKeys(e){return this.initialised?e.filter(t=>this.displayableKeys.has(t)):e}isPreserving(){return!!this.params.handlerParams.filterParams.preservePreviousValues}addKeyOnlyKeys(e){const{allValues:t,keyOnlyKeys:s,missingKeys:r,caseFormat:i}=this,n=this.getFormattedKeyIndex();for(let o=0,a=e.length;o<a;++o){const l=e[o];t.set(l,null),s.add(l),r.add(l),n.set(i(l),l)}e.length&&++this.keyOnlyVersion,this.resortKeys()}clearMissing(e){for(const t of this.missingKeys)e(t)||this.dropKey(t);return this.resortKeys()}resortKeys(){return this.allKeys=this.allKeys.then(()=>{const e=this.sortKeys(this.allValues);return this.updateDisplayableKeys(e),e}),this.allKeys}mapFormattedKeys(e){return tl(e?this.availableKeys:this.allValues.keys(),this.caseFormat)}getValuesFromRows(e){const t=this.csrmValuesExtractor;if(!t)return this.error(113),null;const s=e&&!this.params.handlerParams.filterParams.caseSensitive?this.allValues:void 0;return t.extractUniqueValues(e,s)}processAllValues(e,t){const s=e??new Map;return s.size&&(this.valuesSeen=!0),this.isPreserving()&&!t?this.mergeValues(s):(this.keyOnlyKeys.size&&++this.keyOnlyVersion,this.missingKeys.clear(),this.keyOnlyKeys.clear(),this.formattedKeyIndex=void 0,this.allValues=s),this.sortKeys(this.allValues)}mergeValues(e){const{caseFormat:t,missingKeys:s,keyOnlyKeys:r}=this,i=this.allValues,n=this.getFormattedKeyIndex();let o;const a=r.size;e.forEach(function(c,u){const d=t(u);let h=n.get(d);h!==void 0&&r.size&&r.has(h)&&(i.delete(h),r.delete(h),s.delete(h),h=void 0),h===void 0&&(h=u,n.set(d,h)),h===u?i.set(h,c):(o??(o=new Set),o.add(h)),s.size&&s.delete(h)}),r.size!==a&&++this.keyOnlyVersion,i.forEach(function(c,u){!e.has(u)&&!o?.has(u)&&s.add(u)}),this.evictMissing()}findKey(e){return this.getFormattedKeyIndex().get(this.caseFormat(e))}getFormattedKeyIndex(){let e=this.formattedKeyIndex;return e||(e=tl(this.allValues.keys(),this.caseFormat),this.formattedKeyIndex=e),e}evictMissing(){const e=this.params.handlerParams.filterParams.preservePreviousValuesLimit??k5,{missingKeys:t,isKeyChecked:s}=this;if(e<0||t.size<=e)return;const r=Array.from(t).filter(i=>!s(i));for(let i=0,n=r.length-e;i<n;++i)this.dropKey(r[i])}dropKey(e){this.allValues.delete(e),this.missingKeys.delete(e),this.keyOnlyKeys.delete(e)&&++this.keyOnlyVersion,this.formattedKeyIndex?.delete(this.caseFormat(e))}uniqueValues(e){const t=new Map,s=new Set,r=this.caseFormat,i=this.params.createKey;for(const n of e??[]){const o=Rt(n),a=i(o),l=r(a);s.has(l)||(s.add(l),t.set(a,o))}return t}validateProvidedValues(e){if(this.params.userKeyCreator&&e?.length){const t=e[0];t&&typeof t!="object"&&typeof t!="function"&&(this.params.createKey(t)==null?this.warn(209):this.warn(210))}return e}sortKeys(e){const t=e??new Map,s=this.params.handlerParams.filterParams,r=this.keyOnlyKeys.size>0&&t===this.allValues?this.keyOnlyKeys:void 0;if(s.suppressSorting){if(!r)return Array.from(t.keys());const l=[];t.forEach(function(u,d){r.has(d)||l.push(d)});for(const c of r)l.push(c);return l}const i=!!s.excelMode&&t.has(null),n=[],o=this.compareByValue?[]:void 0;t.forEach(function(c,u){u===null&&i||r?.has(u)||(n.push(u),o&&o.push(c))});let a;if(o){const l=this.valueComparator,c=n.length,u=[];for(let d=0;d<c;++d)u.push(d);u.sort(function(h,p){return l(o[h],o[p])}),a=[];for(let d=0;d<c;++d)a.push(n[u[d]])}else a=n.sort(this.keyComparator);if(r){const l=Array.from(r).sort(Nl);for(let c=0,u=l.length;c<u;++c){const d=l[c];(d!==null||!i)&&a.push(d)}}return i&&a.push(null),a}updateDisplayableKeys(e){const{availableKeys:t,missingKeys:s}=this;if(!s.size&&!this.isPreserving()){this.displayableKeys=t;return}const r=new Set;for(let i=0,n=e.length;i<n;++i){const o=e[i];(t.has(o)||s.has(o))&&r.add(o)}this.displayableKeys=r}isValuesTakenFromGrid(){return this.valuesType===2}updateAvailableKeys(e){const t=this.missingKeys;let s;this.isValuesTakenFromGrid()?s=this.getAvailableValues(r=>this.params.handlerParams.doesRowPassOtherFilter(r)):t.size?s=e.filter(r=>!t.has(r)):s=e,this.availableKeys=new Set(s),this.updateDisplayableKeys(e),window.setTimeout(()=>{this.isAlive()&&this.dispatchLocalEvent({type:"availableValuesChanged"})})}},G5=(e,t)=>{const s=e.filterParams,r=t.filterParams;return s.suppressSorting!==r.suppressSorting||s.excelMode!==r.excelMode||s.comparator!==r.comparator||e.colDef.comparator!==t.colDef.comparator||s.treeList!==r.treeList||!!s.treeListPathGetter!=!!r.treeListPathGetter},mf=e=>e!=null,O5=class extends u0{constructor(){super(...arguments),this.filterType="set",this.heldKeys=[],this.treeDataTreeList=!1,this.groupingTreeList=!1,this.caseSensitive=!1,this.keyShape="",this.noValueFormatterSupplied=!1}init(e){const t=this.caseFormat.bind(this);this.appliedModel=new Ol(t),this.heldKeyIndex=new Ol(t),this.colId=e.column.getColId(),this.beans.setFilterSvc.addHandler(this.colId,this);const s=this.updateParams(e);this.appliedModel.update(e.model);const r=this.isTreeDataOrGrouping.bind(this),i=()=>this.treeDataTreeList,{gos:n,beans:o}=this,a=M5(n,o.rowModel)?this.createManagedBean(new E5(t,r,i)):void 0,l=this.createManagedBean(new _5(a,t,r,this.isKeyChecked.bind(this),s));this.addManagedListeners(l,{availableValuesChanged:e.onModelAsStringChange}),this.valueModel=l,this.keyShape=this.getKeyShape(),this.validateModel(),this.addEventListenersForDataChanges()}refresh(e){const{keysFormedBy:t,valueSource:s,caseSensitive:r,valueModel:i}=this,n=i.isPreserving(),o=e.filterParams.values,a=i.isValuesTakenFromGrid()||(o??null)!==(this.params.filterParams.values??null)&&!mf(o),l=this.isTreeDataOrGrouping(),c=this.updateParams(e),u=this.valueSource,d=e.source==="colDef"&&(this.keysFormedBy!==t||this.caseSensitive!==r||this.isTreeDataOrGrouping()!==l||a&&(u.source!==s.source||u.kind!==s.kind||u.readsFormula!==s.readsFormula)),h=d&&!!this.beans.dataTypeSvc?.isInferring(),p=e.model;if(d&&!h&&p!=null)return!1;this.appliedModel.update(p),this.heldKeyIndex.update({filterType:"set",values:this.heldKeys});const g=n&&!e.filterParams.preservePreviousValues;g&&this.clearMissing(!1);const f=d&&!(h&&i.isValuesTakenFromGrid());return f&&(this.keyShape=this.getKeyShape()),i.refresh(c,f)&&this.reloadValues(!0),this.validateModel(void 0,void 0,g&&i.valuesSeen),!0}getKeyShape(){if(this.treeDataTreeList)return"treeData";if(!this.groupingTreeList)return"";const e=this.beans.rowGroupColsSvc.columns.map(t=>t.getColId()).join();return`${this.gos.get("groupAllowUnbalanced")}${e}`}rekeyIfGroupingChanged(){const{colDef:e,filterParams:t}=this.params,s=this.valueModel;if(!e.showRowGroup||!t.treeList||!s.isPreserving())return!1;s.updateParams(this.updateParams(this.params));const r=this.getKeyShape(),i=r!==this.keyShape&&s.isValuesTakenFromGrid();return this.keyShape=r,i?(s.allKeys.then(()=>{s.updateAllValues(!0).then(()=>{this.dispatchLocalEvent({type:"dataChanged"}),this.keepModelKeys(void 0,!0)})}),!0):!1}isKeyChecked(e){return this.appliedModel.has(e)||this.heldKeyIndex.has(e)}holdKeys(e){y5(this.heldKeys,e)||(this.heldKeys=e,this.heldKeyIndex.update({filterType:"set",values:e}),this.validateModel())}updateParams(e){this.params=e;const{colDef:t,filterValueGetter:s,filterParams:{caseSensitive:r,treeList:i,keyCreator:n,valueFormatter:o}}=e;this.caseSensitive=!!r;const a=!!t.showRowGroup;this.treeDataTreeList=this.gos.get("treeData")&&!!i&&a,this.groupingTreeList=!!this.beans.rowGroupColsSvc?.columns.length&&!!i&&a;const l=n??t.keyCreator,c=!!l&&l===Lp(this.beans,t);return this.keysFormedBy=c?t.valueFormatter:l,this.valueSource=P5(t,s),this.createKey=this.generateCreateKey(l,this.isTreeDataOrGrouping()),this.setValueFormatter(o,l,!!i,!!t.refData),{handlerParams:e,createKey:this.createKey,usingComplexObjects:!!l,userKeyCreator:!!l&&!c}}doesFilterPass(e){const t=this.appliedModel;return t.isNull()?!0:t.isEmpty()?!1:this.matchesKeys(e.node,t)??!1}createKeysMatcher(e){const t=new Ol(this.caseFormat.bind(this));let s=this.caseSensitive;return t.update({filterType:"set",values:e}),r=>(s!==this.caseSensitive&&(s=this.caseSensitive,t.update({filterType:"set",values:e})),this.matchesKeys(r,t))}matchesKeys(e,t){if(this.treeDataTreeList)return this.doesFilterPassForTreeData(e,t);if(this.groupingTreeList)return this.doesFilterPassForGrouping(e,t);const s=this.params.getValue(e);return s!=null&&Array.isArray(s)?s.length===0?t.has(null):s.some(r=>t.has(this.createKey(r,e))):t.has(this.createKey(s,e))}createDisplayValueTree(e){const t=this.params.filterParams,s=new _l(this.beans.log,A5(t.textFormatter,this.beans.gos,this.params.column,"columnFilter")??Qa,t.treeListPathGetter,t.treeListFormatter,this.isTreeDataOrGrouping(),()=>this.valueModel.keyOnlyKeys);return s.updateDisplayedValuesToAllAvailable(r=>this.valueModel.getValueForFormatter(r),e,new Set(e),"reload"),s.getSelectAllItem().children}getFormattedValue(e){const t=this.valueModel;if(t.keyOnlyKeys.has(e))return e??Ce(this,"blanks");let s=t.getValueForFormatter(e);return this.noValueFormatterSupplied&&this.isTreeDataOrGrouping()&&Array.isArray(s)&&(s=x5(s)),kp(this.beans,this.params.column,s,this.valueFormatter)??Gl(s)??Ce(this,"blanks")}getModelAsString(e,t){const{values:s}=e??{},r=t==="filterToolPanel";if(s==null)return r?Ce(this,"filterSummaryListInactive"):"";const i=this.valueModel.getDisplayableKeys(s),n=i.length,o=r?3:10,a=i.slice(0,o).map(l=>this.getFormattedValue(l));if(r){const l=a.join(Ce(this,"filterSummaryListSeparator"));return n>3?Ce(this,"filterSummaryListLong",[l,String(n-3)]):Ce(this,"filterSummaryListShort",[l])}return`(${n}) ${a.join(",")}${n>10?",...":""}`}onAnyFilterChanged(){window.setTimeout(()=>{this.isAlive()&&this.valueModel.refreshAvailable().then(e=>{this.dispatchLocalEvent({type:"anyFilterChanged",updated:!!e})})})}onNewRowsLoaded(){this.onRowsLoaded(!1)}onNewRowsLoadedForColDef(){this.onRowsLoaded(!0)}onRowsLoaded(e){this.rekeyIfGroupingChanged()||this.syncAfterDataChange(e)}setFilterValues(e){this.valueModel.setProvidedValues(e),this.refreshFilterValues()}resetFilterValues(){this.valueModel.setProvidedValues(void 0),this.syncAfterDataChange(!1)}refreshFilterValues(){this.reloadValues(!1)}reloadValues(e){this.valueModel.refreshValues(e).then(()=>{this.dispatchLocalEvent({type:"dataChanged",hardRefresh:!0}),this.validateModel(void 0,!e)})}clearOwnPreservedValues(e){this.valueModel.isPreserving()&&this.valueModel.allKeys.then(()=>{this.clearMissing(e).then(()=>{e||this.reconcileModel(void 0,!1,!0)})})}clearMissing(e){const{valueModel:t,heldKeyIndex:s}=this,r=t.missingKeys.size,i=t.clearMissing(e?n=>this.isKeyChecked(n):n=>s.has(n));return t.missingKeys.size===r?i:i.then(()=>this.dispatchLocalEvent({type:"dataChanged",hardRefresh:!0}))}getFilterKeys(){return Array.from(this.valueModel.allValues.keys())}getFilterValues(){return Array.from(this.valueModel.allValues.values())}isTreeDataOrGrouping(){return this.treeDataTreeList||this.groupingTreeList}caseFormat(e){return e==null||typeof e!="string"||this.caseSensitive?e:e.toUpperCase()}addEventListenersForDataChanges(){this.addManagedPropertyListeners(["groupAllowUnbalanced"],()=>this.onNewRowsLoaded());const e=w5(this,()=>this.syncAfterDataChange(!1),0);this.addManagedEventListeners({columnRowGroupChanged:()=>{this.rekeyIfGroupingChanged()},cellValueChanged:t=>{t.column===this.params.column&&e()},dataTypesInferred:()=>e()})}syncAfterDataChange(e){const t=this.valueModel;t.isValuesTakenFromGrid()&&t.refreshValues(e).then(()=>{this.dispatchLocalEvent({type:"dataChanged"}),this.validateModel({afterDataChange:!0})})}validateModel(e,t,s){const r=this.params,i=r.model;if(i!=null&&!Array.isArray(i.values)){this.params={...r,model:null},r.onModelChange(null,e);return}const n=this.valueModel;n.allKeys.then(()=>{n.isPreserving()?this.keepModelKeys(e):this.reconcileModel(e,t,s)})}reconcileModel(e,t,s){const r=this.params,i=r.model;if(i==null)return;const n=this.valueModel,o=n.mapFormattedKeys(t),a=n.isValuesTakenFromGrid(),l=i.values;if(a&&!s&&o.size===0&&l.length>0)return;const c=[];let u=!1;for(const g of l){const f=this.caseFormat(Rt(g)),m=o.get(f);m!==void 0?(o.delete(f),c.push(m),m!==g&&(u=!0)):u=!0}const d=r.filterParams;if(c.length===0&&d.excelMode){r.onModelChange(null,e);return}const p=!d.defaultToNothingSelected&&(a||!d.suppressClearModelOnRefreshValues)&&o.size===0;if(u||!i.filterType||p){const g=p?null:{filterType:this.filterType,values:c};r.onModelChange(g,e)}}keepModelKeys(e,t){const s=this.params,r=s.model,i=this.valueModel,n=new Map;let o,a=!1;const l=r?.values??[];for(let d=0,h=l.length;d<h;++d){const p=l[d],g=Rt(p),f=this.caseFormat(g);if(n.has(f)){a=!0;continue}let m=i.findKey(g);if(m===void 0){if(t){a=!0;continue}m=g,o??(o=[]),o.push(g)}n.set(f,m),a=a||m!==p}const c=Array.from(n.values()),u=this.heldKeys;for(let d=0,h=u.length;d<h;++d){const p=Rt(u[d]),g=this.caseFormat(p);!n.has(g)&&i.findKey(p)===void 0&&(n.set(g,p),o??(o=[]),o.push(p))}o&&(i.addKeyOnlyKeys(o),this.dispatchLocalEvent({type:"dataChanged"})),r!=null&&(c.length===0&&s.filterParams.excelMode?s.onModelChange(null,e):(a||!r.filterType)&&s.onModelChange({filterType:this.filterType,values:c},e))}doesFilterPassForTreeData(e,t){if(!e.childrenAfterGroup?.length)return t.has(this.createKey(el(e.getRoute()??[e.key??e.id],!0,this.gos.get("groupAllowUnbalanced"))))}doesFilterPassForGrouping(e,t){const{params:s,gos:r,beans:{rowGroupColsSvc:i,valueSvc:n}}=this,o=(i?.columns??[]).map(a=>n.getKeyForNode(a,e));return o.push(s.getValue(e)),t.has(this.createKey(el(o,!1,r.get("groupAllowUnbalanced"))))}generateCreateKey(e,t){return t&&!e?(this.error(250),()=>null):e?(s,r=null)=>{const i=this.getKeyCreatorParams(s,r);return Rt(e(i))}:s=>Rt(Gl(s))}getKeyCreatorParams(e,t=null){const{colDef:s,column:r}=this.params;return T5(this.gos,{value:e,colDef:s,column:r,node:t,data:t?.data})}setValueFormatter(e,t,s,r){let i=e;if(!i){if(t&&!s){this.error(249);return}this.noValueFormatterSupplied=!0,i=n=>{const o=n.value;return R5(o)?Ce(this,"blanks"):r?this.beans.valueSvc.formatValue(n.column,null,o,void 0,!1):Gl(o)}}this.valueFormatter=i}getCrossFilterModel(e){const{createKey:t,valueModel:s,params:r}=this;return e(t,s.displayableKeys,r.model?.values)}destroy(){this.beans.setFilterSvc.removeHandler(this.colId,this),this.appliedModel.destroy(),this.heldKeyIndex.destroy(),super.destroy(),this.valueModel=void 0}};import{BeanStub as N5,_getDefaultFilter as B5,_getFilterKey as V5}from"ag-grid-community";var H5=class extends d0{constructor(){super(...arguments),this.beanName="setFilterSvc",this.handlersByColId=new Map}postConstruct(){const e=()=>this.createPreservingFilters();this.addManagedEventListeners({newColumnsLoaded:e,advancedFilterEnabledChanged:e})}createPreservingFilters(e){const{colFilter:t,filterManager:s,dataTypeSvc:r,colModel:i}=this.beans;if(!t||s?.isAdvFilterEnabled()||r?.isPendingInference)return;if(e){this.createPreservingFilter(e);return}const n=i.getColsInStateOrder();for(let o=0,a=n.length;o<a;++o)this.createPreservingFilter(n[o])}addHandler(e,t){const s=this.handlersByColId;let r=s.get(e);r||(r=new Set,s.set(e,r)),r.add(t)}removeHandler(e,t){const s=this.handlersByColId.get(e);s&&(s.delete(t),s.size||this.handlersByColId.delete(e))}clearPreservedValues(e,t){const s=this.handlersByColId;if(e)if(typeof e=="string")Vl(s.get(e),t);else for(let r=0,i=e.length;r<i;++r)Vl(s.get(e[r]),t);else for(const r of s.values())Vl(r,t)}createPreservingFilter(e){const t=this.beans.colFilter;e.primary&&!t.hasFilter(e)&&t.isFilterAllowed(e)&&t.isCurrentColumn(e)&&this.wantsPreservedValues(e,e.colDef)&&t.getHandler(e,!0)}wantsPreservedValues(e,t){const s=this.beans,r=V5(s,t.filter,B5(s,e));if(r!=="agSetColumnFilter"&&r!=="agMultiColumnFilter"&&r!=="agSelectableColumnFilter")return!1;const i=s.colFilter.resolveFilterParams(e,t);if(i?.preservePreviousValues||i?.defaultFilterParams?.preservePreviousValues)return!0;const n=i?.filters;if(!Array.isArray(n))return!1;for(let o=0,a=n.length;o<a;++o){const l=n[o];if(l&&this.wantsPreservedValues(e,l))return!0}return!1}},Vl=(e,t)=>{if(e)for(const s of e)s.clearOwnPreservedValues(t)};import{RefPlaceholder as U5}from"ag-stack";import{AgInputTextFieldSelector as z5,Component as W5,_getFloatingFilterAriaLabel as K5}from"ag-grid-community";var $5={tag:"div",cls:"ag-floating-filter-input ag-set-floating-filter-input",role:"presentation",children:[{tag:"ag-input-text-field",ref:"eFloatingFilterText"}]},j5=class extends h0{constructor(){super($5,[z5]),this.eFloatingFilterText=U5}init(e){this.params=e,this.eFloatingFilterText.setDisabled(!0).addGuiEventListener("click",()=>this.params.showParentFilter()),this.setParams(e),this.addManagedListeners(e.column,{headerNameChanged:()=>this.refreshAriaLabel()})}setParams(e){if(this.refreshAriaLabel(),this.gos.get("enableFilterHandlers")){const t=e;this.updateFloatingFilterText(t.model)}}refreshAriaLabel(){this.eFloatingFilterText.setInputAriaLabel(K5(this.beans,this.params.column,this.getLocaleTextFunc()))}refresh(e){this.params=e,this.setParams(e)}onParentModelChanged(e){this.updateFloatingFilterText(e)}parentSetFilterInstance(e){this.params.parentFilterInstance(t=>{if(!(t instanceof ff)){this.beans.log.error(248);return}e(t)})}updateFloatingFilterText(e){e==null?this.eFloatingFilterText.setValue(""):this.gos.get("enableFilterHandlers")?this.eFloatingFilterText.setValue(this.params.getHandler().getModelAsString?.(e)??""):this.parentSetFilterInstance(t=>{this.eFloatingFilterText.setValue(t.getModelAsString(e))})}},vf={moduleName:"SetFilter",version:_,beans:[H5],userComponents:{agSetColumnFilter:{classImp:ff,params:{useForm:!0},processParams:(e,t)=>(WG(e,t),e)},agSetColumnFloatingFilter:j5},dynamicBeans:{agSetColumnFilterHandler:O5},icons:{setFilterGroupClosed:"tree-closed",setFilterGroupOpen:"tree-open",setFilterGroupIndeterminate:"tree-indeterminate",setFilterLoading:"loading"},dependsOn:[$,q3]};import{_KeyboardNavigationModule as Y5}from"ag-grid-community";import{RefPlaceholder as Hl,_clearElement as Ul,_removeFromParent as q5}from"ag-stack";import{AgPromise as Gn,Component as Z5,_addFocusableContainerListener as X5,_addGridCommonParams as Cf}from"ag-grid-community";var J5=".ag-status-bar{border-top:var(--ag-footer-row-border);display:flex;justify-content:space-between;line-height:1.5;overflow:auto hidden;padding-left:calc(var(--ag-spacing)*4);padding-right:calc(var(--ag-spacing)*4);scrollbar-width:var(--ag-scrollbar-width,thin)}.ag-status-panel,:where(.ag-status-panel.ag-status-panel-aggregations .ag-status-name-value){display:inline-flex}.ag-status-name-value{color:var(--ag-status-bar-label-color);font-weight:var(--ag-status-bar-label-font-weight);margin-left:var(--ag-spacing);margin-right:var(--ag-spacing);padding-bottom:var(--ag-widget-container-vertical-padding);padding-top:var(--ag-widget-container-vertical-padding);white-space:nowrap}.ag-status-name-value-value{color:var(--ag-status-bar-value-color);font-weight:var(--ag-status-bar-value-font-weight)}.ag-status-bar-left{display:inline-flex}.ag-status-bar-center{display:inline-flex;text-align:center}.ag-status-bar-right{display:inline-flex}";function Q5(e,t,s){return e.getCompDetails(t,e4,void 0,s,!0)}var e4={name:"statusPanel",optionalMethods:["refresh"]},t4={agAggregationComponent:{rowModels:["clientSide","serverSide"],warnArgs:[221]},agFilteredRowCountComponent:{rowModels:["clientSide"],warnArgs:[222]},agSelectedRowCountComponent:{rowModels:["clientSide","serverSide"],warnArgs:[223]},agTotalAndFilteredRowCountComponent:{rowModels:["clientSide"],warnArgs:[224]},agTotalRowCountComponent:{rowModels:["clientSide"],warnArgs:[225]}},s4={tag:"div",cls:"ag-status-bar",children:[{tag:"div",ref:"eStatusBarLeft",cls:"ag-status-bar-left",role:"status"},{tag:"div",ref:"eStatusBarCenter",cls:"ag-status-bar-center",role:"status"},{tag:"div",ref:"eStatusBarRight",cls:"ag-status-bar-right",role:"status"}]},r4=class extends p0{constructor(){super(s4),this.updateQueued=!1,this.panelsPromise=Gn.resolve(),this.eStatusBarLeft=Hl,this.eStatusBarCenter=Hl,this.eStatusBarRight=Hl,this.compDestroyFunctions={},this.registerCSS(J5)}wireBeans(e){this.userCompFactory=e.userCompFactory,this.statusBarSvc=e.statusBarSvc}postConstruct(){this.processStatusPanels(new Map),this.addManagedPropertyListeners(["statusBar"],this.handleStatusBarChanged.bind(this)),X5(this.beans,this,this.getGui())}getFocusableContainerName(){return"statusBar"}getValidPanels(){const e=this.gos,t=e.get("statusBar")?.statusPanels;return t&&t.filter(s=>{const{rowModels:r,warnArgs:i}=t4[s.statusPanel]??{};return!r||r.includes(e.get("rowModelType"))?!0:(this.beans.log.warn(...i),!1)})}processStatusPanels(e){const t=this.getValidPanels();if(t){const s=t.filter(n=>n.align==="left"),r=t.filter(n=>n.align==="center"),i=t.filter(n=>!n.align||n.align==="right");this.panelsPromise=Gn.all([this.createAndRenderComponents(s,this.eStatusBarLeft,e),this.createAndRenderComponents(r,this.eStatusBarCenter,e),this.createAndRenderComponents(i,this.eStatusBarRight,e)])}else this.setDisplayed(!1)}handleStatusBarChanged(){this.updateQueued||(this.updateQueued=!0,this.panelsPromise.then(()=>{this.updateStatusBar(),this.updateQueued=!1}))}updateStatusBar(){const e=this.getValidPanels(),t=Array.isArray(e)&&e.length>0;this.setDisplayed(t);const s=new Map;if(t)for(const r of e){const i=r.key??r.statusPanel,n=this.statusBarSvc.getStatusPanel(i);if(n?.refresh){const o=Cf(this.gos,{...r.statusPanelParams,key:i});n.refresh(o)&&(s.set(i,n),delete this.compDestroyFunctions[i],q5(n.getGui()))}}this.resetStatusBar(),t&&this.processStatusPanels(s)}resetStatusBar(){Ul(this.eStatusBarLeft),Ul(this.eStatusBarCenter),Ul(this.eStatusBarRight),this.destroyComponents(),this.statusBarSvc.unregisterAllComponents()}destroy(){this.destroyComponents(),super.destroy()}destroyComponents(){for(const e of Object.values(this.compDestroyFunctions))e();this.compDestroyFunctions={}}createAndRenderComponents(e,t,s){const r=[];for(const i of e){const n=i.key||i.statusPanel,o=s.get(n);let a;if(o)a=Gn.resolve(o);else{const l=Q5(this.userCompFactory,i,Cf(this.gos,{key:n}));if(l==null)continue;a=l.newAgStackInstance()}r.push({key:n,promise:a})}return Gn.all(r.map(i=>i.promise)).then(()=>{for(const i of r)i.promise.then(n=>{const o=()=>{this.destroyBean(n)};this.isAlive()?(this.statusBarSvc.registerStatusPanel(i.key,n),t.appendChild(n.getGui()),this.compDestroyFunctions[i.key]=o):o()})})}},i4={selector:"AG-STATUS-BAR",component:r4};import{RefPlaceholder as Qr,_exists as n4,_missing as zl,_parseBigIntOrNull as o4}from"ag-stack";import{Component as a4,_createCellId as l4,_formatNumberCommas as c4,_getRowBelow as u4,_getRowNode as d4,_isRowBefore as h4}from"ag-grid-community";import{RefPlaceholder as bf}from"ag-stack";import{Component as p4,_addGridCommonParams as g4}from"ag-grid-community";var f4={tag:"div",cls:"ag-status-name-value",children:[{tag:"span",ref:"eLabel"},":\xA0",{tag:"span",ref:"eValue",cls:"ag-status-name-value-value"}]},m4=BigInt(Number.MIN_SAFE_INTEGER),v4=BigInt(Number.MAX_SAFE_INTEGER),ei=class extends g0{constructor(){super(f4),this.eLabel=bf,this.eValue=bf}setLabel(e,t){this.setDisplayed(!1),this.eLabel.textContent=this.getLocaleTextFunc()(e,t)}setValue(e,t){let s=null,r;typeof e=="bigint"?(r=e,e>=m4&&e<=v4&&(s=Number(e))):s=e,this.eValue.textContent=this.valueFormatter(g4(this.gos,{value:s,bigintValue:r,totalRows:t,key:this.key}))}},C4={selector:"AG-NAME-VALUE",component:ei},Sf=e=>{let t=0;return e.forEachNodeAfterFilter(s=>{s.data&&t++}),t},ti=e=>{let t=0;return e.forEachNode(s=>{s.data&&t++}),t};function b4(e,t){return typeof e!="number"?"":c4(Math.round(e*100)/100,t)}var S4={tag:"div",cls:"ag-status-panel ag-status-panel-aggregations",children:[{tag:"ag-name-value",ref:"avgAggregationComp"},{tag:"ag-name-value",ref:"countAggregationComp"},{tag:"ag-name-value",ref:"minAggregationComp"},{tag:"ag-name-value",ref:"maxAggregationComp"},{tag:"ag-name-value",ref:"sumAggregationComp"}]},y4=class extends f0{constructor(){super(S4,[C4]),this.sumAggregationComp=Qr,this.countAggregationComp=Qr,this.minAggregationComp=Qr,this.maxAggregationComp=Qr,this.avgAggregationComp=Qr}postConstruct(){this.avgAggregationComp.setLabel("avg","Average"),this.countAggregationComp.setLabel("count","Count"),this.minAggregationComp.setLabel("min","Min"),this.maxAggregationComp.setLabel("max","Max"),this.sumAggregationComp.setLabel("sum","Sum"),this.addManagedEventListeners({cellSelectionChanged:this.onCellSelectionChanged.bind(this),modelUpdated:this.onCellSelectionChanged.bind(this)})}init(e){this.refresh(e)}refresh(e){this.params=e;const t=e.valueFormatter??(r=>{const{value:i,bigintValue:n}=r;return n!=null?n.toString():b4(i,this.getLocaleTextFunc.bind(this))}),s=["avg","count","min","max","sum"];for(const r of s){const i=this.getAllowedAggregationValueComponent(r);i&&(i.key=r,i.valueFormatter=t.bind(this))}return this.onCellSelectionChanged(),!0}setAggregationComponentValue(e,t,s){const r=this.getAllowedAggregationValueComponent(e),i=ti(this.beans.rowModel);n4(r)&&r?(r.setValue(t,i),r.setDisplayed(s)):this.getAggregationValueComponent(e)?.setDisplayed(!1)}getAllowedAggregationValueComponent(e){const{aggFuncs:t}=this.params;return!t||t.includes(e)?this.getAggregationValueComponent(e):null}getAggregationValueComponent(e){const t=`${e}AggregationComp`;return this[t]}onCellSelectionChanged(){const e=this.beans,t=e.valueSvc,s=e.formula,r=e.rangeSvc,i=r?.getCellRanges();let n=0,o=0n,a=!1,l=!1,c=0,u=0,d=null,h=null,p=null,g=null;const f=O=>{if(typeof O=="number")if(n+=O,(d===null||O<d)&&(d=O),(h===null||O>h)&&(h=O),!Number.isInteger(O)||!Number.isSafeInteger(O))l=!0;else{const z=BigInt(O);o+=z,(p===null||z<p)&&(p=z),(g===null||z>g)&&(g=z)}else{a=!0,o+=O,(p===null||O<p)&&(p=O),(g===null||O>g)&&(g=O);const z=Number(O);n+=z,(d===null||z<d)&&(d=z),(h===null||z>h)&&(h=z)}u++},m={};if(i?.length&&r)for(let O=0;O<i.length;O++){const z=i[O];let B=r.getRangeStartRow(z);const W=r.getRangeEndRow(z);for(;!(zl(B)||!B||h4(W,B)||!B||!z.columns);)z.columns.forEach(Q=>{if(B===null)return;const de=l4({rowPinned:B.rowPinned,column:Q,rowIndex:B.rowIndex});if(m[de])return;m[de]=!0;const me=d4(e,B);if(zl(me))return;let Z=t.getValueFromData(Q,me);if(Q.allowFormula&&s?.isFormula(Z)&&(Z=s.resolveValue(Q,me)),!(zl(Z)||Z==="")&&(c++,!(typeof Z=="object"&&"value"in Z&&(Z=Z.value,Z==="")))){if(typeof Z=="string"){const D=Z.trim();if(D==="")return;const A=Number(D);if(!Number.isFinite(A))return;n+A>=Number.MAX_SAFE_INTEGER||n+A<=Number.MIN_SAFE_INTEGER||A>=Number.MAX_SAFE_INTEGER||A<=Number.MIN_SAFE_INTEGER?(Z=o4(D),Z===null&&(Z=A)):Z=A}(typeof Z=="number"&&!Number.isNaN(Z)||typeof Z=="bigint")&&f(Z)}}),B=u4(e,B)}const v=c>1,C=u>1,b=a&&!l;let y,S,w,F;b?(y=o/BigInt(u),S=o,w=p,F=g):(y=n/u,S=n,w=d,F=h);const T=C?S:null,x=C?w:null,P=C?F:null,L=C?y:null,G=C;this.setAggregationComponentValue("count",c,v),this.setAggregationComponentValue("sum",T,C),this.setAggregationComponentValue("min",x,C),this.setAggregationComponentValue("max",P,C),this.setAggregationComponentValue("avg",L,G)}};import{_formatNumberCommas as w4}from"ag-grid-community";var x4=class extends ei{postConstruct(){this.setLabel("filteredRows","Filtered"),this.addCss("ag-status-panel"),this.addCss("ag-status-panel-filtered-row-count"),this.setDisplayed(!0);const e=this.onDataChanged.bind(this);this.addManagedEventListeners({modelUpdated:e})}onDataChanged(){const{rowModel:e}=this.beans,t=ti(e),s=Sf(e);this.setValue(s,t),this.setDisplayed(t!==s)}init(e){this.refresh(e),this.onDataChanged()}updateValueFormatter(e){this.valueFormatter=e??(({value:t})=>w4(t,this.getLocaleTextFunc.bind(this)))}refresh(e){const{key:t,valueFormatter:s}=e;return this.key=t,this.updateValueFormatter(s),!0}};import{_formatNumberCommas as F4}from"ag-grid-community";var T4=class extends ei{postConstruct(){this.setLabel("selectedRows","Selected"),this.addCss("ag-status-panel"),this.addCss("ag-status-panel-selected-row-count");const e=this.onRowSelectionChanged.bind(this);this.addManagedEventListeners({modelUpdated:e,selectionChanged:e})}onRowSelectionChanged(){const{selectionSvc:e,rowModel:t}=this.beans,s=e?.getSelectionCount()??0,r=ti(t);if(this.setValue(s,r),s<0){this.setDisplayed(!0);return}this.setDisplayed(s>0)}init(e){this.refresh(e),this.onRowSelectionChanged()}updateValueFormatter(e){this.valueFormatter=e??(({value:t})=>t==null||t>=0?F4(t,this.getLocaleTextFunc.bind(this)):this.getLocaleTextFunc()("statusBarLastRowUnknown","?"))}refresh(e){const{key:t,valueFormatter:s}=e;return this.key=t,this.updateValueFormatter(s),!0}};import{_formatNumberCommas as yf}from"ag-grid-community";var A4=class extends ei{postConstruct(){this.setLabel("totalAndFilteredRows","Rows"),this.addCss("ag-status-panel"),this.addCss("ag-status-panel-total-and-filtered-row-count"),this.setDisplayed(!0),this.addManagedEventListeners({modelUpdated:this.onDataChanged.bind(this)})}onDataChanged(){const{rowModel:e}=this.beans,t=Sf(e),s=ti(e);this.setValue(t,s)}init(e){this.refresh(e),this.onDataChanged()}updateValueFormatter(e){this.valueFormatter=e??(({value:t,totalRows:s})=>{const r=this.getLocaleTextFunc.bind(this),i=yf(t,r),n=yf(s??t,r);if(t===s)return i;const o=r();return`${i} ${o("of","of")} ${n}`})}refresh(e){const{key:t,valueFormatter:s}=e;return this.key=t,this.updateValueFormatter(s),!0}};import{_formatNumberCommas as P4}from"ag-grid-community";var R4=class extends ei{postConstruct(){this.setLabel("totalRows","Total Rows"),this.addCss("ag-status-panel"),this.addCss("ag-status-panel-total-row-count"),this.setDisplayed(!0),this.addManagedEventListeners({modelUpdated:this.onDataChanged.bind(this)})}onDataChanged(){const e=ti(this.beans.rowModel);this.setValue(e,e)}init(e){this.refresh(e),this.onDataChanged()}updateValueFormatter(e){this.valueFormatter=e??(({value:t})=>P4(t,this.getLocaleTextFunc.bind(this)))}refresh(e){const{key:t,valueFormatter:s}=e;return this.key=t,this.updateValueFormatter(s),!0}};import{_unwrapUserComp as M4}from"ag-grid-community";function I4(e,t){const s=e.statusBarSvc?.getStatusPanel(t);return M4(s)}import{BeanStub as E4}from"ag-grid-community";var D4=class extends m0{constructor(){super(),this.beanName="statusBarSvc",this.comps=new Map}registerStatusPanel(e,t){this.comps.set(e,t)}unregisterStatusPanel(e){this.comps.delete(e)}unregisterAllComponents(){this.comps.clear()}getStatusPanel(e){return this.comps.get(e)}destroy(){this.unregisterAllComponents(),super.destroy()}},wf={moduleName:"StatusBar",version:_,beans:[D4],userComponents:{agAggregationComponent:y4,agTotalRowCountComponent:R4,agFilteredRowCountComponent:x4,agTotalAndFilteredRowCountComponent:A4,agSelectedRowCountComponent:T4},selectors:[i4],apiFunctions:{getStatusPanel:I4},dependsOn:[$,Y5]};import{_clearElement as L4,_findFocusableElements as k4,_getActiveDomElement as _4,_removeFromParent as On,_scrollHorizontallyToShow as G4}from"ag-stack";import{Component as O4,KeyCode as Yt,ManagedFocusFeature as N4,_addFocusableContainerListener as B4,_addGridCommonParams as V4,_clamp as H4,_createElement as Nn,_unwrapUserComp as U4}from"ag-grid-community";var z4=".ag-toolbar{align-items:center;background-color:var(--ag-toolbar-background-color);border-bottom:var(--ag-header-row-border);color:var(--ag-toolbar-text-color);display:flex;font-family:var(--ag-header-font-family);font-size:var(--ag-header-font-size);min-height:var(--ag-header-height);overflow:auto hidden;scrollbar-width:var(--ag-scrollbar-width,thin);white-space:nowrap}.ag-toolbar-right-start{margin-inline-start:auto}.ag-toolbar-item{display:inline-flex}.ag-toolbar-item:where(:not(.ag-toolbar-panel)){font-weight:var(--ag-header-font-weight)}.ag-toolbar-button-wrapper{display:inline-flex;height:100%}.ag-toolbar-button{align-items:center;background:transparent;border:0;color:var(--ag-toolbar-text-color);cursor:pointer;display:inline-flex;font-family:var(--ag-header-font-family);font-size:var(--ag-header-font-size);font-weight:var(--ag-header-font-weight);gap:var(--ag-spacing);line-height:1;outline:var(--ag-internal-accessible-no-outline,revert);padding:calc(var(--ag-spacing)*1.25);white-space:nowrap}:where(.ag-toolbar-button) .ag-icon{color:var(--ag-icon-color)}.ag-toolbar-button-wrapper:hover{background-color:var(--ag-icon-button-hover-background-color);color:var(--ag-icon-button-hover-color)}:where(.ag-toolbar-button-wrapper:hover .ag-toolbar-button) .ag-icon,:where(.ag-toolbar-button-wrapper:hover) .ag-toolbar-button{color:var(--ag-icon-button-hover-color)}.ag-toolbar-button:focus-visible{box-shadow:inset var(--ag-focus-shadow)}:where(.ag-toolbar-button:focus):not(:focus-visible){box-shadow:none}.ag-toolbar-button:disabled{cursor:default;opacity:.5;pointer-events:none}.ag-toolbar>.ag-toolbar-button-wrapper:first-child>.ag-toolbar-button{border-start-start-radius:calc(var(--ag-wrapper-border-radius) - var(--ag-border-width))}.ag-toolbar>.ag-toolbar-button-wrapper:last-child>.ag-toolbar-button{border-start-end-radius:calc(var(--ag-wrapper-border-radius) - var(--ag-border-width))}.ag-toolbar-panel{display:inline-flex;flex:1 0 0;padding:0 calc(var(--ag-spacing)*2)}.ag-toolbar-input{align-items:center;display:inline-flex;margin:0 calc(var(--ag-spacing)*2);max-width:none;min-width:200px;position:relative}.ag-toolbar-input+.ag-toolbar-input{margin-inline-start:0}.ag-toolbar-right-start+.ag-toolbar-input{margin-inline-start:var(--ag-spacing)}.ag-toolbar>.ag-toolbar-input:first-child{margin-inline-start:var(--ag-spacing)}.ag-toolbar>.ag-toolbar-input:last-child{margin-inline-end:var(--ag-spacing)}.ag-toolbar-input-icon{align-items:center;color:var(--ag-icon-color);display:inline-flex;inset-inline-start:var(--ag-spacing);opacity:.5;pointer-events:none;position:absolute;z-index:1}.ag-toolbar-input-field{background-color:var(--ag-input-background-color);border:var(--ag-input-border);border-radius:var(--ag-input-border-radius);color:var(--ag-text-color);font-family:inherit;font-size:var(--ag-font-size);font-weight:inherit;line-height:1.5;padding-block:calc(var(--ag-spacing)*.5);width:100%}.ag-toolbar-input .ag-toolbar-input-field{padding-inline-start:calc(var(--ag-icon-size) + var(--ag-spacing)*2)}.ag-toolbar-input-widget{flex:1;min-width:0}.ag-toolbar-input-field:focus{border:var(--ag-input-focus-border);box-shadow:var(--ag-focus-shadow)}.ag-toolbar-input-field::-moz-placeholder{color:var(--ag-input-placeholder-text-color)}.ag-toolbar-input-field::placeholder{color:var(--ag-input-placeholder-text-color)}:where(.ag-toolbar-panel) .ag-column-drop-horizontal{background-color:transparent;border-bottom:none;font-family:var(--ag-cell-font-family);font-size:var(--ag-font-size);padding:0}.ag-toolbar .ag-column-drop-horizontal{border-bottom:none;overflow:visible;padding-inline-start:0}.ag-toolbar-button-chevron{align-items:center;display:inline-flex}.ag-toolbar-separator{align-self:stretch;border-inline-start:var(--ag-toolbar-separator-border);margin:calc(var(--ag-spacing)*1.75) 0;width:0}.ag-toolbar-find{background-color:var(--ag-input-background-color);border:var(--ag-input-border);border-radius:var(--ag-input-border-radius);gap:calc(var(--ag-spacing)*.5);max-width:none;min-width:220px;width:280px}.ag-toolbar-find:focus-within{border:var(--ag-input-focus-border);box-shadow:var(--ag-focus-shadow)}.ag-toolbar-find .ag-toolbar-input-field{background-color:transparent;border:none;flex:1;min-width:0}.ag-toolbar-find .ag-toolbar-input-field:focus{border:none;box-shadow:none}.ag-toolbar-find-match-count{color:inherit;flex-shrink:0;font-size:var(--ag-font-size);font-variant-numeric:tabular-nums;opacity:.7;text-align:end;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap}.ag-toolbar-find-button{flex-shrink:0;padding:calc(var(--ag-spacing)*.5)}";function W4(e,t){if(typeof e=="string")return{toolbarItem:e,key:e};let s=e.toolbarItem,r=e.toolbarItemParams,i,n,o,a;return s==null?({label:i,tooltip:n,icon:o,action:a}=e,(a!=null||i!=null||o!=null)&&(s="agButtonToolbarItem",r=void 0)):s==="agMenuToolbarItem"&&({label:i,tooltip:n,icon:o}=e),{toolbarItem:s,toolbarItemParams:r,alignment:e.alignment,key:e.key??t(),label:i,tooltip:n,icon:o,action:a}}var K4={name:"toolbarItem",optionalMethods:["refresh"]},$4={tag:"div",cls:"ag-toolbar",role:"toolbar"},j4=class extends v0{constructor(){super($4),this.toolbarItems=new Map,this.nextKey=0,this.generation=0,this.registerCSS(z4)}postConstruct(){const e=this.getGui();this.beans.toolbar.setToolbar(this),this.processToolbarItems(),this.addManagedPropertyListeners(["toolbar"],this.updateToolbar.bind(this)),this.createManagedBean(new N4(e,{onTabKeyDown:this.onTabKeyDown.bind(this),handleKeyDown:this.handleKeyDown.bind(this)})),this.addManagedElementListeners(e,{focusin:this.ensureFocusedItemVisible.bind(this)}),B4(this.beans,this,e)}ensureFocusedItemVisible(e){const t=this.getGui(),s=e.target;!s||!t.contains(s)||s===t||G4(s)}getFocusableContainerName(){return"toolbar"}getToolbarItemInstance(e){const t=this.toolbarItems.get(e);if(t)return U4(t)}onTabKeyDown(e){}handleKeyDown(e){const t=_4(this.beans);if(t instanceof HTMLInputElement)return;const{key:s}=e;if(s!==Yt.LEFT&&s!==Yt.RIGHT&&s!==Yt.PAGE_HOME&&s!==Yt.PAGE_END)return;const r=k4(this.getGui()),i=r.indexOf(t);if(i===-1)return;const n=this.gos.get("enableRtl");let o;switch(s){case Yt.LEFT:o=n?i+1:i-1;break;case Yt.RIGHT:o=n?i-1:i+1;break;case Yt.PAGE_HOME:o=0;break;case Yt.PAGE_END:o=r.length-1;break}o=H4(o,0,r.length-1),o!==i&&(r[o].focus(),e.preventDefault())}getValidItems(e){if(!e?.items)return;this.nextKey=0;const t=()=>`toolbar-item-${this.nextKey++}`;return e.items.map(s=>W4(s,t))}createItemParams(e,t){const{toolbarItem:s,...r}=e;return V4(this.gos,{...r,key:t})}processToolbarItems(){const e=this.gos.get("toolbar"),t=this.getValidItems(e),s=Array.isArray(t)&&t.length>0;if(this.setDisplayed(s),!s)return;const r=[],i=[],n=e?.alignment??"left";let o=n;for(const l of t){const c=l.toolbarItem==="separator",u=l.alignment??(c?o:n);(u==="right"?i:r).push(l),c||(o=u)}const a=++this.generation;this.createAndRenderComponents([...r,...i],r.length,a)}updateToolbar(){this.generation++,L4(this.getGui()),this.destroyToolbarItems(),this.processToolbarItems()}destroy(){this.generation++,this.destroyToolbarItems(),this.beans.toolbar?.clearToolbar(this),super.destroy()}destroyToolbarItems(){for(const e of this.toolbarItems.values())this.destroyBean(e);this.toolbarItems.clear()}createSeparator(){return Nn({tag:"div",cls:"ag-toolbar-separator",attrs:{role:"separator"}})}createAndRenderComponents(e,t,s){const r=this.getGui(),i=t<e.length;for(let n=0;n<e.length;n++){i&&n===t&&r.appendChild(Nn({tag:"div",cls:"ag-toolbar-right-start"}));const o=e[n];if(o.toolbarItem==="separator"){r.appendChild(this.createSeparator());continue}const{key:a}=o;if(o.toolbarItem==null){this.beans.log.error(301,{key:a});continue}const l=Nn({tag:"div"});r.appendChild(l);const c=this.beans.userCompFactory.getCompDetails(o,K4,void 0,this.createItemParams(o,a),!0);if(c==null){On(l);continue}c.newAgStackInstance().then(u=>this.mountComponent(a,u,l,s))}}mountComponent(e,t,s,r){if(r!==this.generation){On(s),t!=null&&this.destroyBean(t);return}if(t==null){On(s);return}const i=this.toolbarItems.has(e);if(i||!this.isAlive()||s.parentNode!==this.getGui()){On(s),this.destroyBean(t),i&&this.beans.log.warn(303,{key:e});return}this.toolbarItems.set(e,t);const n=t.getGui();if("agToolbarButton"in t){const o=Nn({tag:"div",cls:"ag-toolbar-button-wrapper"});o.appendChild(n),s.replaceWith(o)}else s.replaceWith(n)}},Y4={selector:"AG-TOOLBAR",component:j4};import{RefPlaceholder as xf}from"ag-stack";import{Component as q4,_addGridCommonParams as Z4}from"ag-grid-community";import{FAST_TEST_TIMINGS as X4,_addOrRemoveAttribute as J4,_clearElement as Q4,_setAriaLabel as e6,_setDisabled as t6,_setDisplayed as Ff}from"ag-stack";import{_createElement as Tf,_createIconNoSpan as Wl}from"ag-grid-community";var Af=X4?0:300;function Pf(e,t,{label:s,iconName:r,initialValue:i}){const n=Wl(r,e);let o;n&&(o=Tf({tag:"span",cls:"ag-toolbar-input-icon",attrs:{"aria-hidden":"true"}}),o.appendChild(n)),t.setInputPlaceholder(`${s}...`).setInputAriaLabel(s).setValue(i,!0),t.addCss("ag-toolbar-input-widget");const a=t.getInputElement();return a.classList.add("ag-toolbar-input-field"),{eIconWrapper:o,eInput:a}}function Rf(e,{iconName:t,label:s,cls:r,disabled:i}){const n=Tf({tag:"button",cls:r?`ag-toolbar-button ${r}`:"ag-toolbar-button",attrs:{type:"button","aria-label":s,title:s}});i&&t6(n,!0);const o=Wl(t,e);return o&&n.appendChild(o),n}function Mf(e,{eIcon:t,eLabel:s,eGui:r,icon:i,label:n,hoverText:o}){if(Q4(t),i){const l=Wl(i,e);l&&t.appendChild(l)}Ff(t,!!i);const a=!!n;s.textContent=n??"",Ff(s,a),e6(r,o),J4(r,"title",o)}function If(e,t){const s=e.rowGroupPanelBuilder;return s||e.log.error(302,{itemName:t,moduleName:"RowGroupingPanel",...e.gos.getModuleErrorParams()}),s}var s6={tag:"button",cls:"ag-toolbar-item ag-toolbar-button",attrs:{type:"button"},children:[{tag:"span",ref:"eIcon",cls:"ag-toolbar-button-icon",attrs:{"aria-hidden":"true"}},{tag:"span",ref:"eLabel",cls:"ag-toolbar-button-label"}]},r6=class extends C0{constructor(){super(s6),this.agToolbarButton="agToolbarButton",this.eIcon=xf,this.eLabel=xf}init(e){this.applyParams(e),this.addManagedElementListeners(this.getGui(),{click:()=>this.invokeAction()})}refresh(e){return this.applyParams(e),!0}applyParams(e){this.params=e,Mf(this.beans,{eIcon:this.eIcon,eLabel:this.eLabel,eGui:this.getGui(),icon:e.icon,label:e.label,hoverText:e.tooltip??e.label})}invokeAction(){const{action:e,key:t}=this.params;if(!e)return;const s=Z4(this.gos,{key:t});e(s)}};import{_debounce as i6,_setDisabled as Ef}from"ag-stack";import{AgInputTextField as n6,Component as o6,_createElement as a6}from"ag-grid-community";var l6=0;function c6(e){return a6({tag:"label",cls:"ag-toolbar-find-match-count",attrs:{"aria-live":"polite",for:e}})}var u6=class extends b0{constructor(){super({tag:"div",cls:"ag-toolbar-item ag-toolbar-input ag-toolbar-find"})}init(e){if(!this.gos.isModuleRegistered("Find")){this.beans.log.error(302,{itemName:"agFindToolbarItem",moduleName:"Find",...this.gos.getModuleErrorParams()}),this.setDisplayed(!1);return}const t=this.getLocaleTextFunc(),s=t("toolbarFind","Find"),r=this.getGui();let i;const n=()=>this.gos.updateGridOptions({options:{findSearchValue:this.eInput.value}});this.eInputField=this.createManagedBean(new n6({clearButton:!0,autoComplete:e.toolbarItemParams?.browserAutoComplete,onValueClear:()=>{clearTimeout(i),n()}}));const{eIconWrapper:o,eInput:a}=Pf(this.beans,this.eInputField,{label:s,iconName:"search",initialValue:this.gos.get("findSearchValue")}),l=`ag-toolbar-find-input-${++l6}`;a.id=l,o&&r.appendChild(o),this.eInput=a,r.appendChild(this.eInputField.getGui()),this.eMatchCount=c6(l),r.appendChild(this.eMatchCount),this.ePrevButton=Rf(this.beans,{iconName:"previous",label:t("toolbarFindPreviousMatch","Previous Match"),cls:"ag-toolbar-find-button",disabled:!0}),r.appendChild(this.ePrevButton),this.eNextButton=Rf(this.beans,{iconName:"next",label:t("toolbarFindNextMatch","Next Match"),cls:"ag-toolbar-find-button",disabled:!0}),r.appendChild(this.eNextButton);const c=i6(this,n,Af);this.addManagedElementListeners(this.eInput,{input:()=>i=c(),keydown:u=>{u.key==="Enter"&&(u.preventDefault(),n(),u.shiftKey?this.beans.findSvc?.previous():this.beans.findSvc?.next())}}),this.addManagedElementListeners(this.ePrevButton,{click:()=>this.beans.findSvc?.previous()}),this.addManagedElementListeners(this.eNextButton,{click:()=>this.beans.findSvc?.next()}),this.addManagedEventListeners({findChanged:u=>this.onFindChanged(u)}),this.addManagedPropertyListener("findSearchValue",({currentValue:u})=>{clearTimeout(i),this.eInputField.setValue(u??"",!0)}),this.syncMatchState()}refresh(e){return this.eInput?(this.eInputField.setAutoComplete(e.toolbarItemParams?.browserAutoComplete),this.eInputField.setValue(this.gos.get("findSearchValue"),!0),this.syncMatchState(),!0):!1}onFindChanged(e){this.updateMatchDisplay(e.findSearchValue,e.activeMatch?.numOverall??0,e.totalMatches)}syncMatchState(){const e=this.beans.findSvc,t=this.gos.get("findSearchValue"),s=e?.activeMatch?.numOverall??0,r=e?.totalMatches??0;this.updateMatchDisplay(t,s,r)}updateMatchDisplay(e,t,s){const r=!!e?.length;this.eMatchCount.textContent=r?`${t}/${s}`:"";const i=s>0;Ef(this.ePrevButton,!i),Ef(this.eNextButton,!i)}};import{RefPlaceholder as Kl,_removeAriaExpanded as d6,_setAriaExpanded as $l,_setAriaHasPopup as h6,_setDisabled as p6,_setDisplayed as g6}from"ag-stack";import{Component as f6,_createIconNoSpan as m6}from"ag-grid-community";var v6={tag:"button",cls:"ag-toolbar-item ag-toolbar-button",attrs:{type:"button"},children:[{tag:"span",ref:"eIcon",cls:"ag-toolbar-button-icon",attrs:{"aria-hidden":"true"}},{tag:"span",ref:"eLabel",cls:"ag-toolbar-button-label"},{tag:"span",ref:"eChevron",cls:"ag-toolbar-button-chevron",attrs:{"aria-hidden":"true"}}]},C6=class extends S0{constructor(){super(v6),this.agToolbarButton="agToolbarButton",this.eIcon=Kl,this.eLabel=Kl,this.eChevron=Kl}init(e){const t=m6("selectOpen",this.beans);t&&this.eChevron.appendChild(t),this.beans.gos.assertModuleRegistered(["ContextMenu","ColumnMenu"],"AG Grid toolbar item: `agMenuToolbarItem`"),this.applyParams(e),this.addManagedElementListeners(this.getGui(),{click:()=>this.showMenu()})}refresh(e){return this.applyParams(e),!0}getAccessibleName(){const{tooltip:e,label:t}=this.params;return e??t??this.getLocaleTextFunc()("toolbarMenu","Menu")}applyParams(e){this.params=e;const t=this.getGui();Mf(this.beans,{eIcon:this.eIcon,eLabel:this.eLabel,eGui:t,icon:e.icon??"menu",label:e.label,hoverText:this.getAccessibleName()});const r=!!e.toolbarItemParams?.menuItems?.length;g6(this.eChevron,r),p6(t,!r),h6(t,r?"menu":!1),r?$l(t,!1):d6(t)}showMenu(){const e=this.params.toolbarItemParams?.menuItems;if(!e?.length)return;const t=this.beans.toolbarMenuBuilder;if(!t)return;const s=this.getGui();$l(s,!0),t.showMenu({anchorElement:s,menuItems:e,ariaLabel:this.getAccessibleName(),onClose:()=>{this.isAlive()&&($l(s,!1),s.focus())}})}};import{Component as b6}from"ag-grid-community";var S6=class extends y0{constructor(){super({tag:"div",cls:"ag-toolbar-item ag-toolbar-panel"})}init(e){if(!this.gos.isModuleRegistered("Pivot")){this.beans.log.error(302,{itemName:"agPivotPanelToolbarItem",moduleName:"Pivot",...this.gos.getModuleErrorParams()}),this.setDisplayed(!1);return}const t=If(this.beans,"agPivotPanelToolbarItem");if(!t){this.setDisplayed(!1);return}const s=this.createManagedBean(t.createPivotDropZone(!0,!0));this.getGui().appendChild(s.getGui()),s.setDisplayed(!0),this.addManagedListeners(s,{displayChanged:()=>s.setDisplayed(!0)}),this.setDisplayed(this.beans.colModel.pivotMode),this.addManagedEventListeners({columnPivotModeChanged:()=>this.setDisplayed(this.beans.colModel.pivotMode)})}refresh(e){return!0}};import{_debounce as y6}from"ag-stack";import{AgInputTextField as w6,Component as x6}from"ag-grid-community";var F6=class extends w0{constructor(){super({tag:"div",cls:"ag-toolbar-item ag-toolbar-input"})}init(e){if(!this.gos.isModuleRegistered("QuickFilter")){this.beans.log.error(302,{itemName:"agQuickFilterToolbarItem",moduleName:"QuickFilter",...this.gos.getModuleErrorParams()}),this.setDisplayed(!1);return}const s=this.getLocaleTextFunc()("toolbarQuickFilter","Filter"),r=this.getGui();let i;const n=u=>this.gos.updateGridOptions({options:{quickFilterText:u}});this.eInputField=this.createManagedBean(new w6({clearButton:!0,autoComplete:e.toolbarItemParams?.browserAutoComplete,onValueClear:()=>{clearTimeout(i),n("")}}));const{eIconWrapper:o,eInput:a}=Pf(this.beans,this.eInputField,{label:s,iconName:"filter",initialValue:this.gos.get("quickFilterText")});o&&r.appendChild(o),this.eInput=a,r.appendChild(this.eInputField.getGui());const l=y6(this,()=>n(this.eInput.value),Af);this.addManagedElementListeners(this.eInput,{input:()=>i=l()});const c=u=>{clearTimeout(i),this.eInputField.setValue(u??"",!0)};this.addManagedPropertyListener("quickFilterText",({currentValue:u})=>c(u))}refresh(e){return this.eInput?(this.eInputField.setAutoComplete(e.toolbarItemParams?.browserAutoComplete),this.eInputField.setValue(this.gos.get("quickFilterText"),!0),!0):!1}};import{Component as T6}from"ag-grid-community";var A6=class extends x0{constructor(){super({tag:"div",cls:"ag-toolbar-item ag-toolbar-panel"})}init(e){const t=If(this.beans,"agRowGroupPanelToolbarItem");if(!t){this.setDisplayed(!1);return}const s=this.createManagedBean(t.createRowGroupDropZone(!0,!0));this.getGui().appendChild(s.getGui())}refresh(e){return!0}};import{_unwrapUserComp as P6}from"ag-grid-community";function R6(e,t){const s=e.toolbar?.getToolbarItemInstance(t);return P6(s)}import{BeanStub as M6}from"ag-grid-community";var I6=class extends F0{constructor(){super(...arguments),this.beanName="toolbar"}setToolbar(e){this.comp=e}clearToolbar(e){this.comp===e&&(this.comp=void 0)}getToolbarItemInstance(e){return this.comp?.getToolbarItemInstance(e)}hasItem(e){return!!this.gos.get("toolbar")?.items?.some(t=>t===e||typeof t=="object"&&t.toolbarItem===e)}},Df={moduleName:"Toolbar",version:_,beans:[I6],userComponents:{agButtonToolbarItem:r6,agFindToolbarItem:u6,agMenuToolbarItem:C6,agPivotPanelToolbarItem:S6,agQuickFilterToolbarItem:F6,agRowGroupPanelToolbarItem:A6},icons:{filter:"filter"},selectors:[Y4],apiFunctions:{getToolbarItemInstance:R6},dependsOn:[$]};import{_SharedExportModule as E6}from"ag-grid-community";function Lf(e){return e.excelCreator?.getFactoryMode()==="MULTI_SHEET"?(e.log.warn(161),!1):!0}function D6(e,t){if(Lf(e))return e.excelCreator?.getDataAsExcel(t)}function L6(e,t){Lf(e)&&e.excelCreator?.exportDataAsExcel(t)}function k6(e,t){return e.excelCreator?.setFactoryMode("MULTI_SHEET"),e.excelCreator?.getSheetDataForExcel(t)}function _6(e,t){return e.excelCreator?.getMultipleSheetsAsExcel(t)}function G6(e,t){e.excelCreator?.exportMultipleSheetsAsExcel(t)}var kf={moduleName:"ExcelExport",version:_,beans:[pE],apiFunctions:{getDataAsExcel:D6,exportDataAsExcel:L6,getSheetDataForExcel:k6,getMultipleSheetsAsExcel:_6,exportMultipleSheetsAsExcel:G6},dependsOn:[E6,$]};import{_SharedExportModule as O6}from"ag-grid-community";import{_downloadFile as N6}from"ag-stack";import{BaseCreator as B6}from"ag-grid-community";import{BaseGridSerializingSession as V6,_addGridCommonParams as si,_getDrawnColSpan as H6,_isFullWidthGroupRow as U6}from"ag-grid-community";function X(e,t,s=0){return e!=null&&Number.isFinite(e)&&e>=s?e:t}function _f(e,t=0){return e!=null&&Number.isFinite(e)&&e>=t?e:void 0}var jl={A4:{width:595.28,height:841.89},Letter:{width:612,height:792}},Gf="A4",z6="landscape",ri=36;function W6(e,t){let s;if(typeof e=="string"||e==null){const a=typeof e=="string"&&e in jl?e:Gf;s=jl[a]}else s=Of(e.width)&&Of(e.height)?e:jl[Gf];let{width:r,height:i}=s;const n=t==="portrait"||t==="landscape"?t:z6;return(n==="landscape"&&r<i||n==="portrait"&&r>i)&&([r,i]=[i,r]),{width:r,height:i}}function Of(e){return Number.isFinite(e)&&e>0}function K6(e){if(typeof e=="number"){const s=X(e,ri);return{top:s,right:s,bottom:s,left:s}}const t=e??{};return{top:X(t.top,ri),right:X(t.right,ri),bottom:X(t.bottom,ri),left:X(t.left,ri)}}function $6(e){let t=0;for(const s of e){let r=0;for(const i of s.cells)r+=1+Math.floor(X(i.mergeAcross,0));t=Math.max(t,r)}return t}function j6(e,t,s){const r=[];for(let i=0;i<t;i++){const n=e[i]??null,o=n?.colKind==="row-number"?"auto":"grid";r.push(typeof s=="function"?s({column:n,index:i})??o:s??o)}return r}function Y6(e){return e==="auto"?!0:e==="grid"?!1:!(Number.isFinite(e)&&e>=Number.EPSILON)}function q6(e,t,s,r,i){if(!t)return[];const n=X(s,0),o=[],a=Nf(e,t);for(let d=0;d<t;d++){const h=a[d],p=X(i?.[d],h,Number.EPSILON);o.push(Z6(r[d]??"grid",h,p))}let l=0;for(const d of o)l+=d;if(!n){const d=[];for(let h=0;h<t;h++)d.push(0);return d}const c=l>n?n/l:1,u=[];for(const d of o)u.push(d*c);return u}function Nf(e,t){const s=[];for(let r=0;r<t;r++){const i=e[r];s.push(i?X(i.getActualWidth(),100,Number.EPSILON):100)}return s}function Z6(e,t,s){return e==="grid"?t:e==="auto"?s:X(e,s,Number.EPSILON)}function X6(e){const t=[];for(const s of e){if(s.type==="BODY")break;(s.type==="HEADER"||s.type==="HEADER_GROUPING")&&t.push(s)}return t}function Bf(e,t,s){let r=0;for(let i=0;i<s;i++)r+=e[t+i]??0;return r}function Yl(e){return e==="HEADER"||e==="HEADER_GROUPING"}import{_hasOwn as J6}from"ag-stack";var Bn=32,Vf=126,ql=500,Q6=600,Hf={Helvetica:{ascent:718,descent:207},"Helvetica-Bold":{ascent:718,descent:207},"Times-Roman":{ascent:683,descent:217},"Times-Bold":{ascent:683,descent:217},Courier:{ascent:629,descent:157},"Courier-Bold":{ascent:629,descent:157}},eH=[278,278,355,556,556,889,667,191,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,278,278,584,584,584,556,1015,667,667,722,722,667,611,778,722,278,500,667,556,833,722,778,667,778,722,667,611,722,667,944,667,667,611,278,278,278,469,556,333,556,556,500,556,556,278,556,556,222,222,500,222,833,556,556,556,556,333,500,278,556,500,722,500,500,500,334,260,334,584],tH=[278,333,474,556,556,889,722,238,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,333,333,584,584,584,611,975,722,722,722,722,667,611,778,722,278,556,722,611,833,722,778,667,778,722,667,611,722,667,944,667,667,611,333,278,333,584,556,333,556,611,556,611,556,333,611,611,278,278,556,278,889,611,611,611,611,389,556,333,611,556,778,556,556,500,389,280,389,584],sH=[250,333,408,500,500,833,778,180,333,333,500,564,250,333,250,278,500,500,500,500,500,500,500,500,500,500,278,278,564,564,564,444,921,722,667,667,722,611,556,722,722,333,389,722,611,889,722,722,556,722,667,556,611,722,722,944,722,722,611,333,278,333,469,500,333,444,500,444,500,444,333,500,500,278,278,500,278,778,500,500,500,500,333,389,278,500,500,722,500,500,444,480,200,480,541],rH=[250,333,555,500,500,1e3,833,278,333,333,500,570,250,333,250,278,500,500,500,500,500,500,500,500,500,500,333,333,570,570,570,500,930,722,667,722,722,667,611,778,778,389,500,778,667,944,722,778,611,778,722,556,667,722,722,1e3,722,722,667,333,278,333,581,500,333,500,556,444,556,444,333,500,556,278,333,556,278,833,556,500,556,556,444,389,333,556,500,722,500,500,444,394,220,394,520],iH=new Map([[8364,[556,556,500,500]],[8218,[222,278,333,333]],[402,[556,556,500,500]],[8222,[333,500,444,500]],[8230,[1e3,1e3,1e3,1e3]],[8224,[556,556,500,500]],[8225,[556,556,500,500]],[710,[333,333,333,333]],[8240,[1e3,1e3,1e3,1e3]],[352,[667,667,556,556]],[8249,[333,333,333,333]],[338,[1e3,1e3,889,1e3]],[381,[611,611,611,667]],[8216,[222,278,333,333]],[8217,[222,278,333,333]],[8220,[333,500,444,500]],[8221,[333,500,444,500]],[8226,[350,350,350,350]],[8211,[556,556,500,500]],[8212,[1e3,1e3,1e3,1e3]],[732,[333,333,333,333]],[8482,[1e3,1e3,980,1e3]],[353,[500,556,389,389]],[8250,[333,333,333,333]],[339,[944,944,722,722]],[382,[500,500,444,444]],[376,[667,667,722,722]]]),nH={Helvetica:0,"Helvetica-Bold":1,"Times-Roman":2,"Times-Bold":3,Courier:0,"Courier-Bold":0},oH=new Map([["\xC6","W"],["\xE6","m"],["\xD0","D"],["\xF0","o"],["\xD8","O"],["\xF8","o"],["\xDE","P"],["\xFE","p"],["\xDF","b"],["\u0152","W"],["\u0153","w"]]);function Vn(e,t){const s=Uf(t);if(s==="Courier"||s==="Courier-Bold")return Q6;const r=lH(s),i=e.codePointAt(0)??0;if(i>=Bn&&i<=Vf)return r[i-Bn]??ql;const n=iH.get(i);if(n)return n[nH[s]];const o=cH(e).codePointAt(0)??0;return o>=Bn&&o<=Vf?r[o-Bn]??ql:ql}function aH(e,t){const s=Hf[Uf(t)];return s.ascent/(s.ascent+s.descent)*e}function lH(e){switch(e){case"Helvetica-Bold":return tH;case"Times-Roman":return sH;case"Times-Bold":return rH;default:return eH}}function Uf(e){return J6(Hf,e)?e:"Helvetica"}function cH(e){const t=oH.get(e);return t||(e.normalize("NFD")[0]??"?")}var uH=new Map([[8364,128],[8218,130],[402,131],[8222,132],[8230,133],[8224,134],[8225,135],[710,136],[8240,137],[352,138],[8249,139],[338,140],[381,142],[8216,145],[8217,146],[8220,147],[8221,148],[8226,149],[8211,150],[8212,151],[732,152],[8482,153],[353,154],[8250,155],[339,156],[382,158],[376,159]]);function Hn(e,t=!0){let s=t?"FEFF":"";for(const r of e)s+=dH(r.codePointAt(0)??65533);return`<${s}>`}function dH(e){if(e<=65535)return e.toString(16).toUpperCase().padStart(4,"0");const t=e-65536,s=55296+(t>>>10),r=56320+(t&1023);return`${s.toString(16).toUpperCase().padStart(4,"0")}${r.toString(16).toUpperCase().padStart(4,"0")}`}function Zl(e,t=!1,s=!1){const r=e.replace(/\r\n?/g,`
`),i=t?r:r.replace(/\n/g," ");let n="";for(const o of i){if(o===`
`){n+=o;continue}const a=o.codePointAt(0)??0;n+=s||Wf(a)!=null?o:"?"}return n}function hH(e,t,s,r,i=!1,n){if(!e||!Number.isFinite(t)||t<=0||!Number.isFinite(s)||s<=0)return[];if(i)return pH(e,t,s,r,n);const o=[],a=e.split(`
`);for(const l of a){if(!l.trim()){o.push("");continue}const c=l.trim().split(/\s+/);let u="",d=0;const h=It(" ",s,r,n);for(const p of c){const g=It(p,s,r,n),f=u?d+h+g:g;if(f<=t){u=u?`${u} ${p}`:p,d=f;continue}u&&o.push(u);const m=bH(p,t,s,r,n),v=m.length-1;for(let C=0;C<v;C++)o.push(m[C]);u=m[v]??"",d=It(u,s,r,n)}u&&o.push(u)}return o}function pH(e,t,s,r,i){const n=[];for(const o of e.split(`
`)){if(!o){n.push("");continue}const a=Array.from(o);let l=0;for(;l<a.length;){let c=0,u=-1,d=l;for(;d<a.length;){const h=a[d],p=c+It(h,s,r,i);if(p>t)break;c=p,d+=1,h===" "&&(u=d)}if(d===a.length){n.push(a.slice(l).join(""));break}d===l?d+=1:u>l&&(d=u),n.push(a.slice(l,d).join("")),l=d}}return n}var gH=String.raw`\(`,fH=String.raw`\)`;function ii(e){let t="";for(const s of e){const r=s.codePointAt(0)??0,i=Wf(r)??63;i===40?t+=gH:i===41?t+=fH:i===92?t+="\\\\":i>=32&&i<=126?t+=String.fromCharCode(i):t+=`\\${i.toString(8).padStart(3,"0")}`}return t}function mH(e,t,s){if(!Number.isFinite(t)||t<=0)return 0;let r=0;for(const i of e)r+=Vn(i,s);return r/1e3*t}function zf(e,t,s,r,i){if(!e||!Number.isFinite(t)||t<=0||!Number.isFinite(s)||s<=0)return"";if(It(e,s,r,i)<=t)return e;const n="...",o=It(n,s,r,i),a=o<=t,l=a?t-o:t;let c="",u=0;for(const d of e){const h=It(d,s,r,i);if(u+h>l)break;c+=d,u+=h}return a?`${c}${n}`:c}function vH(e,t,s,r,i){if(!e||!Number.isFinite(t)||t<=0||!Number.isFinite(s)||s<=0)return"";let n="",o=0;for(const a of e){const l=It(a,s,r,i);if(o+l>t)break;n+=a,o+=l}return n}function CH(e,t,s,r,i){return zf(`${e}...`,t,s,r,i)}function k(e){return Number.isFinite(e)?Number.isInteger(e)?e.toString():e.toFixed(2):"0"}function Wf(e){return e>=32&&e<=126||e>=160&&e<=255?e:uH.get(e)}function bH(e,t,s,r,i){const n=[];let o="",a=0;for(const l of e){const c=It(l,s,r,i);o&&a+c>t&&(n.push(o),o="",a=0),o+=l,a+=c}return o&&n.push(o),n}function It(e,t,s,r){return r?r(e):mH(e,t,s)}function SH(e,t){return`${e}:${t}`}var yH=new Map([[40,41],[41,40],[60,62],[62,60],[91,93],[93,91],[123,125],[125,123],[171,187],[187,171],[8249,8250],[8250,8249],[8261,8262],[8262,8261],[8317,8318],[8318,8317],[8333,8334],[8334,8333],[9001,9002],[9002,9001],[12296,12297],[12297,12296],[12298,12299],[12299,12298],[12300,12301],[12301,12300],[12302,12303],[12303,12302],[12304,12305],[12305,12304],[12308,12309],[12309,12308],[12310,12311],[12311,12310],[12312,12313],[12313,12312],[12314,12315],[12315,12314],[65113,65114],[65114,65113],[65115,65116],[65116,65115],[65117,65118],[65118,65117],[65288,65289],[65289,65288],[65308,65310],[65310,65308],[65339,65341],[65341,65339],[65371,65373],[65373,65371],[65375,65376],[65376,65375],[65378,65379],[65379,65378]]);function Un(e,t="auto"){const s=xH(e),r=t==="auto"?FH(s):t,i=r==="rtl"?1:0,n=TH(s,i),o=s.filter(u=>!Yf(u.codePoint)),a=n.filter((u,d)=>!Yf(s[d].codePoint));let l=i,c=Number.POSITIVE_INFINITY;for(const u of a)l=Math.max(l,u),u%2&&(c=Math.min(c,u));if(Number.isFinite(c))for(let u=l;u>=c;u--){let d=0;for(;d<o.length;){for(;d<o.length&&a[d]<u;)d++;let h=d;for(;h<o.length&&a[h]>=u;)h++;qf(o,d,h),qf(a,d,h),d=h}}wH(o,a);for(let u=0;u<o.length;u++){const d=o[u],h=a[u]%2===1;if(d.direction=h?"rtl":"ltr",h){const p=yH.get(d.codePoint);p!=null&&(d.codePoint=p,d.text=String.fromCodePoint(p))}}return{characters:o,direction:r}}function wH(e,t){let s=0;for(;s<e.length;){if(!Xl(e[s].codePoint)){s++;continue}const r=s;for(;s<e.length&&Xl(e[s].codePoint);)s++;if(s>=e.length)break;const i=e.splice(r,s-r).reverse(),n=t.splice(r,s-r).reverse();e.splice(r+1,0,...i),t.splice(r+1,0,...n),s=r+i.length+1}}function Kf(e,t="auto"){const s=Un(e,t);return{text:s.characters.map(r=>r.text).join(""),direction:s.direction}}function xH(e){const t=[];let s=0;for(const r of e)t.push({text:r,codePoint:r.codePointAt(0)??65533,sourceIndex:s,direction:"ltr"}),s+=r.length;return t}function FH(e){for(const t of e){const s=jf(t.codePoint);if(s==="R"||s==="AL")return"rtl";if(s==="L")return"ltr"}return"ltr"}function TH(e,t){const s=e.map(i=>jf(i.codePoint));let r=t?"R":"L";for(let i=0;i<s.length;i++){const n=s[i];n==="NSM"?s[i]=i?s[i-1]:r:n==="AL"?(s[i]="R",r="R"):(n==="L"||n==="R")&&(r=n)}for(let i=0;i<s.length;i++){if(s[i]!=="N")continue;const n=$f(s,i,-1)??(t?"R":"L"),o=$f(s,i,1)??(t?"R":"L");s[i]=n===o?n:t?"R":"L"}return s.map(i=>t===0?i==="R"?1:i==="EN"||i==="AN"?2:0:i==="L"||i==="EN"||i==="AN"?2:1)}function $f(e,t,s){for(let r=t+s;r>=0&&r<e.length;r+=s){const i=e[r];if(i==="L"||i==="R")return i;if(i==="EN"||i==="AN")return"L"}}function jf(e){return Xl(e)?"NSM":e>=48&&e<=57?"EN":e>=1632&&e<=1641||e>=1776&&e<=1785?"AN":e>=1424&&e<=1535||e>=64285&&e<=64335?"R":e>=1536&&e<=2303||e>=64336&&e<=65023||e>=65136&&e<=65279?"AL":e>=65&&e<=90||e>=97&&e<=122||e>=192&&e<=687||e>=880&&e<=1327||e>=12352&&e<=12543||e>=13312&&e<=40959?"L":"N"}function Xl(e){return e>=768&&e<=879||e>=1425&&e<=1479||e>=1552&&e<=1562||e>=1611&&e<=1631||e===1648||e>=1750&&e<=1773}function Yf(e){return e===1564||e===8206||e===8207||e>=8234&&e<=8238||e>=8294&&e<=8297}function qf(e,t,s){for(let r=t,i=s-1;r<i;r++,i--){const n=e[r];e[r]=e[i],e[i]=n}}var AH=["isol","fina","medi","init"],Zf=["ccmp","locl","rlig","calt","liga"],PH=["kern","curs","mark","mkmk"],RH=new Set(["ar","fa","ps","sd","ug","ur"]);function MH(e,t,s,r){const i=e.normalize("NFC"),n=GH(i),o=OH(n,r),a=Un(i,s),l=new Map;for(const p of a.characters)l.set(p.sourceIndex,p);let c=[];for(const p of n){const g=l.get(p.sourceIndex);if(!g)continue;const f=t.getGlyphId(g.codePoint);c.push({glyphId:f,codePoint:p.codePoint,cluster:p.sourceIndex,unicode:p.text,xAdvance:t.getAdvanceWidth(f),yAdvance:0,xOffset:0,yOffset:0})}const u=t.getTable("GSUB");if(u){for(const p of Zf.slice(0,2))c=Jl(u,c,o,r,p);if(o==="arab"){const p=NH(n);for(const g of AH)c=Jl(u,c,o,r,g,f=>p.get(f.cluster)===g)}for(const p of Zf.slice(2))c=Jl(u,c,o,r,p)}for(const p of c)p.xAdvance=t.getAdvanceWidth(p.glyphId);const d=t.getTable("GPOS");if(d)for(const p of PH)c=IH(d,c,o,r,p);const h=new Map;for(let p=0;p<a.characters.length;p++)h.set(a.characters[p].sourceIndex,p);return c.sort((p,g)=>{const f=h.get(p.cluster)??p.cluster,m=h.get(g.cluster)??g.cluster;return f-m}),{direction:a.direction,glyphs:c.map(({codePoint:p,...g})=>g)}}function Jl(e,t,s,r,i,n){const o=new dm(e),a=om(o,s,r,i);if(!a.length)return t;const l=Xf(t);try{for(const c of a)t=Jf(o,c,t,n);return t}catch{return l}}function IH(e,t,s,r,i){const n=new dm(e),o=om(n,s,r,i);if(!o.length)return t;const a=Xf(t);try{return EH(n,o,a),a}catch{return t}}function Xf(e){return e.map(t=>({...t}))}function Jf(e,t,s,r){const i=e.u16(t),n=e.u16(t+4);for(let o=0;o<n;o++){const a=t+e.u16(t+6+o*2);if(i===1)rm(e,a,s,r);else if(i===2)s=sm(e,a,s,r);else if(i===4)s=im(e,a,s,r);else if(i===5)s=Qf(e,a,s);else if(i===6)s=em(e,a,s);else if(i===7&&e.u16(a)===1){const l=e.u16(a+2),c=a+e.u32(a+4);l===1?rm(e,c,s,r):l===2?s=sm(e,c,s,r):l===4?s=im(e,c,s,r):l===5?s=Qf(e,c,s):l===6&&(s=em(e,c,s))}}return s}function Qf(e,t,s){if(e.u16(t)!==3)return s;const r=e.u16(t+2),i=e.u16(t+4),n=[];for(let a=0;a<r;a++)n.push(t+e.u16(t+6+a*2));const o=t+6+r*2;return tm(e,s,n,[],[],o,i)}function em(e,t,s){if(e.u16(t)!==3)return s;let r=t+2;const i=e.u16(r);r+=2;const n=[];for(let d=0;d<i;d++,r+=2)n.push(t+e.u16(r));const o=e.u16(r);r+=2;const a=[];for(let d=0;d<o;d++,r+=2)a.push(t+e.u16(r));const l=e.u16(r);r+=2;const c=[];for(let d=0;d<l;d++,r+=2)c.push(t+e.u16(r));const u=e.u16(r);return tm(e,s,a,n,c,r+2,u)}function tm(e,t,s,r,i,n,o){const a=e.u16(8);for(let l=0;l+s.length<=t.length;l++)if(Ql(e,t,l,s,1)&&Ql(e,t,l-1,r,-1)&&Ql(e,t,l+s.length,i,1))for(let c=0;c<o;c++){const u=n+c*4,d=e.u16(u),h=t[l+d];if(!h)continue;const p=e.u16(u+2),g=a+e.u16(a+2+p*2);t=Jf(e,g,t,f=>f===h)}return t}function Ql(e,t,s,r,i){for(let n=0;n<r.length;n++){const o=t[s+n*i];if(!o||st(e,r[n],o.glyphId)<0)return!1}return!0}function sm(e,t,s,r){if(e.u16(t)!==1)return s;const i=t+e.u16(t+2),n=e.u16(t+4);for(let o=s.length-1;o>=0;o--){const a=s[o];if(r&&!r(a))continue;const l=st(e,i,a.glyphId);if(l<0||l>=n)continue;const c=t+e.u16(t+6+l*2),u=e.u16(c),d=[];for(let h=0;h<u;h++)d.push({...a,glyphId:e.u16(c+2+h*2),unicode:h?"":a.unicode});s.splice(o,1,...d)}return s}function rm(e,t,s,r){const i=e.u16(t),n=t+e.u16(t+2);for(const o of s){if(r&&!r(o))continue;const a=st(e,n,o.glyphId);a<0||(i===1?o.glyphId=o.glyphId+e.i16(t+4)&65535:i===2&&a<e.u16(t+4)&&(o.glyphId=e.u16(t+6+a*2)))}}function im(e,t,s,r){if(e.u16(t)!==1)return s;const i=t+e.u16(t+2),n=e.u16(t+4);for(let o=0;o<s.length;o++){const a=s[o];if(r&&!r(a))continue;const l=st(e,i,a.glyphId);if(l<0||l>=n)continue;const c=t+e.u16(t+6+l*2),u=e.u16(c);for(let d=0;d<u;d++){const h=c+e.u16(c+2+d*2),p=e.u16(h+2);if(p<2||o+p>s.length)continue;let g=!0;for(let v=1;v<p;v++)if(s[o+v].glyphId!==e.u16(h+2+v*2)){g=!1;break}if(!g)continue;const f=s.slice(o,o+p),m=e.u16(h);s.splice(o,p,{...a,glyphId:m,unicode:f.map(v=>v.unicode).join(""),xAdvance:f.reduce((v,C)=>v+C.xAdvance,0)});break}}return s}function EH(e,t,s){for(const r of t){const i=e.u16(r),n=e.u16(r+2),o=e.u16(r+4);for(let a=0;a<o;a++){let l=r+e.u16(r+6+a*2),c=i;i===9&&e.u16(l)===1&&(c=e.u16(l+2),l+=e.u32(l+4)),c===2?_H(e,l,s):c===3?DH(e,l,s,(n&1)!==0):c===4?LH(e,l,s):c===6&&kH(e,l,s)}}}function DH(e,t,s,r){if(e.u16(t)!==1)return;const i=t+e.u16(t+2),n=e.u16(t+4);for(let o=0;o+1<s.length;o++){const a=st(e,i,s[o].glyphId),l=st(e,i,s[o+1].glyphId);if(a<0||l<0||a>=n||l>=n)continue;const c=t+6+a*4,u=t+6+l*4,d=e.u16(c+(r?0:2)),h=e.u16(u+(r?2:0));if(!d||!h)continue;const p=Ws(e,t+d),g=Ws(e,t+h);!p||!g||(s[o].xAdvance+=p.x-g.x,s[o+1].yOffset+=s[o].yOffset+p.y-g.y)}}function LH(e,t,s){if(e.u16(t)!==1)return;const r=t+e.u16(t+2),i=t+e.u16(t+4),n=e.u16(t+6),o=t+e.u16(t+8),a=t+e.u16(t+10);for(let l=1;l<s.length;l++){const c=st(e,r,s[l].glyphId);if(c<0||c>=e.u16(o))continue;let u=l-1,d=-1;for(;u>=0&&(d=st(e,i,s[u].glyphId),!(d>=0));)u--;if(d<0||d>=e.u16(a))continue;const h=o+2+c*4,p=e.u16(h);if(p>=n)continue;const g=Ws(e,o+e.u16(h+2)),f=e.u16(a+2+(d*n+p)*2);if(!f||!g)continue;const m=Ws(e,a+f);if(!m)continue;let v=0;for(let C=u;C<l;C++)v+=s[C].xAdvance;s[l].xOffset+=m.x-g.x-v,s[l].yOffset+=m.y-g.y,s[l].xAdvance=0}}function kH(e,t,s){if(e.u16(t)!==1)return;const r=t+e.u16(t+2),i=t+e.u16(t+4),n=e.u16(t+6),o=t+e.u16(t+8),a=t+e.u16(t+10);for(let l=1;l<s.length;l++){const c=st(e,r,s[l].glyphId),u=st(e,i,s[l-1].glyphId);if(c<0||u<0||c>=e.u16(o)||u>=e.u16(a))continue;const d=o+2+c*4,h=e.u16(d);if(h>=n)continue;const p=Ws(e,o+e.u16(d+2)),g=e.u16(a+2+(u*n+h)*2);if(!p||!g)continue;const f=Ws(e,a+g);f&&(s[l].xOffset+=s[l-1].xOffset+f.x-p.x,s[l].yOffset+=s[l-1].yOffset+f.y-p.y,s[l].xAdvance=0)}}function Ws(e,t){const s=e.u16(t);if(!(s<1||s>3))return{x:e.i16(t+2),y:e.i16(t+4)}}function _H(e,t,s){const r=e.u16(t),i=t+e.u16(t+2),n=e.u16(t+4),o=e.u16(t+6),a=lm(n),l=lm(o);for(let c=0;c+1<s.length;c++){const u=s[c],d=s[c+1],h=st(e,i,u.glyphId);if(h<0)continue;let p=-1;if(r===1){const g=e.u16(t+8);if(h>=g)continue;const f=t+e.u16(t+10+h*2),m=e.u16(f),v=2+a+l;for(let C=0;C<m;C++){const b=f+2+C*v;if(e.u16(b)===d.glyphId){p=b+2;break}}}else if(r===2){const g=t+e.u16(t+8),f=t+e.u16(t+10),m=e.u16(t+12),v=e.u16(t+14),C=am(e,g,u.glyphId),b=am(e,f,d.glyphId);C<m&&b<v&&(p=t+16+(C*v+b)*(a+l))}p>=0&&(nm(e,p,n,u),nm(e,p+a,o,d))}}function nm(e,t,s,r){let i=t;s&1&&(r.xOffset+=e.i16(i),i+=2),s&2&&(r.yOffset+=e.i16(i),i+=2),s&4&&(r.xAdvance+=e.i16(i),i+=2),s&8&&(r.yAdvance+=e.i16(i))}function om(e,t,s,r){try{const i=e.u16(4),n=e.u16(6),o=e.u16(8),a=ec(e,i,t)??ec(e,i,"DFLT");if(a==null)return[];const l=i+a,c=BH(s),u=(c?ec(e,l+4,c,e.u16(l+2)):void 0)??e.u16(l);if(!u)return[];const d=l+u,h=e.u16(d+4),p=e.u16(d+2),g=[];p!==65535&&g.push(p);for(let v=0;v<h;v++)g.push(e.u16(d+6+v*2));const f=[];for(const v of g){const C=n+2+v*6;if(e.tag(C)!==r)continue;const b=n+e.u16(C+4),y=e.u16(b+2);for(let S=0;S<y;S++)f.push(e.u16(b+4+S*2))}const m=[];for(const v of f)m.push(o+e.u16(o+2+v*2));return m}catch{return[]}}function ec(e,t,s,r){const i=r??e.u16(t),n=r==null?t+2:t;for(let o=0;o<i;o++){const a=n+o*6;if(e.tag(a)===s)return e.u16(a+4)}}function st(e,t,s){const r=e.u16(t);if(r===1){const i=e.u16(t+2);for(let n=0;n<i;n++)if(e.u16(t+4+n*2)===s)return n}else if(r===2){const i=e.u16(t+2);for(let n=0;n<i;n++){const o=t+4+n*6,a=e.u16(o),l=e.u16(o+2);if(s>=a&&s<=l)return e.u16(o+4)+s-a}}return-1}function am(e,t,s){const r=e.u16(t);if(r===1){const i=e.u16(t+2),n=e.u16(t+4);return s>=i&&s<i+n?e.u16(t+6+(s-i)*2):0}if(r===2){const i=e.u16(t+2);for(let n=0;n<i;n++){const o=t+4+n*6;if(s>=e.u16(o)&&s<=e.u16(o+2))return e.u16(o+4)}}return 0}function lm(e){let t=0;for(let s=0;s<8;s++)e&1<<s&&t++;return t*2}function GH(e){const t=[];let s=0;for(const r of e)t.push({text:r,codePoint:r.codePointAt(0)??65533,sourceIndex:s}),s+=r.length;return t}function OH(e,t){const s=t?.toLowerCase().split("-")[0];if(s==="ja")return"kana";if(s==="zh")return"hani";let r=!1;for(const i of e){const n=i.codePoint;if(n>=1536&&n<=2303)return"arab";if(n>=1424&&n<=1535)return"hebr";if(n>=880&&n<=1023)return"grek";if(n>=1024&&n<=1327)return"cyrl";if(n>=12352&&n<=12543)return"kana";if(n>=13312&&n<=40959)return"hani";(n>=65&&n<=90||n>=97&&n<=122||n>=192&&n<=687)&&(r=!0)}return!r&&s&&RH.has(s)?"arab":"latn"}function NH(e){const t=new Map;for(let s=0;s<e.length;s++){const r=um(e[s].codePoint);if(r==="U"||r==="T")continue;const i=cm(e,s,-1),n=cm(e,s,1),o=(r==="D"||r==="R")&&i==="D",a=r==="D"&&(n==="D"||n==="R");t.set(e[s].sourceIndex,o&&a?"medi":o?"fina":a?"init":"isol")}return t}function cm(e,t,s){for(let r=t+s;r>=0&&r<e.length;r+=s){const i=um(e[r].codePoint);if(i!=="T")return i}}function um(e){return e>=1552&&e<=1562||e>=1611&&e<=1631||e===1648||e>=1750&&e<=1773?"T":e===1570||e===1571||e===1572||e===1573||e===1575||e===1577||e>=1583&&e<=1586||e===1608||e===1609||e===1649||e===1688?"R":e>=1568&&e<=1747?"D":"U"}function BH(e){if(!e)return;const t=e.toLowerCase(),s=t.split("-")[0];return{ar:"ARA ",bg:"BGR ",el:"ELL ",fa:"FAR ",he:"IWR ",ja:"JAN ",ur:"URD ",zh:t.includes("-tw")||t.includes("-hk")||t.includes("-hant")?"ZHT ":"ZHS "}[s]}var dm=class{constructor(e){this.data=e,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength)}u16(e){return this.ensure(e,2),this.view.getUint16(e,!1)}i16(e){return this.ensure(e,2),this.view.getInt16(e,!1)}u32(e){return this.ensure(e,4),this.view.getUint32(e,!1)}tag(e){return this.ensure(e,4),String.fromCharCode(this.data[e],this.data[e+1],this.data[e+2],this.data[e+3])}ensure(e,t){if(e<0||e+t>this.data.length)throw new Error("Invalid OpenType layout offset.")}},VH=new Set(["OS/2","cmap","cvt ","fpgm","gasp","glyf","head","hhea","hmtx","loca","maxp","name","post","prep"]);function HH(e,t){const s=ZH(e.data),r=new DataView(s.buffer,s.byteOffset,s.byteLength);ft(s,0,12,t);const i=tc(s,0);if(rt(r,0)!==65536&&i!=="true")throw new Error(`AG Grid: PDF font "${t}" must be a static TrueType TTF font.`);const n=XH(s,r,t);if(n.has("CFF ")||n.has("CFF2"))throw new Error(`AG Grid: PDF font "${t}" uses unsupported CFF outlines.`);const o=bs(n,"head",t),a=bs(n,"hhea",t),l=bs(n,"maxp",t),c=bs(n,"hmtx",t),u=bs(n,"cmap",t),d=bs(n,"loca",t),h=bs(n,"glyf",t),p=n.get("OS/2"),g=n.get("post"),f=n.get("name");Ss(s,o,54,t,"head"),Ss(s,a,36,t,"hhea"),Ss(s,l,6,t,"maxp");const m=te(r,o.offset+18);if(!m)throw new Error(`AG Grid: PDF font "${t}" has an invalid unitsPerEm value.`);const v=te(r,l.offset+4),C=mt(r,o.offset+50);if(C!==0&&C!==1)throw new Error(`AG Grid: PDF font "${t}" uses an invalid glyph location format.`);Ss(s,d,(v+1)*(C?4:2),t,"loca");const b=te(r,a.offset+34);if(!v||!b||b>v)throw new Error(`AG Grid: PDF font "${t}" has invalid horizontal metrics.`);Ss(s,c,b*4+Math.max(v-b,0)*2,t,"hmtx");const y=s8(r,p,t),S=JH(s,r,u,t),w=t8(r,c.offset,v,b),F=mt(r,a.offset+4),T=mt(r,a.offset+6),x=[mt(r,o.offset+36),mt(r,o.offset+38),mt(r,o.offset+40),mt(r,o.offset+42)],P=p&&p.length>=8?te(r,p.offset+4):a8(e.weight),L=p&&p.length>=90&&te(r,p.offset)>=2?mt(r,p.offset+88):F,G=g&&g.length>=8?l8(r,g.offset+4):0,O=o8(r8(s,r,f)||t),z=new Map;return{data:s,postScriptName:O,unitsPerEm:m,ascent:F,descent:T,capHeight:L,bbox:x,italicAngle:G,weight:P,style:e.style??(G?"italic":"normal"),canSubset:y,getTable:B=>{const W=n.get(B);return W?s.subarray(W.offset,W.offset+W.length):void 0},getGlyphId:B=>{const W=z.get(B);if(W!=null)return W;const J=S(B),Q=J>=0&&J<v?J:0;return z.set(B,Q),Q},getAdvanceWidth:B=>w[B]??w[0]??m,createSubset:B=>y?UH(s,r,n,d,h,v,C,B,t):s}}function UH(e,t,s,r,i,n,o,a,l){const c=zH(t,r.offset,n,o);WH(c,i.length,l);const u=KH(t,i,c,n,a,l),d=new Map;for(const[C,b]of s)VH.has(C)&&d.set(C,e.slice(b.offset,b.offset+b.length));const h=[],p=[];for(let C=0;C<n;C++){if(p.push(h.length),!u.has(C))continue;const b=c[C],y=c[C+1];for(let S=b;S<y;S++)h.push(e[i.offset+S]);o===0&&h.length%2&&h.push(0)}p.push(h.length),d.set("glyf",new Uint8Array(h)),d.set("loca",$H(p,o));const g=d.get("head");Ks(new DataView(g.buffer,g.byteOffset,g.byteLength),8,0);const f=jH(d),m=new DataView(f.buffer,f.byteOffset,f.byteLength),v=YH(f,m,"head");return Ks(m,v+8,2981146554-hm(f)>>>0),f}function zH(e,t,s,r){const i=[];for(let n=0;n<=s;n++)i.push(r===0?te(e,t+n*2)*2:rt(e,t+n*4));return i}function WH(e,t,s){let r=e[0];if(r!==0)throw new Error(`AG Grid: PDF font "${s}" contains invalid glyph offsets.`);for(let i=0;i<e.length;i++){const n=e[i];if(n<r||n>t)throw new Error(`AG Grid: PDF font "${s}" contains invalid glyph offsets.`);r=n}}function KH(e,t,s,r,i,n){const o=new Set([0]),a=[];for(const l of i)Number.isInteger(l)&&l>=0&&l<r&&!o.has(l)&&(o.add(l),a.push(l));for(;a.length;){const l=a.pop(),c=s[l],u=s[l+1];if(c===u)continue;let d=t.offset+c;const h=t.offset+u;if(d+10>h||mt(e,d)>=0)continue;d+=10;let p=!0;for(;p;){if(d+4>h)throw new Error(`AG Grid: PDF font "${n}" contains a truncated composite glyph.`);const g=te(e,d),f=te(e,d+2);if(f>=r)throw new Error(`AG Grid: PDF font "${n}" contains an invalid composite glyph reference.`);o.has(f)||(o.add(f),a.push(f)),d+=4,d+=(g&1)!==0?4:2,(g&8)!==0?d+=2:(g&64)!==0?d+=4:(g&128)!==0&&(d+=8),p=(g&32)!==0}}return o}function $H(e,t){const s=t===0?2:4,r=new Uint8Array(e.length*s),i=new DataView(r.buffer);for(let n=0;n<e.length;n++)t===0?i.setUint16(n*2,e[n]/2,!1):i.setUint32(n*4,e[n],!1);return r}function jH(e){const t=Array.from(e.entries()).sort(([d],[h])=>d.localeCompare(h)),s=t.length,r=2**Math.floor(Math.log2(s)),i=r*16,n=Math.log2(r),o=s*16-i;let a=12+s*16;for(const[,d]of t)a+=pm(d.length);const l=new Uint8Array(a),c=new DataView(l.buffer);Ks(c,0,65536),c.setUint16(4,s,!1),c.setUint16(6,i,!1),c.setUint16(8,n,!1),c.setUint16(10,o,!1);let u=12+s*16;for(let d=0;d<t.length;d++){const[h,p]=t[d],g=12+d*16;qH(l,g,h),Ks(c,g+4,hm(p)),Ks(c,g+8,u),Ks(c,g+12,p.length),l.set(p,u),u+=pm(p.length)}return l}function YH(e,t,s){const r=te(t,4);for(let i=0;i<r;i++){const n=12+i*16;if(tc(e,n)===s)return rt(t,n+8)}return 0}function hm(e){let t=0;for(let s=0;s<e.length;s+=4){const r=(e[s]??0)<<24|(e[s+1]??0)<<16|(e[s+2]??0)<<8|(e[s+3]??0);t=t+(r>>>0)>>>0}return t}function pm(e){return e+3&-4}function qH(e,t,s){for(let r=0;r<4;r++)e[t+r]=s.charCodeAt(r)}function Ks(e,t,s){e.setUint32(t,s>>>0,!1)}function ZH(e){return e instanceof Uint8Array?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}function XH(e,t,s){const r=te(t,4);ft(e,12,r*16,s);const i=new Map;for(let n=0;n<r;n++){const o=12+n*16,a=tc(e,o),l=rt(t,o+8),c=rt(t,o+12);ft(e,l,c,s),i.set(a,{offset:l,length:c})}return i}function bs(e,t,s){const r=e.get(t);if(!r)throw new Error(`AG Grid: PDF font "${s}" is missing the required ${t} table.`);return r}function JH(e,t,s,r){Ss(e,s,4,r,"cmap");const i=te(t,s.offset+2);Ss(e,s,4+i*8,r,"cmap");let n,o;for(let a=0;a<i;a++){const l=s.offset+4+a*8,c=te(t,l),u=te(t,l+2),d=s.offset+rt(t,l+4);ft(e,d,2,r);const h=te(t,d),p=c===0||c===3&&(u===1||u===10);p&&h===12&&n==null?n=d:p&&h===4&&o==null&&(o=d)}if(n!=null)return QH(e,t,n,r);if(o!=null)return e8(e,t,o,r);throw new Error(`AG Grid: PDF font "${r}" does not contain a supported Unicode cmap.`)}function QH(e,t,s,r){ft(e,s,16,r);const i=rt(t,s+4),n=rt(t,s+12);return ft(e,s,i,r),ft(e,s+16,n*12,r),o=>{let a=0,l=n-1;for(;a<=l;){const c=a+l>>>1,u=s+16+c*12,d=rt(t,u),h=rt(t,u+4);if(o<d)l=c-1;else if(o>h)a=c+1;else return rt(t,u+8)+o-d}return 0}}function e8(e,t,s,r){ft(e,s,14,r);const i=te(t,s+2);ft(e,s,i,r);const n=te(t,s+6)/2,o=s+14,a=o+n*2+2,l=a+n*2,c=l+n*2;return u=>{if(u>65535)return 0;for(let d=0;d<n;d++){const h=te(t,o+d*2);if(u>h)continue;const p=te(t,a+d*2);if(u<p)return 0;const g=mt(t,l+d*2),f=c+d*2,m=te(t,f);if(!m)return u+g&65535;const v=f+m+(u-p)*2;if(v+2>s+i)return 0;const C=te(t,v);return C?C+g&65535:0}return 0}}function t8(e,t,s,r){const i=[];let n=0;for(let o=0;o<s;o++)o<r&&(n=te(e,t+o*4)),i.push(n);return i}function s8(e,t,s){if(!t||t.length<10)return!0;const r=te(e,t.offset+8);if((r&2)!==0)throw new Error(`AG Grid: PDF font "${s}" does not permit embedding.`);if((r&512)!==0)throw new Error(`AG Grid: PDF font "${s}" only permits bitmap embedding.`);return(r&256)===0}function r8(e,t,s){if(!s||s.length<6)return;const r=te(t,s.offset+2),i=s.offset+te(t,s.offset+4);if(s.offset+6+r*12>s.offset+s.length)return;let n;for(let o=0;o<r;o++){const a=s.offset+6+o*12,l=te(t,a);if(te(t,a+6)!==6)continue;const u=te(t,a+8),d=i+te(t,a+10);if(d<s.offset||d+u>s.offset+s.length)continue;const h=l===0||l===3?i8(e,d,u):n8(e,d,u);if(l===3)return h;n??(n=h)}return n}function i8(e,t,s){let r="";const i=t+s-s%2;for(let n=t;n<i;n+=2)r+=String.fromCharCode(e[n]<<8|e[n+1]);return r}function n8(e,t,s){let r="";for(let i=t,n=t+s;i<n;i++)r+=String.fromCharCode(e[i]);return r}function o8(e){return e.replace(/[^A-Za-z0-9_.+-]/g,"")||"CustomFont"}function a8(e){return e==="bold"?700:e==="normal"||e==null?400:e}function Ss(e,t,s,r,i){if(s>t.length)throw new Error(`AG Grid: PDF font "${r}" has a truncated ${i} table.`);ft(e,t.offset,s,r)}function ft(e,t,s,r){if(!Number.isSafeInteger(t)||!Number.isSafeInteger(s)||t<0||s<0||t+s>e.length)throw new Error(`AG Grid: PDF font "${r}" contains invalid table offsets.`)}function tc(e,t){return String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])}function te(e,t){return e.getUint16(t,!1)}function mt(e,t){return e.getInt16(t,!1)}function rt(e,t){return e.getUint32(t,!1)}function l8(e,t){return e.getInt32(t,!1)/65536}var sc=new Set(["Helvetica","Helvetica-Bold","Times-Roman","Times-Bold","Courier","Courier-Bold"]),c8=new Set(Array.from(sc,e=>zn(e))),gm=class extends Error{constructor(e,t){super(`PDF font family "${e}" is not registered.`),this.family=e,this.registeredFamilies=t,this.name="PdfFontFamilyNotRegisteredError"}},fm=class{constructor(e){this.customFamilies=new Map,this.resolvedFonts=new Map,this.shapedRuns=new Map,this.nextFontIndex=1;for(const t of e??[])this.registerFamily(t)}resolve(e,t,s,r="Helvetica"){const i=e||r,n=mm(t,Cm(i)),o=s??"normal",a=this.customFamilies.get(zn(i));if(a){const c=u8(a.faces,n,o);return this.getOrCreateCustomFont(a.family,c)}if(!sc.has(i))throw new gm(i,this.getRegisteredFamilyNames());const l=d8(i,n);return this.getOrCreateBuiltInFont(l)}measureText(e,t,s,r="auto",i){let n=0;if(s.trueType){const l=this.getShapedRun(e,s,r,i);for(const c of l.glyphs){const u=this.getAsciiFallbackFont(c.glyphId,c.unicode,s);u?n+=Vn(c.unicode,u.family)/1e3*t:n+=c.xAdvance/s.trueType.unitsPerEm*t}return n}const o=Kf(e,r).text,a=s.builtInFamily??"Helvetica";for(const l of o)n+=Vn(l,a);return n/1e3*t}encodeText(e,t,s="auto",r){const i=Kf(e,s);if(!t.trueType)return{operatorValue:`(${ii(i.text)})`,visualText:i.text,direction:i.direction,logicalText:e};const n=this.getShapedRun(e,t,s,r),o=[];let a="";for(const l of n.glyphs){const c=this.getAsciiFallbackFont(l.glyphId,l.unicode,t);if(c){o.push({fontKey:c.key,operatorValue:`(${ii(l.unicode)})`,xAdvance:Vn(l.unicode,c.family)/1e3,yAdvance:0,xOffset:0,yOffset:0});continue}const u=SH(l.glyphId,l.unicode);let d=t.cidByMapping.get(u);if(d==null){if(t.mappingByCid.size>=65535)throw new Error(`AG Grid: PDF font "${t.family}" exceeded the 65,535 character-code limit.`);d=t.mappingByCid.size+1,t.cidByMapping.set(u,d),t.mappingByCid.set(d,{glyphId:l.glyphId,unicode:l.unicode})}a+=d.toString(16).padStart(4,"0"),o.push({fontKey:t.key,operatorValue:`<${d.toString(16).padStart(4,"0")}>`,xAdvance:l.xAdvance/t.trueType.unitsPerEm,yAdvance:l.yAdvance/t.trueType.unitsPerEm,xOffset:l.xOffset/t.trueType.unitsPerEm,yOffset:l.yOffset/t.trueType.unitsPerEm})}return{operatorValue:`<${a}>`,visualText:n.glyphs.map(l=>l.unicode).join(""),direction:n.direction,logicalText:e,glyphRun:n,positionedGlyphs:o}}getBaselineOffset(e,t){return t.trueType?t.trueType.ascent/t.trueType.unitsPerEm*e:aH(e,t.builtInFamily??"Helvetica")}getNaturalLineHeight(e,t){if(!t.trueType)return e;const s=(t.trueType.ascent-t.trueType.descent)/t.trueType.unitsPerEm*e;return Math.max(e,s)}getUsedFonts(){return Array.from(this.resolvedFonts.values()).sort((e,t)=>Number(e.key.slice(1))-Number(t.key.slice(1)))}getShapedRun(e,t,s,r){const i=`${t.key}\0${s}\0${r??""}\0${e}`;let n=this.shapedRuns.get(i);return n||(n=MH(e,t.trueType,s,r),this.shapedRuns.set(i,n)),n}getAsciiFallbackFont(e,t,s){if(e||t.length!==1)return;const r=t.codePointAt(0)??0;if(!(r<32||r>126))return this.resolve("Helvetica",s.weight,"normal")}getRegisteredFamilyNames(){return[...Array.from(this.customFamilies.values(),e=>e.family),...sc]}registerFamily(e){const t=e.family.trim();if(!t)throw new Error("AG Grid: PDF font families require a non-empty family name.");if(!e.faces?.length)throw new Error(`AG Grid: PDF font family "${t}" requires at least one face.`);const s=zn(t);if(this.customFamilies.has(s)||c8.has(s))throw new Error(`AG Grid: PDF font family "${t}" is registered more than once or uses a reserved name.`);const r=[],i=new Set;for(const n of e.faces){const o=HH(n,t),a=mm(n.weight,o.weight),l=n.style??o.style,c=`${a}:${l}`;if(i.has(c))throw new Error(`AG Grid: PDF font family "${t}" contains duplicate ${a} ${l} faces.`);i.add(c),r.push({weight:a,style:l,font:o})}this.customFamilies.set(s,{family:t,faces:r})}getOrCreateCustomFont(e,t){const s=`${zn(e)}:${t.weight}:${t.style}`,r=this.resolvedFonts.get(s);if(r)return r;const i={key:`F${this.nextFontIndex++}`,family:e,weight:t.weight,style:t.style,trueType:t.font,cidByMapping:new Map,mappingByCid:new Map};return this.resolvedFonts.set(s,i),i}getOrCreateBuiltInFont(e){const t=this.resolvedFonts.get(e);if(t)return t;const s={key:`F${this.nextFontIndex++}`,family:e,weight:Cm(e),style:"normal",builtInFamily:e,cidByMapping:new Map,mappingByCid:new Map};return this.resolvedFonts.set(e,s),s}};function u8(e,t,s){let r=e.filter(o=>o.style===s);!r.length&&s==="oblique"&&(r=e.filter(o=>o.style==="italic")),r.length||(r=e.filter(o=>o.style==="normal")),r.length||(r=e);let i=r[0],n=Math.abs(i.weight-t);for(let o=1;o<r.length;o++){const a=r[o],l=Math.abs(a.weight-t);(l<n||l===n&&a.weight>i.weight)&&(i=a,n=l)}return i}function d8(e,t){const s=t>=600;return e==="Times-Roman"||e==="Times-Bold"?s?"Times-Bold":"Times-Roman":e==="Courier"||e==="Courier-Bold"?s?"Courier-Bold":"Courier":s?"Helvetica-Bold":"Helvetica"}function mm(e,t=400){return e==="bold"?700:e==="normal"||e==null?vm(t):vm(e)}function vm(e){return Number.isFinite(e)?Math.min(Math.max(Math.round(e/100)*100,100),900):400}function Cm(e){return e.endsWith("-Bold")?700:400}function zn(e){return e.trim().toLowerCase()}function Wn(e){const t=[];for(let r=0;r<e.length;r+=2048){const i=Math.min(r+2048,e.length);let n="";for(let o=r;o<i;o++)n+=e[o].toString(16).padStart(2,"0");t.push(n)}return`${t.join(`
`)}>`}function h8(e){const t=e.indexOf(","),s=t>=0?e.slice(t+1):e;let r;try{r=atob(s.replace(/\s/g,""))}catch{throw new Error("AG Grid: PDF image data is not valid base64.")}const i=new Uint8Array(r.length);for(let n=0;n<r.length;n++)i[n]=r.charCodeAt(n);return i}var p8=new Set([192,193,194]),g8=new Set([195,197,198,199,201,202,203,205,206,207]);function f8(e){if(e.length<4||e[0]!==255||e[1]!==216)throw new Error("AG Grid: PDF image is not a valid JPEG file.");let t=2;for(;t<e.length;){for(;t<e.length&&e[t]!==255;)t++;for(;t<e.length&&e[t]===255;)t++;if(t>=e.length)break;const s=e[t++];if(s===217||s===218)break;if(s===1||s>=208&&s<=215)continue;if(t+2>e.length)break;const r=rc(e,t);if(r<2||t+r>e.length)throw new Error("AG Grid: PDF image contains an invalid JPEG segment.");if(g8.has(s))throw new Error("AG Grid: PDF Export supports baseline, extended and progressive JPEG images only.");if(p8.has(s)){if(r<8)throw new Error("AG Grid: PDF image contains an invalid JPEG frame.");const i=e[t+2],n=rc(e,t+3),o=rc(e,t+5),a=e[t+7];if(i!==8||!o||!n||a!==1&&a!==3)throw new Error("AG Grid: PDF Export supports 8-bit greyscale and RGB JPEG images.");return{width:o,height:n,colorSpace:a===1?"DeviceGray":"DeviceRGB",bitsPerComponent:i,data:e,filter:"DCTDecode"}}t+=r}throw new Error("AG Grid: PDF image does not contain a supported JPEG frame.")}function rc(e,t){return e[t]<<8|e[t+1]}var m8=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],v8=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258],C8=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],bm=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],b8=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],S8=class{constructor(e){this.data=e,this.byteIndex=0,this.bitBuffer=0,this.bitCount=0}readBits(e){for(;this.bitCount<e;){if(this.byteIndex>=this.data.length)throw new Error("AG Grid: PDF PNG image compressed data ended unexpectedly.");this.bitBuffer|=this.data[this.byteIndex++]<<this.bitCount,this.bitCount+=8}const t=e===32?4294967295:(1<<e)-1,s=this.bitBuffer&t;return this.bitBuffer>>>=e,this.bitCount-=e,s}alignToByte(){this.bitBuffer=0,this.bitCount=0}},ni=class{constructor(e){this.symbolsByCode=new Map;const t=new Array(16).fill(0);let s=0;for(const o of e){if(o<0||o>15)throw new Error("AG Grid: PDF PNG image contains an invalid Huffman code length.");o&&(t[o]+=1,s=Math.max(s,o))}if(!s)throw new Error("AG Grid: PDF PNG image Huffman table has no symbols.");let r=0;for(let o=1;o<=15;o++)r+=t[o]<<15-o;if(r>32768)throw new Error("AG Grid: PDF PNG image contains an over-subscribed Huffman table.");const i=new Array(16).fill(0);let n=0;for(let o=1;o<=15;o++)n=n+t[o-1]<<1,i[o]=n;for(let o=0;o<e.length;o++){const a=e[o];if(!a)continue;const l=A8(i[a]++,a);this.symbolsByCode.set(a<<16|l,o)}this.maximumLength=s}decode(e){let t=0;for(let s=1;s<=this.maximumLength;s++){t|=e.readBits(1)<<s-1;const r=this.symbolsByCode.get(s<<16|t);if(r!=null)return r}throw new Error("AG Grid: PDF PNG image contains an invalid Huffman code.")}},y8=class{constructor(e){this.position=0,this.bytes=new Uint8Array(e)}get length(){return this.position}push(e){this.ensureCapacity(1),this.bytes[this.position]=e,this.position+=1}copyBackReference(e,t){this.ensureCapacity(t);const s=this.bytes;for(let r=0;r<t;r++)s[this.position]=s[this.position-e],this.position+=1}ensureCapacity(e){if(this.position+e>this.bytes.length)throw new Error("AG Grid: PDF PNG image data exceeds its expected dimensions.")}toBytes(){return this.position===this.bytes.length?this.bytes:this.bytes.subarray(0,this.position)}};function w8(e,t){if(e.length<6)throw new Error("AG Grid: PDF PNG image data is not a valid zlib stream.");const s=e[0]&15,r=e[0]<<8|e[1];if(s!==8||r%31!==0||(e[1]&32)!==0)throw new Error("AG Grid: PDF PNG image uses an unsupported zlib stream.");const i=new S8(e.subarray(2,e.length-4)),n=new y8(t);let o=!1;for(;!o;){o=i.readBits(1)===1;const c=i.readBits(2);if(c===0)x8(i,n);else if(c===1){const u=F8();Sm(i,n,u.literalLength,u.distance)}else if(c===2){const u=T8(i);Sm(i,n,u.literalLength,u.distance)}else throw new Error("AG Grid: PDF PNG image contains an invalid DEFLATE block.")}const a=n.toBytes(),l=e[e.length-4]*16777216+e[e.length-3]*65536+e[e.length-2]*256+e[e.length-1];if(P8(a)!==l>>>0)throw new Error("AG Grid: PDF PNG image data failed its zlib checksum.");return a}function x8(e,t){e.alignToByte();const s=e.readBits(16),r=e.readBits(16);if((s^65535)!==r)throw new Error("AG Grid: PDF PNG image contains an invalid stored DEFLATE block.");t.ensureCapacity(s);for(let i=0;i<s;i++)t.push(e.readBits(8))}function Sm(e,t,s,r){for(;;){const i=s.decode(e);if(i<256)t.push(i);else{if(i===256)return;if(i<=285){const n=i-257,o=v8[n]+e.readBits(C8[n]);if(!r)throw new Error("AG Grid: PDF PNG image contains a length without a DEFLATE distance table.");const a=r.decode(e);if(a>=bm.length)throw new Error("AG Grid: PDF PNG image contains an invalid DEFLATE distance.");const l=bm[a]+e.readBits(b8[a]);if(l>t.length)throw new Error("AG Grid: PDF PNG image contains an invalid DEFLATE back-reference.");t.copyBackReference(l,o)}else throw new Error("AG Grid: PDF PNG image contains an invalid DEFLATE length.")}}}function F8(){const e=new Array(288);for(let t=0;t<=143;t++)e[t]=8;for(let t=144;t<=255;t++)e[t]=9;for(let t=256;t<=279;t++)e[t]=7;for(let t=280;t<=287;t++)e[t]=8;return{literalLength:new ni(e),distance:new ni(new Array(32).fill(5))}}function T8(e){const t=e.readBits(5)+257,s=e.readBits(5)+1,r=e.readBits(4)+4,i=new Array(19).fill(0);for(let c=0;c<r;c++)i[m8[c]]=e.readBits(3);const n=new ni(i),o=[],a=t+s;for(;o.length<a;){const c=n.decode(e);if(c<=15)o.push(c);else if(c===16){if(!o.length)throw new Error("AG Grid: PDF PNG image contains an invalid repeated Huffman length.");const u=e.readBits(2)+3,d=o[o.length-1];ic(o,d,u,a)}else if(c===17)ic(o,0,e.readBits(3)+3,a);else if(c===18)ic(o,0,e.readBits(7)+11,a);else throw new Error("AG Grid: PDF PNG image contains an invalid Huffman length.")}const l=o.slice(t);return{literalLength:new ni(o.slice(0,t)),distance:l.some(c=>c>0)?new ni(l):void 0}}function ic(e,t,s,r){if(e.length+s>r)throw new Error("AG Grid: PDF PNG image contains too many Huffman lengths.");for(let i=0;i<s;i++)e.push(t)}function A8(e,t){let s=0;for(let r=0;r<t;r++)s=s<<1|e&1,e>>>=1;return s}function P8(e){let t=1,s=0;for(const r of e)t=(t+r)%65521,s=(s+t)%65521;return(s<<16|t)>>>0}var Kn=[137,80,78,71,13,10,26,10],ym=4e6;function R8(e){M8(e);let t,s,r;const i=[];let n=Kn.length;for(;n+12<=e.length;){const g=nc(e,n),f=O8(e,n+4),m=n+8,v=m+g;if(v+4>e.length)throw new Error("AG Grid: PDF image contains a truncated PNG chunk.");const C=e.subarray(m,v);if(f==="IHDR")t=I8(C);else if(f==="PLTE")s=C;else if(f==="tRNS")r=C;else if(f==="IDAT")i.push(C);else if(f==="IEND")break;n=v+4}if(!t||!i.length)throw new Error("AG Grid: PDF image is missing required PNG data.");const o=G8(i),a=t.bitDepth*t.channels,l=Math.ceil(t.width*a/8),c=(l+1)*t.height,u=w8(o,c);if(u.length!==c)throw new Error("AG Grid: PDF image PNG data does not match its dimensions.");const d=Math.max(1,Math.ceil(a/8)),h=D8(u,l,t.height,d),p=L8(h,t);return k8(p,t,s,r)}function M8(e){if(e.length<Kn.length)throw new Error("AG Grid: PDF image is not a valid PNG file.");for(let t=0;t<Kn.length;t++)if(e[t]!==Kn[t])throw new Error("AG Grid: PDF image is not a valid PNG file.")}function I8(e){if(e.length!==13)throw new Error("AG Grid: PDF image contains an invalid PNG header.");const t=nc(e,0),s=nc(e,4),r=e[8],i=e[9],n=e[10],o=e[11],a=e[12],l=E8(i),u=r===8||i===3&&(r===1||r===2||r===4);if(t&&s&&s>ym/t)throw new Error(`AG Grid: PDF PNG images are limited to ${ym.toLocaleString("en-GB")} pixels.`);if(!t||!s||!u||n!==0||o!==0||a!==0||!l)throw new Error("AG Grid: PDF Export supports non-interlaced, 8-bit PNG images and 1-, 2-, or 4-bit indexed PNG images.");return{width:t,height:s,bitDepth:r,colorType:i,channels:l,colorSpace:i===0||i===4?"DeviceGray":"DeviceRGB"}}function E8(e){return e===0||e===3?1:e===2?3:e===4?2:e===6?4:0}function D8(e,t,s,r){const i=new Uint8Array(t*s);let n=0;for(let o=0;o<s;o++){const a=e[n++],l=o*t;for(let c=0;c<t;c++){const u=e[n++],d=c>=r?i[l+c-r]:0,h=o>0?i[l+c-t]:0,p=o>0&&c>=r?i[l+c-t-r]:0;let g;if(a===0)g=u;else if(a===1)g=u+d;else if(a===2)g=u+h;else if(a===3)g=u+Math.floor((d+h)/2);else if(a===4)g=u+_8(d,h,p);else throw new Error("AG Grid: PDF image uses an invalid PNG scanline filter.");i[l+c]=g&255}}return i}function L8(e,t){if(t.bitDepth===8)return e;const s=new Uint8Array(t.width*t.height),r=Math.ceil(t.width*t.bitDepth/8),i=8/t.bitDepth,n=(1<<t.bitDepth)-1;for(let o=0;o<t.height;o++){const a=o*r,l=o*t.width;for(let c=0;c<t.width;c++){const u=e[a+Math.floor(c/i)],d=8-t.bitDepth*(c%i+1);s[l+c]=u>>>d&n}}return s}function k8(e,t,s,r){const i=t.width*t.height,n=t.colorSpace==="DeviceGray"?1:3,o=new Uint8Array(i*n),a=new Uint8Array(i);a.fill(255);let l=!1;for(let c=0;c<i;c++){const u=c*t.channels,d=c*n;if(t.colorType===0){const h=e[u];o[d]=h;const p=r?.length===2?$n(r,0):-1;h===p&&(a[c]=0,l=!0)}else if(t.colorType===2)o[d]=e[u],o[d+1]=e[u+1],o[d+2]=e[u+2],r?.length===6&&e[u]===$n(r,0)&&e[u+1]===$n(r,2)&&e[u+2]===$n(r,4)&&(a[c]=0,l=!0);else if(t.colorType===3){const h=e[u],p=h*3;if(!s||p+2>=s.length)throw new Error("AG Grid: PDF image contains an invalid PNG palette index.");o[d]=s[p],o[d+1]=s[p+1],o[d+2]=s[p+2];const g=r?.[h]??255;a[c]=g,g!==255&&(l=!0)}else t.colorType===4?(o[d]=e[u],a[c]=e[u+1],a[c]!==255&&(l=!0)):(o[d]=e[u],o[d+1]=e[u+1],o[d+2]=e[u+2],a[c]=e[u+3],a[c]!==255&&(l=!0))}return{width:t.width,height:t.height,colorSpace:t.colorSpace,bitsPerComponent:8,data:o,alpha:l?a:void 0}}function _8(e,t,s){const r=e+t-s,i=Math.abs(r-e),n=Math.abs(r-t),o=Math.abs(r-s);return i<=n&&i<=o?e:n<=o?t:s}function G8(e){let t=0;for(const i of e)t+=i.length;const s=new Uint8Array(t);let r=0;for(const i of e)s.set(i,r),r+=i.length;return s}function O8(e,t){return String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])}function $n(e,t){return e[t]<<8|e[t+1]}function nc(e,t){return e[t]*16777216+e[t+1]*65536+e[t+2]*256+e[t+3]}var wm=72/96,N8=4,B8=class{constructor(){this.resourceById=new Map}resolve(e){const t=e.id.trim();if(!t)throw new Error("AG Grid: PDF images require a non-empty id.");let s=this.resourceById.get(t);s||(s={...V8(e),id:t,key:`Im${this.resourceById.size+1}`},this.resourceById.set(t,s));const r=s.width*wm,i=s.height*wm,n=Fm(e.width),o=Fm(e.height);let a=n??r,l=o??i;return n!=null&&o==null?l=n*(s.height/s.width):o!=null&&n==null&&(a=o*(s.width/s.height)),{resource:s,width:a,height:l,alignment:e.alignment??"start",gap:U8(e.gap),altText:e.altText}}getResources(){return Array.from(this.resourceById.values())}};function xm(e,t){if(e.width<=t||e.width<=0)return e;const s=Math.max(t,0)/e.width;return{...e,width:e.width*s,height:e.height*s}}function V8(e){const t=h8(e.base64),s=e.imageType.toLowerCase();if(H8(e,s),s==="png")return R8(t);if(s==="jpg"||s==="jpeg")return f8(t);throw new Error(`AG Grid: PDF Export does not support "${e.imageType}" images.`)}function H8(e,t){const s=/^data:image\/([a-z0-9.+-]+)[;,]/i.exec(e.base64)?.[1].toLowerCase();if(!s)return;if(s!==t&&!(s==="jpeg"&&(t==="jpg"||t==="jpeg")))throw new Error(`AG Grid: PDF image "${e.id}" is a "${s}" data URL but its imageType is "${e.imageType}".`)}function Fm(e){return e!=null&&Number.isFinite(e)&&e>0?e:void 0}function U8(e){return e!=null&&Number.isFinite(e)?Math.max(e,0):N8}var oc={r:255,g:255,b:255},ys={backgroundColor:"#ffffff",dataBackgroundColor:"#ffffff",oddRowBackgroundColor:"#ffffff",foregroundColor:"#000000",headerBackgroundColor:"#ffffff",headerTextColor:"#000000",borderColor:"#000000"};function z8(e){const t=e??{},s=ws(t.backgroundColor,ys.backgroundColor),r=t.dataBackgroundColor?ws(t.dataBackgroundColor,ys.dataBackgroundColor,s):s,i=t.oddRowBackgroundColor?ws(t.oddRowBackgroundColor,ys.oddRowBackgroundColor,r??s):r,n=ws(t.headerBackgroundColor,ys.headerBackgroundColor,s),o=ws(t.borderColor,ys.borderColor,s??r),a=ws(t.foregroundColor,ys.foregroundColor,r??s),l=ws(t.headerTextColor,ys.headerTextColor,n??s);return{pageBackground:s,dataBackground:r,oddRowBackground:i,headerBackground:n,border:o,foreground:a,headerText:l}}function Tm(e,t,s){return e==="HEADER"||e==="HEADER_GROUPING"?{background:t.headerBackground,border:t.border,text:t.headerText??t.foreground}:e==="CUSTOM"?{background:t.dataBackground,border:t.border,text:t.foreground}:e==="BODY"?{background:s%2===1?t.oddRowBackground??t.dataBackground:t.dataBackground,border:t.border,text:t.foreground}:{background:t.dataBackground,border:t.border,text:t.foreground}}function qt(e,t,s){if(!e)return t;const r=jn(e);if(r!==null){if(!r)return t;if(!(r.a<=0))return r.a<1?dc(r,s??oc):uc(r)}}function Et(e){const t=(lc(e.r)/255).toFixed(3),s=(lc(e.g)/255).toFixed(3),r=(lc(e.b)/255).toFixed(3);return`${t} ${s} ${r}`}function W8(e){const t=jn(e);return t===null?!0:!!t&&t.a<=0}function ws(e,t,s){if(e){const i=jn(e);if(i===null||i&&i.a<=0)return;if(i&&i.a>0)return i.a<1?dc(i,s??oc):uc(i)}const r=jn(t);if(!(!r||r.a<=0))return r.a<1?dc(r,s??oc):uc(r)}function jn(e){const t=e.trim().toLowerCase();if(!t||t==="transparent"||t==="none")return null;const s=/^color\(\s*srgb(\s+\S.*|\s+(?![\n\r\u2028\u2029])\s)\)$/.exec(t);if(s){const n=s[1].trim(),[o,a]=n.split("/").map(p=>p.trim()),l=o.split(/\s+/).filter(Boolean);if(l.length<3)return;const c=Yn(l[0],!0),u=Yn(l[1],!0),d=Yn(l[2],!0);if(c==null||u==null||d==null)return;const h=a?ac(a):1;return{r:c,g:u,b:d,a:h??1}}if(t.startsWith("#")){const n=t.slice(1);if(!/^(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(n))return;if(n.length===3||n.length===4){const o=Number.parseInt(n[0]+n[0],16),a=Number.parseInt(n[1]+n[1],16),l=Number.parseInt(n[2]+n[2],16),c=n.length===4?Number.parseInt(n[3]+n[3],16)/255:1;return{r:o,g:a,b:l,a:c}}if(n.length===6||n.length===8){const o=Number.parseInt(n.slice(0,2),16),a=Number.parseInt(n.slice(2,4),16),l=Number.parseInt(n.slice(4,6),16),c=n.length===8?Number.parseInt(n.slice(6,8),16)/255:1;return{r:o,g:a,b:l,a:c}}return}const r=/^rgba?\((.+)\)$/.exec(t);if(r){const n=r[1].trim();let o,a;if(n.includes(",")){const h=n.split(",").map(p=>p.trim());if(h.length<3)return;o=h.slice(0,3),a=h[3]}else{const[h,p]=n.split("/").map(g=>g.trim());if(o=h.split(/\s+/).filter(Boolean),a=p,o.length<3)return}const[l,c,u]=o.slice(0,3).map(h=>Yn(h,!1));if(l==null||c==null||u==null)return;const d=a?ac(a):1;return{r:l,g:c,b:u,a:d??1}}const i=/^hsla?\((.+)\)$/.exec(t);if(i){const n=i[1].trim();let o,a;if(n.includes(",")){const p=n.split(",").map(g=>g.trim());if(p.length<3)return;o=p.slice(0,3),a=p[3]}else{const[p,g]=n.split("/").map(f=>f.trim());if(o=p.split(/\s+/).filter(Boolean),a=g,o.length<3)return}const l=Number.parseFloat(o[0]),c=Am(o[1]),u=Am(o[2]);if(!Number.isFinite(l)||c==null||u==null)return;const d=K8(l,c,u),h=a?ac(a):1;return{...d,a:h??1}}}function Yn(e,t){const s=e.trim(),r=s.endsWith("%"),i=Number.parseFloat(s);return Number.isFinite(i)?r?vt(i/100*255):t&&i>=0&&i<=1?vt(i*255):vt(i):null}function ac(e){const t=e.trim(),s=t.endsWith("%"),r=Number.parseFloat(t);return Number.isFinite(r)?cc(s?r/100:r):null}function Am(e){const t=e.trim();if(!t.endsWith("%"))return null;const s=Number.parseFloat(t.slice(0,-1));return Number.isFinite(s)?Math.max(0,Math.min(1,s/100)):null}function K8(e,t,s){const r=(e%360+360)%360,i=(1-Math.abs(2*s-1))*t,n=i*(1-Math.abs(r/60%2-1)),o=s-i/2;let a=0,l=0,c=0;return r<60?(a=i,l=n):r<120?(a=n,l=i):r<180?(l=i,c=n):r<240?(l=n,c=i):r<300?(a=n,c=i):(a=i,c=n),{r:vt((a+o)*255),g:vt((l+o)*255),b:vt((c+o)*255)}}function vt(e){return Math.max(0,Math.min(255,Math.round(e)))}function lc(e){return Number.isFinite(e)?vt(e):0}function cc(e){return Math.max(0,Math.min(1,e))}function uc(e){return{r:e.r,g:e.g,b:e.b}}function dc(e,t){const s=cc(e.a);return{r:vt(e.r*s+t.r*(1-s)),g:vt(e.g*s+t.g*(1-s)),b:vt(e.b*s+t.b*(1-s))}}function Pe(e,t){if(!(!e&&!t))return{...e,...t}}var $8={top:0,right:0,bottom:8,left:0},j8={top:6,right:6,bottom:6,left:6},Y8={top:0,right:0,bottom:12,left:0},q8={top:3,right:6,bottom:3,left:6},Z8="center",X8="left",J8={top:0,right:0,bottom:0,left:0},Pm="ellipsis",Q8=24;function Rm(e,t,s,r,i,n,o,a){if(e)return{text:e,style:o7(t,s,r,i,n,o,a)}}function e7(e,t,s,r,i,n){const o=Yl(e.type),a=Tm(e.type,i,n),l=gc(t),c=Om(o?r:s,l),u=o?t.headerFontSize:t.fontSize,d=o?t.defaultHeaderStyle:t.defaultCellStyle,h=pc(Pe(d,e.style),t,c,a,i,u),p=[];let g=0,f=Dm(e.type,t);for(const b of e.cells){const y=Math.min((b.mergeAcross??0)+1,t.columnCount-g);if(y<=0)break;const S=pc(Pe(d,Pe(e.style,b.style)),t,c,a,i,u);km(b,S,t);const w=Bf(t.columnWidths,g,y),F=Math.max(w-S.padding.left-S.padding.right,0),T=b.image?xm(Lm(t).resolve(b.image),F):void 0,x=T?Em(T,S,b.value):void 0,P=T?T.width+(b.value?T.gap:0):0,L=Math.max(F-P,0),G=hc(b.value,L,S),O=Math.max(G.length,1),B=Math.max(O*S.lineHeight,T?.height??0)+S.padding.top+S.padding.bottom,W=Math.max(Math.floor(b.mergeDown??0)+1,1),J=!!b.covered;!J&&W===1&&(f=Math.max(f,B)),p.push({columnIndex:g,span:y,width:w,style:S,lines:G,hyperlink:b.hyperlink,image:T,imageOnRight:x,rowSpan:W,requiredHeight:B,covered:J}),g+=y}const m=o?t.headerRowHeight:t.rowHeight,v=m!=null,C=m??f;return{type:e.type,defaultCellStyle:h,cells:p,rowHeight:C,minimumHeight:Dm(e.type,t),fixedHeight:v}}function t7(e){let t=!1;for(const s of e)for(const r of s.cells)if(!r.covered&&r.rowSpan>1){t=!0;break}if(!t)return!1;for(let s=0;s<e.length;s++){const r=e[s];if(r.spanned=!0,!r.fixedHeight)for(const i of r.cells){if(i.covered||i.rowSpan<=1)continue;const n=Math.min(s+i.rowSpan,e.length);let o=0;for(let a=s;a<n;a++)o+=e[a].rowHeight;if(o<i.requiredHeight){const a=(i.requiredHeight-o)/(n-s);for(let l=s;l<n;l++)e[l].rowHeight+=a}}}for(let s=0;s<e.length;s++)for(const r of e[s].cells){if(r.covered||r.rowSpan<=1)continue;const i=Math.min(s+r.rowSpan,e.length);let n=0;for(let o=s;o<i;o++)n+=e[o].rowHeight;r.renderHeight=n}return!0}function qn(e,t,s){if(!Number.isFinite(s)||s<=0)return;if(e.fixedHeight||e.spanned){const h=Math.min(e.rowHeight,s);return{row:e,cells:e.cells.map(p=>({measurement:p,lines:n7(p,p.renderHeight??h),showImage:!!p.image})),height:h,complete:!0}}const r=t?.lineOffsets??e.cells.map(()=>0),i=t?.imageRendered??e.cells.map(()=>!1),n=Mm(e,r,i);if(n<=s)return{row:e,cells:e.cells.map((h,p)=>({measurement:h,lines:h.lines.slice(r[p]??0),showImage:!!h.image&&!i[p]})),height:n,complete:!0};const o=[...r],a=[...i],l=[];let c=Math.min(e.minimumHeight,s),u=!1;for(let h=0;h<e.cells.length;h++){const p=e.cells[h],g=r[h]??0,f=Math.max(p.lines.length-g,0),m=Math.max(s-p.style.padding.top-p.style.padding.bottom,0),v=Math.floor(m/p.style.lineHeight),C=Math.min(f,v),b=p.lines.slice(g,g+C),y=!!p.image&&!i[h];C>0&&(u=!0,o[h]=g+C,c=Math.max(c,p.style.padding.top+C*p.style.lineHeight+p.style.padding.bottom)),y&&(u=!0,a[h]=!0,c=Math.max(c,Math.min(p.style.padding.top+p.image.height+p.style.padding.bottom,s))),l.push({measurement:p,lines:b,showImage:y})}if(!u)return;const d=e.cells.every((h,p)=>(o[p]??0)>=h.lines.length&&(!h.image||a[p]));return{row:e,cells:l,height:c,complete:d,nextState:d?void 0:{lineOffsets:o,imageRendered:a}}}function s7(e,t,s){const r=t?.lineOffsets??e.cells.map(()=>0),i=t?.imageRendered??e.cells.map(()=>!1),n=Number.isFinite(s)?Math.max(s,0):0,o=[];for(let a=0,l=e.cells.length;a<l;a++){const c=e.cells[a],u=c.lines.slice(r[a]??0),d=Math.max(n-c.style.padding.top-c.style.padding.bottom,0),h=Math.max(Math.floor(d/c.style.lineHeight),1);o.push({measurement:c,lines:Zn(u,h,c.style,Im(c)),showImage:!!c.image&&!i[a]})}return{row:e,cells:o,height:Math.min(Mm(e,r,i),Math.max(n,e.minimumHeight)),complete:!0}}function r7(e,t,s,r,i,n){const o=[];for(let l=0;l<t.columnCount;l++)o.push(Q8);let a=0;for(const l of e){if(l.type==="CUSTOM")continue;const c=Yl(l.type),u=Tm(l.type,i,a),d=gc(t),h=Om(c?r:s,d),p=c?t.headerFontSize:t.fontSize,g=c?t.defaultHeaderStyle:t.defaultCellStyle;let f=0;for(const m of l.cells){const v=Math.min((m.mergeAcross??0)+1,t.columnCount-f);if(v<=0)break;if(!i7(n,f,v)){f+=v;continue}const C=pc(Pe(g,Pe(l.style,m.style)),t,h,u,i,p);km(m,C,t);const b=m.image?Lm(t).resolve(m.image):void 0,y=a7(m.value??"",C),S=b?b.width+(m.value?b.gap:0):0,w=y+S+C.padding.left+C.padding.right,F=Bf(o,f,v);if(w>F){const T=(w-F)/v;for(let x=f;x<f+v;x++)o[x]+=T}f+=v}l.type==="BODY"&&(a+=1)}return o}function i7(e,t,s){for(let r=t,i=t+s;r<i;r++)if(e[r])return!0;return!1}function hc(e,t,s){const r=n=>s.fontRegistry.measureText(n,s.fontSize,s.font,s.direction,s.language);let i;if(s.wrapText)i=hH(Zl(e,s.preserveLineBreaks,!!s.font.trueType),t,s.fontSize,s.fontFamily,s.preserveSpaces,r);else{const n=Zl(e,s.preserveLineBreaks,!!s.font.trueType),o=s.preserveLineBreaks?n.split(`
`):[n];i=[];for(const a of o)i.push(s.overflow==="clip"?vH(a,t,s.fontSize,s.fontFamily,r):zf(a,t,s.fontSize,s.fontFamily,r));!s.preserveLineBreaks&&!i[0]&&(i=[])}return Zn(i,s.maxLines,s,t)}function Mm(e,t,s){let r=e.minimumHeight;for(let i=0;i<e.cells.length;i++){const n=e.cells[i],o=Math.max(n.lines.length-(t[i]??0),0);o>0&&(r=Math.max(r,n.style.padding.top+o*n.style.lineHeight+n.style.padding.bottom)),n.image&&!s[i]&&(r=Math.max(r,n.style.padding.top+n.image.height+n.style.padding.bottom))}return r}function n7(e,t){const s=Math.max(t-e.style.padding.top-e.style.padding.bottom,0),r=Math.floor(s/e.style.lineHeight);return Zn(e.lines,r,e.style,Im(e))}function Im(e){const t=e.width-e.style.padding.left-e.style.padding.right,s=e.image?e.image.width+e.image.gap:0;return Math.max(t-s,0)}function Zn(e,t,s,r){if(t==null||e.length<=t)return e;if(t<=0)return[];const i=e.slice(0,t);if(s.overflow==="ellipsis"){const n=i.length-1;i[n]=CH(i[n],r,s.fontSize,s.fontFamily,o=>s.fontRegistry.measureText(o,s.fontSize,s.font,s.direction,s.language))}return i}function Em(e,t,s){const r=t.direction==="auto"?Un(s,t.direction).direction:t.direction;return e.alignment==="end"?r==="ltr":r==="rtl"}function Dm(e,t){const s=Yl(e),r=s?t.defaultHeaderStyle:t.defaultCellStyle,i=s?t.headerFontSize:t.fontSize,n=X(r?.lineHeight,i,Number.EPSILON),o=Xn(r?.padding,{top:t.cellPadding,right:t.cellPadding,bottom:t.cellPadding,left:t.cellPadding});return n+o.top+o.bottom}function Lm(e){if(!e.imageRegistry)throw new Error("AG Grid: PDF layout options are missing the document image registry.");return e.imageRegistry}function o7(e,t,s,r,i,n,o){const a=Pe(s.defaultCellStyle,s.defaultHeaderStyle),l=X(a?.fontSize,o,Number.EPSILON),c=t==="title"?Math.max(l+4,14):Math.max(l+1,11),u=X(e?.fontSize,c,Number.EPSILON),d=n.resolve(e?.fontFamily,e?.fontWeight??i.weight,e?.fontStyle??i.style,i.family),h=Xn(e?.padding,t==="title"?j8:q8),p=Xn(e?.margin,t==="title"?$8:Y8),g=r.pageBackground??r.dataBackground,f=(t==="title"?r.headerText??r.foreground:r.foreground)??{r:0,g:0,b:0},m=qt(e?.borderColor,void 0,g);return{fontSize:u,fontFamily:d.family,fontWeight:d.weight,fontStyle:d.style,font:d,fontRegistry:n,direction:e?.direction??s.direction??"auto",language:e?.language??s.language,lineHeight:X(e?.lineHeight,n.getNaturalLineHeight(u,d),Number.EPSILON),maxLines:_m(e?.maxLines),overflow:e?.overflow??Pm,alignment:e?.alignment??Z8,alignmentExplicit:e?.alignment!=null,padding:h,margin:p,textColor:qt(e?.color,f,g)??f,backgroundColor:qt(e?.backgroundColor,void 0,g),borderColor:m,borderWidth:Gm(e?.borderWidth,m),wrapText:e?.wrapText??!1,preserveLineBreaks:e?.preserveLineBreaks??e?.wrapText??!1,preserveSpaces:e?.preserveSpaces??!1}}function pc(e,t,s,r,i,n){const o=Xn(e?.padding,{top:t.cellPadding,right:t.cellPadding,bottom:t.cellPadding,left:t.cellPadding}),a=X(e?.fontSize,n,Number.EPSILON),l=gc(t),c=l.resolve(e?.fontFamily,e?.fontWeight??s.weight,e?.fontStyle??s.style,s.family),u=r.background??i.dataBackground??i.pageBackground,d=r.text??i.foreground??{r:0,g:0,b:0},h=qt(e?.borderColor,r.border,u);return{fontSize:a,fontFamily:c.family,fontWeight:c.weight,fontStyle:c.style,font:c,fontRegistry:l,direction:e?.direction??t.direction??"auto",language:e?.language??t.language,lineHeight:X(e?.lineHeight,l.getNaturalLineHeight(a,c),Number.EPSILON),maxLines:_m(e?.maxLines),overflow:e?.overflow??Pm,alignment:e?.alignment??X8,alignmentExplicit:e?.alignment!=null,padding:o,margin:J8,textColor:qt(e?.color,d,u)??d,backgroundColor:qt(e?.backgroundColor,r.background,u),borderColor:h,borderWidth:Gm(e?.borderWidth,h),wrapText:e?.wrapText??!1,preserveLineBreaks:e?.preserveLineBreaks??e?.wrapText??!1,preserveSpaces:e?.preserveSpaces??!1}}function a7(e,t){const s=Zl(e,t.preserveLineBreaks,!!t.font.trueType),r=t.preserveLineBreaks?s.split(`
`):[s];let i=0;for(const n of r)i=Math.max(i,t.fontRegistry.measureText(n,t.fontSize,t.font,t.direction,t.language));return i}function Xn(e,t){if(typeof e=="number"){const r=X(e,0);return{top:r,right:r,bottom:r,left:r}}const s=e??{};return{top:X(s.top,t.top),right:X(s.right,t.right),bottom:X(s.bottom,t.bottom),left:X(s.left,t.left)}}function km(e,t,s){if(e.elementType!=="rowgroup"||!e.groupLevel)return;const r=e.groupLevel*(s.rowGroupIndentSize??0);(t.direction==="auto"?Un(e.value,t.direction).direction:t.direction)==="rtl"?t.padding.right+=r:t.padding.left+=r}function _m(e){if(!(e==null||!Number.isFinite(e)||e<1))return Math.floor(e)}function Gm(e,t){return X(e,t?1:0)}function gc(e){return e.fontRegistry??(e.fontRegistry=new fm(void 0)),e.fontRegistry}function Om(e,t){return typeof e=="string"?t.resolve(e,void 0,void 0):e}var l7=4,c7=9;function u7(e,t,s,r,i,n){const o={};if(!e)return o;for(const a of["all","first","even"]){const l=e[a];l&&(o[a]=p7(l,t,s,r,i,n))}return o}function Nm(e,t){return t===1&&e.first?e.first:t%2===0&&e.even?e.even:e.all??{header:[],footer:[],headerHeight:0,footerHeight:0}}function d7(e,t){const s={Page:String(t.pageNumber),Pages:String(t.totalPages),Date:t.date,Time:t.time};return e.replace(/&\[(Page|Pages|Date|Time)\]/g,(r,i)=>s[i])}function h7(e,t){try{const s=new Intl.DateTimeFormat(t,{year:"numeric",month:"numeric",day:"numeric"}).format(e),r=new Intl.DateTimeFormat(t,{hour:"numeric",minute:"2-digit",second:"2-digit"}).format(e);return{date:Jn(s),time:Jn(r)}}catch{return{date:Jn(e.toLocaleDateString()),time:Jn(e.toLocaleTimeString())}}}function Jn(e){return e.replace(/[\u00a0\u202f]/g," ")}function p7(e,t,s,r,i,n){const o=Bm(e.header,t,s,r,i,n),a=Bm(e.footer,t,s,r,i,n);return{header:o,footer:a,headerHeight:Vm(o),footerHeight:Vm(a)}}function Bm(e,t,s,r,i,n){if(!e?.length)return[];const o=[],a=s.foreground??{r:0,g:0,b:0},l=s.pageBackground??s.dataBackground,c=["Left","Center","Right"],u=Math.min(e.length,3);for(let d=0;d<u;d++){const h=e[d],p=h.style,g=X(p?.fontSize,c7,Number.EPSILON),f=i.resolve(p?.fontFamily,p?.fontWeight??r.weight,p?.fontStyle??r.style,r.family),m=X(p?.lineHeight,i.getNaturalLineHeight(g,f),Number.EPSILON),v=h.position??c[d];let C="left";v==="Center"?C="center":v==="Right"&&(C="right"),o.push({value:h.value??"",position:v,image:h.image?n.resolve(h.image):void 0,style:{fontSize:g,fontFamily:f.family,fontWeight:f.weight,fontStyle:f.style,font:f,fontRegistry:i,direction:p?.direction??t.direction??"auto",language:p?.language??t.language,lineHeight:m,maxLines:1,overflow:"ellipsis",alignment:C,alignmentExplicit:!0,padding:{top:0,right:0,bottom:0,left:0},margin:{top:0,right:0,bottom:0,left:0},textColor:qt(p?.color,a,l)??a,borderWidth:0,wrapText:!1,preserveLineBreaks:!1,preserveSpaces:!1}})}return o}function Vm(e){let t=0;for(const s of e){const r=s.value?s.style.lineHeight:0;t=Math.max(t,r,s.image?.height??0)}return t?t+l7*2:0}function Hm(e,t,s,r,i,n,o){const a=Math.max(s.width-r.margin.left-r.margin.right,0),l=Math.max(a-n.margin.left-n.margin.right,0),c=Math.max(l-n.padding.left-n.padding.right,0);if(!l||!c)return t;const u=t-n.margin.top,d=Math.max(u-r.margin.bottom-n.margin.bottom,0),h=Math.max(d-n.padding.top-n.padding.bottom,0),p=Math.floor(h/n.lineHeight),g=Zn(hc(e,c,n),p,n,c);if(!g.length)return t;const f=g.length*n.lineHeight+n.padding.top+n.padding.bottom,m=u-f,v=r.margin.left+n.margin.left;n.backgroundColor&&i.push(`${Et(n.backgroundColor)} rg`,`${k(v)} ${k(m)} ${k(l)} ${k(f)} re f`),n.borderColor&&n.borderWidth>0&&i.push(`${k(n.borderWidth)} w`,`${Et(n.borderColor)} RG`,`${k(v)} ${k(m)} ${k(l)} ${k(f)} re S`,"0.5 w"),i.push(`${Et(n.textColor)} rg`,"BT",`/${n.font.key} ${k(n.fontSize)} Tf`);let C=u-n.padding.top-o.getBaselineOffset(n.fontSize,n.font);for(const b of g){const y=o.encodeText(b,n.font,n.direction,n.language),S=$m(b,v,l,n,o,y.direction);fc(i,y,S,C,n),C-=n.lineHeight}return i.push("ET"),m-n.margin.bottom}function Um(e,t,s,r,i,n,o,a){if(!e.length||s<=0)return;const c=Math.max(r.width-i.margin.left-i.margin.right,0)/3;if(!(c<=0))for(const u of e){const d=u.style,h=d7(u.value,o),p=u.image?xm(u.image,c):void 0,g=p?p.width+(h?p.gap:0):0,m=(h?hc(h,Math.max(c-g,0),d):[])[0];if(!m&&!p)continue;let v=0;u.position==="Center"?v=1:u.position==="Right"&&(v=2);const C=i.margin.left+c*v,b=m?a.measureText(m,d.fontSize,d.font,d.direction,d.language):0,y=Math.min(g+b,c);let S=C;u.position==="Center"?S+=(c-y)/2:u.position==="Right"&&(S+=c-y);const w=p?Em(p,d,m??""):!1,F=w?S:S+g,T=t-(s-d.lineHeight)/2-a.getBaselineOffset(d.fontSize,d.font);if(p){const x=w?S+b+(m?p.gap:0):S,P=t-(s+p.height)/2;Km(n,p,x,P)}if(m){const x=a.encodeText(m,d.font,d.direction,d.language);n.push(`${Et(d.textColor)} rg`,"BT",`/${d.font.key} ${k(d.fontSize)} Tf`),fc(n,x,F,T,d),n.push("ET")}}}function g7(e,t,s,r){const i=r.encodeText(e.text,e.font,e.direction,e.language),n=r.measureText(e.text,e.fontSize,e.font,e.direction,e.language),o=r.getBaselineOffset(e.fontSize,e.font),a=e.rotation*Math.PI/180,l=Math.cos(a),c=Math.sin(a),u=o-e.lineHeight/2,d=t.width/2,h=t.height/2,p=d-l*(n/2)+c*u,g=h-c*(n/2)-l*u;s.push("q","/Artifact BMC"),e.graphicsState&&s.push(`/${e.graphicsState.key} gs`),s.push(`${Et(e.color)} rg`,"BT",`/${e.font.key} ${k(e.fontSize)} Tf`),C7(s,i,e.fontSize,l,c,p,g,e),s.push("ET","EMC","Q")}function f7(e,t,s,r,i,n){let o=t;for(const a of e){const l=qn(a,void 0,a.rowHeight);l&&(o=zm(l,o,s,r,i,n))}return o}function zm(e,t,s,r,i,n){const o=e.row,a=t-e.height;let l=.5,c=s.margin.left,u=0;for(const d of e.cells){const h=d.measurement;if(h.covered){c+=h.width,u+=h.span;continue}const p=Math.max(t-s.margin.bottom,e.height),g=Math.min(h.renderHeight??e.height,p),f=t-g;l=Wm(r,c,f,h.width,g,h.style,s.drawCellBorders,l),m7(r,d.lines,c,t,f,h.width,g,h.style,n,h.hyperlink,i,h.image,h.imageOnRight??!1,h.rowSpan>1),d.showImage&&h.image&&v7(r,h.image,c,t,f,h.width,h.style,h.imageOnRight??!1),c+=h.width,u+=h.span}for(let d=u;d<s.columnCount;d++){const h=s.columnWidths[d];l=Wm(r,c,a,h,e.height,o.defaultCellStyle,s.drawCellBorders,l),c+=h}return l!==.5&&r.push("0.5 w"),a}function Wm(e,t,s,r,i,n,o,a){return n.backgroundColor&&e.push(`${Et(n.backgroundColor)} rg`,`${k(t)} ${k(s)} ${k(r)} ${k(i)} re f`),o&&n.borderColor&&n.borderWidth>0&&(n.borderWidth!==a&&(e.push(`${k(n.borderWidth)} w`),a=n.borderWidth),e.push(`${Et(n.borderColor)} RG`,`${k(t)} ${k(s)} ${k(r)} ${k(i)} re S`)),a}function m7(e,t,s,r,i,n,o,a,l,c,u,d,h,p){const g=a.padding,f=d?d.width+(t.length?d.gap:0):0,m=h?s:s+f,v=Math.max(n-f,0),C=Math.max(v-g.left-g.right,0),b=Math.max(o-g.top-g.bottom,0);if(!t.length||!C||!b)return;const y=a.font.key;e.push("q",`${k(m+g.left)} ${k(i+g.bottom)} ${k(C)} ${k(b)} re W n`,"BT",`${Et(a.textColor)} rg`,`/${y} ${k(a.fontSize)} Tf`);const S=t.length*a.lineHeight,w=p?Math.max((b-S)/2,0):0;let F=r-g.top-w,T=F-l.getBaselineOffset(a.fontSize,a.font);for(const x of t){const P=l.encodeText(x,a.font,a.direction,a.language),L=$m(x,m,v,a,l,P.direction);if(fc(e,P,L,T,a),c&&x){const G=Math.min(l.measureText(x,a.fontSize,a.font,a.direction,a.language),C),O=Math.max(F-a.lineHeight,i+g.bottom),z=Math.min(L+G,m+v-g.right);z>L&&F>O&&u.push({uri:c,rect:[L,O,z,F]})}T-=a.lineHeight,F-=a.lineHeight}e.push("ET","Q")}function v7(e,t,s,r,i,n,o,a){const l=o.padding,c=Math.max(r-i-l.top-l.bottom,0),u=Math.max(n-l.left-l.right,0);if(!c||!u)return;const d=a?s+n-l.right-t.width:s+l.left,h=i+l.bottom+(c-t.height)/2;e.push("q",`${k(s+l.left)} ${k(i+l.bottom)} ${k(u)} ${k(c)} re W n`),Km(e,t,d,h),e.push("Q")}function Km(e,t,s,r){e.push("q",t.altText?`/Span << /ActualText ${Hn(t.altText)} >> BDC`:"/Artifact BMC",`${k(t.width)} 0 0 ${k(t.height)} ${k(s)} ${k(r)} cm /${t.resource.key} Do`,"EMC","Q")}function $m(e,t,s,r,i,n){const o=i.measureText(e,r.fontSize,r.font,r.direction,r.language),a=t+r.padding.left,l=t+s-r.padding.right-o,c=Math.max(s-r.padding.left-r.padding.right,0);let u=a;return r.alignment==="center"?u=a+(c-o)/2:(r.alignment==="right"||!r.alignmentExplicit&&n==="rtl")&&(u=a+c-o),Math.max(a,Math.min(u,l))}function fc(e,t,s,r,i){const n=t.positionedGlyphs;if(!n){e.push(`1 0 0 1 ${k(s)} ${k(r)} Tm ${t.operatorValue} Tj`);return}e.push(`/Span << /ActualText ${Hn(t.logicalText)} >> BDC`);let o=i.font.key;e.push(`/${o} ${k(i.fontSize)} Tf`);let a=s,l=r;for(const c of n){c.fontKey!==o&&(o=c.fontKey,e.push(`/${o} ${k(i.fontSize)} Tf`));const u=a+c.xOffset*i.fontSize,d=l+c.yOffset*i.fontSize;e.push(`1 0 0 1 ${k(u)} ${k(d)} Tm ${c.operatorValue} Tj`),a+=c.xAdvance*i.fontSize,l+=c.yAdvance*i.fontSize}e.push("EMC")}function C7(e,t,s,r,i,n,o,a){const l=t.positionedGlyphs;if(!l){e.push(`${k(r)} ${k(i)} ${k(-i)} ${k(r)} ${k(n)} ${k(o)} Tm ${t.operatorValue} Tj`);return}let c=a.font.key;e.push(`/${c} ${k(s)} Tf`);let u=0,d=0;for(const h of l){h.fontKey!==c&&(c=h.fontKey,e.push(`/${c} ${k(s)} Tf`));const p=u+h.xOffset*s,g=d+h.yOffset*s,f=n+r*p-i*g,m=o+i*p+r*g;e.push(`${k(r)} ${k(i)} ${k(-i)} ${k(r)} ${k(f)} ${k(m)} Tm ${h.operatorValue} Tj`),u+=h.xAdvance*s,d+=h.yAdvance*s}}var b7=.12,S7=-45,jm={r:128,g:128,b:128},y7="GSWatermark";function w7(e,t,s,r,i){const n=e.watermark,o=n?.text.trim()??"",a=Math.max(0,Math.min(X(n?.opacity,b7),1));if(!o||a<=0)return;const l=n?.style,c=Math.min(t.width,t.height)/6,u=X(l?.fontSize,c,Number.EPSILON),d=i.resolve(l?.fontFamily,l?.fontWeight??700,l?.fontStyle??r.style,r.family),h=X(l?.lineHeight,i.getNaturalLineHeight(u,d),Number.EPSILON),p=s.pageBackground??s.dataBackground;return{text:o,opacity:a,rotation:X(n?.rotation,S7),pages:n?.pages??"all",fontSize:u,lineHeight:h,font:d,direction:l?.direction??e.direction??"auto",language:l?.language??e.language,color:qt(l?.color,jm,p)??jm,graphicsState:a<1?{key:y7,opacity:a}:void 0}}function x7(e,t){return e.pages==="first"?t===1:e.pages==="odd"?t%2===1:e.pages==="even"?t%2===0:!0}var F7=class{constructor(){this.objects=[]}reserve(){return this.objects.push(""),this.objects.length}add(e){return this.objects.push(e),this.objects.length}set(e,t){this.objects[e-1]=t}build(e,t){let s=`%PDF-1.4
`;const r=[0],i=this.objects;for(let a=0;a<i.length;a++){const l=i[a],c=a+1;r[c]=s.length,s+=`${c} 0 obj
${l}
endobj
`}const n=s.length;s+=`xref
0 ${i.length+1}
`,s+=`0000000000 65535 f 
`;for(let a=1;a<=i.length;a++)s+=`${String(r[a]).padStart(10,"0")} 00000 n 
`;const o=[`/Size ${i.length+1}`,`/Root ${e} 0 R`];return t&&o.push(`/Info ${t} 0 R`),s+=`trailer
<< ${o.join(" ")} >>
`,s+=`startxref
${n}
%%EOF`,s}};function T7(e,t,s,r,i,n=[],o=[]){const a=new F7,l=[],c=[],u=[];for(const w of s){const F=w.trueType?M7(a,w):R7(a,w);l.push(`/${w.key} ${F} 0 R`)}for(const w of n){const F=Math.max(0,Math.min(w.opacity,1)),T=a.add(`<< /Type /ExtGState /ca ${k(F)} /CA ${k(F)} /BM /Normal >>`);c.push(`/${w.key} ${T} 0 R`)}for(const w of o){const F=A7(a,w);u.push(`/${w.key} ${F} 0 R`)}const d=a.reserve(),h=[],p=`<< ${l.join(" ")} >>`,g=c.length?` /ExtGState << ${c.join(" ")} >>`:"",f=u.length?` /XObject << ${u.join(" ")} >>`:"";for(const w of e){const F=w.content,T=`<< /Length ${F.length} >>
stream
${F}
endstream`,x=a.add(T),P=[];for(const z of w.annotations){const[B,W,J,Q]=z.rect,de=`${k(B)} ${k(W)} ${k(J)} ${k(Q)}`,me=ii(k7(z.uri)),Z=a.add(`<< /Type /Annot /Subtype /Link /Rect [${de}] /Border [0 0 0] /A << /S /URI /URI (${me}) >> >>`);P.push(`${Z} 0 R`)}const L=P.length?` /Annots [${P.join(" ")}]`:"",G=`<< /Type /Page /Parent ${d} 0 R /MediaBox [0 0 ${k(t.width)} ${k(t.height)}] /Resources << /Font ${p}${g}${f} >> /Contents ${x} 0 R${L} >>`,O=a.add(G);h.push(O)}const m=[];for(const w of h)m.push(`${w} 0 R`);a.set(d,`<< /Type /Pages /Kids [${m.join(" ")}] /Count ${h.length} >>`);const v=i?.trim(),C=v?` /Lang (${ii(v)})`:"",b=a.add(`<< /Type /Catalog /Pages ${d} 0 R${C} >>`),y=r?.trim()??"",S=y.length?a.add(`<< /Title ${P7(y)} >>`):void 0;return a.build(b,S)}function A7(e,t){let s;if(t.alpha){const o=Wn(t.alpha);s=e.add(`<< /Type /XObject /Subtype /Image /Width ${t.width} /Height ${t.height} /ColorSpace /DeviceGray /BitsPerComponent 8 /Filter /ASCIIHexDecode /Length ${o.length} >>
stream
${o}
endstream`)}const r=Wn(t.data),i=t.filter?`/Filter [/ASCIIHexDecode /${t.filter}]`:"/Filter /ASCIIHexDecode",n=s?` /SMask ${s} 0 R`:"";return e.add(`<< /Type /XObject /Subtype /Image /Width ${t.width} /Height ${t.height} /ColorSpace /${t.colorSpace} /BitsPerComponent ${t.bitsPerComponent} ${i}${n} /Length ${r.length} >>
stream
${r}
endstream`)}function P7(e){return/^[\x20-\x7e]*$/.test(e)?`(${ii(e)})`:Hn(e)}function R7(e,t){const s=t.builtInFamily??"Helvetica";return e.add(`<< /Type /Font /Subtype /Type1 /BaseFont /${s} /Encoding /WinAnsiEncoding >>`)}function M7(e,t){const s=t.trueType,r=s.canSubset?`AGGRID+${s.postScriptName}`:s.postScriptName,i=s.createSubset(Array.from(t.mappingByCid.values(),v=>v.glyphId)),n=Wn(i),o=e.add(`<< /Length ${n.length} /Length1 ${i.length} /Filter /ASCIIHexDecode >>
stream
${n}
endstream`),a=1e3/s.unitsPerEm,l=s.bbox.map(v=>k(v*a)).join(" "),c=t.style==="normal"&&!s.italicAngle?4:68,u=e.add(`<< /Type /FontDescriptor /FontName /${r} /Flags ${c} /FontBBox [${l}] /ItalicAngle ${k(s.italicAngle)} /Ascent ${k(s.ascent*a)} /Descent ${k(s.descent*a)} /CapHeight ${k(s.capHeight*a)} /StemV 80 /FontWeight ${t.weight} /FontFile2 ${o} 0 R >>`),d=I7(t),h=D7(t),p=e.add(`<< /Length ${h.length} /Filter /ASCIIHexDecode >>
stream
${h}
endstream`),g=e.add(`<< /Type /Font /Subtype /CIDFontType2 /BaseFont /${r} /CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) /Supplement 0 >> /FontDescriptor ${u} 0 R /DW 1000${d?` /W [${d}]`:""} /CIDToGIDMap ${p} 0 R >>`),f=E7(t),m=e.add(`<< /Length ${f.length} >>
stream
${f}
endstream`);return e.add(`<< /Type /Font /Subtype /Type0 /BaseFont /${r} /Encoding /Identity-H /DescendantFonts [${g} 0 R] /ToUnicode ${m} 0 R >>`)}function I7(e){const t=e.trueType,s=Array.from(e.mappingByCid.entries()).sort(([n],[o])=>n-o),r=[],i=1e3/t.unitsPerEm;for(const[n,o]of s)r.push(`${n} [${k(t.getAdvanceWidth(o.glyphId)*i)}]`);return r.join(" ")}function E7(e){const t=[];for(const[r,i]of e.mappingByCid)i.unicode&&t.push(`<${L7(r,4)}> ${Hn(i.unicode,!1)}`);const s=["/CIDInit /ProcSet findresource begin","12 dict begin","begincmap","/CIDSystemInfo << /Registry (Adobe) /Ordering (UCS) /Supplement 0 >> def","/CMapName /Adobe-Identity-UCS def","/CMapType 2 def","1 begincodespacerange","<0000> <FFFF>","endcodespacerange"];for(let r=0;r<t.length;r+=100){const i=t.slice(r,r+100);s.push(`${i.length} beginbfchar`,...i,"endbfchar")}return s.push("endcmap","CMapName currentdict /CMap defineresource pop","end","end"),s.join(`
`)}function D7(e){const t=e.mappingByCid.size,s=new Uint8Array((t+1)*2),r=new DataView(s.buffer);for(const[i,n]of e.mappingByCid)r.setUint16(i*2,n.glyphId,!1);return Wn(s)}function L7(e,t){return e.toString(16).toUpperCase().padStart(t,"0")}function k7(e){return encodeURI(_7(e)).replace(/%25([0-9a-f]{2})/gi,"%$1")}function _7(e){let t="";for(let s=0;s<e.length;s++){const r=e.charCodeAt(s);if(r>=55296&&r<=56319){const i=e.charCodeAt(s+1);i>=56320&&i<=57343?(t+=e[s]+e[s+1],s++):t+="\uFFFD"}else r>=56320&&r<=57343?t+="\uFFFD":t+=e[s]}return t}var Zt={fontSize:10,headerFontSize:11,cellPadding:4,repeatHeader:!0,drawCellBorders:!0,rowGroupIndentSize:12};function Ym(e,t,s){const r=s.page,i=W6(r?.size,r?.orientation),n=K6(r?.margin),o=z8(s.colors),a=new fm(s.fonts),l=new B8,c=t.length||Math.max($6(e),1),u=Math.max(i.width-n.left-n.right,0),d=s.defaultCellStyle,h=Pe(d,s.defaultHeaderStyle),p=X(d?.fontSize,Zt.fontSize,Number.EPSILON),g=X(h?.fontSize,Zt.headerFontSize,Number.EPSILON),f=s.repeatHeader??Zt.repeatHeader,m=s.drawCellBorders??Zt.drawCellBorders,v=X(s.rowGroupIndentSize,Zt.rowGroupIndentSize),C=a.resolve(d?.fontFamily,d?.fontWeight,d?.fontStyle),b=a.resolve(h?.fontFamily??C.family,h?.fontWeight??700,h?.fontStyle??C.style,C.family),y=Rm(s.documentTitle,s.documentTitleStyle,"title",s,o,b,a,Zt.headerFontSize),S=Rm(s.documentSubtitle,s.documentSubtitleStyle,"subtitle",s,o,C,a,Zt.headerFontSize),w=y?.text??"",F=u7(s.headerFooterConfig,s,o,C,a,l),T=h7(new Date,s.language),x=w7(s,i,o,C,a),P=X6(e),L={columnCount:c,columnWidths:Nf(t,c),margin:n,drawCellBorders:m,fontSize:p,headerFontSize:g,cellPadding:Zt.cellPadding,defaultCellStyle:d,defaultHeaderStyle:h,rowHeight:_f(s.rowHeight,Number.EPSILON),headerRowHeight:_f(s.headerRowHeight,Number.EPSILON),rowGroupIndentSize:v,fontRegistry:a,language:s.language,direction:s.direction,imageRegistry:l},G=j6(t,c,s.columnWidth),O=G.map(Y6),z=O.includes(!0)?r7(e,L,C,b,o,O):void 0,B=q6(t,c,u,G,z),W={...L,columnWidths:B},J=[],Q=[],de=new Set(P);let me=0;for(const Y of e){const oe=e7(Y,W,C,b,o,me);J.push(oe),de.has(Y)&&Q.push(oe),Y.type==="BODY"&&(me+=1)}const Z=t7(Q);let D=0;for(const Y of Q)D+=Y.rowHeight;const A=[],ne=[];let K=[],I=[],V=0,q={header:[],footer:[],headerHeight:0,footerHeight:0},ae=W,xe=Math.max(i.height-n.top-n.bottom,0),he=i.height-n.top,ke=!1;const Ps=Y=>{K.length>Y&&(ke=!0)},lt=Y=>{ke&&(A.push({content:K.join(`
`),annotations:I}),ne.push(q)),V+=1,q=Nm(F,V);const oe=Math.max((i.height-n.top-n.bottom)/2,0),_e=q.headerHeight+q.footerHeight;if(_e>oe){const le=oe/_e;q={...q,headerHeight:q.headerHeight*le,footerHeight:q.footerHeight*le}}if(ae={...W,margin:{...W.margin,top:W.margin.top+q.headerHeight,bottom:W.margin.bottom+q.footerHeight}},xe=Math.max(i.height-ae.margin.top-ae.margin.bottom,0),K=["0.5 w"],I=[],ke=!1,o.pageBackground&&K.push(`${Et(o.pageBackground)} rg`,`0 0 ${k(i.width)} ${k(i.height)} re f`),he=i.height-ae.margin.top,V===1){if(y){const le=K.length;he=Hm(y.text,he,i,ae,K,y.style,a),Ps(le)}if(S){const le=K.length;he=Hm(S.text,he,i,ae,K,S.style,a),Ps(le)}}if(Y&&Q.length){const le=K.length;he=f7(Q,he,ae,K,I,a),Ps(le)}};lt(!1),s.coverPage&&ke&&lt(!1);const ns=Y=>{const oe=Nm(F,Y);return Math.max(i.height-n.top-n.bottom-oe.headerHeight-oe.footerHeight,0)},Jo=(Y,oe)=>{if(!f||Y.type!=="BODY"||!Q.length)return!1;const _e=ns(V+1),le=_e-D;return!oe&&Y.rowHeight<=_e&&Y.rowHeight>le?!1:le>0&&!!qn(Y,oe,le)};for(const Y of J){if(Y===Q[0]&&(f||Z)){const le=Math.max(he-ae.margin.bottom,0);ke&&D>le&&D<=ns(V+1)&&lt(!1)}let oe,_e=!1;for(;!_e;){let le=Math.max(he-ae.margin.bottom,0);const fr=ke?ns(V+1):xe,Cd=Y.fixedHeight?Math.min(Y.rowHeight,fr):Y.rowHeight;!oe&&ke&&Cd<=fr&&Cd>le&&(lt(Jo(Y,oe)),le=Math.max(he-ae.margin.bottom,0));let os=qn(Y,oe,le);!os&&ke&&(lt(Jo(Y,oe)),le=Math.max(he-ae.margin.bottom,0),os=qn(Y,oe,le)),os??(os=s7(Y,oe,le));const Uw=K.length;he=zm(os,he,ae,K,I,a),Ps(Uw),_e=os.complete,oe=os.nextState,_e||lt(Jo(Y,oe))}}(ke||!A.length)&&(A.push({content:K.join(`
`),annotations:I}),ne.push(q));const vd=A.length;for(let Y=0;Y<vd;Y++){if(x&&x7(x,Y+1)){const fr=[];g7(x,i,fr,a),A[Y].content+=`
${fr.join(`
`)}`}const oe=ne[Y],_e=[],le={pageNumber:Y+1,totalPages:vd,...T};Um(oe.header,i.height-n.top,oe.headerHeight,i,W,_e,le,a),Um(oe.footer,n.bottom+oe.footerHeight,oe.footerHeight,i,W,_e,le,a),_e.length&&(A[Y].content+=`
${_e.join(`
`)}`)}return T7(A,i,a.getUsedFonts(),w,s.language,x?.graphicsState?[x.graphicsState]:[],l.getResources())}function Ct(e,t){for(const s of t){const r=e[s];if(r!=null)return r}}function bt(e,t){const s=Ct(e,t);return s==null?void 0:String(s).trim()||void 0}function Dt(e){if(e==null)return;if(typeof e=="number"&&Number.isFinite(e))return e;const t=/^-?\d+(?:\.\d+)?/.exec(String(e).trim());if(!t)return;const s=Number.parseFloat(t[0]);return Number.isFinite(s)?s:void 0}function G7(e){const t=Dt(Ct(e,["padding"])),s=Dt(Ct(e,["paddingTop","padding-top"])),r=Dt(Ct(e,["paddingRight","padding-right"])),i=Dt(Ct(e,["paddingBottom","padding-bottom"])),n=Dt(Ct(e,["paddingLeft","padding-left"]));if(s==null&&r==null&&i==null&&n==null)return t;const o={};return s!=null&&(o.top=s),r!=null&&(o.right=r),i!=null&&(o.bottom=i),n!=null&&(o.left=n),Object.keys(o).length?o:void 0}function O7(e){const t=bt(e,["whiteSpace","white-space"])?.toLowerCase(),s=bt(e,["whiteSpaceCollapse","white-space-collapse"])?.toLowerCase(),r=bt(e,["textWrapMode","text-wrap-mode"])?.toLowerCase(),i={};return t&&(t==="normal"?(i.wrapText=!0,i.preserveLineBreaks=!1,i.preserveSpaces=!1):t==="nowrap"?(i.wrapText=!1,i.preserveLineBreaks=!1,i.preserveSpaces=!1):t==="pre"?(i.wrapText=!1,i.preserveLineBreaks=!0,i.preserveSpaces=!0):t==="pre-line"?(i.wrapText=!0,i.preserveLineBreaks=!0,i.preserveSpaces=!1):(t==="pre-wrap"||t==="break-spaces")&&(i.wrapText=!0,i.preserveLineBreaks=!0,i.preserveSpaces=!0)),s==="preserve"||s==="preserve-breaks"||s==="break-spaces"?(i.preserveLineBreaks=!0,i.preserveSpaces=s!=="preserve-breaks"):s==="collapse"&&(i.preserveLineBreaks=!1,i.preserveSpaces=!1),(r==="wrap"||r==="nowrap")&&(i.wrapText=r==="wrap"),Object.keys(i).length?i:void 0}var N7=new Set(["none","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset"]);function $s(e,t){return e?t?.(e)??e:void 0}function mc(e,t,s){return $s(bt(e,t),s)}function B7(e){if(!e)return;const t=e.trim(),s=/(var\([^)]+\)|(?:rgb|hsl)a?\([^)]+\)|color\([^)]+\))\s*$/i.exec(t);if(s)return s[1];const r=/(#[0-9a-fA-F]{3,8}|(?<![a-zA-Z])[a-zA-Z]+)\s*$/.exec(t);if(!r)return;const i=r[1];if(!N7.has(i.toLowerCase()))return i}function Qn(e,t){if(!e)return;const s={...e};return e.color?s.color=$s(e.color,t):delete s.color,e.backgroundColor?s.backgroundColor=$s(e.backgroundColor,t):delete s.backgroundColor,e.borderColor?s.borderColor=$s(e.borderColor,t):delete s.borderColor,s}var V7=new Set(["http","https","mailto","tel"]);function qm(e){if(typeof e!="string")return;const t=e.trim(),s=/^([a-z][a-z\d+.-]*):/i.exec(t)?.[1].toLowerCase();return s&&V7.has(s)?e:void 0}function H7(e){if(e){if(e.startsWith("center"))return"center";if(e.startsWith("right")||e.startsWith("end"))return"right";if(e.startsWith("left")||e.startsWith("start"))return"left"}}function U7(e){return W7(e)}function z7(e){if(e==null)return;if(typeof e=="number")return Zm(e);const t=String(e).trim().toLowerCase();if(t==="bold"||t==="bolder")return"bold";if(t==="normal")return"normal";if(t==="lighter")return 300;if(/^\d+(?:\.\d+)?$/.test(t))return Zm(Number.parseFloat(t))}function W7(e){if(!e)return;const t=e.split(",")[0].trim().replace(/(^["'])|(["']$)/g,"").toLowerCase();return t.includes("helvetica-bold")?"Helvetica-Bold":t==="helvetica"||t==="arial"||t==="sans-serif"||t==="system-ui"?"Helvetica":t.includes("times-bold")?"Times-Bold":t.includes("times")||t==="serif"?"Times-Roman":t.includes("courier-bold")?"Courier-Bold":t.includes("courier")||t==="monospace"?"Courier":t}function Zm(e){return Number.isFinite(e)?Math.min(Math.max(Math.round(e/100)*100,100),900):void 0}function vc(e,t){const s={};for(const v of e)v&&Object.assign(s,v);if(!Object.keys(s).length)return;const r={},i=mc(s,["color"],t);i&&(r.color=i);const n=mc(s,["backgroundColor","background-color","background"],t);n&&(r.backgroundColor=n);const o=mc(s,["borderColor","border-color"],t)??$s(B7(bt(s,["border","border-top"])),t);o&&(r.borderColor=o);const a=Dt(Ct(s,["borderWidth","border-width"]))??Dt(bt(s,["border","border-top"]));a!=null&&(r.borderWidth=a);const l=Dt(Ct(s,["fontSize","font-size"]));l!=null&&(r.fontSize=l);const c=Dt(Ct(s,["lineHeight","line-height"]));c!=null&&(r.lineHeight=c);const u=U7(bt(s,["fontFamily","font-family"]));u&&(r.fontFamily=u);const d=z7(Ct(s,["fontWeight","font-weight"]));d&&(r.fontWeight=d);const h=bt(s,["fontStyle","font-style"])?.toLowerCase();(h==="normal"||h==="italic"||h==="oblique")&&(r.fontStyle=h);const p=bt(s,["direction"])?.toLowerCase();(p==="ltr"||p==="rtl")&&(r.direction=p);const g=H7(bt(s,["textAlign","text-align"]));g&&(r.alignment=g);const f=G7(s);f!=null&&(r.padding=f);const m=O7(s);return m&&Object.assign(r,m),Object.keys(r).length?r:void 0}var K7=class extends T0{constructor(e){super(e),this.config=e,this.useGridHeaderLayout=!0,this.rows=[],this.columnsToExport=[],this.rowIndex=0,this.bodyRowIndex=-1}prepare(e){super.prepare(e),this.columnsToExport=[...e]}addCustomContent(e){if(e){if(typeof e=="string"){const t=Math.max(this.columnsToExport.length-1,0),s=e.split(/\r?\n/);for(const r of s)this.createRow("CUSTOM").cells.push({value:r,mergeAcross:t||void 0,elementType:"custom"});return}for(const t of e){const s=this.createRow("CUSTOM"),r=Math.max(this.columnsToExport.length,1);let i=0;for(const n of t){if(i>=r)break;const o=n?.mergeAcross,a=typeof o=="number"&&Number.isFinite(o)?Math.max(Math.floor(o),0):0,l=Math.min(a,r-i-1);s.cells.push({value:String(n?.data?.value??""),hyperlink:qm(n?.data?.hyperlink),image:n?.data?.image,mergeAcross:l||void 0,style:Qn(n?.style,this.config.resolveColor),elementType:"custom"}),i+=l+1}}}}onNewHeaderGroupingRow(){const e=this.createRow("HEADER_GROUPING");return{onCell:this.createHeaderCellAccumulator(e)}}onNewHeaderRow(){const e=this.createRow("HEADER");return{onCell:this.createHeaderCellAccumulator(e)}}createHeaderCellAccumulator(e){return t=>{if(t.type==="covered"){e.cells.push({value:"",covered:!0});return}if(t.type==="column"){const i=t.column,n=this.extractHeaderValue(i);e.cells.push({value:n,mergeDown:t.rowSpan>1?t.rowSpan-1:void 0,elementType:"header",sourceColumn:i,style:Pe(this.resolveColumnHeaderPdfStyle(i),this.resolveCallbackPdfStyle({type:"header",accumulatedRowIndex:this.rowIndex,value:n,column:i}))});return}const s=t.column,r=s?this.extractGroupHeaderValue(s):"";e.cells.push({value:r,mergeAcross:t.columnSpan>1?t.columnSpan-1:void 0,elementType:"groupheader",sourceColumn:s,style:s?Pe(this.resolveColumnGroupHeaderPdfStyle(s),this.resolveCallbackPdfStyle({type:"groupheader",accumulatedRowIndex:this.rowIndex,value:r,column:s})):void 0})}}onNewBodyRow(e){const t=this.createRow("BODY",e),s=this.rowIndex;let r=0,i=!1;return{onColumn:(n,o,a)=>{if(r>0){r-=1;return}const l=a??e;if(!l){t.cells.push({value:"",elementType:"cell",sourceColumn:n});return}const c=Math.max(l.uiLevel??l.level??0,0),u=this.isFullWidthGroupCell(l,o),d=this.isRowGroupCell(n,l,u);t.sourceNode||(t.sourceNode=l,t.rowPinned=l.rowPinned,t.groupLevel=c),i||(t.style=Pe(this.resolveRowPdfStyle(l),this.resolveCallbackPdfStyle({type:"row",accumulatedRowIndex:s,value:l.data,node:l})),i=!0);const h=this.resolveCellPdfStyle(n,l),p=this.extractPdfRowCellValue(n,l,o,s,d,u),g=String(p.valueFormatted??p.value??""),f=this.resolveCellImage(g,n,l,s),m=f?String(f.value??""):g,v=Pe(h,this.resolveCallbackPdfStyle({type:d?"rowgroup":"cell",accumulatedRowIndex:s,value:m,node:l,column:n})),C=H6(this.columnsToExport,o,l),b=C>1?C-1:void 0;b&&(r=b),t.cells.push({value:m,hyperlink:this.resolveCellHyperlink(m,n,l,s),image:f?.image,mergeAcross:b,style:v,elementType:d?"rowgroup":"cell",sourceColumn:n,sourceNode:l,groupLevel:c})}}}parse(){if(this.config.direction!=="rtl")return Ym(this.rows,this.columnsToExport,this.config);const e=this.rows.map(s=>({...s,cells:[...s.cells].reverse()})),t=[...this.columnsToExport].reverse();return Ym(e,t,this.config)}createRow(e,t){this.rowIndex+=1,e==="BODY"&&(this.bodyRowIndex+=1);const s={type:e,cells:[],sourceNode:t,rowPinned:t?.rowPinned,groupLevel:t?Math.max(t.uiLevel??t.level??0,0):void 0};return this.rows.push(s),s}resolveRowPdfStyle(e){if(this.shouldSkipGridStyles())return;const t=this.gos.get("rowStyle"),s=this.gos.getCallback("getRowStyle"),r=this.getNodeRowIndex(e),i=s?.({data:e.data,node:e,rowIndex:r});return vc([t,i],this.config.resolveColor)}extractPdfRowCellValue(e,t,s,r,i,n){if(i&&!this.processCellCallback&&!this.processRowGroupCallback){const{value:o,valueFormatted:a}=this.valueSvc.getValueForDisplay({column:n?void 0:e,node:t,includeValueFormatted:!0,exporting:!0,from:this.valueFrom,transformValues:this.transformValues});return{value:o??"",valueFormatted:a}}return this.extractRowCellValue({column:e,node:t,currentColumnIndex:s,accumulatedRowIndex:r,type:"pdf",useRawFormula:!1})}resolveCellPdfStyle(e,t){if(this.shouldSkipGridStyles())return;const s=e.getColDef(),r=s.cellStyle;if(!r&&s.wrapText==null)return;const i=this.getNodeRowIndex(t);let n;if(typeof r=="function"){const a=this.valueSvc.getDisplayValue(e,t,this.valueFrom,this.transformValues),l=si(this.gos,{data:t.data,node:t,rowIndex:i,value:a,column:e,colDef:s});n=r(l)}else n=r;const o=s.wrapText==null?void 0:{wrapText:s.wrapText};return Pe(o,vc([n],this.config.resolveColor))}resolveColumnHeaderPdfStyle(e){const t=e.getColDef();return Pe(this.resolveHeaderPdfStyle(t.headerStyle,{colDef:t,column:e,floatingFilter:!1}),this.shouldSkipGridStyles()||t.wrapHeaderText==null?void 0:{wrapText:t.wrapHeaderText})}resolveColumnGroupHeaderPdfStyle(e){const t=e.getColGroupDef();if(t)return Pe(this.resolveHeaderPdfStyle(t.headerStyle,{colDef:t,columnGroup:e,floatingFilter:!1}),this.shouldSkipGridStyles()||t.wrapHeaderText==null?void 0:{wrapText:t.wrapHeaderText})}resolveHeaderPdfStyle(e,t){if(!e||this.shouldSkipGridStyles())return;const s=typeof e=="function"?e(si(this.gos,t)):e;return vc([s],this.config.resolveColor)}getNodeRowIndex(e){return e.rowIndex??Math.max(this.bodyRowIndex,0)}resolveCallbackPdfStyle(e){const t=this.config.processStyleCallback;if(!t)return;const s=t(si(this.gos,e));return Qn(s,this.config.resolveColor)}resolveCellHyperlink(e,t,s,r){const i=this.config.processCellHyperlinkCallback;if(!i)return;const n={value:e,accumulatedRowIndex:r,node:s,column:t};return qm(i(si(this.gos,n)))}resolveCellImage(e,t,s,r){const i=this.config.addImageToCell;if(!i)return;const n={value:e,accumulatedRowIndex:r,node:s,column:t};return i(si(this.gos,n))??void 0}isRowGroupCell(e,t,s){return this.gos.get("treeData")||t.group?e.isRowGroupDisplayed(t.rowGroupColumn?.getColId()??"")||s:!1}isFullWidthGroupCell(e,t){return t===0&&U6(this.gos,e,this.colModel.pivotMode)}shouldSkipGridStyles(){return this.config.skipGridStyles===!0}};import{paramToVariableName as $7}from"ag-stack";var Xm=["backgroundColor","dataBackgroundColor","oddRowBackgroundColor","foregroundColor","headerBackgroundColor","headerTextColor","borderColor"];function Jm(e,t){return!e||!t?t??e:{...e,...t}}function Qm(e,t){return e&&{...e,color:t(e.color),backgroundColor:t(e.backgroundColor),borderColor:t(e.borderColor)}}function j7(e,t){if(!e||!t)return t??e;const s={};for(const r of["all","first","even"]){const i=e[r],n=t[r];(i||n)&&(s[r]={...i,...n})}return s}function Y7(e,t){if(!e)return e;const s={};for(const r of["all","first","even"]){const i=e[r];i&&(s[r]=X7(i,t))}return s}function q7(e,t){return!e||!t?t??e:{...e,...t,style:{...e.style,...t.style}}}function Z7(e,t){return e?.style?{...e,style:{...e.style,color:t(e.style.color)}}:e}function X7(e,t){return{header:ev(e.header,t),footer:ev(e.footer,t)}}function ev(e,t){return e&&e.map(s=>({...s,style:s.style?{...s.style,color:t(s.style.color)}:void 0}))}function J7(e,t,s,r){const i={...e,...t,...s},n=t?.dataBackgroundColor!=null||s?.dataBackgroundColor!=null,o=t?.oddRowBackgroundColor!=null||s?.oddRowBackgroundColor!=null,a=e.oddRowBackgroundColor==null||e.oddRowBackgroundColor===e.dataBackgroundColor,l=n&&!o&&a;i.oddRowBackgroundColor=l?i.dataBackgroundColor:i.oddRowBackgroundColor;for(const c of Xm){const u=i[c];u&&(i[c]=r(u)??u)}return i}function Q7(e){if(!e||typeof getComputedStyle!="function")return{};const t=getComputedStyle(e),s={};for(const n of Xm){const o=$7(n),a=t.getPropertyValue(o).trim();if(!a)continue;const l=tv(a,e);l&&(s[n]=l)}const r=sv(e,".ag-header","color");r&&(s.headerTextColor=r);const i=sv(e,".ag-header","backgroundColor");return i&&(s.headerBackgroundColor=i),s}function eU(e,t){return $s(e,s=>s&&tv(s,t)||void 0)}function tv(e,t){return typeof document>"u"||!t||typeof getComputedStyle!="function"?e:th(e,t)}function sv(e,t,s){if(!e||typeof getComputedStyle!="function")return;const r=e.querySelector(t);if(!r)return;const i=getComputedStyle(r)[s].trim();if(!(!i||W8(i)))return i}var tU=class extends A0{constructor(){super(...arguments),this.beanName="pdfCreator"}getMergedParams(e){const t=this.gos.get("defaultPdfExportParams"),s=this.getResolveColorValueFn(),r={...t,...e};r.direction??(r.direction=this.gos.get("enableRtl")?"rtl":"ltr"),r.colors=J7(Q7(this.beans.eRootDiv),t?.colors,e?.colors,s),t?.page&&e?.page&&(r.page={...t.page,...e.page}),r.defaultCellStyle=Qn(Pe(t?.defaultCellStyle,e?.defaultCellStyle),s),r.defaultHeaderStyle=Qn(Pe(t?.defaultHeaderStyle,e?.defaultHeaderStyle),s);const i=Jm(t?.documentTitleStyle,e?.documentTitleStyle);r.documentTitleStyle=Qm(i,s);const n=Jm(t?.documentSubtitleStyle,e?.documentSubtitleStyle);r.documentSubtitleStyle=Qm(n,s);const o=j7(t?.headerFooterConfig,e?.headerFooterConfig);r.headerFooterConfig=Y7(o,s);const a=q7(t?.watermark,e?.watermark);return r.watermark=Z7(a,s),r}export(e){if(this.isExportSuppressed()){this.warn(160);return}this.runExport(()=>{const t=this.getMergedParams(e),s=this.createPdfBlob(t);s&&N6(this.resolveFileName(t),s)})}exportDataAsPdf(e){this.export(e)}getDataAsPdf(e){if(this.isExportSuppressed()){this.warn(160);return}return this.createPdfBlob(this.getMergedParams(e))}createPdfBlob(e){try{const t=this.getData(e);return new Blob([t],{type:e.mimeType||"application/pdf"})}catch(t){if(t instanceof gm){this.error(330,{fontFamily:t.family,registeredFamilies:t.registeredFamilies});return}throw t}}getDefaultFileExtension(){return"pdf"}createSerializingSession(e){const{colModel:t,colNames:s,rowGroupColsSvc:r,valueSvc:i,gos:n,log:o}=this.beans,{processCellCallback:a,processHeaderCallback:l,processGroupHeaderCallback:c,processRowGroupCallback:u}=e??{},d=this.getResolveColorValueFn();return new K7({...e,colModel:t,colNames:s,rowGroupColsSvc:r,valueSvc:i,gos:n,log:o,resolveColor:d,processCellCallback:a??void 0,processHeaderCallback:l??void 0,processGroupHeaderCallback:c??void 0,processRowGroupCallback:u??void 0})}isExportSuppressed(){return this.gos.get("suppressPdfExport")}getResolveColorValueFn(){const{eRootDiv:e}=this.beans,t=new Map;return s=>{if(!s)return;const r=t.get(s);if(r!==void 0||t.has(s))return r;const i=eU(s,e);return t.set(s,i),i}}};function sU(e,t){return e.pdfCreator?.getDataAsPdf(t)}function rU(e,t){e.pdfCreator?.exportDataAsPdf(t)}var rv={moduleName:"PdfExport",version:_,beans:[tU],apiFunctions:{getDataAsPdf:sU,exportDataAsPdf:rU},dependsOn:[O6,$]};import{_ColumnFilterModule as iU}from"ag-grid-community";import{LocalEventService as nU,_removeFromArray as oU}from"ag-stack";import{AgPromise as Xt,FilterWrapperComp as aU,ProvidedFilter as lU,_getFilterModel as cU,_isFilterCompActive as Cc,_refreshFilterUi as iv,_refreshHandlerAndUi as nv,_resolveFilter as eo,_updateFilterModel as uU}from"ag-grid-community";import{_focusInto as dU,_getActiveDomElement as hU,_isNothingFocused as pU,_setAriaRole as gU}from"ag-stack";import{AgPromise as js,KeyCode as oi,TabGuardComp as fU,_createElement as mU}from"ag-grid-community";var ov=class extends P0{constructor(){super({tag:"div",cls:"ag-multi-filter ag-menu-list-compact"}),this.filterDefs=[],this.guiDestroyFuncs=[],this.filterGuis=[],this.lastActivatedMenuItem=null}postConstruct(){this.initialiseTabGuard({onFocusIn:e=>this.onFocusIn(e)})}refreshGui(e){return e===this.lastOpenedInContainer?js.resolve():(this.tabGuardFeature.removeAllChildrenExceptTabGuards(),this.destroyChildren(),js.all(this.getFilterWrappers().map((t,s)=>{if(!t)return js.resolve(null);const r=this.getFilterFromWrapper(t),i=this.getCompFromWrapper(t),n=this.filterDefs[s],o=O1(r,n);let a;if(n.display==="subMenu"&&e!=="toolPanel")a=this.insertFilterMenu(i,r,o).then(l=>l.getGui());else if(n.display==="subMenu"||n.display==="accordion"){const l=this.insertFilterGroup(r,i,o);a=js.resolve(l.getGui())}else a=js.resolve(i.getGui());return a})).then(t=>{t.forEach((s,r)=>{s&&(r>0&&this.appendChild(mU({tag:"div",cls:"ag-filter-separator"})),this.appendChild(s))}),this.filterGuis=t,this.lastOpenedInContainer=e}))}refreshChildGui(){const e=this.lastOpenedInContainer;this.lastOpenedInContainer=void 0,e&&this.getGui().isConnected&&this.afterGuiAttached({container:e,hidePopup:this.hidePopup,suppressFocus:!0})}destroyChildren(){for(const e of this.guiDestroyFuncs)e();this.guiDestroyFuncs.length=0,this.filterGuis.length=0}insertFilterMenu(e,t,s){const r=e.getGui();gU(r,"dialog");const i=this.createBean(new WN),n={getGui:()=>e.getGui(),afterGuiAttached:o=>{e.afterGuiAttached?.(o),e!==t&&t.afterGuiAttached?.(o)}};return i.init({menuItemDef:{name:s,subMenu:[],subMenuRole:"dialog",cssClasses:["ag-multi-filter-menu-item"],menuItem:tg,menuItemParams:{cssClassPrefix:"ag-compact-menu-option",isCompact:!0}},level:0,isAnotherSubMenuOpen:()=>!1,childComponent:n,contextParams:{column:null,columnGroup:null,node:null,value:null}}).then(()=>{i.setParentComponent(this),this.guiDestroyFuncs.push(()=>this.destroyBean(i)),this.addManagedListeners(i,{menuItemActivated:a=>{this.lastActivatedMenuItem&&this.lastActivatedMenuItem!==a.menuItem&&this.lastActivatedMenuItem.deactivate(),this.lastActivatedMenuItem=a.menuItem}});const o=i.getGui();return i.addManagedElementListeners(o,{keydown:a=>{const{key:l}=a;switch(l){case oi.UP:case oi.RIGHT:case oi.DOWN:case oi.LEFT:a.preventDefault(),l===oi.RIGHT&&i.openSubMenu(!0);break}},focusin:()=>i.activate(),focusout:()=>{!i.isSubMenuOpen()&&!i.isSubMenuOpening()&&i.deactivate()}}),i})}insertFilterGroup(e,t,s){const r=this.createBean(new dt({title:s,cssIdentifier:"multi-filter"}));return this.guiDestroyFuncs.push(()=>this.destroyBean(r)),r.addItem(t.getGui()),r.toggleGroupExpand(!1),e.afterGuiAttached&&r.addManagedListeners(r,{expanded:()=>e.afterGuiAttached({container:this.lastOpenedInContainer,suppressFocus:!0,hidePopup:this.hidePopup})}),r}afterGuiAttached(e){let t;e?(this.hidePopup=e.hidePopup,t=this.refreshGui(e.container)):(this.hidePopup=void 0,t=js.resolve());const s=e?.suppressFocus;t.then(()=>{const{filterDefs:r,filterGuis:i,beans:n}=this,o=this.getFilterWrappers();let a=!!s;r&&nn(r,(c,u)=>{const d=u===0,h=c.display&&c.display!=="inline",p=s||!d||h,g={...e,suppressFocus:p},f=o[u],m=f?this.getFilterFromWrapper(f):void 0;if(f){const v=this.getCompFromWrapper(f);v!==m&&v.afterGuiAttached(g)}if(m&&(this.executeFunctionIfExistsOnFilter(m,"afterGuiAttached",g),d&&!p&&(a=!0)),!s&&d&&h){const v=i[u];v&&(dU(v)||v.focus({preventScroll:!0}),a=!0)}});const l=hU(n);!a&&(pU(n)||this.getGui().contains(l))&&this.forceFocusOutOfContainer(!0)})}afterGuiDetached(){this.executeFunctionIfExists("afterGuiDetached")}onAnyFilterChanged(){this.executeFunctionIfExists("onAnyFilterChanged",e=>this.executeOnWrapper(e,"onAnyFilterChanged"))}onNewRowsLoaded(){this.executeFunctionIfExists("onNewRowsLoaded",e=>this.executeOnWrapper(e,"onNewRowsLoaded"))}destroy(){this.destroyChildren(),this.hidePopup=void 0,super.destroy()}executeOnWrapper(e,t){}executeFunctionIfExists(e,t){nn(this.getFilterWrappers(),s=>{s&&(t?.(s),this.executeFunctionIfExistsOnFilter(this.getFilterFromWrapper(s),e))})}executeFunctionIfExistsOnFilter(e,t,...s){const r=e[t];typeof r=="function"&&r.apply(e,s)}onFocusIn(e){const t=this.lastActivatedMenuItem;t!=null&&!t.getGui().contains(e.target)&&(t.deactivate(),this.lastActivatedMenuItem=null)}},av=class extends ov{constructor(){super(...arguments),this.filterType="multi",this.wrappers=[],this.activeFilterIndices=[],this.afterFiltersReadyFuncs=[]}init(e){this.params=e,this.filterDefs=hs(e);const t=this.beans,s=e.column,r=cU(t.colFilter.model,s.getColId()),{filterChangedCallback:i}=e;this.filterChangedCallback=i;const n=eo(t,s),o=this.filterDefs.map((a,l)=>this.createFilter(a,l,r,n));return new Xt(a=>{Xt.all(o).then(l=>{this.wrappers=l,this.refreshGui("columnMenu").then(()=>{a()})})}).then(()=>{for(const a of this.afterFiltersReadyFuncs)a();this.afterFiltersReadyFuncs.length=0})}refresh(e){const t=hs(e);if(kh(this.filterDefs,t))return!1;this.params=e;const{beans:s,wrappers:r}=this,i=s.colFilter,n=e.column,o=eo(s,n);for(let a=0,l=r.length;a<l;++a){const c=r[a],u=c?.handler;if(!u)continue;const d=eo(s,n,t[a],ht,o),{onModelChange:h,doesRowPassOtherFilter:p}=c.handlerParams,g={...i.createHandlerParamsForDef(n,d),onModelChange:h,doesRowPassOtherFilter:p},{getHandler:f,onStateChange:m,onAction:v}=c.filterParams,C=i.createFilterComp(n,d,S=>({...this.createChildParams(S,!0,g.getValue,a),onModelChange:h,getHandler:f,onStateChange:m,onAction:v}),!0,"colDef").compDetails.params;if(c.handlerParams=g,c.filterParams=C,u.refresh?.({...g,model:c.model??null,source:"colDef"})===!1)return!1;const b=c.model??null,y=c.state??{model:b};c.pendingUi=void 0,c.filter.refresh?.({...C,model:b,state:y,source:"colDef"})===!1&&this.recreateChildUi(c,a,d)}return!0}recreateChildUi(e,t,s){const{handler:r,handlerParams:i}=e,n=e.model??null;let o;const{compDetails:a,createFilterUi:l}=this.beans.colFilter.createFilterComp(this.params.column,s,u=>{const d=this.createChildParams(u,!0,i.getValue,t);return o=this.updateDisplayParams(d,t,n,()=>a,()=>r,i.onModelChange),d},!0,"colDef"),c=l();e.pendingUi=c,c.then(u=>{if(e.pendingUi!==c||this.wrappers[t]!==e||!this.isAlive()){this.destroyBean(u);return}e.pendingUi=void 0;const d=e.filter,h=a.params;e.filter=u,e.comp=o(u),e.filterParams=h,e.state={model:n},this.destroyBean(d);const p=e.model??null;p!==n&&(e.state={model:p},iv(u,h,p,e.state,"api")),this.refreshChildGui()})}isFilterActive(){return this.wrappers.some(e=>{if(!e)return!1;const{filter:t,handler:s,model:r}=e;return s?r!=null:Cc(this.beans,t)})}getLastActiveFilterIndex(){const e=this.activeFilterIndices;return e.length>0?e[e.length-1]:null}doesFilterPass(e,t){return this.wrappers.every((s,r)=>{if(!s||t!=null&&r===t)return!0;const{handler:i,filter:n,model:o}=s;return i?o==null||i.doesFilterPass({...e,model:o,handlerParams:s.handlerParams}):!n.isFilterActive?.()||n.doesFilterPass(e)})}getModelFromUi(){return{filterType:this.filterType,filterModels:this.wrappers.map(t=>{if(!t)return null;const s=t.filter;return typeof s.getModelFromUi=="function"?s.getModelFromUi():null})}}getModel(){return this.isFilterActive()?{filterType:this.filterType,filterModels:this.wrappers.map(t=>{if(!t)return null;const{filter:s,handler:r,model:i}=t;return r?i:Cc(this.beans,s)?s.getModel():null})}:null}setModel(e){const t=(r,i)=>new Xt(n=>{const o=r.setModel(i);o?o.then(n):n()}),s=[];return this.wrappers.forEach((r,i)=>{if(!r)return;const n=pt(e,i),{filter:o,filterParams:a,handler:l,handlerParams:c,state:u}=r;if(l){const d={model:n,state:u?.state};r.state=d,r.model=n,s.push(nv(()=>Xt.resolve(r.state===d?{filter:o,filterParams:a}:void 0),l,c,n,d,"api").then(()=>{this.updateActiveListForHandler(i,r.model)}))}else s.push(t(o,n).then(()=>{this.updateActiveListForFilter(i,o)}))}),Xt.all(s).then(()=>{})}applyModel(e="api"){let t=!1;for(const s of this.wrappers)if(s){const r=s.filter;r instanceof lU&&(t=r.applyModel(e)||t)}return t}getChildFilterInstance(e){return this.wrappers[e]?.filter}getNumChildFilters(){return this.wrappers.length}destroy(){for(const e of this.wrappers)this.destroyBean(e?.filter),this.destroyBean(e?.handler);this.wrappers.length=0,super.destroy()}getFilterWrappers(){return this.wrappers}getFilterFromWrapper(e){return e.filter}getCompFromWrapper(e){return e.comp}executeOnWrapper(e,t){e.handler?.[t]?.()}createFilter(e,t,s,r){const i=this.params.column;let n=null,o;const a=this.beans,l=(v,C)=>{const b=this.wrappers[t];if(!b)return;const y={model:v,state:b.state?.state};b.state=y,b.model=v,nv(()=>Xt.resolve({filter:b.filter,filterParams:b.filterParams}),b.handler,b.handlerParams,v,y,"ui").then(()=>{this.onHandlerModelChanged(t,b.model,C)})},c=a.colFilter,u=eo(a,i,e,ht,r),d=c.createHandlerGetValue(i,u.filterValueGetter),{compDetails:h,handler:p,handlerParams:g,createFilterUi:f}=c.createFilterInstance(i,u,(v,C)=>{const b=this.createChildParams(v,C,d,t);return C&&(n=pt(s,t),o=this.updateDisplayParams(b,t,n,()=>h,()=>p,l)),b});if(!f)return Xt.resolve(null);let m;return p&&(m={...g,onModelChange:l,doesRowPassOtherFilter:this.createDoesRowPassOtherFilter(t)},p.init?.({...m,model:n,source:"init"})),f().then(v=>{if(!p)return{filter:v,comp:v,pendingUi:void 0};const C=h?.params,b=o(v);return{filter:v,comp:b,filterParams:C,handler:p,handlerParams:m,model:n,pendingUi:void 0}})}createChildParams(e,t,s,r){return{...e,filterChangedCallback:t?()=>{}:i=>{this.executeWhenAllFiltersReady(()=>this.onFilterModelChanged(r,i))},doesRowPassOtherFilter:this.createDoesRowPassOtherFilter(r),getValue:s}}createDoesRowPassOtherFilter(e){return this.beans.colFilter.createDoesRowPassOtherFilter(this.params.column,t=>this.doesFilterPass({node:t,data:t.data},e))}updateDisplayParams(e,t,s,r,i,n){const o=this.params.column,a=new nU;e.model=s,e.state={model:s},e.onModelChange=n,e.getHandler=i;const l=(u,d)=>{u.state=d,a.dispatchEvent({type:"filterStateChanged",column:o,state:d})};e.onStateChange=u=>{const d=this.wrappers[t];d&&(l(d,u),iv(d.filter,d.filterParams,d.model??null,u,"ui"))};const c=(u,d,h)=>{const p=this.wrappers[t];if(!p)return;const g=()=>p?.model??null;uU({action:d,filterParams:p.filterParams,getFilterUi:()=>{const f=Xt.resolve(p.filter);return{created:!0,filterParams:p.filterParams,compDetails:r(),create:()=>f,promise:f}},getModel:g,getState:()=>p?.state??{model:g()},updateState:f=>l(p,f),updateModel:f=>p.filterParams?.onModelChange(f,h),processModelToApply:p.handler?.processModelToApply?.bind(p.handler)})};return e.onAction=(u,d,h)=>{c(o,u,d),a.dispatchEvent({type:"filterAction",column:o,action:u,event:h})},u=>{const d=r()?.params;return this.createManagedBean(new aU(o,{comp:u,params:d,isHandler:!0},a,c,!1))}}executeWhenAllFiltersReady(e){(this.wrappers?.length??0)>0?e():this.afterFiltersReadyFuncs.push(e)}updateActiveListForFilter(e,t){this.updateActiveList(e,Cc(this.beans,t))}updateActiveListForHandler(e,t){this.updateActiveList(e,t!=null)}updateActiveList(e,t){const s=this.activeFilterIndices;oU(this.activeFilterIndices,e),t&&s.push(e)}onFilterModelChanged(e,t){this.updateActiveListForFilter(e,this.wrappers[e]?.filter),this.filterChanged(e,t)}onHandlerModelChanged(e,t,s){this.updateActiveListForHandler(e,t),this.filterChanged(e,s)}filterChanged(e,t){this.filterChangedCallback(t),this.wrappers.forEach((s,r)=>{if(e===r||!s)return;const{filter:i,handler:n}=s;n?.onAnyFilterChanged?.(),typeof i.onAnyFilterChanged=="function"&&i.onAnyFilterChanged()})}getModelAsString(e){if(!e?.filterModels?.length)return"";const t=this.getLastActiveFilterIndex()??0;return this.wrappers[t]?.filter?.getModelAsString?.(e.filterModels[t])??""}};import{_removeFromArray as vU}from"ag-stack";import{BeanStub as CU,_getDisplayHandler as bU,_getRowHandler as SU,_resolveFilter as lv}from"ag-grid-community";var yU=class extends R0{constructor(){super(...arguments),this.filterType="multi",this.handlerWrappers=[],this.activeFilterIndices=[],this.filterDefs=[]}init(e){this.params=e;const t=hs(e.filterParams);this.filterDefs=t;const{beans:s,handlerWrappers:r}=this,i=s.colFilter,n=e.column;for(let o=0,a=t.length;o<a;++o){const l=i.createHandler(n,lv(s,n,t[o],ht,e));if(r.push(l),!l){this.warn(278,{colId:n.getColId()});continue}const c=this.updateHandlerParams(l.handlerParams,o);l.handlerParams=c,l.handler.init?.({...c,model:pt(e.model,o),source:"init"})}this.refuseModelWithoutChild(),this.resetActiveList(this.params.model)}refuseModelWithoutChild(){const e=this.params,t=e.model,s=(r,i)=>!!r&&pt(t,i)!=null;return t==null||this.handlerWrappers.some(s)?!1:(this.params={...e,model:null},e.onModelChange(null,e.additionalEventAttributes),!0)}refresh(e){const{source:t,additionalEventAttributes:s}=e,r=t==="colDef";if(r){const l=hs(e.filterParams);if(kh(this.filterDefs,l))return!1;this.filterDefs=l}if(this.params=e,this.refuseModelWithoutChild()&&!r)return!0;const{beans:i,handlerWrappers:n}=this,o=i.colFilter,a=e.column;for(let l=0,c=n.length;l<c;++l){const u=n[l];if(!u)continue;r&&(u.handlerParams=this.updateHandlerParams(o.createHandlerParamsForDef(a,lv(i,a,this.filterDefs[l],ht,e)),l));const d=pt(this.params.model,l);if(u.handler.refresh?.({...u.handlerParams,model:d,source:t,additionalEventAttributes:s})===!1&&r)return!1}return t!=="floating"&&t!=="ui"&&this.resetActiveList(this.params.model),(s?.fromButtons||t==="floating")&&this.onAnyFilterChanged(),!0}updateHandlerParams(e,t){const s=e.onModelChange,{buttons:r,...i}=e.filterParams,n={...e,onModelChange:(o,a)=>s(on(this.params.model,this.handlerWrappers.length,o,t),a),doesRowPassOtherFilter:this.beans.colFilter.createDoesRowPassOtherFilter(e.column,o=>this.doesFilterPass({node:o,data:o.data,model:this.params.model,handlerParams:n},t)),filterParams:i};return n}doesFilterPass(e,t){const s=e.model?.filterModels;return s==null?!0:this.handlerWrappers.every((r,i)=>{const n=s[i];if(n==null||t!=null&&i===t)return!0;const o=r?.handler;return!o||o.doesFilterPass({...e,model:n,handlerParams:r.handlerParams})})}resetActiveList(e){this.activeFilterIndices=[];const t=e?.filterModels;if(t!=null)for(let s=0;s<this.handlerWrappers.length;s++)t[s]!=null&&this.activeFilterIndices.push(s)}updateActiveList(e,t){const s=this.activeFilterIndices;vU(s,e),t!=null&&s.push(e)}getLastActiveFilterIndex(){const e=this.activeFilterIndices;return e.length>0?e[e.length-1]:null}getModelAsString(e,t){const s=t==="filterToolPanel",r=()=>s?this.getLocaleTextFunc()("filterSummaryInactive","is (All)"):"";if(!e?.filterModels?.length)return r();const i=this.getLastActiveFilterIndex()??0;return this.handlerWrappers[i]?.handler.getModelAsString?.(e.filterModels[i],t)??r()}getHandler(e){return SU(this.handlerWrappers[e]?.handler)}getChildDisplayHandler(e){return bU(this.handlerWrappers[e]?.handler)}onChildAnyFilterChanged(e){this.handlerWrappers[e]?.handler.onAnyFilterChanged?.()}getChildGetValue(e){return this.handlerWrappers[e]?.handlerParams.getValue}onAnyFilterChanged(){nn(this.handlerWrappers,e=>e?.handler?.onAnyFilterChanged?.())}onNewRowsLoaded(){nn(this.handlerWrappers,e=>e?.handler?.onNewRowsLoaded?.())}destroy(){for(const e of this.handlerWrappers)this.destroyBean(e?.handler);this.handlerWrappers.length=0,super.destroy()}};import{BeanStub as wU,_getDefaultSimpleFilter as xU,_getFilterParamsForDataType as FU}from"ag-grid-community";var TU=class extends M0{constructor(){super(...arguments),this.beanName="multiFilter"}getParamsForDataType(e,t,s,r){let i=e?.filters;const n=this.beans;i?.length||(i=[{filter:xU(s.baseDataType)},{filter:"agSetColumnFilter"}]);const o=this.getLocaleTextFunc();return i=i.map(a=>{const{filterParams:l,filterValueGetter:c}=a,u=Aa(a),d=typeof u=="object"&&u!==null?u.component:u,h=d===!0?ht:d;if(typeof h!="string")return a;const{filterParams:p,filterValueGetter:g}=FU(h,l,c||t,s,r,n,o);return{...a,filterParams:p,filterValueGetter:g}}),{filterParams:{...e,filters:i}}}};import{AgPromise as bc,_getFilterDetails as AU,_isUseApplyButton as PU,_refreshFilterUi as RU,_resolveFilter as MU}from"ag-grid-community";var cv=class extends ov{constructor(){super(...arguments),this.filterType="multi",this.filters=[],this.filterParams=[],this.validity=[]}init(e){this.params=e,this.filterDefs=hs(e),this.allState=e.state;const t=this.filterDefs.map((s,r)=>this.createFilter(s,r));return new bc(s=>{bc.all(t).then(r=>{if(!this.isAlive()){this.destroyBeans(r??[]),s();return}this.filters=r,this.refreshGui("columnMenu").then(()=>{s()})})})}refresh(e){const{model:t,state:s,source:r}=e;if(r==="colDef")return!1;this.params=e;const i=this.filterParams;if(s===this.allState)return!0;this.allState=s;const n=s.state;return this.filters.forEach((o,a)=>{const l=pt(t,a),c={state:n?.[a],model:pt(s.model,a)};RU(o,i[a],l,c,r)}),!0}getLastActiveFilterIndex(){return this.getHandler().getLastActiveFilterIndex?.()??null}getChildFilterInstance(e){return this.filters[e]??void 0}getNumChildFilters(){return this.filters.length}destroy(){this.filters=this.destroyBeans(this.filters),super.destroy()}getFilterWrappers(){return this.filters}getFilterFromWrapper(e){return e}getCompFromWrapper(e){return e}createFilter(e,t){const{beans:s,params:r}=this,i=r.column,n=s.userCompFactory,o=this.updateParams(e,r,t),a=AU(n,MU(s,i,e,ht).def,o,ht);if(!a)return bc.resolve(null);const l=a.params;return l.buttons&&(s.log.warn(292,{colId:i.getColId()}),delete l.buttons),this.filterParams[t]=l,a.newAgStackInstance()}updateParams(e,t,s){const{doesRowPassOtherFilter:r,model:i,onModelChange:n,state:o,onStateChange:a,column:l,source:c,onAction:u,onUiChange:d,getValue:h}=t,p=pt(i,s),g=o?{model:pt(o.model,s),state:o.state?.[s]}:{model:p},f=()=>{const v=this.getHandler();this.filters.forEach((C,b)=>{s!==b&&(v.onChildAnyFilterChanged(b),C?.onAnyFilterChanged?.())})},m=this.beans.colFilter;return{...m.createBaseFilterParams(l),...e,doesRowPassOtherFilter:v=>r(v)&&this.getHandler().doesFilterPass({node:v,data:v.data,model:this.params.model,handlerParams:m.getHandlerParams(l)},s),model:p,state:g,onModelChange:(v,C)=>{const{filters:b,params:y}=this,S=on(y.model,b.length,v,s);this.updateActiveList(s,v),n(S,C),f()},onStateChange:v=>this.onStateChange(a,s,v),getHandler:()=>this.getHandler().getChildDisplayHandler(s),onAction:(v,C,b)=>{if(PU(t))return;const y=v==="apply"||v==="reset";y&&this.updateActiveList(s,pt(this.params.state.model,s)),u(v,C,b),y&&f()},onUiChange:d,source:c,getValue:this.getHandler().getChildGetValue(s)??h}}updateActiveList(e,t){this.getHandler().updateActiveList?.(e,t)}getHandler(){return this.params.getHandler()}onStateChange(e,t,s){const{model:r,state:i,valid:n}=s,o=this.validity;o[t]=n;const a=this.allState,l=on(a.model,this.filters.length,r,t),c=o.every(h=>h!==!1),u=[...a.state??[]];u[t]=i;const d={state:u,model:l,valid:c};this.allState=d,e(d)}getModelAsString(e){return this.getHandler().getModelAsString?.(e)??""}};import{_clearElement as IU,_setDisplayed as ai}from"ag-stack";import{AgPromise as EU,Component as DU,_getDefaultFloatingFilterType as LU,_getFloatingFilterCompDetails as kU,_mergeDeep as _U,_resolveFilter as GU}from"ag-grid-community";var OU={tag:"div",cls:"ag-multi-floating-filter ag-floating-filter-input"},NU=class extends I0{constructor(){super(OU),this.floatingFilters=[],this.compDetailsList=[]}init(e){this.params=e;const{compDetailsList:t}=this.getCompDetailsList(e);return this.setParams(t)}setParams(e){const t=[];return e.forEach(s=>{const r=s?.newAgStackInstance();r!=null&&(this.compDetailsList.push(s),t.push(r))}),EU.all(t).then(s=>{s.forEach((r,i)=>{this.floatingFilters.push(r);const n=r.getGui();this.appendChild(n),i>0&&ai(n,!1)})})}refresh(e){this.params=e;const{compDetailsList:t,floatingFilterParamsList:s}=this.getCompDetailsList(e);if(t.length===this.compDetailsList.length&&t.every((i,n)=>!this.beans.colFilter?.areFilterCompsDifferent(this.compDetailsList[n],i))){if(s.forEach((i,n)=>{this.floatingFilters[n].refresh?.(i)}),this.gos.get("enableFilterHandlers")){const i=e;if(i.model==null)this.floatingFilters.forEach((n,o)=>{ai(n.getGui(),o===0)});else{const n=i.getHandler()?.getLastActiveFilterIndex?.();this.floatingFilters.forEach((o,a)=>{const l=n==null?a===0:a===n;ai(o.getGui(),l)})}}}else IU(this.getGui()),this.destroyBeans(this.floatingFilters),this.floatingFilters=[],this.compDetailsList=[],this.setParams(t)}getCompDetailsList(e){const t=[],s=[],r=e.filterParams,i=e.currentParentModel,{beans:n,gos:o}=this,a=e.column,l=hs(r);for(let c=0,u=l.length;c<u;++c){const d={...e,filterParams:{...r},parentFilterInstance:g=>{this.parentMultiFilterInstance(f=>{const m=f.getChildFilterInstance(c);m!=null&&g(m)})},currentParentModel:()=>i()?.filterModels?.[c]??null};if(o.get("enableFilterHandlers")){const g=d;g.model=g.model?.filterModels?.[c]??null;const{onModelChange:f,getHandler:m}=g;g.onModelChange=(v,C)=>f(on(this.params.model,l.length,v,c),C),g.getHandler=()=>m().getChildDisplayHandler(c)}const h=GU(n,a,l[c],ht);_U(d.filterParams,ps(n,a,h.def));const p=this.getCompDetails(h,d);p&&(t.push(p),s.push(d))}return{compDetailsList:t,floatingFilterParamsList:s}}onParentModelChanged(e,t){t?.afterFloatingFilter||this.parentMultiFilterInstance(s=>{const r=e?.filterModels,i=this.floatingFilters;if(!r){for(let o=0,a=i.length;o<a;++o){const l=i[o];l.onParentModelChanged(null,t),ai(l.getGui(),o===0)}return}const n=s.getLastActiveFilterIndex();for(let o=0,a=i.length;o<a;++o){const l=i[o],c=r.length>o?r[o]:null;l.onParentModelChanged(c,t);const u=n==null?o===0:o===n;ai(l.getGui(),u)}})}destroy(){this.destroyBeans(this.floatingFilters),this.floatingFilters.length=0,super.destroy()}getCompDetails(e,t){const s=LU(e.key)??"agReadOnlyFloatingFilter";return kU(this.beans.userCompFactory,e.def,t,s)}parentMultiFilterInstance(e){this.params.parentFilterInstance(t=>{t instanceof av||t instanceof cv||this.beans.log.error(120),e(t)})}},uv={moduleName:"MultiFilter",version:_,userComponents:{agMultiColumnFilter:{getComp:e=>e.gos.get("enableFilterHandlers")?{classImp:cv,params:{useForm:!0}}:av},agMultiColumnFloatingFilter:NU},beans:[TU],dynamicBeans:{agMultiColumnFilterHandler:yU},dependsOn:[$,iU,Ur]};import{_ColumnFilterModule as BU,_PopupModule as VU}from"ag-grid-community";import{_exists as HU}from"ag-stack";import{BeanStub as UU}from"ag-grid-community";var zU=class extends E0{constructor(){super(...arguments),this.beanName="aggColNameSvc"}getHeaderName(e,t){if(this.gos.get("suppressAggFuncInHeader"))return t;const{valueColsSvc:s,colModel:r,rowGroupColsSvc:i}=this.beans,n=e.pivotValueColumn,o=HU(n);let a=null,l;if(o){const c=s?.columns??[],u=this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&c.length===1,d=e.colDef.pivotTotalColumnIds!==void 0;if(u&&!d)return t;a=n?n.getAggFunc():null,l=!0}else{const c=e.isValueActive(),u=i?.columns.length!==0,d=r.pivotMode||u||this.gos.get("treeData");c&&d?(a=e.aggFunc,l=!0):l=!1}if(l){const c=typeof a=="string"?a:"func";return`${this.getLocaleTextFunc()(c,c)}(${t})`}return t}};import{_exists as dv,_last as WU}from"ag-stack";import{BeanStub as KU}from"ag-grid-community";var hv={sum:"Sum",first:"First",last:"Last",min:"Min",max:"Max",count:"Count",avg:"Average"},$U=["sum","avg","max","min","count","first","last"],jU=class extends D0{constructor(){super(...arguments),this.beanName="aggFuncSvc",this.aggFuncsMap=new Map,this.orderedFuncNames=[],this.initialised=!1}postConstruct(){this.init()}init(){this.initialised||(this.initialiseWithDefaultAggregations(),this.addAggFuncs(this.gos.get("aggFuncs")))}initialiseWithDefaultAggregations(){const e=this.aggFuncsMap;e.set("sum",YU),e.set("first",qU),e.set("last",ZU);const t=this.getDateStringParser.bind(this);e.set("min",s=>pv(s,!1,t)),e.set("max",s=>pv(s,!0,t)),e.set("count",JU),e.set("avg",e9),this.initialised=!0,this.updateOrderedFuncNames()}getDateStringParser({column:e}){const t=this.beans.dataTypeSvc,s=e;if(!t||!s)return null;const r=t.getBaseDataType(s);return r!=="dateString"&&r!=="dateTimeString"?null:t.getDateParserFunction(s)}getDefaultFuncLabel(e){return hv[e]??e}getDefaultAggFunc(e){const t=e.colDef.defaultAggFunc,s=i=>dv(this.aggFuncsMap.get(i))&&this.getFuncNames(e).includes(i);if(dv(t)&&s(t))return t;if(s("sum"))return"sum";const r=this.getFuncNames(e);return r?.length?r[0]:null}addAggFuncs(e){if(this.init(),!!e){for(const t of Object.keys(e))e[t]&&this.aggFuncsMap.set(t,e[t]);this.updateOrderedFuncNames()}}getAggFunc(e){return this.init(),this.aggFuncsMap.get(e)}getFuncNames(e){return e.colDef.allowedAggFuncs??this.orderedFuncNames.slice()}updateOrderedFuncNames(){const e=[];for(const t of $U)this.aggFuncsMap.has(t)&&e.push(t);for(const t of[...this.aggFuncsMap.keys()].sort())t in hv||e.push(t);this.orderedFuncNames=e}clear(){this.aggFuncsMap.clear(),this.orderedFuncNames=[]}};function YU(e){const{values:t}=e;let s=null;for(let r=0;r<t.length;r++){const i=t[r];typeof i=="number"?s===null?s=i:s+=typeof s=="number"?i:BigInt(i):typeof i=="bigint"&&(s===null?s=i:s=(typeof s=="bigint"?s:BigInt(s))+i)}return s}function qU(e){return e.values.length>0?e.values[0]:null}function ZU(e){return e.values.length>0?WU(e.values):null}function pv(e,t,s){const{values:r}=e;let i=null,n=null,o=0,a;for(let l=0;l<r.length;l++){const c=r[l];if(typeof c=="number"||typeof c=="bigint"){(i===null||(t?i<c:i>c))&&(i=c);continue}if(i!==null)continue;let u;if(c instanceof Date)u=c.getTime();else if(typeof c=="string"){if(a===void 0&&(a=s(e)),!a)continue;u=a(c)?.getTime()??Number.NaN}else continue;!Number.isNaN(u)&&(n===null||(t?o<u:o>u))&&(n=c,o=u)}return i??n}var XU=Object.freeze({toString:function(){return this.value.toString()},toNumber:function(){return this.value}});function JU(e){const{values:t}=e;let s=0;for(let n=0;n<t.length;n++){const o=t[n];s+=o!=null&&typeof o.value=="number"?o.value:1}const r=e.rowNode?.aggData?.[e.column.getColId()];if(r?.value===s)return r;const i=Object.create(XU);return i.value=s,i}var QU=Object.freeze({toString:function(){return typeof this.value=="number"||typeof this.value=="bigint"?this.value.toString():""},toNumber:function(){return this.value}});function e9(e){const{values:t}=e;let s=0,r=0;for(let a=0;a<t.length;a++){const l=t[a];let c=null;typeof l=="number"||typeof l=="bigint"?(c=l,r++):l!=null&&(typeof l.value=="number"||typeof l.value=="bigint")&&typeof l.count=="number"&&(c=l.value*(typeof l.value=="number"?l.count:BigInt(l.count)),r+=l.count),typeof c=="number"?s+=typeof s=="number"?c:BigInt(c):typeof c=="bigint"&&(s=(typeof s=="bigint"?s:BigInt(s))+c)}let i=null;r>0&&(i=s/(typeof s=="number"?r:BigInt(r)));const n=e.rowNode?.aggData?.[e.column?.getColId()];if(n?.count===r&&n.value===i)return n;const o=Object.create(QU);return o.count=r,o.value=i,o}import{BeanStub as t9,_getGroupAggFiltering as s9}from"ag-grid-community";var r9=class extends L0{constructor(){super(...arguments),this.beanName="aggChildrenSvc"}getAggregatedChildren(e,t,s){if(!e?.group)return[];if(e.rowPinned&&(e=e.pinnedSibling,!e))return[];const r=this.gos,i=gv(e,t,r);if(!s)return i;const n=[];return fv(i,t,r,n),n}},gv=(e,t,s)=>{const r=t?.colDef,i=r?.pivotKeys;return i?e.leafGroup&&i.length&&!r.pivotTotalColumnIds?xg(e.childrenMapped,i):e.childrenAfterFilter??e.childrenAfterGroup??[]:s9(s)||s.get("suppressAggFilteredOnly")?e.childrenAfterGroup??[]:e.childrenAfterFilter??e.childrenAfterGroup??[]},fv=(e,t,s,r)=>{for(let i=0,n=e.length;i<n;++i){const o=e[i];o.group?fv(gv(o,t,s),t,s,r):r.push(o)}};function i9(e,t){e.aggFuncSvc&&e.aggFuncSvc.addAggFuncs(t)}function n9(e){e.aggFuncSvc&&e.aggFuncSvc.clear()}function o9(e,t,s){e.valueColsSvc?.setColumnAggFunc?.(t,s,"api")}var a9='.ag-row-grand-total-border-bottom,.ag-row-grand-total-border-top{z-index:2}.ag-row-grand-total-border-bottom:before,.ag-row-grand-total-border-top:before{content:"";left:0;pointer-events:none;position:absolute;right:0;z-index:3}.ag-row-grand-total-border-top:before{border-top:var(--ag-grand-total-row-border);top:calc(var(--ag-internal-row-border-width)*-1)}.ag-row-grand-total-border-bottom:before{border-bottom:var(--ag-grand-total-row-border);bottom:0}:where(.ag-grid-sticky-bottom-rows-container) .ag-row-grand-total-border-top:before{top:0}:where(.ag-grid-pinned-top-rows-container>.ag-row-last).ag-row-grand-total-border-bottom:before{bottom:calc(var(--ag-pinned-row-border-width)*-1)}';import{BeanStub as l9,_forEachChangedGroupDepthFirst as mv,_getGrandTotalRow as c9,_getGroupAggFiltering as u9}from"ag-grid-community";var d9=class extends k0{constructor(){super(...arguments),this.beanName="aggStage",this.step="aggregate",this.refreshProps=["getGroupRowAgg","alwaysAggregateAtRootLevel","suppressAggFilteredOnly","grandTotalRow"],this.hadAgg=!1,this.aggCleared=!1,this.prevValueColumns=null}destroy(){super.destroy(),this.prevValueColumns=null}refreshAggregateDependentCells(e,t){const s=this.beans,r=this.hadAgg||this.aggCleared;this.aggCleared=!1;const i=s.visibleCols.allCols;let n=!1;for(let a=0,l=i.length;a<l;++a){const c=i[a];if(c.showValuesAs!=null||r&&c.valueGetter!=null){n=!0;break}}if(!n)return;const o=s.rowRenderer.getAllRowCtrls();for(let a=0,l=o.length;a<l;++a){const c=o[a],u=c.rowNode;if(e?.has(u)||t?.hasRow(u))continue;const d=c.getAllCellCtrls();for(let h=0,p=d.length;h<p;++h){const g=d[h],f=g.column;(f.showValuesAs!=null||r&&f.valueGetter!=null)&&g.refreshOrDestroyCell(f9)}}}execute(e){this.aggregate(e,!1)}aggregateRootOnly(){this.aggregate(void 0,!0)}aggregate(e,t){const{gos:s,beans:r}=this,i=s.getCallback("getGroupRowAgg"),n=r.valueColsSvc?.columns;if(!n?.length&&!i){if(this.prevValueColumns=null,this.hadAgg&&!e&&!t){this.hadAgg=!1,this.aggCleared=!0;const T=r.colModel,x=r.rowModel;mv(x.rootNode,x.hierarchical,void 0,P=>{Fg(P,null,T)})}return}this.hadAgg=!0;const o=r.colModel,a=r.aggFuncSvc,l=t||s.get("alwaysAggregateAtRootLevel")||!!c9(s)||o.pivotMode,c=!u9(s)&&!s.get("suppressAggFilteredOnly"),u=r.valueSvc,d=r.gridApi,h=r.gridOptions.context,p=n??[],g=p.length,f=e?.kind==="cells"?e:void 0;let m;const v=new Array(g);for(let T=0;T<g;++T){const x=p[T],P=f?f.getSlot(x.colId):-1;P>=0&&(m=f),v[T]={column:x,colId:x.colId,colDef:x.colDef,aggFunc:vv(x.aggFunc,a,x,r),colSlot:P}}const C=g9(o,r.pivotResultCols,a,r),b=this.prevValueColumns;let y;C||i||!n?this.prevValueColumns=null:(!t&&!e&&(this.prevValueColumns=n),y={cols:v,checkRemoved:b!==n});const S=g>0?new Array(g):null,w=r.rowModel,F=T=>{if(T.level===-1&&!l){Us(T,null,o);return}let x;i?x=i({nodes:T.childrenAfterFilter}):S?C?x=p9(T,C,u,d,h):x=h9(T,v,g,S,m,c,u,d,h):x=null,Fg(T,x,o,y)};if(t){const T=w.rootNode;T&&F(T);return}mv(w.rootNode,w.hierarchical,e,F)}},h9=(e,t,s,r,i,n,o,a,l)=>{const c=(n?e.childrenAfterFilter:e.childrenAfterGroup)??[],u=c.length,d=e.data,h=Object.create(null),p=i?i.getSlot(e):-1,g=p>=0?e.aggData:void 0;let f=0;for(let m=0;m<s;++m){const v=t[m];p>=0&&!i.hasCellBySlot(p,v.colSlot)?(r[m]=null,g&&(h[v.colId]=g[v.colId])):(r[m]=new Array(u),++f)}if(f===0)return h;for(let m=0;m<u;++m){const v=c[m],C=v.aggData;if(C)for(let b=0;b<s;++b){const y=r[b];if(y!==null){const S=t[b],w=C[S.colId];y[m]=w!==void 0?w:o.getValueFromData(S.column,v)}}else for(let b=0;b<s;++b){const y=r[b];y!==null&&(y[m]=o.getValueFromData(t[b].column,v))}}for(let m=0;m<s;++m){const v=r[m];if(v===null)continue;const C=t[m],b=C.aggFunc;h[C.colId]=b?b({values:v,column:C.column,colDef:C.colDef,rowNode:e,data:d,aggregatedChildren:c,api:a,context:l}):null}return h},p9=(e,t,s,r,i)=>{const n=t.length,o=e.leafGroup,a=e.data,l=e.childrenMapped,c=e.childrenAfterFilter??[],u=Object.create(null);let d,h;for(let p=0;p<n;++p){const g=t[p],f=g.column,m=g.colId,v=g.totalColIds;let C,b;if(v!=null){const S=v.length;C=new Array(S);for(let w=0;w<S;++w)C[w]=u[v[w]];b=c}else if(o){const S=g.pivotKeys;(!h||S!==d)&&(d=S,h=xg(l,S)),b=h;const w=b.length;C=new Array(w);for(let F=0;F<w;++F)C[F]=s.getValueFromData(f,b[F])}else{b=c;const S=b.length;C=new Array(S);for(let w=0;w<S;++w){const F=b[w],T=F.aggData,x=T?T[m]:void 0;C[w]=x!==void 0?x:s.getValueFromData(f,F)}}const y=g.aggFunc;u[m]=y?y({values:C,column:f,colDef:g.colDef,pivotResultColumn:g.pivotResultCol,rowNode:e,data:a,aggregatedChildren:b,api:r,context:i}):null}return u},vv=(e,t,s,r)=>{if(typeof e=="function")return e;if(e==null)return null;const i=t.getAggFunc(e);return typeof i!="function"?(r.log.warn(109,{inputValue:e.toString(),allSuggestions:t.getFuncNames(s)}),null):i},g9=(e,t,s,r)=>{if(!e.isPivotActive())return null;const i=t?.getAggregationOrderedList();if(!i||i.length===0)return null;const n=i.length,o=new Array(n);let a=0;for(let l=0;l<n;++l){const c=i[l],u=c.pivotValueColumn;if(!u)continue;const d=c.colDef;o[a++]={column:u,colId:c.colId,colDef:u.colDef,aggFunc:vv(u.aggFunc,s,u,r),pivotResultCol:c,pivotKeys:d.pivotKeys,totalColIds:d.pivotTotalColumnIds}}return a===0?null:(o.length=a,o)},f9={force:!1,newData:!1};import{BeanStub as m9,_forEachChangedGroupDepthFirst as v9,_getGroupAggFiltering as C9}from"ag-grid-community";var b9=class extends _0{constructor(){super(...arguments),this.beanName="filterAggStage",this.step="filter_aggregates",this.refreshProps=[],this.setAllChildrenCountTreeData=e=>{const t=e.childrenAfterAggFilter;let s=0;if(t){const i=t.length;s=i;for(let n=0;n<i;++n)s+=t[n].allChildrenCount??0}const r=s===0&&e.level>=0?null:s;e.setAllChildrenCount(r),e.pinnedSibling?.setAllChildrenCount(r)},this.setAllChildrenCountGridGrouping=e=>{const t=e.childrenAfterAggFilter;let s=0;for(let r=0,i=t.length;r<i;++r){const n=t[r];n.group?s+=n.allChildrenCount:s++}e.setAllChildrenCount(s),e.pinnedSibling?.setAllChildrenCount(s)}}wireBeans(e){this.filterManager=e.filterManager}execute(e){const{rowModel:t,colModel:s,groupStage:r}=this.beans,{filterManager:i}=this,n=s.pivotMode,o=i?.isAggregateFilterPresent()||i?.isAggregateQuickFilterPresent(),a=!!r?.treeData,l=g=>!g.node.group,c=g=>g.node.leafGroup,u=C9(this.gos)??(n?c:l),d=a?this.setAllChildrenCountTreeData:this.setAllChildrenCountGridGrouping,h=(g,f=!1)=>{if(g.childrenAfterFilter){if(g.childrenAfterAggFilter=g.childrenAfterFilter,f){const m=g.childrenAfterAggFilter;for(let v=0,C=m.length;v<C;++v)h(m[v],f)}g.hasChildren()?d(g):(g.setAllChildrenCount(null),g.pinnedSibling?.setAllChildrenCount(null))}g.sibling&&(g.sibling.childrenAfterAggFilter=g.childrenAfterAggFilter)},p=g=>{g.childrenAfterAggFilter=g.childrenAfterFilter?.filter(f=>u({node:f})&&i.doesRowPassAggregateFilters({rowNode:f})?(h(f,!0),!0):f.childrenAfterAggFilter?.length)??null,g.hasChildren()?d(g):(g.setAllChildrenCount(null),g.pinnedSibling?.setAllChildrenCount(null)),g.sibling&&(g.sibling.childrenAfterAggFilter=g.childrenAfterAggFilter)};v9(t.rootNode,t.hierarchical,e,o?p:h)}};import{BeanStub as S9,_addGridCommonParams as y9,_getGrandTotalRow as w9,_getGroupTotalRowCallback as x9}from"ag-grid-community";import{GROUP_TOTAL_ROW_ID_PREFIX as F9,_createRowNodeSibling as T9}from"ag-grid-community";function Lt(e,t,s){let r=e.sibling;return r||(r=T9(e,t),r.footer=!0,r.setRowTop(null),r.setRowIndex(null),r.oldRowTop=null,r.id=s??F9+e.id,r.sibling=e,e.sibling=r,r)}function to(e){const t=e.sibling;t&&(t._destroy(!1),e.sibling=void 0)}var A9=class extends G0{constructor(){super(...arguments),this.beanName="footerSvc"}addTotalRows(e,t,s,r,i,n){let o=e;if(i){const c=t.sibling;return r&&c?.displayed&&w9(this.gos)===n&&s(c,o++),o}const a=x9(this.gos);return(r&&a({node:t}))===n&&s(Lt(t,this.beans),o++),o}getTopDisplayIndex(e,t,s,r){let i=t;if(e[0].footer){if(t===0)return 0;i-=1}const n=e[e.length-1],o=i>=s.length;return n.footer&&o?n.rowIndex:r(i)}doesCellShowTotalPrefix(e,t){return!e.footer||!t?.getColDef().showRowGroup?!1:this.gos.get("treeData")?!0:e.level===-1?this.beans.showRowGroupCols?.columns[0]===t:!!e.rowGroupColumn&&t?.isRowGroupDisplayed(e.rowGroupColumn.getId())}applyTotalPrefix(e,t,s,r){const i=r.getColDef().cellRendererParams?.totalValueGetter;if(i){const n=y9(this.gos,{column:r,node:s,value:e,formattedValue:t});if(typeof i==="function")return i(n);if(typeof i=="string")return this.beans.expressionSvc?.evaluate(i,n);this.warn(179)}return s.level===-1?this.getLocaleTextFunc()("footerTotal","Total")+" ":this.getTotalValue(t??e)??""}getTotalValue(e){return this.getLocaleTextFunc()("footerTotal","Total")+" "+(e??"")}};import{_indexMap as P9}from"ag-stack";import{BeanStub as R9,_dispatchColumnChangedEvent as M9}from"ag-grid-community";var Cv=class extends O0{constructor(){super(...arguments),this.activeColSet=new Set,this.colsCache=null,this.extractColsWithIndex=null,this.extractColsWithValue=null,this.pendingChanged=null,this.reindexPending=!1,this.pendingStateOrder=null,this.pendingStateChanged=!1,this.compareByStateIndex=(e,t)=>{const s=this.pendingStateOrder;if(!s)return 0;const r=s.get(e),i=s.get(t);return r==null?i==null?0:1:i==null?-1:r-i}}extractAddColWithIndex(e,t){let s=this.extractColsWithIndex;s===null&&(s=[],this.extractColsWithIndex=s),s.push({col:e,key:t})}extractAddColWithValue(e){let t=this.extractColsWithValue;t===null&&(t=new Set,this.extractColsWithValue=t),t.add(e)}bucketByKey(e,t){t!=null?this.extractAddColWithIndex(e,t):this.extractAddColWithValue(e)}get columns(){let e=this.colsCache;return e===null&&(e=Array.from(this.activeColSet),this.colsCache=e),e}wireBeans(e){this.colModel=e.colModel}resetActiveCols(e){this.activeColSet=new Set(e),this.colsCache=e}setColActive(e,t,s,r=!1){return this.writeColActive(e,t,s)?(t?this.activeColSet.add(e):this.activeColSet.delete(e),r&&this.onColActiveChanged(e,t,s),this.colsCache=null,!0):!1}onColActiveChanged(e,t,s){}applyActiveCols(e,t,s,r,i){for(let n=0,o=e.length;n<o;++n){const a=e[n];!t.has(a)&&this.writeColActive(a,!1,r)&&i&&this.onColActiveChanged(a,!1,r)}for(const n of t)this.writeColActive(n,!0,r)&&i&&this.onColActiveChanged(n,!0,r);this.activeColSet=t,this.colsCache=s}onColActiveChangesComplete(e){}onColumnsChanged(){}stageChangedColsBetween(e,t){const s=P9(t),r=e.length>0?new Set(e):null;let i=null,n=!1;for(let o=0,a=e.length;o<a;++o){const l=e[o],c=s.get(l);c===void 0?(n=!0,i??(i=this.pendingColChangeSet()),i.add(l)):c!==o&&(i??(i=this.pendingColChangeSet()),i.add(l))}for(let o=0,a=t.length;o<a;++o){const l=t[o];r?.has(l)||(n=!0,i??(i=this.pendingColChangeSet()),i.add(l))}return i===null?"none":(this.reindexPending=!0,n?"membership":"reorder")}setColumns(e,t){const s=e??[],r=this.colModel;if(r.colsList.length===0)return;const i=this.columns,n=[];for(let c=0,u=s.length;c<u;++c){const d=r.getNonPivotCol(s[c]);d&&n.push(d)}const o=this.expandActiveCols(n),a=Array.from(o),l=this.stageChangedColsBetween(i,a);if(l!=="none"){r.beginColUpdate();try{this.applyActiveCols(i,o,a,t,!0),r.stageColChanges(t,l)}finally{r.endColUpdate()}}}seatActiveCol(e,t,s){e.add(t)}expandActiveCols(e){const t=new Set,s=new Set(e);for(let r=0,i=e.length;r<i;++r)this.seatActiveCol(t,e[r],s);return t}stageColChange(e){this.reindexPending=!0,this.pendingColChangeSet().add(e)}stageRemovedFrom(e){const t=this.activeColSet,s=e.length;let r=0;for(;r<s&&t.has(e[r]);)++r;this.stageColsFrom(e,r)}stageColsFrom(e,t){const s=e.length;if(t>=s)return;this.reindexPending=!0;const r=this.pendingColChangeSet();for(let i=t;i<s;++i)r.add(e[i])}recordColChange(e){this.pendingColChangeSet().add(e)}pendingColChangeSet(){let e=this.pendingChanged;return e===null&&(e=new Set,this.pendingChanged=e),e}flushReindex(){this.reindexPending&&(this.reindexPending=!1,this.onColumnsChanged())}dispatchColChange(e){this.onColActiveChangesComplete(e);const t=this.pendingChanged;t&&(this.pendingChanged=null,M9(this.eventSvc,this.eventName,Array.from(t),e))}addColumns(e,t){this.updateColList(e,!0,t)}removeColumns(e,t){this.updateColList(e,!1,t)}updateColList(e,t,s){if(!e||e.length===0)return;const r=this.colModel,i=t?null:this.columns,n=this.activeColSet.size;r.beginColUpdate();try{let o=!1;for(let a=0,l=e.length;a<l;++a){const c=e[a],u=c?r.getNonPivotCol(c):null;u&&this.setColActive(u,t,s,!0)&&(o=!0)}if(!o)return;i===null?this.stageColsFrom(this.columns,n):this.stageRemovedFrom(i),r.stageColChanges(s,"membership")}finally{r.endColUpdate()}}commitExtract(e){const t=this.extractColsWithIndex,s=this.extractColsWithValue,r=this.activeColSet,i=this.columns,n=new Set;if(t!==null){t.length>1&&t.sort((o,a)=>o.key-a.key);for(let o=0,a=t.length;o<a;++o)this.seatActiveCol(n,t[o].col)}if(s!==null){for(let o=0,a=i.length;o<a;++o){const l=i[o];s.has(l)&&this.seatActiveCol(n,l)}for(const o of s)r.has(o)||this.seatActiveCol(n,o)}this.applyActiveCols(i,n,null,e,!1),this.onColumnsChanged(),this.extractColsWithIndex=null,this.extractColsWithValue=null}recordPendingStateOrder(e,t){let s=this.pendingStateOrder;s===null&&(s=new Map,this.pendingStateOrder=s),s.set(e,t),this.pendingStateChanged=!0}sortByPendingState(){if(!this.pendingStateChanged)return;this.pendingStateChanged=!1;const e=this.columns;e.length>0&&this.sortPendingCols(e)&&this.resetActiveCols(e),this.onColumnsChanged(),this.pendingStateOrder=null}sortPendingCols(e){return this.pendingStateOrder?(e.sort(this.compareByStateIndex),!0):!1}},Sc=0,I9=1,yc=2,bv=e=>e!=null&&e!=="",li=(e,t,s)=>e.aggFunc===t?!1:(e.aggFunc=t,e.dispatchStateUpdatedEvent("aggFunc",s),!0),Sv=class extends Cv{constructor(){super(...arguments),this.beanName="valueColsSvc",this.eventName="columnValueChanged"}wireBeans(e){super.wireBeans(e),this.aggFuncSvc=e.aggFuncSvc}extractCol(e,t,s){const r=e.colDef,i=r.aggFunc;let n;if(i!==void 0)n=i!==null&&i!=="";else if(t){const o=r.initialAggFunc;n=o!=null&&o!==""}else n=e.aggregationActive;if(!n){const o=e.showValuesAs?.def.defaultAggFunc;o&&(this.bucketCol(e,t),e.aggFunc||li(e,o,s));return}this.bucketCol(e,t),i!=null&&i!==""?li(e,i,s):e.aggFunc||li(e,r.initialAggFunc,s)}bucketCol(e,t){const s=e.colDef,r=s.valueIndex??(t?s.initialValueIndex:null);this.bucketByKey(e,r)}onColActiveChanged(e,t,s){const r=this.aggFuncSvc;t&&r&&!e.aggFunc&&li(e,r.getDefaultAggFunc(e),s)}writeColActive(e,t,s){return e.aggregationActive===t?!1:(e.aggregationActive=t,e.dispatchColEvent(this.eventName,s),!0)}setColumnAggFunc(e,t,s){if(!e)return;const r=this.colModel,i=r.getNonPivotCol(e);if(!i)return;const n=i.aggregationActive&&!bv(t)?this.columns:null;r.beginColUpdate();try{const o=this.applyAggFunc(i,t,s);if(o===Sc)return;const a=o===yc;n!==null?this.stageRemovedFrom(n):a?this.stageColChange(i):this.recordColChange(i),r.stageColChanges(s,a?"membership":"dispatch")}finally{r.endColUpdate()}}syncColState(e,t,s,r){const i=t?.aggFunc,n=i!==void 0?i:s?.aggFunc,o=t?.valueIndex,a=o!==void 0?o:s?.valueIndex;if(!(n===void 0&&a===void 0)){if(n!==void 0){if(typeof n!="string"&&n!=null){this.warn(33);return}this.applyAggFunc(e,n,r)}else typeof a=="number"&&!e.aggregationActive&&this.setColActive(e,!0,r,!0);typeof a=="number"&&e.aggregationActive&&this.recordPendingStateOrder(e,a)}}onColumnsChanged(){const e=this.columns;for(let t=0,s=e.length;t<s;++t)e[t].aggregationActiveIndex=t}applyAggFunc(e,t,s){if(bv(t)){const r=li(e,t,s);return this.setColActive(e,!0,s)?yc:r?I9:Sc}return this.setColActive(e,!1,s)?yc:Sc}},wc={moduleName:"SharedAggregation",version:_,beans:[jU,zU,A9,Sv],apiFunctions:{addAggFuncs:i9,clearAggFuncs:n9,setColumnAggFunc:o9},css:[a9],dependsOn:[$]},yv={moduleName:"AggregationStage",version:_,beans:[d9],rowModels:["clientSide"],dependsOn:[wc]},xc={moduleName:"Aggregation",version:_,beans:[b9,r9],rowModels:["clientSide"],dependsOn:[yv]},wv=class extends Cv{writeColActive(e,t,s){return this.setActiveFlag(e,t)?(e.dispatchColEvent(this.eventName,s),e.dispatchStateUpdatedEvent(this.enableProp,s),!0):!1}wireBeans(e){super.wireBeans(e),this.groupHierarchCols=e.groupHierarchyColSvc}getActiveHierarchyCols(){const e=this.groupHierarchCols;return e?.columns.length?e:void 0}extractCol(e,t){if(!this.willExtractCol(e,t))return;const s=e.colDef,r=s[this.indexProp]??(t?s[this.initialIndexProp]:null);this.bucketByKey(e,r)}willExtractCol(e,t){const s=e.colDef,r=xv(s[this.enableProp],s[this.indexProp]);return r!==void 0?r:t?!!xv(s[this.initialEnableProp],s[this.initialIndexProp]):this.activeColSet.has(e)}getActiveVirtuals(e){return this.groupHierarchCols?.getVirtualCols(e)}seatActiveCol(e,t,s){const r=this.getActiveVirtuals(t);if(r!==void 0){const i=r.length;let n=!1;if(s!==void 0){for(let o=0;o<i;++o)if(s.has(r[o])){n=!0;break}}if(!n)for(let o=0;o<i;++o)e.add(r[o])}e.add(t)}setColActive(e,t,s,r=!1){if(t){const i=this.getActiveVirtuals(e);if(i!==void 0){const n=this.activeColSet;for(let o=0,a=i.length;o<a;++o){const l=i[o];n.add(l),this.writeColActive(l,!0,s)}}}return super.setColActive(e,t,s,r)}syncColState(e,t,s,r){const i=this.enableProp,n=this.indexProp;let o=t?.[i],a=t?.[n];o===void 0&&a===void 0&&(s&&(o=s[i],a=s[n]),o===void 0&&a===void 0)||(typeof a=="number"?(this.setColActive(e,!0,r),this.recordPendingStateOrder(e,a)):this.setColActive(e,!!o,r)&&(this.pendingStateChanged=!0))}sortPendingCols(e){const t=this.getActiveHierarchyCols();return t?(e.sort((s,r)=>t.compareVirtualColumns(s,r)??this.compareByStateIndex(s,r)),!0):super.sortPendingCols(e)}restoreColumnOrder(e,t){const s=this.columns;if(!s.length)return;const r=this.enableProp==="rowGroup",i=this.indexProp,n=new Set(Object.keys(e)),o=new Set(n);for(let f=0,m=s.length;f<m;++f){const v=s[f].colId;n.delete(v),o.add(v)}const a=[],l=Object.create(null);let c=0;const u=this.colModel.colDefList;for(let f=0,m=u.length;f<m;++f){const v=u[f].colId;o.has(v)&&(a.push(v),l[v]=c++)}let d=1e3,h=!1,p=0;const g=f=>{const m=l[f];for(let v=p;v<m;++v){const C=a[v];n.has(C)&&(e[C][i]=d++,n.delete(C))}p=m};for(let f=0,m=s.length;f<m;++f){const v=s[f],C=v.colId;if(e[C]?.colId!=null){g(C),e[C][i]=d++;continue}const b=v.colDef,y=r?b.rowGroupIndex:b.pivotIndex,S=r?b.initialRowGroupIndex:b.initialPivotIndex;if(y===null||y===void 0&&S==null){if(!h){const w=r?b.rowGroup:b.pivot,F=r?b.initialRowGroup:b.initialPivot;if(w||w===void 0&&F)g(C);else{for(const x of n)e[x][i]=d+l[x];d+=a.length,h=!0}}t[C]||(t[C]={colId:C}),t[C][i]=d++}}}};function xv(e,t){if(e!==void 0)return!!e;if(t!==void 0)return t!==null&&t>=0}var Fv=class extends wv{constructor(){super(...arguments),this.beanName="pivotColsSvc",this.eventName="columnPivotChanged",this.enableProp="pivot",this.indexProp="pivotIndex",this.initialEnableProp="initialPivot",this.initialIndexProp="initialPivotIndex",this.hasPivotComparator=!1}postConstruct(){this.addManagedEventListeners({columnValueChanged:()=>{const e=this.beans;e.colModel.pivotMode&&e.sortSvc?.invalidate()}})}setActiveFlag(e,t){return e.pivotActive===t?!1:(e.pivotActive=t,!0)}onColumnsChanged(){const e=this.columns;let t=!1;for(let s=0,r=e.length;s<r;++s){const i=e[s];i.pivotActiveIndex=s,t||(t=i.colDef.pivotComparator!=null)}this.hasPivotComparator=t}hasInteractivePivotSort(){const e=this.columns;for(let t=0,s=e.length;t<s;++t)if(e[t].pivotSort!==void 0)return!0;return!1}isStrictColumnOrder(){return this.hasPivotComparator&&!!this.gos.get("enableStrictPivotColumnOrder")||this.hasInteractivePivotSort()}reRankByPivotGroupOrder(e,t,s){const r=new Map;for(let l=0,c=e.length;l<c;++l){const u=Tv(e[l]);r.has(u)||r.set(u,r.size)}const i=r.size,n=[];for(let l=0,c=t.length;l<c;++l){const u=t[l],d=s[u];d!=null&&n.push({id:u,order:l,rank:r.get(Tv(d))??i})}n.sort(E9);const o=n.length,a=new Array(o);for(let l=0;l<o;++l)a[l]=n[l].id;return a}},Tv=e=>{const t=e.colDef.pivotKeys;if(t!==void 0&&t.length>0)return t.join("");if(t!==void 0)return Av(e);let s="",r=e.originalParent;for(;r!=null;)r.isPadding()||(s=`${r.getGroupId()}\0${s}`),r=r.originalParent;return s!==""?s:Av(e)},Av=e=>`\0${e.colId}`,E9=(e,t)=>e.rank-t.rank||e.order-t.order;import{_clamp as D9,_shouldUpdateColVisibilityAfterGroup as L9,dispatchColumnVisibleEvent as k9}from"ag-grid-community";var _9=class extends wv{constructor(){super(...arguments),this.beanName="rowGroupColsSvc",this.eventName="columnRowGroupChanged",this.enableProp="rowGroup",this.indexProp="rowGroupIndex",this.initialEnableProp="initialRowGroup",this.initialIndexProp="initialRowGroupIndex",this.pendingVisibilityChanges=new Set}moveColumn(e,t,s){const r=this.columns,i=r.length;if(i===0||e<0||e>=i||(t=D9(t,0,i-1),e===t))return;const n=r[e],o=r.slice();o.splice(t,0,o.splice(e,1)[0]);const a=this.colModel;a.beginColUpdate();try{this.resetActiveCols(o),this.stageColChange(n),a.stageColChanges(s,"reorder")}finally{a.endColUpdate()}}onColActiveChanged(e,t,s){if(e.colKind!=="hierarchy"&&L9(this.gos,t)){const r=!t;e.visible!==r&&(e.setVisible(r,s),this.pendingVisibilityChanges.add(e))}}onColActiveChangesComplete(e){const t=this.pendingVisibilityChanges;if(t.size){const s=Array.from(t);t.clear(),k9(this.eventSvc,s,e)}}setActiveFlag(e,t){return e.rowGroupActive===t?!1:(e.rowGroupActive=t,!0)}onColumnsChanged(){const e=this.columns;for(let t=0,s=e.length;t<s;++t)e[t].rowGroupActiveIndex=t}};import{AgColumn as G9,BeanStub as O9,GROUP_AUTO_COLUMN_ID as Fc,_addColumnDefaultAndTypes as N9,_applyColumnState as B9,_convertColumnEventSourceType as V9,_getColumnStateFromColDef as H9,_getLegacyTooltipFieldValue as U9,_isCellTooltipConfigured as Pv,_isClientSideRowModel as z9,_isColumnsSortingCoupledToGroup as W9,_isGroupHideColumnsUntilExpanded as K9,_isGroupMultiAutoColumn as $9,_isGroupUseEntireRow as j9,_mergeDeep as Y9,_resolveGroupTooltipValue as q9}from"ag-grid-community";function Rv(e,t,s){let r=e;const i=r.level-t.level;if(i<=0||!s.get("groupHideOpenParents"))return!1;for(let o=0;o<i;o++){if(!(r.parent?.getFirstChild()===r))return!1;r=r.parent}return r===t}var Mv=e=>(typeof e=="object"&&e!==null?e.component:e)==="agGroupColumnFilter",Tc=e=>!!e&&(e.tooltipComponent!=null||e.tooltipComponentSelector!=null),Iv=e=>e?.group?e.rowGroupColumn?.colDef:void 0,Z9=class extends N0{constructor(){super(...arguments),this.beanName="autoColSvc",this.columns=[],this.modelEverUpdated=!1}postConstruct(){this.addManagedPropertyListener("autoGroupColumnDef",this.updateColumns.bind(this)),this.addManagedEventListeners({columnHeaderNameChanged:this.onHeaderNameChanged.bind(this)}),this.setupGroupHideColumnsUntilExpanded()}onHeaderNameChanged({column:e,source:t}){if(!e)return;const s=this.columns;for(let r=0,i=s.length;r<i;++r){const n=s[r];n.colDef.showRowGroup===e.getColId()&&n.setColDef(this.createAutoColDef(n.colId,e,r),null,t)}}setupGroupHideColumnsUntilExpanded(){const e=()=>{this.modelEverUpdated=!0,this.updateGroupColumnVisibility(!0)};this.addManagedEventListeners({modelUpdated:e}),this.addManagedPropertyListeners(["groupHideColumnsUntilExpanded","groupDisplayType","groupHideOpenParents"],e)}refreshCols(e){const t=this.beans,{colModel:s,gos:r,rowGroupColsSvc:i}=t,n=s.pivotMode,o=j9(r,n),a=n?r.get("pivotSuppressAutoColumn"):this.isSuppressAutoCol(),l=r.get("treeData"),c=i?.columns,d=!(c&&c.length>0||l)||a||o,h=this.columns;if(d)return h.length>0&&this.destroyColumns(),null;const p=$9(r),g=!l&&p;if(l&&p&&this.warn(182),X9(h,c,g)){for(let m=0,v=h.length;m<v;++m){const C=h[m],b=g?c[m]:void 0;C.setColDef(this.createAutoColDef(C.colId,b,m),null,e)}return h}const f=this.reconcileAutoCols(h,g?c:void 0,e);return this.columns=f,!this.modelEverUpdated&&z9(this.gos)&&this.updateGroupColumnVisibility(!1),f}updateColumns(e){const t=this.columns,s=t.length;if(s===0)return;const r=this.beans,i=V9(e.source),n=new Array(s),o=r.colModel;o.beginColUpdate();try{for(let a=0;a<s;++a)n[a]=this.updateOneAutoCol(t[a],a,i);B9(r,{state:n},i,!0)}finally{o.endColUpdate()}}destroy(){this.destroyColumns(),super.destroy()}destroyColumns(){const e=this.columns;this.columns=[];for(let t=0,s=e.length;t<s;++t){const r=e[t];r.isAlive()&&r.destroy()}}reconcileAutoCols(e,t,s){const r=new Map;for(let n=0,o=e.length;n<o;++n){const a=e[n];r.set(a.colId,a)}let i;if(t){const n=t.length;i=new Array(n);for(let o=0;o<n;++o)i[o]=this.reuseOrCreateAutoCol(r,t[o],o,s)}else i=[this.reuseOrCreateAutoCol(r,void 0,void 0,s)];for(const n of r.values())n.isAlive()&&n.destroy();return i}reuseOrCreateAutoCol(e,t,s,r){const i=Ev(t),n=e.get(i);return n!==void 0?(e.delete(i),n.setColDef(this.createAutoColDef(i,t,s),null,r),n):this.createOneAutoCol(i,t,s)}isSuppressAutoCol(){const e=this.gos;return e.get("groupDisplayType")==="custom"?!0:e.get("treeDataDisplayType")==="custom"}createOneAutoCol(e,t,s){const r=this.createAutoColDef(e,t,s),i=new G9(r,null,e,!0,"auto-group");return this.beans.context.createBean(i),i}updateOneAutoCol(e,t,s){const r=this.beans,i=e.colDef,n=typeof i.showRowGroup=="string"?i.showRowGroup:void 0,o=n!=null?r.colModel.getNonPivotCol(n):void 0,a=e.colId,l=this.createAutoColDef(a,o??void 0,t);return e.setColDef(l,null,s),H9(r,l,a)}createAutoColDef(e,t,s){let r=this.createBaseColDef(t);const i=this.gos.get("autoGroupColumnDef");Y9(r,i),r=N9(this.beans,r,e,!0),r.colId=e,i?.groupRowEditable==null&&(r.groupRowEditable=void 0),i?.groupRowValueSetter==null&&(r.groupRowValueSetter=void 0),this.gos.get("treeData")||!r.field&&!r.valueGetter&&!r.filterValueGetter&&!Mv(r.filter)&&(r.filter=!1),s&&s>0&&(r.headerCheckboxSelection=!1);const n=W9(this.gos),o=r.valueGetter||r.field!=null;return n&&!o&&(r.sortIndex=void 0,r.initialSort=void 0),t||this.applyDynamicSingleColumnTooltips(r,i),r}applyDynamicSingleColumnTooltips(e,t){const s=this.beans.rowGroupColsSvc?.columns??[],r=s.some(a=>Pv(a.colDef)),i=s.some(({colDef:a})=>Tc(a)),n=!!t&&Pv(t),o=Tc(t);!r&&!i&&!n&&!o||(e.tooltip=void 0,e.tooltipField=void 0,e.tooltipValueGetter=void 0,e.tooltipComponent=void 0,e.tooltipComponentParams=void 0,e.tooltipComponentSelector=void 0,(r||n)&&(e.tooltip=a=>this.resolveDynamicSingleColumnTooltip(a,t)),!(!i&&!o)&&(e.tooltipComponentSelector=a=>this.resolveDynamicSingleColumnTooltipComponent(a,t)))}resolveDynamicSingleColumnTooltip(e,t){const s=Iv(e.node),r=s??t;if(r)return q9(r,e,()=>{if(s)return{resolved:!0,value:e.value};const{tooltipField:i}=r;if(!i||!e.data)return{resolved:!1};const n=!this.gos.get("suppressFieldDotNotation")&&i.includes(".");return{resolved:!0,value:U9(e.data,i,n)}})}resolveDynamicSingleColumnTooltipComponent(e,t){const s=Iv(e.node)??t;if(Tc(s))return s.tooltipComponentSelector?s.tooltipComponentSelector(e):{component:s.tooltipComponent,params:s.tooltipComponentParams}}createBaseColDef(e){const t=this.gos.get("autoGroupColumnDef"),r={headerName:this.getLocaleTextFunc()("group","Group"),showRowGroup:e?.colId??!0};return t&&(t.cellRenderer||t.cellRendererSelector)||(r.cellRenderer="agGroupCellRenderer"),e&&(r.headerName=this.beans.colNames.getDisplayNameForColumn(e,"header")??void 0,r.headerValueGetter=e.colDef.headerValueGetter,r.headerTooltip=e.colDef.headerTooltip,r.headerTooltipValueGetter=e.colDef.headerTooltipValueGetter,r.tooltip=e.colDef.tooltip,r.tooltipField=e.colDef.tooltipField,r.tooltipValueGetter=e.colDef.tooltipValueGetter,r.tooltipComponent=e.colDef.tooltipComponent,r.tooltipComponentParams=e.colDef.tooltipComponentParams,r.tooltipComponentSelector=e.colDef.tooltipComponentSelector),r}getDeepestExpandedLevel(e,t){let s=-1;if(!e)return s;for(let r=0,i=e.length;r<i;++r){const n=e[r];if(!n.group||!n.expanded)continue;if(n.level>s&&(s=n.level),s>=t)return s;const o=this.getDeepestExpandedLevel(n.childrenAfterGroup,t);if(o>s&&(s=o),s>=t)return s}return s}updateGroupColumnVisibility(e){const t=this.columns;if(t.length===0)return;const{gos:s,visibleCols:r,rowModel:i,colModel:n}=this.beans,o=K9(s);let a=!1;n.beginColUpdate();try{if(!o)Lv(t)&&(a=!0);else if(t.length>1){const l=t.length-2,c=i?.rootNode?.childrenAfterGroup,u=this.getDeepestExpandedLevel(c,l);if(u>=l)Lv(t)&&(a=!0);else for(let d=0;d<t.length-1;d++)Dv(t[d+1],u>=d)&&(a=!0)}a&&e&&r.refresh("api",!1)}finally{n.endColUpdate()}}},Ev=e=>e?`${Fc}-${e.colId}`:Fc,X9=(e,t,s)=>{if(!s||!t)return e.length===1&&e[0].colId===Fc;const r=t.length;if(e.length!==r)return!1;for(let i=0;i<r;++i)if(e[i].colId!==Ev(t[i]))return!1;return!0},Dv=(e,t)=>t!==e.visible?(e.setVisible(t,"api"),!0):!1,Lv=e=>{let t=!1;for(let s=0,r=e.length;s<r;++s)Dv(e[s],!0)&&(t=!0);return t};import{BeanStub as J9}from"ag-grid-community";var Ac=null,kv=e=>{const t=Ac,s=new Uint32Array(1<<32-Math.clz32(e|63));return t&&s.set(t),Ac=s,s},Q9=(e,t,s,r)=>{const i=t-r,n=s-1;if(i===1){let c=0;for(;e[c].level===n;)++c;if(c<t-1){const u=e[c];e.copyWithin(c,c+1),e[t-1]=u}return e}if(r===1){let c=0;for(;e[c].level!==n;)++c;if(c>0){const u=e[c];e.copyWithin(1,0,c),e[0]=u}return e}const o=new Array(i);let a=0,l=0;for(let c=0;c<t;++c){const u=e[c];u.level===n?e[a++]=u:o[l++]=u}for(let c=0;c<i;++c)e[r+c]=o[c];return e},ez=(e,t)=>{let s=e[0].level+1,r=s,i=0,n=s,o=Ac;(!o||s>=o.length)&&(o=kv(s)),++o[s];for(let d=1;d<t;++d){const h=e[d].level+1;h>s?(s=h,s>=o.length&&(o=kv(s))):h<r&&(r=h),++o[h],i|=n-h,n=h}if(i>=0)return o.fill(0,r,s+1),e;const a=o[r],l=o[s];if(a+l===t)return o[r]=0,o[s]=0,Q9(e,t,s,l);let c=0;for(let d=s;d>=r;--d){const h=o[d];o[d]=c,c+=h}const u=new Array(t);for(let d=0;d<t;++d){const h=e[d];u[o[h.level+1]++]=h}return o.fill(0,r,s+1),u},_v=(e,t=e.length)=>{if(t===2){if(e[0].level<e[1].level){const s=e[0];e[0]=e[1],e[1]=s}return e}if(t>16)return ez(e,t);for(let s=1;s<t;s++){const r=e[s],i=r.level;let n=s-1;if(e[n].level<i){let o=s;do e[o]=e[n],o=n--;while(n>=0&&e[n].level<i);e[o]=r}}return e},tz=class{constructor(){this.kind="cells",this.rows=[],this.unsorted=!1,this.slots=new Map,this.bits=[],this.extraBits=null,this.colCount=0}addRow(e){let t=e;if(t==null)return;const s=this.slots;if(s.get(t)!==void 0){for(;t!=null&&s.get(t)>=0;)s.set(t,-1),t=t.parent;return}const r=this.rows;do s.set(t,-1),r.push(t),t=t.parent;while(t!=null&&!s.has(t));this.unsorted=!0}addCell(e,t){if(t==null){this.addRow(e);return}if(e==null)return;const s=this.slots,r=this.bits,i=s.get(t)??this.ensureCol(t);let n=s.get(e);if(n===void 0)n=this.ensureRow(e);else if(n<0)return;const o=i<32?r:this.extraBits[(i>>>5)-1],a=1<<(i&31),l=o[n];if((l&a)!==0)return;o[n]=l|a;let c=e.parent;for(;c!=null;){const u=s.get(c);if(u<0)break;const d=o[u];if((d&a)!==0)break;o[u]=d|a,c=c.parent}}hasRow(e){return this.slots.has(e)}getSortedRows(){if(!this.unsorted)return this.rows;this.unsorted=!1;const e=_v(this.rows);return this.rows=e,e}getSlot(e){return this.slots.get(e)??-1}hasCellBySlot(e,t){return e<0?!0:t<32?t>=0&&(this.bits[e]&1<<t)!==0:(this.extraBits[(t>>>5)-1][e]&1<<(t&31))!==0}ensureRow(e){const t=this.slots,s=this.rows,r=this.bits,i=this.extraBits;let n=r.push(0);const o=n-1;if(i!==null)for(let l=0,c=i.length;l<c;++l)i[l].push(0);t.set(e,o),s.push(e),this.unsorted=!0;let a=e.parent;for(;a!=null&&!t.has(a);){if(t.set(a,n),s.push(a),n=r.push(0),i!==null)for(let l=0,c=i.length;l<c;++l)i[l].push(0);a=a.parent}return o}ensureCol(e){const t=this.colCount++;if(this.slots.set(e,t),t>=32){const s=(t>>>5)-1;let r=this.extraBits;r===null&&(r=[],this.extraBits=r),s>=r.length&&r.push(new Array(this.bits.length).fill(0))}return t}},Gv=class{constructor(){this.kind="rows",this.rows=[],this.unsorted=!1,this.rowSet=new Set}addRow(e){let t=e;if(t==null)return;const s=this.rowSet;if(s.has(t))return;const r=this.rows;do s.add(t),r.push(t),t=t.parent;while(t!=null&&!s.has(t));this.unsorted=!0}addCell(e,t){this.addRow(e)}hasRow(e){return this.rowSet.has(e)}getSortedRows(){if(!this.unsorted)return this.rows;this.unsorted=!1;const e=_v(this.rows);return this.rows=e,e}},sz=class extends B0{constructor(){super(...arguments),this.beanName="changedPathFactory"}newPath(e){return e?new tz:new Gv}ensureRowsPath(e){let t=e.changedPath;if(!t&&e.changedRowNodes&&!e.newData){const s=this.beans.rowModel;s.hierarchical&&(t=new Gv,e.changedPath=t,t.addRow(s.rootNode))}return t}};import{_exists as rz}from"ag-stack";import{_removeAriaExpanded as iz,_setAriaExpanded as nz}from"ag-stack";import{BeanStub as oz,_addGridCommonParams as Ov,_createGlobalRowEvent as az}from"ag-grid-community";var Nv=class extends V0{addExpandedCss(e,t){t.isExpandable()&&e.push("ag-row-group",t.expanded?"ag-row-group-expanded":"ag-row-group-contracted")}getRowExpandedListeners(e){const{rowNode:t}=e,s=this.updateExpandedCss.bind(this,e,t);return{expandedChanged:s,hasChildrenChanged:s,masterChanged:s}}setExpanded(e,t,s,r){if(e.expanded===t)return;!t&&e.sticky&&this.beans.ctrlsSvc.getScrollFeature().setVerticalScrollPosition(e.rowTop-e.stickyRowTop),e._expanded=t,e.dispatchRowEvent("expandedChanged");const i={...az(e,this.gos,"rowGroupOpened"),expanded:t,event:s??null};this.dispatchExpandedEvent(i,r)}defaultExpanded(e){const s=this.beans.gos,r=e.level??0;if(e.master&&!e.group){const o=s.get("isMasterOpenByDefault");if(o){const l=Ov(s,{rowNode:e,data:e.data,level:r});return!!o(l)}const a=s.get("masterDefaultExpanded")??s.get("groupDefaultExpanded");return a===-1||r<a}const i=e.group&&s.get("isGroupOpenByDefault");if(!i){const o=s.get("groupDefaultExpanded");return o===-1||r<o}const n=Ov(s,{rowNode:e,field:e.field,key:e.key,level:r,rowGroupColumn:e.rowGroupColumn});return!!i(n)}isExpandable(e){return this.checkExpandable(e,e.hasChildren())}checkExpandable(e,t){return e.footer?!1:this.beans.colModel.pivotMode?t&&!e.leafGroup:t||e.master}updateExpandedCss(e,t){const s=t.isExpandable(),r=!!t.expanded,i=e.getGui();if(!i)return;const n=i.rowComp;n.toggleCss("ag-row-group",s),n.toggleCss("ag-row-group-expanded",s&&r),n.toggleCss("ag-row-group-contracted",s&&!r),s?nz(i.element,r):iz(i.element)}dispatchStateUpdatedEvent(){this.eventSvc.dispatchEvent({type:"rowExpansionStateChanged"})}},lz=class extends Nv{constructor(){super(...arguments),this.beanName="expansionSvc",this.events=null,this.dispatchExpandedDebounced=null}destroy(){super.destroy(),this.events=null,this.dispatchExpandedDebounced=null}setExpansionState(e){const t=new Set(e.expandedRowGroupIds);this.beans.rowModel.forEachNode(s=>{const r=s.id;r&&(s._expanded=t.has(r))}),this.onGroupExpandedOrCollapsed()}getInternalExpansionState(e=!1){const t=[],s=[];return this.beans.rowModel.forEachNode(r=>{const i=r.id;i&&(r.expanded?t.push(i):e&&r.isExpandable()&&s.push(i))}),{expandedRowGroupIds:t,collapsedRowGroupIds:s}}getExpansionState(){return this.getInternalExpansionState()}isExpanded(e){if(e.footer)return!!e._expanded;if(!this.checkExpandable(e,!!e.group))return!1;let t=e._expanded;return t===null&&(t=this.defaultExpanded(e)??!1,e._expanded=t),!!t}resetExpansion(){const{rowModel:e}=this.beans;e.forEachNode(t=>{!t.group&&!t.master||(t._expanded=null)}),this.onGroupExpandedOrCollapsed()}expandAll(e){const{gos:t,rowModel:s,colModel:r,eventSvc:i}=this.beans,n=t.get("treeData"),o=r.isPivotActive(),a=c=>{if(c)for(const u of c){const d=()=>{u._expanded=e,a(u.childrenAfterGroup)};if(u.master){d();continue}if(n){rz(u.childrenAfterGroup)&&d();continue}if(o){!u.leafGroup&&d();continue}u.group&&d()}},l=s.rootNode;l&&a(l.childrenAfterGroup),this.onGroupExpandedOrCollapsed(),i.dispatchEvent({type:"expandOrCollapseAll",source:e?"expandAll":"collapseAll"})}onGroupExpandedOrCollapsed(){this.dispatchStateUpdatedEvent(),this.beans.rowModel.reMapRows()}setDetailsExpansionState(e){const t=this.getInternalExpansionState(!0),s=t.collapsedRowGroupIds.length===0;if(t.expandedRowGroupIds.length===0!==s)return s?e.expandAll():e.collapseAll()}dispatchExpandedEvent(e,t){if((this.events??(this.events=[])).push(e),t){this.dispatchExpandedEvents();return}let s=this.dispatchExpandedDebounced;if(!s){if(!this.isAlive())return;s=this.debounce(()=>this.dispatchExpandedEvents()),this.dispatchExpandedDebounced=s}s()}dispatchExpandedEvents(){const{eventSvc:e,rowRenderer:t}=this.beans,s=this.events,r=s?.length;if(!r)return;this.events=null;const i=new Array(r);for(let n=0;n<r;++n)i[n]=s[n].node,e.dispatchEvent(s[n]);this.dispatchStateUpdatedEvent(),t.refreshCells({rowNodes:i})}debounce(e){const t=this.beans.animationFrameSvc;if(!t)return()=>window.setTimeout(e,0);let s=!1;return()=>{if(!t.active){window.setTimeout(e,0);return}s||(s=!0,t.addDestroyTask(()=>{s=!1,e()}))}}};import{BeanStub as cz,_getGrandTotalPinnedFloat as uz}from"ag-grid-community";import{_getGrandTotalRow as dz,_getGroupTotalRowCallback as hz,_isGroupMultiAutoColumn as pz}from"ag-grid-community";function Bv(e){let t=e.get("groupHideParentOfSingleChild");return t||(t=e.get("groupRemoveSingleChildren"),!t&&e.get("groupRemoveLowestSingleChildren")&&(t="leafGroupsOnly")),{groupHideParentOfSingleChild:t,isGroupMultiAutoColumn:pz(e),hideOpenParents:e.get("groupHideOpenParents"),grandTotalRow:dz(e),groupTotalRow:hz(e)}}function Vv(e,t,s){return e.groupHideParentOfSingleChild===!0&&s&&t.childrenAfterGroup.length===1}function Hv(e,t,s){return e.groupHideParentOfSingleChild==="leafGroupsOnly"&&s&&t.leafGroup&&t.childrenAfterGroup.length===1}function Uv(e,t,s,r,i,n){return r&&!s||i||n?!1:!e.hideOpenParents||t.master||t.level===-1?!0:!(!(r&&t.leafGroup)&&t.expanded)}var gz=class extends H0{constructor(){super(...arguments),this.beanName="flattenStage",this.step="map",this.refreshProps=["alwaysShowGrandTotalRow","groupHideParentOfSingleChild","groupRemoveSingleChildren","groupRemoveLowestSingleChildren","groupTotalRow","masterDetail"]}execute(){const{beans:e,gos:t}=this,s=[],r=e.rowModel.rootNode;if(!r)return s;const i=e.colModel.pivotMode,n=i&&r.leafGroup,o=n&&r.aggData,a=o?[r]:r.childrenAfterSort,l=Bv(t);this.recursivelyAddToRowsToDisplay(l,a,s,i,0);const c=l.grandTotalRow,u=c&&!o&&(s.length>0||!n&&t.get("alwaysShowGrandTotalRow")&&e.rowModel.rowCountReady);let d;return u?(d=Lt(r,e),uz(c)||this.addRowNodeToRowsToDisplay(l,d,s,0,c==="top")):(o||!c)&&to(r),e.pinnedRowModel?.setGrandTotalNode(d),s}recursivelyAddToRowsToDisplay(e,t,s,r,i){if(!t?.length)return;const n=this.beans.masterDetailSvc;for(let o=0;o<t.length;o++){const a=t[o],l=a.hasChildren(),c=Vv(e,a,l),u=Hv(e,a,l);if(Uv(e,a,l,r,c,u)&&this.addRowNodeToRowsToDisplay(e,a,s,i),!(r&&a.leafGroup))if(l){const h=c||u;if(a.expanded||h){const p=e.groupTotalRow({node:a});p||to(a);const g=h?i:i+1;let f;p==="top"&&(f=Lt(a,this.beans),this.addRowNodeToRowsToDisplay(e,f,s,g));const m=n?.getDetail(a);m&&this.addRowNodeToRowsToDisplay(e,m,s,i),this.recursivelyAddToRowsToDisplay(e,a.childrenAfterSort,s,r,g),p==="bottom"&&(f=Lt(a,this.beans),this.addRowNodeToRowsToDisplay(e,f,s,g))}}else{const h=n?.getDetail(a);h&&this.addRowNodeToRowsToDisplay(e,h,s,i)}}}addRowNodeToRowsToDisplay(e,t,s,r,i){i?s.unshift(t):s.push(t),t.setUiLevel(e.isGroupMultiAutoColumn?0:r)}};import{BeanStub as fz,_ChangedRowNodes as zv,_csrmFirstLeaf as mz,_csrmReorderAllLeafs as vz,_getCellByPosition as Cz,_isClientSideRowModel as bz,_prevOrNextDisplayedRow as Sz}from"ag-grid-community";var yz=class extends U0{constructor(){super(...arguments),this.beanName="groupEditSvc",this.pendingEditRefresh=null,this.dropGroupTarget=null,this.dropGroupTimer=null,this.dropGroupThrottled=!1,this.draggingGroups=null}postConstruct(){bz(this.gos)&&this.addManagedListeners(this.eventSvc,{cellValueChanged:e=>this.onCsrmCellChange(e),batchEditingStopped:()=>this.flushGroupEdits()})}destroy(){this.stopDragging(!0),super.destroy()}isGroupingDrop(e){return!e.rowDragManaged||!e.sameGrid||!this.gos.get("refreshAfterGroupEdit")?!1:!!this.beans.rowGroupColsSvc?.columns?.length&&!this.beans.colModel.pivotMode}initDraggingGroups(e){const t=new Map,s=r=>{const i=r.childrenAfterGroup;if(i){if(t.has(r))return;const n=i.slice();t.set(r,n);for(const o of n)s(o)}};for(const r of e.rows)r.group&&s(r);this.draggingGroups=t}canSetParent(e){return e.sameGrid?this.beans.groupStage?.treeData?!0:e.rowDragManaged&&!this.gos.get("refreshAfterGroupEdit")?!1:!!this.beans.rowGroupColsSvc?.columns?.length:!1}canDropRow(e,t){if(this.beans.groupStage?.treeData)return!wz(e,t.newParent);const{position:s,target:r,newParent:i,rootNode:n}=t,o=e.parent;if(e.group&&(Kv(e,r)||Kv(e,i)))return!1;if(s==="inside")return!0;if(i&&i!==o)return i!==n||o===n;const a=i??r?.parent??n;if(a!==o)return!1;const l=e.group?e.level:o.level??-1;let c=-1;return r?c=r.group?r.level:r.parent?.level??-1:a&&(c=a.level),!(l>=0&&c>=0&&c!==l)}fixRowsDrop(e,t,s,r){const i=!!this.beans.groupStage?.treeData;if(e.treeData=i,!(!!this.beans.rowGroupColsSvc?.columns?.length||this.gos.get("pivotMode"))&&!i)return;!this.draggingGroups&&this.isGroupingDrop(e)&&!e.suppressMoveWhenRowDragging&&this.initDraggingGroups(e);let o=e.target,a=null,l=!1;const c=e.rootNode,u=this.beans.rowModel,d=this.canStartGroup(o,i);this.updateDropTarget(e,s,d);const h=this.beans.pageBounds?.getLastRow?.()??u.getRowCount()-1;if(t&&(!o||r>=.5&&o.rowIndex===h?a=c:e.moved&&o&&this.dropGroupThrottled&&this.shouldDropTargetBeParent(e)&&(a=o),a??(a=o?.parent??c)),!s&&o&&d&&!(o.group&&o.expanded)&&this.startDropGroupDelay(o),a){if(o&&a===o&&a!==c){const p=a.expanded?Sz(u,1,o):null;p?.parent===a?(o=p,r=-.5):l=!0}if(o&&!l){let p=o;for(;p&&p!==c&&p!==a;)o=p,p=p.parent}}e.target=o,e.newParent=a,e.yDelta=r,e.inside=l}clearNewSameParent(e,t){const s=e.newParent;s&&(!t||xz(e.rows,s))&&(e.newParent=null)}updateDropTarget(e,t,s){const r=s?e.target:null;this.dropGroupTarget&&this.dropGroupTarget!==r&&this.resetDragGroup(),r?.childrenAfterSort?.length&&(t&&this.dropGroupThrottled&&!r.expanded&&r.isExpandable?.()&&r.setExpanded(!0,void 0,!0),this.canDropInTarget(r,e)&&(this.dropGroupThrottled=!0,this.dropGroupTarget=r))}canDropInTarget(e,t){if(e.expanded)return!0;if(!e.group)return!1;if(t.pointerPos==="inside")return!0;if(t.treeData)return!1;const s=t.rows,r=e.level;for(let i=0,n=s.length;i<n;++i){const o=s[i];if(o!==e&&o.group&&o.level!==r)return!1}return!0}startDropGroupDelay(e){if(this.dropGroupTarget&&this.dropGroupTarget!==e&&this.resetDragGroup(),this.dropGroupTarget=e,this.dropGroupTimer!==null)return;const t=this.gos.get("rowDragInsertDelay");this.dropGroupTimer=window.setTimeout(()=>{this.dropGroupTimer=null,this.dropGroupThrottled=!0,this.beans.dragAndDrop?.nudge()},t)}resetDragGroup(){this.dropGroupTimer!==null&&(window.clearTimeout(this.dropGroupTimer),this.dropGroupTimer=null),this.dropGroupTarget=null,this.dropGroupThrottled=!1}stopDragging(e){e&&(this.draggingGroups=null),this.resetDragGroup()}shouldDropTargetBeParent({target:e,rows:t,pointerPos:s,treeData:r}){if(!e||s==="none")return!1;if(s==="inside"||!r&&e.group&&!e.expanded)return!0;if(s==="above")return!1;const i=this.beans.rowModel;let o=e.rowIndex+1,a;do a=i.getRow(o++);while(a?.footer);const l=this.draggingGroups?.get(e)??e.childrenAfterGroup;if(a?.parent===e&&l?.length){const c=new Set(t);for(let u=0,d=l.length;u<d;++u){const h=l[u];if(h.rowIndex!==null&&!c.has(h))return!0}}return!1}dropGroupEdit(e){const{beans:t}=this,s=e.position,r=e.target??null,i=e.rootNode,n=e.newParent??r?.parent??i,o=t.focusSvc,a=o.getFocusedCell(),l=a&&Cz(t,a),c=new Set,u=new zv,d=u.updates;let h;const p=C=>{c.has(C)||(c.add(C),h??(h=this.newGroupValues(n)),this.setRowGroup(C,h)&&d.add(C))},g=C=>{const b=this.draggingGroups?.get(C)??C.childrenAfterGroup,y=b?.length;if(y)for(let S=0;S<y;++S){const w=b[S];w.sourceRowIndex>=0?p(w):g(w)}};for(const C of e.rows)if(C.group)g(C);else{const b=C.sourceRowIndex>=0&&!C.destroyed?C:this.csrmFirstLeaf(C);b&&p(b)}const f=s==="inside"?"above":s,m=s==="inside"?this.findFirstLeafForParent(n,c)??r:r;let v=!1;if(c.size&&f!=="none"&&(v=vz(i._leafs,c,m,f==="above")),!d.size&&!v)return!1;u.reordered=v;for(const C of c)u.updates.add(C);return this.csrmRefresh(u),l?l.focusCell():o.clearFocusedCell(),!0}canStartGroup(e,t){return!e||e.level<0||e.footer||e.detail?!1:e.group?!0:t}flushGroupEdits(){const e=this.pendingEditRefresh;e&&(this.pendingEditRefresh=null,this.csrmRefresh(e))}csrmRefresh(e){const t=this.beans.rowModel;t.rootNode&&t.refreshModel({step:"group",keepRenderedRows:!0,animate:!this.gos.get("suppressAnimationFrame"),changedRowNodes:e})}newGroupValues(e){const t=this.beans.rowGroupColsSvc?.columns??[],s=new Array(t.length);let r=-1,i=e;for(;i&&i.level>=0;){const n=t[i.level];if(n){const o=n.colId,a=i.level;s[a]=i.groupData?.[o]??i.key??void 0,a>r&&(r=a)}i=i.parent}return{values:s,columns:t,maxLevel:r}}setRowGroup(e,{values:t,columns:s,maxLevel:r}){if(r<0)return!1;const{valueSvc:i,changeDetectionSvc:n}=this.beans;let o=!1;n?.beginDeferred();try{for(let a=0;a<s.length;++a){const l=s[a];if(!l||a>r)continue;const c=t[a],u=i.getValueFromData(l,e);if(u===c||u==null&&c==null)continue;let d=c;const h=i.parseValue(l,e,c,u);h!==void 0&&(d=h),e.setDataValue(l,d,"rowDrag")&&(o=!0)}}finally{n?.endDeferred()}return o}onCsrmCellChange(e){const{column:t,node:s,source:r}=e;if(!this.gos.get("refreshAfterGroupEdit")||r==="rowDrag"||!t?.isRowGroupActive()||s.group||!s.data)return;if(this.beans.editSvc?.isBatchEditing()){let n=this.pendingEditRefresh;n||(n=Wv(),this.pendingEditRefresh=n),n.updates.add(s)}else{const n=Wv();n.updates.add(s),this.csrmRefresh(n)}}csrmFirstLeaf(e){if(!e)return null;const t=this.draggingGroups;let s=t?.get(e)??e.childrenAfterGroup;for(;s?.length;){const r=s[0];if(r.sourceRowIndex>=0)return r.destroyed?this.firstAliveChildLeaf(r):r;s=t?.get(r)??r.childrenAfterGroup}return mz(e)}firstAliveChildLeaf(e){const t=this.draggingGroups?.get(e)??e.childrenAfterGroup;if(t){for(const s of t)if(s.sourceRowIndex>=0&&!s.destroyed)return s}return null}findFirstLeafForParent(e,t){if(!e)return null;const s=this.draggingGroups?.get(e)??e?.childrenAfterGroup;if(!s)return null;for(let r=0,i=s.length;r<i;++r){const n=s[r];if(n.sourceRowIndex>=0&&!t.has(n))return n;const o=this.findFirstLeafForParent(n,t);if(o!==null)return o}return null}},Wv=()=>{const e=new zv;return e.reordered=!0,e},Kv=(e,t)=>{if(!e||!t)return!1;let s=t;for(;s;){if(s===e)return!0;s=s.parent}return!1},wz=(e,t)=>{if(!t||e.parent===t)return!1;let s=t;const r=e.id;for(;s;){if(s===e||r!=null&&s.id===r)return!0;s=s.parent}return!1},xz=(e,t)=>{for(let s=0,r=e.length;s<r;++s)if(e[s].parent!==t)return!1;return!0};import{BeanStub as Fz,_forEachChangedGroupDepthFirst as $v}from"ag-grid-community";var Pc=e=>{const t=e.sibling;t&&(t.childrenAfterFilter=e.childrenAfterFilter)},Tz=e=>{e.childrenAfterFilter=e.childrenAfterGroup,Pc(e)},jv=(e,t)=>e.childrenAfterFilter&&e.childrenAfterFilter.length>0?!0:!!(e.data&&t.doesRowPassFilter(e)),Yv=(e,t,s)=>{const r=e.length;t??(t=e);const i=t.length;let n=0;for(let o=0;o<r;++o){const a=e[o];if(jv(a,s)){if(n>=i||t[n]!==a)return qv(e,r,o,t,n,s);++n}else if(n<i)return qv(e,r,o,t,n,s)}return n===i?t:e},qv=(e,t,s,r,i,n)=>{const o=i>0?r.slice(0,i):[];for(;s<t;){const a=e[s++];jv(a,n)&&o.push(a)}return o},Az=class extends z0{constructor(){super(...arguments),this.beanName="groupFilterStage",this.step="filter",this.refreshProps=["excludeChildrenWhenTreeDataFiltering"]}wireBeans(e){this.filterManager=e.filterManager}execute(e){const t=this.filterManager;t?.isChildFilterPresent()?this.doingTreeDataFiltering()?this.treeDataFilter(t):this.filterActive(t,e):$v(this.beans.rowModel.rootNode,!0,e,Tz)}filterActive(e,t){const s=r=>{const i=r.childrenAfterGroup;i?r.childrenAfterFilter=Yv(i,r.childrenAfterFilter,e):r.childrenAfterFilter=i,Pc(r)};$v(this.beans.rowModel.rootNode,!0,t,s)}treeDataFilter(e){const t=(r,i)=>{const n=r.childrenAfterGroup;n&&!i?r.childrenAfterFilter=Yv(n,r.childrenAfterFilter,e):r.childrenAfterFilter=n,Pc(r)},s=(r,i)=>{const n=r.childrenAfterGroup;if(n)for(let o=0,a=n.length;o<a;++o){const l=n[o],c=i||e.doesRowPassFilter(l);l.childrenAfterGroup?s(l,c):t(l,c)}t(r,i)};s(this.beans.rowModel.rootNode,!1)}doingTreeDataFiltering(){return!!this.beans.groupStage?.treeData&&!this.gos.get("excludeChildrenWhenTreeDataFiltering")}};import{_reuseArrayIfEqual as Pz}from"ag-stack";import{BeanStub as Rz,_doDeltaSort as Mz,_forEachChangedGroupDepthFirst as Iz,_updateRowNodeAfterSort as Ez}from"ag-grid-community";var Dz=class extends W0{constructor(){super(...arguments),this.beanName="groupSortStage",this.step="sort",this.refreshProps=["postSortRows","groupDisplayType","accentedSort","groupMaintainOrder"]}execute(e,t){const{gos:s,colModel:r,groupStage:i,rowGroupColsSvc:n,rowModel:o,rowNodeSorter:a,rowRenderer:l,sortSvc:c,showRowGroupCols:u}=this.beans,d=c?.getSortOptions()??[],h=d.length>0,p=s.getCallback("postSortRows"),g=h&&!p&&s.get("deltaSort")&&t,f=n?.columns,m=h&&f?.length&&!i?.treeData&&s.get("groupMaintainOrder")?Lz(d,f):null,v=!m&&h?d:void 0,C=r.pivotMode;let b=!1;function y(S){const w=C&&S.leafGroup;let F;w||(F=m?m[S.level+1]:v);const T=S.childrenAfterSort,x=S.childrenAfterAggFilter,P=T?.[0];let L;F?g?L=Mz(a,S,g,e,F):L=a.doFullSortInPlace(x?.slice()??[],F):L=Pz(T,x),S.childrenAfterSort=L,Ez(S),p?.({nodes:L}),b||(b=P!==L[0])}if(Iz(o.rootNode,!0,e,y),b&&s.get("groupHideOpenParents")){const S=u?.columns;S?.length&&l.refreshCells({columns:S,force:!0})}}},Lz=(e,t)=>{const s=e.length,r=t.length,i=r,n=new Map;for(let a=0;a<r;++a){const l=t[a];n.set(l,a),n.set(l.colId,a)}const o=new Array(r+1);for(let a=0;a<s;++a){const l=e[a],c=l.column,u=c.colDef,d=u.showRowGroup,h=u.field!=null||u.valueGetter!=null||u.comparator!=null;if(d===!0){for(let m=0;m<r;++m)(o[m]??(o[m]=[])).push(l);h&&(o[i]??(o[i]=[])).push(l);continue}const p=typeof d=="string",g=p?d:c,f=n.get(g);f!==void 0?((o[f]??(o[f]=[])).push(l),p&&h&&(o[i]??(o[i]=[])).push(l)):(!p||h)&&(o[i]??(o[i]=[])).push(l)}return o};import{BeanStub as kz}from"ag-grid-community";var _z=class extends K0{constructor(){super(...arguments),this.beanName="groupStage",this.step="group",this.refreshProps=["groupAllowUnbalanced","groupDefaultExpanded","groupDisplayType","groupHideOpenParents","initialGroupOrderComparator","treeData","treeDataChildrenField","treeDataParentIdField"],this.treeData=!1,this.grouping=!1,this.gosTreeData=!1,this.pivotMode=!1,this.hasTreeData=!1,this.hasRowGrouping=!1,this.needReset=!1,this.nested=!1,this.strategy=void 0,this.strategyType=void 0,this.columnsInvalidated=!1}postConstruct(){const e=this.gos;this.hasRowGrouping=e.isModuleRegistered("RowGrouping"),e.isModuleRegistered("TreeData")&&(this.hasTreeData=!0,this.gosTreeData=e.get("treeData")),this.addManagedEventListeners({showRowGroupColsSetChanged:()=>this.strategy?.onShowRowGroupColsSetChanged()})}invalidateGroupCols(){this.columnsInvalidated=!0,this.strategy?.invalidateGroupCols?.()}destroy(){this.strategy=this.destroyBean(this.strategy),super.destroy()}getNonLeaf(e){return this.strategy?.nonLeafsById?.get(e)}getNestedDataGetter(){return this.getStrategy()?.nestedDataGetter}onPropChange(e){const t=this.gos,s=this.strategy?.nestedDataGetter;return e.has("treeData")&&(this.gosTreeData=t.get("treeData")&&this.hasTreeData,this.columnsInvalidated=!0),this.strategy?.onPropChange?.(e),this.getNestedDataGetter()!==s}extractData(){const e=this.beans.rowModel.rootNode,t=this.nested?e?.childrenAfterGroup:e?._leafs;if(!t)return this.gos.get("rowData")??[];const s=t.length,r=new Array(s);let i=0;for(let n=0;n<s;++n){const o=t[n].data;o!=null&&(r[i++]=o)}return r.length=i,r}execute(e){const t=this.beans,s=t.rowModel,r=s.rootNode;if(!r)return!1;const i=this.getStrategy(),n=!!i?.nestedDataGetter,o=this.needReset;if(this.nested=n,o&&(this.needReset=!1,t.rowDragSvc?.cancelRowDrag(),e.animate=!1,Oz(r,!n,t)),!i){s.hierarchical=!1;return}return s.hierarchical=!0,t.changedPathFactory?.ensureRowsPath(e,r),i.execute(r,e)||o}loadLeafs(e){return e.footer?Gz(e):so(e)}loadGroupData(e){const t=this.getStrategy();return t?t.loadGroupData(e):(e._groupData=null,null)}clearNonLeafs(){this.strategy?.clearNonLeafs()}getWantedStrategyType(){if(this.isAlive()){if(this.gosTreeData)return"tree";if(this.hasRowGrouping&&(this.beans.rowGroupColsSvc?.columns?.length||this.pivotMode))return"group"}return"none"}getStrategy(){let e=this.strategy;const t=this.beans.colModel.pivotMode;if(t!==this.pivotMode&&(this.pivotMode=t,this.columnsInvalidated=!0),e!==void 0&&!this.columnsInvalidated&&this.isAlive())return e;this.columnsInvalidated=!1;const s=this.getWantedStrategyType();if(s===this.strategyType)return e!==void 0?e:(this.strategy=null,null);if(e&&(this.strategy=this.destroyBean(e),this.needReset=!0),this.strategyType=s,this.treeData=s==="tree",this.grouping=s==="group",s==="none")return this.strategy=null,null;const r=s==="tree"?"treeGroupStrategy":"groupStrategy";return e=this.beans.registry.createDynamicBean(r,!1)??null,this.strategy=e&&this.createBean(e),e}},Gz=e=>{const t=e.sibling;if(!t)return null;const s=t._leafs;return s!==void 0?s:so(t)},so=e=>{const t=e.childrenAfterGroup,s=t?.length;if(e._leafs=null,!s)return null;let r;const i=s===1?t[0]:null;if(i?.group&&i.sourceRowIndex<0)r=i._leafs,r===void 0&&(r=so(i));else if(e.leafGroup)r=t;else{r=[];for(let n=0;n<s;++n){const o=t[n];if(o.sourceRowIndex>=0&&r.push(o),!o.group)continue;let a=o._leafs;if(a===void 0&&(a=so(o)),a)for(let l=0,c=a.length;l<c;++l)r.push(a[l])}}return e._leafs=r,r},Oz=(e,t,s)=>{const r=e._leafs,i=e.sibling;e.treeNodeFlags=0,e.childrenAfterGroup=r,e.childrenMapped=null,e._groupData=void 0,e.aggData=null,i&&(i.childrenAfterGroup=e.childrenAfterGroup,i.childrenAfterAggFilter=e.childrenAfterAggFilter,i.childrenAfterFilter=e.childrenAfterFilter,i.childrenAfterSort=e.childrenAfterSort,i.childrenMapped=null,i._groupData=void 0,i.aggData=null);for(let n=0,o=r.length??0;n<o;++n){const a=r[n],l=a.sibling;a._leafs=void 0,Zv(a),l&&Zv(l),a.parent=e,t&&(a.treeParent=null),ml(a,s,!1)}e.updateHasChildren()},Zv=e=>{e.key=null,e.treeNodeFlags=0,e.allChildrenCount=null,e.childrenAfterGroup=null,e.childrenAfterAggFilter=null,e.childrenAfterFilter=null,e.childrenAfterSort=null,e.childrenMapped=null,e.level=0,e._groupData=void 0};import{RefPlaceholder as ci,_setAriaRole as Nz,_setDisplayed as Xv,_setVisible as Bz}from"ag-stack";import{Component as Vz}from"ag-grid-community";import{_isElementInEventPath as Jv,_removeAriaExpanded as Hz,_setAriaExpanded as Uz}from"ag-stack";import{BeanStub as zz,KeyCode as Wz,_createIconNoSpan as Kz,_getCellRendererDetails as Qv,_getCheckboxLocation as $z,_getCheckboxes as jz,_getInnerCellRendererDetails as ro,_isRowSelection as Yz,_isStopPropagationForAgGrid as eC,_stopPropagationForAgGrid as qz}from"ag-grid-community";var tC=class extends $0{constructor(){super(...arguments),this.indentClass=null}init(e,t,s,r,i,n,o){this.params=o,this.eGui=t,this.eCheckbox=s,this.eExpanded=r,this.eContracted=i,this.comp=e,this.compClass=n;const{node:a,column:l,colDef:c}=o;if(this.node=a,this.displayedNode=a,!this.isEmbeddedRowMismatch()){if((!c||c.showRowGroup===!0)&&e.toggleCss("ag-group-cell-all-levels",!0),a.footer){this.initFooterCell();return}if(!l){this.initFullWidthCell();return}this.displayedNode=this.beans.showRowGroupColValueSvc?.getDisplayedNode(a,l)??this.node,this.setupExpand(),this.setupCheckbox(),this.addGroupValue(),this.setupIndent()}}initFooterCell(){const{node:e}=this.params;this.addGroupValue(),this.setupIndent(),e.level===-1||this.comp.toggleCss("ag-row-group-leaf-indent",!0)}initFullWidthCell(){const e=()=>{const{rowDragSvc:t}=this.beans;if(!this.params.rowDrag||!t)return;const s=t.createRowDragComp(()=>this.params.value,this.params.node);this.createManagedBean(s),this.eGui.insertAdjacentElement("afterbegin",s.getGui())};this.setupExpand(),e(),this.setupCheckbox(),this.addGroupValue(),this.setupIndent()}getCellAriaRole(){const e=this.params.colDef?.cellAriaRole,t=this.params.column?.getColDef().cellAriaRole;return e||t||"gridcell"}isEmbeddedRowMismatch(){if(!this.params.fullWidth||!this.gos.get("embedFullWidthRows"))return!1;const{visibleCols:e}=this.beans,t=this.params.pinned==="left",s=this.params.pinned==="right",r=!t&&!s;return this.gos.get("enableRtl")?e.rightCols.length>0?!s:!r:e.leftCols.length>0?!t:!r}addGroupValue(){const{params:{value:e,valueFormatted:t}}=this,s=this.getInnerCompDetails();this.comp.setInnerRenderer(s,t??e??null)}setupExpand(){const{colModel:e}=this.beans,{eGridCell:t,suppressDoubleClickExpand:s}=this.params,r=(l,c)=>{const u=Kz(l,this.beans,null);u&&(c.appendChild(u),this.addDestroyFunc(()=>u.remove()))};r("groupExpanded",this.eExpanded),r("groupContracted",this.eContracted);const i=this.comp,n=()=>{if(!this.isExpandable())return;const c=!!this.displayedNode.expanded;i.setExpandedDisplayed(c),i.setContractedDisplayed(!c),Uz(t,c)},o=()=>{const l=this.isExpandable();i.toggleCss("ag-cell-expandable",l),i.toggleCss("ag-row-group",l);const c=!l&&e.pivotMode;i.toggleCss("ag-pivot-leaf-group",c);const u=!e.pivotMode&&(!this.displayedNode.footer||this.displayedNode.level!==-1);i.toggleCss("ag-row-group-leaf-indent",!l&&u);const d=this.getChildCount(),h=d>0?`(${d})`:"";i.setChildCount(h),l?n():(i.setExpandedDisplayed(!1),i.setContractedDisplayed(!1),Hz(t))};!s&&!this.isGroupCellEditable(this.displayedNode)&&this.addManagedListeners(t,{dblclick:this.onCellDblClicked.bind(this)}),this.addManagedListeners(this.eExpanded,{click:this.onExpandClicked.bind(this)}),this.addManagedListeners(this.eContracted,{click:this.onExpandClicked.bind(this)}),this.addManagedListeners(t,{keydown:this.onKeyDown.bind(this)}),this.addManagedListeners(this.displayedNode,{allChildrenCountChanged:o,masterChanged:o,groupChanged:o,hasChildrenChanged:o,expandedChanged:n}),o()}getInnerCompDetails(){const{userCompFactory:e,findSvc:t}=this.beans,s=this.params;if(s.fullWidth){const l=this.gos.get("groupRowRendererParams"),c=ro(e,l,s);return c||(t?.isMatch(s.node,null)?ro(e,{...l,innerRenderer:"agFindCellRenderer"},s):void 0)}const r=l=>l&&l.componentClass==this.compClass,i=ro(e,s,s);if(i&&!r(i))return i;const{displayedNode:{rowGroupColumn:n}}=this,o=n?.colDef,a=n&&s.column?.isRowGroupDisplayed(n.getId());if(o&&a){const l=Qv(e,o,s);if(l)if(r(l)){if(o?.cellRendererParams?.innerRenderer)return ro(e,o.cellRendererParams,s)}else return l}if(t?.isMatch(s.node,s.column))return Qv(e,{...o??s.colDef,cellRenderer:"agFindCellRenderer"},s)}getChildCount(){const{column:e,suppressCount:t}=this.params;if(t)return 0;const{allChildrenCount:s,rowGroupColumn:r}=this.displayedNode;return!((s??0)>0&&(!r||!e||e?.isRowGroupDisplayed(r.getId())))||this.gos.get("showOpenedGroup")&&this.displayedNode!==this.node&&!Rv(this.node,this.displayedNode,this.gos)?0:s??0}isExpandable(){const{node:e,column:t,colDef:s}=this.params;if(!this.displayedNode.isExpandable()||e.rowPinned)return!1;if(!t)return!0;if(e.hasChildren()&&s){const{showRowGroup:n}=s;if(!n)return!1;if(n===!0)return!0}return e===this.displayedNode?e.rowGroupColumn&&t?.isRowGroupDisplayed(e.rowGroupColumn.getId())?!0:e.master?s?.showRowGroup===!0||s?.showRowGroup==null:!1:Rv(this.node,this.displayedNode,this.gos)}setupIndent(){const{suppressPadding:e,node:t,colDef:s}=this.params;if(e)return;const r=()=>{let i=t.uiLevel;s&&s.showRowGroup!==!0&&(i=0);const n="ag-row-group-indent-"+i;n!==this.indentClass&&(this.indentClass&&this.comp.toggleCss(this.indentClass,!1),this.indentClass=n,this.comp.toggleCss(n,!0),this.eGui.style.setProperty("--ag-indentation-level",String(i)))};this.addManagedListeners(t,{uiLevelChanged:r.bind(this)}),r()}setupCheckbox(){const{node:e}=this.params;!e.footer&&!e.rowPinned&&!e.detail&&(this.addManagedPropertyListener("rowSelection",({currentValue:s,previousValue:r})=>{const i=typeof s=="object"?s:void 0,n=typeof r=="object"?r:void 0;i?.checkboxLocation!==n?.checkboxLocation&&(this.destroyCheckbox(),this.addCheckbox())}),this.addCheckbox())}addCheckbox(){const{selectionSvc:e}=this.beans;if(!e||!Yz(this.gos))return;const{node:t,column:s}=this.params,r=this.gos.get("rowSelection"),i=$z(r);if(i==="selectionColumn")return;if(i==="autoGroupColumn"){const c=s?.getColDef().showRowGroup!=null,u=!s&&t.group;if(!(c||u))return}const n=typeof r=="object"?jz(r):this.params.checkbox;if(!(typeof n=="function"||n===!0))return;if(typeof s?.getColDef().showRowGroup=="string"&&!this.isExpandable()){this.comp.setCheckboxSpacing(!0);return}const l=e.createCheckboxSelectionComponent();this.cbComp=l,this.createBean(l),l.init({rowNode:t,column:s,overrides:{isVisible:n,callbackParams:this.params,removeHidden:!0}}),this.eCheckbox.appendChild(l.getGui()),this.comp.setCheckboxVisible(!0)}destroyCheckbox(){this.comp.setCheckboxSpacing(!1),this.comp.setCheckboxVisible(!1),this.cbComp?.getGui().remove(),this.cbComp=this.destroyBean(this.cbComp)}isGroupCellEditable(e){const t=this.params.column;return!!t&&(!!t.getColDef().groupRowEditable||this.gos.get("enableGroupEdit"))&&t.isCellEditable(e)}onExpandClicked(e){eC(e)||(qz(e),this.onExpandOrContract(e))}onKeyDown(e){!(e.key===Wz.ENTER)||this.params.suppressEnterExpand||this.isGroupCellEditable(this.params.node)||this.onExpandOrContract(e)}onCellDblClicked(e){if(eC(e))return;Jv(this.eExpanded,e)||Jv(this.eContracted,e)||this.onExpandOrContract(e)}onExpandOrContract(e){if(!this.isExpandable())return;const t=this.displayedNode;t.setExpanded(!t.expanded,e)}destroy(){super.destroy(),this.destroyCheckbox()}},Zz={tag:"span",cls:"ag-cell-wrapper",children:[{tag:"span",ref:"eExpanded",cls:"ag-group-expanded ag-hidden"},{tag:"span",ref:"eContracted",cls:"ag-group-contracted ag-hidden"},{tag:"span",ref:"eCheckbox",cls:"ag-group-checkbox ag-invisible"},{tag:"span",ref:"eValue",cls:"ag-group-value"},{tag:"span",ref:"eChildCount",cls:"ag-group-child-count"}]},sC=class extends j0{constructor(){super(Zz),this.eExpanded=ci,this.eContracted=ci,this.eCheckbox=ci,this.eValue=ci,this.eChildCount=ci}init(e){const t={setInnerRenderer:(n,o)=>this.setRenderDetails(n,o),setChildCount:n=>this.eChildCount.textContent=n,toggleCss:(n,o)=>this.toggleCss(n,o),setContractedDisplayed:n=>Xv(this.eContracted,n),setExpandedDisplayed:n=>Xv(this.eExpanded,n),setCheckboxVisible:n=>Bz(this.eCheckbox,n),setCheckboxSpacing:n=>this.eCheckbox.classList.toggle("ag-group-checkbox-spacing",n)},s=this.createManagedBean(new tC),r=!e.colDef,i=this.getGui();s.init(t,i,this.eCheckbox,this.eExpanded,this.eContracted,this.constructor,e),r&&Nz(i,s.getCellAriaRole())}setRenderDetails(e,t){e?e.newAgStackInstance().then(s=>{if(!s)return;const r=()=>this.destroyBean(s);this.isAlive()?(this.eValue.appendChild(s.getGui()),this.addDestroyFunc(r)):r()}):this.eValue.innerText=t}destroy(){this.destroyBean(this.innerCellRenderer),super.destroy()}refresh(){return!1}},Xz=".ag-group-checkbox-spacing{width:var(--ag-icon-size)}:where(.ag-ltr) .ag-group-checkbox-spacing{margin-right:var(--ag-cell-widget-spacing)}:where(.ag-rtl) .ag-group-checkbox-spacing{margin-left:var(--ag-cell-widget-spacing)}";import{BeanStub as Jz}from"ag-grid-community";var Qz=class extends Y0{constructor(){super(...arguments),this.beanName="showRowGroupColValueSvc"}getGroupValue(e,t,s){if(!t)return e.group?{displayedNode:e,value:e.groupValue}:null;const r=this.beans.valueSvc,i=t.showRowGroup;if(!i)return null;if(e.level===-1&&e.footer)return{displayedNode:e,value:null};if(typeof i=="string"){const o=this.beans.colModel.colsById[i];if(o?.rowGroupActive&&o.rowGroupActiveIndex>e.level)return null;const a=this.getDisplayedNode(e,t,!0);if(a)return{displayedNode:a,value:r.getValueFromData(t,a,s)}}const n=r.getValueFromData(t,e,s);if(n==null){const o=this.getDisplayedNode(e,t);if(o)return{displayedNode:o,value:r.getValueFromData(t,o,s)}}return{displayedNode:e,value:n}}formatAndPrefixGroupColValue(e,t,s=!1){const r=this.formatGroupColValue(e,t,s),{value:i,displayedNode:n}=e,o=this.beans.footerSvc;return o?.doesCellShowTotalPrefix(n,t)?o.applyTotalPrefix(i,r,n,t):n.footer&&n.level===-1?null:r}formatGroupColValue(e,t,s=!1){const r=this.beans.valueSvc,{displayedNode:i,value:n}=e,o=i.rowGroupColumn,a=i.group&&!t;if(o&&(a||t?.isRowGroupDisplayed(o.colId))){if(s&&o.colDef.useValueFormatterForExport===!1)return null;const c=r.formatValue(o,i,n);return i.key===""&&!c?this.getLocaleTextFunc()("blanks","(Blanks)"):c}return!t||i.group||s&&t.colDef.useValueFormatterForExport===!1?null:r.formatValue(t,i,n)}getDisplayedNode(e,t,s=!1){const r=this.gos,i=r.get("groupHideOpenParents"),n=r.get("showOpenedGroup")&&!s;if(!i&&!n)return;const o=t.showRowGroup;if(o===!0)return e.group?void 0:e.parent??void 0;let a=e;for(;a&&a.rowGroupColumn?.colId!=o;){const l=a===a.parent?.getFirstChild();if(!n&&!l)return;a=a.parent}if(a!==e)return a??void 0}};import{_pushToMapArray as eW}from"ag-stack";import{BeanStub as tW}from"ag-grid-community";var sW=class extends q0{constructor(){super(...arguments),this.beanName="showRowGroupCols",this.columns=[],this.sourceCols=[],this.colsSet=new Set}destroy(){super.destroy(),this.columns.length=0,this.colsSet.clear(),this.clearStamps()}clearStamps(){const e=this.sourceCols;for(let t=0,s=e.length;t<s;++t)e[t].showRowGroupCol=null;e.length=0}refresh(){const{colModel:e,rowGroupColsSvc:t}=this.beans,s=this.columns,r=this.colsSet;this.clearStamps();const i=this.sourceCols,n=s.length;let o=0,a=!1;const l=e.colsList;for(let c=0,u=l.length;c<u;++c){const d=l[c],p=d.colDef.showRowGroup;if(typeof p=="string"){const g=e.getNonPivotColById(p);g&&(g.showRowGroupCol=d,i.push(g))}else if(p===!0){const g=t?.columns;if(g)for(let f=0,m=g.length;f<m;++f){const v=g[f];v.showRowGroupCol=d,i.push(v)}}else continue;a||(a=o>=n||!r.has(d)),s[o++]=d}if(a||(a=o!==n),a){s.length=o,r.clear();for(let c=0;c<o;++c)r.add(s[c]);this.eventSvc.dispatchEvent({type:"showRowGroupColsSetChanged"})}}getSourceColumnsForGroupColumn(e){const t=e.showRowGroup;if(!t)return null;const{rowGroupColsSvc:s,colModel:r}=this.beans;if(t===!0)return s?s.columns:null;const i=r.getNonPivotCol(t);return i?[i]:null}isRowGroupDisplayed(e,t){const s=e.showRowGroup;return s===!0||s!=null&&s===t}interleaveSortedColumns(e){const t=this.beans.rowGroupColsSvc?.columns;if(!t)return e;const s=new Map;for(let n=0,o=t.length;n<o;++n){const a=t[n],l=a.sortDef.direction?a.showRowGroupCol:null;l&&eW(s,l,a)}if(s.size===0)return e;const r=new Set,i=[];for(let n=0,o=e.length;n<o;++n){const a=e[n],l=a.showRowGroupCol??a;if(r.has(l))continue;r.add(l),i.push(l);const c=s.get(l);for(let u=0,d=c?.length??0;u<d;++u)i.push(c[u])}return i}fillCoupledSortIndexMap(e,t){let s=-1;for(let r=0,i=e.length;r<i;++r){const n=e[r],o=n.showRowGroupCol;t.set(n,o&&o!==n?s:++s)}return s}isGroupSortMixed(e,t){const s=this.getSourceColumnsForGroupColumn(e);if(!s)return!0;for(let r=0,i=s.length;r<i;++r)if(t!==s[r].sortDef.direction)return!0;return!1}};import{BeanStub as rW,_isClientSideRowModel as iW,_isGroupRowsSticky as nW,_isServerSideRowModel as oW}from"ag-grid-community";import{_last as aW}from"ag-stack";import{BeanStub as lW,_getRowHeightForNode as cW,_isClientSideRowModel as uW,_isGroupRowsSticky as dW}from"ag-grid-community";var hW=class extends Z0{constructor(e,t){super(),this.createRowCon=e,this.destroyRowCtrls=t,this.stickyTopRowCtrls=[],this.stickyBottomRowCtrls=[],this.extraTopHeight=0,this.extraBottomHeight=0}postConstruct(){this.isClientSide=uW(this.gos),this.beans.ctrlsSvc.whenReady(this,e=>{this.gridBodyCtrl=e.gridBodyCtrl}),this.resetStickyContainers()}setOffsetTop(e){this.extraTopHeight!==e&&(this.extraTopHeight=e,this.eventSvc.dispatchEvent({type:"stickyTopOffsetChanged",offset:e}))}setOffsetBottom(e){this.extraBottomHeight!==e&&(this.extraBottomHeight=e)}resetOffsets(){this.setOffsetBottom(0),this.setOffsetTop(0)}getLastPixelOfGroup(e){return this.isClientSide?gW(e):pW(e)}getFirstPixelOfGroup(e){const t=e.footer&&e.sibling;return t?t.rowTop+t.rowHeight-1:e.hasChildren()?e.rowTop-1:0}updateStickyRows(e){const t=e==="top";let s=0;if(!this.canRowsBeSticky())return this.refreshNodesAndContainerHeight(e,new Set,s);const r=new Set,{rowModel:i,rowRenderer:n,pinnedRowModel:o,pageBounds:a,rowContainerHeight:l}=this.beans,{pageFirstPixel:c,pageLastPixel:u}=a.getCurrentPagePixelRange(),d=t?n.firstVisibleVPixel-this.extraTopHeight:n.lastVisibleVPixel-this.extraTopHeight,h=n.lastVisibleVPixel-n.firstVisibleVPixel,p=h>0?h*this.gos.get("stickyRowsMaxViewportRatio"):Number.MAX_SAFE_INTEGER,g=l.divStretchOffset??0,f=c+g,m=u+g,v=w=>{if(r.add(w),t){const F=this.getLastPixelOfGroup(w),T=d+s+w.rowHeight;F<T?w.stickyRowTop=s+(F-T):w.stickyRowTop=s}else{const F=this.getFirstPixelOfGroup(w),T=d-(s+w.rowHeight);F>T?w.stickyRowTop=s-(F-T):w.stickyRowTop=s}s=0,r.forEach(F=>{const T=F.stickyRowTop+F.rowHeight;s<T&&(s=T)})},C=this.areFooterRowsStickySuppressed(),b=this.gos.get("suppressGroupRowsSticky");let y=d;const S=w=>{if(!w.displayed||w.rowHeight>p)return!1;if(w.footer){if(C===!0||C==="grand"&&w.level===-1||C==="group"&&w.level>-1)return!1;if(w.level>-1){const T=w.sibling?.rowIndex,x=w.rowIndex,P=T!=null&&x!=null?T+1===x:!1;if(e==="bottom"&&P||e==="top"&&!P)return!1}if(w.level===-1&&o?.getUserGrandTotalPinned())return!1;if(e==="bottom"){if(w.level===-1)return!r.has(w);{const T=w.sibling,x=T?.rowIndex;if(x==null)return!1;const P=i.getRowBounds(x),L=P?.rowTop??T.rowTop,G=P?.rowHeight??T.rowHeight;if(L==null||G==null||L+G-1>y)return!1}}return!r.has(w)}return w.isExpandable()?b||e==="bottom"?!1:!r.has(w)&&!!w.expanded:!1};for(let w=0;w<100;w++){let F=d+s;t||(F=d-s),t&&F<f?F=f:!t&&F>m&&(F=m),y=F;const T=i.getRowIndexAtPixel(F),x=i.getRow(T);if(x==null)break;const L=this.getStickyAncestors(x).find(O=>(t?O.rowIndex<T:O.rowIndex>T)&&S(O));if(L){if(s+L.rowHeight>p)break;v(L);continue}if((t?x.rowTop<F:x.rowTop+x.rowHeight>F)&&S(x)){if(s+x.rowHeight>p)break;v(x);continue}break}return t||r.forEach(w=>{w.stickyRowTop=s-(w.stickyRowTop+w.rowHeight)}),this.refreshNodesAndContainerHeight(e,r,s)}areFooterRowsStickySuppressed(){const e=this.gos.get("suppressStickyTotalRow");if(e===!0)return!0;const t=e==="group",s=e==="grand";return t&&s?!0:s?"grand":t?"group":!1}canRowsBeSticky(){const e=dW(this.gos),t=this.areFooterRowsStickySuppressed(),s=this.gos.get("suppressGroupRowsSticky");return e&&(!t||!s)}getStickyAncestors(e){const t=[];let s=e.footer?e.sibling:e.parent;for(;s;)s.sibling&&t.push(s.sibling),t.push(s),s=s.parent;return t.reverse()}checkStickyRows(){const e=this.updateStickyRows("top"),t=this.updateStickyRows("bottom");return e||t}destroyStickyCtrls(){this.resetStickyContainers()}resetStickyContainers(){this.refreshNodesAndContainerHeight("top",new Set,0),this.refreshNodesAndContainerHeight("bottom",new Set,0)}refreshStickyNode(e){let t=this.stickyTopRowCtrls,s=rC(t,e);const r=s>=0;if(!r&&(t=this.stickyBottomRowCtrls,s=rC(t,e),s<0))return;const i=this.createRowCon(e,!1,!1),n=t.slice();n[s]=i,r?this.stickyTopRowCtrls=n:this.stickyBottomRowCtrls=n,this.destroyRowCtrls([t[s]])}refreshNodesAndContainerHeight(e,t,s){const r=e==="top",i=r?this.stickyTopRowCtrls:this.stickyBottomRowCtrls,n=[],o=[];for(let p=0;p<i.length;p++){const g=i[p].rowNode;if(!t.has(g)){n.push(i[p]);continue}o.push(i[p])}const a=new Set;for(let p=0;p<o.length;p++)a.add(o[p].rowNode);const l=[];try{for(const p of t)a.has(p)||(p.sticky=!0,l.push(this.createRowCon(p,!1,!1)))}catch(p){for(const g of t)g.sticky=a.has(g);for(let g=0,f=l.length;g<f;++g){const m=l[g];m.destroyFirstPass(),m.destroySecondPass()}throw p}for(let p=0,g=n.length;p<g;++p)n[p].rowNode.sticky=!1;let c=!!l.length||o.length!==i.length;r?this.topContainerHeight!==s&&(this.topContainerHeight=s,this.gridBodyCtrl.setStickyTopHeight(s),c=!0):this.bottomContainerHeight!==s&&(this.bottomContainerHeight=s,this.gridBodyCtrl.setStickyBottomHeight(s),c=!0),this.destroyRowCtrls(n);const u=[...o,...l];u.sort((p,g)=>g.rowNode.rowIndex-p.rowNode.rowIndex),r||u.reverse();for(const p of u)p.setRowTop(p.rowNode.stickyRowTop);const d=this.beans.pageBounds;let h=0;if(r){for(const p of t)p.rowIndex<d.getFirstRow()&&(h+=p.rowHeight);h>this.topContainerHeight&&(h=this.topContainerHeight),this.setOffsetTop(h)}else{for(const p of t)p.rowIndex>d.getLastRow()&&(h+=p.rowHeight);h>this.bottomContainerHeight&&(h=this.bottomContainerHeight),this.setOffsetBottom(h)}return c?(r?this.stickyTopRowCtrls=u:this.stickyBottomRowCtrls=u,!0):!1}ensureRowHeightsValid(){let e=!1;const t=s=>{const r=s.rowNode;if(r.rowHeightEstimated){const i=cW(this.beans,r);r.setRowHeight(i.height),e=!0}};return this.stickyTopRowCtrls.forEach(t),this.stickyBottomRowCtrls.forEach(t),e}};function pW(e){if(e.isExpandable()||e.footer){if(e.master&&e.detailNode)return e.detailNode.rowTop+e.detailNode.rowHeight;if(!e.sibling||Math.abs(e.sibling.rowIndex-e.rowIndex)===1){let s=e.childStore?.getStoreBounds();return e.footer&&(s=e.sibling?.childStore?.getStoreBounds()),(s?.heightPx??0)+(s?.topPx??0)}return e.footer?e.rowTop+e.rowHeight:e.sibling.rowTop+e.sibling.rowHeight}return Number.MAX_SAFE_INTEGER}function gW(e){if(e.isExpandable()||e.footer){if(e.footer&&e.rowIndex===0)return Number.MAX_SAFE_INTEGER;if(!e.sibling||Math.abs(e.sibling.rowIndex-e.rowIndex)===1){let r=e.footer&&e.sibling||e;for(;r.isExpandable()&&r.expanded;)if(r.master&&r.detailNode)r=r.detailNode;else if(r.childrenAfterSort){if(r.childrenAfterSort.length===0)break;r=aW(r.childrenAfterSort)}return r.rowTop+r.rowHeight}return e.footer?e.rowTop+e.rowHeight:e.sibling.rowTop+e.sibling.rowHeight}return Number.MAX_SAFE_INTEGER}function rC(e,t){const s=e.length;let r=0;for(;r<s&&e[r].rowNode!==t;)++r;return r<s?r:-1}var fW=class extends X0{constructor(){super(...arguments),this.beanName="stickyRowSvc"}createStickyRowFeature(e,t,s){const r=this.gos;if(nW(r)&&iW(r)||oW(r))return e.createManagedBean(new hW(t,s))}},iC={moduleName:"GroupCellRenderer",version:_,userComponents:{agGroupRowRenderer:sC,agGroupCellRenderer:sC},dynamicBeans:{groupCellRendererCtrl:tC},icons:{groupContracted:"tree-closed",groupExpanded:"tree-open"},css:[Xz],dependsOn:[$]},nC={moduleName:"GroupColumn",version:_,beans:[Z9,sW,Qz,_9,Fv,Sv],dependsOn:[$,iC]},Rc={moduleName:"ChangedPath",version:_,beans:[sz],dependsOn:[$]},Ys={moduleName:"CsrmHierarchy",version:_,rowModels:["clientSide"],beans:[gz,lz],dependsOn:[Rc]},oC={moduleName:"CsrmGroupStages",version:_,rowModels:["clientSide"],beans:[_z,Az,Dz],dependsOn:[Ys]},Mc={moduleName:"StickyRow",version:_,beans:[fW]},aC={moduleName:"GroupEdit",version:_,beans:[yz],dependsOn:[Ys]};import{AgColumn as mW,BeanStub as vW,GROUP_HIERARCHY_COLUMN_ID_PREFIX as CW,_addColumnDefaultAndTypes as Ic}from"ag-grid-community";import{_pushToMapArray as lC}from"ag-stack";var bW=e=>{const t=e.edit,s=t.node,r=[];if(e.treeDepth===0){for(let a=s.next;a!==s;a=a.next)r.push(a.col);e.columns=r,e.columnTree=r;return}const i=new Map,n=new Set;for(let a=s.next;a!==s;a=a.next){const l=a.col;r.push(l);let c=l.originalParent;for(;c!==null&&!n.has(c);)n.add(c),lC(i,c.originalParent,c),c=c.originalParent;lC(i,l.originalParent,l)}let o=e.columnTree;for(const a of t.affectedParents){const l=i.get(a)??[];a!==null?a.children=l:o=l}e.columns=r,e.columnTree=o},cC=e=>{const t={col:null,prev:null,next:null},s=new Map,r=e.columns;let i=t;for(let o=0,a=r.length;o<a;++o){const l={col:r[o],prev:i,next:t};i.next=l,s.set(r[o].colId,l),i=l}i.next=t,t.prev=i;const n={node:t,byId:s,affectedParents:new Set,commit:bW};return e.edit=n,n},uC=(e,t,s)=>{const r=e.edit??cC(e),i=r.node,n=r.byId,o=s!=null?n.get(s):void 0,a=o??i.prev,l=a.next,c={col:t,prev:a,next:l};if(a.next=c,l.prev=c,n.set(t.colId,c),o){const d=o.col.originalParent;t.originalParent=d,e.treeDepth>0&&r.affectedParents.add(d);return}t.originalParent=null;const u=e.treeDepth;u>0&&(e.wrapperCache.wrap(t,u,e.buildToken),r.affectedParents.add(null))},SW=(e,t)=>{const s=t.length;if(s===0)return;const r=e.edit??cC(e),i=r.node,n=r.byId,o=e.wrapperCache,a=e.treeDepth,l=e.buildToken;for(let c=s-1;c>=0;--c){const u=t[c];u.buildToken=l,o.wrap(u,a,l);const d=i.next,h={col:u,prev:i,next:d};i.next=h,d.prev=h,n.set(u.colId,h)}a>0&&r.affectedParents.add(null)};import{MONTHS as dC,_getDateParts as yW,_parseDateTimeFromString as wW}from"ag-stack";var xW=({valueSvc:e,dataTypeSvc:t},s,r)=>{const i=r?e.getValueFromData(s,r):void 0;let n=null;return i instanceof Date?n=i:typeof i=="string"&&(n=(t?.getDateParserFunction(s)??wW)(i)??null),n},FW=(e,t,s,r)=>i=>{const n=xW(e,t,i.node),o=yW(n);return o?r?.(o[s])??o[s]:null},TW=({colNames:e},t,s)=>r=>{const i=e.getDisplayNameForColumn(t,r.location);return i?`${i} (${s})`:""},AW=Object.fromEntries(dC.map(e=>[e,e.toLowerCase()])),PW=e=>{const t=dC[Number.parseInt(e,10)-1]??e,s=AW[t]??e;return{month:t,localeKey:s}},hC={year:{label:"Year",index:0},quarter:{label:"Quarter",index:1,map:e=>Math.ceil(Number(e)/3).toString()},month:{label:"Month",index:1},formattedMonth:{label:"Month",localeKey:"month",index:1,map:(e,t)=>{const s=PW(e);return t(s.localeKey,s.month)}},day:{label:"Day",index:2},hour:{label:"Hour",index:3},minute:{label:"Minute",index:4},second:{label:"Second",index:5}},RW=class extends J0{constructor(){super(...arguments),this.beanName="groupHierarchyColSvc",this.columns=[],this.sourceColumnMap=new Map,this.virtualColInfo=new Map}contributeTo(e){const{plan:t,matches:s}=this.planHierarchy(e.columns);if(t.length===0){this.columns.length>0&&this.clearColumns();return}s?this.reapplyDefs(t,e.source):this.rebuildColumns(t),SW(e,this.columns)}reapplyDefs(e,t){const{columns:s,gos:r}=this;for(let i=0,n=e.length;i<n;++i){const{sourceCol:o,part:a,colId:l}=e[i],c=s[i],u=this.createColDefForPart(a,o,l,c.colDef);c.setColDef(u,null,t)&&r.validateColDef(u,l,!0)}}rebuildColumns(e){const{sourceColumnMap:t,virtualColInfo:s,beans:r,gos:i}=this;t.clear(),s.clear();const n=new Array(e.length);for(let o=0,a=e.length;o<a;++o){const{sourceCol:l,part:c,colId:u}=e[o],d=this.createColDefForPart(c,l,u);i.validateColDef(d,u,!0);const h=new mW(d,null,u,!0,"hierarchy");r.context.createBean(h),n[o]=h;const p=t.get(l);s.set(h,{source:l,index:p?.length??0}),p?p.push(h):t.set(l,[h])}this.columns=n}planHierarchy(e){const t=this.gos.get("groupHierarchyConfig"),s=this.columns,r=[];let i=!0;for(let n=0,o=e.length;n<o;++n){const a=e[n],l=IW(a);if(l!=null)for(let c=0,u=l.length;c<u;++c){const d=l[c],h=MW(a.colId,d,t);if(h===null)continue;const p=r.length;i&&(p>=s.length||s[p].colId!==h)&&(i=!1),r.push({sourceCol:a,part:d,colId:h})}}return{plan:r,matches:i&&r.length===s.length}}destroy(){this.clearColumns(),super.destroy()}clearColumns(){this.columns=[],this.sourceColumnMap.clear(),this.virtualColInfo.clear()}compareVirtualColumns(e,t){const s=this.virtualColInfo,r=s.get(e),i=s.get(t);return r!==void 0&&i!==void 0?r.source===i.source?r.index-i.index:null:i?.source===e?1:r?.source===t?-1:null}getVirtualCols(e){return this.sourceColumnMap.get(e)}createColDefForPart(e,t,s,r){const{beans:i,gos:n}=this;if(typeof e!="string")return Ic(i,e,s,!0);const{enableRowGroup:o,enablePivot:a}=t.colDef,l={enableRowGroup:o,enablePivot:a,hide:!0,editable:!1},c=n.get("groupHierarchyConfig")??{};if(e in c){const g={...l,...c[e]};return g.colId??(g.colId=s),Ic(i,g,g.colId,!0)}const u=Ic(i,{colId:s,...l},s,!0);if(r?.valueGetter)return{...u,headerValueGetter:r.headerValueGetter,valueGetter:r.valueGetter};const d=hC[e],h=this.getLocaleTextFunc(),{map:p}=d;return{...u,headerValueGetter:TW(i,t,h(d.localeKey??e,d.label)),valueGetter:FW(i,t,d.index,p&&(g=>p(g,h)))}}},MW=(e,t,s)=>typeof t!="string"?t.colId||null:s?.[t]===void 0&&!(t in hC)?null:`${CW}-${e}-${t}`,IW=e=>{const t=e.colDef;return!t.rowGroup&&!t.enableRowGroup&&t.rowGroupIndex==null&&!t.pivot&&!t.enablePivot&&t.pivotIndex==null?null:t.groupHierarchy??t.rowGroupingHierarchy},EW={moduleName:"GroupHierarchy",version:_,beans:[RW],dependsOn:[Rc]};import{Component as DW,_createElement as LW}from"ag-grid-community";var kW=class extends Q0{constructor(){super()}postConstruct(){this.setGui(this.createNorthPanel());const e=this.onRowGroupChanged.bind(this);this.addManagedEventListeners({columnRowGroupChanged:e,newColumnsLoaded:e}),this.addManagedPropertyListener("rowGroupPanelShow",e),this.addManagedPropertyListener("pivotPanelShow",()=>this.onPivotPanelShow()),this.onRowGroupChanged()}createNorthPanel(){const e=LW({tag:"div",cls:"ag-column-drop-wrapper",role:"presentation"}),t=new wl(!0);this.rowGroupComp=this.createManagedBean(t);const s=new yl(!0);this.pivotComp=this.createManagedBean(s),e.appendChild(t.getGui()),e.appendChild(s.getGui());const r=this.onDropPanelVisible.bind(this);return this.addManagedListeners(t,{displayChanged:r}),this.addManagedListeners(s,{displayChanged:r}),this.onDropPanelVisible(),e}onDropPanelVisible(){const{rowGroupComp:e,pivotComp:t}=this,s=e.isDisplayed()&&t.isDisplayed(),r="ag-column-drop-horizontal-half-width";e.toggleCss(r,s),t.toggleCss(r,s)}onRowGroupChanged(){const e=this.rowGroupComp;if(!e)return;const t=this.gos.get("rowGroupPanelShow");if(t==="always")e.setDisplayed(!0);else if(t==="onlyWhenGrouping"){const s=this.beans.rowGroupColsSvc?.columns?.length!==0;e.setDisplayed(s)}else e.setDisplayed(!1)}onPivotPanelShow(){const e=this.pivotComp;if(!e)return;const t=this.gos.get("pivotPanelShow");if(t==="always")e.setDisplayed(!0);else if(t==="onlyWhenPivoting"){const s=this.beans.colModel.isPivotActive();e.setDisplayed(s)}else e.setDisplayed(!1)}getFocusableContainers(){return[this.rowGroupComp,this.pivotComp].filter(e=>!!e)}},_W={selector:"AG-GRID-HEADER-DROP-ZONES",component:kW};import{BeanStub as GW}from"ag-grid-community";var OW=class extends eF{constructor(){super(...arguments),this.beanName="rowGroupPanelBuilder"}createRowGroupDropZone(e,t=!1){return new wl(e,void 0,t)}createPivotDropZone(e,t=!1){return new yl(e,void 0,t)}};import{RefPlaceholder as pC,_clearElement as Ec,_setDisplayed as NW}from"ag-stack";import{AgPromise as ui,AgSelect as BW,FilterComp as VW,TabGuardComp as HW,_createElement as UW}from"ag-grid-community";function zW(e){return e.buttons&&(e.buttons=[]),e}var WW={tag:"div",cls:"ag-group-filter",children:[{tag:"div",ref:"eGroupField"},{tag:"div",ref:"eUnderlyingFilter"}]},KW=class extends tF{constructor(){super(WW),this.filterType="group",this.eGroupField=pC,this.eUnderlyingFilter=pC}wireBeans(e){this.groupFilterSvc=e.groupFilter}postConstruct(){this.initialiseTabGuard({})}init(e){return this.params=e,this.addManagedEventListeners({columnHeaderNameChanged:({column:t})=>{t&&this.getHandler()?.sourceColumns?.includes(t)&&this.updateGroupField()}}),this.updateParams().then(()=>{this.addHandlerListeners(this.updateGroups.bind(this))})}refresh(e){const t=e;return this.params=t,t.source==="colDef"&&this.updateParams(),!0}updateParams(){return this.validateParams(),this.updateGroups()}validateParams(){const{colDef:e}=this.params;e.field&&this.beans.log.warn(234),e.filterValueGetter&&this.beans.log.warn(235),e.filterParams&&this.beans.log.warn(236)}addHandlerListeners(e){const t=this.addManagedListeners(this.getHandler(),{sourceColumnsChanged:()=>{this.updateGroups()},destroyed:()=>{for(const s of t)s();this.addHandlerListeners(e)}})}updateGroups(){const{sourceColumns:e,selectedColumn:t}=this.updateGroupField();return this.dispatchLocalEvent({type:"columnsChanged"}),this.getUnderlyingFilters(e,t)}updateGroupField(){this.groupColumn=this.params.column;const e=this.getHandler();if(!e)return{sourceColumns:null};const{sourceColumns:t,hasMultipleColumns:s,selectedColumn:r}=e,i=this.eGroupField;if(Ec(i),this.eGroupFieldSelect=this.destroyBean(this.eGroupFieldSelect),s&&t){const n=this.createGroupFieldSelectElement(t,r);this.eGroupFieldSelect=n,i.appendChild(n.getGui()),i.appendChild(UW({tag:"div",cls:"ag-filter-separator"}))}return NW(i,s),{sourceColumns:t,selectedColumn:r}}createGroupFieldSelectElement(e,t){const s=this.createBean(new BW),r=this.getLocaleTextFunc();return s.setLabel(r("groupFilterSelect","Select field:")),s.setLabelAlignment("top"),s.addOptions(e.map(i=>({value:i.colId,text:this.beans.colNames.getDisplayNameForColumn(i,"groupFilter",!1)??void 0}))),s.setValue(t.colId),s.onValueChange(i=>this.updateSelectedColumn(i)),s.addCss("ag-group-filter-field-select-wrapper"),e.length===1&&s.setDisabled(!0),s}getUnderlyingFilters(e,t){if(!e)return this.filterColumnPairs=void 0,this.selectedFilter=void 0,ui.resolve();const s=[],r=[],i=this.beans.colFilter;for(const n of e){const o=i.getOrCreateFilterUi(n);o&&s.push(o.then(a=>{a&&r.push({filter:a,column:n}),n.colId===t.colId&&(this.selectedFilter=a??void 0)}))}return ui.all(s).then(()=>{this.filterColumnPairs=r})}addUnderlyingFilterElement(e){if(Ec(this.eUnderlyingFilter),!e)return ui.resolve();const t=this.createManagedBean(new VW(e,"COLUMN_MENU"));return this.filterComp=t,t.hasFilter()?(this.eUnderlyingFilter.appendChild(t.getGui()),t.getFilter()?.then(()=>{t.afterGuiAttached?.(this.afterGuiAttachedParams),!this.afterGuiAttachedParams?.suppressFocus&&this.eGroupFieldSelect&&!this.eGroupFieldSelect.isDisabled()&&this.eGroupFieldSelect.getFocusableElement().focus()})??ui.resolve()):ui.resolve()}updateSelectedColumn(e){if(!e)return;this.filterComp?.afterGuiDetached(),this.destroyBean(this.filterComp);const t=this.getFilterColumnPair(e),s=t?.column;this.selectedFilter=t?.filter,this.getHandler().setSelectedColumn(s),this.dispatchLocalEvent({type:"columnsChanged"}),this.addUnderlyingFilterElement(s)}isFilterActive(){return this.groupFilterSvc.isFilterActive(this.groupColumn)}doesFilterPass(){return!0}getModel(){return null}setModel(){}afterGuiAttached(e){this.afterGuiAttachedParams=e,this.addUnderlyingFilterElement(this.getHandler().selectedColumn)}afterGuiDetached(){Ec(this.eUnderlyingFilter),this.selectedFilter?.afterGuiDetached?.()}getSelectedColumn(){return this.getHandler().selectedColumn}getHandler(){return this.params.getHandler()}destroy(){this.eGroupFieldSelect=this.destroyBean(this.eGroupFieldSelect),super.destroy()}getFilterColumnPair(e){if(e)return this.filterColumnPairs?.find(({column:t})=>t.colId===e)}};import{BeanStub as $W}from"ag-grid-community";var jW=class extends sF{init(e){this.params=e,this.validateModel(e),this.updateColumns(),this.addManagedEventListeners({columnRowGroupChanged:this.updateColumns.bind(this),filterDestroyed:t=>this.onFilterDestroyed(t)})}refresh(e){this.params=e,this.validateModel(e),e.source==="colDef"&&this.updateColumns()}doesFilterPass(){return!0}setSelectedColumn(e){this.selectedColumn=e,this.dispatchLocalEvent({type:"selectedColumnChanged"})}validateModel(e){e.model!=null&&e.onModelChange(null)}getSourceColumns(){const e=this.params.column;if(this.gos.get("treeData"))return this.warn(237),[];const t=this.beans.groupFilter.getSourceColumns(e);return t||(this.warn(183),[])}updateColumns(){const e=this.getSourceColumns(),t=e.filter(i=>i.isFilterAllowed());this.sourceColumns=t;let s,r;t.length?e.length===1?(s=t[0],r=!1):(s=this.selectedColumn,(!s||!t.some(i=>i.getId()===s.getId()))&&(s=t[0]),r=!0):(s=void 0,r=!1),this.selectedColumn=s,this.hasMultipleColumns=r,this.dispatchLocalEvent({type:"sourceColumnsChanged"})}onFilterDestroyed({column:e,source:t}){if(t==="gridDestroyed")return;const s=e.getColId();this.sourceColumns?.some(r=>r.colId===s)&&setTimeout(()=>{this.isAlive()&&this.updateColumns()})}};import{BeanStub as YW}from"ag-grid-community";var qW=class extends rF{constructor(){super(...arguments),this.beanName="groupFilter"}postConstruct(){this.addManagedEventListeners({columnRowGroupChanged:()=>this.updateFilterFlags("columnRowGroupChanged")})}isGroupFilter(e){return Mv(e.colDef.filter)}isFilterAllowed(e){const t=this.beans.colFilter;return!!this.getSourceColumns(e)?.some(s=>t?.isFilterAllowed(s))}isFilterActive(e){const t=this.beans.colFilter;return!!this.getSourceColumns(e)?.some(s=>t?.isFilterActive(s))}getSourceColumns(e){return this.beans.showRowGroupCols?.getSourceColumnsForGroupColumn(e)}updateFilterFlags(e,t){const{autoColSvc:s,colFilter:r}=this.beans,i=s?.columns;if(!(!i||!r))for(let n=0,o=i.length;n<o;++n){const a=i[n];this.isGroupFilter(a)&&r.setColFilterActive(a,this.isFilterActive(a),e,t)}}};import{RefPlaceholder as ZW,_clearElement as XW}from"ag-stack";import{AgInputTextField as JW,AgPromise as Dc,Component as QW,_getDisplayHandler as eK,_getFloatingFilterAriaLabel as tK,_isGroupMultiAutoColumn as sK}from"ag-grid-community";var rK={tag:"div",ref:"eFloatingFilter",cls:"ag-group-floating-filter ag-floating-filter-input",role:"presentation"},iK=class extends iF{constructor(){super(rK),this.eFloatingFilter=ZW,this.haveAddedColumnListeners=!1}init(e){this.params=e;const t=sK(this.gos),s=this.onColChange.bind(this),r=i=>{t?this.setupUnderlyingFloatingFilterElement().then(()=>i()):(this.setupReadOnlyFloatingFilterElement(),i())};return this.gos.get("enableFilterHandlers")?new Dc(i=>r(i)).then(()=>{this.addHandlerListeners(e,s)}):new Dc(i=>{this.params.parentFilterInstance(n=>{this.parentFilterInstance=n,r(i)})}).then(()=>{this.addManagedListeners(this.parentFilterInstance,{columnsChanged:s})})}refresh(e){if(this.params=e,this.setParams(),this.gos.get("enableFilterHandlers"))if(this.showingUnderlyingFloatingFilter){const t=this.getSelectedColumn(),s=this.beans.colFilter.getFloatingFilterCompDetails(t,this.params.showParentFilter);this.underlyingFloatingFilter?.refresh?.(s?.params)}else this.updateDisplayedValue()}setParams(){this.eFloatingFilterText?.setInputAriaLabel(tK(this.beans,this.params.column,this.getLocaleTextFunc()))}addHandlerListeners(e,t){const s=this.addManagedListeners(e.getHandler(),{selectedColumnChanged:t,sourceColumnsChanged:t,destroyed:()=>{for(const r of s)r();this.addHandlerListeners(this.params,t)}})}setupReadOnlyFloatingFilterElement(){this.eFloatingFilterText||(this.eFloatingFilterText=this.createManagedBean(new JW),this.eFloatingFilterText.setDisabled(!0).addGuiEventListener("click",()=>this.params.showParentFilter()),this.setParams()),this.updateDisplayedValue(),this.eFloatingFilter.appendChild(this.eFloatingFilterText.getGui())}setupUnderlyingFloatingFilterElement(){this.showingUnderlyingFloatingFilter=!1,this.underlyingFloatingFilter=void 0,XW(this.eFloatingFilter);const e=this.getSelectedColumn();if(e&&!e.isVisible()){const t=this.beans.colFilter,s=t.getFloatingFilterCompDetails(e,this.params.showParentFilter);if(s)return this.haveAddedColumnListeners||(this.haveAddedColumnListeners=!0,this.addManagedListeners(e,{visibleChanged:this.onColumnVisibleChanged.bind(this),colDefChanged:this.onColDefChanged.bind(this)})),s.newAgStackInstance().then(r=>{this.underlyingFloatingFilter=r,this.underlyingFloatingFilter?.onParentModelChanged(t.getModelForColumn(e)),this.appendChild(r.getGui()),this.showingUnderlyingFloatingFilter=!0})}return this.setupReadOnlyFloatingFilterElement(),Dc.resolve()}getSelectedColumn(){return this.gos.get("enableFilterHandlers")?this.params.getHandler().selectedColumn:this.parentFilterInstance.getSelectedColumn()}onColumnVisibleChanged(){this.setupUnderlyingFloatingFilterElement()}onColDefChanged(e){if(!e.column)return;const t=this.beans.colFilter.getFloatingFilterCompDetails(e.column,this.params.showParentFilter);t&&this.underlyingFloatingFilter?.refresh?.(t.params)}onParentModelChanged(e,t){this.showingUnderlyingFloatingFilter?this.underlyingFloatingFilter?.onParentModelChanged(this.beans.colFilter.getModelForColumn(this.getSelectedColumn()),t):this.updateDisplayedValue()}updateDisplayedValue(){const e=this.eFloatingFilterText;if(!e)return;const t=this.beans.colFilter,s=this.getSelectedColumn(),r=i=>{if(!i)e.setValue(""),e.setDisplayed(!1);else{const n=s?t.getModelForColumn(s):null;e.setValue(n==null?"":i.getModelAsString?.(n)??""),e.setDisplayed(!0)}};s?this.gos.get("enableFilterHandlers")?r(eK(t.getHandler(s))):t.getOrCreateFilterUi(s)?.then(i=>{r(i)}):r()}onColChange(){this.showingUnderlyingFloatingFilter||this.updateDisplayedValue()}};import{BeanStub as nK,RowNode as oK,_csrmFirstLeaf as gC,_forEachChangedGroupDepthFirst as fC}from"ag-grid-community";var aK=(e,t)=>{if(!e){t.length=0;return}const s=e.length;t.length=s;for(let r=0;r<s;r++){const i=e[r],n=i.colDef;t[r]={col:i,field:n.field,type:n.type,keyCreator:n.keyCreator,valueGetter:n.valueGetter}}},lK=(e,t)=>{const s=e.length;if(s!==t?.length)return!0;for(let r=0;r<s;r++){const i=e[r],n=t[r];if(i.col!==n)return!0;const o=n.colDef;if(i.field!==o.field||i.type!==o.type||i.valueGetter!==o.valueGetter||i.keyCreator!==o.keyCreator)return!0}return!1};function cK(e){if(!e)return!1;const t=e.length;if(t<2)return!1;let s=!1;for(let r=1;r<t;r++)if(mC(e[r-1],e[r])>0){s=!0;break}return s?(e.sort(mC),!0):!1}function mC(e,t){const s=e.sourceRowIndex,r=t.sourceRowIndex,i=s>=0,n=r>=0,o=i&&n,a=!i&&!n;return o?s-r:a?e.__objectId-t.__objectId:i?1:-1}var uK=class extends nF{constructor(){super(...arguments),this.groupCols=[],this.nonLeafsById=new Map,this.pivotMode=!1,this.groupEmpty=!1,this.checkGroupCols=!0}wireBeans(e){this.colModel=e.colModel,this.rowModel=e.rowModel,this.valueSvc=e.valueSvc,this.selectionSvc=e.selectionSvc,this.showRowGroupCols=e.showRowGroupCols,this.rowGroupColsSvc=e.rowGroupColsSvc}invalidateGroupCols(){this.checkGroupCols=!0}destroy(){super.destroy(),this.groupCols.length=0,this.nonLeafsById.clear()}clearNonLeafs(){const e=this.nonLeafsById;for(const t of e.values())t._destroy(null);e.clear()}loadGroupData(e){if(!e.group)return e._groupData=null,null;const t=e.rowGroupColumn,{valueSvc:s,showRowGroupCols:r}=this,i={};if(e._groupData=i,!t)return i;const n=gC(e),o=t.getId();if(!r)return i;const a=r.columns;for(let l=0,c=a.length;l<c;++l){const u=a[l];u.isRowGroupDisplayed(o)&&(i[u.colId]=n&&s.getValueFromData(t,n))}return i}execute(e,t){const s=t.changedPath;if(this.initRefresh(t)!=="skip"){const i=t.changedRowNodes;i?this.handleDeltaUpdate(e,s,i,!!t.animate):this.shotgunResetEverything(e)}this.positionLeafsAndGroups(e,s),this.orderGroups(e)}positionLeafsAndGroups(e,t){fC(e,!0,t,s=>{const r=s.childrenAfterGroup,i=r?.length;if(!i)return;const n=new Array(i);let o=0,a=!1,l;for(let c=0;c<i;++c){const u=r[c];if(!u.childrenAfterGroup?.length)a||(a=o!==c),n[o++]=u;else if(!l&&u.key===""){l=u;const d=i-1;a||(a=c!==d),n[d]=u}}if(a){for(let u=0;u<i;++u){const d=r[u];d.childrenAfterGroup?.length&&d!==l&&(n[o++]=d)}s.childrenAfterGroup=n;const c=s.sibling;c&&(c.childrenAfterGroup=n)}})}initRefresh(e){const{rowGroupColsSvc:t,colModel:s,gos:r}=this;this.pivotMode=s.pivotMode,this.groupEmpty=this.pivotMode||!r.get("groupAllowUnbalanced");const i=t?.columns,n=this.groupCols,o=e.afterColumnsChanged;if(o||!n||this.checkGroupCols)if(this.checkGroupCols=!1,n&&!lK(n,i)){if(o)return"skip"}else{e.animate=!1;const a=n[0]?.col.getId()!==i?.[0]?.getId();return aK(i,n),a?"refresh":"groupColsChanged"}return"refresh"}handleDeltaUpdate(e,t,{removals:s,updates:r,adds:i,reordered:n},o){const a=new Set;for(let l=0,c=s.length;l<c;++l){const u=s[l],d=this.removeFromParent(u);a.has(d)||(a.add(d),t?.addRow(d))}for(const l of r){const c=l.parent;if(t?.addRow(c),this.moveNodeInWrongPath(e,l)){a.add(c);const u=l.parent;t?.addRow(u),n||(n=(u?.childrenAfterGroup?.length??0)>1)}}if(i.size)for(const l of i){this.insertOneNode(e,l);const c=l.parent;t?.addRow(c),n||(n=(c?.childrenAfterGroup?.length??0)>1)}a.size&&(vC(a),this.removeEmptyGroups(a,o)),n&&this.sortChildren(e,t)}sortChildren(e,t){fC(e,!0,void 0,s=>{cK(s.childrenAfterGroup)&&t?.addRow(s)})}orderGroups(e){const t=this.gos.getCallback("initialGroupOrderComparator");if(!t)return;const s=this.beans,r=s.gridApi,i=s.gridOptions.context,n=(a,l)=>t({api:r,context:i,nodeA:a,nodeB:l}),o=a=>{const l=a.childrenAfterGroup,c=l?.length;if(!(!c||a.leafGroup)){c>1&&l.sort(n);for(let u=0,d=c;u<d;++u)o(l[u])}};o(e)}moveNodeInWrongPath(e,t){const{valueSvc:s}=this.beans,r=this.groupEmpty;let i=t.parent,n=!1;const o=this.groupCols;if(!o)return!1;for(let a=o.length-1;a>=0;--a){const{col:l}=o[a];let c=s.getKeyForNode(l,t);if(c==null||c===""){if(!r)continue;c=""}if(!i?.parent||i.key!==c){n=!0;break}i=i.parent}return n||(n=!!i?.parent),n?(this.removeFromParent(t),this.insertOneNode(e,t),t.setData(t.data),!0):!1}groupShouldBeRemoved(e){const t=this.getChildrenMappedKey(e.key,e.rowGroupColumn),s=e.parent?.childrenMapped;return(s?!s[t]:!0)?!1:!!e.group&&(e.childrenAfterGroup?.length??0)===0}removeEmptyGroups(e,t){const s=this.selectionSvc,r=Array.from(e),i=this.nonLeafsById;do{e.clear();for(let n=0;n<r.length;++n){let o=r[n];for(;o;){const a=o.parent;if(o.destroyed){r[n]=a,o=a;continue}if(!a)break;if(!this.groupShouldBeRemoved(o)){o=a;continue}e.add(a),this.removeFromParent(o),o.isSelected()&&s?.removeFromSelection?.(o,"rowGroupChanged"),r[n]=a,i.delete(o.id),o._destroy(t),o=a}}vC(e)}while(e.size)}removeFromParent(e){const t=e.parent;if(t){const s=this.getChildrenMappedKey(e.key,e.rowGroupColumn),r=t.childrenMapped;r&&delete r[s]}return e.setRowTop(null),e.setRowIndex(null),t}addToParent(e,t){const s=t.childrenMapped??(t.childrenMapped={}),r=this.getChildrenMappedKey(e.key,e.rowGroupColumn);if(s[r]!==e){s[r]=e;let i=t.childrenAfterGroup;if(!i){t.childrenAfterGroup=i=[];const n=t.sibling;n&&(n.childrenAfterGroup=t.childrenAfterGroup)}i.push(e),ml(t,this.beans,!0),io(t)}}shotgunResetEverything(e){const t=this.nonLeafsById;for(const i of t.values())i.childrenAfterGroup=null,i.childrenMapped=null;e.leafGroup=!this.groupCols?.length,e.childrenAfterGroup=[],e.childrenMapped={},e.updateHasChildren();const s=e.sibling;s&&(s.childrenAfterGroup=e.childrenAfterGroup,s.childrenMapped=e.childrenMapped);const r=e._leafs;for(let i=0,n=r.length;i<n;++i)this.insertOneNode(e,r[i]);this.destroyStaleGroups(t)}destroyStaleGroups(e){const t=this.selectionSvc;for(const[s,r]of e)r.childrenAfterGroup===null&&(r.isSelected()&&t?.removeFromSelection?.(r,"rowGroupChanged"),e.delete(s),r._destroy(!1))}insertOneNode(e,t){let s=e;const{valueSvc:r,groupCols:i,groupEmpty:n}=this;if(!i)return;const o=i.length;for(let a=0;a<o;++a){const l=i[a],c=l.col;let u=r.getKeyForNode(c,t);if(u==null||u===""){if(!n)continue;u=""}const d=s.childrenMapped?.[this.getChildrenMappedKey(u,c)];if(d){s=d;continue}const h=s.level+1,p=h>=o-1,g=this.createGroup(s,l,u,h,p,t);this.addToParent(g,s),s=g}s.group||this.warn(184,{parentGroupData:s.data,childNodeData:t.data}),t.parent=s,t.level=s.level+1,s.childrenAfterGroup.push(t),s.updateHasChildren(),io(s)}createGroup(e,t,s,r,i,n){const o=t.col,a=(e.level>=0?e.id+"-":"row-group-")+(o.colId+"-"+s),l=this.nonLeafsById;let c=l.get(a),u=!0;if(c){if(c.childrenAfterGroup!==null)return c._expanded??(c._expanded=null),c;u=!1,io(c)}else c=new oK(this.beans),c.group=!0,c.key=s,c.id=a,c.aggData=null,l.set(a,c);const d=f=>{f.childrenAfterGroup=h,f.childrenMapped=p,f.parent=e,f.level=r,f.rowGroupIndex=r,f.leafGroup=i},h=[],p={};if(d(c),c.field=t.field??null,c.rowGroupColumn=o,c.groupValue=this.valueSvc.getValueFromData(o,n),c._expanded??(c._expanded=null),u)return c.setAllChildrenCount(0),c.updateHasChildren(),c;const g=c.sibling;return g&&d(g),c.dispatchRowEvent("hasChildrenChanged"),c}getChildrenMappedKey(e,t){return t?t.getId()+"-"+e:e}onShowRowGroupColsSetChanged(){const{rowModel:e,valueSvc:t}=this;for(const r of this.nonLeafsById.values()){r._groupData=void 0;const i=r.rowGroupColumn,n=i&&gC(r);r.groupValue=n&&t.getValueFromData(i,n)}const s=e.rootNode?._leafs;if(s)for(let r=0,i=s.length;r<i;++r){const n=s[r];n.parent._groupData=void 0}}},vC=e=>{for(const t of e){const s=t?.childrenAfterGroup;if(!s)continue;const r=s.length;let i=0;for(let n=0;n<r;++n){const o=s[n];o.parent===t&&!o.destroyed&&(i!==n&&(s[i]=o),++i)}r!==i&&(s.length=i,t.updateHasChildren(),io(t))}},io=e=>{for(;e._leafs!==void 0;){const t=e.parent;if(!t)break;e._leafs=void 0,e=t}};function dK(e,t){e.rowGroupColsSvc?.setColumns(t,"api")}function hK(e,t){e.rowGroupColsSvc?.removeColumns(t,"api")}function pK(e,t){e.rowGroupColsSvc?.addColumns(t,"api")}function gK(e,t,s){e.rowGroupColsSvc?.moveColumn(t,s,"api")}function fK(e){return e.rowGroupColsSvc?.columns??[]}var Lc={moduleName:"SharedRowGrouping",version:_,apiFunctions:{setRowGroupColumns:dK,removeRowGroupColumns:hK,addRowGroupColumns:pK,getRowGroupColumns:fK,moveRowGroupColumn:gK},dependsOn:[$,wc,nC,Mc,EW]},kc={moduleName:"RowGrouping",version:_,dynamicBeans:{groupStrategy:uK},rowModels:["clientSide"],dependsOn:[Lc,xc,Ys,oC,aC]},CC={moduleName:"RowGroupingPanel",version:_,beans:[OW],selectors:[_W],icons:{menuMoveLeft:"left",menuMoveRight:"right",pivotPanel:"pivot",rowGroupPanel:"group",panelDelimiter:"small-right",panelDelimiterRtl:"small-left"},dependsOn:[Al,VU,Ur]},bC={moduleName:"GroupFilter",version:_,userComponents:{agGroupColumnFilter:{classImp:KW,processParams:zW},agGroupColumnFloatingFilter:iK},beans:[qW],dynamicBeans:{agGroupColumnFilterHandler:jW},dependsOn:[$,BU]};import{BeanStub as mK,RowNode as SC,_addGridCommonParams as vK,_addRowHeightChangedListener as CK,_getRowHeightAsNumber as yC,_getRowIdCallback as bK}from"ag-grid-community";var SK=class extends oF{constructor(){super(...arguments),this.beanName="rowModel",this.hierarchical=!1,this.firstRow=-1,this.lastRow=-1,this.rowCount=-1,this.rowCountReady=!1,this.rowNodesByIndex={},this.rootNode=null,this.viewportChangedContext=!1}ensureRowHeightsValid(e,t,s,r){return!1}postConstruct(){const e=this.beans,t=new SC(e);this.rootNode=t,t.level=-1,this.rowHeight=yC(e),this.addManagedEventListeners({viewportChanged:this.onViewportChanged.bind(this)}),CK(this,()=>this.refreshRowHeight()),this.addManagedPropertyListener("viewportDatasource",()=>this.updateDatasource())}refreshRowHeight(){const e=yC(this.beans);e!==this.rowHeight&&(this.rowHeight=e,this.updateRowHeights())}start(){this.updateDatasource()}isLastRowIndexKnown(){return!0}destroy(){this.destroyDatasource(),super.destroy(),this.rootNode=null}destroyDatasource(){const e=this.datasource;e&&(e.destroy?.(),this.beans.rowRenderer.datasourceChanged(),this.firstRow=-1,this.lastRow=-1)}updateDatasource(){const e=this.gos.get("viewportDatasource");e&&this.setViewportDatasource(e)}getPageSize(){return this.gos.get("viewportRowModelPageSize")}getBufferSize(){return this.gos.get("viewportRowModelBufferSize")}calculateFirstRow(e){const t=this.getBufferSize(),s=this.getPageSize(),r=e-t;return r<0?0:Math.floor(r/s)*s}calculateLastRow(e){if(e===-1)return e;const t=this.getBufferSize(),s=this.getPageSize(),r=e+t,i=Math.ceil(r/s)*s,n=this.rowCount-1;return Math.min(i,n)}onViewportChanged(e){const t=this.calculateFirstRow(e.firstRow),s=this.calculateLastRow(e.lastRow);(this.firstRow!==t||this.lastRow!==s)&&(this.firstRow=t,this.lastRow=s,this.purgeRowsNotInViewport(),this.viewportChangedContext=!0,this.datasource?.setViewportRange(this.firstRow,this.lastRow),this.viewportChangedContext=!1)}purgeRowsNotInViewport(){const e=this.rowNodesByIndex;for(const t of Object.keys(e)){const s=Number.parseInt(t,10);if(s<this.firstRow||s>this.lastRow){if(this.isRowFocused(s)||this.beans.editSvc?.isRowEditing(e[s]))continue;delete e[s]}}}isRowFocused(e){const t=this.beans.focusSvc.getFocusCellToUseAfterRefresh();return!t||t.rowPinned!=null?!1:t.rowIndex===e}setViewportDatasource(e){this.destroyDatasource(),this.datasource=e,this.rowCount=-1,e.init?e.init(vK(this.gos,{setRowCount:this.setRowCount.bind(this),setRowData:this.setRowData.bind(this),getRow:this.getRow.bind(this)})):this.warn(226)}getType(){return"viewport"}getRow(e){return this.rowNodesByIndex[e]||(this.rowNodesByIndex[e]=this.createBlankRowNode(e)),this.rowNodesByIndex[e]}getRowNode(e){let t;return this.forEachNode(s=>{s.id===e&&(t=s)}),t}getRowCount(){return this.rowCount===-1?0:this.rowCount}getRowIndexAtPixel(e){return this.rowHeight!==0?Math.floor(e/this.rowHeight):0}resetRowHeights(){}onRowHeightChanged(){this.beans.pinnedRowModel?.ensureRowHeightsValid()}getRowBounds(e){const t=this.rowHeight;return{rowHeight:t,rowTop:t*e}}updateRowHeights(){const e=this.rowHeight;this.forEachNode(t=>{t.setRowHeight(e),t.setRowTop(e*t.rowIndex)}),this.eventSvc.dispatchEvent({type:"modelUpdated",newData:!1,newPage:!1,keepRenderedRows:!0,animate:!1})}getTopLevelRowCount(){return this.getRowCount()}getTopLevelRowDisplayedIndex(e){return e}isEmpty(){return this.rowCount>0}getOverlayType(){return null}isRowsToRender(){return this.rowCount>0}getNodesInRangeForSelection(e,t){const s=e.rowIndex,r=t.rowIndex,i=s<this.firstRow||s>this.lastRow,n=r<this.firstRow||r>this.lastRow;if(i||n)return[];const o=[],a=s<=r?s:r,l=s<=r?r:s;for(let c=a;c<=l;c++)o.push(this.rowNodesByIndex[c]);return o}forEachNode(e){let t=0;for(const s of Object.keys(this.rowNodesByIndex)){const r=Number.parseInt(s,10),i=this.rowNodesByIndex[r];e(i,t),t++}}setRowData(e){const t=bK(this.beans),s=new Map;if(t)for(const r of Object.values(this.rowNodesByIndex))s.set(r.id,r);for(let r=this.firstRow;r<=this.lastRow;r++){const i=e[r];if(!i)continue;let n,o;if(t?(n=t({data:i,rowPinned:void 0,level:0,parentKeys:void 0}),o=s.get(n)):o=this.rowNodesByIndex[r],o){const a=o.rowIndex;a!=null&&a!==r&&this.rowNodesByIndex[a]===o&&delete this.rowNodesByIndex[a],o.updateData(i),o.setRowIndex(r),o.setRowTop(this.rowHeight*r)}else o=this.createBlankRowNode(r),o.setDataAndId(i,n??r.toString()),this.beans.selectionSvc?.updateRowSelectable(o);this.rowNodesByIndex[r]=o}this.viewportChangedContext||this.eventSvc.dispatchEvent({type:"modelUpdated",newData:!1,newPage:!1,keepRenderedRows:!0,animate:!1})}createBlankRowNode(e){const t=new SC(this.beans),s=this.rowHeight;return t.setRowHeight(s),t.setRowTop(s*e),t.setRowIndex(e),t}setRowCount(e,t=!1){if(e===this.rowCount)return;this.rowCount=e;const s=this.eventSvc;this.rowCountReady||(this.rowCountReady=!0,s.dispatchEvent({type:"rowCountReady"})),s.dispatchEvent({type:"modelUpdated",newData:!1,newPage:!1,keepRenderedRows:t,animate:!1})}isRowPresent(e){return!!this.getRowNode(e.id)}},wC={moduleName:"ViewportRowModel",version:_,rowModels:["viewport"],beans:[SK],dependsOn:[$]};import{CsvExportModule as yK,HighlightChangesModule as wK,_KeyboardNavigationModule as xK}from"ag-grid-community";function FK(e,t){e.clipboardSvc?.copyToClipboard(t)}function TK(e,t){e.clipboardSvc?.cutToClipboard(t)}function AK(e,t){e.clipboardSvc?.copySelectedRowsToClipboard(t)}function PK(e,t){e.clipboardSvc?.copySelectedRangeToClipboard(t)}function RK(e){e.clipboardSvc?.copyRangeDown()}function MK(e){e.clipboardSvc?.pasteFromClipboard()}import{_exists as IK,_getActiveDomElement as xC,_getDeepActiveElement as EK,_getDocument as FC,_isNothingFocused as DK,_last as _c,_removeFromArray as LK}from"ag-stack";import{BeanStub as kK,_createCellId as qs,_forEachChangedGroupDepthFirst as _K,_getRowBelow as Gc,_getRowNode as Oc,_isClientSideRowModel as TC,_isSameRow as AC,isColumnSelectionCol as GK,isSpecialCol as OK}from"ag-grid-community";var no="paste",Nc="dragCopy",Bc="clipboard",Vc=`(?:[^>"']|"[^"]*"|'[^']*')*`,NK=String.raw`<(\/?)([a-z][\w:-]*)${Vc}>`;function PC(e){return new RegExp(String.raw`<${e}\b${Vc}>([\s\S]*?)<\/${e}\s*>`,"i")}var BK=PC("body"),VK=PC("table"),HK=new RegExp(String.raw`^<p\b${Vc}>\s*<br\s*\/?>\s*<\/p\s*>$`,"i");function Hc(e){return e?.length===1&&e[0]===""}function RC(e,t=","){const s=[],r=n=>n==="\r"||n===`
`;let i=!1;if(e==="")return[[""]];for(let n=0,o=0,a=0;a<e.length;a++){const l=e[a-1],c=e[a],u=e[a+1],d=()=>{s[n]||(s[n]=[]),s[n][o]||(s[n][o]="")};if(d(),c==='"'&&(i?u==='"'?(s[n][o]+='"',a++):i=!1:(l===void 0||l===t||r(l))&&(i=!0)),!i&&c!=='"'){if(c===t){o++,d();continue}else if(r(c)){o=0,n++,d(),c==="\r"&&u===`
`&&a++;continue}}s[n][o]+=c}return s}var UK=class extends aF{constructor(){super(...arguments),this.beanName="clipboardSvc",this.clientSideRowModel=null,this.gridCtrl=null,this.lastPasteOperationTime=0,this.navigatorApiFailed=!1}postConstruct(){const{gos:e,rowModel:t,ctrlsSvc:s}=this.beans;TC(e,t)&&(this.clientSideRowModel=t),s.whenReady(this,r=>{this.gridCtrl=r.gridCtrl})}destroy(){super.destroy(),this.clientSideRowModel=null,this.gridCtrl=null}pasteFromClipboard(){!this.gos.get("suppressClipboardApi")&&!this.navigatorApiFailed&&typeof navigator.clipboard?.readText=="function"?this.pasteFromClipboardApi(navigator.clipboard):this.pasteFromClipboardLegacy()}async pasteFromClipboardApi(e){let t=null;if(this.isHtmlReconciliationEnabled()&&typeof e.read=="function"){if(t=await this.tryReadItems(e,!0),!this.isAlive())return;if(!t||t.htmlReadFailed){const r=await this.tryReadItems(e,!1);if(!this.isAlive())return;(!t||r?.html)&&(t=r)}}let s=t?.data;if(s==null)try{s=await e.readText()}catch(r){this.isAlive()&&(this.warn(40,{error:r,method:"readText"}),this.navigatorApiFailed=!0,this.pasteFromClipboardLegacy());return}this.isAlive()&&this.processClipboardData(s,t?.html)}async tryReadItems(e,t){try{const s=await(t?e.read({unsanitized:["text/html"]}):e.read());return await this.readClipboardItems(s)}catch{return null}}async readClipboardItems(e){const t=e.find(r=>r.types.includes("text/plain"));if(!t)return{};const s=await(await t.getType("text/plain")).text();if(!t.types.includes("text/html"))return{data:s};try{return{data:s,html:await(await t.getType("text/html")).text()}}catch{return{data:s,htmlReadFailed:!0}}}pasteFromClipboardLegacy(){let e=!1,t;const s=r=>{const i=Date.now();i-this.lastPasteOperationTime<50&&(e=!0,r.preventDefault()),this.lastPasteOperationTime=i;const n=r.clipboardData;!e&&n&&this.isHtmlReconciliationEnabled()&&(t=n.getData("text/html"))};this.executeOnTempElement(r=>{r.addEventListener("paste",s),r.focus({preventScroll:!0})},r=>{e||this.processClipboardData(r.value,t)})}refocusLastFocusedCell(){const{focusSvc:e}=this.beans,t=e.getFocusedCell();t&&e.setFocusedCell({rowIndex:t.rowIndex,column:t.column,rowPinned:t.rowPinned,forceBrowserFocus:!0})}getClipboardDelimiter(){const e=this.gos.get("clipboardDelimiter");return IK(e)?e:"	"}isHtmlReconciliationEnabled(){return!this.gos.get("suppressLastEmptyLineOnPaste")}processClipboardData(e,t){if(e==null)return;const s=this.getClipboardDelimiter(),r=this.isHtmlReconciliationEnabled()?t:void 0;let i=RC(e,s);if(r&&s!=="	"&&/[\r\n]$/.test(e)&&Hc(_c(i))){const c=RC(e,"	");this.reconcileClipboardDataWithHtml(c,r)&&i.pop()}r&&s==="	"&&this.reconcileClipboardDataWithHtml(i,r);const n=this.gos.getCallback("processDataFromClipboard");if(n&&(i=n({data:i})),i==null)return;this.gos.get("suppressLastEmptyLineOnPaste")&&this.removeLastLineIfBlank(i);const{rangeSvc:o,editSvc:a}=this.beans,l=(c,u,d,h)=>{o?.isMoreThanOneCell()&&!this.hasOnlyOneValueToPaste(i)?this.pasteIntoActiveRange(i,c,u,h):this.pasteStartingFromFocusedCell(i,c,u,d,h),a?.stopEditing(void 0,{source:no})};this.doPasteOperation(l)}reconcileClipboardDataWithHtml(e,t){const s=this.getHtmlTableShape(t,e);if(!s)return!1;const r=e.length===s.rowCount+1&&Hc(_c(e));if(e.length>s.rowCount&&!r)return!1;const i=e.length-(r?2:1),n=s.boundaryRows;for(let o=0,a=n.length;o<a;++o){const{row:l,cellCount:c,hasNonEmptyMissingCell:u}=n[o];if(!(l<i)&&(c<(e[l]?.length??0)||u))return!1}r&&e.pop();for(let o=0,a=n.length;o<a;++o){const{row:l,cellCount:c}=n[o];if(l<i)continue;const u=e[l],d=c-(u?.length??0);if(u)for(let h=0;h<d;++h)u.push("");else e.push(Array(d).fill(""))}return r}getHtmlTableShape(e,t){const r=(BK.exec(e)?.[1]??e).replace(/<!--[\s\S]*?-->/g,"");if(r.includes("<!--"))return null;const i=VK.exec(r);if(!i||(r.slice(0,i.index)+r.slice(i.index+i[0].length)).trim())return null;const o=i[1],a=[],l=t.length-2;let c=0,u=!1,d,h=0,p=0,g=0,f=!1;const m=new RegExp(NK,"gi");let v=0;for(let C=m.exec(o);C;C=m.exec(o)){const b=o.indexOf("<",v);if(b>=0&&b<C.index||!d&&o.slice(v,C.index).trim())return null;v=m.lastIndex;const[y,S,w]=C,F=S==="/",T=w.toLowerCase();if(T==="table"||T==="script"||T==="style"||T==="textarea"||T==="template")return null;if(T==="td"||T==="th"){if(F){if(d!==T)return null;c>=l&&p>=g&&!this.isEmptyHtmlCell(o.slice(h,C.index))&&(f=!0),p++,d=void 0}else{if(!u||d||/\b(?:rowspan|colspan)\s*=/i.test(y)||/\/\s*>$/.test(y))return null;d=T,h=m.lastIndex}continue}if(T==="tr")if(F){if(!u||d||!p)return null;c>=l&&a.push({row:c,cellCount:p,hasNonEmptyMissingCell:f}),c++,u=!1}else{if(u||d)return null;u=!0,p=0,g=t[c]?.length??0,f=!1}}return!u&&!d&&c&&!o.slice(v).trim()?{rowCount:c,boundaryRows:a}:null}isEmptyHtmlCell(e){const t=e.trim();return!t||HK.test(t)}doPasteOperation(e){const t="clipboard",{eventSvc:s,focusSvc:r,rowRenderer:i,gos:n,editSvc:o}=this.beans;s.dispatchEvent({type:"pasteStart",source:t});const{clientSideRowModel:a}=this,l=a?.rootNode,c=l&&this.beans.changedPathFactory?.newPath(n.get("aggregateOnlyChangedColumns")),u={},d=[],h=r.getFocusedCell();o?.beginBulkWrite();try{e(u,d,h,c)}finally{o?.endBulkWrite()}const p=d.slice();c&&(a.doAggregate(c),_K(l,a.hierarchical,c,f=>{p.push(f)})),i.refreshCells({rowNodes:p}),this.dispatchFlashCells(u),this.fireRowChanged(d);const g=xC(this.beans);(DK(this.beans,g)||this.beans.eRootDiv.contains(g))&&this.refocusLastFocusedCell(),s.dispatchEvent({type:"pasteEnd",source:t})}getPreProcessRangeCallback(e){return t=>{const{rangeSvc:s}=this.beans;if(!s)return;const{rowDiff:r,colDiff:i}=this.getAdjustedRangeDimensionForPaste(t,e);r!==0&&s.extendRangeRowCountBy(t,r),i!==0&&s.extendRangeColumnCountBy(t,i)}}getAdjustedRangeDimensionForPaste(e,t){const s=this.beans.rangeSvc,r=t.length,i=s.getRangeRowCount(e),n=i>=r&&i%r===0,o=t[0].length,a=e.columns.length,l=a>=o&&a%o===0;return{rowDiff:n?0:r-i,colDiff:l?0:o-a}}pasteIntoActiveRange(e,t,s,r){let i=0,n=0;const o=(a,l,c,u)=>{if(u-i>=e.length){if(u%e.length!==0)return;i+=n,n=0}const h=e[u-i];s.push(l);const p=this.gos.getCallback("processCellFromClipboard"),g=c.columns,f=g.findIndex(m=>GK(m));f!==-1&&g.splice(f,1);for(let m=0;m<g.length;m++){const v=g[m];if(!v.isCellEditable(l)||v.isSuppressPaste(l))continue;let C=m;m>=h.length&&(C=m%h.length);const b=this.processCell(l,v,h[C],Nc,p,!0);l.setDataValue(v,b,no),r?.addCell(l.parent,v.getId());const{rowIndex:y,rowPinned:S}=a,w=qs({rowIndex:y,column:v,rowPinned:S});t[w]=!0}n++};this.iterateActiveRanges(o,!1,this.getPreProcessRangeCallback(e))}getDisplayedColumnsStartingAt(e){let t=e;const s=[],{visibleCols:r}=this.beans;for(;t&&OK(t);)t=r.getColAfter(t);for(;t!=null;)s.push(t),t=r.getColAfter(t);return s}pasteStartingFromFocusedCell(e,t,s,r,i){if(!r)return;const n={rowIndex:r.rowIndex,rowPinned:r.rowPinned},o=this.getDisplayedColumnsStartingAt(r.column);this.isPasteSingleValueIntoRange(e)?this.pasteSingleValueIntoRange(e,s,t,i):this.pasteMultipleValues(e,n,s,o,t,Bc,i)}isPasteSingleValueIntoRange(e){const t=this.beans.rangeSvc;return this.hasOnlyOneValueToPaste(e)&&!!t&&!t.isEmpty()}pasteSingleValueIntoRange(e,t,s,r){const i=e[0][0],n=(o,a,l)=>{t.push(a),l.columns.forEach(c=>this.updateCellValue(a,c,i,s,Bc,r))};this.iterateActiveRanges(n)}hasOnlyOneValueToPaste(e){return e.length===1&&e[0].length===1}copyRangeDown(){const{rangeSvc:e,gos:t,formula:s,valueSvc:r}=this.beans;if(!e||e.isEmpty())return;const i=[],n=(o,a,l,c)=>{const u=t.getCallback("processCellForClipboard"),d=t.getCallback("processCellFromClipboard"),h=(p,g,f)=>{const{columns:m}=f;i.length?(a.push(g),m.forEach((v,C)=>{if(!v.isCellEditable(g)||v.isSuppressPaste(g))return;v.allowFormula&&s?.isFormula(i[C])&&(i[C]=s?.updateFormulaByOffset({value:i[C],rowDelta:1}));const y=this.processCell(g,v,i[C],Nc,d,!0);g.setDataValue(v,y,no),c?.addCell(g.parent,v.getId());const{rowIndex:S,rowPinned:w}=p,F=qs({rowIndex:S,column:v,rowPinned:w});o[F]=!0})):m.forEach(v=>{const C=this.processCell(g,v,r.getValue(v,g,"batch"),Nc,u,!1,!0);i.push(C)})};this.iterateActiveRanges(h,!0)};this.doPasteOperation(n)}removeLastLineIfBlank(e){const t=_c(e);if(Hc(t)){if(e.length===1)return;LK(e,t)}}fireRowChanged(e){if(this.gos.get("editType")==="fullRow")for(const t of e)this.eventSvc.dispatchEvent({type:"rowValueChanged",node:t,data:t.data,rowIndex:t.rowIndex,rowPinned:t.rowPinned})}shouldSkipPasteRow(e,t,s){if(e.detail||e.footer)return!0;if(s&&e.group){for(const r of t)if(r.isCellEditable(e))return!1;return!0}return!1}pasteMultipleValues(e,t,s,r,i,n,o){let a=t;const l=this.beans,{gos:c}=l,u=this.clientSideRowModel!=null&&!c.get("enableGroupEdit")&&!c.get("treeData"),d=()=>{for(;a;){const h=Oc(l,a);if(a=Gc(l,{rowPinned:a.rowPinned,rowIndex:a.rowIndex}),h!=null&&!this.shouldSkipPasteRow(h,r,u))return h}return null};for(const h of e){const p=d();p&&(h.forEach((g,f)=>this.updateCellValue(p,r[f],g,i,n,o)),s.push(p))}}updateCellValue(e,t,s,r,i,n){if(!e||!t?.isCellEditable(e)||t?.isSuppressPaste(e))return;const o=this.processCell(e,t,s,i,this.gos.getCallback("processCellFromClipboard"),!0);e.setDataValue(t,o,no);const{rowIndex:a,rowPinned:l}=e,c=qs({rowIndex:a,column:t,rowPinned:l});r[c]=!0,n?.addCell(e.parent,t.getId())}copyToClipboard(e={}){this.copyOrCutToClipboard(e)}cutToClipboard(e={},t="api"){this.gos.get("suppressCutToClipboard")||(this.eventSvc.dispatchEvent({type:"cutStart",source:t}),this.copyOrCutToClipboard(e,!0),this.eventSvc.dispatchEvent({type:"cutEnd",source:t}))}copyOrCutToClipboard(e,t){let{includeHeaders:s,includeGroupHeaders:r}=e;const{gos:i,focusSvc:n}=this.beans;s??(s=i.get("copyHeadersToClipboard")),r??(r=i.get("copyGroupHeadersToClipboard"));const o={includeHeaders:s,includeGroupHeaders:r},a=i.get("rowSelection"),l=i.get("cellSelection");let c=null;this.shouldCopyCells(l,a)?(this.copySelectedRangeToClipboard(o),c=0):this.shouldCopyRows(a)?(this.copySelectedRowsToClipboard(o),c=1):n.isAnyCellFocused()&&(this.copyFocusedCellToClipboard(o),c=2),t&&c!==null&&this.clearCellsAfterCopy(c)}shouldCopyCells(e,t){const{rangeSvc:s,selectionSvc:r,gos:i}=this.beans;if(!s||s.isEmpty())return!1;if(e)return!(typeof t=="object"&&t.copySelectedRows&&!r?.isEmpty());{const n=i.get("suppressCopySingleCellRanges");return!(!s.isMoreThanOneCell()&&n)}}shouldCopyRows(e){const{selectionSvc:t,gos:s}=this.beans;return t?.isEmpty()??!0?!1:e&&typeof e!="string"?e.copySelectedRows??!1:!s.get("suppressCopyRowsToClipboard")}copiesRangeOrSelectedRows(){const e=this.gos,t=e.get("rowSelection");return this.shouldCopyCells(e.get("cellSelection"),t)||this.shouldCopyRows(t)}clearCellsAfterCopy(e){const t=this.beans,{rangeSvc:s,focusSvc:r,eventSvc:i}=t;if(i.dispatchEvent({type:"keyShortcutChangedCellStart"}),e===0)s.clearCellRangeCellValues({cellEventSource:"clipboardSvc"});else if(e===1)this.clearSelectedRows();else{const n=r.getFocusedCell();if(n==null)return;const o=Oc(t,n);o&&this.clearCellValue(o,n.column)}i.dispatchEvent({type:"keyShortcutChangedCellEnd"})}clearSelectedRows(){const{selectionSvc:e,visibleCols:t}=this.beans,s=e?.getSelectedNodes()??[],r=t.allCols;for(const i of s)for(const n of r)this.clearCellValue(i,n)}clearCellValue(e,t){if(!t.isCellEditable(e))return;const s=this.beans.valueSvc.getDeleteValue(t,e);e.setDataValue(t,s,"clipboardSvc")}iterateActiveRanges(e,t,s){const r=this.beans.rangeSvc;if(!r||r.isEmpty())return;const i=r.getCellRanges(),n=t?[i[0]]:i;for(const o of n)this.iterateActiveRange({cellRange:o,rowCallback:e,preProcessRange:s})}iterateActiveRange(e){const{cellRange:t,preProcessRange:s,rowCallback:r}=e,{beans:i}=this,{rangeSvc:n}=i;if(!n)return;s&&s(t);let o=n.getRangeStartRow(t);const a=n.getRangeEndRow(t);let l=0,c=!1;for(;!c&&o!=null;){const u=Oc(i,o);c=AC(o,a),r(o,u,t,l++),o=Gc(i,o)}}copySelectedRangeToClipboard(e={}){const t=this.beans.rangeSvc;if(!t||t.isEmpty())return;const s=t.areAllRangesAbleToMerge(),{data:r,cellsToFlash:i}=s?this.buildDataFromMergedRanges(t,e):this.buildDataFromRanges(t,e);this.copyDataToClipboard(r),this.dispatchFlashCells(i)}buildDataFromMergedRanges(e,t){const s=new Set,r=e.getCellRanges(),i=new Map,n=[],o={},a=TC(this.gos,this.beans.rowModel),l=new Set;a||this.beans.rowModel.forEachNode(d=>{l.add(d.rowIndex)});for(const d of r){d.columns.forEach(g=>s.add(g));const{rowPositions:h,cellsToFlash:p}=this.getRangeRowPositionsAndCellsToFlash(e,d);for(const g of h){const f=l.has(g.rowIndex);if(!a&&!f)continue;const m=`${g.rowIndex}-${g.rowPinned||"null"}`;i.get(m)||(i.set(m,!0),n.push(g))}Object.assign(o,p)}const c=Array.from(s);return c.sort((d,h)=>d.allColsIndex-h.allColsIndex),{data:this.buildExportParams({columns:c,rowPositions:n,includeHeaders:t.includeHeaders,includeGroupHeaders:t.includeGroupHeaders}),cellsToFlash:o}}buildDataFromRanges(e,t){const s=e.getCellRanges(),r=[],i={};for(const n of s){const{rowPositions:o,cellsToFlash:a}=this.getRangeRowPositionsAndCellsToFlash(e,n);Object.assign(i,a),r.push(this.buildExportParams({columns:n.columns,rowPositions:o,includeHeaders:t.includeHeaders,includeGroupHeaders:t.includeGroupHeaders}))}return{data:r.join(`
`),cellsToFlash:i}}getRangeRowPositionsAndCellsToFlash(e,t){const s=[],r={},i=e.getRangeStartRow(t),n=e.getRangeEndRow(t);let o=i;for(;o;){s.push(o);for(const a of t.columns){const{rowIndex:l,rowPinned:c}=o,u=qs({rowIndex:l,column:a,rowPinned:c});r[u]=!0}if(AC(o,n))break;o=Gc(this.beans,o)}return{rowPositions:s,cellsToFlash:r}}getCellsToFlashFromRowNodes(e){const t=this.beans.visibleCols.allCols,s={};for(let r=0;r<e.length;r++){const{level:i,rowIndex:n,rowPinned:o,sibling:a}=e[r],l=i===-1?a?.rowIndex:n;if(l!=null)for(let c=0;c<t.length;c++){const u=t[c],d=qs({rowIndex:l,column:u,rowPinned:o});s[d]=!0}}return s}copyFocusedCellToClipboard(e={}){let t=this.beans.focusSvc.getFocusedCell();if(t==null)return;t=this.beans.rowSpanSvc?.getCellStart(t)??t;const s=qs(t),r={rowPinned:t.rowPinned,rowIndex:t.rowIndex},i=t.column,n=this.buildExportParams({columns:[i],rowPositions:[r],includeHeaders:e.includeHeaders,includeGroupHeaders:e.includeGroupHeaders});this.copyDataToClipboard(n),this.dispatchFlashCells({[s]:!0})}copySelectedRowsToClipboard(e={}){const{columnKeys:t,includeHeaders:s,includeGroupHeaders:r}=e,i=this.buildExportParams({columns:t,includeHeaders:s,includeGroupHeaders:r});this.copyDataToClipboard(i);const n=this.beans.selectionSvc?.getSelectedNodes()??[];this.dispatchFlashCells(this.getCellsToFlashFromRowNodes(n))}buildExportParams(e){const{columns:t,rowPositions:s,includeHeaders:r=!1,includeGroupHeaders:i=!1}=e,{gos:n,csvCreator:o}=this.beans,a=({node:c,column:u})=>{const{value:d,valueFormatted:h}=this.beans.valueSvc.getValueForDisplay({column:u,node:c,includeValueFormatted:!0,from:"batch",transformValues:!0}),p=h??d??"",g=n.getCallback("processCellForClipboard");return g?g({column:u,node:c,value:p,type:Bc,formatValue:f=>this.beans.valueSvc.formatValue(u,c,f)??f,parseValue:f=>this.beans.valueSvc.parseValue(u,c,f,d)??f}):p},l={columnKeys:t,rowPositions:s,skipColumnHeaders:!r,skipColumnGroupHeaders:!i,suppressQuotes:!0,columnSeparator:this.getClipboardDelimiter(),onlySelected:!s,valueFrom:"batch",transformValues:!0,processCellCallback:n.getCallback("processCellForClipboard"),processRowGroupCallback:a,processHeaderCallback:n.getCallback("processHeaderForClipboard"),processGroupHeaderCallback:n.getCallback("processGroupHeaderForClipboard")};return o.getDataAsCsv(l,!0)}dispatchFlashCells(e){window.setTimeout(()=>{this.eventSvc.dispatchEvent({type:"flashCells",cells:e})},0)}processCell(e,t,s,r,i,n,o){const{valueSvc:a,formula:l}=this.beans;return i?i({column:t,node:e,value:s,type:r,formatValue:u=>a.formatValue(t,e??null,u)??u,parseValue:u=>a.parseValue(t,e??null,u,a.getValue(t,e,"edit"))}):n&&t.colDef.useValueParserForImport!==!1?a.parseValue(t,e??null,s,a.getValue(t,e,"edit")):o&&t.colDef.useValueFormatterForExport!==!1?l?.isFormula(s)?s:a.formatValue(t,e??null,s)??s:s}copyDataToClipboard(e){const t=this.gos.getCallback("sendToClipboard");if(t){t({data:e});return}if(!this.gos.get("suppressClipboardApi")&&navigator.clipboard){navigator.clipboard.writeText(e).catch(r=>{this.warn(40,{error:r,method:"writeText"}),this.copyDataToClipboardLegacy(e)});return}this.copyDataToClipboardLegacy(e)}copyDataToClipboardLegacy(e){this.executeOnTempElement(t=>{const s=FC(this.beans);t.value=e||" ",t.select(),t.focus({preventScroll:!0}),s.execCommand("copy")||this.warn(41)})}executeOnTempElement(e,t){if(!this.gridCtrl)return;const s=FC(this.beans),r=s.createElement("textarea"),i=r.style;i.width="1px",i.height="1px";const n=s.documentElement;i.top=n.scrollTop+"px",i.left=n.scrollLeft+"px",i.position="absolute",i.opacity="0";const o=this.gridCtrl.getGui(),a=EK(this.beans),l=()=>{a==null||xC(this.beans)!==r||(a.isConnected?a.focus({preventScroll:!0}):this.refocusLastFocusedCell())};o.appendChild(r);try{e(r)}catch{this.warn(42)}t?window.setTimeout(()=>{try{if(!this.isAlive())return;l(),t(r)}finally{r.remove()}},100):(l(),r.remove())}},MC={moduleName:"Clipboard",version:_,beans:[UK],apiFunctions:{copyToClipboard:FK,cutToClipboard:TK,copySelectedRowsToClipboard:AK,copySelectedRangeToClipboard:PK,copySelectedRangeDown:RK,pasteFromClipboard:MK},dependsOn:[$,yK,xK,wK]};import{CellStyleModule as zK,_SharedDragAndDropModule as WK}from"ag-grid-community";var KK='.ag-row-number-cell{background-color:var(--ag-header-background-color);border:none;color:var(--ag-header-text-color);font-family:var(--ag-header-font-family);font-size:var(--ag-header-font-size);font-variant-numeric:tabular-nums;font-weight:var(--ag-header-font-weight);overflow:hidden;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap;width:100%}:where(.ag-ltr) .ag-row-number-cell{text-align:right}:where(.ag-rtl) .ag-row-number-cell{text-align:left}.ag-row-numbers-resizer{bottom:-2px;cursor:row-resize;height:4px;position:absolute;width:100%}:where(.ag-ltr) .ag-row-numbers-resizer{left:0}:where(.ag-rtl) .ag-row-numbers-resizer{right:0}.ag-grid-pinned-bottom-rows .ag-row-numbers-resizer{bottom:unset;top:-2px}:where(.ag-row-number-header.ag-row-number-selection-enabled){cursor:cell}:where(.ag-row-hover:not(.ag-full-width-row)) .ag-row-number-cell{background-image:linear-gradient(var(--ag-row-header-hover-color),var(--ag-row-header-hover-color))}.ag-row-number-range-highlight{background-color:var(--ag-range-header-highlight-color)}.ag-row-number-range-selected{background-color:var(--ag-row-numbers-selected-color)}:where(.ag-ltr){:where(.ag-cell.ag-row-number-cell):not(.ag-cell-last-left-pinned),:where(.ag-row-number-floating-filter),:where(.ag-row-number-header):not(.ag-header-cell-last-left-pinned){border-right:var(--ag-pinned-column-border)}:where(.ag-cell.ag-row-number-cell.ag-row-number-selection-enabled){cursor:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbDpzcGFjZT0icHJlc2VydmUiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgc3R5bGU9ImZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxLjUiPjxwYXRoIGQ9Ik0zLjQ0NSA4LjkxMVY3LjQwOUg5Ljc1VjYuMDE0bDIuNTM1IDIuMTQ2LTIuNTM1IDIuMTQ2VjguOTExeiIgc3R5bGU9InN0cm9rZTojZmZmO3N0cm9rZS13aWR0aDouNDFweCIgdHJhbnNmb3JtPSJtYXRyaXgoMS41Nzg0IDAgMCAxLjg2NDI5IC00LjQxMyAtNy4yMTIpIi8+PC9zdmc+"),auto}}:where(.ag-rtl){:where(.ag-cell.ag-row-number-cell):not(.ag-cell-first-right-pinned),:where(.ag-row-number-floating-filter),:where(.ag-row-number-header):not(.ag-header-cell-first-right-pinned){border-left:var(--ag-pinned-column-border)}:where(.ag-cell.ag-row-number-cell.ag-row-number-selection-enabled){cursor:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbDpzcGFjZT0icHJlc2VydmUiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgc3R5bGU9ImZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxLjUiPjxwYXRoIGQ9Ik01Ljk3OSA4LjkxMXYxLjM5NUwzLjQ0NSA4LjE2bDIuNTM0LTIuMTQ2djEuMzk1aDYuMzA2djEuNTAyeiIgc3R5bGU9InN0cm9rZTojZmZmO3N0cm9rZS13aWR0aDouNDFweCIgdHJhbnNmb3JtPSJtYXRyaXgoMS41Nzg0IDAgMCAxLjg2NDI5IC00LjQxMyAtNy4yMTIpIi8+PC9zdmc+"),auto}}';import{Direction as $K}from"ag-stack";import{Component as jK,_getRowNode as YK}from"ag-grid-community";var qK={tag:"div",cls:"ag-row-numbers-resizer"},ZK=class extends lF{constructor(e){super(qK),this.cellCtrl=e,this.initialYPosition=-1,this.dragging=!1}postConstruct(){const{beans:e,cellCtrl:t}=this,{dragSvc:s,environment:r}=e;this.defaultRowHeight=r.getDefaultRowHeight(),s.addDragSource({dragStartPixels:0,eElement:this.getGui(),onDragStart:this.onDragStart.bind(this),onDragging:this.onDragging.bind(this),onDragStop:this.onDragStop.bind(this),onDragCancel:this.onDragCancel.bind(this),includeTouch:!0,stopPropagationForTouch:!0});const i=t.getRowPosition();this.node=YK(this.beans,i)}onDragStart(e){if(!this.node)return;const{beans:{ctrlsSvc:t,eventSvc:s}}=this;t.get("gridCtrl")?.setResizeCursor($K.Vertical,!0),this.dragging=!0,this.initialHeight=this.node.rowHeight,s.dispatchEvent({type:"rowResizeStarted",node:this.node,event:e,rowHeight:this.initialHeight})}onDragging(e){let{clientY:t}=e;if(this.cellCtrl.rowNode.rowPinned==="bottom"&&(t*=-1),this.initialYPosition===-1||!this.dragging){this.initialYPosition=t;return}const{beans:s,initialHeight:r,initialYPosition:i,defaultRowHeight:n,node:o}=this;if(r==null)return;const a=o?.rowHeight,l=Math.max(r-(i-t),n);if(a===l)return;o?.setRowHeight(l);const{rowRenderer:c,rowModel:u,pinnedRowModel:d}=s,h=!!o?.rowPinned;h&&c.redraw({afterScroll:!0}),(!h||d?.isManual())&&u.onRowHeightChanged({animate:!1})}onDragStop(e){this.beans.eventSvc.dispatchEvent({type:"rowResizeEnded",node:this.node,event:e,rowHeight:this.node?.rowHeight}),this.clearDragDetails(!0)}onDragCancel(){this.clearDragDetails(!0)}clearDragDetails(e){this.initialYPosition=-1,this.initialHeight=null,this.dragging=!1,e&&this.beans.ctrlsSvc.get("gridCtrl")?.setResizeCursor(!1)}destroy(){this.clearDragDetails(!1),this.node=void 0,super.destroy()}};import{_debounce as XK,_setAriaLabel as JK}from"ag-stack";import{KeyCode as Uc,ROW_NUMBERS_COLUMN_ID as QK,_BaseSingleColService as e$,_addGridCommonParams as t$,_convertColumnEventSourceType as s$,_createElement as r$,_getFirstRow as i$,_getRowNode as n$,_interpretAsRightClick as o$,_isRowNumbers as di,_selectAllCells as a$,isRowNumberCol as Zs}from"ag-grid-community";import{_isRowNumbers as l$}from"ag-grid-community";function IC(e){const t=l$(e);return!(!t||typeof t!="object"||!t.enableRowResizer)}var c$=class{constructor(e,t){this.beans=e,this.cellCtrl=t}refreshRowResizer(){!IC(this.beans)||!this.isRowResizeSupported(this.cellCtrl.rowNode)?this.removeRowResizerFromCellComp():this.addResizerToCellComp()}isRowResizeSupported(e){const{pinnedRowModel:t,rowModel:s,visibleCols:r}=this.beans,i=!!s.onRowHeightChanged;return r.autoHeightCols.length?(this.beans.log.warn(276),!1):e.rowPinned!=null?t?.isManual()?i:!0:i}addResizerToCellComp(){const{beans:e,cellCtrl:t}=this;let{rowResizer:s}=this;if(!s){if(s=e.registry.createDynamicBean("rowNumberRowResizer",!1,t),!s)return;this.rowResizer=e.context.createBean(s)}t.comp.setRowResizerElement(s.getGui())}removeRowResizerFromCellComp(){const{rowResizer:e,beans:{context:t},cellCtrl:s}=this;e&&(s.comp?.setRowResizerElement(null),this.rowResizer=t.destroyBean(e))}destroy(){this.removeRowResizerFromCellComp()}},u$=class extends cF{constructor(){super(...arguments),this.beanName="rowNumbersSvc",this.colKind="row-number",this.isIntegratedWithSelection=!1,this.rowNumberOverrides=null,this.lastColumnResized=0,this.autoSizedTextLength=0,this.boundValueGetter=e=>this.valueGetter(e),this.boundCellClass=e=>this.getCellClass(e)}wireBeans(e){this.rangeSvc=e.rangeSvc,this.ariaAnnounce=e.ariaAnnounce,this.visibleCols=e.visibleCols}postConstruct(){const e=XK(this,this.onRowsChanged.bind(this),10);this.addManagedEventListeners({columnResized:()=>{this.lastColumnResized=Date.now()},cellFocused:this.onGridCellFocused.bind(this),modelUpdated:t=>e(!t.keepRenderedRows),rangeSelectionChanged:()=>this.refreshCells(!0),pinnedRowsChanged:()=>e(!0)}),this.addManagedPropertyListeners(["rowNumbers","cellSelection"],t=>{this.updateColumns(t),this.refreshCells(!0)}),this.refreshSelectionIntegration(),this.registerRangeSelectionExtension()}shouldSkipColumn(e){return di(this.beans)&&Zs(e)}isAllColumnsSelectionCell(e){return di(this.beans)&&Zs(e.column)}isAllColumnsRange(e,t){return!di(this.beans)||t.length===0?!1:e.columns.length===t.length&&t.every(s=>e.columns.includes(s))}registerRangeSelectionExtension(){const e=this.rangeSvc;e&&(e.registerRangeSelectionExtension(this),this.addDestroyFunc(()=>e.unregisterRangeSelectionExtension?.(this)))}isEnabled(){return!!di(this.beans)}handleMouseDownOnCell(e,t){return!this.isIntegratedWithSelection||t.target.classList.contains("ag-row-numbers-resizer")?(this.rangeSvc&&t.preventDefault(),t.stopImmediatePropagation(),!1):(!t.shiftKey&&!o$(this.beans,t)&&this.focusFirstRenderedCellAtRowPosition(e),!0)}handleKeyDownOnCell(e,t){return this.isIntegratedWithSelection&&t.key===Uc.ENTER?(this.selectRowCells(e,t),t.preventDefault(),!0):!1}selectRowCells(e,t){const s=this.rangeSvc;s&&s.handleCellKeyboardSelect(t,e)}updateColumns(e){const t=s$(e.source),s=this.rowNumberOverrides;this.refreshSelectionIntegration();const r=this.column!==null,i=this.refreshCols();if(!i)r&&this.beans.colModel.refreshAll(t);else if(!r)this.beans.colModel.refreshAll(t),this.autoSize(i,!0);else{const{minWidth:n,maxWidth:o}=i;this.refreshColDef(t),(i.minWidth!==n||i.maxWidth!==o||d$(s,this.rowNumberOverrides))&&this.autoSize(i,!0)}}keepsColDefWidth(e,t,s){return t===s||t<e.minWidth}resetColumnState(e){const t=this.column;t&&(t.resetActualWidth(e),this.autoSizedTextLength=0)}destroy(){this.rowNumberOverrides=null,super.destroy()}setupForHeader(e){const{column:t,eGridHeader:s}=e.params;Zs(t)&&(JK(s,"Row Number"),e.addManagedElementListeners(s,{click:this.onHeaderClick.bind(this),focus:this.onHeaderFocus.bind(this)}))}onGridCellFocused(e){if(!this.isIntegratedWithSelection||e.rowIndex==null||!e.column)return;const t=this.beans.colModel.getCol(e.column);if(!t||!Zs(t))return;const r=this.getLocaleTextFunc()("ariaSelectAllRowCells","Press Enter to select all cells on this row");this.ariaAnnounce?.announceValue(r,"ariaSelectAllRowCells")}createRowNumbersRowResizerFeature(e){return IC(this.beans)?new c$(this.beans,e):void 0}refreshSelectionIntegration(){const e=this.gos.get("cellSelection");this.refreshRowNumberOverrides(),this.isIntegratedWithSelection=!!this.rangeSvc&&!!e&&!this.isSuppressCellSelectionIntegration}refreshRowNumberOverrides(){const e=di(this.beans);if(this.rowNumberOverrides={},this.isSuppressCellSelectionIntegration=!1,!e||typeof e!="object")return;e.suppressCellSelectionIntegration&&(this.isSuppressCellSelectionIntegration=!0);const t=["contextMenuItems","context","onCellClicked","onCellContextMenu","onCellDoubleClicked","headerTooltip","headerStyle","headerComponent","headerComponentParams","suppressHeaderKeyboardEvent","suppressNavigable","tooltip","tooltipField","tooltipValueGetter","tooltipComponent","tooltipComponentParams","tooltipComponentSelector","valueGetter","valueFormatter","width","maxWidth","minWidth","resizable","cellRenderer","cellRendererSelector","cellRendererParams"];for(const s of t)e[s]!=null&&(this.rowNumberOverrides[s]=e[s])}onHeaderFocus(){if(!this.isIntegratedWithSelection)return;const t=this.getLocaleTextFunc()("ariaSelectAllCells","Press Space or Enter to select all cells");this.ariaAnnounce?.announceValue(t,"ariaSelectAllCells")}handleKeyDownOnHeader(e,t){!this.isIntegratedWithSelection||t.key!==Uc.SPACE&&t.key!==Uc.ENTER||!Zs(e)||(t.preventDefault(),this.selectAllCellsFromHeader())}onHeaderClick(e){Date.now()-this.lastColumnResized<100||!this.isIntegratedWithSelection||this.column?.isResizing()||this.focusAllCellsFromHeaderClick()}selectAllCellsFromHeader(){a$(this.beans)}focusAllCellsFromHeaderClick(){this.selectAllCellsFromHeader(),this.focusFirstRenderedCellAtRowPosition()}onRowsChanged(e){const t=this.column;t&&(this.autoSize(t,e),this.refreshCells(!1))}refreshCells(e){const t=this.column;t&&this.beans.rowRenderer.refreshCells({columns:[t],force:e})}autoSize(e,t){if(e.isUserSized())return;const s=this.getLargestRowNumberText(e);if(!t&&s.length<=this.autoSizedTextLength)return;this.autoSizedTextLength=s.length;const r=this.beans.autoWidthCalc?.getPreferredWidthForElements([this.createDummyElement(s)],2);if(r==null)return;const i=Math.max(r,e.minWidth,this.rowNumberOverrides?.width??0),n=Math.min(i,e.maxWidth);if(n===e.actualWidth)return;const o=[e];this.beans.colResize?.setClampedColumnWidths(o,[n],!0,"rowNumbersService",o)}getLargestRowNumberText(e){let t=String(this.beans.rowModel.getRowCount()+1);const s=this.rowNumberOverrides;if(typeof s?.valueFormatter=="function"){const r=t$(this.gos,{data:void 0,value:t,node:null,column:e,colDef:e.colDef});t=s.valueFormatter(r)??""}return t}createDummyElement(e){const t=r$({tag:"div",cls:"ag-cell-value ag-cell ag-row-number-cell"});return t.textContent=e,t}createColDef(){const e=this.gos.get("enableRtl");return{minWidth:60,initialWidth:60,resizable:!1,valueGetter:this.boundValueGetter,...this.rowNumberOverrides,colId:QK,chartDataType:"excluded",suppressHeaderMenuButton:!0,sortable:!1,suppressMovable:!0,lockPinned:!0,pinned:e?"right":"left",lockPosition:e?"right":"left",editable:!1,suppressFillHandle:!0,suppressAutoSize:!0,suppressSizeToFit:!0,suppressHeaderContextMenu:!0,headerClass:this.getHeaderClass(),cellClass:this.boundCellClass,cellAriaRole:"rowheader"}}valueGetter(e){const t=e.node,s=this.beans.formula?.active,r=t?.pinnedSibling;if(t?.rowPinned&&r){const i=s?r.formulaRowIndex:r.rowIndex;return`${i==null?"-":i+1}`}return String(((s?t?.formulaRowIndex:t?.rowIndex)||0)+1)}getHeaderClass(){const e=["ag-row-number-header"];return this.isIntegratedWithSelection&&e.push("ag-row-number-selection-enabled"),e}getCellClass(e){const t=this.rangeSvc,{node:s}=e,r=["ag-row-number-cell"],i=this.gos.get("cellSelection");if(!t||!i)return r;this.isIntegratedWithSelection&&r.push("ag-row-number-selection-enabled");const n=t.getCellRanges();if(!n.length)return r;const o=this.visibleCols.allCols.length-1,a=typeof i=="object"&&i.enableHeaderHighlight;for(const l of n)t.isRowInRange({rowIndex:s.rowIndex,rowPinned:s.rowPinned},l)&&(a&&r.push("ag-row-number-range-highlight"),l.columns.length===o&&r.push("ag-row-number-range-selected"));return r}focusFirstRenderedCellAtRowPosition(e){const t=this.beans.editSvc;if(t?.isEditing()&&t.isRangeSelectionEnabledWhileEditing?.()||!e&&(e=i$(this.beans),!e))return;const s=this.beans,r=this.visibleCols,i=this.gos.get("enableRtl")?r.rightCols:r.leftCols;let n;if(i.length==1){const c=n$(s,e);if(!c)return;n=s.colViewport.getColsWithinViewport(c,null)}else n=i;const o=n.find(c=>!Zs(c));if(!o)return;const{rowPinned:a,rowIndex:l}=e;setTimeout(()=>{this.isAlive()&&s.focusSvc.setFocusedCell({rowIndex:l,rowPinned:a,column:o,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!0})})}};function d$(e,t){return e?.width!==t?.width||e?.valueFormatter!==t?.valueFormatter}var zc={moduleName:"RowNumbers",version:_,beans:[u$],dynamicBeans:{rowNumberRowResizer:ZK},dependsOn:[$,zK,WK],css:[KK]};import{_ColumnFilterModule as EC}from"ag-grid-community";import{RefPlaceholder as DC}from"ag-stack";import{Component as h$}from"ag-grid-community";import{RefPlaceholder as LC,_debounce as p$,_setDisplayed as hi}from"ag-stack";import{AgInputTextFieldSelector as g$,Component as f$,_createIconNoSpan as Wc}from"ag-grid-community";var m$={tag:"div",cls:"ag-filter-toolpanel-search",role:"presentation",children:[{tag:"div",ref:"eExpand",cls:"ag-filter-toolpanel-expand"},{tag:"ag-input-text-field",ref:"eFilterTextField",cls:"ag-filter-toolpanel-search-input"}]},v$=class extends uF{constructor(){super(...arguments),this.eExpand=LC,this.eFilterTextField=LC}postConstruct(){this.setTemplate(m$,[g$]);const e=this.getLocaleTextFunc();this.eFilterTextField.setClearButtonEnabled(!0).setSearchIcon(!0).setInputAriaLabel(e("ariaFilterColumnsInput","Filter Columns Input")).onValueChange(this.onSearchTextChanged.bind(this)).onValueClear(()=>this.onSearchTextCleared()),this.createExpandIcons(),this.setExpandState(0),this.addManagedElementListeners(this.eExpand,{click:this.onExpandClicked.bind(this)}),this.addManagedEventListeners({newColumnsLoaded:this.showOrHideOptions.bind(this)})}init(e){this.params=e,this.eFilterTextField.setAutoComplete(e.browserAutoComplete),this.beans.colModel.ready&&this.showOrHideOptions()}createExpandIcons(){const{eExpand:e,beans:t}=this;e.appendChild(this.eExpandChecked=Wc("accordionOpen",t)),e.appendChild(this.eExpandUnchecked=Wc("accordionClosed",t)),e.appendChild(this.eExpandIndeterminate=Wc("accordionIndeterminate",t))}showOrHideOptions(){const{params:e,eFilterTextField:t}=this,s=!e.suppressFilterSearch,r=!e.suppressExpandAll,i=this.getLocaleTextFunc();t.setInputPlaceholder(i("searchOoo","Search..."));const n=a=>a.getOriginalParent()&&a.isFilterAllowed(),o=this.beans.colModel.getCols().some(n);hi(t.getGui(),s),hi(this.eExpand,r&&o)}onSearchTextChanged(){this.onSearchTextChangedDebounced||(this.onSearchTextChangedDebounced=p$(this,()=>this.dispatchLocalEvent({type:"searchChanged",searchText:this.eFilterTextField.getValue()}),300)),this.searchTextChangedTimeout=this.onSearchTextChangedDebounced()}onSearchTextCleared(){clearTimeout(this.searchTextChangedTimeout),this.dispatchLocalEvent({type:"searchChanged",searchText:this.eFilterTextField.getValue()})}onExpandClicked(){const e=this.currentExpandState===0?{type:"collapseAll"}:{type:"expandAll"};this.dispatchLocalEvent(e)}setExpandState(e){this.currentExpandState=e,hi(this.eExpandChecked,e===0),hi(this.eExpandUnchecked,e===1),hi(this.eExpandIndeterminate,e===2)}},C$={selector:"AG-FILTERS-TOOL-PANEL-HEADER",component:v$};import{_clearElement as b$,_exists as Kc,_getActiveDomElement as S$,_setAriaLabel as y$}from"ag-stack";import{Component as w$,_addGridCommonParams as x$,_mergeDeep as F$,isProvidedColumnGroup as kC}from"ag-grid-community";import{RefPlaceholder as pi,_clearElement as T$,_setAriaExpanded as _C,_setAriaLabel as A$,_setAriaRole as P$,_setDisplayed as Jt}from"ag-stack";import{Component as R$,FilterComp as M$,KeyCode as GC,_createElement as I$,_createIconNoSpan as $c}from"ag-grid-community";var E$={tag:"div",cls:"ag-filter-toolpanel-instance",children:[{tag:"div",ref:"eFilterToolPanelHeader",cls:"ag-filter-toolpanel-header ag-filter-toolpanel-instance-header",role:"button",attrs:{"aria-expanded":"false"},children:[{tag:"div",ref:"eExpand",cls:"ag-filter-toolpanel-expand"},{tag:"span",ref:"eFilterName",cls:"ag-header-cell-text"},{tag:"span",ref:"eFilterIcon",cls:"ag-header-icon ag-filter-icon ag-filter-toolpanel-instance-header-icon"}]},{tag:"div",ref:"agFilterToolPanelBody",cls:"ag-filter-toolpanel-instance-body ag-filter"}]},OC=class extends dF{constructor(e,t){super(E$),this.hideHeader=e,this.expandedCallback=t,this.eFilterToolPanelHeader=pi,this.eFilterName=pi,this.agFilterToolPanelBody=pi,this.eFilterIcon=pi,this.eExpand=pi,this.expanded=!1}postConstruct(){const{beans:e,eExpand:t,eFilterIcon:s}=this,r=$c("accordionOpen",e);this.eExpandChecked=r;const i=$c("accordionClosed",e);this.eExpandUnchecked=i,t.appendChild(r),t.appendChild(i);const n=this.getLocaleTextFunc();A$(s,n("ariaFilterActive","Filter Active")),P$(s,"img")}setColumn(e){this.column=e;const{eFilterToolPanelHeader:t,eFilterIcon:s,eExpandChecked:r,hideHeader:i}=this;this.refreshFilterName(),this.addManagedListeners(e,{headerNameChanged:this.refreshFilterName.bind(this)}),this.addManagedListeners(t,{click:this.toggleExpanded.bind(this),keydown:this.onKeyDown.bind(this)}),this.addManagedEventListeners({filterOpened:this.onFilterOpened.bind(this)}),this.addInIcon("filterActive",s,e),Jt(s,this.isFilterActive()),Jt(r,!1),i?(Jt(t,!1),t.removeAttribute("tabindex")):t.setAttribute("tabindex","0"),this.addManagedListeners(e,{filterChanged:this.onFilterChanged.bind(this)})}refreshFilterName(){this.eFilterName.innerText=this.getColumnFilterName()||""}onKeyDown(e){const{key:t}=e,{ENTER:s,SPACE:r,LEFT:i,RIGHT:n}=GC;t!==s&&t!==r&&t!==i&&t!==n||(e.preventDefault(),t===s||t===r?this.toggleExpanded():t===GC.LEFT?this.collapse():this.expand())}getColumn(){return this.column}getColumnFilterName(){return this.beans.colNames.getDisplayNameForColumn(this.column,"filterToolPanel",!1)}addCssClassToTitleBar(e){this.eFilterToolPanelHeader.classList.add(e)}addInIcon(e,t,s){if(t==null)return;const r=$c(e,this.beans,s);t.appendChild(r)}isFilterActive(){return!!this.beans.colFilter?.isFilterActive(this.column)}onFilterChanged(){Jt(this.eFilterIcon,this.isFilterActive()),this.dispatchLocalEvent({type:"filterChanged"})}toggleExpanded(){this.expanded?this.collapse():this.expand()}expand(){this.expanded||(this.expanded=!0,_C(this.eFilterToolPanelHeader,!0),Jt(this.eExpandChecked,!0),Jt(this.eExpandUnchecked,!1),this.addFilterElement(),this.expandedCallback())}addFilterElement(e){const t=I$({tag:"div",cls:"ag-filter-toolpanel-instance-filter"}),s=this.createManagedBean(new M$(this.column,"TOOLBAR"));this.filterComp=s,s.hasFilter()&&s.getFilter()?.then(r=>{this.underlyingFilter=r,r&&(t.appendChild(s.getGui()),this.agFilterToolPanelBody.appendChild(t),s.afterGuiAttached({container:"toolPanel",suppressFocus:e}))})}collapse(){if(!this.expanded)return;this.expanded=!1,_C(this.eFilterToolPanelHeader,!1),this.removeFilterElement(),Jt(this.eExpandChecked,!1),Jt(this.eExpandUnchecked,!0);const e=this.filterComp;e?.afterGuiDetached(),this.destroyBean(e),this.expandedCallback()}removeFilterElement(){T$(this.agFilterToolPanelBody)}isExpanded(){return this.expanded}onPanelHidden(){if(!this.expanded)return;const e=this.underlyingFilter;e&&e.afterGuiDetached?.()}onFilterOpened(e){e.source==="COLUMN_MENU"&&e.column===this.column&&this.expanded&&this.collapse()}};import{RefPlaceholder as D$,_clearElement as L$,_setAriaLabel as k$,_setAriaRole as _$}from"ag-stack";import{Component as G$,_addGridCommonParams as O$,_createIconNoSpan as N$,_getHeaderTooltipComponentDefinition as B$,_getShouldDisplayTooltip as V$,_isHeaderNameChangeForGroup as H$,_resolveHeaderTooltipValue as U$,isProvidedColumnGroup as Xs}from"ag-grid-community";var Qt=class extends hF{constructor(e,t,s,r,i){super(),this.columnGroup=e,this.childFilterComps=t,this.expandedCallback=s,this.depth=r,this.showingColumn=i,this.filterGroupComp=D$}get callbackColumn(){const{columnGroup:e}=this;return Xs(e)?Vs(this.beans,e):e}postConstruct(){const e={cssIdentifier:"filter-toolpanel",direction:"vertical"};this.setTemplate({tag:"div",cls:"ag-filter-toolpanel-group-wrapper",children:[{tag:"ag-group-component",ref:"filterGroupComp"}]},[ee],{filterGroupComp:e}),this.setGroupTitle();const{filterGroupComp:t,depth:s,childFilterComps:r,gos:i}=this;t.setAlignItems("stretch"),t.addCss(`ag-filter-toolpanel-group-level-${s}`),t.getGui().style.setProperty("--ag-indentation-level",String(s)),t.addCssClassToTitleBar(`ag-filter-toolpanel-group-level-${s}-header`);for(const a of r)t.addItem(a),a.addCssClassToTitleBar(`ag-filter-toolpanel-group-level-${s+1}-header`),a.getGui().style.setProperty("--ag-indentation-level",String(s+1));const n=this.showingColumn?this.columnGroup:void 0,o=()=>n?.colDef??this.columnGroup.getColGroupDef();this.tooltipFeature=this.createOptionalManagedBean(this.beans.tooltipSvc?.createTooltip({getGui:()=>t.getTitleBarGui(),getTooltipComponentDefinition:()=>B$(o()),getLocation:()=>"filterToolPanelColumnGroup",getTooltipValue:()=>{const a=o(),l=this.filterGroupName;return U$(a,O$(i,{location:"filterToolPanelColumnGroup",colDef:a,column:this.callbackColumn,value:l,valueFormatted:l}))},shouldDisplayTooltip:V$(i,()=>t.getGui().querySelector(".ag-group-title")),getAdditionalParams:()=>{const a=o();return{...a?{colDef:a}:{},column:this.callbackColumn,valueFormatted:this.filterGroupName}}})),this.refreshFilterClass(),this.addExpandCollapseListeners(),this.addFilterChangedListeners(),this.addHeaderNameChangedListener(),this.setupTooltip(),this.addInIcon("filterActive")}setupTooltip(){const e=()=>this.tooltipFeature?.refreshTooltip();e(),this.addManagedEventListeners({newColumnsLoaded:e})}addCssClassToTitleBar(e){this.filterGroupComp.addCssClassToTitleBar(e)}onPanelHidden(){for(const e of this.childFilterComps)e.onPanelHidden()}isColumnGroup(){return Xs(this.columnGroup)}isExpanded(){return this.filterGroupComp.isExpanded()}getChildren(){return this.childFilterComps}getFilterGroupName(){return this.filterGroupName??""}getFilterGroupId(){return this.columnGroup.getId()}hideGroupItem(e,t){this.filterGroupComp.hideItem(e,t)}hideGroup(e){this.setDisplayed(!e)}addInIcon(e){const t=N$(e,this.beans);if(t){t.classList.add("ag-filter-toolpanel-group-instance-header-icon");const s=this.getLocaleTextFunc();k$(t,s("ariaFilterActive","Filter Active")),_$(t,"img")}this.filterGroupComp.addTitleBarWidget(t)}forEachToolPanelFilterChild(e){for(const t of this.childFilterComps)t instanceof OC&&e(t)}addExpandCollapseListeners(){const e=this.isColumnGroup()?()=>this.expandedCallback():()=>this.forEachToolPanelFilterChild(s=>s.expand()),t=this.isColumnGroup()?()=>this.expandedCallback():()=>this.forEachToolPanelFilterChild(s=>s.collapse());this.addManagedListeners(this.filterGroupComp,{expanded:e,collapsed:t})}getColumns(){return Xs(this.columnGroup)?this.columnGroup.getLeafColumns():[this.columnGroup]}addFilterChangedListeners(){for(const e of this.getColumns())this.addManagedListeners(e,{filterChanged:()=>this.refreshFilterClass()});Xs(this.columnGroup)||this.addManagedEventListeners({filterOpened:this.onFilterOpened.bind(this)})}addHeaderNameChangedListener(){const{columnGroup:e}=this,t=()=>{this.setGroupTitle(),this.tooltipFeature?.refreshTooltip()};if(!Xs(e)){this.addManagedListeners(e,{headerNameChanged:t});return}const s=e.getGroupId(),r=cg(this.beans,e);this.addManagedEventListeners({columnHeaderNameChanged:i=>{H$(i,s)&&(t(),r())}})}refreshFilterClass(){const e=this.getColumns(),t=()=>e.some(s=>s.isFilterActive());this.filterGroupComp.toggleCss("ag-has-filter",t())}onFilterOpened(e){e.source==="COLUMN_MENU"&&e.column===this.columnGroup&&this.isExpanded()&&this.collapse()}expand(){this.filterGroupComp.toggleGroupExpand(!0)}collapse(){this.filterGroupComp.toggleGroupExpand(!1)}setGroupTitle(){const e=this.columnGroup,t=Xs(e)?this.getColumnGroupName(e):this.getColumnName(e);this.filterGroupName=t,this.filterGroupComp.setTitle(t||"")}getColumnGroupName(e){return wn(this.beans,e,"filterToolPanel")}getColumnName(e){return this.beans.colNames.getDisplayNameForColumn(e,"filterToolPanel",!1)}destroyFilters(){this.childFilterComps=this.destroyBeans(this.childFilterComps),L$(this.getGui())}destroy(){this.destroyFilters(),super.destroy()}},z$=class extends pF{constructor(){super({tag:"div",cls:"ag-filter-list-panel",role:"group"}),this.initialised=!1,this.pendingStateRestore=!1,this.isRestoringState=!1,this.filterGroupComps=[],this.suppressOnColumnsChanged=!1,this.onColumnsChangedPending=!1}wireBeans(e){this.colModel=e.colModel}postConstruct(){this.noMatchesComp=this.createManagedBean(new ul("ag-filter-toolpanel-no-matches")),this.appendChild(this.noMatchesComp)}init(e,t=!1){this.initialised=!0,this.pendingStateRestore=t;const s=x$(this.gos,{suppressExpandAll:!1,suppressFilterSearch:!1,suppressSyncLayoutWithGrid:!1});F$(s,e),this.params=s,s.suppressSyncLayoutWithGrid||this.addManagedEventListeners({columnMoved:()=>this.onColumnsChanged()}),this.addManagedEventListeners({newColumnsLoaded:()=>this.onColumnsChanged(),toolPanelVisibleChanged:r=>{r.key==="filters"&&!r.visible&&this.onPanelHidden()},dragStarted:()=>{this.suppressOnColumnsChanged=!0},dragStopped:()=>{this.suppressOnColumnsChanged=!1,this.onColumnsChangedPending&&(this.onColumnsChangedPending=!1,this.onColumnsChanged())}}),this.colModel.ready&&this.onColumnsChanged()}onColumnsChanged(){if(this.suppressOnColumnsChanged){this.onColumnsChangedPending=!0;return}const e=this.colModel.pivotMode;!this.params.suppressSyncLayoutWithGrid&&!e?this.syncFilterLayout():this.buildTreeFromProvidedColumnDefs(),this.refreshAriaLabel()}syncFilterLayout(){ag(this.colModel,this.setFiltersLayout.bind(this)),this.refreshAriaLabel()}buildTreeFromProvidedColumnDefs(){const e=this.colModel.colDefTree;this.recreateFilters(e)}setFiltersLayout(e){const t=og(this.beans,e);this.recreateFilters(t)}recreateFilters(e){const t=S$(this.beans);this.isRestoringState=this.pendingStateRestore&&!!this.params.initialState,this.pendingStateRestore=!1;const s=this.getExpansionState();this.destroyFilters();const r=this.recursivelyAddComps(e,0,s);this.filterGroupComps=r;const i=r.length;if(i){for(const o of r)this.appendChild(o);this.setFirstAndLastVisible(0,i-1)}this.appendChild(this.noMatchesComp);const n=this.searchFilterText;Kc(n)?this.searchFilters(n):this.noMatchesComp.setNoMatches(!1,!1),this.fireExpandedEvent(),this.getGui().contains(t)&&t.focus(),this.isRestoringState=!1,this.refreshAriaLabel()}recursivelyAddComps(e,t,s){return e.map(r=>{if(kC(r))return this.recursivelyAddFilterGroupComps(r,t,s)?.flatMap(l=>l)??[];const i=r;if(!this.shouldDisplayFilter(i))return[];const n=t===0,o=new OC(n,()=>this.onFilterExpanded());if(this.createBean(o),o.setColumn(i),s.get(i.getId())&&o.expand(),t>0)return o;const a=this.createBean(new Qt(i,[o],this.onGroupExpanded.bind(this),t,!0));return a.addCssClassToTitleBar("ag-filter-toolpanel-header"),s.get(a.getFilterGroupId())||a.collapse(),a}).flatMap(r=>r)}refreshAriaLabel(){const e=this.getLocaleTextFunc(),t=e("ariaFilterPanelList","Filter List"),s=e("filters","Filters"),l=this.getGui().querySelectorAll(".ag-filter-toolpanel-group-item:not(.ag-filter-toolpanel-group-wrapper, .ag-hidden)").length;y$(this.getAriaElement(),`${t} ${l} ${s}`)}recursivelyAddFilterGroupComps(e,t,s){if(!this.filtersExistInChildren(e.getChildren()))return;if(e.getColGroupDef()?.suppressFiltersToolPanel)return[];const i=e.isPadding()?t:t+1,n=this.recursivelyAddComps(e.getChildren(),i,s).flatMap(l=>l);if(e.isPadding())return n;const o=new Qt(e,n,this.onGroupExpanded.bind(this),t,!1);this.createBean(o),o.addCssClassToTitleBar("ag-filter-toolpanel-header");const a=s.get(o.getFilterGroupId());return(this.isRestoringState&&!a||a===!1)&&o.collapse(),[o]}filtersExistInChildren(e){return e.some(t=>kC(t)?this.filtersExistInChildren(t.getChildren()):this.shouldDisplayFilter(t))}shouldDisplayFilter(e){const t=e.colDef?.suppressFiltersToolPanel;return e.isFilterAllowed()&&!t}getExpansionState(){const e=new Map;if(this.isRestoringState){const{expandedColIds:s,expandedGroupIds:r}=this.params.initialState;for(const i of s)e.set(i,!0);for(const i of r)e.set(i,!0);return e}const t=s=>{e.set(s.getFilterGroupId(),s.isExpanded());for(const r of s.getChildren())r instanceof Qt?t(r):e.set(r.getColumn().getId(),r.isExpanded())};return this.filterGroupComps.forEach(t),e}refresh(){}setVisible(e){super.setDisplayed(e),e&&!this.initialised&&this.init(this.params,!0)}expandFilterGroups(e,t){const s=[],r=i=>{const n=i.getFilterGroupId();(!t||t.includes(n))&&(e&&i.isColumnGroup()?i.expand():i.collapse(),s.push(n));for(const a of i.getChildren())a instanceof Qt&&r(a)};if(this.filterGroupComps.forEach(r),this.onGroupExpanded(),t){const i=t.filter(n=>s.indexOf(n)<0);i.length>0&&this.beans.log.warn(166,{unrecognisedGroupIds:i})}}expandFilters(e,t){const s=[],r=i=>{if(i instanceof Qt){let a=!1;for(const l of i.getChildren())r(l)&&(e?(i.expand(),a=!0):i.isColumnGroup()||i.collapse());return a}const n=i.getColumn().colId,o=!t||t.includes(n);return o&&(e?i.expand():i.collapse(),s.push(n)),o};if(this.filterGroupComps.forEach(r),this.onGroupExpanded(),t){const i=t.filter(n=>s.indexOf(n)<0);i.length>0&&this.beans.log.warn(167,{unrecognisedColIds:i})}}onGroupExpanded(){this.fireExpandedEvent()}onFilterExpanded(){this.dispatchLocalEvent({type:"filterExpanded"})}fireExpandedEvent(){let e=0,t=0;const s=i=>{if(i.isColumnGroup()){i.isExpanded()?e++:t++;for(const n of i.getChildren())n instanceof Qt&&s(n)}};this.filterGroupComps.forEach(s);let r;e>0&&t>0?r=2:t>0?r=1:r=0,this.dispatchLocalEvent({type:"groupExpanded",state:r})}performFilterSearch(e){this.searchFilterText=Kc(e)?e.toLowerCase():null,this.searchFilters(this.searchFilterText,!0)}searchFilters(e,t=!1){const s=o=>!Kc(e)||o.toLowerCase().indexOf(e)!==-1,r=(o,a)=>{if(!(o instanceof Qt))return s(o.getColumnFilterName()||"");const l=o.getChildren(),c=s(o.getFilterGroupName()),u=a||c;if(u){o.hideGroup(!1);for(let h=0;h<l.length;h++)r(l[h],u),o.hideGroupItem(!1,h);return!0}let d=!1;return l.forEach((h,p)=>{const g=r(h,a);o.hideGroupItem(!g,p),g&&(d=!0)}),o.hideGroup(!d),d};let i,n;this.filterGroupComps.forEach((o,a)=>{r(o,!1);const l=o.getGui()?.classList.contains("ag-hidden");i===void 0?l||(i=a,n=a):!l&&n!==a&&(n=a)}),this.setFirstAndLastVisible(i,n),this.noMatchesComp.setNoMatches(e!=null&&i===void 0,t),this.refreshAriaLabel()}setFirstAndLastVisible(e,t){this.filterGroupComps.forEach((s,r)=>{s.removeCss("ag-first-group-visible"),s.removeCss("ag-last-group-visible"),r===e&&s.addCss("ag-first-group-visible"),r===t&&s.addCss("ag-last-group-visible")})}onPanelHidden(){for(const e of this.filterGroupComps)e.onPanelHidden()}getExpandedFiltersAndGroups(){const e=[],t=new Set,s=r=>{if(r instanceof Qt){for(const n of r.getChildren())s(n);const i=r.getFilterGroupId();r.isExpanded()&&!t.has(i)&&e.push(i)}else r.isExpanded()&&t.add(r.getColumn().colId)};return this.filterGroupComps.forEach(s),{expandedGroupIds:e,expandedColIds:Array.from(t)}}destroyFilters(){this.filterGroupComps=this.destroyBeans(this.filterGroupComps),b$(this.getGui())}destroy(){this.destroyFilters(),super.destroy()}},W$={selector:"AG-FILTERS-TOOL-PANEL-LIST",component:z$},K$=".ag-filter-toolpanel{flex:1 1 0px;min-width:0}.ag-filter-toolpanel-header,.ag-filter-toolpanel-search{align-items:center;color:var(--ag-header-text-color);display:flex;font-weight:var(--ag-header-font-weight);padding:0 var(--ag-spacing);>:where(.ag-filter-icon),>:where(.ag-filter-toolpanel-expand),>:where(.ag-filter-toolpanel-search-input),>:where(.ag-header-cell-text){align-items:center;display:flex}}.ag-filter-toolpanel-header{padding-bottom:var(--ag-spacing);padding-top:var(--ag-spacing);position:relative;&:focus-visible{border-radius:var(--ag-border-radius);box-shadow:inset var(--ag-focus-shadow)}}:where(.ag-ltr) .ag-filter-toolpanel-group-instance-header-icon,:where(.ag-ltr) .ag-filter-toolpanel-instance-header-icon{margin-left:var(--ag-spacing)}:where(.ag-rtl) .ag-filter-toolpanel-group-instance-header-icon,:where(.ag-rtl) .ag-filter-toolpanel-instance-header-icon{margin-right:var(--ag-spacing)}.ag-filter-toolpanel-search{min-height:var(--ag-header-height);padding-bottom:var(--ag-spacing);padding-top:var(--ag-widget-container-vertical-padding)}:where(.ag-filter-toolpanel-group:not(.ag-has-filter)>.ag-group-title-bar) .ag-filter-toolpanel-group-instance-header-icon{display:none}.ag-filter-toolpanel-search-input{flex-grow:1;height:calc(var(--ag-spacing)*4)}:where(.ag-ltr) .ag-filter-toolpanel-group-title-bar-icon{margin-right:var(--ag-spacing)}:where(.ag-rtl) .ag-filter-toolpanel-group-title-bar-icon{margin-left:var(--ag-spacing)}.ag-filter-toolpanel-expand{cursor:pointer}:where(.ag-ltr) .ag-filter-toolpanel-expand{margin-right:var(--ag-spacing)}:where(.ag-rtl) .ag-filter-toolpanel-expand{margin-left:var(--ag-spacing)}:where(.ag-ltr) .ag-filter-toolpanel-group-title-bar,:where(.ag-ltr) .ag-filter-toolpanel-instance-header{padding-left:calc(var(--ag-spacing) + var(--ag-filter-tool-panel-group-indent)*var(--ag-indentation-level))}:where(.ag-rtl) .ag-filter-toolpanel-group-title-bar,:where(.ag-rtl) .ag-filter-toolpanel-instance-header{padding-right:calc(var(--ag-spacing) + var(--ag-filter-tool-panel-group-indent)*var(--ag-indentation-level))}:where(.ag-ltr) .ag-filter-toolpanel-instance-body{margin-left:var(--ag-filter-tool-panel-group-indent)}:where(.ag-rtl) .ag-filter-toolpanel-instance-body{margin-right:var(--ag-filter-tool-panel-group-indent)}.ag-filter-toolpanel-instance-filter{background-color:var(--ag-chrome-background-color)}.ag-filter-toolpanel-group-level-0{border-top:none}",$$={tag:"div",cls:"ag-filter-toolpanel",children:[{tag:"ag-filters-tool-panel-header",ref:"filtersToolPanelHeaderPanel"},{tag:"ag-filters-tool-panel-list",ref:"filtersToolPanelListPanel"}]},j$=class extends gF{constructor(){super($$,[C$,W$]),this.filtersToolPanelHeaderPanel=DC,this.filtersToolPanelListPanel=DC,this.initialised=!1,this.listenerDestroyFuncs=[],this.registerCSS(K$)}init(e){if(this.initialised){for(const l of this.listenerDestroyFuncs)l();this.listenerDestroyFuncs=[]}this.initialised=!0;const s={...{suppressExpandAll:!1,suppressFilterSearch:!1,suppressSyncLayoutWithGrid:!1},...e};this.params=s;const r=!!e.initialState&&e!==this.appliedParams;this.appliedParams=e;const{filtersToolPanelHeaderPanel:i,filtersToolPanelListPanel:n}=this;i.init(s),n.init(s,r);const{suppressExpandAll:o,suppressFilterSearch:a}=s;o&&a&&i.setDisplayed(!1),this.listenerDestroyFuncs.push(...this.addManagedListeners(i,{expandAll:()=>n.expandFilterGroups(!0),collapseAll:()=>n.expandFilterGroups(!1),searchChanged:l=>n.performFilterSearch(l.searchText)}),...this.addManagedListeners(n,{filterExpanded:s.onStateUpdated,groupExpanded:l=>{i.setExpandState(l.state),s.onStateUpdated()}}))}setVisible(e){super.setDisplayed(e),e&&!this.initialised&&this.init(this.params)}setFilterLayout(e){this.filtersToolPanelListPanel.setFiltersLayout(e)}expandFilterGroups(e){this.filtersToolPanelListPanel.expandFilterGroups(!0,e)}collapseFilterGroups(e){this.filtersToolPanelListPanel.expandFilterGroups(!1,e)}expandFilters(e){this.filtersToolPanelListPanel.expandFilters(!0,e)}collapseFilters(e){this.filtersToolPanelListPanel.expandFilters(!1,e)}syncLayoutWithGrid(){this.filtersToolPanelListPanel.syncFilterLayout()}refresh(e){return this.init(e),!0}getState(){return this.filtersToolPanelListPanel.getExpandedFiltersAndGroups()}};import{BeanStub as Y$,FilterComp as q$,_getDisplayHandler as Z$}from"ag-grid-community";var X$=class extends fF{constructor(){super(...arguments),this.beanName="filterPanelSvc",this.states=new Map,this.orderedStates=[],this.initialStateApplied=!1,this.columnsLoaded=!1,this.isActive=!1}postConstruct(){if(!this.gos.get("enableFilterHandlers"))return;const e=this.updateFilterStates.bind(this),t=()=>this.dispatchStatesUpdates(void 0,!0),s=this.onFilterDestroyed.bind(this);this.addManagedEventListeners({newColumnsLoaded:()=>{this.columnsLoaded=!0,this.initialStateApplied||this.applyState(),e()},dataTypesInferred:e,filterChanged:e,filterDestroyed:s,filterHandlerDestroyed:s,filterOpened:t,filterClosed:t,columnHeaderNameChanged:({column:i})=>{i&&this.updateFilterState(i.getColId(),"name",jc(this.beans,i))}});const r=({column:i})=>{this.states.get(i.colId)?.refresh?.(),t()};this.addManagedListeners(this.beans.colFilter,{filterStateChanged:r,filterModelAsStringChanged:r})}updateParams(e,t){this.params=e;let s=!1;if(t&&(this.currState=t,this.columnsLoaded)){const r=new Set(t.filters?.map(i=>i.colId));for(const i of this.getIds())r.has(i)||this.remove(i);this.clear(),this.applyState(),this.updateFilterStates(),s=!0}s||this.dispatchStatesUpdates(),this.beans.colFilter?.setGlobalButtons(!!e.buttons?.length)}getIds(){return Array.from(this.states.keys())}getAvailable(){const e=this.beans,t=[];for(const s of e.colModel.colDefList){const r=s.colId;s.isFilterAllowed()&&!s.colDef.suppressFiltersToolPanel&&!this.states.get(r)&&t.push({id:r,name:jc(e,s)})}return t}add(e){this.createFilter(e,!0),this.dispatchStatesUpdates(e)}remove(e){const t=this.orderedStates,s=t.indexOf(e);s!==-1&&(this.removeFilter(e),this.dispatchStatesUpdates(t[s]))}setFilterCards(e){const{states:t,orderedStates:s,beans:r}=this,i=new Set(e);for(const o of this.getIds())i.has(o)||this.removeFilter(o);const n=new Map;for(const o of i){const a=t.get(o)??this.createFilterStateWrapper(o,!1);a?n.set(o,a):r.colModel.getNonPivotColById(o)||r.log.warn(337,{colId:o})}t.clear(),n.forEach((o,a)=>t.set(a,o)),s.length=0,s.push(...n.keys()),this.dispatchStatesUpdates()}removeFilter(e){const{states:t,orderedStates:s,beans:{colFilter:r,selectableFilter:i}}=this,n=t.get(e);if(!n)return;n.destroy?.();const o=n.state.column;t.delete(e),i?.clearActive(e),r?.destroyFilter(o),this.eventSvc.dispatchEvent({type:"filterSwitched",column:o}),s.splice(s.indexOf(e),1)}getState(e){return this.states.get(e)?.state}updateFilterState(e,t,s,r){const i=this.getState(e);i&&(i[t]=s,r||this.dispatchLocalEvent({type:"filterPanelStateChanged",id:e,state:i}))}expand(e,t){const s=this.states.get(e);if(!s)return;s.destroy?.();const{handler:r,state:{column:i}}=s,n=this.createFilterState(i,r,t);this.states.set(e,n),this.dispatchLocalEvent({type:"filterPanelStateChanged",id:e,state:n.state})}setFilterCardsExpanded(e,t){const s=this.states;for(const r of t??this.getIds()){const i=s.get(r)?.state;i&&i.expanded!==e&&this.expand(r,e)}}updateType(e,t){const s=this.states.get(e);if(!s)return;const r=s.state;if(!r.expanded)return;const i=r.filterDefs;if(!i)return;const n=this.beans.selectableFilter;n.setActive(e,i,t),n.switchFilter(r.column,"columnFilter");const o=this.states.get(e);if(!o)return;const a=o.state;this.dispatchLocalEvent({type:"filterPanelStateChanged",id:e,state:a})}getActions(){const e=this.params?.buttons;if(!e?.length)return;const t=!!this.beans.colFilter?.canApplyAll();return{actions:e,canApply:t}}doAction(e){this.beans.colFilter?.updateAllModels(e)}getGridState(){const e=[];return this.states.forEach((t,s)=>{e.push({colId:s,expanded:t.state.expanded})}),{filters:e}}createFilter(e,t){const s=this.createFilterStateWrapper(e,t);s&&(this.states.set(e,s),this.orderedStates.push(e))}createFilterStateWrapper(e,t){const{colModel:s,colFilter:r}=this.beans,i=s.getNonPivotColById(e);if(i&&!i.colDef.suppressFiltersToolPanel){const n=Z$(r.getHandler(i,!0));if(n)return this.createFilterState(i,n,t)}}updateFilterStates(){if(!this.params)return;const e=this.beans.colFilter.getModel(),t=new Set;for(const s of Object.keys(e)){const r=this.states.get(s);r?r.refresh?.():this.createFilter(s),t.add(s)}this.states.forEach((s,r)=>{t.has(r)||s.refresh?.()}),this.dispatchStatesUpdates()}createFilterState(e,t,s){const r=this.beans,{colFilter:i,selectableFilter:n}=r,o=jc(r,e),a=e.colId,l=()=>!!this.params?.buttons&&i.hasUnappliedModel(a),c=l();if(s){const u=e.colDef,{filterDefs:d,activeFilterDef:h}=n?.getDefs(e,u)??{},p=this.createBean(new q$(e,"TOOLBAR",!0));return{state:{column:e,name:o,isEditing:c,expanded:s,detail:p.getGui(),activeFilterDef:h,filterDefs:d,afterGuiAttached:p.afterGuiAttached.bind(p),afterGuiDetached:p.afterGuiDetached.bind(p)},handler:t,refresh:()=>{this.updateFilterState(a,"isEditing",l())},destroy:()=>this.destroyBean(p)}}else{const u=e.colId,d=()=>t.getModelAsString?.(i.getStateForColumn(u).model,"filterToolPanel")??"";return{state:{column:e,name:o,isEditing:c,expanded:!1,summary:d()},handler:t,refresh:()=>{this.updateFilterState(u,"isEditing",l(),!0),this.updateFilterState(u,"summary",d())}}}}onFilterDestroyed({column:e,source:t}){const{colFilter:s,filterManager:r}=this.beans;if(!s?.isAlive()||!r?.isFilterAllowed(e))return;const i=this.states,n=e.getColId(),o=i.get(n);if(o){const a=this.createFilterStateWrapper(n,o.state.expanded);a?(o.destroy?.(),i.set(n,a)):this.remove(n),t==="api"&&this.dispatchStatesUpdates()}}dispatchStatesUpdates(e,t){this.dispatchLocalEvent({type:"filterPanelStatesChanged",activeId:e,action:t})}applyState(){if(this.params&&this.columnsLoaded){this.initialStateApplied=!0;for(const{colId:e,expanded:t}of this.currState?.filters??[])this.createFilter(e,t)}}destroy(){this.clear(),this.params=void 0,this.currState=void 0,super.destroy()}clear(){const{states:e,orderedStates:t}=this;e.forEach(s=>s.destroy?.()),e.clear(),t.length=0}};function jc(e,t){return e.colNames.getDisplayNameForColumn(t,"filterToolPanel")??t.colId}import{BeanStub as J$,_getDefaultFilter as Q$,_getDefaultSimpleFilter as ej,_getFilterKey as tj,_isSetFilterByDefault as sj}from"ag-grid-community";import{_removeFromParent as rj,_translate as ij}from"ag-stack";var nj={addFilterCard:"Add Filter",ariaLabelAddFilterField:"Add Filter Field",ariaLabelFilterCardDelete:"Delete Filter",ariaLabelFilterCardHasEdits:"Has Edits",agTextColumnFilterDisplayName:"Simple Filter",agNumberColumnFilterDisplayName:"Simple Filter",agBigIntColumnFilterDisplayName:"Simple Filter",agDateColumnFilterDisplayName:"Simple Filter",agSetColumnFilterDisplayName:"Selection Filter",agMultiColumnFilterDisplayName:"Combo Filter",addFilterPlaceholder:"Search columns..."};function Js(e,t){return ij(e,nj,t)}function oj(e,t,s){let r=0;for(let i=0;i<s.length;i++){const n=s[i];n===t[r]?r++:rj(n)}for(;r<t.length;)e.appendChild(t[r++])}var aj=class extends mF{constructor(){super(...arguments),this.beanName="selectableFilter",this.selectedFilters=new Map,this.valueGetters=new Map}postConstruct(){const{gos:e,selectedFilters:t}=this,s=e.get("initialState")?.filter?.selectableFilters??{};for(const r of Object.keys(s))t.set(r,s[r]);this.addManagedEventListeners({newColumnsLoaded:()=>this.refreshValueGetters()})}getFilterValueGetter(e){return this.valueGetters.get(e)}getFilterDef(e,t){const s=this.resolveDefs(e,t,void 0);return s?.updateDef(s.defs[s.index])}getDefs(e,t,s){const r=this.resolveDefs(e,t,s);if(!r)return;const i=r.updateDef,n=r.defs.map(o=>this.withName(e,i(o)));return{filterDefs:n,activeFilterDef:n[r.index]}}withName(e,t){if(t.name)return t;const s=this.beans,r=tj(s,t.filter,Q$(s,e));return r===void 0?{...t,name:""}:{...t,name:Js(this,`${r}DisplayName`)}}resolveDefs(e,t,s){if(t.filter!=="agSelectableColumnFilter")return;const i=this.beans.colFilter.resolveFilterParams(e,t),{filters:n,defaultFilterParams:o,defaultFilterIndex:a}=i??{},l=h=>{if(!h.name){const f=h.filter,m=typeof f=="object"&&f!==null?f.component:f;typeof m!="string"&&typeof m!="boolean"&&this.warn(280,{colId:e.colId})}if(!o)return h;const p=h.filterParams,g=typeof p=="function"?f=>({...o,...p(f)}):{...o,...p};return{...h,filterParams:g}},c=n?.length?n:this.getDefaultFilters(e),u=c!==n;let d=s??this.selectedFilters.get(e.colId)??a??(u&&sj(this.gos)?1:0);return(!Number.isInteger(d)||d<0||d>=c.length)&&(d=0),{defs:c,index:d,updateDef:l}}setActive(e,t,s,r){const i=t.indexOf(s);i<0||(this.selectedFilters.set(e,i),this.setValueGetter(e,s.filterValueGetter),r||this.onChange())}clearActive(e){this.selectedFilters.delete(e);const t=this.beans.colModel.getNonPivotColById(e);this.setValueGetter(e,t&&this.getFilterDef(t,t.colDef)?.filterValueGetter),this.onChange()}getState(){return this.selectedFilters.size>0?Object.fromEntries(this.selectedFilters):void 0}setState(e){const t=this.beans.colModel,s=e?Object.keys(e):[],r=a=>this.resolveDefs(a,a.colDef,void 0)?.index,i=new Map,n=a=>{const l=t.getNonPivotColById(a);l&&i.set(l,r(l))};for(const a of this.selectedFilters.keys())n(a);for(let a=0,l=s.length;a<l;++a)n(s[a]);if(this.clearAll(),e)for(let a=0,l=s.length;a<l;++a){const c=s[a],u=t.getNonPivotColById(c);if(u){const d=this.getDefs(u,u.colDef,e[c]);d&&this.setActive(c,d.filterDefs,d.activeFilterDef,!0)}}this.refreshValueGetters();let o=!1;for(const[a,l]of i)r(a)!==l&&(o=!0,this.switchFilter(a,"api"));o&&this.onChange()}switchFilter(e,t){this.beans.colFilter?.filterParamsChanged(e.colId,t),this.eventSvc.dispatchEvent({type:"filterSwitched",column:e})}destroy(){this.clearAll(),super.destroy()}clearAll(){const{selectedFilters:e,valueGetters:t}=this;e.clear(),t.clear()}refreshValueGetters(){this.valueGetters.clear();for(const e of this.beans.colModel.getAllCols())this.setValueGetter(e.colId,this.getFilterDef(e,e.colDef)?.filterValueGetter)}setValueGetter(e,t){t?this.valueGetters.set(e,t):this.valueGetters.delete(e)}onChange(){this.dispatchLocalEvent({type:"selectedFilterChanged"})}getDefaultFilters(e){const t=this.beans,{gos:s,dataTypeSvc:r}=t,i=s.isModuleRegistered("MultiFilter"),n=r?.getBaseDataType(e);return[{filter:ej(n)},{filter:"agSetColumnFilter"},...i?[{filter:"agMultiColumnFilter"}]:[]]}};import{Component as lj,_createElement as cj}from"ag-grid-community";import{RefPlaceholder as uj,_focusInto as NC,_getActiveDomElement as dj,_isNothingFocused as BC,_removeFromParent as hj}from"ag-stack";import{Component as pj,FilterButtonComp as gj,_translateForFilter as fj}from"ag-grid-community";import{_clearElement as VC}from"ag-stack";import{Component as mj,_createElement as vj,_createIconNoSpan as Cj}from"ag-grid-community";var bj={tag:"div",cls:"ag-filter-card ag-filter-card-add"},Sj=class extends vF{constructor(e){super(bj),this.options=new Map,this.setOptions(e)}postConstruct(){this.showButton()}refresh(e){this.setOptions(e);const{eSelect:t,options:s}=this;t&&t.setValueList({valueList:Array.from(s.keys()),refresh:!0})}showButton(){VC(this.getGui()),this.destroySelect();const e=vj({tag:"button",cls:"ag-button ag-standard-button ag-filter-add-button",children:[{tag:"span",children:[()=>Cj("filterAdd",this.beans)]},{tag:"span",cls:"ag-filter-add-button-label",children:Js(this,"addFilterCard")}]});this.activateTabIndex([e]);const t=this.showSelect.bind(this);e.addEventListener("click",t),this.removeButton=()=>{e.removeEventListener("click",t)},this.appendChild(e),e.focus()}showSelect(){VC(this.getGui()),this.destroyButton();const e="ariaLabelAddFilterField",t={className:"ag-filter-add-select",pickerType:"virtual-list",pickerAriaLabelKey:e,pickerAriaLabelValue:Js(this,e),placeholder:Js(this,"addFilterPlaceholder"),value:"",valueList:Array.from(this.options.keys()),searchType:"matchAny",searchIcon:!0,allowTyping:!0,filterList:!0,allowNoResultsCopy:!0,highlightMatch:!0,valueFormatter:r=>this.options.get(r)},s=this.createManagedBean(new fn(t));this.eSelect=s,this.appendChild(s.getGui()),s.showPicker(),s.getFocusableElement().focus(),s.addManagedListeners(s,{fieldPickerValueSelected:({value:r})=>this.dispatchLocalEvent({type:"filterSelected",id:r}),pickerHidden:()=>{this.showButton()}})}setOptions(e){const t=this.options;t.clear();for(const{id:s,name:r}of e)t.set(s,r)}destroySelect(){this.eSelect=this.destroyBean(this.eSelect)}destroyButton(){this.removeButton=this.removeButton?.()}destroy(){this.destroySelect(),this.destroyButton(),super.destroy()}};import{RefPlaceholder as Qs,_clearElement as yj,_removeFromParent as wj,_setAriaControls as HC,_setAriaExpanded as xj,_setAriaLabel as UC,_setDisplayed as Fj}from"ag-stack";import{Component as Tj,_createIcon as Yc}from"ag-grid-community";import{RefPlaceholder as Aj,_removeFromParent as Pj}from"ag-stack";import{AgSelectSelector as Rj,Component as Mj}from"ag-grid-community";var Ij={tag:"div",cls:"ag-filter-card-body",children:[{tag:"ag-select",cls:"ag-filter-type-select",ref:"eFilterType"}]},Ej=class extends CF{constructor(){super(...arguments),this.eFilterType=Aj}postConstruct(){const e={onValueChange:t=>this.dispatchLocalEvent({type:"filterTypeChanged",filterDef:t})};this.setTemplate(Ij,[Rj],{eFilterType:e}),this.eFilterType.setDisplayed(!1)}refresh(e){const t=this.state;this.state=e;const{activeFilterDef:s,filterDefs:r,detail:i,afterGuiAttached:n,afterGuiDetached:o}=e,{activeFilterDef:a,filterDefs:l,detail:c}=t??{},u=this.eFilterType;if(r!==l){u.clearOptions();const d=r?.map(h=>({value:h,text:h.name}));d&&u.clearOptions().addOptions(d).setValue(s,!0),u.setDisplayed(!!d)}else s!==a&&u.setValue(s,!0);i!==c&&(c&&(Pj(c),o()),this.appendChild(i),n({container:"newFiltersToolPanel",suppressFocus:!0}))}};import{Component as Dj}from"ag-grid-community";var Lj={tag:"div",cls:"ag-filter-card-summary",attrs:{"aria-hidden":"true"}},kj=class extends bF{constructor(){super(Lj)}refresh(e){this.getGui().textContent=e.summary}},_j={tag:"div",cls:"ag-filter-card",children:[{tag:"div",cls:"ag-filter-card-header",role:"presentation",children:[{tag:"div",cls:"ag-filter-card-heading",role:"heading",attrs:{"aria-level":"2"},children:[{tag:"button",ref:"eExpand",cls:"ag-button ag-filter-card-expand",children:[{tag:"span",ref:"eTitle",cls:"ag-filter-card-title"},{tag:"span",ref:"eEditing",cls:"ag-filter-card-editing-icon"},{tag:"span",ref:"eExpandIcon",cls:"ag-filter-card-expand-icon"}]}]},{tag:"button",ref:"eDelete",cls:"ag-button ag-filter-card-delete",children:[{tag:"span",ref:"eDeleteIcon",cls:"ag-filter-card-delete-icon"}]}]}]},Gj=class extends SF{constructor(e){super(_j),this.id=e,this.eTitle=Qs,this.eExpand=Qs,this.eDelete=Qs,this.eExpandIcon=Qs,this.eDeleteIcon=Qs,this.eEditing=Qs}postConstruct(){const{beans:e,eDelete:t,eExpand:s,eDeleteIcon:r,eEditing:i,id:n}=this,o=e.filterPanelSvc;UC(t,Js(this,"ariaLabelFilterCardDelete")),r.appendChild(Yc("close",e,null)),this.activateTabIndex([s,t]),this.addManagedElementListeners(s,{click:()=>o.expand(n,!this.state?.expanded)}),this.addManagedElementListeners(t,{click:()=>o.remove(n)}),this.addManagedEventListeners({filterOpened:this.onFilterOpened.bind(this)}),i.appendChild(Yc("filterCardEditing",e,null))}refresh(e){const{eExpand:t,eEditing:s,state:r,beans:i}=this;this.state=e;const{name:n,expanded:o,isEditing:a}=e;this.eTitle.textContent=n,Fj(s,a),o!==r?.expanded&&this.toggleExpand(e);let l=o?null:`${n} ${e.summary}`;a&&(l=`${l??n}. ${Js(this,"ariaLabelFilterCardHasEdits")}`),UC(t,l);const c=d=>{if(d)return wj(d.getGui()),this.destroyBean(d)},u=(d,h,p)=>(d||(d=this.createBean(new h),p?.(d),this.appendChild(d.getGui())),d.refresh(e),d);if(e.expanded){this.summaryComp=c(this.summaryComp);const d=u(this.detailComp,Ej,p=>p.addManagedListeners(p,{filterTypeChanged:({filterDef:g})=>i.filterPanelSvc.updateType(this.id,g)}));this.detailComp=d;const h=`ag-${this.getCompId()}-filter`;d.getGui().id=h,HC(t,h)}else this.detailComp=c(this.detailComp),this.summaryComp=u(this.summaryComp,kj),HC(t,null)}toggleExpand(e){const t=!!e.expanded,{eExpandIcon:s,eExpand:r,beans:i}=this;yj(s),s.appendChild(Yc(t?"filterCardCollapse":"filterCardExpand",i,null)),xj(r,t)}onFilterOpened(e){const{state:t,beans:s,id:r}=this;e.source==="COLUMN_MENU"&&e.column===t?.column&&t?.expanded&&s.filterPanelSvc.expand(r,!1)}destroy(){this.detailComp=this.destroyBean(this.detailComp),this.summaryComp=this.destroyBean(this.summaryComp),this.state=void 0,super.destroy()}};function Oj(e){return!!e?.id}function Nj(e){return!!e?.action}var Bj={tag:"div",cls:"ag-filter-panel",children:[{tag:"div",cls:"ag-filter-panel-container",ref:"eContainer"}]},Vj=class extends yF{constructor(){super(Bj),this.eContainer=uj,this.filters=new Map}refresh(e){if(Nj(e)){this.refreshActions();return}if(Oj(e)){this.filters.get(e.id)?.refresh(e.state);return}const{eContainer:t,filters:s,beans:r}=this,i=r.filterPanelSvc,n=i.getIds(),o=new Map,a=!BC(r),l=a?dj(r):void 0,c=a&&t.contains(l),u=[],d=[];for(const v of n){const C=s.get(v)??this.createBean(new Gj(v));C.refresh(i.getState(v)),o.set(v,C),d.push(C.getGui())}this.filters=o;const h=[];s.forEach((v,C)=>{u.push(v.getGui()),o.has(C)||h.push(v)});let p=this.addFilterComp;p&&u.push(p.getGui());const g=i.getAvailable();g.length?(p||(p=this.createBean(new Sj(g)),p.addManagedListeners(p,{filterSelected:({id:v})=>i.add(v)})),p.refresh(g),d.push(p.getGui())):p=this.destroyBean(p),this.addFilterComp=p,oj(t,d,u);for(const v of h)this.destroyBean(v);const f=e?.activeId,m=f&&o.get(f)?.getGui();m?NC(m):c&&BC(r)&&NC(d[d.length-1]??t),this.refreshActions()}refreshActions(){const e=this.beans.filterPanelSvc,{actions:t,canApply:s}=e.getActions()??{};let r=this.buttonComp;if(t?.length){const i=t.map(n=>({type:n,label:fj(this,`${n}Filter`)}));if(!r){r=this.createBean(new gj({className:"ag-filter-panel-buttons"})),this.getGui().appendChild(r.getGui());const n={};for(const o of["apply","clear","reset","cancel"])n[o]=()=>e.doAction(o);r.addManagedListeners(r,n)}r.updateButtons(i),r.updateValidity(s!==!1)}else r&&(hj(r.getGui()),r=this.destroyBean(r));this.buttonComp=r}destroy(){this.beans.filterPanelSvc?.clear?.(),this.addFilterComp=this.destroyBean(this.addFilterComp),this.buttonComp=this.destroyBean(this.buttonComp);const e=this.filters;e.forEach(t=>this.destroyBean(t)),e.clear(),super.destroy()}},Hj=".ag-filter-panel{display:flex;flex-direction:column;width:100%;:where(.ag-standard-button){transition:background-color .25s ease-in-out,color .25s ease-in-out}}.ag-filter-panel .ag-simple-filter-body-wrapper{padding:var(--ag-widget-vertical-spacing) var(--ag-widget-container-horizontal-padding) 0}.ag-filter-panel .ag-mini-filter{margin-left:var(--ag-widget-container-horizontal-padding);margin-right:var(--ag-widget-container-horizontal-padding);margin-top:var(--ag-widget-vertical-spacing)}.ag-filter-panel-container{display:flex;flex:1;flex-direction:column;gap:var(--ag-widget-container-vertical-padding);overflow:auto;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding) 0}.ag-filter-card{background-color:var(--ag-background-color);border:solid var(--ag-border-width) var(--ag-border-color);border-radius:var(--ag-border-radius)}.ag-filter-card-header{align-items:center;display:flex;flex-direction:row;gap:var(--ag-spacing);padding-top:var(--ag-widget-vertical-spacing)}.ag-filter-card-heading{flex:1;min-width:0;padding-bottom:calc(var(--ag-widget-container-vertical-padding) - var(--ag-widget-vertical-spacing));padding-top:calc(var(--ag-widget-container-vertical-padding) - var(--ag-widget-vertical-spacing))}:where(.ag-ltr) .ag-filter-card-heading{padding-left:var(--ag-widget-horizontal-spacing)}:where(.ag-rtl) .ag-filter-card-heading{padding-right:var(--ag-widget-horizontal-spacing)}.ag-filter-card-expand{align-items:center;display:flex;flex-direction:row;width:100%}.ag-filter-card-title{font-weight:var(--ag-header-font-weight);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ag-filter-card-expand-icon{display:flex;flex:1;justify-content:end}.ag-filter-card-editing-icon{margin:0 var(--ag-spacing)}.ag-filter-card-delete-icon,.ag-filter-card-editing-icon,.ag-filter-card-expand-icon,.ag-filter-card-summary{color:var(--ag-filter-panel-card-subtle-color)}.ag-filter-card-delete-icon,.ag-filter-card-expand-icon{transition:color .25s ease-in-out}.ag-filter-card-delete-icon:hover,.ag-filter-card-expand-icon:hover{color:var(--ag-filter-panel-card-subtle-hover-color)}.ag-filter-card-heading:hover .ag-filter-card-expand-icon{color:var(--ag-filter-panel-card-subtle-hover-color)}.ag-filter-add-button,.ag-filter-card-delete,.ag-filter-card-expand{border-radius:var(--ag-button-border-radius)}.ag-filter-card-summary,.ag-filter-type-select{margin-left:var(--ag-widget-container-horizontal-padding);margin-right:var(--ag-widget-container-horizontal-padding)}:where(.ag-ltr) .ag-filter-card-delete{margin-right:var(--ag-widget-horizontal-spacing)}:where(.ag-rtl) .ag-filter-card-delete{margin-left:var(--ag-widget-horizontal-spacing)}.ag-filter-card-summary{margin-bottom:var(--ag-widget-container-vertical-padding)}.ag-filter-type-select{padding-top:var(--ag-widget-vertical-spacing)}.ag-filter-card-add{border:0;margin-bottom:calc(var(--ag-spacing)*.5);padding:0}.ag-filter-add-button{align-items:center;display:flex;flex-direction:row;line-height:1.5;width:100%}:where(.ag-ltr) .ag-filter-add-button-label{margin-left:var(--ag-spacing)}:where(.ag-rtl) .ag-filter-add-button-label{margin-right:var(--ag-spacing)}.ag-filter-add-select{border:0;.ag-rich-select-value{border:0;padding-block:calc(((1.5*var(--ag-font-size) + 2*var(--ag-button-vertical-padding)) - var(--ag-input-height))/2)}}.ag-filter-panel-buttons{display:flex;flex-wrap:wrap;gap:var(--ag-widget-vertical-spacing) var(--ag-widget-horizontal-spacing);justify-content:flex-end;overflow:hidden;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding) 0}.ag-filter-panel-buttons-button{line-height:1.5}.ag-filter-panel .ag-filter-panel-buttons-apply-button{background-color:var(--ag-filter-panel-apply-button-background-color);color:var(--ag-filter-panel-apply-button-color)}.ag-filter-panel-buttons:where(:last-child),.ag-filter-panel-container:where(:last-child){padding-bottom:var(--ag-widget-container-vertical-padding)}.ag-filter-panel .ag-set-filter-body-wrapper,.ag-filter-panel .ag-simple-filter-body-wrapper{padding-bottom:var(--ag-widget-container-vertical-padding)}",Uj=class extends wF{constructor(){super(),this.registerCSS(Hj)}init(e){if(!this.gos.get("enableFilterHandlers")){this.beans.log.warn(282),this.setTemplateFromElement(cj({tag:"div",cls:"ag-filter-panel"}));return}const t=this.beans.filterPanelSvc;t.isActive=!0,this.addDestroyFunc(()=>{t.isActive=!1}),this.updateParams(e,e.initialState);const s=this.createManagedBean(new Vj);this.filterPanel=s;const r=i=>{s.refresh(i),e.onStateUpdated()};r(),this.addManagedListeners(t,{filterPanelStatesChanged:r,filterPanelStateChanged:r})}getGui(){return this.filterPanel?.getGui()??super.getGui()}refresh(e){return this.updateParams(e,e.initialState),!0}updateParams(e,t){this.beans.filterPanelSvc?.updateParams(e,t)}expandFilterCards(e){this.beans.filterPanelSvc?.setFilterCardsExpanded(!0,e)}collapseFilterCards(e){this.beans.filterPanelSvc?.setFilterCardsExpanded(!1,e)}setFilterCards(e){this.filterPanel&&this.beans.filterPanelSvc?.setFilterCards(e)}getState(){return this.beans.filterPanelSvc?.getGridState()??{}}},zC={moduleName:"FiltersToolPanel",version:_,userComponents:{agFiltersToolPanel:j$},icons:{filtersToolPanel:"filter"},dependsOn:[Hr,$,EC]},WC={moduleName:"NewFiltersToolPanel",version:_,userComponents:{agNewFiltersToolPanel:Uj},beans:[X$,aj],icons:{filterAdd:"filter-add",filtersToolPanel:"filter",richSelectOpen:"small-down",richSelectRemove:"cancel",richSelectLoading:"loading",filterCardExpand:"chevron-down",filterCardCollapse:"chevron-up",filterCardEditing:"edit"},dependsOn:[Hr,$,EC]};import{EventApiModule as zj}from"ag-grid-community";import{RefPlaceholder as Wj,_missing as Kj}from"ag-stack";import{Component as $j,_getGridRegisteredModules as jj,createGrid as Yj}from"ag-grid-community";import{_focusInto as qj,_missing as Zj}from"ag-stack";import{BeanStub as Xj,_addGridCommonParams as Jj,_isSameRow as Qj}from"ag-grid-community";var KC=class extends xF{constructor(){super(...arguments),this.loadRowDataVersion=0}wireBeans(e){this.environment=e.environment}init(e,t){this.params=t,this.comp=e,t.pinned==null&&(this.setAutoHeightClasses(),this.setupRefreshStrategy(),this.createDetailGrid(),this.loadRowData(),this.addManagedEventListeners({fullWidthRowFocused:this.onFullWidthRowFocused.bind(this)}))}onFullWidthRowFocused(e){const t=this.params,s={rowIndex:t.node.rowIndex,rowPinned:t.node.rowPinned},r={rowIndex:e.rowIndex,rowPinned:e.rowPinned};Qj(s,r)&&qj(this.comp.getGui(),e.fromBelow)}setAutoHeightClasses(){const e=this.gos.get("detailRowAutoHeight"),t=e?"ag-details-row-auto-height":"ag-details-row-fixed-height",s=e?"ag-details-grid-auto-height":"ag-details-grid-fixed-height",r=this.comp;r.toggleCss(t,!0),r.toggleDetailGridCss(s,!0)}setupRefreshStrategy(){const e=this.params.refreshStrategy;if(e=="everything"||e=="nothing"||e=="rows"){this.refreshStrategy=e;return}e!=null&&this.warn(170,{providedStrategy:e}),this.refreshStrategy="rows"}createDetailGrid(){const{params:e,gos:t}=this;if(Zj(e.detailGridOptions)){this.warn(171);return}const s=t.get("theme"),r=e.detailGridOptions.theme;r&&r!==s&&this.warn(267);const i={themeStyleContainer:this.environment.eStyleContainer,...e.detailGridOptions,theme:s};t.get("detailRowAutoHeight")&&(i.domLayout="autoHeight"),this.comp.setDetailGrid(i)}registerDetailWithMaster(e){const{params:t,beans:{selectionSvc:s,findSvc:r,expansionSvc:i}}=this,n=t.node.id,o=t.api,a={id:n,api:e},l=t.node;if(o.isDestroyed())return;o.addDetailGridInfo(n,a),l.detailGridInfo=a;const c=l.parent,u=()=>{s?.setDetailSelectionState(c,t.detailGridOptions,e)};r?.registerDetailGrid(l,e);function d(g){g.source==="rowDataChanged"||!c||s?.refreshMasterNodeState(c)}function h({source:g}){if(!e.isDestroyed()){if(g==="expandAll")return e.expandAll();if(g==="collapseAll")return e.collapseAll()}}function p({node:g,source:f}){g!==c||f==="masterDetail"||e.isDestroyed()||u()}e.addEventListener("firstDataRendered",()=>{if(!this.isAlive()||e.isDestroyed()||o.isDestroyed())return;u(),e.addEventListener("selectionChanged",d),o.addEventListener("rowSelected",p),e.isModuleRegistered("CsrmSsrmSharedApiModule")&&(o.addEventListener("expandOrCollapseAll",h),i?.setDetailsExpansionState(e))}),this.addManagedListeners(c,{masterChanged:g=>{g.node.master||this.onDestroy(a)}}),this.addDestroyFunc(()=>{o.isDestroyed()||(o.removeEventListener("rowSelected",p),o.removeEventListener("expandOrCollapseAll",h)),this.onDestroy(a)})}onDestroy(e){const{params:t}=this,s=t.node,r=t.api;if(s.detailGridInfo!==e)return;const i=s.id;!r.isDestroyed()&&r.getDetailGridInfo(i)===e&&r.removeDetailGridInfo(i),s.detailGridInfo=null}loadRowData(){this.loadRowDataVersion++;const e=this.loadRowDataVersion,t=this.params;if(t.detailGridOptions?.rowModelType==="serverSide"){t.node.detailGridInfo?.api?.refreshServerSide({purge:!0});return}const s=t.getDetailRowData;if(!s){this.warn(172);return}const r=n=>{if(this.loadRowDataVersion===e){this.comp.setRowData(n);const a=t.node,l=a.detailGridInfo?.api,c=a.parent,u=this.gos.get("rowSelection"),d=!!u&&typeof u=="object"&&u.masterSelects==="detail";l&&c&&d&&this.beans.selectionSvc?.setDetailSelectionState(c,t.detailGridOptions,l)}},i={node:t.node,data:t.node.data,successCallback:r,context:Jj(this.gos,{}).context};s(i)}refresh(){switch(this.refreshStrategy){case"nothing":return!0;case"everything":return!1}return this.loadRowData(),!0}},eY=class{constructor(e){this.parentWrapper=e}wrap(e,t,s,r){return this.parentWrapper.wrap(e,t,s,r)}},tY={tag:"div",cls:"ag-details-row"},sY={tag:"div",cls:"ag-details-row",role:"gridcell",children:[{tag:"div",ref:"eDetailGrid",cls:"ag-details-grid",role:"presentation"}]},rY=class extends FF{constructor(){super(...arguments),this.eDetailGrid=Wj}wireBeans(e){this.context=e.context}init(e){this.params=e,this.selectAndSetTemplate();const t={toggleCss:(s,r)=>this.toggleCss(s,r),toggleDetailGridCss:(s,r)=>this.eDetailGrid.classList.toggle(s,r),setDetailGrid:s=>this.setDetailGrid(s),setRowData:s=>this.setRowData(s),getGui:()=>this.eDetailGrid};this.ctrl=this.createManagedBean(new KC),this.ctrl.init(t,e)}refresh(){return this.ctrl?.refresh()??!1}selectAndSetTemplate(){const e=this.params;if(e.pinned){this.setTemplate(tY);return}const t=()=>{this.setTemplate(sY)};if(Kj(e.template))t();else if(typeof e.template=="string")this.setTemplate(e.template,[]);else if(typeof e.template=="function"){const s=e.template,r=s(e);this.setTemplate(r,[])}else this.beans.log.warn(168),t();this.eDetailGrid==null&&this.beans.log.warn(169)}setDetailGrid(e){if(!this.eDetailGrid)return;const t=this.context.getBean("frameworkCompWrapper"),s=new eY(t),{frameworkOverrides:r}=this.beans,i=Yj(this.eDetailGrid,e,{frameworkOverrides:r,providedBeanInstances:{frameworkCompWrapper:s},modules:jj(this.params.api.getGridId(),e.rowModelType??"clientSide"),hasAncestorStyledRoot:!0});this.detailApi=i,this.ctrl?.registerDetailWithMaster(i),this.addDestroyFunc(()=>{i.destroy()})}setRowData(e){this.detailApi?.setGridOption("rowData",e)}};function oo(e,t){const s=e.masterDetailSvc?.store;return s?t(s):void 0}function iY(e,t,s){oo(e,r=>{r[t]=s})}function nY(e,t){oo(e,s=>{delete s[t]})}function oY(e,t){return oo(e,s=>s[t])}function aY(e,t){oo(e,s=>{let r=0;Object.values(s).forEach(i=>{i&&t(i,r++)})})}var lY=".ag-details-row{width:100%}.ag-details-row-fixed-height{height:100%}.ag-details-grid{width:100%}.ag-details-grid-fixed-height{height:100%}";import{_exists as cY,_observeResize as uY}from"ag-stack";import{BeanStub as dY,DETAIL_ROW_ID_PREFIX as hY,RowNode as pY,_getClientSideRowModel as gY,_isClientSideRowModel as $C,_isServerSideRowModel as jC}from"ag-grid-community";var fY=class extends TF{constructor(){super(...arguments),this.beanName="masterDetailSvc",this.store={}}isEnabled(){return this.gos.get("masterDetail")}postConstruct(){const e=this.gos;$C(e)&&(this.enabled=this.isEnabled()),jC(e)&&this.addEventListeners()}addEventListeners(){const e=r=>{this.setMaster(r.node,!1,!0)};let t;const s=()=>{if(t){for(const r of t)r();t=void 0}this.isEnabled()&&(t=this.addManagedListeners(this.beans.eventSvc,{rowNodeDataChanged:e}))};s(),this.gos.addPropertyEventListener("masterDetail",s)}refreshModel(e){if(e.changedProps){const t=this.isEnabled();if(this.enabled!==t){this.setMasters(null);return}}e.rowDataUpdated&&this.setMasters(e.changedRowNodes)}setMaster(e,t,s){const r=e.master,i=this.isEnabled();let n=i;const o=this.gos,a=o.get("isRowMaster"),l=o.get("treeData");if(i)if(t||s){if(a){const c=e.data;n=!!c&&!!a(c)}}else n=r;l||(n&&t||!n&&r)&&(e._expanded??(e._expanded=null)),n!==r&&(e.master=n,e.dispatchRowEvent("masterChanged"),this.dispatchLocalEvent({type:"masterChanged"}))}hasExpandableMasterRows(){const e=this.beans.rowModel.rootNode;return!!(e?._leafs?.some(t=>t.master&&t.isExpandable())||e?.childStore?.hasExpandableMasterRows())}setMasters(e){if(this.enabled=this.isEnabled(),e){for(const t of e.updates)this.setMaster(t,!1,!0);for(const t of e.adds)this.setMaster(t,!0,!1)}else{const t=gY(this.beans)?.rootNode?._leafs;if(t)for(let s=0,r=t.length;s<r;++s)this.setMaster(t[s],!0,!1)}}getDetail(e){if(!e.master||!e.expanded)return null;let t=e.detailNode;return t||(t=new pY(this.beans),t.detail=!0,t.selectable=!1,t.parent=e,cY(e.id)&&(t.id=hY+e.id),t.data=e.data,t.level=e.level+1,e.detailNode=t,t)}setupDetailRowAutoHeight(e,t){const{gos:s,beans:r}=this;if(!s.get("detailRowAutoHeight"))return;const i=()=>{const o=t.clientHeight;if(o!=null&&o>0){const a=()=>{const{rowModel:l,environment:c}=this.beans,{rowNode:u}=e;u.setRowHeight(o+c.getRowBorderWidth()),($C(s,l)||jC(s,l))&&l.onRowHeightChanged()};window.setTimeout(a,0)}},n=uY(r,t,i);e.addDestroyFunc(n),i()}destroy(){this.store={},super.destroy()}},mY={moduleName:"SharedMasterDetail",version:_,beans:[fY],userComponents:{agDetailCellRenderer:rY},dynamicBeans:{detailCellRendererCtrl:KC},apiFunctions:{addDetailGridInfo:iY,removeDetailGridInfo:nY,getDetailGridInfo:oY,forEachDetailGridInfo:aY},dependsOn:[$,iC,Mc],css:[lY]},YC={moduleName:"MasterDetail",version:_,dependsOn:[mY,Ys,zj]};import{_DragModule as vY,_KeyboardNavigationModule as CY}from"ag-grid-community";import{_last as er,_toStringOrNull as bY}from"ag-stack";import{_addGridCommonParams as SY,_getCellByPosition as ao,_getFillHandle as qc,_getLastRow as yY,_getNormalisedMousePosition as qC,_getRowAbove as Zc,_getRowBelow as gi,_getRowNode as wY,_isFiniteNumber as xY,_isRowBefore as FY,_isSameRow as je,_stopPropagationForAgGrid as TY,isRowNumberCol as AY}from"ag-grid-community";import{_getPageBody as ZC,_isVisible as PY,_last as RY,_setDisplayed as MY}from"ag-stack";import{Component as IY,_areCellsEqual as EY,_getCellPositionForEvent as DY,_isRowBefore as LY}from"ag-grid-community";var XC=class extends AF{constructor(){super(...arguments),this.changedCalculatedValues=!1,this.dragging=!1,this.shouldDestroyOnEndDragging=!1}postConstruct(){this.beans.dragSvc.addDragSource({dragStartPixels:0,eElement:this.getGui(),onDragging:e=>{let t=!1;if(this.dragging||(t=!0,this.dragging=!0,ZC(this.beans).classList?.add(this.getDraggingCssClass())),this.updateValuesOnMove(e),t){this.changedCalculatedValues=!1;return}this.beans.rangeSvc.autoScrollService.check(e),this.changedCalculatedValues&&(this.onDrag(e),this.changedCalculatedValues=!1)},onDragStop:e=>{this.dragging=!1,this.onDragEnd(e),this.clearDragProperties()},onDragCancel:()=>{this.dragging=!1,this.onDragCancel(),this.clearDragProperties()}}),this.addManagedEventListeners({cellSelectionChanged:this.updateLocalRangeIfNeeded.bind(this)}),this.addManagedElementListeners(this.getGui(),{pointerdown:JC,mousedown:JC})}getLastCellHovered(){return this.lastCellHovered}getDraggingCssClass(){return`ag-dragging-${this.type===0?"fill":"range"}-handle`}updateValuesOnMove(e){const t=DY(this.gos,e);!t||this.shouldSkipCell(t)||this.lastCellHovered&&EY(t,this.lastCellHovered)||(this.lastCellHovered=t,this.changedCalculatedValues=!0)}clearDragProperties(){this.clearValues(),this.beans.rangeSvc.autoScrollService.ensureCleared(),ZC(this.beans).classList?.remove(this.getDraggingCssClass()),this.shouldDestroyOnEndDragging&&this.destroy()}getType(){return this.type}refresh(e,t){const s=this.cellCtrl,r=this.getGui(),i=t??RY(this.beans.rangeSvc.getCellRanges()),n=i.startRow,o=i.endRow;if(n&&o&&(LY(o,n)?(this.rangeStartRow=o,this.rangeEndRow=n):(this.rangeStartRow=n,this.rangeEndRow=o)),s!==e||!PY(r)){this.cellCtrl=e;const a=e.comp.getParentOfValue();a&&a.appendChild(r)}this.cellRange=i}clearValues(){this.lastCellHovered=void 0}destroy(){if(!this.shouldDestroyOnEndDragging&&this.dragging){MY(this.getGui(),!1),this.shouldDestroyOnEndDragging=!0;return}this.shouldDestroyOnEndDragging=!1,super.destroy(),this.getGui()?.remove()}updateLocalRangeIfNeeded(e){if(!this.cellRange)return;const{id:t,type:s}=this.cellRange;if(!t||e.id!=null&&t!==e.id)return;const r=this.beans.rangeSvc?.getCellRanges().find(i=>i.id===t&&i.type===s);r&&r!==this.cellRange&&(this.cellRange=r)}},JC=e=>{e.stopPropagation()};function kY(e){const t=e.length;let s=0;if(t<=1)return e;for(let u=0;u<e.length;u++){const d=e[u],h=d.toString().split("e-");if(h.length>1){s=Math.max(s,Number.parseInt(h[1],10));continue}Math.floor(d)!==d&&(s=Math.max(s,d.toString().split(".")[1].length))}let r=0,i=0,n=0,o=0;for(let u=0;u<t;u++){const d=e[u];r+=u,i+=d,o+=u*u,n+=u*d}const a=(t*n-r*i)/(t*o-r*r),l=i/t-a*r/t,c=[];for(let u=0;u<=t;u++)c.push(Number.parseFloat((u*a+l).toFixed(s)));return c}function _Y(e,t,s){const r=e==="up"?-1:e==="down"?1:0;if(r===0)return 0;const i=s?.formulaRowIndex,n=t.formulaRowIndex;return i==null||n==null?r:n-i}var fi=Symbol("fillOperationResultType"),GY={[fi]:"skip"},OY={[fi]:"default"};function NY(e){return{[fi]:"value",value:e}}function BY(){return GY}function VY(){return OY}function HY(e){return e!=null&&typeof e=="object"&&fi in e?e:void 0}var UY={tag:"div",cls:"ag-fill-handle"},zY=class extends XC{constructor(){super(UY),this.markedCells=[],this.cellValues=[],this.isUp=!1,this.isLeft=!1,this.isReduce=!1,this.type=0}postConstruct(){super.postConstruct(),this.addManagedElementListeners(this.getGui(),{dblclick:this.onDblClick.bind(this)})}onDblClick(e){TY(e);const{cellRange:t,rangeStartRow:s,beans:r}=this,{rangeSvc:i,visibleCols:n}=r,o=yY(r);if(!o)return;const a=this.getFillHandleDirection();this.dragAxis=a==="xy"?"y":a;const l=i?.createCellRangeFromCellRangeParams({rowStartIndex:s.rowIndex,rowStartPinned:s.rowPinned,columnStart:t.columns[0],rowEndIndex:this.dragAxis==="x"?t.endRow?.rowIndex??null:o.rowIndex,rowEndPinned:this.dragAxis==="x"?t.endRow?.rowPinned:o.rowPinned,columnEnd:this.dragAxis==="x"?er(n.allCols):er(t.columns)});this.isUp=!1,this.isLeft=!1,l&&this.performFill({event:e,initialRange:t,finalRange:l}),this.dragAxis=void 0}updateValuesOnMove(e){super.updateValuesOnMove(e),this.initialXY??(this.initialXY=qC(this.beans,e));const{x:t,y:s}=this.initialXY,{x:r,y:i}=qC(this.beans,e),n=Math.abs(t-r),o=Math.abs(s-i),a=this.getFillHandleDirection();let l;a==="xy"?l=n>o?"x":"y":l=a,l!==this.dragAxis&&(this.dragAxis=l,this.changedCalculatedValues=!0)}shouldSkipCell(e){return AY(e.column)}onDrag(e){if(!this.initialPosition){const s=this.cellCtrl;if(!s)return;this.initialPosition=s.cellPosition}const t=this.getLastCellHovered();t&&this.markPathFrom(this.initialPosition,t)}onDragEnd(e){if(this.initialXY=null,!this.markedCells.length)return;const t=this.dragAxis==="x",{cellRange:s,rangeStartRow:r,rangeEndRow:i,beans:{rangeSvc:n}}=this,o=s.columns.length;let a;if(!this.isUp&&!this.isLeft)a=n.createCellRangeFromCellRangeParams({rowStartIndex:r.rowIndex,rowStartPinned:r.rowPinned,columnStart:s.columns[0],rowEndIndex:t?i.rowIndex:this.lastCellMarked.rowIndex,rowEndPinned:t?i.rowPinned:this.lastCellMarked.rowPinned,columnEnd:t?this.lastCellMarked.column:s.columns[o-1]});else{const l=t?r:this.lastCellMarked;a=n.createCellRangeFromCellRangeParams({rowStartIndex:l.rowIndex,rowStartPinned:l.rowPinned,columnStart:t?this.lastCellMarked.column:s.columns[0],rowEndIndex:i.rowIndex,rowEndPinned:i.rowPinned,columnEnd:s.columns[o-1]})}a&&this.performFill({event:e,initialRange:s,finalRange:a,shouldUpdateRange:!0})}onDragCancel(){this.initialXY=null,this.markedCells.length&&this.clearMarkedPath()}performFill({event:e,initialRange:t,finalRange:s,shouldUpdateRange:r}){const{eventSvc:i,rangeSvc:n}=this.beans;i.dispatchEvent({type:"fillStart"}),this.handleValueChanged(t,s,e),r&&n.setCellRanges([s]),i.dispatchEvent({type:"fillEnd",initialRange:t,finalRange:s})}getFillHandleDirection(){const e=qc(this.gos)?.direction;return e?e!=="x"&&e!=="y"&&e!=="xy"?(this.beans.log.warn(177),"xy"):e:"xy"}handleValueChanged(e,t,s){const{beans:r}=this,{rangeSvc:i,gos:n,valueSvc:o}=r,a=i.getRangeEndRow(e),l=i.getRangeStartRow(e),c=i.getRangeEndRow(t),u=i.getRangeStartRow(t),d=this.dragAxis==="y";if(this.isReduce&&!qc(n)?.suppressClearOnFillReduction){const T=d?e.columns:e.columns.filter(P=>t.columns.indexOf(P)<0),x=d?gi(r,c):u;x&&this.clearCellsInRange(x,a,T);return}const h=[],p=[],g=[],f=[];let m=!0,v=0,C;const b=()=>{h.length=0,p.length=0,g.length=0,f.length=0,v=0,C=void 0},y=(T,x)=>{let P=this.isUp?a:l,L=!1;for(d&&(m=!0,b());!L&&P;){const G=wY(r,P);if(!G)break;if(d&&T)S(h,T,G,()=>!je(P,this.isUp?l:a));else if(x){m=!0,b();for(const O of x)S(h,O,G,()=>O!==(this.isLeft?e.columns[0]:er(e.columns)))}L=je(P,this.isUp?u:c),P=this.isUp?Zc(this.beans,P):gi(r,P)}},S=(T,x,P,L)=>{let G,O=!1,z=x,B=P;if(m)G=o.getValue(x,P,"edit"),p.push(G),g.push(o.getValue(x,P,"edit",!0)),f.push(o.getValueForDisplay({column:x,node:P,from:"edit"}).valueFormatted),m=L();else{const{value:W,fromUserFunction:J,sourceCol:Q,sourceRowNode:de,includeUnchangedValue:me,skipCell:Z}=this.processValues({event:s,values:T,initialValues:p,initialNonAggregatedValues:g,initialFormattedValues:f,col:x,rowNode:P,previousRowNode:C,idx:v++});if(z=Q??x,B=de??P,G=W,O=Z??!1,!O&&x.isCellEditable(P)){const D=o.getValue(x,P,"edit");if(!J){if(Q){const ne=Q.colDef;if(ne.useValueFormatterForExport!==!1&&ne.valueFormatter){const K=o.getValueForDisplay({column:Q,node:de,includeValueFormatted:!0,from:"edit"}).valueFormatted;K!=null&&(G=K)}}x.colDef.useValueParserForImport!==!1&&(G=o.parseValue(x,P,Q?G:bY(G),D))}J&&D===G?O=!me:P.setDataValue(x,G,"rangeSvc")}}O||(C=P,T.push({value:G,column:z,rowNode:B}))},{changeDetectionSvc:w,editSvc:F}=this.beans;F?.beginBulkWrite();try{if(w?.beginDeferred(),d)e.columns.forEach(T=>{y(T)});else{const T=this.isLeft?[...t.columns].reverse():t.columns;y(void 0,T)}F?.stopEditing(void 0,{source:"fillHandle"})}finally{w?.endDeferred(),F?.endBulkWrite()}}clearCellsInRange(e,t,s){const r={startRow:e,endRow:t,columns:s,startColumn:s[0]};this.beans.rangeSvc.clearCellRangeCellValues({cellRanges:[r],restoreSourceInBatch:!0})}processValues(e){const{formula:t,valueSvc:s}=this.beans,{event:r,values:i,initialValues:n,initialNonAggregatedValues:o,initialFormattedValues:a,col:l,rowNode:c,previousRowNode:u,idx:d}=e,h=qc(this.gos)?.setFillValue,p=this.dragAxis==="y";let g;if(p?g=this.isUp?"up":"down":g=this.isLeft?"left":"right",h){const v=s.getValue(l,c,"edit"),C=SY(this.gos,{event:r,values:i.map(({value:S})=>S),initialValues:n,initialNonAggregatedValues:o,initialFormattedValues:a,currentIndex:d,currentCellValue:v,direction:g,column:l,rowNode:c,useValue:NY,skipCell:BY,useDefault:VY}),b=h(C),y=HY(b);if(y){const S=y[fi];if(S==="value")return{value:y.value,fromUserFunction:!0,includeUnchangedValue:!0};if(S==="skip")return{value:v,fromUserFunction:!0,skipCell:!0}}else if(b!==!1)return{value:b,fromUserFunction:!0}}const f=v=>xY(v)||typeof v=="string"&&/^[+-]?\d+(?:\.\d+)?$/.test(v.trim()),m=i.every(({value:v})=>f(v));if(r.altKey||!m){const v=String(er(i)?.value??"");if(m&&n.length===1){const F=this.isUp||this.isLeft?-1:1;return{value:Number.parseFloat(v)+1*F,fromUserFunction:!1}}const{value:C,column:b,rowNode:y}=i[d%i.length];let S;const w=b.allowFormula&&t?.isFormula(v);if(w){const F=_Y(g,c,u),T=g==="left"?-1:g==="right"?1:0;S=t.updateFormulaByOffset({value:v,rowDelta:F,columnDelta:T})}else S=C;return{value:S,fromUserFunction:!1,sourceCol:w?void 0:b,sourceRowNode:y}}return{value:er(kY(i.map(({value:v})=>Number(v)))),fromUserFunction:!1}}clearValues(){this.clearMarkedPath(),this.clearCellValues(),this.lastCellMarked=void 0,super.clearValues()}clearMarkedPath(){for(const e of this.markedCells){if(!e.isAlive())continue;const{comp:t}=e;t.toggleCss("ag-selection-fill-top",!1),t.toggleCss("ag-selection-fill-right",!1),t.toggleCss("ag-selection-fill-bottom",!1),t.toggleCss("ag-selection-fill-left",!1)}this.markedCells.length=0,this.isUp=!1,this.isLeft=!1,this.isReduce=!1}clearCellValues(){this.cellValues.length=0}markPathFrom(e,t){if(this.clearMarkedPath(),this.clearCellValues(),this.dragAxis==="y"){if(je(t,e))return;const s=FY(t,e),{rangeStartRow:r,rangeEndRow:i}=this;s&&(t.rowPinned==r.rowPinned&&t.rowIndex>=r.rowIndex||r.rowPinned!=i.rowPinned&&t.rowPinned==i.rowPinned&&t.rowIndex<=i.rowIndex)?(this.reduceVertical(e,t),this.isReduce=!0):(this.extendVertical(e,t,s),this.isReduce=!1)}else{const s=e.column,r=t.column;if(s===r)return;const i=s.allColsIndex,n=r.allColsIndex;n<=i&&n>=this.cellRange.columns[0].allColsIndex?(this.reduceHorizontal(e,t),this.isReduce=!0):(this.extendHorizontal(e,t,n<i),this.isReduce=!1)}this.lastCellMarked=t}extendVertical(e,t,s){const r=this.beans,{rangeSvc:i}=r;let n=e;do{const o=this.cellRange,a=o.columns.length;for(let l=0;l<a;l++){const c=o.columns[l],d={...{rowIndex:n.rowIndex,rowPinned:n.rowPinned},column:c},h=i.isCellInSpecificRange(d,o),p=je(n,e);if(s&&(this.isUp=!0),!p){const g=ao(r,d);if(g){this.markedCells.push(g);const f=g.comp;h||(f.toggleCss("ag-selection-fill-left",l===0),f.toggleCss("ag-selection-fill-right",l===a-1)),f.toggleCss(s?"ag-selection-fill-top":"ag-selection-fill-bottom",je(n,t))}}}if(je(n,t))break}while(n=s?Zc(this.beans,n):gi(r,n))}reduceVertical(e,t){let s=e;const r=this.beans;do{const i=this.cellRange,n=i.columns.length,o=je(s,t);for(let a=0;a<n;a++){const c={...{rowIndex:s.rowIndex,rowPinned:s.rowPinned},column:i.columns[a]},u=ao(r,c);u&&(this.markedCells.push(u),u.comp.toggleCss("ag-selection-fill-bottom",je(s,t)))}if(o)break}while(s=Zc(r,s))}extendHorizontal(e,t,s){const r=this.beans,{visibleCols:i}=r,n=i.allCols,o=(s?t.column:e.column).allColsIndex,a=(s?this.cellRange.columns[0]:t.column).allColsIndex,l=s?0:1,c=n.slice(o+l,a+l),{rangeStartRow:u,rangeEndRow:d}=this;for(const h of c){let p=u,g;do{g=je(p,d);const f=ao(r,{rowIndex:p.rowIndex,rowPinned:p.rowPinned,column:h});if(f){this.markedCells.push(f);const m=f.comp;m.toggleCss("ag-selection-fill-top",je(p,u)),m.toggleCss("ag-selection-fill-bottom",je(p,d)),s?(this.isLeft=!0,m.toggleCss("ag-selection-fill-left",h===c[0])):m.toggleCss("ag-selection-fill-right",h===er(c))}p=gi(r,p)}while(!g)}}reduceHorizontal(e,t){const s=this.beans,{visibleCols:r}=s,i=r.allCols,n=t.column.allColsIndex,o=e.column.allColsIndex,a=i.slice(n,o),{rangeStartRow:l,rangeEndRow:c}=this;for(const u of a){let d=l,h;do{h=je(d,c);const p=ao(this.beans,{rowIndex:d.rowIndex,rowPinned:d.rowPinned,column:u});p&&(this.markedCells.push(p),p.comp.toggleCss("ag-selection-fill-right",u===a[0])),d=gi(s,d)}while(!h)}}refresh(e,t){const s=t??this.beans.rangeSvc.getCellRanges()[0];if(!s.startRow||!s.endRow){this.destroy();return}super.refresh(e,s)}};import{_last as QC}from"ag-stack";import{CellRangeType as eb,_isSameRow as WY}from"ag-grid-community";var KY=class extends XC{constructor(){super({tag:"div",cls:"ag-range-handle"}),this.type=1,this.rangeFixed=!1}onDrag(e){const t=this.getLastCellHovered();if(!t)return;const s=this.beans.rangeSvc,r=this.cellRange??QC(s.getCellRanges());r&&(this.rangeFixed||(this.fixRangeStartEnd(r),this.rangeFixed=!0),this.endPosition={rowIndex:t.rowIndex,rowPinned:t.rowPinned,column:t.column},s.getCellRanges().length===2&&s.getCellRanges()[0].type===eb.DIMENSION&&r.type===eb.VALUE&&!WY(this.endPosition,s.getRangeEndRow(r))&&s.updateRangeRowBoundary({cellRange:s.getCellRanges()[0],boundary:"end",cellPosition:{...this.endPosition,column:s.getCellRanges()[0].columns[0]},silent:!0}),s.extendRangeToCell(r,this.endPosition))}shouldSkipCell(e){return!1}onDragEnd(e){const t=this.cellRange??QC(this.beans.rangeSvc.getCellRanges());t&&(this.fixRangeStartEnd(t),this.rangeFixed=!1)}onDragCancel(){this.rangeFixed=!1}fixRangeStartEnd(e){const t=this.beans.rangeSvc,s=t.getRangeStartRow(e),r=t.getRangeEndRow(e),i=e.columns[0];e.startRow=s,e.endRow=r,e.startColumn=i}},$Y=".ag-cell-range-selected.ag-cell-range-chart,.ag-cell-range-selected:not(.ag-cell-focus),.ag-grid-viewport:not(.ag-has-focus) .ag-cell-range-single-cell:not(.ag-cell-inline-editing){background-color:var(--ag-range-selection-background-color);&.ag-column-hover{background-image:var(--ag-internal-column-hover-image),var(--ag-internal-range-overlap-image,none)}&.ag-cell-range-chart{background-color:var(--ag-range-selection-chart-background-color)!important;&.ag-cell-range-chart-category{background-color:var(--ag-range-selection-chart-category-background-color)!important}}}.ag-cell-range-selected-1.ag-cell-range-chart,.ag-cell-range-selected-1.ag-formula-range,.ag-cell-range-selected-1:not(.ag-cell-focus),.ag-root:not(.ag-context-menu-open) .ag-grid-viewport:not(.ag-has-focus) .ag-cell-range-selected-1:not(.ag-cell-inline-editing){background-color:var(--ag-range-selection-background-color);&.ag-column-hover{background-image:var(--ag-internal-column-hover-image)}}.ag-cell-range-selected-2{--ag-internal-range-overlap-image:linear-gradient(var(--ag-range-selection-background-color),var(--ag-range-selection-background-color))}.ag-cell-range-selected-3{--ag-internal-range-overlap-image:linear-gradient(var(--ag-range-selection-background-color),var(--ag-range-selection-background-color)),linear-gradient(var(--ag-range-selection-background-color),var(--ag-range-selection-background-color))}.ag-cell-range-selected-4{--ag-internal-range-overlap-image:linear-gradient(var(--ag-range-selection-background-color),var(--ag-range-selection-background-color)),linear-gradient(var(--ag-range-selection-background-color),var(--ag-range-selection-background-color)),linear-gradient(var(--ag-range-selection-background-color),var(--ag-range-selection-background-color))}.ag-cell-range-selected-2.ag-cell-range-chart,.ag-cell-range-selected-2.ag-formula-range,.ag-cell-range-selected-2:not(.ag-cell-focus),.ag-cell-range-selected-3.ag-cell-range-chart,.ag-cell-range-selected-3.ag-formula-range,.ag-cell-range-selected-3:not(.ag-cell-focus),.ag-cell-range-selected-4.ag-cell-range-chart,.ag-cell-range-selected-4.ag-formula-range,.ag-cell-range-selected-4:not(.ag-cell-focus){background-image:var(--ag-internal-range-overlap-image)}.ag-cell.ag-cell-range-selected:not(.ag-cell-range-single-cell){&.ag-cell-range-top{border-top-color:var(--ag-range-selection-border-color);border-top-style:var(--ag-range-selection-border-style)}&.ag-cell-range-right{border-right-color:var(--ag-range-selection-border-color);border-right-style:var(--ag-range-selection-border-style)}&.ag-cell-range-bottom{border-bottom-color:var(--ag-range-selection-border-color);border-bottom-style:var(--ag-range-selection-border-style)}&.ag-cell-range-left{border-left-color:var(--ag-range-selection-border-color);border-left-style:var(--ag-range-selection-border-style)}}.ag-cell.ag-selection-fill-top,.ag-cell.ag-selection-fill-top.ag-cell-range-selected{border-top:1px dashed;border-top-color:var(--ag-range-selection-border-color)}:where(.ag-ltr) .ag-cell.ag-selection-fill-right,:where(.ag-ltr) .ag-cell.ag-selection-fill-right.ag-cell-range-selected{border-right:1px dashed var(--ag-range-selection-border-color)!important}:where(.ag-rtl) .ag-cell.ag-selection-fill-right,:where(.ag-rtl) .ag-cell.ag-selection-fill-right.ag-cell-range-selected{border-left:1px dashed var(--ag-range-selection-border-color)!important}.ag-cell.ag-selection-fill-bottom,.ag-cell.ag-selection-fill-bottom.ag-cell-range-selected{border-bottom:1px dashed;border-bottom-color:var(--ag-range-selection-border-color)}:where(.ag-ltr) .ag-cell.ag-selection-fill-left,:where(.ag-ltr) .ag-cell.ag-selection-fill-left.ag-cell-range-selected{border-left:1px dashed var(--ag-range-selection-border-color)!important}:where(.ag-rtl) .ag-cell.ag-selection-fill-left,:where(.ag-rtl) .ag-cell.ag-selection-fill-left.ag-cell-range-selected{border-right:1px dashed var(--ag-range-selection-border-color)!important}.ag-fill-handle,.ag-range-handle{background-color:var(--ag-range-selection-border-color);bottom:-1px;height:6px;position:absolute;width:6px}:where(.ag-ltr) .ag-fill-handle,:where(.ag-ltr) .ag-range-handle{right:-1px}:where(.ag-rtl) .ag-fill-handle,:where(.ag-rtl) .ag-range-handle{left:-1px}.ag-fill-handle{cursor:crosshair}:where(.ag-ltr) .ag-range-handle{cursor:nwse-resize}:where(.ag-rtl) .ag-range-handle{cursor:nesw-resize}.ag-cell{@media (forced-colors:active){--ag-range-selection-background-color:SelectedItem;--ag-range-selection-chart-background-color:SelectedItem;--ag-range-selection-chart-category-background-color:SelectedItem;--ag-range-selection-border-color:Highlight}}";function jY(e){return e.rangeSvc?.getCellRanges()??null}function YY(e,t){e.rangeSvc?.addCellRange(t)}function tb(e){e.rangeSvc?.removeAllCellRanges()}import{AutoScrollService as qY,_areEqual as sb,_defaultComparator as ZY,_exists as XY,_last as Ee,_makeNull as rb,_missing as JY,_removeAllFromArray as QY,_removeFromArray as lo}from"ag-stack";import{BeanStub as eq,KeyCode as tq,_areCellsEqual as sq,_canScrollVertically as rq,_getAbsoluteRowIndex as ib,_getCellCtrlForEventTarget as iq,_getEnableColumnSelection as nq,_getFirstRow as Xc,_getLastRow as Jc,_getRowAbove as mi,_getRowBelow as tr,_getRowCtrlForEventTarget as oq,_getRowNode as aq,_getSuppressMultiRanges as lq,_interpretAsRightClick as cq,_isCellSelectionEnabled as co,_isRowBefore as De,_isSameRow as St,_isUsingNewCellSelectionAPI as uq}from"ag-grid-community";import{_last as dq,_missing as hq,_requestAnimationFrame as pq,_setAriaSelected as gq}from"ag-stack";import{CellRangeType as uo,_isSameRow as nb}from"ag-grid-community";var vi="ag-cell-range-selected",fq="ag-cell-range-chart",mq="ag-cell-range-single-cell",ob="ag-cell-range-chart-category",vq="ag-cell-range-handle",Cq="ag-cell-range-top",bq="ag-cell-range-right",Sq="ag-cell-range-bottom",yq="ag-cell-range-left";function wq(e){const t=e.get("cellSelection");return t!==void 0?typeof t!="boolean"?t.handle?.mode==="range":!1:e.get("enableRangeHandle")}function ab(e){const t=e.get("cellSelection");return t!==void 0?typeof t!="boolean"?t.handle?.mode==="fill":!1:e.get("enableFillHandle")}var xq=class{constructor(e,t){this.beans=e,this.cellCtrl=t,this.rangeColorClass=null,this.handleColorClass=null,this.refreshScheduled=!1,this.rangeSvc=e.rangeSvc}setComp(e){this.cellComp=e,this.eGui=this.cellCtrl.eGui,this.onCellSelectionChanged()}unsetComp(){this.selectionHandle=this.beans.context.destroyBean(this.selectionHandle)}onCellSelectionChanged(){const e=this.cellComp;if(!e)return;const{rangeSvc:t,cellCtrl:s,eGui:r}=this,i=t.getCellRangeCount(s.cellPosition);this.rangeCount=i;const n=this.getHasChartRange();this.hasChartRange=n,e.toggleCss(vi,i!==0),e.toggleCss(`${vi}-1`,i===1),e.toggleCss(`${vi}-2`,i===2),e.toggleCss(`${vi}-3`,i===3),e.toggleCss(`${vi}-4`,i>=4),e.toggleCss(fq,n),gq(r,i>0?!0:void 0),e.toggleCss(mq,this.isSingleCell()),this.updateRangeBorders(),this.refreshRangeStyleAndHandle()}updateRangeBorders(){const e=this.getRangeBorders(),t=this.isSingleCell(),s=!t&&e.top,r=!t&&e.right,i=!t&&e.bottom,n=!t&&e.left,o=this.cellComp;o.toggleCss(Cq,s),o.toggleCss(bq,r),o.toggleCss(Sq,i),o.toggleCss(yq,n)}isSingleCell(){const{rangeSvc:e}=this;return this.rangeCount===1&&!!e&&!e.isMoreThanOneCell()}getHasChartRange(){const{rangeSvc:e}=this;if(!this.rangeCount||!e)return!1;const t=e.getCellRanges();return t.length>0&&t.every(s=>[uo.DIMENSION,uo.VALUE].includes(s.type))}onDisplayedColumnsChanged(){this.rangeCount>0&&(this.updateRangeBorders(),this.refreshRangeStyleAndHandle())}getRangeBorders(){const e=this.beans.gos.get("enableRtl");let t=!1,s=!1,r=!1,i=!1;const{rangeSvc:n,beans:{visibleCols:o},cellCtrl:{cellPosition:a}}=this,l=a.column,c=n.getCellRanges().filter(h=>n.isCellInSpecificRange(a,h));if(!c.length)return{top:t,right:s,bottom:r,left:i};let u,d;e?(u=o.getColAfter(l),d=o.getColBefore(l)):(u=o.getColBefore(l),d=o.getColAfter(l)),u||(i=!0),d||(s=!0);for(let h=0;h<c.length&&!(t&&s&&r&&i);h++){const p=c[h],g=n.getRangeStartRow(p),f=n.getRangeEndRow(p);!t&&nb(g,a)&&(t=!0),!r&&nb(f,a)&&(r=!0),!i&&u&&p.columns.indexOf(u)<0&&(i=!0),!s&&d&&p.columns.indexOf(d)<0&&(s=!0)}return{top:t,right:s,bottom:r,left:i}}refreshRangeStyleAndHandle(){const{context:e}=this.beans;if(e.isDestroyed())return;this.styleCellForRangeType();const t=this.getRangeForHandle();this.selectionHandle&&!t&&(this.selectionHandle=e.destroyBean(this.selectionHandle)),t&&this.addSelectionHandle(t),this.refreshHandleColor(t),this.cellComp.toggleCss(vq,!!this.selectionHandle)}reattachHandle(e){const t=this.selectionHandle?.getGui();t&&e.appendChild(t)}scheduleRefreshRangeStyleAndHandle(){this.refreshScheduled||(this.refreshScheduled=!0,pq(this.beans,()=>{this.cellCtrl.rangeFeature===this&&(this.refreshScheduled=!1,this.refreshRangeStyleAndHandle())}))}styleCellForRangeType(){if(this.hasChartRange){const{rangeSvc:e}=this,t=e.getCellRanges()[0],r=t.type===uo.DIMENSION&&e.isCellInSpecificRange(this.cellCtrl.cellPosition,t);this.cellComp.toggleCss(ob,r)}else this.cellComp.toggleCss(ob,!1),this.applyRangeColor(this.getRangeColorClass())}applyRangeColor(e){this.rangeColorClass&&this.rangeColorClass!==e&&(this.cellComp.toggleCss(this.rangeColorClass,!1),this.cellComp.toggleCss("ag-formula-range",!1)),e&&(this.cellComp.toggleCss(e,!0),this.cellComp.toggleCss("ag-formula-range",e.startsWith("ag-formula-range"))),this.rangeColorClass=e??null}getRangeColorClass(){const{rangeSvc:e,rangeCount:t}=this;if(!e||!t)return null;const s=e.getCellRanges();for(let r=s.length-1;r>=0;r--){const i=s[r],n=i.colorClass;if(n&&e.isCellInSpecificRange(this.cellCtrl.cellPosition,i))return n}return null}refreshHandleColor(e){const t=this.selectionHandle?.getGui?.(),s=e?.colorClass??null;if(!t){this.handleColorClass=null;return}this.handleColorClass&&this.handleColorClass!==s&&t.classList.remove(this.handleColorClass),s?t.classList.add(s):this.handleColorClass&&t.classList.remove(this.handleColorClass),this.handleColorClass=s??null}getRangeForHandle(){const{gos:e,editSvc:t}=this.beans,s=this.rangeSvc,r=s.getCellRanges(),i=r.length;if(this.rangeCount<1||i<1)return null;const n=t?.isRangeSelectionEnabledWhileEditing(),o=n?r:[dq(r)];for(const a of o){const{cellPosition:l,column:c}=this.cellCtrl,u=ab(e)&&!c.isSuppressFillHandle(),d=wq(e);let p=!t?.isEditing(this.cellCtrl,{withOpenEditor:!0})&&(n||i===1&&(u||d));if(this.hasChartRange&&(p=a.type===uo.VALUE),p&&a.endRow!=null&&s.isContiguousRange(a)&&s.isBottomRightCell(a,l))return a}return null}addSelectionHandle(e){const{editSvc:t,gos:s,context:r,registry:i}=this.beans,n=t?.isRangeSelectionEnabledWhileEditing(),o=e.type,l=!n&&ab(s)&&hq(o)?0:1;if(this.selectionHandle&&this.selectionHandle.getType()!==l&&(this.selectionHandle=r.destroyBean(this.selectionHandle)),!this.selectionHandle){const c=i.createDynamicBean(l===0?"fillHandle":"rangeHandle",!1);c&&(this.selectionHandle=r.createBean(c))}this.selectionHandle?.refresh(this.cellCtrl,e)}destroy(){this.unsetComp()}};import{BeanStub as Fq,_isCellSelectionEnabled as lb}from"ag-grid-community";var Tq=class extends PF{constructor(e){super(),this.eContainer=e}postConstruct(){const{beans:e,gos:t,eContainer:s}=this,r=e.rangeSvc,i={eElement:s,onDragStart:r.onDragStart.bind(r),onDragStop:r.onDragStop.bind(r),onDragging:r.onDragging.bind(r)},n=e.dragSvc,o=n.addDragSource.bind(n,i),a=n.removeDragSource.bind(n,i);this.addManagedPropertyListeners(["enableRangeSelection","cellSelection"],()=>{lb(t)?o():a()}),this.addDestroyFunc(a),lb(t)&&o()}};import{BeanStub as Aq}from"ag-grid-community";var Pq=class extends RF{constructor(e,t){super(),this.column=e,this.eGui=t}postConstruct(){this.addManagedElementListeners(this.eGui,{click:e=>e&&this.onClick(e)})}onClick(e){this.beans.rangeSvc?.handleColumnSelection(this.column,e)}};import{BeanStub as Rq}from"ag-grid-community";var Mq=class extends MF{constructor(e,t){super(),this.column=e,this.comp=t,this.columnMap=new Map,this.isActive=!1}postConstruct(){const e=this.onRangeSelectionChanged.bind(this);this.addManagedEventListeners({rangeSelectionChanged:e,displayedColumnsChanged:e}),this.addManagedPropertyListener("cellSelection",this.refreshActive.bind(this)),this.refreshActive()}resetColumnMap(){const{columnMap:e,column:t}=this;if(e.clear(),t.isColumn){e.set(t,!1);return}const s=t.getDisplayedLeafColumns();for(let r=0,i=s.length;r<i;++r)e.set(s[r],!1)}refreshActive(){const{gos:e,rangeSvc:t}=this.beans,s=e.get("cellSelection"),r=!!(s&&t&&typeof s=="object"&&s.enableHeaderHighlight);r!==this.isActive&&(this.isActive=r,r?this.onRangeSelectionChanged():this.comp.toggleCss("ag-header-range-highlight",!1))}onRangeSelectionChanged(){if(!this.isActive)return;this.resetColumnMap();const e=this.columnMap;let t=e.size;const s=this.beans.rangeSvc.getCellRanges();for(let r=0,i=s.length;r<i&&t>0;++r){const n=s[r].columns;for(let o=0,a=n.length;o<a;++o){const l=n[o];e.get(l)===!1&&(e.set(l,!0),--t)}}this.comp.toggleCss("ag-header-range-highlight",e.size>0&&t===0)}destroy(){super.destroy(),this.comp=null,this.column=null}},Iq=class extends IF{constructor(){super(...arguments),this.beanName="rangeSvc",this.rangeSelectionExtensions=[],this.cellRanges=[],this.bodyScrollListener=this.onBodyScroll.bind(this),this.dragging=!1,this.intersectionRange=!1,this.columnRangeSelectionCtx={}}wireBeans(e){this.rowModel=e.rowModel,this.dragSvc=e.dragSvc,this.colModel=e.colModel,this.visibleCols=e.visibleCols,this.cellNavigation=e.cellNavigation,this.ctrlsSvc=e.ctrlsSvc}postConstruct(){const e=this.onColumnsChanged.bind(this),t=()=>this.removeAllCellRanges(),s=this.refreshLastRangeStart.bind(this);this.addManagedEventListeners({newColumnsLoaded:e,columnVisible:e,columnValueChanged:e,columnPivotModeChanged:t,columnRowGroupChanged:t,columnPivotChanged:t,columnGroupOpened:s,columnMoved:s,columnPinned:s}),this.ctrlsSvc.whenReady(this,r=>{const i=r.gridBodyCtrl;this.autoScrollService=new qY({scrollContainer:i.eGridViewport,scrollAxis:"xy",getVerticalPosition:()=>i.scrollFeature.getVScrollPosition().top,setVerticalPosition:n=>i.scrollFeature.setVerticalScrollPosition(n),getHorizontalPosition:()=>i.scrollFeature.getHScrollPosition().left,setHorizontalPosition:n=>i.scrollFeature.setHorizontalScrollPosition(n),shouldSkipVerticalScroll:()=>!rq(this.beans),shouldSkipHorizontalScroll:()=>!i.scrollFeature.isHorizontalScrollShowing(),getTopOffset:()=>i.getTopPinnedRowsOffset(),getBottomOffset:()=>i.getBottomPinnedRowsOffset()})})}registerRangeSelectionExtension(e){this.rangeSelectionExtensions.includes(e)||this.rangeSelectionExtensions.push(e)}unregisterRangeSelectionExtension(e){lo(this.rangeSelectionExtensions,e)}shouldSuppressRangeSelection(e){return this.rangeSelectionExtensions.some(t=>t.shouldSuppressRangeSelection?.(e))}shouldSkipColumn(e){return this.rangeSelectionExtensions.some(t=>t.shouldSkipColumn?.(e))}isAllColumnsSelectionCell(e){return this.rangeSelectionExtensions.some(t=>t.isAllColumnsSelectionCell?.(e))}isAllColumnsRange(e,t){return this.rangeSelectionExtensions.some(s=>s.isAllColumnsRange?.(e,t))}updateSelectionModeForCell(e){this.setSelectionMode(this.isAllColumnsSelectionCell(e))}onDragStart(e){const t=this.gos,s=e.target;if(!co(t)||oq(t,s)?.isSuppressMouseEvent(e)||this.shouldSuppressRangeSelection(s))return;const{shiftKey:r}=e,i=this.isMultiRange(e),n=r&&!!this.cellRanges?.length;!i&&(!n||XY(Ee(this.cellRanges).type))&&this.removeAllCellRanges(!0);const o=this.dragSvc.startTarget;if(o&&this.updateValuesOnMove(o),!!this.lastCellHovered){if(this.dragging=!0,this.lastMouseEvent=e,this.intersectionRange=i&&this.getCellRangeCount(this.lastCellHovered)>1,n||this.setNewestRangeStartCell(this.lastCellHovered),this.cellRanges.length>0)this.draggingRange=Ee(this.cellRanges);else{const a={rowIndex:this.lastCellHovered.rowIndex,rowPinned:this.lastCellHovered.rowPinned},l=this.getColumnsFromModel([this.lastCellHovered.column]);if(!l?.length)return;this.draggingRange={startRow:a,endRow:a,columns:l,startColumn:this.newestRangeStartCell.column},this.cellRanges.push(this.draggingRange)}this.ctrlsSvc.getGridBodyCtrl().eGridViewport.addEventListener("scroll",this.bodyScrollListener,{passive:!0}),this.dispatchChangedEvent(!0,!1,this.draggingRange.id)}}onDragging(e){const{dragging:t,lastCellHovered:s,newestRangeStartCell:r,autoScrollService:i,cellHasChanged:n}=this;if(!t||!e)return;this.updateValuesOnMove(e.target),this.lastMouseEvent=e;const o=p=>s?.rowPinned===p&&r.rowPinned===p,a=o("top")||o("bottom");if(i.check(e,a),!n||!s)return;const l=r?.column,c=s?.column,u=this.calculateColumnsBetween(l,c);if(!u)return;const{rowIndex:d,rowPinned:h}=s;this.draggingRange.endRow={rowIndex:d,rowPinned:h},this.draggingRange.columns=u,this.dispatchChangedEvent(!1,!1,this.draggingRange.id)}onDragStop(){if(!this.dragging)return;const{id:e}=this.draggingRange;this.autoScrollService.ensureCleared(),this.ctrlsSvc.getGridBodyCtrl().eGridViewport.removeEventListener("scroll",this.bodyScrollListener),this.lastMouseEvent=null,this.dragging=!1,this.draggingRange=void 0,this.lastCellHovered=void 0,this.intersectionRange&&(this.intersectionRange=!1,this.intersectLastRange()),this.dispatchChangedEvent(!1,!0,e)}onColumnsChanged(){this.refreshLastRangeStart();for(const t of this.cellRanges){const s=t.columns;t.columns=t.columns.filter(i=>i.isVisible()&&i.displayed),!sb(s,t.columns)&&this.dispatchChangedEvent(!1,!0,t.id)}const e=this.cellRanges.length;this.cellRanges=this.cellRanges.filter(t=>t.columns.length>0),e>this.cellRanges.length&&this.dispatchChangedEvent(!1,!0)}refreshLastRangeStart(){const e=Ee(this.cellRanges);e&&this.refreshRangeStart(e)}isContiguousRange(e){const t=e.columns,s=t.length;if(!s)return!1;let r=t[0].allColsIndex,i=r;for(let n=1;n<s;++n){const o=t[n].allColsIndex;o<r?r=o:o>i&&(i=o)}return i-r+1===s}getRangeStartRow(e){return e.startRow&&e.endRow?De(e.startRow,e.endRow)?e.startRow:e.endRow:{rowIndex:0,rowPinned:(this.beans.pinnedRowModel?.getPinnedTopRowCount()??0)>0?"top":null}}getRangeEndRow(e){if(e.startRow&&e.endRow)return De(e.startRow,e.endRow)?e.endRow:e.startRow;const t=this.beans.pinnedRowModel?.getPinnedBottomRowCount()??0;return t>0?{rowIndex:t-1,rowPinned:"bottom"}:{rowIndex:this.rowModel.getRowCount()-1,rowPinned:null}}getRangeRowCount(e){const t=this.beans,s=this.getRangeStartRow(e),r=this.getRangeEndRow(e),i=ib(t,s);return ib(t,r)-i+1}handleCellMouseDown(e,t){const s=e.ctrlKey||e.metaKey;this.handleCellSelectionInput(t,{target:e.target,shiftKey:e.shiftKey,isRightClick:cq(this.beans,e),isMultiRange:this.isMultiRange(e),isMultiKey:s,preventDefault:()=>e.preventDefault()})}handleCellKeyboardSelect(e,t){const s=e.ctrlKey||e.metaKey;this.handleCellSelectionInput(t,{target:e.target,shiftKey:e.shiftKey,isRightClick:!1,isMultiRange:this.isMultiRangeForKeyState(s),isMultiKey:s,preventDefault:()=>e.preventDefault()})}handleCellSelectionInput(e,t){const{target:s,shiftKey:r,isRightClick:i,isMultiRange:n,isMultiKey:o,preventDefault:a}=t;if(this.shouldSuppressRangeSelection(s))return;const l=this.isAllColumnsSelectionCell(e);if(l&&a(),r)return this.extendLatestRangeToCell(e);this.updateSelectionModeForCell(e);const c=this.calculateColumnsBetween(e.column,e.column);if(!c)return;const u=l?this.findContainingRange({columns:c,startRow:e,endRow:e}):void 0;if(l&&i&&u)return;l&&!!u&&n&&o&&u?this.removeRowFromAllColumnsRange(e,u):this.setRangeToCell(e,n)}isMultiRange(e){return this.isMultiRangeForKeyState(e.ctrlKey||e.metaKey)}isMultiRangeForKeyState(e){const{editingWithRanges:t,allowMulti:s}=this.getMultiRangeContext();return t||(s?e:!1)}getMultiRangeContext(){const{gos:e,editSvc:t}=this.beans,s=!!t?.isEditing()&&!!t?.isRangeSelectionEnabledWhileEditing(),r=lq(e)&&!s;return{editingWithRanges:s,suppressMultiRanges:r,allowMulti:!r}}removeRowFromAllColumnsRange(e,t){const{beans:s,cellRanges:r}=this,i=Xc(s),n=Jc(s),o=this.getRangeStartRow(t),a=this.getRangeEndRow(t);if(!o&&St(i,e))ho(t,tr(s,i),"top");else if(!a&&St(n,e))ho(t,mi(s,n),"bottom");else if(St(o,a))lo(r,t);else if(St(o,e))ho(t,tr(s,e),"top");else if(St(a,e))ho(t,mi(s,e),"bottom");else{const l=mi(s,e),c=tr(s,e);t.startRow=o,t.endRow=l??void 0,r.push({...t,startRow:c??void 0,endRow:a})}this.dispatchChangedEvent(!0,!0)}setRangeToCell(e,t=!1){const{gos:s}=this;if(!co(s))return;this.updateSelectionModeForCell(e);const r=this.calculateColumnsBetween(e.column,e.column);if(!r)return;const{suppressMultiRanges:i}=this.getMultiRangeContext();(i||!t||JY(this.cellRanges))&&this.removeAllCellRanges(!0);const n={rowIndex:e.rowIndex,rowPinned:e.rowPinned},o={startRow:n,endRow:n,columns:r,startColumn:e.column},a=this.ensureRangeStartColumn(o);a&&(this.cellRanges.push(o),this.setNewestRangeStartCell({...e,column:a}),this.onDragStop(),this.dispatchChangedEvent(!0,!0))}getRangeLastColumn(e){const t=e.columns[0],s=Ee(e.columns);return this.newestRangeStartCell?.column===t?s:t}extendRangeRowCountBy(e,t){const{beans:s}=this,{startRow:r,endRow:i}=e;if(!r||!i)return;let n=0,o;const a=De(i,r);a?o=r:o=i;const l=t>0?tr:mi,c=Math.abs(t);for(;n<c;){const d=l(s,o);if(!d)break;o=d,n++}if(n!==c)return;const u={...o,column:this.getRangeLastColumn(e)};this.updateRangeRowBoundary({cellRange:e,boundary:a?"start":"end",cellPosition:u})}extendRangeColumnCountBy(e,t){const{columns:s}=e;if(t===0)return;const r=this.getColumnsFromModel();if(!r)return;const i=this.ensureRangeStartColumn(e);if(!i)return;const n=Ee(s),o=i===s[0]?n:s[0];if(!n||!o)return;let a=r.indexOf(i);const l=r.indexOf(o),c=l<a;c&&(a=l);const d=s.length+t;if(d<=0)return;const h=[];for(let p=a;p<a+d;p++){const g=r[p];if(!g)break;h.push(g)}if(h.length===d){if(c){const p=Ee(h);e.startColumn=p,this.focusCellOnNewColumn(e,p)}e.columns=h,this.dispatchChangedEvent(!0,!0,e.id)}}extendLatestRangeToCell(e){if(this.isEmpty()||!this.newestRangeStartCell)return;const t=Ee(this.cellRanges);this.updateSelectionModeForCell(e),this.updateRangeRowBoundary({cellRange:t,boundary:"end",cellPosition:e})}extendRangeToCell(e,t){e&&(this.updateSelectionModeForCell(t),this.updateRangeRowBoundary({cellRange:e,boundary:"end",cellPosition:t}))}updateRangeRowBoundary(e){const{cellRange:t,boundary:s,cellPosition:r,silent:i=!1}=e,n=r.column,o=this.ensureRangeStartColumn(t);if(!o)return;const a=this.calculateColumnsBetween(o,n);!a||Lq(t,r)||(s==="start"&&this.focusCellOnNewRow(t,r),t.columns=a,t[s==="start"?"startRow":"endRow"]={rowIndex:r.rowIndex,rowPinned:r.rowPinned},i||this.dispatchChangedEvent(!0,!0,t.id))}getRangeEdgeColumns(e){const t=this.visibleCols.allCols,s=e.columns;let r=-1,i=-1;for(let n=0,o=s.length;n<o;++n){const a=s[n].allColsIndex;a>-1&&((r===-1||a<r)&&(r=a),a>i&&(i=a))}return{left:t[r],right:t[i]}}extendLatestRangeInDirection(e){if(this.isEmpty()||!this.newestRangeStartCell)return;const t=e.key,s=e.ctrlKey||e.metaKey,r=Ee(this.cellRanges),i=this.newestRangeStartCell,n=r.endRow.rowIndex,o=r.endRow.rowPinned,l={column:this.getRangeLastColumn(r),rowIndex:n,rowPinned:o},c=this.cellNavigation.getNextCellToFocus(t,l,s);if(c&&!this.shouldSkipColumn(c.column))return this.setCellRange({rowStartIndex:i.rowIndex,rowStartPinned:i.rowPinned,rowEndIndex:c.rowIndex,rowEndPinned:c.rowPinned,columnStart:i.column,columnEnd:c.column}),c}setCellRange(e){co(this.gos)&&(this.removeAllCellRanges(!0),this.addCellRange(e))}setCellRanges(e){if(sb(this.cellRanges,e)||!this.verifyCellRanges(this.gos))return;this.setSelectionMode(!1),this.removeAllCellRanges(!0);const t=this.getColumnsFromModel(this.visibleCols.allCols)??[];let s=!1;for(const r of e){if(r.columns&&r.startRow){const i=this.getColumnsFromModel(r.columns);if(!i||i.length===0)continue;r.columns=i;const{startRow:n}=r;this.setNewestRangeStartCell({rowIndex:n.rowIndex,rowPinned:n.rowPinned,column:r.columns[0]})}!s&&t.length>0&&this.isAllColumnsRange(r,t)&&(s=!0),this.cellRanges.push(r)}this.setSelectionMode(s),this.dispatchChangedEvent(!1,!0)}clearCellRangeCellValues(e){const{beans:t,eventSvc:s}=this,{cellEventSource:r="rangeSvc",dispatchWrapperEvents:i,wrapperEventSource:n="deleteKey",restoreSourceInBatch:o}=e;let{cellRanges:a}=e;i&&(s.dispatchEvent({type:"cellSelectionDeleteStart",source:n}),s.dispatchEvent({type:"rangeDeleteStart",source:n})),a??(a=this.cellRanges);const{valueSvc:l,editSvc:c}=t,u=!!c?.isBatchEditing(),{changeDetectionSvc:d}=t;c?.beginBulkWrite();try{d?.beginDeferred(),this.forEachEditableCellInRanges(a,(h,p)=>{if(o&&u){c?.batchResetToSourceValue({rowNode:h,column:p});return}const g=l.getDeleteValue(p,h);h.setDataValue(p,g,r)})}finally{d?.endDeferred(),c?.endBulkWrite()}i&&(s.dispatchEvent({type:"cellSelectionDeleteEnd",source:n}),s.dispatchEvent({type:"rangeDeleteEnd",source:n}))}createCellRangeFromCellRangeParams(e){return this.createPartialCellRangeFromRangeParams(e,!1)}createPartialCellRangeFromRangeParams(e,t){const{columns:s,columnStart:r,columnEnd:i,rowStartIndex:n,rowStartPinned:o,rowEndIndex:a,rowEndPinned:l}=e,c=this.getColumnsFromParams(s,r,i);if(!c||!t&&c.columns.length===0)return;const{columns:u,startsOnTheRight:d}=c,h=cb(n,o),p=cb(a,l);return{startRow:h,endRow:p,columns:u,startColumn:this.getColumnFromModel(r)??(d?Ee(u):u[0])}}addCellRange(e){const t=this.gos;if(!co(t)||!this.verifyCellRanges(t))return;this.setSelectionMode(!1);const s=this.createCellRangeFromCellRangeParams(e);if(s)return s.startRow&&this.setNewestRangeStartCell({rowIndex:s.startRow.rowIndex,rowPinned:s.startRow.rowPinned,column:s.startColumn}),this.cellRanges.push(s),this.dispatchChangedEvent(!1,!0,s.id),s}getCellRanges(){return this.cellRanges}isEmpty(){return this.cellRanges.length===0}isMoreThanOneCell(){const e=this.cellRanges.length;if(e===0)return!1;if(e>1)return!0;const t=this.cellRanges[0],s=this.getRangeStartRow(t),r=this.getRangeEndRow(t);return s.rowPinned!==r.rowPinned||s.rowIndex!==r.rowIndex||t.columns.length!==1}areAllRangesAbleToMerge(){const e=new Map;if(this.cellRanges.length<=1)return!0;for(const r of this.cellRanges)this.forEachRowInRange(r,i=>{const n=`${i.rowPinned||"normal"}_${i.rowIndex}`,o=e.get(n),a=r.columns.map(l=>l.getId());if(o){const l=a.filter(c=>o.indexOf(c)===-1);o.push(...l)}else e.set(n,a)});let s;for(const r of e.values()){const i=r.sort(ZY).join();if(s===void 0){s=i;continue}if(s!==i)return!1}return!0}removeAllCellRanges(e){this.isEmpty()||(this.onDragStop(),this.cellRanges.length=0,e||this.dispatchChangedEvent(!1,!0))}isCellInAnyRange(e){return this.getCellRangeCount(e)>0}isCellInSpecificRange(e,t){const s=t.columns?.includes(e.column),r=this.isRowInRange(e,t);return s&&r}isColumnInAnyRange(e){const{beans:t}=this,s=Xc(t),r=Jc(t);if(!s||!r)return!1;const i=e.isColumn?[e]:e.getDisplayedLeafColumns();return this.findContainingRange({columns:i,startRow:s,endRow:r},!0)!=null}findContainingRange({columns:e,startRow:t,endRow:s},r=!1){const i=this.cellRanges;for(let n=i.length-1;n>=0;n--){const o=i[n],a=e.every(c=>o.columns.includes(c));let l;if(r)l=St(o.startRow,t)&&St(o.endRow,s);else{const c=t&&this.isRowInRange(t,o),u=s&&this.isRowInRange(s,o);l=!!c&&!!u}if(a&&l)return o}}isBottomRightCell(e,t){const s=e.columns;let r=-1;for(let c=0,u=s.length;c<u;++c){const d=s[c].allColsIndex;d>r&&(r=d)}const{startRow:i,endRow:n}=e,o=De(i,n)?n:i,a=t.column.allColsIndex===r,l=t.rowIndex===o.rowIndex&&rb(t.rowPinned)===rb(o.rowPinned);return a&&l}getCellRangeCount(e){return this.cellRanges.filter(t=>this.isCellInSpecificRange(e,t)).length}isRowInRange(e,t){const s=this.getRangeStartRow(t),r=this.getRangeEndRow(t),i=St(e,s),n=St(e,r);if(i||n)return!0;const o=!De(e,s),a=De(e,r);return o&&a}intersectLastRange(e){const{editingWithRanges:t,suppressMultiRanges:s}=this.getMultiRangeContext();if(t||s||e&&this.dragging||this.isEmpty())return;const r=Ee(this.cellRanges),i=this.getRangeStartRow(r),n=this.getRangeEndRow(r),o=[];for(const a of this.cellRanges.slice(0,-1)){const l=this.getRangeStartRow(a),c=this.getRangeEndRow(a),u=a.columns,d=u.filter(p=>r.columns.indexOf(p)===-1);if(d.length===u.length){o.push(a);continue}if(De(n,l)||De(c,i)){o.push(a);continue}const h=o.length;if(De(l,i)){const p={columns:[...u],startColumn:r.startColumn,startRow:{...l},endRow:mi(this.beans,i)};o.push(p)}if(d.length>0){const p={columns:d,startColumn:d.includes(r.startColumn)?r.startColumn:d[0],startRow:Eq([{...i},{...l}]),endRow:Dq([{...n},{...c}])};o.push(p)}De(n,c)&&o.push({columns:[...u],startColumn:r.startColumn,startRow:tr(this.beans,n),endRow:{...c}}),o.length-h===1&&(o[o.length-1].id=a.id)}this.cellRanges=o,e&&this.dispatchChangedEvent(!1,!0)}createRangeHighlightFeature(e,t,s){e.createManagedBean(new Mq(t,s))}setSelectionMode(e){this.selectionMode=e?1:0}refreshRangeStart(e){const{columns:t}=e,s=this.ensureRangeStartColumn(e);if(!s)return;const r=(l,c)=>{const u=e.columns.filter(d=>d!==l);l?(e.startColumn=l,e.columns=c?[l,...u]:[...u,l]):e.columns=u},{left:i,right:n}=this.getRangeEdgeColumns(e);if(s===t[0]&&s!==i){r(i,!0);return}s===Ee(t)&&s===n&&r(n,!1)}setNewestRangeStartCell(e){this.newestRangeStartCell=e}getColumnsFromParams(e,t,s){const r=!e&&!t&&!s;let i,n=!1;return r||e?i=this.getColumnsFromModel(r?void 0:e):t&&s&&(i=this.calculateColumnsBetween(t,s),i?.length&&(n=i[0]!==this.getColumnFromModel(t))),i?{columns:i,startsOnTheRight:n}:void 0}verifyCellRanges(e){const{suppressMultiRanges:t}=this.getMultiRangeContext(),s=uq(e)&&t&&this.cellRanges.length>1;return s&&this.warn(93),!s}forEachRowInRange(e,t){const s=this.getRangeStartRow(e),r=this.getRangeEndRow(e);let i=s;for(;i&&(t(i),!St(i,r));)i=tr(this.beans,i)}forEachEditableCellInRanges(e,t){const{beans:s}=this;for(const r of e)this.forEachRowInRange(r,i=>{const n=aq(s,i);if(n)for(let o=0;o<r.columns.length;o++){const a=this.getColumnFromModel(r.columns[o]);a?.isCellEditable(n)&&t(n,a)}})}onBodyScroll(){this.dragging&&this.lastMouseEvent&&this.onDragging(this.lastMouseEvent)}updateValuesOnMove(e){const t=iq(this.gos,e),s=t?.cellPosition;if(this.cellHasChanged=!1,!s||this.lastCellHovered&&sq(s,this.lastCellHovered))return;const r=this.beans.editSvc;if(r?.isEditing(t,{withOpenEditor:!0})&&!r?.isRangeSelectionEnabledWhileEditing()){this.dragSvc.cancelDrag(e);return}this.lastCellHovered&&(this.cellHasChanged=!0),this.lastCellHovered=s}dispatchChangedEvent(e,t,s){this.eventSvc.dispatchEvent({type:"cellSelectionChanged",started:e,finished:t,id:s}),this.eventSvc.dispatchEvent({type:"rangeSelectionChanged",started:e,finished:t,id:s})}getColumnFromModel(e){return typeof e=="string"?this.colModel.getCol(e):e}getColumnsFromModel(e){const{visibleCols:t,selectionMode:s}=this;(!e||s===1)&&(e=t.allCols);const r=[];for(const i of e){const n=this.getColumnFromModel(i);!n||this.shouldSkipColumn(n)||r.push(n)}return r.length?r:void 0}ensureRangeStartColumn(e){const t=this.getRangeStartColumn(e.columns,e.startColumn);if(t)return e.startColumn=t,t}getRangeStartColumn(e,t){const s=e[0],r=Ee(e);if(!s||!r)return;if(!t||e.includes(t))return t??s;const i=t.allColsIndex,n=s.allColsIndex,o=r.allColsIndex;return i<0||n<0||o<0||i-n<=o-i?s:r}calculateColumnsBetween(e,t){const s=this.visibleCols.allCols,r=this.getColumnFromModel(e),i=this.getColumnFromModel(t),n=r===i,o=r.allColsIndex;if(o<0){this.warn(178,{colId:r.getId()});return}const a=n?o:i.allColsIndex;if(a<0){this.warn(178,{colId:i.getId()});return}if(n||this.selectionMode===1)return this.getColumnsFromModel([r]);const l=Math.min(o,a),c=l===o?a:o;return this.getColumnsFromModel(s.slice(l,c+1))}focusCellOnNewColumn(e,t){const{focusSvc:s}=this.beans,r=s.getFocusedCell();r&&this.isCellInSpecificRange(r,e)&&s.setFocusedCell({...r,column:t,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!0})}focusCellOnNewRow(e,t){const{focusSvc:s}=this.beans,r=s.getFocusedCell();r&&this.isCellInSpecificRange(r,e)&&s.setFocusedCell({...t,column:r.column,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!0})}createDragListenerFeature(e){return new Tq(e)}createCellRangeFeature(e){return new xq(this.beans,e)}createHeaderGroupCellMouseListenerFeature(e,t){return new Pq(e,t)}handleColumnSelection(e,t){const{gos:s,beans:r,columnRangeSelectionCtx:i,cellRanges:n}=this;if(!nq(s))return;const{suppressMultiRanges:o,editingWithRanges:a}=this.getMultiRangeContext(),l=n.length>0,c=t.ctrlKey||t.metaKey,u=!a||c,d=Xc(r),h=Jc(r);if(!d||!h)return;if(t.key===tq.ENTER&&t.preventDefault(),t.shiftKey){const g=i.root;if(!g)return;const f=e.isColumn?e:Ee(e.getLeafColumns()),m=this.findContainingRange({columns:[g],startRow:d,endRow:h},!0);if(!m){lo(n,i.lastCellRange),this.selectColumns(this.calculateColumnsBetween(g,f),d,h);return}this.updateRangeRowBoundary({cellRange:m,boundary:"end",cellPosition:{column:f,...h}});return}l&&(o||!c&&!a)&&this.removeAllCellRanges(!0);const p=(g,f)=>{const m=this.findContainingRange({columns:g,startRow:d,endRow:h},!0);if(m&&u)this.deselectColumnsFromRange(m,g);else{const v=this.selectColumns(g,d,h);v&&(i.lastCellRange=v)}i.root=f};if(e.isColumn)p([e],e);else{const g=e.getDisplayedLeafColumns();p(g,g[0])}}deselectColumnsFromRange(e,t){QY(e.columns,t),t.includes(e.startColumn)&&(e.startColumn=e.columns[0]),e.columns.length===0&&lo(this.cellRanges,e),this.dispatchChangedEvent(!0,!0)}selectColumns(e,t,s){return this.addCellRange({columns:e,columnStart:e[0],columnEnd:Ee(e),rowStartIndex:t.rowIndex,rowStartPinned:t.rowPinned,rowEndIndex:s.rowIndex,rowEndPinned:s.rowPinned})}};function cb(e,t){return e!=null?{rowIndex:e,rowPinned:t}:void 0}function Eq(e){let t;for(const s of e)(t===void 0||De(t,s))&&(t=s);return t}function Dq(e){let t;for(const s of e)(t===void 0||De(s,t))&&(t=s);return t}function Lq(e,t){const{startRow:s,endRow:r}=e,i=De(s,r)?r:s,n=t.rowIndex===i.rowIndex&&t.rowPinned===i.rowPinned,o=e.columns[0],a=Ee(e.columns),l=e.startColumn===o?a:o;return t.column===l&&n}function ho(e,t,s){let r;s==="top"?r=!e.startRow||!e.endRow||De(e.startRow,e.endRow)?"startRow":"endRow":r=!e.startRow||!e.endRow||De(e.startRow,e.endRow)?"endRow":"startRow",e[r]=t??void 0}var po={moduleName:"CellSelection",version:_,beans:[Iq],dynamicBeans:{fillHandle:zY,rangeHandle:KY},apiFunctions:{getCellRanges:jY,addCellRange:YY,clearRangeSelection:tb,clearCellSelection:tb},dependsOn:[$,CY,vY],css:[$Y]},kq={moduleName:"RangeSelection",version:_,dependsOn:[po]};import{_CsrmSsrmSharedApiModule as _q,_RowModelSharedApiModule as Gq,_SharedRowSelectionModule as Oq,_SortModule as Nq,_SsrmInfiniteSharedApiModule as Bq,onRowHeightChanged as Vq,resetRowHeights as Hq}from"ag-grid-community";import{RefPlaceholder as ub}from"ag-stack";import{Component as Uq,_createIconNoSpan as zq}from"ag-grid-community";var Wq={tag:"div",cls:"ag-loading",children:[{tag:"span",ref:"eLoadingIcon",cls:"ag-loading-icon"},{tag:"span",ref:"eLoadingText",cls:"ag-loading-text"}]},Kq=class extends EF{constructor(){super(Wq),this.eLoadingIcon=ub,this.eLoadingText=ub}init(e){e.node.failedLoad?this.setupFailed():this.setupLoading()}setupFailed(){this.eLoadingText.textContent=this.getLocaleTextFunc()("loadingError","ERR")}setupLoading(){const e=zq("groupLoading",this.beans,null);e&&this.eLoadingIcon.appendChild(e),this.eLoadingText.textContent=this.getLocaleTextFunc()("loadingOoo","Loading...")}refresh(e){return!1}},$q={moduleName:"LoadingCellRenderer",version:_,userComponents:{agLoadingCellRenderer:Kq},icons:{groupLoading:"loading"},dependsOn:[$]};import{_ColumnGroupModule as jq}from"ag-grid-community";function Yq(e){return e.colModel.pivotMode}function qq(e,t,s){return e.pivotResultCols?.lookupPivotResultCol(t,s)??null}function Zq(e,t){e.valueColsSvc?.setColumns(t,"api")}function Xq(e){return e.valueColsSvc?.columns??[]}function Jq(e,t){e.valueColsSvc?.removeColumns(t,"api")}function Qq(e,t){e.valueColsSvc?.addColumns(t,"api")}function eZ(e,t){e.pivotColsSvc?.setColumns(t,"api")}function tZ(e,t){e.pivotColsSvc?.removeColumns(t,"api")}function sZ(e,t){e.pivotColsSvc?.addColumns(t,"api")}function rZ(e){return e.pivotColsSvc?.columns??[]}function iZ(e,t){e.pivotResultCols?.setPivotResultCols(t,"api",!0)}function nZ(e){return e.pivotResultCols?.pivotCols??null}import{BeanStub as oZ,_resolvePivotSort as aZ}from"ag-grid-community";var db="PivotRowTotal_",lZ=({headerName:e},{headerName:t})=>e&&!t?1:!e&&t?-1:!e&&!t?0:e<t?-1:e>t?1:0,cZ=e=>(t,s)=>e(t.headerName,s.headerName),uZ=()=>0,dZ=(e,t,s)=>{if(e.children!=null)return!0;const r=e.pivotKeys;return r!=null?r.length>t:!s&&t===0},hZ=(e,t)=>{const s=e.some(r=>r.children!=null);return r=>dZ(r,t,s)},pZ=(e,t,s)=>{const r=e.filter(t).sort(s),i=[];let n=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];i.push(t(l)?r[n++]:l)}return i},gZ=(e,t,s)=>{const r=e.children;if(!r)return null;const i=hb(r,t+1,s);return i?{...e,children:i}:null},hb=(e,t,s)=>{const r=e.length;if(t>=s.length||r===0)return null;const i=pZ(e,hZ(e,t),s[t]);let n=!1;for(let o=0;o<r;++o){const a=i[o],l=gZ(a,t,s);l?(i[o]=l,n=!0):a!==e[o]&&(n=!0)}return n?i:null},fZ=class extends DF{constructor(){super(...arguments),this.beanName="pivotColDefSvc"}wireBeans(e){this.colModel=e.colModel,this.pivotColsSvc=e.pivotColsSvc,this.valueColsSvc=e.valueColsSvc,this.colNames=e.colNames}postConstruct(){const e=()=>this.gos.get("serverSidePivotResultFieldSeparator")??"_";this.fieldSeparator=e(),this.addManagedPropertyListener("serverSidePivotResultFieldSeparator",()=>{this.fieldSeparator=e()});const t=()=>this.gos.get("pivotDefaultExpanded");this.pivotDefaultExpanded=t(),this.addManagedPropertyListener("pivotDefaultExpanded",()=>{this.pivotDefaultExpanded=t()})}createPivotColumnDefs(e){const t=this.createPivotColumnsFromUniqueValues(e);function s(i,n=[]){return i.forEach(o=>{o.children!==void 0?s(o.children,n):n.push(o)}),n}const r=s(t);return this.addRowGroupTotals(t,r),this.addExpandablePivotGroups(t,r),this.addPivotTotalsToGroups(t,r),t}createPivotColumnsFromUniqueValues(e){const t=this.pivotColsSvc?.columns??[],s=t.length;return this.recursivelyBuildGroup(0,e,[],s,t)}recursivelyBuildGroup(e,t,s,r,i){if(e>=r)return this.buildMeasureCols(s);const n=i[e],o=n.colDef,a=this.getPivotGroupComparator(n),l=this.valueColsSvc?.columns;if(l?.length===1&&this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&e===r-1){const u=[];for(const d of t.keys()){const h=[...s,d],p=pb(d,o),g=this.createColDef(l[0],p,h);g.columnGroupShow="open",u.push(g)}return u.sort(a),u}const c=[];for(const u of t.keys()){const d=this.pivotDefaultExpanded===-1||e<this.pivotDefaultExpanded,h=[...s,u];c.push({children:this.recursivelyBuildGroup(e+1,t.get(u),h,r,i),headerName:pb(u,o),pivotKeys:h,columnGroupShow:"open",openByDefault:d,groupId:this.generateColumnGroupId(h)})}return c.sort(a),c}buildMeasureCols(e){const t=this.valueColsSvc?.columns??[];return t.length===0?[this.createColDef(null,"-",e)]:t.map(s=>{const r=this.colNames.getDisplayNameForColumn(s,"header"),i=this.createColDef(s,r,e);return i.columnGroupShow="open",i})}addExpandablePivotGroups(e,t){const s=this.gos.get("suppressExpandablePivotGroups");if(s||this.gos.get("pivotColumnGroupTotals"))return;const r=(i,n,o)=>{if("children"in i){const{valueColsSvc:u}=this,{columns:d=[]}=u??{},h=new Map;i.children.forEach(f=>{r(f,n,h)});const p=!i.children.some(f=>f.children),g=p&&d.length===1&&this.gos.get("removePivotHeaderRowWhenSingleValueColumn");for(const f of d){const m=this.colNames.getDisplayNameForColumn(f,"header"),v=this.createColDef(f,m,i.pivotKeys);v.pivotTotalColumnIds=h.get(f.colId),v.columnGroupShow=s?"open":"closed",v.aggFunc=f.aggFunc,(!p||g)&&(i.children.push(v),n.push(v))}this.merge(o,h);return}const a=i.pivotValueColumn;if(!a)return;const l=a.colId;o.has(l)?o.get(l).push(i.colId):o.set(l,[i.colId])};e.forEach(i=>{r(i,t,new Map)})}addPivotTotalsToGroups(e,t){if(!this.gos.get("pivotColumnGroupTotals"))return;const s=this.gos.get("pivotColumnGroupTotals")==="after",r=this.valueColsSvc?.columns,i=r?.map(n=>n.aggFunc);if(!(!i||i.length<1||!this.sameAggFuncs(i))&&r){const n=r[0];e.forEach(o=>{this.recursivelyAddPivotTotal(o,t,n,s)})}}recursivelyAddPivotTotal(e,t,s,r){const i=e;if(!i.children){const o=e;return o.colId?[o.colId]:null}let n=[];if(i.children.forEach(o=>{const a=this.recursivelyAddPivotTotal(o,t,s,r);a&&(n=n.concat(a))}),i.children.length>1){const a=this.getLocaleTextFunc()("pivotColumnGroupTotals","Total"),l=this.createColDef(s,a,e.pivotKeys,!0);l.pivotTotalColumnIds=n,l.aggFunc=s.aggFunc,l.columnGroupShow=this.gos.get("suppressExpandablePivotGroups")?"open":void 0;const c=e.children;r?c.push(l):c.unshift(l),t.push(l)}return n}addRowGroupTotals(e,t){if(!this.gos.get("pivotRowTotals"))return;const s=this.gos.get("pivotRowTotals")==="after",i=(this.valueColsSvc?.columns??[]).slice();s||i.reverse();const n=i.length>1||!this.gos.get("removePivotHeaderRowWhenSingleValueColumn");for(let o=0;o<i.length;o++){const a=i[o],l=this.colNames.getDisplayNameForColumn(a,"header"),c=this.createColDef(a,l,[]),u=[];for(let h=0;h<t.length;h++){const p=t[h];p.pivotValueColumn===a&&u.push(p.colId)}c.pivotTotalColumnIds=u,c.colId=db+c.colId;const d=n?{children:[c],pivotKeys:[],groupId:`${db}_pivotGroup_${a.colId}`}:c;t.push(c),s?e.push(d):e.unshift(d)}}recreateColDef(e){const{pivotValueColumn:t,headerName:s,pivotKeys:r,pivotTotalColumnIds:i,columnGroupShow:n,colId:o,field:a,valueGetter:l,aggFunc:c}=e;if(!t)return e;const u=this.createColDef(t,s,r,!!i);return u.columnGroupShow=n,u.colId=o,u.field=a,u.valueGetter=l,u.aggFunc=c,u.pivotTotalColumnIds=i,this.gos.get("processPivotResultColDef")?.(u),u}createColDef(e,t,s,r=!1){const i={};if(e){const n=e.colDef;Object.assign(i,n),i.hide=!1,e.isCalculatedCol&&(i.calculatedExpression=void 0,i.allowFormula=void 0)}return i.headerName=t,i.colId=this.generateColumnId(s??[],e&&!r?e.colId:""),i.field=i.colId,i.valueGetter=n=>n.data?.[n.colDef.field],i.pivotKeys=s,i.pivotValueColumn=e,i.filter===!0&&(i.filter="agNumberColumnFilter"),i}sameAggFuncs(e){if(e.length==1)return!0;for(let t=1;t<e.length;t++)if(e[t]!==e[0])return!1;return!0}merge(e,t){t.forEach((s,r)=>{const n=[...e.has(r)?e.get(r):[],...s];e.set(r,n)})}generateColumnGroupId(e){return`pivotGroup_${(this.pivotColsSvc?.columns??[]).map(s=>s.colId).join("-")}_${e.join("-")}`}generateColumnId(e,t){return`pivot_${(this.pivotColsSvc?.columns??[]).map(r=>r.colId).join("-")}_${e.join("-")}_${t}`}getPivotGroupComparator(e){const t=aZ(this.beans,e.pivotSort);if(t===null)return uZ;const s=e.colDef.pivotComparator,r=s?cZ(s):lZ;return t==="desc"?(i,n)=>r(n,i):r}orderPivotResultColDefs(e){const t=this.pivotColsSvc?.columns;if(!t?.length)return e;const s=[];for(let r=0,i=t.length;r<i;++r)s.push(this.getPivotGroupComparator(t[r]));return hb(e,0,s)??e}createColDefsFromFields(e){const t=this.pivotColsSvc?.columns??[],s=t.map(o=>this.getPivotGroupComparator(o)),r=new Map;for(let o=0;o<e.length;o++){const l=e[o].split(this.fieldSeparator);let c=r;for(let u=0;u<l.length;u++){const d=l[u];let h=c.get(d);h||(h=new Map,c.set(d,h)),c=h}}const i=(o,a,l,c,u)=>{const d=[];for(const[f,m]of l){const v=i(`${o}${this.fieldSeparator}${f}`,f,m,c+1,[...u,f]);d.push(v)}const h=c+1;if(h<t.length&&d.sort(s[h]),d.length===0){const f=u.slice(0,-1),m=this.colModel.getNonPivotCol(a);if(m){const C=this.colNames.getDisplayNameForColumn(m,"header")??a,b=this.createColDef(m,C,void 0,!1);return b.colId=o,b.aggFunc=m.aggFunc,b.valueGetter=y=>y.data?.[o],b.pivotKeys=f,b}return{colId:o,headerName:a,pivotKeys:f,valueGetter:C=>C.data?.[o]}}return this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&d.length===1&&"colId"in d[0]?(d[0].headerName=a,d[0]):{openByDefault:this.pivotDefaultExpanded===-1||c<this.pivotDefaultExpanded,groupId:o,headerName:a,children:d}},n=[];for(const[o,a]of r){const l=i(o,o,a,0,[o]);n.push(l)}return t.length>0&&n.sort(s[0]),n}};function pb(e,t){return t.refData?.[e]??e}import{_areEqual as mZ,_pushToMapArray as vZ}from"ag-stack";import{BeanStub as CZ,_buildColumnTree as bZ,_destroyColumnTreeAll as gb,_destroyColumnTreeUnused as SZ}from"ag-grid-community";var yZ=class extends LF{constructor(){super(...arguments),this.beanName="pivotResultCols",this.pivotCols=null,this.pivotTree=[],this.pivotTreeDepth=0,this.dependentsByValueCol=null,this.pivotHasMarryChildren=!1,this.pivotGroupsById=new Map,this.pivotColsByKey=new Map,this.pivotAllGroups=[],this.savedPivot=null,this.suppliedColDefs=null}wireBeans(e){this.colModel=e.colModel,this.visibleCols=e.visibleCols}lookupPivotResultCol(e,t){const s=this.pivotCols;if(s==null)return null;const r=this.colModel.getNonPivotCol(t);for(let i=0,n=s.length;i<n;++i){const o=s[i];if(o.pivotValueColumn===r&&mZ(o.colDef.pivotKeys,e))return o}return null}getAggregationOrderedList(){const e=this.aggOrderedList;return e!==void 0?e:this.loadAggregationOrderedList()}buildAllCols(){const e=this.collectParkedPrimaries(),t=this.colModel.colsList;return e===null?t:t.concat(e)}buildColsInStateOrder(){const e=this.collectParkedPrimaries(),t=this.colModel.colsList;if(e===null)return t;for(let s=0,r=t.length;s<r;++s)e.push(t[s]);return e}collectParkedPrimaries(){const e=this.colModel.colDefList;let t=null;for(let s=0,r=e.length;s<r;++s){const i=e[s];i.inColsList||(t??(t=[]),t.push(i))}return t}loadAggregationOrderedList(){const e=this.pivotCols;if(!e||e.length===0)return this.aggOrderedList=null,null;let t=null,s=null;for(let i=0,n=e.length;i<n;++i){const o=e[i];o.colDef.pivotTotalColumnIds!=null?(s===null&&(s=[],t=e.slice(0,i)),s.push(o)):t!==null&&t.push(o)}const r=s===null?e:t.concat(s);return this.aggOrderedList=r,r}setPivotResultCols(e,t,s){this.aggOrderedList=void 0;const r=this.colModel;if(r.ready){if(!e&&this.pivotCols==null){this.suppliedColDefs=null;return}r.beginColUpdate();try{e?(this.processPivotResultColDef(e),s?(this.suppliedColDefs=e,this.applyPivotResultColDefs(this.orderColDefs(e),t)):(this.suppliedColDefs=null,this.applyPivotResultColDefs(e,t))):(this.suppliedColDefs=null,this.clearPivotResultCols(t)),this.visibleCols.refresh(t,!1)}finally{r.endColUpdate()}}}resortPivotResultCols(e){const t=this.suppliedColDefs;if(!t)return;this.aggOrderedList=void 0;const s=this.colModel;s.beginColUpdate();try{this.applyPivotResultColDefs(this.orderColDefs(t),e),this.visibleCols.refresh(e,!1)}finally{s.endColUpdate()}}orderColDefs(e){return this.beans.pivotColDefSvc?.orderPivotResultColDefs(e)??e}destroy(){this.pivotCols&&gb(this.pivotCols,this.pivotAllGroups),this.pivotTree=[],this.pivotCols=null,this.pivotAllGroups=[],this.dependentsByValueCol=null;const e=this.savedPivot;e&&(this.savedPivot=null,gb(e.cols,e.groups)),super.destroy()}applyPivotResultColDefs(e,t){const s=this.beans,r=this.pivotCols,i=r?this.pivotTree:null,n=this.savedPivot,o=s.pivotColsSvc?.isStrictColumnOrder()??!1,a=i==null&&n!=null&&!o,l=i??n?.tree??null,c=i?r:n?.cols??null,u=i?this.pivotAllGroups:n?.groups??null,d=s.colModel.nextBuildToken(),h=bZ(s,e,!1,this.pivotGroupsById,this.pivotColsByKey,s.colModel.colsById,t,!0,d,null);l&&l!==h.columnTree&&SZ(c??[],u??[],d),this.pivotCols=h.columns,this.pivotTree=h.columnTree,this.pivotTreeDepth=h.treeDepth,this.pivotHasMarryChildren=h.marryChildren,this.pivotGroupsById=h.groupsById,this.pivotColsByKey=h.colsByKey,this.pivotAllGroups=h.allGroups,this.savedPivot=null,this.dependentsByValueCol=null,this.colModel.refreshCols(!a,t)}clearPivotResultCols(e){this.savedPivot={tree:this.pivotTree,cols:this.pivotCols,groups:this.pivotAllGroups},this.pivotCols=null,this.pivotTree=[],this.pivotTreeDepth=0,this.pivotHasMarryChildren=!1,this.pivotAllGroups=[],this.dependentsByValueCol=null,this.colModel.refreshCols(!1,e)}recreateColDefsForSource(e,t){const s=this.pivotCols;if(s==null)return;let r=this.dependentsByValueCol;if(r===null){r=new Map;for(let o=0,a=s.length;o<a;++o){const l=s[o],c=l.pivotValueColumn;c!=null&&vZ(r,c,l)}this.dependentsByValueCol=r}const i=r.get(e);if(i===void 0)return;const n=this.beans.pivotColDefSvc;if(n)for(let o=0,a=i.length;o<a;++o){const l=i[o],c=n.recreateColDef(l.colDef);l.setColDef(c,c,t)}}processPivotResultColDef(e){const t=this.gos.get("processPivotResultColDef"),s=this.gos.get("processPivotResultColGroupDef");(t||s)&&fb(e,t,s)}},fb=(e,t,s)=>{for(let r=0,i=e.length;r<i;++r){const n=e[r],o=n.children;o?(s?.(n),fb(o,t,s)):t?.(n)}};import{_areEqual as wZ,_jsonEquals as xZ,_missing as FZ}from"ag-stack";import{BeanStub as TZ,_defaultPivotSort as AZ,_forEachChangedGroupDepthFirst as PZ}from"ag-grid-community";var mb="Exceeded maximum allowed pivot column count.",go=e=>{const t={};return e.forEach((s,r)=>t[r]=s instanceof Map?go(s):s),t},RZ=class extends kF{constructor(){super(...arguments),this.beanName="pivotStage",this.step="pivot",this.refreshProps=["removePivotHeaderRowWhenSingleValueColumn","pivotRowTotals","pivotColumnGroupTotals","suppressExpandablePivotGroups","enableStrictPivotColumnOrder"],this.uniqueValues=new Map,this.pivotOrderLastTime=[],this.lastTimeFailed=!1,this.maxUniqueValues=-1,this.currentUniqueCount=0}wireBeans(e){this.pivotResultCols=e.pivotResultCols,this.pivotColDefSvc=e.pivotColDefSvc}execute(e,t){return this.beans.colModel.isPivotActive()?this.executePivotOn(e,t):this.executePivotOff()}executePivotOff(){return this.aggregationColumnsHashLastTime=null,this.pivotOrderLastTime=[],this.uniqueValues=new Map,this.pivotResultCols.pivotCols?(this.pivotResultCols.setPivotResultCols(null,"rowModelUpdated"),!0):!1}executePivotOn(e,t){const{valueColsSvc:s,gos:r,rowGroupColsSvc:i,pivotColsSvc:n}=this.beans,o=s?.columns.length??1,a=r.get("pivotMaxGeneratedColumns");this.maxUniqueValues=a===-1?-1:a/o;let l;try{l=this.bucketUpRowNodes(e)}catch(w){if(w.message===mb)return this.pivotResultCols.setPivotResultCols([],"rowModelUpdated"),this.eventSvc.dispatchEvent({type:"pivotMaxColumnsExceeded",message:w.message}),this.lastTimeFailed=!0,!1;throw w}const c=this.setUniqueValues(l),u=s?.columns??[],d=u.map(w=>`${w.getId()}-${w.colDef.headerName}`).join("#"),h=u.map(w=>w.aggFunc?.toString()).join("#"),p=this.aggregationColumnsHashLastTime!==d,g=this.aggregationFuncsHashLastTime!==h;this.aggregationColumnsHashLastTime=d,this.aggregationFuncsHashLastTime=h;const f=(i?.columns??[]).map(w=>w.getId()).join("#"),m=f!==this.groupColumnsHashLastTime;this.groupColumnsHashLastTime=f;const v=n?.columns??[],b=n?.isStrictColumnOrder()??!1?vb(this.uniqueValues,v,0,AZ(this.beans)):[],y=!wZ(b,this.pivotOrderLastTime);this.pivotOrderLastTime=b;const S=this.refreshProps.some(w=>t?.has(w));if(this.lastTimeFailed||c||p||m||g||y||S){const w=this.pivotColDefSvc.createPivotColumnDefs(this.uniqueValues);return this.pivotResultCols.setPivotResultCols(w,"rowModelUpdated"),this.lastTimeFailed=!1,!0}return this.lastTimeFailed=!1,!1}setUniqueValues(e){return xZ(go(this.uniqueValues),go(e))?!1:(this.uniqueValues=e,!0)}bucketUpRowNodes(e){const t=this.beans.rowModel;this.currentUniqueCount=0;const s=new Map;PZ(t.rootNode,t.hierarchical,e,i=>{i.leafGroup&&(i.childrenMapped=null)});const r=i=>{if(i.leafGroup)this.bucketRowNode(i,s);else{const n=i.childrenAfterFilter;if(n)for(let o=0,a=n.length;o<a;++o)r(n[o])}};return r(t.rootNode),s}bucketRowNode(e,t){const s=this.beans.pivotColsSvc?.columns;s?.length===0?e.childrenMapped=null:e.childrenMapped=go(this.bucketChildren(e.childrenAfterFilter,s,0,t)),e.sibling&&(e.sibling.childrenMapped=e.childrenMapped)}bucketChildren(e,t=[],s,r){const i=new Map,n=t[s],o=this.maxUniqueValues!==-1;for(let l=0,c=e.length;l<c;++l){const u=e[l];let d=this.beans.valueSvc.getKeyForNode(n,u);if(FZ(d)&&(d=""),!r.get(d)){this.currentUniqueCount+=1,r.set(d,new Map);const h=this.currentUniqueCount>this.maxUniqueValues;if(o&&h)throw new Error(mb)}i.has(d)||i.set(d,[]),i.get(d).push(u)}if(s===t.length-1)return i;const a=new Map;for(const l of i.keys())a.set(l,this.bucketChildren(i.get(l),t,s+1,r.get(l)));return a}};function vb(e,t,s,r){const i=t[s],n=[...e.keys()],o=i?.pivotSort,a=o===void 0?r:o;if(a!==null){const c=i?.colDef.pivotComparator;c?n.sort(c):n.sort(),a==="desc"&&n.reverse()}if(s===t.length-1)return n;const l=[];for(let c=0;c<n.length;c++){const u=n[c];l.push(u);const d=e.get(u);if(d instanceof Map){const h=vb(d,t,s+1,r);for(let p=0;p<h.length;p++)l.push(h[p])}}return l}var Cb={moduleName:"SharedPivot",version:_,beans:[yZ,fZ,Fv],apiFunctions:{isPivotMode:Yq,getPivotResultColumn:qq,setValueColumns:Zq,getValueColumns:Xq,removeValueColumns:Jq,addValueColumns:Qq,setPivotColumns:eZ,removePivotColumns:tZ,addPivotColumns:sZ,getPivotColumns:rZ,setPivotResultColumns:iZ,getPivotResultColumns:nZ},dependsOn:[Lc,jq]},bb={moduleName:"Pivot",version:_,rowModels:["clientSide"],beans:[RZ],dependsOn:[Cb,kc,Ys]};import{_removeFromArray as MZ}from"ag-stack";import{BeanStub as IZ,RowNode as EZ}from"ag-grid-community";var Sb=e=>{const t=e.split(".");if(t.includes("__proto__"))return()=>{};const s=t.length;return s<2?r=>r?.[e]:r=>{let i=0;do if(r=r?.[t[i++]],i===s)return r;while(typeof r=="object")}},Ge=2147483648,Ve=1073741824,fo=536870912,Ci=268435455,Qc=String.fromCodePoint(31,41150,8291),eu=3,DZ=class extends _F{constructor(){super(...arguments),this.nestedDataGetter=null,this.parentIdGetter=null,this.nonLeafsById=null,this.fullReload=!1}postConstruct(){this.onPropChange(null)}onPropChange(e){const t=this.gos;if(!e||e.has("treeDataParentIdField")){const s=t.get("treeDataParentIdField"),r=s?Sb(s):null;this.fullReload||(this.fullReload=this.parentIdGetter!==r),this.parentIdGetter=r,r&&(this.nestedDataGetter=null)}if(!e||e.has("treeDataChildrenField")){const s=this.parentIdGetter?"":t.get("treeDataChildrenField"),r=s?Sb(s):null;this.fullReload||(this.fullReload=this.nestedDataGetter!==r),this.nestedDataGetter=r}}destroy(){this.reset(),super.destroy()}reset(){this.clearNonLeafs(),this.fullReload=!0}clearNonLeafs(){const e=this.nonLeafsById;if(e){for(const t of e.values())t._destroy(null);e.clear(),this.nonLeafsById=null}}getNonLeaf(e){return this.nonLeafsById?.get(e)}loadGroupData(e){const t=e.key;if(t==null)return e._groupData=null,null;const s={};e._groupData=s;const r=this.beans.showRowGroupCols?.columns;if(r)for(let i=0,n=r.length;i<n;++i)s[r[i].colId]=t;return s}execute(e,t){this.fullReload&&this.reset();const{changedRowNodes:s,changedPath:r}=t,i=this.fullReload||!s&&!r,n=!!s&&this.flagUpdatedNodes(s);(i||n)&&(this.fullReload=!1,this.parentIdGetter?this.loadSelfRef(e,i):this.nestedDataGetter?this.loadNested(e,s,i):this.loadDataPath(e,i));const o=this.initRowsParents(e);this.destroyFillerRows(!!t.animate),this.initRowsChildrenSize(e);let a=this.preprocessRows(e);const l=o||(a&Ge)!==0;a&=~Ge;const c=this.traverseRoot(e,r);return a>0&&a!==c&&(this.handleCycles(e),this.traverseRoot(e,r)),e.treeNodeFlags=0,l}flagUpdatedNodes(e){const{adds:t,updates:s,removals:r}=e;let i=r.length>0;if(t.size>0){i=!0;for(const n of t)n.treeNodeFlags|=Ve}if(s.size>0){i=!0;for(const n of s)n.treeNodeFlags|=Ve}return i}initRowsParents(e){const t=e._leafs,s=t.length;let r=!1;for(let i=0;i<s;++i)this.initRowParent(t[i])&&(r=!0);return r}initRowParent(e){let t=!1;for(;;){const s=e.parent,r=e.treeParent;if(r===null){s&&(t=!0,this.hideRow(e));break}let i=r.treeNodeFlags+1;const n=s!==r;if(n&&(t=!0,i|=Ve,e.parent=r),n&&s&&(s.destroyed&&kZ(r,s),s.treeNodeFlags|=Ve),r.sourceRowIndex>=0||r.treeNodeFlags&fo||r.treeParent===null){r.treeNodeFlags=i;break}r.treeNodeFlags=i|fo|e.treeNodeFlags&Ve,e=r}return t}destroyFillerRows(e){const t=this.nonLeafsById;if(t){for(const s of t.values())(s.treeParent===null||(s.treeNodeFlags&Ci)===0)&&(t.delete(s.id),s._destroy(e),this.hideRow(s));t.size===0&&(this.nonLeafsById=null)}}initRowsChildrenSize(e){this.initRowChildrenSize(e);const t=e._leafs,s=t.length;for(let i=0;i<s;++i)this.initRowChildrenSize(t[i]);const r=this.nonLeafsById;if(r!==null)for(const i of r.values())this.initRowChildrenSize(i)}initRowChildrenSize(e){let{childrenAfterGroup:t,_leafs:s,treeNodeFlags:r}=e;const i=t?.length,n=r&Ci;if(e.treeNodeFlags=r&~Ci|((i||0)===n?0:Ge),n===0&&e.level>=0){if(t!==null){e.childrenAfterGroup=null,e.childrenAfterFilter=null,e.childrenAfterAggFilter=null,e.childrenAfterSort=null;const o=e.sibling;o&&(o.childrenAfterGroup=null,o.childrenAfterFilter=null,o.childrenAfterAggFilter=null,o.childrenAfterSort=null)}}else if(i!==n||t===s)if(!t||t===s){e.childrenAfterGroup=t=new Array(n);const o=e.sibling;o&&(o.childrenAfterGroup=t)}else t.length=n}preprocessRows(e){const t=e._leafs,s=t.length;let r=0,i=!1;for(let n=0;n<s;++n){let o=t[n];for(;;){const a=o.treeParent;if(a===null)break;++r;let l=a.treeNodeFlags;const c=a.childrenAfterGroup,u=l&Ci;if(l=l&~Ci|u+1,(l&Ge||c[u]!==o)&&(l|=Ge,c[u]=o,i=!0),a.treeNodeFlags=l,a.data||(a.treeNodeFlags&fo)===0||a.treeParent===null)break;a.treeNodeFlags=l&~fo|o.treeNodeFlags&Ve,o=a}}return r|(i?Ge:0)}traverseRoot(e,t){let s=0;const r=e.childrenAfterGroup;for(let i=0,n=r.length;i<n;++i)s+=this.traverse(r[i],0,!1,t);return s&~Ge}traverse(e,t,s,r){const i=e.childrenAfterGroup,n=i?.length??0;let o=e.treeNodeFlags;e.treeNodeFlags=0,e.level=t,e.group!==!!n?(ml(e,this.beans,!!n),o|=Ve):e.hasChildren()!==!!n&&(e.updateHasChildren(),o|=Ve);const a=(o&(Ve|Ge))!==0;n!==0||e.master?e._expanded??(e._expanded=null):e._expanded=void 0,s&&e.rowIndex!==null&&e.clearRowTopAndRowIndex(),s||(s=!e.expanded),++t,o&=Ge;for(let c=0;c<n;++c){const u=i[c],d=this.traverse(u,t,s,r);o=o+(d&~Ge)|d&Ge}return a&&(o|=Ge),o&Ge&&(n>0&&r?.addRow(e),e._leafs=void 0),o+1}handleCycles(e){const t=new Set,s=n=>{if(t.has(n))return!1;t.add(n);for(const o of n.childrenAfterGroup??[])s(o);return!0};s(e);const r=e.childrenAfterGroup;r.length=0;const i=e._leafs;for(let n=0,o=i.length;n<o;++n){const a=i[n],l=a.treeParent;if(l&&s(a)){l.treeNodeFlags|=Ge|Ve,a.parent=e;const c=l.childrenAfterGroup;MZ(c,a),c.length===0&&(l.childrenAfterGroup=null),r.push(a),this.warn(270,{id:a.id,parentId:l?.id??""})}else l===e&&r.push(a)}}loadNested(e,t,s){if(!s&&t){for(const i of t.adds)i.key=i.id;return}const r=e._leafs;for(let i=0,n=r.length;i<n;++i){const o=r[i],a=o.id;o.key!==a&&mo(o,a)}}loadSelfRef(e,t){const s=e._leafs,r=s.length;if(!this.gos.get("getRowId")){for(let a=0;a<r;a++)s[a].treeParent=null;return}const n=this.beans.rowModel,o=this.parentIdGetter;for(let a=0;a<r;a++){const l=s[a];if(t||l.treeNodeFlags&Ve||l.treeParent?.destroyed){let c;const u=o?.(l.data);u!=null&&(c=n.getRowNode(u),c||this.warn(271,{id:l.id,parentId:u})),l.treeParent=c??e;const d=l.id;l.key!==d&&mo(l,d)}else l.treeParent??(l.treeParent=e)}}loadFlattened(e){const t=e._leafs;for(let s=0,r=t.length;s<r;++s){const i=t[s];i.treeParent=e;const n=i.id;i.key!==n&&mo(i,n)}}loadDataPath(e,t){const s=this.gos.get("getDataPath");if(!s){this.loadFlattened(e);return}const r=new Map,i=new Map;let n;t||(n=this.loadExistingDataPath(e,r,i));const o=e._leafs;for(let a=0,l=o.length;a<l;++a){const c=o[a];if(!t&&c.treeParent!==null&&(c.treeNodeFlags&Ve)===0)continue;const u=s(c.data),d=u?.length;if(!d){this.warn(185,{data:c.data});continue}const h=u[d-1];c.key!==h&&mo(c,h);const p=u.join(Qc);i.set(c,p);const g=r.get(p);g===void 0?r.set(p,c):g!==c&&(n=this.duplicatedPath(r,n,g,c,p))}n&&this.processDuplicatePaths(n,i),this.buildFromPaths(e,r,i)}loadExistingDataPath(e,t,s){let r;const i=e._leafs;for(let n=0,o=i.length;n<o;++n){const a=i[n],l=a.treeParent;if(l===null||(a.treeNodeFlags&Ve)!==0)continue;let c=a.key,u=l;for(;u&&u!==e&&u!==a;){c=Qc+c;const d=s.get(u);if(d!==void 0){c=d+c;break}c=u.key+c,u=u.treeParent}if(u!==a){s.set(a,c);const d=t.get(c);d===void 0?t.set(c,a):d!==a&&(r=this.duplicatedPath(t,r,d,a,c))}}return r}duplicatedPath(e,t,s,r,i){r.sourceRowIndex<s.sourceRowIndex&&e.set(i,r);const n=(t??(t=new Map)).get(i);return n===void 0?t.set(i,[s,r]):n.push(r),t}buildFromPaths(e,t,s){const r=new Array(48),i=e._leafs;for(let n=0,o=i.length;n<o;++n){const a=i[n],l=s.get(a);if(l===void 0)continue;const c=this.splitPathKey(r,l);let u=0,d=e;for(let h=c-1;h>=0;--h){const p=t.get(l.slice(0,r[h]));if(p){d=p,u=h+1;break}}u<c&&(d=this.buildMissingFillers(t,l,r,c,u,d)),a.treeParent=d}}splitPathKey(e,t){let s=0,r=0;const i=t.length;for(;r<i;){const n=t.indexOf(Qc,r);if(n===-1)break;e[s++]=n,r=n+eu}return s}buildMissingFillers(e,t,s,r,i,n){let o=0,a="row-group";n.sourceRowIndex<0&&n.treeParent&&(o=i,a=n.id);do{const l=i===0?0:s[i-1]+eu,c=s[i],u=t.slice(0,c);let d=e.get(u);if(d===void 0){const h=l===0?u:t.slice(l,c);a=this.makeFillerIdBase(t,s,i,a,o)+h,d=this.getOrCreateFiller(h,a),e.set(u,d),o=i+1}else d.sourceRowIndex<0&&(a=d.id,o=i+1);d.treeParent=n,n=d,++i}while(i<r);return n}processDuplicatePaths(e,t){for(const s of e.values()){s.sort(LZ);const r=s.length,i=new Array(r-1);for(let o=1;o<r;++o){const a=s[o];t.delete(a),a.treeParent=null,i[o-1]=a.data}const n=s[0];this.warn(186,{rowId:n.id,rowData:n.data,duplicateRowsData:i})}}getOrCreateFiller(e,t){const s=this.nonLeafsById??(this.nonLeafsById=new Map);let r=s.get(t);return r===void 0&&(r=new EZ(this.beans),r.id=t,r.key=e,r.group=!0,r.leafGroup=!1,r.rowGroupIndex=null,s.set(t,r)),r}makeFillerIdBase(e,t,s,r,i){for(;i<s;){const n=i>0?t[i-1]+eu:0,o=t[i];r+="-"+i+"-"+e.slice(n,o),++i}return r+"-"+s+"-"}hideRow(e){e.isSelected()&&this.beans.selectionSvc?.removeFromSelection?.(e,"rowDataChanged"),e.parent=null,e.group=!1,e.treeParent=null,e.treeNodeFlags=0,e.childrenAfterGroup=null,e.childrenAfterFilter=null,e.childrenAfterAggFilter=null,e.childrenAfterSort=null,e._leafs=void 0,e._groupData=null,e.aggData=null;const t=e.sibling;t&&(t.childrenAfterGroup=null,t.childrenAfterFilter=null,t.childrenAfterAggFilter=null,t.childrenAfterSort=null),e.updateHasChildren(),e.rowIndex!==null&&e.clearRowTopAndRowIndex()}onShowRowGroupColsSetChanged(){const e=this.beans.rowModel.rootNode._leafs;if(!e)return;for(let s=0,r=e.length;s<r;++s)e[s]._groupData=void 0;const t=this.nonLeafsById;if(t)for(const s of t.values())s._groupData=void 0}},LZ=(e,t)=>e.sourceRowIndex-t.sourceRowIndex,kZ=(e,t)=>{t._expanded!==void 0&&e._expanded===void 0&&e.treeParent!==null&&e.sourceRowIndex<0&&(e._expanded=t._expanded)},mo=(e,t)=>{const s=e._groupData!==void 0;e.key=t,e.groupValue=t;const r=e.sibling;r&&(r.key=t),s&&(e._groupData=void 0,e.setData(e.data))},yb={moduleName:"SharedTreeData",version:_,dependsOn:[$,wc,nC,Rc,Mc]},wb={moduleName:"TreeData",version:_,dynamicBeans:{treeGroupStrategy:DZ},rowModels:["clientSide"],dependsOn:[yb,xc,Ys,oC,aC]};import{_doOnce as _Z,_exists as tu}from"ag-stack";import{BeanStub as GZ,RowNode as OZ,_getGroupTotalRowCallback as xb,_getRowHeightAsNumber as NZ,_getRowHeightForNode as Fb}from"ag-grid-community";var BZ="ag-Grid-MissingKey",VZ=class extends GF{constructor(){super(...arguments),this.beanName="ssrmBlockUtils"}wireBeans(e){this.valueSvc=e.valueSvc,this.showRowGroupCols=e.showRowGroupCols,this.nodeManager=e.ssrmNodeManager,this.expansionSvc=e.expansionSvc,this.serverSideRowModel=e.rowModel,this.storeFactory=e.ssrmStoreFactory}createRowNode(e){const t=new OZ(this.beans),s=e.rowHeight??NZ(this.beans);return t.setRowHeight(s),t.group=e.group,t.leafGroup=e.leafGroup,t.level=e.level,t.uiLevel=e.level,t.parent=e.parent,t.stub=!0,t.__needsRefreshWhenVisible=!1,t.group&&(t.expanded=!1,t.field=e.field,t.rowGroupColumn=e.rowGroupColumn,t.rowGroupIndex=e.level),t}destroyRowNode(e,t=!1){e.childStore&&!t&&(this.destroyBean(e.childStore),e.childStore=null);const s=e.sibling;s&&!e.footer&&this.destroyRowNode(s,!1),e._destroy(!0),e.id!=null&&this.nodeManager.removeNode(e)}setTreeGroupInfo(e){e.updateHasChildren();const t=this.gos.get("getServerSideGroupKey"),s=e.hasChildren();s&&t!=null&&(e.key=t(e.data)),!s&&e.childStore!=null&&(this.destroyBean(e.childStore),e.childStore=null,e.master||(e.expanded=!1))}setRowGroupInfo(e){if(e.key=this.valueSvc.getValueFromData(e.rowGroupColumn,e),(e.key===null||e.key===void 0)&&_Z(()=>{this.warn(190,{rowGroupId:e.rowGroupColumn?.getId(),data:e.data})},"SSBlock-BadKey"),this.gos.get("groupAllowUnbalanced")&&e.key===""){const i=this.serverSideRowModel.getParams();e.childStore=this.createBean(this.storeFactory.createStore(i,e))}if(xb(this.beans.gos)({node:e})){const i=Lt(e,this.beans);i.uiLevel=e.uiLevel+1}}setMasterDetailInfo(e){const t=this.gos.get("isRowMaster");t!=null?e.master=t(e.data):e.master=!0}updateDataIntoRowNode(e,t){e.updateData(t),this.gos.get("treeData")?(this.setTreeGroupInfo(e),this.setChildCountIntoRowNode(e),this.updateRowFooter(e)):e.group?(this.setChildCountIntoRowNode(e),this.updateRowFooter(e)):this.gos.get("masterDetail")}updateRowFooter(e){if(!e.footer){if(e.group&&xb(this.beans.gos)({node:e})){e.sibling||Lt(e,this.beans);return}e.sibling&&to(e)}}setDataIntoRowNode(e,t,s,r){e.stub=!1;const i=this.gos.get("treeData");e.setDataAndId(t,s);const n=e.group;(i||!n)&&this.gos.get("masterDetail")&&this.setMasterDetailInfo(e),i?this.setTreeGroupInfo(e):n&&this.setRowGroupInfo(e),(i||n)&&(this.setGroupDataIntoRowNode(e),this.setChildCountIntoRowNode(e)),this.beans.selectionSvc?.updateRowSelectable(e),tu(t)&&e.setRowHeight(Fb(this.beans,e,!1,r).height)}setChildCountIntoRowNode(e){const t=this.gos.get("getChildCount");t&&e.setAllChildrenCount(t(e.data))}setGroupDataIntoRowNode(e){const t=e.key;e.groupValue=t,e.sibling&&(e.sibling.groupValue=t);const s=this.showRowGroupCols?.columns;if(!s)return;const r=this.gos.get("treeData");for(const i of s){let n=e._groupData;if(n||(n={},e._groupData=n),r)n[i.colId]=t;else if(i.isRowGroupDisplayed(e.rowGroupColumn.getId())){const o=this.valueSvc.getValueFromData(e.rowGroupColumn,e);n[i.colId]=o}}}clearDisplayIndex(e){e.clearRowTopAndRowIndex(),e.hasChildren()&&e.childStore&&e.childStore?.clearDisplayIndexes(),e.master&&e.detailNode&&e.detailNode?.clearRowTopAndRowIndex()}setDisplayIndex(e,t,s,r){const i=this.gos.get("groupAllowUnbalanced")&&e.group&&e.key==="",n=this.gos.get("groupHideOpenParents")&&e.group&&e.expanded;if(e.setUiLevel(r),n||i?(e.setRowIndex(null),e.setRowTop(null)):(e.setRowIndex(t.value++),e.setRowTop(s.value),e.rowHeight==null&&e.setRowHeight(Fb(this.beans,e).height),s.value+=e.rowHeight),e.footer)return;if(e.master&&(e.expanded&&e.detailNode?(e.detailNode.setRowIndex(t.value++),e.detailNode.setRowTop(s.value),s.value+=e.detailNode.rowHeight):e.detailNode&&e.detailNode.clearRowTopAndRowIndex()),e.hasChildren()&&!!e.childStore){const l=e.childStore;e.expanded||i?l.setDisplayIndexes(t,s,i?r:r+1):l.clearDisplayIndexes()}}extractRowBounds(e,t){const s=r=>({rowHeight:r.rowHeight,rowTop:r.rowTop});if(e.rowIndex===t)return s(e);if(e.hasChildren()&&e.expanded&&e.childStore){const r=e.childStore;if(r.isDisplayIndexInStore(t))return r.getRowBounds(t)}else if(e.master&&e.expanded&&e.detailNode&&e.detailNode.rowIndex===t)return s(e.detailNode)}isPixelInNodeRange(e,t){return!tu(e.rowTop)||!tu(e.rowHeight)?!1:t>=e.rowTop&&t<e.rowTop+e.rowHeight}getIndexAtPixel(e,t){if(this.isPixelInNodeRange(e,t))return e.rowIndex;const s=e.master&&e.expanded,r=e.detailNode;if(s&&r&&this.isPixelInNodeRange(r,t))return r.rowIndex;if(e.hasChildren()&&e.expanded&&e.childStore){const i=e.childStore;if(i.isPixelInRange(t))return i.getRowIndexAtPixel(t)}return null}createNodeIdPrefix(e){const t=[];let s=e;for(;s&&s.level>=0;)s.key===""?t.push(BZ):t.push(s.key),s=s.parent;if(t.length>0)return t.reverse().join("-")}checkOpenByDefault(e){const t=!!this.expansionSvc?.isNodeExpanded(e),s=e._expanded;!!s!==t?e.setExpanded(t):s===void 0&&(e._expanded=t)}};import{BeanStub as HZ,_isServerSideRowModel as UZ}from"ag-grid-community";var zZ=class extends OF{constructor(){super(...arguments),this.beanName="ssrmExpandListener"}postConstruct(){UZ(this.gos)&&this.addManagedEventListeners({rowExpansionStateChanged:this.onRowExpandStateChanged.bind(this)})}onRowExpandStateChanged(){const e=this.beans,t=e.expansionSvc;e.rowModel.forEachNode(s=>{t.updateExpandedState(s)}),this.eventSvc.dispatchEvent({type:"storeUpdated"})}};import{_jsonEquals as WZ}from"ag-stack";import{BeanStub as KZ,_isServerSideRowModel as $Z}from"ag-grid-community";var jZ=class extends NF{constructor(){super(...arguments),this.beanName="ssrmFilterListener"}wireBeans(e){this.serverSideRowModel=e.rowModel,this.filterManager=e.filterManager,this.listenerUtils=e.ssrmListenerUtils}postConstruct(){$Z(this.gos)&&this.addManagedEventListeners({advancedFilterEnabledChanged:()=>this.onFilterChanged(!0),filterChanged:()=>this.onFilterChanged()})}onFilterChanged(e){const t=this.serverSideRowModel.getParams();if(!t)return;const s=t.filterModel;let r,i;if(this.filterManager?.isAdvFilterEnabled()){r=this.filterManager.getAdvFilterModel();const l=e?Object.keys(s??{}):this.getAdvancedFilterColumns(s),c=this.getAdvancedFilterColumns(r);for(const u of l)c.add(u);i=Array.from(c)}else if(r=this.filterManager?.getFilterModel()??{},e){const l=this.getAdvancedFilterColumns(s);for(const c of Object.keys(r))l.add(c);i=Array.from(l)}else i=this.findChangedColumns(s,r);const n=this.listenerUtils.isSortingWithValueColumn(i),o=this.listenerUtils.isSortingWithSecondaryColumn(i),a={valueColChanged:n,secondaryColChanged:o,changedColumns:i};this.serverSideRowModel.refreshAfterFilter(r,a)}findChangedColumns(e,t){const s={};for(const i of Object.keys(e))s[i]=!0;for(const i of Object.keys(t))s[i]=!0;const r=[];for(const i of Object.keys(s))!WZ(e[i],t[i])&&r.push(i);return r}getAdvancedFilterColumns(e){const t=new Set;if(!e)return t;const s=r=>{if(r.filterType==="join")for(const i of r.conditions)s(i);else t.add(r.colId)};return s(e),t}};import{BeanStub as YZ}from"ag-grid-community";var qZ=class extends BF{constructor(){super(...arguments),this.beanName="ssrmListenerUtils"}wireBeans(e){this.pivotResultCols=e.pivotResultCols,this.valueColsSvc=e.valueColsSvc}isSortingWithValueColumn(e){const t=(this.valueColsSvc?.columns??[]).map(s=>s.colId);for(let s=0;s<e.length;s++)if(t.indexOf(e[s])>-1)return!0;return!1}isSortingWithSecondaryColumn(e){const t=this.pivotResultCols?.pivotCols;if(!t)return!1;const s=t.map(r=>r.colId);for(let r=0;r<e.length;r++)if(s.indexOf(e[r])>-1)return!0;return!1}};import{BeanStub as ZZ,_getSortModel as XZ,_isServerSideRowModel as JZ}from"ag-grid-community";var QZ=class extends VF{constructor(){super(...arguments),this.beanName="ssrmSortSvc"}wireBeans(e){this.sortSvc=e.sortSvc,this.serverSideRowModel=e.rowModel,this.listenerUtils=e.ssrmListenerUtils}postConstruct(){JZ(this.gos)&&this.addManagedEventListeners({sortChanged:this.onSortChanged.bind(this)})}onSortChanged(){const e=this.serverSideRowModel.getParams();if(!e)return;const t=XZ(this.sortSvc),s=e.sortModel,r=this.findChangedColumnsInSort(t,s),i=this.listenerUtils.isSortingWithValueColumn(r),n=this.listenerUtils.isSortingWithSecondaryColumn(r),o={valueColChanged:i,secondaryColChanged:n,changedColumns:r};this.serverSideRowModel.refreshAfterSort(t,o)}findChangedColumnsInSort(e,t){let s=[];for(const n of[e,t])if(n){const o=n.map(a=>a.colId);s=s.concat(o)}const r=(n,o)=>{const a=n?n.sort:null,l=o?o.sort:null;return a!==l},i=(n,o)=>{const a=n?t.indexOf(n):-1,l=o?e.indexOf(o):-1;return a!==l};return s.filter(n=>{const o=t.find(l=>l.colId===n),a=e.find(l=>l.colId===n);return r(o,a)||i(o,a)})}};import{BeanStub as eX}from"ag-grid-community";var tX=class extends HF{constructor(){super(...arguments),this.beanName="ssrmNodeManager",this.rowNodes=new Map}addRowNode(e){const t=e.id;this.rowNodes.has(t)&&this.warn(187,{rowId:t,firstData:this.rowNodes.get(t).data,secondData:e.data}),this.rowNodes.set(t,e)}removeNode(e){const t=e.id;this.rowNodes.delete(t)}destroy(){this.clear(),super.destroy()}clear(){this.rowNodes.clear(),super.destroy()}};import{_areEqual as sX,_debounce as rX,_jsonEquals as iX}from"ag-stack";import{BeanStub as nX,GRAND_TOTAL_ROW_ID as oX,GROUP_TOTAL_ROW_ID_PREFIX as Tb,ROOT_NODE_ID as aX,RowNode as lX,_addRowHeightChangedListener as cX,_getRowHeightAsNumber as vo,_getRowHeightForNode as uX,_getSortModel as Ab,_isGetRowHeightFunction as dX,_isRowSelection as hX}from"ag-grid-community";var pX=class extends UF{constructor(){super(...arguments),this.beanName="rowModel",this.hierarchical=!0,this.started=!1,this.rowCountReady=!1,this.managingPivotResultColumns=!1,this.onRowHeightChanged_debounced=rX(this,this.onRowHeightChanged.bind(this),100)}wireBeans(e){this.colModel=e.colModel,this.colNames=e.colNames,this.pivotResultCols=e.pivotResultCols,this.rowGroupColsSvc=e.rowGroupColsSvc,this.pivotColsSvc=e.pivotColsSvc,this.valueColsSvc=e.valueColsSvc,this.filterManager=e.filterManager,this.sortSvc=e.sortSvc,this.rowRenderer=e.rowRenderer,this.nodeManager=e.ssrmNodeManager,this.storeFactory=e.ssrmStoreFactory,this.pivotColDefSvc=e.pivotColDefSvc}ensureRowHeightsValid(){return!1}start(){this.started=!0,this.updateDatasource()}destroyDatasource(){this.datasource&&(this.datasource.destroy&&this.datasource.destroy(),this.rowRenderer.datasourceChanged(),this.datasource=void 0)}postConstruct(){const e=this.resetRootStore.bind(this);this.addManagedEventListeners({newColumnsLoaded:this.onColumnEverything.bind(this),storeUpdated:this.onStoreUpdated.bind(this),columnValueChanged:e,columnPivotChanged:this.onPivotChanged.bind(this),columnRowGroupChanged:e,columnPivotModeChanged:e}),cX(this,()=>this.onRowHeightStyleChanged()),this.addManagedPropertyListeners(["masterDetail","treeData","removePivotHeaderRowWhenSingleValueColumn","cacheBlockSize"],e),this.addManagedPropertyListeners(["groupAllowUnbalanced","groupTotalRow","grandTotalRow","alwaysShowGrandTotalRow"],()=>this.onStoreUpdated()),this.verifyProps(),this.addManagedPropertyListener("serverSideDatasource",()=>this.updateDatasource())}updateDatasource(){const e=this.gos.get("serverSideDatasource");e&&this.setDatasource(e)}verifyProps(){hX(this.gos)&&!this.gos.exists("getRowId")&&this.warn(188,{feature:"selection"})}setDatasource(e){this.started&&(this.destroyDatasource(),this.datasource=e,this.resetRootStore())}applyRowData(e,t,s){const r=this.getRootStore();if(!r)return;const i=r.getChildStore(s);i&&i.applyRowData(e,t,e.rowData.length)}isLastRowIndexKnown(){const e=this.getRootStore();return e?e.isLastRowIndexKnown():!1}onColumnEverything(){if(!this.storeParams){this.resetRootStore();return}const e=this.columnsToValueObjects(this.rowGroupColsSvc?.columns),t=this.columnsToValueObjects(this.valueColsSvc?.columns),s=this.columnsToValueObjects(this.pivotColsSvc?.columns),r=c=>{const u={};for(const p of c.oldCols)u[p.id]=p;const d=c.newCols.every(p=>{const g=u[p.id];return g&&delete u[p.id],g&&g.field===p.field&&g.aggFunc===p.aggFunc}),h=!c.allowRemovedColumns&&!!Object.values(u).length;return d&&!h},i=!iX(this.storeParams.sortModel,Ab(this.sortSvc)),n=!r({oldCols:this.storeParams.rowGroupCols,newCols:e}),o=!r({oldCols:this.storeParams.pivotCols,newCols:s}),a=!!e?.length&&!r({oldCols:this.storeParams.valueCols,newCols:t,allowRemovedColumns:!0});if(i||n||o||a)this.resetRootStore();else{const c=this.createStoreParams();this.storeParams.rowGroupCols=c.rowGroupCols,this.storeParams.pivotCols=c.pivotCols,this.storeParams.valueCols=c.valueCols}}onPivotChanged(e){if(!this.arePivotColsUnchanged()){this.resetRootStore();return}const t=this.pivotResultCols;if(t?.suppliedColDefs){t.resortPivotResultCols(e.source);return}const s=this.pivotResultFields;this.managingPivotResultColumns&&s&&this.generateSecondaryColumns(s)}arePivotColsUnchanged(){const e=this.storeParams?.pivotCols;if(!e)return!1;const t=this.columnsToValueObjects(this.pivotColsSvc?.columns);return sX(e,t,(s,r)=>s.id===r.id&&s.field===r.field&&s.aggFunc===r.aggFunc)}destroyRootStore(){this.rootNode?.childStore&&(this.rootNode.childStore=this.destroyBean(this.rootNode.childStore),this.nodeManager.clear())}refreshAfterSort(e,t){this.storeParams&&(this.storeParams.sortModel=e);const s=this.getRootStore();s&&(s.refreshAfterSort(t),this.onStoreUpdated())}generateSecondaryColumns(e){if(!this.pivotColDefSvc){this.gos.assertModuleRegistered("SharedPivot",2);return}this.pivotResultFields=e;const t=this.pivotResultCols;if(t?.suppliedColDefs)return;const s=this.pivotColDefSvc.createColDefsFromFields(e);this.managingPivotResultColumns=!0,t?.setPivotResultCols(s,"rowModelUpdated")}onRowHeightStyleChanged(){if(!this.rootNode)return;const e=vo(this.beans);e!==this.lastRowHeight&&(this.lastRowHeight=e,this.resetRowHeights())}resetRowHeights(){if(!this.rootNode)return;const e=this.resetRowHeightsForAllRowNodes(),t=this.rootNode.sibling;t&&this.resetRowHeight(t),e&&this.onRowHeightChanged()}resetRowHeightsForAllRowNodes(){let e=!1;const t=vo(this.beans);return this.forEachNode(s=>{if(e=!0,s.stub){s.setRowHeight(t);return}this.resetRowHeight(s);const r=s.detailNode;r&&this.resetRowHeight(r);const i=s.sibling;i&&this.resetRowHeight(i)}),e}resetRowHeight(e){const t=uX(this.beans,e);e.setRowHeight(t.height,t.estimated)}onRootStoreCreated(){this.rowCountReady||(this.rowCountReady=!0,this.eventSvc.dispatchEvent({type:"rowCountReady"}))}resetRootStore(){this.destroyRootStore(),this.rootNode=new lX(this.beans),this.rootNode.group=!0,this.rootNode.level=-1,this.beans.selectionSvc?.syncInRowNode(this.rootNode),this.lastRowHeight=vo(this.beans),this.datasource&&(this.storeParams=this.createStoreParams(),this.rootNode.childStore=this.createBean(this.storeFactory.createStore(this.storeParams,this.rootNode)),this.updateRowIndexesAndBounds()),this.managingPivotResultColumns&&(this.pivotResultCols?.setPivotResultCols(null,"api"),this.managingPivotResultColumns=!1,this.pivotResultFields=void 0),this.dispatchModelUpdated(!0)}columnsToValueObjects(e=[]){return e.map(t=>({id:t.getId(),aggFunc:t.aggFunc,displayName:this.colNames.getDisplayNameForColumn(t,"model"),field:t.field}))}createStoreParams(){const e=this.columnsToValueObjects(this.rowGroupColsSvc?.columns),t=this.columnsToValueObjects(this.valueColsSvc?.columns),s=this.columnsToValueObjects(this.pivotColsSvc?.columns),r=dX(this.gos);return{valueCols:t,rowGroupCols:e,pivotCols:s,pivotMode:this.colModel.pivotMode,filterModel:this.filterManager?.isAdvFilterEnabled()?this.filterManager?.getAdvFilterModel():this.filterManager?.getFilterModel()??{},sortModel:Ab(this.sortSvc),datasource:this.datasource,lastAccessedSequence:{value:0},dynamicRowHeight:r}}getParams(){return this.storeParams}dispatchModelUpdated(e=!1){this.eventSvc.dispatchEvent({type:"modelUpdated",animate:!e,keepRenderedRows:!e,newPage:!1,newData:!1})}onStoreUpdated(){this.updateRowIndexesAndBounds(),this.dispatchModelUpdated()}onRowHeightChanged(){this.updateRowIndexesAndBounds(),this.dispatchModelUpdated()}updateRowIndexesAndBounds(){const e=this.getRootStore();e&&e.setDisplayIndexes({value:0},{value:0},0)}retryLoads(){const e=this.getRootStore();e&&(e.retryLoads(),this.onStoreUpdated())}getRow(e){const t=this.getRootStore();if(t)return t.getRowUsingDisplayIndex(e)}refreshAfterFilter(e,t){this.storeParams&&(this.storeParams.filterModel=e);const s=this.getRootStore();s&&(s.refreshAfterFilter(t),this.onStoreUpdated())}getRootStore(){return this.rootNode?.childStore}getRowCount(){const e=this.getRootStore();return e?e.getDisplayIndexEnd():0}getTopLevelRowCount(){const e=this.getRootStore();return e?e.getRowCount():1}getTopLevelRowDisplayedIndex(e){const t=this.getRootStore();return t?t.getTopLevelRowDisplayedIndex(e):e}getRowBounds(e){const t=this.getRootStore();return t?t.getRowBounds(e):{rowTop:0,rowHeight:vo(this.beans)}}getBlockStates(){const e=this.getRootStore();if(!e)return;const t={};return e.forEachStoreDeep(s=>{const r=s.getBlockStates();for(const i of Object.keys(r))t[i]=r[i]}),t}getRowIndexAtPixel(e){const t=this.getRootStore();return e<=0||!t?0:t.getRowIndexAtPixel(e)}isEmpty(){return!1}getOverlayType(){const e=this.getRootStore(),t=this.rootNode?.sibling?.displayed?1:0;return e?.getDisplayIndexEnd()===t?this.filterManager?.isAnyFilterPresent()?"noMatchingRows":"noRows":null}isRowsToRender(){return this.getRootStore()!=null&&this.getRowCount()>0}getType(){return"serverSide"}forEachNode(e){const t=this.getRootStore();t&&t.forEachNodeDeep(e)}forEachDisplayedNode(e){const t=(s,r)=>{s.stub||!s.displayed||e(s,r)};this.forEachNodeAfterFilterAndSort(t,!0)}forEachNodeAfterFilterAndSort(e,t=!1){const s=this.getRootStore();s&&s.forEachNodeDeepAfterFilterAndSort(e,void 0,t)}executeOnStore(e,t){if(!this.started)return!1;const s=this.getRootStore();if(!s)return!0;const r=s.getChildStore(e);return r&&t(r),!0}refreshStore(e={}){const t=e.route??[];this.executeOnStore(t,s=>s.refreshStore(e.purge===!0))}getStoreState(){const e=[],t=this.getRootStore();return t&&t.addStoreStates(e),e}getNodesInRangeForSelection(e,t){const s=e.rowIndex,r=t.rowIndex;if(s===null&&r===null)return[];if(r===null)return e?[e]:[];if(s===null)return[t];const i=[],[n,o]=[s,r].sort((a,l)=>a-l);return this.forEachNode(a=>{const l=a.rowIndex;l==null||a.stub||l>=n&&l<=o&&i.push(a)}),i.length!==o-n+1?null:i}getRowNode(e){if(typeof e!="string"&&(e=String(e)),e===oX)return this.getRootStore()?.getGrandTotalNode();let t;if(this.forEachNode(s=>{s.id===e&&(t=s),s.detailNode?.id===e&&(t=s.detailNode)}),!t&&e===aX)return this.rootNode;if(!t&&e.startsWith(Tb)){const s=e.slice(Tb.length),r=this.getRowNode(s);t=r?.sibling?.footer?r.sibling:void 0}return t}isRowPresent(e){return!!this.getRowNode(e.id)}setRowCount(e,t){const s=this.getRootStore();s&&s.setRowCount(e,t)}destroy(){this.destroyDatasource(),this.destroyRootStore(),super.destroy()}onRowHeightChangedDebounced(){this.onRowHeightChanged_debounced()}};import{_getServerSideRowModel as Co}from"ag-grid-community";function gX(e){return e.selectionSvc?.getSelectionState()??null}function fX(e,t){e.selectionSvc?.setSelectionState(t,"api")}function mX(e,t){return e.ssrmTxnManager?.applyTransaction(t)}function vX(e,t){const s=t.startRow??0,r=t.route??[];if(s<0){e.log.warn(189,{startRow:s});return}Co(e)?.applyRowData(t.successParams,s,r)}function CX(e,t,s){return e.ssrmTxnManager?.applyTransactionAsync(t,s)}function bX(e){Co(e)?.retryLoads()}function SX(e){return e.ssrmTxnManager?.flushAsyncTransactions()}function yX(e,t){Co(e)?.refreshStore(t)}function wX(e){return Co(e)?.getStoreState()??[]}import{_exists as xX}from"ag-stack";import{RowNode as FX,_getRowHeightForNode as TX}from"ag-grid-community";import{BeanStub as AX}from"ag-grid-community";var bo=class extends zF{constructor(){super(...arguments),this.name="expand",this.expanded=new Set,this.collapsed=new Set,this.initialState=new Map}setExpandedState({expandedRowGroupIds:e,collapsedRowGroupIds:t}){this.expanded=new Set(e),this.collapsed=new Set(t);for(const s of this.expanded)this.initialState.set(s,!1);for(const s of this.collapsed)this.initialState.set(s,!0)}getExpandedState(){return{expandedRowGroupIds:Array.from(this.expanded),collapsedRowGroupIds:Array.from(this.collapsed)}}setRowExpanded(e,t){const s=e.id,r=this.initialState.get(s)===t;if(t){this.collapsed.delete(s),r||this.expanded.add(s);return}this.expanded.delete(s),r||this.collapsed.add(s)}isRowExpanded(e){const t=e.id;if(this.expanded.has(t))return!0;if(this.collapsed.has(t))return!1;const s=this.initialState.get(t);if(s!=null)return s;const r=this.getInitialRowState(e);return this.initialState.set(t,r),r}getInitialRowState(e){if(!e.isExpandable())return!1;const t=this.gos.getCallback("isServerSideGroupOpenByDefault");if(!t)return!1;const s={data:e.data,rowNode:e};return t(s)}isRowInitialised(e){return this.initialState.has(e)}expandAll(e){this.beans.rowModel.forEachNode(t=>{t.isExpandable()?this.setRowExpanded(t,e):e||this.expanded.delete(t.id)})}};import{BeanStub as PX}from"ag-grid-community";var Pb=class extends WF{constructor(){super(...arguments),this.name="expandAll",this.allExpanded=void 0,this.flipped=new Set}setExpandedState(e){this.allExpanded=e.expandAll,this.flipped=new Set(e.invertedRowGroupIds)}getExpandedState(){return{expandAll:this.allExpanded,invertedRowGroupIds:Array.from(this.flipped)}}setRowExpanded(e,t){const s=e.id;if(t===this.allExpanded){this.flipped.delete(s);return}this.flipped.add(s)}isRowExpanded(e){const t=e.id;return this.allExpanded!==this.flipped.has(t)}isRowInitialised(){return!0}expandAll(e){this.allExpanded=e,this.flipped.clear()}},RX=class extends Nv{constructor(){super(...arguments),this.beanName="expansionSvc"}wireBeans(e){this.serverSideRowModel=e.rowModel,this.storeFactory=e.ssrmStoreFactory}setStrategy(e){this.destroyBean(this.strategy),this.strategy=this.createManagedBean(e)}postConstruct(){const e=()=>{this.setStrategy(new bo)};this.addManagedEventListeners({columnRowGroupChanged:e,columnPivotChanged:e,columnPivotModeChanged:e}),this.addManagedPropertyListener("ssrmExpandAllAffectsAllRows",t=>{t.currentValue||(this.setStrategy(new bo),this.updateAllNodes(),this.dispatchStateUpdatedEvent())}),e()}setExpansionState(e){const t="expandAll"in e,s=this.isExpandAllStrategy(this.strategy);t!==s&&this.setStrategy(t?new Pb:new bo),this.strategy.setExpandedState(e),this.updateAllNodes(),this.dispatchStateUpdatedEvent()}getExpansionState(){return this.strategy.getExpandedState()}updateAllNodes(){this.serverSideRowModel.forEachNode(e=>{super.setExpanded(e,this.isNodeExpanded(e))})}isExpanded(e){let t=e._expanded;return t===!1||!e.isExpandable()?!1:(t===null&&(t=this.defaultExpanded(e),e._expanded=t),t)}isNodeExpanded(e){return this.strategy.isRowExpanded(e)&&e.isExpandable()}setExpanded(e,t,s,r){const i=e.isExpandable();if(!(!i&&!this.checkExpandable(e,!!e.group))){if(this.strategy.setRowExpanded(e,t),t&&!i){this.dispatchStateUpdatedEvent();return}super.setExpanded(e,t,s),this.dispatchStateUpdatedEvent(),this.updateExpandedState(e)}}resetExpansion(){this.setStrategy(new bo),this.updateAllNodes(),this.dispatchStateUpdatedEvent()}expandAll(e){const t=this.beans.gos.get("ssrmExpandAllAffectsAllRows");!this.isExpandAllStrategy(this.strategy)&&t&&this.setStrategy(new Pb),this.strategy.expandAll(e),this.updateAllNodes(),this.dispatchStateUpdatedEvent(),this.beans.eventSvc.dispatchEvent({type:"expandOrCollapseAll",source:e?"expandAll":"collapseAll"})}isExpandAllStrategy(e){return e.name==="expandAll"}onGroupExpandedOrCollapsed(){}setDetailsExpansionState(e){const{gos:t}=this.beans;if(!t.get("ssrmExpandAllAffectsAllRows"))return;const s=this.getExpansionState();if(s.expandAll===void 0)return;const i=s.expandAll&&s.invertedRowGroupIds.length===0;if((!s.expandAll&&s.invertedRowGroupIds.length===0)!==i)return i?e.expandAll():e.collapseAll()}dispatchExpandedEvent(e){this.eventSvc.dispatchEvent(e),this.beans.rowRenderer.refreshRowByNode(e.node)}updateExpandedState(e){const t=e.childStore;if(e.expanded){if(e.master&&!e.detailNode&&(e.detailNode=this.createDetailNode(e)),!t&&e.hasChildren()){const s=this.serverSideRowModel.getParams();e.childStore=this.createBean(this.storeFactory.createStore(s,e))}}else t&&this.gos.get("purgeClosedRowNodes")&&(e.childStore=this.destroyBean(t))}createDetailNode(e){const t=new FX(this.beans);t.detail=!0,t.selectable=!1,t.parent=e,xX(e.id)&&(t.id="detail_"+e.id),t.data=e.data,t.level=e.level+1;const s=200,r=TX(this.beans,t).height;return t.rowHeight=r||s,t}};import{BaseSelectionService as MX,_getGroupSelectsDescendants as Rb,_getRowSelectionMode as Mb,_isMultiRowSelection as IX,_isRowSelection as So,_isUsingNewRowSelectionAPI as EX}from"ag-grid-community";import{BeanStub as DX,ROOT_NODE_ID as su,_isMultiRowSelection as Ib,_isUsingNewRowSelectionAPI as LX}from"ag-grid-community";var ru=class extends KF{constructor(e){super(),this.selectionCtx=e,this.selectedState={selectAll:!1,toggledNodes:new Set},this.selectAllUsed=!1,this.selectedNodes={},this.rootSelected=!1}getSelectedState(){const{selectAll:e,toggledNodes:t}=this.selectedState,s=[...t];return this.rootSelected&&!t.has(su)&&s.push(su),{selectAll:e,toggledNodes:s}}setSelectedState(e){if(typeof e!="object"){this.error(116);return}if(!("selectAll"in e)){this.error(116);return}if(typeof e.selectAll!="boolean"){this.error(117);return}if(!("toggledNodes"in e)||!Array.isArray(e.toggledNodes))return this.warn(197);const t={selectAll:e.selectAll,toggledNodes:new Set};let s=!1;e.toggledNodes.forEach(i=>{typeof i!="string"?this.warn(196,{key:i}):i===su?s=!0:t.toggledNodes.add(i)});const r=t.selectAll||t.toggledNodes.size+(s?1:0)>1;if(LX(this.gos)&&!Ib(this.gos)&&r){this.warn(130);return}this.selectedState=t,this.rootSelected=s}deleteSelectionStateFromParent(e,t){if(this.selectedState.toggledNodes.size===0)return!1;let s=!1;for(const r of t)this.selectedState.toggledNodes.delete(r)&&(s=!0);return s}setNodesSelected(e){const{nodes:t,clearSelection:s,newValue:r,source:i}=e;if(t.length===0)return 0;const n=s&&r;if(!Ib(this.gos)||n){if(t.length>1)return this.error(130),0;const c=t[0].primaryRow,u=c.level===-1;if(!u&&c.id===void 0||r&&!c.selectable)return 0;const d=r&&!u;return this.selectedNodes=d?{[c.id]:c}:{},this.selectedState={selectAll:!1,toggledNodes:new Set(d?[c.id]:[])},this.rootSelected=r&&u,1}const o=(c,u)=>{r&&c.selectable?this.selectedNodes[u]=c:delete this.selectedNodes[u],r===this.selectedState.selectAll||!c.selectable?this.selectedState.toggledNodes.delete(u):this.selectedState.toggledNodes.add(u)};let a=0;for(const c of t){const u=c.primaryRow;if(u.level===-1){const d=r&&u.selectable;d!==this.rootSelected&&a++,this.rootSelected=d}else{const d=u.id;if(d===void 0)continue;const h=this.isNodeSelected(u);o(u,d),this.isNodeSelected(u)!==h&&a++}}const l=t.length===1&&i==="api"?t[0].primaryRow:void 0;return l?.id!==void 0&&this.selectionCtx.setRoot(l),a}processNewRow(e){this.selectedNodes[e.id]&&(this.selectedNodes[e.id]=e)}isNodeSelected(e){if(e.level===-1)return this.rootSelected;const{selectAll:t,toggledNodes:s}=this.selectedState,r=s.has(e.id);return t?!r:r}getSelectedNodes(e=!1,t=!0){const{selectedState:{selectAll:s},selectedNodes:r,selectAllUsed:i}=this;if(t&&i&&this.warn(199),e&&s)return null;const n=Object.values(r),o=this.rootSelected?this.beans.rowModel.rootNode:null;return o&&n.push(o),n}getSelectedRows(){return(this.getSelectedNodes()??[]).map(t=>t.data).filter(t=>t!=null)}getSelectionCount(){return this.selectedState.selectAll?-1:this.selectedState.toggledNodes.size+(this.rootSelected?1:0)}isSoleSelection(e){const{selectedState:t,rootSelected:s}=this;return t.selectAll||s?!1:t.toggledNodes.size===1&&t.toggledNodes.has(e.id)}isEmpty(){return!this.selectedState.selectAll&&!this.selectedState.toggledNodes?.size&&!this.rootSelected}selectAllRowNodes(){this.reset(!0)}deselectAllRowNodes(){this.reset(!1)}reset(e){this.selectedState={selectAll:e,toggledNodes:new Set},this.selectedNodes={},this.rootSelected=!1,this.selectAllUsed||(this.selectAllUsed=e)}getSelectAllState(){const{selectAll:e,toggledNodes:t}=this.selectedState;return t.size>0?null:e}};import{BeanStub as kX,ROOT_NODE_ID as yo,_isMultiRowSelection as _X}from"ag-grid-community";var wo=class extends $F{constructor(e){super(),this.selectionCtx=e,this.selectedState={selectAllChildren:!1,toggledNodes:new Map},this.rootSelected=!1}wireBeans(e){this.rowModel=e.rowModel,this.rowGroupColsSvc=e.rowGroupColsSvc,this.filterManager=e.filterManager,this.selectionSvc=e.selectionSvc}postConstruct(){this.addManagedEventListeners({modelUpdated:()=>this.removeRedundantState(),columnRowGroupChanged:()=>this.selectionSvc.reset("rowGroupChanged")})}getSelectedState(){const{gos:e,rowGroupColsSvc:t,selectedState:s}=this,r=e.get("treeData"),i=(a,l,c)=>{const u={nodeId:c};if((r||t&&l<=t.columns.length)&&(u.selectAllChildren=a.selectAllChildren),a.toggledNodes.size){const d=[];a.toggledNodes.forEach((h,p)=>{const g=i(h,l+1,p);d.push(g)}),u.toggledNodes=d}return u},n=i(s,0),o=n.toggledNodes;return this.rootSelected&&!o?.some(a=>a.nodeId===yo)&&(n.toggledNodes=[...o??[],{nodeId:yo}]),n}setSelectedState(e){if("selectAll"in e){this.error(111);return}const t=(s,r)=>{if(typeof s!="object")throw this.error(243),new Error;if("selectAllChildren"in s&&typeof s.selectAllChildren!="boolean")throw this.error(244),new Error;if("toggledNodes"in s){if(!Array.isArray(s.toggledNodes))throw this.error(245),new Error;if(!s.toggledNodes.every(l=>typeof l=="object"&&"nodeId"in l&&typeof l.nodeId=="string"))throw this.error(246),new Error}const i=s.selectAllChildren??!r,n=s.toggledNodes?.map(a=>[a.nodeId,t(a,i)]);if(n?.some(([,a])=>i===a.selectAllChildren&&a.toggledNodes.size===0))throw this.error(247),new Error;return{selectAllChildren:i,toggledNodes:new Map(n)}};try{const s=e.toggledNodes,r=Array.isArray(s)&&s.some(n=>n?.nodeId===yo),i=r?{...e,toggledNodes:s.filter(n=>n?.nodeId!==yo)}:e;this.selectedState=t(i,!!i.selectAllChildren),this.rootSelected=r}catch{}}deleteSelectionStateFromParent(e,t){let s=this.selectedState;const r=[...e];for(;s&&r.length;)s=s.toggledNodes.get(r.pop());if(!s)return!1;let i=!1;for(const n of t)s?.toggledNodes.delete(n)&&(i=!0);return i&&this.removeRedundantState(),i}setNodesSelected({nodes:e,newValue:t,clearSelection:s,source:r}){if(e.length===0)return 0;const i=s&&t;if(!_X(this.gos)||i){if(e.length>1)return this.error(130),0;const a=e[0].primaryRow;if(a.id===void 0&&a.level!==-1||t&&!a.selectable)return 0;this.deselectAllRowNodes()}let n=0;for(const a of e){const l=a.primaryRow;if(l.level===-1){const c=this.rootSelected;this.selectedState={selectAllChildren:t,toggledNodes:new Map},this.rootSelected=t,t!==c&&n++}else if(l.id!==void 0){const c=this.getRouteToNode(l),u=this.selectedState,d=this.isNodePathSelected(c,u);this.recursivelySelectNode(c,u,t),this.isNodePathSelected(c,u)!==d&&n++}}this.removeRedundantState();const o=e.length===1&&r==="api"?e[0].primaryRow:void 0;return o?.id!==void 0&&this.selectionCtx.setRoot(o),n}isNodeSelected(e){if(e.level===-1)return this.rootSelected;const t=this.getRouteToNode(e);return this.isNodePathSelected(t,this.selectedState)}isNodePathSelected([e,...t],s){if(t.length===0){const r=s.toggledNodes.has(e.id);return e.hasChildren()&&s.toggledNodes.get(e.id)?.toggledNodes.size?void 0:s.selectAllChildren?!r:r}if(s.toggledNodes.has(e.id)){const r=s.toggledNodes.get(e.id);if(r)return this.isNodePathSelected(t,r)}return s.selectAllChildren}getRouteToNode(e){const t=[];let s=e;for(;s.parent;)t.push(s),s=s.parent;return t.reverse()}removeRedundantState(){if(this.filterManager?.isAnyFilterPresent())return;const e=(t=this.selectedState,s,r)=>{if(t.toggledNodes.forEach((o,a)=>{e(o,a,t)}),s){const a=this.rowModel.getRowNode(s)?.childStore;if(a?.isLastRowIndexKnown()&&t.toggledNodes.size>=a.getChildRowCount()){for(const u of t.toggledNodes.entries()){const[d,h]=u;if(h.toggledNodes.size>0||!this.rowModel.getRowNode(d))return}t.selectAllChildren=!t.selectAllChildren,t.toggledNodes.clear()}}const i=t.toggledNodes.size===0,n=r?.selectAllChildren===t.selectAllChildren;i&&n&&r?.toggledNodes.delete(s)};e()}recursivelySelectNode([e,...t],s,r){if(!e)return;if(!t.length){const a=e.selectable;if(s.selectAllChildren===r||!a){s.toggledNodes.delete(e.id);return}const c={selectAllChildren:r,toggledNodes:new Map};s.toggledNodes.set(e.id,c);return}const n=s.toggledNodes.has(e.id),o=s.toggledNodes.get(e.id)??{selectAllChildren:s.selectAllChildren,toggledNodes:new Map};n||s.toggledNodes.set(e.id,o),this.recursivelySelectNode(t,o,r),s.selectAllChildren===o.selectAllChildren&&o.toggledNodes.size===0&&s.toggledNodes.delete(e.id)}getSelectedNodes(e=!1){if(this.warn(202),this.selectedState.selectAllChildren&&e)return null;const t=[];return this.rowModel.forEachNode(s=>{s.isSelected()&&t.push(s)}),t}processNewRow(){}getSelectedRows(){return(this.getSelectedNodes()??[]).map(t=>t.data).filter(t=>t!=null)}getSelectionCount(){return-1}isSoleSelection(e){if(this.rootSelected||e.level===-1)return!1;let t=this.selectedState;const s=this.getRouteToNode(e);for(let r=0;r<s.length;r++){if(t.selectAllChildren)return!this.filterManager?.isAnyFilterPresent()&&t.toggledNodes.size===0&&s.slice(r).every(n=>this.isOnlyChild(n));if(t.toggledNodes.size!==1)return!1;const i=t.toggledNodes.get(s[r].id);if(!i)return!1;t=i}return t.selectAllChildren&&t.toggledNodes.size===0}isOnlyChild(e){const t=e.parent?.childStore;return!!t?.isLastRowIndexKnown()&&t.getChildRowCount()===1}isEmpty(){return!this.selectedState.selectAllChildren&&!this.selectedState.toggledNodes?.size&&!this.rootSelected}selectAllRowNodes(){this.reset(!0)}deselectAllRowNodes(){this.reset(!1)}reset(e){this.selectedState={selectAllChildren:e,toggledNodes:new Map},this.rootSelected=!1}getSelectAllState(){const{selectAllChildren:e,toggledNodes:t}=this.selectedState;return t.size>0?null:e}},GX=class extends jF{constructor(){super(...arguments),this.beanName="selectionSvc"}postConstruct(){super.postConstruct(),this.addManagedPropertyListeners(["groupSelectsChildren","rowSelection"],()=>{const s=Rb(this.gos),r=s&&this.selectionStrategy instanceof ru?wo:!s&&this.selectionStrategy instanceof wo?ru:void 0;r&&(this.destroyBean(this.selectionStrategy),this.selectionStrategy=this.createManagedBean(new r(this.selectionCtx)),this.shotgunResetNodeSelectionState(),this.dispatchSelectionChanged("api"))}),this.addManagedPropertyListeners(["rowSelection"],()=>{const s=Mb(this.gos);s!==this.selectionMode&&(this.selectionMode=s,this.deselectAllRowNodes({source:"api"}))}),this.selectionMode=Mb(this.gos);const t=Rb(this.gos)?wo:ru;this.selectionStrategy=this.createManagedBean(new t(this.selectionCtx))}handleSelectionEvent(e,t,s,r){if(this.isRowSelectionBlocked(t))return 0;const i=this.inferNodeSelections(t,e.shiftKey,e.metaKey||e.ctrlKey,s,r);if(i==null)return 0;this.selectionCtx.selectAll=!1;let n;return"select"in i?(i.reset?this.selectionStrategy.deselectAllRowNodes({source:"api"}):this.selectionStrategy.setNodesSelected({nodes:i.deselect,newValue:!1,source:s}),n=this.selectionStrategy.setNodesSelected({nodes:i.select,newValue:!0,source:s})):n=this.selectionStrategy.setNodesSelected({nodes:[i.node],newValue:i.newValue,clearSelection:i.clearSelection,event:e,source:s}),this.shotgunResetNodeSelectionState(s,e),this.dispatchSelectionChanged(s),n}getSelectionState(){return this.selectionStrategy.getSelectedState()}setSelectionState(e,t){if(!So(this.gos)){e&&this.warn(132);return}Array.isArray(e)||(e?(this.selectionStrategy.setSelectedState(e),this.shotgunResetNodeSelectionState(),this.dispatchSelectionChanged(t)):this.deselectAllRowNodes({source:t}))}setNodesSelected(e){if(!So(this.gos)&&e.newValue)return this.warn(132),0;const{nodes:t,...s}=e;if(t.length>1&&this.selectionMode!=="multiRow")return this.warn(130),0;const r={nodes:t.filter(n=>n.selectable),...s};if(!r.nodes.length)return 0;const i=this.selectionStrategy.setNodesSelected(r);return this.shotgunResetNodeSelectionState(r.source,r.event),this.dispatchSelectionChanged(r.source),i}deleteSelectionStateFromParent(e,t){this.selectionStrategy.deleteSelectionStateFromParent(e,t)&&(this.shotgunResetNodeSelectionState(),this.dispatchSelectionChanged("api"))}shotgunResetNodeSelectionState(e,t){this.beans.rowModel.forEachNode(s=>{if(s.stub)return;const r=this.selectionStrategy.isNodeSelected(s);r!==s.isSelected()&&this.selectRowNode(s,r,t,e)}),this.syncRootNode(e,t)}syncRootNode(e,t){const s=this.beans.rowModel.rootNode;if(!s)return;const r=this.selectionStrategy.isNodeSelected(s);r!==s.isSelected()&&this.selectRowNode(s,r,t,e)}getSelectedNodes(){return this.selectionStrategy.getSelectedNodes()??[]}getSelectedRows(){return this.selectionStrategy.getSelectedRows()}getSelectionCount(){return this.selectionStrategy.getSelectionCount()}isSoleSelection(e){return this.selectionStrategy.isSoleSelection(e)}syncInRowNode(e){this.selectionStrategy.processNewRow(e);const t=this.selectionStrategy.isNodeSelected(e);if(t!==!1&&!e.selectable){this.selectionStrategy.setNodesSelected({nodes:[e],newValue:!1,source:"api"}),this.shotgunResetNodeSelectionState(),this.dispatchSelectionChanged("api");return}e.__selected=t}reset(){this.selectionStrategy.deselectAllRowNodes({source:"api"}),this.selectionCtx.reset()}isEmpty(){return this.selectionStrategy.isEmpty()}hasNodesToSelect(){return!0}selectAllRowNodes(e){if(!So(this.gos)){this.warn(132);return}if(Eb(this.beans.log,e),EX(this.gos)&&!IX(this.gos))return this.warn(130);this.selectionStrategy.selectAllRowNodes(e),this.selectionCtx.selectAll=!0,this.beans.rowModel.forEachNode(t=>{t.stub||this.selectRowNode(t,!0,void 0,e.source)}),this.syncRootNode(e.source),this.dispatchSelectionChanged(e.source)}deselectAllRowNodes(e){Eb(this.beans.log,e),this.selectionStrategy.deselectAllRowNodes(e),this.selectionCtx.selectAll=!1,this.beans.rowModel.forEachNode(t=>{t.stub||this.selectRowNode(t,!1,void 0,e.source)}),this.syncRootNode(e.source),this.dispatchSelectionChanged(e.source)}getSelectAllState(e){return this.selectionStrategy.getSelectAllState(e)}getBestCostNodeSelection(){return this.warn(194,{method:"getBestCostNodeSelection"})}updateSelectable(){if(!So(this.gos))return;const e=[];this.beans.rowModel.forEachNode(t=>{!this.updateRowSelectable(t,!0)&&t.isSelected()&&e.push(t)}),e.length&&this.setNodesSelected({nodes:e,newValue:!1,source:"selectableChanged"})}dispatchSelectionChanged(e){this.eventSvc.dispatchEvent({type:"selectionChanged",source:e,selectedNodes:this.selectionStrategy instanceof wo?null:this.selectionStrategy.getSelectedNodes(!0,!1),serverSideState:this.getSelectionState()})}updateSelectableAfterGrouping(){return this.error(194,{method:"updateSelectableAfterGrouping"})}refreshMasterNodeState(){}setDetailSelectionState(){}};function Eb(e,{selectAll:t}){(t==="filtered"||t==="currentPage")&&e.warn(195,{justCurrentPage:t==="currentPage"})}import{BeanStub as OX}from"ag-grid-community";var NX=class extends YF{constructor(){super(...arguments),this.beanName="rowChildrenSvc"}getHasChildrenValue(e){const t=this.gos.get("treeData"),s=this.gos.get("isServerSideGroup");return!e.stub&&!e.footer&&(t?!!s&&s(e.data):!!e.group)}};import{BeanStub as BX,_addGridCommonParams as VX,_getGrandTotalRow as HX,_getMaxConcurrentDatasourceRequests as UX}from"ag-grid-community";var zX=class extends qF{constructor(){super(...arguments),this.beanName="lazyBlockLoadingSvc",this.outboundRequests=0,this.cacheLoadingNodesMap=new Map,this.isCheckQueued=!1,this.nextBlockToLoad=void 0}wireBeans(e){this.rowRenderer=e.rowRenderer,this.rowModel=e.rowModel}postConstruct(){this.maxOutboundRequests=UX(this.gos)}subscribe(e){this.cacheLoadingNodesMap.set(e,new Set)}unsubscribe(e){this.cacheLoadingNodesMap.delete(e)}queueLoadCheck(){this.isCheckQueued||(this.isCheckQueued=!0,setTimeout(()=>{this.queueLoadAction(),this.isCheckQueued=!1}))}onLoadComplete(){this.outboundRequests-=1,this.queueLoadCheck()}hasAvailableLoadBandwidth(){return this.maxOutboundRequests===void 0?!0:this.outboundRequests<this.maxOutboundRequests}queueLoadAction(){const e=this.getBlockToLoad();if(!e)return;const t=this.nextBlockToLoad?.cache===e.cache&&this.nextBlockToLoad.index===e.index;if(!t&&(!this.nextBlockToLoad||!t)){this.nextBlockToLoad=e,window.clearTimeout(this.loaderTimeout);const s=Number(this.nextBlockToLoad.index),r=this.nextBlockToLoad.cache,i=e.index+e.cache.getBlockSize();this.loaderTimeout=window.setTimeout(()=>{r.isAlive()&&(this.loaderTimeout=void 0,this.attemptLoad(r,s,i),this.nextBlockToLoad=void 0)},this.gos.get("blockLoadDebounceMillis"))}}attemptLoad(e,t,s){this.hasAvailableLoadBandwidth()&&(this.executeLoad(e,t,s),this.queueLoadCheck())}executeLoad(e,t,s){const r=e.getSsrmParams(),i=e.store.getParentNode(),n={startRow:t,endRow:s,rowGroupCols:r.rowGroupCols,valueCols:r.valueCols,pivotCols:r.pivotCols,pivotMode:r.pivotMode,groupKeys:i.getRoute()??[],filterModel:r.filterModel,sortModel:r.sortModel},o=this.cacheLoadingNodesMap.get(e),a=()=>{for(let v=0;v<s-t;v++)o.delete(t+v)},l=()=>{for(let v=0;v<s-t;v++)o.add(t+v)};let c=!1;const u=v=>{if(c){this.warn(338);return}c=!0,this.onLoadComplete(),a(),v()},d=v=>u(()=>e.onLoadSuccess(t,s-t,v)),h=()=>u(()=>e.onLoadFailed(t,s-t)),p=i.level===-1,g=p?e.store:void 0,f=p&&g?.grandTotalData===void 0&&!!HX(this.gos),m=VX(this.gos,{request:n,success:d,fail:h,parentNode:i,needsGrandTotal:f});l(),this.outboundRequests+=1,e.getSsrmParams().datasource?.getRows(m)}getBlockToLoad(){const e=this.rowRenderer.firstRenderedRow,t=this.rowRenderer.lastRenderedRow;for(let a=e;a<=t;a++){const l=this.rowModel.getRow(a);if(!l)continue;const c=l.parent?.childStore;if(!c)continue;const u=c.getCache(),d=u.getNodes().getBy("node",l);if(!(!d||this.cacheLoadingNodesMap.get(u)?.has(d.index))&&(l.__needsRefreshWhenVisible||l.stub&&!l.failedLoad))return{cache:u,index:u.getBlockStartIndex(d.index)}}let s=null,r=null,i=Number.MAX_SAFE_INTEGER;for(const a of this.cacheLoadingNodesMap.keys())a.getNodesToRefresh().forEach(c=>{const u=a.getNodes().getBy("node",c);if(!u||this.cacheLoadingNodesMap.get(a)?.has(u.index))return;if(c.rowIndex==null){r=c,s=a;return}const h=Math.abs(e-c.rowIndex),p=Math.abs(c.rowIndex-t);h<i&&(r=c,i=h,s=a),p<i&&(r=c,i=p,s=a)});if(!s)return;const n=s,o=n.getNodes().getBy("node",r)?.index;return o==null?void 0:{cache:n,index:n.getBlockStartIndex(o)}}isRowLoading(e,t){return this.cacheLoadingNodesMap.get(e)?.has(t)??!1}};import{BeanStub as WX}from"ag-grid-community";import{BeanStub as KX,ServerSideTransactionResultStatus as iu,_getGrandTotalPinnedFloat as $X,_getGrandTotalRow as Db,_getGroupTotalRowCallback as jX,_getRowHeightAsNumber as Lb,_getRowIdCallback as YX}from"ag-grid-community";import{BeanStub as qX,GRAND_TOTAL_ROW_ID as bi,_getRowHeightAsNumber as ZX,_getRowHeightForNode as XX,_getRowIdCallback as JX}from"ag-grid-community";var QX=class{constructor(...e){this.indexes=e,this.maps=new Map(this.indexes.map(t=>[t,new Map]))}getSize(){return this.maps.get(this.indexes[0]).size}getBy(e,t){return this.maps.get(e).get(t)}set(e){for(const t of this.indexes)this.maps.get(t).set(e[t],e)}delete(e){for(const t of this.indexes)this.maps.get(t).delete(e[t])}clear(){this.maps.forEach(e=>e.clear())}getIterator(e){return this.maps.get(e).values()}forEach(e){const t=this.getIterator(this.indexes[0]);let s;for(;(s=t.next())&&!s.done;)e(s.value)}find(e){const t=this.getIterator(this.indexes[0]);let s;for(;(s=t.next())&&!s.done;)if(e(s.value))return s.value}some(e){const t=this.getIterator(this.indexes[0]);let s;for(;(s=t.next())&&!s.done;)if(e(s.value))return!0;return!1}filter(e){const t=this.getIterator(this.indexes[0]);let s;const r=[];for(;(s=t.next())&&!s.done;)e(s.value)&&r.push(s.value);return r}},eJ=100,nu=class extends ZF{constructor(e,t,s,r,i=!1){super(),this.live=!0,this.removedNodeCache=new Map,this.store=e,this.numberOfRows=t,this.isLastRowKnown=s,this.isLastRowInferred=i,this.storeParams=r}wireBeans(e){this.rowRenderer=e.rowRenderer,this.blockUtils=e.ssrmBlockUtils,this.focusSvc=e.focusSvc,this.nodeManager=e.ssrmNodeManager,this.serverSideRowModel=e.rowModel,this.rowNodeSorter=e.rowNodeSorter,this.sortSvc=e.sortSvc,this.lazyBlockLoadingSvc=e.lazyBlockLoadingSvc,this.colModel=e.colModel}postConstruct(){this.lazyBlockLoadingSvc.subscribe(this),this.nodeMap=new QX("index","id","node"),this.nodeDisplayIndexMap=new Map,this.nodesToRefresh=new Set;const{blockUtils:e,gos:t,store:s}=this;this.defaultNodeIdPrefix=e.createNodeIdPrefix(s.getParentNode()),this.getRowIdFunc=JX(this.beans),this.isMasterDetail=t.get("masterDetail")}destroy(){this.lazyBlockLoadingSvc.unsubscribe(this),this.numberOfRows=0,this.nodeMap.forEach(e=>this.blockUtils.destroyRowNode(e.node)),this.nodeMap.clear(),this.nodeDisplayIndexMap.clear(),this.nodesToRefresh.clear(),this.live=!1,super.destroy()}getRowByDisplayIndex(e){if(!this.store.isDisplayIndexInStore(e))return;const t=this.nodeDisplayIndexMap.get(e);if(t)return(t.stub||t.__needsRefreshWhenVisible)&&this.lazyBlockLoadingSvc.queueLoadCheck(),t;if(this.gos.get("groupHideOpenParents")||this.gos.get("groupAllowUnbalanced")){const l=this.nodeMap.find(c=>!!c.node.childStore?.isDisplayIndexInStore(e));if(l)return l.node.childStore?.getRowUsingDisplayIndex(e)}if(e===this.store.getDisplayIndexStart())return this.createStubNode(0,e);const r=this.nodeDisplayIndexMap.get(e-1);if(r){if(this.isMasterDetail&&r.master&&r.expanded)return r.detailNode;if(r.expanded&&r.childStore?.isDisplayIndexInStore(e))return r.childStore?.getRowUsingDisplayIndex(e);const l=this.nodeMap.getBy("node",r);return this.createStubNode(l.index+1,e)}const i=this.getSurroundingNodesByDisplayIndex(e);if(i==null){const l=this.store.getRowCount()-(this.store.getDisplayIndexEnd()-e);return this.createStubNode(l,e)}const{previousNode:n,nextNode:o}=i;if(n?.node.expanded&&n.node.childStore?.isDisplayIndexInStore(e))return n.node.childStore?.getRowUsingDisplayIndex(e);if(o){const l=o.node.rowIndex-e,c=o.index-l;return this.createStubNode(c,e)}const a=this.store.getRowCount()-(this.store.getDisplayIndexEnd()-e);return this.createStubNode(a,e)}createStubNode(e,t){const s=this.store.getRowBounds(t),r=this.createRowAtIndex(e,null,i=>{i.setRowIndex(t),i.setRowTop(s.rowTop),this.nodeDisplayIndexMap.set(t,i)});if(e===0&&this.gos.get("groupHideOpenParents")){const i=this.store.getParentNode().groupData;if(i)for(const n of Object.keys(i))Ag(r,this.colModel,n,i[n])}return this.lazyBlockLoadingSvc.queueLoadCheck(),r}getRowByStoreIndex(e){return this.nodeMap.getBy("index",e)?.node}skipDisplayIndexes(e,t,s){if(e===0)return;const r=ZX(this.beans);t.value+=e,s.value+=e*r}setDisplayIndexes(e,t,s){this.nodeDisplayIndexMap.clear();const r={};this.nodeMap.forEach(o=>{r[o.index]=o.node});let i=-1;for(const o of Object.keys(r)){const a=r[o],l=Number(o),c=l-1-i;this.skipDisplayIndexes(c,e,t);const u=l===0;if(a.firstChild!==u&&(a.firstChild=u,a.dispatchRowEvent("firstChildChanged")),u&&this.gos.get("groupHideOpenParents")){const d=this.store.getParentNode().groupData;if(d)for(const h of Object.keys(d))Ag(a,this.colModel,h,u?d[h]:void 0)}this.blockUtils.setDisplayIndex(a,e,t,s),a.rowIndex!=null&&this.nodeDisplayIndexMap.set(a.rowIndex,a),i=l}const n=this.numberOfRows-1-i;this.skipDisplayIndexes(n,e,t),this.purgeExcessRows()}getRowCount(){return this.numberOfRows}setRowCount(e,t){this.numberOfRows=e,this.isLastRowInferred=!1,t!=null&&(this.isLastRowKnown=t,t||(this.numberOfRows+=1)),this.fireStoreUpdatedEvent()}getNodes(){return this.nodeMap}getNodeCachedByDisplayIndex(e){return this.nodeDisplayIndexMap.get(e)??null}getNodesToRefresh(){return this.nodesToRefresh}getSurroundingNodesByDisplayIndex(e){let t,s;return this.nodeMap.forEach(r=>{if(e>r.node.rowIndex){(s==null||s.node.rowIndex<r.node.rowIndex)&&(s=r);return}(t==null||t.node.rowIndex>r.node.rowIndex)&&(t=r)}),!s&&!t?null:{previousNode:s,nextNode:t}}getDisplayIndexFromStoreIndex(e){const t=this.nodeMap.getBy("index",e);if(t)return t.node.rowIndex;let s,r;if(this.nodeMap.forEach(o=>{if(e>o.index){(r==null||r.index<o.index)&&(r=o);return}(s==null||s.index>o.index)&&(s=o)}),!s)return this.store.getDisplayIndexEnd()-(this.numberOfRows-e);if(!r)return this.store.getDisplayIndexStart()+e;const i=e-r.index;return(r.node.childStore?.getDisplayIndexEnd()??r.node.rowIndex)+i}createRowAtIndex(e,t,s){const r=this.nodeMap.getBy("index",e);if(r){const{node:n}=r;if(n.__needsRefreshWhenVisible=!1,this.doesNodeMatch(t,n))return this.blockUtils.updateDataIntoRowNode(n,t),this.nodesToRefresh.delete(n),n;if(this.getRowIdFunc==null&&n.hasChildren()&&n.expanded)return this.nodesToRefresh.delete(n),n;this.destroyRowAtIndex(e)}if(t&&this.getRowIdFunc!=null){const n=this.getRowId(t),o=n&&this.removedNodeCache?.get(n);if(o)return this.removedNodeCache?.delete(n),o.setRowTop(o.oldRowTop),this.blockUtils.updateDataIntoRowNode(o,t),this.nodeMap.set({id:o.id,node:o,index:e}),this.nodesToRefresh.delete(o),o.__needsRefreshWhenVisible=!1,o;const a=this.nodeMap.getBy("id",n);if(a){this.nodeMap.delete(a);const{node:l,index:c}=a;return this.blockUtils.updateDataIntoRowNode(l,t),this.nodeMap.set({id:l.id,node:l,index:e}),this.nodesToRefresh.delete(l),l.__needsRefreshWhenVisible=!1,this.getBlockStartIndex(c)===this.getBlockStartIndex(e)||this.markBlockForVerify(c),l}}const i=this.blockUtils.createRowNode(this.store.getRowDetails());if(t!=null){const n=this.getPrefixedId(this.store.getIdSequence().value++);this.blockUtils.setDataIntoRowNode(i,t,n,void 0),this.blockUtils.checkOpenByDefault(i),this.nodeManager.addRowNode(i)}return this.nodeMap.set({id:i.id,node:i,index:e}),s&&s(i),i}getBlockStates(){const e={},t={};this.nodeMap.forEach(({node:n,index:o})=>{const a=this.getBlockStartIndex(o);!n.stub&&!n.failedLoad&&(e[a]=(e[a]??0)+1);let l="loaded";n.failedLoad?l="failed":this.lazyBlockLoadingSvc.isRowLoading(this,a)?l="loading":(this.nodesToRefresh.has(n)||n.stub)&&(l="needsLoading"),t[a]||(t[a]=new Set),t[a].add(l)});const s={loading:4,failed:3,needsLoading:2,loaded:1},r=this.blockUtils.createNodeIdPrefix(this.store.getParentNode()),i={};for(const n of Object.keys(t)){const a=[...t[n]].sort((u,d)=>(s[d]??0)-(s[u]??0))[0],l=Number(n)/this.getBlockSize(),c=r?`${r}-${l}`:String(l);i[c]={blockNumber:l,startRow:Number(n),endRow:Number(n)+this.getBlockSize(),pageStatus:a,loadedRowCount:e[n]??0}}return i}destroyRowAtIndex(e){const t=this.nodeMap.getBy("index",e);t&&(this.nodeMap.delete(t),this.nodeDisplayIndexMap.delete(t.node.rowIndex),this.nodesToRefresh.size>0?(this.removedNodeCache.set(t.node.id,t.node),t.node.setRowTop(null)):this.blockUtils.destroyRowNode(t.node),this.nodesToRefresh.delete(t.node))}getSsrmParams(){return this.store.getSsrmParams()}getPrefixedId(e){return this.defaultNodeIdPrefix?this.defaultNodeIdPrefix+"-"+e:e.toString()}markBlockForVerify(e){const[t,s]=this.getBlockBounds(e);this.nodeMap.filter(i=>i.index>=t&&i.index<s).forEach(({node:i})=>{i.__needsRefreshWhenVisible=!0})}doesNodeMatch(e,t){if(t.stub)return!1;const s=this.getRowId(e);return s===null?t.data===e:t.id===s}purgeStubsOutsideOfViewport(){const{firstRenderedRow:e,lastRenderedRow:t}=this.rowRenderer,s=this.getBlockStartIndex(e),[,r]=this.getBlockBounds(t);this.nodeMap.forEach(i=>{this.lazyBlockLoadingSvc.isRowLoading(this,i.index)||i.node.failedLoad||i.node.stub&&(i.index<s||i.index>r)&&this.destroyRowAtIndex(i.index)})}getBlocksDistanceFromRow(e,t){const s={};return e.forEach(({node:r,index:i})=>{const[n,o]=this.getBlockBounds(i);if(n in s)return;const a=Math.abs(r.rowIndex-t);let l;const c=this.nodeMap.getBy("index",[o-1]);c&&(l=Math.abs(c.node.rowIndex-t));const u=l==null||a<l?a:l;s[n]=u}),Object.entries(s)}purgeExcessRows(){if(this.purgeStubsOutsideOfViewport(),this.store.getDisplayIndexEnd()==null||this.storeParams.maxBlocksInCache==null)return;const{firstRenderedRow:e,lastRenderedRow:t}=this.rowRenderer,s=new Set,r=new Set;this.nodeMap.forEach(({index:p,node:g})=>{const f=this.getBlockStartIndex(p);s.add(f),g.rowIndex>=e&&g.rowIndex<=t&&r.add(f)});const i=Math.max(r.size,this.storeParams.maxBlocksInCache??0),o=s.size-i;if(o<=0)return;let a=Number.MAX_SAFE_INTEGER,l=Number.MIN_SAFE_INTEGER;r.forEach(p=>{a>p&&(a=p),l<p&&(l=p)});const c=this.nodeMap.filter(({node:p,index:g})=>{const f=this.getBlockStartIndex(g);return!(f>=a&&f<=l)&&!this.isNodeCached(p)&&!this.lazyBlockLoadingSvc.isRowLoading(this,g)});if(c.length===0)return;const u=e+(t-e)/2,d=this.getBlocksDistanceFromRow(c,u),h=this.getBlockSize();d.sort((p,g)=>Math.sign(g[1]-p[1]));for(let p=0;p<Math.min(o,d.length);p++){const g=Number(d[p][0]);for(let f=g;f<g+h;f++){const m=this.nodeMap.getBy("index",f);!m||this.isNodeCached(m.node)||this.destroyRowAtIndex(f)}}}isNodeFocused(e){const t=this.focusSvc.getFocusCellToUseAfterRefresh();return!t||t.rowPinned!=null?!1:t.rowIndex===e.rowIndex}isNodeCached(e){const t=e.isExpandable()&&e.expanded,s=this.gos.get("groupAllowUnbalanced")&&e.key==="",r=!!this.beans.editSvc?.isRowEditing(e);return t||this.isNodeFocused(e)||s||r}extractDuplicateIds(e){if(this.getRowIdFunc==null)return[];const t=new Set,s=new Set;return e.forEach(r=>{const i=this.getRowId(r);if(t.has(i)){s.add(i);return}t.add(i)}),[...s]}onLoadSuccess(e,t,s){if(!this.live)return;const r=s.groupLevelInfo;this.store.setStoreInfo(r);const i=this.store.getParentNode().level===-1,n=i&&this.getRowIdFunc!=null?bi:null;if(this.getRowIdFunc!=null){const d=this.extractDuplicateIds(s.rowData);if(d.length>0){const h=d.join(", ");this.warn(205,{duplicateIdText:h}),this.onLoadFailed(e,t);return}}s.pivotResultFields&&this.serverSideRowModel.generateSecondaryColumns(s.pivotResultFields);const o=this.nodesToRefresh.size>0;let a=0,l;for(let d=0;d<s.rowData.length;d++){const h=s.rowData[d];if(n!=null&&this.getRowId(h)===n){l=h,a++;continue}const p=e+d-a,g=this.nodeMap.getBy("index",p);if(g?.node?.stub){this.createRowAtIndex(p,h);continue}if(g&&this.doesNodeMatch(h,g.node)){this.blockUtils.updateDataIntoRowNode(g.node,h),this.nodesToRefresh.delete(g.node),g.node.__needsRefreshWhenVisible=!1;continue}this.createRowAtIndex(p,h)}i&&(s.grandTotalData!==void 0&&(l=s.grandTotalData),l!==void 0&&this.setGrandTotalData(l));const c=s.rowData.length-a;if(s.rowCount!=null&&s.rowCount!==-1)this.numberOfRows=s.rowCount,this.isLastRowKnown=!0,this.isLastRowInferred=!1;else if(t>c)this.numberOfRows=e+c,this.isLastRowKnown=!0,this.isLastRowInferred=!0;else if(!this.isLastRowKnown){const d=e+c+1;d>this.numberOfRows&&(this.numberOfRows=d)}this.isLastRowKnown&&this.nodeMap.filter(h=>h.index>=this.numberOfRows).forEach(h=>this.destroyRowAtIndex(h.index)),this.gos.get("serverSideEnableClientSideSort")&&this.isStoreFullyLoaded()&&this.clientSideSortRows(),this.fireStoreUpdatedEvent();const u=this.nodesToRefresh.size===0;o&&u&&this.fireRefreshFinishedEvent()}fireRefreshFinishedEvent(){this.nodesToRefresh.size===0&&(this.removedNodeCache.forEach(t=>{this.blockUtils.destroyRowNode(t)}),this.removedNodeCache=new Map,this.store.fireRefreshFinishedEvent())}isStoreFullyLoaded(){const e=this.isLastRowKnown,t=this.nodeMap.getSize()===this.numberOfRows;if(!e||!t||this.nodesToRefresh.size>0)return!1;for(let s=0;s<this.numberOfRows;s++){const r=this.nodeMap.getBy("index",s);if(!r)return!1;const{node:i}=r;if(i.__needsRefreshWhenVisible||i.stub)return!1}return!0}isLastRowIndexKnown(){return this.isLastRowKnown}isLastRowIndexInferred(){return this.isLastRowInferred}onLoadFailed(e,t){if(!this.live)return;const s=this.nodesToRefresh.size>0;for(let i=e;i<e+t&&i<this.getRowCount();i++){let{node:n}=this.nodeMap.getBy("index",i)??{};n&&this.nodesToRefresh.delete(n),n?.stub||(n&&!n.stub&&this.destroyRowAtIndex(i),n=this.createRowAtIndex(i)),n.__needsRefreshWhenVisible=!1,n.failedLoad=!0}const r=this.nodesToRefresh.size===0;s&&r&&this.fireRefreshFinishedEvent(),this.fireStoreUpdatedEvent()}markNodesForRefresh(){this.nodeMap.forEach(e=>{e.node.stub&&!e.node.failedLoad||this.nodesToRefresh.add(e.node)}),this.lazyBlockLoadingSvc.queueLoadCheck(),this.isLastRowKnown&&this.numberOfRows===0?(this.numberOfRows=1,this.isLastRowKnown=!1,this.fireStoreUpdatedEvent()):this.isLastRowKnown&&this.isLastRowInferred&&(this.isLastRowKnown=!1)}isNodeInCache(e){return!!this.nodeMap.getBy("id",e)}fireStoreUpdatedEvent(){this.live&&this.store.fireStoreUpdatedEvent()}getRowId(e){if(this.getRowIdFunc==null)return null;const{level:t}=this.store.getRowDetails(),s=this.store.getParentNode().getRoute()??[];return this.getRowIdFunc({data:e,parentKeys:s.length>0?s:void 0,level:t})}setGrandTotalData(e){const t=this.store;if(t.grandTotalData=e,!(e==null||!t.getGrandTotalNode()))return this.createOrUpdateGrandTotalNode(e)}createOrUpdateGrandTotalNode(e){const t=this.store.getGrandTotalNode();if(t)return t._updateDataNoSibling(e),t;const s=this.store.getParentNode(),r=Lt(s,this.beans,bi);r.group=!1,r.stub=!1,r.data=e;const i=XX(this.beans,r);return r.setRowHeight(i.height,i.estimated),this.nodeManager.addRowNode(r),r}getOrderedNodeMap(){const e={};return this.nodeMap.forEach(t=>e[t.index]=t),e}clearDisplayIndexes(){this.nodeDisplayIndexMap.clear()}clientSideSortRows(){const e=this.sortSvc?.getSortOptions()??[],t=e.some(o=>o.sort!=null),s=this.rowNodeSorter;if(!t||!s)return;const r=new Array(this.nodeMap.getSize()),i=this.nodeMap;i.forEach(o=>r[o.index]=o.node),i.clear();const n=s.doFullSortInPlace(r,e);for(let o=0,a=n.length;o<a;++o){const l=n[o];i.set({id:l.id,node:l,index:o})}}updateRowNodes(e){const t=[],{blockUtils:s,nodeMap:r}=this;for(const i of e){const n=this.getRowId(i);if(n===bi){const a=this.setGrandTotalData(i);a&&t.push(a);continue}const o=r.getBy("id",n);o&&(s.updateDataIntoRowNode(o.node,i),t.push(o.node))}return t}insertRowNodes(e,t){const s=this.numberOfRows,r=t==null&&this.isLastRowKnown?s:t;if(r==null||s<r)return[];const i={};e.forEach(l=>{const c=this.getRowId(l);if(c===bi){this.setGrandTotalData(l);return}c&&this.isNodeInCache(c)||(i[c]=l)});const n=Object.values(i),o=n.length;if(o===0)return[];const a=this.nodeMap.filter(l=>l.index>=r);return a.forEach(l=>this.nodeMap.delete(l)),a.forEach(l=>{this.nodeMap.set({node:l.node,index:l.index+o,id:l.id})}),this.numberOfRows+=o,n.map((l,c)=>this.createRowAtIndex(r+c,l))}removeRowNodes(e,t){const s=[],r=[],i=new Set(e);i.delete(bi)&&this.setGrandTotalData(null);let n=0;const o=this.getOrderedNodeMap();let a=-1;for(const c of Object.keys(o)){a+=1;const u=o[c];if(i.has(u.id)){i.delete(u.id),this.destroyRowAtIndex(Number(c)),s.push(u.node),n+=1;continue}if(n===0)continue;const d=Number(c);a!==d&&r.push(u.node),this.nodeMap.delete(u),this.nodeMap.set({id:u.id,node:u.node,index:d-n})}return t!=null&&t>=0?(this.numberOfRows=t,this.isLastRowKnown=!0,this.isLastRowInferred=!1):this.numberOfRows-=n,i.size>0&&r.length>0&&(r.forEach(c=>c.__needsRefreshWhenVisible=!0),this.lazyBlockLoadingSvc.queueLoadCheck()),s}getBlockSize(){return this.storeParams.cacheBlockSize||eJ}getBlockStartIndex(e){const t=this.getBlockSize();return e-e%t}getBlockBounds(e){const t=this.getBlockStartIndex(e),s=this.getBlockSize();return[t,t+s]}},tJ=class extends XF{constructor(e,t,s){super(),this.idSequence={value:0},this.grandTotalPinned=!1,this.ssrmParams=e,this.parentRowNode=s,this.storeParams=t,this.level=s.level+1,this.group=e.rowGroupCols?this.level<e.rowGroupCols.length:!1,this.leafGroup=e.rowGroupCols?this.level===e.rowGroupCols.length-1:!1,this.info={}}wireBeans(e){this.blockUtils=e.ssrmBlockUtils,this.storeUtils=e.ssrmStoreUtils,this.selectionSvc=e.selectionSvc,this.rowGroupColsSvc=e.rowGroupColsSvc}postConstruct(){let e=1;if(this.level===0&&(e=this.storeUtils.getServerSideInitialRowCount()??1,this.beans.rowModel.onRootStoreCreated()),this.cache=this.createManagedBean(new nu(this,e,!1,this.storeParams)),!this.gos.get("treeData")&&this.group&&this.rowGroupColsSvc){const s=this.ssrmParams.rowGroupCols[this.level];this.groupField=s.field,this.rowGroupColumn=this.rowGroupColsSvc.columns[this.level]}}destroy(){this.displayIndexStart=void 0,this.displayIndexEnd=void 0,this.grandTotalData=void 0,this.destroyGrandTotalRow(),this.destroyBean(this.cache),super.destroy()}getGrandTotalNode(){if(this.parentRowNode.level===-1){const e=this.parentRowNode.sibling;if(e?.footer)return e}}destroyGrandTotalRow(){const e=this.getGrandTotalNode();e&&(this.parentRowNode.sibling=void 0,this.blockUtils.destroyRowNode(e))}applyRowData(e,t,s){this.cache.onLoadSuccess(t,s,e)}applyTransaction(e){const t=YX(this.beans);if(!t)return this.warn(206),{status:iu.Cancelled};const s=this.gos.getCallback("isApplyServerSideTransaction");if(s){const u={transaction:e,parentNode:this.parentRowNode,groupLevelInfo:this.info};if(!s(u))return{status:iu.Cancelled}}const r=this.cache.isStoreFullyLoaded();let i;e.update?.length&&(i=this.cache.updateRowNodes(e.update));let n;if(e.add?.length){let u=e.addIndex;u!=null&&u<0&&(u=void 0),n=this.cache.insertRowNodes(e.add,u)}let o;if(e.remove?.length){const u=e.remove.map(h=>t({level:this.level,parentKeys:this.parentRowNode.getRoute()??[],data:h})),d=[...new Set(u)];o=this.cache.removeRowNodes(d,e.rowCount)}const a=this.gos.get("serverSideEnableClientSideSort"),l=i?.length||n?.length;return r&&a&&l&&this.cache.clientSideSortRows(),this.updateSelectionAfterTransaction(i,o),{status:iu.Applied,update:i,add:n,remove:o}}updateSelectionAfterTransaction(e,t){if(!this.selectionSvc)return;const s=[];for(const r of e??[])r.isSelected()&&!r.selectable&&s.push(r);for(const r of t??[])r.isSelected()&&s.push(r);s.length&&this.selectionSvc.setNodesSelected({newValue:!1,clearSelection:!1,nodes:s,source:"rowDataChanged"})}clearDisplayIndexes(){this.displayIndexStart=void 0,this.displayIndexEnd=void 0,this.cache.getNodes().forEach(e=>this.blockUtils.clearDisplayIndex(e.node)),this.parentRowNode.sibling&&this.blockUtils.clearDisplayIndex(this.parentRowNode.sibling),this.cache.clearDisplayIndexes()}getDisplayIndexStart(){return this.displayIndexStart}getDisplayIndexEnd(){return this.displayIndexEnd}getRowCount(){const e=this.cache.getRowCount();return this.parentRowNode.sibling&&!this.grandTotalPinned?e+1:e}getChildRowCount(){return this.cache.getRowCount()}setRowCount(e,t){this.cache.setRowCount(e,t)}isDisplayIndexInStore(e){return this.getRowCount()===0?!1:this.displayIndexStart<=e&&e<this.getDisplayIndexEnd()}areRowsLoadedEmpty(){return this.cache.isLastRowIndexKnown()&&this.cache.getRowCount()===0}getGroupTotalRowPosition(){if(!(this.parentRowNode.level===-1||this.areRowsLoadedEmpty()))return jX(this.gos)({node:this.parentRowNode})||void 0}setDisplayIndexes(e,t,s){this.displayIndexStart=e.value,this.topPx=t.value;const r=this.getGroupTotalRowPosition();!r&&this.parentRowNode.level>-1&&to(this.parentRowNode),r==="top"&&this.blockUtils.setDisplayIndex(Lt(this.parentRowNode,this.beans),e,t,s);let i,n;if(this.parentRowNode.level===-1){const o=Db(this.gos);let a=this.getGrandTotalNode();o&&this.grandTotalData&&(!this.areRowsLoadedEmpty()||this.gos.get("alwaysShowGrandTotalRow"))?a??(a=this.cache.createOrUpdateGrandTotalNode(this.grandTotalData)):a&&(this.destroyGrandTotalRow(),a=void 0),this.beans.pinnedRowModel?.setGrandTotalNode(a);const l=!!$X(o);this.grandTotalPinned=l,a&&(l?this.blockUtils.clearDisplayIndex(a):o==="top"?i=a:o==="bottom"&&(n=a))}i&&this.blockUtils.setDisplayIndex(i,e,t,s),this.cache.setDisplayIndexes(e,t,s),r==="bottom"&&this.blockUtils.setDisplayIndex(Lt(this.parentRowNode,this.beans),e,t,s),n&&this.blockUtils.setDisplayIndex(n,e,t,s),this.displayIndexEnd=e.value,this.heightPx=t.value-this.topPx}forEachStoreDeep(e,t={value:0}){e(this,t.value++),this.cache.getNodes().forEach(s=>{const r=s.node.childStore;r&&r.forEachStoreDeep(e,t)})}forEachNodeDeep(e,t={value:0}){this.cache.getNodes().forEach(s=>{e(s.node,t.value++);const r=s.node.childStore;r&&r.forEachNodeDeep(e,t)})}hasExpandableMasterRows(){return this.cache.getNodes().some(({node:e})=>e.master&&e.isExpandable()||!!e.childStore?.hasExpandableMasterRows())}forEachNodeDeepAfterFilterAndSort(e,t={value:0},s=!1){const r=this.getGroupTotalRowPosition(),i=this.parentRowNode.sibling;r==="top"&&i&&e(i,t.value++);const n=this.parentRowNode.level===-1?Db(this.gos):void 0,o=this.getGrandTotalNode();n==="top"&&o&&e(o,t.value++);const a=this.cache.getOrderedNodeMap();for(const l of Object.values(a)){e(l.node,t.value++);const c=l.node.childStore;c&&c.forEachNodeDeepAfterFilterAndSort(e,t,s)}r==="bottom"&&i&&e(i,t.value++),n==="bottom"&&o&&e(o,t.value++)}retryLoads(){this.cache.getNodes().forEach(({node:e})=>{e.failedLoad&&(e.failedLoad=!1,e.__needsRefreshWhenVisible=!0,e.stub=!0)}),this.forEachChildStoreShallow(e=>e.retryLoads())}getRowUsingDisplayIndex(e){return e===this.parentRowNode.sibling?.rowIndex?this.parentRowNode.sibling:this.cache.getRowByDisplayIndex(e)}getRowBounds(e){if(!this.isDisplayIndexInStore(e))return null;const t=this.cache.getNodeCachedByDisplayIndex(e);if(t){const a=this.blockUtils.extractRowBounds(t,e);if(a)return a}const{previousNode:s,nextNode:r}=this.cache.getSurroundingNodesByDisplayIndex(e)??{};if(s){const a=this.blockUtils.extractRowBounds(s.node,e);if(a!=null)return a}const i=Lb(this.beans);if(r){const a=(r.node.rowIndex-e)*i;return{rowTop:r.node.rowTop-a,rowHeight:i}}const n=this.topPx+this.heightPx,o=(this.getDisplayIndexEnd()-e)*i;return{rowTop:n-o,rowHeight:i}}isPixelInRange(e){return e>=this.topPx&&e<this.topPx+this.heightPx}getRowIndexAtPixel(e){if(e<this.topPx)return this.getDisplayIndexStart();if(e>=this.topPx+this.heightPx)return this.getDisplayIndexEnd()-1;if(this.parentRowNode.sibling&&e>this.parentRowNode.sibling.rowTop&&e<this.parentRowNode.sibling.rowTop+this.parentRowNode.sibling.rowHeight)return this.parentRowNode.sibling.rowIndex;let t=Number.MAX_SAFE_INTEGER,s=null,r=Number.MAX_SAFE_INTEGER,i=null;if(this.cache.getNodes().forEach(({node:l})=>{const c=Math.abs(e-l.rowTop);if(l.rowTop<e){c<t&&(t=c,s=l);return}c<r&&(r=c,i=l)}),s=s,i=i,s){const l=this.blockUtils.getIndexAtPixel(s,e);if(l!=null)return l}const n=Lb(this.beans);if(i){const l=i.rowTop,c=Math.ceil((l-e)/n);return i.rowIndex-c}const o=this.topPx+this.heightPx,a=Math.floor((o-e)/n);return this.getDisplayIndexEnd()-a}getChildStore(e){return this.storeUtils.getChildStore(e,this,t=>{const s=this.cache.getNodes().find(r=>r.node.key==t);return s?s.node:null})}forEachChildStoreShallow(e){this.cache.getNodes().forEach(({node:t})=>{t.childStore&&e(t.childStore)})}refreshAfterSort(e){if(this.storeUtils.isServerSideSortAllLevels()||this.storeUtils.isServerRefreshNeeded(this.parentRowNode,this.ssrmParams.rowGroupCols,e)){const s=this.cache.isStoreFullyLoaded(),r=this.gos.get("serverSideEnableClientSideSort");if(!(s&&r)){const n=this.cache.getRowCount(),o=this.cache.isLastRowIndexKnown(),a=this.cache.isLastRowIndexInferred();this.destroyBean(this.cache),this.cache=this.createManagedBean(new nu(this,n,o,this.storeParams,a));return}this.cache.clientSideSortRows()}this.forEachChildStoreShallow(s=>s.refreshAfterSort(e))}refreshAfterFilter(e){if(!this.storeUtils.isServerSideOnlyRefreshFilteredGroups()||this.storeUtils.isServerRefreshNeeded(this.parentRowNode,this.ssrmParams.rowGroupCols,e)){this.refreshStore(!0);return}this.forEachChildStoreShallow(s=>s.refreshAfterFilter(e))}refreshStore(e){if(e){this.grandTotalData=void 0,this.destroyGrandTotalRow(),this.destroyBean(this.cache),this.cache=this.createManagedBean(new nu(this,1,!1,this.storeParams)),this.fireStoreUpdatedEvent();return}this.cache.markNodesForRefresh()}getTopLevelRowDisplayedIndex(e){return this.cache.getDisplayIndexFromStoreIndex(e)??e}isLastRowIndexKnown(){return this.cache.isLastRowIndexKnown()}getRowNodesInRange(e,t){return this.cache.getNodes().filter(({node:s})=>s.rowIndex>=e.rowIndex&&s.rowIndex<=t.rowIndex).map(({node:s})=>s)}addStoreStates(e){e.push({route:this.parentRowNode.getRoute()??[],rowCount:this.getRowCount(),lastRowIndexKnown:this.isLastRowIndexKnown(),info:this.info,maxBlocksInCache:this.storeParams.maxBlocksInCache,cacheBlockSize:this.storeParams.cacheBlockSize}),this.forEachChildStoreShallow(t=>t.addStoreStates(e))}getIdSequence(){return this.idSequence}getParentNode(){return this.parentRowNode}getRowDetails(){return{field:this.groupField,group:this.group,leafGroup:this.leafGroup,level:this.level,parent:this.parentRowNode,rowGroupColumn:this.rowGroupColumn}}getSsrmParams(){return this.ssrmParams}setStoreInfo(e){e&&Object.assign(this.info,e)}fireStoreUpdatedEvent(){this.eventSvc.dispatchEvent({type:"storeUpdated"})}fireRefreshFinishedEvent(){this.eventSvc.dispatchEvent({type:"storeRefreshed",route:this.parentRowNode.getRoute()})}getBlockStates(){return this.cache.getBlockStates()}getStoreBounds(){return{topPx:this.topPx,heightPx:this.heightPx}}getCache(){return this.cache}getFirstNode(){return this.cache.getNodes().getBy("index",0)?.node??null}},sJ=class extends JF{constructor(){super(...arguments),this.beanName="ssrmStoreFactory"}wireBeans(e){this.colModel=e.colModel,this.rowGroupColsSvc=e.rowGroupColsSvc,this.pivotColsSvc=e.pivotColsSvc,this.rowAutoHeight=e.rowAutoHeight}createStore(e,t){const s=this.getStoreParams(e,t);return new tJ(e,s,t)}getStoreParams(e,t){const s=this.getLevelSpecificParams(t),r=this.getBlockSize(s),i=this.getMaxBlocksInCache(e,s);return{cacheBlockSize:r,maxBlocksInCache:i}}getMaxBlocksInCache(e,t){const s=t?.maxBlocksInCache??this.gos.get("maxBlocksInCache");if(s!=null&&s>=0){if(e.dynamicRowHeight){this.warn(203);return}if(this.rowAutoHeight&&rJ(this.colModel.colsList)){this.warn(204);return}return s}}getBlockSize(e){const t=e?.cacheBlockSize??this.gos.get("cacheBlockSize");return t!=null&&t>0?t:100}getLevelSpecificParams(e){const t=this.gos.getCallback("getServerSideGroupLevelParams");if(!t)return;const s={level:e.level+1,parentRowNode:e.level>=0?e:void 0,rowGroupColumns:this.rowGroupColsSvc?.columns??[],pivotColumns:this.pivotColsSvc?.columns??[],pivotMode:this.colModel.pivotMode};return t(s)}},rJ=e=>{for(let t=0,s=e.length;t<s;++t){const r=e[t];if(r.colDef.autoHeight&&r.visible)return!0}return!1};import{BeanStub as iJ,_isServerSideRowModel as kb}from"ag-grid-community";var nJ=class extends QF{constructor(){super(...arguments),this.beanName="ssrmStoreUtils"}wireBeans(e){this.colModel=e.colModel,this.serverSideRowModel=e.rowModel,this.storeFactory=e.ssrmStoreFactory}getChildStore(e,t,s){if(!e?.length)return t;const r=e[0],i=s(r);if(i){if(e.length===1&&!i.childStore){const a=this.serverSideRowModel.getParams();i.childStore=this.createBean(this.storeFactory.createStore(a,i))}const n=e.slice(1,e.length),o=i.childStore;return o?o.getChildStore(n):null}return null}isServerRefreshNeeded(e,t,s){if(s.valueColChanged||s.secondaryColChanged)return!0;const r=e.level+1;if(!(r<t.length))return!0;const o=t[r].id;return s.changedColumns.indexOf(o)>-1?!0:this.colModel.getCols().filter(u=>u.showRowGroup&&s.changedColumns.includes(u.getId())).map(u=>u.showRowGroup).some(u=>u===!0||u===o)}getServerSideInitialRowCount(){return this.gos.get("serverSideInitialRowCount")}isServerSideSortAllLevels(){return this.gos.get("serverSideSortAllLevels")&&kb(this.gos)}isServerSideOnlyRefreshFilteredGroups(){return this.gos.get("serverSideOnlyRefreshFilteredGroups")&&kb(this.gos)}};import{BeanStub as oJ,ServerSideTransactionResultStatus as sr}from"ag-grid-community";var aJ=class extends eT{constructor(){super(...arguments),this.beanName="ssrmTxnManager",this.asyncTransactions=[]}wireBeans(e){this.valueCache=e.valueCache,this.serverSideRowModel=e.rowModel,this.selectionSvc=e.selectionSvc}applyTransactionAsync(e,t){this.asyncTransactionsTimeout==null&&this.scheduleExecuteAsync(),this.asyncTransactions.push({transaction:e,callback:t})}scheduleExecuteAsync(){const e=this.gos.get("asyncTransactionWaitMillis");this.asyncTransactionsTimeout=window.setTimeout(()=>{this.executeAsyncTransactions()},e)}executeAsyncTransactions(){if(!this.asyncTransactions)return;const e=[],t=[],s=[];let r=!1;for(const i of this.asyncTransactions){let n;if(this.serverSideRowModel.executeOnStore(i.transaction.route,l=>{n=l.applyTransaction(i.transaction)})?n??(n={status:sr.StoreNotFound}):n={status:sr.StoreNotStarted},t.push(n),n.status==sr.StoreLoading){s.push(i);continue}i.callback&&e.push(()=>i.callback(n)),n.status===sr.Applied&&(r=!0)}e.length>0&&window.setTimeout(()=>{for(const i of e)i()},0),this.asyncTransactionsTimeout=void 0,this.asyncTransactions=s,r&&(this.valueCache?.onDataChanged(),this.eventSvc.dispatchEvent({type:"storeUpdated"})),t.length>0&&this.eventSvc.dispatchEvent({type:"asyncTransactionsFlushed",results:t})}flushAsyncTransactions(){this.asyncTransactionsTimeout!=null&&clearTimeout(this.asyncTransactionsTimeout),this.executeAsyncTransactions()}applyTransaction(e){let t;if(this.serverSideRowModel.executeOnStore(e.route,r=>{t=r.applyTransaction(e)}))if(t){if(this.valueCache?.onDataChanged(),t.remove&&this.selectionSvc){const r=t.remove.map(i=>i.id);this.selectionSvc.deleteSelectionStateFromParent(e.route??[],r)}return this.eventSvc.dispatchEvent({type:"storeUpdated"}),t}else return{status:sr.StoreNotFound};else return{status:sr.StoreNotStarted}}},_b={moduleName:"ServerSideRowModel",version:_,rowModels:["serverSide"],beans:[pX,zZ,nJ,VZ,tX,aJ,jZ,sJ,qZ,GX,zX,NX,RX,QZ],dependsOn:[$,Nq,Oq,Cb,yb,$q]},Gb={moduleName:"ServerSideRowModelApi",version:_,apiFunctions:{getServerSideSelectionState:gX,setServerSideSelectionState:fX,applyServerSideTransaction:mX,applyServerSideTransactionAsync:CX,applyServerSideRowData:vX,retryServerSideLoads:bX,flushServerSideAsyncTransactions:SX,refreshServerSide:yX,getServerSideGroupLevelState:wX,resetRowHeights:Hq,onRowHeightChanged:Vq},dependsOn:[$,Gq,_q,Bq]};import{RefPlaceholder as lJ}from"ag-stack";import{AgAbstractCellEditor as cJ,KeyCode as ou}from"ag-grid-community";import{_getActiveDomElement as uJ,_getDocument as xo}from"ag-stack";import{AgAbstractInputField as dJ,_createElement as hJ}from"ag-grid-community";var Ob=/\$?(?<![A-Za-z])[A-Za-z]+\$?[0-9]+(?::\$?[A-Za-z]+\$?[0-9]+)?/g,pJ=/^(\$?)([A-Za-z]+)(\$?)([0-9]+)(?::(\$?)([A-Za-z]+)(\$?)([0-9]+))?$/,gJ=/[A-Za-z0-9]/,Si=e=>!!e&&gJ.test(e),Fo=e=>!!e&&/[A-Za-z]/.test(e),fJ=e=>{if(!Fo(e[0]))return!1;for(let t=1,s=e.length;t<s;++t)if(!Si(e[t]))return!1;return!0},mJ=e=>{const t=e.toUpperCase();let s=0;for(let r=0,i=t.length;r<i;++r){const n=t.charCodeAt(r)-64;if(n<1||n>26)return-1;s=s*26+n}return s-1},Nb=e=>Si(e??void 0),Bb=(e,t,s)=>{const r=t>0?e[t-1]:null;if(Nb(r))return!1;if(s.endsWith(":"))return!0;const i=t+s.length,n=i<e.length?e[i]:null;return!Nb(n)},au=(e,t={})=>{const r=(t.allowTrailingColon??!1)&&e.endsWith(":")?e.slice(0,-1):e,i=pJ.exec(r);if(!i)return null;const[,n,o,a,l,c,u,d,h]=i;return{startCol:o,startRow:l,startColAbsolute:n==="$",startRowAbsolute:a==="$",...!!(u&&h)?{endCol:u,endRow:h,endColAbsolute:c==="$",endRowAbsolute:d==="$"}:null}},Vb=e=>{const t=[];let s,r=0;for(Ob.lastIndex=0;(s=Ob.exec(e))!=null;){let i=s[0];const n=s.index??0,o=n+i.length;o<e.length&&e[o]===":"&&(i+=":"),Bb(e,n,i)&&(t.push({ref:i,start:n,end:n+i.length,index:r}),r+=1)}return t},vJ=".ag-formula-input-field-input{background-color:var(--ag-input-background-color);border:var(--ag-input-border);border-radius:var(--ag-input-border-radius);color:var(--ag-input-text-color);overflow:auto;padding:0 var(--ag-input-padding-start);resize:none;scrollbar-width:none;white-space:pre}.ag-formula-input-field-input:where(:focus){background-color:var(--ag-input-focus-background-color);border:var(--ag-input-focus-border);box-shadow:var(--ag-input-focus-shadow);color:var(--ag-input-focus-text-color)}.ag-formula-input-field-input:where(:disabled){background-color:var(--ag-input-disabled-background-color);border:var(--ag-input-disabled-border);color:var(--ag-input-disabled-text-color)}.ag-formula-input-field-input:where(.invalid){background-color:var(--ag-input-invalid-background-color);border:var(--ag-input-invalid-border);color:var(--ag-input-invalid-text-color)}.ag-cell-inline-editing .ag-formula-input-field-input{line-height:var(--ag-internal-content-line-height)}.ag-formula-operator{position:relative;-webkit-text-fill-color:transparent}:where(.ag-formula-operator):after{content:attr(data-symbol);position:absolute;-webkit-text-fill-color:currentcolor}:where(.ag-ltr) :where(.ag-formula-operator):after{left:50%;transform:translateX(-50%)}:where(.ag-rtl) :where(.ag-formula-operator):after{right:50%;transform:translateX(50%)}.ag-formula-token-color-1{color:var(--ag-formula-token-1-color)}.ag-formula-token-color-2{color:var(--ag-formula-token-2-color)}.ag-formula-token-color-3{color:var(--ag-formula-token-3-color)}.ag-formula-token-color-4{color:var(--ag-formula-token-4-color)}.ag-formula-token-color-5{color:var(--ag-formula-token-5-color)}.ag-formula-token-color-6{color:var(--ag-formula-token-6-color)}.ag-formula-token-color-7{color:var(--ag-formula-token-7-color)}.ag-formula-range-color-1{--ag-range-selection-border-color:var(--ag-formula-token-1-color);--ag-range-selection-background-color:var(--ag-formula-token-1-background-color)}.ag-formula-range-color-2{--ag-range-selection-border-color:var(--ag-formula-token-2-color);--ag-range-selection-background-color:var(--ag-formula-token-2-background-color)}.ag-formula-range-color-3{--ag-range-selection-border-color:var(--ag-formula-token-3-color);--ag-range-selection-background-color:var(--ag-formula-token-3-background-color)}.ag-formula-range-color-4{--ag-range-selection-border-color:var(--ag-formula-token-4-color);--ag-range-selection-background-color:var(--ag-formula-token-4-background-color)}.ag-formula-range-color-5{--ag-range-selection-border-color:var(--ag-formula-token-5-color);--ag-range-selection-background-color:var(--ag-formula-token-5-background-color)}.ag-formula-range-color-6{--ag-range-selection-border-color:var(--ag-formula-token-6-color);--ag-range-selection-background-color:var(--ag-formula-token-6-background-color)}.ag-formula-range-color-7{--ag-range-selection-border-color:var(--ag-formula-token-7-color);--ag-range-selection-background-color:var(--ag-formula-token-7-background-color)}.ag-fill-handle.ag-formula-range-color-1,.ag-range-handle.ag-formula-range-color-1{background-color:var(--ag-formula-token-1-color)}.ag-fill-handle.ag-formula-range-color-2,.ag-range-handle.ag-formula-range-color-2{background-color:var(--ag-formula-token-2-color)}.ag-fill-handle.ag-formula-range-color-3,.ag-range-handle.ag-formula-range-color-3{background-color:var(--ag-formula-token-3-color)}.ag-fill-handle.ag-formula-range-color-4,.ag-range-handle.ag-formula-range-color-4{background-color:var(--ag-formula-token-4-color)}.ag-fill-handle.ag-formula-range-color-5,.ag-range-handle.ag-formula-range-color-5{background-color:var(--ag-formula-token-5-color)}.ag-fill-handle.ag-formula-range-color-6,.ag-range-handle.ag-formula-range-color-6{background-color:var(--ag-formula-token-6-color)}";import{RefPlaceholder as CJ,_getWindow as bJ,_observeResize as SJ,_requestAnimationFrame as yJ}from"ag-stack";import{Component as wJ}from"ag-grid-community";var xJ='.ag-text-area-mirror-wrapper{position:relative}.ag-text-area-mirror-input{-webkit-text-fill-color:transparent;caret-color:currentcolor}:where(.ag-text-area-mirror-input)::-moz-placeholder{-webkit-text-fill-color:currentcolor}:where(.ag-text-area-mirror-input)::placeholder{-webkit-text-fill-color:currentcolor}:where(.ag-text-area-mirror-input)::-moz-selection{background-color:var(--ag-range-selection-background-color)}:where(.ag-text-area-mirror-input)::selection{background-color:var(--ag-range-selection-background-color)}.ag-text-area-mirror{overflow:hidden;pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:1}.ag-text-area-mirror-text{box-sizing:border-box;margin:0;min-height:100%;width:100%}:where(.ag-text-area-mirror-text):after{content:"\\200b"}:where(.ag-text-area-mirror-composing) .ag-text-area-mirror-input{-webkit-text-fill-color:currentcolor}:where(.ag-text-area-mirror-composing) .ag-text-area-mirror{visibility:hidden}@media (forced-colors:active){.ag-text-area-mirror-input{-webkit-text-fill-color:currentcolor}:where(.ag-text-area-mirror){display:none}}',FJ=["font-family","font-size","font-weight","font-style","font-variant","font-stretch","font-kerning","font-feature-settings","font-variation-settings","line-height","letter-spacing","word-spacing","tab-size","text-align","text-indent","text-transform","direction","white-space","overflow-wrap","word-break","padding-top","padding-right","padding-bottom","padding-left"],Hb=class extends tT{constructor(e){super({tag:"div",cls:"ag-text-area-mirror",attrs:{"aria-hidden":"true"},children:[{tag:"div",ref:"eText",cls:"ag-text-area-mirror-text"}]}),this.field=e,this.eText=CJ,this.layoutPending=!1,this.registerCSS(xJ)}postConstruct(){const e=this.field.getInputElement(),t=this.field.getWrapperElement();t.classList.add("ag-text-area-mirror-wrapper"),e.classList.add("ag-text-area-mirror-input"),t.appendChild(this.getGui()),this.addManagedElementListeners(e,{scroll:()=>this.syncScroll(),focus:()=>this.scheduleLayout(),blur:()=>this.scheduleLayout(),compositionstart:()=>t.classList.add("ag-text-area-mirror-composing"),compositionend:()=>t.classList.remove("ag-text-area-mirror-composing")}),this.addManagedEventListeners({stylesChanged:()=>this.scheduleLayout()}),this.addDestroyFunc(SJ(this.beans,e,()=>this.refreshLayout())),this.addDestroyFunc(()=>{e.classList.remove("ag-text-area-mirror-input"),t.classList.remove("ag-text-area-mirror-wrapper","ag-text-area-mirror-composing"),this.getGui().remove()}),this.scheduleLayout()}setContent(e){this.eText.replaceChildren(e),this.scheduleLayout()}scheduleLayout(){this.layoutPending||(this.layoutPending=!0,yJ(this.beans,()=>{this.layoutPending=!1,this.isAlive()&&this.refreshLayout()}))}refreshLayout(){const e=this.field.getInputElement(),t=bJ(this.beans).getComputedStyle(e),s=this.getGui();for(const r of FJ)this.eText.style.setProperty(r,t.getPropertyValue(r));this.eText.style.color=t.color,s.style.left=`${e.offsetLeft+e.clientLeft}px`,s.style.top=`${e.offsetTop+e.clientTop}px`,s.style.width=`${e.clientWidth}px`,s.style.height=`${e.clientHeight}px`,this.syncScroll()}syncScroll(){const e=this.field.getInputElement(),t=this.getGui();t.scrollTop=e.scrollTop,t.scrollLeft=e.scrollLeft}};import{_getActiveDomElement as TJ}from"ag-stack";import{BeanStub as AJ,KeyCode as kt}from"ag-grid-community";var Ub=new Set(["=","+","-","*","/","^",",","(",";","<",">","&"]),zb=(e,t)=>{for(let s=t-1;s>=0;s--){const r=e[s];if(r!=null&&r.trim()!=="")return r}return null};import{_getRowNode as Wb,isSpecialCol as PJ}from"ag-grid-community";var RJ="ag-formula-token-color",MJ="ag-formula-range-color",lu=(e,t)=>{const s=t??0;return{tokenClass:`${RJ}-${s+1}`,rangeClass:`${MJ}-${s+1}`,colorIndex:s}},cu=e=>{if(!e)return null;const t=/ag-formula-range-color-(\d+)/.exec(e);if(!t)return null;const s=Number.parseInt(t[1],10);return Number.isFinite(s)?s-1:null},IJ=(e,t,s)=>{if(!e)return;const{rangeClass:r}=lu(t,s);e.colorClass=r},Kb=(e,t)=>{const s=au(t,{allowTrailingColon:!0});if(!s)return null;const{formula:r}=e,{startCol:i,startRow:n,endCol:o,endRow:a}=s,l=i,c=o??i,u=r?.getColByRef(l),d=r?.getColByRef(c);if(!u||!d)return null;const h=Number.parseInt(n,10)-1,p=a?Number.parseInt(a,10)-1:h;if(h<0||p<0)return null;const g=e.rowModel;return!g?.getFormulaRow(h)||!g.getFormulaRow(p)?null:{rowStartIndex:h,rowEndIndex:p,columnStart:u,columnEnd:d}},EJ=(e,t)=>{const s=e.rowModel;if(!s)return null;const{rowStartIndex:r,rowEndIndex:i}=t;let n=null;for(let a=r;a<=i;a++){const l=s.getFormulaRow(a)?.rowIndex;if(l!=null){n=l;break}}let o=null;for(let a=i;a>=r;a--){const l=s.getFormulaRow(a)?.rowIndex;if(l!=null){o=l;break}}return n==null||o==null?null:{...t,rowStartIndex:n,rowEndIndex:o}},DJ=e=>{const t=e.rangeSvc?.getCellRanges(),s=t?.length?t[t.length-1]:null;return s?es(e,s):null},es=(e,t)=>{const{rangeSvc:s,formula:r}=e;if(!s||!r)return null;const i=s.getRangeStartRow(t),n=s.getRangeEndRow(t);if(!i||!n||i.rowPinned||n.rowPinned)return null;const o=Wb(e,i),a=Wb(e,n),l=o?.formulaRowIndex,c=a?.formulaRowIndex;if(l==null||c==null)return null;const u=Math.min(l,c)+1,d=Math.max(l,c)+1,h=t.columns?.filter(y=>!PJ(y)&&!!r.getColRef(y));if(!h?.length)return null;const p=[...h],g=p[0],f=p[p.length-1],m=r.getColRef(g),v=r.getColRef(f);return!m||!v?null:m===v&&u===d?`${m}${u}`:`${m}${u}:${v}${d}`},xs=(e,t)=>{const s=Vb(t),{formula:r}=e;if(!r)return s;const i=[];let n=0;for(const o of s)Kb(e,o.ref)&&(i.push({...o,index:n}),n+=1);return i},$b=(e,t)=>xs(e,t).map(({ref:r,index:i})=>({ref:r,index:i})),LJ=class extends sT{constructor(e){super(),this.field=e,this.functionAutocompleteList=null,this.functionAutocompleteToken=null,this.functionAutocompleteEntries=null,this.functionAutocompleteSearch=null}postConstruct(){this.addManagedElementListeners(this.field.getContentElement(),{keydown:this.onContentKeyDown.bind(this),mouseup:this.updateFunctionAutocomplete.bind(this),focusin:this.updateFunctionAutocomplete.bind(this),focusout:this.closeFunctionAutocomplete.bind(this)}),this.addDestroyFunc(()=>this.closeFunctionAutocomplete())}onPlainValueUpdated(){this.closeFunctionAutocomplete()}onFormulaValueUpdated(){this.updateFunctionAutocomplete()}onContentKeyDown(e){if(this.functionAutocompleteList)switch(e.key){case kt.ENTER:case kt.TAB:e.preventDefault(),e.stopPropagation(),this.confirmFunctionAutocomplete();return;case kt.ESCAPE:e.preventDefault(),e.stopPropagation(),this.closeFunctionAutocomplete();return;case kt.UP:case kt.DOWN:this.functionAutocompleteList.onNavigationKeyDown(e,e.key);return}switch(e.key){case kt.LEFT:case kt.RIGHT:case kt.PAGE_HOME:case kt.PAGE_END:this.scheduleFunctionAutocompleteUpdate();break}}scheduleFunctionAutocompleteUpdate(){setTimeout(()=>{this.isAlive()&&this.updateFunctionAutocomplete()})}updateFunctionAutocomplete(){if(!this.isContentFocused()){this.closeFunctionAutocomplete();return}const{field:e,beans:t}=this,s=e.getCurrentValue();if(!s.trimStart().startsWith("=")){this.closeFunctionAutocomplete();return}const i=e.getCaretOffsetsForAutocomplete();if(_J(t,s,i.valueOffset)){this.closeFunctionAutocomplete();return}const n=kJ(s,i.valueOffset,t.formula??null);if(!n){this.closeFunctionAutocomplete();return}const{prefix:o}=n;if(!o.length){this.closeFunctionAutocomplete();return}const a=this.getFunctionAutocompleteEntries();if(!a.length){this.closeFunctionAutocomplete();return}const l=o.toLocaleLowerCase();if(!a.some(({key:u})=>u.toLocaleLowerCase().startsWith(l))){this.closeFunctionAutocomplete();return}this.functionAutocompleteToken=n,this.openFunctionAutocomplete(a),this.functionAutocompleteList&&this.functionAutocompleteSearch!==o&&(this.functionAutocompleteList.setSearch(o),this.functionAutocompleteSearch=o)}getFunctionAutocompleteEntries(){const e=this.beans.formula,t=e?.active?e.getFunctionNames?.()??[]:[];return this.functionAutocompleteEntries?.length!==t.length&&(this.functionAutocompleteEntries=t.map(s=>({key:s}))),this.functionAutocompleteEntries}openFunctionAutocomplete(e){if(this.functionAutocompleteList||!e.length)return;const t=this.beans.popupSvc;if(!t)return;let s=null;const r=()=>{this.functionAutocompleteList&&s&&t.positionPopupByComponent(s)};this.functionAutocompleteList=this.createManagedBean(new Oa({autocompleteEntries:e,onConfirmed:()=>this.confirmFunctionAutocomplete(),useStartsWithSearch:!0,autoSizeList:!0,maxVisibleItems:10,onListHeightChanged:r}));const i=this.functionAutocompleteList.getGui();s={ePopup:i,type:"autocomplete",eventSource:this.field.getGui(),position:"under",alignSide:this.gos.get("enableRtl")?"right":"left",keepWithinBounds:!0};const n=t.addPopup({eChild:i,anchorToElement:this.field.getGui(),positionCallback:r,ariaLabel:"Formula functions"});this.functionAutocompleteHidePopup=n.hideFunc,this.functionAutocompleteList.afterGuiAttached()}closeFunctionAutocomplete(){this.functionAutocompleteToken=null,this.functionAutocompleteSearch=null,this.functionAutocompleteList&&(this.functionAutocompleteHidePopup?.(),this.functionAutocompleteHidePopup=void 0,this.destroyBean(this.functionAutocompleteList),this.functionAutocompleteList=null)}confirmFunctionAutocomplete(){const e=this.functionAutocompleteToken,t=this.functionAutocompleteList?.getSelectedValue();if(!e||!t){this.closeFunctionAutocomplete();return}const{field:s}=this,r=s.getCurrentValue(),i=t.key,n=r.slice(0,e.start)+i+r.slice(e.end),o=e.start+i.length,a=n[o]==="("?n:n.slice(0,o)+"("+n.slice(o);s.getContentElement().focus({preventScroll:!0}),s.applyFormulaValueChange({nextValue:a,caret:o+1}),this.closeFunctionAutocomplete()}isContentFocused(){return TJ(this.beans)===this.field.getContentElement()}},kJ=(e,t,s)=>{if(t<0||t>e.length||GJ(e,t))return null;let r=t;for(;r>0&&Si(e[r-1]);)r--;let i=t;for(;i<e.length&&Si(e[i]);)i++;if(r===i)return null;let n=i;if(t!==i){const l=e.slice(t,i),c=au(l);c&&(!s||s.getColByRef(c.startCol))&&(n=t)}const o=e.slice(r,n);if(!o||!Fo(o[0])||e[r-1]==="$")return null;const a=zb(e,r);return a!=null&&!Ub.has(a)?null:{start:r,end:n,prefix:e.slice(r,t)}},_J=(e,t,s)=>{for(const r of xs(e,t))if(s>=r.start&&s<=r.end)return!0;return!1},GJ=(e,t)=>{let s=!1;for(let r=0;r<t&&r<e.length;r++)if(e[r]==='"'){if(e[r+1]==='"'){r++;continue}s=!s}return s};import{_last as uu}from"ag-stack";import{BeanStub as OJ,isSpecialCol as NJ}from"ag-grid-community";var BJ=class extends rT{constructor(e){super(),this.field=e,this.rangeSelectionEnabled=!1,this.trackedRangeRefs=new Map,this.trackedRanges=new Map,this.suppressRangeEvents=!1,this.ignoreNextRangeEvent=!1,this.skipNextValueUpdate=!1,this.suppressSelectionChangeHandling=!1,this.handleEditorDeactivated=()=>{this.rangeSelectionEnabled=!1,this.suppressRangeEvents=!1,this.ignoreNextRangeEvent=!1,this.skipNextValueUpdate=!1,this.clearTrackedRanges(!0)}}postConstruct(){this.addManagedEventListeners({cellSelectionChanged:this.onCellSelectionChanged.bind(this)}),this.addDestroyFunc(()=>this.disableRangeSelectionWhileEditing()),this.addDestroyFunc(()=>this.unregisterActiveEditor())}onValueUpdated(e,t){if(this.skipNextValueUpdate){this.skipNextValueUpdate=!1;return}if(this.isActiveEditor()){if(t){this.enableRangeSelectionWhileEditing()&&(this.skipNextValueUpdate=!0,this.field.setValue(e,!0)),this.syncRangesFromFormula(e);return}this.disableRangeSelectionWhileEditing()}}setEditingCellRef(e,t,s){this.editingColumn=e,this.editingRowIndex=t??void 0,this.editingCellRef=s}setEditorActive(e){if(e){this.registerActiveEditor();return}this.unregisterActiveEditor()}withSelectionChangeHandlingSuppressed(e){const t=this.suppressSelectionChangeHandling;this.suppressSelectionChangeHandling=!0;try{e()}finally{this.suppressSelectionChangeHandling=t}}deactivateForFocusLoss(){this.isActiveEditor()&&(this.handleEditorDeactivated(),this.beans.editSvc?.disableRangeSelectionWhileEditing?.(),this.unregisterActiveEditor())}registerActiveEditor(){const e=this.field.getCompId(),{formulaInputManager:t}=this.beans;if(!t||!t.registerActiveEditor(e,this.handleEditorDeactivated))return;this.rangeSelectionEnabled=!1,this.suppressRangeEvents=!1,this.ignoreNextRangeEvent=!1,this.skipNextValueUpdate=!1,this.clearTrackedRanges(!1);const r=this.field.getCurrentValue(),i=r.trimStart().startsWith("=");this.onValueUpdated(r,i)}unregisterActiveEditor(){const e=this.field.getCompId(),{formulaInputManager:t}=this.beans;t&&t.unregisterActiveEditor(e,this.handleEditorDeactivated)}isActiveEditor(){const e=this.field.getCompId(),{formulaInputManager:t}=this.beans;return!!t&&t.isActiveEditor(e)}getTrackedRefCount(e){return this.trackedRangeRefs.get(e)??0}hasTrackedRef(e){return this.getTrackedRefCount(e)>0}addTrackedRef(e){this.trackedRangeRefs.set(e,this.getTrackedRefCount(e)+1)}removeTrackedRef(e){const t=this.getTrackedRefCount(e)-1;if(t<=0){this.trackedRangeRefs.delete(e);return}this.trackedRangeRefs.set(e,t)}enableRangeSelectionWhileEditing(){return this.rangeSelectionEnabled?!1:(this.rangeSelectionEnabled=!0,this.beans.editSvc?.enableRangeSelectionWhileEditing?.(),!0)}disableRangeSelectionWhileEditing(){!this.rangeSelectionEnabled&&!this.trackedRangeRefs.size||(this.rangeSelectionEnabled=!1,this.beans.editSvc?.disableRangeSelectionWhileEditing?.(),this.clearTrackedRanges(this.isActiveEditor()))}clearTrackedRanges(e=!0){e&&Array.from(this.trackedRangeRefs.keys()).forEach(s=>this.removeRangeForRef(s)),this.trackedRangeRefs.clear(),this.trackedRanges.clear()}getLiveRanges(){return this.beans.rangeSvc?.getCellRanges()??[]}withSuppressedRangeEvents(e){this.suppressRangeEvents=!0,e(),this.suppressRangeEvents=!1}setCellRangesSilently(e){const t=this.beans.rangeSvc;t&&this.withSuppressedRangeEvents(()=>t.setCellRanges(e))}getColorIndexForTokenOrRef(e,t){return this.field.getColorIndexForToken(t??null)??this.field.getColorIndexForRef(e)}normaliseRefForComparison(e){return e?(e.endsWith(":")?e.slice(0,-1):e).replace(/\$/g,"").toUpperCase():null}tagRangeColor(e,t,s){const{rangeClass:r}=lu(t,s);return e.colorClass===r?!1:(IJ(e,t,s),!0)}trackRange(e,t,s){const r=this.trackedRanges.get(e),i=s!==void 0?s:r?.tokenIndex??null;r?r.ref!==t&&(this.removeTrackedRef(r.ref),this.addTrackedRef(t)):this.addTrackedRef(t),this.trackedRanges.set(e,{ref:t,tokenIndex:i})}getUntrackedFormulaRangesByRef(){const e=new Map,t=this.getLiveRanges();for(const s of t){if(this.trackedRanges.has(s)||cu(s.colorClass)==null)continue;const r=es(this.beans,s);if(!r||r===this.editingCellRef)continue;const i=e.get(r);i?i.push(s):e.set(r,[s])}return e}syncRangesFromFormula(e){const t=e??this.field.getCurrentValue()??"";if(!this.rangeSelectionEnabled){this.clearTrackedRanges();return}const s=$b(this.beans,t),r=new Map;for(const c of s){const{ref:u,index:d}=c;if(u===this.editingCellRef)continue;const h=r.get(u)??[];h.push(d),r.set(u,h)}for(const c of Array.from(this.trackedRangeRefs.keys()))r.has(c)||this.removeRangeForRef(c);if(!this.beans.rangeSvc)return;const n=new Set(this.getLiveRanges());for(const[c,u]of this.trackedRanges.entries())n.has(c)||(this.trackedRanges.delete(c),this.removeTrackedRef(u.ref));const o=this.getUntrackedFormulaRangesByRef();let a=!1;for(const[c,u]of r.entries()){const d=[];for(const[p,g]of this.trackedRanges.entries())g.ref===c&&d.push(p);const h=o.get(c);for(;d.length<u.length&&h?.length;){const p=h.shift();p&&d.push(p)}for(;d.length>u.length;){const p=d.pop();p&&this.removeTrackedRange(p)}for(;d.length<u.length;){const p=u[d.length],g=this.addRangeForRef(c,!1,p);if(!g)break;d.push(g)}for(let p=0;p<d.length&&p<u.length;p++){const g=d[p],f=u[p];this.trackRange(g,c,f);const m=this.getColorIndexForTokenOrRef(c,f);this.tagRangeColor(g,c,m)&&(a=!0)}}const l=[];for(const c of o.values())c.length&&l.push(...c);if(l.length){const c=this.getLiveRanges(),u=c.filter(d=>!l.includes(d));u.length!==c.length&&(this.setCellRangesSilently(u),a=!0)}a&&this.refreshRangeStyling()}onCellSelectionChanged(e){if(!this.isActiveEditor()||!this.rangeSelectionEnabled||!this.beans.editSvc?.isRangeSelectionEnabledWhileEditing?.())return;if(this.ignoreNextRangeEvent){this.ignoreNextRangeEvent=!1;return}if(this.suppressSelectionChangeHandling)return;const{finished:t,started:s}=e,r=this.getLiveRanges(),i=r.filter(d=>!this.isSpecialOnlyRange(d));if(i.length!==r.length){this.setCellRangesSilently(i),this.refocusEditingCell();return}const n=r.length?uu(r):null,o=n?es(this.beans,n):null,a=!!n&&!this.trackedRanges.has(n)&&!!o&&o!==this.editingCellRef,l=t&&(s||a),c=this.ensureTrackedRangeColors();if(this.suppressRangeEvents){c&&this.refreshRangeStyling();return}if((s||a)&&this.field.rememberCaret(),!a&&this.handleRemovedRangeTokens()){this.field.restoreCaretAfterToken(),this.refocusEditingCell();return}if(this.updateTrackedRangeTokens())return;const u=DJ(this.beans);if(!u||u===this.editingCellRef){this.refocusEditingCell();return}if(l){const{action:d,previousRef:h,tokenIndex:p}=this.field.applyRangeInsert(u);if(d==="none"){this.keepLatestSelectionOnly(n),this.beans.editSvc?.stopEditing(void 0,{source:"edit"});return}if(d==="replace"&&h===u){this.discardLatestRangeForRef(u),this.field.restoreCaretAfterToken(),this.refocusEditingCell();return}this.tagLatestRangeForRef(u,p),this.handleRangeTokenUpdate(h,u,!0,d==="insert",p),this.syncRangesFromFormula(this.field.getCurrentValue()),this.field.restoreCaretAfterToken(),this.refocusEditingCell();return}if(!s&&!t){const{previousRef:d,tokenIndex:h}=this.field.insertOrReplaceToken(u,!1);this.tagLatestRangeForRef(u,h),this.handleRangeTokenUpdate(d,u,!1,!1),this.refocusEditingCell();return}this.tagLatestRangeForRef(u),t&&(this.field.restoreCaretAfterToken(),this.refocusEditingCell())}keepLatestSelectionOnly(e){!e||this.getLiveRanges().length<=1||this.setCellRangesSilently([e])}isSpecialOnlyRange(e){const t=e.columns;return!!t?.length&&t.every(s=>NJ(s))}handleRangeTokenUpdate(e,t,s,r,i){if(s){!r&&e&&e!==t&&this.removeRangeForRef(e,i),this.addRangeForRef(t,!0,i);return}if(r||!e){this.addTrackedRef(t);return}e!==t&&(this.removeTrackedRef(e),this.addTrackedRef(t))}addRangeForRef(e,t,s){const r=this.beans.rangeSvc;if(!r)return;let i;if(t)i=this.findLatestRangeForRef(e,!0)??this.findLatestRangeForRef(e,!1);else{const n=Kb(this.beans,e);if(!n)return;const o=EJ(this.beans,n);if(!o)return;this.withSuppressedRangeEvents(()=>{i=r.addCellRange(o)})}if(i){const n=this.getColorIndexForTokenOrRef(e,s);this.tagRangeColor(i,e,n),this.trackRange(i,e,s),this.refreshRangeStyling()}return i}findLatestRangeForRef(e,t){const s=this.getLiveRanges();for(let r=s.length-1;r>=0;r--){const i=s[r];if(es(this.beans,i)===e&&!(t&&this.trackedRanges.has(i)))return i}}tagLatestRangeForRef(e,t){const{trackedRanges:s}=this,r=this.getLiveRanges(),i=r.length?uu(r):null;if(!i)return;const n=s.get(i)?.tokenIndex??null,o=this.getColorIndexForTokenOrRef(e,t??n);this.tagRangeColor(i,e,o),this.refreshRangeStyling()}discardLatestRangeForRef(e){const t=this.getLiveRanges();if(!t.length)return;const s=uu(t);if(es(this.beans,s)===e){if(this.trackedRanges.has(s)){this.removeTrackedRange(s);return}this.setCellRangesSilently(t.slice(0,-1))}}ensureTrackedRangeColors(){const e=this.getLiveRanges();if(!e.length)return!1;let t=!1;for(const s of e){const r=this.trackedRanges.get(s),i=r?.ref??es(this.beans,s);if(!i||!this.hasTrackedRef(i))continue;const n=r?.tokenIndex??null,o=this.field.getColorIndexForToken(n),a=cu(s.colorClass),l=o??(this.field.hasColorForRef(i)?this.field.getColorIndexForRef(i):this.field.moveColorToRef(void 0,i,a??void 0));l!=null&&(this.tagRangeColor(s,i,l)&&(t=!0),this.trackedRanges.has(s)||this.trackRange(s,i,n))}return t}handleRemovedRangeTokens(){if(!this.beans.rangeSvc||this.trackedRanges.size===0)return!1;const e=this.field.getCurrentValue(),t=$b(this.beans,e).filter(({ref:l})=>l!==this.editingCellRef);if(!t.length)return!1;const s=this.getLiveRanges(),r=new Set(s),i=new Map;for(const l of s){const c=es(this.beans,l);!c||c===this.editingCellRef||i.set(c,(i.get(c)??0)+1)}const n=new Map;for(const l of t){const{ref:c}=l;n.set(c,(n.get(c)??0)+1)}for(const[l,c]of Array.from(n.entries())){const u=i.get(l)??0,d=c-u;d>0?n.set(l,d):n.delete(l)}if(!n.size)return!1;const o=[];for(const[l,c]of Array.from(this.trackedRanges.entries())){if(r.has(l))continue;const{ref:u}=c,d=n.get(u)??0;d<=0||(n.set(u,d-1),o.push({range:l,tracked:c}))}if(!o.length)return!1;o.sort((l,c)=>(c.tracked.tokenIndex??-1)-(l.tracked.tokenIndex??-1));let a=!1;for(const{range:l,tracked:c}of o){const{ref:u,tokenIndex:d}=c;a=this.field.removeTokenRef(u,d??null)||a,this.trackedRanges.delete(l),this.removeTrackedRef(u)}return a&&this.syncRangesFromFormula(this.field.getCurrentValue()),a}refreshRangeStyling(){const{eventSvc:e}=this.beans;e&&(this.ensureTrackedRangeColors(),this.ignoreNextRangeEvent=!0,e.dispatchEvent({type:"cellSelectionChanged",started:!1,finished:!1}))}refocusEditingCell(){const{focusSvc:e}=this.beans,{editingColumn:t,editingRowIndex:s}=this;!e||t==null||s==null||e.setFocusedCell({column:t,rowIndex:s,rowPinned:null,preventScrollOnBrowserFocus:!0})}removeTrackedRange(e){const t=this.trackedRanges.get(e);if(!t)return;const s=this.getLiveRanges(),r=s.filter(i=>i!==e);r.length!==s.length&&this.setCellRangesSilently(r),this.trackedRanges.delete(e),this.removeTrackedRef(t.ref)}removeRangeForRef(e,t){if(!(!e||!this.hasTrackedRef(e))){if(t!=null){let s=!1;for(const[r,i]of Array.from(this.trackedRanges.entries())){const{ref:n,tokenIndex:o}=i;if(!(n!==e||o!==t)){this.removeTrackedRange(r),s=!0;break}}if(!s){for(const[r,i]of Array.from(this.trackedRanges.entries()))if(i.ref===e){this.removeTrackedRange(r);break}}return}for(const[s,r]of Array.from(this.trackedRanges.entries()))r.ref===e&&this.removeTrackedRange(s)}}updateTrackedRangeTokens(){if(!this.beans.rangeSvc)return!1;const e=this.getLiveRanges(),t=this.normaliseRefForComparison(this.editingCellRef);let s=!1;for(const r of e){const i=this.trackedRanges.get(r);if(!i)continue;const{ref:n,tokenIndex:o}=i,a=es(this.beans,r),l=this.normaliseRefForComparison(n),c=this.normaliseRefForComparison(a);if(!a||!c||c===l||c===t)continue;const{colorClass:u}=r,h=this.field.getColorIndexForToken(o??null)??this.field.moveColorToRef(n,a,cu(u)??void 0),p=this.field.replaceTokenRef(n,a,h,o);p!=null&&(this.tagRangeColor(r,a,h),this.trackRange(r,a,p??o??null),s=!0)}return s&&this.refreshRangeStyling(),s}},du=7,VJ={"/":"\xF7","*":"\xD7"},HJ={"\xF7":"/","\xD7":"*"},UJ=class extends iT{constructor(){super(void 0,"ag-formula-input-field",null,"textarea"),this.currentValue="",this.selectionCaretOffset=null,this.lastTokenValueOffset=null,this.lastTokenValueLength=null,this.lastTokenCaretOffset=null,this.focusFromMouseTime=null,this.suppressNextFocusCaretPlacement=!1,this.formulaColorByRef=new Map,this.registerCSS(vJ),this.registerCSS(_a)}postConstruct(){super.postConstruct();const e=this.getInputElement();e.rows=1,e.wrap="off",e.spellcheck=!1,this.mirror=this.createManagedBean(new Hb(this)),this.rangeSyncFeature=this.createManagedBean(new BJ(this)),this.autocompleteFeature=this.createManagedBean(new LJ(this)),this.addManagedElementListeners(this.getContentElement(),{focus:this.onContentFocus.bind(this),blur:this.onContentBlur.bind(this),mousedown:this.onContentMouseDown.bind(this)})}addInputListeners(){this.addManagedElementListeners(this.getInputElement(),{beforeinput:e=>{(e.inputType==="insertLineBreak"||e.inputType==="insertParagraph")&&e.preventDefault()},input:e=>{e.isComposing||this.onContentInput()},compositionend:()=>this.onContentInput()})}getContentElement(){return this.getInputElement()}setValue(e,t){const s=e==null?"":String(e),{isFormula:r,hasFormulaPrefix:i}=this.getFormulaState(s);return r?(this.applyFormulaValue(s,{silent:t}),this.rangeSyncFeature?.onValueUpdated(s,i),this):(this.applyPlainValue(s,{silent:t,dispatch:!0}),this.rangeSyncFeature?.onValueUpdated(s,i),this)}getCurrentValue(){const e=Yb(this.getInputElement().value);return e!==this.currentValue&&this.setEditorValue(e,!0),this.currentValue}setEditingCellRef(e,t){const s=e?this.beans.formula?.getColRef(e):void 0,r=s&&t!=null&&t!==void 0?`${s}${t+1}`:void 0;if(!r){this.rangeSyncFeature?.setEditingCellRef(void 0,void 0,void 0);return}this.rangeSyncFeature?.setEditingCellRef(e,t,r)}rememberCaret(){this.selectionCaretOffset=this.getInputElement().selectionStart}setEditorValue(e,t=!1){return this.currentValue=e,super.setValue(e,t),this}renderFormula(e,t){this.updateInputValue(e,t);const s=xo(this.beans).createDocumentFragment();for(const r of $J(this.beans,this.getInputElement().value,this.getColorIndexForToken.bind(this)))s.appendChild(r);this.mirror.setContent(s)}renderPlainValue(e,t){this.updateInputValue(e,t);const s=xo(this.beans).createDocumentFragment();s.appendChild(xo(this.beans).createTextNode(this.getInputElement().value)),this.mirror.setContent(s)}updateInputValue(e,t){const s=this.getInputElement();if(Yb(s.value)!==e){const{selectionStart:r,selectionEnd:i,selectionDirection:n}=s;s.value=e,s.setSelectionRange(r,i,n)}t!=null&&s.setSelectionRange(t,t)}withSelectionChangeHandlingSuppressed(e){if(!this.rangeSyncFeature){e();return}this.rangeSyncFeature.withSelectionChangeHandlingSuppressed(e)}getColorIndexForRef(e){if(!hu(this.beans))return null;const t=this.formulaColorByRef.get(e);if(t!=null)return t;const s=this.formulaColorByRef.size%du;return this.formulaColorByRef.set(e,s),s}getColorIndexForToken(e){return!hu(this.beans)||e==null?null:e%du}hasColorForRef(e){return this.formulaColorByRef.has(e)}moveColorToRef(e,t,s){const r=e&&this.formulaColorByRef.has(e)?this.getColorIndexForRef(e):s??this.formulaColorByRef.get(t)??this.getColorIndexForRef(t);return e&&e!==t&&this.formulaColorByRef.delete(e),r==null?null:(this.formulaColorByRef.set(t,r),r)}updateFormulaColorsFromValue(e){if(e=e==null?"":String(e),!hu(this.beans)){this.formulaColorByRef.clear();return}const t=zJ(this.beans,e);let s=t.length!==this.formulaColorByRef.size;const r=new Map;t.forEach((i,n)=>{const o=n%du;r.set(i,o),this.formulaColorByRef.get(i)!==o&&(s=!0)}),s&&(this.formulaColorByRef.clear(),r.forEach((i,n)=>this.formulaColorByRef.set(n,i)))}onContentInput(){const e=this.getCurrentValue(),{isFormula:t,hasFormulaPrefix:s}=this.getFormulaState(e);if(!t){this.applyPlainValue(e,{dispatch:!0}),this.rangeSyncFeature?.onValueUpdated(e,s);return}this.applyFormulaValue(e,{dispatch:!0}),this.rangeSyncFeature?.onValueUpdated(e,s)}onContentFocus(){if(this.rangeSyncFeature?.setEditorActive(!0),this.suppressNextFocusCaretPlacement){this.suppressNextFocusCaretPlacement=!1;return}const{focusFromMouseTime:e}=this,t=e!=null;if(this.focusFromMouseTime=null,t)return;const s=this.getInputElement();s.setSelectionRange(s.value.length,s.value.length)}onContentBlur(e){this.focusFromMouseTime=null;const t=e.relatedTarget,s=t?.closest(".ag-cell-editor"),r=t?.closest(".ag-cell");!t||this.getGui().contains(t)||!s||!r||this.rangeSyncFeature?.deactivateForFocusLoss()}onContentMouseDown(){this.focusFromMouseTime=Date.now()}insertOrReplaceToken(e,t){const{caretOffset:s,valueOffset:r}=this.getTokenInsertOffsets(t),i=t||this.lastTokenValueLength==null?0:this.lastTokenValueLength,n=this.getCurrentValue(),o=n.slice(0,r)+e+n.slice(r+i),a=pu(this.beans,o,r)?.index??null;let l;return this.applyFormulaValueChange({nextValue:o,caret:s+e.length,updateTracking:()=>{l=this.updateLastTokenTracking(e,s,r)}}),{previousRef:l,tokenIndex:a}}removeTokenRef(e,t){const s=this.getCurrentValue(),r=xs(this.beans,s);let i;if(t!=null&&(i=r.find(l=>l.index===t),i&&i.ref!==e&&(i=void 0)),i??(i=r.find(l=>l.ref===e)),!i)return!1;const n=s.slice(0,i.start)+s.slice(i.end),o=this.selectionCaretOffset??i.start,a=Math.min(o,n.length);return this.applyFormulaValueChange({nextValue:n,caret:a,updateTracking:()=>{this.lastTokenValueOffset=null,this.lastTokenValueLength=null,this.lastTokenCaretOffset=a,this.lastTokenRef=void 0}}),!0}applyRangeInsert(e){const t=this.getCurrentValue(),s=this.getCaretOffsets(),{valueOffset:r}=s,i=pu(this.beans,t,r);if(i){const{end:l,ref:c}=i;if(c.endsWith(":")&&r===l){const{previousRef:h,tokenIndex:p}=this.insertOrReplaceToken(e,!0);return{action:"insert",previousRef:h,tokenIndex:p}}const{previousRef:u,tokenIndex:d}=this.replaceTokenAtMatch(i,e);return{action:"replace",previousRef:u,tokenIndex:d}}const n=WJ(t,r);if(n){const l=t.slice(0,n.start)+e+t.slice(n.end),c=pu(this.beans,l,n.start)?.index??null,{previousRef:u}=this.replaceTokenAtMatch(n,e,c);return{action:"replace",previousRef:u,tokenIndex:c}}if(!KJ(t,r))return{action:"none"};const{previousRef:o,tokenIndex:a}=this.insertOrReplaceToken(e,!0);return{action:"insert",previousRef:o,tokenIndex:a}}restoreCaretAfterToken(){const t=(this.lastTokenCaretOffset??this.getInputElement().selectionStart)+(this.lastTokenValueLength??0);this.selectionCaretOffset=null,this.suppressNextFocusCaretPlacement=!0,setTimeout(()=>{this.isAlive()&&(this.getContentElement().focus({preventScroll:!0}),uJ(this.beans)===this.getContentElement()&&(this.suppressNextFocusCaretPlacement=!1),this.getInputElement().setSelectionRange(t,t))})}replaceTokenAtMatch(e,t,s){const r=this.getCurrentValue(),i=r.slice(0,e.start)+t+r.slice(e.end);return this.applyFormulaValueChange({nextValue:i,caret:e.start+t.length,updateTracking:()=>{this.updateLastTokenTracking(t,e.start,e.start)}}),{previousRef:e.ref,tokenIndex:s??e.index}}getTokenInsertOffsets(e){return this.getCaretOffsets({useCachedCaret:!0,useCachedValueOffset:!e})}getCaretOffsetsForAutocomplete(){return this.getCaretOffsets()}getCaretOffsets(e={useCachedCaret:!1,useCachedValueOffset:!1}){const{useCachedCaret:t,useCachedValueOffset:s}=e,r=this.getInputElement(),i=t?this.selectionCaretOffset??r.selectionStart:r.selectionStart,n=s&&this.lastTokenValueOffset!=null?this.lastTokenValueOffset:i;return{caretOffset:i,valueOffset:n}}updateLastTokenTracking(e,t,s){const r=this.lastTokenRef;return this.lastTokenValueOffset=s,this.lastTokenValueLength=e.length,this.lastTokenCaretOffset=t,this.lastTokenRef=e,r}getFormulaState(e){const t=e.trimStart().startsWith("=");return{isFormula:this.beans.formula?.isFormula(e)??t,hasFormulaPrefix:t}}dispatchValueChanged(){this.dispatchLocalEvent({type:"fieldValueChanged"})}applyPlainValue(e,t){this.formulaColorByRef.clear(),this.renderPlainValue(e,t.caret),this.setEditorValue(e,t.silent||t.dispatch),t.dispatch&&this.dispatchValueChanged(),this.autocompleteFeature?.onPlainValueUpdated()}applyFormulaValue(e,t){this.updateFormulaColorsFromValue(e),this.renderFormula(e,t.caret),this.setEditorValue(e,t.silent||t.dispatch),t.dispatch&&this.dispatchValueChanged(),this.autocompleteFeature?.onFormulaValueUpdated()}applyFormulaValueChange(e){const{nextValue:t,caret:s}=e;this.updateFormulaColorsFromValue(t),e.updateTracking?.(),this.renderFormula(t,s),this.setEditorValue(t,!0),this.dispatchValueChanged(),this.autocompleteFeature?.onFormulaValueUpdated()}replaceTokenRef(e,t,s,r){const i=this.getCurrentValue(),n=xs(this.beans,i);let o;if(r!=null&&(o=n.find(l=>l.index===r&&l.ref===e)),o??(o=n.find(l=>l.ref===e)),!o)return null;s!=null&&this.formulaColorByRef.set(t,s);const a=i.slice(0,o.start)+t+i.slice(o.end);return this.applyFormulaValueChange({nextValue:a,caret:o.start+t.length,updateTracking:()=>{this.updateLastTokenTracking(t,o.start,o.start)}}),o.index}},hu=e=>{const{gos:t,rangeSvc:s}=e;return!!s&&!!t.get("cellSelection")},zJ=(e,t)=>{const s=[],r=new Set;for(const i of xs(e,t)){const n=i.ref;r.has(n)||(r.add(n),s.push(n))}return s},pu=(e,t,s)=>{for(const r of xs(e,t))if(s>=r.start&&s<=r.end)return{ref:r.ref,start:r.start,end:r.end,index:r.index};return null},WJ=(e,t)=>{for(const s of Vb(e))if(t>=s.start&&t<=s.end)return{ref:s.ref,start:s.start,end:s.end,index:s.index};return null},KJ=(e,t)=>{const s=zb(e,t);return s==null||Ub.has(s)},$J=(e,t,s)=>{const r=[];let i=0;const n=xs(e,t),o=xo(e);for(const a of n){a.start>i&&jb(o,r,t.slice(i,a.start));const l=s(a.index);r.push(jJ(a.ref,l,l!=null,a.index)),i=a.end}return i<t.length&&jb(o,r,t.slice(i)),r.length||r.push(o.createTextNode("")),r},jJ=(e,t,s,r)=>{const i={"aria-label":e,"data-formula-ref":e,"data-formula-token-index":r.toString()};let n;if(s&&t!=null){const a=lu(e,t);n=a.tokenClass,i["data-formula-range-class"]=a.rangeClass}const o=hJ({tag:"span",cls:"ag-formula-token",attrs:i,children:e});return n&&o.classList.add(n),o},jb=(e,t,s)=>{let r=0;for(const i of s.matchAll(/[/*]/g)){t.push(e.createTextNode(s.slice(r,i.index)));const n=e.createElement("span");n.className="ag-formula-operator",n.dataset.symbol=VJ[i[0]],n.textContent=i[0],t.push(n),r=i.index+1}t.push(e.createTextNode(s.slice(r)))},Yb=e=>e.replace(/[÷×]/g,t=>HJ[t]??t),YJ=class extends nT{constructor(){super({tag:"div",cls:"ag-cell-edit-wrapper"}),this.eEditor=lJ,this.focusAfterAttached=!1,this.cachedRaw=this,this.seededText=this}initialiseEditor(e){const t=this.createManagedBean(new UJ);this.eEditor=t,t.addCss("ag-cell-editor"),this.appendChild(t),this.addManagedElementListeners(t.getContentElement(),{keydown:a=>this.onFormulaInputKeyDown(a,e.onKeyDown)});const{eventKey:s,cellStartedEdit:r}=e;let i,n=!1;r?(this.focusAfterAttached=!0,s===ou.BACKSPACE||s===ou.DELETE?i="":s?.length===1?i=s:(i=this.getStartValue(e),n=!0)):(i=this.getStartValue(e),n=!0);const o=i==null?"":String(i);this.eEditor.setEditingCellRef(e.column,e.rowIndex),this.eEditor.setValue(o,!0),this.seededText=n?this.eEditor.getCurrentValue():this}onFormulaInputKeyDown(e,t){const{key:s}=e;if(s!==ou.TAB||e.defaultPrevented)return;const{focusSvc:r}=this.beans,i=r?.getFocusedCell();this.eEditor.withSelectionChangeHandlingSuppressed(()=>{t?.(e)});const n=r?.getFocusedCell();let o=!1;if(i&&n){const{rowIndex:l,rowPinned:c,column:u}=i,{rowIndex:d,rowPinned:h,column:p}=n;o=l!==d||c!==h||u!==p}const{defaultPrevented:a}=e;(a||o)&&e.preventDefault(),e.stopPropagation()}getStartValue(e){const{value:t}=e;return t?.toString()??t}agSetEditValue(e){this.params.value=e;const t=this.getStartValue(this.params);this.eEditor.setValue(t??"",!0),this.seededText=this.eEditor.getCurrentValue()}isPopup(){return!1}afterGuiAttached(){if(!this.focusAfterAttached)return;this.focusIn();const e=this.eEditor.getInputElement();e.setSelectionRange(e.value.length,e.value.length)}focusIn(){this.eEditor.getContentElement().focus({preventScroll:!0})}getValue(){const e=this.eEditor.getCurrentValue(),{value:t,parseValue:s}=this.params;if(typeof e=="string"&&this.isFormulaText(e))return e;if(e===this.seededText||e==null&&t==null)return t;if(Object.is(this.cachedRaw,e))return this.cachedParsed;const r=s(String(e));return this.cachedRaw=e,this.cachedParsed=r,r}getValidationElement(){return this.eEditor.getContentElement()}getValidationErrors(){const{params:e}=this,t=this.eEditor.getCurrentValue(),s=this.getLocaleTextFunc(),{getValidationErrors:r,validateFormulas:i}=e;let n=null;if((i===!0||!!r)&&typeof t=="string"&&this.isFormulaText(t)){const a=this.beans.formula?.validateExpression(t);a&&(n=[a.getTranslatedMessage(s)])}return r?r({value:this.getValue(),internalErrors:n,cellEditorParams:e}):n}isFormulaText(e){const t=e==null?"":String(e);return this.beans.formula?.isFormula(t)??t.trimStart().startsWith("=")}},qJ='.formula-error:after{background-color:var(--ag-invalid-color);content:"";height:12px;position:absolute;top:-6px;width:12px;@media (forced-colors:active){background-color:Mark}}:where(.ag-ltr) .formula-error:after{right:-6px;transform:rotate(45deg)}:where(.ag-rtl) .formula-error:after{left:-6px;transform:rotate(-45deg)}';function ZJ(e,t){const s=e.formula;return s?.isEvaluationActive()?t===void 0?s.hasCachedRows()?(s.refreshFormulas(!0),!0):!1:s.refreshRow(t):!1}import{_isExpressionString as XJ}from"ag-stack";import{BeanStub as JJ,_addGridCommonParams as QJ}from"ag-grid-community";var eQ=class extends oT{constructor(){super(...arguments),this.beanName="formulaDataSvc",this.hasSource=!1}postConstruct(){const e=this.gos.get("formulaDataSource");e&&this.setDataSource(e)}hasDataSource(){return this.hasSource}getFormula(e){const t=this.dataSource?.getFormula(e);return XJ(t)?t:void 0}setFormula(e){this.dataSource?.setFormula(e)}setDataSource(e){this.dataSource=e,this.hasSource=!0,e.init?.(this.createInitParams())}createInitParams(){return QJ(this.gos,{})}destroy(){this.dataSource?.destroy?.(),super.destroy()}};import{BeanStub as tQ}from"ag-grid-community";var sQ=class extends aT{constructor(){super(...arguments),this.beanName="formulaInputManager",this.activeEditor=null,this.activeEditorDeactivate=null}postConstruct(){this.registerRangeSelectionExtension()}registerActiveEditor(e,t){if(this.activeEditor===e&&this.activeEditorDeactivate===t)return!1;const s=this.activeEditorDeactivate;return s&&s!==t&&s(),this.activeEditor=e,this.activeEditorDeactivate=t,!0}unregisterActiveEditor(e,t){this.activeEditor===e&&this.activeEditorDeactivate===t&&(this.activeEditor=null,this.activeEditorDeactivate=null)}isActiveEditor(e){return this.activeEditor===e}shouldSuppressRangeSelection(e){const t=e;return t?.closest?this.activeEditor!=null?!!t.closest(".ag-cell-editor"):!!t.closest(".ag-formula-input-field"):!1}registerRangeSelectionExtension(){const e=this.beans.rangeSvc;e&&(e.registerRangeSelectionExtension(this),this.addDestroyFunc(()=>e.unregisterRangeSelectionExtension?.(this)))}};import{_isExpressionString as gu,_parseBigIntOrNull as rQ}from"ag-stack";import{BeanStub as iQ,_convertColumnEventSourceType as nQ}from"ag-grid-community";import{_DATA_TYPE_DERIVED_COL_DEF_PROPERTIES as oQ,_normaliseCalculatedExpression as aQ}from"ag-grid-community";var fu={editable:!1,suppressPaste:!0,field:void 0,valueGetter:void 0,valueSetter:void 0,cellEditor:void 0,cellEditorSelector:void 0},lQ=Object.keys(fu);function mu(e,t){return{...e,colId:t,calculatedExpression:aQ(e.calculatedExpression),...fu}}function cQ(e,t){const s=lQ.filter(r=>e[r]!==void 0&&e[r]!==fu[r]);return e.colId!==void 0&&e.colId!==t&&s.push("colId"),s}var To=["headerName","cellDataType","calculatedExpression","columnGroupShow"];function uQ(e,t){const s={},r=i=>{const n=e[i],o=t[i];n!==o&&(s[i]={oldValue:n,newValue:o})};for(const i of To)r(i);return Object.keys(s).length?s:null}function ts(e){const t={};for(let s=0,r=To.length;s<r;++s){const i=To[s];i in e&&(t[i]=e[i])}return t}function qb(e,t){return e("calculatedColumnExpressionRestrictedReference",'Column "${variable}" cannot be used in this expression.',[t]).replace("${variable}",t)}function Zb(e){const t=e.trim();return t.startsWith("=")?t:`=${t}`}function dQ(e,t,s){if(s.cellDataType===void 0||s.cellDataType===e.cellDataType)return e;const r={...e};for(const i of oQ)s[i]===void 0&&t?.[i]===void 0&&delete r[i];return r}function Ao(e,t,s=!1){let r=!1,i="",n=0;for(let o=0;o<e.length;o++){const a=e[o];if(a==='"'){e[o+1]==='"'?o++:r=!r;continue}if(!r&&a==="["){const l=Jb(e,o,s);if(l===-1)continue;i+=e.slice(n,o);const c=e.slice(o+1,l);i+=`[${t(s?c.replace(/]]/g,"]"):c,o,l+1)??c}]`,n=l+1,o=l}}return i+e.slice(n)}function Xb(e){return e.replace(/]/g,"]]")}function Jb(e,t,s){for(let r=t+1;r<e.length;++r)if(e[r]==="]")if(s&&e[r+1]==="]")++r;else return r;return-1}function Qb(e,t){let s=!1;for(let r=0;r<t;++r){const i=e[r];if(i==='"')e[r+1]==='"'?++r:s=!s;else if(!s&&i==="["){const n=Jb(e,r,!0);if(n===-1||t<=n)return{start:r,end:n===-1?t:n+1,prefix:e.slice(r+1,t).replace(/]]/g,"]")};r=n}}return null}function hQ(e,t,s,r){const i=Math.min(t,s),n=Math.max(t,s);if(i!==n)return pQ(e.slice(i,n).trim(),r)?eS(e,i,n):{start:i,end:n};if(tS(e,i)||Qb(e,i)!==null)return{start:i,end:n};const o=gQ(e,i,r);return o?eS(e,o.start,o.end):{start:i,end:n}}function pQ(e,t){for(let s=0,r=t.length;s<r;++s)if(t[s]===e)return!0;return!1}function gQ(e,t,s){const r=vu(e,t,s);if(r)return r;const i=fQ(e,t);if(i!=null){const o=vu(e,i,s);if(o)return o}const n=mQ(e,t);return n!=null?vu(e,n,s):null}function vu(e,t,s){for(let r=0,i=s.length;r<i;++r){const n=s[r];for(let o=0,a=n.length;o<a;++o){const l=t-o;if(l>=0&&e.startsWith(n,l))return{start:l,end:l+a}}}return null}function eS(e,t,s){for(;t>0&&e[t-1].trim()==="";)t--;for(;s<e.length&&e[s].trim()==="";)s++;return{start:t,end:s}}function fQ(e,t){for(let s=t-1;s>=0;--s)if(e[s].trim()!=="")return s;return null}function mQ(e,t){for(let s=t,r=e.length;s<r;++s)if(e[s].trim()!=="")return s;return null}function tS(e,t){let s=!1;for(let r=0;r<t&&r<e.length;++r)if(e[r]==='"'){if(e[r+1]==='"'){r++;continue}s=!s}return s}import{_isExpressionString as vQ}from"ag-stack";import{_getClientSideRowModel as CQ}from"ag-grid-community";function yi(e,t){if(!Number.isFinite(t)||t<0)return null;const s=CQ(e);if(s)return s.getFormulaRow(t)??null;const r=e.rowModel.getRow(t);return r&&sS(r)?r:null}function Cu(e){return e.formulaRowIndex??e.rowIndex??null}function sS(e){return!e.stub&&!e.failedLoad&&e.data!=null}var rS=[{symbol:"%",fixity:"postfix",precedence:100},{symbol:"-",fixity:"prefix",precedence:90},{symbol:"+",fixity:"prefix",precedence:90},{symbol:"^",fixity:"infix",precedence:80,associativity:"right"},{symbol:"*",fixity:"infix",precedence:70,associativity:"left",isAssociative:!0},{symbol:"/",fixity:"infix",precedence:70,associativity:"left"},{symbol:"+",fixity:"infix",precedence:60,associativity:"left",isAssociative:!0},{symbol:"-",fixity:"infix",precedence:60,associativity:"left"},{symbol:"&",fixity:"infix",precedence:55,associativity:"left",isAssociative:!0},{symbol:"=",fixity:"infix",precedence:50,associativity:"left"},{symbol:"<>",fixity:"infix",precedence:50,associativity:"left"},{symbol:">=",fixity:"infix",precedence:50,associativity:"left"},{symbol:"<=",fixity:"infix",precedence:50,associativity:"left"},{symbol:">",fixity:"infix",precedence:50,associativity:"left"},{symbol:"<",fixity:"infix",precedence:50,associativity:"left"}],Po=new Map;for(const e of rS){const t=Po.get(e.symbol)??[];t.push(e),Po.set(e.symbol,t)}function rr(e,t){const s=Po.get(e)??[];return t?s.find(r=>r.fixity===t):s[0]}var bQ=[...new Set(rS.map(e=>e.symbol))].sort((e,t)=>t.length-e.length),bu=Po,SQ={1:["invalidFormulaValidation","Invalid formula."],2:["formulaParseInvalidCellReference","Invalid cell reference: ${variable}."],3:["formulaParseInvalidRangeEndReference","Invalid range end reference."],4:["formulaParseUnterminatedString","Unterminated string."],5:["formulaParseUnexpectedCharacter","Unexpected character: ${variable}."],6:["formulaParseOperatorStackUnderflow","Operator stack underflow."],7:["formulaParseMissingOperand","Missing operand for '${variable}'."],8:["formulaParseInternalUnexpectedFrameDuringReduction","Internal error: unexpected frame during reduction."],9:["formulaParseInternalUnexpectedFrameBeforeOpenParen","Internal error: unexpected frame before '('."],10:["formulaParseMisplacedComma","Misplaced comma."],11:["formulaParseCommaOutsideFunctionCall","Comma outside of a function call."],12:["formulaParseInternalUnexpectedFrameBeforeCloseParen","Internal error: unexpected frame before ')'."],13:["formulaParseMismatchedParentheses","Mismatched parentheses."],14:["formulaParseUnsupportedOperand","Unsupported operand: ${variable}."],15:["formulaParseMismatchedParenthesesOrUnfinishedFunctionCall","Mismatched parentheses or unfinished function call."],16:["formulaParseInvalidExpression","Invalid expression."],17:["formulaParseFormulasMustBeginWithEquals","Formulas must begin with =."],18:["formulaSerializeStringContainsQuote",'String contains a quote (") which the tokenizer does not support.',"#PARSE!"],19:["formulaSerializeCannotProduceAbsoluteColumnLabelFromId","Cannot produce absolute COLUMN label from id '${variable}'."],20:["formulaSerializeCannotProduceAbsoluteRowIndexFromId","Cannot produce absolute ROW index from id '${variable}'."],21:["formulaSerializeCannotProduceRowIndexFromId","Cannot produce ROW index from id '${variable}'."],22:["formulaSerializeCannotMapColumnIdToA1Label","Cannot map column id '${variable}' to A1 label."],23:["formulaSerializeCannotParseAbsoluteRowIndex","Cannot parse absolute row index '${variable}'."],24:["formulaSerializeCannotMapRowIdToA1Index","Cannot map row id '${variable}' to A1 index."],25:["formulaEvalRangeNotAllowedInScalarContext","Range is not allowed in scalar context."],26:["formulaEvalUnknownReferenceToCell","Unknown reference to cell.","#REF!"],27:["formulaEvalUnsupportedOperation","Unsupported operation ${variable}.","#NAME?"],28:["formulaEvalInvalidAbsoluteRow","Invalid absolute row.","#REF!"],29:["formulaEvalUnrecognisedRowId","Unrecognised row id.","#REF!"],30:["formulaEvalInvalidAbsoluteColumn","Invalid absolute column.","#REF!"],31:["formulaEvalUnrecognisedColumnId","Unrecognised column id.","#REF!"],32:["formulaEvalUnrecognisedRowInRange","Unrecognised row in range.","#REF!"],33:["formulaEvalUnrecognisedReferenceToCell","Unrecognised reference to cell.","#REF!"],34:["formulaEvalIncompleteRangeReference","Incomplete range reference.","#REF!"],35:["formulaFunctionExpectedExactlyArguments","${variable}: expected exactly ${variable} arguments."],36:["formulaFunctionExpectedAtMostArguments","${variable}: expected at most ${variable} arguments."],37:["formulaFunctionExpectedAtLeastArguments","${variable}: expected at least ${variable} arguments."],38:["formulaFunctionInvalidCriteriaWildcardsWithComparator","Invalid criteria: wildcards with comparator.","#VALUE!"],39:["formulaFunctionNonNumericArgument","${variable}: non-numeric argument.","#VALUE!"],40:["formulaFunctionDivisionByZero","${variable}: division by zero.","#DIV/0!"],41:["formulaFunctionCannotCombineDatesWithBigInt","${variable}: cannot combine dates with BigInt.","#VALUE!"],42:["formulaFunctionRequiresAtLeastOneNumericValue","${variable}: requires at least one numeric value.","#PARSE!"],43:["formulaFunctionRequiresAtLeastOneValue","${variable}: requires at least one value."],44:["formulaFunctionAllValuesMustBeNumbers","${variable}: all values must be numbers.","#VALUE!"],45:["formulaFunctionArgumentMustBeRange","${variable}: ${variable} argument must be a range.","#VALUE!"],46:["formulaFunctionArgumentMustBeValue","${variable}: ${variable} argument must be a value.","#VALUE!"],47:["formulaFunctionRangesHaveDifferentSizes","${variable}: ranges have different sizes.","#VALUE!"],48:["formulaFunctionValuesMustBeNumeric","${variable}: values must be numeric.","#VALUE!"],49:["formulaFunctionValuesMustBeIntegers","${variable}: values must be integers.","#VALUE!"],50:["formulaFunctionUnsupportedValueType","${variable}: unsupported value type.","#VALUE!"],51:["formulaServiceCircularReference","Circular reference.","#CIRCREF!"],52:["formulaServiceExpectedParsableFormula","Expected parsable formula.","#PARSE!"],53:["formulaServiceInternalSchedulingError","Internal scheduling error."],54:["formulaFunctionDivNonNumericArgument","DIV: non-numeric argument.","#VALUE!"],55:["formulaFunctionDivDivisionByZero","DIV: division by zero.","#DIV/0!"],56:["formulaFunctionSumCannotCombineDatesWithBigInt","SUM: cannot combine dates with BigInt.","#VALUE!"],57:["formulaFunctionSumRequiresAtLeastOneNumericValue","SUM: requires at least one numeric value.","#PARSE!"],58:["formulaFunctionAvgRequiresAtLeastOneValue","AVG: requires at least one value."],59:["formulaFunctionMedianAllValuesMustBeNumbers","MEDIAN: all values must be numbers.","#VALUE!"],60:["formulaFunctionMedianRequiresAtLeastOneValue","MEDIAN: requires at least one value."],61:["formulaFunctionSumifFirstArgumentMustBeRange","SUMIF: first argument must be a range.","#VALUE!"],62:["formulaFunctionSumifSecondArgumentMustBeValue","SUMIF: second argument must be a value (criteria).","#VALUE!"],63:["formulaFunctionSumifThirdArgumentMustBeRange","SUMIF: third argument must be a range (sum_range).","#VALUE!"],64:["formulaFunctionSumifRangesHaveDifferentSizes","SUMIF: ranges have different sizes.","#VALUE!"],65:["formulaFunctionCountifFirstArgumentMustBeRange","COUNTIF: first argument must be a range.","#VALUE!"],66:["formulaFunctionCountifSecondArgumentMustBeValue","COUNTIF: second argument must be a value (criteria).","#VALUE!"],67:["formulaFunctionConcatUnsupportedValueType","CONCAT: unsupported value type.","#VALUE!"],68:["formulaFunctionMinRequiresAtLeastOneValue","MIN: requires at least one value."],69:["formulaFunctionMaxRequiresAtLeastOneValue","MAX: requires at least one value."],70:["formulaFunctionPercentNonNumericArgument","PERCENT: non-numeric argument.","#VALUE!"],71:["formulaFunctionPowerNonNumericArgument","POWER: non-numeric argument.","#VALUE!"]},iS=(e,t)=>{if(!t?.length)return e;let s=e,r=0;for(;r<t.length&&s.indexOf("${variable}")!==-1;)s=s.replace("${variable}",t[r++]);return s},nS=e=>{if(e?.length)return e.map(String)},oS=e=>SQ[e],yQ=(e,t)=>{const[,s]=oS(e);return iS(s,nS(t))},wQ=(e,t)=>iS(e,nS(t)),xQ=e=>{if(e?.length)return e.map(String)},N=class extends Error{constructor(e,t,s){const r=typeof e=="string",i=!r&&Array.isArray(t)?xQ(t):void 0,n=r?e:yQ(e,i);if(super(n),this.name="FormulaError",r)this.type=typeof t=="string"?t:"#ERROR!",this.errorId=null,this.localeKey=null,this.defaultMessage=e,this.variableValues=void 0;else{const[o,a,l]=oS(e);this.type=s??l??"#ERROR!",this.errorId=e,this.localeKey=o,this.defaultMessage=a,this.variableValues=i}}getTranslatedMessage(e){return this.localeKey?wQ(e(this.localeKey,this.defaultMessage,this.variableValues),this.variableValues):this.message}},it=class extends N{constructor(e,t,s,r){super(e,r,"#PARSE!"),this.errorStart=t,this.errorEnd=s}};function Su(e,t){if(e.type!=="operation")return null;if(!t(e.operation))return e.operation;for(const s of e.operands){const r=Su(s,t);if(r)return r}return null}var FQ=(e,t,s)=>{const r=t.trim();if(r.startsWith('"')&&r.endsWith('"')&&r.length>=2)return r.slice(1,-1);if(r.toLowerCase()==="true")return!0;if(r.toLowerCase()==="false")return!1;if(r.toLowerCase()==="null")return null;const i=Number(r);if(!Number.isNaN(i))return i;if(r.startsWith("[")&&r.endsWith("]")&&r.length>2){const o=r.slice(1,-1),a=e.colModel.getCol(o)??null;if(!s&&!a)throw new it(2,0,r.length,[r]);return{column:{id:a?.colId??o,absolute:!1},row:{id:"",absolute:!1,current:!0}}}const n=au(r);if(n){const{startCol:o,startRow:a,startColAbsolute:l,startRowAbsolute:c,endCol:u,endRow:d,endColAbsolute:h,endRowAbsolute:p}=n,g=(m,v,C,b)=>{const y=m||s?v.toUpperCase():e.formula?.getColByRef(v)?.colId,S=C||s?b:yi(e,Number(b)-1)?.id;if(y==null||S==null)throw new it(2,0,0,[r]);return{column:{id:y,absolute:m||s==="absolute"},row:{id:S,absolute:C||s==="absolute"}}},f=g(l,o,c,a);if(u&&d){const m=g(h??!1,u,p??!1,d);f.endColumn=m.column,f.endRow=m.row}return f}};function TQ(e,t){const s=[];let r=0;const i=(l,c,u="text")=>{s.push(e.slice(l,c)),t?.tokens.push({start:l,end:c,type:u})},n=l=>{if(!t)throw l;t.error??(t.error=l)},o=l=>{let c=l;for(;c<e.length&&/\s/.test(e[c]);)c++;return e[c]==="("},a=(l,c)=>{let u=c;const d=()=>l[u]==="$"?(u++,!0):!1,h=()=>{const m=u;for(;u<l.length&&/[A-Za-z]/.test(l[u]);)u++;return u>m},p=()=>{const m=u;for(;u<l.length&&/[0-9]/.test(l[u]);)u++;return u>m},g=()=>{const m=u;return d(),!h()||(d(),!p())?(u=m,!1):!0};if(!g())return 0;if(l[u]===":"){const m=u;if(u++,!g())throw new it(3,m,u)}const f=l.slice(c,u);return Bb(l,c,f)?u-c:0};for(;r<e.length;){const l=e[r];if(/\s/.test(l)){r++;continue}if(l==='"'){let u=r+1;for(;u<e.length&&e[u]!=='"';)u++;if(u>=e.length){n(new it(4,r,r+1)),i(r,e.length);break}i(r,u+1),r=u+1;continue}if(/[0-9]/.test(l)||l==="."&&/[0-9]/.test(e[r+1])){let u=r+1;for(;u<e.length&&/[0-9.]/.test(e[u]);)u++;i(r,u),r=u;continue}if(l==="["){let u=e.indexOf("]",r+1);for(;t&&u>=0&&e[u+1]==="]";)u=e.indexOf("]",u+2);if(u<0){n(new it(5,r,r+1,[l])),i(r,e.length,"reference");break}i(r,u+1,"reference"),r=u+1;continue}if(l==="$"||Fo(l)){let u=0;try{u=a(e,r)}catch(h){if(!(h instanceof it))throw h;n(h)}if(u>0){i(r,r+u,"reference"),r+=u;continue}let d=r+1;for(;d<e.length&&Si(e[d]);)d++;i(r,d,t&&o(d)?"function":"text"),r=d;continue}if(l==="("||l===")"||l===","){i(r,r+1),r++;continue}const c=bQ.find(u=>e.startsWith(u,r));if(!c){n(new it(5,r,r+1,[l])),i(r,r+1),r++;continue}i(r,r+c.length,"operator"),r+=c.length}return s}function AQ(e,t){return e.fixity!=="infix"||t.fixity!=="infix"?!0:e.associativity==="right"&&e.precedence===t.precedence?!1:e.precedence>=t.precedence}function PQ(e,t){const s=bu.get(e);if(!s)return null;const r=t!==void 0&&bu.has(t);return t!==void 0&&!r&&!(t==="("||t===",")&&t!=="("||t===")"?s.find(o=>o.fixity==="postfix")??s.find(o=>o.fixity==="infix")??null:s.find(o=>o.fixity==="prefix")??s.find(o=>o.fixity==="infix")??null}function aS(e,t,s,r){const i=TQ(t,r);if(r?.error)throw r.error;const n=(u,d,h)=>{const p=r?.tokens[d];return new it(u,p?.start??d,p?.end??d+1,h)},o=[],a=[],l=()=>{const u=a.pop();if(!u)throw new it(6,0,0);if(u.kind==="op"){const d=u.def;if(d.fixity!=="postfix"&&o.length<=u.outLen)throw n(7,u.index,[d.symbol]);if(d.fixity!=="infix"){const g=o.pop();if(!g)throw n(7,u.index,[d.symbol]);if(d.symbol==="+"&&d.fixity==="prefix"){o.push(g);return}if(d.fixity==="postfix"&&d.symbol==="%"){o.push({type:"operation",operation:d.symbol,operands:[g]});return}d.symbol==="-"&&d.fixity==="prefix"?o.push({type:"operation",operation:"-",operands:[{type:"operand",value:0},g]}):o.push({type:"operation",operation:d.symbol,operands:[g]});return}const h=o.pop(),p=o.pop();if(!p||!h)throw n(7,u.index,[d.symbol]);o.push({type:"operation",operation:d.symbol,operands:[p,h]});return}throw n(8,u.index)};let c=0;for(;c<i.length;){const u=i[c];if(Fo(u[0])&&i[c+1]==="("){const p=u;a.push({kind:"function",name:p,args:[],index:c},{kind:"parenthesis",outLen:o.length,index:c+1}),c+=2;continue}if(u==="("){a.push({kind:"parenthesis",outLen:o.length,index:c}),c++;continue}if(u===","){const p=i[c-1];if(p==null||p==="("||p===",")throw n(10,c);for(;;){const m=a[a.length-1];if(!m||m.kind==="parenthesis")break;if(m.kind==="op")l();else throw n(9,c)}const g=a[a.length-1];if(g?.kind!=="parenthesis")throw n(10,c);const f=a[a.length-2];if(f?.kind!=="function")throw n(11,c);o.length>g.outLen&&f.args.push(o.pop()),c++;continue}if(u===")"){if(i[c-1]===",")throw n(10,c);for(;;){const f=a[a.length-1];if(!f||f.kind==="parenthesis")break;if(f.kind==="op")l();else throw n(12,c)}const p=a[a.length-1];if(p?.kind!=="parenthesis")throw n(13,c);const g=p.outLen;if(a.pop(),a[a.length-1]?.kind==="function"){const f=a.pop();o.length>g&&f.args.push(o.pop());const m={type:"operation",operation:f.name,operands:f.args};if(o.push(m),r){const v=pS(m);v?.type==="operand"&&typeof v.value=="object"&&v.value&&r.references.push({cell:v.value,range:{start:r.tokens[f.index].start,end:r.tokens[c].end}})}}c++;continue}const d=bu.has(u)?PQ(u,i[c-1]):null;if(d){for(;;){const p=a[a.length-1];if(p?.kind!=="op")break;if(AQ(p.def,d))l();else break}a.push({kind:"op",def:d,index:c,outLen:o.length}),c++;continue}const h=FQ(e,u,s);if(h===void 0)throw n(14,c,[u]);if(o.push({type:"operand",value:h}),r&&typeof h=="object"&&h){const{start:p,end:g}=r.tokens[c];r.references.push({cell:h,range:{start:p,end:g}})}c++}for(;a.length;){const u=a[a.length-1];if(u.kind==="op")l();else throw n(15,u.index)}if(o.length!==1)throw n(16,i.length-1);return o[0]}var wi=(e,t,s=!1)=>{if(!vQ(t))throw new it(17,0,1);const r=t.slice(1).trim();return wu(aS(e,r,s))};function lS(e,t){const s={tokens:[],references:[]},r=/^\s*=/.exec(t)?.[0].length??0,i=t.slice(r),n=i.trim();if(r&&!n)return{tokens:[],references:[],error:new N(16),range:{start:r-1,end:r}};let o=null,a;try{if(n){const l=wu(aS(e,i,"absolute",s)),c=Su(l,u=>!!e.formula?.getFunction(u));if(c){o=new N(27,[c]);const u=s.tokens.find(d=>d.type==="function"&&i.slice(d.start,d.end)===c);a=u&&{start:u.start,end:u.end}}}}catch(l){if(!(l instanceof N))throw l;o=l,s.references.length=0,l instanceof it&&l.errorEnd>l.errorStart&&(a={start:l.errorStart,end:l.errorEnd})}return{tokens:s.tokens.map(l=>({...l,start:l.start+r,end:l.end+r})),references:s.references.map(({cell:l,range:c})=>({cell:l,range:{start:c.start+r,end:c.end+r}})),error:o,range:a&&{start:a.start+r,end:a.end+r}}}function yu(e,t){return e.type==="operation"&&e.operation.toUpperCase()===t.toUpperCase()}function cS(e,t=!1){return!e||e.type!=="operand"?t:!!e.value}function uS(e){if(e?.type!=="operand")return null;const t=e.value;return typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):null}function dS(e){if(!yu(e,"COLUMN"))return null;const t=uS(e.operands[0]);if(t==null)return null;const s=cS(e.operands[1],!1);return{id:t,absolute:s}}function hS(e){if(!yu(e,"ROW"))return null;const t=uS(e.operands[0]);if(t==null)return null;const s=cS(e.operands[1],!1);return{id:t,absolute:s}}function pS(e){if(!yu(e,"REF"))return null;const t=e.operands;if(t.length!==2&&t.length!==4)return null;const s=dS(t[0]),r=hS(t[1]);if(!s||!r)return null;const i={column:s,row:r};if(t.length===4){const n=dS(t[2]),o=hS(t[3]);if(!n||!o)return null;i.endColumn=n,i.endRow=o}return{type:"operand",value:i}}function wu(e){if(e.type==="operation"){const t=e.operands.map(wu),s={type:"operation",operation:e.operation,operands:t};return pS(s)??s}return e}var xu=e=>e.type==="operation";function gS(e,t){const s=e.colModel.colsById[t];return s?e.formula?.getColRef(s)??null:null}function RQ(e,t){return e.formula?.getColByRef?.(t)?.colId??null}function MQ(e,t,s){const r=e.colsById[s];if(!r)return null;const i=t.indexOf(r);return i>=0?i:null}function IQ(e,t){return e[t]?.colId??null}function Fu(e,t){const s=e.rowModel?.getRowNode?.(t),r=s?Cu(s):null;return r!=null?r+1:null}function fS(e,t){return yi(e,t-1)?.id??null}var EQ=/^[A-Za-z]+$/;function Tu(e){if(e.includes('"'))throw new N(18);return'"'+e+'"'}function DQ(e,t){const s=t.id,r=EQ.test(s);if(t.absolute){if(r)return s.toUpperCase();const i=gS(e,s);if(i)return i.toUpperCase();throw new N(19,[s])}if(r){const i=RQ(e,s);if(i)return i}return s}function LQ(e,t){const{id:s,absolute:r}=t;if(r){if(fS(e,Number(s))==null)throw new N(20,[s])}else if(Fu(e,s)==null)throw new N(21,[s]);return s}function kQ(e,t){const s=t.id;if(t.absolute)return s;const r=gS(e,s);if(r)return r.toUpperCase();throw new N(22,[s])}function _Q(e,t){const s=t.id;if(t.absolute){const i=Number(s);if(Number.isFinite(i)&&i>=1)return i;throw new N(23,[s])}const r=Fu(e,s);if(r!=null)return r;throw new N(24,[s])}function Ro(e,t,s,r){const i=r?t.id:s?kQ(e,t):_Q(e,t);return t.absolute?"$"+i:""+i}function GQ(e,t,s,r){if(r&&t.row.current&&!t.endColumn&&!t.endRow)return`[${t.column.id}]`;const i=Ro(e,t.column,!0,s)+Ro(e,t.row,!1,s),{endColumn:n,endRow:o}=t;return n&&o?i+":"+Ro(e,n,!0,s)+Ro(e,o,!1,s):i}function mS(e,t){return"COLUMN("+Tu(DQ(e,t))+(t.absolute?",true)":")")}function vS(e,t){return"ROW("+Tu(LQ(e,t))+(t.absolute?",true)":")")}function OQ(e,t,s){if(s&&t.row.current&&!t.endColumn&&!t.endRow)return`[${t.column.id}]`;const r="REF("+mS(e,t.column)+","+vS(e,t.row),{endColumn:i,endRow:n}=t;return i&&n?r+","+mS(e,i)+","+vS(e,n)+")":r+")"}function CS(e){if(e.operation!=="-"||e.operands.length!==2)return null;const[t,s]=e.operands;return t.type==="operand"&&t.value===0?s:null}function bS(e,t,s){if(!xu(t)||CS(t))return!1;const r=rr(t.operation,"infix");if(!r)return!1;const i=e.precedence,n=r.precedence;return n<i?!0:n>i?!1:e.associativity==="right"?s==="left"&&r.symbol===e.symbol:e.isAssociative?!1:s==="right"}function NQ(e){if(!xu(e))return!1;const t=rr(e.operation,"infix");return!!t&&t.symbol!=="^"}function SS(e,t,s,r,i=!1){function n(o){if(o.type==="operand"){const d=o.value;return typeof d=="string"?Tu(d):typeof d=="number"?""+d:typeof d=="boolean"?d?"TRUE":"FALSE":d==null?"NULL":s?OQ(e,d,i):GQ(e,d,r,i)}const a=o.operands,l=a.length;if(l===2&&o.operation==="-"){const d=CS(o);if(d){const h=n(d);return NQ(d)?"-("+h+")":"-"+h}}const c=o.operation.toUpperCase();if(l===1){const d=a[0],h=rr(c,"postfix");if(h)return n(d)+h.symbol;const p=rr(c,"prefix");if(p){const g=n(d);return xu(d)&&rr(d.operation,"infix")?p.symbol+"("+g+")":p.symbol+g}return c+"("+n(d)+")"}if(l===2){const d=rr(c,"infix");if(d){const h=a[0],p=a[1],g=bS(d,h,"left")?"("+n(h)+")":n(h),f=bS(d,p,"right")?"("+n(p)+")":n(p);return g+d.symbol+f}}let u="";for(let d=0;d<l;d++)u+=(d===0?"":",")+n(a[d]);return c+"("+u+")"}return"="+n(t)}var Mo=class{constructor(e,t,s,r,i,n){this.rowNode=e,this.column=t,this.formulaString=s,this.fromDataSource=r,this.beans=i,this.service=n,this._valueVersion=-1,this.errorType=null,this._value=void 0,this.astStale=!0,this.ast=null,this.errorId=null,this.errorMessage="",this.errorVariableValues=null,this.baseDataType=void 0}setComputedValue(e){this._value=e,this._valueVersion=this.service.valueCacheVersion,this.errorType=null,this.errorId=null,this.errorMessage="",this.errorVariableValues=null}setErrorFields(e,t,s,r){this.errorType=e,this.errorId=t,this.errorMessage=t==null?s:"",this.errorVariableValues=r,this._valueVersion=this.service.valueCacheVersion}isValueReady(){return this._valueVersion===this.service.valueCacheVersion}getValue(){return this.errorType??this._value}getAst(){if(!this.astStale)return this.ast;const e=wi(this.beans,this.formulaString)??null;return this.ast=e,this.astStale=!1,e}};function yS(e,t,s){let r=e.get(t);if(r?.has(s))throw new N(51);r||(r=new Set,e.set(t,r)),r.add(s)}function Au(e,t,s){const r=e.get(t);r&&(r.delete(s),r.size===0&&e.delete(t))}function wS(e){return!!(e.endColumn&&e.endRow)}function Pu(e,t,s){const{row:r,column:i}=t;if(r.current&&!s?.row)throw new N(29);const n=r.current?s.row:r.absolute?yi(e,Number(r.id)-1):e.rowModel.getRowNode(r.id),o=i.absolute?e.formula.getColByRef(i.id):e.colModel.colsById[i.id];return!n||!r.current&&!sS(n)||!o?null:{row:n,column:o}}function xS(e,t,s,r){if(t.type==="operand"){const a=t.value;if(typeof a!="object"||a==null)return a;if(wS(a))throw new N(25);const l=Pu(e,a,r);if(!l)throw new N(26);return s.resolveAddrRef(l)}const i=e.formula?.getFunction(t.operation);if(!i)throw new N(27,[t.operation]);const{args:n,values:o}=HQ(e,t.operands,s,r);return i({row:r.row,column:r.column,args:n,values:o})}function FS(e,t,s,r){if(t.type==="operand"){const n=t.value;if(typeof n!="object"||n==null)return{kind:"value",value:n};if(wS(n))return zQ(e,n,s,r);const o=Pu(e,n,r);if(!o)throw new N(26);return{kind:"value",value:s.resolveAddrRef(o)}}return{kind:"value",value:xS(e,t,s,r)}}var BQ=class{constructor(e,t,s,r){this.beans=e,this.operandNodes=t,this.resolver=s,this.caller=r,this.i=0,this.res={done:!1,value:void 0}}next(){return this.i>=this.operandNodes.length?(this.res.done=!0,this.res.value=void 0,this.res):(this.res.done=!1,this.res.value=FS(this.beans,this.operandNodes[this.i++],this.resolver,this.caller),this.res)}[Symbol.iterator](){return this}},VQ=class{constructor(e,t,s,r){this.beans=e,this.operandNodes=t,this.resolver=s,this.caller=r,this.i=0,this.inner=null,this.res={done:!1,value:void 0}}next(){for(;;){if(this.inner){const t=this.inner.next();if(!t.done)return this.res.done=!1,this.res.value=t.value,this.res;this.inner=null;continue}if(this.i>=this.operandNodes.length)return this.res.done=!0,this.res.value=void 0,this.res;const e=FS(this.beans,this.operandNodes[this.i++],this.resolver,this.caller);if(e.kind==="value")return this.res.done=!1,this.res.value=e.value,this.res;this.inner=e[Symbol.iterator]()}}[Symbol.iterator](){return this}};function HQ(e,t,s,r){return{args:{[Symbol.iterator](){return new BQ(e,t,s,r)}},values:{[Symbol.iterator](){return new VQ(e,t,s,r)}}}}function Io(e,t,s){if(t.current){const n=s?.row?Cu(s.row):null;if(n==null)throw new N(29);return n}if(t.absolute){const n=Number(t.id)-1;if(!Number.isFinite(n)||n<0)throw new N(28);return n}const r=e.rowModel?.getRowNode?.(t.id),i=r?Cu(r):null;if(i==null)throw new N(29);return i}function Eo(e,t){if(t.absolute){const r=e.formula?.getColByRef(t.id);if(!r)throw new N(30);return r}const s=e.colModel.colsById[t.id];if(!s)throw new N(31);return s}var UQ=class{constructor(e,t,s,r,i,n){this.beans=e,this.rowStartIndex=t,this.rowEndIndex=s,this.colStart=r,this.colEnd=i,this.resolver=n,this.cols=null,this.currentRowIndex=this.rowStartIndex,this.currentColIdx=-1,this.colStartIdx=-1,this.colEndIdx=-1,this.res={done:!1,value:void 0}}initColsOnce(){if(this.cols)return;this.cols=this.beans.colModel.colsList;const e=TS(this.beans,this.colStart,this.colEnd);if(!e){this.colStartIdx=-1,this.colEndIdx=-1;return}[this.colStartIdx,this.colEndIdx]=e,this.currentColIdx=this.colStartIdx}next(){if(!this.cols&&(this.initColsOnce(),this.colStartIdx<0))return this.res.done=!0,this.res;if(this.currentRowIndex<=this.rowEndIndex){const e=yi(this.beans,this.currentRowIndex);if(!e)throw new N(32);const t=this.cols[this.currentColIdx];return this.currentColIdx<this.colEndIdx?this.currentColIdx++:(this.currentColIdx=this.colStartIdx,this.currentRowIndex++),this.res.value=this.resolver.resolveAddrRef({row:e,column:t}),this.res}return this.res.done=!0,this.res.value=void 0,this.res}};function zQ(e,t,s,r){const i=Io(e,t.row,r),n=t.endRow?Io(e,t.endRow,r):i,o=Math.min(i,n),a=Math.max(i,n),l=Eo(e,t.column),c=t.endColumn?Eo(e,t.endColumn):l;return{kind:"range",rowStart:o,rowEnd:a,colStart:l,colEnd:c,[Symbol.iterator](){return new UQ(e,o,a,l,c,s)}}}function TS(e,t,s){const r=e.colModel.colsList;let i=null,n=null;for(let l=0;l<r.length&&(i===null||n===null);l++){const c=r[l];if(c===s&&(n=l),c===t&&(i=l),n!==null&&i!==null)break}if(i===null||n===null)return null;const o=Math.min(i,n),a=Math.max(i,n);return[o,a]}function*WQ(e,t,s,r,i){const n=e.colModel.colsList,o=TS(e,r,i);if(o==null)return;const[a,l]=o;for(let c=t;c<=s;c++){const u=yi(e,c);if(u)for(let d=a;d<=l;d++)yield{row:u,column:n[d]}}}function*KQ(e,t,s,r){const i=[t];for(;i.length;){const n=i.pop();if(n.type==="operand"){const o=n.value;if(typeof o!="object"||o==null)continue;if(!o.endColumn&&!o.endRow){const p=Pu(e,o,r);if(!p)throw new N(33);const g=s.ensureCellFormula(p.row,p.column);if(!g||g.isValueReady())continue;yield p;continue}if(!o.endColumn||!o.endRow)throw new N(34);const a=Io(e,o.row,r),l=Io(e,o.endRow,r),c=Math.min(a,l),u=Math.max(a,l),d=Eo(e,o.column),h=Eo(e,o.endColumn);for(const p of WQ(e,c,u,d,h)){const g=s.ensureCellFormula(p.row,p.column);!g||g.isValueReady()||(yield p)}continue}for(let o=0;o<n.operands.length;o++)i.push(n.operands[o])}}import{_isFiniteNumber as $Q}from"ag-grid-community";function Ye(e,t,s){const r=e[Symbol.iterator](),i=new Array(s);for(let n=0;n<s;n++){const o=r.next();if(o.done)throw new N(35,[t,s]);i[n]=o.value}if(!r.next().done)throw new N(35,[t,s]);return i}function ir(e){return{*[Symbol.iterator](){for(const t of e)t!=null&&t!==""&&(yield t)}}}function AS(e,t,s,r){const i=[];for(const n of e)if(i.push(n),i.length>r)throw new N(36,[t,r]);if(i.length<s)throw new N(37,[t,s]);return i}var Ru=e=>e.kind==="range",PS=e=>e.kind==="value",jQ=["<=",">=","<>","<",">","="];function YQ(e){for(const t of jQ)if(e.startsWith(t))return t;return null}function Mu(e){if($Q(e))return e;if(e instanceof Date)return+e;if(typeof e=="string"){const t=Number(e);if(!Number.isNaN(t))return t}return null}function RS(e){if(e==null)return"";switch(typeof e){case"string":return e;case"number":return String(e);case"boolean":return e?"TRUE":"FALSE"}return e instanceof Date?String(+e):String(e)}function qQ(e){let t="^";for(let s=0;s<e.length;s++){const r=e[s];if(r==="~"&&s+1<e.length&&(e[s+1]==="*"||e[s+1]==="?")){t+="\\"+e[++s];continue}if(r==="*"){t+=".*";continue}if(r==="?"){t+=".";continue}/[-/\\^$*+?.()|[\]{}]/.test(r)?t+="\\"+r:t+=r}return t+="$",new RegExp(t,"i")}var ZQ=(e,t,s)=>{let r=Mu(t),i=Mu(s);switch((r==null||i==null)&&(r=t,i=RS(s).toUpperCase()),e){case"<":return i<r;case">":return i>r;case"<=":return i<=r;case">=":return i>=r;case"=":return i===r;case"<>":return i!==r}return!1},XQ=(e,t,s)=>{const r=RS(s),i=t.test(r);return e==="="?i:!i},JQ=e=>e==null||e==="";function MS(e){if(typeof e=="number")return o=>Mu(o)===e;if(typeof e!="string")return o=>e===o;const t=e.trim();if(t==="")return JQ;const s=YQ(t),r=s?t.substring(s.length):t;if(!/[*?]/.test(r))return ZQ.bind(null,s??"=",r.toUpperCase());if(s&&s!=="="&&s!=="<>")throw new N(38);const n=qQ(r);return XQ.bind(null,s??"=",n)}var IS=(e,t,s)=>{if(!s||t===0||s.absolute)return;const{visibleCols:r,colModel:i}=e,n=r.allCols,o=MQ(i,n,s.id);if(o==null)return;const a=o+t;if(a<0)return;const l=IQ(n,a);l&&(s.id=l)},ES=(e,t,s,r)=>{if(!s||t===0||s.absolute)return;if(r){const a=Number(s.id);if(!Number.isFinite(a))return;s.id=String(a+t);return}const i=Fu(e,s.id);if(i==null)return;const n=i+t;if(n<1)return;const o=fS(e,n);o&&(s.id=o)},QQ=e=>!!e&&typeof e=="object"&&e!==null&&"row"in e&&"column"in e,DS=(e,t,s,r,i)=>{if(t.type==="operand"){const{value:n}=t;if(!QQ(n))return;const{row:o,column:a,endRow:l,endColumn:c}=n;ES(e,s,o,i),IS(e,r,a),ES(e,s,l,i),IS(e,r,c);return}if(t.type==="operation")for(const n of t.operands)DS(e,n,s,r,i)},eee=({values:e})=>{let t=0;for(const s of e)s!=null&&s!==""&&!Number.isNaN(Number(s))&&t++;return t},tee=({values:e})=>{let t=0;for(const s of e)s!=null&&s!==""&&t++;return t},see=({values:e})=>{let t=0;for(const s of e)(s==null||s==="")&&t++;return t},ree=({args:e})=>{const[t,s]=Ye(e,"COUNTIF",2);if(!Ru(t))throw new N(65);if(!PS(s))throw new N(66);const r=MS(s.value);let i=0;for(const n of t)r(n)&&i++;return i},iee=()=>new Date,nee=()=>{const e=new Date;return new Date(e.getFullYear(),e.getMonth(),e.getDate())},oee=({values:e})=>{const[t,s]=Ye(e,"EQUALS",2);return t===s},aee=({values:e})=>{const[t,s]=Ye(e,"NOT_EQUALS",2);return t!==s},lee=({values:e})=>{const[t,s]=Ye(e,"GT",2);return t>s},cee=({values:e})=>{const[t,s]=Ye(e,"GTE",2);return t>=s},uee=({values:e})=>{const[t,s]=Ye(e,"LT",2);return t<s},dee=({values:e})=>{const[t,s]=Ye(e,"LTE",2);return t<=s},hee=({values:e})=>{const[t,s,r]=Ye(e,"IF",3);return t?s:r},pee=({values:e})=>{let t=null;for(const s of e)s!=null&&(t===null||s<t)&&(t=s);if(t===null)throw new N(68);return t},gee=({values:e})=>{let t=null;for(const s of e)s!=null&&(t===null||s>t)&&(t=s);if(t===null)throw new N(69);return t};import{_isFiniteNumber as fee}from"ag-grid-community";var LS=1440*60*1e3;function mee(e){return e.getTime()/LS}function Do(e){return new Date(e*LS)}function nr(e){return e instanceof Date}function qe(e,t){if(typeof t=="bigint"){const s=Number(t);if(Number.isFinite(s))return s;throw new N(48,[e])}if(fee(t))return t;if(nr(t))return mee(t);if(typeof t=="boolean")return t?1:0;if(typeof t=="string"){const s=Number(t.trim());if(Number.isFinite(s))return s}throw new N(48,[e])}function or(e,t){return typeof t=="bigint"?t:qe(e,t)}function yt(e,t){if(typeof t=="bigint")return t;if(!Number.isFinite(t)||!Number.isInteger(t))throw new N(49,[e]);return BigInt(t)}var kS=({values:e})=>{let t=1,s=null;for(const r of ir(e)){const i=or("PRODUCT",r);if(typeof i=="bigint"){if(s??(s=yt("PRODUCT",t)),i===0n)return 0n;s*=i;continue}if(s!=null){s*=yt("PRODUCT",i);continue}if(i===0)return 0;t*=i}return s??t},vee=({values:e})=>{const[t,s]=Ye(ir(e),"DIVIDE",2),r=qe("DIV",t),i=qe("DIV",s);if(r==null||i==null)throw new N(54);if(i===0)throw new N(55);return r/i},Iu=({values:e})=>{let t=!1,s=0,r=null,i=!1;for(const n of ir(e)){t||(t=nr(n));const o=or("SUM",n);if(typeof o=="bigint"){if(t)throw new N(56);r??(r=yt("SUM",s)),r+=o,i=!0;continue}if(typeof r=="bigint"){if(t)throw new N(56);r+=yt("SUM",o),i=!0;continue}s+=o,i=!0}if(!i)throw new N(57);return typeof r=="bigint"?r:t?Do(s):s},Cee=({values:e})=>{const[t,s]=Ye(ir(e),"MINUS",2),r=nr(t),i=nr(s);if(r||i){const a=qe("MINUS",t),l=qe("MINUS",s);return r&&!i?Do(a-l):a-l}const n=or("MINUS",t),o=or("MINUS",s);return typeof n=="bigint"||typeof o=="bigint"?yt("MINUS",n)-yt("MINUS",o):n-o},bee=({values:e})=>{const[t]=Ye(e,"PERCENT",1),s=qe("PERCENT",t);if(s==null)throw new N(70);return s/100},_S=({values:e})=>{const[t,s]=Ye(e,"POWER",2),r=qe("POWER",t),i=qe("POWER",s);if(r==null||i==null)throw new N(71);return Math.pow(r,i)},See=({values:e})=>{const[t,s=0]=AS(e,"ROUND",1,2),r=qe("ROUND",t),i=Math.trunc(qe("ROUND",s)),n=Math.pow(10,i);return Math.round(r*n)/n},yee=({values:e})=>{let t=0,s=0,r=!0;for(const n of ir(e)){const o=qe("AVG",n);o!=null&&(t+=o,s++,r&&(r=nr(n)))}if(s===0)throw new N(58);const i=t/s;return r?Do(i):i},wee=({values:e})=>{let t=!0;const s=[];for(const n of ir(e)){const o=qe("MEDIAN",n);if(o==null)throw new N(59);s.push(o),t&&(t=nr(n))}if(s.length===0)throw new N(60);s.sort((n,o)=>n-o);const r=Math.floor(s.length/2),i=s.length%2===1?s[r]:(s[r-1]+s[r])/2;return t?Do(i):i},xee=()=>Math.random(),Fee=({args:e})=>{const[t,s,r]=AS(e,"SUMIF",2,3);if(!Ru(t))throw new N(61);if(!PS(s))throw new N(62);if(r&&!Ru(r))throw new N(63);const i=MS(s.value);if(!r){let d=0,h=null;for(const p of t)if(i(p)){const g=or("SUMIF",p);typeof g=="bigint"?(h??(h=yt("SUMIF",d)),h+=g):h!=null?h+=yt("SUMIF",g):d+=g}return h??d}const n=t.rowEnd-t.rowStart,o=r.rowEnd-r.rowStart;if(n!==o)throw new N(64);const a=t[Symbol.iterator](),l=r[Symbol.iterator]();let c=0,u=null;for(;;){const d=a.next(),h=l.next();if(d.done||h.done){if(d.done!==h.done)throw new N(64);break}if(i(d.value)){const p=or("SUMIF",h.value);typeof p=="bigint"?(u??(u=yt("SUMIF",c)),u+=p):u!=null?u+=yt("SUMIF",p):c+=p}}return u??c},Eu=({values:e})=>{let t="";for(const s of e)if(s!=null)switch(typeof s){case"string":{t+=s;break}case"number":{t+=String(s);break}case"boolean":{t+=s?"TRUE":"FALSE";break}case"object":{t+=s.toString();break}default:throw new N(67)}return t},GS={IF:hee,NOW:iee,TODAY:nee,PRODUCT:kS,SUM:Iu,ADD:Iu,SUMIF:Fee,POWER:_S,MIN:pee,MAX:gee,AVERAGE:yee,MEDIAN:wee,ROUND:See,COUNT:eee,COUNTA:tee,COUNTBLANK:see,COUNTIF:ree,RAND:xee,CONCAT:Eu,CONCATENATE:Eu,"+":Iu,"-":Cee,"*":kS,"/":vee,"^":_S,"%":bee,"=":oee,"&":Eu,"<>":aee,">":lee,">=":cee,"<":uee,"<=":dee},Du={suppressFlash:!0,force:!0},OS="ABCDEFGHIJKLMNOPQRSTUVWXYZ",Lu=OS.length,Tee=class extends lT{constructor(){super(...arguments),this.beanName="formula",this.valueCacheVersion=0,this.active=!1,this.cachedResult=new Map,this.activeCtx=null,this.colRefMap=new Map,this.colToRefMap=new Map,this.functionNames=null,this.formulaDataSvc=void 0,this.formulaColumnsPresent=!1,this.calculatedColumnsActive=!1,this.refreshedColDefsVersion=-1,this.activeChanged=!1}hasCachedRows(){return this.cachedResult.size>0}setFormulasActive(e){const t=this.beans.calculatedColsSvc?.isEnabled()===!0;let s=!1,r=!1;for(let u=0,d=e.length;u<d;++u){const h=e[u];if(h.allowFormula&&(s=!0),h.isCalculatedCol&&(r=!0),s&&(r||!t))break}const i=s||r;this.formulaColumnsPresent=i;const n=s&&this.checkForEditableFormulaIncompatibleServices(e),o=r&&this.checkForBaseIncompatibleServices(),a=this.beans.rowModel.getType()==="clientSide",l=n&&a,c=o;(l!==this.active||c!==this.calculatedColumnsActive)&&(this.active=l,this.calculatedColumnsActive=c,this.activeChanged=!0)}onColsRefreshed(){this.activeChanged&&(this.activeChanged=!1,this.refreshForCols())}refreshForCols(){this.rebuildColRefMap(),this.refreshFormulas(!0),this.refreshedColDefsVersion=this.beans.colModel.colDefsVersion}isEvaluationActive(){return this.active||this.calculatedColumnsActive}checkForBaseIncompatibleServices(){return this.gos.get("enableCellExpressions")?(this.warn(295,{blockedService:"Cell Expressions"}),!1):!0}checkForEditableFormulaIncompatibleServices(e){if(this.gos.get("masterDetail"))return this.warn(295,{blockedService:"Master Detail"}),!1;if(!this.checkForBaseIncompatibleServices())return!1;if(this.gos.get("treeData"))return this.warn(295,{blockedService:"Tree Data"}),!1;for(let t=0,s=e.length;t<s;++t){const r=e[t];if(r.isAllowPivot()||r.isPivotActive())return this.warn(295,{blockedService:"Column Pivoting"}),!1;if(r.isAllowRowGroup()||r.isRowGroupActive())return this.warn(295,{blockedService:"Row Groups"}),!1;if(r.isAllowValue()||r.isValueActive()||r.aggFunc)return this.warn(295,{blockedService:"Value Aggregation"}),!1}return!0}postConstruct(){this.setupFunctions(),this.formulaDataSvc=this.beans.formulaDataSvc;const e=o=>{this.onRowDataChanged(o.node)},t=o=>{this.onRowDataChanged(o.node)},s=()=>{this.isEvaluationActive()&&this.refreshedColDefsVersion!==this.beans.colModel.colDefsVersion&&this.refreshForCols()},r=()=>{this.isEvaluationActive()&&(this.rebuildColRefMap(),this.cachedResult.size!==0&&this.bumpValueCacheAndRefresh())},i=()=>{const o=this.cachedResult;if(!this.isEvaluationActive()||o.size===0)return;let a=!1;for(const l of o.keys())if(l.rowPinned){o.delete(l),a=!0;const c=l.sibling;c&&o.delete(c)}a&&this.beans.rowRenderer.refreshCells(Du)},n=()=>{this.beans.rowModel.getType()==="clientSide"||!this.isEvaluationActive()||this.refreshFormulas(!0)};this.addManagedPropertyListeners(["masterDetail","enableCellExpressions"],o=>{this.formulaColumnsPresent&&this.beans.colModel.refreshAll(nQ(o.source))}),this.addManagedListeners(this.beans.eventSvc,{cellValueChanged:e,rowNodeDataChanged:t,newColumnsLoaded:s,columnMoved:r,modelUpdated:n,storeUpdated:n,pinnedRowDataChanged:i,pinnedRowsChanged:i})}onRowDataChanged(e){!this.active&&!this.calculatedColumnsActive||e.rowPinned!=null&&e.pinnedSibling||(this.dropRow(e),this.bumpValueCacheAndRefresh(!1))}destroy(){this.active=!1,this.calculatedColumnsActive=!1,super.destroy(),this.cachedResult.clear(),this.colRefMap.clear(),this.colToRefMap.clear(),this.supportedOperations.clear(),this.functionNames=null,this.activeCtx=null,this.formulaDataSvc=void 0}dropRow(e){const t=this.cachedResult;let s=t.delete(e);const r=e.sibling;if(r){t.delete(r)&&(s=!0);const n=r.pinnedSibling;n&&t.delete(n)&&(s=!0)}const i=e.pinnedSibling;return i&&t.delete(i)&&(s=!0),s}onRowsChanged(e,t){if(!this.active&&!this.calculatedColumnsActive)return;if(t){this.refreshFormulas(!0);return}let s=!0;if(e){const{adds:r,removals:i,updates:n,reordered:o}=e;for(const a of i)this.dropRow(a);for(const a of n)this.dropRow(a);s=o||i.length>0||r.size>0||n.size>0}s&&this.bumpValueCacheAndRefresh()}bumpValueCacheAndRefresh(e=!0){this.valueCacheVersion++,this.beans.rowRenderer.refreshCells(e?Du:void 0)}updateFormulaByOffset(e){const{value:t,rowDelta:s=0,columnDelta:r=0,useRefFormat:i=!0}=e,n=this.beans;try{const o=!i,a=wi(n,t,o);return DS(n,a,s,r,o),SS(n,a,i,o)}catch{return t}}setupFunctions(){const e=this.supportedOperations=new Map,t=Object.keys(GS);for(let r=0,i=t.length;r<i;++r){const n=t[r];e.set(n,GS[n])}this.functionNames=null;const s=this.gos.get("formulaFuncs");if(s){const r=Object.keys(s);for(let i=0,n=r.length;i<n;++i){const o=r[i];e.set(o.toUpperCase(),s[o].func)}}}getFunctionNames(){return this.functionNames??this.buildFunctionNames()}buildFunctionNames(){const e=this.supportedOperations,t=[];for(const s of e.keys())fJ(s)&&t.push(s);return t.sort((s,r)=>s.localeCompare(r)),this.functionNames=t,t}rebuildColRefMap(){const{beans:e,colRefMap:t,colToRefMap:s}=this;if(t.clear(),s.clear(),!this.isEvaluationActive())return;const r=e.colModel.colsList;if(!r)return;let i=0;for(let n=0,o=r.length;n<o;++n){const a=r[n];if(!a.primary)continue;let l="",c=i++;for(;l=OS[c%Lu]+l,!(c<Lu);)c=Math.floor(c/Lu)-1;a.formulaRef!==l&&(a.formulaRef=l,a.dispatchColEvent("formulaRefChanged","api")),t.set(l,a),s.set(a,l)}}getColByRef(e){return this.colRefMap.get(e.toUpperCase())??null}getColRef(e){return this.colToRefMap.get(e)??null}refreshFormulas(e){this.cachedResult.clear(),e&&this.beans.rowRenderer.refreshCells(Du)}refreshRow(e){if(!this.active&&!this.calculatedColumnsActive)return!1;let t=!1;if(typeof e=="string"){const{rowModel:s,pinnedRowModel:r}=this.beans,i=s.getRowNode(e);i&&this.dropRow(i)&&(t=!0);const n=r?.getPinnedRowById(e,"top");n&&this.dropRow(n)&&(t=!0);const o=r?.getPinnedRowById(e,"bottom");o&&this.dropRow(o)&&(t=!0)}else t=this.dropRow(e);return t&&this.bumpValueCacheAndRefresh(),t}isFormula(e){return this.active&&gu(e)}normaliseFormula(e,t=!1){const s=this.beans;try{return SS(s,wi(s,e),!t,!1)}catch{return null}}validateExpression(e){try{const t=wi(this.beans,e,!0),s=Su(t,r=>!!this.getFunction(r));return s?new N(27,[s]):null}catch(t){return t instanceof N?t:new N(1)}}getDataSourceFormula(e,t){if(!this.active||!this.formulaDataSvc?.hasDataSource())return;const s=this.ensureCellFormula(e,t);return s?.fromDataSource?s.formulaString:void 0}getFormulaError(e,t){const s=this.ensureCellFormula(t,e);if(!s)return null;s.isValueReady()||this.resolveValue(e,t);const r=s.errorType;if(!r)return null;const i=s.errorId;return i!=null?new N(i,s.errorVariableValues??void 0,r):new N(s.errorMessage,r)}isFormulaErrorValue(e,t,s){if(!(e.allowFormula||e.isCalculatedCol)||typeof s!="string"||!t)return!1;const r=this.cachedResult.get(t)?.get(e);return!!r&&r.isValueReady()&&r.errorType===s}getFunction(e){const t=this.supportedOperations;return t.get(e)??t.get(e.toUpperCase())}ensureCellFormula(e,t){const s=this.active,r=this.calculatedColumnsActive;if(s&&t.allowFormula){if(!r)return this.ensureEditableCellFormula(e,t);const n=t.calculatedExpression;return n===void 0?this.ensureEditableCellFormula(e,t):this.ensureCalculatedCellFormula(e,t,n??"")}if(!r)return null;const i=t.calculatedExpression;return i===void 0?null:this.ensureCalculatedCellFormula(e,t,i??"")}ensureEditableCellFormula(e,t){const s=this.cachedResult;let r=s.get(e);const i=r?.get(t);if(i!==void 0)return i;r||(r=new Map,s.set(e,r)),r.set(t,null);try{const n=this.formulaDataSvc,o=n?.hasDataSource()?n.getFormula({column:t,rowNode:e}):void 0;if(gu(o)){const l=new Mo(e,t,o,!0,this.beans,this);return r.set(t,l),l}const a=this.fetchRawValue(t,e);if(gu(a)){const l=new Mo(e,t,a,!1,this.beans,this);return r.set(t,l),l}return null}catch(n){throw r.delete(t),n}}ensureCalculatedCellFormula(e,t,s){if(e.stub||e.failedLoad||t.aggregationActive&&e.group||!e.data)return null;const r=this.cachedResult;let i=r.get(e);const n=i?.get(t);if(n!==void 0)return n;i||(i=new Map,r.set(e,i)),i.set(t,null);try{const o=s.trim();if(!o)return null;const a=o.startsWith("=")?o:`=${s}`,l=new Mo(e,t,a,!1,this.beans,this);return i.set(t,l),l}catch(o){throw i.delete(t),o}}coerceFormulaValue(e,t){let s=e.baseDataType;if(s===void 0&&(s=this.beans.dataTypeSvc?.getBaseDataType(e.column)??null,e.baseDataType=s),s==="bigint")return rQ(t)??t;if(s==="number"&&typeof t=="bigint"){const r=Number(t);return Number.isFinite(r)?r:t}return t}fetchRawValue(e,t){if(e.isCalculatedCol)return e.calculatedExpression?.trim()?void 0:"";const s=this.beans.valueSvc,r=e.pivotValueColumn;return r&&!t.group&&!t.rowPinned?this.leafInPivotBucket(e,t)?s.getValueFromData(r,t):void 0:s.getValueFromData(e,t)}leafInPivotBucket(e,t){const s=this.beans,r=s.pivotColsSvc?.columns,i=e.colDef.pivotKeys;if(!r||!i)return!1;const n=s.valueSvc;for(let o=0,a=i.length;o<a;++o){const l=r[o];if(!l||n.getKeyForNode(l,t)!==i[o])return!1}return!0}resolveAddrRef(e){const{row:t,column:s}=e,r=this.ensureCellFormula(t,s);if(r){if(!r.isValueReady())throw new N(53);if(r.errorType)throw r;return r.getValue()}return this.fetchRawValue(s,t)}makeFormulaFrame(e){const t=e.column.isCalculatedCol&&this.beans.calculatedColsSvc?.getExpressionError(e.column);if(t)throw t.reason==="customValidation"?new N(t.messages.join("; "),"#ERROR!"):new N(qb(this.getLocaleTextFunc(),t.reference),"#REF!");const r=this.ensureCellFormula(e.row,e.column).getAst();if(!r)throw new N(52);const i=KQ(this.beans,r,this,e);return{address:e,ast:r,unresolvedDepIterator:i}}resolveValue(e,t){const s=this.ensureCellFormula(t,e);if(!s)return this.fetchRawValue(e,t);if(s.isValueReady())return s.getValue();const r=this.activeCtx,i=r??(this.activeCtx=new Map),n=[];try{for(yS(i,t,e),n.push(this.makeFormulaFrame({row:t,column:e}));n.length;){const{address:o,ast:a,unresolvedDepIterator:l}=n[n.length-1],{row:c,column:u}=o,d=this.ensureCellFormula(c,u);if(d.isValueReady()){if(n.pop(),Au(i,c,u),d.errorType)throw d;continue}const h=l.next();if(!h.done){const f=h.value,m=this.ensureCellFormula(f.row,f.column);if(!m||m.isValueReady())continue;yS(i,f.row,f.column),n.push(this.makeFormulaFrame(f));continue}const p=xS(this.beans,a,this,o),g=this.coerceFormulaValue(d,p);if(d.errorType&&d.isValueReady())throw Au(i,c,u),d;d.setComputedValue(g),Au(i,c,u),n.pop()}if(!s.isValueReady())throw new N(53);return s.getValue()}catch(o){return this.errorAllVisitors(i,o)}finally{r||(this.activeCtx=null)}}errorAllVisitors(e,t){let s="#ERROR!",r=null,i,n=null;return t instanceof Mo?(s=t.errorType??"#ERROR!",r=t.errorId,i=t.errorMessage,n=t.errorVariableValues):t instanceof N?(s=t.type,r=t.errorId,i=t.message,n=t.variableValues??null):i=String(t?.message??t),e.forEach((o,a)=>{for(const l of o)this.ensureCellFormula(a,l)?.setErrorFields(s,r,i,n)}),s}},ku={moduleName:"Formula",version:_,userComponents:{agFormulaCellEditor:YJ},beans:[Tee,eQ,sQ],apiFunctions:{refreshFormulas:ZJ},dependsOn:[zc],css:[qJ]};import{_PopupModule as Aee}from"ag-grid-community";var Pee='.ag-has-cell-notes:after{background-color:transparent;border-radius:0;border-style:solid;content:"";pointer-events:none;position:absolute;top:0}:where(.ag-ltr) .ag-has-cell-notes:after{border-color:transparent var(--ag-note-indicator-color) transparent transparent;border-width:0 var(--ag-note-indicator-size) var(--ag-note-indicator-size) 0;right:0}:where(.ag-rtl) .ag-has-cell-notes:after{border-color:transparent transparent transparent var(--ag-note-indicator-color);border-width:0 0 var(--ag-note-indicator-size) var(--ag-note-indicator-size);left:0}:where(.ag-ltr,.ag-rtl) .ag-has-cell-notes:after{inset-inline-start:auto}.ag-notes-panel.ag-panel{background-color:var(--ag-note-popup-background-color);border:var(--ag-note-popup-border);width:100%}.ag-notes-panel-content-wrapper,.ag-notes-popup-content{min-height:0;min-width:0}.ag-notes-popup-content{display:flex;flex-direction:column;gap:calc(var(--ag-spacing)/2);height:100%;padding:var(--ag-note-popup-padding);width:100%}.ag-notes-popup-meta{color:var(--ag-note-popup-text-color);font-size:calc(var(--ag-font-size) - 1px)}:where(.ag-ltr) .ag-notes-popup-meta{padding-left:calc(var(--ag-spacing)/2)}:where(.ag-rtl) .ag-notes-popup-meta{padding-right:calc(var(--ag-spacing)/2)}.ag-notes-popup-body{display:flex;flex:1 1 auto;min-height:0;min-width:0}.ag-notes-popup-editor{display:flex;flex:1 1 auto;height:100%;min-width:0;width:100%}.ag-notes-popup-editor :where(.ag-text-area-input-wrapper){align-items:stretch;flex:1 1 auto;height:100%;min-width:0;width:100%}.ag-notes-popup-editor .ag-text-area-input{background-color:var(--ag-note-popup-input-background-color);color:var(--ag-note-popup-input-text-color);flex:1 1 auto;height:100%;min-width:0;padding:calc(var(--ag-spacing)/2);resize:none;width:100%}.ag-notes-popup-editor .ag-text-area-input[readonly]{background-color:var(--ag-note-popup-background-color);border:none}.ag-notes-popup-read-only :where(.ag-text-area-input-wrapper){background-color:var(--ag-input-disabled-background-color)}';function Ree(e,t){return e.notesSvc?.getNote(t)}function Mee(e,t){e.notesSvc?.setNote(t)}function Iee(e,t){e.notesSvc?.refreshNotes(t)}import{BeanStub as Eee,_addGridCommonParams as Dee}from"ag-grid-community";function He(e){return e.location==="fullWidthRow"}function Lo(e){if(!(!e||typeof e.text!="string"||!e.text.trim()))return{...e}}var Lee=class extends cT{constructor(){super(...arguments),this.beanName="notesDataSvc"}postConstruct(){this.setDataSource(this.gos.get("notesDataSource")),this.addManagedPropertyListener("notesDataSource",({currentValue:e})=>{this.setDataSource(e),this.beans.notesSvc?.onDataSourceChanged()})}hasDataSource(){return!!this.dataSource}supportsFullWidthRows(){return this.isFullWidthDataSource(this.dataSource)}getNote(e){const{dataSource:t}=this;if(He(e))return Lo(this.isFullWidthDataSource(t)?t.getNote(e):void 0);const s=this.beans.colModel.getCol(e.column);if(s)return Lo(t?.getNote({...e,column:s}))}setNote(e){const{dataSource:t}=this,s=Lo(e.note);if(He(e)){this.isFullWidthDataSource(t)&&t.setNote({...e,note:s});return}const r=this.beans.colModel.getCol(e.column);r&&t?.setNote({...e,column:r,note:s})}setDataSource(e){this.dataSource!==e&&(this.dataSource?.destroy?.(),this.dataSource=e,e?.init?.(this.createInitParams()))}createInitParams(){return Dee(this.gos,{})}isFullWidthDataSource(e){return!e||!("supportsFullWidthRows"in e)?!1:e.supportsFullWidthRows===!0}destroy(){this.dataSource?.destroy?.(),super.destroy()}};import{BeanStub as kee}from"ag-grid-community";import{_interpretAsRightClick as _ee,_isStopPropagationForAgGrid as Gee}from"ag-grid-community";import{RefPlaceholder as NS,_computeAlignedPosition as Oee,_findBestPlacement as Nee,_fitsWithinBounds as Bee,_getActiveDomElement as Vee,_getEffectivePlacements as Hee,_getRectSize as Uee,_setDisplayed as zee,_toRelativeRect as Wee}from"ag-stack";import{AgInputTextAreaSelector as Kee,BeanStub as $ee,Component as jee,KeyCode as Yee}from"ag-grid-community";var BS={width:290,height:150,minWidth:240,minHeight:150},qee=["tl-tr","tr-br","br-tr","tr-tl","br-tl"],Zee=["tl-tr","tr-br","br-tr"],Xee={tag:"div",cls:"ag-notes-popup-content",children:[{tag:"div",ref:"eMeta",cls:"ag-notes-popup-meta"},{tag:"div",cls:"ag-notes-popup-body",children:[{tag:"ag-input-text-area",ref:"eEditor",cls:"ag-notes-popup-editor"}]}]},Jee=class extends uT{constructor(e,t){super(Xee,[Kee]),this.note=e,this.readOnly=t,this.eMeta=NS,this.eEditor=NS,this.initialText=e?.text.trim()??""}postConstruct(){const e=this.getLocaleTextFunc(),t=this.note?.author?.trim(),s=this.note?.updatedAt?.trim()||this.note?.createdAt?.trim(),r=[t,s].filter(n=>!!n);this.eMeta.textContent=r.join(" \xB7 "),zee(this.eMeta,!!r.length),this.eEditor.setInputPlaceholder(this.readOnly?void 0:e("notePlaceholder","Add a note...")).setRows(8).setValue(this.note?.text??"",!0).setInputAriaLabel(e("ariaInputEditor","Input Editor"));const i=this.eEditor.getInputElement();i.setAttribute("title",""),i.readOnly=this.readOnly}focusEditor(){this.eEditor.getFocusableElement().focus();const t=this.eEditor.getInputElement(),s=t.value.length;t.setSelectionRange(s,s)}getEditedNote(){return Qee(this.note,this.eEditor.getValue())}isDirty(){return this.readOnly?!1:(this.eEditor.getValue()?.trim()??"")!==this.initialText}};function Qee(e,t){const s=t?.trim();if(s)return{...e,text:s}}var ete=class extends dT{constructor(e){super(),this.params=e,this.saveOnClose=!0,this.closed=!1}postConstruct(){const e=Lo(this.params.note),t=this.createManagedBean(new Jee(e,!!this.params.readOnly));this.contentComp=t;const{x:s,y:r}=this.computeInitialPosition(),i=this.createManagedBean(new ms({...BS,modal:!0,resizable:!0,movable:!1,closable:!1,hideTitleBar:!0,cssIdentifier:"notes",x:s,y:r,closedCallback:a=>this.onDialogClosed(a)}));this.dialog=i,i.setBodyComponent(t);const n=i.getGui(),o=this.getLocaleTextFunc();n.classList.add("ag-notes-popup"),n.classList.toggle("ag-notes-popup-read-only",!!this.params.readOnly),n.setAttribute("aria-label",o("note","Note")),this.addManagedElementListeners(n,{keydown:a=>{a.key===Yee.TAB&&a.preventDefault()},pointerenter:()=>this.params.onPopupEnter(),pointerout:a=>this.onPotentialLeave(a.relatedTarget,!0),focusout:a=>{i.isResizing||this.onPotentialLeave(a.relatedTarget,!1)}}),this.params.focusEditor&&t.focusEditor()}hide(e=!0){this.saveOnClose=e,this.dialog?.close()}focusEditor(){this.contentComp?.focusEditor()}hasFocus(){return!!this.dialog?.getGui().contains(Vee(this.beans))}onPotentialLeave(e,t){const s=this.dialog?.getGui();s&&(e&&s.contains(e)||t&&this.hasFocus()||this.params.onPopupLeave())}computeInitialPosition(){return tte({anchorRect:this.params.anchorToElement.getBoundingClientRect(),parentRect:this.beans.popupSvc.getParentRect(),popupSize:BS,placementMode:this.params.placementMode,enableRtl:this.gos.get("enableRtl")})}onDialogClosed(e){this.closed||(this.closed=!0,this.notifyClosed(e))}destroy(){this.closed||(this.closed=!0,this.notifyClosed()),super.destroy()}notifyClosed(e){const t=this.saveOnClose&&(this.contentComp?.isDirty()??!1),s=t?this.contentComp?.getEditedNote():void 0;this.params.onClosed(t,s,e)}};function tte(e){const{anchorRect:t,parentRect:s,popupSize:r,placementMode:i,enableRtl:n}=e,o=Wee(t,s),a=Uee(s),l=i==="fullWidthRow"?Zee:qee,c=Hee(l,n);for(const u of c){const d=Oee(o,r,u,0);if((u==="tl-tr"||u==="tr-tl")&&(d.y-=1),Bee(d,r,a))return d}return Nee(o,r,a,[...l.slice(1),l[0]],{gap:0,enableRtl:n})}var VS="ag-has-cell-notes",HS=class{constructor(e,t){this.beans=e,this.notesSvc=t,this.showTimer=0,this.hideTimer=0,this.suppressHoverUntilPointerLeave=!1,this.preserveActivePopupOwnerOnClose=!1}refresh(){if(this.refreshHasNotesStyling(),!this.activeTarget)return;const{canView:e,canCreate:t}=this.notesSvc.getNoteAccess(this.activeTarget.noteParams)??{};!e&&!t&&this.closeNotePopup(!1)}show(e){const t=this.getTarget(e?.pinned);t&&this.openPopup(t,e?.focusEditor)}hide(e=!0){this.closeNotePopup(e)}closeNotePopup(e=!0){this.clearShowTimer(),this.cancelHide(),this.popup?.hide(e)}destroy(){this.closeNotePopup(!1)}getNoteTrigger(){return this.beans.gos.get("noteTrigger")==="click"?"click":"hover"}onPointerEnter(e,t){if(t.pointerType!=="mouse"||this.suppressHoverUntilPointerLeave)return;if(this.getNoteTrigger()!=="hover"){e&&this.matchesActiveTarget(e)&&this.cancelHide();return}const s=e&&this.notesSvc.getNoteAccess(e.noteParams);if(this.cancelHide(),!e||!s?.canView||this.matchesActiveTarget(e))return;this.clearShowTimer();const r=this.notesSvc.getHoverGeneration();this.showTimer=window.setTimeout(()=>{r===this.notesSvc.getHoverGeneration()&&this.openPopup(e)},this.beans.gos.get("noteShowDelay"))}onPointerLeave(e){e.pointerType==="mouse"&&(this.suppressHoverUntilPointerLeave=!1,this.clearShowTimer(),!this.popup?.hasFocus()&&this.scheduleHide())}onContextMenu(){this.suppressHoverUntilPointerLeave=!0,this.closeNotePopup()}onClick(e,t){if(this.getNoteTrigger()!=="click"||Gee(t)||_ee(this.beans,t))return;const s=e&&this.notesSvc.getNoteAccess(e.noteParams);!e||!s?.canView||(this.suppressHoverUntilPointerLeave=!1,this.openPopup(e))}openPopup(e,t=!1){const s=this.notesSvc.getNoteAccess(e.noteParams);if(!s||!s.canView&&!(t&&s.canCreate))return;if(this.cancelHide(),this.clearShowTimer(),this.matchesActiveTarget(e)&&this.popup){t&&this.popup.focusEditor();return}const r=this.notesSvc.replaceActivePopupOwner(this);r?r.closeNotePopup():this.popup&&(this.preserveActivePopupOwnerOnClose=!0,this.closeNotePopup());const i=this.beans.context.createBean(new ete({note:s.note??{text:""},readOnly:s.canView&&!s.canEdit,anchorToElement:e.anchorElement,placementMode:He(e.noteParams)?"fullWidthRow":"cell",focusEditor:t,onClosed:(n,o,a)=>this.onPopupClosed(n,o,a),onPopupEnter:()=>this.cancelHide(),onPopupLeave:()=>this.scheduleHide()}));this.popup=i,this.activeTarget=e}onPopupClosed(e,t,s){const r=this.activeTarget,i=this.popup,n=this.preserveActivePopupOwnerOnClose;this.popup=void 0,this.activeTarget=void 0,this.preserveActivePopupOwnerOnClose=!1,n||this.notesSvc.clearActivePopupOwner(this),i&&this.beans.context.destroyBean(i),r&&s instanceof KeyboardEvent&&s.key==="Escape"&&this.beans.focusSvc.setFocusedCell({rowIndex:r.rowNode.rowIndex,rowPinned:r.rowNode.rowPinned,column:r.focusColumn,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!0,sourceEvent:s}),!(!e||!r)&&this.notesSvc.setNote({...r.noteParams,note:t,previousNote:this.notesSvc.getNoteAccess(r.noteParams)?.note,source:"ui"})}matchesActiveTarget(e){return ite(this.activeTarget?.noteParams,e.noteParams)}scheduleHide(){this.cancelHide(),this.hideTimer=window.setTimeout(()=>this.closeNotePopup(),this.beans.gos.get("noteHideDelay"))}cancelHide(){this.hideTimer&&(window.clearTimeout(this.hideTimer),this.hideTimer=0)}clearShowTimer(){this.showTimer&&(window.clearTimeout(this.showTimer),this.showTimer=0)}},ste=class extends HS{constructor(e,t,s,r){super(e,r),this.ctrl=t,this.compBean=s}refresh(){this.ctrl.isNoteHoverSuppressed()&&this.clearShowTimer(),super.refresh()}initialise(){this.compBean.addManagedElementListeners(this.ctrl.eGui,{pointerenter:e=>{this.ctrl.isNoteHoverSuppressed()||this.onPointerEnter(this.getTarget(),e)},pointerleave:e=>this.onPointerLeave(e),click:e=>{this.ctrl.isNoteHoverSuppressed()||this.onClick(this.getTarget(),e)},contextmenu:()=>this.onContextMenu()}),this.refresh()}refreshHasNotesStyling(){const e=!!this.notesSvc.getNoteAccess(this.getPosition())?.note;this.ctrl.comp.toggleCss(VS,e&&!this.ctrl.isNoteHoverSuppressed())}getPosition(){return{rowNode:this.ctrl.rowNode,column:this.ctrl.column}}getTarget(){return{noteParams:this.getPosition(),rowNode:this.ctrl.rowNode,focusColumn:this.ctrl.column,anchorElement:this.ctrl.eGui}}},rte=class extends HS{constructor(e,t,s){super(e,s),this.ctrl=t}initialise(){for(const e of this.ctrl.getTargets())e.compBean.addManagedListeners(e.element,{pointerenter:t=>this.onPointerEnter(this.getTargetForElement(t.target),t),pointerleave:t=>this.onPointerLeave(t),click:t=>this.onClick(this.getTargetForElement(t.target),t),contextmenu:()=>this.onContextMenu()});this.refresh()}refreshHasNotesStyling(){if(this.ctrl.isFullWidth())for(const e of this.ctrl.getTargets()){const t=this.getNoteParamsForTarget(e),s=!!this.notesSvc.getNoteAccess(t)?.note;e.element.classList.toggle(VS,s)}}getNoteParamsForTarget(e){const t=e.pinned==="left"||e.pinned==="right"?e.pinned:void 0;return{rowNode:this.ctrl.rowNode,location:"fullWidthRow",pinned:t}}getTargetForElement(e){const t=this.ctrl.getTarget(e);if(t)return this.getNoteTargetForFullWidthTarget(t)}getNoteTargetForFullWidthTarget(e){return{noteParams:this.getNoteParamsForTarget(e),rowNode:this.ctrl.rowNode,focusColumn:e.column,anchorElement:e.element}}getTarget(e){let t,s;for(const r of this.ctrl.getTargets()){if(t)break;const i=this.getNoteTargetForFullWidthTarget(r);s??(s=i),(r.pinned==="left"||r.pinned==="right"?r.pinned:void 0)===e&&(t=i)}return t??s}};function ite(e,t){return!e||!t?e===t:He(e)||He(t)?He(e)&&He(t)&&e.rowNode===t.rowNode&&e.pinned===t.pinned:e.rowNode===t.rowNode&&e.column===t.column}var nte=class extends hT{constructor(){super(...arguments),this.beanName="notesSvc",this.hoverGeneration=0}postConstruct(){this.addManagedListeners(this.beans.eventSvc,{bodyScroll:()=>this.resetActivePopupState()})}hasDataSource(){return!!this.beans.notesDataSvc?.hasDataSource()}onDataSourceChanged(){this.resetActivePopupState(!1),this.beans.rowRenderer.redrawRows()}getHoverGeneration(){return this.hoverGeneration}createNotesFeature(e,t){if(!this.hasDataSource())return;const s=new ste(this.beans,e,t,this);return s.initialise(),s}createFullWidthNotesFeature(e){if(!this.hasDataSource()||!this.beans.notesDataSvc?.supportsFullWidthRows())return;const t=new rte(this.beans,e,this);return t.initialise(),t}getNoteAccess(e){const{colModel:t,notesDataSvc:s}=this.beans;if(!this.hasDataSource()||He(e)&&!s.supportsFullWidthRows())return;He(e)&&e.pinned&&!this.gos.get("embedFullWidthRows")&&(e={...e,pinned:void 0});const r=He(e)?this.getColumnForFullWidth(e.pinned):t.getCol(e.column),i=s.getNote(e);if(!r)return;const n=r.isColumnFunc(e.rowNode,r.colDef.suppressNoteActions??null),o=!!i?.readOnly;return{params:e,rowNode:e.rowNode,column:r,note:i,isReadOnly:o,isSuppressed:n,canView:!!i,canCreate:!i&&!n,canEdit:!!i&&!n&&!o,canDelete:!!i&&!n&&!o}}getNote(e){return this.getNoteAccess(e)?.note}replaceActivePopupOwner(e){const t=this.activePopupOwner;if(t!==e)return this.activePopupOwner=e,t}clearActivePopupOwner(e){this.activePopupOwner===e&&(this.activePopupOwner=void 0)}resetActivePopupState(e=!0){this.hoverGeneration++,this.activePopupOwner?.closeNotePopup(e)}getMenuItems(e){const t=this.getNoteAccess(e);if(!t)return[];const s=this.getLocaleTextFunc(),r=s("shiftF2","Shift+F2"),i=()=>this.showNote(t.params,!0),n=[];if(!t.note)return n.push({name:s("addNote","Add Note"),shortcut:r,disabled:!t.canCreate,action:t.canCreate?i:void 0}),n;const o=t.isReadOnly||t.isSuppressed;return t.canView&&o&&n.push({name:s("viewNote","View Note"),shortcut:r,action:i}),o||n.push({name:s("editNote","Edit Note"),shortcut:r,disabled:!t.canEdit,action:t.canEdit?i:void 0}),n.push({name:s("deleteNote","Remove Note"),disabled:!t.canDelete,action:t.canDelete?()=>this.setNote({...t.params,note:void 0}):void 0}),n}showNote(e,t=!1){const s=this.getNoteAccess(e);if(!s||!s.canView&&!(t&&s.canCreate))return!1;const{rowRenderer:r}=this.beans;if(He(s.params)){const o=r.getRowCtrlByNode(e.rowNode)?.getNotesFeature();return o?(o.show({pinned:s.params.pinned,focusEditor:t}),!0):!1}const i=r.getCellCtrls([e.rowNode],[s.column])[0];return i?(i.showNote(t),!0):!1}setNote(e){const{notesDataSvc:t}=this.beans;if(!this.hasDataSource())return;const s=this.getNoteAccess(e);if(!s)return;const{note:r}=e,i=e.previousNote??s.note,n=e.source??"api";!r&&!i||n==="ui"&&(s.isSuppressed||i?.readOnly)||(n==="api"&&this.activePopupOwner?.closeNotePopup(!1),t.setNote(He(s.params)?{...s.params,note:r}:{rowNode:s.rowNode,column:s.column,note:r}),this.refreshNotes(He(s.params)?{rowNodes:[e.rowNode]}:{rowNodes:[e.rowNode],columns:[s.column]}))}refreshNotes(e={}){const{rowRenderer:t}=this.beans;t.refreshCells({rowNodes:e.rowNodes,columns:e.columns,force:!0,suppressFlash:!0});const s=e.rowNodes,r=s?new Set(s):void 0;for(const i of t.getAllRowCtrls())i.isFullWidth()&&(r&&!r.has(i.rowNode)||i.refreshRow({force:!0,suppressFlash:!0}))}getColumnForFullWidth(e){const{visibleCols:t}=this.beans;switch(e){case"left":return t.leftCols[0];case"right":return t.rightCols[0];default:return t.centerCols[0]??t.allCols[0]}}},US={moduleName:"Notes",version:_,beans:[Lee,nte],apiFunctions:{getNote:Ree,setNote:Mee,refreshNotes:Iee},dependsOn:[$,Aee],css:[Pee]};import{_PopupModule as ote}from"ag-grid-community";var ate=".ag-column-header-edit-popup-content{box-sizing:border-box;display:flex;flex:1 1 auto;flex-direction:column;gap:calc(var(--ag-spacing)*2);min-width:0;padding:calc(var(--ag-spacing)*2)}.ag-column-header-edit-popup-editor{flex:1 1 auto}.ag-column-header-edit-popup-actions{display:flex;gap:var(--ag-widget-horizontal-spacing);justify-content:flex-end}.ag-column-header-edit-highlighted{background-color:var(--ag-column-header-edit-highlight-color)}";import{BeanStub as lte,_createIconNoSpan as cte,_dispatchGroupHeaderNameChangedEvent as ute,_setColGroupHeaderNameOverride as dte,isProvidedColumnGroup as xi}from"ag-grid-community";import{RefPlaceholder as ko,_getActiveDomElement as zS,_isNothingFocused as hte,_setDisplayed as pte}from"ag-stack";import{AgInputTextFieldSelector as gte,BeanStub as fte,Component as mte,KeyCode as WS}from"ag-grid-community";var vte=300,Cte=300,bte={tag:"div",cls:"ag-column-header-edit-popup-content",children:[{tag:"ag-input-text-field",ref:"eEditor",cls:"ag-column-header-edit-popup-editor"},{tag:"div",ref:"eActions",cls:"ag-column-header-edit-popup-actions",children:[{tag:"button",ref:"eApply",cls:"ag-button ag-standard-button ag-column-header-edit-action ag-column-header-edit-action-apply"},{tag:"button",ref:"eCancel",cls:"ag-button ag-standard-button ag-column-header-edit-action"}]}]},Ste=class extends pT{constructor(e,t,s,r,i){super(bte,[gte]),this.initialValue=e,this.liveApply=t,this.onValueChange=s,this.onApply=r,this.onCancel=i,this.eEditor=ko,this.eActions=ko,this.eApply=ko,this.eCancel=ko}postConstruct(){const e=this.getLocaleTextFunc();this.eEditor.setValue(this.initialValue,!0).setInputAriaLabel(e("ariaColumnHeaderNameEditor","Column Name Editor")),pte(this.eActions,!this.liveApply),this.liveApply?this.eEditor.onValueChange(t=>this.onValueChange(t??"")):(this.eApply.textContent=e("columnHeaderEditApply","Apply"),this.eCancel.textContent=e("columnHeaderEditCancel","Cancel"),this.eApply.type="button",this.eCancel.type="button",this.addManagedElementListeners(this.eApply,{click:()=>this.onApply()}),this.addManagedElementListeners(this.eCancel,{click:()=>this.onCancel()}))}focusEditor(){const e=this.eEditor.getInputElement();e.focus(),e.select()}isEditorElement(e){return e===this.eEditor.getInputElement()}getValue(){return this.eEditor.getValue()??""}setValue(e){this.eEditor.setValue(e,!0)}},yte=class extends gT{constructor(e){super(),this.params=e,this.closed=!1,this.restoreFocusEl=null}postConstruct(){const{liveApply:e}=this.params,t=this.createManagedBean(new Ste(this.params.initialValue,e,i=>this.params.onApply(i),()=>this.commit(),()=>this.close()));this.contentComp=t;const s=this.getLocaleTextFunc(),r=this.createManagedBean(new ms({width:vte,minWidth:Cte,minHeight:0,title:s("editColumnName","Edit Column Name"),component:t,closable:!0,centered:!0,movable:!0,resizable:!1,modal:!1,alwaysOnTop:!0,cssIdentifier:"column-header-edit",closedCallback:()=>this.onDialogClosed()}));this.dialog=r,this.addManagedElementListeners(r.getGui(),{keydown:i=>{if(i.key===WS.ENTER){if(!t.isEditorElement(i.target))return;i.preventDefault(),e?this.close():this.commit()}else i.key===WS.ESCAPE&&this.close()}}),this.focusEditorTimeout=window.setTimeout(()=>{this.focusEditorTimeout=void 0,this.restoreFocusEl=zS(this.beans),t.focusEditor()})}commit(){this.params.onApply(this.contentComp?.getValue()??""),this.close()}close(){this.dialog?.close()}setValue(e){this.contentComp?.setValue(e)}getValue(){return this.contentComp?.getValue()??""}onDialogClosed(){this.closed||(this.closed=!0,this.restoreFocus(),this.params.onClosed())}restoreFocus(){const e=this.restoreFocusEl;if(this.restoreFocusEl=null,!e?.isConnected)return;const t=zS(this.beans);(hte(this.beans,t)||this.dialog?.getGui().contains(t))&&e.focus()}destroy(){this.focusEditorTimeout!=null&&(window.clearTimeout(this.focusEditorTimeout),this.focusEditorTimeout=void 0),this.closed||(this.closed=!0,this.restoreFocus(),this.params.onClosed()),super.destroy()}},wte=class extends fT{constructor(){super(...arguments),this.beanName="colHeaderEditSvc",this.activePopup=null,this.removePopupColListener=null,this.editingTarget=null}getOptions(){const e=this.gos.get("columnHeaderEdit");return typeof e=="object"&&e!=null?e:void 0}isLiveApplyMode(){return this.getOptions()?.applyMode!=="deferred"}isHighlightSuppressed(){return this.getOptions()?.suppressColumnHighlighting===!0}isHighlightedColumn(e){return!this.isHighlightSuppressed()&&this.editingTarget===e}isHighlightedGroup(e){return!this.isHighlightSuppressed()&&this.editingTarget===e}setEditingTarget(e){const t=this.editingTarget;this.editingTarget=e,this.dispatchHighlightChanged(t),e&&e!==t&&this.dispatchHighlightChanged(e)}dispatchHighlightChanged(e){e&&(xi(e)?this.beans.eventSvc.dispatchEvent({type:"columnHeaderEditHighlightChanged",groupId:e.groupId}):this.beans.eventSvc.dispatchEvent({type:"columnHeaderEditHighlightChanged",colId:e.getColId()}))}isEditable(e){return xi(e)?!!e.colGroupDef?.headerNameEditable:!!e.colDef.headerNameEditable&&!e.isCalculatedCol}getEditableHeaderName(e){const{beans:t}=this,s=xi(e)?wn(t,e,"header"):t.colNames.getDisplayNameForColumn(e,"header");return s!=null?String(s):""}applyHeaderName(e,t){if(xi(e)){if(!dte(this.beans,e.groupId,t))return;const{beans:s}=this;ute(s.eventSvc,Vs(s,e),"uiColumnHeaderEdit")}else e.setHeaderNameOverride(t,"uiColumnHeaderEdit")}postConstruct(){this.addManagedEventListeners({columnMenuVisibleChanged:e=>{!e.visible&&e.key==="columnChooser"&&this.destroyActivePopup()}})}getEditColumnNameMenuItem(e){return this.isEditable(e)?{name:this.getLocaleTextFunc()("editColumnName","Edit Column Name"),icon:cte("columnHeaderEdit",this.beans,null),action:()=>this.showHeaderNameEditor(e)}:null}showHeaderNameEditor(e){this.destroyActivePopup();let t=this.getEditableHeaderName(e);const s=this.isLiveApplyMode(),r=this.createBean(new yte({initialValue:t,liveApply:s,onApply:a=>{!s&&a===t||this.applyHeaderName(e,a)},onClosed:()=>this.destroyActivePopup()}));this.activePopup=r;const i=()=>{t=this.getEditableHeaderName(e),r.getValue()!==t&&r.setValue(t)},n=xi(e),o=n?e.groupId:e.getColId();this.removePopupColListener=this.addManagedEventListeners({columnHeaderNameChanged:a=>{const l=n?a.columnGroup?.getGroupId():a.column?.getColId();(!l||l===o)&&i()}})[0],this.setEditingTarget(e)}destroyActivePopup(){this.removePopupColListener?.(),this.removePopupColListener=null,this.activePopup&&(this.destroyBean(this.activePopup),this.activePopup=null),this.setEditingTarget(null)}destroy(){this.destroyActivePopup(),super.destroy()}},KS={moduleName:"ColumnHeaderEdit",version:_,beans:[wte],dependsOn:[$,ote],icons:{columnHeaderEdit:"edit"},css:[ate]};import{_setAgPackageInfo as xte}from"ag-grid-community";var Fte=".ag-sparkline-wrapper{height:100%;inset-inline-start:var(--ag-internal-sparkline-inset,0);line-height:normal;position:absolute;top:0}";import{RefPlaceholder as Tte,_batchCall as Ate,_setAriaLabel as Pte,_setAriaLabelledBy as $S}from"ag-stack";import{Component as Rte,_formatNumberCommas as Mte}from"ag-grid-community";import{_isFiniteNumber as Ite}from"ag-grid-community";var Ete="Sparkline - ${chartType} displaying ${count} values between ${min} and ${max}. Starts at ${start} and ends at ${end}.",Dte="Sparkline - ${chartType} displaying 1 value, ${value}.",Lte="Sparkline - ${chartType} displaying no values.",kte=(e,t)=>{const s=t?.type??"line";switch(s){case"line":return e("lineChart","Line");case"area":return e("areaChart","Area");case"bar":return e("barChart","Bar");default:return s}},_te=(e,t)=>{let s=0,r=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,n,o;for(const a of e){const l=Bte(a,t);l!=null&&(n??(n=l),o=l,s++,r=Math.min(r,l),i=Math.max(i,l))}return s===0?{count:s}:{count:s,min:r,max:i,start:n,end:o}};function Gte(e){const{translate:t,chartType:s,summary:r,formatNumber:i}=e;let n,o,a,l;if(!Ote(r))n="ariaSparklineChartDescriptionEmpty",o=Lte,a=[s],l={chartType:s};else if(r.count===1){const c=i(r.start);n="ariaSparklineChartDescriptionSingleValue",o=Dte,a=[s,c],l={chartType:s,value:c}}else{const[c,u,d,h,p]=[r.count,r.min,r.max,r.start,r.end].map(i);n="ariaSparklineChartDescription",o=Ete,a=[s,c,u,d,h,p],l={chartType:s,count:c,min:u,max:d,start:h,end:p}}return{template:t(n,o,a),values:l}}var Ote=e=>e.count>0&&e.min!=null&&e.max!=null&&e.start!=null&&e.end!=null,Nte=(e,t)=>e.replace(/\$\{([^}]+)\}/g,(s,r)=>t[r]??s),Bte=(e,t)=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(e&&typeof e=="object"){const s=Array.isArray(e)?e[1]:e[t];return Ite(s)?s:null}return null},jS="ag-sparkline",Vte=class extends mT{constructor(){super({tag:"div",cls:`${jS}-wrapper`,children:[{tag:"span",ref:"eSparkline"}]}),this.eSparkline=Tte,this.cachedWidth=0,this.cachedHeight=0,this.dataRef=[],this.processedData=[]}postConstruct(){this.env=this.beans.environment,this.addManagedPropertyListeners(["chartThemeOverrides","chartThemes","styleNonce"],()=>this.refresh(this.params))}createListener(e=!0){return()=>this.updateSize(this.params?.column?.getActualWidth()??0,(this.params?.node.rowHeight??0)-2,e)}initGridObserver(){const e=this.createListener(),t=this.createListener(!1),s=this.params?.column,r=this.params?.node;s.__addEventListener("columnStateUpdated",e),r.__addEventListener("heightChanged",e),this.addDestroyFunc(()=>{s.__removeEventListener("columnStateUpdated",e),r.__removeEventListener("heightChanged",e)}),t()}updateSize(e,t,s=!0){const r=this.params?.colDef,i=(r?.rowDrag?1:0)+(r?.checkboxSelection?1:0)+(r?.dndSource?1:0),n=this.env,o=n.getDefaultCellHorizontalPadding(),a=i*(n.getDefaultIconSize()+n.getDefaultCellWidgetSpacing()),l=o-1+a;if(this.getGui().style.setProperty("--ag-internal-sparkline-inset",l+"px"),e-=2*o+a,e!==this.cachedWidth||t!==this.cachedHeight){this.cachedWidth=e,this.cachedHeight=t;const c=this.refresh.bind(this);s?Ate(()=>this.isAlive()&&c()):c()}}init(e){this.params=e;const{eParentOfValue:t}=e,s=`${jS}-cell-renderer-${this.getCompId()}`;this.getGui().setAttribute("id",s),$S(t,s),this.addDestroyFunc(()=>$S(t)),this.initGridObserver()}refresh(e=this.params){var t;this.params=e;const s=this.processData(e?.value);this.refreshAriaLabel(s);const r=this.cachedWidth,i=this.cachedHeight,n=this.gos.get("styleNonce");return!this.sparklineInstance&&e&&r>0&&i>0?(this.sparklineOptions={container:this.eSparkline,width:r,height:i,...e.sparklineOptions,...n?{styleNonce:n}:{},data:s,context:this.createContext()},(t=this.sparklineOptions).type??(t.type="line"),this.sparklineInstance=e.createSparkline(this.sparklineOptions),!0):this.sparklineInstance?(this.sparklineInstance.update({...this.sparklineOptions,data:s,width:r,height:i,context:this.createContext(),...n?{styleNonce:n}:{}}),!0):!1}refreshAriaLabel(e){const t=this.getLocaleTextFunc(),s=this.getLocaleTextFunc.bind(this),r=this.params?.sparklineOptions?.yKey??this.sparklineOptions?.yKey??"y",i=_te(e,r),n=this.params?.sparklineOptions??this.sparklineOptions,{template:o,values:a}=Gte({translate:t,chartType:kte(t,n),summary:i,formatNumber:l=>Mte(l,s)});Pte(this.getGui(),Nte(o,a))}processData(e){return e?.length?(this.dataRef!==e&&(this.dataRef=e,this.processedData=Array.isArray(e[0])?e.filter(t=>t!=null):e),this.processedData):e??[]}createContext(){return{data:this.params?.data,cellData:this.params?.value}}destroy(){super.destroy(),this.sparklineInstance?.destroy()}},YS="Sparklines",qS={moduleName:YS,version:_,dependsOn:[$],validate:()=>({isValid:!1,errorId:258}),with:e=>{e.setup();const t={moduleName:YS,version:_,dependsOn:[$],css:[Fte],userComponents:{agSparklineCellRenderer:{classImp:Vte,params:{createSparkline:e.createSparkline}}},validate:()=>({isValid:!0})};return xte(t,e.isEnterprise?"ag-charts-enterprise":"ag-charts-community",e.VERSION),t}};import{BeanStub as Hte,_addGridCommonParams as ZS,_mergeDeep as XS}from"ag-grid-community";import{_getLocaleTextFunc as Ute}from"ag-stack";var _o=(e,t)=>t===!1||t===null?!1:JS(e)?t==="overwrite"?"overwrite":!1:typeof t=="string"?t:e==="sum"?"uniform":e==="avg"||e==null||t===!0?"overwrite":!1,JS=e=>e==="count"||e==="min"||e==="max"||e==="first"||e==="last",zte=e=>e==="sum"||e==="avg",nt=e=>{if(typeof e=="number")return e;if(typeof e=="bigint"||typeof e=="string"){const t=Number(e);return Number.isFinite(t)?t:0}if(typeof e=="boolean")return e?1:0;if(e!=null&&typeof e=="object"){if(typeof e.toNumber=="function")return nt(e.toNumber());if("value"in e)return nt(e.value)}return 0},QS=e=>Number.isFinite(e)?BigInt(Math.round(e)):0n,ar=e=>{if(typeof e=="bigint")return e;if(typeof e=="number")return QS(e);if(typeof e=="boolean")return e?1n:0n;if(typeof e=="string")try{return BigInt(e)}catch{return QS(Number(e))}if(e!=null&&typeof e=="object"){if(typeof e.toNumber=="function")return ar(e.toNumber());if("value"in e)return ar(e.value)}return 0n},Go=e=>{const t=typeof e;if(t==="number"||t==="bigint"||t==="boolean")return!0;if(t==="string")return Number.isFinite(Number(e));if(e!=null&&t==="object"){if(typeof e.toNumber=="function")return!0;if("value"in e)return Go(e.value)}return!1},Wte=e=>{if(e.cellDataType==="bigint")return 0;const t=e.cellEditorParams;if(t==null||typeof t!="object")return;const s=t.precision;if(typeof s=="number"&&Number.isInteger(s)&&s>=0)return s;const r=t.step;if(typeof r=="number"&&Number.isInteger(r))return 0},_u=e=>{if(e!=null&&typeof e=="object"){if(typeof e.toNumber=="function")return e.toNumber();if("value"in e)return e.value}return e},Gu=e=>{if(!Go(e))return null;const t=nt(e);return Number.isFinite(t)?t:null},Fi=(e,t)=>{const s=e.aggData;return s?Gu(s[t.colId]):null},Kte=(e,t)=>Gu(e.getDataValue(t,"value")),$te=(e,t,s)=>e?.lookupPivotResultCol(t,s)??null,lr=2,Ti=(e,t)=>e==null||!t?null:e/t,jte=e=>e==null||!Number.isFinite(e)?lr:Math.min(100,Math.max(0,e)),Yte="#N/A",qte=e=>{if(e.notApplicable)return Yte;const t=typeof e.value=="bigint"?Number(e.value):e.value;return typeof t!="number"||!Number.isFinite(t)?"":`${(t*100).toFixed(jte(e.precision))}%`},Ai=e=>Gu(e.rawValue),Zte=e=>e.rowGroupActive||e.treeData?!0:"inapplicable",ey=e=>e.pivotActive?!0:"inapplicable",Pi=e=>({transform:e,formatter:qte}),Xte=e=>{const t=(r,i)=>Ute(e.localeSvc)(r,i),s={percentOfGrandTotal:{...Pi(r=>Ti(Ai(r),r.grandTotal())),defaultAggFunc:"sum",displayName:()=>t("percentOfGrandTotal","% of Grand Total"),description:()=>t("percentOfGrandTotalDescription","Each value as a percentage of the column's grand total.")},percentOfColumnTotal:{...Pi(r=>Ti(Ai(r),r.columnTotal())),defaultAggFunc:"sum",displayName:()=>t("percentOfColumnTotal","% of Column Total"),description:()=>t("percentOfColumnTotalDescription","Each value as a percentage of its column total \u2014 every column totals 100%.")},percentOfRowTotal:{...Pi(r=>Ti(Ai(r),r.rowTotal())),displayName:()=>t("percentOfRowTotal","% of Row Total"),description:()=>t("percentOfRowTotalDescription","Each value as a percentage of the row total across the pivot columns."),applicability:ey},percentOfParentRowTotal:{...Pi(r=>Ti(Ai(r),r.parentTotal())),defaultAggFunc:"sum",displayName:()=>t("percentOfParentRowTotal","% of Parent Row Total"),description:()=>t("percentOfParentRowTotalDescription","Each value as a percentage of its parent group."),applicability:Zte},percentOfParentColumnTotal:{...Pi(r=>Ti(Ai(r),r.parentColumnTotal())),displayName:()=>t("percentOfParentColumnTotal","% of Parent Column Total"),description:()=>t("percentOfParentColumnTotalDescription","Each value as a percentage of its parent pivot column."),applicability:ey}};return Object.assign(Object.create(null),s)},ty=100,sy=1e4,Jte=class{constructor(e,t){this.column=e,this._beans=t}get rowGroups(){if(!this._rowGroups){const e=new Set;ry(this._beans.rowGroupColsSvc?.columns,this.column,e),this._rowGroups=Array.from(e)}return this._rowGroups}get dimensions(){if(!this._dimensions){const e=new Set(this.rowGroups);ry(this._beans.pivotColsSvc?.columns,this.column,e),this._dimensions=Array.from(e)}return this._dimensions}get valueColumns(){if(!this._valueColumns){const e=new Set(this.dimensions),t=this.column.colDef.pivotValueColumn??this.column,s=[],r=this._beans.valueColsSvc?.columns;for(let i=0,n=r?.length??0;i<n;++i){const o=r[i];o!==t&&!e.has(o)&&s.push(o)}this._valueColumns=s}return this._valueColumns}dimensionItems(e){const t=typeof e=="string"?e:e.getColId(),s=this._beans,r=s.pivotColsSvc?.columns;if(r&&s.colModel.isPivotActive()){for(let i=0,n=r.length;i<n;++i)if(r[i].getColId()===t)return Qte(s,i)}return ese(s,t)}getColumn(e){return this._beans.colModel.getCol(e)??null}},Qte=(e,t)=>{const s=e.pivotResultCols?.getAggregationOrderedList();if(!s)return[];const r=new Set,i=[];for(let n=0,o=s.length;n<o&&i.length<ty;++n){const a=s[n].colDef.pivotKeys;a&&t<a.length&&!r.has(a[t])&&(r.add(a[t]),i.push(a[t]))}return i},ese=(e,t)=>{const s=e.rowModel.rootNode,r=e.colModel.getCol(t)?.rowGroupActiveIndex??-1;if(!s||r<0)return[];let i=s.childrenAfterSort??[];for(let a=0;a<r&&i.length;++a){const l=[];for(let c=0,u=i.length;c<u&&l.length<sy;++c){const d=i[c].childrenAfterSort;if(d)for(let h=0,p=d.length;h<p&&l.length<sy;++h)l.push(d[h])}i=l}const n=new Set,o=[];for(let a=0,l=i.length;a<l&&o.length<ty;++a){const c=i[a].key;c!=null&&!n.has(c)&&(n.add(c),o.push(c))}return o},tse=class{constructor(e,t,s,r,i,n,o){this.api=e,this.context=t,this._beans=s,this.column=r,this.type=i,this.active=n,this.columnLists=o}get currentParams(){return this.active?this.column.showValuesAs?.params:void 0}apply(e){this._beans.showValuesAsSvc?.setColumnShowValuesAs(this.column,e!=null?{type:this.type,params:e}:this.type)}},ry=(e,t,s)=>{if(e)for(let r=0,i=e.length;r<i;++r){const n=e[r];n!==t&&s.add(n)}},sse=class{constructor(e,t,s,r,i,n,o){this.api=e,this.context=t,this._beans=s,this.column=r,this.node=i,this.aggValue=n,this.params=o,this._rawValue=this}get rawValue(){let e=this._rawValue;return e===this&&(e=_u(this.aggValue),this._rawValue=e),e}columnTotal(){const e=this.rootWithTotal();return e?Fi(e,this.column):null}grandTotal(){const e=this.rootWithTotal();return e?this._beans.colModel.isPivotActive()?this.rowTotalAt(e):Fi(e,this.column):null}rootWithTotal(){const e=this._beans.rowModel.rootNode;return e&&e.aggData==null&&this._beans.aggStage?.aggregateRootOnly(),e}parentTotal(){const e=this.node.parent;return e?(e.level===-1&&e.aggData==null&&this._beans.aggStage?.aggregateRootOnly(),Fi(e,this.column)):null}parentColumnTotal(){const{pivotKeys:e,pivotValueColumn:t}=this.column.colDef;if(!e||!t||e.length===0)return null;const s=$te(this._beans.pivotResultCols,e.slice(0,-1),t);return s?Fi(this.node,s):null}rowTotal(){return this.rowTotalAt(this.node)}rowTotalAt(e){const t=this.column,s=t.pivotValueColumn,r=s?this._beans.pivotResultCols?.getAggregationOrderedList():null;if(s&&r){let i=0,n=!1;for(let o=0,a=r.length;o<a;++o){const l=r[o].colDef;if(l.pivotValueColumn===s&&!l.pivotTotalColumnIds){const c=Fi(e,r[o]);c!=null&&(i+=c,n=!0)}}return n?i:null}return Kte(e,t)}},rse=class extends vT{constructor(){super(...arguments),this.beanName="showValuesAsSvc"}wireBeans(e){this.colModel=e.colModel,this.rowRenderer=e.rowRenderer,this.gridApi=e.gridApi,this.gridOptions=e.gridOptions,this.groupStage=e.groupStage,this.pivotResultCols=e.pivotResultCols,this.valueColsSvc=e.valueColsSvc,this.dataTypeSvc=e.dataTypeSvc}destroy(){super.destroy(),this.cachedBuiltinModes=void 0,this.cachedResolvedBuiltinModes=void 0}resolveColumn(e,t){const s=e.colDef,r=s.showValuesAsDef;if(r===null){e.showValuesAsDef=null,this.setActive(e,null);return}if(!t&&s.showValuesAs===void 0){const a=e.showValuesAs;if(r!=null||a!=null){const l=e.showValuesAsDef?.precision??lr;if(e.showValuesAsDef=this.resolveConfig(e),a){const c=a.precision!==l?a.precision:void 0;this.applyActive(e,a.type,{type:a.type,params:a.params,precision:c})}}else e.showValuesAsDef=void 0;return}const i=this.colDefSelection(s);if(r==null&&i==null){e.showValuesAsDef=void 0,this.setActive(e,null);return}if(e.showValuesAsDef=this.resolveConfig(e),i==null){this.setActive(e,null);return}const n=typeof i=="string"?i:i.type,o=typeof i=="string"?void 0:i;n==null?this.setActive(e,null):this.applyActive(e,n,o)}colDefSelection(e){return e.showValuesAsDef===null?null:(e.showValuesAs!==void 0?e.showValuesAs:e.initialShowValuesAs)??null}get builtinModes(){return this.cachedBuiltinModes??(this.cachedBuiltinModes=Xte(this.beans)),this.cachedBuiltinModes}get resolvedBuiltinModes(){let e=this.cachedResolvedBuiltinModes;if(!e){const t=this.builtinModes;e=Object.create(null);for(const s of Object.keys(t)){const r=this.resolveMode(s,t[s],void 0);r&&(e[s]=r)}this.cachedResolvedBuiltinModes=e}return e}ensureConfig(e){e.showValuesAsDef??(e.showValuesAsDef=this.resolveConfig(e))}resolveConfig(e){const t=e.colDef.showValuesAsDef;if(t===null)return null;const s=this.resolvedBuiltinModes,r=t?.modes;let i;if(!r)i=s;else{i=Object.assign(Object.create(null),s);const n=this.builtinModes;for(const o of Object.keys(r)){const a=this.resolveMode(o,n[o],r[o]);a?i[o]=a:delete i[o]}}return{modes:i,precision:t?.precision??lr,suppressHeaderIndicator:t?.suppressHeaderIndicator}}resolveMode(e,t,s){if(s===null||s===!1)return null;let r;if(typeof s=="function"?r=s(t):s!=null&&s!==!0&&(r=s),!t&&!r)return null;const i={};XS(i,t,!0,!0),XS(i,r,!0,!0);const n=i.transformedDataType??"number",o=i.formatter??this.beans.dataTypeSvc?.getFormatValue(n)??null;return{type:e,def:i,formatter:o,transformedDataType:n}}setActive(e,t){e.showValuesAs=t}applyActive(e,t,s){const r=e.showValuesAsDef,i=r?.modes[t];if(!i){this.setActive(e,null);return}const n={type:i.type,def:i.def,formatter:i.formatter,transformedDataType:i.transformedDataType,params:s?.params,precision:s?.precision??r?.precision??lr,_applyingSig:-1,_applyingValue:!1},o=e.showValuesAs;this.setActive(e,o?Object.assign(o,n):n)}toColState(e){const t=e.showValuesAs;if(!t)return null;const{type:s,params:r,precision:i}=t,n=e.showValuesAsDef?.precision??lr;if(r===void 0&&i===n)return s;const o={type:s};return r!==void 0&&(o.params=r),i!==n&&(o.precision=i),o}isApplying(e){const t=e.showValuesAs;if(!t)return!1;const s=t.def,r=s.ready;if(r&&!r(t.params??s.params))return!1;const i=s.applicability;if(typeof i!="function")return Nu(i);const n=this.groupStage,o=this.pivotResultCols,a=(n?.grouping?1:0)|(o&&this.colModel.isPivotActive()?2:0)|(n?.treeData?4:0);if(t._applyingSig===a)return t._applyingValue;const l=Nu(i(this.buildApplicabilityParams(e)));return t._applyingSig=a,t._applyingValue=l,l}transform(e,t,s){const r=e.showValuesAs;if(!r)return s;const i=r.def,n=i.transform;if(!n)return _u(s)??null;const o=r.params??i.params;return n(new sse(this.gridApi,this.gridOptions.context,this.beans,e,t,s,o))??null}formatValue(e,t,s,r,i){const n=e.showValuesAs,o=n?.formatter;return o?o(ZS(this.gos,{value:s,rawValue:_u(r),aggValue:r,showValuesAsType:n.type,precision:n.precision,notApplicable:i,node:t,data:t?.data,colDef:e.colDef,column:e})):null}syncColState(e,t,s,r){const i=t?.showValuesAs,n=i!==void 0?i:s?.showValuesAs;if(n===void 0)return;const o=n!=null&&typeof n=="object"?n:void 0,a=o?o.type:n;if(!(a!=null&&e.showValuesAsDef===null)){if(a==null){if(e.showValuesAs==null)return;this.setActive(e,null)}else{const l=e.showValuesAs,c=e.showValuesAsDef?.precision??lr;if(!o&&l?.type===a&&l.params===void 0&&l.precision===c)return;this.ensureConfig(e),this.applyActive(e,a,o)}this.applyModeChangeEffects(e,r,!0)}}getActiveModeLabel(e){const t=e.showValuesAs;return!t||!this.isApplying(e)?null:Ou(t.def,t.type)}isMenuEligible(e){const t=e.colDef;if(t.enableShowValuesAs===!1||e.showValuesAsDef===null)return!1;if(e.userProvidedColDef?.enableShowValuesAs===!0)return!0;if(t.enableShowValuesAs!==!0)return!1;if(e.aggregationActive)return!0;const s=this.dataTypeSvc?.getBaseDataType(e);return s==="number"||s==="bigint"}getMenuItems(e,t){this.ensureConfig(e);const s=e.showValuesAs?.type??null,r=[{name:t("showValuesAsNone","None"),action:()=>this.setColumnShowValuesAs(e,null),checked:s==null,menuItemRole:"menuitemradio"}];let i=null;const n=()=>(i??(i=new Jte(e,this.beans)),i),o=e.showValuesAsDef?.modes;for(const a of o?Object.keys(o):[]){const l=this.buildModeMenuItem(e,a,o[a],s,n);l&&r.push(l)}return r}buildModeMenuItem(e,t,s,r,i){const n=r===t,o=s.def,a=o.applicability;let l=!0;a!=null&&(l=typeof a=="function"?a(this.buildApplicabilityParams(e)):a);const c=ise(l);if(c==="hidden"&&!n)return null;const u={name:Ou(o,t),checked:n,menuItemRole:"menuitemradio",tooltip:this.modeTooltip(t,s)},d=o.menu,h=d?d(new tse(this.gridApi,this.gridOptions.context,this.beans,e,t,n,i())):void 0;if(h&&h.length>1)u.subMenu=h;else{const p=h?.length===1?h[0]:null;u.action=p&&typeof p=="object"&&p.action?p.action:()=>this.setColumnShowValuesAs(e,t)}return c==="disabled"||c==="inapplicable"?u.disabled=!0:c!=="enabled"&&(u.cssClasses=["ag-show-values-as-inapplicable"]),u}modeTooltip(e,t){const s=Ou(t.def,e),r=iy(t.def.description);return r?`${s}: ${r}`:s}getActiveModeTooltip(e){const t=e.showValuesAs;return t?this.modeTooltip(t.type,t):null}setColumnShowValuesAs(e,t){if(t==null){if(e.showValuesAs==null)return;this.setActive(e,null)}else{const s=typeof t=="string"?t:t.type,r=typeof t=="string"?void 0:t;this.ensureConfig(e),this.applyActive(e,s,r)}this.applyModeChangeEffects(e)}applyModeChangeEffects(e,t="api",s=!1){const r=this.colModel;r.beginColUpdate();try{if(e.dispatchStateUpdatedEvent("showValuesAs",t),this.eventSvc.dispatchEvent({type:"columnShowValuesAsChanged"}),this.promoteToValueColumn(e,t,s))return;this.rowRenderer.refreshCells({columns:[e.colId],force:!0})}finally{r.endColUpdate()}}promoteToValueColumn(e,t,s){const r=e.showValuesAs?.def.defaultAggFunc,i=this.valueColsSvc;return!r||e.aggregationActive||this.colModel.isPivotActive()||!i?!1:(s?i.syncColState(e,{colId:e.colId,aggFunc:r},void 0,t):i.setColumnAggFunc(e,r,t),!0)}buildApplicabilityParams(e){const t=this.groupStage;return ZS(this.gos,{column:e,rowGroupActive:t?.hasRowGrouping?t.grouping:void 0,treeData:t?.hasTreeData?t.treeData:void 0,pivotActive:this.pivotResultCols?this.colModel.isPivotActive():void 0})}},Ou=(e,t)=>iy(e.displayName)??t,iy=e=>(typeof e=="function"?e():e)??null,Nu=e=>e==null||e===!0||e==="enabled",ise=e=>e==="disabled"?"disabled":e===!1||e==="hide"?"hidden":Nu(e)?"enabled":"inapplicable",ny={moduleName:"ShowValuesAs",version:_,rowModels:["clientSide"],beans:[rse],icons:{showValuesAs:"values-as"},dependsOn:[yv]},nse=".ag-find-cell{display:block;overflow:hidden;text-overflow:ellipsis}.ag-find-match{background-color:var(--ag-find-match-background-color);color:var(--ag-find-match-color)}.ag-find-active-match{background-color:var(--ag-find-active-match-background-color);color:var(--ag-find-active-match-color)}";function ose(e){e.findSvc?.next()}function ase(e){e.findSvc?.previous()}function lse(e){return e.findSvc?.totalMatches??0}function cse(e,t,s){e.findSvc?.goTo(t,s)}function use(e){e.findSvc?.clearActive()}function dse(e){return e.findSvc?.activeMatch}function hse(e,t){const{node:s,column:r}=t;return e.findSvc?.getNumMatches(s,r)??0}function pse(e,t){return e.findSvc?.getParts(t)??[]}function gse(e){return e.findSvc?.refresh(!0)}import{_clearElement as fse,_toString as oy}from"ag-stack";import{Component as mse,_createElement as vse}from"ag-grid-community";var Cse={tag:"span",cls:"ag-find-cell"},bse=class extends CT{constructor(){super(Cse)}init(e){this.refresh(e)}refresh(e){const{node:t,column:s}=e,{findSvc:r,valueSvc:i}=this.beans,n=s,{value:o,valueFormatted:a}=i.getValueForDisplay({column:n,node:t,includeValueFormatted:!0,from:"edit",transformValues:n?.showValuesAs!=null}),l=a??o??"",c=this.getGui();fse(c);const u=r?.getParts({value:l,node:t,column:s??null});if(!u)c.textContent=oy(l)??"",c.classList.remove("ag-find-cell-active-match");else{let d=!1;for(const{value:h,match:p,activeMatch:g}of u){const f=oy(h)??"";if(p){const m=vse({tag:"mark",cls:"ag-find-match"});m.textContent=f,g&&(m.classList.add("ag-find-active-match"),d=!0),c.appendChild(m)}else c.appendChild(document.createTextNode(f))}c.classList.toggle("ag-find-cell-active-match",d)}return!0}};import{_debounce as Sse,_jsonEquals as yse,_missing as Bu,_toString as ay}from"ag-stack";import{BeanStub as wse,_addGridCommonParams as ly,_isClientSideRowModel as Oo,_isFullWidthGroupRow as xse,isSpecialCol as Fse}from"ag-grid-community";function cy(e){return e?.toLocaleLowerCase()}function Ri(e,t,s){const r=t(ay(s));let i=0;if(r?.length){let n=-1;for(;n=r.indexOf(e,n+1),n!=-1;)i++}return i}var Tse=class extends bT{constructor(){super(...arguments),this.beanName="findSvc",this.active=!1,this.topMatches=new Map,this.topNodes=[],this.topNumMatches=0,this.centerMatches=new Map,this.centerNodes=[],this.centerNumMatches=0,this.bottomMatches=new Map,this.bottomNodes=[],this.restoring=!1,this.caseFormat=cy,this.scrollOnRefresh=!1,this.totalMatches=0}postConstruct(){if(!Oo(this.gos))return;const e=this.refresh.bind(this,!1),t=this.refresh.bind(this,!0),s=Sse(this,()=>{this.isAlive()&&t()},0);this.refreshDebounced=s,this.addManagedPropertyListener("findSearchValue",e),this.addManagedPropertyListener("findOptions",({currentValue:i,previousValue:n})=>{yse(i,n)||e()}),this.addManagedPropertyListeners(["groupSuppressBlankHeader","showOpenedGroup"],t),this.addManagedEventListeners({modelUpdated:t,displayedColumnsChanged:t,pinnedRowDataChanged:t,cellValueChanged:s,rowNodeDataChanged:s,cellEditingStopped:s,cellEditValuesChanged:s,batchEditingStopped:s});const r=this.beans.rowSpanSvc;r?.active&&this.addManagedListeners(r,{spannedCellsUpdated:s}),e()}next(){this.findAcrossContainers(!1,["top",null,"bottom"],1,1)}previous(){this.findAcrossContainers(!0,["bottom",null,"top"],this.totalMatches,-1)}goTo(e,t){if(!t&&e===this.activeMatch?.numOverall)return;const{topMatches:s,topNumMatches:r,centerMatches:i,centerNumMatches:n,bottomMatches:o}=this;if(e<=r){this.goToInContainer(s,e,0);return}if(e<=n){this.goToInContainer(i,e,r);return}this.goToInContainer(o,e,r+n)}clearActive(){this.activeMatch&&this.setActive(void 0)}isMatch(e,t){return this.active&&!!this.getMatches(e.rowPinned).get(e)?.some(([s])=>s===t)}getNumMatches(e,t){return this.getMatches(e.rowPinned).get(e)?.find(([s])=>s===t)?.[1]??0}getParts(e){const{value:t,node:s,column:r,precedingNumMatches:i}=e,n=this.findSearchValue,o=ay(t)??"";if(Bu(n))return[{value:o}];const a=this.caseFormat(o)??"",l=this.getActiveMatchNum(s,r)-(i??0);let c=0,u=0;const d=n.length,h=[];for(;;){const p=a.indexOf(n,c);if(p!=-1){u++,p>c&&h.push({value:o.slice(c,p)});const g=p+d;h.push({value:o.slice(p,g),match:!0,activeMatch:u===l}),c=g}else return c<o.length&&h.push({value:o.slice(c)}),h}}registerDetailGrid(e,t){const s=this.gos;if(!Oo(s))return;const r=()=>s.get("findOptions")?.searchDetail,i=n=>{const a=this.centerMatches.get(e)?.[0]?.[1]??0;n!==a&&this.refreshDebounced()};t.addEventListener("findChanged",n=>{t.isDestroyed()||!this.isAlive()||!this.active||!r()||i(n.totalMatches)}),t.addEventListener("gridPreDestroyed",()=>{if(!this.isAlive()||!this.active||!r())return;const n=e.parent,o=this.findSearchValue;if(!n||!o)return;const a=s.get("detailCellRendererParams")?.getFindMatches?.({node:n,data:n.data,findSearchValue:s.get("findSearchValue"),updateMatches:this.refreshDebounced,getMatchesForValue:l=>Ri(o,this.caseFormat,l)})??0;i(a)}),r()&&t.setGridOption("findSearchValue",s.get("findSearchValue"))}getState(){if(!Oo(this.gos))return;const e=this.gos.get("findSearchValue")||void 0;return e?{searchValue:e,activeMatch:this.activeMatch?.numOverall}:void 0}setState({searchValue:e,activeMatch:t}){if(Oo(this.gos))if(e!==void 0&&this.gos.updateGridOptions({options:{findSearchValue:e}}),t!=null){this.restoring=!0;try{this.goTo(t)}finally{this.restoring=!1}}else this.activeMatch&&this.setActive(void 0)}refresh(e){const t=new Set([...this.topNodes,...this.centerNodes,...this.bottomNodes]);this.topNodes=[],this.centerNodes=[],this.bottomNodes=[];const{topNodes:s,topMatches:r,centerMatches:i,centerNodes:n,bottomNodes:o,bottomMatches:a,beans:{gos:l,visibleCols:c,rowModel:u,valueSvc:d,pinnedRowModel:h,pagination:p,rowSpanSvc:g,masterDetailSvc:f,colModel:m},findSearchValue:v}=this,C=l.get("findOptions"),b=C?.caseSensitive?D=>D??void 0:cy;this.caseFormat=b;const y=l.get("findSearchValue"),S=b(y?.trim());this.findSearchValue=S,r.clear(),i.clear(),a.clear();const w=e?this.activeMatch:void 0;this.activeMatch=void 0;const F=l.get("masterDetail")&&C?.searchDetail&&f;if(Bu(S)){if(this.active=!1,this.topNumMatches=0,this.centerNumMatches=0,this.totalMatches=0,this.refreshRows(t),F){const D=f.store;for(const A of Object.keys(D))D[A]?.api?.findClearActive()}Bu(v)||this.dispatchFindChanged();return}const T=c.allCols,x=l.getCallback("isFullWidthRow"),P=l.get("detailCellRendererParams"),L=l.get("fullWidthCellRendererParams"),G=l.get("groupRowRendererParams"),O=Bv(l),z=m.pivotMode;let B=0,W,J,Q=!1;const de=(D,A,ne,K)=>{if(!ne)return;let I=W.get(D);I||(I=[],W.set(D,I),J.push(D),K||t.add(D)),I.push([A,ne]),B+=ne},me=D=>{if(Q){let I=D.rowIndex,V=D.parent;for(;I==null&&V;)I=V.rowIndex,V=V.parent;if(I==null||!p.isRowInPage(I))return}const A=D.hasChildren();if(!Uv(O,D,A,z,Vv(O,D,A),Hv(O,D,A)))return;const ne=D.data;if(x?.({rowNode:D})){if(L){const I=L.getFindMatches?.({node:D,data:ne,findSearchValue:y,updateMatches:this.refreshDebounced,getMatchesForValue:V=>Ri(S,b,V)})??0;de(D,null,I)}return}if(xse(l,D,z)){let I;const V=G?.getFindText;if(V){const ae=d.getDisplayValue(void 0,D,"batch",!1);I=V(ly(l,{value:ae,node:D,data:ne,column:null,colDef:null,getValueFormatted:()=>{const{valueFormatted:xe}=d.getValueForDisplay({node:D,includeValueFormatted:!0,from:"batch"});return xe}}))}else{const{value:ae,valueFormatted:xe}=d.getValueForDisplay({node:D,includeValueFormatted:!0,from:"batch"});I=xe??ae}const q=Ri(S,b,I);de(D,null,q);return}const K=D.level>0&&l.get("groupHideOpenParents")&&D.parent?.getFirstChild()===D&&!D.parent?.expanded;for(const I of T){if(Fse(I))continue;const V=g?.getCellSpan(I,D);if(V&&V.firstNode!==D||I.showRowGroup&&K)continue;let q;const ae=I.colDef,xe=I.showValuesAs!=null,he=xe?"edit":"batch",ke=ae.getFindText;if(ke){const lt=d.getDisplayValue(I,D,he,xe);q=ke(ly(l,{value:lt,node:D,data:ne,column:I,colDef:ae,getValueFormatted:()=>{const{valueFormatted:ns}=d.getValueForDisplay({column:I,node:D,includeValueFormatted:!0,from:he,transformValues:xe});return ns}}))}else{const{value:lt,valueFormatted:ns}=d.getValueForDisplay({column:I,node:D,includeValueFormatted:!0,from:he,transformValues:xe});q=ns??lt}const Ps=Ri(S,b,q);de(D,I,Ps)}if(D.master&&F){const I=D.detailNode;if(I){const V=I.detailGridInfo?.api;if(V){V.setGridOption("findSearchValue",y);const q=V.findGetTotalMatches();de(I,null,q);return}}if(P){const V=P.getFindMatches?.({node:D,data:ne,findSearchValue:y,updateMatches:this.refreshDebounced,getMatchesForValue:q=>Ri(S,b,q)})??0;de(I??{parent:D,dummy:!0},null,V,!I)}}};W=r,J=s,h?.forEachPinnedRow("top",me),this.topNumMatches=B;let Z=B;W=i,J=n,B=0,Q=!!p&&!!C?.currentPageOnly,u.forEachNodeAfterFilterAndSort(me,!0),this.centerNumMatches=B,Z+=B,W=a,J=o,B=0,Q=!1,h?.forEachPinnedRow("bottom",me),Z+=B,this.totalMatches=Z,this.active=!0,this.refreshRows(t),w&&this.resetActiveMatch(w),this.dispatchFindChanged()}resetActiveMatch(e){const{column:t,numInMatch:s}=e;let r=e.node;if(r.dummy){const c=r.parent?.detailNode;if(!c)return;r=c}const i=r.rowPinned??null;if(!this.getMatches(i)?.get(r)?.some(([c,u])=>c===t&&u>=s))return;let o=0;i==null?o=this.topNumMatches:i==="bottom"&&(o=this.topNumMatches+this.centerNumMatches),(()=>{const c=this.getMatches(i);for(const u of c.keys()){const d=u===r,h=c.get(u);for(const[p,g]of h){if(d&&p===t){o+=s;return}o+=g}}})();const l={...e,node:r,numOverall:o};this.activeMatch=l,this.refreshRows(new Set([r]),t==null?void 0:new Set([t])),this.scrollOnRefresh&&(this.scrollOnRefresh=!1,this.scrollToActive(l)),this.setDetailActive(l)}refreshRows(e,t){e.size&&this.beans.rowRenderer.refreshCells({rowNodes:[...e],columns:t?[...t]:void 0,force:!0,suppressFlash:!0})}findAcrossContainers(e,t,s,r){if(!this.totalMatches){this.setActive();return}const i=this.activeMatch;let n=t;if(i){const{column:o,node:a,numInMatch:l,numOverall:c}=i,u=a.rowPinned??null,d=c+r;if(this.findInContainer(u,e,d,a,o,l))return;const p=t.indexOf(u),g=t.length;if(t.slice(p+1,g).some(m=>this.findInContainer(m,e,d)))return;n=t.slice(0,p+1)}n.some(o=>this.findInContainer(o,e,s))}findInContainer(e,t,s,r,i,n){const o=this.getMatches(e),a=this.getRowNodes(e),l=t?-1:1;if(r!=null){const h=o.get(r),p=h?.findIndex(([f])=>f===i);if(p!=null&&p!=-1){const[f,m]=h[p];if(t?n>1:n<m)return this.setActive({column:f,node:r,numInMatch:n+l,numOverall:s}),!0}const g=p!=null&&p!=-1?h?.[p+l]:void 0;if(g){const[f,m]=g;return this.setActive({column:f,node:r,numInMatch:t?m:1,numOverall:s}),!0}}let c;if(r==null)c=a[t?a.length-1:0];else{const h=a.findIndex(p=>p===r);c=a[h+l]}if(c==null)return!1;const u=o.get(c),d=u?.[t?u.length-1:0];if(d){const[h,p]=d;return this.setActive({column:h,node:c,numInMatch:t?p:1,numOverall:s}),!0}return!1}dispatchFindChanged(){const{eventSvc:e,activeMatch:t,totalMatches:s,findSearchValue:r}=this;e.dispatchEvent({type:"findChanged",activeMatch:t,totalMatches:s,findSearchValue:r})}setActive(e){if(e&&e.node.rowIndex==null&&!this.restoring){const s=e.node;let r=s.footer?s.sibling:s.parent;for(;r&&r.level!==-1;)r.expanded=!0,r=r.parent;this.activeMatch=e,this.scrollOnRefresh=!0,this.beans.expansionSvc?.onGroupExpandedOrCollapsed();return}const t=this.activeMatch;this.activeMatch=e,this.refreshAndScrollToActive(e,t),e&&this.setDetailActive(e),this.dispatchFindChanged()}setDetailActive({node:e,numInMatch:t}){e.detail&&e.detailGridInfo?.api?.findGoTo(t)}refreshAndScrollToActive(e,t){if(e||t){const s=new Set,r=new Set;let i=!1;const n=o=>{if(!o)return;const{node:a,column:l}=o;s.add(a),l==null?i=!0:r.add(l)};n(e),n(t),this.refreshRows(s,i?void 0:r)}e&&!this.restoring&&this.scrollToActive(e)}scrollToActive({node:{rowPinned:e,rowIndex:t},column:s}){const{ctrlsSvc:r,pagination:i,gos:n}=this.beans,o=r.getScrollFeature();e==null&&t!=null&&(i&&!n.get("findOptions")?.currentPageOnly&&!i.isRowInPage(t)&&i.goToPageWithIndex(t),o.ensureIndexVisible(t)),o.ensureColumnVisible(s)}goToInContainer(e,t,s){let r=s;for(const i of e.keys()){const n=e.get(i);for(const[o,a]of n){if(t<=r+a){this.setActive({column:o,node:i,numInMatch:t-r,numOverall:t});return}r+=a}}}getMatches(e){return e==="top"?this.topMatches:e==="bottom"?this.bottomMatches:this.centerMatches}getRowNodes(e){return e==="top"?this.topNodes:e==="bottom"?this.bottomNodes:this.centerNodes}getActiveMatchNum(e,t){const s=this.activeMatch;return s?.node===e&&s.column===t?s.numInMatch:0}destroy(){this.topMatches.clear(),this.topNodes.length=0,this.centerMatches.clear(),this.centerNodes.length=0,this.bottomMatches.clear(),this.bottomNodes.length=0,this.activeMatch=void 0,super.destroy()}},Ase={moduleName:"FindCore",version:_,rowModels:["clientSide"],beans:[Tse],userComponents:{agFindCellRenderer:bse},css:[nse]},uy={moduleName:"Find",version:_,apiFunctions:{findGetTotalMatches:lse,findGoTo:cse,findNext:ose,findPrevious:ase,findGetActiveMatch:dse,findGetNumMatches:hse,findGetParts:pse,findClearActive:use,findRefresh:gse},dependsOn:[$,Ase]};import{_EditCoreModule as Pse}from"ag-grid-community";var Rse=".ag-cell-batch-edit{background-color:var(--ag-cell-batch-edit-background-color);color:var(--ag-cell-batch-edit-text-color);display:inherit;@media (forced-colors:active){background-color:Mark}}.ag-row-batch-edit{background-color:var(--ag-row-batch-edit-background-color);color:var(--ag-row-batch-edit-text-color);@media (forced-colors:active){background-color:Mark}}";import{_isClientSideRowModel as Mse}from"ag-grid-community";function Ise({editSvc:e,gos:t,rowModel:s,log:r}){if(!Mse(t,s)){r.warn(289,{rowModelType:t.get("rowModelType")});return}e?.startBatchEditing()}function Ese({editSvc:e}){e?.stopBatchEditing({cancel:!0,source:"api",forceCancel:!0})}function Dse({editSvc:e}){e?.stopBatchEditing({source:"api",forceStop:!0,commit:!0})}function Lse(e){return e.editSvc?.isBatchEditing()??!1}var dy={moduleName:"BatchEdit",version:_,beans:[],apiFunctions:{isBatchEditing:Lse,startBatchEdit:Ise,cancelBatchEdit:Ese,commitBatchEdit:Dse},dependsOn:[Pse,$],css:[Rse]};import{ColumnApiModule as kse,TooltipModule as _se,_PopupModule as Gse,_UserColumnService as Ose}from"ag-grid-community";var Nse=":where(.ag-calculated-column-panel .ag-panel-content-wrapper){padding:var(--ag-spacing) var(--ag-cell-horizontal-padding)}.ag-calculated-column-form{display:flex;flex:1 1 auto;flex-direction:column;gap:calc(var(--ag-spacing)*2);min-height:0;min-width:260px}.ag-calculated-column-form :where(.ag-input-field-input[readonly]){--ag-input-background-color:var(--ag-input-disabled-background-color);--ag-input-border:var(--ag-input-disabled-border);--ag-input-text-color:var(--ag-input-disabled-text-color);--ag-input-focus-background-color:var(--ag-input-disabled-background-color);--ag-input-focus-text-color:var(--ag-input-disabled-text-color)}.ag-calculated-column-expression-wrap{display:flex;flex:1 1 auto;flex-direction:column;gap:var(--ag-spacing)}.ag-calculated-column-expression-wrap :where(.ag-text-area){flex:1 1 auto}.ag-calculated-column-expression-wrap :where(.ag-text-area-input-wrapper){height:100%}.ag-calculated-column-token-reference{color:var(--ag-calculated-column-reference-color)}.ag-calculated-column-token-function{color:var(--ag-calculated-column-function-color)}.ag-calculated-column-token-operator{color:var(--ag-calculated-column-operator-color)}.ag-calculated-column-expression-error{-webkit-text-decoration:underline wavy var(--ag-calculated-column-error-underline-color);text-decoration:underline wavy var(--ag-calculated-column-error-underline-color);-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none;text-underline-offset:.15em;@media (forced-colors:active){text-decoration-color:CanvasText}}@media (forced-colors:active){.ag-calculated-column-expression-mirror{display:block;forced-color-adjust:none;-webkit-text-fill-color:transparent}}.ag-calculated-column-expression-wrap .ag-text-area-input{height:100%;padding-bottom:calc(var(--ag-spacing)/2);padding-top:calc(var(--ag-spacing)/2);resize:none}.ag-rtl .ag-calculated-column-expression-wrap .ag-text-area-input{direction:ltr;padding-left:var(--ag-input-padding-start)}.ag-calculated-column-expression-tools{display:flex;:where(.ag-field-set-wrapper){align-items:center;flex-wrap:nowrap;gap:var(--ag-spacing);justify-content:end}}:where(.ag-ltr) .ag-calculated-column-expression-tools{:where(.ag-label){text-align:right}}:where(.ag-rtl) .ag-calculated-column-expression-tools{:where(.ag-label){text-align:left}}.ag-standard-button.ag-calculated-column-expression-tool{padding:calc(var(--ag-spacing)/2)}.ag-calculated-column-suggestion-path{align-items:center;display:flex;gap:calc(var(--ag-spacing)/2)}.ag-calculated-column-suggestion-parent{min-width:0;overflow:hidden;text-overflow:ellipsis}.ag-calculated-column-suggestion-parent,.ag-calculated-column-suggestion-separator{color:var(--ag-calculated-column-parent-suggestion-color)}.ag-calculated-column-suggestion-separator{flex:none}.ag-calculated-column-suggestion-leaf{flex:none;overflow:hidden}.ag-calculated-column-picker-list{width:var(--ag-calculated-column-suggestion-list-width)}.ag-calculated-column-empty-picker{display:grid}:where(.ag-calculated-column-empty-picker)>.ag-autocomplete-list{grid-area:1/1}.ag-calculated-column-empty-message{align-self:center;grid-area:1/1;opacity:.5;overflow-wrap:anywhere;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding)}.ag-calculated-column-actions{display:flex;gap:calc(var(--ag-spacing)/2);justify-content:flex-end}.ag-calculated-column-action{min-width:72px}.ag-calculated-column-highlighted{background-color:var(--ag-calculated-column-highlight-color)}";function Bse(e,t){e.calculatedColsSvc?.openCalculatedColumnDialog(e.colModel.getCol(t),"edit",!0)}function Vse(e,t){const{colModel:s,calculatedColsSvc:r}=e;if(s.pivotMode)return;const i=s.getCol(t);t!=null&&!i?.primary||r?.openCalculatedColumnDialog(i,"add",!0)}function Hse(e,t){e.calculatedColsSvc?.refreshCalculatedColumns(t)}import{_camelCaseToHumanText as Use,_findFocusableElements as zse,_isNothingFocused as hy,_isStringLargerThan as py,_requestAnimationFrame as Wse}from"ag-stack";import{BeanStub as Kse,_addColumnDefaultAndTypes as gy,_addGridCommonParams as Vu,_createUserColumn as $se,_isCalculatedColumnsEnabled as Hu,_mergedEqual as cr,_normaliseCalculatedExpression as fy,_warnOnce as jse}from"ag-grid-community";import{RefPlaceholder as Ue,_getActiveDomElement as Yse,_getElementRootNode as qse,_setAriaActiveDescendant as my,_setAriaAutoComplete as Zse,_setAriaControls as No,_setAriaDescribedBy as Xse,_setAriaExpanded as Uu,_setAriaHasPopup as vy,_setAriaInvalid as Jse,_setDisplayed as Bo}from"ag-stack";import{AgFieldSetSelector as Qse,AgInputTextAreaSelector as ere,AgInputTextFieldSelector as tre,AgSelectSelector as sre,Component as rre,KeyCode as ot,_createElement as ire}from"ag-grid-community";import{_isHorizontalScrollShowing as Cy}from"ag-stack";import{Component as nre}from"ag-grid-community";var by="\u203A",ore={tag:"div",cls:"ag-autocomplete-row ag-calculated-column-suggestion",role:"presentation",children:[{tag:"div",cls:"ag-autocomplete-row-label ag-calculated-column-suggestion-label"}]},are=class extends ST{constructor(){super(ore),this.tooltipValue=null}postConstruct(){this.tooltipFeature=this.createOptionalManagedBean(this.beans.tooltipSvc?.createHighlightTooltip({getGui:()=>this.getGui(),getTooltipComponentDefinition:()=>{},getTooltipValue:()=>this.tooltipValue,getLocation:()=>"calculatedColumnAutocomplete",shouldDisplayTooltip:()=>this.isTruncated()},this))}setState(e,t){this.suggestion=e,this.render(),this.updateSelected(t)}updateSelected(e){this.toggleCss("ag-autocomplete-row-selected",e),this.dispatchLocalEvent({type:"itemHighlighted",highlighted:e})}setSearchString(e){}render(){const e=this.suggestion,t=this.getGui(),s=t.lastElementChild;s.textContent="",s.classList.remove("ag-calculated-column-suggestion-path"),t.removeAttribute("aria-label");const r=e.displayPath;if(e.type!=="column"||!r||r.length<2){s.textContent=e.label,this.tooltipValue=e.label,this.tooltipFeature?.setTooltipAndRefresh(this.tooltipValue);return}s.classList.add("ag-calculated-column-suggestion-path");const i=r.join(` ${by} `);t.setAttribute("aria-label",i),this.tooltipValue=i;const n=t.ownerDocument,o=r.length-1;for(let a=0,l=r.length;a<l;++a){const c=a===o,u=n.createElement("span");if(u.className=c?"ag-calculated-column-suggestion-leaf":"ag-calculated-column-suggestion-parent",u.textContent=r[a],s.appendChild(u),!c){const d=n.createElement("span");d.className="ag-calculated-column-suggestion-separator",d.textContent=by,s.appendChild(d)}}this.tooltipFeature?.setTooltipAndRefresh(this.tooltipValue)}isTruncated(){const e=this.getGui().lastElementChild;if(Cy(e))return!0;const t=e.children;for(const s of t)if(Cy(s))return!0;return!1}},lre=class extends Hb{constructor(e){super(e),this.addCss("ag-calculated-column-expression-mirror")}postConstruct(){super.postConstruct(),this.eText.classList.add("ag-calculated-column-expression-text")}refresh(e,t){const s=this.getGui().ownerDocument,r=s.createDocumentFragment(),i=t.diagnostic?.range,n=(a,l,c)=>{if(a===l)return;const u=[a,l];i&&(i.start>a&&i.start<l&&u.push(i.start),i.end>a&&i.end<l&&u.push(i.end),u.sort((d,h)=>d-h));for(let d=1;d<u.length;++d){const h=u[d-1],p=u[d],g=i&&h<i.end&&p>i.start,f=e.slice(h,p);if(c==="text"&&!g){r.appendChild(s.createTextNode(f));continue}const m=s.createElement("span");c!=="text"&&m.classList.add(`ag-calculated-column-token-${c}`),g&&m.classList.add("ag-calculated-column-expression-error"),m.textContent=f,r.appendChild(m)}};let o=0;for(const a of t.tokens)n(o,a.start,"text"),n(a.start,a.end,a.type),o=a.end;n(o,e.length,"text"),this.setContent(r)}},zu={cellDataType:"text",calculatedExpression:""},cre=["text","number","date","boolean"],ure=["columns","functions","operators"],Sy=["+","-","*","/","^","&","=","<>",">",">=","<","<="],dre=[...Sy].sort((e,t)=>t.length-e.length),hre=Sy.map(e=>({type:"operator",label:e,value:e})),pre=6,gre="ag-calculated-column-picker-list";function yy(e){return e.displayPath!=null&&e.displayPath.length>=2?e.searchText??e.label:e.label}var fre={tag:"div",cls:"ag-calculated-column-form",children:[{tag:"ag-input-text-field",ref:"eTitle"},{tag:"div",ref:"eTitleError",cls:"ag-aria-description-container",attrs:{"aria-live":"polite","aria-atomic":"true"}},{tag:"ag-select",ref:"eType"},{tag:"div",ref:"eTypeError",cls:"ag-aria-description-container",attrs:{"aria-live":"polite","aria-atomic":"true"}},{tag:"div",cls:"ag-calculated-column-expression-wrap",children:[{tag:"ag-input-text-area",ref:"eExpression"},{tag:"div",ref:"eExpressionError",cls:"ag-aria-description-container",attrs:{"aria-live":"polite","aria-atomic":"true"}},{tag:"ag-field-set",cls:"ag-calculated-column-expression-tools",ref:"eExpressionTools",children:[{tag:"button",ref:"eColumns",cls:"ag-button ag-standard-button ag-calculated-column-expression-tool"},{tag:"button",ref:"eFunctions",cls:"ag-button ag-standard-button ag-calculated-column-expression-tool"},{tag:"button",ref:"eOperators",cls:"ag-button ag-standard-button ag-calculated-column-expression-tool"}]}]},{tag:"div",ref:"eActions",cls:"ag-calculated-column-actions",children:[{tag:"button",ref:"eApply",cls:"ag-button ag-standard-button ag-calculated-column-action ag-calculated-column-action-apply"},{tag:"button",ref:"eCancel",cls:"ag-button ag-standard-button ag-calculated-column-action"}]}]},mre=class extends yT{constructor(e,t,s,r,i,n,o,a,l,c,u,d=!1){super(fre,[tre,sre,ere,Qse]),this.draft=e,this.dataTypeOptions=t,this.getColumnSuggestions=r,this.getFunctionSuggestions=i,this.inspectExpression=n,this.onValidate=o,this.onApply=a,this.onCancel=l,this.liveApply=c,this.onDraftChange=u,this.readOnly=d,this.eTitle=Ue,this.eType=Ue,this.eExpression=Ue,this.eTitleError=Ue,this.eTypeError=Ue,this.eExpressionError=Ue,this.eColumns=Ue,this.eFunctions=Ue,this.eOperators=Ue,this.eApply=Ue,this.eCancel=Ue,this.eActions=Ue,this.eExpressionTools=Ue,this.activeReplacement=null,this.suggestionSource=null,this.titleFeedback={message:null},this.typeFeedback={message:null},this.expressionFeedback={message:null},this.autocompleteList=null,this.suggestionType=null,this.suggestionSourceType=null,this.openSuggestions=[],this.expressionSelection=null,this.expressionPickers=new Set(s)}postConstruct(){this.setupFormFields(),this.setupActionButtons(),this.setupAria(),this.setupExpressionEditor(),this.readOnly||(this.addFormFieldListeners(),this.addActionListeners(),this.addFormListeners(),this.addDestroyFunc(()=>this.closeSuggestionPopup())),this.setValidationErrors(this.liveApply||this.readOnly?this.onValidate(this.draft):null),!this.liveApply&&(!this.draft.calculatedExpression.trim()||!this.draft.headerName.trim())&&(this.eApply.disabled=!0)}hideSuggestions(){this.activeReplacement=null,this.closeSuggestionPopup()}refreshValidation(e){this.hideSuggestions(),this.setValidationErrors(e(this.draft))}setupFormFields(){const e=this.getLocaleTextFunc(),t=this.eType.showPicker.bind(this.eType);if(this.eType.showPicker=()=>{this.hideSuggestions(),t()},this.eTitle.setLabel(e("calculatedColumnTitle","Title")).setLabelAlignment("top").setValue(this.draft.headerName,!0),this.eType.setLabel(e("calculatedColumnType","Type")).setLabelAlignment("top").addOptions(this.dataTypeOptions).setValue(typeof this.draft.cellDataType=="string"?this.draft.cellDataType:void 0,!0).setReadOnly(this.readOnly),this.readOnly)for(const s of[this.eTitle,this.eExpression])s.getInputElement().readOnly=!0;this.eExpression.setLabel(e("calculatedColumnExpression","Expression")).setLabelAlignment("top").setAutoComplete(!1).setInputPlaceholder(this.readOnly?void 0:e("calculatedColumnExpressionPlaceholder","Type here")).setRows(3).setValue(this.draft.calculatedExpression,!0),this.eExpressionTools.setDirection("horizontal").setLabelWidth("flex").setLabel(e("calculatedColumnExpressionToolsLabel","Insert")).setLabelSeparator(":")}setupAria(){if(this.eExpressionError.id=`ag-calculated-column-expression-error-${this.getCompId()}`,this.eTitleError.id=`ag-calculated-column-title-error-${this.getCompId()}`,this.eTypeError.id=`ag-calculated-column-type-error-${this.getCompId()}`,this.readOnly)return;const e=String(this.gos.get("tabIndex")),t=this.eExpression.getInputElement();Zse(t,"list"),vy(t,"listbox");const s=[this.eColumns,this.eFunctions,this.eOperators];for(const r of s)r.setAttribute("tabindex",e),vy(r,"listbox"),Uu(r,!1)}setupActionButtons(){const e=this.getLocaleTextFunc(),t=["Columns","Functions","Operators","Apply","Cancel"];for(const n of t){const o=this[`e${n}`];o.textContent=e(`calculatedColumn${n}`,n),o.type="button"}const s=!this.readOnly&&this.expressionPickers.has("columns"),r=!this.readOnly&&this.expressionPickers.has("functions"),i=!this.readOnly&&this.expressionPickers.has("operators");Bo(this.eColumns,s),Bo(this.eFunctions,r),Bo(this.eOperators,i),this.eExpressionTools.setDisplayed(s||r||i),Bo(this.eActions,!this.liveApply&&!this.readOnly)}addFormFieldListeners(){this.eTitle.onValueChange(e=>{this.updateDraft({headerName:e??""})}),this.eType.onValueChange(e=>{this.updateDraft({cellDataType:e??this.dataTypeOptions[0]?.value??zu.cellDataType})}),this.eExpression.onValueChange(e=>{this.updateDraft({calculatedExpression:e??""}),this.refreshContextSuggestions()})}setupExpressionEditor(){this.expressionEditor=this.createManagedBean(new lre(this.eExpression));const e=this.eExpression.getInputElement();e.setAttribute("spellcheck","false"),!this.readOnly&&this.addManagedElementListeners(e,{click:()=>{this.rememberExpressionSelection(),this.refreshContextSuggestions()},input:()=>this.rememberExpressionSelection(),keydown:t=>this.onExpressionKeyDown(t),keyup:t=>this.onExpressionKeyUp(t),select:()=>this.rememberExpressionSelection()})}addActionListeners(){const e=this.expressionPickers,t=[["columns","column",this.eColumns],["functions","function",this.eFunctions],["operators","operator",this.eOperators]];for(const s of t){const[r,i,n]=s;e.has(r)&&this.addManagedElementListeners(n,{mousedown:()=>this.rememberExpressionSelection(),click:()=>this.openPicker(i,n)})}this.liveApply||(this.addManagedElementListeners(this.eApply,{click:()=>{this.setValidationErrors(this.onApply(this.draft))}}),this.addManagedElementListeners(this.eCancel,{click:()=>this.onCancel()}))}addFormListeners(){this.addManagedElementListeners(this.getGui(),{keydown:e=>{e.target!==this.eExpression.getInputElement()&&this.onSuggestionKeyDown(e)},focusout:()=>window.setTimeout(()=>{this.getGui().contains(Yse(this.beans))||this.hideSuggestions()},0)})}setValidationErrors(e){if(!this.isAlive())return;const t=this.draft.calculatedExpression,s=e?.calculatedExpression??null,r=this.inspectExpression(t,s),i=s??(r.diagnostic?[r.diagnostic.message]:null);this.expressionEditor.refresh(t,r),this.setFieldErrors(this.eTitle.getInputElement(),this.eTitleError,this.titleFeedback,e?.headerName),this.setFieldErrors(this.eType.getFocusableElement(),this.eTypeError,this.typeFeedback,e?.cellDataType),this.setFieldErrors(this.eExpression.getInputElement(),this.eExpressionError,this.expressionFeedback,i),this.eTitle.getInputElement().setCustomValidity(e?.headerName?.join(`
`)??""),this.eExpression.getInputElement().setCustomValidity(i?.join(`
`)??""),this.eApply.disabled=!!(e?.headerName?.length||e?.cellDataType?.length||s?.length)}setFieldErrors(e,t,s,r){const i=!!r?.length,n=i?r.join(`
`):null;n!==s.message&&(t.textContent=n??""),s.message=n,Xse(e,n?t.id:void 0),e.classList.toggle("invalid",i),Jse(e,i),n&&!s.tooltip&&(s.tooltip=this.createValidationTooltip(()=>e,()=>s.message)),s.tooltip?.setTooltipAndRefresh(n),e.setAttribute("title","")}createValidationTooltip(e,t){return this.createOptionalManagedBean(this.beans.tooltipSvc?.createTooltip({getGui:e,getTooltipComponentDefinition:()=>{},getTooltipValue:t,getLocation:()=>"calculatedColumnExpression",shouldDisplayTooltip:()=>!!t()}))}updateDraft(e){this.draft={...this.draft,...e};const t=this.onDraftChange?this.onDraftChange(this.draft):this.onValidate(this.draft);this.setValidationErrors(t)}rememberExpressionSelection(){const e=this.eExpression.getInputElement(),t=e.value.length,s=e.selectionStart??t,r=e.selectionEnd??s;this.expressionSelection={start:s,end:r}}refreshContextSuggestions(){const e=this.eExpression.getInputElement(),t=e.value,s=e.selectionStart??t.length,r=Qb(t,s);if(r){this.showSuggestions("column",r.prefix,r,e,"inline");return}const i=this.getFunctionToken(t,s);if(i){this.showSuggestions("function",i.prefix,{start:i.start,end:i.end},e,"inline");return}this.activeReplacement&&this.hideSuggestions()}openPicker(e,t){this.rememberExpressionSelection(),this.showSuggestions(e,"",this.expressionSelection,t,"picker")}getSuggestionsForType(e){return e==="column"?this.getColumnSuggestions():e==="function"?this.getFunctionSuggestions():hre}showSuggestions(e,t,s,r,i){this.eType.hidePicker();const n=this.getSuggestionsForType(e),o=t.toLocaleLowerCase();if(!(!o||n.some(l=>yy(l).toLocaleLowerCase().includes(o)))){this.hideSuggestions();return}this.autocompleteList&&this.suggestionType!==e&&this.closeSuggestionPopup(),this.activeReplacement=s,this.suggestionSource=r,this.suggestionSourceType=i,this.openSuggestionPopup(e,n),this.autocompleteList?.setSearch(t),this.refreshAriaForSuggestions(),this.positionSuggestionPopup()}refreshAriaForSuggestions(){if(!this.autocompleteList||!this.suggestionSource){this.clearAriaForSuggestions();return}const e=this.autocompleteList.getListId(),t=this.eExpression.getInputElement(),s=this.suggestionSourceType==="inline",r=s?this.autocompleteList.getActiveOptionId():null,i=r&&qse(t).getElementById(r)?r:null;No(t,s?e:null),my(t,i);for(const n of[this.eColumns,this.eFunctions,this.eOperators]){const o=this.suggestionSourceType==="picker"&&this.suggestionSource===n;Uu(n,o),No(n,o?e:null)}}clearAriaForSuggestions(){const e=this.eExpression.getInputElement();No(e,null),my(e,null);for(const t of[this.eColumns,this.eFunctions,this.eOperators])Uu(t,!1),No(t,null)}openSuggestionPopup(e,t){const s=this.beans.popupSvc;if(!s||this.autocompleteList)return;this.suggestionType=e,this.openSuggestions=t;const r=this.createManagedBean(new Oa({autocompleteEntries:this.createAutocompleteEntries(t),onConfirmed:()=>this.confirmSelectedSuggestion(),autoSizeList:!0,retainRoleWhenEmpty:!0,maxVisibleItems:pre,onListHeightChanged:()=>this.positionSuggestionPopup(),onActiveOptionChanged:()=>this.refreshAriaForSuggestions(),rowComponentCreator:e==="column"?(i,n)=>this.createColumnSuggestionRow(i,n):void 0}));this.autocompleteList=r,this.hideSuggestionPopup=s.addPopup({eChild:r.getGui(),positionCallback:()=>this.positionSuggestionPopup(),alwaysOnTop:!0,ariaLabel:this.getLocaleTextFunc()("calculatedColumnSuggestions","Calculated Column Suggestions")}).hideFunc,r.afterGuiAttached(),e==="column"&&t.length===0&&this.showEmptyColumnsMessage(r),this.refreshAriaForSuggestions()}showEmptyColumnsMessage(e){const t=this.getLocaleTextFunc()("calculatedColumnNoEligibleColumns","No eligible columns found."),s=ire({tag:"div",cls:"ag-calculated-column-empty-message"});s.textContent=t,e.addCss("ag-calculated-column-empty-picker"),e.getGui().appendChild(s),e.addManagedListeners(s,{mousedown:r=>r.preventDefault()}),this.beans.ariaAnnounce.announceValue(t,"calculatedColumnNoEligibleColumns")}createAutocompleteEntries(e){const t=[];for(let s=0,r=e.length;s<r;++s){const i=e[s],n={key:`${s}`,displayValue:yy(i),suggestion:i};t.push(n)}return t}createColumnSuggestionRow(e,t){const s=new are;return s.setState(e.suggestion,t),s}positionSuggestionPopup(){const e=this.suggestionSource,t=this.autocompleteList,s=this.beans.popupSvc;if(!e||!t||!s)return;const r=t.getGui(),i=this.suggestionSourceType==="picker";if(r.classList.toggle(gre,i),i){r.style.width="";const n=this.getGui().offsetWidth;n>0&&(r.style.maxWidth=`${n}px`)}else{const n=this.eExpression.getInputElement().offsetWidth;n>0&&(r.style.width=`${n}px`),r.style.maxWidth=""}s.positionPopupByComponent({ePopup:r,type:"calculatedColumnAutocomplete",eventSource:e,position:"under",alignSide:this.gos.get("enableRtl")?"right":"left",keepWithinBounds:!0}),s.bringPopupToFront(r)}confirmSelectedSuggestion(){const e=this.autocompleteList?.getSelectedValue(),t=e?this.openSuggestions[Number(e.key)]:void 0;t?this.acceptSuggestion(t):this.hideSuggestions()}closeSuggestionPopup(){this.clearAriaForSuggestions(),this.suggestionSource=null,this.suggestionType=null,this.suggestionSourceType=null,this.openSuggestions=[],this.hideSuggestionPopup?.(),this.hideSuggestionPopup=void 0,this.autocompleteList&&(this.destroyBean(this.autocompleteList),this.autocompleteList=null)}onExpressionKeyDown(e){this.onSuggestionKeyDown(e)}onSuggestionKeyDown(e){const t=this.autocompleteList;if(t)switch(e.key){case ot.ESCAPE:e.preventDefault(),e.stopPropagation(),this.hideSuggestions();return;case ot.UP:case ot.DOWN:e.stopPropagation(),t.onNavigationKeyDown(e,e.key);return;case ot.TAB:case ot.ENTER:e.preventDefault(),e.stopPropagation(),(e.key===ot.TAB||this.openSuggestions.length!==0)&&this.confirmSelectedSuggestion();return}}onExpressionKeyUp(e){switch(e.key){case ot.ESCAPE:case ot.UP:case ot.DOWN:case ot.TAB:case ot.ENTER:return}this.refreshContextSuggestions()}acceptSuggestion(e){const t=this.eExpression.getInputElement(),s=t.value,r=this.getSuggestionInsertText(e),i=this.activeReplacement??this.expressionSelection,n=i?.start??t.selectionStart??s.length,o=i?.end??t.selectionEnd??n,{start:a,end:l}=e.type==="operator"?hQ(s,n,o,dre):{start:n,end:o},c=`${s.slice(0,a)}${r}${s.slice(l)}`;this.eExpression.setValue(c);const u=e.type==="function"&&r.endsWith("()")?a+r.length-1:a+r.length;t.setSelectionRange(u,u),this.expressionSelection={start:u,end:u},t.focus(),this.hideSuggestions()}getSuggestionInsertText(e){switch(e.type){case"column":return`[${e.value}]`;case"function":return`${e.value}()`;case"operator":return` ${e.value} `}}getFunctionToken(e,t){if(tS(e,t))return null;let s=t;for(;s>0&&/[A-Za-z0-9_.]/.test(e[s-1]);)s--;let r=t;for(;r<e.length&&/[A-Za-z0-9_.]/.test(e[r]);)r++;if(s===r||!/[A-Za-z_]/.test(e[s]))return null;const i=this.getPreviousNonSpaceChar(e,s);return i!=null&&!"([,+-*/^&=<>".includes(i)?null:{start:s,end:r,prefix:e.slice(s,t)}}getPreviousNonSpaceChar(e,t){for(let s=t-1;s>=0;s--)if(e[s]!==" ")return e[s];return null}};import{isSpecialCol as vre}from"ag-grid-community";function Cre(e,t,s){const r=t.filter(n=>n.getColId()!==s).map(n=>{const o=Sre(e,n);return{column:n,colId:n.getColId(),leafName:o[o.length-1],path:o,reference:""}}),i=new Map;for(const n of r)for(const o of Wu(n.path))i.set(o,(i.get(o)??0)+1);for(const n of r){const o=Wu(n.path).find(a=>i.get(a)===1);if(o){n.reference=o;continue}n.suffix=` (${yre(n.colId)})`,n.reference=`${xy(n.path)}${n.suffix}`}return r}function bre(e,t,s=!1){const r=new Set(e.map(o=>Ku(o.reference,s))),i=new Map,n=Ku(t,s);for(let o=0,a=e.length;o<a;++o){const l=Wu(e[o].path);for(let c=0,u=l.length;c<u;++c){const d=Ku(l[c],s);i.set(d,(i.get(d)??0)+1)}}return(i.get(n)??0)>1&&!r.has(n)}function Sre(e,t){const s=wy(e.colNames.getDisplayNameForColumn(t,"header"),t.getColId()),r=[];let i=t.getOriginalParent();for(;i;)i.isPadding()||r.unshift(wy(e.colNames.getDisplayNameForProvidedColumnGroup(null,i,"header"),i.getGroupId())),i=i.getOriginalParent();return[...r,s]}function wy(e,t){return e?.trim()||t.trim()||t}function Wu(e){const t=[];for(let s=e.length-1;s>=0;s--){const r=xy(e.slice(s));r&&t.push(r)}return t}function xy(e){return e.filter(Boolean).join(" ")}function yre(e){return encodeURIComponent(e)}function Ku(e,t){return t?e.toLocaleLowerCase():e}function Fy(e,t,s){const r=Ty(e,t,s.column),i=r&&(s.endColumn?Ty(e,t,s.endColumn):r);if(!r||!i)return{columns:[],unknown:!0};if(r===i)return{columns:[r]};const n=t.indexOf(r),o=t.indexOf(i);return n<0||o<0?{columns:[]}:{columns:t.slice(Math.min(n,o),Math.max(n,o)+1)}}function*wre(e,t){const s=e.colModel.colsList.filter(i=>i.primary);function*r(i){if(i.type==="operation")for(const n of i.operands)yield*r(n);else i.value!=null&&typeof i.value=="object"&&(yield*Fy(e,s,i.value).columns)}yield*r(t)}function Ty(e,t,s){if(!s.absolute)return e.colModel.colsById[s.id];const r=mJ(s.id);return r<0?void 0:t[r]}function Ay(e,t){if(e.type==="restricted")return qb(t,e.reference);const[s,r]=e.type==="ambiguous"?["calculatedColumnExpressionAmbiguousReference",'Ambiguous column reference "${variable}". Use the Columns list or a more specific group path.']:["calculatedColumnExpressionUnknownReference",'Unknown column reference "${variable}".'];return t(s,r,[e.reference]).replace("${variable}",e.reference)}function xre(e,t,s,r){const{isColumnReferenceable:i,originalExpression:n,originalError:o}=r??{},a=t.filter(v=>!vre(v)),l=Cre(e,a,s),c=new Map(l.map(v=>[v.reference,v.colId])),u=new Map,d=new Map(l.map(v=>[v.colId,v.reference])),h=new Set;for(let v=0,C=l.length;v<C;++v){const b=l[v],y=Fs(b.reference),S=u.get(y)??[];S.push(b.colId),u.set(y,S),i&&!i(b.column)&&h.add(b.colId)}const p=v=>{const C=c.get(v);if(C!=null)return C;const b=u.get(Fs(v));return b?.length===1?b[0]:void 0},g=v=>Ao(v,C=>Xb(d.get(C)??C)),f=n===void 0?void 0:g(n),m=(v,C,b)=>{let y,S;for(const{cell:w,range:F}of C){if(w.row.current)continue;y??(y=e.colModel.colsList.filter(P=>P.primary));const{columns:T,unknown:x}=Fy(e,y,w);if(x&&(S??(S={type:"unknown",reference:v.slice(F.start,F.end),range:F})),b){const P=T.find(L=>h.has(L.colId));if(P)return{type:"restricted",reference:d.get(P.colId)??P.colId,range:F}}}return S};return{suggestions:l.filter(({colId:v})=>!h.has(v)).map(({leafName:v,path:C,reference:b,suffix:y})=>({type:"column",label:b,value:Xb(b),searchText:`${b} ${v}`,displayPath:y?[...C.slice(0,-1),`${v}${y}`]:C})),toInternalExpression(v,C,b){const y=n!==void 0&&v===f,S=C==="revalidate";if(y&&C===void 0)return{expression:n,error:o};let w,F,T,x;const P=Ao(v,(G,O,z)=>{o&&Fs(G)===Fs(o.reference)&&(x??(x={start:O,end:z}));const B=p(G);if(h.has(B??G))return F===void 0&&(F=G,T={start:O,end:z}),B;if(B!=null)return B;if(y&&e.colModel.getCol(G))return G;const J=(u.get(Fs(G))?.length??0)>1||bre(l,G,!0);w??(w={type:J?"ambiguous":"unknown",reference:G,range:{start:O,end:z}})},!0),L=m(v,b??lS(e,v).references,!y||S||o?.type==="restricted");return L?.type==="restricted"?(F===void 0&&(F=L.reference,T=L.range),o&&Fs(L.reference)===Fs(o.reference)&&(x??(x=L.range))):w??(w=L),(!y||S)&&F!==void 0&&(w={type:"restricted",reference:F,range:T}),y?{expression:n,error:o&&!S?{...o,range:x}:w}:{expression:P,error:w}},toDisplayExpression:g}}function Fre(e,t){return wi(e,Zb(t),"absolute")}function Tre(e,t){try{return[...new Set(wre(e,Fre(e,t)))]}catch(s){if(!(s instanceof N))throw s;const r=new Set;return Ao(t,i=>{const n=e.colModel.getCol(i);return n&&r.add(n),i}),[...r]}}function Fs(e){return e.toLocaleLowerCase()}var Are=256;function Vo(e){return e?.getFirstRealParent()?.groupId??null}var Pre={text:"dataTypeText",number:"dataTypeNumber",bigint:"dataTypeBigInt",boolean:"dataTypeBoolean",date:"dataTypeDate",dateString:"dataTypeDateString",dateTime:"dataTypeDateTime",dateTimeString:"dataTypeDateTimeString",object:"dataTypeObject"},Rre=class extends wT{constructor(){super(...arguments),this.beanName="calculatedColsSvc",this.dynamicColumns=new Map,this.inactiveDynamicColumns=new Map,this.lastCalculatedColIndex=0,this.validationStatesByColId=new Map,this.validationStatesInitialised=!1,this.lifecycleInitialised=!1,this.knownCalculatedColumns=new Map,this.suppressValidationChecks=0,this.openDialogsByColId=new Map,this.liveCreationColumnIds=new Set,this.pendingLiveApplyUpdatesByColId=new Map,this.formulaErrorsByExpression=new Map}postConstruct(){this.userColumnSvc=this.beans.userColumnSvc,this.userColumnSvc.registerOwner(()=>this.isEnabled(),To),this.addManagedEventListeners({newColumnsLoaded:e=>{this.checkColumnLifecycle(e.source),this.checkValidationStates(e.source)}}),this.addManagedPropertyListener("calculatedColumns",({previousValue:e,currentValue:t})=>{const s=Hu(t),r=s!==Hu(e),i=typeof e=="object"?e:void 0,n=typeof t=="object"?t:void 0,o=r||s&&i?.processColDef!==n?.processColDef;o&&(s?this.adoptUserColumns():this.clearDynamicColumnInstances(),this.refreshDynamicColumns("gridOptionsChanged"),this.checkValidationStates("gridOptionsChanged")),(o||i?.suppressColumnHighlighting===!0!=(n?.suppressColumnHighlighting===!0))&&this.refreshOpenDialogHighlights()})}isEnabled(){return Hu(this.gos.get("calculatedColumns"))}getExpressionError(e){const t=this.userColumnSvc.getEntry(e.colId)?.calculatedExpressionError;return t&&t.expression===this.getResolvedAuthoredColDef(e).calculatedExpression?t:void 0}refreshCalculatedColumns(e){if(!this.isEnabled())return;const{colModel:t,formula:s}=this.beans,r=e?.columns?.map(o=>t.getCol(o))??t.colDefList,i=new Set(r.filter(o=>!!o?.isCalculatedCol)),n=[];for(const o of i){const a=o.colId,l=ts(this.getResolvedAuthoredColDef(o)),c=this.getExpressionValidation(l.calculatedExpression??"",this.getExpressionError(o)),u=this.createDialogContext(a,!0,null),d=this.validateDialogDraft(this.toDraft(o,u.mapper),u,!0),h=this.userColumnSvc.getEntry(a);cr(h?.calculatedExpressionError,d.expressionError)||(h?.created?this.userColumnSvc.setCreatedColumn(a,h.properties??{},h.parentGroupId??null,d.expressionError):d.expressionError||Object.keys(h?.properties??{}).length?this.userColumnSvc.setOverride(a,h?.properties??{},d.expressionError):this.userColumnSvc.clearColumn(a),n.push({colId:a,colDef:l,validation:c}))}if(n.length&&this.refreshDynamicColumns("api"),e?.columns==null)for(const o of this.openDialogsByColId.values())o.refreshValidation();else for(const o of i)this.openDialogsByColId.get(o.colId)?.refreshValidation();if(i.size){s?.refreshFormulas(!0);for(const{colId:o,colDef:a,validation:l}of n){const c=t.getCol(o);c?.isCalculatedCol&&this.dispatchChangedEvents(c,a,ts(this.getResolvedAuthoredColDef(c)),"api",l)}}}getResolvedAuthoredColDef(e){return this.dynamicColumns.get(e.colId)?.resolvedAuthoredColDef??e.colDef}isHighlightedColumn(e){return e!=null&&this.isEnabled()&&this.getOptions()?.suppressColumnHighlighting!==!0&&this.openDialogsByColId.get(e.colId)?.highlight===!0}refreshCalculatedColumnHighlight(e){if(e==null)return;const t=this.beans.rowRenderer.getCellCtrls(null,[e]);for(const s of t)s.refreshCalculatedColumnCss();this.beans.ctrlsSvc.getHeaderRowContainerCtrl()?.refresh()}refreshOpenDialogHighlights(){const e=this.beans.colModel.colsById;for(const[t,s]of this.openDialogsByColId)s.highlight&&this.refreshCalculatedColumnHighlight(e[t]??null)}updateCalculatedColumn(e,t,s){if(!this.isEnabled())return;const r="calculatedColumn",{colModel:i}=this.beans,n=i.getCol(e);if(!n?.isCalculatedCol||n.colDef.calculatedColumnReadOnly)return;const o=this.getResolvedAuthoredColDef(n),a=ts(o),l=this.getExpressionValidation(o.calculatedExpression??"",this.getExpressionError(n)),c={...t};c.headerName===this.getDraftHeaderName(n)&&delete c.headerName,c.cellDataType===o.cellDataType&&delete c.cellDataType;const u=fy(c.calculatedExpression);u!==void 0&&(c.calculatedExpression=u);const d=n.colId,h=this.userColumnSvc.getEntry(d),p=u===void 0?h?.calculatedExpressionError:s,g=this.getUpdatedCalculatedColDef(n,c),f=this.dynamicColumns.get(d),m=gy(this.beans,g,d),v=!cr(m,o)||!cr(p,h?.calculatedExpressionError);v&&(f?(f.colDef=g,this.recordCreatedColumn(d,g,h?.parentGroupId??null,p)):this.setDeclaredColOverride(n,g,p),this.refreshDynamicColumns(r),u!==void 0&&this.beans.formula?.refreshFormulas(!1));const C=i.colsById[d]??n;this.dispatchChangedEvents(C,a,ts(this.getResolvedAuthoredColDef(C)),r,l),v&&this.checkValidationStates(r,!0),this.refreshCalculatedColumn(d)}getFormulaError(e){const t=this.formulaErrorsByExpression,s=t.get(e);if(s!==void 0)return s;t.size>=Are&&t.clear();const r=this.beans.formula?.validateExpression(Zb(e))??null;return t.set(e,r),r}getFormulaExpressionError(e){return this.getFormulaError(e)?.getTranslatedMessage(this.getLocaleTextFunc())??null}getInvalidColumnReference(e,t=s=>!!this.beans.colModel.colsById[s]){let s;return Ao(e,r=>(s==null&&!t(r)&&(s=r),r)),s}openCalculatedColumnDialog(e,t,s=!0,r){if(!this.isEnabled())return;const i=this.isLiveApplyMode();if(t==="add"){const a=this.createUniqueColId(),l=this.getLocaleTextFunc()("calculatedColumnDefaultTitle","Untitled"),c={colId:a,headerName:l,...this.getDefaultDraft()};if(i){this.liveCreationColumnIds.add(a);const u=this.addDynamicCalculatedColumn(c,e);if(u){const d=this.createDialogContext(a,i,e??null);this.showDialog(c,()=>null,d,u,s,r,e)}else this.liveCreationColumnIds.delete(a);return}this.showDialog(c,u=>{this.addDynamicCalculatedColumn(u,e)&&r&&this.focusCalculatedColumn(u.colId)},this.createDialogContext(a,i,e??null),void 0,s,r,e);return}if(!e?.isCalculatedCol)return;const n=this.createDialogContext(e.colId,i,null),o=this.toDraft(e,n.mapper);this.showDialog(o,a=>{const{colId:l,...c}=this.toColDef(a);this.updateCalculatedColumn(e.colId,c)},n,e,s,r,e)}addDynamicCalculatedColumn(e,t){const s=e.colId,r={...this.toColDef(e),calculatedColumnReadOnly:!1},i=t?.colDef.columnGroupShow;i!=null&&(r.columnGroupShow=i),this.inactiveDynamicColumns.delete(s),this.dynamicColumns.set(s,{colDef:r,anchorColId:t?.colId??null,initialPinned:t?.pinned,instance:null}),this.recordCreatedColumn(s,r,Vo(t)),this.refreshDynamicColumns("calculatedColumn");const n=this.beans.colModel.colsById[s];return n&&this.dispatchCreatedOrRemovedEvent("calculatedColumnCreated",this.getEventCommonParams(n,e.calculatedExpression,"calculatedColumn")),this.checkValidationStates("calculatedColumn",!0),n??void 0}removeCalculatedColumn(e){if(!this.isEnabled()||!e?.isCalculatedCol||e.colDef.calculatedColumnReadOnly)return;const t="calculatedColumn",s=this.getResolvedAuthoredColDef(e).calculatedExpression??"",r=e.colId;this.closeCalculatedColumnDialog(r);const i=this.dynamicColumns.delete(r);if(i)for(const n of this.dynamicColumns.values())n.anchorColId===r&&(n.anchorColId=null);this.userColumnSvc.removeColumn(r,!i),this.refreshDynamicColumns(t),this.dispatchCreatedOrRemovedEvent("calculatedColumnRemoved",this.getEventCommonParams(e,s,t)),this.checkValidationStates(t,!0)}recordCreatedColumn(e,t,s,r){this.userColumnSvc.setCreatedColumn(e,ts(t),s,r)}isLiveApplyMode(){return this.getOptions()?.applyMode!=="deferred"}getOptions(){const e=this.gos.get("calculatedColumns");return typeof e=="object"&&e!=null?e:void 0}setDeclaredColOverride(e,t,s){const r=this.userColumnSvc,i=e.colId,n=ts(r.getDeclaredDef(i)??{}),o=ts(t),a={},l=Object.keys(o);for(let u=0,d=l.length;u<d;++u){const h=l[u];o[h]!==n[h]&&(a[h]=o[h])}const c=Object.keys(n);for(let u=0,d=c.length;u<d;++u){const h=c[u];h in o||(a[h]=void 0)}Object.keys(a).length||s?r.setOverride(i,a,s):r.clearColumn(i)}contributeTo(e){if(!this.isEnabled())return;const{dynamicColumns:t}=this,s=this.userColumnSvc;if(t.size===0)return;const r=e.source,i=e.buildToken,n=e.newColDefs,o=this.getOptions()?.processColDef,a=o?this.createColDefProcessor(o,e.columns):null;t.forEach((l,c)=>{const u=l.anchorColId,d=this.getOrCreateColumn(l,c,i,r,n,a);d.buildToken=i,u!=null&&u!==c&&!s.getEntry(u)?.removed?(d.anchoredToColId=u,uC(e,d,u)):(d.anchoredToColId=void 0,uC(e,d))})}createColDefProcessor(e,t){const s=new Map(t.map(o=>[o.colId,o])),r=this.getKeptAutoCols(t);for(let o=0,a=r.length;o<a;++o)s.set(r[o].colId,r[o]);const i=this.dynamicColumns,n={hasCol:o=>s.has(o)||i.has(o),getCol:o=>s.get(o)??i.get(o)?.instance??null};return(o,a)=>this.processUserColDef(e,o,a,n)}getKeptAutoCols(e){const{autoColSvc:t,rowGroupColsSvc:s,colModel:r,gos:i}=this.beans,n=t?.columns;if(!n?.length||i.get("treeData"))return n??[];const o=new Set(r.colDefList),a=new Set,l=c=>{c&&s?.willExtractCol(c,!o.has(c))&&a.add(c.colId)};for(let c=0,u=e.length;c<u;++c)l(e[c]);return this.dynamicColumns.forEach(c=>l(c.instance)),n.filter(c=>{const u=c.colDef.showRowGroup;return typeof u=="string"?a.has(u):a.size>0})}clearDynamicColumnInstances(){this.dynamicColumns.forEach(e=>{e.instance=null})}resetDynamicColumnDefs(e=!1){return e||this.inactiveDynamicColumns.clear(),this.dynamicColumns.size?(e&&this.dynamicColumns.forEach((t,s)=>{t.parentGroupId=Vo(t.instance),t.parkedExpressionError=this.userColumnSvc.getEntry(s)?.calculatedExpressionError,t.instance=null,this.inactiveDynamicColumns.set(s,t)}),this.dynamicColumns.clear(),!0):!1}adoptUserColumns(){if(!this.isEnabled())return!1;const e=this.userColumnSvc,t=this.dynamicColumns,s=n=>{const o=e.getEntry(n);return o?.created===!0&&o.properties?.calculatedExpression!=null},r=n=>{let o=!1;return n.forEach((a,l)=>{s(l)||(n.delete(l),o=!0)}),o};let i=r(t);return r(this.inactiveDynamicColumns),e.forEachEntry((n,o)=>{const a=n.properties;if(!n.created||a?.calculatedExpression==null)return;const l=mu({...a,calculatedColumnReadOnly:!1},o),c=t.get(o);if(c){cr(l,c.colDef)||(c.colDef=l,i=!0);const u=c.instance;u!==null&&(n.parentGroupId??null)!==Vo(u)&&(c.anchorColId=this.findAnchorInGroup(n.parentGroupId),i=!0);return}if(e.isDeclared(o)){jse(`userColumns: colId '${o}' is declared in columnDefs; skipping.`);return}this.inactiveDynamicColumns.delete(o),t.set(o,{colDef:l,anchorColId:this.findAnchorInGroup(n.parentGroupId),instance:null}),i=!0}),i}findAnchorInGroup(e){if(e==null)return null;const{colModel:t}=this.beans,s=this.userColumnSvc,r=t.colDefList;for(let i=r.length-1;i>=0;--i){const n=r[i];if(Vo(n)!==e)continue;const o=n.colId;if(!s.getEntry(o)?.removed&&(s.isDeclared(o)||this.dynamicColumns.has(o)))return o}return null}restoreDynamicColumnDefs(e){if(!this.isEnabled())return!1;const t=this.inactiveDynamicColumns;if(!t.size)return!1;let s=!1;for(let r=0,i=e.length;r<i;++r){const n=e[r].colId,o=t.get(n);o!==void 0&&(t.delete(n),this.dynamicColumns.has(n)||(this.dynamicColumns.set(n,o),this.recordCreatedColumn(n,o.colDef,o.parentGroupId??null,o.parkedExpressionError),o.parkedExpressionError=void 0,s=!0))}return s}getOrCreateColumn(e,t,s,r,i,n){const o=this.beans,a=n?n(e,t):e.colDef;e.resolvedAuthoredColDef=n?gy(o,e.colDef,t):void 0;const l=e.instance;if(l!==null)return l.buildToken=s,l.reapplyColDef(a,r,i),l;const c=$se(o,a,t,!0,s);return e.initialPinned!==void 0&&a.pinned===void 0&&a.initialPinned===void 0&&o.pinnedCols?.setColPinned(c,e.initialPinned,r),e.initialPinned=void 0,e.instance=c,c}processUserColDef(e,t,s,r){const i=t.colDef,n=t.anchorColId,o=i.calculatedExpression??"",a=this.userColumnSvc.getEntry(s)?.calculatedExpressionError,l=e(Vu(this.gos,{colDef:{...i},sourceColumn:n==null?null:r.getCol(n),expressionValidation:this.getExpressionValidation(o,a?.expression===o?a:void 0,r.hasCol)}));if(l==null)return i;const c=cQ(l,s);c.length&&this.warn(336,{colId:s,properties:c});const u=mu({...l,calculatedExpression:l.calculatedExpression??i.calculatedExpression},s);return(this.liveCreationColumnIds.has(s)||u.calculatedColumnReadOnly==null)&&(u.calculatedColumnReadOnly=!1),u}refreshDynamicColumns(e){this.suppressValidationChecks++;try{this.beans.colModel.rebuildCols(e)}finally{this.suppressValidationChecks--}}createUniqueColId(){const{colModel:e}=this.beans,t=this.userColumnSvc,s=this.inactiveDynamicColumns;let r=this.lastCalculatedColIndex,i;do i=`calculated_${++r}`;while(e.getCol(i)!==void 0||s.has(i)||t.getEntry(i)!==void 0);return this.lastCalculatedColIndex=r,i}getUpdatedCalculatedColDef(e,t){const s=e.colId,r=this.dynamicColumns.get(s),i=e.getUserProvidedColDef(),n=this.userColumnSvc,o=n.getEntry(s)?.properties,a=n.getDeclaredDef(s)??i,l=o?{...a,...o}:a,c=r?.colDef??l??e.colDef,u={...t};delete u.colId;const d={...dQ(c,i,u),...u};return d.calculatedExpression??(d.calculatedExpression=c.calculatedExpression),mu(d,s)}createDialogContext(e,t,s){const r=this.beans,i=r.colModel.getCol(e)??null,n=this.getOptions()?.isColumnReferenceable,o=i&&this.getExpressionError(i),a=xre(r,r.colModel.colDefList,e,{originalExpression:i?this.getResolvedAuthoredColDef(i).calculatedExpression??"":void 0,originalError:o?.reason==="restrictedReference"?{type:"restricted",reference:o.reference}:void 0,isColumnReferenceable:n?l=>n(Vu(this.gos,{column:l,colDef:l.colDef,calculatedColumn:i,sourceColumn:s})):void 0});return{colId:e,sourceColumn:s,liveApply:t,mapper:a,initialHeaderName:i?this.getDraftHeaderName(i):void 0}}validateDialogDraft(e,t,s=!1){const{colId:r,mapper:i,liveApply:n,sourceColumn:o}=t,{expression:a,error:l}=i.toInternalExpression(e.calculatedExpression,s?"revalidate":void 0),c=l?.type==="restricted",u=this.beans.colModel.getCol(r)??null,d=this.getOptions()?.getValidationErrors,h=u&&this.getExpressionError(u),p=!s&&h?.reason==="customValidation"&&h.expression===a?h:void 0,g=p?.messages??null;if(n&&!d&&!c)return{expression:a,errors:g?{calculatedExpression:g}:null,expressionError:p};let f=null;l?f=Ay(l,this.getLocaleTextFunc()):py(a,0,!0)?f=this.inspectDialogExpression(e.calculatedExpression,i,s?"revalidate":"diagnostics").diagnostic?.message??null:n||(f=this.getLocaleTextFunc()("calculatedColumnExpressionEmpty","Enter an expression"));const m=this.normaliseValidationErrors({headerName:!n&&!e.headerName.trim()?[this.getLocaleTextFunc()("calculatedColumnTitleEmpty","Enter a title")]:void 0,calculatedExpression:f?[f]:void 0});let v={...m,calculatedExpression:m?.calculatedExpression??g??void 0};d&&(v=d(Vu(this.gos,{colDef:{...u&&this.getResolvedAuthoredColDef(u),...this.toColDef(e),calculatedExpression:a},displayExpression:e.calculatedExpression,referencedColumns:Tre(this.beans,a),internalErrors:m,column:u,sourceColumn:o}))),v=this.normaliseValidationErrors(v),c&&!v?.calculatedExpression&&(v={...v,calculatedExpression:[f]});const C=v?.calculatedExpression;return{expression:a,errors:v,expressionError:c?{expression:a,reason:"restrictedReference",reference:l.reference}:C&&(d||p)?{expression:a,reason:"customValidation",messages:C}:void 0}}normaliseValidationErrors(e){const t={};for(const s of["headerName","cellDataType","calculatedExpression"]){const r=e?.[s];r?.length&&(t[s]=[...r])}return Object.keys(t).length?t:null}inspectDialogExpression(e,t,s="diagnostics"){const{tokens:r,references:i,error:n,range:o}=lS(this.beans,e),a=t.toInternalExpression(e,s,i).error;return a?{tokens:r,diagnostic:{message:Ay(a,this.getLocaleTextFunc()),range:a.range}}:{tokens:r,diagnostic:n?{message:n.getTranslatedMessage(this.getLocaleTextFunc()),range:o}:void 0}}showDialog(e,t,s,r,i=!0,n,o){const{colId:a,liveApply:l}=s,c=this.openDialogsByColId.get(a);if(c){this.beans.menuSvc?.hidePopupMenu(),i&&c.dialog.getGui().focus({preventScroll:!0});return}const u={resolved:!1},d=!!r?.colDef.calculatedColumnReadOnly,h=y=>{const S=this.validateDialogDraft(y,s);if(l&&!d&&r){const w=this.getExpressionError(r);cr(w,S.expressionError)||this.scheduleLiveApplyUpdate(y,s,S)}return S.errors},p=y=>{if(u.resolved)return null;const S=this.validateDialogDraft(y,s);return S.errors?S.errors:(u.resolved=!0,t({...y,calculatedExpression:S.expression}),u.close?.(),null)},g=()=>{u.resolved||(u.resolved=!0,u.close?.())},f=l?y=>this.scheduleLiveApplyUpdate(y,s):void 0,m=this.getDataTypeOptions(e.cellDataType),v=this.createManagedBean(new mre(e,m,this.getExpressionPickers(),()=>s.mapper.suggestions,()=>this.getFunctionSuggestions(),(y,S)=>{const w=this.inspectDialogExpression(y,s.mapper),F=l&&!!y.trim()&&!this.getOptions()?.getValidationErrors&&!S?.length;return w.diagnostic&&!F&&!S?.includes(w.diagnostic.message)&&(w.diagnostic=void 0),w},h,p,g,l,f,d)),C=this.createManagedBean(new ms({title:d?this.getLocaleTextFunc()("calculatedColumnView","View Calculated Column"):this.getLocaleTextFunc()("calculatedColumn","Calculated Column"),component:v,minWidth:320,width:400,minHeight:380,height:380,centered:!0,movable:!0,resizable:!0,modal:!1,cssIdentifier:"calculated-column",closedCallback:y=>{const S=n?o:this.beans.colModel.getCol(a)??o;i&&S&&this.restoreFocusOnDialogClose(S,v.getGui(),y,n)}}));u.close=()=>C.close(),this.openDialogsByColId.set(a,{dialog:C,highlight:r!=null,readOnly:d,refreshValidation:()=>this.refreshDialogValidation(v,s)}),this.refreshCalculatedColumnHighlight(r??null),i&&(zse(v.getGui())[0]??C.getGui()).focus({preventScroll:!0});const b=this.addManagedElementListeners(C.getGui(),{mousedown:()=>v.hideSuggestions()});C.addDestroyFunc(()=>{for(let y=0,S=b.length;y<S;++y)b[y]()}),C.addDestroyFunc(()=>{l&&!d&&this.isAlive()&&!this.beans.context.isDestroyed()?this.flushLiveApplyUpdate(a):this.cancelLiveApplyUpdate(a),this.openDialogsByColId.get(a)?.dialog===C&&(this.openDialogsByColId.delete(a),this.refreshCalculatedColumnHighlight(r??null)),this.finishLiveCreation(a)}),C.addEventListener("destroyed",()=>this.destroyBean(v))}refreshDialogValidation(e,t){const{colId:s,liveApply:r,sourceColumn:i}=t;t.mapper=this.createDialogContext(s,r,i).mapper,e.refreshValidation(n=>{const o=this.validateDialogDraft(n,t,!0),a=this.pendingLiveApplyUpdatesByColId.get(s);return a&&(a.colDef=this.getLiveApplyColDef(n,o,t.initialHeaderName),a.expressionError=o.expressionError),o.errors})}restoreFocusOnDialogClose(e,t,s,r){if(!this.isAlive()||this.beans.context.isDestroyed())return;const i=r?.eventSource;if(!i){if(e.isAlive()&&hy(this.beans)){const o=this.beans.headerNavigation?.getHeaderPositionForColumn(e,!1);o&&this.beans.focusSvc.focusHeaderPosition({headerPosition:o})}return}const n={column:e,columnIndex:e.allColsIndex,headerPosition:r.headerPosition,getEventSource:()=>i};this.beans.menuUtils?.restoreFocusOnClose(n,t,s,!0),hy(this.beans)&&r.headerPosition&&this.beans.focusSvc.focusHeaderPosition({headerPosition:r.headerPosition})}scheduleLiveApplyUpdate(e,t,s=this.validateDialogDraft(e,t)){const r=t.colId,{errors:i,expressionError:n}=s,o=this.getLiveApplyColDef(e,s,t.initialHeaderName),a=this.getOptions()?.applyDebounce??0,l=Number.isInteger(a)&&a>=0?a:0,c=this.pendingLiveApplyUpdatesByColId.get(r);if(l===0&&c&&c.timeout===void 0)return c.colDef=o,c.expressionError=n,i;this.cancelLiveApplyUpdate(r);const u={colDef:o,expressionError:n};this.pendingLiveApplyUpdatesByColId.set(r,u);const d=()=>{this.isAlive()&&this.pendingLiveApplyUpdatesByColId.get(r)===u&&this.flushLiveApplyUpdate(r)};return l>0?u.timeout=window.setTimeout(d,l):Wse(this.beans,d),i}getLiveApplyColDef(e,t,s){const{colId:r,...i}=this.toColDef({...e,calculatedExpression:t.expression});return i.headerName||(i.headerName=s),t.errors?.headerName&&delete i.headerName,t.errors?.cellDataType&&delete i.cellDataType,i}flushLiveApplyUpdate(e){const t=this.pendingLiveApplyUpdatesByColId.get(e);t!==void 0&&(this.cancelLiveApplyUpdate(e),this.updateCalculatedColumn(e,t.colDef,t.expressionError))}cancelLiveApplyUpdate(e){const t=this.pendingLiveApplyUpdatesByColId.get(e);t?.timeout!==void 0&&window.clearTimeout(t.timeout),this.pendingLiveApplyUpdatesByColId.delete(e)}closeCalculatedColumnDialog(e){this.liveCreationColumnIds.delete(e);const t=this.openDialogsByColId.get(e);t!==void 0&&(this.cancelLiveApplyUpdate(e),t.dialog.close())}finishLiveCreation(e){this.liveCreationColumnIds.delete(e)&&this.isAlive()&&!this.beans.context.isDestroyed()&&this.beans.colModel.getCol(e)?.isCalculatedCol&&this.getOptions()?.processColDef&&this.refreshDynamicColumns("calculatedColumn")}getDefaultDraft(){const e=this.getDataTypeOptions()[0]?.value??zu.cellDataType;return{...zu,cellDataType:e}}getDataTypeOptions(e){const t=this.getOptions()?.dataTypes,s=t?this.getValidConfiguredDataTypes(t):[...cre];return typeof e=="string"&&s.indexOf(e)<0&&s.push(e),s.map(r=>({value:r,text:this.getDataTypeDisplayName(r)}))}getValidConfiguredDataTypes(e){const t=this.beans.dataTypeSvc;if(!t)return[...e];const s=[];for(const r of e)t.isDataTypeRegistered(r)?s.push(r):this.warn(304,{dataType:r});return s}getDataTypeDisplayName(e){const t=Pre[e];return t!=null?this.getLocaleTextFunc()(t,this.formatDataTypeName(e)):this.formatDataTypeName(e)}formatDataTypeName(e){return Use(e.replace(/[_-]+/g,"."))??e}getExpressionPickers(){const e=this.getOptions()?.expressionPickers;return e===void 0?[...ure]:e??[]}toDraft(e,t){const s=this.getResolvedAuthoredColDef(e);return{colId:e.colId,headerName:this.getDraftHeaderName(e),cellDataType:s.cellDataType,calculatedExpression:t.toDisplayExpression(s.calculatedExpression??"")}}getDraftHeaderName(e){return e.headerNameOverride??this.getResolvedAuthoredColDef(e).headerName??e.colId}focusCalculatedColumn(e){window.setTimeout(()=>{const t=this.beans,s=this.isAlive()&&t.headerNavigation?.getHeaderPositionForColumn(e,!1);s&&t.focusSvc.focusHeaderPosition({headerPosition:s})},0)}toColDef(e){return{colId:e.colId,headerName:e.headerName,calculatedExpression:fy(e.calculatedExpression)??"",cellDataType:e.cellDataType,editable:!1,suppressPaste:!0}}getExpressionValidationState(e,t){return py(e,0,!0)?this.getInvalidColumnReference(e,t)!=null?"unknownReference":this.getFormulaExpressionError(e)==null?"valid":"invalidExpression":"valid"}getExpressionValidation(e,t,s){if(t)return{valid:!1,reason:t.reason};const r=this.getExpressionValidationState(e,s);return r==="valid"?{valid:!0}:{valid:!1,reason:r}}forEachCalculatedColumn(e){const t=this.beans.colModel.colDefList;for(let s=0,r=t.length;s<r;++s){const i=t[s];i.isCalculatedCol&&e(i,i.colId,i.colDef.calculatedExpression??"")}}checkColumnLifecycle(e){const t=this.knownCalculatedColumns,s=new Map,r=this.lifecycleInitialised&&this.suppressValidationChecks===0;this.forEachCalculatedColumn((i,n)=>{s.set(n,{column:i,colDef:ts(this.getResolvedAuthoredColDef(i))})}),this.knownCalculatedColumns=s,this.lifecycleInitialised=!0,s.forEach(({column:i,colDef:n},o)=>{const a=n.calculatedExpression??"",l=this.openDialogsByColId.get(o);if(l&&l.readOnly!==!!i.colDef.calculatedColumnReadOnly&&this.closeCalculatedColumnDialog(o),!r)return;const c=t.get(o);c==null?this.dispatchCreatedOrRemovedEvent("calculatedColumnCreated",this.getEventCommonParams(i,a,e)):this.dispatchChangedEvents(i,c.colDef,n,e)}),t.forEach((i,n)=>{s.has(n)||(this.closeCalculatedColumnDialog(n),r&&this.dispatchCreatedOrRemovedEvent("calculatedColumnRemoved",this.getEventCommonParams(i.column,i.colDef.calculatedExpression??"",e)))})}dispatchChangedEvents(e,t,s,r,i){const n=uQ(t,s);if(!n&&!i)return;const o=this.getExpressionValidation(s.calculatedExpression??"",this.getExpressionError(e));if(!n&&cr(i,o))return;const a=this.getEventCommonParams(e,s.calculatedExpression??"",r);this.eventSvc.dispatchEvent({type:"calculatedColumnChanged",...a,changes:n??{},expressionValidation:o}),n?.calculatedExpression&&this.dispatchExpressionChangedEvent(a,t.calculatedExpression??"")}checkValidationStates(e,t=!1){if(this.suppressValidationChecks>0)return;const s=t||this.validationStatesInitialised,r=this.validationStatesByColId,i=new Map;this.forEachCalculatedColumn((n,o,a)=>{const l=this.getExpressionValidationState(a);i.set(o,l);const c=r.get(o),u=c!==void 0;if(s&&(u&&c!==l||!u&&l!=="valid")){const h=l==="valid";this.dispatchValidationStateChangedEvent(this.getEventCommonParams(n,a,e),h,h?void 0:l)}}),this.validationStatesByColId=i,this.validationStatesInitialised=!0}getEventCommonParams(e,t,s){return{column:e,columns:[e],expression:t,source:s}}dispatchCreatedOrRemovedEvent(e,t){this.eventSvc.dispatchEvent({type:e,...t})}dispatchExpressionChangedEvent(e,t){this.eventSvc.dispatchEvent({type:"calculatedColumnExpressionChanged",...e,oldExpression:t})}dispatchValidationStateChangedEvent(e,t,s){this.eventSvc.dispatchEvent({type:"calculatedColumnValidationStateChanged",...e,valid:t,reason:s})}getFunctionSuggestions(){return(this.beans.formula?.getFunctionNames()??[]).map(e=>({type:"function",value:e,label:e}))}refreshCalculatedColumn(e){window.setTimeout(()=>{const t=this.beans,s=this.isAlive()&&t.colModel.colsById[e];s&&t.rowRenderer.refreshCells({columns:[s],force:!0})},0)}},Py={moduleName:"CalculatedColumns",version:_,beans:[Rre,Ose],apiFunctions:{openAddCalculatedColumnDialog:Vse,openCalculatedColumnDialog:Bse,refreshCalculatedColumns:Hse},dependsOn:[ku,Gse,kse,_se],icons:{calculatedColumnsHeader:"fx",calculatedColumnAdd:"plus",calculatedColumnEdit:"edit",calculatedColumnRemove:"minus"},css:[Nse]};import{BeanStub as Mre}from"ag-grid-community";var Ire=class{constructor(e,t,s){this.params=e;const{aggregatedChildren:r,column:i,newValue:n}=e,o=ar(n),a=ar(e.oldValue),l=r.length,c=BigInt(l);this.children=r,this.column=i,this.count=l,this.bigCount=c,this.newValue=n,this.strategy=_o(s,t?.distribution),s==="avg"?(this.target=o*c,this.oldTarget=a*c):(this.target=o,this.oldTarget=a),this.getVal=t?.getValue,this.setVal=t?.setValue}run(){const{strategy:e,newValue:t}=this;if(e===!1)return!1;if(e==="overwrite")return this.writeAll(t);const{target:s,oldTarget:r}=this;return s===0n&&!Go(t)?this.writeAll(t):e==="increment"&&s===r?!1:e==="uniform"?this.writeUniformDirect(s):e==="increment"?this.writeIncrementDirect(s-r):this.writePercentage()}readOne(e){const{children:t,column:s,getVal:r}=this,i=t[e];if(r){const{colDef:n,api:o,context:a}=this.params;return ar(r({node:i,data:i.data,column:s,colDef:n,api:o,context:a,groupParams:this.params}))}return ar(i.getDataValue(s,"value"))}writeOne(e,t){const{children:s,column:r,setVal:i}=this,n=s[e];if(i){const{colDef:o,api:a,context:l}=this.params;return i({node:n,data:n.data,column:r,colDef:o,api:a,context:l,groupParams:this.params,value:t})}return n.setDataValue(r,t,"data")}writeAll(e){const{count:t}=this;let s=!1;for(let r=0;r<t;++r)this.writeOne(r,e)&&(s=!0);return s}writeUniformDirect(e){const{count:t,bigCount:s}=this,r=e/s,i=e-r*s,n=Number(i<0n?-i:i),o=i>=0n?1n:-1n;let a=!1;for(let l=0;l<t;++l)this.writeOne(l,l<n?r+o:r)&&(a=!0);return a}writeIncrementDirect(e){const{count:t,bigCount:s}=this,r=e/s,i=e-r*s,n=Number(i<0n?-i:i),o=i>=0n?1n:-1n;let a=!1;for(let l=0;l<t;++l)this.writeOne(l,this.readOne(l)+r+(l<n?o:0n))&&(a=!0);return a}writePercentage(){const{count:e,target:t}=this;let s=0n;const r=new Array(e);for(let a=0;a<e;++a){const l=this.readOne(a);r[a]=l,s+=l}if(s===0n)return this.writeUniformDirect(t);let i=0n;for(let a=0;a<e;++a){const l=r[a]*t/s;r[a]=l,i+=l}let n=t-i;for(let a=0;n>0n&&a<e;++a,--n)++r[a];for(let a=0;n<0n&&a<e;++a,++n)--r[a];let o=!1;for(let a=0;a<e;++a)this.writeOne(a,r[a])&&(o=!0);return o}},Ere=class{constructor(e,t,s){this.params=e;const{aggregatedChildren:r,column:i,colDef:n,newValue:o}=e,a=nt(o),l=r.length,c=s==="avg";this.children=r,this.column=i,this.count=l,this.newValue=o,this.strategy=_o(s,t?.distribution),this.isAvg=c,c?(this.target=a*l,this.oldTarget=nt(e.oldValue)*l):(this.target=a,this.oldTarget=nt(e.oldValue));const u=t?.precision;u===!1?this.precision=void 0:typeof u=="number"?this.precision=Number.isInteger(u)&&u>=0?u:void 0:this.precision=Wte(n),this.getVal=t?.getValue,this.setVal=t?.setValue}run(){const{strategy:e,newValue:t}=this;if(e===!1)return!1;if(e==="overwrite")return this.writeAll(t);if(this.target===0&&!Go(t))return this.writeAll(t);if(e==="increment"&&this.target===this.oldTarget)return!1;switch(e){case"uniform":return this.distributeUniform();case"increment":return this.distributeIncrement();default:return this.isAvg?this.distributePercentageAvg():this.distributePercentage()}}readOne(e){const{column:t,getVal:s}=this;if(s){const{colDef:r,api:i,context:n}=this.params;return nt(s({node:e,data:e.data,column:t,colDef:r,api:i,context:n,groupParams:this.params}))}return nt(e.getDataValue(t,"value"))}readValueAndCount(e){const{column:t,getVal:s}=this;let r;if(s){const{colDef:i,api:n,context:o}=this.params;r=s({node:e,data:e.data,column:t,colDef:i,api:n,context:o,groupParams:this.params})}else r=e.getDataValue(t);if(e.group){if(r!=null&&typeof r=="object"){const{value:i,count:n}=r;if(i!=null&&typeof n=="number"&&n>0)return typeof i=="number"?r:{value:nt(i),count:n}}return{value:nt(r),count:e.allLeafChildren?.length||1}}return{value:nt(r),count:1}}writeOne(e,t){const{column:s,setVal:r}=this;if(r){const{colDef:i,api:n,context:o}=this.params;return r({node:e,data:e.data,column:s,colDef:i,api:n,context:o,groupParams:this.params,value:t})}return e.setDataValue(s,t,"data")}writeAll(e){const{children:t,count:s}=this;let r=!1;for(let i=0;i<s;++i)this.writeOne(t[i],e)&&(r=!0);return r}distributeUniform(){const{children:e,count:t,target:s,precision:r}=this;if(r===void 0)return this.writeAll(s/t);const i=10**r,n=Math.round(s*i),o=Math.trunc(n/t),a=n-o*t,l=Math.abs(a),c=a>=0?1:-1;let u=!1;for(let d=0;d<t;++d)this.writeOne(e[d],(d<l?o+c:o)/i)&&(u=!0);return u}distributeIncrement(){const{children:e,count:t,target:s,oldTarget:r,precision:i}=this;if(i===void 0){const h=(s-r)/t;let p=!1;for(let g=0;g<t;++g){const f=e[g];this.writeOne(f,this.readOne(f)+h)&&(p=!0)}return p}const n=10**i,o=Math.round(s*n)-Math.round(r*n),a=Math.trunc(o/t),l=o-a*t,c=Math.abs(l),u=l>=0?1:-1;let d=!1;for(let h=0;h<t;++h){const p=e[h],g=Math.round(this.readOne(p)*n);this.writeOne(p,(g+a+(h<c?u:0))/n)&&(d=!0)}return d}distributePercentage(){const{children:e,count:t,target:s,precision:r}=this,i=new Array(t);let n=0;for(let p=0;p<t;++p){const g=this.readOne(e[p]);i[p]=g,n+=g}if(n===0)return this.distributeUniform();if(r===void 0){const p=s/n;let g=!1;for(let f=0;f<t;++f)this.writeOne(e[f],i[f]*p)&&(g=!0);return g}const o=10**r,a=Math.round(s*o);let l=0;for(let p=0;p<t;++p){const g=Math.round(i[p]/n*a);i[p]=g,l+=g}const c=a-l,u=Math.abs(c),d=c>=0?1:-1;let h=!1;for(let p=0;p<t;++p)this.writeOne(e[p],(i[p]+(p<u?d:0))/o)&&(h=!0);return h}distributePercentageAvg(){const{children:e,count:t,target:s,precision:r}=this,i=new Array(t),n=new Array(t);let o=0,a=0;for(let m=0;m<t;++m){const v=this.readValueAndCount(e[m]),C=v.count;n[m]=C,a+=C;const b=v.value*C;i[m]=b,o+=b}if(o===0)return this.distributeUniform();const l=s/t*a;if(r===void 0){const m=l/o;let v=!1;for(let C=0;C<t;++C)this.writeOne(e[C],i[C]*m/n[C])&&(v=!0);return v}const c=10**r,u=Math.round(l*c);let d=0;for(let m=0;m<t;++m){const v=Math.round(i[m]/o*u);i[m]=v,d+=v}const h=u-d,p=Math.abs(h),g=h>=0?1:-1;let f=!1;for(let m=0;m<t;++m)this.writeOne(e[m],(i[m]+(m<p?g:0))/(c*n[m]))&&(f=!0);return f}},Ry=(e,t)=>{const{aggregatedChildren:s,colDef:r}=e;if(s.length===0)return!1;const i=r.aggFunc??null,n=My(t,i);return n===!1?!1:typeof n=="function"?n(e)??!0:r.cellDataType==="bigint"?new Ire(e,n,i).run():new Ere(e,n,i).run()};function My(e,t){if(!e)return;const s=e.distribution;if(s===!1||s===null)return!1;const r=JS(t),i=e.default;if(typeof s=="object"){const n=typeof t=="string"?s[t]:void 0;return n!==void 0?$u(n,r,e):r?!1:$u(i,!1,e)??ju(e)}if(r)return s==="overwrite"?ju(e,"overwrite"):!1;if(s===void 0&&!zte(t)){const n=$u(i,!1,e);if(n!==void 0)return n}return e}function $u(e,t,s){if(e===!1||e===null)return!1;if(e!==void 0){if(typeof e=="function")return e;if(typeof e=="object"){const r=e.distribution;if(t&&r!=="overwrite"&&r!==!0)return!1;const{precision:i,getValue:n,setValue:o}=s;return{distribution:t?"overwrite":r,precision:e.precision??i,getValue:e.getValue??n,setValue:e.setValue??o}}return t&&e!=="overwrite"&&e!==!0?!1:ju(s,t?"overwrite":e)}}function ju(e,t){return{distribution:t,precision:e.precision,getValue:e.getValue,setValue:e.setValue}}var Dre=class extends xT{constructor(){super(...arguments),this.beanName="rowGroupingEditValueSvc"}isGroupCellEditable(e,t){const s=t.colDef;if(!t.isColumnFunc(e,s.groupRowEditable))return!1;const r=s.groupRowValueSetter;if(typeof r=="function")return!0;const i=s.aggFunc??null;if(typeof r=="object"){const n=My(r,i);return typeof n=="function"||n!==!1&&_o(i,n?.distribution)!==!1}return _o(i,r??void 0)!==!1}setGroupDataValue(e,t,s,r,i,n){const o=t.colDef;let a=o.groupRowValueSetter;if(a==null){const u=o.groupRowEditable;a=u&&t.isColumnFunc(e,u)?!0:void 0}if(!a)return;const l=this.gos.addCommon({node:e,data:e.data,oldValue:r,newValue:s,colDef:o,column:t,eventSource:i,valueChanged:n,aggregatedChildren:this.beans.aggChildrenSvc?.getAggregatedChildren(e,t)??[]});return(typeof a=="function"?a(l):Ry(l,a===!0?void 0:a))??!0}},Iy={moduleName:"RowGroupingEdit",version:_,beans:[Dre],dependsOn:[$,Lc]};import{_PopupModule as Lre,_SharedDragAndDropModule as kre,_setAgPackageInfo as _re}from"ag-grid-community";import{BeanStub as Gre}from"ag-grid-community";var Ore=class extends FT{constructor(e){super(),this.beanName="agChartsExports",this.isEnterprise=!1,this.create=e.create,this._Theme=e._Theme,this.isEnterprise=e.isEnterprise}};import{BeanStub as Nre}from"ag-grid-community";import{_parseDateTimeFromString as Bre}from"ag-stack";function Ey(e){return e.chart!=null?e.chart:e}var Vre=new Set(["__proto__","constructor","prototype"]);function ur(e,t,s){if(e==null)return s;const r=t.split(".");let i=e;for(;r.length>1;)if(i=i[r.shift()],i==null)return s;return i[r[0]]??s}function Hre(e,t,s){if(e==null)return;const r=t.split(".");let i=e;r.filter(n=>!Vre.has(n)).forEach((n,o)=>{i[n]||(i[n]={}),o<r.length-1&&(i=i[n])}),i[r[r.length-1]]=s}var Ure={column:"bar",groupedColumn:"bar",stackedColumn:"bar",normalizedColumn:"bar",bar:"bar",groupedBar:"bar",stackedBar:"bar",normalizedBar:"bar",line:"line",stackedLine:"line",normalizedLine:"line",scatter:"scatter",bubble:"bubble",pie:"pie",donut:"donut",doughnut:"donut",area:"area",stackedArea:"area",normalizedArea:"area",histogram:"histogram",radarLine:"radar-line",radarArea:"radar-area",nightingale:"nightingale",radialColumn:"radial-column",radialBar:"radial-bar",sunburst:"sunburst",rangeBar:"range-bar",rangeArea:"range-area",boxPlot:"box-plot",treemap:"treemap",heatmap:"heatmap",waterfall:"waterfall",funnel:"funnel",coneFunnel:"cone-funnel",pyramid:"pyramid"},zre=new Set(["columnLineCombo","areaColumnCombo","customCombo"]),Wre=["grouped","stacked","normalized"],Dy={area:{isCartesian:!0,canInvert:!0},bar:{isCartesian:!0,canInvert:!0},histogram:{isCartesian:!0},line:{isCartesian:!0,canInvert:!0},pie:{isPie:!0},donut:{isPie:!0,canInvert:!0},scatter:{isCartesian:!0},bubble:{isCartesian:!0},"radial-column":{isPolar:!0,isEnterprise:!0,isRadial:!0,canInvert:!0},"radial-bar":{isPolar:!0,isEnterprise:!0,isRadial:!0,canInvert:!0},"radar-line":{isPolar:!0,isEnterprise:!0,canInvert:!0},"radar-area":{isPolar:!0,isEnterprise:!0,canInvert:!0},nightingale:{isPolar:!0,isEnterprise:!0,canInvert:!0},"range-bar":{isCartesian:!0,isStatistical:!0,isEnterprise:!0,canSwitchDirection:!0},"range-area":{isCartesian:!0,isStatistical:!0,isEnterprise:!0},"box-plot":{isCartesian:!0,isStatistical:!0,isEnterprise:!0,canSwitchDirection:!0},treemap:{isEnterprise:!0,isHierarchical:!0},sunburst:{isEnterprise:!0,isHierarchical:!0},heatmap:{isCartesian:!0,isEnterprise:!0},waterfall:{isCartesian:!0,isEnterprise:!0,canSwitchDirection:!0},funnel:{isCartesian:!0,isEnterprise:!0,canSwitchDirection:!0},"cone-funnel":{isCartesian:!0,isEnterprise:!0,canSwitchDirection:!0},pyramid:{isCartesian:!0,isEnterprise:!0,canSwitchDirection:!0}};function Kre(e){return!!Dy[e]}function Yu(e){return zre.has(e)}function _t(e,t){return!!Dy[e]?.[t]}function $re(e){return _t(se(e),"isEnterprise")}var jre=new Set(["stackedColumn","normalizedColumn","stackedBar","normalizedBar"]);function Yre(e){return jre.has(e)}function ss(e){return _t(e,"isCartesian")}function qu(e){return e==="funnel"||e==="cone-funnel"||e==="pyramid"}function Zu(e){return _t(e,"isPolar")}function qre(e){return _t(e,"isRadial")}function Ts(e){return _t(e,"isHierarchical")}function Zre(e){return _t(e,"isStatistical")}function Mi(e){return e==="doughnut"?"donut":e}function Ly(e){return Ure[e]}function se(e){return Ly(e)??"line"}function ky(e){return _t(e,"isPie")}function Xre(e){return e==="pie"||e==="waterfall"||e==="histogram"||e==="funnel"||e==="coneFunnel"||e==="pyramid"}function Xu(e){return Ts(se(e))?void 0:1}function Ho(e){return Ts(se(e))?2:Xre(e)?1:void 0}function _y(e){return!Yu(e)&&_t(se(e),"canInvert")}function Jre(e){return _t(se(e),"canSwitchDirection")}function Ju(e){switch(e){case"groupedColumn":case"stackedColumn":case"normalizedColumn":case"groupedBar":case"stackedBar":case"normalizedBar":case"stackedLine":case"normalizedLine":case"stackedArea":case"normalizedArea":return`${e}Full`;case"doughnut":return"donut";case"areaColumnCombo":return"AreaColumnCombo";default:return e}}import{_warnForGrid as Qre}from"ag-grid-community";var Gy=["number","category","grouped-category","log","time"];function eie(e){switch(e){case"bar":case"stackedBar":case"normalizedBar":return["number","category"];case"groupedBar":return["number","grouped-category"];case"column":case"stackedColumn":case"normalizedColumn":case"line":case"stackedLine":case"normalizedLine":case"area":case"stackedArea":case"normalizedArea":case"histogram":return["category","number"];case"groupedColumn":return["grouped-category","number"];case"scatter":case"bubble":return["number","number"];default:return}}function tie(e,t,s,r,i){const{chartOptionsToRestore:n,chartPaletteToRestore:o,chartThemeToRestore:a}=e,l=lie(e),c=Qu(l),u=c?{baseTheme:l}:Oy(e,l)??{},d=e.getGridOptionsChartThemeOverrides(),h=e.apiChartThemeOverrides,p=se(e.chartType),g=e.crossFiltering?iie(t,e,p):void 0,v=[c?oie(e,s,(()=>{const C=b=>b?Object.keys(b).some(y=>ur(b[y],"title.enabled",!1)):!1;return C(d)||C(h)})()):void 0,aie(),r,g,d,h,{...n},i].filter(C=>!!C).reduce((C,b)=>({baseTheme:C,overrides:b}),u);if(o&&l===a){const C=e.agChartsExports._Theme.getChartTheme(u).palette;sie(o,C)||(v.palette=o)}return v}function sie(e,t){const s=(r,i)=>r===i?!0:r?.length!==i?.length?!1:r?.every((n,o)=>n===i?.[o])??!1;return s(e.fills,t.fills)&&s(e.strokes,t.strokes)}var rie={"ag-default":!0,"ag-default-dark":!0,"ag-sheets":!0,"ag-sheets-dark":!0,"ag-polychroma":!0,"ag-polychroma-dark":!0,"ag-vivid":!0,"ag-vivid-dark":!0,"ag-material":!0,"ag-material-dark":!0,"ag-financial":!0,"ag-financial-dark":!0};function Qu(e){return Object.prototype.hasOwnProperty.call(rie,e)}function iie(e,t,s){const i={tooltip:{delay:500},legend:{listeners:{legendItemClick:o=>{const a=e.getChart(),l=[o.seriesId,`${o.seriesId}-filtered-out`];for(const c of a.series.filter(u=>l.includes(u.id)))c.toggleSeriesItem(void 0,"category",o.itemId,void 0)}}},listeners:{click:o=>t.crossFilterCallback(o,!0)}};if(s==="pie"||s==="donut")return{[s]:{series:{fills:{$applyCycle:[{$palette:"fills"},{$if:[{$eq:[{$value:"$parentIndex"},0]},{$mix:[{$value:"$1"},{$ref:"backgroundColor"},.7]},{$value:"$1"}]}]},strokes:{$applyCycle:[{$palette:"strokes"},{$if:[{$eq:[{$value:"$parentIndex"},0]},{$mix:[{$value:"$1"},{$ref:"backgroundColor"},.7]},{$value:"$1"}]}]}},...i}};const n={};return s!=="line"&&(n.fill={$if:[{$isEven:[{$value:"$index"}]},{$palette:"fill"},{$mix:[{$path:["../$prevIndex/fill",{$palette:"fill"}]},{$ref:"backgroundColor"},.7]}]}),{[s]:{series:{stroke:{$if:[{$isEven:[{$value:"$index"}]},{$palette:"stroke"},{$mix:[{$path:["../$prevIndex/fill",{$palette:"stroke"}]},{$ref:"backgroundColor"},.7]}]},...n},...i}}}var nie=Gy.reduce((e,t)=>({...e,[t]:{title:{_enabledFromTheme:!0}}}),{});function oie(e,t,s){const r=e.getExtraPaddingDirections();return{common:{...t?{animation:{duration:500}}:void 0,axes:nie,padding:{top:!s&&r.includes("top")?40:20,right:r.includes("right")?30:20,bottom:r.includes("bottom")?40:20,left:r.includes("left")?30:20}}}}function aie(){return{pie:{series:{title:{_enabledFromTheme:!0},calloutLabel:{_enabledFromTheme:!0},sectorLabel:{enabled:!1,_enabledFromTheme:!0}}},donut:{series:{title:{_enabledFromTheme:!0},calloutLabel:{_enabledFromTheme:!0},sectorLabel:{enabled:!1,_enabledFromTheme:!0}}}}}function lie(e){let t=e.getChartThemeName();const s=e.getChartThemes();return s.includes(t)||(t=s[0]),t}function Oy(e,t){const{customChartThemes:s}=e,r=s?.[t];return r||Qre(e.gridId,140,{name:t}),r}function ed(e,t){const s={highlightedItem:{strokeWidth:2}};return t||(s.unhighlightedSeries={opacity:1}),e||(s.unhighlightedItem={opacity:1}),s}var dr=class{constructor(e){this.chartProxyParams=e,this.clearThemeOverrides=!1,this.agChartsExports=e.agChartsExports,this.chart=e.chartInstance,this.chartType=e.chartType,this.crossFiltering=e.crossFiltering,this.crossFilterCallback=e.crossFilterCallback,this.standaloneChartType=se(this.chartType),this.chart==null?this.chart=e.agChartsExports.create(this.getCommonChartOptions()):this.clearThemeOverrides=!0}crossFilteringReset(){}update(e){this.getChartRef().update(this.getUpdateOptions(e,this.getCommonChartOptions(e.updatedOverrides)))}updateThemeOverrides(e){this.getChartRef().updateDelta({theme:{overrides:e}})}getChart(){return Ey(this.chart)}getChartRef(){return this.chart}downloadChart(e,t,s){const{chart:r}=this,i=Ey(r),n=t||i.title.node.getPlainText(),{width:o,height:a}=e??{};r.download({width:o,height:a,fileName:n,fileFormat:s})}getChartImageDataURL(e){return this.getChart().getCanvasDataURL(e)}getChartOptions(){return this.chart.getOptions()}getChartThemeOverrides(){return this.getChartOptions().theme.overrides??{}}getChartPalette(){return this.agChartsExports._Theme.getChartTheme(this.getChartOptions().theme).palette}setPaired(e){const t=se(this.chartProxyParams.chartType);this.chart.updateDelta({theme:{overrides:{[t]:{paired:e}}}})}isPaired(){const e=se(this.chartProxyParams.chartType);return ur(this.getChartThemeOverrides(),`${e}.paired`,!0)}lookupCustomChartTheme(e){return Oy(this.chartProxyParams,e)}getSeriesGroupType(){}transformCategoryData(e,t){return e.map((s,r)=>{const i=s[t],n=i?.toString?i.toString():"",o={...s};return o[t]={id:r,value:i,toString:()=>n},o})}getCommonChartOptions(e){const t=this.clearThemeOverrides?{}:this.chart?.getOptions()??{},s=this.chart!=null?this.getActiveFormattingPanelOverrides():void 0;this.clearThemeOverrides=!1;const r=this.chartProxyParams,i=r.styleNonce,n=tie(r,this,this.agChartsExports.isEnterprise,this.getChartThemeDefaults(),e??s);return{...t,mode:"integrated",...i?{styleNonce:i}:{},suppressFieldDotNotation:!0,theme:n,container:r.parentElement,enableRtl:r.enableRtl}}getChartThemeDefaults(){const e={enabled:!0,snap:!0,label:{enabled:!1}},t=this.agChartsExports.isEnterprise?{zoom:{enabled:!0},animation:{enabled:!0,duration:500},axes:{number:{crosshair:e},category:{crosshair:e},log:{crosshair:e},time:{crosshair:e}}}:{};t.minHeight=0,t.minWidth=0,t.navigator={enabled:!1,height:18},t.context=this.chartProxyParams.context;const s={common:t};return this.setSeriesChartThemeDefaults(s),s}setSeriesChartThemeDefaults(e){const t=this.getSeriesChartThemeDefaults();t&&(e[this.standaloneChartType]=t)}getSeriesChartThemeDefaults(){}getActiveFormattingPanelOverrides(){return this.clearThemeOverrides?{}:this.chart?.getOptions().theme?.overrides??{}}destroy({keepChartInstance:e=!1}={}){if(e)return this.chart.resetAnimations(),this.chart;this.destroyChart()}destroyChart(){this.chart&&(this.chart.destroy(),this.chart=void 0)}};function td({value:e,source:t}){return t==="tooltip"||t==="series-label"?void 0:Math.round(e)+"%"}var rs=class extends dr{constructor(){super(...arguments),this.crossFilteringAllPoints=new Set,this.crossFilteringSelectedPoints=[],this.isSingleSeries=!1}getUpdateOptions(e,t){const s=this.getAxes(e,t);return{...t,data:this.getData(e,s),axes:s,series:this.getSeries(e)}}getData(e,t){const s=["area","line"].includes(this.standaloneChartType);return this.crossFiltering&&s?this.getCrossFilterData(e):this.getDataTransformedData(e,t)}getDataTransformedData(e,t){const s=t.x.type,{categories:r,data:i}=e,[n]=r;switch(s){case"category":return this.transformCategoryData(i,n.id);case"time":return this.transformTimeData(i,n.id,n.convertTime);default:return i}}getXAxisType(e){return e.grouping?"grouped-category":this.isXAxisOfType(e,"time",t=>t instanceof Date)?"time":this.isXAxisOfType(e,"number")?"number":"category"}isXAxisOfType(e,t,s){const[r]=e.categories;if(r?.chartDataType)return r.chartDataType===t;if(!s)return!1;const i=e.data[0];return i?s(i[r.id]):!1}transformTimeData(e,t,s){return e[0]?.[t]instanceof Date?e:e.map(i=>{const n=i[t];return typeof n=="string"?{...i,[t]:s?s(n):Bre(n)}:i})}crossFilteringReset(){this.crossFilteringSelectedPoints=[],this.crossFilteringAllPoints.clear()}crossFilteringPointSelected(e){return this.crossFilteringSelectedPoints.length==0||this.crossFilteringSelectedPoints.includes(e)}crossFilteringDeselectedPoints(){return this.crossFilteringSelectedPoints.length>0&&this.crossFilteringAllPoints.size!==this.crossFilteringSelectedPoints.length}extractLineAreaCrossFilterSeries(e,t){const[s]=t.categories,r=i=>this.standaloneChartType==="area"?t.getCrossFilteringContext().lastSelectedChartId===t.chartId?i+"-total":i:i+"-total";return e.map(i=>(i.yKey=r(i.yKey),i.listeners={seriesNodeClick:n=>{const o=n.datum[i.xKey],a=n.event.metaKey||n.event.ctrlKey;this.crossFilteringAddSelectedPoint(a,o),this.crossFilterCallback(n)}},i.marker={itemStyler:n=>{const o=n.datum[s.id],a=n.highlightState==="highlighted-item";return{fill:a?"yellow":n.fill,size:a?14:this.crossFilteringPointSelected(o)?8:0}}},this.standaloneChartType==="area"&&(i.fillOpacity=this.crossFilteringDeselectedPoints()?.3:1),this.standaloneChartType==="line"&&(i.strokeOpacity=this.crossFilteringDeselectedPoints()?.3:1),i))}getCrossFilterData(e){this.crossFilteringAllPoints.clear();const[t]=e.categories,s=e.fields[0].colId,r=`${s}-filtered-out`,i=e.getCrossFilteringContext().lastSelectedChartId;return e.data.map(n=>{const o=n[t.id];this.crossFilteringAllPoints.add(o);const a=this.crossFilteringPointSelected(o);return this.standaloneChartType==="area"&&i===e.chartId&&(n[`${s}-total`]=a?n[s]:n[s]+n[r]),this.standaloneChartType==="line"&&(n[`${s}-total`]=a?n[s]:n[s]+n[r]),n})}crossFilteringAddSelectedPoint(e,t){e?this.crossFilteringSelectedPoints.push(t):this.crossFilteringSelectedPoints=[t]}isHorizontal(e){const t=this.standaloneChartType;if(t!=="waterfall"&&t!=="box-plot"&&t!=="range-bar")return!1;const s=e.theme,r=i=>{const n=i?.overrides?.[t]?.series?.direction;return n!=null?n==="horizontal":typeof i?.baseTheme=="object"?r(i.baseTheme):!1};return r(s)}getSeriesChartThemeDefaults(){return{series:{highlight:ed(this.crossFiltering,this.isSingleSeries)}}}},cie=class extends rs{getSeries(e){const t=e.fields[0];return[{type:this.standaloneChartType,xKey:t.colId,xName:t.displayName,yName:this.chartProxyParams.translate("histogramFrequency"),areaPlot:!1}]}getAxes(e){return{x:{type:"number",position:"bottom"},y:{type:"number",position:"left"}}}},uie=class extends rs{constructor(){super(...arguments),this.isSingleSeries=!0}getAxes(e,t){const s=this.isHorizontal(t),r=s?"y":"x",i=s?"x":"y";return{[r]:{type:this.getXAxisType(e),position:s?"left":"bottom"},[i]:{type:"number",position:s?"bottom":"left"}}}getSeries(e){const[t]=e.categories,[s]=e.fields;return[{type:this.standaloneChartType,xKey:t.id,xName:t.name,yKey:s.colId,yName:s.displayName??void 0}]}},die=class extends dr{getUpdateOptions(e,t){return{...t,data:this.transformFunnelCategories(e),series:this.getSeries(e)}}transformFunnelCategories(e){const{data:t}=e,[{id:s}]=e.categories;return t.map((r,i)=>({...r,[s]:{name:r[s],id:i,toString:()=>String(r[s])}}))}getSeriesChartThemeDefaults(){const e={crosshair:{enabled:!1}};return{zoom:{enabled:!1},...this.chartType!=="pyramid"&&{axes:{category:e,number:e}}}}getSeries(e){const[{id:t}]=e.categories,[{colId:s}]=e.fields;return[{type:this.standaloneChartType,stageKey:t,valueKey:s}]}};import{GROUP_AUTO_COLUMN_ID as hie}from"ag-grid-community";var Uo="AG-GRID-DEFAULT-LABEL-KEY";function pie(e,t){const s=Ny(e,r,i);return sd(s);function r(o){return t.length}function i(o,a){const l=t[a],c=o[l];return n(c)}function n(o){return o==null?null:String(o)}}function gie(e,t){const s=Ny(e,r,i);return sd(s);function r(n){return t(n)?.length??0}function i(n,o){const a=t(n);return a&&a[o]}}function sd(e,t=null,s){const{depth:r,rootValues:i,value:n,children:o}=e;if(i)return i.map(l=>({[Uo]:t,...l}));if(r===0)return[{[Uo]:t,...n}];const a=[];for(const[l,c]of o.entries())a.push(...sd(c,l,!0));return s?[{[Uo]:t,children:a,...n??{}}]:a}function Ny(e,t,s){const r={depth:0,children:new Map};for(const n of e){const o=t(n);i(n,o,s,0,r)}return r;function i(n,o,a,l,c){if(l===o)return l===0?(c.rootValues??(c.rootValues=[]),c.rootValues.push(n)):c.value=n,c;{const u=a(n,l),d=c.children.get(u),h=i(n,o,a,l+1,d??{depth:0,children:new Map});return c.children.set(u,h),c.depth=Math.max(1+h.depth,c.depth),c}}}var fie=class extends dr{getUpdateOptions(e,t){const{fields:s}=e,[r,i]=s;return{...t,series:this.getSeries(r,i),data:this.getData(e,r,i)}}getSeriesChartThemeDefaults(){return{gradientLegend:{gradient:{preferredLength:200},position:"right"}}}getSeries(e,t){return[{type:this.standaloneChartType,labelKey:Uo,sizeKey:e?.colId,sizeName:e?.displayName??void 0,colorKey:t?.colId,colorName:t?.displayName??void 0}]}getData(e,t,s){const{categories:r,data:i,groupData:n,grouping:o}=e;if(o){const a=s?i.concat(n?.map(l=>{const c={...l};return delete c[t.colId],c})??[]):i;return gie(a,l=>l[hie]?.value??null)}else{const a=r.map(({id:l})=>l);return pie(i,a)}}},mie=class extends dr{getAxes(e){const t=this.standaloneChartType==="radial-bar";return{angle:{type:t?"angle-number":"angle-category"},radius:{type:t?"radius-category":"radius-number"}}}getSeries(e){const{fields:t,categories:s,seriesGroupType:r}=e,[i]=s,n=this.standaloneChartType==="radial-bar",o=this.getSeriesGroupTypeOptions(r);return t.map(a=>({type:this.standaloneChartType,angleKey:n?a.colId:i.id,angleName:n?a.displayName??void 0:i.name,radiusKey:n?i.id:a.colId,radiusName:n?i.name:a.displayName??void 0,...o}))}getSeriesGroupType(){const e=this.standaloneChartType;if(!["nightingale","radial-bar","radial-column"].includes(e))return;const s=this.getChart().chartOptions?.processedOptions?.series?.[0],r=()=>s?.normalizedTo?"normalized":"stacked";return e==="nightingale"?s?.grouped?"grouped":r():s?.stacked?r():"grouped"}getUpdateOptions(e,t){const s=this.getAxes(e);return{...t,data:this.getData(e,s),axes:s,series:this.getSeries(e)}}getData(e,t){if(t.angle.type==="angle-category"||t.radius.type==="radius-category"){const[r]=e.categories;return this.transformCategoryData(e.data,r.id)}else return e.data}getSeriesGroupTypeOptions(e){return e?{grouped:e==="grouped"||void 0,stacked:e!=="grouped"||void 0,normalizedTo:e==="normalized"?100:void 0}:{}}getSeriesChartThemeDefaults(){return{series:{highlight:ed(this.crossFiltering)}}}},vie="AG-GRID-DEFAULT-HEATMAP-CATEGORY-KEY",Cie="AG-GRID-DEFAULT-HEATMAP-SERIES-KEY",bie="AG-GRID-DEFAULT-HEATMAP-VALUE-KEY";function Sie(e,t){return e.reduce((s,r,i,n)=>s.concat(t(r,i,n)),new Array)}var yie=class extends dr{getUpdateOptions(e,t){const s=Cie,r=bie,i=vie;return{...t,series:this.getSeries(e,s,r,i),data:this.getData(e,s,r,i)}}getSeries(e,t,s,r){const[i]=e.categories;return[{type:this.standaloneChartType,yKey:r,xKey:t,colorKey:s,yName:i.name,xName:void 0,colorName:void 0}]}getData(e,t,s,r){const[i]=e.categories;return Sie(e.data,(n,o)=>{const a=n[i.id],l=a==null?"":String(a),c={id:o,value:a,toString:()=>l};return e.fields.map(({colId:u,displayName:d})=>({...n,[t]:d,[s]:n[u],[r]:c}))})}getSeriesChartThemeDefaults(){return{gradientLegend:{gradient:{preferredLength:200},position:"right"},series:{tooltip:{renderer:wie}}}}};function wie(e){const{xKey:t,yKey:s,colorKey:r,yName:i,datum:n}=e;return{title:"",data:[{label:i,value:n[s]},{label:n[t],value:r&&n[r]}].map(({label:a,value:l})=>({label:String(a),value:String(l)}))}}import{BeanStub as xie,CellRangeType as Ii,_normalizeSortType as Fie,_resolveSortOptions as Tie,isColumnGroupAutoCol as Aie}from"ag-grid-community";import{_hasOwn as Pie,_last as Rie}from"ag-stack";import{BeanStub as Mie,GROUP_AUTO_COLUMN_ID as Iie,_isClientSideRowModel as Eie,_isServerSideRowModel as Die}from"ag-grid-community";var Lie=class extends TT{wireBeans(e){this.sortSvc=e.sortSvc,this.gridRowModel=e.rowModel,this.colModel=e.colModel,this.pivotResultCols=e.pivotResultCols,this.rowNodeSorter=e.rowNodeSorter}getData(e){if(e.crossFiltering){if(e.grouping)return this.warn(141),{chartData:[],colNames:{}};if(!Eie(this.gos))return this.warn(142),{chartData:[],colNames:{}}}Die(this.gos)&&e.pivoting&&this.updatePivotKeysForSSRM();const s=this.extractRowsFromGridRowModel(e);return s.chartData=this.aggregateRowsByDimension(e,s.chartData),s}extractRowsFromGridRowModel(e){const{crossFiltering:t,startRow:s,endRow:r,valueCols:i,dimensionCols:n,grouping:o,crossFilteringSort:a,combineGroupValues:l}=e;let c=[];const u={},d={},h={};let p={},g=[],f;if(t)p=this.getFilteredRowNodes(),g=this.getAllRowNodes(a),f=g.length;else{const y=this.gridRowModel.getRowCount()-1;s===r&&s===0&&n.length===0&&i.length===0?f=0:f=(r>=0?Math.min(r,y):y)-s+1}if(f>0)for(const y of i){let S=[];const w=y.colDef.pivotKeys;w&&(S=w.slice());const F=y.colDef.headerName;F&&S.push(F),S.length>0&&(u[y.getId()]=S)}let m=0,v=0;const C={};for(let y=0;y<f;y++){const S=t?g[y]:this.gridRowModel.getRow(y+s);if(S.footer||S.detail){m++;continue}const w={node:S};for(const F of n){const T=F.colId,x=this.colModel.getCol(T);if(x){const P=S.getDataValue(x,"data");if(o){const L=P?.toString?String(P.toString()):" ",G=this.getGroupLabels(S,L),O=G.slice().reverse();let z={value:O,id:v++,toString:()=>O.filter(Boolean).join(" - ")};if(l){const W=z.toString(),J=C[W];J?z=J:C[W]=z}w[T]=z,S.group&&(d[G.toString()]=y-m);const B=G.slice(1,G.length).toString();B&&(h[B]=d[B])}else w[T]=P}else w[wt]=y+1}for(const F of i){const T=F.colId;if(t){const x=T+"-filtered-out",P=S.getDataValue(F,"data");let L=P;P!=null&&(typeof P.toNumber=="function"?L=P.toNumber():typeof P.value=="number"&&(L=P.value)),p[S.id]?(w[T]=L,w[x]=e.aggFunc||e.isScatter?void 0:0):(w[T]=e.aggFunc||e.isScatter?void 0:0,w[x]=L)}else{let x=S.getDataValue(F,"data");x&&typeof x.value=="number"&&(x=x.value),x&&Pie(x,"toString")&&(x=Number.parseFloat(x.toString())),w[T]=x!=null&&typeof x.toNumber=="function"?x.toNumber():x}}c.push(w)}let b;if(o){const y=Object.values(h),S=c;c=[],b=[];for(let w=0;w<S.length;w++)(y.includes(w)?b:c).push(S[w])}return{chartData:c,colNames:u,groupChartData:b}}aggregateRowsByDimension(e,t){const s=e.dimensionCols;if(!e.aggFunc||s.length===0)return t;const i=Rie(s)?.colId,n={},o=[];for(const a of t){let l=n;for(const c of s){const u=c.colId,d=a[u];if(u===i){let h=l[d];if(!h){h={__children:[]};for(const p of s){const g=p.colId;h[g]=a[g]}l[d]=h,o.push(h)}h.__children.push(a)}else l[d]||(l[d]={}),l=l[d]}}if(this.gos.assertModuleRegistered("SharedAggregation",1)){const a=e.aggFunc,l=typeof a=="function"?a:typeof a=="string"?this.beans.aggFuncSvc.getAggFunc(a):null;if(typeof l!="function")return this.warn(109,{inputValue:String(a),allSuggestions:[]}),o;const c=this.beans.gridApi,u=this.gos.get("context");for(const d of o)for(const h of e.valueCols){const p=h.colId;if(e.crossFiltering){const g=d.__children.filter(b=>b[p]!==void 0).map(b=>b[p]),f=l({values:g,column:h,colDef:h.colDef,pivotResultColumn:void 0,rowNode:void 0,data:void 0,aggregatedChildren:[],api:c,context:u});d[p]=f?.value!==void 0?f.value:f;const m=`${p}-filtered-out`,v=d.__children.filter(b=>b[m]!==void 0).map(b=>b[m]),C=l({values:v,column:h,colDef:h.colDef,pivotResultColumn:void 0,rowNode:void 0,data:void 0,aggregatedChildren:[],api:c,context:u});d[m]=C?.value!==void 0?C.value:C}else{const g=d.__children.map(m=>m[p]),f=l({values:g,column:h,colDef:h.colDef,pivotResultColumn:void 0,rowNode:void 0,data:void 0,aggregatedChildren:[],api:c,context:u});d[p]=f?.value!==void 0?f.value:f}}}return o}updatePivotKeysForSSRM(){const e=this.pivotResultCols?.pivotCols;if(!e)return;const t=this.extractPivotKeySeparator(e);for(const s of e)if(t==="")s.colDef.pivotKeys=[];else{const r=s.colId.split(t);s.colDef.pivotKeys=r.slice(0,r.length-1)}}extractPivotKeySeparator(e){if(e.length===0)return"";const t=(r,i)=>{const n=r.getGroupId();return r.getParent()?t(r.getParent(),n):i.split(n)[1][0]},s=e[0];return s.getParent()==null?"":t(s.getParent(),s.colId)}getGroupLabels(e,t){const s=[t];for(;e&&e.level!==0;)if(e=e.parent,e)if(e.group){const r=this.colModel.getCol(Iie);if(r){const i=e.getDataValue(r,"data"),n=i?.toString?String(i.toString()):" ";s.push(n)}}else s.push(e.key);return s}getFilteredRowNodes(){const e={};return this.gridRowModel.forEachNodeAfterFilterAndSort(t=>{e[t.id]=t}),e}getAllRowNodes(e){const t=[];this.gridRowModel.forEachNode(i=>{t.push(i)});const s=this.rowNodeSorter;if(!s)return t;const r=e===!0?this.sortSvc?.getSortOptions():e;return!r||r.length==0?t:s.doFullSortInPlace(t,r)}};import{BeanStub as kie,_getRowNode as _ie}from"ag-grid-community";var Gie=class extends AT{constructor(){super(...arguments),this.valueColsWithoutSeriesType=new Set}wireBeans(e){this.colModel=e.colModel,this.colNames=e.colNames}postConstruct(){const e=()=>this.valueColsWithoutSeriesType.clear();this.addManagedEventListeners({newColumnsLoaded:e,rowDataUpdated:e})}getColumn(e){return this.colModel.colsById[e]??null}getAllDisplayedColumns(){return this.beans.visibleCols.allCols}getColDisplayName(e){return this.colNames.getDisplayNameForColumn(e,"chart")}getColGroupDisplayName(e){return this.colNames.getDisplayNameForColumnGroup(e,"chart")}getRowGroupColumns(){return this.beans.rowGroupColsSvc?.columns??[]}getGroupDisplayColumns(){return this.beans.showRowGroupCols?.columns??[]}isPivotMode(){return this.colModel.pivotMode}isPivotActive(){return this.colModel.isPivotActive()}getChartColumns(){const e=this.colModel.colsList,t=new Set,s=new Set;for(const r of e){const i=r.colDef,n=i.chartDataType;if(n)switch(n){case"category":case"time":t.add(r);continue;case"series":s.add(r);continue;case"excluded":continue;default:this.warn(153,{chartDataType:n});break}if(i.colId==="ag-Grid-AutoColumn"){t.add(r);continue}if(!r.primary){s.add(r);continue}(this.isInferredValueCol(r)?s:t).add(r)}return{dimensionCols:t,valueCols:s}}isInferredValueCol(e){const t=e.colId;if(t==="ag-Grid-AutoColumn")return!1;const s=_ie(this.beans,{rowIndex:0,rowPinned:null});if(!s)return this.valueColsWithoutSeriesType.has(t);let r=s.getDataValue(e,"data");r??(r=this.extractLeafData(s,e)),r!=null&&(typeof r.toNumber=="function"?r=r.toNumber():typeof r.value=="number"&&(r=r.value));const i=typeof r=="number"||e.colDef.cellDataType==="number"||["series","time"].includes(e.colDef.chartDataType);return i?this.valueColsWithoutSeriesType.add(t):r==null&&e.colDef.cellDataType!=="number"&&this.warn(265,{colId:t}),i}extractLeafData(e,t){const s=e.data&&e.getDataValue(t,"data");if(s!=null)return s;const r=e.childrenAfterGroup;if(r)for(let i=0,n=r.length;i<n;++i){const o=r[i],a=this.extractLeafData(o,t);if(a!=null)return a}return null}destroy(){this.valueColsWithoutSeriesType.clear(),super.destroy()}};import{BeanStub as Oie}from"ag-grid-community";var Nie=new Set(["line","groupedColumn","stackedColumn","area","stackedArea"]),Bie=class extends PT{constructor(e){super(),this.suppressComboChartWarnings=!1,this.chartDataModel=e,this.seriesChartTypes=e.params.seriesChartTypes??[]}postConstruct(){this.initComboCharts()}update(e){this.seriesChartTypes=e??this.seriesChartTypes,this.initComboCharts(),this.updateSeriesChartTypes()}initComboCharts(){const e=this.seriesChartTypes&&this.seriesChartTypes.length>0;(this.chartDataModel.chartType==="customCombo"||e)&&(this.chartDataModel.chartType="customCombo",this.savedCustomSeriesChartTypes=this.seriesChartTypes||[])}updateSeriesChartTypes(){if(this.chartDataModel.isComboChart()){if(this.seriesChartTypes=this.seriesChartTypes.map(e=>{const t=["groupedColumn","stackedColumn","stackedArea"].includes(e.chartType);return e.secondaryAxis=t?!1:e.secondaryAxis,e}),this.chartDataModel.chartType==="customCombo"){this.updateSeriesChartTypesForCustomCombo();return}this.updateChartSeriesTypesForBuiltInCombos()}}updateSeriesChartTypesForCustomCombo(){!(this.seriesChartTypes&&this.seriesChartTypes.length>0)&&!this.suppressComboChartWarnings&&this.warn(150),this.seriesChartTypes=this.seriesChartTypes.map(r=>(Nie.has(r.chartType)||(this.warn(151,{chartType:r.chartType}),r.chartType="line"),r));const t=r=>{(!this.savedCustomSeriesChartTypes||this.savedCustomSeriesChartTypes.length===0)&&(this.savedCustomSeriesChartTypes=this.seriesChartTypes);const i=this.savedCustomSeriesChartTypes.find(n=>n.colId===r.colId);return i||(r.selected&&!this.suppressComboChartWarnings&&this.warn(152,{colId:r.colId}),{colId:r.colId,chartType:"line",secondaryAxis:!1})},s=this.chartDataModel.valueColState.map(t);this.seriesChartTypes=s,this.savedCustomSeriesChartTypes=s,this.suppressComboChartWarnings=!0}updateChartSeriesTypesForBuiltInCombos(){const{chartType:e,valueColState:t}=this.chartDataModel,s=e==="columnLineCombo"?"groupedColumn":"stackedArea",r=e==="columnLineCombo"?"line":"groupedColumn",i=t.filter(o=>o.selected),n=Math.ceil(i.length/2);this.seriesChartTypes=i.map((o,a)=>{const l=a>=n?r:s;return{colId:o.colId,chartType:l,secondaryAxis:!1}})}},wt="AG-GRID-DEFAULT-CATEGORY",Vie=class extends RT{constructor(e){super(),this.unlinked=!1,this.chartData=[],this.valueColState=[],this.dimensionColState=[],this.colNames={},this.crossFiltering=!1,this.crossFilteringSort=!0,this.grouping=!1,this.useGroupColumnAsCategory=!1,this.params=e,this.chartId=e.chartId,this.setParams(e)}wireBeans(e){this.rangeSvc=e.rangeSvc,this.chartTranslation=e.chartTranslation}setParams(e){const{chartType:t,pivotChart:s,chartThemeName:r,switchCategorySeries:i,aggFunc:n,cellRange:o,suppressChartRanges:a,unlinkChart:l,crossFiltering:c,crossFilteringSort:u,seriesGroupType:d,useGroupColumnAsCategory:h}=e;this.chartType=t,this.pivotChart=s??!1,this.chartThemeName=r,this.switchCategorySeries=!!i,this.aggFunc=n,this.referenceCellRange=o,this.suppliedCellRange=o,this.suppressChartRanges=a??!1,this.unlinked=!!l,this.crossFiltering=!!c,this.crossFilteringSort=u??!0,this.seriesGroupType=d,this.useGroupColumnAsCategory=!!h}postConstruct(){this.datasource=this.createManagedBean(new Lie),this.chartColSvc=this.createManagedBean(new Gie),this.comboChartModel=this.createManagedBean(new Bie(this)),this.updateCellRanges({setColsFromRange:!0}),this.updateData()}updateModel(e){const{cellRange:t,seriesChartTypes:s}=e,r=t!==this.suppliedCellRange;r&&(this.dimensionCellRange=void 0,this.valueCellRange=void 0),this.setParams(e),this.updateSelectedDimensions(t?.columns),this.updateCellRanges({setColsFromRange:!0,isExplicitRangeChange:r}),(this.isComboChart()||s)&&this.comboChartModel.update(s),this.unlinked||this.updateData()}updateCellRanges(e){const{updatedColState:t,resetOrder:s,maintainColState:r,setColsFromRange:i,updateOrder:n,isExplicitRangeChange:o}=e??{};this.valueCellRange&&(this.referenceCellRange=this.valueCellRange);const{dimensionCols:a,valueCols:l}=this.chartColSvc.getChartColumns(),c=this.getAllColumnsFromRanges();t&&this.updateColumnState(t,s),this.setDimensionCellRange(a,c,t),this.setValueCellRange(l,c,i),!t&&!r&&(this.resetColumnState(n,o),this.syncDimensionCellRange()),this.comboChartModel.updateSeriesChartTypes()}updateData(){const{startRow:e,endRow:t}=this.getRowIndexes();this.pivotChart&&this.resetColumnState(),this.grouping=this.isGrouping();const s={aggFunc:this.aggFunc,dimensionCols:this.getSelectedDimensions(),grouping:this.grouping,pivoting:this.isPivotActive(),crossFiltering:this.crossFiltering,crossFilteringSort:this.getCrossFilteringSort(),valueCols:this.getSelectedValueCols(),startRow:e,endRow:t,isScatter:["scatter","bubble"].includes(this.chartType),combineGroupValues:Zre(se(this.chartType))},{chartData:r,colNames:i,groupChartData:n}=this.datasource.getData(s);this.chartData=r,this.groupChartData=n,this.colNames=i,this.categoryAxisType=void 0}isGrouping(){const e=this.gos.get("treeData"),t=e?null:this.chartColSvc.getRowGroupColumns(),s=e||t&&t.length>0,r=this.getSelectedDimensions().map(({colId:o})=>o),n=this.chartColSvc.getGroupDisplayColumns().map(o=>o.colId).some(o=>r.includes(o));return!!s&&n}getSelectedValueCols(){return this.valueColState.filter(e=>e.selected).map(e=>e.column)}getSelectedDimensions(){return this.dimensionColState.filter(e=>e.selected)}getValueColState(){return this.valueColState.map(this.displayNameMapper.bind(this))}displayNameMapper(e){const{column:t}=e;if(t){const s=this.getColDisplayName(t);e.displayName=this.isPivotMode()?this.getPivotDisplayName(t,s):s}else{const s=this.colNames[e.colId];e.displayName=s?s.join(" - "):this.getColDisplayName(t)}return e}getPivotDisplayName(e,t){let s=!1,r=[t];const i=n=>{if(!n)return;const o=this.chartColSvc.getColGroupDisplayName(n);o?.length?(r.unshift(o),i(n.getParent())):s=!0};if(i(e.getParent()),s){const n=this.colNames[e.colId];n&&(r=n)}return r.join(" - ")}getColDisplayName(e){return this.chartColSvc.getColDisplayName(e)}isPivotMode(){return this.chartColSvc.isPivotMode()}getChartDataType(e){const t=this.chartColSvc.getColumn(e);return t?t.colDef.chartDataType:void 0}getConvertTime(e){const t=this.chartColSvc.getColumn(e);if(t?.colDef.cellDataType==="dateString")return this.beans.dataTypeSvc?.getDateParserFunction(t)}isPivotActive(){return this.chartColSvc.isPivotActive()}createCellRange(e,...t){return{id:this.chartId,startRow:this.referenceCellRange.startRow,endRow:this.referenceCellRange.endRow,columns:t,startColumn:e===Ii.DIMENSION||this.referenceCellRange.startColumn==null?t[0]:this.referenceCellRange.startColumn,type:e}}getAllColumnsFromRanges(){if(this.pivotChart)return new Set(this.chartColSvc.getAllDisplayedColumns());const e=this.dimensionCellRange||this.valueCellRange?[]:this.referenceCellRange.columns;return this.dimensionCellRange&&e.push(...this.dimensionCellRange.columns),this.valueCellRange&&e.push(...this.valueCellRange.columns),new Set(e)}getRowIndexes(){let e=0,t=0;const{rangeSvc:s,valueCellRange:r,dimensionCellRange:i}=this,n=r??i;if(s&&n){e=s.getRangeStartRow(n).rowIndex;const o=s.getRangeEndRow(n);t=o.rowPinned==="bottom"?-1:o.rowIndex}return{startRow:e,endRow:t}}getSelectedColIds(e){return new Set(e.filter(t=>t.selected).map(t=>t.colId))}isColumnSelectable(e,t,s,r){return s&&!e.isVisible()&&r.has(e.colId)?!0:t.has(e)&&(s||e.isVisible())}resetColumnState(e,t){const{dimensionCols:s,valueCols:r}=this.chartColSvc.getChartColumns(),i=this.getAllColumnsFromRanges(),n=this.valueColState.length<1,o=n||e?void 0:new Map(this.valueColState.map(b=>[b.colId,b.order])),a=!this.pivotChart&&this.gos.get("includeHiddenColumnsInCharts"),l=t?new Set:this.getSelectedColIds(this.dimensionColState),c=t?new Set:this.getSelectedColIds(this.valueColState);this.dimensionColState=[],this.valueColState=[];const u=Ts(se(this.chartType));let d=!1,h=1;const p=this.suppliedCellRange.columns[0],g=this.gos.get("treeData"),f=g?null:this.chartColSvc.getRowGroupColumns(),m=g||f&&f.length>0;s.forEach(b=>{const y=Aie(b),S=this.crossFiltering&&this.aggFunc?p.getColId()===b.colId:this.useGroupColumnAsCategory&&m&&y||(!d||u)&&this.isColumnSelectable(b,i,a,l);this.dimensionColState.push({column:b,colId:b.colId,displayName:this.getColDisplayName(b),selected:S,order:h++}),S&&(d=!0)});const v={colId:wt,displayName:this.chartTranslation.translate("defaultCategory"),selected:!d,order:0};this.dimensionColState.unshift(v);const C=this.referenceCellRange.columns.filter(b=>r.has(b));if(r.forEach(b=>{n&&this.referenceCellRange.columns.includes(b)&&(b=C.shift()),this.valueColState.push({column:b,colId:b.colId,displayName:this.getColDisplayName(b),selected:this.isColumnSelectable(b,i,a,c),order:h++})}),o){let b=Math.max(...o.values())+1;this.valueColState.forEach(y=>{y.order=o.has(y.colId)?o.get(y.colId):b++}),this.valueColState.sort((y,S)=>y.order-S.order)}}updateColumnState(e,t){const s=c=>c.colId===e.colId,{dimensionColState:r,valueColState:i}=this,n=r.find(s),o=i.find(s);if(n)if(Ts(se(this.chartType)))n.selected=e.selected;else{const u=e.selected?n:r.filter(d=>d!==n).find(({selected:d})=>d);r.forEach(d=>d.selected=d===u)}else o&&(o.selected=e.selected);const a=[...r,...i],l=[];t||(a.forEach((c,u)=>{u===e.order&&l.push(e.colId),c.colId!==e.colId&&l.push(c.colId)}),a.forEach(c=>{const u=l.indexOf(c.colId);c.order=u>=0?l.indexOf(c.colId):a.length-1})),this.reorderColState()}reorderColState(){const e=(t,s)=>t.order-s.order;this.dimensionColState.sort(e),this.valueColState.sort(e)}setDimensionCellRange(e,t,s){this.dimensionCellRange=void 0;const r=Ts(se(this.chartType));if(!s&&!this.dimensionColState.length){const a=new Array;e.forEach(l=>{a.length>0&&!r||!t.has(l)||a.push(l)}),a.length>0&&(this.dimensionCellRange=this.createCellRange(Ii.DIMENSION,...a));return}let i=s?[s]:[];if(this.crossFiltering&&this.aggFunc){const a=this.suppliedCellRange.columns[0];i=this.dimensionColState.filter(l=>l.colId===a.getColId())}else(r||i.length===0||i.some(({column:a})=>!a||!e.has(a)))&&(i=this.dimensionColState.filter(a=>a.selected));const n=i.length===1?i[0].colId===wt:!1,o=i.map(({column:a})=>a).filter(a=>a!=null);o.length>0&&!n&&(this.dimensionCellRange=this.createCellRange(Ii.DIMENSION,...o))}setValueCellRange(e,t,s){this.valueCellRange=void 0;const r=[],i=Ho(this.chartType);let n=0;if(e.forEach(o=>{s?(i==null||n<i)&&t.has(o)&&(r.push(o),n++):this.valueColState.some(a=>a.selected&&a.colId===o.colId)&&r.push(o)}),r.length>0){let o=[];this.valueColState.length>0?o=this.valueColState.map(a=>a.colId):t.forEach(a=>o.push(a.colId)),r.sort((a,l)=>o.indexOf(a.colId)-o.indexOf(l.colId)),this.valueCellRange=this.createCellRange(Ii.VALUE,...r)}}resetCellRanges(e,t){if(!e&&!t)return;const{dimensionCols:s,valueCols:r}=this.chartColSvc.getChartColumns(),i=this.getAllColumnsFromRanges();e&&this.setDimensionCellRange(s,i),t&&this.setValueCellRange(r,i)}updateSelectedDimensions(e){const t=new Set(e.map(r=>r.colId));if(Ts(se(this.chartType))){const r=this.dimensionColState.filter(n=>t.has(n.colId)),i=new Set(r.map(n=>n.colId));this.dimensionColState=this.dimensionColState.map(n=>({...n,selected:i.has(n.colId)}))}else{const i=(this.dimensionColState.find(n=>t.has(n.colId))??this.dimensionColState[0]).colId;this.dimensionColState=this.dimensionColState.map(n=>({...n,selected:n.colId===i}))}}syncDimensionCellRange(){const e=this.getSelectedDimensions();if(e.length===0)return;const t=e.map(({column:s})=>s).filter(s=>s!=null);t.length>0&&(this.dimensionCellRange=this.createCellRange(Ii.DIMENSION,...t))}isComboChart(e){return Yu(e??this.chartType)}getCrossFilteringSort(){const e=this.crossFilteringSort;if(typeof e=="boolean")return e;const t=[];return e.forEach(({sort:s,colId:r})=>{const i=this.chartColSvc.getColumn(r);i&&t.push({sort:s,column:i,type:Fie(i.getSortDef()?.type),colComparator:void 0,leafComparator:void 0,descending:!1,absolute:!1})}),Tie(t,this.beans.colModel),t}},By=class extends rs{getAxes(e,t){return{x:{type:this.getXAxisType(e),position:this.isHorizontal(t)?"left":"bottom"},y:{type:"number",position:this.isHorizontal(t)?"bottom":"left"}}}computeSeriesStatistics(e,t){const{data:s,fields:r}=e,[i]=e.categories,n=i.id||wt,o=this.groupDataByCategory(n,s);return Array.from(o).map(([a,l])=>{const c={[i.id]:a};return r.forEach((u,d)=>{const h=l.map(g=>g[u.colId]).filter(g=>typeof g=="number"&&!Number.isNaN(g)),p=t(h);for(const g of Object.keys(p)){const f=`${g}:${d}`;c[f]=h.length>0?p[g]:null}}),c})}groupDataByCategory(e,t){const s=r=>{if(e===wt)return 1;const i=r[e];return i==null?"":i instanceof Date?i.getTime():i};return t.reduce((r,i)=>{const n=s(i),o=r.get(n);return o?o.push(i):r.set(n,[i]),r},new Map)}},Hie=class extends By{getSeries(e){const[t]=e.categories;return e.fields.map((s,r)=>({type:this.standaloneChartType,xKey:t.id,xName:t.name,yName:s.displayName??void 0,minName:"Min",q1Name:"Q1",medianName:"Median",q3Name:"Q3",maxName:"Max",minKey:`min:${r}`,q1Key:`q1:${r}`,medianKey:`median:${r}`,q3Key:`q3:${r}`,maxKey:`max:${r}`}))}getData(e){return this.computeSeriesStatistics(e,t=>{const s=t.sort((r,i)=>r-i);return{min:s[0],q1:this.quantile(s,.25),median:this.quantile(s,.5),q3:this.quantile(s,.75),max:s[s.length-1]}})}quantile(e,t){const s=(e.length-1)*t,r=Math.floor(s),i=s-r;return e[r+1]!==void 0?e[r]+i*(e[r+1]-e[r]):e[r]}},Uie=class extends By{getSeries(e){const[t]=e.categories;return e.fields.map((s,r)=>({type:this.standaloneChartType,xKey:t.id,xName:t.name,yName:s.displayName??void 0,yLowName:"Min",yHighName:"Max",yLowKey:`min:${r}`,yHighKey:`max:${r}`}))}getData(e){return this.computeSeriesStatistics(e,t=>({min:Math.min(...t),max:Math.max(...t)}))}},zie=class extends MT{constructor(){super(...arguments),this.beanName="enterpriseChartProxyFactory"}createChartProxy(e){switch(e.chartType){case"histogram":return new cie(e);case"radarLine":case"radarArea":case"nightingale":case"radialColumn":case"radialBar":return new mie(e);case"rangeBar":case"rangeArea":return new Uie(e);case"boxPlot":return new Hie(e);case"treemap":case"sunburst":return new fie(e);case"heatmap":return new yie(e);case"waterfall":return new uie(e);case"funnel":case"coneFunnel":case"pyramid":return new die(e)}}};import{TabGuardClassNames as Wie,_findFocusableElements as Vy}from"ag-stack";import{BeanStub as Kie,Component as $ie,KeyCode as jie}from"ag-grid-community";import{Component as Yie}from"ag-grid-community";import{_removeFromParent as qie}from"ag-stack";import{BeanStub as Zie}from"ag-grid-community";var Hy=class extends IT{constructor(e,t,s,r){super(),this.chartController=e,this.eGui=t,this.cssClass=s,this.createPanels=r,this.panels=[]}postConstruct(){this.addManagedListeners(this.chartController,{chartUpdated:()=>this.refreshPanels(!0),chartApiUpdate:()=>this.refreshPanels(!1)})}addComponent(e){this.createBean(e),this.panels.push(e),e.addCss(this.cssClass),this.eGui.appendChild(e.getGui())}refreshPanels(e){const t=this.chartController.getChartType(),s=this.chartController.isGrouping(),r=se(t);e&&t===this.chartType&&s===this.isGrouping||(this.destroyPanels(),this.createPanels(t,r),this.chartType=t,this.isGrouping=s)}destroyPanels(){for(const e of this.panels)qie(e.getGui()),this.destroyBean(e);this.panels=[]}destroy(){this.destroyPanels(),super.destroy()}};import{AgInputNumberFieldSelector as Xie,Component as Jie}from"ag-grid-community";var Qie=class extends ET{constructor(e){super(),this.chartMenuParamsFactory=e}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e=this.chartMenuParamsFactory.addEnableParams("animation.enabled",{cssIdentifier:"charts-advanced-settings-top-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("animation"),suppressEnabledCheckbox:!0,useToggle:!0}),t=this.chartMenuParamsFactory.getDefaultNumberInputParams("animation.duration","durationMillis",{min:0});this.setTemplate(`<div>
            <ag-group-component data-ref="animationGroup">
                <ag-input-number-field data-ref="animationHeightInput"></ag-input>
            </ag-group-component>
        </div>`,[ee,Xie],{animationGroup:e,animationHeightInput:t})}};import{AgCheckboxSelector as ene,Component as tne}from"ag-grid-community";var Uy=class extends ba{constructor(e){super({...e,dialogCallbacks:qh})}},xt={selector:"AG-COLOR-PICKER",component:Uy},sne=class extends DT{constructor(e){super(),this.chartMenuParamsFactory=e}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e=this.chartMenuParamsFactory.addEnableParams("crosshair.enabled",{cssIdentifier:"charts-advanced-settings-top-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("crosshair"),suppressEnabledCheckbox:!0,useToggle:!0}),t=this.chartMenuParamsFactory.getDefaultCheckboxParams("crosshair.label.enabled","crosshairLabel"),s=this.chartMenuParamsFactory.getDefaultCheckboxParams("crosshair.snap","crosshairSnap"),r=this.chartMenuParamsFactory.getDefaultColorPickerParams("crosshair.stroke","color");this.setTemplate(`<div>
            <ag-group-component data-ref="crosshairGroup">
                <ag-checkbox data-ref="crosshairLabelCheckbox"></ag-checkbox>
                <ag-checkbox data-ref="crosshairSnapCheckbox"></ag-checkbox>
                <ag-color-picker data-ref="crosshairStrokeColorPicker"></ag-color-picker>
            </ag-group-component>
        </div>`,[ee,ene,xt],{crosshairGroup:e,crosshairLabelCheckbox:t,crosshairSnapCheckbox:s,crosshairStrokeColorPicker:r})}};import{AgCheckboxSelector as rne,Component as ine}from"ag-grid-community";var nne=class extends LT{constructor(e){super(),this.chartMenuParamsFactory=e}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e=this.chartMenuParamsFactory.addEnableParams("navigator.enabled",{cssIdentifier:"charts-advanced-settings-top-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("navigator"),suppressEnabledCheckbox:!0,useToggle:!0}),t=this.chartMenuParamsFactory.getDefaultSliderParams("navigator.height","height",60);t.minValue=10;const s=this.chartMenuParamsFactory.getDefaultCheckboxParams("navigator.miniChart.enabled","miniChart");this.setTemplate(`<div>
            <ag-group-component data-ref="navigatorGroup">
                <ag-slider data-ref="navigatorHeightSlider"></ag-slider>
                <ag-checkbox data-ref="navigatorMiniChartCheckbox"></ag-checkbox>
            </ag-group-component>
        </div>`,[ee,Ie,rne],{navigatorGroup:e,navigatorHeightSlider:t,navigatorMiniChartCheckbox:s})}};import{RefPlaceholder as one}from"ag-stack";import{AgCheckboxSelector as ane,Component as lne}from"ag-grid-community";var cne=class extends kT{constructor(e){super(),this.chartMenuParamsFactory=e,this.zoomScrollingStepInput=one}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e=this.chartMenuParamsFactory.addEnableParams("zoom.enabled",{cssIdentifier:"charts-advanced-settings-top-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("zoom"),suppressEnabledCheckbox:!0,useToggle:!0}),t=this.chartMenuParamsFactory.getDefaultCheckboxParams("zoom.enableScrolling","scrollingZoom"),s=this.chartMenuParamsFactory.getDefaultSliderParams("zoom.scrollingStep","scrollingStep",1);s.step=.01,s.minValue=s.step;const r=this.chartMenuParamsFactory.getDefaultCheckboxParams("zoom.enableSelecting","selectingZoom");t.onValueChange=(i=>n=>{i&&(i(n),this.zoomScrollingStepInput.setDisabled(!n))})(t.onValueChange),this.setTemplate(`<div>
            <ag-group-component data-ref="zoomGroup">
                <ag-checkbox data-ref="zoomSelectingCheckbox"></ag-checkbox>
                <ag-checkbox data-ref="zoomScrollingCheckbox"></ag-checkbox>
                <ag-slider data-ref="zoomScrollingStepInput"></ag-slider>
            </ag-group-component>
        </div>`,[ee,ane,Ie],{zoomGroup:e,zoomScrollingCheckbox:t,zoomScrollingStepInput:s,zoomSelectingCheckbox:r}),this.zoomScrollingStepInput.setDisabled(!t.value)}},une=["navigator","zoom","animation","crosshair"],dne=class extends _T{constructor(e){super('<div class="ag-chart-advanced-settings-wrapper"></div>'),this.chartMenuContext=e}postConstruct(){this.chartPanelFeature=this.createManagedBean(new Hy(this.chartMenuContext.chartController,this.getGui(),"ag-chart-advanced-settings-section",(e,t)=>this.createPanels(e,t))),this.chartPanelFeature.refreshPanels()}createPanels(e,t){for(const s of une){if(!this.isGroupPanelShownForSeries(s,t))continue;const r=this.createPanel(s);this.chartPanelFeature.addComponent(r)}}isGroupPanelShownForSeries(e,t){return e==="animation"||ss(t)&&!qu(t)}createPanel(e){const{chartMenuParamsFactory:t,chartAxisMenuParamsFactory:s}=this.chartMenuContext;switch(e){case"navigator":return new nne(t);case"zoom":return new cne(t);case"animation":return new Qie(t);case"crosshair":return new sne(s)}}},hne=class extends GT{constructor(){super(...arguments),this.beanName="advSettingsMenuFactory"}showMenu(e,t){this.hideMenu();const s=this.createBean(new pne(e)),r=this.createBean(new ms({title:this.beans.chartTranslation.translate("advancedSettings"),component:s,width:300,height:400,resizable:!0,movable:!0,centered:!0,closable:!0,afterGuiAttached:()=>{Vy(s.getGui())[0]?.focus()},closedCallback:()=>{this.activeMenu=this.destroyBean(this.activeMenu),this.activeDialog=void 0,t?.focus({preventScroll:!0})}})),i=r.getGui();r.addManagedElementListeners(i,{keydown:n=>gne(n,i)}),this.activeDialog=r,this.activeMenu=s}hideMenu(){this.activeDialog&&this.destroyBean(this.activeDialog)}destroy(){this.activeMenu=this.destroyBean(this.activeMenu),this.activeDialog=this.destroyBean(this.activeDialog),super.destroy()}},pne=class extends OT{constructor(e){super('<div class="ag-chart-advanced-settings"></div>'),this.chartMenuContext=e}postConstruct(){const e=this.createManagedBean(new dne(this.chartMenuContext));this.getGui().appendChild(e.getGui())}};function gne(e,t){if(e.key!==jie.TAB||e.defaultPrevented)return;e.preventDefault();const s=Vy(t,`.${Wie.TAB_GUARD}`),r=s.length;if(!r)return;const i=e.shiftKey,n=s.findIndex(a=>a===e.target);let o=i?r-1:0;n>=0&&(o=(n+(i?-1:1)+r)%r),s[o].focus()}import{RefPlaceholder as fne,_focusInto as mne,_isNothingFocused as vne}from"ag-stack";import{BeanStub as Cne,Component as bne,_addGridCommonParams as Sne,_createIconNoSpan as yne}from"ag-grid-community";var wne=class extends NT{constructor(){super(...arguments),this.beanName="chartMenuListFactory"}wireBeans(e){this.popupSvc=e.popupSvc,this.chartMenuSvc=e.chartMenuSvc,this.chartTranslation=e.chartTranslation}showMenuList(e){const{eventSource:t,showMenu:s,chartMenuContext:r}=e,i=this.chartMenuSvc.doChartToolPanelsExist(r.chartController),n=this.mapWithStockItems(this.getMenuItems(r.chartController,i),r,s,t,i);if(!n.length)return;const o=this.createBean(new xne(n));this.activeChartMenuList=o;let a=-1,l="left";this.gos.get("enableRtl")&&(a=1,l="right");const c=o.getGui();this.popupSvc.addPopup({modal:!0,eChild:c,closeOnEsc:!0,alwaysOnTop:!0,closedCallback:()=>{this.destroyBean(o),this.activeChartMenuList=void 0,vne(this.beans)&&t.focus({preventScroll:!0})},afterGuiAttached:u=>o.afterGuiAttached(u),positionCallback:()=>{this.popupSvc.positionPopupByComponent({type:"chartMenu",eventSource:t,ePopup:c,alignSide:l,nudgeX:4*a,nudgeY:4,position:"under",keepWithinBounds:!0})},ariaLabel:"Chart Menu"})}getMenuItems(e,t){const s=[...t?["chartEdit"]:[],...e.isEnterprise()?["chartAdvancedSettings"]:[],e.isChartLinked()?"chartUnlink":"chartLink","chartDownload"],r=this.gos.get("chartMenuItems");return r?Array.isArray(r)?r:r(Sne(this.gos,{defaultItems:s,chartId:e.getChartId()})):s}mapWithStockItems(e,t,s,r,i){if(!e)return[];const n=[];for(const o of e){let a;if(typeof o=="string"?a=this.getStockMenuItem(o,t,s,r,i):a={...o},!a)continue;const{subMenu:l}=a;Array.isArray(l)&&(a.subMenu=this.mapWithStockItems(l,t,s,r,i)),n.push(a)}return n}getStockMenuItem(e,t,s,r,i){switch(e){case"chartEdit":return i?this.createMenuItem(this.chartTranslation.translate("chartEdit"),"chartsMenuEdit",s):null;case"chartAdvancedSettings":return this.createMenuItem(this.chartTranslation.translate("chartAdvancedSettings"),"chartsMenuAdvancedSettings",()=>this.chartMenuSvc.openAdvancedSettings(t,r));case"chartUnlink":return t.chartController.isChartLinked()?this.createMenuItem(this.chartTranslation.translate("chartUnlink"),"unlinked",()=>this.chartMenuSvc.toggleLinked(t)):null;case"chartLink":return t.chartController.isChartLinked()?null:this.createMenuItem(this.chartTranslation.translate("chartLink"),"linked",()=>this.chartMenuSvc.toggleLinked(t));case"chartDownload":return this.createMenuItem(this.chartTranslation.translate("chartDownload"),"chartsDownload",()=>this.chartMenuSvc.downloadChart(t))}return null}createMenuItem(e,t,s){return{name:e,icon:yne(t,this.beans,null),action:s}}destroy(){this.destroyBean(this.activeChartMenuList),super.destroy()}},xne=class extends BT{constructor(e){super(`
            <div data-ref="eChartsMenu" role="presentation" class="ag-menu ag-chart-menu-popup"></div>
        `),this.menuItems=e,this.eChartsMenu=fne}postConstruct(){this.mainMenuList=this.createManagedBean(new xn(0)),this.mainMenuList.addMenuItems(this.menuItems),this.mainMenuList.addEventListener("closeMenu",this.onHidePopup.bind(this)),this.eChartsMenu.appendChild(this.mainMenuList.getGui())}onHidePopup(){this.hidePopupFunc?.()}afterGuiAttached({hidePopup:e}){e&&(this.hidePopupFunc=e,this.addDestroyFunc(e)),mne(this.mainMenuList.getGui())}};import{BeanStub as Fne}from"ag-grid-community";var Tne=class extends VT{constructor(){super(...arguments),this.beanName="chartCrossFilterSvc"}filter(e,t=!1){const s=this.beans.filterManager,r=s?.getFilterModel()??{};if(t){Object.keys(r).length>0&&s?.setFilterModel(null);return}let i=zy(e);i.indexOf("-filtered-out")&&(i=i.replace("-filtered-out","")),this.updateFilters(r,e,i)}updateFilters(e,t,s){const r=zy(t),i=this.convertRawValue(s,t.datum[r]);if(i===void 0)return;const n=this.beans.filterManager;n&&n.getColumnFilterInstance(s).then(o=>{const a=o?.filterType;let l,c=g=>g;if(a==="multi"){const g=Pne(o);l=g.setFilter,c=g.processModel??c}else a==="set"&&(l=o);if(!l){this.warn(154,{colId:s});return}const u=t.event.metaKey||t.event.ctrlKey,d=l.getFilterHandler().getCrossFilterModel((g,f,m)=>Rne(u,g(i),f,m)),h=c(d),p=u?{...e}:{};p[s]=h,n?.setFilterModel(p)})}convertRawValue(e,t){const{colModel:s,dataTypeSvc:r}=this.beans,i=s.colsById[e],n=i?.colDef;return n&&r&&n.chartDataType==="time"&&n.cellDataType==="dateString"?r.getDateFormatterFunction(i)(t):t}};function Ane(e,t,s){const r=new Array(s);for(let i=0;i<s;i++)r[i]=i===t?e:null;return{filterType:"multi",filterModels:r}}function Pne(e){const t=e.getNumChildFilters();for(let s=0;s<t;s++){const r=e.getChildFilterInstance(s);if(r?.filterType==="set")return{setFilter:r,processModel:i=>Ane(i,s,t)}}return{}}function zy(e){return e.xKey||e.calloutLabelKey}function Rne(e,t,s,r){let i;if(e)if(s.has(t)&&(r==null||r.includes(t)))if(i=[],r==null)for(const n of s)n!==t&&i.push(n);else for(const n of r)n!==t&&s.has(n)&&i.push(n);else{if(r==null)i=Array.from(s);else{i=[];for(const n of r)s.has(n)&&i.push(n)}i.push(t)}else i=[t];return{filterType:"set",values:i}}import{BeanStub as Mne}from"ag-grid-community";var Ine=["chartUnlink","chartLink","chartDownload","chartMenu"],zo={settings:"chartSettings",data:"chartData",format:"chartFormat"},Ene=class extends HT{constructor(){super(...arguments),this.beanName="chartMenuSvc"}wireBeans(e){this.advSettingsMenuFactory=e.advSettingsMenuFactory}downloadChart(e,t,s,r){e.chartController.getChartProxy().downloadChart(t,s,r)}toggleLinked(e){e.chartController.detachChartRange()}openAdvancedSettings(e,t){this.advSettingsMenuFactory?.showMenu(e,t)}hideAdvancedSettings(){this.advSettingsMenuFactory?.hideMenu()}getChartToolbarOptions(){const e=["chartMenu"],t=this.gos.getCallback("getChartToolbarItems");return t?t({defaultItems:e}).filter(r=>Ine.includes(r)?!0:(this.warn(155,{option:r}),!1)):e}getChartToolPanels(e){const t=this.gos.get("chartToolPanelsDef");let r=t?.panels?.map(o=>{const a=zo[o];return a||this.warn(156,{panel:o}),a}).filter(Boolean)??Object.values(zo);e.isPivotChart()&&(r=r.filter(o=>o!=="chartData"));const i=t?.defaultToolPanel,n=i&&zo[i]||r[0];return{panels:r,defaultPanel:n}}doesChartToolbarExist(){return this.getChartToolbarOptions().length>0}doChartToolPanelsExist(e){const{panels:t}=this.getChartToolPanels(e);return t.length>0}};import{BeanStub as Dne}from"ag-grid-community";var Lne={pivotChartTitle:"Pivot Chart",rangeChartTitle:"Range Chart",settings:"Chart",data:"Set Up",format:"Customize",categories:"Categories",defaultCategory:"(None)",series:"Series",switchCategorySeries:"Switch Category / Series",categoryValues:"Category Values",seriesLabels:"Series Labels",aggregate:"Aggregate",xyValues:"X Y Values",paired:"Paired Mode",axis:"Axis",xAxis:"Horizontal Axis",yAxis:"Vertical Axis",polarAxis:"Polar Axis",radiusAxis:"Radius Axis",navigator:"Navigator",zoom:"Zoom",animation:"Animation",crosshair:"Crosshair",color:"Color",thickness:"Thickness",preferredLength:"Preferred Length",xType:"X Type",axisType:"Axis Type",automatic:"Automatic",category:"Category",number:"Number",time:"Time",timeFormat:"Time Format",autoRotate:"Auto Rotate",labelRotation:"Rotation",circle:"Circle",polygon:"Polygon",square:"Square",cross:"Cross",diamond:"Diamond",plus:"Plus",triangle:"Triangle",heart:"Heart",orientation:"Orientation",fixed:"Fixed",parallel:"Parallel",perpendicular:"Perpendicular",radiusAxisPosition:"Position",ticks:"Ticks",gridLines:"Grid Lines",width:"Width",height:"Height",length:"Length",padding:"Padding",spacing:"Spacing",chartStyle:"Chart Style",title:"Title",chartTitles:"Titles",chartTitle:"Chart Title",chartSubtitle:"Subtitle",horizontalAxisTitle:"Horizontal Axis Title",verticalAxisTitle:"Vertical Axis Title",polarAxisTitle:"Polar Axis Title",titlePlaceholder:"Chart Title",background:"Background",font:"Font",weight:"Weight",top:"Top",right:"Right",bottom:"Bottom",left:"Left",labels:"Labels",calloutLabels:"Callout Labels",sectorLabels:"Sector Labels",positionRatio:"Position Ratio",size:"Size",shape:"Shape",minSize:"Minimum Size",maxSize:"Maximum Size",legend:"Legend",position:"Position",markerSize:"Marker Size",markerStroke:"Marker Stroke",markerPadding:"Marker Padding",itemSpacing:"Item Spacing",itemPaddingX:"Item Padding X",itemPaddingY:"Item Padding Y",layoutHorizontalSpacing:"Horizontal Spacing",layoutVerticalSpacing:"Vertical Spacing",strokeWidth:"Stroke Width",offset:"Offset",offsets:"Offsets",tooltips:"Tooltips",callout:"Callout",markers:"Markers",shadow:"Shadow",blur:"Blur",xOffset:"X Offset",yOffset:"Y Offset",lineWidth:"Line Width",lineDash:"Line Dash",lineDashOffset:"Dash Offset",scrollingZoom:"Scrolling",scrollingStep:"Scrolling Step",selectingZoom:"Selecting",durationMillis:"Duration (ms)",crosshairLabel:"Label",crosshairSnap:"Snap to Node",normal:"Normal",bold:"Bold",italic:"Italic",boldItalic:"Bold Italic",predefined:"Predefined",fillOpacity:"Fill Opacity",strokeColor:"Line Color",strokeOpacity:"Line Opacity",miniChart:"Mini-Chart",histogramBinCount:"Bin count",connectorLine:"Connector Line",seriesItems:"Series Items",seriesItemType:"Item Type",seriesItemPositive:"Positive",seriesItemNegative:"Negative",seriesItemLabels:"Item Labels",columnGroup:"Column",barGroup:"Bar",pieGroup:"Pie",lineGroup:"Line",scatterGroup:"X Y (Scatter)",areaGroup:"Area",polarGroup:"Polar",statisticalGroup:"Statistical",hierarchicalGroup:"Hierarchical",specializedGroup:"Specialized",combinationGroup:"Combination",groupedColumnTooltip:"Grouped",stackedColumnTooltip:"Stacked",normalizedColumnTooltip:"100% Stacked",groupedBarTooltip:"Grouped",stackedBarTooltip:"Stacked",normalizedBarTooltip:"100% Stacked",pieTooltip:"Pie",donutTooltip:"Donut",lineTooltip:"Line",stackedLineTooltip:"Stacked",normalizedLineTooltip:"100% Stacked",groupedAreaTooltip:"Area",stackedAreaTooltip:"Stacked",normalizedAreaTooltip:"100% Stacked",scatterTooltip:"Scatter",bubbleTooltip:"Bubble",histogramTooltip:"Histogram",radialColumnTooltip:"Radial Column",radialBarTooltip:"Radial Bar",radarLineTooltip:"Radar Line",radarAreaTooltip:"Radar Area",nightingaleTooltip:"Nightingale",rangeBarTooltip:"Range Bar",rangeAreaTooltip:"Range Area",boxPlotTooltip:"Box Plot",treemapTooltip:"Treemap",sunburstTooltip:"Sunburst",waterfallTooltip:"Waterfall",heatmapTooltip:"Heatmap",columnLineComboTooltip:"Column & Line",areaColumnComboTooltip:"Area & Column",customComboTooltip:"Custom Combination",innerRadius:"Inner Radius",startAngle:"Start Angle",endAngle:"End Angle",reverseDirection:"Reverse Direction",groupPadding:"Group Padding",seriesPadding:"Series Padding",tile:"Tile",whisker:"Whisker",cap:"Cap",capLengthRatio:"Length Ratio",labelPlacement:"Placement",inside:"Inside",outside:"Outside",noDataToChart:"No data available to be charted.",pivotChartRequiresPivotMode:"Pivot Chart requires Pivot Mode enabled.",chartSettingsToolbarTooltip:"Menu",chartLinkToolbarTooltip:"Linked to Grid",chartUnlinkToolbarTooltip:"Unlinked from Grid",chartDownloadToolbarTooltip:"Download Chart",chartMenuToolbarTooltip:"Menu",chartEdit:"Edit Chart",chartAdvancedSettings:"Advanced Settings",chartLink:"Link to Grid",chartUnlink:"Unlink from Grid",chartDownload:"Download Chart",histogramFrequency:"Frequency",seriesChartType:"Series Chart Type",seriesType:"Series Type",secondaryAxis:"Secondary Axis",seriesAdd:"Add a series",categoryAdd:"Add a category",bar:"Bar",column:"Column",histogram:"Histogram",advancedSettings:"Advanced Settings",direction:"Direction",horizontal:"Horizontal",vertical:"Vertical",seriesGroupType:"Group Type",groupedSeriesGroupType:"Grouped",stackedSeriesGroupType:"Stacked",normalizedSeriesGroupType:"100% Stacked",legendEnabled:"Enabled",groupedColumnFull:"Grouped Column",stackedColumnFull:"Stacked Column",normalizedColumnFull:"100% Stacked Column",groupedBarFull:"Grouped Bar",stackedBarFull:"Stacked Bar",normalizedBarFull:"100% Stacked Bar",stackedAreaFull:"Stacked Area",normalizedAreaFull:"100% Stacked Area",stackedLineFull:"Stacked Line",normalizedLineFull:"100% Stacked Line",customCombo:"Custom Combination",funnel:"Funnel",coneFunnel:"Cone Funnel",pyramid:"Pyramid",funnelGroup:"Funnel",funnelTooltip:"Funnel",coneFunnelTooltip:"Cone Funnel",pyramidTooltip:"Pyramid",dropOff:"Drop-Off",stageLabels:"Stage Labels",reverse:"Reverse",tooltipMode:"Tooltip Mode",tooltipModeSingle:"Single",tooltipModeShared:"Multiple",tooltipModeCompact:"Compact",groupedColumn:"Grouped",stackedColumn:"Stacked",pie:"Pie",donut:"Donut",line:"Line",scatter:"Scatter",bubble:"Bubble",area:"Area",stackedArea:"Stacked",radarLine:"Radar Line",radarArea:"Radar Area",nightingale:"Nightingale",radialColumn:"Radial Column",radialBar:"Radial Bar",boxPlot:"Box Plot",rangeBar:"Range Bar",rangeArea:"Range Area",treemap:"Treemap",sunburst:"Sunburst",waterfall:"Waterfall",heatmap:"Heatmap",columnLineCombo:"Column & Line",AreaColumnCombo:"Area & Column",ariaChartMenuClose:"Close Chart Edit Menu",ariaChartSelected:"Selected",group:"Group",timeFormatSlashesDDMMYYYY:"DD/MM/YYYY",timeFormatSlashesMMDDYYYY:"MM/DD/YYYY",timeFormatSlashesDDMMYY:"DD/MM/YY",timeFormatSlashesMMDDYY:"MM/DD/YY",timeFormatDotsDDMYY:"DD.M.YY",timeFormatDotsMDDYY:"M.DD.YY",timeFormatDashesYYYYMMDD:"YYYY-MM-DD",timeFormatSpacesDDMMMMYYYY:"DD MMMM YYYY",timeFormatHHMMSS:"HH:MM:SS",timeFormatHHMMSSAmPm:"HH:MM:SS AM/PM",sum:"Sum",first:"First",last:"Last",min:"Min",max:"Max",count:"Count",avg:"Average"},kne=class extends UT{constructor(){super(...arguments),this.beanName="chartTranslation"}translate(e){const t=this.getLocaleTextFunc(),s=Lne[e];return t(e,s)}};import{_focusInto as _ne,_initDetachedStyledRoot as Gne}from"ag-stack";import{BeanStub as One}from"ag-grid-community";import{RefPlaceholder as Ei,_clearElement as Nne,_focusInto as Bne,_getAbsoluteHeight as Vne,_getAbsoluteWidth as Hne,_removeFromParent as Une,_setDisplayed as Wy}from"ag-stack";import{Component as zne,_addGridCommonParams as Wne,_focusGridInnerElement as Kne,_mergeDeep as $ne}from"ag-grid-community";import{BeanStub as jne}from"ag-grid-community";import{_createValidationWarning as Yne,_emitValidationWarning as Ky}from"ag-grid-community";var hr=e=>t=>t==null?!0:e(t),$y=e=>typeof e=="string",rd=e=>typeof e=="boolean",qne=e=>typeof e=="object",Ft=(e,t)=>s=>Yne(316,{property:e,value:s,expectedType:t}),jy=e=>`${e} is not supported in AG Charts Community ('ag-charts-enterprise' hasn't been loaded). See https://www.ag-grid.com/javascript-data-grid/integrated-charts-installation/ for more details.`,Zne=["doughnut"],id=["type","chartId","chartType","chartThemeName","chartThemeOverrides","unlinkChart"];function Xne(e){return!!Ly(e)||Yu(e)}function Jne(e){return Zne.includes(e)}var Qne=e=>hr(t=>{if(Xne(t))return!0;if(Jne(t)){const s=Mi(t);return e.deprecated(312,{chartType:t,renamedChartType:s}),s}return!1}),eoe=hr(e=>typeof e=="object"),toe=hr(e=>typeof e=="object"),soe=hr(e=>typeof e=="string"||typeof e=="function"),Yy=e=>({property:"chartType",validationFn:hr(t=>e||!t||!$re(t)),warnMessage:t=>jy(`The '${t}' chart type`)}),qy=e=>({property:"switchCategorySeries",validationFn:hr(t=>{if(!t||e)return!0}),warnMessage:()=>jy("'switchCategorySeries' has been ignored as it"),warnIfFixed:!0}),nd=e=>[{property:"chartId",validationFn:$y,warnMessage:Ft("chartId","string")},{property:"chartType",validationFn:Qne(e),warnMessage:Ft("chartType","ChartType")},{property:"chartThemeName",validationFn:$y,warnMessage:Ft("chartThemeName","string")},{property:"chartThemeOverrides",validationFn:eoe,warnMessage:Ft("chartThemeOverrides","AgChartThemeOverrides")},{property:"unlinkChart",validationFn:rd,warnMessage:Ft("unlinkChart","boolean")}],Zy=e=>[{property:"cellRange",validationFn:toe,warnMessage:Ft("cellRange","ChartParamsCellRange")},{property:"suppressChartRanges",validationFn:rd,warnMessage:Ft("suppressChartRanges","boolean")},{property:"aggFunc",validationFn:soe,warnMessage:Ft("aggFunc","string or IAggFunc")},qy(e)];function roe(e,t,s){switch(e.type){case"rangeChartUpdate":return noe(e,t,s);case"pivotChartUpdate":return ooe(e,s);case"crossFilterChartUpdate":return aoe(e,t,s);default:return s.warn(320,{property:"'type'",allowed:["rangeChartUpdate","pivotChartUpdate","crossFilterChartUpdate"],value:e.type}),!1}}function ioe(e,t,s){return Wo(e,[Yy(t),qy(t)],s)}function noe(e,t,s){const r=[...nd(s),Yy(t),...Zy(t),{property:"seriesChartTypes",validationFn:i=>i===void 0||Array.isArray(i)&&i.every(qne),warnMessage:Ft("seriesChartTypes","Array of SeriesChartType")},{property:"useGroupColumnAsCategory",validationFn:rd,warnMessage:Ft("useGroupColumnAsCategory","boolean")}];return Wo(e,r,s,[...id,"cellRange","suppressChartRanges","switchCategorySeries","aggFunc","seriesChartTypes","seriesGroupType","useGroupColumnAsCategory"],"UpdateRangeChartParams")}function ooe(e,t){const s=[...nd(t)];return Wo(e,s,t,[...id],"UpdatePivotChartParams")}function aoe(e,t,s){const r=[...nd(s),...Zy(t)];return Wo(e,r,s,[...id,"cellRange","suppressChartRanges","aggFunc"],"UpdateCrossFilterChartParams")}function Wo(e,t,s,r,i){let n;for(const o of t){const{property:a,validationFn:l,warnMessage:c,warnIfFixed:u}=o;if(a in e){const d=e[a],h=l(d);if(h===!0)continue;if(h===!1)return Ky(c(d),s),!1;n=n??{...e},n[a]=h,u&&Ky(c(d),s)}}if(r){for(const o of Object.keys(e))if(!r.includes(o))return s.warn(313,{paramsType:i,property:o}),!1}return n||!0}var Xy=["ag-default","ag-material","ag-sheets","ag-polychroma","ag-vivid"],loe=class extends zT{constructor(e){super(),this.model=e,this.isEnterprise=()=>this.agChartsExports.isEnterprise}wireBeans(e){this.rangeSvc=e.rangeSvc,this.agChartsExports=e.agChartsExports}postConstruct(){this.setChartRange(),this.model.unlinked&&this.rangeSvc&&this.rangeSvc.setCellRanges([]);const e=this.updateForGridChange.bind(this,{});this.addManagedEventListeners({cellSelectionChanged:t=>{t.id&&t.id===this.model.chartId&&this.updateForRangeChange()},columnMoved:this.updateForGridChange.bind(this,{updateOrder:!0}),columnPinned:e,columnVisible:e,columnRowGroupChanged:e,modelUpdated:e,cellValueChanged:this.updateForDataChange.bind(this),cellEditValuesChanged:this.updateForDataChange.bind(this)})}update(e){if(!this.validUpdateType(e))return!1;const t=roe(e,this.agChartsExports.isEnterprise,this.beans.log);if(!t)return!1;const s=t===!0?e:t;return this.applyValidatedChartParams(s),!0}applyValidatedChartParams(e){const{chartId:t,chartType:s,chartThemeName:r,unlinkChart:i}=e,o={...{chartId:t,pivotChart:this.model.pivotChart,chartType:s??this.model.chartType,chartThemeName:r??this.model.chartThemeName,unlinkChart:i??this.model.unlinked,cellRange:this.model.suppliedCellRange,switchCategorySeries:this.model.switchCategorySeries,aggFunc:this.model.aggFunc,seriesChartTypes:void 0,suppressChartRanges:!1,crossFiltering:!1}};switch(e.type){case"rangeChartUpdate":o.cellRange=this.createCellRange(e)??this.model.suppliedCellRange,o.switchCategorySeries=e.switchCategorySeries??this.model.switchCategorySeries,o.aggFunc=e.aggFunc??this.model.aggFunc,o.seriesChartTypes=e.seriesChartTypes,o.suppressChartRanges=e.suppressChartRanges??this.model.suppressChartRanges,o.seriesGroupType=e.seriesGroupType??this.model.seriesGroupType,o.useGroupColumnAsCategory=e.useGroupColumnAsCategory??this.model.useGroupColumnAsCategory;break;case"crossFilterChartUpdate":o.cellRange=this.createCellRange(e)??this.model.suppliedCellRange,o.switchCategorySeries=!1,o.aggFunc=e.aggFunc??this.model.aggFunc,o.crossFiltering=!0,o.crossFilteringSort=this.model.crossFilteringSort,o.suppressChartRanges=e.suppressChartRanges??this.model.suppressChartRanges;break;case"pivotChartUpdate":o.switchCategorySeries=!1;break}this.model.updateModel(o),o.unlinkChart||o.suppressChartRanges?this.rangeSvc?.setCellRanges([]):this.setChartRange()}updateForGridChange(e){if(this.model.unlinked)return;const{maintainColState:t,setColsFromRange:s,updateOrder:r}=e??{};this.model.updateCellRanges({maintainColState:t,setColsFromRange:s,updateOrder:r}),this.model.updateData(),this.setChartRange()}updateForDataChange(){this.model.unlinked||(this.model.updateData(),this.raiseChartModelUpdateEvent())}updateForRangeChange(){this.updateForGridChange({setColsFromRange:!0}),this.raiseChartRangeSelectionChangedEvent()}updateForPanelChange(e){this.model.updateCellRanges(e),this.model.updateData(),e.skipAnimation&&this.getChartProxy().getChartRef().skipAnimations(),this.setChartRange(),this.raiseChartRangeSelectionChangedEvent()}updateThemeOverrides(e){this.chartProxy.updateThemeOverrides(e)}getChartUpdateParams(e){const s=this.getSelectedValueColState().map(a=>({colId:a.colId,displayName:a.displayName})),r=this.getChartData(),i=this.getSelectedDimensions(),n=this.model,o={data:r,groupData:n.groupChartData,grouping:this.isGrouping(),categories:i.map(({colId:a,displayName:l})=>{const c=n.categoryAxisType??n.getChartDataType(a);return{id:a,name:l,chartDataType:c,convertTime:c==="time"?n.getConvertTime(a):void 0}}),fields:s,chartId:this.getChartId(),getCrossFilteringContext:()=>({lastSelectedChartId:"xxx"}),seriesChartTypes:this.getSeriesChartTypes(),updatedOverrides:e,seriesGroupType:n.seriesGroupType};return this.isCategorySeriesSwitched()?this.invertCategorySeriesParams(o):o}invertCategorySeriesParams(e){const[t]=e.categories,s=[{id:wt,name:""}],r=e.data.map((n,o)=>{const a=`${t.id}:${o}`,l=n[t.id],c=l==null?"":String(l);return{colId:a,displayName:c}}),i=e.fields.map(n=>{const o={[wt]:n.displayName};for(const[a,l]of e.data.entries()){const c=`${t.id}:${a}`,u=l[n.colId];o[c]=u}return o});return{...e,categories:s,fields:r,data:i}}getChartModel(){const e=this.model.pivotChart?"pivot":"range",t=this.isComboChart()?this.model.comboChartModel.seriesChartTypes:void 0;return{modelType:e,chartId:this.model.chartId,chartType:this.model.chartType,chartThemeName:this.getChartThemeName(),chartOptions:this.chartProxy?.getChartThemeOverrides(),chartPalette:this.chartProxy?.getChartPalette(),cellRange:this.getCellRangeParams(),switchCategorySeries:this.model.switchCategorySeries,suppressChartRanges:this.model.suppressChartRanges,aggFunc:this.model.aggFunc,unlinkChart:this.model.unlinked,seriesChartTypes:t,seriesGroupType:this.model.seriesGroupType,useGroupColumnAsCategory:this.model.useGroupColumnAsCategory}}getChartId(){return this.model.chartId}getChartData(){return this.model.chartData}getChartType(){return this.model.chartType}setChartType(e){this.updateMultiSeriesAndCategory(this.model.chartType,e),this.model.chartType=e,this.model.comboChartModel.updateSeriesChartTypes(),this.model.switchCategorySeries=!1,this.model.categoryAxisType=void 0,this.model.seriesGroupType=void 0,this.raiseChartModelUpdateEvent()}isCategorySeriesSwitched(){return this.model.switchCategorySeries&&!this.model.isGrouping()}switchCategorySeries(e){_y(this.getChartType())&&(this.model.switchCategorySeries=e,this.raiseChartModelUpdateEvent())}getAggFunc(){return this.model.aggFunc}setAggFunc(e,t){this.model.aggFunc!==e&&(this.model.aggFunc=e,!t&&(this.model.updateData(),this.raiseChartModelUpdateEvent()))}updateMultiSeriesAndCategory(e,t){const s=(a,l)=>{let c=0;for(const u of a)u.selected&&(c>=l?u.selected=!1:c++);c===0&&(a[0].selected=!0)},r=Xu(t),i=Ho(t),n=r!=null&&(Xu(e)??100)>(r??100),o=i!=null&&(Ho(e)??100)>(i??100);n&&s(this.model.dimensionColState,r),o&&s(this.model.valueColState,i),(n||o)&&(this.model.resetCellRanges(n,o),this.setChartRange(!0))}setChartThemeName(e,t){this.model.chartThemeName=e,t||this.raiseChartModelUpdateEvent()}getChartThemeName(){return this.model.chartThemeName}isPivotChart(){return this.model.pivotChart}isPivotMode(){return this.model.isPivotMode()}isGrouping(){return this.model.isGrouping()}isCrossFilterChart(){return this.model.crossFiltering}getThemeNames(){return this.gos.get("chartThemes")??Xy}getPalettes(){return this.getThemeNames().map(e=>{const t=Qu(e)?e:this.chartProxy.lookupCustomChartTheme(e);return this.agChartsExports._Theme.getChartTheme(t).palette})}getSelectedValueColState(){return this.model.getValueColState().filter(e=>e.selected)}getSelectedDimensions(){return this.model.getSelectedDimensions()}getColStateForMenu(){return{dimensionCols:this.model.dimensionColState,valueCols:this.model.getValueColState()}}setChartRange(e=!1){this.rangeSvc&&!this.model.suppressChartRanges&&!this.model.unlinked&&this.rangeSvc.setCellRanges(this.getCellRanges()),e||this.raiseChartModelUpdateEvent()}detachChartRange(){this.model.unlinked=!this.model.unlinked,this.model.unlinked?this.rangeSvc&&this.rangeSvc.setCellRanges([]):this.updateForGridChange(),this.dispatchLocalEvent({type:"chartLinkedChanged"})}setChartProxy(e){this.chartProxy=e}getChartProxy(){return this.chartProxy}isActiveXYChart(){return["scatter","bubble"].includes(this.getChartType())}isChartLinked(){return!this.model.unlinked}customComboExists(){const e=this.model.comboChartModel.savedCustomSeriesChartTypes;return e&&e.length>0}getSeriesChartTypes(){return this.model.comboChartModel.seriesChartTypes}isComboChart(e){return this.model.isComboChart(e)}updateSeriesChartType(e,t,s){const r=this.model.comboChartModel.seriesChartTypes.find(i=>i.colId===e);if(r){const i=this.model.chartType!=="customCombo";i&&(this.model.chartType="customCombo");const n=r.chartType;t!=null&&(r.chartType=t),s!=null&&(r.secondaryAxis=s),this.model.comboChartModel.savedCustomSeriesChartTypes=this.model.comboChartModel.seriesChartTypes,this.model.comboChartModel.updateSeriesChartTypes(),this.updateForDataChange(),i&&this.dispatchLocalEvent({type:"chartTypeChanged"}),n!==t&&this.dispatchLocalEvent({type:"chartSeriesChartTypeChanged"}),this.raiseChartOptionsChangedEvent()}}getActiveSeriesChartTypes(){const e=this.getSelectedValueColState().map(t=>t.colId);return this.getSeriesChartTypes().filter(t=>e.includes(t.colId))}getChartSeriesTypes(e){const t=e??this.getChartType();return this.isComboChart(t)?["line","bar","area"]:[se(t)]}getChartSeriesType(){const e=this.getSeriesChartTypes();if(e.length===0)return"bar";const t=e[0].chartType;return t==="columnLineCombo"?"bar":t==="areaColumnCombo"?"area":se(t)}getCellRanges(){return[this.model.dimensionCellRange,this.model.valueCellRange].filter(Boolean)}createCellRange(e){return e.cellRange&&this.rangeSvc?.createPartialCellRangeFromRangeParams(e.cellRange,!0)}validUpdateType(e){if(!e.type)return this.warn(136),!1;const t={"Range Chart":()=>!this.isPivotChart()&&!this.isCrossFilterChart(),"Pivot Chart":()=>this.isPivotChart(),"Cross Filter Chart":()=>this.isCrossFilterChart()},s=Object.keys(t).find(i=>t[i]())??"Range Chart",r=e.type===`${s[0].toLowerCase()}${s.slice(1).replace(/ /g,"")}Update`;return r||this.warn(137,{currentChartType:s,type:e.type}),r}getCellRangeParams(){const e=this.getCellRanges(),t=e[0],s=t?.startRow??null,r=t?.endRow??null;return{rowStartIndex:s?.rowIndex??null,rowStartPinned:s?.rowPinned,rowEndIndex:r?.rowIndex??null,rowEndPinned:r?.rowPinned,columns:e.reduce((i,n)=>i.concat(n.columns.map(o=>o.getId())),[])}}setCategoryAxisType(e){this.model.categoryAxisType=e,this.raiseChartModelUpdateEvent()}getSeriesGroupType(){return this.model.seriesGroupType??this.chartProxy.getSeriesGroupType()}setSeriesGroupType(e){this.model.seriesGroupType=e,this.raiseChartModelUpdateEvent()}raiseChartModelUpdateEvent(){this.dispatchLocalEvent({type:"chartModelUpdate"}),this.raiseChartOptionsChangedEvent()}raiseChartUpdatedEvent(){this.dispatchLocalEvent({type:"chartUpdated"})}raiseChartApiUpdateEvent(){this.dispatchLocalEvent({type:"chartApiUpdate"})}raiseChartOptionsChangedEvent(){const{chartId:e,chartType:t}=this.getChartModel();this.eventSvc.dispatchEvent({type:"chartOptionsChanged",chartId:e,chartType:t,chartThemeName:this.getChartThemeName(),chartOptions:this.chartProxy?.getChartThemeOverrides()})}raiseChartRangeSelectionChangedEvent(){this.eventSvc.dispatchEvent({type:"chartRangeSelectionChanged",id:this.model.chartId,chartId:this.model.chartId,cellRange:this.getCellRangeParams()})}destroy(){super.destroy(),this.rangeSvc&&this.rangeSvc.setCellRanges([])}},coe=class extends rs{getAxes(e){const t={x:{type:this.getXAxisType(e),position:"bottom"},y:{type:"number",position:"left"}};return this.isNormalised()&&(t.y.label={...t.y.label,formatter:td}),t}getSeries(e){const[t]=e.categories,s=e.fields.map(r=>({type:this.standaloneChartType,xKey:t.id,xName:t.name,yKey:r.colId,yName:r.displayName,normalizedTo:this.chartType==="normalizedArea"?100:void 0,stacked:["normalizedArea","stackedArea"].includes(this.chartType)}));return this.crossFiltering?this.extractLineAreaCrossFilterSeries(s,e):s}isNormalised(){return!this.crossFiltering&&this.chartType==="normalizedArea"}},uoe=new Set(["bar","groupedBar","stackedBar","normalizedBar"]),doe=class extends rs{getAxes(e){const t={x:{type:this.getXAxisType(e),position:this.isHorizontal()?"left":"bottom"},y:{type:"number",position:this.isHorizontal()?"bottom":"left"}};return this.isNormalised()&&(t.y.label={...t.y.label,formatter:td}),t}getSeries(e){const[t]=e.categories,s=e.fields.map(r=>({type:this.standaloneChartType,direction:this.isHorizontal()?"horizontal":"vertical",stacked:this.crossFiltering||Yre(this.chartType),normalizedTo:this.isNormalised()?100:void 0,xKey:t.id,xName:t.name,yKey:r.colId,yName:r.displayName}));return this.crossFiltering?this.extractCrossFilterSeries(s):s}extractCrossFilterSeries(e){const t=[];for(let s=0;s<e.length;s++){const i={...e[s],listeners:{seriesNodeClick:this.crossFilterCallback}},n={...i,yKey:`${i.yKey}-filtered-out`,showInLegend:!1};t.push(i,n)}return t}isNormalised(){const e=["normalizedColumn","normalizedBar"];return!this.crossFiltering&&e.includes(this.chartType)}isHorizontal(){return uoe.has(this.chartType)}},hoe=class extends rs{getAxes(e){const t={x:{type:this.getXAxisType(e),position:"bottom"},y:{type:"number",position:"left"}};return this.isNormalised()&&(t.y.label={...t.y.label,formatter:td}),t}getSeries(e){const[t]=e.categories,s=["normalizedLine","stackedLine"].includes(this.chartType),r=e.fields.map(i=>({type:this.standaloneChartType,xKey:t.id,xName:t.name,yKey:i.colId,yName:i.displayName,normalizedTo:s&&this.isNormalised()?100:void 0,stacked:s}));return this.crossFiltering?this.extractLineAreaCrossFilterSeries(r,e):r}isNormalised(){const e=["normalizedLine"];return!this.crossFiltering&&e.includes(this.chartType)}},poe=class extends rs{getAxes(e){return{x:{type:"number",position:"bottom"},y:{type:"number",position:"left"}}}getSeries(e){const[t]=e.categories,s=this.isPaired(),r=this.getSeriesDefinitions(e.fields,s),i=t.id===wt?void 0:t,n=r.map(o=>o?.sizeField?{type:"bubble",xKey:o.xField.colId,xName:o.xField.displayName??void 0,yKey:o.yField.colId,yName:o.yField.displayName??void 0,title:`${o.yField.displayName} vs ${o.xField.displayName}`,sizeKey:o.sizeField.colId,sizeName:o.sizeField.displayName??"",labelKey:i?i.id:o.yField.colId,labelName:i?i.name:void 0}:{type:"scatter",xKey:o.xField.colId,xName:o.xField.displayName??void 0,yKey:o.yField.colId,yName:o.yField.displayName??void 0,title:`${o.yField.displayName} vs ${o.xField.displayName}`,labelKey:i?i.id:o.yField.colId,labelName:i?i.name:void 0});return this.crossFiltering?this.extractCrossFilterSeries(n,e):n}extractCrossFilterSeries(e,t){const{data:s}=t,r=l=>`${l}-filtered-out`,i=(l,c)=>{const u=[1/0,-1/0];if(c!=null)for(const d of l){const h=d[c]??d[r(c)];h<u[0]&&(u[0]=h),h>u[1]&&(u[1]=h)}if(u[0]<=u[1])return u},n=l=>{let c;if(l.type==="bubble"){const{sizeKey:u}=l;c=i(s,u)}return{...l,...c!=null?{sizeDomain:c}:{},highlight:{highlightedItem:{fill:"yellow"}},listeners:{...l.listeners,seriesNodeClick:this.crossFilterCallback}}},o=l=>{const{yKey:c,xKey:u}=l;let d={};return l.type==="bubble"&&(d={sizeKey:r(l.sizeKey)}),{...l,...d,yKey:r(c),xKey:r(u),showInLegend:!1,listeners:{...l.listeners,seriesNodeClick:h=>{const p=h.datum[r(u)],g={...h,xKey:u,datum:{...h.datum,[u]:p}};this.crossFilterCallback(g)}}}},a=e.map(n);return[...a,...a.map(o)]}getSeriesDefinitions(e,t){if(e.length<2)return[];const s=this.chartType==="bubble";if(t)return s?e.map((i,n)=>n%3===0?{xField:i,yField:e[n+1],sizeField:e[n+2]}:null).filter(i=>i?.yField&&i.sizeField):e.map((i,n)=>n%2===0?{xField:i,yField:e[n+1]}:null).filter(i=>i?.yField);const r=e[0];return s?e.map((i,n)=>n%2===1?{xField:r,yField:i,sizeField:e[n+1]}:null).filter(i=>i?.sizeField):e.filter((i,n)=>n>0).map(i=>({xField:r,yField:i}))}},goe=class extends rs{getAxes(e){const t=e?e.fields:[],s=new Map(t.map(o=>[o.colId,o])),{primaryYKeys:r,secondaryYKeys:i}=this.getYKeys(t,e.seriesChartTypes),n={x:{type:this.getXAxisType(e),position:"bottom"}};return r.length>0&&(n.y={type:"number",position:"left"}),i.length>0&&i.forEach(o=>{if(!(s.get(o)?.colId===o))return;const c={type:"number",position:"right"};n[`y_${o}`]=c}),n}getSeries(e){const{fields:t,seriesChartTypes:s}=e,[r]=e.categories;return t.map(i=>{const n=s.find(o=>o.colId===i.colId);if(n){const o=n.chartType,l=["groupedColumn","groupedBar"].includes(o)?{grouped:!0}:{},c=n.secondaryAxis?`y_${i.colId}`:"y";return{type:se(o),xKey:r.id,yKey:i.colId,yName:i.displayName,yKeyAxis:c,stacked:["stackedArea","stackedColumn"].includes(o),...l}}})}getYKeys(e,t){const s=[],r=[];for(const i of e){const n=i.colId,o=t.find(a=>a.colId===n);o&&(o.secondaryAxis?r.push(n):s.push(n))}return{primaryYKeys:s,secondaryYKeys:r}}setSeriesChartThemeDefaults(e){const t=this.getSeriesChartThemeDefaults();if(!t)return;const s=new Set;for(const r of this.chartProxyParams.seriesChartTypes)s.add(r.chartType);for(const r of s){const i=se(r);e[i]=t}}};function foe(e){const t=e.currentOffset;e.currentOffset-=e.offsetAmount;const s=e.currentOffset;return e.currentOffset-=e.offsetAmount,{outerRadiusOffset:t,innerRadiusOffset:s}}var moe=class extends dr{getUpdateOptions(e,t){return{...t,data:this.crossFiltering?this.getCrossFilterData(e):e.data,series:this.getSeries(e)}}getSeries(e){const[t]=e.categories,s=e.fields.length,r={currentOffset:0,offsetAmount:s>1?20:40},i=this.getFields(e).map(n=>{const o={type:this.standaloneChartType,angleKey:n.colId,angleName:n.displayName,sectorLabelKey:n.colId,calloutLabelName:t.name,calloutLabelKey:t.id};if(this.chartType==="donut"||this.chartType==="doughnut"){const{outerRadiusOffset:a,innerRadiusOffset:l}=foe(r),c=n.displayName?{title:{text:n.displayName,showInLegend:s>1}}:void 0;return{...o,type:"donut",outerRadiusOffset:a,innerRadiusOffset:l,...c}}return o});return this.crossFiltering?this.extractCrossFilterSeries(i):i}getCrossFilterData(e){const t=e.fields[0].colId,s=`${t}-filtered-out`;return e.data.map(r=>{const i=r[t]+r[s];return r[`${t}-total`]=i,r[s]=1,r[t]=r[t]/i,r})}extractCrossFilterSeries(e){const t=e[0],s=t.angleKey,r={...t,radiusMin:0,radiusMax:1,listeners:{seriesNodeClick:this.crossFilterCallback},legendItemKey:t.calloutLabelKey,angleKey:`${s}-total`},i={...r,radiusKey:s,sectorLabelKey:`${s}-total`};return[{...r,radiusKey:`${s}-filtered-out`,showInLegend:!1},i]}getFields(e){return this.chartType==="pie"?e.fields.slice(0,1):e.fields}getSeriesChartThemeDefaults(){return{series:{highlight:ed(this.crossFiltering)}}}};import{AgPromise as voe,Component as Coe}from"ag-grid-community";import{RefPlaceholder as boe,_clearElement as Soe}from"ag-stack";import{Component as yoe,_createElement as woe,_createIconNoSpan as xoe}from"ag-grid-community";var Foe=class extends WT{constructor(){super('<div class="ag-chart-menu" data-ref="eMenu"></div>'),this.eMenu=boe,this.buttonListenersDestroyFuncs=[]}wireBeans(e){this.chartTranslation=e.chartTranslation}updateParams(e){const{buttons:t}=e;this.createButtons(t)}createButtons(e){for(const s of this.buttonListenersDestroyFuncs)s?.();this.buttonListenersDestroyFuncs=[];const t=this.eMenu;Soe(t);for(const s of e){const{buttonName:r,iconName:i,callback:n}=s,o=this.createButton(i),a=this.chartTranslation.translate(r+"ToolbarTooltip");a&&o instanceof HTMLElement&&(o.title=a),this.buttonListenersDestroyFuncs.push(...this.addManagedElementListeners(o,{click:l=>n(l.currentTarget)})),t.appendChild(o)}}createButton(e){const t=xoe(e,this.beans);t.classList.add("ag-chart-menu-icon");const s=woe({tag:"button",attrs:{type:"button"},cls:"ag-chart-menu-toolbar-button"});return s.appendChild(t),s}destroy(){this.buttonListenersDestroyFuncs=[],super.destroy()}};import{AgPromise as Toe,Component as Aoe,_createElement as Jy}from"ag-grid-community";import{_getDocument as Poe,_setDisplayed as Roe}from"ag-stack";import{AgToggleButton as Moe,Component as Ioe}from"ag-grid-community";import{AgSelect as Eoe,AgToggleButton as Doe}from"ag-grid-community";import{AgSelect as Loe,Component as koe}from"ag-grid-community";import{_escapeString as _oe,_getActiveDomElement as Goe,_removeFromParent as Ooe}from"ag-stack";import{AgSelect as Noe,Component as Boe,DragSourceType as Qy}from"ag-grid-community";var Voe=".ag-pill-select{display:flex;flex-direction:column}.ag-pill-select .ag-column-drop{margin:calc(var(--ag-spacing)*-.5);width:auto}.ag-pill-select .ag-column-drop-list{padding:calc(var(--ag-spacing)*.5)}:where(.ag-pill-select){.ag-select{padding-top:var(--ag-spacing)}.ag-picker-field-wrapper{--ag-picker-button-background-color:transparent;--ag-picker-button-focus-background-color:transparent;--ag-picker-button-border:0;--ag-picker-button-focus-border:0}.ag-picker-field-display{cursor:pointer;font-weight:500}.ag-picker-field-display,.ag-picker-field-icon{color:var(--ag-chart-menu-label-color)}}",Hoe=class extends KT{constructor(e){super('<div class="ag-pill-select" role="presentation"></div>'),this.config=e??{};const{selectedValueList:t,valueFormatter:s,valueList:r}=this.config;this.selectedValues=t??[],this.valueList=r??[],this.valueFormatter=s??(i=>_oe(i)),this.registerCSS(Voe)}postConstruct(){const{ariaLabel:e,onValuesChange:t,dragSourceId:s}=this.config;this.dropZonePanel=this.createManagedBean(new zoe({getValues:()=>this.selectedValues,setValues:i=>this.updateValues(i),isDraggable:()=>this.selectedValues.length>1},i=>this.valueFormatter(i),e,s)),this.getGui().appendChild(this.dropZonePanel.getGui()),this.initSelect(),t!=null&&(this.onValuesChange=t)}setValues(e,t){const{added:s,removed:r,updated:i}=this.getChanges(this.valueList,e);let n=!1;return(s.length||r.length||i.length)&&(n=!0),this.valueList=e,this.updateValues(t,n,!0),this}setValueFormatter(e){return this.valueFormatter=e,this}initSelect(){const e=this.createSelectOptions();if(!e.length)return!1;const{selectPlaceholder:t}=this.config;return this.eSelect=this.createBean(new Noe({options:e,placeholder:t,onValueChange:s=>this.addValue(s),pickerIcon:"chartsMenuAdd"})),this.getGui().appendChild(this.eSelect.getGui()),!0}createSelectOptions(){const e=[],{maxSelection:t}=this.config;if(t&&this.selectedValues.length>=t)return e;for(const s of this.valueList)this.selectedValues.includes(s)||e.push({value:s,text:this.valueFormatter(s)});return e}addValue(e){this.dropZonePanel.addItem(e)}updateValues(e,t,s){const r=this.selectedValues;this.selectedValues=e;const i=this.getChanges(r,e),n=t||i.added.length||i.removed.length,o=Goe(this.beans),a=this.eSelect?.getGui().contains(o),l=this.dropZonePanel?.getGui().contains(o);s||this.onValuesChange?.(i);const c=n?!this.refreshSelect():!1;this.dropZonePanel.refreshGui(),n&&a&&(c?this.dropZonePanel.focusList(!0):this.eSelect?.getFocusableElement().focus()),l&&!e.length&&this.eSelect?.getFocusableElement().focus()}getChanges(e,t){const s=t.filter(n=>!e.includes(n)),r=e.filter(n=>!t.includes(n)),i=t.filter((n,o)=>e[o]!==n);return{added:s,removed:r,updated:i,selected:t}}refreshSelect(){if(!this.eSelect)return this.initSelect();const e=this.createSelectOptions();return e.length?(this.eSelect.clearOptions().addOptions(e).setValue(void 0,!0),!0):(Ooe(this.eSelect.getGui()),this.eSelect=this.destroyBean(this.eSelect),!1)}destroy(){this.destroyBean(this.eSelect),super.destroy()}},Uoe=class extends Bg{constructor(e,t,s,r,i,n){super(t,s,!1),this.value=e,this.valueFormatter=r,this.draggable=i,this.sourceId=n}getItem(){return this.value}getDisplayName(){return this.valueFormatter(this.value)}getAriaDisplayName(){return this.getDisplayName()}getTooltip(){}createGetDragItem(){return()=>({value:this.value})}getDragSourceType(){return Qy.ChartPanel}getDragSourceId(){return this.sourceId}isMovable(){return this.isDraggable()}isDraggable(){return this.draggable}},zoe=class extends Og{constructor(e,t,s,r){super(!1),this.model=e,this.valueFormatter=t,this.ariaLabel=s,this.sourceId=r}postConstruct(){super.init()}isItemDroppable(e,t){return this.isSourceEventFromTarget(t)||this.sourceId!=null&&this.sourceId===t.dragSource.sourceId}updateItems(e){this.model.setValues(e)}getExistingItems(){return this.model.getValues()}getIconName(){return this.isPotentialDndItems()?"move":"notAllowed"}getAriaLabel(){return this.ariaLabel}createPillComponent(e,t,s){return new Uoe(e,t,s,this.valueFormatter,this.model.isDraggable(),this.sourceId)}getItems(e){return[e.value]}isInterestedIn(e){return e===Qy.ChartPanel}},ew=class extends $T{constructor(e,t,s,r){super(r),this.chartController=e,this.allowMultipleSelection=t,this.maxSelection=s}wireBeans(e){this.chartTranslation=e.chartTranslation}addItem(e){this.groupComp.addItem(e)}createGroup(e,t,s,r,i){if(this.allowMultipleSelection){const n=e.filter(o=>o.selected);this.valuePillSelect=this.groupComp.createManagedBean(new Hoe({valueList:e,selectedValueList:n,valueFormatter:t,selectPlaceholder:this.chartTranslation.translate(s),dragSourceId:r,onValuesChange:o=>this.onValueChange(o),maxSelection:this.maxSelection})),this.groupComp.addItem(this.valuePillSelect)}else{const n=this.createValueSelectParams(e);n.onValueChange=o=>{for(const a of e)a.selected=!1;o.selected=!0,o.colId===wt&&this.chartController.setAggFunc(void 0,!0),this.chartController.updateForPanelChange({updatedColState:o,skipAnimation:i?.()})},this.valueSelect=this.groupComp.createManagedBean(new Loe(n)),this.groupComp.addItem(this.valueSelect)}}refreshValueSelect(e){if(!this.valueSelect)return;const{options:t,value:s}=this.createValueSelectParams(e);this.valueSelect.clearOptions().addOptions(t).setValue(s,!0)}createValueSelectParams(e){let t;return{options:e.map(r=>{const i=r.displayName??"";return r.selected&&(t=r),{value:r,text:i}}),value:t}}onValueChange({added:e,updated:t,removed:s,selected:r}){let i,n;const o=()=>{r.forEach((a,l)=>{a.order=l}),n=!0};e.length?(i=e[0],i.selected=!0,o()):s.length?(i=s[0],i.selected=!1):t.length&&(o(),i=t[0]),i&&this.chartController.updateForPanelChange({updatedColState:i,resetOrder:n})}destroy(){this.valuePillSelect=void 0,this.valueSelect=void 0,super.destroy()}},Woe="sum",Koe=class extends ew{constructor(e,t,s,r,i){super(e,s,void 0,'<div id="categoriesGroup"></div>'),this.title=t,this.dimensionCols=r,this.isOpen=i}postConstruct(){this.groupComp=this.createBean(new dt({title:this.title,enabled:!0,suppressEnabledCheckbox:!0,suppressOpenCloseIcons:!1,cssIdentifier:"charts-data",expanded:this.isOpen})),this.createGroup(this.dimensionCols,e=>e.displayName??"","categoryAdd","categorySelect",()=>!this.chartController.getAggFunc()),this.createAggFuncControls(this.dimensionCols),this.getGui().appendChild(this.groupComp.getGui())}refresh(e){this.valuePillSelect?.setValues(e,e.filter(t=>t.selected)),this.refreshValueSelect(e),this.refreshAggFuncControls(e,this.chartController.getAggFunc())}createAggFuncControls(e){const t=this.chartController.getAggFunc();this.groupComp.addItem(this.aggFuncToggle=this.createBean(new Doe({label:this.chartTranslation.translate("aggregate"),labelAlignment:"left",labelWidth:"flex",inputWidth:"flex",value:t!=null,onValueChange:s=>{const r=s?Woe:void 0;this.chartController.setAggFunc(r),this.aggFuncSelect?.setValue(r,!0),this.aggFuncSelect?.setDisplayed(r!=null)}}))),this.groupComp.addItem(this.aggFuncSelect=this.createBean(new Eoe({options:[{value:"sum",text:this.chartTranslation.translate("sum")},{value:"first",text:this.chartTranslation.translate("first")},{value:"last",text:this.chartTranslation.translate("last")},{value:"min",text:this.chartTranslation.translate("min")},{value:"max",text:this.chartTranslation.translate("max")},{value:"count",text:this.chartTranslation.translate("count")},{value:"avg",text:this.chartTranslation.translate("avg")}],value:typeof t=="string"?t:void 0,onValueChange:s=>{this.chartController.setAggFunc(s)}}))),this.refreshAggFuncControls(e,t)}refreshAggFuncControls(e,t){const r=e.filter(i=>i.selected).some(i=>i.colId!==wt);this.aggFuncToggle?.setValue(t!=null),this.aggFuncSelect?.setValue(typeof t=="string"?t:void 0,!0),this.aggFuncToggle?.setDisplayed(r),this.aggFuncSelect?.setDisplayed(r&&t!=null)}clearAggFuncControls(){this.aggFuncToggle=this.destroyBean(this.aggFuncToggle),this.aggFuncSelect=this.destroyBean(this.aggFuncSelect)}destroy(){this.clearAggFuncControls(),this.groupComp=this.destroyBean(this.groupComp),super.destroy()}};import{RefPlaceholder as $oe}from"ag-stack";import{AgSelect as tw,AgToggleButton as joe,Component as Yoe}from"ag-grid-community";import{BeanStub as qoe,_toFiniteNumber as Zoe}from"ag-grid-community";var Tt=class extends jT{constructor(e){super(),this.chartOptionsProxy=e}wireBeans(e){this.chartTranslation=e.chartTranslation}getDefaultColorPickerParams(e,t,s){return this.addValueParams(e,{label:this.chartTranslation.translate(t??"color"),labelWidth:"flex",inputWidth:"flex",labelAlignment:"top",pickerGap:6},s)}getDefaultNumberInputParams(e,t,s){return this.addValueParams(e,{label:this.chartTranslation.translate(t),labelAlignment:"top",labelWidth:"flex",inputWidth:"flex",precision:s?.precision,step:s?.step,min:s?.min,max:s?.max},{parseInputValue:r=>Zoe(r)??void 0,formatInputValue:r=>r==null?"":`${r}`})}getDefaultSliderParams(e,t,s,{isArray:r,valueWhenUnset:i}={}){const n=this.chartOptionsProxy.getValue(e)??i?.()??0,o=r&&Array.isArray(n)?n[0]:n,a=this.getDefaultSliderParamsWithoutValueParams(o,t,s);return a.onValueChange=l=>this.chartOptionsProxy.setValue(e,r?[l]:l),a}getDefaultSliderParamsWithoutValueParams(e,t,s){return{label:this.chartTranslation.translate(t),minValue:0,maxValue:Math.max(e,s),textFieldWidth:45,value:`${e}`}}getDefaultCheckboxParams(e,t,s){const r=this.chartOptionsProxy.getValue(e),i={label:this.chartTranslation.translate(t),value:r,readOnly:s?.readOnly,passive:s?.passive};return i.onValueChange=n=>{this.chartOptionsProxy.setValue(e,typeof n=="boolean"?n:void 0)},i}getDefaultToggleParams(e,t,s){const r=this.chartOptionsProxy.getValue(e),i={label:this.chartTranslation.translate(t),labelAlignment:"left",labelWidth:"flex",inputWidth:"flex",value:r,readOnly:s?.readOnly,passive:s?.passive};return i.onValueChange=n=>{this.chartOptionsProxy.setValue(e,typeof n=="boolean"?n:void 0)},i}getDefaultSelectParams(e,t,s){return this.getDefaultSelectParamsWithoutValueParams(t,s,this.chartOptionsProxy.getValue(e),r=>{this.chartOptionsProxy.setValue(e,r)})}getDefaultSelectParamsWithoutValueParams(e,t,s,r){return{label:this.chartTranslation.translate(e),labelAlignment:"top",options:t,pickerGap:6,value:s,onValueChange:r}}getDefaultFontPanelParams(e,t,s){const r=i=>`${e}.${i}`;return this.addEnableParams(r("enabled"),{name:this.chartTranslation.translate(t),suppressEnabledCheckbox:!1,chartMenuParamsFactory:this,keyMapper:r,valueWhenUnset:s},s&&(()=>s("enabled")))}addValueParams(e,t,s){const r=this.chartOptionsProxy.getValue(e)??s?.valueWhenUnset?.();return t.value=s?.formatInputValue?s.formatInputValue(r):r,t.onValueChange=i=>{const n=s?.parseInputValue?s.parseInputValue(i):i;this.chartOptionsProxy.setValue(e,n)},t}addEnableParams(e,t,s){return t.enabled=this.chartOptionsProxy.getValue(e)??s?.()??!1,t.onEnableChange=r=>this.chartOptionsProxy.setValue(e,r),t}getChartOptions(){return this.chartOptionsProxy}},Xoe=class extends YT{constructor(e,t){super(),this.chartMenuContext=e,this.isOpen=t,this.chartSpecificGroup=$oe,this.hasContent=!1}wireBeans(e){this.chartTranslation=e.chartTranslation,this.chartSvc=e.chartSvc}postConstruct(){const t={title:this.getTitle(),enabled:!0,suppressEnabledCheckbox:!0,suppressOpenCloseIcons:!1,cssIdentifier:"charts-data",expanded:this.isOpen,items:[...this.createDirectionSelect(),this.createReverseSelect(),this.createGroupTypeSelect()]};this.setTemplate(`
            <div id="chartSpecificGroup">
                <ag-group-component data-ref="chartSpecificGroup"></ag-group-component>
            </div>`,[ee],{chartSpecificGroup:t}),this.setDisplayed(this.hasContent)}refresh(){this.hasContent=!1,this.chartSpecificGroup.setTitle(this.getTitle()),this.updateDirectionSelect(),this.updateReverseSelect(),this.updateGroupTypeSelect(),this.setDisplayed(this.hasContent)}getTitle(){const e=this.chartMenuContext.chartController.getChartType();return this.chartTranslation.translate(Ju(e))}createDirectionSelect(){if(!this.chartSvc.isEnterprise())return[];const{chartOptionsService:e,chartController:t}=this.chartMenuContext,s=e.getSeriesOptionsProxy(()=>se(t.getChartType())),r=this.createManagedBean(new Tt(s)),i=["horizontal","vertical"].map(a=>({value:a,text:this.chartTranslation.translate(a)})),n=r.getDefaultSelectParams("direction","direction",i),o=n.onValueChange;return n.onValueChange=a=>{o(a),t.raiseChartModelUpdateEvent()},this.directionSelect=this.createManagedBean(new tw(n)),this.updateDirectionSelect(),[this.directionSelect]}createReverseSelect(){const{chartMenuParamsFactory:e}=this.chartMenuContext,t=e.getDefaultToggleParams("series.reverse","reverse");return this.reverseToggle=this.createManagedBean(new joe(t)),this.updateReverseSelect(),this.reverseToggle}updateReverseSelect(){const e=this.chartMenuContext.chartController.getChartType()==="pyramid";this.updateDisplayed(this.reverseToggle,e)}updateDirectionSelect(){const e=Jre(this.chartMenuContext.chartController.getChartType());this.updateDisplayed(this.directionSelect,e)}createGroupTypeSelect(){const{chartController:e,chartMenuParamsFactory:t}=this.chartMenuContext;return this.groupTypeSelect=this.createManagedBean(new tw(t.getDefaultSelectParamsWithoutValueParams("seriesGroupType",Wre.map(s=>({value:s,text:this.chartTranslation.translate(`${s}SeriesGroupType`)})),e.getSeriesGroupType(),s=>e.setSeriesGroupType(s)))),this.updateGroupTypeSelect(),this.groupTypeSelect}updateGroupTypeSelect(){const e=["radialColumn","radialBar","nightingale"].includes(this.chartMenuContext.chartController.getChartType());this.updateDisplayed(this.groupTypeSelect,e)}updateDisplayed(e,t){e?.setDisplayed(t),e&&(this.hasContent=this.hasContent||t)}};import{_areEqual as Joe,_clearElement as Qoe}from"ag-stack";import{AgCheckbox as eae,AgSelect as tae,Component as sae}from"ag-grid-community";var rae=class extends qT{constructor(e,t,s){super('<div id="seriesChartTypeGroup"></div>'),this.chartController=e,this.columns=t,this.isOpen=s,this.selectedColIds=[],this.chartTypeComps=new Map,this.secondaryAxisComps=new Map}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){this.createSeriesChartTypeGroup(this.columns)}refresh(e){Joe(this.getValidColIds(e),this.selectedColIds)?this.refreshComps():this.recreate(e)}recreate(e){this.isOpen=this.seriesChartTypeGroupComp.isExpanded(),Qoe(this.getGui()),this.destroyBean(this.seriesChartTypeGroupComp),this.columns=e,this.selectedColIds=[],this.clearComps(),this.postConstruct()}getValidColIds(e){const t=this.chartController.getSeriesChartTypes();return e.filter(s=>s.selected&&!!t.filter(r=>r.colId===s.colId)[0]).map(({colId:s})=>s)}createSeriesChartTypeGroup(e){this.seriesChartTypeGroupComp=this.createBean(new dt({title:this.chartTranslation.translate("seriesChartType"),enabled:!0,suppressEnabledCheckbox:!0,suppressOpenCloseIcons:!1,cssIdentifier:"charts-data",expanded:this.isOpen}));const t=this.chartController.getSeriesChartTypes();for(const s of e){if(!s.selected)continue;const r=t.filter(c=>c.colId===s.colId)[0];if(!r)continue;this.selectedColIds.push(s.colId);const i=this.seriesChartTypeGroupComp.createManagedBean(new dt({title:s.displayName,enabled:!0,suppressEnabledCheckbox:!0,suppressOpenCloseIcons:!0,cssIdentifier:"charts-format-sub-level"})),n=c=>["groupedColumn","stackedColumn","stackedArea"].includes(c),o=this.seriesChartTypeGroupComp.createManagedBean(new eae({label:this.chartTranslation.translate("secondaryAxis"),labelWidth:"flex",disabled:n(r.chartType),value:!!r.secondaryAxis,onValueChange:c=>this.chartController.updateSeriesChartType(s.colId,void 0,c)}));i.addItem(o);const a=["line","area","stackedArea","groupedColumn","stackedColumn"].map(c=>({value:c,text:this.chartTranslation.translate(Ju(c))})),l=i.createManagedBean(new tae({options:a,value:r.chartType,onValueChange:c=>this.chartController.updateSeriesChartType(s.colId,c)}));i.addItem(l),this.seriesChartTypeGroupComp.addItem(i),this.chartTypeComps.set(s.colId,l),this.secondaryAxisComps.set(s.colId,o)}this.getGui().appendChild(this.seriesChartTypeGroupComp.getGui())}refreshComps(){const e=this.chartController.getSeriesChartTypes();for(const t of this.selectedColIds){const s=e.find(n=>n.colId===t);if(!s)continue;const r=this.chartTypeComps.get(t),i=this.secondaryAxisComps.get(t);r?.setValue(s.chartType),i?.setValue(!!s.secondaryAxis),i?.setDisabled(this.isSecondaryAxisDisabled(s.chartType))}}clearComps(){this.chartTypeComps.clear(),this.secondaryAxisComps.clear()}isSecondaryAxisDisabled(e){return["groupedColumn","stackedColumn","stackedArea"].includes(e)}destroy(){this.clearComps(),this.seriesChartTypeGroupComp=this.destroyBean(this.seriesChartTypeGroupComp),super.destroy()}};import{AgToggleButton as iae}from"ag-grid-community";var nae=class extends ew{constructor(e,t,s,r,i,n,o){super(e,r,i,'<div id="seriesGroup"></div>'),this.chartOptionsService=t,this.title=s,this.valueCols=n,this.isOpen=o}postConstruct(){if(this.groupComp=this.createBean(new dt({title:this.title,enabled:!0,suppressEnabledCheckbox:!0,suppressOpenCloseIcons:!1,cssIdentifier:"charts-data",expanded:this.isOpen})),this.chartController.isActiveXYChart()){const e=this.groupComp.createManagedBean(new iae({label:this.chartTranslation.translate("paired"),labelAlignment:"left",labelWidth:"flex",inputWidth:"flex",value:this.chartOptionsService.getPairedMode(),onValueChange:t=>{this.chartOptionsService.setPairedMode(!!t),this.chartController.updateForGridChange({maintainColState:!0})}}));this.groupComp.addItem(e)}this.createGroup(this.valueCols,this.generateGetSeriesLabel(this.valueCols),"seriesAdd","seriesSelect"),this.getGui().appendChild(this.groupComp.getGui())}refresh(e){this.valuePillSelect?.setValueFormatter(this.generateGetSeriesLabel(e)),this.valuePillSelect?.setValues(e,e.filter(t=>t.selected)),this.refreshValueSelect(e)}generateGetSeriesLabel(e){if(!this.chartController.isActiveXYChart())return n=>n.displayName??"";const t=e.filter(n=>n.selected),s=this.chartController.getChartType()==="bubble",r=this.chartOptionsService.getPairedMode(),i=new Map;return i.set(0,"X"),i.set(1,"Y"),i.set(2,"size"),n=>{const o=n.displayName??"";if(!n.selected)return o;const a=t.indexOf(n);if(a===-1)return o;let l;return r?l=i.get(a%(s?3:2)):a===0?l="X":l=s&&a%2===0?"size":"Y",`${o} (${l})`}}destroy(){this.groupComp=this.destroyBean(this.groupComp),super.destroy()}},oae={groups:[{type:"categories",isOpen:!0},{type:"series",isOpen:!0},{type:"seriesChartType",isOpen:!0},{type:"chartSpecific",isOpen:!0}]},aae=class extends ZT{constructor(e){super('<div class="ag-chart-data-wrapper ag-scrollable-container"></div>'),this.chartMenuContext=e,this.isSwitchCategorySeriesToggled=!1,this.restoreSwitchCategorySeriesToggleFocus=!1,this.panels=[],this.chartController=e.chartController}wireBeans(e){this.chartTranslation=e.chartTranslation,this.chartSvc=e.chartSvc}postConstruct(){this.createSwitchCategorySeriesToggle(),this.isSwitchCategorySeriesToggled=this.chartController.isCategorySeriesSwitched(),this.updatePanels();const e=this.updatePanels.bind(this);this.addManagedListeners(this.chartController,{chartModelUpdate:e,chartApiUpdate:e})}destroy(){this.clearPanelComponents(),super.destroy()}updatePanels(){const e=this.chartType,t=this.isSwitchCategorySeriesToggled,{dimensionCols:s,valueCols:r}=this.chartController.getColStateForMenu();this.chartType=this.chartController.getChartType(),this.isSwitchCategorySeriesToggled=this.chartController.isCategorySeriesSwitched();const i=this.isSwitchCategorySeriesToggled!==t;this.canRefresh(e,this.chartType)&&!i?(this.categoriesDataPanel?.refresh(s),this.seriesDataPanel?.refresh(r),this.seriesChartTypePanel?.refresh(r),this.chartSpecificPanel?.refresh()):this.recreatePanels(s,r);const n=_y(this.chartType)&&this.chartSvc.isEnterprise()&&!this.chartController.isGrouping();Roe(this.switchCategorySeriesToggle.getGui(),n),i&&this.switchCategorySeriesToggle?.setValue(this.chartController.isCategorySeriesSwitched()),this.restoreSwitchCategorySeriesToggleFocus&&(this.restoreSwitchCategorySeriesToggleFocus=!1,n&&this.switchCategorySeriesToggle.getFocusableElement().focus())}canRefresh(e,t){if(e===void 0)return!1;if(e===t)return!0;const s=r=>["columnLineCombo","areaColumnCombo","customCombo"].includes(r);return!!(s(e)&&s(t))}recreatePanels(e,t){this.clearPanelComponents();const{chartType:s}=this;if(!s)return;const r=this.chartController.isCategorySeriesSwitched();this.getDataPanelDef().groups?.forEach(({type:i,isOpen:n})=>{i===(r?"series":"categories")?(this.categoriesDataPanel=this.createBean(new Koe(this.chartController,this.getCategoryGroupTitle(r),this.getCategoryGroupMultipleSelect(s,r),e,n)),this.panels.push(this.categoriesDataPanel)):i===(r?"categories":"series")?(this.seriesDataPanel=this.createBean(new nae(this.chartController,this.chartMenuContext.chartOptionsService,this.getSeriesGroupTitle(r),this.getSeriesGroupMultipleSelect(s,r),this.getSeriesGroupMaxSelection(s,r),t,n)),this.panels.push(this.seriesDataPanel)):i==="seriesChartType"?this.chartController.isComboChart()&&(this.seriesChartTypePanel=this.createBean(new rae(this.chartController,t,n)),this.panels.push(this.seriesChartTypePanel)):i==="chartSpecific"?(this.chartSpecificPanel=this.createBean(new Xoe(this.chartMenuContext,n)),this.panels.push(this.chartSpecificPanel)):this.beans.log.warn(144,{type:i})}),(r?this.categoriesDataPanel:this.seriesDataPanel)?.addItem(this.switchCategorySeriesToggle.getGui()),this.addPanelComponents()}addPanelComponents(){if(!this.panels.length)return;const t=Poe(this.beans).createDocumentFragment();for(const s of this.panels)s.addCss("ag-chart-data-section"),t.appendChild(s.getGui());this.getGui().appendChild(t)}clearPanelComponents(){for(const e of this.panels)e.getGui().remove(),this.destroyBean(e);this.panels=[]}getDataPanelDef(){return this.gos.get("chartToolPanelsDef")?.dataPanel??oae}getCategoryGroupTitle(e){return e?this.chartTranslation.translate("seriesLabels"):this.chartTranslation.translate(this.chartController.isActiveXYChart()?"labels":"categories")}getCategoryGroupMultipleSelect(e,t){return t?!1:Xu(e)!==1}getSeriesGroupTitle(e){return e?this.chartTranslation.translate("categoryValues"):this.chartTranslation.translate(this.chartController.isActiveXYChart()?"xyValues":"series")}getSeriesGroupMultipleSelect(e,t){return this.getSeriesGroupMaxSelection(e,t)!==1}getSeriesGroupMaxSelection(e,t){if(!t)return Ho(e)}createSwitchCategorySeriesToggle(){this.switchCategorySeriesToggle=this.createManagedBean(new Moe({label:this.chartTranslation.translate("switchCategorySeries"),labelAlignment:"left",labelWidth:"flex",inputWidth:"flex",value:this.chartController.isCategorySeriesSwitched(),onValueChange:e=>{this.restoreSwitchCategorySeriesToggleFocus=!0,this.chartController.switchCategorySeries(e)}}))}};import{Component as lae}from"ag-grid-community";import{RefPlaceholder as Ko,_removeFromParent as sw,_setDisplayed as cae}from"ag-stack";import{AgCheckbox as uae,AgSelectSelector as dae,Component as hae}from"ag-grid-community";import{RefPlaceholder as $o,_exists as pae,_getActiveDomElement as gae,_setFixedWidth as fae}from"ag-stack";import{AgAbstractLabel as mae,AgInputNumberFieldSelector as vae}from"ag-grid-community";var Cae=class extends XT{constructor(e){super(e,`<div class="ag-angle-select">
            <div data-ref="eLabel"></div>
            <div class="ag-wrapper ag-angle-select-wrapper">
                <div class="ag-angle-select-field">
                    <div data-ref="eParentCircle" class="ag-angle-select-parent-circle">
                        <div data-ref="eChildCircle" class="ag-angle-select-child-circle"></div>
                    </div>
                </div>
                <ag-input-number-field data-ref="eAngleValue"></ag-input-number-field>
            </div>
        </div>`,[vae]),this.eLabel=$o,this.eParentCircle=$o,this.eChildCircle=$o,this.eAngleValue=$o,this.radius=0,this.offsetX=0,this.offsetY=0}wireBeans(e){this.dragSvc=e.dragSvc}postConstruct(){super.postConstruct();const{value:e,onValueChange:t}=this.config;e!=null&&this.setValue(e,void 0,!0),t!=null&&this.onValueChange(t),this.dragListener={eElement:this.eParentCircle,dragStartPixels:0,onDragStart:()=>{this.parentCircleRect=this.eParentCircle.getBoundingClientRect()},onDragging:s=>this.calculateAngleDrag(s),onDragStop:()=>{}},this.dragSvc?.addDragSource(this.dragListener),this.eAngleValue.setLabel("").setLabelWidth(5).setInputWidth(45).setMin(0).setMax(360).setValue(`${this.degrees}`).onValueChange(s=>{(s==null||s==="")&&(s="0"),s=this.eAngleValue.normalizeValue(s);let r=Number.parseFloat(s);r>180&&(r=r-360),this.setValue(r)}),this.updateNumberInput(),pae(this.getValue())&&this.eAngleValue.setValue(this.normalizeNegativeValue(this.getValue()).toString()),this.addManagedListeners(this,{fieldValueChanged:()=>{this.eAngleValue.getInputElement().contains(gae(this.beans))||this.updateNumberInput()}})}updateNumberInput(){const e=this.normalizeNegativeValue(this.getValue());this.eAngleValue.setValue(e.toString())}positionChildCircle(e){const t=this.parentCircleRect||{width:24,height:24},s=this.eChildCircle,r=t.width/2,i=t.height/2;s.style.left=`${r+Math.cos(e)*8}px`,s.style.top=`${i+Math.sin(e)*8}px`}calculatePolar(){const e=this.offsetX,t=this.offsetY,s=Math.atan2(t,e);this.degrees=this.toDegrees(s),this.radius=Math.sqrt(e*e+t*t),this.positionChildCircle(s)}calculateCartesian(){const e=this.toRadians(this.getValue()),t=this.getRadius();this.setOffsetX(Math.cos(e)*t).setOffsetY(Math.sin(e)*t)}setOffsetX(e){return this.offsetX!==e&&(this.offsetX=e,this.calculatePolar()),this}setOffsetY(e){return this.offsetY!==e&&(this.offsetY=e,this.calculatePolar()),this}calculateAngleDrag(e){const t=this.parentCircleRect,s=t.width/2,r=t.height/2,i=e.clientX-t.left,n=e.clientY-t.top,o=i-s,a=n-r,l=Math.atan2(a,o);this.setValue(l,!0)}toDegrees(e){return e/Math.PI*180}toRadians(e){return e/180*Math.PI}normalizeNegativeValue(e){return e<0?360+e:e}normalizeAngle180(e){return e%=Math.PI*2,e<-Math.PI?e+=Math.PI*2:e>=Math.PI&&(e-=Math.PI*2),e}getRadius(){return this.radius}setRadius(e){return this.radius===e?this:(this.radius=e,this.calculateCartesian(),this)}onValueChange(e){return this.addManagedListeners(this,{fieldValueChanged:()=>{e(this.degrees)}}),this}getValue(e){return e?this.toRadians(this.degrees):this.degrees}setValue(e,t,s){let r;return t?r=e:r=this.normalizeAngle180(this.toRadians(e)),e=this.toDegrees(r),this.degrees!==e&&(this.degrees=Math.floor(e),this.calculateCartesian(),this.positionChildCircle(r),s||this.dispatchLocalEvent({type:"fieldValueChanged"})),this}setWidth(e){return fae(this.getGui(),e),this}setDisabled(e){return super.setDisabled(e),this.eAngleValue.setDisabled(e),this}destroy(){this.dragSvc?.removeDragSource(this.dragListener),super.destroy()}};import{RefPlaceholder as bae,_defaultComparator as Sae,_removeFromParent as yae}from"ag-stack";import{AgSelectSelector as wae,Component as xae}from"ag-grid-community";var is=class extends JT{constructor(e){super(),this.params=e,this.fontGroup=bae,this.activeComps=[],this.chartOptions=e.chartMenuParamsFactory.getChartOptions()}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const{cssIdentifier:e="charts-format-sub-level",name:t,enabled:s,onEnableChange:r,suppressEnabledCheckbox:i}=this.params,n={cssIdentifier:e,direction:"vertical",suppressOpenCloseIcons:!0,title:t,enabled:s,suppressEnabledCheckbox:!0,onEnableChange:o=>{r&&r(o)},useToggle:!i};this.setTemplate(`<div class="ag-font-panel">
        <ag-group-component data-ref="fontGroup">
            <ag-select data-ref="familySelect"></ag-select>
            <ag-select data-ref="weightStyleSelect"></ag-select>
            <div class="ag-charts-font-size-color">
                <ag-select data-ref="sizeSelect"></ag-select>
                <ag-color-picker data-ref="colorPicker"></ag-color-picker>
            </div>
        </ag-group-component>
    </div>`,[ee,wae,xt],{fontGroup:n,familySelect:this.getFamilySelectParams(),weightStyleSelect:this.getWeightStyleSelectParams(),sizeSelect:this.getSizeSelectParams(),colorPicker:this.getColorPickerParams()}),this.toggleCss("ag-font-panel-no-header",!t)}addItem(e,t){t?this.fontGroup.prependItem(e):this.fontGroup.addItem(e),this.activeComps.push(e)}setEnabled(e){this.fontGroup.setEnabled(e)}getColorPickerParams(){const{chartMenuParamsFactory:e,keyMapper:t,valueWhenUnset:s}=this.params,r=e.getDefaultColorPickerParams(t("color"),void 0,{valueWhenUnset:s&&(()=>s("color"))});if(r.value==null){const i=this.chartOptions.getValue(t("placement"));if(typeof i=="string"){const n=i.startsWith("inside")?"insideStyle":"outsideStyle";r.value=this.chartOptions.getValue(t(`${n}.color`))}}return r}getFamilySelectParams(){const e=["Arial, sans-serif","Aria Black, sans-serif","Book Antiqua,  serif","Charcoal, sans-serif","Comic Sans MS, cursive","Courier, monospace","Courier New, monospace","Gadget, sans-serif","Geneva, sans-serif","Helvetica, sans-serif","Impact, sans-serif","Lucida Console, monospace","Lucida Grande, sans-serif","Lucida Sans Unicode,  sans-serif","Monaco, monospace","Palatino Linotype, serif","Palatino, serif","Times New Roman, serif","Times, serif","Verdana, sans-serif"],t=e.map(i=>({value:i,text:i})),s=this.getInitialFontValue("fontFamily");let r=e[0];if(s){const i=Fae(s),o=e.map(a=>a.toLowerCase()).indexOf(i.toLowerCase());o>=0?r=e[o]:(t.push({value:s,text:i}),r=s)}return t.sort(({text:i},{text:n})=>Sae(i,n)),this.params.chartMenuParamsFactory.getDefaultSelectParamsWithoutValueParams("font",t,`${r}`,i=>this.setFont({fontFamily:i}))}getSizeSelectParams(){const e=[8,10,12,14,16,18,20,22,24,26,28,30,32,34,36],t=this.getInitialFontValue("fontSize");t!=null&&!e.includes(t)&&e.push(t);const s=e.sort((r,i)=>r-i).map(r=>({value:`${r}`,text:`${r}`}));return this.params.chartMenuParamsFactory.getDefaultSelectParamsWithoutValueParams("size",s,t==null?void 0:`${t}`,r=>this.setFont({fontSize:Number.parseInt(r,10)}))}getWeightStyleSelectParams(){const e=this.getInitialFontValue("fontWeight")??"normal",t=this.getInitialFontValue("fontStyle")??"normal",s=[{name:"normal",weight:"normal",style:"normal"},{name:"bold",weight:"bold",style:"normal"},{name:"italic",weight:"normal",style:"italic"},{name:"boldItalic",weight:"bold",style:"italic"}];let r=s.find(n=>n.weight===e&&n.style===t);r||(r={name:"predefined",weight:e,style:t},s.unshift(r));const i=s.map(n=>({value:n.name,text:this.chartTranslation.translate(n.name)}));return this.params.chartMenuParamsFactory.getDefaultSelectParamsWithoutValueParams("weight",i,r.name,n=>{const o=s.find(a=>a.name===n);this.setFont({fontWeight:o.weight,fontStyle:o.style})})}destroyActiveComps(){for(const e of this.activeComps)yae(e.getGui()),this.destroyBean(e)}destroy(){this.destroyActiveComps(),super.destroy()}setFont(e){const{keyMapper:t}=this.params;for(const s of Object.keys(e)){const r=e[s];r&&this.chartOptions.setValue(t(s),r)}}getInitialFontValue(e){const{keyMapper:t,valueWhenUnset:s}=this.params;return this.chartOptions.getValue(t(e))??s?.(e)}};function Fae(e){const t=e.split(",");if(t.length===1)return e;const s=t[0];if(!s.startsWith('"')&&!s.startsWith("'"))return s;const r=s[0],i=[];for(const n of t)if(i.push(n),n.trim().endsWith(r))return i.join(",").slice(1,-1);return e}import{RefPlaceholder as Tae}from"ag-stack";import{Component as Aae}from"ag-grid-community";var Pae=class extends QT{constructor(e){super(),this.chartMenuUtils=e,this.axisTicksSizeSlider=Tae}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const{chartMenuUtils:e}=this,t=e.addEnableParams("tick.enabled",{cssIdentifier:"charts-format-sub-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("ticks"),suppressEnabledCheckbox:!0,useToggle:!0}),s=e.getDefaultColorPickerParams("tick.stroke"),r=e.getDefaultSliderParams("tick.width","width",10),i=e.getDefaultSliderParams("tick.size","length",30);this.setTemplate(`<div>
            <ag-group-component data-ref="axisTicksGroup">
                <ag-color-picker data-ref="axisTicksColorPicker"></ag-color-picker>
                <ag-slider data-ref="axisTicksWidthSlider"></ag-slider>
                <ag-slider data-ref="axisTicksSizeSlider"></ag-slider>
            </ag-group-component>
        </div>`,[ee,xt,Ie],{axisTicksGroup:t,axisTicksColorPicker:s,axisTicksWidthSlider:r,axisTicksSizeSlider:i})}setTickSizeSliderDisplayed(e){this.axisTicksSizeSlider.setDisplayed(e)}};import{Component as Rae}from"ag-grid-community";var Mae=class extends eA{constructor(e){super(),this.chartMenuUtils=e,this.chartOptions=e.getChartOptions()}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e=this.chartMenuUtils.addEnableParams("gridLine.enabled",{cssIdentifier:"charts-format-sub-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("gridLines"),suppressEnabledCheckbox:!0,useToggle:!0}),t=this.getGridLineColorPickerParams("color"),s=this.getGridLineWidthSliderParams("thickness"),r=this.getGridLineDashSliderParams("lineDash");this.setTemplate(`<div>
            <ag-group-component data-ref="gridLineGroup">
                <ag-color-picker data-ref="gridLineColorPicker"></ag-color-picker>
                <ag-slider data-ref="gridLineWidthSlider"></ag-slider>
                <ag-slider data-ref="gridLineLineDashSlider"></ag-slider>
            </ag-group-component>
        </div>`,[ee,xt,Ie],{gridLineGroup:e,gridLineColorPicker:t,gridLineWidthSlider:s,gridLineLineDashSlider:r})}getGridLineColorPickerParams(e){return this.chartMenuUtils.getDefaultColorPickerParams("gridLine.style",e,{formatInputValue:t=>t?.[0]?.stroke,parseInputValue:t=>{const s=this.chartOptions.getValue("gridLine.style")??[];return s.length===0?[{stroke:t,lineDash:[]}]:[{...s[0],stroke:t}]}})}getGridLineWidthSliderParams(e){return this.chartMenuUtils.getDefaultSliderParams("gridLine.width",e,10)}getGridLineDashSliderParams(e){const s=this.chartOptions.getValue("gridLine.style")?.[0]?.lineDash?.[0],r=this.chartMenuUtils.getDefaultSliderParamsWithoutValueParams(s??0,e,30);return r.onValueChange=i=>{const n=this.chartOptions.getValue("gridLine.style.0.stroke");this.chartOptions.setValue("gridLine.style",[{lineDash:[i],stroke:n}])},r}},Iae="%d %B %Y",jo=class extends tA{constructor(e,t){super(),this.axisType=e,this.options=t,this.axisGroup=Ko,this.axisTypeSelect=Ko,this.axisPositionSelect=Ko,this.axisTimeFormatSelect=Ko,this.activePanels=[],this.updateFuncs=[];const{chartOptionsService:s,seriesType:r,chartController:i}=t;this.chartOptionsService=s,this.chartController=i,this.chartOptionsSeriesProxy=s.getSeriesOptionsProxy(()=>r)}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const{isExpandedOnInit:e,chartOptionsService:t,registerGroupComponent:s}=this.options,r=this.axisType,i={cssIdentifier:"charts-format-top-level",direction:"vertical",title:this.translate(r),expanded:e,suppressEnabledCheckbox:!0},n=t.getCartesianAxisOptionsProxy(this.axisType),o=this.createManagedBean(new Tt(n)),a=this.createManagedBean(new Tt(t.getCartesianAxisThemeOverridesProxy(this.axisType))),l=this.getAxisTypeSelectParams(o,t.getCartesianAxisAppliedThemeOverridesProxy(this.axisType)),c=this.getAxisPositionSelectParams(o),u=this.getAxisTimeFormatSelectParams(o),d=this.getAxisColorInputParams(a),h=this.getAxisLineWidthSliderParams(a);this.setTemplate(`<div>
            <ag-group-component data-ref="axisGroup">
                <ag-select data-ref="axisTypeSelect"></ag-select>
                <ag-select data-ref="axisTimeFormatSelect"></ag-select>
                <ag-select data-ref="axisPositionSelect"></ag-select>
                <ag-color-picker data-ref="axisColorInput"></ag-color-picker>
                <ag-slider data-ref="axisLineWidthSlider"></ag-slider>
            </ag-group-component>
        </div>`,[ee,dae,xt,Ie],{axisGroup:i,axisTypeSelect:l??void 0,axisPositionSelect:c??void 0,axisTimeFormatSelect:u??void 0,axisColorInput:d,axisLineWidthSlider:h}),s(this.axisGroup),this.axisTypeSelect.setDisplayed(!!l.options?.length),c||this.removeTemplateComponent(this.axisPositionSelect);const p=()=>{const f=n.getValue("type")==="time";cae(this.axisTimeFormatSelect.getGui(),f)};u?(p(),this.addManagedEventListeners({chartOptionsChanged:()=>{p()}})):this.removeTemplateComponent(this.axisTimeFormatSelect),this.initGridLines(a),this.initAxisTicks(a),this.initAxisLabels(a);const g=()=>{for(const f of this.updateFuncs)f()};this.addManagedListeners(this.chartController,{chartUpdated:g,chartModelUpdate:()=>setTimeout(()=>{this.isAlive()&&(this.refreshAxisTypeSelect(o),p())})})}getAxisTypeSelectParams(e,t){const s=e.getChartOptions(),r=this.getAxisTypeSelectOptions(),i=e.getDefaultSelectParams("type","axisType",r);return i.onValueChange=n=>{const o=s.getValue("type");if(n===o)return;const a=t.getValue("*"),l=o==="time",c=n==="time",d=l===c?null:c?Iae:void 0;d===void 0&&s.clearValue?.("label","format"),this.chartOptionsService.setCartesianCategoryAxisType(this.axisType,n),d!=null&&s.setValue("label.format",d),t.setValue("*",a)},i}refreshAxisTypeSelect(e){const t=this.getAxisTypeSelectOptions(),s=!!t.length;this.axisTypeSelect.setDisplayed(s),s&&this.axisTypeSelect.clearOptions().addOptions(t).setValue(e.getChartOptions().getValue("type"))}getAxisTypeSelectOptions(){const e=this.chartController,t=e.getChartType(),s=()=>{const r=e.getChartData()[0];return r?e.getSelectedDimensions().every(i=>!Number.isNaN(Number.parseFloat(r[i.colId]))):!1};return["heatmap","histogram","boxPlot","rangeBar","scatter","bubble"].includes(t)||e.isGrouping()||!this.isCategoryAxis()||e.isCategorySeriesSwitched()||!s()?[]:["category","number","time"].map(r=>({value:r,text:this.translate(r)}))}isCategoryAxis(){const e=this.chartOptionsSeriesProxy.getValue("direction")==="horizontal";return e&&this.axisType==="yAxis"||!e&&this.axisType==="xAxis"}getAxisPositionSelectParams(e){const t=((s,r)=>{if(s==="heatmap")return null;if(r==="xAxis")return[{value:"top",text:this.translate("top")},{value:"bottom",text:this.translate("bottom")}];if(r==="yAxis")return[{value:"left",text:this.translate("left")},{value:"right",text:this.translate("right")}]})(this.chartController.getChartType(),this.axisType);return t?e.getDefaultSelectParams("position","position",t):null}getAxisTimeFormatSelectParams(e){if(!this.isCategoryAxis())return null;const t=[{value:"%d/%m/%Y",text:this.translate("timeFormatSlashesDDMMYYYY")},{value:"%m/%d/%Y",text:this.translate("timeFormatSlashesMMDDYYYY")},{value:"%d/%m/%y",text:this.translate("timeFormatSlashesDDMMYY")},{value:"%m/%d/%y",text:this.translate("timeFormatSlashesMMDDYY")},{value:"%d.%e.%y",text:this.translate("timeFormatDotsDDMYY")},{value:"%e.%d.%y",text:this.translate("timeFormatDotsMDDYY")},{value:"%Y-%m-%d",text:this.translate("timeFormatDashesYYYYMMDD")},{value:"%d %B %Y",text:this.translate("timeFormatSpacesDDMMMMYYYY")},{value:"%H:%M:%S",text:this.translate("timeFormatHHMMSS")},{value:"%I:%M:%S %p",text:this.translate("timeFormatHHMMSSAmPm")}];return e.getDefaultSelectParams("label.format","timeFormat",t)}getAxisColorInputParams(e){return e.getDefaultColorPickerParams("line.stroke")}getAxisLineWidthSliderParams(e){const t=e.getChartOptions(),s=()=>t.getValue("line.enabled")?t.getValue("line.strokeWidth"):null,r=n=>{t.setValues([{expression:"line.enabled",value:n!=null},{expression:"line.strokeWidth",value:n??0}])},i=e.getDefaultSliderParamsWithoutValueParams(s()??0,"thickness",10);return i.onValueChange=n=>{r(n===0?null:n)},i}initGridLines(e){if(this.chartController.getChartType()==="heatmap")return;const s=this.createBean(new Mae(e));this.axisGroup.addItem(s),this.activePanels.push(s)}initAxisTicks(e){if(!this.hasConfigurableAxisTicks())return;const t=this.createBean(new Pae(e));this.axisGroup.addItem(t),this.activePanels.push(t);const s=()=>t.setTickSizeSliderDisplayed(this.isGroupedCategoryAxis());this.updateFuncs.push(s),s()}hasConfigurableAxisTicks(){switch(this.chartController.getChartType()){case"radarLine":case"radarArea":case"rangeBar":case"boxPlot":case"waterfall":return!1;default:return!0}}initAxisLabels(e){const t={name:this.translate("labels"),enabled:!0,suppressEnabledCheckbox:!0,chartMenuParamsFactory:e,keyMapper:r=>`label.${r}`},s=this.createBean(new is(t));this.axisGroup.addItem(s),this.activePanels.push(s),this.addAdditionalLabelComps(s,e)}addAdditionalLabelComps(e,t){this.addLabelPadding(e,t);const s=this.createRotationWidget("labelRotation",t),r=this.initLabelRotation(s,t);e.addItem(r),e.addItem(s)}initLabelRotation(e,t){const s=t.getChartOptions(),r=()=>s.getValue("label.rotation"),i=()=>s.getValue("label.autoRotate"),n=u=>{u&&(this.prevRotation=r()),s.setValues([{expression:"label.autoRotate",value:u},{expression:"label.rotation",value:u?void 0:this.prevRotation}]),e.setDisplayed(!u)},a=typeof r()=="number"?!1:i(),l=this.createBean(new uae({label:this.translate("autoRotate"),value:a,onValueChange:n}));e.setDisplayed(!a);const c=()=>l.setDisplayed(this.isGroupedCategoryAxis());return this.updateFuncs.push(c),c(),l}createRotationWidget(e,t){const s=t.getChartOptions(),r=()=>s.getValue("label.rotation"),i=l=>s.setValue("label.rotation",l),o=`${this.chartTranslation.translate(e)} \xB0`,a=new Cae({label:o,labelWidth:"flex",value:r()??0,onValueChange:i});return this.updateFuncs.push(()=>{a.setValue(r()??0)}),this.createBean(a)}isGroupedCategoryAxis(){return this.chartOptionsService.getCartesianAxisOptionsProxy(this.axisType).getValue("type")==="grouped-category"?!this.isCategoryAxis():!0}addLabelPadding(e,t){const s=this.createBean(new Te(t.getDefaultSliderParams("label.spacing","padding",30)));e.addItem(s)}translate(e){return this.chartTranslation.translate(e)}removeTemplateComponent(e){sw(e.getGui()),this.destroyBean(e)}destroyActivePanels(){for(const e of this.activePanels)sw(e.getGui()),this.destroyBean(e)}destroy(){this.destroyActivePanels(),super.destroy()}};import{RefPlaceholder as Eae}from"ag-stack";import{AgSelect as Dae,Component as Lae}from"ag-grid-community";var kae=class extends sA{constructor(e){super(),this.options=e,this.axisGroup=Eae}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const{isExpandedOnInit:e,chartOptionsService:t,registerGroupComponent:s}=this.options,r={cssIdentifier:"charts-format-top-level",direction:"vertical",title:this.translate("polarAxis"),expanded:e,suppressEnabledCheckbox:!0},i=this.createManagedBean(new Tt(t.getPolarAxisThemeOverridesProxy("angle"))),n=i.getDefaultColorPickerParams("line.stroke"),o=i.getDefaultSliderParams("line.strokeWidth","thickness",10);this.setTemplate(`<div>
            <ag-group-component data-ref="axisGroup">
                <ag-color-picker data-ref="axisColorInput"></ag-color-picker>
                <ag-slider data-ref="axisLineWidthSlider"></ag-slider>
            </ag-group-component>
        </div>`,[ee,xt,Ie],{axisGroup:r,axisColorInput:n,axisLineWidthSlider:o}),s(this.axisGroup),this.initAxis(i),this.initAxisLabels(i),this.initRadiusAxis()}createSingleAxisParamsFactory(e){return this.createManagedBean(new Tt(this.options.chartOptionsService.getPolarAxisThemeOverridesProxy(e,"thisAxis")))}initAxis(e){const t=this.options.chartController.getChartType();if(["radarLine","radarArea"].includes(t)){const r=[{value:"circle",text:this.translate("circle")},{value:"polygon",text:this.translate("polygon")}];this.axisGroup.addItem(this.createSelect({chartAxisThemeOverrides:e,labelKey:"shape",options:r,property:"shape"}))}t!=="pie"&&this.axisGroup.addItem(this.createSlider({chartAxisThemeOverrides:this.createSingleAxisParamsFactory("radius"),labelKey:"innerRadius",defaultMaxValue:1,property:"innerRadiusRatio"}))}initAxisLabels(e){const t={name:this.translate("labels"),enabled:!0,suppressEnabledCheckbox:!0,chartMenuParamsFactory:e,keyMapper:i=>`label.${i}`},s=this.createManagedBean(new is(t)),r=this.createOrientationWidget();s.addItem(r),this.axisGroup.addItem(s)}createOrientationWidget(){const e=[{value:"fixed",text:this.translate("fixed")},{value:"parallel",text:this.translate("parallel")},{value:"perpendicular",text:this.translate("perpendicular")}];return this.createSelect({chartAxisThemeOverrides:this.createSingleAxisParamsFactory("angle"),labelKey:"orientation",options:e,property:"label.orientation",valueWhenUnset:"fixed"})}initRadiusAxis(){const e=se(this.options.chartController.getChartType());if(!qre(e))return;const t=this.options.chartOptionsService.getPolarCategoryAxisType();if(!t)return;const s=this.createSingleAxisParamsFactory(t),r=[this.createSlider({chartAxisThemeOverrides:s,labelKey:"groupPadding",defaultMaxValue:1,property:"paddingInner"}),this.createSlider({chartAxisThemeOverrides:s,labelKey:"seriesPadding",defaultMaxValue:1,property:"groupPaddingInner"})],i=this.createManagedBean(new dt({cssIdentifier:"charts-format-sub-level",direction:"vertical",suppressOpenCloseIcons:!0,enabled:!0,suppressEnabledCheckbox:!0,title:this.translate("padding"),items:r})).hideEnabledCheckbox(!0).hideOpenCloseIcons(!0);this.axisGroup.addItem(i)}createSlider(e){const{labelKey:t,defaultMaxValue:s,step:r=.05,property:i,chartAxisThemeOverrides:n}=e,o=n.getDefaultSliderParams(i,t,s);return o.step=r,this.createManagedBean(new Te(o))}createSelect(e){const{labelKey:t,options:s,property:r,chartAxisThemeOverrides:i,valueWhenUnset:n}=e,o=i.getDefaultSelectParams(r,t,s);return o.value??(o.value=n),this.createManagedBean(new Dae(o))}translate(e){return this.chartTranslation.translate(e)}};import{RefPlaceholder as _ae}from"ag-stack";import{Component as Gae}from"ag-grid-community";import{Component as Oae}from"ag-grid-community";var Nae=class extends rA{constructor(e){super(),this.chartMenuUtils=e}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e=this.chartMenuUtils.addEnableParams("background.visible",{cssIdentifier:"charts-format-sub-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("background"),suppressEnabledCheckbox:!0,useToggle:!0}),t=this.chartMenuUtils.getDefaultColorPickerParams("background.fill");this.setTemplate(`<div>
            <ag-group-component data-ref="chartBackgroundGroup">
                <ag-color-picker data-ref="colorPicker"></ag-color-picker>
            </ag-group-component>
        <div>`,[ee,xt],{chartBackgroundGroup:e,colorPicker:t})}};import{RefPlaceholder as Bae}from"ag-stack";import{Component as Vae}from"ag-grid-community";var Hae=class extends iA{constructor(e,t){super(),this.chartMenuUtils=e,this.chartController=t,this.paddingTopSlider=Bae}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e={cssIdentifier:"charts-format-sub-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("padding"),suppressEnabledCheckbox:!0},t=s=>this.chartMenuUtils.getDefaultSliderParams("padding."+s,s,200);this.setTemplate(`<div>
            <ag-group-component data-ref="chartPaddingGroup">
                <ag-slider data-ref="paddingTopSlider"></ag-slider>
                <ag-slider data-ref="paddingRightSlider"></ag-slider>
                <ag-slider data-ref="paddingBottomSlider"></ag-slider>
                <ag-slider data-ref="paddingLeftSlider"></ag-slider>
            </ag-group-component>
        <div>`,[ee,Ie],{chartPaddingGroup:e,paddingTopSlider:t("top"),paddingRightSlider:t("right"),paddingBottomSlider:t("bottom"),paddingLeftSlider:t("left")}),this.addManagedEventListeners({chartOptionsChanged:s=>{this.updateTopPadding(s.chartOptions)}})}updateTopPadding(e){const t=[...this.chartController.getChartSeriesTypes(),"common"].map(s=>{const r=e?.[s]?.padding;return typeof r=="number"?r:r?.top}).find(s=>s!=null);t!=null&&this.paddingTopSlider.setValue(`${t}`)}},Uae=class extends nA{constructor(e){super(),this.options=e,this.chartGroup=_ae}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const{chartController:e,chartMenuParamsFactory:t,isExpandedOnInit:s,registerGroupComponent:r}=this.options,i={cssIdentifier:"charts-format-top-level",direction:"vertical",title:this.chartTranslation.translate("chartStyle"),expanded:s,suppressEnabledCheckbox:!0,items:[this.createManagedBean(new Hae(t,e)),this.createManagedBean(new Nae(t))]};this.setTemplate(`<div>
            <ag-group-component data-ref="chartGroup"></ag-group-component>
        </div>`,[ee],{chartGroup:i}),r(this.chartGroup)}};import{BeanStub as zae}from"ag-grid-community";var Wae=class extends oA{constructor(e){super(),this.groupContainer=e,this.id=0,this.groupComponents=new Map}addGroupComponent(e){const t=this.id++;this.groupComponents.set(t,e),e.isExpanded()&&(this.expandedGroupComponent=t),e.onExpandedChange(s=>{if(s){const r=this.expandedGroupComponent;if(this.expandedGroupComponent=t,r!=null){const i=e.getGui(),n=i.offsetTop-this.groupContainer.parentElement.scrollTop;this.groupComponents.get(r)?.toggleGroupExpand(!1,!0);let o=i.offsetTop-n;o<0&&(o=0),o!==this.groupContainer.parentElement.scrollTop&&(this.groupContainer.parentElement.scrollTop=o)}}else this.expandedGroupComponent=void 0})}destroy(){this.groupComponents.clear(),super.destroy()}};import{RefPlaceholder as rw}from"ag-stack";import{AgCheckbox as Kae,AgSelect as $ae,Component as jae}from"ag-grid-community";var Yae=2,qae=class extends aA{constructor(e,t){super(),this.options=e,this.legendGroup=rw,this.enabledGroup=rw,this.isGradient=["treemap","sunburst","heatmap"].includes(e.seriesType),this.key=this.isGradient?"gradientLegend":"legend",this.chartController=t.chartController}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const{chartMenuParamsFactory:e,isExpandedOnInit:t,registerGroupComponent:s}=this.options,r=this.createManagedBean(new $ae(e.getDefaultSelectParams(`${this.key}.position`,"position",["top","right","bottom","left"].map(o=>({value:o,text:this.chartTranslation.translate(o)})))));this.enabledGroup=this.createManagedBean(new dt(e.addEnableParams(`${this.key}.enabled`,{cssIdentifier:"charts-format-sub-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("legendEnabled"),suppressEnabledCheckbox:!0,useToggle:!0,items:[this.createLabelPanel(e),r,...this.getItems(e)]})));const i={cssIdentifier:"charts-format-top-level",direction:"vertical",title:this.chartTranslation.translate("legend"),suppressEnabledCheckbox:!0,expanded:t,items:[this.enabledGroup]};this.setTemplate(`<div>
            <ag-group-component data-ref="legendGroup">
            </ag-group-component>
        </div>`,[ee],{legendGroup:i}),s(this.legendGroup);const n=this.updateLegendEnabledState.bind(this);this.addManagedListeners(this.chartController,{chartModelUpdate:n,chartApiUpdate:n})}updateLegendEnabledState(){const{valueCols:e}=this.chartController.getColStateForMenu();this.enabledGroup.setEnabled(e.filter(t=>t.selected).length>1)}getItems(e){const t=(s,r,i)=>{const n=e.getDefaultSliderParams(`${this.key}.${s}`,r,i);return this.createManagedBean(new Te(n))};return this.isGradient?[this.createManagedBean(new Kae(e.addValueParams("gradientLegend.reverseOrder",{label:this.chartTranslation.translate("reverseDirection"),labelWidth:"flex"}))),t("gradient.thickness","thickness",40),t("gradient.preferredLength","preferredLength",300),t("spacing","spacing",200)]:[t("spacing","spacing",200),t("item.marker.size","markerSize",40),this.createMarkerStrokeSlider(e),t("item.marker.padding.right","itemSpacing",20),this.createItemPaddingSlider(e,"layoutHorizontalSpacing",["left","right"]),this.createItemPaddingSlider(e,"layoutVerticalSpacing",["top","bottom"])]}createMarkerStrokeSlider(e){const t=`${this.key}.item.marker.strokeWidth`,s=e.getDefaultSliderParams(t,"markerStroke",10);if(e.getChartOptions().getValue(t)==null){const r=this.getRenderedMarkerStrokeWidths();r.length>0&&(s.value=r.length===1?`${r[0]}`:"")}return this.createManagedBean(new Te(s))}getRenderedMarkerStrokeWidths(){const e=this.chartController.getChartProxy().getChart().ctx.legendManager.getData(),t=new Set;for(let s=0,r=e.length;s<r;++s){const i=e[s].symbol?.marker;i&&t.add(Math.min(i.strokeWidth??1,Yae))}return[...t]}createItemPaddingSlider(e,t,s){const r=o=>`${this.key}.item.padding.${o}`,i=e.getDefaultSliderParams(r(s[0]),t,50),n=e.getChartOptions();return i.onValueChange=o=>n.setValues(s.map(a=>({expression:r(a),value:o}))),this.createManagedBean(new Te(i))}createLabelPanel(e){const t=this.isGradient?"gradientLegend.scale.label":"legend.item.label",s={enabled:!0,suppressEnabledCheckbox:!0,chartMenuParamsFactory:e,keyMapper:r=>`${t}.${r}`,cssIdentifier:"charts-format-sub-level-no-header"};return this.createManagedBean(new is(s))}};import{RefPlaceholder as Zae,_removeFromParent as Xae}from"ag-stack";import{AgSelect as od,Component as Jae}from"ag-grid-community";import{RefPlaceholder as Qae,_removeFromParent as ele}from"ag-stack";import{Component as tle}from"ag-grid-community";var sle=class extends lA{constructor(e){super(),this.params=e,this.toggleableGroup=Qae,this.activeComps=[],this.chartOptions=e.chartMenuParamsFactory.getChartOptions()}postConstruct(){const{tag:e,cssIdentifier:t="charts-format-sub-level",title:s,suppressEnabledCheckbox:r}=this.params,i=this.params.chartMenuParamsFactory.addEnableParams(`${e}.enabled`,{cssIdentifier:t,direction:"vertical",suppressOpenCloseIcons:!0,title:s,suppressEnabledCheckbox:!0,useToggle:!r});this.setTemplate(`<div class="ag-toggleable-group-panel">
                <ag-group-component data-ref="toggleableGroup">
                </ag-group-component>
            </div>`,[ee],{toggleableGroup:i}),this.toggleCss("ag-toggleable-group-panel-no-header",!s)}addItem(e,t){t?this.toggleableGroup.prependItem(e):this.toggleableGroup.addItem(e),this.activeComps.push(e)}setEnabled(e){this.toggleableGroup.setEnabled(e)}destroyActiveComps(){for(const e of this.activeComps)ele(e.getGui()),this.destroyBean(e)}destroy(){this.destroyActiveComps(),super.destroy()}};import{Component as rle}from"ag-grid-community";var ile=class extends cA{constructor(e){super(),this.chartMenuUtils=e}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e={cssIdentifier:"charts-format-sub-level",direction:"vertical",title:this.chartTranslation.translate("callout"),enabled:!0,suppressOpenCloseIcons:!0,suppressEnabledCheckbox:!0};this.setTemplate(`<div>
            <ag-group-component data-ref="calloutGroup">
                <ag-slider data-ref="calloutLengthSlider"></ag-slider>
                <ag-slider data-ref="calloutStrokeWidthSlider"></ag-slider>
                <ag-slider data-ref="labelOffsetSlider"></ag-slider>
            </ag-group-component>
        </div>`,[ee,Ie],{calloutGroup:e,calloutLengthSlider:this.chartMenuUtils.getDefaultSliderParams("calloutLine.length","length",40),calloutStrokeWidthSlider:this.chartMenuUtils.getDefaultSliderParams("calloutLine.strokeWidth","strokeWidth",10),labelOffsetSlider:this.chartMenuUtils.getDefaultSliderParams("calloutLabel.offset","offset",30)})}};import{Component as nle}from"ag-grid-community";var ole=class extends uA{constructor(e){super(),this.chartMenuUtils=e}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e={cssIdentifier:"charts-format-sub-level",direction:"vertical",title:this.chartTranslation.translate("cap"),enabled:!0,suppressOpenCloseIcons:!0,suppressEnabledCheckbox:!0},t=this.chartMenuUtils.getDefaultSliderParams("cap.lengthRatio","capLengthRatio",1);t.step=.05,this.setTemplate(`<div>
            <ag-group-component data-ref="capsGroup">
                <ag-slider data-ref="capLengthRatioSlider"></ag-slider>
            </ag-group-component>
        </div>`,[ee,Ie],{capsGroup:e,capLengthRatioSlider:t})}};import{Component as ale}from"ag-grid-community";var lle=class extends dA{constructor(e){super(),this.chartMenuUtils=e}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e={cssIdentifier:"charts-format-sub-level",direction:"vertical",title:this.chartTranslation.translate("connectorLine"),enabled:!0,suppressOpenCloseIcons:!0,suppressEnabledCheckbox:!0};this.setTemplate(`<div>
            <ag-group-component data-ref="lineGroup">
                <ag-color-picker data-ref="lineColorPicker"></ag-color-picker>
                <ag-slider data-ref="lineStrokeWidthSlider"></ag-slider>
                <ag-slider data-ref="lineOpacitySlider"></ag-slider>
                <ag-slider data-ref="lineDashSlider"></ag-slider>                
            </ag-group-component>
        </div>`,[ee,xt,Ie],{lineGroup:e,lineColorPicker:this.chartMenuUtils.getDefaultColorPickerParams("line.stroke"),lineStrokeWidthSlider:this.getSliderParams("strokeWidth",10,"line.strokeWidth"),lineDashSlider:this.getSliderParams("lineDash",30,"line.lineDash",1,!0),lineOpacitySlider:this.getSliderParams("strokeOpacity",1,"line.strokeOpacity",.05)})}getSliderParams(e,t,s,r=1,i=!1){const n=this.chartMenuUtils.getDefaultSliderParams(s,e,t,{isArray:i});return n.step=r,n}};import{AgSelectSelector as cle,Component as ule}from"ag-grid-community";function iw(e){return["square","circle","cross","diamond","plus","triangle","heart"].map(t=>({value:t,text:e.translate(t)}))}var dle=class extends hA{constructor(e){super(),this.chartMenuUtils=e}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e=this.chartMenuUtils.addEnableParams("marker.enabled",{cssIdentifier:"charts-format-sub-level",direction:"vertical",title:this.chartTranslation.translate("markers"),suppressEnabledCheckbox:!0,useToggle:!0,suppressOpenCloseIcons:!0});this.setTemplate(`<div>
            <ag-group-component data-ref="seriesMarkersGroup">
                <ag-select data-ref="seriesMarkerShapeSelect"></ag-select>
                <ag-slider data-ref="seriesMarkerSizeSlider"></ag-slider>
                <ag-slider data-ref="seriesMarkerStrokeWidthSlider"></ag-slider>
            </ag-group-component>
        </div>`,[ee,cle,Ie],{seriesMarkersGroup:e,seriesMarkerShapeSelect:this.chartMenuUtils.getDefaultSelectParams("marker.shape","shape",iw(this.chartTranslation)),seriesMarkerSizeSlider:this.chartMenuUtils.getDefaultSliderParams("marker.size","size",60),seriesMarkerStrokeWidthSlider:this.chartMenuUtils.getDefaultSliderParams("marker.strokeWidth","strokeWidth",10)})}};import{RefPlaceholder as hle,_removeFromParent as ple}from"ag-stack";import{AgSelectSelector as gle,Component as fle}from"ag-grid-community";var mle=class extends pA{constructor(e){super(),this.chartMenuUtils=e,this.seriesItemsGroup=hle,this.activePanels=[]}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e={cssIdentifier:"charts-format-sub-level",direction:"vertical",title:this.chartTranslation.translate("seriesItems"),enabled:!0,suppressOpenCloseIcons:!0,suppressEnabledCheckbox:!0};this.setTemplate(`<div>
            <ag-group-component data-ref="seriesItemsGroup">
                <ag-select data-ref="seriesItemSelect"></ag-select>
            </ag-group-component>
        </div>`,[ee,gle],{seriesItemsGroup:e,seriesItemSelect:this.getSeriesItemsParams()}),this.initSeriesControls()}getSeriesItemsParams(){const e=[{value:"positive",text:this.chartTranslation.translate("seriesItemPositive")},{value:"negative",text:this.chartTranslation.translate("seriesItemNegative")}],t=s=>{this.destroyActivePanels(),this.initSeriesControls(s)};return this.chartMenuUtils.getDefaultSelectParamsWithoutValueParams("seriesItemType",e,"positive",t)}initSeriesControls(e="positive"){this.initSlider("strokeWidth",10,`item.${e}.strokeWidth`),this.initSlider("lineDash",30,`item.${e}.lineDash`,1,!0),this.initSlider("strokeOpacity",1,`item.${e}.strokeOpacity`,.05,!1),this.initSlider("fillOpacity",1,`item.${e}.fillOpacity`,.05,!1),this.initItemLabels(e)}initSlider(e,t,s,r=1,i=!1){const n=this.chartMenuUtils.getDefaultSliderParams(s,e,t,{isArray:i});n.step=r;const o=this.seriesItemsGroup.createManagedBean(new Te(n));this.seriesItemsGroup.addItem(o),this.activePanels.push(o)}initItemLabels(e){const t=this.chartMenuUtils.getDefaultFontPanelParams(`item.${e}.label`,"seriesItemLabels"),s=this.createBean(new is(t));this.seriesItemsGroup.addItem(s),this.activePanels.push(s)}destroyActivePanels(){for(const e of this.activePanels)ple(e.getGui()),this.destroyBean(e)}destroy(){this.destroyActivePanels(),super.destroy()}};import{Component as vle}from"ag-grid-community";var Cle=class extends gA{constructor(e,t="shadow"){super(),this.chartMenuUtils=e,this.propertyKey=t}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e=this.propertyKey,t=this.chartMenuUtils.addEnableParams(`${e}.enabled`,{cssIdentifier:"charts-format-sub-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("shadow"),suppressEnabledCheckbox:!0,useToggle:!0}),s=this.chartMenuUtils.getDefaultColorPickerParams(`${e}.color`);this.setTemplate(`<div>
            <ag-group-component data-ref="shadowGroup">
                <ag-color-picker data-ref="shadowColorPicker"></ag-color-picker>
                <ag-slider data-ref="shadowBlurSlider"></ag-slider>
                <ag-slider data-ref="shadowXOffsetSlider"></ag-slider>
                <ag-slider data-ref="shadowYOffsetSlider"></ag-slider>
            </ag-group-component>
        </div>`,[ee,xt,Ie],{shadowGroup:t,shadowColorPicker:s,shadowBlurSlider:this.getSliderParams("blur",0,20),shadowXOffsetSlider:this.getSliderParams("xOffset",-10,10),shadowYOffsetSlider:this.getSliderParams("yOffset",-10,10)})}getSliderParams(e,t,s){const r=`${this.propertyKey}.${e}`,i=this.chartMenuUtils.getDefaultSliderParams(r,e,s);return i.minValue=t,i}};import{Component as ble}from"ag-grid-community";var Sle=class extends fA{constructor(e){super(),this.chartMenuUtils=e}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e={cssIdentifier:"charts-format-sub-level",direction:"vertical",enabled:!0,suppressOpenCloseIcons:!0,suppressEnabledCheckbox:!0};this.setTemplate(`<div>
            <ag-group-component data-ref="groupSpacing">
                <ag-slider data-ref="groupPaddingSlider"></ag-slider>
                <ag-slider data-ref="groupSpacingSlider"></ag-slider>
            </ag-group-component>
            <ag-group-component data-ref="tileSpacing">
                <ag-slider data-ref="tilePaddingSlider"></ag-slider>
                <ag-slider data-ref="tileSpacingSlider"></ag-slider>
            </ag-group-component>
        </div>`,[ee,Ie],{groupSpacing:{...e,title:this.chartTranslation.translate("group")},tileSpacing:{...e,title:this.chartTranslation.translate("tile")},groupPaddingSlider:this.getSliderParams("padding","group.padding"),groupSpacingSlider:this.getSliderParams("spacing","group.gap"),tilePaddingSlider:this.getSliderParams("padding","tile.padding"),tileSpacingSlider:this.getSliderParams("spacing","tile.gap")})}getSliderParams(e,t){return this.chartMenuUtils.getDefaultSliderParams(t,e,10)}};import{RefPlaceholder as yle}from"ag-stack";import{AgSelectSelector as wle,Component as xle}from"ag-grid-community";function Fle(e){return e[0].toUpperCase()+e.substring(1)}var Tle=class extends mA{constructor(e){super(),this.chartMenuUtils=e,this.tooltipMode=yle}postConstruct(){const{chartMenuUtils:e,beans:t}=this,s="tooltip",r=t.chartTranslation,i=e.addEnableParams(`${s}.enabled`,{cssIdentifier:"charts-format-sub-level",direction:"vertical",suppressOpenCloseIcons:!0,title:r.translate("tooltips"),suppressEnabledCheckbox:!0,useToggle:!0}),n="tooltipMode",o=["single","shared","compact"].map(c=>({value:c,text:r.translate(`${n}${Fle(c)}`)})),a=`${s}.mode`,l=e.getDefaultSelectParams(a,n,o);this.setTemplate(`<div>
            <ag-group-component data-ref="tooltipGroup">
                <ag-select data-ref="tooltipMode"></ag-select>
            </ag-group-component>
        </div>`,[ee,wle],{tooltipGroup:i,tooltipMode:l}),this.addManagedEventListeners({chartOptionsChanged:()=>{const c=e.getChartOptions().getValue(a);this.tooltipMode.setValue(c,!0)}})}};import{Component as Ale}from"ag-grid-community";var Ple=class extends vA{constructor(e){super(),this.chartMenuUtils=e}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e=this.chartMenuUtils.getChartOptions(),t=r=>()=>e.getValue(r),s={cssIdentifier:"charts-format-sub-level",direction:"vertical",title:this.chartTranslation.translate("whisker"),enabled:!0,suppressOpenCloseIcons:!0,suppressEnabledCheckbox:!0};this.setTemplate(`<div>
            <ag-group-component data-ref="whiskersGroup">
                <ag-color-picker data-ref="whiskerColorPicker"></ag-color-picker>
                <ag-slider data-ref="whiskerThicknessSlider"></ag-slider>
                <ag-slider data-ref="whiskerOpacitySlider"></ag-slider>
                <ag-slider data-ref="whiskerLineDashSlider"></ag-slider>
                <ag-slider data-ref="whiskerLineDashOffsetSlider"></ag-slider>
            </ag-group-component>
        </div>`,[ee,xt,Ie],{whiskersGroup:s,whiskerColorPicker:this.chartMenuUtils.getDefaultColorPickerParams("whisker.stroke",void 0,{valueWhenUnset:t("stroke")}),whiskerThicknessSlider:this.chartMenuUtils.getDefaultSliderParams("whisker.strokeWidth","strokeWidth",10,{valueWhenUnset:t("strokeWidth")}),whiskerOpacitySlider:this.chartMenuUtils.getDefaultSliderParams("whisker.strokeOpacity","strokeOpacity",1,{valueWhenUnset:t("strokeOpacity")}),whiskerLineDashSlider:this.chartMenuUtils.getDefaultSliderParams("whisker.lineDash","lineDash",30,{isArray:!0,valueWhenUnset:t("lineDash")}),whiskerLineDashOffsetSlider:this.chartMenuUtils.getDefaultSliderParams("whisker.lineDashOffset","lineDashOffset",30,{valueWhenUnset:t("lineDashOffset")})})}},ce="tooltips",we="strokeWidth",Di="lineWidth",Re="lineDash",fe="lineOpacity",Me="fillOpacity",ge="labels",Gt="shadow",Yo="stageLabels",Li="markers",Rle=class extends CA{constructor(e){super(),this.options=e,this.seriesGroup=Zae,this.activePanels=[],this.widgetFuncs={lineWidth:()=>this.initStrokeWidth(Di),[we]:()=>this.initStrokeWidth("strokeWidth"),lineColor:()=>this.initLineColor(),[Re]:()=>this.initLineDash(),[fe]:()=>this.initOpacity("strokeOpacity"),[Me]:()=>this.initOpacity("fillOpacity"),markers:()=>new dle(this.chartMenuUtils),[ge]:()=>this.initLabels(),sectorLabels:()=>this.initSectorLabels(),[Gt]:()=>new Cle(this.chartMenuUtils),[ce]:()=>new Tle(this.options.chartMenuParamsFactory),bins:()=>this.initBins(),whiskers:()=>new Ple(this.chartMenuUtils),caps:()=>new ole(this.chartMenuUtils),connectorLine:()=>new lle(this.chartMenuUtils),seriesItems:()=>new mle(this.chartMenuUtils),tileSpacing:()=>new Sle(this.chartMenuUtils),shape:()=>this.initShape(),size:()=>this.initSize("size","size"),minSize:()=>this.initSize("minSize","minSize"),maxSize:()=>this.initSize("maxSize","maxSize"),dropoff:()=>this.initDropOff(),stageLabels:()=>this.initStageLabels()},this.seriesWidgetMappings={bar:[ce,we,Re,fe,Me,ge,Gt],pie:[ce,we,fe,Me,ge,"sectorLabels",Gt],donut:[ce,we,fe,Me,ge,"sectorLabels",Gt],line:[ce,Di,Re,fe,Li,ge],scatter:[ce,"shape","size",we,ge],bubble:[ce,"shape","minSize","maxSize",we,ge],area:[ce,Di,Re,fe,Me,Li,ge,Gt],histogram:[ce,"bins",we,Re,fe,Me,ge,Gt],"radial-column":[ce,we,Re,fe,Me,ge],"radial-bar":[ce,we,Re,fe,Me,ge],"radar-line":[ce,we,Re,fe,Li,ge],"radar-area":[ce,we,Re,fe,Me,Li,ge],nightingale:[ce,we,Re,fe,Me,ge],"box-plot":[ce,we,Re,fe,Me,"whiskers","caps"],"range-bar":[ce,we,Re,fe,Me,ge],"range-area":[ce,Di,Re,fe,Me,Li,ge,Gt],treemap:[ce,"tileSpacing"],sunburst:[ce],heatmap:[ce,ge,"lineColor",Di,fe],waterfall:[ce,"connectorLine","seriesItems"],funnel:[ce,we,Re,fe,Me,ge,"dropoff",Yo,Gt],"cone-funnel":[ce,we,Re,fe,Me,ge,Yo],pyramid:[ce,we,Re,fe,Me,ge,Yo,Gt]},this.seriesType=e.seriesType}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const{isExpandedOnInit:e,chartOptionsService:t,chartController:s,registerGroupComponent:r}=this.options,i={cssIdentifier:"charts-format-top-level",direction:"vertical",title:this.translate("series"),expanded:e,suppressEnabledCheckbox:!0};this.setTemplate(`<div>
            <ag-group-component data-ref="seriesGroup">
            </ag-group-component>
        </div>`,[ee],{seriesGroup:i}),r(this.seriesGroup),this.chartMenuUtils=this.createManagedBean(new Tt(t.getSeriesOptionsProxy(()=>this.seriesType))),this.addManagedListeners(s,{chartSeriesChartTypeChanged:this.refreshWidgets.bind(this)}),this.refreshWidgets()}refreshWidgets(){const{chartController:e}=this.options;this.destroyActivePanels(),e.getChartProxy().getChart().waitForUpdate().then(()=>{if(this.isAlive()){e.isComboChart()&&(this.updateSeriesType(),this.initSeriesSelect());for(const r of this.seriesWidgetMappings[this.seriesType]??[]){const i=this.widgetFuncs[r]();let n;if(Array.isArray(i)){const o=this.createBean(i[0]);n=o,i[1](o)}else n=this.createBean(i);this.seriesGroup.addItem(n),this.activePanels.push(n)}}}).catch(s=>this.beans.log.error(105,{e:s}))}initSeriesSelect(){const e=this.createBean(new od(this.chartMenuUtils.getDefaultSelectParamsWithoutValueParams("seriesType",this.getSeriesSelectOptions(),`${this.seriesType}`,t=>{this.seriesType=t,this.refreshWidgets()})));this.seriesGroup.addItem(e),this.activePanels.push(e)}initLineColor(){return new Uy(this.chartMenuUtils.getDefaultColorPickerParams("stroke","strokeColor"))}initStrokeWidth(e,t){return new Te(this.chartMenuUtils.getDefaultSliderParams(t?`${t}.${e}`:"strokeWidth",e,10))}initLineDash(e){return new Te(this.chartMenuUtils.getDefaultSliderParams(e?`${e}.lineDash`:"lineDash","lineDash",30,{isArray:!0}))}initOpacity(e,t){const s=this.chartMenuUtils.getDefaultSliderParams(t?`${t}.${e}`:e,e,1);return s.step=.05,new Te(s)}initDropOff(){return[new sle({tag:"dropOff",cssIdentifier:"charts-format-sub-level",title:this.translate("dropOff"),suppressEnabledCheckbox:!1,chartMenuParamsFactory:this.chartMenuUtils}),s=>{for(const r of[this.initStrokeWidth("strokeWidth","dropOff"),this.initLineDash("dropOff"),this.initOpacity("strokeOpacity","dropOff"),this.initOpacity("fillOpacity","dropOff")]){const i=s.createManagedBean(r);s.addItem(i),this.activePanels.push(i)}}]}initLabels(){const e=ky(this.seriesType),t=e?"calloutLabel":"label",s=e?"calloutLabels":"labels",r=this.chartMenuUtils.getDefaultFontPanelParams(t,s);return[new is(r),o=>{if(e){const a=o.createManagedBean(new ile(this.chartMenuUtils));o.addItem(a),this.activePanels.push(a)}if(this.seriesType==="range-bar"){const a=[{value:"inside",text:this.translate("inside")},{value:"outside",text:this.translate("outside")}],l=o.createManagedBean(new od(this.chartMenuUtils.getDefaultSelectParams("label.placement","labelPlacement",a)));o.addItem(l),this.activePanels.push(l);const c=o.createManagedBean(new Te(this.chartMenuUtils.getDefaultSliderParams("label.padding","padding",200)));o.addItem(c),this.activePanels.push(c)}}]}initSectorLabels(){const e=this.chartMenuUtils.getDefaultFontPanelParams("sectorLabel","sectorLabels");return[new is(e),r=>{const i=this.chartMenuUtils.getDefaultSliderParams("sectorLabel.positionRatio","positionRatio",1);i.step=.05;const n=r.createManagedBean(new Te(i));r.addItem(n)}]}initStageLabels(){const e=this.chartMenuUtils.getDefaultFontPanelParams("stageLabel",Yo,t=>{const s=this.chartMenuUtils.getChartOptions().getValue("direction")==="horizontal";return this.options.chartOptionsService.getCartesianAxisThemeOverridesProxy(s?"xAxis":"yAxis").getValue(`label.${t}`)});return new is(e)}initBins(){const e=this.chartMenuUtils.getDefaultSliderParams("binCount","histogramBinCount",20),t=this.chartMenuUtils.getChartOptions(),s=(t.getValue("bins")??t.getValue("calculatedBins",!0)).length;return e.value=`${s}`,e.maxValue=Math.max(s,20),new Te(e)}initShape(){return new od(this.chartMenuUtils.getDefaultSelectParams("shape","shape",iw(this.chartTranslation)))}initSize(e,t){return new Te(this.chartMenuUtils.getDefaultSliderParams(e,t,60))}getSeriesSelectOptions(){const e=this.getActiveSeriesTypes();return["area","bar","line"].filter(t=>e.includes(t)).map(t=>({value:t,text:this.translate(t)}))}updateSeriesType(){const e=this.getActiveSeriesTypes();!e.includes(this.seriesType)&&e.length>0&&(this.seriesType=e[0])}getActiveSeriesTypes(){return this.options.chartController.getActiveSeriesChartTypes().map(e=>se(e.chartType))}translate(e){return this.chartTranslation.translate(e)}destroyActivePanels(){for(const e of this.activePanels)Xae(e.getGui()),this.destroyBean(e)}destroy(){this.destroyActivePanels(),super.destroy()}};import{RefPlaceholder as Mle}from"ag-stack";import{Component as Ile}from"ag-grid-community";import{AgInputTextField as Ele,Component as Dle}from"ag-grid-community";var ki=class extends bA{constructor(e,t,s){super("<div></div>"),this.chartMenuUtils=e,this.name=t,this.key=s,this.chartOptions=e.getChartOptions()}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){this.initFontPanel()}hasTitle(){const e=this.chartOptions.getValue(this.key);return e?.enabled&&e.text&&e.text.length>0}initFontPanel(){const e=this.hasTitle(),t={name:this.chartTranslation.translate(this.name),enabled:e,suppressEnabledCheckbox:!1,chartMenuParamsFactory:this.chartMenuUtils,keyMapper:s=>`${this.key}.${s}`,onEnableChange:s=>this.onEnableChange(s)};this.fontPanel=this.createManagedBean(new is(t)),this.fontPanel.addItem(this.createBean(new Ele(this.getTextInputParams())),!0),this.fontPanel.addItem(this.createBean(new Te(this.getSpacingSliderParams()))),this.getGui().appendChild(this.fontPanel.getGui())}getTextInputParams(){return this.chartMenuUtils.addValueParams(`${this.key}.text`,{label:this.chartTranslation.translate("title"),labelAlignment:"top"})}getSpacingSliderParams(){return this.chartMenuUtils.getDefaultSliderParams(`${this.key}.spacing`,"spacing",100)}onEnableChange(e){this.chartOptions.setValue(`${this.key}.enabled`,e)}},Lle=class extends ki{wireBeans(e){super.wireBeans(e),this.chartMenuSvc=e.chartMenuSvc}postConstruct(){this.titlePlaceholder=this.chartTranslation.translate("titlePlaceholder"),super.postConstruct(),this.addManagedEventListeners({chartTitleEdit:()=>{this.fontPanel.setEnabled(this.hasTitle())}})}getTextInputParams(){const e=super.getTextInputParams();return this.shouldOverrideTextWithPlaceholder(e.value)&&(e.value=this.titlePlaceholder),e}getSpacingSliderParams(){const e=super.getSpacingSliderParams();return e.value="10",e}onEnableChange(e){if(this.chartMenuSvc.doesChartToolbarExist()){const s=this.chartOptions.getValue("padding.top");this.chartOptions.setValue("padding.top",e?s-20:s+20)}this.chartOptions.setValue(`${this.key}.enabled`,e);const t=this.chartOptions.getValue(`${this.key}.text`);e&&this.shouldOverrideTextWithPlaceholder(t)&&this.chartOptions.setValue(`${this.key}.text`,this.titlePlaceholder)}shouldOverrideTextWithPlaceholder(e){return e==="Title"||e?.trim().length===0}},kle=class extends SA{constructor(e){super(),this.options=e,this.titleGroup=Mle}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const{chartMenuParamsFactory:e,chartOptionsService:t,seriesType:s,isExpandedOnInit:r=!1,registerGroupComponent:i}=this.options,n=[];if(ss(s)&&s!=="pyramid"){const a=l=>this.createManagedBean(new Tt(t.getCartesianAxisThemeOverridesProxy(l)));n.push(this.createManagedBean(new ki(a("xAxis"),"horizontalAxisTitle","title")),this.createManagedBean(new ki(a("yAxis"),"verticalAxisTitle","title")))}else if(Zu(s)){const a=this.createManagedBean(new Tt(t.getPolarAxisThemeOverridesProxy("radius","thisAxis")));n.push(this.createManagedBean(new ki(a,"polarAxisTitle","title")))}const o={cssIdentifier:"charts-format-top-level",direction:"vertical",title:this.chartTranslation.translate("chartTitles"),expanded:r,suppressEnabledCheckbox:!0,items:[this.createManagedBean(new Lle(e,"chartTitle","title")),this.createManagedBean(new ki(e,"chartSubtitle","subtitle")),...n]};this.setTemplate(`<div>
            <ag-group-component data-ref="titleGroup"></ag-group-component>
        </div>`,[ee],{titleGroup:o}),i(this.titleGroup)}},_le={groups:[{type:"chart"},{type:"titles"},{type:"legend"},{type:"series"},{type:"axis"}]},nw=["axis","horizontalAxis","verticalAxis"],Gle=class extends yA{constructor(e){super('<div class="ag-chart-format-wrapper"></div>'),this.chartMenuContext=e}postConstruct(){this.groupExpansionFeature=this.createManagedBean(new Wae(this.getGui())),this.chartPanelFeature=this.createManagedBean(new Hy(this.chartMenuContext.chartController,this.getGui(),"ag-chart-format-section",(e,t)=>this.createPanels(t))),this.chartPanelFeature.refreshPanels()}createPanels(e){let t=!1;this.getFormatPanelDef().groups?.forEach(({type:s,isOpen:r=!1})=>{if(!this.isGroupPanelShownInSeries(s,e))return;r&&(t&&this.beans.log.warn(145,{group:s}),t=!0);const i=o=>this.groupExpansionFeature.addGroupComponent(o),n={...this.chartMenuContext,isExpandedOnInit:r,seriesType:e,registerGroupComponent:i};switch(s){case"chart":this.chartPanelFeature.addComponent(new Uae(n));break;case"titles":this.chartPanelFeature.addComponent(new kle(n));break;case"legend":this.chartPanelFeature.addComponent(new qae(n,this.chartMenuContext));break;case"axis":Zu(e)?this.chartPanelFeature.addComponent(new kae(n)):ss(e)&&(this.chartPanelFeature.addComponent(new jo("xAxis",n)),this.chartPanelFeature.addComponent(new jo("yAxis",n)));break;case"horizontalAxis":this.chartPanelFeature.addComponent(new jo("xAxis",n));break;case"verticalAxis":this.chartPanelFeature.addComponent(new jo("yAxis",n));break;case"series":this.chartPanelFeature.addComponent(new Rle(n));break;default:this.beans.log.warn(147,{group:s})}})}getFormatPanelDef(){return this.gos.get("chartToolPanelsDef")?.formatPanel??_le}isGroupPanelShownInSeries(e,t){const s=["chart","titles","legend","series"].includes(e)||ss(t)&&nw.includes(e)||Zu(t)&&e==="axis",r=qu(t)&&e==="legend"||qu(t)&&nw.includes(e);return s&&!r}};import{RefPlaceholder as _i,_areEqual as Ole,_clearElement as ow,_getAbsoluteWidth as Nle,_radioCssClass as aw,_setDisplayed as Ble}from"ag-stack";import{Component as Vle,_createElement as Hle,_createIconNoSpan as lw}from"ag-grid-community";import{_getDocument as Ule,_setAriaLabel as cw,_setAriaPressed as zle,_setAriaRole as ad}from"ag-stack";import{Component as Wle,KeyCode as uw,_createElement as dw}from"ag-grid-community";var Kle="gray";function hw(e){const t=e.find(s=>typeof s=="string")??Kle;return e.map(s=>{if(typeof s=="string")return s;const{colorStops:r,fill:i}=s,n=r?.[0]?.color;return typeof n=="string"?n:typeof i=="string"?i:t})}var $le="http://www.w3.org/2000/svg",Gi=58,jle=[[5,5,5,56],[3,53,54,53]],pw=Gi/2,Yle=[{r:24,opacity:.5},{r:19.2,opacity:.2},{r:14.4,opacity:.2},{r:9.6,opacity:.2}],ld=(e,t)=>Math.round(e*t+1e-8),qle=4/3*Math.tan(Math.PI/8);function Zle(e,t,s){const r=qle*s;return[`M ${e+s} ${t}`,`C ${e+s} ${t+r} ${e+r} ${t+s} ${e} ${t+s}`,`C ${e-r} ${t+s} ${e-s} ${t+r} ${e-s} ${t}`,`C ${e-s} ${t-r} ${e-r} ${t-s} ${e} ${t-s}`,`C ${e+r} ${t-s} ${e+s} ${t-r} ${e+s} ${t}`].join(" ")}function gw(e,t,s){const[r,i,n,o]=e,a=Math.trunc(t*s),l=c=>a%2===0?ld(c,s)/s:(ld(c-.5/s,s)+.5)/s;return r===n?[l(r),i,l(n),o]:i===o?[r,l(i),n,l(o)]:e}function Xle(e,t,s){const r=i=>ld(i,s)/s;return e.map(i=>{if("rect"in i){const[c,u,d,h]=i.rect,p=t/2,[g,f]=[r(c)+p,r(u)+p],[m,v]=[r(c+d)-p,r(u+h)-p];return`M ${g} ${f} H ${m} V ${v} H ${g} Z`}const[n,o,a,l]=gw(i.line,t,s);return`M ${n} ${o} L ${a} ${l}`}).join(" ")}function Jle(e,t,s,r,i){const n=e.ownerDocument,o=n.defaultView?.devicePixelRatio??1,a=(C,b={})=>{const y=n.createElementNS($le,C);for(const S of Object.keys(b))y.setAttribute(S,String(b[S]));return y},l=C=>{if(typeof C=="string")return C;const b=C.palette==="fills"?s:r;return!b.length||C.wrap===!1&&C.index>=b.length?"none":b[C.index%b.length]},c=C=>{const{fill:b,stroke:y,attrs:S}=C;let w;if("circle"in C){const[T,x,P]=C.circle;w=Zle(T,x,P)}else typeof C.d=="string"?w=C.d:w=Xle(C.d,y?Number(S?.["stroke-width"]??1):0,o);const F=a("path",{d:w,...S,fill:b?l(b):"none"});return y&&F.setAttribute("stroke",l(y)),F},u=()=>t.axes==="none"?[]:t.axes==="polar"?Yle.map(({r:C,opacity:b})=>c({circle:[pw,pw,C],stroke:"gray",attrs:{"stroke-width":1,"stroke-opacity":b}})):jle.map(C=>{const[b,y,S,w]=gw(C,1,o);return a("line",{x1:b,y1:y,x2:S,y2:w,"stroke-width":1,stroke:"gray"})}),d=a("svg",{class:"ag-chart-mini-thumbnail-svg",width:Gi,height:Gi,viewBox:`0 0 ${Gi} ${Gi}`,"aria-hidden":"true",focusable:"false"}),h=a("title");h.textContent=i,d.appendChild(h);const p=u(),[g,f]=t.seriesOverAxes?[p,[]]:[[],p];d.append(...g);const m=([C,b,y,S])=>a("svg",{x:C,y:b,width:y,height:S,viewBox:`${C} ${b} ${y} ${S}`,overflow:"hidden"}),v=t.clip?d.appendChild(m(t.clip)):d;for(const C of t.series)v.appendChild(c(C));d.append(...f),e.appendChild(d)}var Le=e=>({palette:"fills",index:e}),cd=e=>({palette:"strokes",index:e}),fw=e=>({palette:"strokes",index:e,wrap:!1}),Oe=[5,5,48,48],qo={"stroke-width":1,"stroke-opacity":.75},Ot=(e,t,s,r)=>[{rect:[e,t,s,r]}],U=(e,t,s,r,i)=>({d:Ot(e,t,s,r),fill:Le(i)}),As=(e,t,s,r)=>({d:Ot(e,t,s,r),fill:Le(0),stroke:cd(0),attrs:qo}),at=(e,t)=>({d:e,stroke:Le(t),attrs:{"stroke-width":3,"stroke-linecap":"round"}}),pr=(e,t)=>({d:e,fill:Le(t)}),ud=(e,t)=>({d:e,fill:Le(t),stroke:fw(t),attrs:{"fill-opacity":.7,...qo}}),E=(e,t,s)=>s==null?{d:e,fill:Le(t)}:{d:e,fill:Le(t),attrs:{"fill-opacity":s}},j=(e,t,s,r,i)=>i==null?{circle:[e,t,s],fill:Le(r)}:{circle:[e,t,s],fill:Le(r),attrs:{"fill-opacity":i}},mw={"stroke-width":1,"stroke-opacity":.5,"stroke-linecap":"round"},dd=(e,t)=>({d:e,stroke:Le(t),attrs:mw}),hd=(e,t)=>({d:e,fill:Le(t),stroke:fw(t),attrs:{"fill-opacity":.8,...mw}}),Qle={tooltip:"donutTooltip",axes:"none",series:[E("M 29.75 5.762 C 37.785 6.021 45.116 10.413 49.135 17.375 C 53.155 24.337 53.292 32.882 49.5 39.97 L 42.479 35.916 C 44.828 31.338 44.693 25.881 42.12 21.425 C 39.548 16.969 34.889 14.123 29.75 13.869 Z",0),E("M 48.75 41.268 C 42.281 51.681 28.839 55.283 18.03 49.5 L 22.084 42.479 C 29.012 46.034 37.507 43.758 41.729 37.215 Z",1),E("M 16.732 48.75 C 10.129 44.648 6.013 37.519 5.762 29.75 L 13.869 29.75 C 14.11 34.624 16.685 39.083 20.785 41.729 Z",2),E("M 5.762 28.25 C 5.877 24.678 6.814 21.181 8.5 18.03 L 15.521 22.084 C 14.538 23.998 13.975 26.101 13.869 28.25 Z",3),E("M 9.25 16.732 C 11.136 13.696 13.696 11.136 16.732 9.25 L 20.785 16.271 C 18.977 17.438 17.438 18.977 16.271 20.785 Z",4),E("M 18.03 8.5 C 21.181 6.814 24.678 5.877 28.25 5.762 L 28.25 13.869 C 26.101 13.975 23.998 14.538 22.084 15.521 Z",5)]},pd=(e,t,s,r)=>({d:[{rect:e},...t.map(i=>({line:i}))],fill:Le(s),stroke:cd(s),attrs:r?{...qo,"fill-opacity":.3}:qo}),vw=e=>({tooltip:"boxPlotTooltip",series:[pd([8,19,10,19],[[8,29,18,29],[13,10,13,19],[13,47,13,38],[8,10,18,10],[8,47,18,47]],0,e),pd([24,15,10,19],[[24,24,34,24],[29,5,29,15],[29,44,29,34],[24,5,34,5],[24,44,34,44]],1,e),pd([40,24,10,18],[[40,33,50,33],[45,15,45,24],[45,51,45,42],[40,15,50,15],[40,51,50,51]],2,e)]}),Cw=e=>{const t=(s,r,i,n,o)=>({d:Ot(s,r,i,n),fill:Le(o),stroke:e?"#ffffff":cd(o),attrs:{"stroke-width":.75}});return{tooltip:"treemapTooltip",clip:[5,5,53,53],axes:"none",series:[t(5,5,31.8,23.85,0),t(5,29.15,31.8,23.85,1),t(37.1,5,15.9,23.85,2),t(37.1,29,15.9,15.9,3),t(37.1,45.05,15.9,7.95,4)]}},bw=(e,t)=>({tooltip:"waterfallTooltip",series:[{d:Ot(7.667,33,7.111,15),fill:e},{d:Ot(16.556,21,7.111,12),fill:e},{d:Ot(25.444,21,7.111,12),fill:t},{d:Ot(34.333,10,7.111,23),fill:e},{d:Ot(43.222,10,7.111,11),fill:t}]}),Sw=[6.505,21.552,36.599].flatMap(e=>[6.505,21.552,36.599].map(t=>[e,t])),yw=14.897,ww=e=>({tooltip:"heatmapTooltip",axes:"none",series:Sw.map(([t,s],r)=>({d:Ot(t,s,yw,yw),fill:e[r]}))}),ece=["rgb(255, 160, 58)","rgb(249, 169, 46)","rgb(243, 178, 35)","rgb(237, 186, 23)","rgb(231, 195, 12)","rgb(225, 204, 0)","rgb(219, 213, 0)","rgb(213, 222, 0)","rgb(207, 230, 0)"],tce=(e,t)=>{try{return Ae.fromString(e,t)}catch{return new Ae(0,0,0)}},sce=(e,t)=>{const[s,r]=[0,1].map(i=>tce(e[i%e.length],t));return Sw.map((i,n)=>{const o=n*.2,a=(l,c)=>l*(1-o)+c*o;return new Ae(a(s.r,r.r),a(s.g,r.g),a(s.b,r.b),a(s.a,r.a)).toRgbaString()})},xw={groupedColumn:{tooltip:"groupedColumnTooltip",series:[U(9.364,29,10.182,24,0),U(23.909,17,10.182,36,1),U(38.455,5,10.182,48,2)]},stackedColumn:{tooltip:"stackedColumnTooltip",series:[U(9.364,29,10.182,24,0),U(23.909,17,10.182,36,0),U(38.455,5,10.182,48,0),U(9.364,35,10.182,18,1),U(23.909,26,10.182,27,1),U(38.455,17,10.182,36,1),U(9.364,47,10.182,6,2),U(23.909,44,10.182,9,2),U(38.455,41,10.182,12,2)]},normalizedColumn:{tooltip:"normalizedColumnTooltip",series:[U(9.364,5,10.182,48,0),U(23.909,5,10.182,48,0),U(38.455,5,10.182,48,0),U(9.364,24.2,10.182,28.8,1),U(23.909,19.4,10.182,33.6,1),U(38.455,14.6,10.182,38.4,1),U(9.364,43.4,10.182,9.6,2),U(23.909,33.8,10.182,19.2,2),U(38.455,24.2,10.182,28.8,2)]},groupedBar:{tooltip:"groupedBarTooltip",series:[U(5,9.364,24,10.182,0),U(5,23.909,36,10.182,1),U(5,38.455,48,10.182,2)]},stackedBar:{tooltip:"stackedBarTooltip",series:[U(5,9.364,24,10.182,0),U(5,23.909,36,10.182,0),U(5,38.455,48,10.182,0),U(5,9.364,18,10.182,1),U(5,23.909,27,10.182,1),U(5,38.455,36,10.182,1),U(5,9.364,6,10.182,2),U(5,23.909,9,10.182,2),U(5,38.455,12,10.182,2)]},normalizedBar:{tooltip:"normalizedBarTooltip",series:[U(5,9.364,48,10.182,0),U(5,23.909,48,10.182,0),U(5,38.455,48,10.182,0),U(5,9.364,28.8,10.182,1),U(5,23.909,33.6,10.182,1),U(5,38.455,38.4,10.182,1),U(5,9.364,9.6,10.182,2),U(5,23.909,19.2,10.182,2),U(5,38.455,28.8,10.182,2)]},line:{tooltip:"lineTooltip",clip:Oe,series:[at("M 5 46.143 L 29 32.429 L 53 18.714",0),at("M 5 39.286 L 29 11.857 L 53 25.571",1),at("M 5 18.714 L 29 32.429 L 53 46.143",2)]},stackedLine:{tooltip:"stackedLineTooltip",clip:Oe,series:[at("M 5 49.308 L 29 41.923 L 53 34.538",0),at("M 5 41.923 L 29 19.769 L 53 19.769",1),at("M 5 23.462 L 29 8.692 L 53 16.077",2)]},normalizedLine:{tooltip:"normalizedLineTooltip",clip:Oe,series:[at("M 5 50.423 L 29 44.302 L 53 32.06",0),at("M 5 38.181 L 29 19.819 L 53 12.474",1),at("M 5 7.577 L 29 7.577 L 53 7.577",2)]},area:{tooltip:"groupedAreaTooltip",clip:Oe,series:[ud("M 5 46.143 L 29 32.429 L 53 18.714 L 53 53 L 29 53 L 5 53 L 5 46.143",0),ud("M 5 39.286 L 29 11.857 L 53 25.571 L 53 53 L 29 53 L 5 53 L 5 39.286",1),ud("M 5 18.714 L 29 32.429 L 53 46.143 L 53 53 L 29 53 L 5 53 L 5 18.714",2)]},stackedArea:{tooltip:"stackedAreaTooltip",clip:Oe,series:[pr("M 5 49.308 L 29 41.923 L 53 34.538 L 53 53 L 29 53 L 5 53 L 5 49.308",0),pr("M 5 41.923 L 29 19.769 L 53 19.769 L 53 34.538 L 29 41.923 L 5 49.308 L 5 41.923",1),pr("M 5 23.462 L 29 8.692 L 53 16.077 L 53 19.769 L 29 19.769 L 5 41.923 L 5 23.462",2)]},normalizedArea:{tooltip:"normalizedAreaTooltip",clip:Oe,series:[pr("M 5 50.423 L 29 44.302 L 53 32.06 L 53 56.544 L 29 56.544 L 5 56.544 L 5 50.423",0),pr("M 5 38.181 L 29 19.819 L 53 12.474 L 53 32.06 L 29 44.302 L 5 50.423 L 5 38.181",1),pr("M 5 7.577 L 29 7.577 L 53 7.577 L 53 12.474 L 29 19.819 L 5 38.181 L 5 7.577",2)]},histogram:{tooltip:"histogramTooltip",series:[As(5,45.615,6.857,7.385),As(11.857,34.539,6.857,18.462),As(18.714,12.385,6.857,40.615),As(25.571,5,6.857,48),As(32.429,16.077,6.857,36.923),As(39.286,30.846,6.857,22.154),As(46.143,49.308,6.857,3.692)]},pie:{tooltip:"pieTooltip",axes:"none",series:[E("M 29.65 28.625 L 29.75 5.762 C 37.785 6.021 45.116 10.413 49.135 17.375 C 53.155 24.337 53.292 32.882 49.5 39.97 Z",0),E("M 29.194 29.724 L 48.75 41.268 C 42.281 51.681 28.839 55.283 18.03 49.5 Z",1),E("M 27.701 29.75 L 16.732 48.75 C 10.129 44.648 6.013 37.519 5.762 29.75 Z",2),E("M 26.201 28.25 L 5.762 28.25 C 5.877 24.678 6.814 21.181 8.5 18.03 Z",3),E("M 26.951 26.951 L 9.25 16.732 C 11.136 13.696 13.696 11.136 16.732 9.25 Z",4),E("M 28.25 26.201 L 18.03 8.5 C 21.181 6.814 24.678 5.877 28.25 5.762 Z",5)]},donut:Qle,sunburst:{tooltip:"sunburstTooltip",axes:"none",series:[E("M 29.65 28.625 L 29.749 17.775 C 33.494 18.025 36.867 20.125 38.743 23.375 C 40.619 26.625 40.751 30.596 39.096 33.963 Z",0),E("M 29.75 5.762 C 37.519 6.013 44.648 10.129 48.75 16.732 L 39.648 21.987 C 37.435 18.627 33.766 16.509 29.75 16.272 Z",0),E("M 49.5 18.03 C 53.167 24.884 53.167 33.116 49.5 39.97 L 40.398 34.715 C 42.201 31.118 42.201 26.882 40.398 23.285 Z",0),E("M 29 29.75 L 38.346 35.262 C 36.258 38.379 32.752 40.25 29 40.25 C 25.248 40.25 21.742 38.379 19.654 35.262 Z",1),E("M 48.75 41.268 C 44.648 47.871 37.519 51.987 29.75 52.238 L 29.75 41.728 C 33.766 41.491 37.435 39.373 39.648 36.013 Z",1),E("M 28.25 52.238 C 20.481 51.987 13.352 47.871 9.25 41.268 L 18.352 36.013 C 20.565 39.373 24.234 41.491 28.25 41.728 Z",1),E("M 28.35 28.625 L 18.904 33.963 C 17.249 30.596 17.381 26.625 19.257 23.375 C 21.133 20.125 24.506 18.025 28.251 17.775 Z",2),E("M 8.5 39.97 C 4.833 33.116 4.833 24.884 8.5 18.03 L 17.602 23.285 C 15.799 26.882 15.799 31.118 17.602 34.715 Z",2),E("M 9.25 16.732 C 13.352 10.129 20.481 6.013 28.25 5.762 L 28.25 16.272 C 24.234 16.509 20.565 18.627 18.352 21.987 Z",2)]},nightingale:{tooltip:"nightingaleTooltip",axes:"polar",seriesOverAxes:!0,series:[E("M 29 29 L 22.143 29 C 22.143 27.305 22.77 25.671 23.904 24.412 Z",0),E("M 29 29 L 23.286 19.103 C 25.732 17.69 28.614 17.234 31.376 17.821 Z",0),E("M 29 29 L 34.143 20.092 C 36.344 21.363 37.997 23.404 38.782 25.822 Z",0),E("M 29 29 L 38.143 29 C 38.143 31.259 37.306 33.439 35.794 35.118 Z",0),E("M 29 29 L 33 35.928 C 31.288 36.917 29.27 37.236 27.337 36.825 Z",0),E("M 29 29 L 24.429 36.918 C 22.472 35.788 21.003 33.974 20.305 31.825 Z",0),E("M 17.571 29 C 17.571 26.176 18.617 23.452 20.507 21.353 L 23.904 24.412 C 22.77 25.671 22.143 27.305 22.143 29 Z",1),E("M 19.857 13.164 C 23.77 10.905 28.382 10.174 32.802 11.114 L 31.376 17.821 C 28.614 17.234 25.732 17.69 23.286 19.103 Z",1),E("M 37 15.144 C 40.424 17.121 42.995 20.295 44.217 24.056 L 38.782 25.822 C 37.997 23.404 36.344 21.363 34.143 20.092 Z",1),E("M 42.714 29 C 42.714 32.389 41.459 35.658 39.192 38.177 L 35.794 35.118 C 37.306 33.439 38.143 31.259 38.143 29 Z",1),E("M 35.857 40.877 C 32.922 42.571 29.464 43.119 26.149 42.415 L 27.337 36.825 C 29.27 37.236 31.288 36.917 33 35.928 Z",1),E("M 21.571 41.867 C 18.392 40.031 16.005 37.083 14.87 33.591 L 20.305 31.825 C 21.003 33.974 22.472 35.788 24.429 36.918 Z",1),E("M 14.143 29 C 14.143 25.329 15.502 21.787 17.959 19.059 L 20.507 21.353 C 18.617 23.452 17.571 26.176 17.571 29 Z",2),E("M 17 8.215 C 22.136 5.25 28.189 4.291 33.99 5.524 L 32.802 11.114 C 28.382 10.174 23.77 10.905 19.857 13.164 Z",2),E("M 39.286 11.185 C 43.688 13.726 46.994 17.808 48.565 22.643 L 44.217 24.056 C 42.995 20.295 40.424 17.121 37 15.144 Z",2),E("M 46.143 29 C 46.143 33.236 44.574 37.323 41.74 40.471 L 39.192 38.177 C 41.459 35.658 42.714 32.389 42.714 29 Z",2),E("M 38.143 44.836 C 34.23 47.095 29.618 47.826 25.198 46.886 L 26.149 42.415 C 29.464 43.119 32.922 42.571 35.857 40.877 Z",2),E("M 17.571 48.795 C 12.68 45.971 9.007 41.435 7.262 36.063 L 14.87 33.591 C 16.005 37.083 18.392 40.031 21.571 41.867 Z",2)]},radialBar:{tooltip:"radialBarTooltip",axes:"polar",seriesOverAxes:!0,series:[E("M 29 18.4 C 34.854 18.4 39.6 23.146 39.6 29 L 36.42 29 C 36.42 24.902 33.098 21.58 29 21.58 Z",0),E("M 29 12.04 C 35.059 12.04 40.658 15.273 43.688 20.52 C 46.717 25.767 46.717 32.233 43.688 37.48 L 40.934 35.89 C 43.395 31.626 43.395 26.374 40.934 22.11 C 38.472 17.846 33.923 15.22 29 15.22 Z",0),E("M 29 5.68 C 39.555 5.68 48.794 12.769 51.525 22.964 C 54.257 33.159 49.801 43.918 40.66 49.196 L 39.07 46.442 C 46.964 41.884 50.813 32.592 48.454 23.787 C 46.094 14.983 38.115 8.86 29 8.86 Z",0),E("M 39.6 29 C 39.6 32.787 37.58 36.286 34.3 38.18 L 32.71 35.426 C 35.006 34.1 36.42 31.651 36.42 29 Z",1),E("M 43.688 37.48 C 40.658 42.727 35.059 45.96 29 45.96 L 29 42.78 C 33.923 42.78 38.472 40.154 40.934 35.89 Z",1),E("M 40.66 49.196 C 35.304 52.288 28.938 53.126 22.964 51.525 L 23.787 48.454 C 28.947 49.836 34.444 49.112 39.07 46.442 Z",1),E("M 34.3 38.18 C 30.145 40.579 24.897 39.888 21.505 36.495 L 23.753 34.247 C 26.128 36.621 29.802 37.105 32.71 35.426 Z",2),E("M 29 45.96 C 22.941 45.96 17.342 42.727 14.312 37.48 L 17.066 35.89 C 19.528 40.154 24.077 42.78 29 42.78 Z",2),E("M 22.964 51.525 C 19.01 50.466 15.405 48.384 12.51 45.49 L 14.759 43.241 C 17.259 45.741 20.373 47.539 23.787 48.454 Z",2)]},radialColumn:{tooltip:"radialColumnTooltip",axes:"polar",seriesOverAxes:!0,series:[E("M 38.581 28.393 C 38.757 31.181 37.711 33.908 35.714 35.862 L 41.01 37.895 L 43.877 30.426 Z",0),E("M 34.316 36.994 C 31.99 38.541 29.105 38.998 26.414 38.245 L 27.552 45.429 L 35.454 44.177 Z",0),E("M 24.735 37.601 C 22.232 36.36 20.394 34.09 19.701 31.383 L 12.805 36.967 L 17.84 43.185 Z",0),E("M 19.419 29.607 C 19.243 26.819 20.289 24.092 22.286 22.138 L 19.977 21.252 L 17.11 28.721 Z",0),E("M 23.684 21.006 C 26.01 19.459 28.895 19.002 31.586 19.755 L 30.698 14.152 L 22.797 15.403 Z",0),E("M 33.265 20.399 C 35.768 21.64 37.606 23.91 38.299 26.617 L 42.086 23.55 L 37.052 17.333 Z",0),E("M 43.877 30.426 L 46.864 31.573 L 43.998 39.042 L 41.01 37.895 Z",1),E("M 35.454 44.177 L 35.954 47.338 L 28.053 48.589 L 27.552 45.429 Z",1),E("M 17.84 43.185 L 15.974 44.695 L 10.94 38.478 L 12.805 36.967 Z",1),E("M 17.11 28.721 L 12.629 27 L 15.496 19.532 L 19.977 21.252 Z",1),E("M 22.797 15.403 L 22.296 12.242 L 30.198 10.991 L 30.698 14.152 Z",1),E("M 37.052 17.333 L 39.539 15.319 L 44.573 21.536 L 42.086 23.55 Z",1),E("M 46.864 31.573 L 50.599 33.006 L 47.732 40.475 L 43.998 39.042 Z",2),E("M 35.954 47.338 L 36.455 50.498 L 28.553 51.75 L 28.053 48.589 Z",2),E("M 15.974 44.695 L 14.731 45.702 L 9.696 39.485 L 10.94 38.478 Z",2),E("M 12.629 27 L 5.907 24.42 L 8.774 16.952 L 15.496 19.532 Z",2),E("M 22.296 12.242 L 30.198 10.991 L 29.249 5.001 C 26.564 4.973 23.893 5.396 21.347 6.253 Z",2),E("M 39.539 15.319 L 44.573 21.536 L 49.908 17.216 C 48.589 14.877 46.888 12.775 44.873 10.999 Z",2)]},radarLine:{tooltip:"radarLineTooltip",axes:"polar",series:[dd("M 29 9.8 L 42.135 18.525 L 47.719 33.272 L 36.289 44.136 L 20.669 46.299 L 10.281 33.272 L 15.865 18.525 L 29 9.8 Z",0),j(29,9.8,2,0),j(42.135,18.525,2,0),j(47.719,33.272,2,0),j(36.289,44.136,2,0),j(20.669,46.299,2,0),j(10.281,33.272,2,0),j(15.865,18.525,2,0),j(29,9.8,2,0),dd("M 29 14.6 L 44.011 17.029 L 40.699 31.67 L 39.413 50.623 L 22.752 41.974 L 12.621 32.738 L 21.494 23.014 L 29 14.6 Z",1),j(29,14.6,2,1),j(44.011,17.029,2,1),j(40.699,31.67,2,1),j(39.413,50.623,2,1),j(22.752,41.974,2,1),j(12.621,32.738,2,1),j(21.494,23.014,2,1),j(29,14.6,2,1),dd("M 29 29 L 34.629 24.511 L 36.019 30.602 L 34.207 39.812 L 24.835 37.649 L 19.641 31.136 L 25.247 26.007 L 29 29 Z",2),j(29,29,2,2),j(34.629,24.511,2,2),j(36.019,30.602,2,2),j(34.207,39.812,2,2),j(24.835,37.649,2,2),j(19.641,31.136,2,2),j(25.247,26.007,2,2),j(29,29,2,2)]},radarArea:{tooltip:"radarAreaTooltip",axes:"polar",series:[hd("M 29 8.48 L 47.764 14.036 L 43.916 32.405 L 37.148 45.92 L 23.117 41.217 L 20.869 30.856 L 17.038 19.461 L 29 8.48 Z",0),hd("M 29 20.66 L 35.52 23.8 L 38.827 31.243 L 37.148 45.92 L 20.852 45.92 L 8.994 33.566 L 10.236 14.036 L 29 20.66 Z",1),hd("M 29 15.44 L 40.962 19.461 L 50.702 33.953 L 38.658 49.056 L 23.117 41.217 L 19.173 31.243 L 19.759 21.63 L 29 15.44 Z",2)]},scatter:{tooltip:"scatterTooltip",clip:Oe,series:[j(17.644,11,2.5,0),j(25.289,36.2,2.5,1),j(33.889,42.2,2.5,2),j(47.267,18.2,2.5,3),j(14.778,43.4,2.5,4),j(24.333,23,2.5,5),j(37.711,30.2,2.5,6),j(43.444,47,2.5,7)]},bubble:{tooltip:"bubbleTooltip",clip:Oe,series:[j(14.3,38.6,5,0,.7),j(31.5,33.8,7,1,.7),j(18.6,14.6,7,2,.7),j(44.4,19.4,5,3,.7),j(40.1,38.6,9,4,.7)]},rangeBar:{tooltip:"rangeBarTooltip",series:[U(9.364,10,10.182,27.918,0),U(23.909,15.429,10.182,32.571,1),U(38.455,10,10.182,27.918,2)]},rangeArea:{tooltip:"rangeAreaTooltip",series:[E("M 5 14.222 L 11 10 L 35 26.889 L 53 14.222 L 53 29 L 35 41.667 L 11 24.778 L 5 29",0,.8),E("M 5 20.556 L 11 16.333 L 35 33.222 L 53 20.556 L 53 35.333 L 35 48 L 11 31.111 L 5 35.333",2,.8),E("M 5 22.667 L 17 31.111 L 41 14.222 L 53 22.667 L 53 37.444 L 41 29 L 17 45.889 L 5 37.444",1,.8)]},columnLineCombo:{tooltip:"columnLineComboTooltip",clip:Oe,series:[U(14.6,17,9.6,36,0),U(33.8,5,9.6,48,1),at("M 5 29 L 17 41 L 29 17 L 41 29 L 53 41",2)]},areaColumnCombo:{tooltip:"areaColumnComboTooltip",clip:Oe,series:[E("M 5 13 L 17 21 L 29 5 L 41 13 L 53 21 L 53 53 L 5 53",0,.8),U(14.6,29,9.6,24,1),U(33.8,17,9.6,36,2)]},customCombo:{tooltip:"customComboTooltip",clip:Oe,series:[U(14.6,17,9.6,36,0),U(33.8,5,9.6,48,1),at("M 5 29 L 17 41 L 29 17 L 41 29 L 53 41",2),{d:"M 25.76 43.46 L 31.27 48.53 M 49.86 22 L 49.86 22 C 49.02 21.318 47.896 21.096 46.86 21.41 L 46.86 21.41 C 45.555 21.773 44.388 22.518 43.51 23.55 L 25.51 43.8 L 25.43 43.89 L 23.01 51.89 L 22.83 52.46 L 31.02 48.86 L 49.02 28.52 L 49.02 28.52 C 49.941 27.522 50.543 26.272 50.75 24.93 L 50.75 24.93 C 50.954 23.866 50.621 22.771 49.86 22 Z M 41.76 25.5 L 47.34 30.5 M 40.74 26.65 L 46.25 31.71",fill:"whitesmoke",stroke:"darkslategrey",attrs:{"stroke-width":1}}]},funnel:{tooltip:"funnelTooltip",clip:Oe,axes:"none",series:[E("M 53 5 L 53 18.241 L 5 18.241 L 5 5",0),E("M 48.2 21.552 L 48.2 34.793 L 9.8 34.793 L 9.8 21.552",0),E("M 39.2 38.103 L 39.2 53 L 18.8 53 L 18.8 38.103",0)]},coneFunnel:{tooltip:"coneFunnelTooltip",clip:Oe,axes:"none",series:[E("M 53 5 L 42.2 19.897 L 15.8 19.897 L 5 5",0),E("M 42.2 19.897 L 33.2 38.103 L 24.8 38.103 L 15.8 19.897",0,.8),E("M 33.2 38.103 L 33.2 53 L 24.8 53 L 24.8 38.103",0,.6)]},pyramid:{tooltip:"pyramidTooltip",clip:Oe,axes:"none",series:[E("M 29 5 L 35.4 18.241 L 22.6 18.241",0),E("M 37 21.552 L 43.4 34.793 L 14.6 34.793 L 21 21.552",1),E("M 45 38.103 L 53 53 L 5 53 L 13 38.103",2)]},boxPlot:vw(!1),treemap:Cw(!1),waterfall:bw(Le(0),Le(1))},rce={boxPlot:vw(!0),treemap:Cw(!0),waterfall:bw("#5090dc","#ffa03a"),heatmap:ww(ece)};function ice(e,t,s,r){return t?e==="heatmap"?ww(sce(s,r)):xw[e]:rce[e]??xw[e]}var Fw={columnGroup:{column:{range:!0,pivot:!0,enterprise:!1,chartType:"groupedColumn"},stackedColumn:{range:!0,pivot:!0,enterprise:!1,chartType:"stackedColumn"},normalizedColumn:{range:!0,pivot:!0,enterprise:!1,chartType:"normalizedColumn"}},barGroup:{bar:{range:!0,pivot:!0,enterprise:!1,chartType:"groupedBar"},stackedBar:{range:!0,pivot:!0,enterprise:!1,chartType:"stackedBar"},normalizedBar:{range:!0,pivot:!0,enterprise:!1,chartType:"normalizedBar"}},pieGroup:{pie:{range:!0,pivot:!0,enterprise:!1,chartType:"pie"},donut:{range:!0,pivot:!0,enterprise:!1,chartType:"donut"},doughnut:{range:!0,pivot:!0,enterprise:!1,chartType:"donut"}},lineGroup:{line:{range:!0,pivot:!0,enterprise:!1,chartType:"line"},stackedLine:{range:!0,pivot:!0,enterprise:!1,chartType:"stackedLine"},normalizedLine:{range:!0,pivot:!0,enterprise:!1,chartType:"normalizedLine"}},scatterGroup:{scatter:{range:!0,pivot:!0,enterprise:!1,chartType:"scatter"},bubble:{range:!0,pivot:!0,enterprise:!1,chartType:"bubble"}},areaGroup:{area:{range:!0,pivot:!0,enterprise:!1,chartType:"area"},stackedArea:{range:!0,pivot:!0,enterprise:!1,chartType:"stackedArea"},normalizedArea:{range:!0,pivot:!0,enterprise:!1,chartType:"normalizedArea"}},polarGroup:{radarLine:{range:!0,pivot:!1,enterprise:!0,chartType:"radarLine"},radarArea:{range:!0,pivot:!1,enterprise:!0,chartType:"radarArea"},nightingale:{range:!0,pivot:!1,enterprise:!0,chartType:"nightingale"},radialColumn:{range:!0,pivot:!1,enterprise:!0,chartType:"radialColumn"},radialBar:{range:!0,pivot:!1,enterprise:!0,chartType:"radialBar"}},statisticalGroup:{boxPlot:{range:!0,pivot:!1,enterprise:!0,chartType:"boxPlot"},histogram:{range:!0,pivot:!1,enterprise:!1,chartType:"histogram"},rangeBar:{range:!0,pivot:!1,enterprise:!0,chartType:"rangeBar"},rangeArea:{range:!0,pivot:!1,enterprise:!0,chartType:"rangeArea"}},hierarchicalGroup:{treemap:{range:!0,pivot:!0,enterprise:!0,chartType:"treemap"},sunburst:{range:!0,pivot:!0,enterprise:!0,chartType:"sunburst"}},specializedGroup:{heatmap:{range:!0,pivot:!1,enterprise:!0,chartType:"heatmap"},waterfall:{range:!0,pivot:!1,enterprise:!0,chartType:"waterfall"}},combinationGroup:{columnLineCombo:{range:!0,pivot:!0,enterprise:!1,chartType:"columnLineCombo"},areaColumnCombo:{range:!0,pivot:!0,enterprise:!1,chartType:"areaColumnCombo"},customCombo:{range:!0,pivot:!0,enterprise:!1,chartType:"customCombo"}},funnelGroup:{funnel:{range:!0,pivot:!1,enterprise:!0,chartType:"funnel"},coneFunnel:{range:!0,pivot:!1,enterprise:!0,chartType:"coneFunnel"},pyramid:{range:!0,pivot:!1,enterprise:!0,chartType:"pyramid"}}},nce={columnGroup:["column","stackedColumn","normalizedColumn"],barGroup:["bar","stackedBar","normalizedBar"],pieGroup:["pie","donut"],lineGroup:["line","stackedLine","normalizedLine"],areaGroup:["area","stackedArea","normalizedArea"],scatterGroup:["scatter","bubble"],polarGroup:["radarLine","radarArea","nightingale","radialColumn","radialBar"],statisticalGroup:["boxPlot","histogram","rangeBar","rangeArea"],hierarchicalGroup:["treemap","sunburst"],specializedGroup:["heatmap","waterfall"],funnelGroup:["funnel","coneFunnel","pyramid"],combinationGroup:["columnLineCombo","areaColumnCombo","customCombo"]},oce=class extends wA{constructor(e,t,s,r,i=nce){super('<div class="ag-chart-settings-mini-wrapper"></div>'),this.wrappers=new Map,this.chartController=e,this.fills=t,this.strokes=s,this.isCustomTheme=r,this.chartGroups={...i}}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){!this.chartController.customComboExists()&&this.chartGroups.combinationGroup&&(this.chartGroups.combinationGroup=this.chartGroups.combinationGroup.filter(l=>l!=="customCombo"));const e=this.getGui(),t=this.chartController.isEnterprise(),s=this.chartController.isPivotChart(),r=!s,i=hw(this.fills),n=Ule(this.beans),o=hw(this.strokes),a=Object.keys(this.chartGroups).map(l=>{const c=l in Fw?Fw[l]:void 0;if(!c)return this.beans.log.warn(148,{group:l}),null;const d=(this.chartGroups[l]??[]).map(h=>{const p=h in c?c[h]:void 0;return p?!t&&p.enterprise?null:r&&p.range||s&&p.pivot?p:null:(this.beans.log.warn(149,{group:l,chartType:h}),null)}).filter(h=>h!=null);return d.length===0?null:{label:this.chartTranslation.translate(l),items:d}}).filter(l=>l!=null);for(const{label:l,items:c}of a){const u=this.createBean(new dt({title:l,suppressEnabledCheckbox:!0,enabled:!0,suppressOpenCloseIcons:!0,cssIdentifier:"charts-settings",direction:"horizontal",suppressKeyboardNavigation:!0})),d=u.getGui();ad(d,"group"),cw(d,l),ad(u.eContainer,"list");for(const h of c){const{chartType:p}=h,g=dw({tag:"div",cls:"ag-chart-mini-thumbnail",role:"button",attrs:{tabindex:"0"}}),f=()=>{this.chartController.setChartType(p),this.updateSelectedMiniChart()};this.addManagedListeners(g,{click:f,keydown:C=>{(C.key==uw.ENTER||C.key===uw.SPACE)&&(C.preventDefault(),f())}}),cw(g,this.chartTranslation.translate(Ju(p))),this.wrappers.set(p,g);const m=ice(p,this.isCustomTheme,i,n);m&&Jle(g,m,i,o,this.chartTranslation.translate(m.tooltip));const v=dw({tag:"div"});ad(v,"listitem"),v.appendChild(g),u.addItem(v)}e.appendChild(d)}this.updateSelectedMiniChart()}updateSelectedMiniChart(){const e=this.chartController.getChartType();this.wrappers.forEach((t,s)=>{const r=s===e;t.classList.toggle("ag-selected",r),zle(t,r)})}destroy(){this.wrappers.clear(),super.destroy()}},ace=class extends xA{constructor(e){super(`<div class="ag-chart-settings-wrapper">
            <div data-ref="eMiniChartsContainer" class="ag-chart-settings-mini-charts-container ag-scrollable-container"></div>
            <div data-ref="eNavBar" class="ag-chart-settings-nav-bar">
                <div data-ref="ePrevBtn" class="ag-chart-settings-prev">
                    <button type="button" class="ag-button ag-chart-settings-prev-button"></button>
                </div>
                <div data-ref="eCardSelector" class="ag-chart-settings-card-selector"></div>
                <div data-ref="eNextBtn" class="ag-chart-settings-next">
                    <button type="button" class="ag-button ag-chart-settings-next-button"></button>
                </div>
            </div>
        </div>`),this.chartController=e,this.eMiniChartsContainer=_i,this.eNavBar=_i,this.eCardSelector=_i,this.ePrevBtn=_i,this.eNextBtn=_i,this.miniChartsContainers=[],this.cardItems=[],this.activePaletteIndex=0,this.palettes=[],this.themes=[]}postConstruct(){this.resetPalettes();const e=this.gos.get("enableRtl");this.ePrevBtn.insertAdjacentElement("afterbegin",lw(e?"chartsThemeNext":"chartsThemePrevious",this.beans)),this.eNextBtn.insertAdjacentElement("afterbegin",lw(e?"chartsThemePrevious":"chartsThemeNext",this.beans)),this.addManagedElementListeners(this.ePrevBtn,{click:()=>this.setActivePalette(this.getPrev(),"left")}),this.addManagedElementListeners(this.eNextBtn,{click:()=>this.setActivePalette(this.getNext(),"right")});const t=()=>this.resetPalettes(!0);this.addManagedListeners(this.chartController,{chartTypeChanged:t,chartApiUpdate:t}),this.scrollSelectedIntoView()}scrollSelectedIntoView(){setTimeout(()=>{if(!this.isAlive())return;const e=r=>!r.getGui().classList.contains("ag-hidden"),s=this.miniChartsContainers.find(e).getGui().querySelector(".ag-selected");if(s){const r=s.offsetParent;r&&this.eMiniChartsContainer.scrollTo(0,r.offsetTop)}},250)}resetPalettes(e){const t=this.chartController.getPalettes(),s=this.gos.get("chartToolPanelsDef")?.settingsPanel?.chartGroupsDef;if(Ole(t,this.palettes)&&!e||this.isAnimating)return;this.palettes=t,this.themes=this.chartController.getThemeNames(),this.activePaletteIndex=this.themes.findIndex(i=>i===this.chartController.getChartThemeName()),this.cardItems=[],ow(this.eCardSelector),this.destroyMiniCharts();const{themes:r}=this;this.palettes.forEach((i,n)=>{const o=this.activePaletteIndex===n,{fills:a=[],strokes:l=[]}=i,c=r[n],u=!Qu(c),d=this.createBean(new oce(this.chartController,a,l,u,s));this.miniChartsContainers.push(d),this.eMiniChartsContainer.appendChild(d.getGui()),this.addCardLink(n),o?d.updateSelectedMiniChart():d.setDisplayed(!1)}),Ble(this.eNavBar,this.palettes.length>1),aw(this.cardItems[this.activePaletteIndex],"ag-selected","ag-not-selected")}addCardLink(e){const t=Hle({tag:"div",cls:"ag-chart-settings-card-item"});this.addManagedElementListeners(t,{click:()=>{this.setActivePalette(e,e<this.activePaletteIndex?"left":"right")}}),this.eCardSelector.appendChild(t),this.cardItems.push(t)}getPrev(){let e=this.activePaletteIndex-1;return e<0&&(e=this.palettes.length-1),e}getNext(){let e=this.activePaletteIndex+1;return e>=this.palettes.length&&(e=0),e}setActivePalette(e,t){if(this.isAnimating||this.activePaletteIndex===e)return;aw(this.cardItems[e],"ag-selected","ag-not-selected");const s=this.miniChartsContainers[this.activePaletteIndex],r=s.getGui(),i=this.miniChartsContainers[e],n=i.getGui();s.updateSelectedMiniChart(),i.updateSelectedMiniChart();const o=t==="left"?-1:1,a=n.style.left=`${Nle(this.getGui())*o}px`;this.activePaletteIndex=e,this.isAnimating=!0;const l="ag-animating";i.setDisplayed(!0),s.addCss(l),i.addCss(l),this.chartController.setChartThemeName(this.themes[e]),window.setTimeout(()=>{r.style.left=`${-Number.parseFloat(a)}px`,n.style.left="0px"},0),window.setTimeout(()=>{this.isAnimating=!1,s.removeCss(l),i.removeCss(l),s.setDisplayed(!1)},300)}destroyMiniCharts(){ow(this.eMiniChartsContainer),this.miniChartsContainers=this.destroyBeans(this.miniChartsContainers)}destroy(){this.destroyMiniCharts(),super.destroy()}},lce="data",cce="format",uce=class extends FA{constructor(e,t){super(),this.panels=e,this.chartMenuContext=t,this.tabs=[]}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){for(const e of this.panels){const t=e.replace("chart","").toLowerCase(),s=this.createPanel(t),r=this.createTab(e,t,s);this.tabs.push(r),this.addDestroyFunc(()=>this.destroyBean(s))}this.tabbedLayout=new wa({items:this.tabs,cssClass:"ag-chart-tabbed-menu",keepScrollPosition:!0,suppressFocusBodyOnOpen:!0,suppressTrapFocus:!0,enableCloseButton:!0,closeButtonAriaLabel:this.chartTranslation.translate("ariaChartMenuClose"),onCloseClicked:()=>{this.eventSource?.focus({preventScroll:!0}),this.dispatchLocalEvent({type:"closed"})}}),this.createBean(this.tabbedLayout)}createTab(e,t,s){const r=Jy({tag:"div",cls:`ag-chart-tab ag-chart-${t}`});this.createBean(s),r.appendChild(s.getGui());const i=this.chartTranslation.translate(t);return{title:Jy({tag:"div",children:i}),titleLabel:i,bodyPromise:Toe.resolve(r),getScrollableContainer:()=>r.querySelector(".ag-scrollable-container")??r,name:e}}showTab(e){const t=this.tabs[e];this.tabbedLayout.showItem(t)}getGui(){return this.tabbedLayout?.getGui()}showMenu(e,t){this.eventSource=e,t||this.tabbedLayout?.focusHeader(!0)}destroy(){this.parentComponent?.isAlive()&&this.destroyBean(this.parentComponent),super.destroy()}createPanel(e){switch(e){case lce:return new aae(this.chartMenuContext);case cce:return new Gle(this.chartMenuContext);default:return new ace(this.chartMenuContext.chartController)}}},dce=class extends TA{constructor(e,t,s){super('<div class="ag-chart-menu-wrapper"></div>'),this.eChartContainer=e,this.eMenuPanelContainer=t,this.chartMenuContext=s,this.buttons={chartLink:{iconName:"linked",callback:()=>this.chartMenuSvc.toggleLinked(this.chartMenuContext)},chartUnlink:{iconName:"unlinked",callback:()=>this.chartMenuSvc.toggleLinked(this.chartMenuContext)},chartDownload:{iconName:"chartsDownload",callback:()=>this.chartMenuSvc.downloadChart(this.chartMenuContext)},chartMenu:{iconName:"chartsMenu",callback:r=>this.showMenuList(r)}},this.panels=[],this.menuVisible=!1,this.chartController=s.chartController}wireBeans(e){this.chartMenuSvc=e.chartMenuSvc,this.chartMenuListFactory=e.chartMenuListFactory}postConstruct(){this.chartToolbar=this.createManagedBean(new Foe),this.getGui().appendChild(this.chartToolbar.getGui()),this.refreshToolbarAndPanels(),this.addManagedEventListeners({chartCreated:e=>{e.chartId===this.chartController.getChartId()&&this.gos.get("chartToolPanelsDef")?.defaultToolPanel&&this.showMenu({panel:this.defaultPanel,suppressFocus:!0})}}),this.addManagedListeners(this.chartController,{chartLinkedChanged:this.refreshToolbarAndPanels.bind(this)}),this.refreshMenuClasses(),this.addManagedListeners(this.chartController,{chartApiUpdate:this.refreshToolbarAndPanels.bind(this)})}isVisible(){return this.menuVisible}getExtraPaddingDirections(){return["chartMenu","chartLink","chartUnlink","chartDownload"].some(e=>this.chartToolbarOptions.includes(e))?["top"]:[]}refreshToolbarAndPanels(){this.initToolbarOptionsAndPanels(),this.updateToolbar()}initToolbarOptionsAndPanels(){const{panels:e,defaultPanel:t}=this.chartMenuSvc.getChartToolPanels(this.chartController);this.panels=e,this.defaultPanel=t,this.chartToolbarOptions=this.chartMenuSvc.getChartToolbarOptions()}updateToolbar(){const e=this.chartToolbarOptions.map(t=>{const{iconName:s,callback:r}=this.buttons[t];return{buttonName:t,iconName:s,callback:r}});this.chartToolbar.updateParams({buttons:e})}createMenuPanel(e){const t=this.menuPanel=this.createBean(new va({height:"100%",closable:!0,hideTitleBar:!0,cssIdentifier:"chart-menu"}));return t.setParentComponent(this),this.eMenuPanelContainer.appendChild(t.getGui()),this.tabbedMenu=this.createBean(new uce(this.panels,this.chartMenuContext)),this.addManagedListeners(this.tabbedMenu,{closed:()=>{this.hideMenu()}}),this.addManagedListeners(t,{destroyed:()=>this.destroyBean(this.tabbedMenu)}),new voe(s=>{window.setTimeout(()=>{t.setBodyComponent(this.tabbedMenu),this.tabbedMenu.showTab(e),s(t)},100)})}showContainer(e,t){this.menuPanel&&(this.menuVisible=!0,this.refreshMenuClasses(),this.tabbedMenu.showMenu(e,t))}showMenu(e){const{panel:t,eventSource:s,suppressFocus:r}=e??{};if(this.menuPanel&&!t)this.showContainer(s,r);else{const i=t||this.defaultPanel;let n=this.panels.indexOf(i);n<0&&(this.beans.log.warn(143,{panel:t}),n=this.panels.indexOf(this.defaultPanel)),this.menuPanel?(this.tabbedMenu.showTab(n),this.showContainer(s,r)):this.createMenuPanel(n).then(()=>this.showContainer(s,r))}}hideMenu(){this.menuVisible=!1,this.refreshMenuClasses()}refreshMenuClasses(){this.eChartContainer.classList.toggle("ag-chart-menu-visible",this.menuVisible),this.eChartContainer.classList.toggle("ag-chart-menu-hidden",!this.menuVisible)}showMenuList(e){this.chartMenuListFactory.showMenuList({eventSource:e,showMenu:()=>this.showMenu({eventSource:e}),chartMenuContext:this.chartMenuContext})}destroy(){super.destroy(),this.menuPanel?.isAlive()&&this.destroyBean(this.menuPanel),this.tabbedMenu?.isAlive()&&this.destroyBean(this.tabbedMenu)}};import{BeanStub as hce}from"ag-grid-community";var Tw=["number","category","time","grouped-category"],pce=["angle-category","angle-number","radius-category","radius-number"],gce=[...Tw,...pce],fce=class extends AA{constructor(e){super(),this.chartController=e}getChartThemeOverridesProxy(){return{getValue:e=>this.getChartOption(e),setValue:(e,t)=>this.setChartThemeOverrides([{expression:e,value:t}]),setValues:e=>this.setChartThemeOverrides(e)}}getAxisThemeOverridesProxy(){return{getValue:e=>this.getAxisProperty(e),setValue:(e,t)=>this.setAxisThemeOverrides([{expression:e,value:t}]),setValues:e=>this.setAxisThemeOverrides(e)}}getCartesianAxisOptionsProxy(e){return{getValue:t=>this.getCartesianAxisProperty(e,t),setValue:(t,s)=>this.setCartesianAxisOptions(e,[{expression:t,value:s}]),setValues:t=>this.setCartesianAxisOptions(e,t),clearValue:(t,s)=>this.clearCartesianAxisOptions(e,t,s)}}getCartesianAxisThemeOverridesProxy(e){return{getValue:t=>this.getCartesianAxisProperty(e,t),setValue:(t,s)=>this.setCartesianAxisThemeOverrides(e,[{expression:t,value:s}]),setValues:t=>this.setCartesianAxisThemeOverrides(e,t)}}getCartesianAxisAppliedThemeOverridesProxy(e){return{getValue:t=>this.getCartesianAxisThemeOverride(e,t==="*"?null:t),setValue:(t,s)=>this.setCartesianAxisThemeOverrides(e,[{expression:t==="*"?null:t,value:s}]),setValues:t=>this.setCartesianAxisThemeOverrides(e,t)}}getPolarAxisThemeOverridesProxy(e,t="allAxes"){const s=r=>t==="allAxes"?this.setAxisThemeOverrides(r):this.setPolarAxisThemeOverrides(e,r);return{getValue:r=>this.getPolarAxisProperty(e,r),setValue:(r,i)=>s([{expression:r,value:i}]),setValues:s}}getPolarCategoryAxisType(){for(const e of this.getChartAxes()){if(e.type==="angle-category")return"angle";if(e.type==="radius-category")return"radius"}}getSeriesOptionsProxy(e){return{getValue:(t,s)=>this.getSeriesOption(e(),t,s),setValue:(t,s)=>this.setSeriesOptions(e(),[{expression:t,value:s}]),setValues:t=>this.setSeriesOptions(e(),t)}}getPersistedChartThemeOverrides(e,t,s,r){const i=this.getRetainedChartThemeOverrideKeys(s,r),n=this.getRetainedChartAxisThemeOverrideKeys(null,s,r),o=this.createChartOptions();for(const a of i){const l=this.retrieveChartOptionsThemeOverride(e,s,a);l!==void 0&&this.assignChartOptionsThemeOverride(o,r,a,l)}return t&&this.assignPersistedAxisOverrides({existingAxes:t,retainedChartAxisThemeOverrideKeys:n,existingChartOptions:e,targetChartOptions:o,existingChartType:s,targetChartType:r}),o.theme.overrides}assignPersistedAxisOverrides(e){const{existingAxes:t,retainedChartAxisThemeOverrideKeys:s,existingChartOptions:r,targetChartOptions:i,existingChartType:n,targetChartType:o}=e;for(const{expression:a,targetAxisTypes:l}of s)for(const c of t.map(u=>u.type)){const u=this.retrieveChartOptionsThemeOverride(r,n,["axes",c,a].join("."));if(u!==void 0)for(const d of l)this.assignChartOptionsThemeOverride(i,o,["axes",d,a].join("."),u)}}getRetainedChartThemeOverrideKeys(e,t){const s=["animation"],r=["zoom","navigator"],i=((n,o)=>{const a=new Array;return ss(se(n))&&ss(se(o))&&a.push(...r),a})(e,t);return[...s,...i]}getRetainedChartAxisThemeOverrideKeys(e,t,s){return ss(se(t))&&ss(se(s))?this.getRetainedCartesianAxisThemeOverrideKeys(e).map(i=>({expression:i,targetAxisTypes:Tw})):[]}getRetainedCartesianAxisThemeOverrideKeys(e){const t=e==="xAxis"?["",".top",".bottom"]:e==="yAxis"?["",".left",".right"]:["",".left",".right",".top",".bottom"],s=["crosshair"],r=new Array;for(const i of s)for(const n of t)r.push(`${i}${n}`);return r}getChartOption(e){return this.readProcessed({kind:"chart"},e)}readProcessed(e,t){const s=this.getChart().chartOptions?.processedOptions;if(!s)return;let r;switch(e.kind){case"chart":r=s;break;case"axis":r=this.pickProcessedAxis(s.axes,e.direction);break;case"series":r=Array.isArray(s.series)?s.series.find(i=>Aw(e.seriesType,i)):void 0;break}return ur(r,t,void 0)}pickProcessedAxis(e,t){if(!(!e||typeof e!="object"))return e[t]}setChartThemeOverrides(e){const t=this.getChartType(),s=this.createChartOptions();for(const{expression:r,value:i}of e)this.assignChartOptionsThemeOverride(s,t,r,i);this.applyChartOptions(s)}applyChartOptions(e,t){if(Object.keys(e).length===0)return;this.updateChart(e),!t?.silent&&this.raiseChartOptionsChangedEvent()}awaitChartOptionUpdate(e){this.chartController.getChartProxy().getChart().waitForUpdate().then(()=>e()).catch(s=>this.error(108,{e:s}))}getAxisProperty(e){return this.readProcessed({kind:"axis",direction:"x"},e)}setAxisThemeOverrides(e){const t=this.getChart(),s=this.getChartType(),r=this.createChartOptions();for(const{expression:i,value:n}of e)for(const o of Object.values(t.axes??{}))this.isValidAxisType(o)&&this.assignChartAxisThemeOverride(r,s,o.type,null,i,n);this.applyChartOptions(r)}setPolarAxisThemeOverrides(e,t){const s=this.getChartType(),r=this.createChartOptions();for(const{expression:i,value:n}of t)for(const o of this.getChartAxes())!o.type.startsWith(e)||!this.isValidAxisType(o)||this.assignChartAxisThemeOverride(r,s,o.type,null,i,n);this.applyChartOptions(r)}getCartesianAxisProperty(e,t){return this.readProcessed({kind:"axis",direction:e==="xAxis"?"x":"y"},t)}getPolarAxisProperty(e,t){return this.readProcessed({kind:"axis",direction:e},t)}getCartesianAxisThemeOverride(e,t){const s=this.getChartAxes(),r=this.getCartesianAxis(s,e);if(!r||!this.isValidAxisType(r))return;const i=this.getChartType(),n=this.getChart().getOptions();return this.retrieveChartAxisThemeOverride(n,i,r.type,e==="yAxis"?["left","right"]:["bottom","top"],t)}setCartesianAxisThemeOverrides(e,t){const s=this.getChartAxes(),r=this.getCartesianAxis(s,e);if(!r||!this.isValidAxisType(r))return;const i=this.getChartType(),n=this.createChartOptions();for(const{expression:o,value:a}of t)this.assignChartAxisThemeOverride(n,i,r.type,e==="yAxis"?["left","right"]:["bottom","top"],o,a);this.applyChartOptions(n)}setCartesianAxisOptions(e,t){this.updateCartesianAxisOptions(e,s=>{const r=e==="yAxis"?"y":"x";for(const{expression:i,value:n}of t)this.assignChartOption(s,`axes.${r}.${i}`,n)})}clearCartesianAxisOptions(e,t,s){this.updateCartesianAxisOptions(e,r=>{const i=e==="yAxis"?"y":"x";this.clearChartOption(r,`axes.${i}.${t}`,s)})}updateCartesianAxisOptions(e,t){const s=this.getChart().getOptions(),r="axes"in s?s.axes:void 0;if(!s||!r)return;const i=this.getChartAxes(),n=this.getCartesianAxis(i,e);if(!n)return;const o=this.createChartOptions();o.axes=r,t(o,n,s),this.applyChartOptions(o)}setCartesianCategoryAxisType(e,t){this.updateCartesianAxisOptions(e,(s,r,i)=>{const n=this.getChartType();this.assignPersistedAxisOverrides({existingAxes:[r],retainedChartAxisThemeOverrideKeys:this.getRetainedChartAxisThemeOverrideKeys(e,n,n),existingChartOptions:i,targetChartOptions:s,existingChartType:n,targetChartType:n}),this.assignChartOption(s,"axes.x.type",t),this.chartController.setCategoryAxisType(t)})}getCartesianAxis(e,t){if(!(e.length<2))switch(t){case"xAxis":return e[0].direction==="x"?e[0]:e[1];case"yAxis":return e[1].direction==="y"?e[1]:e[0]}}getSeriesOption(e,t,s){if(s){const r=this.getChart().series.find(i=>Aw(e,i));return ur(r,t,void 0)}return this.readProcessed({kind:"series",seriesType:e},t)}setSeriesOptions(e,t){const s=this.createChartOptions();for(const{expression:r,value:i}of t)this.assignChartOptionsSeriesThemeOverride(s,e,`series.${r}`,i);this.applyChartOptions(s)}getPairedMode(){return this.chartController.getChartProxy().isPaired()}setPairedMode(e){this.chartController.getChartProxy().setPaired(e)}getChartAxes(){const e=this.getChart();return Object.values(e.axes??{})}retrieveChartAxisThemeOverride(e,t,s,r,i){if(r)for(const n of r){const o=this.retrieveChartOptionsThemeOverride(e,t,["axes",s,n,...i?[i]:[]].join("."));if(o!==void 0)return o}else return this.retrieveChartOptionsThemeOverride(e,t,["axes",s,...i?[i]:[]].join("."))}assignChartAxisThemeOverride(e,t,s,r,i,n){if(r)for(const o of r)this.assignChartOptionsThemeOverride(e,t,["axes",s,o,...i?[i]:[]].join("."),n);else this.assignChartOptionsThemeOverride(e,t,["axes",s,...i?[i]:[]].join("."),n)}isValidAxisType(e){return gce.includes(e.type)}getChartType(){return this.chartController.getChartType()}getChart(){return this.chartController.getChartProxy().getChart()}updateChart(e){const t=this.chartController.getChartProxy().getChartRef();t.skipAnimations(),t.updateDelta(e)}createChartOptions(){return{theme:{overrides:{}}}}retrieveChartOptionsThemeOverride(e,t,s){const r=this.getChartThemeOverridesSeriesTypeKeys(t);for(const i of r){const n=this.retrieveChartOptionsSeriesThemeOverride(e,i,s);if(n!==void 0)return n}}assignChartOptionsThemeOverride(e,t,s,r){const i=this.getChartThemeOverridesSeriesTypeKeys(t);for(const n of i)this.assignChartOptionsSeriesThemeOverride(e,n,s,r)}retrieveChartOptionsSeriesThemeOverride(e,t,s){return this.retrieveChartOption(e,["theme","overrides",t,...s?[s]:[]].join("."))}assignChartOptionsSeriesThemeOverride(e,t,s,r){this.assignChartOption(e,["theme","overrides",t,...s?[s]:[]].join("."),r)}getChartThemeOverridesSeriesTypeKeys(e){const t=this.chartController.getChartSeriesTypes(e);return this.chartController.isComboChart()&&t.push("common"),t}retrieveChartOption(e,t){return ur(e,t,void 0)}assignChartOption(e,t,s){Hre(e,t,s)}clearChartOption(e,t,s){const r=ur(e,t,void 0);r&&delete r[s]}raiseChartOptionsChangedEvent(){const e=this.chartController.getChartModel();this.eventSvc.dispatchEvent({type:"chartOptionsChanged",chartId:e.chartId,chartType:e.chartType,chartThemeName:this.chartController.getChartThemeName(),chartOptions:e.chartOptions})}};function Aw(e,t){return Kre(e)&&t.type===e}var mce=class extends PA{constructor(e){super(`
            <div style="height: 100%; width: 100%;">
                <div class="ag-chart" data-ref="eWrapper">
                    <div data-ref="eChartContainer" class="ag-chart-components-wrapper ag-chart-menu-hidden">
                        <div data-ref="eChart" class="ag-chart-canvas-wrapper"></div>
                        <div data-ref="eEmpty" class="ag-chart-empty-text ag-unselectable"></div>
                    </div>
                    <div data-ref="eMenuContainer" class="ag-chart-docked-container"></div>
                </div>
            </div>
            `),this.eChart=Ei,this.eWrapper=Ei,this.eChartContainer=Ei,this.eMenuContainer=Ei,this.eEmpty=Ei,this.params=e}wireBeans(e){this.crossFilterService=e.chartCrossFilterSvc,this.chartTranslation=e.chartTranslation,this.chartMenuSvc=e.chartMenuSvc,this.focusSvc=e.focusSvc,this.popupSvc=e.popupSvc,this.enterpriseChartProxyFactory=e.enterpriseChartProxyFactory}postConstruct(){const e={...this.params,chartType:Mi(this.params.chartType),chartThemeName:this.getThemeName()},t=this.createBean(new Vie(e));this.chartController=this.createManagedBean(new loe(t)),this.chartOptionsService=this.createManagedBean(new fce(this.chartController)),this.validateCustomThemes(),this.createChart(),this.params.insideDialog&&this.addDialog(),this.addMenu(),this.addManagedElementListeners(this.getGui(),{focusin:this.setActiveChartCellRange.bind(this)}),this.addManagedListeners(this.chartController,{chartModelUpdate:this.update.bind(this)}),this.addManagedPropertyListeners(["chartThemeOverrides","chartThemes"],this.reactivePropertyUpdate.bind(this)),this.update(),this.raiseChartCreatedEvent()}createChart(){let e;this.chartProxy&&(e=this.chartProxy.destroy({keepChartInstance:!0}));const t=(c,u)=>{const d=this.params.crossFilteringContext;d.lastSelectedChartId=u?"":this.chartController.getChartId(),u&&this.params.crossFilteringResetCallback(),this.crossFilterService.filter(c,u)},{gos:s,chartController:r,beans:i,params:n,eChart:o}=this,a=r.getChartType(),l={gridId:i.context.getId(),agChartsExports:i.agChartsExports,chartType:a,chartInstance:e,getChartThemeName:this.getChartThemeName.bind(this),getChartThemes:this.getChartThemes.bind(this),customChartThemes:s.get("customChartThemes"),styleNonce:s.get("styleNonce"),getGridOptionsChartThemeOverrides:()=>this.getGridOptionsChartThemeOverrides(),getExtraPaddingDirections:()=>this.chartMenu?.getExtraPaddingDirections()??[],apiChartThemeOverrides:n.chartThemeOverrides,crossFiltering:n.crossFiltering??!1,crossFilterCallback:t,parentElement:o,grouping:r.isGrouping(),chartThemeToRestore:n.chartThemeName,chartOptionsToRestore:n.chartOptionsToRestore,chartPaletteToRestore:n.chartPaletteToRestore,seriesChartTypes:r.getSeriesChartTypes(),translate:c=>this.chartTranslation.translate(c),context:Wne(s,{}),enableRtl:s.get("enableRtl")};if(n.chartOptionsToRestore=void 0,this.chartType=a,this.chartProxy=this.createChartProxy(l),!this.chartProxy){this.beans.log.warn(138,{chartType:l.chartType});return}r.setChartProxy(this.chartProxy),this.createMenuContext()}createMenuContext(){if(this.chartMenuContext)return;const e=this.createManagedBean(new Tt(this.chartOptionsService.getChartThemeOverridesProxy())),t=this.createManagedBean(new Tt(this.chartOptionsService.getAxisThemeOverridesProxy()));this.chartMenuContext={chartController:this.chartController,chartOptionsService:this.chartOptionsService,chartMenuParamsFactory:e,chartAxisMenuParamsFactory:t}}getChartThemeName(){return this.chartController.getChartThemeName()}getChartThemes(){return this.chartController.getThemeNames()}getGridOptionsChartThemeOverrides(){return this.gos.get("chartThemeOverrides")}createChartProxy(e){const{chartType:t}=e;switch(t){case"column":case"bar":case"groupedColumn":case"stackedColumn":case"normalizedColumn":case"groupedBar":case"stackedBar":case"normalizedBar":return new doe(e);case"pie":case"donut":case"doughnut":return new moe(e);case"area":case"stackedArea":case"normalizedArea":return new coe(e);case"line":case"stackedLine":case"normalizedLine":return new hoe(e);case"scatter":case"bubble":return new poe(e);case"columnLineCombo":case"areaColumnCombo":case"customCombo":return new goe(e)}const s=this.enterpriseChartProxyFactory?.createChartProxy(e);if(!s)throw this.beans.log.errorToThrow(251,{chartType:t});return s}addDialog(){const e=this.chartTranslation.translate(this.params.pivotChart?"pivotChartTitle":"rangeChartTitle"),{width:t,height:s}=this.getBestDialogSize(),r=this.params.focusDialogOnOpen?()=>setTimeout(()=>Bne(this.getGui())):void 0;this.chartDialog=new ms({resizable:!0,movable:!0,maximizable:!0,title:e,width:t,height:s,component:this,centered:!0,closable:!0,afterGuiAttached:r,postProcessPopupParams:{type:"chart"}}),this.createBean(this.chartDialog),this.chartDialog.addEventListener("destroyed",()=>{this.destroy(),this.chartMenuSvc.hideAdvancedSettings();const i=this.focusSvc.getFocusedCell();setTimeout(()=>{this.focusSvc.isAlive()&&(i?this.focusSvc.setFocusedCell({...i,forceBrowserFocus:!0}):Kne(this.beans))})})}getBestDialogSize(){const e=this.popupSvc.getPopupParent(),t=Hne(e)*.75,s=Vne(e)*.75,r=.553,i=this.chartProxy.getChart();let n=this.params.insideDialog?850:i.width,o=this.params.insideDialog?470:i.height;return(n>t||o>s)&&(n=Math.min(n,t),o=Math.round(n*r),o>s&&(o=s,n=Math.min(n,Math.round(o/r)))),{width:n,height:o}}addMenu(){this.params.crossFiltering||(this.chartMenu=this.createBean(new dce(this.eChartContainer,this.eMenuContainer,this.chartMenuContext)),this.eChartContainer.appendChild(this.chartMenu.getGui()))}update(e){if(e?.chartId&&!this.chartController.update(e))return;const t=this.chartTypeChanged(e),s=t||this.chartEmpty?(i=>{const n=this.chartType,o=i,a=this.chartProxy.getChart(),l=a?.getOptions(),c=Object.values(a?.axes??{});return this.chartOptionsService.getPersistedChartThemeOverrides(l,c,n,o??n)})(t):void 0;t&&this.createChart(),s&&e?.chartThemeOverrides&&$ne(s,e.chartThemeOverrides);const r=s??e?.chartThemeOverrides;this.updateChart(r),e?.chartId&&this.chartProxy.getChart().waitForUpdate().then(()=>{this.chartController.raiseChartApiUpdateEvent()})}updateChart(e){const{chartProxy:t}=this,s=this.chartController.getSelectedValueColState(),r=this.chartController.getChartData(),i=this.handleEmptyChart(r,s.length);if(this.chartEmpty=i,i){e&&this.chartController.updateThemeOverrides(e);return}const n=this.chartController.getChartUpdateParams(e);t.update(n),this.chartProxy.getChart().waitForUpdate().then(()=>{this.chartController.raiseChartUpdatedEvent()})}chartTypeChanged(e){const[t,s]=[this.chartController.getChartType(),e?.chartType],r=s?Mi(s):void 0;return this.chartType!==t?r??t:r&&t!==r?r:null}getChartModel(){return this.chartController.getChartModel()}getChartImageDataURL(e){return this.chartProxy.getChartImageDataURL(e)}handleEmptyChart(e,t){const s=this.chartController.isPivotChart()&&!this.chartController.isPivotMode(),r=this.chartController.getChartType();let i=1;this.chartController.isActiveXYChart()?i=r==="bubble"?3:2:Ts(se(r))&&(i=0);const n=t<i||e.length===0;if(this.eChart){const o=s||n;Wy(this.eChart,!o),Wy(this.eEmpty,o)}return s?(this.eEmpty.textContent=this.chartTranslation.translate("pivotChartRequiresPivotMode"),!0):n?(this.eEmpty.textContent=this.chartTranslation.translate("noDataToChart"),!0):!1}downloadChart(e,t,s){this.chartProxy.downloadChart(e,t,s)}openChartToolPanel(e){const t=e&&zo[e];this.chartMenu.showMenu({panel:t})}closeChartToolPanel(){this.chartMenu.hideMenu()}getChartId(){return this.chartController.getChartId()}getUnderlyingChart(){return this.chartProxy.getChartRef()}crossFilteringReset(){this.chartProxy.crossFilteringReset()}setMaximized(e){this.chartDialog?.setMaximized(e)}setActiveChartCellRange(e){this.getGui().contains(e.relatedTarget)||this.chartController.setChartRange(!0)}getThemeName(){const e=this.gos.get("chartThemes")??Xy;if(e.length===0)throw this.beans.log.errorToThrow(254);const{chartThemeName:t}=this.params;return e.includes(t)?t:e[0]}getAllKeysInObjects(e){const t={};for(const s of e.filter(r=>r!=null))for(const r of Object.keys(s))t[r]=null;return Object.keys(t)}validateCustomThemes(){const e=this.getChartThemes(),t=this.gos.get("customChartThemes");if(t)for(const s of this.getAllKeysInObjects([t]))e.includes(s)||this.beans.log.warn(139,{customThemeName:s})}reactivePropertyUpdate(){this.chartController.setChartThemeName(this.getThemeName(),!0);const e=this.getChartId(),t=this.chartController.isCrossFilterChart()?"crossFilter":this.getChartModel().modelType,s=this.gos.get("chartThemeOverrides")??{};this.update({type:`${t}ChartUpdate`,chartId:e,chartThemeOverrides:s})}raiseChartCreatedEvent(){this.chartProxy.getChart().waitForUpdate().then(()=>{this.eventSvc.dispatchEvent({type:"chartCreated",chartId:this.chartController.getChartId()})})}raiseChartDestroyedEvent(){this.eventSvc.dispatchEvent({type:"chartDestroyed",chartId:this.chartController.getChartId()})}destroy(){super.destroy(),this.chartProxy&&this.chartProxy.destroy(),this.destroyBean(this.chartMenu),this.chartDialog?.isAlive()&&this.destroyBean(this.chartDialog),this.onDestroyColorSchemeChangeListener?.();const e=this.getGui();Nne(e),Une(e),this.raiseChartDestroyedEvent()}};import{_errorToThrowWithoutAttribution as vce}from"ag-grid-community";var Oi=!1;function Cce(e){const t=e.version;return e.version??(e.version=_ce(e)),e=Se("23.0.0",e,bce),e=Se("24.0.0",e,Sce),e=Se("25.1.0",e,yce),e=Se("26.0.0",e,wce),e=Se("26.1.0",e,xce),e=Se("26.2.0",e,Fce),e=Se("28.0.0",e,Tce),e=Se("28.2.0",e,Ace),e=Se("29.0.0",e,Pce),e=Se("29.1.0",e,Pw),e=Se("29.2.0",e,Rw),e=Se("30.0.0",e,Rce),e=Se("31.0.0",e,Mce),e=Se("32.0.0",e,Ice),e=Se("33.0.0",e,Ece),e=Se("34.0.0",e,Dce),e=Se("36.0.0",e,Lce),e=kce(e),e=Se(_,e,s=>s),Oi&&t!==e.version&&console.log("AG Grid: ChartModel migration complete",{model:e}),e}function bce(e){return e=ye("chartOptions.legend.item.marker.type","shape",e),e=ye("chartOptions.seriesDefaults.marker.type","shape",e),e=ye("chartOptions.legend.padding","spacing",e),e}function Sce(e){e=re("chartOptions.seriesDefaults.marker.minSize",e);const{chartType:t,chartPalette:s,chartOptions:{xAxis:r,yAxis:i,...n},...o}=e,l=eie(t)?.map((u,d)=>({type:u,...d===0?r:i}));return{chartType:t,chartThemeName:{borneo:"ag-default",material:"ag-material",bright:"ag-vivid"}[s]??"ag-default",chartOptions:{...n,axes:l,xAxis:r,yAxis:i},...o}}function yce(e){return e=ye("chartOptions.seriesDefaults.label.minRequiredAngle","minAngle",e),e}function wce(e){return e=Nt("chartOptions.seriesDefaults.highlightStyle",e,({dimOpacity:s,...r})=>({...r,...s!=null?{series:{dimOpacity:s}}:{}})),e=re("chart",e),e=re("chartOptions.seriesDefaults.tooltipClass",e),e=re("chartOptions.seriesDefaults.tooltipTracking",e),e=Iw("chartOptions.axes[].label.rotation",0,e),e=Iw("chartOptions.axes[].label.rotation",335,e),e}function xce(e){const t=({item:s,series:r,...i})=>({item:{...i,...s},...r?{series:r}:{}});return e=Nt("chartOptions.seriesDefaults.highlightStyle",e,t),e=Nt("chartOptions.series[].highlightStyle",e,t),e}function Fce(e){e=Zo("chartOptions.seriesDefaults.fill.opacity","chartOptions.seriesDefaults.fillOpacity",e),e=Zo("chartOptions.seriesDefaults.stroke.opacity","chartOptions.seriesDefaults.strokeOpacity",e),e=Zo("chartOptions.seriesDefaults.stroke.width","chartOptions.seriesDefaults.strokeWidth",e),e=re("chartOptions.seriesDefaults.fill",e),e=re("chartOptions.seriesDefaults.stroke",e),e=re("chartOptions.seriesDefaults.callout.colors",e),e=re("chartOptions.xAxis",e),e=re("chartOptions.yAxis",e);const{chartType:t,chartOptions:{axes:s,series:r,seriesDefaults:i,...n},...o}=e,a=Mi(t),l=se(a),c=[l],u={};if(!ky(l)){const h={top:{},bottom:{},left:{},right:{}},p=s.map(({type:g,...f})=>({[g]:{...h,...f}})).reduce((g,f)=>Lw(g,f),{});for(const g of Gy.filter(f=>p[f]==null))p[g]={...h};u.axes=p}const d=c.map(h=>({[h]:{...u,series:i,...n}})).reduce((h,p)=>Lw(h,p),{});return e={...o,chartType:a,chartOptions:d},e}function Tce(e){return e=re("chartOptions.*.title.padding",e),e=re("chartOptions.*.subtitle.padding",e),e=re("chartOptions.*.axes.*.title.padding",e),e=gd("chartOptions.*.axes.*.title.enabled",!1,e),e}function Ace(e){return e=ye("chartOptions.pie.series.callout","calloutLine",e),e=ye("chartOptions.pie.series.label","calloutLabel",e),e=ye("chartOptions.pie.series.labelKey","sectorLabelKey",e),e=ye("chartOptions.pie.series.labelName","sectorLabelName",e),e=ye("chartOptions.donut.series.callout","calloutLine",e),e=ye("chartOptions.donut.series.label","calloutLabel",e),e=ye("chartOptions.donut.series.labelKey","sectorLabelKey",e),e=ye("chartOptions.donut.series.labelName","sectorLabelName",e),e}function Pce(e){return e=Ni("chartOptions.scatter.series.fill","chartOptions.scatter.series.marker.fill",e),e=Ni("chartOptions.scatter.series.fillOpacity","chartOptions.scatter.series.marker.fillOpacity",e),e=Ni("chartOptions.scatter.series.stroke","chartOptions.scatter.series.marker.stroke",e),e=Ni("chartOptions.scatter.series.strokeOpacity","chartOptions.scatter.series.marker.strokeOpacity",e),e=Ni("chartOptions.scatter.series.strokeWidth","chartOptions.scatter.series.marker.strokeWidth",e),e=Zo("chartOptions.scatter.series.paired","chartOptions.scatter.paired",e),e}function Pw(e){return e=re("chartOptions.axes[].tick.count",e),e}function Rw(e){return e=Nt("chartOptions.*.tooltip",e,({tracking:s,...r})=>{const i={...r};return s===!1?(i.position??(i.position={type:"pointer"}),i.range??(i.range="nearest")):s===!0&&(i.position??(i.position={type:"node"}),i.range??(i.range="nearest")),i}),e}function Rce(e){return e=ye("chartOptions.pie.series.labelKey","sectorLabelKey",e),e=ye("chartOptions.pie.series.labelName","sectorLabelName",e),e=Pw(e),e=Rw(e),e=re("chartOptions.*.series.flipXY",e),e=Ew("chartOptions.common.legend.enabled",!0,e),e=gd("chartOptions.common.legend.position","right",e),e}function Mce(e){const t={"ag-pastel":"ag-sheets","ag-solar":"ag-polychroma"},s=ye("chartOptions.column","bar",e),r=t[s.chartThemeName]||s.chartThemeName;return{...s,chartThemeName:r}}function Ice(e){return e=Ze("chartOptions.*.autoSize",!0,e,(t,s)=>{t[s]===!0||t[s]===!1&&(t.minHeight=600,t.minWidth=300),delete t[s]}),e}function Ece(e){return e=re("chartOptions.*.axes.category.label.format",e),e=re("chartOptions.*.axes.category.crosshair.label.format",e),e=re("chartOptions.*.axes.angle-category.label.format",e),e=re("chartOptions.*.axes.radius-category.label.format",e),e=ye("chartOptions.*.axes.*.label.padding","spacing",e),e=ye("chartOptions.*.navigator.miniChart.label.padding","spacing",e),e=re("chartOptions.*.axes.*.crossLines.label.className",e),e=Ze("chartOptions.*.axes.*.crossLines.label.position",!0,e,(t,s)=>{typeof t[s]=="string"&&(t[s]=t[s].replace(/([A-Z])/,"-$1").toLowerCase())}),e=re("chartOptions.bullet",e),e=Dw("chartOptions.bar.series.label.placement",e,{inside:"inside-center",outside:"inside-end"}),e=Dw("chartOptions.waterfall.series.item.*.label.placement",e,{inside:"inside-center",start:"outside-start",end:"outside-end"}),e=re("chartOptions.*.navigator.min",e),e=re("chartOptions.*.navigator.max",e),e=re("chartOptions.*.zoom.ratioX",e),e=re("chartOptions.*.zoom.ratioY",e),e=re("chartOptions.*.zoom.rangeX",e),e=re("chartOptions.*.zoom.rangeY",e),e}function Dce(e){return Ze("chartOptions.series[].highlightStyle",!0,e,(s,r)=>{const i=s[r];if(i==null)return;const n={};if(i.item&&(n.highlightedItem=i.item),i.series){const{dimOpacity:o,...a}=i.series;o!=null&&(n.unhighlightedSeries={opacity:o}),Object.keys(a).length>0&&(n.highlightedSeries=a)}delete s[r],s.highlight=n}),e}function Lce(e){return e=ye("chartOptions.bubble.series.size","minSize",e),e}function kce(e){return e=re("chartOptions.*.width",e),e=re("chartOptions.*.height",e),e=gd("chartOptions.*.axes.category.label.autoRotate",!0,e),e}function _ce(e){const t=e;if(e.version!=null)return e.version;const s=(c,...u)=>Object.keys(c||{}).some(d=>u.includes(d)),r=t.chartOptions,i=s(r,"seriesDefaults")?r?.seriesDefaults:r?.[Object.keys(r)[0]],n={"27.0.0":s(t,"seriesChartTypes"),"26.2.0":!s(r,"seriesDefaults"),"26.1.0":s(i?.highlightStyle,"item"),"26.0.0":s(i?.highlightStyle,"series"),"25.1.0":s(i?.label,"minAngle"),"25.0.0":s(t,"modelType","aggFunc","unlinkChart","suppressChartRanges")||s(i,"lineDash","lineDashOffset"),"24.0.0":s(t,"chartThemeName","chart")||s(r,"series"),"23.2.0":s(r,"navigator"),"23.0.0":s(r?.legend?.item?.marker,"shape"),"22.1.0":s(t,"chartPalette","chartType")},o="27.1.0",a=Object.entries(n).filter(([c,u])=>u);Oi&&console.log("AG Grid: ChartModel migration",{heuristicVersionCandidates:a});const[l=o]=a[0];return Oi&&console.log("AG Grid: ChartModel migration",{heuristicVersion:l}),l}function Se(e,t,s){if(Mw(e)>Mw(t.version)){Oi&&console.log("AG Grid: ChartModel migration",{migratingTo:e});const r=s(t);return r.version=e,Oi&&console.log("AG Grid: ChartModel migration",{migratedTo:e,result:r}),r}return t}function Gce(e){const t=e.includes("-beta")?e.replace(/-beta.*/,""):e,s=typeof t=="string"?t.split(".").map(Number):[];if(s.length!==3||s.some(r=>Number.isNaN(r)))throw vce(253,{version:t});return{major:s[0],minor:s[1],patch:s[2]}}function Mw(e){const{major:t,minor:s,patch:r}=Gce(e);return t*1e4+s*100+r}function Iw(e,t,s){return Ze(e,!0,s,(r,i)=>{r[i]===t&&delete r[i]})}function gd(e,t,s){return Ze(e,!1,s,(r,i)=>{r[i]??(r[i]=t)})}function Ew(e,t,s){typeof e=="string"&&(e=e.split("."));const r=e[0];return e.length>1&&(s[r]=Ew(e.slice(1),t,s[r]??{})),Object.keys(s).includes(r)||(s[r]=t),s}function Zo(e,t,s){let r,i=!1;return s=Ze(e,!0,s,(n,o)=>{i=!0,r=n[o],delete n[o]}),i?Ze(t,!1,s,(n,o)=>{n[o]=r}):s}function Ni(e,t,s){let r,i=!1;return s=Ze(e,!0,s,(n,o)=>{i=!0,r=n[o],delete n[o]}),i?Ze(t,!1,s,(n,o)=>{n[o]===void 0&&(n[o]=r)}):s}function ye(e,t,s){return Ze(e,!0,s,(r,i)=>{r[t]=r[i],delete r[i]})}function re(e,t){return Ze(e,!0,t,(s,r)=>delete s[r])}function Ze(e,t,s,r){const i=e instanceof Array?e:e.split("."),n=i.slice(0,i.length-1),o=i[i.length-1];return Nt(n,s,a=>{const l=Object.keys(a).includes(o);if(t&&!l)return a;const c={...a};return r(c,o),c})}function Nt(e,t,s){const r=e instanceof Array?e:e.split(".");if(t={...t},r.length===0)return s(t);if(r[0].startsWith("{")){const i=r[0].substring(1,r[0].lastIndexOf("}")).split(",");for(const n of i)t[n]!=null&&(t[n]=Nt(r.slice(1),t[n],s))}else if(r[0].endsWith("[]")){const i=r[0].substring(0,e[0].indexOf("["));t[i]instanceof Array&&(t[i]=t[i].map(n=>Nt(r.slice(1),n,s)))}else if(r[0]==="*")for(const i of Object.keys(t))t[i]=Nt(r.slice(1),t[i],s);else t[r[0]]!=null&&(t[r[0]]=Nt(r.slice(1),t[r[0]],s));return t}function Dw(e,t,s){return Ze(e,!0,t,(r,i)=>{typeof r[i]=="string"&&(r[i]=s[i]??i)})}var Lw=(e,t)=>({...e,...t}),Oce=class extends RA{constructor(){super(...arguments),this.beanName="chartSvc",this.activeCharts=new Set,this.activeChartComps=new Set,this.crossFilteringContext={lastSelectedChartId:""},this.isEnterprise=()=>this.agChartsExports.isEnterprise}wireBeans(e){this.visibleCols=e.visibleCols,this.rangeSvc=e.rangeSvc,this.agChartsExports=e.agChartsExports}updateChart(e){if(this.activeChartComps.size===0){this.warn(124);return}const t=[...this.activeChartComps].find(s=>s.getChartId()===e.chartId);if(!t){this.warn(125,{chartId:e.chartId});return}t.update(e)}getChartModels(){const e=[],t=s=>({...s,version:_});for(const s of this.activeChartComps)e.push(t(s.getChartModel()));return e}getChartRef(e){let t;for(const s of this.activeCharts)s.chartId===e&&(t=s);return t}getChartComp(e){let t;for(const s of this.activeChartComps)s.getChartId()===e&&(t=s);return t}getChartImageDataURL(e){let t;for(const s of this.activeChartComps)s.getChartId()===e.chartId&&(t=s.getChartImageDataURL(e.fileFormat));return t}downloadChart(e){Array.from(this.activeChartComps).find(s=>s.getChartId()===e.chartId)?.downloadChart(e.dimensions,e.fileName,e.fileFormat)}openChartToolPanel(e){Array.from(this.activeChartComps).find(s=>s.getChartId()===e.chartId)?.openChartToolPanel(e.panel)}closeChartToolPanel(e){Array.from(this.activeChartComps).find(s=>s.getChartId()===e)?.closeChartToolPanel()}createChartFromCurrentRange(e="groupedColumn",t){const s=this.getSelectedRange();return this.createChart({cellRange:s,chartType:e,focusDialogOnOpen:!t})}restoreChart(e,t){if(!e){this.warn(126);return}e.version!==_&&(e=Cce(e));let s,r,i,n;if(e.modelType==="pivot"?(this.gos.updateGridOptions({options:{pivotMode:!0},source:"pivotChart"}),s=this.createCellRange(void 0,!0),r=!0,i=!0):(s=this.createCellRange(e.cellRange),n=e.chartPalette,i=e.suppressChartRanges),!!s)return this.createChart({...e,cellRange:s,pivotChart:r,suppressChartRanges:i,chartContainer:t,chartOptionsToRestore:e.chartOptions,chartPaletteToRestore:n})}createRangeChart(e,t){const s=this.createCellRange(e.cellRange);if(s)return this.createChart({...e,cellRange:s,focusDialogOnOpen:!t})}createPivotChart(e,t){this.gos.updateGridOptions({options:{pivotMode:!0},source:"pivotChart"});const s=this.createCellRange(void 0,!0);if(s)return this.createChart({...e,cellRange:s,pivotChart:!0,suppressChartRanges:!0,focusDialogOnOpen:!t})}createCrossFilterChart(e,t){const s=this.createCellRange(e.cellRange);if(!s)return;const i=e.suppressChartRanges!==void 0&&e.suppressChartRanges!==null?e.suppressChartRanges:!0;return this.createChart({...e,cellRange:s,suppressChartRanges:i,crossFiltering:!0,crossFilteringSort:e.sort,focusDialogOnOpen:!t})}createChart(e){const t=ioe(e,this.agChartsExports.isEnterprise,this.beans.log);if(!t)return;e=t===!0?e:t;const{chartType:s,chartContainer:r}=e,i=this.gos.getCallback("createChartContainer"),n=!(r??i),o={...e,chartId:this.generateId(),chartType:Mi(s),insideDialog:n,crossFilteringContext:this.crossFilteringContext,crossFilteringResetCallback:()=>{for(const d of this.activeChartComps)d.crossFilteringReset()}},a=new mce(o);this.createBean(a);let l=a.getGui(),c;n||([l,c]=Gne(this.beans.environment,l),r?.appendChild(l));const u={destroyChart:()=>{this.activeCharts.has(u)&&(this.destroyBean(a),c?.(),r&&l.remove(),this.activeChartComps.delete(a),this.activeCharts.delete(u))},focusChart:()=>{_ne(a.getGui())},chartElement:l,chart:a.getUnderlyingChart(),chartId:a.getChartModel().chartId,setMaximized:a.setMaximized.bind(a)};return this.activeCharts.add(u),this.activeChartComps.add(a),!r&&i?i(u):r||a.addEventListener("destroyed",()=>{this.activeChartComps.delete(a),this.activeCharts.delete(u)}),u}getSelectedRange(){const e=this.rangeSvc?.getCellRanges();if(!e||e.length===0)return{columns:[]};const t=new Set;let s=Number.MAX_VALUE,r=-Number.MAX_VALUE;for(const{startRow:n,endRow:o,columns:a}of e){if(!(n&&o))continue;for(const h of a)t.add(h);let{rowIndex:l,rowPinned:c}=n,{rowIndex:u,rowPinned:d}=o;if(c==="top"){if(d==="top")continue;l=0}if(d==="bottom"){if(c==="bottom")continue;u=this.beans.pageBounds.getLastRow()}l!==void 0&&(s=Math.min(s,l)),u!==void 0&&(r=Math.max(r,u))}if(s===Number.MAX_VALUE||r===-Number.MAX_VALUE)return{columns:[]};const i=Array.from(t);return{columns:i,startColumn:i[0],startRow:{rowIndex:s,rowPinned:void 0},endRow:{rowIndex:r,rowPinned:void 0}}}generateId(){return`id-${Math.random().toString(36).substring(2,18)}`}createCellRange(e,t){const s=t?{rowStartIndex:null,rowStartPinned:void 0,rowEndIndex:null,rowEndPinned:void 0,columns:this.visibleCols.allCols.map(i=>i.colId)}:e,r=s&&this.rangeSvc?.createPartialCellRangeFromRangeParams(s,!0);return r||this.warn(127,{allRange:t}),r}destroy(){for(const e of this.activeCharts)e.destroyChart();super.destroy()}};function Nce(e){return e.frameworkOverrides.wrapIncoming(()=>e.chartSvc?.getChartModels())}function Bce(e,t){return e.frameworkOverrides.wrapIncoming(()=>e.chartSvc?.getChartRef(t))}function Vce(e,t){return e.frameworkOverrides.wrapIncoming(()=>e.chartSvc?.getChartImageDataURL(t))}function Hce(e,t){return e.frameworkOverrides.wrapIncoming(()=>e.chartSvc?.downloadChart(t))}function Uce(e,t){return e.frameworkOverrides.wrapIncoming(()=>e.chartSvc?.openChartToolPanel(t))}function zce(e,t){return e.frameworkOverrides.wrapIncoming(()=>e.chartSvc?.closeChartToolPanel(t.chartId))}function Wce(e,t){return e.frameworkOverrides.wrapIncoming(()=>e.chartSvc?.createRangeChart(t,!0))}function Kce(e,t){return e.frameworkOverrides.wrapIncoming(()=>e.chartSvc?.createPivotChart(t,!0))}function $ce(e,t){return e.frameworkOverrides.wrapIncoming(()=>e.chartSvc?.createCrossFilterChart(t,!0))}function jce(e,t){return e.frameworkOverrides.wrapIncoming(()=>e.chartSvc?.updateChart(t))}function Yce(e,t,s){return e.frameworkOverrides.wrapIncoming(()=>e.chartSvc?.restoreChart(t,s))}var qce='.ag-chart{background-color:var(--ag-wrapper-background-color);display:flex;height:100%;position:relative;width:100%}.ag-chart-components-wrapper{display:flex}.ag-chart-canvas-wrapper,.ag-chart-components-wrapper{flex:1 1 auto;position:relative}.ag-chart-menu{background:var(--ag-background-color);background-color:color-mix(in srgb,transparent,var(--ag-background-color) 30%);border-radius:var(--ag-border-radius);display:flex;flex-direction:row;gap:20px;padding:4px 2px;position:absolute;top:8px;width:auto;--ag-icon-size:20px}:where(.ag-ltr) .ag-chart-menu{justify-content:right;right:calc(var(--ag-cell-horizontal-padding) + var(--ag-spacing) - 4px)}:where(.ag-rtl) .ag-chart-menu{justify-content:left;left:calc(var(--ag-cell-horizontal-padding) + var(--ag-spacing) - 4px)}.ag-chart-docked-container{min-width:var(--ag-chart-menu-panel-width);position:relative}:where(.ag-chart-menu-hidden)~.ag-chart-docked-container{display:none}.ag-chart-tabbed-menu{display:flex;flex-direction:column;height:100%;overflow:hidden;width:100%}.ag-chart-tabbed-menu-header{cursor:default;flex:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.ag-chart-tabbed-menu-body{align-items:stretch;display:flex;flex:1 1 auto;overflow:hidden;position:relative}.ag-chart-tabbed-menu-body:after{background:linear-gradient(var(--ag-background-color),transparent);content:"";display:block;height:16px;left:0;position:absolute;right:0;top:0}.ag-chart-tab{overflow:hidden;overflow-y:auto;width:100%}.ag-chart-settings{overflow-x:hidden}.ag-chart-settings-wrapper{display:flex;flex-direction:column;height:100%;overflow:hidden;position:relative;width:100%}.ag-chart-settings-nav-bar{align-items:center;border-top:solid var(--ag-border-width) var(--ag-border-color);display:flex;height:30px;padding:0 10px;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%}.ag-chart-settings-card-selector{align-items:center;display:flex;flex:1 1 auto;height:100%;justify-content:space-around;padding:0 10px}.ag-chart-settings-card-item{background-color:var(--ag-foreground-color);border-radius:4px;cursor:pointer;height:8px;position:relative;width:8px;&.ag-selected{background-color:var(--ag-accent-color)}@media not (forced-colors:active){&.ag-not-selected{opacity:.2}&.ag-not-selected:hover{opacity:.35}}@media (forced-colors:active){background-color:Canvas;border-bottom-color:CanvasText;border-bottom-style:solid;border-bottom-width:1px;border-left-color:CanvasText;border-left-style:solid;border-left-width:1px;border-right-color:CanvasText;border-right-style:solid;border-right-width:1px;border-top-color:CanvasText;border-top-style:solid;border-top-width:1px;&.ag-selected{background-color:CanvasText}}}.ag-chart-settings-card-item:before{background-color:transparent;content:" ";display:block;height:20px;left:50%;margin-left:-10px;margin-top:-10px;position:absolute;top:50%;width:20px}.ag-chart-settings-next,.ag-chart-settings-prev{flex:none;position:relative}.ag-chart-settings-next:focus-within,.ag-chart-settings-prev:focus-within{border-radius:1px;box-shadow:var(--ag-focus-shadow)}.ag-chart-settings-next-button,.ag-chart-settings-prev-button{cursor:pointer;height:100%;left:0;opacity:0;position:absolute;top:0;width:100%}.ag-chart-settings-mini-charts-container{flex:1 1 auto;overflow:hidden auto;position:relative}.ag-chart-settings-mini-wrapper{display:flex;flex-direction:column;left:0;min-height:100%;overflow:hidden;padding-bottom:var(--ag-widget-container-vertical-padding);position:absolute;top:0;width:100%;&.ag-animating{transition:left .3s;transition-timing-function:ease-in-out}}.ag-chart-mini-thumbnail{border:solid var(--ag-border-width) var(--ag-border-color);border-radius:5px;cursor:pointer;padding:1px;&.ag-selected{border-color:var(--ag-accent-color);border-width:calc(var(--ag-border-width) + 1px);padding:unset}&:focus-visible{border-color:var(--ag-accent-color);box-shadow:var(--ag-focus-shadow)}}.ag-chart-mini-thumbnail-svg{display:block}.ag-chart-advanced-settings-wrapper,.ag-chart-data-wrapper,.ag-chart-format-wrapper{display:flex;flex-direction:column;padding-bottom:16px;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.ag-chart-advanced-settings-wrapper,.ag-chart-data-wrapper{height:100%;overflow-y:auto}.ag-chart-advanced-settings{background-color:var(--ag-chrome-background-color)}.ag-chart-advanced-settings,.ag-chart-advanced-settings-wrapper{width:100%}.ag-chart-advanced-settings-wrapper{padding-bottom:0}.ag-chart-advanced-settings-section{border-bottom:solid var(--ag-border-width) var(--ag-border-color);display:flex;margin:0;padding-bottom:var(--ag-widget-container-vertical-padding);padding-top:var(--ag-widget-container-vertical-padding)}.ag-chart-empty-text{align-items:center;background-color:var(--ag-background-color);display:flex;height:100%;justify-content:center;top:0;width:100%}.ag-charts-font-size-color{align-self:stretch;display:flex;justify-content:space-between}.ag-chart-menu-icon{border-radius:var(--ag-border-radius);cursor:pointer;margin:2px 0;opacity:.8}.ag-chart-menu-icon:hover{opacity:1}.ag-chart-menu-toolbar-button{background-color:unset;border:0;border-radius:1px;padding:0 2px}.ag-chart-data-column-drag-handle{margin-left:var(--ag-spacing)}.ag-chart-data-section,.ag-chart-format-section{display:flex;margin:0;:where(.ag-label:not(.ag-group-title-bar)){color:var(--ag-chart-menu-label-color)}:where(.ag-label-align-top .ag-label){margin-bottom:var(--ag-widget-vertical-spacing);margin-top:calc(var(--ag-widget-vertical-spacing)*.5)}:where(.ag-slider.ag-label-align-top .ag-label){margin-bottom:0}.ag-label{display:inline-block}}.ag-chart-menu-panel{--ag-panel-background-color:var(--ag-chrome-background-color)}:where(.ag-ltr) .ag-chart-menu-panel{border-left:solid var(--ag-border-width) var(--ag-border-color)}:where(.ag-rtl) .ag-chart-menu-panel{border-right:solid var(--ag-border-width) var(--ag-border-color)}.ag-chart-data-wrapper,.ag-chart-format-wrapper{margin:0;padding:0}.ag-group{.ag-charts-data-group-item{padding-bottom:var(--ag-widget-container-vertical-padding);position:relative}.ag-charts-data-group-item:where(:not(:last-child)){margin-bottom:var(--ag-spacing)}.ag-charts-advanced-settings-top-level-group-title-bar{background-color:unset;position:relative}.ag-charts-data-group-item:where(:not(.ag-charts-format-sub-level-group,.ag-pill-select,.ag-select)){height:var(--ag-list-item-height)}.ag-charts-data-group-item:where(.ag-picker-field){margin-top:var(--ag-spacing)}.ag-charts-advanced-settings-top-level-group-item,.ag-charts-format-top-level-group-item{margin:var(--ag-spacing) 0}.ag-charts-format-sub-level-group-container{display:flex;flex-direction:column;padding:var(--ag-widget-vertical-spacing) 0}.ag-charts-settings-group-container{border-top:none;display:grid;font-weight:500;grid-template-columns:60px 1fr 60px 1fr 60px;row-gap:8px;:where(.ag-charts-settings-group-item:nth-child(3n+1)){grid-column:1}:where(.ag-charts-settings-group-item:nth-child(3n+2)){grid-column:3}:where(.ag-charts-settings-group-item:nth-child(3n+3)){grid-column:5}}.ag-charts-data-group-title-bar,.ag-charts-format-top-level-group-title-bar,.ag-charts-settings-group-title-bar{border-top:none;font-weight:500;margin:0;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding);position:relative}.ag-charts-format-sub-level-group-title-bar{background:none;font-weight:500;padding:var(--ag-widget-vertical-spacing) 0}&.ag-charts-data-group,&.ag-charts-format-top-level-group{border-top:solid var(--ag-border-width) var(--ag-border-color)}.ag-charts-data-group-container,.ag-charts-format-top-level-group-container,.ag-charts-settings-group-container{margin:0;padding:0 var(--ag-widget-container-horizontal-padding)}.ag-charts-format-sub-level-group-item,.ag-charts-format-sub-level-no-header-group-item,.ag-charts-format-top-level-group-item{margin-bottom:var(--ag-widget-vertical-spacing)}&.ag-charts-format-sub-level-group,&.ag-charts-format-top-level-group,.ag-charts-format-sub-level-group-item:last-child,.ag-charts-format-top-level-group-item{margin:0;padding:0}.ag-charts-advanced-settings-top-level-group-container{margin:0}.ag-charts-advanced-settings-top-level-group-container,.ag-charts-advanced-settings-top-level-group-title-bar{padding:0 var(--ag-widget-container-horizontal-padding)}.ag-charts-advanced-settings-top-level-group-item{margin-bottom:0;margin-top:calc(var(--ag-widget-vertical-spacing)*2)}}:where(.ag-dragging-fill-handle) .ag-dialog,:where(.ag-dragging-range-handle) .ag-dialog{.ag-charts-canvas-center,.ag-charts-canvas-overlay>*,.ag-charts-proxy-elem,.ag-charts-proxy-legend-toolbar,.ag-charts-series-area,.ag-charts-toolbar{pointer-events:none}}.ag-angle-select{align-items:center;display:flex}.ag-angle-select-wrapper{display:flex}.ag-angle-select-parent-circle{background-color:var(--ag-background-color);border:solid var(--ag-border-width) var(--ag-border-color);border-radius:12px;display:block;height:24px;position:relative;width:24px}.ag-angle-select-child-circle{background-color:var(--ag-foreground-color);border-radius:3px;height:6px;left:12px;margin-left:-3px;margin-top:-4px;position:absolute;top:4px;width:6px;@media (forced-colors:active){background-color:CanvasText}}:where(.ag-ltr) .ag-angle-select-field{margin-right:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-angle-select-field{margin-left:calc(var(--ag-spacing)*2)}.ag-range-field{align-items:center;display:flex;:where(.ag-input-wrapper){height:100%}}.ag-range-field-input{height:100%;overflow:visible;padding:0;width:100%;&:disabled{opacity:.5}@media not (forced-colors:active){-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none}}.ag-range-field-input{@media not (forced-colors:active){&::-webkit-slider-runnable-track{background-color:var(--ag-border-color);border-radius:1.5px;height:3px;margin:0;padding:0;width:100%}&::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;background-color:var(--ag-background-color);border:solid var(--ag-border-width) var(--ag-border-color);border-radius:100%;height:var(--ag-icon-size);margin:0;padding:0;transform:translateY(calc(var(--ag-icon-size)*-.5 + 1.5px));width:var(--ag-icon-size)}&:focus::-webkit-slider-thumb{border-color:var(--ag-accent-color);box-shadow:var(--ag-focus-shadow)}&:active::-webkit-slider-runnable-track{background-color:var(--ag-accent-color)}}}.ag-range-field-input{@media not (forced-colors:active){&::-moz-range-track{background-color:var(--ag-border-color);border-radius:1.5px;height:3px;margin:0;padding:0;width:100%}&::-moz-range-thumb{-moz-appearance:none;appearance:none;background-color:var(--ag-background-color);border:solid var(--ag-border-width) var(--ag-border-color);border-radius:100%;height:var(--ag-icon-size);margin:0;padding:0;width:var(--ag-icon-size)}&:focus::-moz-range-thumb{border-color:var(--ag-accent-color);box-shadow:var(--ag-focus-shadow)}&:active::-moz-range-track{background-color:var(--ag-accent-color)}}}',kw=28,_w=6;function fd(e){return/(?<!\d)\d+\.\d+\.\d+/.exec(e)}function Zce({gridMajorVersion:e,chartsMajorVersion:t}){const s=Number.parseInt(e,10),r=Number.parseInt(t,10),i=s-kw,n=r-_w,o=i>=0;return i===n&&o}function Xce(e){if(!e||!fd(e))return;const[t,s]=e.split(".")||[],r=`${t}.${s}.x`,n=Number.parseInt(t,10)-kw+_w;if(n<0)return;const a=`${n}.${s}.x`;return{gridMajorMinor:r,chartsMajorMinor:a}}function Xo({type:e,gridVersion:t,chartsVersion:s}){const r="AG Grid: AG Grid version is incompatible. Please see https://www.ag-grid.com/javascript-data-grid/modules/ for more information.";if(!t)return r;const i=Xce(t);if(!i)return r;const{gridMajorMinor:n,chartsMajorMinor:o}=i;return e==="incompatible"?`AG Grid version ${t} and AG Charts version ${s} is not supported. AG Grid version ${n} should be used with AG Chart ${o}. Please see https://www.ag-grid.com/javascript-data-grid/modules/ for more information.`:e==="invalidCharts"?`AG Grid version ${n} should be used with AG Chart ${o} not ${s}. Please see https://www.ag-grid.com/javascript-data-grid/modules/ for more information.`:r}function Jce({gridVersion:e,chartsVersion:t}){if(!fd(t))return{isValid:!1,message:Xo({type:"invalidCharts",gridVersion:e,chartsVersion:t})};if(!fd(e))return{isValid:!1,message:Xo({type:"invalidGrid",gridVersion:e,chartsVersion:t})};const[s,r]=e.split(".")||[],[i,n,o]=t.split(".")||[],a=Zce({gridMajorVersion:s,chartsMajorVersion:i});return a&&r===n||o.includes("beta")?{isValid:!0}:!a||r!==n?{isValid:!1,message:Xo({type:"incompatible",gridVersion:e,chartsVersion:t})}:{isValid:!1,message:Xo({type:"invalid",gridVersion:e,chartsVersion:t})}}var Qce={linked:"linked",unlinked:"unlinked",chartsMenu:"menu-alt",chartsDownload:"save",chartsMenuEdit:"chart",chartsMenuAdvancedSettings:"settings",chartsMenuAdd:"plus",chartsColorPicker:"small-down",chartsThemePrevious:"previous",chartsThemeNext:"next"},eue={getChartModels:Nce,getChartRef:Bce,getChartImageDataURL:Vce,downloadChart:Hce,openChartToolPanel:Uce,closeChartToolPanel:zce,createRangeChart:Wce,createPivotChart:Kce,createCrossFilterChart:$ce,updateChart:jce,restoreChart:Yce},md=[po,$,kre,Lre,Ur],Gw="IntegratedCharts",tue={moduleName:"GridCharts",version:_,dependsOn:md,validate:()=>({isValid:!1,errorId:334})},Ow={moduleName:Gw,version:_,dependsOn:md,validate:()=>({isValid:!1,errorId:257}),with:e=>{if(e.setup(),e.setGridContext?.(!0),e.isEnterprise&&e.setLicenseKey){const s={setLicenseKey:e.setLicenseKey};mr.setChartsLicenseManager(s)}const t={moduleName:Gw,version:_,icons:Qce,apiFunctions:eue,dependsOn:md,css:[qce],validate:()=>Jce({gridVersion:_,chartsVersion:e.VERSION}),beans:[Ore.bind(null,e),Oce,kne,Tne,wne,Ene,zie,hne]};return _re(t,e.isEnterprise?"ag-charts-enterprise":"ag-charts-community",e.VERSION),t}};import{AllCommunityModule as sue}from"ag-grid-community";var Nw=[sue,MC,Yg,kf,rv,zC,WC,YC,Ml,Il,po,lf,zc,kc,CC,bC,_b,Gb,ku,US,KS,vf,uv,Bp,Hr,wf,Df,wC,bb,ny,wb,uy,dy,Py,Iy,Yp],Bw="AllEnterprise",rue={with:e=>({moduleName:Bw,version:_,dependsOn:[...Nw,Ow.with(e),qS.with(e)]}),moduleName:Bw,version:_,dependsOn:Nw};export*from"ag-grid-community";export{Bp as AdvancedFilterModule,xc as AggregationModule,Yp as AiToolkitModule,rue as AllEnterpriseModule,dy as BatchEditModule,Py as CalculatedColumnsModule,po as CellSelectionModule,MC as ClipboardModule,KS as ColumnHeaderEditModule,Ml as ColumnMenuModule,Yg as ColumnsToolPanelModule,Il as ContextMenuModule,kf as ExcelExportModule,zC as FiltersToolPanelModule,uy as FindModule,ku as FormulaModule,tue as GridChartsModule,bC as GroupFilterModule,Ow as IntegratedChartsModule,Qo as LicenseManager,YC as MasterDetailModule,z3 as MenuModule,uv as MultiFilterModule,WC as NewFiltersToolPanelModule,US as NotesModule,rv as PdfExportModule,bb as PivotModule,kq as RangeSelectionModule,lf as RichSelectModule,Iy as RowGroupingEditModule,kc as RowGroupingModule,CC as RowGroupingPanelModule,zc as RowNumbersModule,Gb as ServerSideRowModelApiModule,_b as ServerSideRowModelModule,vf as SetFilterModule,ny as ShowValuesAsModule,Hr as SideBarModule,qS as SparklinesModule,wf as StatusBarModule,Df as ToolbarModule,wb as TreeDataModule,wC as ViewportRowModelModule,Ae as _AgColor,ba as _AgColorPicker,hD as _AgColorPickerSelector,wh as _AgContextMenuService,Ca as _AgDialog,dt as _AgGroupComponent,ee as _AgGroupComponentSelector,Qd as _AgInputRange,eh as _AgInputRangeSelector,Fr as _AgMenuItemComponent,xh as _AgMenuItemRenderer,Qi as _AgMenuList,va as _AgPanel,Te as _AgSlider,Ie as _AgSliderSelector,wa as _AgTabbedLayout,qd as _AgVirtualList,Xd as _AgVirtualListDragFeature,Ry as distributeGroupValue,hE as exportMultipleSheetsAsExcel,da as getMultipleSheetsAsExcel};