UNPKG

@ag-grid-enterprise/core

Version:

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

34 lines 99.1 kB
import{ModuleNames as Ae,_defineModule as Ge}from"@ag-grid-community/core";import{BeanStub as Re,_getDocument as Pe}from"@ag-grid-community/core";import{_missingOrEmpty as B}from"@ag-grid-community/core";var Me=class{constructor(){this.ieCompatibility=!1}init(){this.ieCompatibility=this.md5("hello")!="5d41402abc4b2a76b9719d911017c592"}md5cycle(e,t){let s=e[0],i=e[1],n=e[2],a=e[3];s=this.ff(s,i,n,a,t[0],7,-680876936),a=this.ff(a,s,i,n,t[1],12,-389564586),n=this.ff(n,a,s,i,t[2],17,606105819),i=this.ff(i,n,a,s,t[3],22,-1044525330),s=this.ff(s,i,n,a,t[4],7,-176418897),a=this.ff(a,s,i,n,t[5],12,1200080426),n=this.ff(n,a,s,i,t[6],17,-1473231341),i=this.ff(i,n,a,s,t[7],22,-45705983),s=this.ff(s,i,n,a,t[8],7,1770035416),a=this.ff(a,s,i,n,t[9],12,-1958414417),n=this.ff(n,a,s,i,t[10],17,-42063),i=this.ff(i,n,a,s,t[11],22,-1990404162),s=this.ff(s,i,n,a,t[12],7,1804603682),a=this.ff(a,s,i,n,t[13],12,-40341101),n=this.ff(n,a,s,i,t[14],17,-1502002290),i=this.ff(i,n,a,s,t[15],22,1236535329),s=this.gg(s,i,n,a,t[1],5,-165796510),a=this.gg(a,s,i,n,t[6],9,-1069501632),n=this.gg(n,a,s,i,t[11],14,643717713),i=this.gg(i,n,a,s,t[0],20,-373897302),s=this.gg(s,i,n,a,t[5],5,-701558691),a=this.gg(a,s,i,n,t[10],9,38016083),n=this.gg(n,a,s,i,t[15],14,-660478335),i=this.gg(i,n,a,s,t[4],20,-405537848),s=this.gg(s,i,n,a,t[9],5,568446438),a=this.gg(a,s,i,n,t[14],9,-1019803690),n=this.gg(n,a,s,i,t[3],14,-187363961),i=this.gg(i,n,a,s,t[8],20,1163531501),s=this.gg(s,i,n,a,t[13],5,-1444681467),a=this.gg(a,s,i,n,t[2],9,-51403784),n=this.gg(n,a,s,i,t[7],14,1735328473),i=this.gg(i,n,a,s,t[12],20,-1926607734),s=this.hh(s,i,n,a,t[5],4,-378558),a=this.hh(a,s,i,n,t[8],11,-2022574463),n=this.hh(n,a,s,i,t[11],16,1839030562),i=this.hh(i,n,a,s,t[14],23,-35309556),s=this.hh(s,i,n,a,t[1],4,-1530992060),a=this.hh(a,s,i,n,t[4],11,1272893353),n=this.hh(n,a,s,i,t[7],16,-155497632),i=this.hh(i,n,a,s,t[10],23,-1094730640),s=this.hh(s,i,n,a,t[13],4,681279174),a=this.hh(a,s,i,n,t[0],11,-358537222),n=this.hh(n,a,s,i,t[3],16,-722521979),i=this.hh(i,n,a,s,t[6],23,76029189),s=this.hh(s,i,n,a,t[9],4,-640364487),a=this.hh(a,s,i,n,t[12],11,-421815835),n=this.hh(n,a,s,i,t[15],16,530742520),i=this.hh(i,n,a,s,t[2],23,-995338651),s=this.ii(s,i,n,a,t[0],6,-198630844),a=this.ii(a,s,i,n,t[7],10,1126891415),n=this.ii(n,a,s,i,t[14],15,-1416354905),i=this.ii(i,n,a,s,t[5],21,-57434055),s=this.ii(s,i,n,a,t[12],6,1700485571),a=this.ii(a,s,i,n,t[3],10,-1894986606),n=this.ii(n,a,s,i,t[10],15,-1051523),i=this.ii(i,n,a,s,t[1],21,-2054922799),s=this.ii(s,i,n,a,t[8],6,1873313359),a=this.ii(a,s,i,n,t[15],10,-30611744),n=this.ii(n,a,s,i,t[6],15,-1560198380),i=this.ii(i,n,a,s,t[13],21,1309151649),s=this.ii(s,i,n,a,t[4],6,-145523070),a=this.ii(a,s,i,n,t[11],10,-1120210379),n=this.ii(n,a,s,i,t[2],15,718787259),i=this.ii(i,n,a,s,t[9],21,-343485551),e[0]=this.add32(s,e[0]),e[1]=this.add32(i,e[1]),e[2]=this.add32(n,e[2]),e[3]=this.add32(a,e[3])}cmn(e,t,s,i,n,a){return t=this.add32(this.add32(t,e),this.add32(i,a)),this.add32(t<<n|t>>>32-n,s)}ff(e,t,s,i,n,a,o){return this.cmn(t&s|~t&i,e,t,n,a,o)}gg(e,t,s,i,n,a,o){return this.cmn(t&i|s&~i,e,t,n,a,o)}hh(e,t,s,i,n,a,o){return this.cmn(t^s^i,e,t,n,a,o)}ii(e,t,s,i,n,a,o){return this.cmn(s^(t|~i),e,t,n,a,o)}md51(e){const t=e.length,s=[1732584193,-271733879,-1732584194,271733878];let i;for(i=64;i<=e.length;i+=64)this.md5cycle(s,this.md5blk(e.substring(i-64,i)));e=e.substring(i-64);const n=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(i=0;i<e.length;i++)n[i>>2]|=e.charCodeAt(i)<<(i%4<<3);if(n[i>>2]|=128<<(i%4<<3),i>55)for(this.md5cycle(s,n),i=0;i<16;i++)n[i]=0;return n[14]=t*8,this.md5cycle(s,n),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="",i=0;for(;i<4;i++)s+=t[e>>i*8+4&15]+t[e>>i*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}},L={"01":"GRID","02":"CHARTS","0102":"BOTH"},K="https://ag-grid.com/licensing/",$=class g{constructor(t){this.watermarkMessage=void 0,this.totalMessageLength=124,this.document=t,this.md5=new Me,this.md5.init()}validateLicense(){const t=this.getLicenseDetails(g.licenseKey),s=`AG Grid ${t.currentLicenseType==="BOTH"?"and AG Charts ":""}Enterprise`,i=t.suppliedLicenseType===void 0?"":`AG ${t.suppliedLicenseType==="BOTH"?"Grid and AG Charts":t.suppliedLicenseType==="GRID"?"Grid":"Charts"} Enterprise`;if(t.missing)(!this.isWebsiteUrl()||this.isForceWatermark())&&this.outputMissingLicenseKey(s);else if(t.expired){const n=g.getGridReleaseDate(),a=g.formatDate(n);this.outputExpiredKey(t.expiry,a,s,i)}else t.valid?t.isTrial&&t.trialExpired&&this.outputExpiredTrialKey(t.expiry,s,i):this.outputInvalidLicenseKey(!!t.incorrectLicenseType,s,i)}static extractExpiry(t){const s=t.substring(t.lastIndexOf("_")+1,t.length);return new Date(parseInt(g.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 i=s.length-32,n=s.substring(i),a=s.substring(0,i),[o,r,h]=g.extractBracketedInformation(s);return{md5:n,license:a,version:o,isTrial:r,type:h}}getLicenseDetails(t){const s=g.chartsLicenseManager?"BOTH":"GRID";if(B(t))return{licenseKey:t,valid:!1,missing:!0,currentLicenseType:s};const i=g.getGridReleaseDate(),{md5:n,license:a,version:o,isTrial:r,type:h}=g.extractLicenseComponents(t);let l=n===this.md5.md5(a)&&t.indexOf("For_Trialing_ag-Grid_Only")===-1,c,d,u=null,f=!1,C;function b(){c=u<new Date,d=void 0}if(l&&(u=g.extractExpiry(a),l=!isNaN(u.getTime()),l))switch(d=i>u,o){case"legacy":case"2":{r&&b();break}case"3":B(h)?l=!1:(C=h,h!==L["01"]&&h!==L["0102"]||s==="BOTH"&&C!=="BOTH"?(l=!1,f=!0):r&&b())}return l?{licenseKey:t,valid:l,expiry:g.formatDate(u),expired:d,version:o,isTrial:r,trialExpired:c,incorrectLicenseType:f,currentLicenseType:s,suppliedLicenseType:C}:{licenseKey:t,valid:l,incorrectLicenseType:f,currentLicenseType:s,suppliedLicenseType:C}}isDisplayWatermark(){return this.isForceWatermark()||!this.isLocalhost()&&!this.isWebsiteUrl()&&!B(this.watermarkMessage)}getWatermarkMessage(){return this.watermarkMessage||""}getHostname(){const s=(this.document.defaultView||window).location,{hostname:i=""}=s;return i}isForceWatermark(){const s=(this.document.defaultView||window).location,{pathname:i}=s;return i?i.indexOf("forceWatermark")!==-1:!1}isWebsiteUrl(){return this.getHostname().match(/^((?:[\w-]+\.)?ag-grid\.com)$/)!==null}isLocalhost(){return this.getHostname().match(/^(?:127\.0\.0\.1|localhost)$/)!==null}static formatDate(t){const s=["January","February","March","April","May","June","July","August","September","October","November","December"],i=t.getDate(),n=t.getMonth(),a=t.getFullYear();return i+" "+s[n]+" "+a}static getGridReleaseDate(){return new Date(parseInt(g.decode(g.RELEASE_INFORMATION),10))}static decode(t){const s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let i="",n,a,o,r,h,l,c,d=0;const u=t.replace(/[^A-Za-z0-9+/=]/g,"");for(;d<u.length;)r=s.indexOf(u.charAt(d++)),h=s.indexOf(u.charAt(d++)),l=s.indexOf(u.charAt(d++)),c=s.indexOf(u.charAt(d++)),n=r<<2|h>>4,a=(h&15)<<4|l>>2,o=(l&3)<<6|c,i=i+String.fromCharCode(n),l!=64&&(i=i+String.fromCharCode(a)),c!=64&&(i=i+String.fromCharCode(o));return i=g.utf8_decode(i),i}static utf8_decode(t){t=t.replace(/rn/g,"n");let s="";for(let i=0;i<t.length;i++){const n=t.charCodeAt(i);n<128?s+=String.fromCharCode(n):n>127&&n<2048?(s+=String.fromCharCode(n>>6|192),s+=String.fromCharCode(n&63|128)):(s+=String.fromCharCode(n>>12|224),s+=String.fromCharCode(n>>6&63|128),s+=String.fromCharCode(n&63|128))}return s}static setChartsLicenseManager(t){this.chartsLicenseManager=t}static setLicenseKey(t){this.licenseKey=t,this.chartsLicenseManager&&this.chartsLicenseManager.setLicenseKey(t,!0)}static extractBracketedInformation(t){if(!t.includes("["))return["legacy",!1,void 0];const s=t.match(/\[(.*?)\]/g).map(r=>r.replace("[","").replace("]",""));if(!s||s.length===0)return["legacy",!1,void 0];const i=s.filter(r=>r==="TRIAL").length===1,n=s.filter(r=>r.indexOf("v")===0)[0],a=n?n.replace("v",""):"legacy",o=L[s.filter(r=>L[r])[0]];return[a,i,o]}centerPadAndOutput(t){const s=this.totalMessageLength-t.length;console.error(t.padStart(s/2+t.length,"*").padEnd(this.totalMessageLength,"*"))}padAndOutput(t,s="*",i=""){console.error(t.padEnd(this.totalMessageLength-i.length,s)+i)}outputInvalidLicenseKey(t,s,i){t?(this.centerPadAndOutput(""),this.centerPadAndOutput(` ${s} License `),this.centerPadAndOutput(" Incompatible License Key "),this.padAndOutput(`* Your license key is for ${i} only and does not cover you for ${s}.`," ","*"),this.padAndOutput(`* To troubleshoot your license key visit ${K}.`," ","*"),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 ${K}.`," ","*"),this.centerPadAndOutput(""),this.centerPadAndOutput("")),this.watermarkMessage="Invalid License"}outputExpiredTrialKey(t,s,i){this.centerPadAndOutput(""),this.centerPadAndOutput(` ${s} License `),this.centerPadAndOutput(" Trial Period Expired. "),this.padAndOutput(`* Your trial only license for ${i} 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,i,n){this.centerPadAndOutput(""),this.centerPadAndOutput(` ${i} License `),this.centerPadAndOutput(" Incompatible Software Version "),this.padAndOutput(`* Your license key works with versions of ${n} 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"}};$.RELEASE_INFORMATION="MTczMTQzMDQwMzMxOQ==";var A=$;import{Component as Fe,RefPlaceholder as Oe}from"@ag-grid-community/core";var Be=class extends Fe{constructor(){super(`<div class="ag-watermark"> <div data-ref="eLicenseTextRef" class="ag-watermark-text"></div> </div>`),this.eLicenseTextRef=Oe}wireBeans(e){this.licenseManager=e.licenseManager}postConstruct(){const e=this.shouldDisplayWatermark();this.setDisplayed(e),e&&(this.eLicenseTextRef.innerText=this.licenseManager.getWatermarkMessage(),window.setTimeout(()=>this.addCssClass("ag-opacity-zero"),0),window.setTimeout(()=>this.setDisplayed(!1),5e3))}shouldDisplayWatermark(){return this.licenseManager.isDisplayWatermark()}},_e={selector:"AG-WATERMARK",component:Be},U=class extends Re{constructor(){super(...arguments),this.beanName="licenseManager"}postConstruct(){this.validateLicense()}validateLicense(){this.licenseManager=new A(Pe(this.gos)),this.licenseManager.validateLicense()}static getLicenseDetails(e){return new A(null).getLicenseDetails(e)}getWatermarkSelector(){return _e}isDisplayWatermark(){return this.licenseManager.isDisplayWatermark()}getWatermarkMessage(){return this.licenseManager.getWatermarkMessage()}static setLicenseKey(e){A.setLicenseKey(e)}static setChartsLicenseManager(e){A.setChartsLicenseManager(e)}},ke="32.3.4";import{Component as Ne,_createIconNoSpan as j,_isNodeOrElement as Ve,_loadTemplate as G,_setAriaExpanded as He,_warnOnce as ze}from"@ag-grid-community/core";var q=class extends Ne{constructor(){super(),this.setTemplate("<div></div>")}init(e){this.params=e,this.cssClassPrefix=this.params.cssClassPrefix??"ag-menu-option",this.addIcon(),this.addName(),this.addShortcut(),this.addSubMenu()}configureDefaults(){return!0}addIcon(){if(this.params.isCompact)return;const e=G(`<span data-ref="eIcon" class="${this.getClassName("part")} ${this.getClassName("icon")}" role="presentation"></span>`),{checked:t,icon:s}=this.params;t?e.appendChild(j("check",this.gos)):s&&(Ve(s)?e.appendChild(s):typeof s=="string"?e.innerHTML=s:ze("menu item icon must be DOM node or string")),this.getGui().appendChild(e)}addName(){const e=G(`<span data-ref="eName" class="${this.getClassName("part")} ${this.getClassName("text")}">${this.params.name||""}</span>`);this.getGui().appendChild(e)}addShortcut(){if(this.params.isCompact)return;const e=G(`<span data-ref="eShortcut" class="${this.getClassName("part")} ${this.getClassName("shortcut")}">${this.params.shortcut||""}</span>`);this.getGui().appendChild(e)}addSubMenu(){const e=G(`<span data-ref="ePopupPointer" class="${this.getClassName("part")} ${this.getClassName("popup-pointer")}"></span>`),t=this.getGui();if(this.params.subMenu){const s=this.gos.get("enableRtl")?"smallLeft":"smallRight";He(t,!1),e.appendChild(j(s,this.gos))}t.appendChild(e)}getClassName(e){return`${this.cssClassPrefix}-${e}`}destroy(){super.destroy()}},We=Ge({version:ke,moduleName:Ae.EnterpriseCoreModule,beans:[U],userComponents:[{name:"agMenuItem",classImp:q}]});import{AgCheckboxSelector as Ke,AgToggleButton as $e,Component as R,KeyCode as E,RefPlaceholder as w,_createIcon as Y,_setAriaExpanded as Ue,_setDisplayed as I}from"@ag-grid-community/core";function je(e){const t=e.cssIdentifier||"default",s=e.direction||"vertical";return` <div class="ag-group ag-${t}-group" role="presentation"> <div data-ref="eToolbar" class="ag-group-toolbar ag-${t}-group-toolbar"> <ag-checkbox data-ref="cbGroupEnabled"></ag-checkbox> </div> <div data-ref="eContainer" class="ag-group-container ag-group-container-${s} ag-${t}-group-container"></div> </div> `}var Z=class extends R{constructor(e={}){super(je(e),[Ke]),this.params=e,this.suppressEnabledCheckbox=!0,this.suppressToggleExpandOnEnableChange=!1,this.eToolbar=w,this.cbGroupEnabled=w,this.eContainer=w;const{enabled:t,items:s,suppressEnabledCheckbox:i,expanded:n,suppressToggleExpandOnEnableChange:a,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=n??!0,i!=null&&(this.suppressEnabledCheckbox=i),a!=null&&(this.suppressToggleExpandOnEnableChange=a)}postConstruct(){if(this.setupTitleBar(),this.items.length){const n=this.items;this.items=[],this.addItems(n)}const e=this.localeService.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:i}=this.params;this.hideEnabledCheckbox(this.suppressEnabledCheckbox),this.hideOpenCloseIcons(i??!1),this.refreshChildDisplay(),I(this.eContainer,this.expanded),this.cbGroupEnabled.onValueChange(n=>{this.setEnabled(n,!0,this.suppressToggleExpandOnEnableChange),this.dispatchEnableChangeEvent(n)}),t!=null&&this.onEnableChange(t),s!=null&&this.onExpandedChange(s)}refreshChildDisplay(){I(this.eToolbar,this.expanded&&!this.suppressEnabledCheckbox),this.eTitleBar?.refreshOnExpand(this.expanded)}isExpanded(){return this.expanded}setAlignItems(e){this.alignItems!==e&&this.removeCssClass(`ag-group-item-alignment-${this.alignItems}`),this.alignItems=e;const t=`ag-group-item-alignment-${this.alignItems}`;return this.addCssClass(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(),I(this.eContainer,e),t||this.dispatchLocalEvent({type:e?"expanded":"collapsed"}),this}addItems(e){e.forEach(t=>this.addItem(t))}prependItem(e){this.insertItem(e,!0)}addItem(e){this.insertItem(e,!1)}insertItem(e,t){const s=this.eContainer,i=e instanceof R?e.getGui():e;i.classList.add("ag-group-item",`ag-${this.cssIdentifier}-group-item`),t?(s.insertAdjacentElement("afterbegin",i),this.items.unshift(i)):(s.appendChild(i),this.items.push(i))}hideItem(e,t){const s=this.items[t];I(s,!e)}getItemIndex(e){const t=e instanceof R?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?.addCssClass(e)}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=this.createManagedBean(new Ye(this.params));return this.eTitleBar=e,e.refreshOnExpand(this.expanded),this.addManagedListeners(e,{expandedChanged:t=>this.toggleGroupExpand(t.expanded)}),e}createToggleTitleBar(){const e=this.createManagedBean(new $e({value:this.enabled,label:this.params.title,labelAlignment:"left",labelWidth:"flex",onValueChange:t=>{this.setEnabled(t,!0),this.dispatchEnableChangeEvent(t)}}));return e.addCssClass("ag-group-title-bar"),e.addCssClass(`ag-${this.params.cssIdentifier??"default"}-group-title-bar ag-unselectable`),this.eToggle=e,this.toggleGroupExpand(this.enabled),e}},_="ag-disabled-group-title-bar";function qe(e){const t=e.cssIdentifier??"default",s=e.suppressKeyboardNavigation?"presentation":"role";return` <div class="ag-group-title-bar ag-${t}-group-title-bar ag-unselectable" role="${s}"> <span class="ag-group-title-bar-icon ag-${t}-group-title-bar-icon" data-ref="eGroupOpenedIcon" role="presentation"></span> <span class="ag-group-title-bar-icon ag-${t}-group-title-bar-icon" data-ref="eGroupClosedIcon" role="presentation"></span> <span data-ref="eTitle" class="ag-group-title ag-${t}-group-title"></span> </div> `}var Ye=class extends R{constructor(e={}){super(qe(e)),this.suppressOpenCloseIcons=!1,this.suppressKeyboardNavigation=!1,this.eGroupOpenedIcon=w,this.eGroupClosedIcon=w,this.eTitle=w;const{title:t,suppressOpenCloseIcons:s,suppressKeyboardNavigation:i}=e;t&&t.length>0&&(this.title=t),s!=null&&(this.suppressOpenCloseIcons=s),this.suppressKeyboardNavigation=i??!1}postConstruct(){this.setTitle(this.title),this.hideOpenCloseIcons(this.suppressOpenCloseIcons),this.setupExpandContract()}setupExpandContract(){this.eGroupClosedIcon.appendChild(Y("columnSelectClosed",this.gos,null)),this.eGroupOpenedIcon.appendChild(Y("columnSelectOpen",this.gos,null)),this.addManagedElementListeners(this.getGui(),{click:()=>this.dispatchExpandChanged(),keydown:e=>{switch(e.key){case E.ENTER:case E.SPACE:e.preventDefault(),this.dispatchExpandChanged();break;case E.RIGHT:case E.LEFT:e.preventDefault(),this.dispatchExpandChanged(e.key===E.RIGHT);break}}})}refreshOnExpand(e){this.refreshAriaStatus(e),this.refreshOpenCloseIcons(e)}refreshAriaStatus(e){this.suppressOpenCloseIcons||Ue(this.getGui(),e)}refreshOpenCloseIcons(e){const t=!this.suppressOpenCloseIcons;I(this.eGroupOpenedIcon,t&&e),I(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;e=s?e:void 0,this.eTitle.textContent=e??"",I(t,s),e!==this.title&&(this.title=e);const i=t.classList.contains(_);return this.refreshDisabledStyles(i),this}addWidget(e){return this.getGui().appendChild(e),this}hideOpenCloseIcons(e){return this.suppressOpenCloseIcons=e,e&&this.dispatchExpandChanged(!0),this}refreshDisabledStyles(e){const t=this.getGui();e?(t.classList.add(_),t.removeAttribute("tabindex")):(t.classList.remove(_),typeof this.title=="string"&&!this.suppressKeyboardNavigation?t.setAttribute("tabindex","0"):t.removeAttribute("tabindex"))}},Ze={selector:"AG-GROUP-COMPONENT",component:Z};import{AgInputTextFieldSelector as Je,AgPickerField as Qe,KeyCode as p,RefPlaceholder as J,_bindCellRendererToHtmlElement as Xe,_clearElement as k,_createIconNoSpan as et,_debounce as tt,_escapeString as st,_exists as Q,_fuzzySuggestions as it,_getActiveDomElement as nt,_isEventFromPrintableCharacter as at,_isVisible as ot,_setAriaActiveDescendant as rt,_stopPropagationForAgGrid as lt}from"@ag-grid-community/core";import{Component as ht,KeyCode as y,_clearElement as ct,_getActiveDomElement as X,_getDocument as dt,_setAriaPosInSet as ut,_setAriaSetSize as pt}from"@ag-grid-community/core";import{RefPlaceholder as ee}from"@ag-grid-community/core";import{Component as gt}from"@ag-grid-community/core";var mt=class extends gt{constructor(e){super(` <div class="ag-pill" role="option"> <span class="ag-pill-text" data-ref="eText"></span> <span class="ag-button ag-pill-button" data-ref="eButton" role="presentation"></span> </div> `),this.config=e,this.eText=ee,this.eButton=ee}postConstruct(){const{config:e,eButton:t}=this,{onKeyDown:s,onButtonClick:i}=e;this.getGui().setAttribute("tabindex",String(this.gos.get("tabIndex"))),this.addGuiEventListener("focus",()=>{this.eButton.focus()}),s&&this.addGuiEventListener("keydown",s),i&&this.addManagedElementListeners(t,{click:i})}toggleCloseButtonClass(e,t){this.eButton.classList.toggle(e,t)}setText(e){this.eText.textContent=e}getText(){return this.eText.textContent}},ft=class extends ht{constructor(){super(` <div class="ag-pill-container" role="listbox"></div> `),this.pills=[]}wireBeans(e){this.focusService=e.focusService}init(e){this.params=e,this.refresh()}refresh(){this.clearPills();const{params:e,onPillKeyDown:t}=this,s=e.getValue();if(!Array.isArray(s))return;const i=s.length;for(let n=0;n<i;n++){const a=s[n],o=this.createBean(new mt({onButtonClick:()=>this.onPillButtonClick(o),onKeyDown:t.bind(this)})),r=o.getGui();ut(r,n+1),pt(r,i),e.onPillMouseDown&&o.addGuiEventListener("mousedown",e.onPillMouseDown),e.announceItemFocus&&o.addGuiEventListener("focus",e.announceItemFocus),o.setText(a),o.toggleCloseButtonClass("ag-icon-cancel",!0),this.appendChild(r),this.pills.push(o)}}onNavigationKeyDown(e){const{key:t}=e;if(!this.pills.length||t!==y.LEFT&&t!==y.RIGHT)return;e.preventDefault();const s=X(this.gos),i=this.getGui(),{params:n,focusService:a}=this;if(i.contains(s)){const o=a.findNextFocusableElement(i,!1,t===y.LEFT);o?o.focus():n.eWrapper&&n.eWrapper.focus()}else{const o=a.findFocusableElements(i);o.length>0&&o[t===y.RIGHT?0:o.length-1].focus()}}clearPills(){const e=this.getGui();e.contains(X(this.gos))&&this.params.eWrapper&&this.params.eWrapper.focus(),ct(e),this.destroyBeans(this.pills),this.pills=[]}onPillButtonClick(e){this.deletePill(e)}onPillKeyDown(e){const t=e.key;if(t!==y.DELETE&&t!==y.BACKSPACE)return;e.preventDefault();const s=dt(this.gos),i=this.pills.findIndex(a=>a.getGui().contains(s.activeElement));if(i===-1)return;const n=this.pills[i];n&&this.deletePill(n,i)}deletePill(e,t){const s=e.getText(),i=(this.params.getValue()||[]).filter(n=>n!==s);if(this.params.setValue(i),!i.length&&this.params.eWrapper)this.params.eWrapper.focus();else if(t!=null){const n=this.pills[Math.min(t,this.pills.length-1)];n&&n.getFocusableElement().focus()}}destroy(){this.clearPills(),super.destroy()}};import{KeyCode as Ct,_getDocument as vt,_setAriaActiveDescendant as bt,_setAriaControls as It,_setAriaLabel as wt}from"@ag-grid-community/core";import{Component as yt,_bindCellRendererToHtmlElement as Dt,_escapeString as P,_exists as S,_getDocument as Et,_setAriaSelected as St}from"@ag-grid-community/core";var Tt=class extends yt{constructor(e){super('<div class="ag-rich-select-row" role="presentation"></div>'),this.params=e}wireBeans(e){this.userComponentFactory=e.userComponentFactory}setState(e){let t="";const{params:s}=this;s.valueFormatter&&(t=s.valueFormatter(e)),this.populateWithRenderer(e,t)||this.populateWithoutRenderer(e,t),this.value=e}highlightString(e){const{parsedValue:t}=this;if(this.params.cellRenderer||!S(t))return;let s=S(e);if(s){const i=t?.toLocaleLowerCase().indexOf(e.toLocaleLowerCase());if(i>=0){const n=i+e.length,a=P(t.slice(0,i),!0),o=P(t.slice(i,n),!0),r=P(t.slice(n));this.renderValueWithoutRenderer(`${a}<span class="ag-rich-select-row-text-highlight">${o}</span>${r}`)}else s=!1}s||this.renderValueWithoutRenderer(t)}updateSelected(e){const t=this.getGui();St(t.parentElement,e),this.addOrRemoveCssClass("ag-rich-select-row-selected",e)}getValue(){return this.value}toggleHighlighted(e){this.addOrRemoveCssClass("ag-rich-select-row-highlighted",e)}populateWithoutRenderer(e,t){const s=Et(this.gos),i=this.getGui(),n=s.createElement("span");n.style.overflow="hidden",n.style.textOverflow="ellipsis";const a=P(S(t)?t:e,!0);this.parsedValue=S(a)?a:null,i.appendChild(n),this.renderValueWithoutRenderer(a),this.setTooltip({newTooltipText:this.parsedValue,shouldDisplayTooltip:()=>n.scrollWidth>n.clientWidth})}renderValueWithoutRenderer(e){const t=this.getGui().querySelector("span");t&&(t.innerHTML=S(e)?e:"&nbsp;")}populateWithRenderer(e,t){let s,i;if(this.params.cellRenderer){const n=this.getParentComponent()?.getParentComponent();i=this.userComponentFactory.getEditorRendererDetails(this.params,{value:e,valueFormatted:t,getValue:()=>n?.getValue(),setValue:a=>{n?.setValue(a,!0)},setTooltip:(a,o)=>{this.setTooltip({newTooltipText:a,shouldDisplayTooltip:o})}})}return i&&(s=i.newAgStackInstance()),s&&Dt(s,this.getGui()),s?(s.then(n=>{this.addDestroyFunc(()=>{this.destroyBean(n)})}),!0):!1}};import{KeyCode as m,RefPlaceholder as xt,TabGuardComp as Lt,_getAriaPosInSet as At,_setAriaLabel as Gt,_setAriaPosInSet as Rt,_setAriaRole as te,_setAriaSetSize as Pt,_stopPropagationForAgGrid as Mt,_waitUntil as Ft,_warnOnce as Ot}from"@ag-grid-community/core";function Bt(e){return`<div class="ag-virtual-list-viewport ag-${e}-virtual-list-viewport" role="presentation"> <div class="ag-virtual-list-container ag-${e}-virtual-list-container" data-ref="eContainer"></div> </div>`}var se=class extends Lt{constructor(e){super(Bt(e?.cssIdentifier||"default")),this.renderedRows=new Map,this.rowHeight=20,this.pageSize=-1,this.isScrolling=!1,this.isHeightFromTheme=!0,this.eContainer=xt,this.awaitStableCallbacks=[];const{cssIdentifier:t="default",ariaRole:s="listbox",listName:i}=e||{};this.cssIdentifier=t,this.ariaRole=s,this.listName=i}wireBeans(e){this.resizeObserverService=e.resizeObserverService,this.animationFrameService=e.animationFrameService,this.environment=e.environment}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.setAriaProperties(),this.addManagedEventListeners({gridStylesChanged:this.onGridStylesChanged.bind(this)})}onGridStylesChanged(e){e.listItemHeightChanged&&(this.rowHeight=this.getItemHeight(),this.refresh())}setAriaProperties(){const t=this.localeService.getLocaleTextFunc()("ariaDefaultListName",this.listName||"List"),s=this.eContainer;te(s,this.ariaRole),Gt(s,t)}addResizeObserver(){const e=()=>this.animationFrameService.requestAnimationFrame(()=>this.drawVirtualRows()),t=this.resizeObserverService.observeResize(this.getGui(),e);this.addDestroyFunc(t)}focusInnerElement(e){this.focusRow(e?this.model.getRowCount()-1:0)}onFocusIn(e){const t=e.target;t.classList.contains("ag-virtual-list-item")&&(this.lastFocusedRowIndex=At(t)-1)}onFocusOut(e){this.getFocusableElement().contains(e.relatedTarget)||(this.lastFocusedRowIndex=null)}handleKeyDown(e){switch(e.key){case m.UP:case m.DOWN:this.navigate(e.key===m.UP)&&e.preventDefault();break;case m.PAGE_HOME:case m.PAGE_END:case m.PAGE_UP:case m.PAGE_DOWN:this.navigateToPage(e.key)!==null&&e.preventDefault();break}}onTabKeyDown(e){Mt(e),this.forceFocusOutOfContainer(e.shiftKey)}navigate(e){if(this.lastFocusedRowIndex==null)return!1;const t=this.lastFocusedRowIndex+(e?-1:1);return t<0||t>=this.model.getRowCount()?!1:(this.focusRow(t),!0)}navigateToPage(e,t="focused"){let s=!1;t==="focused"&&(t=this.getLastFocusedRow(),s=!0);const i=this.model.getRowCount()-1;let n=-1;return e===m.PAGE_HOME?n=0:e===m.PAGE_END?n=i:e===m.PAGE_DOWN?n=Math.min(t+this.pageSize,i):e===m.PAGE_UP&&(n=Math.max(t-this.pageSize,0)),n===-1?null:(s?this.focusRow(n):this.ensureIndexVisible(n),n)}getLastFocusedRow(){return this.lastFocusedRowIndex}focusRow(e){this.isScrolling||(this.isScrolling=!0,this.ensureIndexVisible(e),this.animationFrameService.requestAnimationFrame(()=>{if(this.isScrolling=!1,!this.isAlive())return;const t=this.renderedRows.get(e);t&&t.eDiv.focus()}))}getComponentAt(e){const t=this.renderedRows.get(e);return t&&t.rowComponent}forEachRenderedRow(e){this.renderedRows.forEach((t,s)=>e(t.rowComponent,s))}getItemHeight(){return this.isHeightFromTheme?this.environment.getDefaultListItemHeight():this.rowHeight}ensureIndexVisible(e,t=!0){const s=this.model.getRowCount();if(typeof e!="number"||e<0||e>=s)return Ot("invalid row index for ensureIndexVisible: ",e),!1;const i=e*this.rowHeight,n=i+this.rowHeight,a=this.getGui(),o=a.scrollTop,r=a.offsetHeight,h=o+r,l=t?0:this.rowHeight,c=o>i+l,d=h<n-l;if(c)return a.scrollTop=i,!0;if(d){const u=n-r;return a.scrollTop=u,!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.awaitStable(()=>{this.isAlive()&&(this.canSoftRefresh(e)?this.drawVirtualRows(!0):(this.clearVirtualRows(),this.drawVirtualRows()))})}awaitStable(e){if(this.awaitStableCallbacks.push(e),this.awaitStableCallbacks.length>1)return;const t=this.model.getRowCount();Ft(()=>this.eContainer.clientHeight>=t*this.rowHeight,()=>{const s=this.awaitStableCallbacks;this.awaitStableCallbacks=[],s.forEach(i=>i())})}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,i=s+t.offsetHeight,n=Math.floor(s/this.rowHeight),a=Math.floor(i/this.rowHeight);this.pageSize=Math.floor((i-s)/this.rowHeight),this.ensureRowsRendered(n,a,e)}ensureRowsRendered(e,t,s){this.renderedRows.forEach((i,n)=>{(n<e||n>t)&&n!==this.lastFocusedRowIndex&&this.removeRow(n)}),s&&this.refreshRows();for(let i=e;i<=t;i++)this.renderedRows.has(i)||i<this.model.getRowCount()&&this.insertRow(i)}insertRow(e){const t=this.model.getRow(e),s=document.createElement("div");s.classList.add("ag-virtual-list-item",`ag-${this.cssIdentifier}-virtual-list-item`),te(s,this.ariaRole==="tree"?"treeitem":"option"),Pt(s,this.model.getRowCount()),Rt(s,e+1),s.setAttribute("tabindex","-1"),s.style.height=`${this.rowHeight}px`,s.style.top=`${this.rowHeight*e}px`;const i=this.componentCreator(t,s);i.addGuiEventListener("focusin",()=>this.lastFocusedRowIndex=e),s.appendChild(i.getGui()),this.renderedRows.has(e-1)?this.renderedRows.get(e-1).eDiv.insertAdjacentElement("afterend",s):this.renderedRows.has(e+1)?this.renderedRows.get(e+1).eDiv.insertAdjacentElement("beforebegin",s):this.eContainer.appendChild(s),this.renderedRows.set(e,{rowComponent:i,eDiv:s,value:t})}removeRow(e){const t=this.renderedRows.get(e);this.eContainer.removeChild(t.eDiv),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 i=this.model.getRow(s);this.model.areRowsEqual?.(t.value,i)?this.componentUpdater(i,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(),this.awaitStableCallbacks.length=0,super.destroy())}},ie="ag-rich-select-list",ne="ag-rich-select-row",_t=class extends se{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.params=e,this.setComponentCreator(this.createRowComponent.bind(this)),this.setComponentUpdater(()=>{})}postConstruct(){super.postConstruct(),this.createLoadingElement();const{cellRowHeight:e,pickerAriaLabelKey:t,pickerAriaLabelValue:s}=this.params;e&&this.setRowHeight(e);const i=this.getGui(),n=this.getAriaElement();this.addManagedListeners(i,{mousemove:this.onMouseMove.bind(this),mouseout:this.onMouseOut.bind(this),mousedown:this.onMouseDown.bind(this),click:this.onClick.bind(this)}),i.classList.add(ie);const a=`${ie}-${this.getCompId()}`;n.setAttribute("id",a);const r=this.localeService.getLocaleTextFunc()(t,s);wt(n,r),It(this.richSelectWrapper,n)}navigateToPage(e){const t=super.navigateToPage(e,this.lastRowHovered);return t!=null&&this.animationFrameService.requestAnimationFrame(()=>{if(!this.isAlive())return null;this.highlightIndex(t)}),t}drawVirtualRows(e){super.drawVirtualRows(e),this.refreshSelectedItems()}highlightFilterMatch(e){this.forEachRenderedRow(t=>{t.highlightString(e)})}onNavigationKeyDown(e,t){this.animationFrameService.requestAnimationFrame(()=>{if(!this.currentList||!this.isAlive())return;const s=this.currentList.length,i=this.lastRowHovered,n=e===Ct.DOWN?1:-1,a=Math.min(Math.max(i===-1?0:i+n,0),s-1);this.highlightIndex(a),t()})}selectValue(e){if(!this.currentList)return this.eLoading&&this.appendChild(this.eLoading),!1;if(this.eLoading?.offsetParent&&this.eLoading.parentElement?.removeChild(this.eLoading),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}selectListItems(e,t=!1){t||this.selectedItems.clear();for(let s=0;s<e.length;s++){const i=e[s];this.selectedItems.has(i)||this.selectedItems.add(i)}this.refreshSelectedItems()}getCurrentList(){return this.currentList}setCurrentList(e){this.currentList=e,this.setModel({getRowCount:()=>e.length,getRow:t=>e[t],areRowsEqual:(t,s)=>t===s})}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.lastRowHovered=e,this.ensureIndexVisible(e,!t)&&!t&&this.refresh(!0)),this.forEachRenderedRow((s,i)=>{const n=e===i;if(s.toggleHighlighted(n),n){const a=`${ne}-${s.getCompId()}`;bt(this.richSelectWrapper,a),this.richSelectWrapper.setAttribute("data-active-option",a)}}))}getIndicesForValues(e){const{currentList:t}=this;if(!t||t.length===0||e==null)return[];if(Array.isArray(e)||(e=[e]),e.length===0)return[];const s=[];for(let i=0;i<e.length;i++){const n=t.indexOf(e[i]);n>=0&&s.push(n)}return s}toggleListItemSelection(e){this.selectedItems.has(e)?this.selectedItems.delete(e):this.selectedItems.add(e),this.refreshSelectedItems(),this.dispatchValueSelected()}refreshSelectedItems(){this.forEachRenderedRow(e=>{const t=this.selectedItems.has(e.getValue());e.updateSelected(t)})}createLoadingElement(){const e=vt(this.gos),t=this.localeService.getLocaleTextFunc(),s=e.createElement("div");s.classList.add("ag-loading-text"),s.innerText=t("loadingOoo","Loading..."),this.eLoading=s}createRowComponent(e,t){const s=new Tt(this.params);t.setAttribute("id",`${ne}-${s.getCompId()}`),s.setParentComponent(this),this.createBean(s),s.setState(e);const{highlightMatch:i,searchType:n="fuzzy"}=this.params;return i&&n!=="fuzzy"&&s.highlightString(this.getSearchString()),s}getRowForMouseEvent(e){const s=this.getGui().getBoundingClientRect(),i=this.getScrollTop(),n=e.clientY-s.top+i;return Math.floor(n/this.getRowHeight())}onMouseMove(e){const t=this.getRowForMouseEvent(e);t!==-1&&t!=this.lastRowHovered&&(this.lastRowHovered=t,this.highlightIndex(t,!0))}onMouseDown(e){e.preventDefault()}onMouseOut(e){this.getGui().contains(e.relatedTarget)||this.highlightIndex(-1)}onClick(e){const{multiSelect:t}=this.params;if(!this.currentList)return;const s=this.getRowForMouseEvent(e),i=this.currentList[s];t?this.toggleListItemSelection(i):(this.selectListItems([i]),this.dispatchValueSelected())}dispatchValueSelected(){this.dispatchLocalEvent({type:"richSelectListRowSelected",fromEnterKey:!1,value:this.selectedItems})}destroy(){super.destroy(),this.eLoading=void 0}},kt=class extends Qe{constructor(e){super({pickerAriaLabelKey:"ariaLabelRichSelectField",pickerAriaLabelValue:"Rich Select Field",pickerType:"ag-list",className:"ag-rich-select",pickerIcon:"smallDown",ariaRole:"combobox",template:e?.template??` <div class="ag-picker-field" role="presentation"> <div data-ref="eLabel"></div> <div data-ref="eWrapper" class="ag-wrapper ag-picker-field-wrapper ag-rich-select-value ag-picker-collapsed"> <span data-ref="eDisplayField" class="ag-picker-field-display"></span> <ag-input-text-field data-ref="eInput" class="ag-rich-select-field-input"></ag-input-text-field> <span data-ref="eDeselect" class="ag-rich-select-deselect-button ag-picker-field-icon" role="presentation"></span> <span data-ref="eIcon" class="ag-picker-field-icon" aria-hidden="true"></span> </div> </div>`,agComponents:[Je],modalPicker:!1,...e,maxPickerHeight:e?.maxPickerHeight??"calc(var(--ag-row-height) * 6.5)"}),this.searchString="",this.searchStringCreator=null,this.eInput=J,this.eDeselect=J,this.skipWrapperAnnouncement=!1;const{value:t,valueList:s,searchStringCreator:i}=e||{};t!==void 0&&(this.value=t),s!=null&&(this.values=s),i&&(this.searchStringCreator=i)}wireBeans(e){super.wireBeans(e),this.userComponentFactory=e.userComponentFactory,this.ariaAnnouncementService=e.ariaAnnouncementService}postConstruct(){super.postConstruct(),this.createListComponent(),this.eDeselect.appendChild(et("cancel",this.gos));const{allowTyping:e,placeholder:t,suppressDeselectAll:s}=this.config;this.eDeselect.classList.add("ag-hidden"),e?(this.eInput.setAutoComplete(!1).setInputPlaceholder(t),this.eDisplayField.classList.add("ag-hidden")):this.eInput.setDisplayed(!1),this.setupAriaProperties();const{searchDebounceDelay:i=300}=this.config;this.clearSearchString=tt(this.clearSearchString,i),this.renderSelectedValue(),e&&this.eInput.onValueChange(n=>this.searchTextFromString(n)),this.addManagedElementListeners(this.eWrapper,{focus:this.onWrapperFocus.bind(this)}),this.addManagedElementListeners(this.eWrapper,{focusout:this.onWrapperFocusOut.bind(this)}),s||this.addManagedElementListeners(this.eDeselect,{mousedown:this.onDeselectAllMouseDown.bind(this),click:this.onDeselectAllClick.bind(this)})}setupAriaProperties(){const{eWrapper:e,gos:t,localeService:s}=this;e.tabIndex=t.get("tabIndex");const i=s.getLocaleTextFunc();this.ariaDeleteSelection=i("ariaLabelRichSelectDeleteSelection","Press DELETE to deselect item"),this.ariaDeselectAllItems=i("ariaLabelRichSelectDeselectAllItems","Press DELETE to deselect all items"),this.ariaToggleSelection=i("ariaLabelRichSelectToggleSelection","Press SPACE to toggle selection")}createListComponent(){this.listComponent=this.createBean(new _t(this.config,this.eWrapper,()=>this.searchString)),this.listComponent.setParentComponent(this),this.addManagedListeners(this.listComponent,{richSelectListRowSelected:e=>{this.onListValueSelected(e.value,e.fromEnterKey)}})}renderSelectedValue(){const{value:e,eDisplayField:t,config:s}=this,{allowTyping:i,cellRenderer:n,initialInputValue:a,multiSelect:o,suppressDeselectAll:r,suppressMultiSelectPillRenderer:h}=s,l=this.config.valueFormatter?this.config.valueFormatter(e):e;if(i){this.eInput.setValue(a??l);return}if(o&&!r){const u=e==null||Array.isArray(e)&&e.length===0;this.eDeselect.classList.toggle("ag-hidden",u)}let c;if(o&&!h){this.createOrUpdatePillContainer(t);return}n&&(c=this.userComponentFactory.getEditorRendererDetails(s,{value:e,valueFormatted:l,getValue:()=>this.getValue(),setValue:u=>{this.setValue(u,!0)},setTooltip:(u,f)=>{this.setTooltip({newTooltipText:u,shouldDisplayTooltip:f})}}));let d;if(c&&(d=c.newAgStackInstance()),d)k(t),Xe(d,t),d.then(u=>{this.addDestroyFunc(()=>this.destroyBean(u))});else{if(Q(this.value))t.innerText=l,t.classList.remove("ag-display-as-placeholder");else{const{placeholder:u}=s;Q(u)?(t.innerHTML=`${st(u)}`,t.classList.add("ag-display-as-placeholder")):k(t)}this.setTooltip({newTooltipText:l??null,shouldDisplayTooltip:()=>this.eDisplayField.scrollWidth>this.eDisplayField.clientWidth})}}createPickerComponent(){const{values:e}=this;return e&&this.setValueList({valueList:e}),this.listComponent}setSearchStringCreator(e){this.searchStringCreator=e}setValueList(e){const{valueList:t,refresh:s}=e;!this.listComponent||this.listComponent.getCurrentList()===t||(this.listComponent.setCurrentList(t),s&&(this.values?this.listComponent.refresh(!0):(this.values=t,this.isPickerDisplayed&&(this.listComponent.selectValue(this.value)||this.listComponent.refresh())),this.alignPickerToComponent()))}showPicker(){super.showPicker();const{listComponent:e,value:t}=this;if(!e)return;let s=null;this.value!=null&&(e.selectValue(this.value),s=e.getIndicesForValues(Array.isArray(t)?t:[t])[0]),s!=null?e.highlightIndex(s):e.refresh(),this.displayOrHidePicker()}beforeHidePicker(){super.beforeHidePicker()}createOrUpdatePillContainer(e){if(!this.pillContainer){const t=this.pillContainer=this.createBean(new ft);this.addDestroyFunc(()=>{this.destroyBean(this.pillContainer),this.pillContainer=null}),k(e),e.appendChild(t.getGui()),t.init({eWrapper:this.eWrapper,onPillMouseDown:s=>{s.stopImmediatePropagation()},announceItemFocus:()=>{this.announceAriaValue(this.ariaDeleteSelection)},getValue:()=>this.getValue(),setValue:s=>this.setValue(s,!0)})}this.doWhileBlockingAnnouncement(()=>this.pillContainer?.refresh())}doWhileBlockingAnnouncement(e){this.skipWrapperAnnouncement=!0,e(),this.skipWrapperAnnouncement=!1}onWrapperFocus(){const{eInput:e,config:t}=this,{allowTyping:s,multiSelect:i,suppressDeselectAll:n}=t;if(s){const a=e.getFocusableElement();a.focus(),a.select()}else i&&!n&&!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===p.BACKSPACE)this.searchString=this.searchString.slice(0,-1),t="";else if(!at(e))return;e.preventDefault(),this.searchTextFromCharacter(t)}searchTextFromCharacter(e){this.searchString+=e,this.runSearch(),this.clearSearchString()}searchTextFromString(e){e==null&&(e=""),this.searchString=e,this.runSearch()}buildSearchStrings(e){const{valueFormatter:t=i=>i}=this.config;let s;return typeof e[0]=="number"||typeof e[0]=="string"?s=e.map(i=>t(i)):typeof e[0]=="object"&&this.searchStringCreator&&(s=this.searchStringCreator(e)),s}filterListModel(e){const{filterList:t}=this.config;t&&this.setValueList({valueList:e,refresh:!0})}runSearch(){if(!this.listComponent)return;const{values:e}=this,t=this.buildSearchStrings(e);if(!t){this.listComponent.highlightIndex(-1);return}const{suggestions:s,filteredValues:i}=this.getSuggestionsAndFilteredValues(this.searchString,t),{filterList:n,highlightMatch:a,searchType:o="fuzzy"}=this.config,r=i.length,h=!!(n&&this.searchString!=="");if(this.filterListModel(h?i:e),s.length){const l=h?0:t.indexOf(s[0]);this.listComponent?.highlightIndex(l)}else if(this.listComponent?.highlightIndex(-1),!h||r)this.listComponent?.ensureIndexVisible(0);else if(h){this.getAriaElement().removeAttribute("data-active-option");const l=this.listComponent?.getAriaElement();l&&rt(l,null)}a&&o!=="fuzzy"&&this.listComponent?.highlightFilterMatch(this.searchString),this.displayOrHidePicker()}getSuggestionsAndFilteredValues(e,t){let s=[];const i=[];if(!e.length)return{suggestions:s,filteredValues:i};const{searchType:n="fuzzy",filterList:a}=this.config;if(n==="fuzzy"){const o=it({inputValue:e,allSuggestions:t,hideIrrelevant:!0,addSequentialWeight:!0});s=o.values;const r=o.indices;if(a&&r.length)for(let h=0;h<r.length;h++)i.push(this.values[r[h]])}else s=t.filter((o,r)=>{const h=o.toLocaleLowerCase(),l=this.searchString.toLocaleLowerCase(),c=n==="match"?h.startsWith(l):h.indexOf(l)!==-1;return a&&c&&i.push(this.values[r]),c});return{suggestions:s,filteredValues:i}}displayOrHidePicker(){if(!this.listComponent)return;const e=this.listComponent.getGui(),t=this.listComponent.getCurrentList(),s=t?t.length===0:!1;e.classList.toggle("ag-hidden",s)}clearSearchString(){this.searchString=""}setValue(e,t,s,i){if(this.value===e)return this;const n=Array.isArray(e);if(e!=null){if(!n){const a=this.listComponent?.getCurrentList();if((a?a.indexOf(e):-1)===-1)return this}s||this.listComponent?.selectValue(e)}return super.setValue(e,t),i||this.renderSelectedValue(),this}onNavigationKeyDown(e,t,s){e.preventDefault();const i=t===p.DOWN;if(!this.isPickerDisplayed&&i){this.showPicker();return}this.listComponent?.onNavigationKeyDown(t,s)}onEnterKeyDown(e){if(this.isPickerDisplayed&&(e.preventDefault(),this.listComponent?.getCurrentList())){const t=this.listComponent.getLastItemHovered();this.config.multiSelect||!t?this.dispatchPickerEventAndHidePicker(this.value,!0):this.onListValueSelected(new Set([t]),!0)}}onDeleteKeyDown(e){const{eWrapper:t,gos:s}=this;nt(s)===t&&(e.preventDefault(),this.setValue([],!0))}onTabKeyDown(){const{config:e,isPickerDisplayed:t,listComponent:s}=this,{multiSelect:i}=e;if(!(!t||!s)){if(i){const n=this.getValueFromSet(s.getSelectedItems());n&&this.setValue(n,!1,!0,!0)}else this.setValue(s.getLastItemHovered(),!1,!0);this.hidePicker()}}getValueFromSet(e){const{multiSelect:t}=this.config;let s=null;for(const i of e){if(e.size===1&&!t){s=i;break}s||(s=[]),s.push(i)}return Array.isArray(s)&&s.sort(),s}onListValueSelected(e,t){const s=this.getValueFromSet(e);this.setValue(s,!1,!0),this.config.multiSelect||this.dispatchPickerEventAndHidePicker(s,t)}dispatchPickerEventAndHidePicker(e,t){const s={type:"fieldPickerValueSelected",fromEnterKey:t,value:e};this.dispatchLocalEvent(s),this.hidePicker()}getFocusableElement(){const{allowTyping:e}=this.config;return e?this.eInput.getFocusableElement():super.getFocusableElement()}onKeyDown(e){const{key:t}=e,{isPickerDisplayed:s,config:i,listComponent:n,pickerComponent:a}=this,{allowTyping:o,multiSelect:r,suppressDeselectAll:h}=i;switch(t){case p.LEFT:case p.RIGHT:(!o||this.pillContainer)&&(e.preventDefault(),this.pillContainer&&(this.listComponent?.highlightIndex(-1),this.pillContainer.onNavigationKeyDown(e)));break;case p.PAGE_HOME:case p.PAGE_END:if(o){e.preventDefault();const l=this.eInput.getInputElement(),c=t===p.PAGE_HOME?0:l.value.length;l.setSelectionRange(c,c);break}case p.PAGE_UP:case p.PAGE_DOWN:e.preventDefault(),a&&n?.navigateToPage(t);break;case p.DOWN:case p.UP:this.onNavigationKeyDown(e,t,()=>{r&&(this.doWhileBlockingAnnouncement(()=>this.eWrapper.focus()),this.announceAriaValue(this.ariaToggleSelection))});break;case p.ESCAPE:s&&(ot(this.listComponent.getGui())&&(e.preventDefault(),lt(e)),this.hidePicker());break;case p.ENTER:this.onEnterKeyDown(e);break;case p.SPACE:if(s&&r&&n){e.preventDefault();const l=n.getLastItemHovered();l&&n.toggleListItemSelection(l)}break;case p.TAB:this.onTabKeyDown();break;case p.DELETE:r&&!h&&this.onDeleteKeyDown(e);break;default:o||this.buildSearchStringFromKeyboardEvent(e)}}announceAriaValue(e){this.ariaAnnouncementService.announceValue(e,"richSelect")}destroy(){this.listComponent&&(this.listComponent=this.destroyBean(this.listComponent)),super.destroy()}};import{Component as Nt,KeyCode as Vt,RefPlaceholder as N,TouchListener as Ht,_createIconNoSpan as ae,_escapeString as zt,_setAriaLabel as Wt,_setDisplayed as Kt}from"@ag-grid-community/core";var $t=class extends Nt{constructor(e,t,s,i,n){super(),this.dragSourceDropTarget=e,this.ghost=t,this.horizontal=s,this.template=i,this.agComponents=n,this.eText=N,this.eDragHandle=N,this.eButton=N}wireBe