@genesislcap/design-system-configurator 15.46.0 → 15.46.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -99,7 +99,7 @@
99
99
  opacity: 1;
100
100
  background: var(--ag-row-hover-color, rgba(33, 150, 243, 0.1));
101
101
  }
102
- `;class N{init(e){var t,i;this.params=e,this.formatLabel=I(e.filterParams),this.eGui=document.createElement("div"),this.eGui.className=_,this.eRoot=this.eGui.attachShadow({mode:"open"}),$.addStylesTo(this.eRoot),this.eSummary=document.createElement("span"),this.eSummary.className=`${_}__summary`,this.eSummary.setAttribute("role","button"),this.eSummary.tabIndex=0,this.eSummary.addEventListener("click",()=>this.params.showParentFilter()),this.eSummary.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.params.showParentFilter())}),this.eRoot.appendChild(this.eSummary),this.eClear=document.createElement("button"),this.eClear.type="button",this.eClear.className=`${_}__clear`,this.eClear.textContent="✕",this.eClear.setAttribute("aria-label","Clear filter"),this.eClear.title="Clear filter",this.eClear.hidden=!0,this.eClear.addEventListener("click",()=>{this.params.parentFilterInstance(e=>{var t,i;null===(i=(t=e).clear)||void 0===i||i.call(t)})}),this.eRoot.appendChild(this.eClear),this.onParentModelChanged(null!==(i=null===(t=e.currentParentModel)||void 0===t?void 0:t.call(e))&&void 0!==i?i:null)}getGui(){return this.eGui}onParentModelChanged(e){const t=L(e,this.formatLabel)||"All";this.eSummary.textContent=t,this.eSummary.title=t,this.eSummary.classList.toggle(`${_}__summary--inactive`,!e),this.eClear.hidden=!e}destroy(){var e;null===(e=this.eGui)||void 0===e||e.remove()}}var B=i(59469),H=i(34713),z=i(30096),V=i(63296),U=i(81876),K=i(48707),X=i(96730),q=i(57963),j=i(24669),Y=i(49964),W=i(10629),J=i(41392),Q=i(90509),Z=i(79270),ee=i(35610),te=i(21281),ie=i(70985),ae=i(88915),re=i(44561);class se{constructor(e){var t;this.defaultReverse=!1,this.loadGeneration=0,this.detached=!1,this.rowData=new Map,this.pendingBlocks=new Set,this.deliveredRowCount=0,this.streamStarted=!1,this.moreRowsInFlight=!1,this.hasCriteria=!1,this.viewTruncationWarned=!1,this.createSnapshotFunc=e.createSnapshotFunc,this.createDataserverStreamFunc=e.createDataserverStreamFunc,this.getMoreRowsFunc=e.getMoreRowsFunc,this.onRowsInvalidatedFunc=e.onRowsInvalidatedFunc,this.onRowsUpdatedFunc=e.onRowsUpdatedFunc,this.onRowsDeliveredFunc=e.onRowsDeliveredFunc,this.onRowsWithdrawnFunc=e.onRowsWithdrawnFunc,this.onRowCacheResetFunc=e.onRowCacheResetFunc,this.errorHandlerFunc=e.errorHandlerFunc,this.ledger=new ae.J(e.rowId),this.resourceName=e.resourceName,this.resourceParams=Object.assign({},e.resourceParams),this.resourceIndexes=e.resourceIndexes,this.resourceColDefs=e.resourceColDefs,this.maxRows=e.maxRows,this.rowId=e.rowId,this.baseCriteria=e.baseCriteria||"",this.isRequestServer=e.isRequestServer,this.defaultOrderBy=e.defaultOrderBy||void 0,this.defaultReverse=null!==(t=e.defaultReverse)&&void 0!==t&&t,this.onNoDataAvailableFunc=e.onNoDataAvailableFunc,this.onDataAvailableFunc=e.onDataAvailableFunc}buildRequestServerParams(e,t,i){const a=Object.assign({},this.resourceParams);return a.DETAILS=Object.assign({},a.DETAILS),a.DETAILS.MAX_ROWS=this.maxRows,a.DETAILS.OFFSET=e,t?a.DETAILS.CRITERIA_MATCH=t:delete a.DETAILS.CRITERIA_MATCH,a.DETAILS.ORDER_BY=i.orderBy||`${this.rowId} ASC`,a}buildDataserverLogonParams(e,t){const i=Object.assign({},this.resourceParams);return i.MAX_ROWS=this.maxRows,delete i.VIEW_NUMBER,e?i.CRITERIA_MATCH=e:delete i.CRITERIA_MATCH,t.orderBy?(i.ORDER_BY=t.orderBy,i.REVERSE=t.reverse):(delete i.ORDER_BY,delete i.REVERSE),i}getLastRow(e,t,i,a){return"MORE_ROWS"in e&&!1===e.MORE_ROWS?t+i:!a&&"ROWS_COUNT"in e&&"number"==typeof e.ROWS_COUNT?e.ROWS_COUNT:-1}getRows(e){return(0,r.sH)(this,void 0,void 0,function*(){var t,i;if(this.detached)return F.v.debug("Infinite getRows ignored: the datasource was detached by its host"),void e.failCallback();F.v.debug("Infinite getRows called",{startRow:e.startRow,endRow:e.endRow,isRequestServer:this.isRequestServer});try{const i=(0,re.P4)(e.filterModel,this.resourceColDefs),a=[this.baseCriteria,i].filter(Boolean).join(" && "),r=this.resolveSortConfig(e.sortModel);if(this.noteRequestKey(a,r),!this.isRequestServer)return void this.getDataserverRows(e,a,r);const s=this.buildRequestServerParams(e.startRow,a,r);F.v.debug("Infinite datasource request params",s);const o=this.loadGeneration,n=yield this.createSnapshotFunc(s);if(o!==this.loadGeneration)return F.v.debug("Infinite REQUEST_SERVER reply discarded: the block cache was reset"),void e.failCallback();if(!n)return void e.failCallback();const l=n.MESSAGE_TYPE;if(l===te.Go.LOGOFF_ACK||l===te.Go.MSG_NACK){const i=l===te.Go.LOGOFF_ACK?`Connection lost to ${this.resourceName}`:`Request rejected by ${this.resourceName}`;return F.v.error(`Infinite REQUEST_SERVER block failed: ${i}`,n),null===(t=this.errorHandlerFunc)||void 0===t||t.call(this,i,"connection"),void e.failCallback()}if("REPLY"in n&&Array.isArray(n.REPLY)){const t=n.REPLY,i=this.getLastRow(n,e.startRow,t.length,Boolean(a));return e.successCallback(t,i),this.deliverRows(e.startRow,t),void this.notifyDataAvailability(e.startRow,t.length)}e.successCallback([],e.startRow),this.notifyDataAvailability(e.startRow,0)}catch(t){F.v.error("Error in infinite getRows:",t),null===(i=this.errorHandlerFunc)||void 0===i||i.call(this,function(e){var t,i,a;if(e instanceof Error)return e.message;if("string"==typeof e)return e;const r=e;for(const e of[r,null==r?void 0:r.receivedMessage]){const i=null===(t=null==e?void 0:e.ERROR)||void 0===t?void 0:t.map(e=>null==e?void 0:e.TEXT).filter(Boolean);if(null==i?void 0:i.length)return i.join("; ")}if("string"==typeof(null==r?void 0:r.message)&&r.message)return r.message;const s=null!==(i=null==r?void 0:r.MESSAGE_TYPE)&&void 0!==i?i:null===(a=null==r?void 0:r.receivedMessage)||void 0===a?void 0:a.MESSAGE_TYPE;if(s)return s;try{return JSON.stringify(e)}catch(t){return String(e)}}(t),"unknown"),e.failCallback()}})}resolveSortConfig(e){const t=function(e,t,i=!1){if(!e||0===e.length)return{orderBy:null,reverse:!1};const a=e[0],r=a.colId,s="desc"===a.sort;if(i)return{orderBy:`${r} ${s?"DESC":"ASC"}`,reverse:!1};for(const[e,i]of t.entries())if(e&&i.includes(r))return{orderBy:e,reverse:s};return F.v.warn(`Column '${r}' is not part of any named INDEX. Server-side sorting is not available for this column.`),{orderBy:null,reverse:!1}}(e,this.resourceIndexes,this.isRequestServer);return t.orderBy||!this.defaultOrderBy?t:{orderBy:this.defaultOrderBy,reverse:this.defaultReverse}}noteRequestKey(e,t){var i;const a=JSON.stringify(Object.assign({criteria:e},t));void 0!==this.rowCacheKey&&this.rowCacheKey!==a&&(this.loadGeneration+=1,this.ledger.clear(),null===(i=this.onRowCacheResetFunc)||void 0===i||i.call(this)),this.rowCacheKey=a,this.isRequestServer||void 0===this.subscriptionKey||this.subscriptionKey===a||this.teardownDataserverSubscription(),this.subscriptionKey=a}getDataserverRows(e,t,i){if(!this.createDataserverStreamFunc||!this.getMoreRowsFunc)return F.v.error("Infinite DATASERVER paging requires a stream and a getMoreRows function"),void e.failCallback();const a=Number.isFinite(Number(e.startRow))?Number(e.startRow):0,r=Number.isFinite(Number(e.endRow))?Number(e.endRow):a+this.maxRows,s={startRow:a,endRow:r,settled:!1,success:e.successCallback,fail:e.failCallback};if(this.streamStarted&&(this.rowData.size>=r||!1===this.moreRows))this.settleBlock(s,!0);else{if(s.timer=this.createBlockTimer(s),this.pendingBlocks.add(s),!this.dataserverStream){const e=this.buildDataserverLogonParams(t,i);return this.hasCriteria=Boolean(e.CRITERIA_MATCH),this.dataserverStream=this.createDataserverStreamFunc(e),void(this.dataserverStreamSubscription=this.dataserverStream.subscribe(e=>this.handleDataserverMessage(e)))}this.pumpMoreRows()}}pumpMoreRows(){this.moreRowsInFlight||!1===this.moreRows||0===this.pendingBlocks.size||this.dataserverStream&&this.dataserverStreamSubscription&&this.sourceRef&&(this.moreRowsInFlight=!0,this.requestMoreRows())}requestMoreRows(){return(0,r.sH)(this,void 0,void 0,function*(){if(this.dataserverStreamSubscription&&this.sourceRef)try{yield this.getMoreRowsFunc(this.sourceRef)}catch(e){if(this.moreRowsInFlight=!1,(null==e?void 0:e.status)===se.HTTP_NOT_FOUND)return F.v.warn(`Infinite DATASERVER paging is not available on this connection (MORE_ROWS answered 404, expected over HTTP/feature.forceHttp). ${this.resourceName} is truncated to the ${this.rowData.size} row(s) already delivered; use a websocket connection, or a REQUEST_SERVER resource, to page further.`),this.moreRows=!1,this.viewTruncationWarned=!0,void this.settleCoveredBlocks();F.v.error("Infinite DATASERVER MORE_ROWS failed:",e),this.failAllPendingBlocks()}else this.moreRowsInFlight=!1})}handleDataserverMessage(e){var t,i,a,r,s,o;const n=null==e?void 0:e.MESSAGE_TYPE;if(n===te.Go.LOGOFF_ACK||n===te.Go.MSG_NACK)return null===(t=this.errorHandlerFunc)||void 0===t||t.call(this,n===te.Go.LOGOFF_ACK?`Connection lost to ${this.resourceName}`:`Authentication failed for ${this.resourceName}`,"connection"),void this.teardownDataserverSubscription();this.sourceRef=null!==(i=null==e?void 0:e.SOURCE_REF)&&void 0!==i?i:this.sourceRef;const l=(null==e?void 0:e.ROW)?(0,ie.R)(e,this.rowId):void 0;if((null!==(r=null===(a=null==l?void 0:l.updates)||void 0===a?void 0:a.length)&&void 0!==r?r:0)>0||(null!==(o=null===(s=null==l?void 0:l.deletes)||void 0===s?void 0:s.length)&&void 0!==o?o:0)>0)return this.streamStarted=!0,void this.notifyLiveChange(l);const d=this.moreRowsInFlight||this.pendingBlocks.size>0||!this.streamStarted;if(this.moreRowsInFlight=!1,void 0!==(null==e?void 0:e.MORE_ROWS)&&(this.moreRows=e.MORE_ROWS),l){if(void 0!==e.ROWS_COUNT&&void 0===this.serverRowsCount&&(this.serverRowsCount=e.ROWS_COUNT),!d)return this.streamStarted=!0,void this.notifyLiveChange(l);this.accumulate(l),this.refreshPendingDeadlines()}this.streamStarted=!0,this.settleCoveredBlocks(),this.pumpMoreRows()}notifyLiveChange(e){var t,i,a,r,s,o,n,l,d,g,c,h,u,p;const m=(null!==(i=null===(t=e.inserts)||void 0===t?void 0:t.length)&&void 0!==i?i:0)>0||(null!==(r=null===(a=e.deletes)||void 0===a?void 0:a.length)&&void 0!==r?r:0)>0,v=(null!==(o=null===(s=e.updates)||void 0===s?void 0:s.length)&&void 0!==o?o:0)>0;if(m)return F.v.debug("Infinite DATASERVER live change invalidates the cache",{inserts:null!==(l=null===(n=e.inserts)||void 0===n?void 0:n.length)&&void 0!==l?l:0,deletes:null!==(g=null===(d=e.deletes)||void 0===d?void 0:d.length)&&void 0!==g?g:0}),this.reset(),void(null===(c=this.onRowsInvalidatedFunc)||void 0===c||c.call(this,e));v&&(this.accumulate(e),F.v.debug("Infinite DATASERVER live update patched into the cache",{updates:null!==(u=null===(h=e.updates)||void 0===h?void 0:h.length)&&void 0!==u?u:0}),null===(p=this.onRowsUpdatedFunc)||void 0===p||p.call(this,e))}refreshPendingDeadlines(){for(const e of this.pendingBlocks)clearTimeout(e.timer),e.timer=this.createBlockTimer(e)}createBlockTimer(e){return setTimeout(()=>{F.v.warn(`Infinite DATASERVER block ${e.startRow}-${e.endRow} for ${this.resourceName} timed out waiting for rows; resolving with ${this.rowData.size} accumulated row(s).`),this.settleBlock(e,!0)},se.BLOCK_RESOLVE_TIMEOUT_MS)}accumulate(e){var t,i,a;const r=new Map(this.rowData);null===(t=e.inserts)||void 0===t||t.forEach(e=>{const t=null==e?void 0:e[this.rowId];void 0!==t&&r.set(t,e)}),null===(i=e.updates)||void 0===i||i.forEach(e=>{const t=null==e?void 0:e[this.rowId];if(void 0===t)return;const i=r.get(t);r.set(t,i?Object.assign(Object.assign({},i),e):e)}),null===(a=e.deletes)||void 0===a||a.forEach(e=>{const t=null==e?void 0:e[this.rowId];if(void 0===t)return;const i=this.cacheIndexOf(r,t);-1===i||this.deliveredRowCount>0&&i<this.deliveredRowCount||r.delete(t)}),this.rowData=r}cacheIndexOf(e,t){let i=0;for(const a of e.keys()){if(a===t)return i;i+=1}return-1}settleCoveredBlocks(){for(const e of[...this.pendingBlocks])(this.rowData.size>=e.endRow||!1===this.moreRows)&&this.settleBlock(e,!0)}settleBlock(e,t){var i;if(e.settled)return;if(e.settled=!0,this.pendingBlocks.delete(e),clearTimeout(e.timer),!t)return void e.fail();const a=[...this.rowData.values()].slice(e.startRow,e.endRow);this.deliveredRowCount=Math.max(this.deliveredRowCount,e.startRow+a.length);const r=!1===this.moreRows?this.rowData.size:this.hasCriteria?-1:null!==(i=this.serverRowsCount)&&void 0!==i?i:-1;this.warnIfViewTruncated(),F.v.debug("Infinite DATASERVER block settled",{startRow:e.startRow,endRow:e.endRow,rows:a.length,cached:this.rowData.size,lastRow:r}),e.success(a,r),this.deliverRows(e.startRow,a),this.notifyDataAvailability(e.startRow,a.length)}notifyDataAvailability(e,t){var i,a;0!==e||this.detached||(0===t?null===(i=this.onNoDataAvailableFunc)||void 0===i||i.call(this):null===(a=this.onDataAvailableFunc)||void 0===a||a.call(this))}deliverRows(e,t){var i,a;if(this.detached)return;const{withdrawnRowIds:r}=this.ledger.record(e,t);t.length>0&&(null===(i=this.onRowsDeliveredFunc)||void 0===i||i.call(this,t)),r.length>0&&(null===(a=this.onRowsWithdrawnFunc)||void 0===a||a.call(this,r))}warnIfViewTruncated(){var e,t;this.viewTruncationWarned||!1!==this.moreRows||this.hasCriteria||void 0===this.serverRowsCount||this.rowData.size>=this.serverRowsCount||(this.viewTruncationWarned=!0,F.v.warn(`${this.resourceName} stopped at ${this.rowData.size} of ${this.serverRowsCount} rows: the DATASERVER view is capped by MAX_VIEW (${null!==(t=null===(e=this.resourceParams)||void 0===e?void 0:e.MAX_VIEW)&&void 0!==t?t:"server default"}). Raise max-view past the row count to reach the rest.`))}failAllPendingBlocks(){for(const e of[...this.pendingBlocks])this.settleBlock(e,!1)}reset(){this.teardownDataserverSubscription()}teardownDataserverSubscription(){var e;this.failAllPendingBlocks(),null===(e=this.dataserverStreamSubscription)||void 0===e||e.unsubscribe(),this.dataserverStreamSubscription=void 0,this.dataserverStream=void 0,this.subscriptionKey=void 0,this.sourceRef=void 0,this.rowData=new Map,this.deliveredRowCount=0,this.streamStarted=!1,this.serverRowsCount=void 0,this.hasCriteria=!1,this.viewTruncationWarned=!1,this.moreRows=void 0,this.moreRowsInFlight=!1}destroy(){this.teardownDataserverSubscription(),this.ledger.clear(),F.v.debug("GenesisInfiniteDatasource destroyed")}detach(){this.detached=!0,this.loadGeneration+=1,this.rowCacheKey=void 0,this.destroy(),F.v.debug("GenesisInfiniteDatasource detached by its host")}}se.BLOCK_RESOLVE_TIMEOUT_MS=1e4,se.HTTP_NOT_FOUND=404;var oe=i(62922);let ne=class extends((0,n.S)(ee.ML)){constructor(){super(...arguments),this.request={},this.onDatasourceReady=e=>(0,r.sH)(this,void 0,void 0,function*(){if(!(yield this.initializeDatasource(this.datasourceOptions(),!0,!1)))return F.v.debug(`Genesis Datasource init failed for ${this.resourceName}`),this.clearRowData(),void this.setDisconnected(!0);if(!this.isInfiniteSupportedForResource())return void this.clearRowData();this.$emit(Q.V.dataInit),this.setDisconnected(!1),this.indexes=this.getResourceIndexes(this.datasource.availableIndexes,this.datasource.availableSortableFields);const e=(0,K.X)(this.datasource.originalFieldDef),t=yield this.getAgColumnDefs(e);this.$emit(Z.c.schemaUpdated,{schema:t,metadata:e}),this.infiniteDatasource=new se({createSnapshotFunc:this.createSnapshot.bind(this),createDataserverStreamFunc:this.createDataserverStream.bind(this),getMoreRowsFunc:e=>this.connect.getMoreRows(e,0),onRowsDeliveredFunc:this.reportDeliveredRows.bind(this),onRowsWithdrawnFunc:this.reportWithdrawnRows.bind(this),onRowCacheResetFunc:()=>this.clearRowData(!1),onRowsInvalidatedFunc:this.handleLiveRowsInvalidated.bind(this),onRowsUpdatedFunc:this.handleLiveRowsUpdated.bind(this),onNoDataAvailableFunc:()=>this.$emit(Z.c.noDataAvailable),onDataAvailableFunc:()=>this.$emit(Z.c.loadingFinished),errorHandlerFunc:this.handleErrors.bind(this),resourceName:this.resourceName,resourceParams:this.isRequestServer?this.datasource.requestOnlyParams:this.datasource.dataserverOnlyParams,resourceIndexes:this.indexes,resourceColDefs:this.datasource.originalFieldDef,maxRows:+this.maxRows,rowId:this.rowId,baseCriteria:this.buildCriteria(),isRequestServer:this.isRequestServer,defaultOrderBy:this.orderBy,defaultReverse:this.reverse}),this.$emit(Z.c.setInfiniteDatasource,{datasource:this.infiniteDatasource}),this.setupCommitTriggeredRefresh(),this.$emit(Z.c.addGridCssClass,{className:"grid-pro-infinite"}),this.$emit(Z.c.filtersRestored)})}resourceNameChanged(e,t){e&&e!==t&&g.DOM.queueUpdate(()=>(0,r.sH)(this,void 0,void 0,function*(){yield this.restart()}))}criteriaChanged(e,t){const i=e!==(0,X.Q)(t,";");this.infiniteDatasource&&i&&g.DOM.queueUpdate(()=>(0,r.sH)(this,void 0,void 0,function*(){yield this.reloadResourceData()}))}connectedCallback(){super.connectedCallback();const e=this.shouldRunConnect;g.DOM.queueUpdate(()=>{e&&(this.init(),this.subscribeToConnection(),this.subscribeToFilterChanges())})}disconnectedCallback(){super.disconnectedCallback();const e=this.shouldRunDisconnect;g.DOM.queueUpdate(()=>(0,r.sH)(this,void 0,void 0,function*(){e&&(yield this.destroy(),this.unsubscribeFromConnection(),this.unsubscribeFromFilterChanges())}))}subscribeToFilterChanges(){this.unsubscribeFromFilterChanges(),this.filterSub=this.update.pipe((0,W.i)(1),(0,J.B)(600)).subscribe(()=>{this.infiniteDatasource&&this.reloadResourceData()})}unsubscribeFromFilterChanges(){var e;null===(e=this.filterSub)||void 0===e||e.unsubscribe(),this.filterSub=void 0}deepClone(){const e=super.deepClone();return e.deferredGridOptions=structuredClone(this.deferredGridOptions),e.deferredColumnStates=structuredClone(this.deferredColumnStates),e}reloadResourceData(){return(0,r.sH)(this,void 0,void 0,function*(){var e,t;null===(t=null===(e=this.infiniteDatasource)||void 0===e?void 0:e.detach)||void 0===t||t.call(e),this.infiniteDatasource=void 0,this.datasource.destroy(),this.$emit(Z.c.cacheFilterConfig),this.clearRowData(!1),this.setDisconnected(!1),this.$emit(Z.c.refreshInfiniteCache,{purge:!0}),yield this.init()})}init(){return(0,r.sH)(this,void 0,void 0,function*(){const e=Object.assign({getRowId:e=>e.data?String(e.data[this.rowId]):null,cacheBlockSize:this.maxRows,defaultColDef:{filter:!0,resizable:!0,sortable:!1,unSortIcon:!0},rowBuffer:0,rowModelType:"infinite",suppressMultiSort:!0,cacheOverflowSize:2,maxConcurrentDatasourceRequests:1,infiniteInitialRowCount:1,maxBlocksInCache:10},this.deferredGridOptions);this.$emit(Z.c.initialize,{options:e,keepColDefsOnClearRowData:this.keepColDefsOnClearRowData}),this.clearReadyListener(),this.addEventListener(Z.c.ready,this.onDatasourceReady,{once:!0}),this.resourceName||this.handleErrors("Application not connected or invalid resource name, datasource will not work.","unknown")})}clearReadyListener(){this.removeEventListener(Z.c.ready,this.onDatasourceReady)}isInfiniteSupportedForResource(){return!(this.isRequestServer&&!this.datasource.criteriaOnlyRequest)||(this.handleErrors(`Infinite row model is not supported for the REQUEST_SERVER resource '${this.resourceName}' because it does not support criteria-only requests. Set 'criteriaOnlyRequest = true' on the request reply definition, or use a client-side datasource for this resource.`,"resource-type"),!1)}handleLiveRowsInvalidated(e){this.reportLiveChange(e),this.$emit(Z.c.refreshInfiniteCache,{purge:!0})}handleLiveRowsUpdated(e){this.reportLiveChange(e),this.$emit(Z.c.refreshInfiniteCache,{purge:!1})}reportLiveChange(e){const t=this.resetTransaction();this.handleStreamUpdates(e.updates),this.handleStreamDeletes(e.deletes),this.emitTransaction(t)}destroy(){return(0,r.sH)(this,void 0,void 0,function*(){var e,t;this.clearReadyListener(),this.teardownCommitTriggeredRefresh(),this.$emit(Z.c.removeGridCssClass,{className:"grid-pro-infinite"}),this.datasource.destroy(),this.clearRowData(),this.infiniteDatasource&&(null===(t=(e=this.infiniteDatasource).detach)||void 0===t||t.call(e),this.infiniteDatasource=void 0),this.$emit(Z.c.setInfiniteDatasource,{datasource:null})})}restart(){return(0,r.sH)(this,void 0,void 0,function*(){yield this.destroy(),yield this.init()})}clearRowData(e=!0){this.rowData=new Map,this.resetTransaction(),this.$emit(Z.c.dataCleared,{includeSchema:e})}setupCommitTriggeredRefresh(){var e;this.teardownCommitTriggeredRefresh(),!this.isSnapshot&&this.isRequestServer&&(null===(e=this.pollTriggerEvents)||void 0===e?void 0:e.length)&&(this.commitResponseUnsubscribe=this.connectEvents.addCommitResponseListener(e=>{var t;const{eventName:i,response:a}=e.detail;this.pollTriggerEvents.includes(i)&&(null===(t=a.MESSAGE_TYPE)||void 0===t?void 0:t.endsWith("_ACK"))&&(F.v.debug(`Commit ACK for ${i}, re-reading the loaded blocks.`),this.$emit(Z.c.refreshInfiniteCache,{purge:!1}))}))}teardownCommitTriggeredRefresh(){var e;null===(e=this.commitResponseUnsubscribe)||void 0===e||e.call(this),this.commitResponseUnsubscribe=void 0}createSnapshot(){return(0,r.sH)(this,arguments,void 0,function*(e=null){return yield this.datasource.snapshot(e)})}createDataserverStream(e=null){return this.connect.stream(this.resourceName,()=>{},e=>{var t;F.v.error("Infinite DATASERVER paged stream error:",e),this.handleErrors((null===(t=null==e?void 0:e.receivedMessage)||void 0===t?void 0:t.ERROR)||(null==e?void 0:e.message),"stream")},e)}getAgColumnDefs(e){return(0,r.sH)(this,void 0,void 0,function*(){const t=this.generateColumnDefsFromMetadata(e,oe.O,oe.c),i=new Set;return this.indexes.forEach((e,t)=>{t&&e.forEach(e=>i.add(e))}),t.forEach(e=>{e.sortable=this.isRequestServer||i.has(e.field),this.datasource.criteriaOnlyRequest&&(e.filter=this.datasource.availableCriteriaFields.includes(e.field)?e.filter:null)}),t})}loadMore(){F.v.warn("loadMore() is not needed for Infinite Row Model - scrolling triggers data loading automatically")}};(0,r.Cg)([q.dm],ne.prototype,"connect",void 0),(0,r.Cg)([j.a4],ne.prototype,"connectEvents",void 0),(0,r.Cg)([Y.yW],ne.prototype,"datasource",void 0),(0,r.Cg)([g.observable],ne.prototype,"request",void 0),ne=(0,r.Cg)([(0,g.customElement)({name:"grid-pro-infinite-datasource"})],ne);var le=i(18070),de=i(30335),ge=i(26062),ce=i(32610),he=i(98884),ue=i(82128),pe=i(55365),me=i(53397),ve=i(52540),fe=i(49104),be=i(88863),ye=i(71964),Ce=i(73203),Se=i(50103),we=i(23201);(0,o.N)(ge.D,V.L,U.X,ne,v.O,x.G,B.X),h.syG.registerModules([h.n76,h.Q90,h.x6L,h.YN8,h.YzW,h.Lt,h.I95,h.O4V,h.H18,h.lvV,h.mfG,h.Iws,h.nSw,h.FUS,h.Ss0,h.tkg,h.ZDV,h.ZyC,h.XG7,h.VZy,h.$I9,h.dGu,h.AJG,h.c5B,h.BG,h.KIB,h.Sko,h.ZuP,h.Vc,z.JE]);const Re="gridReady";class Ee extends((0,n.S)(c.FoundationElement)){getColumnDragBridge(){return this.columnDragBridge}rowDataChanged(e,t){this.initialised&&this.gridApi&&this.gridApi.setGridOption("rowData",t)}gridSlotChanged(){this.gridSlot&&!this.initialised&&this.agGridOptions&&this.initGrid()}enableColumnSelectionChanged(){this.syncColumnSelectionHostLayout()}getfilterModel(){return(0,r.sH)(this,void 0,void 0,function*(){if(!this.persistFilterModelKey)return this._filterConfig;return yield this.statePersistence.getFilterModel(this.persistFilterModelKey)})}setFilterModel(e){return(0,r.sH)(this,void 0,void 0,function*(){this.persistFilterModelKey?yield this.statePersistence.saveFilterModel(this.persistFilterModelKey,e):this._filterConfig=e})}constructor(){super(),this.gridErrorItems=[],this.disposed=!1,this.debouncedSaveColumnState=m()(this.saveColumnState.bind(this),400),this.debouncedSaveFilterModel=m()(this.cacheFilterConfig.bind(this),400),this.debouncedNotifyDatasourceVisibleColumns=m()(this.notifyDatasourceVisibleColumns.bind(this),400),this.autoCellRendererByType=!1,this.onlyTemplateColDefs=!1,this.gridAutosizingEnabled=!1,this.enableCellFlashing=!1,this.enableRowFlashing=!1,this.columnDragBridge={},this.columnComponentName="grid-pro-column",this.themeMode="dark",this.statusBarConfig=pe.o2,this.withStatusBar=!1,this.enableColumnSelection=!1,this.applyingDatasourceGridOptions=!1,this.rehydrationAttempted=!1,this.rootEventsListeners=[],this.datasourceEventHandlers=[],this.gridEventsQueue=[],this.registeredGridEvents=new Set,this.gridEventListeners=new Map,this.boundGlobalEventListener=this.globalEventListener.bind(this),this._filterConfig=void 0,this.handleLuminanceChange=e=>{const t=d.baseLayerLuminance.getValueFor(e.target);this.themeMode=t===d.StandardLuminance.DarkMode?"dark":"light"},this.luminanceObserver={handleChange:e=>this.handleLuminanceChange(e)},this.agAttributes={},this.agPropertiesMap=ce.zI.reduce((e,t)=>(e[t.toLowerCase()]=t,e[(0,Se.w)(t)]=t,e),{});const e=this.hideDatasourceError.bind(this);this.rootEventsListeners.push([Q.V.dataInit,e],[ce.yY.datasourceErrorClose,e],[le.L.error,this.handleBaseDatasourceError.bind(this)],[le.L.connected,e]),this.datasourceEventHandlers=[[Z.c.initialize,this.handleInitialize.bind(this)],[Z.c.dataLoaded,this.handleDataLoaded.bind(this)],[Z.c.dataChanged,this.handleDataChanged.bind(this)],[Z.c.schemaUpdated,this.handleSchemaUpdated.bind(this)],[Z.c.dataCleared,this.handleDataCleared.bind(this)],[Z.c.loadingStarted,this.handleLoadingStarted.bind(this)],[Z.c.loadingFinished,this.handleLoadingFinished.bind(this)],[Z.c.noDataAvailable,this.handleNoDataAvailable.bind(this)],[Z.c.filtersRestored,this.handleFiltersRestored.bind(this)],[Z.c.moreDataAvailable,this.handleMoreDataAvailable.bind(this)],[Z.c.error,this.handleDatasourceError.bind(this)],[Z.c.destroy,this.handleDatasourceDestroy.bind(this)],[Z.c.cacheFilterConfig,this.cacheFilterConfig.bind(this)],[Z.c.refreshServerSide,this.handleRefreshServerSide.bind(this)],[Z.c.setServerSideDatasource,this.handleSetServerSideDatasource.bind(this)],[Z.c.addGridCssClass,this.handleAddGridCssClass.bind(this)],[Z.c.removeGridCssClass,this.handleRemoveGridCssClass.bind(this)],[Z.c.applyServerSideTransaction,this.handleApplyServerSideTransaction.bind(this)],[Z.c.setInfiniteDatasource,this.handleSetInfiniteDatasource.bind(this)],[Z.c.refreshInfiniteCache,this.handleRefreshInfiniteCache.bind(this)]]}addEventListener(e,t,i){super.addEventListener(e,t,i),this.gridApi?this.addGridEventListener(e):this.gridEventsQueue.includes(e)||this.gridEventsQueue.push(e)}addGridEventListener(e){if(this.registeredGridEvents.has(e))return;this.registeredGridEvents.add(e);const t=t=>{this.$emit(e,t)};this.gridEventListeners.set(e,t),this.gridApi.addEventListener(e,t)}handleError(e,t){this.gridErrorItems=[...this.gridErrorItems,{detail:t.detail,type:e}]}handleBaseDatasourceError(e){const t={detail:{message:e.detail.message},type:ce.Ie.datasource};this.gridErrorItems=[...this.gridErrorItems,{detail:t.detail,type:t.type}]}hideDatasourceError(){this.gridErrorItems=this.gridErrorItems.filter(e=>e.type!==ce.Ie.datasource),this.removeAttribute("ds-disconnected")}connectedCallback(){var e;super.connectedCallback(),this.syncColumnSelectionHostLayout(),this.disposed=!1;const t=null!==(e=this.provider)&&void 0!==e?e:this;this.luminanceSubscription=d.baseLayerLuminance.subscribe(this.luminanceObserver,t),this.gridAutosizingEnabled&&(this.visibilityObserverCleanup=(0,l.j)(this,e=>{e&&this.debouncedColumnAutosize()})),this.rehydrationAttempted=!1,this.shouldRunConnect&&(this.rootEventsListeners.forEach(([e,t])=>{this.addEventListener(e,t)}),ce.zI.forEach(e=>{const t=function(e,t){let i=Object.getPrototypeOf(e);for(;i&&i!==HTMLElement.prototype;){const e=Object.getOwnPropertyDescriptor(i,t);if(e)return e;i=Object.getPrototypeOf(i)}}(this,e);Object.defineProperty(this,e,{get:null==t?void 0:t.get,set:i=>{var a,r;const s=null===(a=null==t?void 0:t.get)||void 0===a?void 0:a.call(this);null===(r=null==t?void 0:t.set)||void 0===r||r.call(this,i),this.agAttributeChangedCallback((0,Se.w)(e),s,i)},enumerable:!0,configurable:!0})}),this.toggleDatasourceEventListeners(!0))}disconnectedCallback(){var e;this.disposed=!0,this.debouncedSaveColumnState.cancel(),this.debouncedSaveFilterModel.cancel();const t=null!==(e=this.provider)&&void 0!==e?e:this;d.baseLayerLuminance.unsubscribe(this.luminanceObserver,t),this.luminanceSubscription&&(this.luminanceSubscription.unsubscribe(),this.luminanceSubscription=void 0),this.visibilityObserverCleanup&&(this.visibilityObserverCleanup(),this.visibilityObserverCleanup=void 0),super.disconnectedCallback(),this.rehydrationAttempted=!1;const i=this.shouldRunDisconnect;this.rootEventsListeners.forEach(([e,t])=>{this.removeEventListener(e,t)}),i?this.performDisconnectCleanup():queueMicrotask(()=>{this.isConnected||this.performDisconnectCleanup()})}syncColumnSelectionHostLayout(){this.classList.toggle("has-column-selection",this.enableColumnSelection)}performDisconnectCleanup(){this.debounced&&(clearTimeout(this.debounced),this.debounced=null),this.initialised=!1,this.resetGridOptionsState(),this.destroyGridInstance(),this.toggleDatasourceEventListeners(!1),this.debouncedSaveColumnState.cancel(),this.debouncedSaveFilterModel.cancel(),this.registeredGridEvents.clear(),this.gridEventsQueue=[]}destroyGridInstance(){this.gridApi&&this.gridEventListeners.forEach((e,t)=>{this.gridApi.removeEventListener(t,e)}),this.gridEventListeners.clear(),this.gridApi?this.gridApi.destroy():this.agGrid&&this.agGrid.destroy(),this.gridSlot&&this.gridSlot.replaceChildren(),this.gridApi=void 0,this.agGrid=void 0}toggleDatasourceEventListeners(e){const t=e?"addEventListener":"removeEventListener";this.datasourceEventHandlers.forEach(([e,i])=>{super[t](e,i)})}handleInitialize(e){const{options:t,keepColDefsOnClearRowData:i}=e.detail;i&&(this.columnState=this.gridApi.getColumnState()),this.applyingDatasourceGridOptions=!0;try{this.gridOptions=Object.assign(Object.assign(Object.assign({},this.userProvidedGridOptions),t),i?{columnDefs:this.gridApi.getColumnDefs()}:{}),this.initGrid()}finally{this.applyingDatasourceGridOptions=!1}}handleDataLoaded(e){const{data:t}=e.detail;this.gridApi&&this.gridApi.setGridOption("rowData",t)}handleDataChanged(e){const{changes:t}=e.detail;if(!this.gridApi||!this.isClientSideRowModel)return;const i=this.gridApi.applyTransaction(t);this.flashAddedCells(null==i?void 0:i.add)}get isClientSideRowModel(){var e,t,i;return"clientSide"===(null!==(i=null===(t=null===(e=this.gridApi)||void 0===e?void 0:e.getGridOption)||void 0===t?void 0:t.call(e,"rowModelType"))&&void 0!==i?i:"clientSide")}flashAddedCells(e){this.enableRowFlashing&&(null==e?void 0:e.length)&&this.gridApi.flashCells({rowNodes:e})}handleSchemaUpdated(e){return(0,r.sH)(this,void 0,void 0,function*(){this.gridApi?yield this.processSchemaUpdate(e.detail):this.pendingSchemaUpdate=e.detail})}processSchemaUpdate(e){return(0,r.sH)(this,arguments,void 0,function*({schema:e}){const t=this.gridApi.getColumnDefs();if(t&&t.length>0)return;this.applyCommunityFilterFallbacks(e);const i=yield this.mergeAllColumnDefsAndStates(e,!0);this.gridApi.setGridOption("columnDefs",i),this.restoreCachedFilterConfig()})}applyCommunityFilterFallbacks(e){const t=this.gridApi.isModuleRegistered("SetFilterModule"),i=this.gridApi.isModuleRegistered("MultiFilterModule");e.forEach(e=>{var r,s,o,n,l;if("agSetColumnFilter"===e.filter&&!t)return F.v.debug(`SetFilterModule is not registered; column '${e.field}' falls back to the enum filter`),e.filter=a.enumFilter,void(null!==(r=e.floatingFilterComponent)&&void 0!==r||(e.floatingFilterComponent=a.enumFloatingFilter));if("agMultiColumnFilter"!==e.filter)return;const d=null===(o=null===(s=e.filterParams)||void 0===s?void 0:s.filters)||void 0===o?void 0:o.find(e=>"agSetColumnFilter"===e.filter);i?!t&&d&&(F.v.debug(`SetFilterModule is not registered; the set sub-filter of column '${e.field}' falls back to the enum filter`),d.filter=a.enumFilter):(null===(n=null==d?void 0:d.filterParams)||void 0===n?void 0:n.values)?(F.v.debug(`MultiFilterModule is not registered; enum column '${e.field}' falls back to the enum filter`),e.filter=a.enumFilter,e.filterParams=Object.assign({},d.filterParams),null!==(l=e.floatingFilterComponent)&&void 0!==l||(e.floatingFilterComponent=a.enumFloatingFilter)):(F.v.warn("MultiFilterModule is not registered, falling back to text filter"),e.filter="agTextColumnFilter")})}handleDataCleared(e){const{includeSchema:t}=e.detail;this.gridApi&&(t&&this.gridApi.setGridOption("columnDefs",[]),this.isClientSideRowModel&&this.gridApi.setGridOption("rowData",[]),this.gridApi.refreshCells({force:!0}))}handleLoadingStarted(){this.gridApi&&this.gridApi.setGridOption("loading",!0)}handleLoadingFinished(){this.gridApi&&(this.gridApi.setGridOption("loading",!1),this.gridApi.hideOverlay())}handleNoDataAvailable(){this.gridApi&&(this.gridApi.setGridOption("loading",!1),this.gridApi.showNoRowsOverlay())}handleFiltersRestored(){this.restoreCachedFilterConfig()}handleMoreDataAvailable(e){var t,i,a,r;const{hasMoreData:s,sourceRef:o}=e.detail;if(!this.gridApi)return;const n=null===(i=(t=this.gridApi).getStatusPanel)||void 0===i?void 0:i.call(t,pe.k7.loadMore);n&&(null===(r=(a=n).updateParams)||void 0===r||r.call(a,{moreRows:s,sourceRef:o}))}handleDatasourceError(){this.setAttribute("ds-disconnected","ds-disconnected")}handleDatasourceDestroy(){this.clearLocalGridOptions()}handleRefreshServerSide(e){const{purge:t}=e.detail;this.gridApi&&this.gridApi.refreshServerSide({purge:t})}handleSetServerSideDatasource(e){const{datasource:t}=e.detail;this.gridApi&&this.gridApi.setGridOption("serverSideDatasource",t)}handleAddGridCssClass(e){var t;const{className:i}=e.detail,a=(null===(t=this.gridSlot)||void 0===t?void 0:t.parentElement)||this;a&&a.classList.add(i)}handleRemoveGridCssClass(e){var t;const{className:i}=e.detail,a=(null===(t=this.gridSlot)||void 0===t?void 0:t.parentElement)||this;a&&a.classList.remove(i)}handleApplyServerSideTransaction(e){var t,i;const{transaction:a,async:r,callback:s}=e.detail;if(this.gridApi)if(r)this.gridApi.applyServerSideTransactionAsync(a,e=>{var t,i;this.flashAddedCells([...null!==(t=null==e?void 0:e.add)&&void 0!==t?t:[],...null!==(i=null==e?void 0:e.update)&&void 0!==i?i:[]]),null==s||s(e)});else{const e=this.gridApi.applyServerSideTransaction(a);this.flashAddedCells([...null!==(t=null==e?void 0:e.add)&&void 0!==t?t:[],...null!==(i=null==e?void 0:e.update)&&void 0!==i?i:[]]),s&&s(e)}}handleSetInfiniteDatasource(e){const{datasource:t}=e.detail;this.gridApi&&this.gridApi.setGridOption("datasource",t)}handleRefreshInfiniteCache(e){var t;this.gridApi&&((null===(t=e.detail)||void 0===t?void 0:t.purge)?this.gridApi.purgeInfiniteCache():this.gridApi.refreshInfiniteCache())}combineAllGridComponents(e){const t={[pe.IX.action]:w.eA,[pe.IX.actionsMenu]:R.cN,[pe.IX.boolean]:E._Y,[pe.IX.editable]:A.YM,[pe.IX.icon]:k.Jt,[pe.IX.statusPill]:D.N7,[pe.IX.select]:O.gs,[pe.IX.selectEditor]:f._Q,[pe.IX.numberEditor]:b.Z0,[pe.IX.multiselectEditor]:y.pZ,[pe.IX.dateEditor]:C.S8,[pe.IX.stringEditor]:S.XJ,[a.enumFilter]:M,[a.enumFloatingFilter]:N,[pe.k7.labelValue]:ve.k,[pe.k7.loadMore]:fe.s,[pe.k7.reload]:be.W,[pe.k7.rowCount]:ye.i};return Object.assign(Object.assign(Object.assign({},t),e),this.gridComponents)}statePersistanceEnabled(){return!(!this.persistColumnStateKey||0===this.persistColumnStateKey.length)}getSelectedRows(){var e,t,i,a;try{if(!this.initialised||!this.gridApi)return[];const r=null===(e=this.gridOptions)||void 0===e?void 0:e.rowSelection;if("single"===r||"multiple"===r)return this.gridApi.getSelectedRows&&this.gridApi.getSelectedRows().length>0?this.gridApi.getSelectedRows():[];if((null===(t=this.gridApi)||void 0===t?void 0:t.getCellRanges)&&this.gridApi.getCellRanges().length>0)return this.getCellRangeRowData();if(!(null===(i=this.gridOptions)||void 0===i?void 0:i.enableRangeSelection)){const e=null===(a=this.gridApi)||void 0===a?void 0:a.getFocusedCell();if(e){const t=this.gridApi.getDisplayedRowAtIndex(e.rowIndex);if(null==t?void 0:t.data)return[t.data]}}return[]}catch(e){return F.v.error("Grid Pro: Error getting selected rows:",e),[]}}getCellRangeRowData(){var e;if(!(null===(e=this.gridApi)||void 0===e?void 0:e.getCellRanges))return[];const t=this.gridApi.getCellRanges();if(0===t.length)return[];const i=[];return t.forEach(e=>{const t=e.startRow.rowIndex,a=e.endRow.rowIndex;for(let e=t;e<=a;e+=1){const t=this.gridApi.getDisplayedRowAtIndex(e);(null==t?void 0:t.data)&&!i.some(e=>e===t.data)&&i.push(t.data)}}),i}hasSelectedRows(){return this.getSelectedRows().length>0}updateLabelValueStatusBar(e){var t,i;if(!this.gridApi)return void F.v.warn("Grid Pro: Cannot update label-value status bar - grid API not available");const a=null===(i=(t=this.gridApi).getStatusPanel)||void 0===i?void 0:i.call(t,pe.k7.labelValue);a&&"function"==typeof a.updateParams?a.updateParams(e):F.v.warn("Grid Pro: Label-value status bar component not found or updateParams method not available")}debouncedColumnAutosize(){this.gridAutosizingEnabled&&(this.debounced&&(clearTimeout(this.debounced),this.debounced=null),this.debounced=setTimeout(()=>{var e;null===(e=this.gridApi)||void 0===e||e.sizeColumnsToFit()},ce.BW))}removeConfigWidthsToAutosize(e){return e.map(e=>Object.assign(Object.assign({},e),{width:null}))}saveColumnState(){return(0,r.sH)(this,void 0,void 0,function*(){if(this.rehydrationAttempted&&this.statePersistanceEnabled()){let e=this.gridApi.getColumnState();e=(0,we.n7)(e),e=this.gridAutosizingEnabled?this.removeConfigWidthsToAutosize(e):e;const t=0===e.filter(e=>{if(e.hide)return!1;const t=this.gridApi.getColumn(e.colId);return Boolean(t.getColDef().headerName)}).length;if(0===e.length||JSON.stringify(e)===JSON.stringify(this.columnState)||t)return;yield this.statePersistence.saveColumnState(this.persistColumnStateKey,e),this.columnState=e}})}getSavedColumnState(){return(0,r.sH)(this,void 0,void 0,function*(){return this.columnState=[],this.statePersistanceEnabled()&&(this.columnState=yield this.statePersistence.getColumnState(this.persistColumnStateKey)),this.columnState})}restoreColumnState(){return(0,r.sH)(this,void 0,void 0,function*(){var e;this.rehydrationAttempted=!0;const t=yield this.getSavedColumnState(),i=(0,we.n7)(t);i&&i.length>0&&(null===(e=this.gridApi)||void 0===e||e.applyColumnState({state:i,applyOrder:!0}))})}cacheFilterConfig(){var e;this.setFilterModel((null===(e=this.gridApi)||void 0===e?void 0:e.getFilterModel())||void 0)}restoreCachedFilterConfig(){return(0,r.sH)(this,void 0,void 0,function*(){var e,t;const i=yield this.getfilterModel();void 0!==i&&(null===(e=this.gridApi)||void 0===e||e.setFilterModel(i),null===(t=this.gridApi)||void 0===t||t.onFilterChanged())})}get gridOptions(){return this.agGridOptions}get isServerSide(){return this.gridProDatasource instanceof U.X}get gridParams(){return{globalListener:this.boundGlobalEventListener,modules:[z.JE,h.Vc,h.ZuP]}}get gridProDatasource(){return this.querySelector("grid-pro-genesis-datasource")||this.querySelector("grid-pro-client-side-datasource")||this.querySelector("grid-pro-server-side-datasource")||this.querySelector("grid-pro-infinite-datasource")}get isInfiniteRowModel(){return this.gridProDatasource instanceof ne}notifyDatasourceVisibleColumns(){var e,t,i,a;const r=this.gridProDatasource;if(!r)return;const s=(0,T.C)(null===(t=null===(e=this.gridApi)||void 0===e?void 0:e.getAllDisplayedColumns)||void 0===t?void 0:t.call(e),null===(a=null===(i=this.gridApi)||void 0===i?void 0:i.getColumnDefs)||void 0===a?void 0:a.call(i));s.length&&r.setVisibleColumns(s)}set gridOptions(e){!this.applyingDatasourceGridOptions&&e&&(this.userProvidedGridOptions=Object.assign({},e));const t=()=>{!this.disposed&&this.isConnected&&(this.debouncedSaveColumnState(),this.debouncedColumnAutosize())},i=()=>{!this.disposed&&this.isConnected&&this.debouncedNotifyDatasourceVisibleColumns()};Array.from(this.attributes).forEach(e=>{const t=this.agPropertiesMap[e.name];t&&(this.agAttributes[t]=e.value)});const{columnDefs:a,components:s,defaultColDef:o,getRowId:n,onGridReady:l,onFilterChanged:d,onFirstDataRendered:g}=e,c=(0,r.Tt)(e,["columnDefs","components","defaultColDef","getRowId","onGridReady","onFilterChanged","onFirstDataRendered"]),h=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.gridOptionsConfig),{defaultColDef:Object.assign({enableCellChangeFlash:this.enableCellFlashing,filter:!0,resizable:!0,sortable:!0},o),components:this.combineAllGridComponents(s),headerHeight:this.headerHeight,rowHeight:this.rowHeight,animateRows:!1,suppressDragLeaveHidesColumns:!0}),this.eventsAndCallbacks),{onGridReady:e=>(0,r.sH)(this,void 0,void 0,function*(){var t,i,a;if(this.gridApi=e.api,this.gridEventsQueue.length&&this.gridEventsQueue.forEach(e=>{this.addGridEventListener(e)}),this.pendingSchemaUpdate){const e=this.pendingSchemaUpdate;this.pendingSchemaUpdate=void 0;try{yield this.processSchemaUpdate(e)}catch(e){F.v.error("Grid Pro: failed to apply the pending schema update on grid ready:",e)}}this.rowData&&this.gridApi.setGridOption("rowData",this.rowData),l&&l(e),(null===(t=this.gridProDatasource)||void 0===t?void 0:t.keepColDefsOnClearRowData)&&(null===(i=this.columnState)||void 0===i?void 0:i.length)>0&&this.gridApi.applyColumnState({state:this.columnState,applyOrder:!0}),this.$emit(Re,{event:e,gridId:this.id}),this.$emit(pe.mr,{event:e,gridId:this.id}),this.notifyDatasourceVisibleColumns(),null===(a=this.gridProDatasource)||void 0===a||a.$emit(Z.c.ready),this.restoreColumnState(),this.restoreCachedFilterConfig(),this.debouncedColumnAutosize()}),onFirstDataRendered:e=>{this.notifyDatasourceVisibleColumns(),g&&g(e)},onColumnPinned:t,onColumnResized:t,onColumnMoved:t,onColumnVisible:()=>{t(),i()},onDisplayedColumnsChanged:()=>{t(),i()},onFilterChanged:e=>{!this.disposed&&this.isConnected&&(this.debouncedSaveFilterModel(),d&&d(e))},onGridSizeChanged:t,onSortChanged:t}),c);this.gridProDatasource?(h.columnDefs=a,h.getRowId=n,this.setupStatusBar(h),this.setLocalGridOptions(h)):this.mergeAllColumnDefsAndStates(a).then(e=>{!this.disposed&&this.isConnected&&(h.columnDefs=e,h.getRowId=n,this.setupStatusBar(h),this.setLocalGridOptions(h),this.initGrid())})}setLocalGridOptions(e){this.agGridOptions=Object.assign(Object.assign({},this.agGridOptions),(0,ce.Qg)(e,this.agAttributes)),this.agGridOptions.context=Object.assign(Object.assign({},this.agGridOptions.context),{[z.nJ]:this.columnDragBridge}),null==this.agGridOptions.allowDragFromColumnsToolPanel&&(this.agGridOptions.allowDragFromColumnsToolPanel=!0)}clearLocalGridOptions(){this.agGridOptions=void 0}resetGridOptionsState(){this.userProvidedGridOptions=void 0,this.agGridOptions=void 0}initGrid(){g.DOM.queueUpdate(()=>{!this.disposed&&this.isConnected&&this.gridSlot&&(this.initialised&&(this.destroyGridInstance(),this.gridSlot.firstChild&&this.gridSlot.removeChild(this.gridSlot.firstChild)),this.agGrid=(0,h.Dvw)(this.gridSlot,this.agGridOptions,this.gridParams),this.initialised=!0)})}mergeAllColumnDefsAndStates(e){return(0,r.sH)(this,arguments,void 0,function*(e,t=!1){var i;const r=e||[];r.forEach(e=>{if(this.headerCaseType&&e.field&&!e.headerName){const t=u[this.headerCaseType];t?e.headerName=t(e.field):F.v.warn(`Invalid header-case-type attribute value: ${this.headerCaseType}. Please use one of the following: camelCase, capitalCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase.`)}});const s=Array.from(this.querySelectorAll(this.columnComponentName)).map(e=>e.definition).map(e=>{var t,i,s,o,n,l;if(this.enableCellFlashing&&void 0===e.enableCellChangeFlash&&(e.enableCellChangeFlash=!0),"agSetColumnFilter"===e.filter||e.filter===a.enumFilter){if(!(null!=e.filterParams&&"values"in e.filterParams)){const a=null===(t=r.find(t=>t.field===e.field))||void 0===t?void 0:t.filterParams,l=null!==(i=null==a?void 0:a.values)&&void 0!==i?i:null===(n=null===(o=null===(s=null==a?void 0:a.filters)||void 0===s?void 0:s.find(e=>"agSetColumnFilter"===e.filter))||void 0===o?void 0:o.filterParams)||void 0===n?void 0:n.values;l&&(e.filterParams=Object.assign(Object.assign({},e.filterParams),{values:l}))}e.filter===a.enumFilter&&(null!==(l=e.floatingFilterComponent)&&void 0!==l||(e.floatingFilterComponent=a.enumFloatingFilter))}e.editable&&(e.cellRenderer||e.cellRendererSelector||(e.cellRendererSelector=t=>{if(t.data[pe.A7]===e.field)return{component:pe.IX.editable}}),e.tooltipComponent||e.tooltipValueGetter||(e.tooltipComponent=Ce.y,e.tooltipValueGetter=t=>{const i=t.data[pe.h1];if(i&&i.column===e.field)return i.message}),e.cellClassRules||(e.cellClassRules={error:e=>{var t;return(null===(t=e.data[pe.h1])||void 0===t?void 0:t.column)===e.colDef.field}}));const d=r.find(t=>e.field===t.field);return Object.assign(Object.assign({},d),e)}),o=s.map(e=>e.field),n=[...s,...this.onlyTemplateColDefs?[]:r.filter(e=>!o.includes(e.field))];if(this.gridProDatasource&&t){const e=yield this.getSavedColumnState();if((null==e?void 0:e.length)>0)return(0,we.yS)(n,e);if((null===(i=this.gridProDatasource.deferredColumnStates)||void 0===i?void 0:i.length)>0)return(0,we.yS)(n,this.gridProDatasource.deferredColumnStates)}return n})}panelExists(e,t){return t.some(t=>t.statusPanel===e)}addRowCountPanel(e,t){if(this.statusBarConfig&&!0===this.statusBarConfig.rows){const i=this.isServerSide||this.isInfiniteRowModel||"infinite"===(null==t?void 0:t.rowModelType)||"serverSide"===(null==t?void 0:t.rowModelType);if(i)this.panelExists(pe.k7.rowCount,e)||e.push({statusPanel:pe.k7.rowCount,align:"left"});else if(!i){const t="agTotalAndFilteredRowCountComponent";this.panelExists(t,e)||e.push({statusPanel:t,align:"left"})}}}addMaxRowsPanel(e){this.statusBarConfig&&!0===this.statusBarConfig.maxRows&&(this.panelExists(pe.k7.labelValue,e)||e.push({statusPanel:pe.k7.labelValue,statusPanelParams:{label:"Max Rows",value:this.gridProDatasource.maxRows||s.OD.MAX_ROWS_250,hide:!1},align:"left"}))}addAggregationPanel(e){this.statusBarConfig&&!0===this.statusBarConfig.aggregation&&(this.panelExists("agAggregationComponent",e)||e.push({statusPanel:"agAggregationComponent",align:"right"}))}addDatasourcePanels(e){if(this.gridProDatasource){const t=this.gridProDatasource.getDatasourceStatusBarPanels(this.isServerSide||this.isInfiniteRowModel,this.statusBarConfig).filter(t=>!this.panelExists(t.statusPanel,e));e.push(...t)}}setupStatusBar(e){var t,i;if(this.withStatusBar&&this.statusBarConfig){const a=[...(null===(t=e.statusBar)||void 0===t?void 0:t.statusPanels)||[]];this.addRowCountPanel(a,e),this.addMaxRowsPanel(a),this.addAggregationPanel(a),this.addDatasourcePanels(a);const r=((null===(i=e.statusBar)||void 0===i?void 0:i.statusPanels)||[]).filter(e=>!this.panelExists(e.statusPanel,a));a.push(...r),e.statusBar={statusPanels:a}}}get observedAttributes(){const e=ce.zI.map(e=>e.toLowerCase()),t=ce.zI.map(e=>(0,Se.w)(e));return e.concat(t)}agAttributeChangedCallback(e,t,i){var a;if(t===i)return;const r=this.agPropertiesMap[e];r&&(this.agAttributes[r]=i,this.initialised&&(null===(a=this.gridApi)||void 0===a||a.setGridOption(r,i)))}globalEventListener(e,t){const i=e.toLowerCase(),a=new Event(i);a.agGridDetails=t,this.dispatchEvent(a);const r="on"+i;"function"==typeof this[r]&&this[r](a)}}(0,r.Cg)([g.observable],Ee.prototype,"gridApi",void 0),(0,r.Cg)([g.observable],Ee.prototype,"gridErrorItems",void 0),(0,r.Cg)([me.l],Ee.prototype,"statePersistence",void 0),(0,r.Cg)([(0,g.attr)({attribute:"auto-cell-renderer-by-type",mode:"boolean"})],Ee.prototype,"autoCellRendererByType",void 0),(0,r.Cg)([(0,g.attr)({attribute:"only-template-col-defs",mode:"boolean"})],Ee.prototype,"onlyTemplateColDefs",void 0),(0,r.Cg)([(0,g.attr)({mode:"boolean",attribute:"grid-autosizing"})],Ee.prototype,"gridAutosizingEnabled",void 0),(0,r.Cg)([(0,g.attr)({mode:"boolean",attribute:"enable-cell-flashing"})],Ee.prototype,"enableCellFlashing",void 0),(0,r.Cg)([(0,g.attr)({mode:"boolean",attribute:"enable-row-flashing"})],Ee.prototype,"enableRowFlashing",void 0),(0,r.Cg)([(0,g.attr)({attribute:"persist-column-state-key"})],Ee.prototype,"persistColumnStateKey",void 0),(0,r.Cg)([(0,g.attr)({attribute:"persist-filter-model-key"})],Ee.prototype,"persistFilterModelKey",void 0),(0,r.Cg)([(0,g.attr)({attribute:"header-case-type"})],Ee.prototype,"headerCaseType",void 0),(0,r.Cg)([g.observable],Ee.prototype,"rowData",void 0),(0,r.Cg)([g.attr],Ee.prototype,"columnComponentName",void 0),(0,r.Cg)([g.observable],Ee.prototype,"eventsAndCallbacks",void 0),(0,r.Cg)([g.attr],Ee.prototype,"headerHeight",void 0),(0,r.Cg)([g.attr],Ee.prototype,"rowHeight",void 0),(0,r.Cg)([g.observable],Ee.prototype,"classNames",void 0),(0,r.Cg)([g.observable],Ee.prototype,"agGrid",void 0),(0,r.Cg)([g.observable],Ee.prototype,"gridSlot",void 0),(0,r.Cg)([g.observable],Ee.prototype,"themeMode",void 0),(0,r.Cg)([g.observable],Ee.prototype,"gridComponents",void 0),(0,r.Cg)([g.observable],Ee.prototype,"statusBarConfig",void 0),(0,r.Cg)([(0,g.attr)({mode:"boolean",attribute:"with-status-bar"})],Ee.prototype,"withStatusBar",void 0),(0,r.Cg)([(0,g.attr)({mode:"boolean",attribute:"enable-column-selection"})],Ee.prototype,"enableColumnSelection",void 0),(0,r.Cg)([g.observable],Ee.prototype,"customErrorHandlerTemplate",void 0),(0,r.Cg)([pe.lz],Ee.prototype,"gridOptionsConfig",void 0),(0,r.Cg)([g.observable],Ee.prototype,"provider",void 0);const Ae=Ee.compose(Object.assign({baseName:"grid-pro",template:ue.a,styles:g.css`
102
+ `;class N{init(e){var t,i;this.params=e,this.formatLabel=I(e.filterParams),this.eGui=document.createElement("div"),this.eGui.className=_,this.eRoot=this.eGui.attachShadow({mode:"open"}),$.addStylesTo(this.eRoot),this.eSummary=document.createElement("span"),this.eSummary.className=`${_}__summary`,this.eSummary.setAttribute("role","button"),this.eSummary.tabIndex=0,this.eSummary.addEventListener("click",()=>this.params.showParentFilter()),this.eSummary.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.params.showParentFilter())}),this.eRoot.appendChild(this.eSummary),this.eClear=document.createElement("button"),this.eClear.type="button",this.eClear.className=`${_}__clear`,this.eClear.textContent="✕",this.eClear.setAttribute("aria-label","Clear filter"),this.eClear.title="Clear filter",this.eClear.hidden=!0,this.eClear.addEventListener("click",()=>{this.params.parentFilterInstance(e=>{var t,i;null===(i=(t=e).clear)||void 0===i||i.call(t)})}),this.eRoot.appendChild(this.eClear),this.onParentModelChanged(null!==(i=null===(t=e.currentParentModel)||void 0===t?void 0:t.call(e))&&void 0!==i?i:null)}getGui(){return this.eGui}onParentModelChanged(e){const t=L(e,this.formatLabel)||"All";this.eSummary.textContent=t,this.eSummary.title=t,this.eSummary.classList.toggle(`${_}__summary--inactive`,!e),this.eClear.hidden=!e}destroy(){var e;null===(e=this.eGui)||void 0===e||e.remove()}}var B=i(59469),H=i(34713),z=i(30096),V=i(63296),U=i(81876),K=i(48707),X=i(96730),q=i(57963),j=i(24669),Y=i(49964),W=i(10629),J=i(41392),Q=i(90509),Z=i(79270),ee=i(35610),te=i(21281),ie=i(70985),ae=i(88915),re=i(44561);class se{constructor(e){var t;this.defaultReverse=!1,this.loadGeneration=0,this.detached=!1,this.rowData=new Map,this.pendingBlocks=new Set,this.deliveredRowCount=0,this.streamStarted=!1,this.moreRowsInFlight=!1,this.hasCriteria=!1,this.viewTruncationWarned=!1,this.createSnapshotFunc=e.createSnapshotFunc,this.createDataserverStreamFunc=e.createDataserverStreamFunc,this.getMoreRowsFunc=e.getMoreRowsFunc,this.onRowsInvalidatedFunc=e.onRowsInvalidatedFunc,this.onRowsUpdatedFunc=e.onRowsUpdatedFunc,this.onRowsDeliveredFunc=e.onRowsDeliveredFunc,this.onRowsWithdrawnFunc=e.onRowsWithdrawnFunc,this.onRowCacheResetFunc=e.onRowCacheResetFunc,this.errorHandlerFunc=e.errorHandlerFunc,this.ledger=new ae.J(e.rowId),this.resourceName=e.resourceName,this.resourceParams=Object.assign({},e.resourceParams),this.resourceIndexes=e.resourceIndexes,this.resourceColDefs=e.resourceColDefs,this.maxRows=e.maxRows,this.rowId=e.rowId,this.baseCriteria=e.baseCriteria||"",this.isRequestServer=e.isRequestServer,this.defaultOrderBy=e.defaultOrderBy||void 0,this.defaultReverse=null!==(t=e.defaultReverse)&&void 0!==t&&t,this.onNoDataAvailableFunc=e.onNoDataAvailableFunc,this.onDataAvailableFunc=e.onDataAvailableFunc}buildRequestServerParams(e,t,i){const a=Object.assign({},this.resourceParams);return a.DETAILS=Object.assign({},a.DETAILS),a.DETAILS.MAX_ROWS=this.maxRows,a.DETAILS.OFFSET=e,t?a.DETAILS.CRITERIA_MATCH=t:delete a.DETAILS.CRITERIA_MATCH,a.DETAILS.ORDER_BY=i.orderBy||`${this.rowId} ASC`,a}buildDataserverLogonParams(e,t){const i=Object.assign({},this.resourceParams);return i.MAX_ROWS=this.maxRows,delete i.VIEW_NUMBER,e?i.CRITERIA_MATCH=e:delete i.CRITERIA_MATCH,t.orderBy?(i.ORDER_BY=t.orderBy,i.REVERSE=t.reverse):(delete i.ORDER_BY,delete i.REVERSE),i}getLastRow(e,t,i,a){return"MORE_ROWS"in e&&!1===e.MORE_ROWS?t+i:!a&&"ROWS_COUNT"in e&&"number"==typeof e.ROWS_COUNT?e.ROWS_COUNT:-1}getRows(e){return(0,r.sH)(this,void 0,void 0,function*(){var t,i;if(this.detached)return F.v.debug("Infinite getRows ignored: the datasource was detached by its host"),void e.failCallback();F.v.debug("Infinite getRows called",{startRow:e.startRow,endRow:e.endRow,isRequestServer:this.isRequestServer});try{const i=(0,re.P4)(e.filterModel,this.resourceColDefs),a=[this.baseCriteria,i].filter(Boolean).join(" && "),r=this.resolveSortConfig(e.sortModel);if(this.noteRequestKey(a,r),!this.isRequestServer)return void this.getDataserverRows(e,a,r);const s=this.buildRequestServerParams(e.startRow,a,r);F.v.debug("Infinite datasource request params",s);const o=this.loadGeneration,n=yield this.createSnapshotFunc(s);if(o!==this.loadGeneration)return F.v.debug("Infinite REQUEST_SERVER reply discarded: the block cache was reset"),void e.failCallback();if(!n)return void e.failCallback();const l=n.MESSAGE_TYPE;if(l===te.Go.LOGOFF_ACK||l===te.Go.MSG_NACK){const i=l===te.Go.LOGOFF_ACK?`Connection lost to ${this.resourceName}`:`Request rejected by ${this.resourceName}`;return F.v.error(`Infinite REQUEST_SERVER block failed: ${i}`,n),null===(t=this.errorHandlerFunc)||void 0===t||t.call(this,i,"connection"),void e.failCallback()}if("REPLY"in n&&Array.isArray(n.REPLY)){const t=n.REPLY,i=this.getLastRow(n,e.startRow,t.length,Boolean(a));return e.successCallback(t,i),this.deliverRows(e.startRow,t),void this.notifyDataAvailability(e.startRow,t.length)}e.successCallback([],e.startRow),this.notifyDataAvailability(e.startRow,0)}catch(t){F.v.error("Error in infinite getRows:",t),null===(i=this.errorHandlerFunc)||void 0===i||i.call(this,function(e){var t,i,a;if(e instanceof Error)return e.message;if("string"==typeof e)return e;const r=e;for(const e of[r,null==r?void 0:r.receivedMessage]){const i=null===(t=null==e?void 0:e.ERROR)||void 0===t?void 0:t.map(e=>null==e?void 0:e.TEXT).filter(Boolean);if(null==i?void 0:i.length)return i.join("; ")}if("string"==typeof(null==r?void 0:r.message)&&r.message)return r.message;const s=null!==(i=null==r?void 0:r.MESSAGE_TYPE)&&void 0!==i?i:null===(a=null==r?void 0:r.receivedMessage)||void 0===a?void 0:a.MESSAGE_TYPE;if(s)return s;try{return JSON.stringify(e)}catch(t){return String(e)}}(t),"unknown"),e.failCallback()}})}resolveSortConfig(e){const t=function(e,t,i=!1){if(!e||0===e.length)return{orderBy:null,reverse:!1};const a=e[0],r=a.colId,s="desc"===a.sort;if(i)return{orderBy:`${r} ${s?"DESC":"ASC"}`,reverse:!1};for(const[e,i]of t.entries())if(e&&i.includes(r))return{orderBy:e,reverse:s};return F.v.warn(`Column '${r}' is not part of any named INDEX. Server-side sorting is not available for this column.`),{orderBy:null,reverse:!1}}(e,this.resourceIndexes,this.isRequestServer);return t.orderBy||!this.defaultOrderBy?t:{orderBy:this.defaultOrderBy,reverse:this.defaultReverse}}noteRequestKey(e,t){var i;const a=JSON.stringify(Object.assign({criteria:e},t));void 0!==this.rowCacheKey&&this.rowCacheKey!==a&&(this.loadGeneration+=1,this.ledger.clear(),null===(i=this.onRowCacheResetFunc)||void 0===i||i.call(this)),this.rowCacheKey=a,this.isRequestServer||void 0===this.subscriptionKey||this.subscriptionKey===a||this.teardownDataserverSubscription(),this.subscriptionKey=a}getDataserverRows(e,t,i){if(!this.createDataserverStreamFunc||!this.getMoreRowsFunc)return F.v.error("Infinite DATASERVER paging requires a stream and a getMoreRows function"),void e.failCallback();const a=Number.isFinite(Number(e.startRow))?Number(e.startRow):0,r=Number.isFinite(Number(e.endRow))?Number(e.endRow):a+this.maxRows,s={startRow:a,endRow:r,settled:!1,success:e.successCallback,fail:e.failCallback};if(this.streamStarted&&(this.rowData.size>=r||!1===this.moreRows))this.settleBlock(s,!0);else{if(s.timer=this.createBlockTimer(s),this.pendingBlocks.add(s),!this.dataserverStream){const e=this.buildDataserverLogonParams(t,i);return this.hasCriteria=Boolean(e.CRITERIA_MATCH),this.dataserverStream=this.createDataserverStreamFunc(e),void(this.dataserverStreamSubscription=this.dataserverStream.subscribe(e=>this.handleDataserverMessage(e)))}this.pumpMoreRows()}}pumpMoreRows(){this.moreRowsInFlight||!1===this.moreRows||0===this.pendingBlocks.size||this.dataserverStream&&this.dataserverStreamSubscription&&this.sourceRef&&(this.moreRowsInFlight=!0,this.requestMoreRows())}requestMoreRows(){return(0,r.sH)(this,void 0,void 0,function*(){if(this.dataserverStreamSubscription&&this.sourceRef)try{yield this.getMoreRowsFunc(this.sourceRef)}catch(e){if(this.moreRowsInFlight=!1,(null==e?void 0:e.status)===se.HTTP_NOT_FOUND)return F.v.warn(`Infinite DATASERVER paging is not available on this connection (MORE_ROWS answered 404, expected over HTTP/feature.forceHttp). ${this.resourceName} is truncated to the ${this.rowData.size} row(s) already delivered; use a websocket connection, or a REQUEST_SERVER resource, to page further.`),this.moreRows=!1,this.viewTruncationWarned=!0,void this.settleCoveredBlocks();F.v.error("Infinite DATASERVER MORE_ROWS failed:",e),this.failAllPendingBlocks()}else this.moreRowsInFlight=!1})}handleDataserverMessage(e){var t,i,a,r,s,o;const n=null==e?void 0:e.MESSAGE_TYPE;if(n===te.Go.LOGOFF_ACK||n===te.Go.MSG_NACK)return null===(t=this.errorHandlerFunc)||void 0===t||t.call(this,n===te.Go.LOGOFF_ACK?`Connection lost to ${this.resourceName}`:`Authentication failed for ${this.resourceName}`,"connection"),void this.teardownDataserverSubscription();this.sourceRef=null!==(i=null==e?void 0:e.SOURCE_REF)&&void 0!==i?i:this.sourceRef;const l=(null==e?void 0:e.ROW)?(0,ie.R)(e,this.rowId):void 0;if((null!==(r=null===(a=null==l?void 0:l.updates)||void 0===a?void 0:a.length)&&void 0!==r?r:0)>0||(null!==(o=null===(s=null==l?void 0:l.deletes)||void 0===s?void 0:s.length)&&void 0!==o?o:0)>0)return this.streamStarted=!0,void this.notifyLiveChange(l);const d=this.moreRowsInFlight||this.pendingBlocks.size>0||!this.streamStarted;if(this.moreRowsInFlight=!1,void 0!==(null==e?void 0:e.MORE_ROWS)&&(this.moreRows=e.MORE_ROWS),l){if(void 0!==e.ROWS_COUNT&&void 0===this.serverRowsCount&&(this.serverRowsCount=e.ROWS_COUNT),!d)return this.streamStarted=!0,void this.notifyLiveChange(l);this.accumulate(l),this.refreshPendingDeadlines()}this.streamStarted=!0,this.settleCoveredBlocks(),this.pumpMoreRows()}notifyLiveChange(e){var t,i,a,r,s,o,n,l,d,g,c,h,u,p;const m=(null!==(i=null===(t=e.inserts)||void 0===t?void 0:t.length)&&void 0!==i?i:0)>0||(null!==(r=null===(a=e.deletes)||void 0===a?void 0:a.length)&&void 0!==r?r:0)>0,v=(null!==(o=null===(s=e.updates)||void 0===s?void 0:s.length)&&void 0!==o?o:0)>0;if(m)return F.v.debug("Infinite DATASERVER live change invalidates the cache",{inserts:null!==(l=null===(n=e.inserts)||void 0===n?void 0:n.length)&&void 0!==l?l:0,deletes:null!==(g=null===(d=e.deletes)||void 0===d?void 0:d.length)&&void 0!==g?g:0}),this.reset(),void(null===(c=this.onRowsInvalidatedFunc)||void 0===c||c.call(this,e));v&&(this.accumulate(e),F.v.debug("Infinite DATASERVER live update patched into the cache",{updates:null!==(u=null===(h=e.updates)||void 0===h?void 0:h.length)&&void 0!==u?u:0}),null===(p=this.onRowsUpdatedFunc)||void 0===p||p.call(this,e))}refreshPendingDeadlines(){for(const e of this.pendingBlocks)clearTimeout(e.timer),e.timer=this.createBlockTimer(e)}createBlockTimer(e){return setTimeout(()=>{F.v.warn(`Infinite DATASERVER block ${e.startRow}-${e.endRow} for ${this.resourceName} timed out waiting for rows; resolving with ${this.rowData.size} accumulated row(s).`),this.settleBlock(e,!0)},se.BLOCK_RESOLVE_TIMEOUT_MS)}accumulate(e){var t,i,a;const r=new Map(this.rowData);null===(t=e.inserts)||void 0===t||t.forEach(e=>{const t=null==e?void 0:e[this.rowId];void 0!==t&&r.set(t,e)}),null===(i=e.updates)||void 0===i||i.forEach(e=>{const t=null==e?void 0:e[this.rowId];if(void 0===t)return;const i=r.get(t);r.set(t,i?Object.assign(Object.assign({},i),e):e)}),null===(a=e.deletes)||void 0===a||a.forEach(e=>{const t=null==e?void 0:e[this.rowId];if(void 0===t)return;const i=this.cacheIndexOf(r,t);-1===i||this.deliveredRowCount>0&&i<this.deliveredRowCount||r.delete(t)}),this.rowData=r}cacheIndexOf(e,t){let i=0;for(const a of e.keys()){if(a===t)return i;i+=1}return-1}settleCoveredBlocks(){for(const e of[...this.pendingBlocks])(this.rowData.size>=e.endRow||!1===this.moreRows)&&this.settleBlock(e,!0)}settleBlock(e,t){var i;if(e.settled)return;if(e.settled=!0,this.pendingBlocks.delete(e),clearTimeout(e.timer),!t)return void e.fail();const a=[...this.rowData.values()].slice(e.startRow,e.endRow);this.deliveredRowCount=Math.max(this.deliveredRowCount,e.startRow+a.length);const r=!1===this.moreRows?this.rowData.size:this.hasCriteria?-1:null!==(i=this.serverRowsCount)&&void 0!==i?i:-1;this.warnIfViewTruncated(),F.v.debug("Infinite DATASERVER block settled",{startRow:e.startRow,endRow:e.endRow,rows:a.length,cached:this.rowData.size,lastRow:r}),e.success(a,r),this.deliverRows(e.startRow,a),this.notifyDataAvailability(e.startRow,a.length)}notifyDataAvailability(e,t){var i,a;0!==e||this.detached||(0===t?null===(i=this.onNoDataAvailableFunc)||void 0===i||i.call(this):null===(a=this.onDataAvailableFunc)||void 0===a||a.call(this))}deliverRows(e,t){var i,a;if(this.detached)return;const{withdrawnRowIds:r}=this.ledger.record(e,t);t.length>0&&(null===(i=this.onRowsDeliveredFunc)||void 0===i||i.call(this,t)),r.length>0&&(null===(a=this.onRowsWithdrawnFunc)||void 0===a||a.call(this,r))}warnIfViewTruncated(){var e,t;this.viewTruncationWarned||!1!==this.moreRows||this.hasCriteria||void 0===this.serverRowsCount||this.rowData.size>=this.serverRowsCount||(this.viewTruncationWarned=!0,F.v.warn(`${this.resourceName} stopped at ${this.rowData.size} of ${this.serverRowsCount} rows: the DATASERVER view is capped by MAX_VIEW (${null!==(t=null===(e=this.resourceParams)||void 0===e?void 0:e.MAX_VIEW)&&void 0!==t?t:"server default"}). Raise max-view past the row count to reach the rest.`))}failAllPendingBlocks(){for(const e of[...this.pendingBlocks])this.settleBlock(e,!1)}reset(){this.teardownDataserverSubscription()}teardownDataserverSubscription(){var e;this.failAllPendingBlocks(),null===(e=this.dataserverStreamSubscription)||void 0===e||e.unsubscribe(),this.dataserverStreamSubscription=void 0,this.dataserverStream=void 0,this.subscriptionKey=void 0,this.sourceRef=void 0,this.rowData=new Map,this.deliveredRowCount=0,this.streamStarted=!1,this.serverRowsCount=void 0,this.hasCriteria=!1,this.viewTruncationWarned=!1,this.moreRows=void 0,this.moreRowsInFlight=!1}destroy(){this.teardownDataserverSubscription(),this.ledger.clear(),F.v.debug("GenesisInfiniteDatasource destroyed")}detach(){this.detached=!0,this.loadGeneration+=1,this.rowCacheKey=void 0,this.destroy(),F.v.debug("GenesisInfiniteDatasource detached by its host")}}se.BLOCK_RESOLVE_TIMEOUT_MS=1e4,se.HTTP_NOT_FOUND=404;var oe=i(62922);let ne=class extends((0,n.S)(ee.ML)){constructor(){super(...arguments),this.request={},this.onDatasourceReady=e=>(0,r.sH)(this,void 0,void 0,function*(){if(!(yield this.initializeDatasource(this.datasourceOptions(),!0,!1)))return F.v.debug(`Genesis Datasource init failed for ${this.resourceName}`),this.clearRowData(),void this.recordDisconnected();if(!this.isInfiniteSupportedForResource())return void this.clearRowData();this.$emit(Q.V.dataInit),this.setDisconnected(!1),this.indexes=this.getResourceIndexes(this.datasource.availableIndexes,this.datasource.availableSortableFields);const e=(0,K.X)(this.datasource.originalFieldDef),t=yield this.getAgColumnDefs(e);this.$emit(Z.c.schemaUpdated,{schema:t,metadata:e}),this.infiniteDatasource=new se({createSnapshotFunc:this.createSnapshot.bind(this),createDataserverStreamFunc:this.createDataserverStream.bind(this),getMoreRowsFunc:e=>this.connect.getMoreRows(e,0),onRowsDeliveredFunc:this.reportDeliveredRows.bind(this),onRowsWithdrawnFunc:this.reportWithdrawnRows.bind(this),onRowCacheResetFunc:()=>this.clearRowData(!1),onRowsInvalidatedFunc:this.handleLiveRowsInvalidated.bind(this),onRowsUpdatedFunc:this.handleLiveRowsUpdated.bind(this),onNoDataAvailableFunc:()=>this.$emit(Z.c.noDataAvailable),onDataAvailableFunc:()=>this.$emit(Z.c.loadingFinished),errorHandlerFunc:this.handleErrors.bind(this),resourceName:this.resourceName,resourceParams:this.isRequestServer?this.datasource.requestOnlyParams:this.datasource.dataserverOnlyParams,resourceIndexes:this.indexes,resourceColDefs:this.datasource.originalFieldDef,maxRows:+this.maxRows,rowId:this.rowId,baseCriteria:this.buildCriteria(),isRequestServer:this.isRequestServer,defaultOrderBy:this.orderBy,defaultReverse:this.reverse}),this.$emit(Z.c.setInfiniteDatasource,{datasource:this.infiniteDatasource}),this.setupCommitTriggeredRefresh(),this.$emit(Z.c.addGridCssClass,{className:"grid-pro-infinite"}),this.$emit(Z.c.filtersRestored)})}resourceNameChanged(e,t){e&&e!==t&&g.DOM.queueUpdate(()=>(0,r.sH)(this,void 0,void 0,function*(){yield this.restart()}))}criteriaChanged(e,t){const i=e!==(0,X.Q)(t,";");this.infiniteDatasource&&i&&g.DOM.queueUpdate(()=>(0,r.sH)(this,void 0,void 0,function*(){yield this.reloadResourceData()}))}connectedCallback(){super.connectedCallback();const e=this.shouldRunConnect;g.DOM.queueUpdate(()=>{e&&(this.init(),this.subscribeToConnection(),this.subscribeToFilterChanges())})}disconnectedCallback(){super.disconnectedCallback();const e=this.shouldRunDisconnect;g.DOM.queueUpdate(()=>(0,r.sH)(this,void 0,void 0,function*(){e&&(yield this.destroy(),this.unsubscribeFromConnection(),this.unsubscribeFromFilterChanges())}))}subscribeToFilterChanges(){this.unsubscribeFromFilterChanges(),this.filterSub=this.update.pipe((0,W.i)(1),(0,J.B)(600)).subscribe(()=>{this.infiniteDatasource&&this.reloadResourceData()})}unsubscribeFromFilterChanges(){var e;null===(e=this.filterSub)||void 0===e||e.unsubscribe(),this.filterSub=void 0}deepClone(){const e=super.deepClone();return e.deferredGridOptions=structuredClone(this.deferredGridOptions),e.deferredColumnStates=structuredClone(this.deferredColumnStates),e}reloadResourceData(){return(0,r.sH)(this,void 0,void 0,function*(){var e,t;null===(t=null===(e=this.infiniteDatasource)||void 0===e?void 0:e.detach)||void 0===t||t.call(e),this.infiniteDatasource=void 0,this.datasource.destroy(),this.$emit(Z.c.cacheFilterConfig),this.clearRowData(!1),this.setDisconnected(!1),this.$emit(Z.c.refreshInfiniteCache,{purge:!0}),yield this.init()})}init(){return(0,r.sH)(this,void 0,void 0,function*(){const e=Object.assign({getRowId:e=>e.data?String(e.data[this.rowId]):null,cacheBlockSize:this.maxRows,defaultColDef:{filter:!0,resizable:!0,sortable:!1,unSortIcon:!0},rowBuffer:0,rowModelType:"infinite",suppressMultiSort:!0,cacheOverflowSize:2,maxConcurrentDatasourceRequests:1,infiniteInitialRowCount:1,maxBlocksInCache:10},this.deferredGridOptions);this.$emit(Z.c.initialize,{options:e,keepColDefsOnClearRowData:this.keepColDefsOnClearRowData}),this.clearReadyListener(),this.addEventListener(Z.c.ready,this.onDatasourceReady,{once:!0}),this.resourceName||this.handleErrors("Application not connected or invalid resource name, datasource will not work.","unknown")})}clearReadyListener(){this.removeEventListener(Z.c.ready,this.onDatasourceReady)}isInfiniteSupportedForResource(){return!(this.isRequestServer&&!this.datasource.criteriaOnlyRequest)||(this.handleErrors(`Infinite row model is not supported for the REQUEST_SERVER resource '${this.resourceName}' because it does not support criteria-only requests. Set 'criteriaOnlyRequest = true' on the request reply definition, or use a client-side datasource for this resource.`,"resource-type"),!1)}handleLiveRowsInvalidated(e){this.reportLiveChange(e),this.$emit(Z.c.refreshInfiniteCache,{purge:!0})}handleLiveRowsUpdated(e){this.reportLiveChange(e),this.$emit(Z.c.refreshInfiniteCache,{purge:!1})}reportLiveChange(e){const t=this.resetTransaction();this.handleStreamUpdates(e.updates),this.handleStreamDeletes(e.deletes),this.emitTransaction(t)}destroy(){return(0,r.sH)(this,void 0,void 0,function*(){var e,t;this.clearReadyListener(),this.teardownCommitTriggeredRefresh(),this.$emit(Z.c.removeGridCssClass,{className:"grid-pro-infinite"}),this.datasource.destroy(),this.clearRowData(),this.infiniteDatasource&&(null===(t=(e=this.infiniteDatasource).detach)||void 0===t||t.call(e),this.infiniteDatasource=void 0),this.$emit(Z.c.setInfiniteDatasource,{datasource:null})})}restart(){return(0,r.sH)(this,void 0,void 0,function*(){yield this.destroy(),yield this.init()})}clearRowData(e=!0){this.rowData=new Map,this.resetTransaction(),this.$emit(Z.c.dataCleared,{includeSchema:e})}setupCommitTriggeredRefresh(){var e;this.teardownCommitTriggeredRefresh(),!this.isSnapshot&&this.isRequestServer&&(null===(e=this.pollTriggerEvents)||void 0===e?void 0:e.length)&&(this.commitResponseUnsubscribe=this.connectEvents.addCommitResponseListener(e=>{var t;const{eventName:i,response:a}=e.detail;this.pollTriggerEvents.includes(i)&&(null===(t=a.MESSAGE_TYPE)||void 0===t?void 0:t.endsWith("_ACK"))&&(F.v.debug(`Commit ACK for ${i}, re-reading the loaded blocks.`),this.$emit(Z.c.refreshInfiniteCache,{purge:!1}))}))}teardownCommitTriggeredRefresh(){var e;null===(e=this.commitResponseUnsubscribe)||void 0===e||e.call(this),this.commitResponseUnsubscribe=void 0}createSnapshot(){return(0,r.sH)(this,arguments,void 0,function*(e=null){return yield this.datasource.snapshot(e)})}createDataserverStream(e=null){return this.connect.stream(this.resourceName,()=>{},e=>{var t;F.v.error("Infinite DATASERVER paged stream error:",e),this.handleErrors((null===(t=null==e?void 0:e.receivedMessage)||void 0===t?void 0:t.ERROR)||(null==e?void 0:e.message),"stream")},e)}getAgColumnDefs(e){return(0,r.sH)(this,void 0,void 0,function*(){const t=this.generateColumnDefsFromMetadata(e,oe.O,oe.c),i=new Set;return this.indexes.forEach((e,t)=>{t&&e.forEach(e=>i.add(e))}),t.forEach(e=>{e.sortable=this.isRequestServer||i.has(e.field),this.datasource.criteriaOnlyRequest&&(e.filter=this.datasource.availableCriteriaFields.includes(e.field)?e.filter:null)}),t})}loadMore(){F.v.warn("loadMore() is not needed for Infinite Row Model - scrolling triggers data loading automatically")}};(0,r.Cg)([q.dm],ne.prototype,"connect",void 0),(0,r.Cg)([j.a4],ne.prototype,"connectEvents",void 0),(0,r.Cg)([Y.yW],ne.prototype,"datasource",void 0),(0,r.Cg)([g.observable],ne.prototype,"request",void 0),ne=(0,r.Cg)([(0,g.customElement)({name:"grid-pro-infinite-datasource"})],ne);var le=i(18070),de=i(30335),ge=i(26062),ce=i(32610),he=i(98884),ue=i(82128),pe=i(55365),me=i(53397),ve=i(52540),fe=i(49104),be=i(88863),ye=i(71964),Ce=i(73203),Se=i(50103),we=i(23201);(0,o.N)(ge.D,V.L,U.X,ne,v.O,x.G,B.X),h.syG.registerModules([h.n76,h.Q90,h.x6L,h.YN8,h.YzW,h.Lt,h.I95,h.O4V,h.H18,h.lvV,h.mfG,h.Iws,h.nSw,h.FUS,h.Ss0,h.tkg,h.ZDV,h.ZyC,h.XG7,h.VZy,h.$I9,h.dGu,h.AJG,h.c5B,h.BG,h.KIB,h.Sko,h.ZuP,h.Vc,z.JE]);const Re="gridReady";class Ee extends((0,n.S)(c.FoundationElement)){getColumnDragBridge(){return this.columnDragBridge}rowDataChanged(e,t){this.initialised&&this.gridApi&&this.gridApi.setGridOption("rowData",t)}gridSlotChanged(){this.gridSlot&&!this.initialised&&this.agGridOptions&&this.initGrid()}enableColumnSelectionChanged(){this.syncColumnSelectionHostLayout()}getfilterModel(){return(0,r.sH)(this,void 0,void 0,function*(){if(!this.persistFilterModelKey)return this._filterConfig;return yield this.statePersistence.getFilterModel(this.persistFilterModelKey)})}setFilterModel(e){return(0,r.sH)(this,void 0,void 0,function*(){this.persistFilterModelKey?yield this.statePersistence.saveFilterModel(this.persistFilterModelKey,e):this._filterConfig=e})}constructor(){super(),this.gridErrorItems=[],this.disposed=!1,this.debouncedSaveColumnState=m()(this.saveColumnState.bind(this),400),this.debouncedSaveFilterModel=m()(this.cacheFilterConfig.bind(this),400),this.debouncedNotifyDatasourceVisibleColumns=m()(this.notifyDatasourceVisibleColumns.bind(this),400),this.autoCellRendererByType=!1,this.onlyTemplateColDefs=!1,this.gridAutosizingEnabled=!1,this.enableCellFlashing=!1,this.enableRowFlashing=!1,this.columnDragBridge={},this.columnComponentName="grid-pro-column",this.themeMode="dark",this.statusBarConfig=pe.o2,this.withStatusBar=!1,this.enableColumnSelection=!1,this.applyingDatasourceGridOptions=!1,this.rehydrationAttempted=!1,this.rootEventsListeners=[],this.datasourceEventHandlers=[],this.gridEventsQueue=[],this.registeredGridEvents=new Set,this.gridEventListeners=new Map,this.boundGlobalEventListener=this.globalEventListener.bind(this),this._filterConfig=void 0,this.handleLuminanceChange=e=>{const t=d.baseLayerLuminance.getValueFor(e.target);this.themeMode=t===d.StandardLuminance.DarkMode?"dark":"light"},this.luminanceObserver={handleChange:e=>this.handleLuminanceChange(e)},this.agAttributes={},this.agPropertiesMap=ce.zI.reduce((e,t)=>(e[t.toLowerCase()]=t,e[(0,Se.w)(t)]=t,e),{});const e=this.hideDatasourceError.bind(this);this.rootEventsListeners.push([Q.V.dataInit,e],[ce.yY.datasourceErrorClose,e],[le.L.error,this.handleBaseDatasourceError.bind(this)],[le.L.connected,e]),this.datasourceEventHandlers=[[Z.c.initialize,this.handleInitialize.bind(this)],[Z.c.dataLoaded,this.handleDataLoaded.bind(this)],[Z.c.dataChanged,this.handleDataChanged.bind(this)],[Z.c.schemaUpdated,this.handleSchemaUpdated.bind(this)],[Z.c.dataCleared,this.handleDataCleared.bind(this)],[Z.c.loadingStarted,this.handleLoadingStarted.bind(this)],[Z.c.loadingFinished,this.handleLoadingFinished.bind(this)],[Z.c.noDataAvailable,this.handleNoDataAvailable.bind(this)],[Z.c.filtersRestored,this.handleFiltersRestored.bind(this)],[Z.c.moreDataAvailable,this.handleMoreDataAvailable.bind(this)],[Z.c.error,this.handleDatasourceError.bind(this)],[Z.c.destroy,this.handleDatasourceDestroy.bind(this)],[Z.c.cacheFilterConfig,this.cacheFilterConfig.bind(this)],[Z.c.refreshServerSide,this.handleRefreshServerSide.bind(this)],[Z.c.setServerSideDatasource,this.handleSetServerSideDatasource.bind(this)],[Z.c.addGridCssClass,this.handleAddGridCssClass.bind(this)],[Z.c.removeGridCssClass,this.handleRemoveGridCssClass.bind(this)],[Z.c.applyServerSideTransaction,this.handleApplyServerSideTransaction.bind(this)],[Z.c.setInfiniteDatasource,this.handleSetInfiniteDatasource.bind(this)],[Z.c.refreshInfiniteCache,this.handleRefreshInfiniteCache.bind(this)]]}addEventListener(e,t,i){super.addEventListener(e,t,i),this.gridApi?this.addGridEventListener(e):this.gridEventsQueue.includes(e)||this.gridEventsQueue.push(e)}addGridEventListener(e){if(this.registeredGridEvents.has(e))return;this.registeredGridEvents.add(e);const t=t=>{this.$emit(e,t)};this.gridEventListeners.set(e,t),this.gridApi.addEventListener(e,t)}handleError(e,t){this.gridErrorItems=[...this.gridErrorItems,{detail:t.detail,type:e}]}handleBaseDatasourceError(e){const t={detail:{message:e.detail.message},type:ce.Ie.datasource};this.gridErrorItems=[...this.gridErrorItems,{detail:t.detail,type:t.type}]}hideDatasourceError(){this.gridErrorItems=this.gridErrorItems.filter(e=>e.type!==ce.Ie.datasource),this.removeAttribute("ds-disconnected")}connectedCallback(){var e;super.connectedCallback(),this.syncColumnSelectionHostLayout(),this.disposed=!1;const t=null!==(e=this.provider)&&void 0!==e?e:this;this.luminanceSubscription=d.baseLayerLuminance.subscribe(this.luminanceObserver,t),this.gridAutosizingEnabled&&(this.visibilityObserverCleanup=(0,l.j)(this,e=>{e&&this.debouncedColumnAutosize()})),this.rehydrationAttempted=!1,this.shouldRunConnect&&(this.rootEventsListeners.forEach(([e,t])=>{this.addEventListener(e,t)}),ce.zI.forEach(e=>{const t=function(e,t){let i=Object.getPrototypeOf(e);for(;i&&i!==HTMLElement.prototype;){const e=Object.getOwnPropertyDescriptor(i,t);if(e)return e;i=Object.getPrototypeOf(i)}}(this,e);Object.defineProperty(this,e,{get:null==t?void 0:t.get,set:i=>{var a,r;const s=null===(a=null==t?void 0:t.get)||void 0===a?void 0:a.call(this);null===(r=null==t?void 0:t.set)||void 0===r||r.call(this,i),this.agAttributeChangedCallback((0,Se.w)(e),s,i)},enumerable:!0,configurable:!0})}),this.toggleDatasourceEventListeners(!0))}disconnectedCallback(){var e;this.disposed=!0,this.debouncedSaveColumnState.cancel(),this.debouncedSaveFilterModel.cancel();const t=null!==(e=this.provider)&&void 0!==e?e:this;d.baseLayerLuminance.unsubscribe(this.luminanceObserver,t),this.luminanceSubscription&&(this.luminanceSubscription.unsubscribe(),this.luminanceSubscription=void 0),this.visibilityObserverCleanup&&(this.visibilityObserverCleanup(),this.visibilityObserverCleanup=void 0),super.disconnectedCallback(),this.rehydrationAttempted=!1;const i=this.shouldRunDisconnect;this.rootEventsListeners.forEach(([e,t])=>{this.removeEventListener(e,t)}),i?this.performDisconnectCleanup():queueMicrotask(()=>{this.isConnected||this.performDisconnectCleanup()})}syncColumnSelectionHostLayout(){this.classList.toggle("has-column-selection",this.enableColumnSelection)}performDisconnectCleanup(){this.debounced&&(clearTimeout(this.debounced),this.debounced=null),this.initialised=!1,this.resetGridOptionsState(),this.destroyGridInstance(),this.toggleDatasourceEventListeners(!1),this.debouncedSaveColumnState.cancel(),this.debouncedSaveFilterModel.cancel(),this.registeredGridEvents.clear(),this.gridEventsQueue=[]}destroyGridInstance(){this.gridApi&&this.gridEventListeners.forEach((e,t)=>{this.gridApi.removeEventListener(t,e)}),this.gridEventListeners.clear(),this.gridApi?this.gridApi.destroy():this.agGrid&&this.agGrid.destroy(),this.gridSlot&&this.gridSlot.replaceChildren(),this.gridApi=void 0,this.agGrid=void 0}toggleDatasourceEventListeners(e){const t=e?"addEventListener":"removeEventListener";this.datasourceEventHandlers.forEach(([e,i])=>{super[t](e,i)})}handleInitialize(e){const{options:t,keepColDefsOnClearRowData:i}=e.detail;i&&(this.columnState=this.gridApi.getColumnState()),this.applyingDatasourceGridOptions=!0;try{this.gridOptions=Object.assign(Object.assign(Object.assign({},this.userProvidedGridOptions),t),i?{columnDefs:this.gridApi.getColumnDefs()}:{}),this.initGrid()}finally{this.applyingDatasourceGridOptions=!1}}handleDataLoaded(e){const{data:t}=e.detail;this.gridApi&&this.gridApi.setGridOption("rowData",t)}handleDataChanged(e){const{changes:t}=e.detail;if(!this.gridApi||!this.isClientSideRowModel)return;const i=this.gridApi.applyTransaction(t);this.flashAddedCells(null==i?void 0:i.add)}get isClientSideRowModel(){var e,t,i;return"clientSide"===(null!==(i=null===(t=null===(e=this.gridApi)||void 0===e?void 0:e.getGridOption)||void 0===t?void 0:t.call(e,"rowModelType"))&&void 0!==i?i:"clientSide")}flashAddedCells(e){this.enableRowFlashing&&(null==e?void 0:e.length)&&this.gridApi.flashCells({rowNodes:e})}handleSchemaUpdated(e){return(0,r.sH)(this,void 0,void 0,function*(){this.gridApi?yield this.processSchemaUpdate(e.detail):this.pendingSchemaUpdate=e.detail})}processSchemaUpdate(e){return(0,r.sH)(this,arguments,void 0,function*({schema:e}){const t=this.gridApi.getColumnDefs();if(t&&t.length>0)return;this.applyCommunityFilterFallbacks(e);const i=yield this.mergeAllColumnDefsAndStates(e,!0);this.gridApi.setGridOption("columnDefs",i),this.restoreCachedFilterConfig()})}applyCommunityFilterFallbacks(e){const t=this.gridApi.isModuleRegistered("SetFilterModule"),i=this.gridApi.isModuleRegistered("MultiFilterModule");e.forEach(e=>{var r,s,o,n,l;if("agSetColumnFilter"===e.filter&&!t)return F.v.debug(`SetFilterModule is not registered; column '${e.field}' falls back to the enum filter`),e.filter=a.enumFilter,void(null!==(r=e.floatingFilterComponent)&&void 0!==r||(e.floatingFilterComponent=a.enumFloatingFilter));if("agMultiColumnFilter"!==e.filter)return;const d=null===(o=null===(s=e.filterParams)||void 0===s?void 0:s.filters)||void 0===o?void 0:o.find(e=>"agSetColumnFilter"===e.filter);i?!t&&d&&(F.v.debug(`SetFilterModule is not registered; the set sub-filter of column '${e.field}' falls back to the enum filter`),d.filter=a.enumFilter):(null===(n=null==d?void 0:d.filterParams)||void 0===n?void 0:n.values)?(F.v.debug(`MultiFilterModule is not registered; enum column '${e.field}' falls back to the enum filter`),e.filter=a.enumFilter,e.filterParams=Object.assign({},d.filterParams),null!==(l=e.floatingFilterComponent)&&void 0!==l||(e.floatingFilterComponent=a.enumFloatingFilter)):(F.v.warn("MultiFilterModule is not registered, falling back to text filter"),e.filter="agTextColumnFilter")})}handleDataCleared(e){const{includeSchema:t}=e.detail;this.gridApi&&(t&&this.gridApi.setGridOption("columnDefs",[]),this.isClientSideRowModel&&this.gridApi.setGridOption("rowData",[]),this.gridApi.refreshCells({force:!0}))}handleLoadingStarted(){this.gridApi&&this.gridApi.setGridOption("loading",!0)}handleLoadingFinished(){this.gridApi&&(this.gridApi.setGridOption("loading",!1),this.gridApi.hideOverlay())}handleNoDataAvailable(){this.gridApi&&(this.gridApi.setGridOption("loading",!1),this.gridApi.showNoRowsOverlay())}handleFiltersRestored(){this.restoreCachedFilterConfig()}handleMoreDataAvailable(e){var t,i,a,r;const{hasMoreData:s,sourceRef:o}=e.detail;if(!this.gridApi)return;const n=null===(i=(t=this.gridApi).getStatusPanel)||void 0===i?void 0:i.call(t,pe.k7.loadMore);n&&(null===(r=(a=n).updateParams)||void 0===r||r.call(a,{moreRows:s,sourceRef:o}))}handleDatasourceError(){this.setAttribute("ds-disconnected","ds-disconnected")}handleDatasourceDestroy(){this.clearLocalGridOptions()}handleRefreshServerSide(e){const{purge:t}=e.detail;this.gridApi&&this.gridApi.refreshServerSide({purge:t})}handleSetServerSideDatasource(e){const{datasource:t}=e.detail;this.gridApi&&this.gridApi.setGridOption("serverSideDatasource",t)}handleAddGridCssClass(e){var t;const{className:i}=e.detail,a=(null===(t=this.gridSlot)||void 0===t?void 0:t.parentElement)||this;a&&a.classList.add(i)}handleRemoveGridCssClass(e){var t;const{className:i}=e.detail,a=(null===(t=this.gridSlot)||void 0===t?void 0:t.parentElement)||this;a&&a.classList.remove(i)}handleApplyServerSideTransaction(e){var t,i;const{transaction:a,async:r,callback:s}=e.detail;if(this.gridApi)if(r)this.gridApi.applyServerSideTransactionAsync(a,e=>{var t,i;this.flashAddedCells([...null!==(t=null==e?void 0:e.add)&&void 0!==t?t:[],...null!==(i=null==e?void 0:e.update)&&void 0!==i?i:[]]),null==s||s(e)});else{const e=this.gridApi.applyServerSideTransaction(a);this.flashAddedCells([...null!==(t=null==e?void 0:e.add)&&void 0!==t?t:[],...null!==(i=null==e?void 0:e.update)&&void 0!==i?i:[]]),s&&s(e)}}handleSetInfiniteDatasource(e){const{datasource:t}=e.detail;this.gridApi&&this.gridApi.setGridOption("datasource",t)}handleRefreshInfiniteCache(e){var t;this.gridApi&&((null===(t=e.detail)||void 0===t?void 0:t.purge)?this.gridApi.purgeInfiniteCache():this.gridApi.refreshInfiniteCache())}combineAllGridComponents(e){const t={[pe.IX.action]:w.eA,[pe.IX.actionsMenu]:R.cN,[pe.IX.boolean]:E._Y,[pe.IX.editable]:A.YM,[pe.IX.icon]:k.Jt,[pe.IX.statusPill]:D.N7,[pe.IX.select]:O.gs,[pe.IX.selectEditor]:f._Q,[pe.IX.numberEditor]:b.Z0,[pe.IX.multiselectEditor]:y.pZ,[pe.IX.dateEditor]:C.S8,[pe.IX.stringEditor]:S.XJ,[a.enumFilter]:M,[a.enumFloatingFilter]:N,[pe.k7.labelValue]:ve.k,[pe.k7.loadMore]:fe.s,[pe.k7.reload]:be.W,[pe.k7.rowCount]:ye.i};return Object.assign(Object.assign(Object.assign({},t),e),this.gridComponents)}statePersistanceEnabled(){return!(!this.persistColumnStateKey||0===this.persistColumnStateKey.length)}getSelectedRows(){var e,t,i,a;try{if(!this.initialised||!this.gridApi)return[];const r=null===(e=this.gridOptions)||void 0===e?void 0:e.rowSelection;if("single"===r||"multiple"===r)return this.gridApi.getSelectedRows&&this.gridApi.getSelectedRows().length>0?this.gridApi.getSelectedRows():[];if((null===(t=this.gridApi)||void 0===t?void 0:t.getCellRanges)&&this.gridApi.getCellRanges().length>0)return this.getCellRangeRowData();if(!(null===(i=this.gridOptions)||void 0===i?void 0:i.enableRangeSelection)){const e=null===(a=this.gridApi)||void 0===a?void 0:a.getFocusedCell();if(e){const t=this.gridApi.getDisplayedRowAtIndex(e.rowIndex);if(null==t?void 0:t.data)return[t.data]}}return[]}catch(e){return F.v.error("Grid Pro: Error getting selected rows:",e),[]}}getCellRangeRowData(){var e;if(!(null===(e=this.gridApi)||void 0===e?void 0:e.getCellRanges))return[];const t=this.gridApi.getCellRanges();if(0===t.length)return[];const i=[];return t.forEach(e=>{const t=e.startRow.rowIndex,a=e.endRow.rowIndex;for(let e=t;e<=a;e+=1){const t=this.gridApi.getDisplayedRowAtIndex(e);(null==t?void 0:t.data)&&!i.some(e=>e===t.data)&&i.push(t.data)}}),i}hasSelectedRows(){return this.getSelectedRows().length>0}updateLabelValueStatusBar(e){var t,i;if(!this.gridApi)return void F.v.warn("Grid Pro: Cannot update label-value status bar - grid API not available");const a=null===(i=(t=this.gridApi).getStatusPanel)||void 0===i?void 0:i.call(t,pe.k7.labelValue);a&&"function"==typeof a.updateParams?a.updateParams(e):F.v.warn("Grid Pro: Label-value status bar component not found or updateParams method not available")}debouncedColumnAutosize(){this.gridAutosizingEnabled&&(this.debounced&&(clearTimeout(this.debounced),this.debounced=null),this.debounced=setTimeout(()=>{var e;null===(e=this.gridApi)||void 0===e||e.sizeColumnsToFit()},ce.BW))}removeConfigWidthsToAutosize(e){return e.map(e=>Object.assign(Object.assign({},e),{width:null}))}saveColumnState(){return(0,r.sH)(this,void 0,void 0,function*(){if(this.rehydrationAttempted&&this.statePersistanceEnabled()){let e=this.gridApi.getColumnState();e=(0,we.n7)(e),e=this.gridAutosizingEnabled?this.removeConfigWidthsToAutosize(e):e;const t=0===e.filter(e=>{if(e.hide)return!1;const t=this.gridApi.getColumn(e.colId);return Boolean(t.getColDef().headerName)}).length;if(0===e.length||JSON.stringify(e)===JSON.stringify(this.columnState)||t)return;yield this.statePersistence.saveColumnState(this.persistColumnStateKey,e),this.columnState=e}})}getSavedColumnState(){return(0,r.sH)(this,void 0,void 0,function*(){return this.columnState=[],this.statePersistanceEnabled()&&(this.columnState=yield this.statePersistence.getColumnState(this.persistColumnStateKey)),this.columnState})}restoreColumnState(){return(0,r.sH)(this,void 0,void 0,function*(){var e;this.rehydrationAttempted=!0;const t=yield this.getSavedColumnState(),i=(0,we.n7)(t);i&&i.length>0&&(null===(e=this.gridApi)||void 0===e||e.applyColumnState({state:i,applyOrder:!0}))})}cacheFilterConfig(){var e;this.setFilterModel((null===(e=this.gridApi)||void 0===e?void 0:e.getFilterModel())||void 0)}restoreCachedFilterConfig(){return(0,r.sH)(this,void 0,void 0,function*(){var e,t;const i=yield this.getfilterModel();void 0!==i&&(null===(e=this.gridApi)||void 0===e||e.setFilterModel(i),null===(t=this.gridApi)||void 0===t||t.onFilterChanged())})}get gridOptions(){return this.agGridOptions}get isServerSide(){return this.gridProDatasource instanceof U.X}get gridParams(){return{globalListener:this.boundGlobalEventListener,modules:[z.JE,h.Vc,h.ZuP]}}get gridProDatasource(){return this.querySelector("grid-pro-genesis-datasource")||this.querySelector("grid-pro-client-side-datasource")||this.querySelector("grid-pro-server-side-datasource")||this.querySelector("grid-pro-infinite-datasource")}get isInfiniteRowModel(){return this.gridProDatasource instanceof ne}notifyDatasourceVisibleColumns(){var e,t,i,a;const r=this.gridProDatasource;if(!r)return;const s=(0,T.C)(null===(t=null===(e=this.gridApi)||void 0===e?void 0:e.getAllDisplayedColumns)||void 0===t?void 0:t.call(e),null===(a=null===(i=this.gridApi)||void 0===i?void 0:i.getColumnDefs)||void 0===a?void 0:a.call(i));s.length&&r.setVisibleColumns(s)}set gridOptions(e){!this.applyingDatasourceGridOptions&&e&&(this.userProvidedGridOptions=Object.assign({},e));const t=()=>{!this.disposed&&this.isConnected&&(this.debouncedSaveColumnState(),this.debouncedColumnAutosize())},i=()=>{!this.disposed&&this.isConnected&&this.debouncedNotifyDatasourceVisibleColumns()};Array.from(this.attributes).forEach(e=>{const t=this.agPropertiesMap[e.name];t&&(this.agAttributes[t]=e.value)});const{columnDefs:a,components:s,defaultColDef:o,getRowId:n,onGridReady:l,onFilterChanged:d,onFirstDataRendered:g}=e,c=(0,r.Tt)(e,["columnDefs","components","defaultColDef","getRowId","onGridReady","onFilterChanged","onFirstDataRendered"]),h=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.gridOptionsConfig),{defaultColDef:Object.assign({enableCellChangeFlash:this.enableCellFlashing,filter:!0,resizable:!0,sortable:!0},o),components:this.combineAllGridComponents(s),headerHeight:this.headerHeight,rowHeight:this.rowHeight,animateRows:!1,suppressDragLeaveHidesColumns:!0}),this.eventsAndCallbacks),{onGridReady:e=>(0,r.sH)(this,void 0,void 0,function*(){var t,i,a;if(this.gridApi=e.api,this.gridEventsQueue.length&&this.gridEventsQueue.forEach(e=>{this.addGridEventListener(e)}),this.pendingSchemaUpdate){const e=this.pendingSchemaUpdate;this.pendingSchemaUpdate=void 0;try{yield this.processSchemaUpdate(e)}catch(e){F.v.error("Grid Pro: failed to apply the pending schema update on grid ready:",e)}}this.rowData&&this.gridApi.setGridOption("rowData",this.rowData),l&&l(e),(null===(t=this.gridProDatasource)||void 0===t?void 0:t.keepColDefsOnClearRowData)&&(null===(i=this.columnState)||void 0===i?void 0:i.length)>0&&this.gridApi.applyColumnState({state:this.columnState,applyOrder:!0}),this.$emit(Re,{event:e,gridId:this.id}),this.$emit(pe.mr,{event:e,gridId:this.id}),this.notifyDatasourceVisibleColumns(),null===(a=this.gridProDatasource)||void 0===a||a.$emit(Z.c.ready),this.restoreColumnState(),this.restoreCachedFilterConfig(),this.debouncedColumnAutosize()}),onFirstDataRendered:e=>{this.notifyDatasourceVisibleColumns(),g&&g(e)},onColumnPinned:t,onColumnResized:t,onColumnMoved:t,onColumnVisible:()=>{t(),i()},onDisplayedColumnsChanged:()=>{t(),i()},onFilterChanged:e=>{!this.disposed&&this.isConnected&&(this.debouncedSaveFilterModel(),d&&d(e))},onGridSizeChanged:t,onSortChanged:t}),c);this.gridProDatasource?(h.columnDefs=a,h.getRowId=n,this.setupStatusBar(h),this.setLocalGridOptions(h)):this.mergeAllColumnDefsAndStates(a).then(e=>{!this.disposed&&this.isConnected&&(h.columnDefs=e,h.getRowId=n,this.setupStatusBar(h),this.setLocalGridOptions(h),this.initGrid())})}setLocalGridOptions(e){this.agGridOptions=Object.assign(Object.assign({},this.agGridOptions),(0,ce.Qg)(e,this.agAttributes)),this.agGridOptions.context=Object.assign(Object.assign({},this.agGridOptions.context),{[z.nJ]:this.columnDragBridge}),null==this.agGridOptions.allowDragFromColumnsToolPanel&&(this.agGridOptions.allowDragFromColumnsToolPanel=!0)}clearLocalGridOptions(){this.agGridOptions=void 0}resetGridOptionsState(){this.userProvidedGridOptions=void 0,this.agGridOptions=void 0}initGrid(){g.DOM.queueUpdate(()=>{!this.disposed&&this.isConnected&&this.gridSlot&&(this.initialised&&(this.destroyGridInstance(),this.gridSlot.firstChild&&this.gridSlot.removeChild(this.gridSlot.firstChild)),this.agGrid=(0,h.Dvw)(this.gridSlot,this.agGridOptions,this.gridParams),this.initialised=!0)})}mergeAllColumnDefsAndStates(e){return(0,r.sH)(this,arguments,void 0,function*(e,t=!1){var i;const r=e||[];r.forEach(e=>{if(this.headerCaseType&&e.field&&!e.headerName){const t=u[this.headerCaseType];t?e.headerName=t(e.field):F.v.warn(`Invalid header-case-type attribute value: ${this.headerCaseType}. Please use one of the following: camelCase, capitalCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase.`)}});const s=Array.from(this.querySelectorAll(this.columnComponentName)).map(e=>e.definition).map(e=>{var t,i,s,o,n,l;if(this.enableCellFlashing&&void 0===e.enableCellChangeFlash&&(e.enableCellChangeFlash=!0),"agSetColumnFilter"===e.filter||e.filter===a.enumFilter){if(!(null!=e.filterParams&&"values"in e.filterParams)){const a=null===(t=r.find(t=>t.field===e.field))||void 0===t?void 0:t.filterParams,l=null!==(i=null==a?void 0:a.values)&&void 0!==i?i:null===(n=null===(o=null===(s=null==a?void 0:a.filters)||void 0===s?void 0:s.find(e=>"agSetColumnFilter"===e.filter))||void 0===o?void 0:o.filterParams)||void 0===n?void 0:n.values;l&&(e.filterParams=Object.assign(Object.assign({},e.filterParams),{values:l}))}e.filter===a.enumFilter&&(null!==(l=e.floatingFilterComponent)&&void 0!==l||(e.floatingFilterComponent=a.enumFloatingFilter))}e.editable&&(e.cellRenderer||e.cellRendererSelector||(e.cellRendererSelector=t=>{if(t.data[pe.A7]===e.field)return{component:pe.IX.editable}}),e.tooltipComponent||e.tooltipValueGetter||(e.tooltipComponent=Ce.y,e.tooltipValueGetter=t=>{const i=t.data[pe.h1];if(i&&i.column===e.field)return i.message}),e.cellClassRules||(e.cellClassRules={error:e=>{var t;return(null===(t=e.data[pe.h1])||void 0===t?void 0:t.column)===e.colDef.field}}));const d=r.find(t=>e.field===t.field);return Object.assign(Object.assign({},d),e)}),o=s.map(e=>e.field),n=[...s,...this.onlyTemplateColDefs?[]:r.filter(e=>!o.includes(e.field))];if(this.gridProDatasource&&t){const e=yield this.getSavedColumnState();if((null==e?void 0:e.length)>0)return(0,we.yS)(n,e);if((null===(i=this.gridProDatasource.deferredColumnStates)||void 0===i?void 0:i.length)>0)return(0,we.yS)(n,this.gridProDatasource.deferredColumnStates)}return n})}panelExists(e,t){return t.some(t=>t.statusPanel===e)}addRowCountPanel(e,t){if(this.statusBarConfig&&!0===this.statusBarConfig.rows){const i=this.isServerSide||this.isInfiniteRowModel||"infinite"===(null==t?void 0:t.rowModelType)||"serverSide"===(null==t?void 0:t.rowModelType);if(i)this.panelExists(pe.k7.rowCount,e)||e.push({statusPanel:pe.k7.rowCount,align:"left"});else if(!i){const t="agTotalAndFilteredRowCountComponent";this.panelExists(t,e)||e.push({statusPanel:t,align:"left"})}}}addMaxRowsPanel(e){this.statusBarConfig&&!0===this.statusBarConfig.maxRows&&(this.panelExists(pe.k7.labelValue,e)||e.push({statusPanel:pe.k7.labelValue,statusPanelParams:{label:"Max Rows",value:this.gridProDatasource.maxRows||s.OD.MAX_ROWS_250,hide:!1},align:"left"}))}addAggregationPanel(e){this.statusBarConfig&&!0===this.statusBarConfig.aggregation&&(this.panelExists("agAggregationComponent",e)||e.push({statusPanel:"agAggregationComponent",align:"right"}))}addDatasourcePanels(e){if(this.gridProDatasource){const t=this.gridProDatasource.getDatasourceStatusBarPanels(this.isServerSide||this.isInfiniteRowModel,this.statusBarConfig).filter(t=>!this.panelExists(t.statusPanel,e));e.push(...t)}}setupStatusBar(e){var t,i;if(this.withStatusBar&&this.statusBarConfig){const a=[...(null===(t=e.statusBar)||void 0===t?void 0:t.statusPanels)||[]];this.addRowCountPanel(a,e),this.addMaxRowsPanel(a),this.addAggregationPanel(a),this.addDatasourcePanels(a);const r=((null===(i=e.statusBar)||void 0===i?void 0:i.statusPanels)||[]).filter(e=>!this.panelExists(e.statusPanel,a));a.push(...r),e.statusBar={statusPanels:a}}}get observedAttributes(){const e=ce.zI.map(e=>e.toLowerCase()),t=ce.zI.map(e=>(0,Se.w)(e));return e.concat(t)}agAttributeChangedCallback(e,t,i){var a;if(t===i)return;const r=this.agPropertiesMap[e];r&&(this.agAttributes[r]=i,this.initialised&&(null===(a=this.gridApi)||void 0===a||a.setGridOption(r,i)))}globalEventListener(e,t){const i=e.toLowerCase(),a=new Event(i);a.agGridDetails=t,this.dispatchEvent(a);const r="on"+i;"function"==typeof this[r]&&this[r](a)}}(0,r.Cg)([g.observable],Ee.prototype,"gridApi",void 0),(0,r.Cg)([g.observable],Ee.prototype,"gridErrorItems",void 0),(0,r.Cg)([me.l],Ee.prototype,"statePersistence",void 0),(0,r.Cg)([(0,g.attr)({attribute:"auto-cell-renderer-by-type",mode:"boolean"})],Ee.prototype,"autoCellRendererByType",void 0),(0,r.Cg)([(0,g.attr)({attribute:"only-template-col-defs",mode:"boolean"})],Ee.prototype,"onlyTemplateColDefs",void 0),(0,r.Cg)([(0,g.attr)({mode:"boolean",attribute:"grid-autosizing"})],Ee.prototype,"gridAutosizingEnabled",void 0),(0,r.Cg)([(0,g.attr)({mode:"boolean",attribute:"enable-cell-flashing"})],Ee.prototype,"enableCellFlashing",void 0),(0,r.Cg)([(0,g.attr)({mode:"boolean",attribute:"enable-row-flashing"})],Ee.prototype,"enableRowFlashing",void 0),(0,r.Cg)([(0,g.attr)({attribute:"persist-column-state-key"})],Ee.prototype,"persistColumnStateKey",void 0),(0,r.Cg)([(0,g.attr)({attribute:"persist-filter-model-key"})],Ee.prototype,"persistFilterModelKey",void 0),(0,r.Cg)([(0,g.attr)({attribute:"header-case-type"})],Ee.prototype,"headerCaseType",void 0),(0,r.Cg)([g.observable],Ee.prototype,"rowData",void 0),(0,r.Cg)([g.attr],Ee.prototype,"columnComponentName",void 0),(0,r.Cg)([g.observable],Ee.prototype,"eventsAndCallbacks",void 0),(0,r.Cg)([g.attr],Ee.prototype,"headerHeight",void 0),(0,r.Cg)([g.attr],Ee.prototype,"rowHeight",void 0),(0,r.Cg)([g.observable],Ee.prototype,"classNames",void 0),(0,r.Cg)([g.observable],Ee.prototype,"agGrid",void 0),(0,r.Cg)([g.observable],Ee.prototype,"gridSlot",void 0),(0,r.Cg)([g.observable],Ee.prototype,"themeMode",void 0),(0,r.Cg)([g.observable],Ee.prototype,"gridComponents",void 0),(0,r.Cg)([g.observable],Ee.prototype,"statusBarConfig",void 0),(0,r.Cg)([(0,g.attr)({mode:"boolean",attribute:"with-status-bar"})],Ee.prototype,"withStatusBar",void 0),(0,r.Cg)([(0,g.attr)({mode:"boolean",attribute:"enable-column-selection"})],Ee.prototype,"enableColumnSelection",void 0),(0,r.Cg)([g.observable],Ee.prototype,"customErrorHandlerTemplate",void 0),(0,r.Cg)([pe.lz],Ee.prototype,"gridOptionsConfig",void 0),(0,r.Cg)([g.observable],Ee.prototype,"provider",void 0);const Ae=Ee.compose(Object.assign({baseName:"grid-pro",template:ue.a,styles:g.css`
103
103
  ${de.B}
104
104
  ${he.yK}
105
105
  ${H.M}
@@ -1143,4 +1143,4 @@
1143
1143
  </div>
1144
1144
  </div>
1145
1145
  `,ti=ei(),ii={menuTabs:["filterMenuTab","generalMenuTab","columnsMenuTab"]},ai=(e,t)=>!e.composedPath().includes(t);function ri(e,t,i,a){return(0,r.sH)(this,void 0,void 0,function*(){var r;try{const s=function(e,t){const i=(new Vt.K).withField(e).withValue(null!=t?t:"").withSerialiser(Ut.n.EQ).withGroup("default").build();return i.serialiser(i)}(i,a),o=yield e.request(t,{DETAILS:{CRITERIA_MATCH:s}});return 1===(null===(r=o.REPLY)||void 0===r?void 0:r.length)?o.REPLY[0]:void 0}catch(e){return void console.error(`Failed to retrieve object from the ${t} resource: ${e instanceof Error?e.message:String(e)}`)}})}class si extends((0,n.S)(c.FoundationElement)){constructor(){super(...arguments),this.requestSupportsAdvancedSearch=!1,this.defaultSlottedNodes=[],this.getAndSetRowsDebounce=m()(()=>this.getAndSetRows(),300),this.handleClickOutside=e=>{ai(e,this)&&(this.open=!1)}}get connect(){var e;return null!==(e=this.connectOverride)&&void 0!==e?e:this._connectDI}set connect(e){this.connectOverride=e}get value(){return g.Observable.track(this,"value"),this._value}set value(e){e!==this._value&&(e?ri(this.connect,this.resourceName,this.valueKey,e).then(t=>{this.value===e&&(this.selectedRow=t)}):this.selectedRow=void 0,this.emitValue(e))}get displayValue(){return this.selectedRow&&this.labelKey&&this.selectedRow[this.labelKey]||this.value||""}get hasSearchKey(){return!!this.searchKey&&this.searchKey.length>0}get hasSlottedContent(){return!(!this.defaultSlottedNodes||0===this.defaultSlottedNodes.length)&&this.defaultSlottedNodes.some(e=>{var t;return e.nodeType===Node.ELEMENT_NODE||e.nodeType===Node.TEXT_NODE&&(null===(t=e.textContent)||void 0===t?void 0:t.trim().length)>0})}connectedCallback(){var e;super.connectedCallback(),(null===(e=this.optionsElement)||void 0===e?void 0:e.style)&&this.dropdownWidthChanged(),this.open=!1,this.filterSearch="",this.grid&&(this.grid.gridOptions={defaultColDef:ii,onRowClicked:e=>{this.selectedRow=e.data,this.emitValue(e.data[this.valueKey]),this.toggle()}})}setGridRowData(e){var t;const i=null===(t=this.grid)||void 0===t?void 0:t.gridApi;i&&("function"==typeof i.updateGridOptions?i.updateGridOptions({rowData:e}):i.setRowData(e))}setGridColumnDefs(e){var t;const i=null===(t=this.grid)||void 0===t?void 0:t.gridApi;i&&("function"==typeof i.updateGridOptions?i.updateGridOptions({columnDefs:e}):i.setColumnDefs(e))}emitValue(e){this._value=e,this.$emit("change",e),this.$emit("input",e),g.Observable.notify(this,"value")}toggle(){this.open=!this.open}getAndSetRows(){return(0,r.sH)(this,void 0,void 0,function*(){var e,t;if(!(null===(e=this.grid)||void 0===e?void 0:e.gridApi))return;const i=this.lastRequest={},a=this.request?{REQUEST:Object.assign({},this.request)}:{},r=Array.isArray(this.searchKey)&&1===this.searchKey.length?this.searchKey[0]:this.searchKey;let s;if(r&&this.filterSearch)if(this.requestSupportsAdvancedSearch){const e=(Array.isArray(r)?r:[r]).map(e=>{var t;return(new Vt.K).withField(e).withValue(null!==(t=this.filterSearch)&&void 0!==t?t:"").withSerialiser(Ut.n.containsIgnoreCase).withGroup("default").build()}),t=new Kt.b;t.Or(e,{join:Xt.r.Or()}),s=t.build()}else{if(Array.isArray(r))throw Error("MulticolumnDropdown: Unable to search multiple keys via request; if the request is a GPAL ReqRep, set requestSupportsAdvancedSearch to true");a.REQUEST=Object.assign(Object.assign({},a.REQUEST),{[r]:`*${this.filterSearch}*`})}const o=null===(t=this.baseCriteria)||void 0===t?void 0:t.trim();o&&s?s=`(${s}) && (${o})`:o&&(s=o),s&&(a.DETAILS={CRITERIA_MATCH:s});try{const e=yield this.connect.request(this.resourceName,a);if(i!==this.lastRequest)return;const t=(null==e?void 0:e.REPLY)||[];this.setGridRowData(t),t.length>0?this.grid.gridApi.hideOverlay():this.grid.gridApi.showNoRowsOverlay()}catch(e){console.error(`Failed to retrieve rows from the ${this.resourceName} resource: ${e instanceof Error?e.message:String(e)}`)}})}filterSearchChanged(){var e,t;this.open&&(null===(t=null===(e=this.grid)||void 0===e?void 0:e.gridApi)||void 0===t||t.showLoadingOverlay(),this.getAndSetRowsDebounce())}requestChanged(){var e,t;this.open&&(null===(t=null===(e=this.grid)||void 0===e?void 0:e.gridApi)||void 0===t||t.showLoadingOverlay(),this.getAndSetRows())}columnDefinitionsChanged(){this.setGridColumnDefs(this.columnDefinitions)}openChanged(){var e,t;this.open?(document.addEventListener("mousedown",this.handleClickOutside),(null===(e=this.grid)||void 0===e?void 0:e.gridApi)&&(this.grid.gridApi.showLoadingOverlay(),this.getAndSetRows())):(document.removeEventListener("mousedown",this.handleClickOutside),this.filterSearch="",(null===(t=this.grid)||void 0===t?void 0:t.gridApi)&&this.setGridRowData([]))}dropdownWidthChanged(){var e,t;null===(t=null===(e=this.optionsElement)||void 0===e?void 0:e.style)||void 0===t||t.setProperty(jt,this.dropdownWidth>0?`${this.dropdownWidth}px`:"inherit")}disconnectedCallback(){document.removeEventListener("mousedown",this.handleClickOutside),super.disconnectedCallback();const e=this.shouldRunDisconnect;g.DOM.queueUpdate(()=>{var t;e&&((null===(t=this.grid)||void 0===t?void 0:t.gridApi)&&this.setGridRowData([]),this.selectedRow=void 0,this._value=void 0)})}changeHandler(e){e.preventDefault(),e.stopImmediatePropagation()}}(0,r.Cg)([q.dm],si.prototype,"_connectDI",void 0),(0,r.Cg)([(0,g.attr)({mode:"boolean"})],si.prototype,"disabled",void 0),(0,r.Cg)([(0,g.attr)({attribute:"resource-name"})],si.prototype,"resourceName",void 0),(0,r.Cg)([(0,g.attr)({attribute:"search-key",converter:qt})],si.prototype,"searchKey",void 0),(0,r.Cg)([(0,g.attr)({attribute:"advanced-search-req",mode:"boolean"})],si.prototype,"requestSupportsAdvancedSearch",void 0),(0,r.Cg)([(0,g.attr)({attribute:"value-key"})],si.prototype,"valueKey",void 0),(0,r.Cg)([(0,g.attr)({attribute:"label-key"})],si.prototype,"labelKey",void 0),(0,r.Cg)([(0,g.attr)({attribute:"dropdown-placement"})],si.prototype,"dropdownPlacement",void 0),(0,r.Cg)([g.attr],si.prototype,"dropdownWidth",void 0),(0,r.Cg)([g.observable],si.prototype,"request",void 0),(0,r.Cg)([g.observable],si.prototype,"columnDefinitions",void 0),(0,r.Cg)([g.observable],si.prototype,"baseCriteria",void 0),(0,r.Cg)([g.observable],si.prototype,"defaultSlottedNodes",void 0),(0,r.Cg)([g.observable],si.prototype,"filterSearch",void 0),(0,r.Cg)([g.observable],si.prototype,"open",void 0),(0,r.Cg)([g.observable],si.prototype,"selectedRow",void 0),(0,r.Cg)([g.volatile],si.prototype,"displayValue",null),(0,r.Cg)([g.volatile],si.prototype,"hasSearchKey",null),(0,r.Cg)([g.volatile],si.prototype,"hasSlottedContent",null);const oi=si.compose({baseName:"multicolumn-dropdown",template:ti,styles:Jt}),ni=si.compose({baseName:"multicolumn-dropdown",template:ei("rapid"),styles:Jt});var li=i(3299),di=i(70349),gi=i(91327),ci=i(19910),hi=i(26270),ui=i(22749),pi=i(22133);class mi{constructor(e,t){this.criteria=e,this.onActiveChanged=t,this.matchedRowIds=new Set,this.lastReportedActive=!1}get active(){return this.matchedRowIds.size>0}get matchCount(){return this.matchedRowIds.size}reset(){this.matchedRowIds.clear(),this.report()}handleDataChanged(e){var t;const{add:i=[],update:a=[],remove:r=[]}=null!==(t=null==e?void 0:e.changes)&&void 0!==t?t:{};for(const e of r)this.syncRow(e,!0);for(const e of i)this.syncRow(e,!1);for(const e of a)this.syncRow(e,!1);this.report()}handleDataCleared(){this.reset()}observe(e){const t=e=>{this.handleDataChanged(e.detail)},i=()=>{this.handleDataCleared()};return e.addEventListener(Z.c.dataChanged,t),e.addEventListener(Z.c.dataCleared,i),()=>{e.removeEventListener(Z.c.dataChanged,t),e.removeEventListener(Z.c.dataCleared,i)}}syncRow(e,t){var i;if(!e)return;const a=String(null!==(i=e[this.criteria.rowIdField])&&void 0!==i?i:"");a&&(!t&&(0,pi.D)(this.criteria,e)?this.matchedRowIds.add(a):this.matchedRowIds.delete(a))}report(){const e=this.active;e!==this.lastReportedActive&&(this.lastReportedActive=e,this.onActiveChanged(e))}}var vi=i(49260),fi=i(49568);const bi={foundationIconRenderer:k.qN,foundationGridProActionRenderer:w._X,foundationGridProActionsMenuRenderer:R.su,foundationAgBooleanRenderer:E.fg,foundationAgTextRenderer:Mt.G4,foundationAgTextFieldRenderer:di.wG,foundationAgEditableRenderer:A.r8,foundationAgSelectRenderer:O.bE,foundationSelectEditor:f.RU,foundationNumberEditor:b.CY,foundationDateEditor:C.vr,foundationMultiselectEditor:y.UH,foundationStringEditor:S.cb,foundationMulticolumnDropdown:oi,foundationStatusPillRenderer:D.a1,StatusPillRenderer:D.N7,foundationGridPro:Ae,foundationColumnSelection:B.E,register(e,...t){if(e)for(const i in this)"register"!==i&&this[i]().register(e,...t)}},yi=[{id:"error",label:"Error",value:"var(--error-fill-rest, #c62828)"},{id:"warning",label:"Warning",value:"var(--warning-fill-rest, #ef6c00)"},{id:"success",label:"Success",value:"var(--success-fill-rest, #2e7d32)"},{id:"accent",label:"Accent",value:"var(--accent-fill-rest, #1565c0)"},{id:"neutral",label:"Neutral",value:"var(--neutral-fill-rest, #546e7a)"}],Ci=[{id:"slow",label:"Slow",value:1400},{id:"normal",label:"Normal",value:1e3},{id:"fast",label:"Fast",value:500}],Si=[{id:"row",label:"Whole row",value:"row"},{id:"cell",label:"Alert field cell",value:"cell"}],wi={color:yi[0].value,durationMs:Ci[1].value,scope:"row"};function Ri(e){return{color:"string"==typeof(null==e?void 0:e.color)&&e.color.trim().length>0?e.color:wi.color,durationMs:"number"==typeof(null==e?void 0:e.durationMs)&&Number.isFinite(e.durationMs)&&e.durationMs>0?e.durationMs:wi.durationMs,scope:"row"===(null==e?void 0:e.scope)||"cell"===(null==e?void 0:e.scope)?e.scope:wi.scope}}const Ei=new Map;function Ai(e){const{persistPreferencesKey:t,target:i,mirrorColorTo:a=[]}=e,r=t?function(e){if(e.statePersistence)return e.statePersistence;try{return c.DI.getOrCreateDOMContainer().get(me.l)}catch(e){return void F.v.debug("Row alert preferences will not persist; no StatePersistence available",e)}}(e):void 0,s=new Set;let o=Ri(Object.assign(Object.assign({},wi),e.preferences));function n(){const e=null!=i?i:"undefined"==typeof document?void 0:document.documentElement;if(e){e.style.setProperty("--row-alert-color",o.color),e.style.setProperty("--alert-flash-duration",`${o.durationMs}ms`);for(const t of a)e.style.setProperty(t,o.color)}}function l(e,i){o=e,n();for(const e of s)e(o);i&&t&&(null==r?void 0:r.saveRowAlertPreferences)&&r.saveRowAlertPreferences(t,o).catch(e=>{F.v.warn("Could not save row alert preferences",e)})}return n(),t&&(null==r?void 0:r.getRowAlertPreferences)&&r.getRowAlertPreferences(t).then(e=>{l(Ri(Object.assign(Object.assign({},o),e)),!1)}).catch(e=>{F.v.warn("Could not load row alert preferences",e)}),{get preferences(){return o},change(e){l(Ri(Object.assign(Object.assign({},o),e)),!0)},subscribe:e=>(s.add(e),()=>{s.delete(e)})}}function ki(e,t={}){var i,a,r,s,o;const{colorPresets:n=yi,ratePresets:l=Ci,menuLabel:d="Alert flash"}=t,g=function(e){const{persistPreferencesKey:t}=e;if(!t)return Ai(e);let i=Ei.get(t);return i||(i=Ai(e),Ei.set(t,i)),i}(t),c=(0,vi.PO)(e)[vi.Xm],h=(0,vi.Li)(Object.assign(Object.assign({},e),{flashField:null!==(a=null!==(i=e.flashField)&&void 0!==i?i:e.stateField)&&void 0!==a?a:null===(o=null===(s=null===(r=e.anyOf)||void 0===r?void 0:r[0])||void 0===s?void 0:s[0])||void 0===o?void 0:o.field}))[vi.mJ];function u(e,t,i,a){return e.map(e=>({name:e.label,checked:e.value===t,action:()=>{g.change(i(e.value)),a()}}))}const p={rowClassRules:{[vi.Xm]:e=>"row"===g.preferences.scope&&c(e)},defaultColDef:{cellClassRules:{[vi.mJ]:e=>"cell"===g.preferences.scope&&h(e)}},get preferences(){return g.preferences},createMenuItem(e){const t=()=>{var t;return null===(t=null==e?void 0:e.redrawRows)||void 0===t?void 0:t.call(e)};return{name:d,subMenu:[{name:"Flash target",subMenu:u(Si,g.preferences.scope,e=>({scope:e}),t)},{name:"Color",subMenu:u(n,g.preferences.color,e=>({color:e}),()=>{})},{name:"Flash rate",subMenu:u(l,g.preferences.durationMs,e=>({durationMs:e}),()=>{})},{name:"Reset to defaults",action:()=>{p.reset(),t()}}]}},getContextMenuItems(e){var t;return[...null!==(t=e.defaultItems)&&void 0!==t?t:[],"separator",p.createMenuItem(e.api)]},setPreferences(e){g.change(e)},reset(){g.change(wi)},subscribe:e=>g.subscribe(e)};return p}var Di=i(92277);const Oi=/^(?:[A-Za-z0-9+/]{4})*?(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,xi=e=>{const t=e.split(":");let i,a;2===t.length?[i,a]=t:a=e;const r=(e=>{if(Oi.test(e)){const t=atob(e),i=new Uint8Array(t.length);return[...t].forEach((e,a)=>{i[a]=t.charCodeAt(a)}),i.buffer}return e})(a);if("str"===i){return new TextDecoder("utf-8").decode(r)}return r},Ti=e=>{const t=(e=>{if("string"==typeof e)return btoa(e);if(e instanceof ArrayBuffer){const t=new Uint8Array(e).reduce((e,t)=>e+String.fromCharCode(t),"");return btoa(t)}return""})(e);return"string"==typeof e?`str:${t}`:e instanceof ArrayBuffer?`bin:${t}`:""},Fi={account:"genesis",namespace:"default",authKey:"kv-default",authEmail:void 0},Ii=c.DI.createInterface();var Li,Gi;!function(e){e.REQ_KEY_VALUE_LIST="REQ_KEY_VALUE_LIST",e.REQ_KEY_VALUE_READ="REQ_KEY_VALUE_READ"}(Li||(Li={})),function(e){e.EVENT_KEY_VALUE_PUT="EVENT_KEY_VALUE_PUT",e.EVENT_KEY_VALUE_DELETE="EVENT_KEY_VALUE_DELETE"}(Gi||(Gi={}));let Pi=class{constructor(e,t,i=Fi){this.connect=e,this.user=t,this.kvStorageConfig=i}delete(e){return(0,r.sH)(this,void 0,void 0,function*(){const t={DETAILS:{KEYS:e}},i=yield this.connect.commitEvent(Gi.EVENT_KEY_VALUE_DELETE,t);return!(!i||"EVENT_ACK"!==i.MESSAGE_TYPE)||{ERROR:i.ERROR,WARNING:i.WARNING}})}get(e){return(0,r.sH)(this,void 0,void 0,function*(){var t;const i={REQUEST:{USER_NAME:null!==(t=this.kvStorageConfig.authEmail)&&void 0!==t?t:this.user.userName,KEY:e}},a=yield this.connect.request(Li.REQ_KEY_VALUE_READ,i);if(a&&a.REPLY&&a.REPLY.length>0){const t=a.REPLY.map(e=>{const t=this.getDecodedValue(e.VALUE);return{kv:{key:e.KEY,value:t}}});return e?t[0]:t}return e?void 0:[]})}getDecodedValue(e){e.startsWith("str:")||e.startsWith("bin:")||(e=`str:${e}`);let t=xi(e);return"string"==typeof t&&t.startsWith("str:")&&(t=xi(t)),"string"==typeof t&&t.startsWith("bin:")&&(t=xi(t)),t}list(){return(0,r.sH)(this,void 0,void 0,function*(){var e;const t={REQUEST:{USER_NAME:null!==(e=this.kvStorageConfig.authEmail)&&void 0!==e?e:this.user.userName}},i=yield this.connect.request(Li.REQ_KEY_VALUE_LIST,t);if(i&&i.REPLY&&i.REPLY.length>0){return i.REPLY.map(e=>e.KEY)}return[]})}put(e){return(0,r.sH)(this,void 0,void 0,function*(){const t={DETAILS:{RECORDS:e.map(e=>({KEY:e.key,VALUE:e.base64?Ti(e.value):e.value}))}},i=yield this.connect.commitEvent(Gi.EVENT_KEY_VALUE_PUT,t);return!(!i||"EVENT_ACK"!==i.MESSAGE_TYPE)||{ERROR:i.ERROR,WARNING:i.WARNING}})}};Pi=(0,r.Cg)([(0,r.Qj)(0,q.dm),(0,r.Qj)(1,Di.KJ),(0,r.Qj)(2,(0,c.optional)(Ii))],Pi);const Mi=c.DI.createInterface(e=>e.singleton(Pi));var _i=i(98316);class $i{getColumnState(e){return(0,r.sH)(this,void 0,void 0,function*(){var t;yield this.migrateLocalStorageToKVStorage(e);const i=yield this.kvStorage.get(e),a=i?null===(t=i.kv)||void 0===t?void 0:t.value:void 0;return a?JSON.parse(a):[]})}saveColumnState(e,t){return(0,r.sH)(this,void 0,void 0,function*(){this.kvStorage.put([{key:e,value:JSON.stringify(t)}])})}deleteColumnState(e){return(0,r.sH)(this,void 0,void 0,function*(){this.kvStorage.delete([e])})}migrateLocalStorageToKVStorage(e){return(0,r.sH)(this,void 0,void 0,function*(){var t;const i=yield this.kvStorage.get(e);if(i&&(null===(t=i.kv)||void 0===t?void 0:t.value))return;const a=this.session.getLocalStorageItem("gridOptions"),r=a?JSON.parse(a)[e]:void 0;r&&(F.v.debug(`Columns state migration for key: ${e} from LocalStorage to KV Storage`),this.kvStorage.put([{key:e,value:r}]))})}getFilterModel(e){return(0,r.sH)(this,void 0,void 0,function*(){var t;const i=yield this.kvStorage.get(e),a=i?null===(t=i.kv)||void 0===t?void 0:t.value:void 0;return a?JSON.parse(a):{}})}saveFilterModel(e,t){return(0,r.sH)(this,void 0,void 0,function*(){this.kvStorage.put([{key:e,value:JSON.stringify(t)}])})}getRowAlertPreferences(e){return(0,r.sH)(this,void 0,void 0,function*(){var t;const i=yield this.kvStorage.get(e),a=i?null===(t=i.kv)||void 0===t?void 0:t.value:void 0;return a?JSON.parse(a):{}})}saveRowAlertPreferences(e,t){return(0,r.sH)(this,void 0,void 0,function*(){this.kvStorage.put([{key:e,value:JSON.stringify(t)}])})}}(0,r.Cg)([Mi],$i.prototype,"kvStorage",void 0),(0,r.Cg)([_i.N],$i.prototype,"session",void 0);var Ni=i(11749);const Bi=d.SwatchRGB.from((0,vt.parseColorHexRGB)("#4c4c4c")),Hi=d.SwatchRGB.from((0,vt.parseColorHexRGB)("#c01754")),{create:zi}=c.DesignToken,Vi={foregroundColor:zi("fui-ag-foreground-color").withDefault(Hi),backgroundColor:zi("fui-ag-background-color").withDefault(Bi)};var Ui=i(68858),Ki=i(49874);const Xi={processCellCallback:e=>["+","=","-","@","\t","\n"].some(t=>String(e.value).startsWith(t))?`'${e.value}`:e.value}}}]);
1146
- //# sourceMappingURL=470.296a76d8bd5451c1865d7092495c9e02.js.map
1146
+ //# sourceMappingURL=470.57cd512241563c5735da75cc1e6677a8.js.map