@agile-team/mach-table 0.35.3 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -18
- package/dist/adapter.d.cts +2 -2
- package/dist/adapter.d.ts +2 -2
- package/dist/analysis.d.cts +2 -2
- package/dist/analysis.d.ts +2 -2
- package/dist/{api-Di5SQHAP.d.cts → api-DH2BoJ9I.d.cts} +2 -2
- package/dist/{api-Di5SQHAP.d.ts → api-DH2BoJ9I.d.ts} +2 -2
- package/dist/business.cjs +1 -1
- package/dist/business.d.cts +1 -19
- package/dist/business.d.ts +1 -19
- package/dist/business.js +1 -1
- package/dist/{configuration-nh5lvWDe.d.ts → configuration-CDG7IuBP.d.ts} +1 -1
- package/dist/{configuration-DlRW86iR.d.cts → configuration-DPbk9Afw.d.cts} +1 -1
- package/dist/import.d.cts +1 -1
- package/dist/import.d.ts +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +4 -13
- package/dist/index.d.ts +4 -13
- package/dist/index.js +5 -5
- package/dist/mach-table.css +1 -1
- package/dist/multi-range.d.cts +1 -1
- package/dist/multi-range.d.ts +1 -1
- package/dist/ordering.d.cts +1 -1
- package/dist/ordering.d.ts +1 -1
- package/dist/preferences.d.cts +1 -1
- package/dist/preferences.d.ts +1 -1
- package/dist/server-side.cjs +1 -1
- package/dist/server-side.d.cts +1 -1
- package/dist/server-side.d.ts +1 -1
- package/dist/server-side.js +1 -1
- package/dist/{shared-O6pPO8H8.d.cts → shared-C-HciMdN.d.cts} +1 -1
- package/dist/{shared-BusgJSf4.d.ts → shared-CvUdCijb.d.ts} +1 -1
- package/dist/workbench.cjs +1 -1
- package/dist/workbench.css +1 -1
- package/dist/workbench.d.cts +3 -3
- package/dist/workbench.d.ts +3 -3
- package/dist/workbench.js +1 -1
- package/dist/worker.d.cts +2 -2
- package/dist/worker.d.ts +2 -2
- package/package.json +2 -2
- package/dist/cachedDictionary-HXvqrDI0.d.cts +0 -30
- package/dist/cachedDictionary-HXvqrDI0.d.ts +0 -30
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var lr=Object.defineProperty;var mo=Object.getOwnPropertyDescriptor;var go=Object.getOwnPropertyNames;var yo=Object.prototype.hasOwnProperty;var vo=(n,e)=>{for(var t in e)lr(n,t,{get:e[t],enumerable:!0})},bo=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of go(e))!yo.call(n,i)&&i!==t&&lr(n,i,{get:()=>e[i],enumerable:!(r=mo(e,i))||r.enumerable});return n};var wo=n=>bo(lr({},"__esModule",{value:!0}),n);var Ya={};vo(Ya,{BUILTIN_AGG_FUNCS:()=>Ae,DEFAULT_LOCALE:()=>x,EVENT_TYPES:()=>ge,LOCALE_EN:()=>Ui,actionsColumn:()=>Zn,advancedFilterCondition:()=>ni,advancedFilterGroup:()=>oi,applyGridViewState:()=>ei,buildColDefsFromSchema:()=>jn,captureGridViewState:()=>Qr,clearGridState:()=>Ln,createActionButtonsRenderer:()=>we,createAggResolver:()=>rt,createBusinessColumnTypes:()=>ao,createCachedDictionary:()=>Zr,createColumnHelper:()=>eo,createDictionaryRenderer:()=>lo,createEnterprisePreset:()=>ro,createGrid:()=>Wn,createGridViewManager:()=>po,createLocalGridStateStore:()=>Hr,createLocalGridViewStore:()=>ti,createMachTableCommands:()=>qn,createMachTablePreset:()=>Xr,createProgressBarRenderer:()=>_r,createRemoteExportRequest:()=>$n,createRowActionsRenderer:()=>er,createStatusTagRenderer:()=>zr,defineColumns:()=>to,defineGridOptions:()=>no,defineMachTableConfig:()=>oo,defineMachTablePreset:()=>io,describeFilter:()=>Ft,downloadFile:()=>Gt,dragColumn:()=>Jn,escapeHtml:()=>de,formatText:()=>K,formatTwo:()=>me,getByPath:()=>_,indexColumn:()=>Xn,isColDefGroup:()=>fe,isSafePath:()=>_e,linkRenderer:()=>Kr,loadGridState:()=>Xt,matchLocaleKey:()=>Tt,normalizeAdvancedFilterModel:()=>V,normalizeColumnFilter:()=>Ke,normalizeFilterModel:()=>j,normalizeGridState:()=>$,normalizeGridViewState:()=>sr,normalizeSavedGridView:()=>Ce,parseCsv:()=>pt,parseDelimited:()=>ft,parseTsv:()=>ht,resolveGridFeatures:()=>ir,resolveSaveConflict:()=>cn,resolveTagVariant:()=>Jt,rowActionsColumn:()=>Qn,sanitizeFormulaCell:()=>oe,saveGridState:()=>Yt,selectionColumn:()=>Yn,setByPath:()=>ue,toTsv:()=>ut,validateGridOptions:()=>tr,version:()=>qa});module.exports=wo(Ya);var Be="0.35.3";function P(n,e,t=!1){if(!(typeof n!="number"||!Number.isFinite(n)||n<e))return t?Math.floor(n):n}function z(n){return P(n,0)||void 0}function ze(n){return!n||typeof n.key!="string"||!n.key.trim()?null:{key:n.key.trim(),debounceMs:P(n.debounceMs,0,!0)??160,...n.sections?{sections:[...new Set(n.sections)]}:{},...n.store?{store:n.store}:{}}}function A(n,e,t,r=!1){let i=!1;for(let o of t)(r?Object.prototype.hasOwnProperty.call(n,o):n[o]!=null)&&(e[o]=n[o],i=!0);return i}var To=new Set(["__proto__","prototype","constructor"]),Te=new Map;function dr(n){if(typeof n!="string"||n.length===0)return null;let e=Te.get(n);if(e!==void 0)return e;let t=n.split("."),r=t.every(i=>i.length>0&&!To.has(i))?t:null;return n.length<=1024&&(Te.size>=256&&Te.delete(Te.keys().next().value),Te.set(n,r)),r}function _e(n){return dr(n)!==null}function _(n,e){if(n==null)return;let t=dr(e);if(!t)return;let r=n;for(let i of t){if(r==null)return;r=r[i]}return r}function ue(n,e,t){if(n==null)return!1;let r=dr(e);if(!r)return!1;let i=n;for(let o=0;o<r.length-1;o++){if(typeof i!="object"&&typeof i!="function"||i===null)return!1;i[r[o]]==null&&(i[r[o]]={}),i=i[r[o]]}return typeof i!="object"&&typeof i!="function"||i===null?!1:(i[r[r.length-1]]=t,!0)}var he={text:["contains","notContains","equals","notEquals","startsWith","endsWith","blank","notBlank"],number:["equals","notEquals","lessThan","lessThanOrEqual","greaterThan","greaterThanOrEqual","inRange","blank","notBlank"],date:["equals","notEquals","lessThan","greaterThan","inRange","blank","notBlank"]};var Do=16,Eo=512,xo=20,Ro=2e3,So=2e3,Mo={text:new Set(he.text),number:new Set(he.number),date:new Set(he.date)};function Io(n){return n==null||typeof n=="string"||typeof n=="number"&&Number.isFinite(n)}function Ao(n,e,t){if(n==null||typeof n!="object")return null;let r=n;return typeof r.match!="string"||!t.has(r.match)?null:{match:r.match,...Lo(r,e)}}function Lo(n,e){let t=e==="number"?ri(n.value):typeof n.value=="string"?n.value:void 0,r=e==="number"?ri(n.value2):typeof n.value2=="string"?n.value2:void 0;return{...t!==void 0?{value:t}:{},...r!==void 0?{value2:r}:{}}}function ri(n){return typeof n=="number"&&Number.isFinite(n)?n:void 0}function ko(n,e){let t=[],r=Mo[e];for(let i of n.slice(0,xo)){let o=Ao(i,e,r);o&&t.push(o)}return t}function Ke(n){if(n==null||typeof n!="object")return null;let e=n;return e.type==="set"?Array.isArray(e.values)?{type:"set",values:e.values.filter(Io).slice(0,Ro)}:null:e.type!=="text"&&e.type!=="number"&&e.type!=="date"||!Array.isArray(e.conditions)?null:{type:e.type,...e.operator==="or"||e.operator==="and"?{operator:e.operator}:{},conditions:ko(e.conditions,e.type)}}function Po(n,e){if(typeof n.colId!="string"||!n.colId.trim())return null;let t=n.colId.trim();if(e.validColumnIds?.has(t)===!1)return null;let r=Ke(n.filter);return r?{kind:"condition",colId:t,filter:r}:null}function Go(n,e,t){if(!Array.isArray(n.children))return null;let r=[];for(let i of n.children){let o=ii(i,e+1,t);o&&r.push(o)}return r.length===0?null:{kind:"group",operator:n.operator==="or"?"or":"and",children:r,...n.not===!0?{not:!0}:{}}}function No(n,e,t){return e<=Do&&t.nodes<Eo&&n!=null&&typeof n=="object"}function ii(n,e,t){if(!No(n,e,t)||t.ancestors.has(n))return null;t.ancestors.add(n),t.nodes++;let r=n,i=r.kind==="condition"?Po(r,t):r.kind==="group"?Go(r,e,t):null;return t.ancestors.delete(n),i}function V(n,e){if(n==null||typeof n!="object")return null;let t=n;if(t.version!==1||t.root==null)return null;let r=ii(t.root,0,{ancestors:new WeakSet,nodes:0,validColumnIds:e});return r?{version:1,root:r}:null}function ni(n,e){return{kind:"condition",colId:n,filter:e}}function j(n,e){if(n==null||typeof n!="object"||Array.isArray(n))return{};let t={};for(let[r,i]of Object.entries(n).slice(0,So)){let o=r.trim();if(!o||e?.has(o)===!1)continue;let s=Ke(i);s&&(t[o]=s)}return t}function oi(n,e,t={}){return{kind:"group",operator:n,children:e,...t.not?{not:!0}:{}}}var cr={align:"center",sortable:!0,resizable:!0,movable:!0,filter:!1,minWidth:80},De={compact:{rowHeight:30,headerHeight:34,fontSize:12,cellPadding:6},normal:{rowHeight:36,headerHeight:40,fontSize:13,cellPadding:9},large:{rowHeight:44,headerHeight:48,fontSize:14,cellPadding:12}},Ee={multiSort:!0,stripedRows:!1,showCellBorders:!1,quickFilterText:null,suppressCellFocus:!1,suppressRowHoverHighlight:!1,suppressNoRowsOverlay:!1,suppressHeaderFocus:!1,loading:!1,error:null,className:"",singleClickEdit:!1,manualSorting:!1,manualFiltering:!1,showSummary:!1,indexOffset:0,applyRowDrag:!0,masterDetail:!1,detailToggleColumn:!0,treeData:!1,childrenKey:"children",autoCheckedChildren:!0,defaultExpandAll:!1,columnMenu:!1,suppressWarnings:!1,enableRangeSelection:!1,suppressClipboard:!1,contextMenu:!1,flashCells:!0,fillHandle:!0,ariaLabel:"MachTable data grid",ariaLabelledBy:"",ariaDescribedBy:"",overlayNoRowsTemplate:"",overlayLoadingTemplate:"",overlayErrorTemplate:"",allowUnsafeOverlayHtml:!1},Oo=Object.keys(Ee);function Fo(n){let e={};for(let t of Oo)e[t]=n[t]??Ee[t];return e}function I(n,e,t,r=!1){return P(n,t,r)??e}function Ho(n){return n&&Object.prototype.hasOwnProperty.call(De,n)?n:"normal"}function Vo(n){return n.theme==="light"||n.theme==="dark"||n.theme==="auto"?n.theme:"light"}function Bo(n,e){let t=typeof n.pagination=="object"&&Array.isArray(n.pagination.pageSizeOptions)?n.pagination.pageSizeOptions:void 0,r=t?[...new Set(t.map(i=>I(i,0,1,!0)).filter(Boolean))]:[10,20,50,100];return r.includes(e)||r.push(e),r.sort((i,o)=>i-o)}function ur(n,e){let t=typeof n=="function"?n(e):_(e,n);return t==null?"":String(t)}function zo(n){let e=n.rowKey,t=e?({data:r})=>ur(e,r):void 0;return{...t?{resolveRowId:t}:{},...e?{rowKey:e}:{}}}function _o(n,e){let t=De[e];return{columnDefs:Array.isArray(n.columnDefs)?n.columnDefs:[],rowData:Array.isArray(n.rowData)?n.rowData:[],defaultColDef:{...cr,...n.defaultColDef??{}},columnTypes:n.columnTypes??{},...zo(n),rowHeight:I(n.rowHeight,t.rowHeight,1),headerHeight:I(n.headerHeight,t.headerHeight,1),rowBuffer:I(n.rowBuffer,8,0,!0),columnLayout:n.columnLayout==="fit"?"fit":"normal",enableColumnResize:n.enableColumnResize===!0,domLayout:n.domLayout==="autoHeight"?"autoHeight":"normal",rowSelection:n.rowSelection==="single"||n.rowSelection==="multiple"?n.rowSelection:"none",size:e,pinnedTopRowData:Array.isArray(n.pinnedTopRowData)?n.pinnedTopRowData:[],pinnedBottomRowData:Array.isArray(n.pinnedBottomRowData)?n.pinnedBottomRowData:[]}}function Ko(n){return{rowStyleRules:Array.isArray(n.rowStyleRules)?n.rowStyleRules:[],theme:Vo(n)}}function Wo(n){return{editType:n.editType==="fullRow"?"fullRow":"cell",editableIndicator:n.editableIndicator==="always"||n.editableIndicator==="none"?n.editableIndicator:"hover",rowDragPolicy:n.rowDragPolicy,undoStackSize:I(n.undoStackSize,100,0,!0),asyncTransactionWaitMillis:I(n.asyncTransactionWaitMillis,16,0,!0)}}function $o(n){return{detailRowHeight:I(n.detailRowHeight,240,1)}}function Uo(n){let e=typeof n.pagination=="object"?n.pagination:void 0,t=I(e?.pageSize,20,1,!0);return{paginationEnabled:n.pagination!==!1&&n.datasource==null,paginationMode:e?.mode==="server"?"server":"client",paginationPage:I(e?.page,1,1,!0),paginationTotal:I(e?.total,0,0,!0),paginationPageSize:t,paginationPageSizeOptions:Bo(n,t),paginationShowTotal:e?e.showTotal!==!1:!0,paginationShowSizeSelector:e?e.showPageSizeSelector!==!1:!0}}function hr(n){return{watermarkEnabled:n.watermark!=null&&n.watermark!==!1,watermarkConfig:n.watermark==null||n.watermark===!1?null:n.watermark===!0?{text:"MachTable"}:n.watermark}}function jo(n){return{advancedFilterModel:V(n.advancedFilterModel),persistence:ze(n.persistence),locale:n.locale??{},tooltipShowDelay:I(n.tooltipShowDelay,600,0),statusBarEnabled:n.statusBar===!0||typeof n.statusBar=="object"&&n.statusBar!=null,statusBarPanels:typeof n.statusBar=="object"&&n.statusBar?.panels?n.statusBar.panels:["rowCount","selectedRowCount","rangeAggregate"]}}function qo(n){return{datasourceMode:n.datasourceMode==="block"?"block":"sequential",blockSize:I(n.blockSize,100,1,!0),infiniteBufferRows:I(n.infiniteBufferRows,40,0,!0),maxBlocksInCache:I(n.maxBlocksInCache,12,1,!0),datasourceMaxConcurrentRequests:I(n.datasourceMaxConcurrentRequests,4,1,!0),blockPrefetch:I(n.blockPrefetch,1,0,!0),datasourceRowCount:n.datasourceRowCount==null?null:I(n.datasourceRowCount,0,0,!0),dataProcessorMinRows:I(n.dataProcessorMinRows,5e3,1,!0),datasourceRetryCount:I(n.datasourceRetryCount,2,0,!0),datasourceRetryDelay:I(n.datasourceRetryDelay,300,0,!0),datasourceRetryJitter:Math.min(1,I(n.datasourceRetryJitter,.15,0))}}var Yo=["detailRowRenderer","isRowExpandable","aggFuncs","components","actionPolicy","summaryMethod","datasource","getRowHeight","tooltipComponent","getContextMenuItems","initialState","rowEditValidator","isTreeRowExpandable","loadTreeChildren","dataProcessor"];function Xo(n,e){for(let t of Yo)n[t]&&Reflect.set(e,t,n[t])}function Jo(n,e){for(let t of Object.keys(n))t.startsWith("on")&&typeof n[t]=="function"&&Reflect.set(e,t,n[t])}function si(n){let e=Ho(n.size),t={...Fo(n),..._o(n,e),...Ko(n),...Wo(n),...$o(n),...Uo(n),...hr(n),...jo(n),...qo(n),features:Array.isArray(n.features)?n.features:[]};return Xo(n,t),Jo(n,t),t}function ai(n){return Array.isArray(n)?n.filter(e=>typeof e=="string"&&e.length>0):typeof n=="string"&&n.length>0?[n]:[]}function pe(n,e){return ai(n.type).includes(e)}function li(n,e,t={}){let r={};for(let o of ai(n.type)){let s=t[o];s&&Object.assign(r,s)}let i={...e,...r,...n};return i.status&&!i.cellRenderer&&(i.cellRenderer="statusTag"),i}var pr=new WeakMap,We=new WeakMap,$e=new WeakMap;function xe(n){let e=pr.get(n);return e||(e={},pr.set(n,e)),e}function fr(n){return pr.get(n)}function di(n,e){e?We.set(n,e):We.delete(n)}function ci(n){let e=We.get(n);return We.delete(n),e}function ui(n,e){e?$e.set(n,e):$e.delete(n)}function mr(n){let e=$e.get(n);return $e.delete(n),e}function gr(n){if(n==null)return"";if(n instanceof Date)return n.toLocaleDateString();if(typeof n=="object")try{return JSON.stringify(n)}catch{return String(n)}return String(n)}function k(n,e){let t=fr(e);if(!t)return;t.flashTimer&&clearTimeout(t.flashTimer),t.flashTimer=void 0;let r=t.destroy;if(t.destroy=void 0,t.refresh=void 0,t.rendererDefinition=void 0,t.rendererRowId=void 0,t.rendererColumnId=void 0,!!r)try{r()}catch(i){n.reportError(i,"cellRenderer.destroy",{colId:e.dataset.colId})}}function hi(n,e,t,r,i,o){let s=n.r.tooltipComponent?"":o,a=r.colDef.tooltipValueGetter;if(a)try{s=a({api:n.api,colDef:r.colDef,column:r,node:t,data:t.data,value:i})??o}catch(l){n.reportError(l,"tooltipValueGetter",{colId:r.id,rowId:t.id})}s?e.setAttribute("title",s):e.removeAttribute("title")}function Zo(n,e,t,r,i,o){let s=fr(e);if(!s?.refresh||s.rendererDefinition!==i||s.rendererRowId!==t.id||s.rendererColumnId!==r.id)return!1;try{return e.querySelector(":scope > .mach-cell-edit-trigger")?.remove(),s.refresh(o)!==!1}catch(a){return n.reportError(a,"cellRenderer.refresh",{colId:r.id,rowId:t.id}),!1}}function te(n,e,t){return q(n,e,t,n.d(e,t))}function q(n,e,t,r){let i=t.colDef.valueFormatter;if(i)try{let o=i({api:n.api,colDef:t.colDef,column:t,node:e,data:e.data,value:r});return o==null?"":String(o)}catch(o){n.reportError(o,"valueFormatter",{colId:t.id,rowId:e.id})}return gr(r)}function Ue(n,e,t,r){let i=r.colDef.cellStyle,o=xe(e),s=o.styleKeys;if(s)for(let d of s)Reflect.set(e.style,d,"");if(!i){o.styleKeys=void 0;return}let a;if(typeof i=="function"){let d=n.d(t,r);try{a=i({api:n.api,colDef:r.colDef,column:r,node:t,data:t.data,value:d,rowIndex:t.rowIndex})}catch(c){n.reportError(c,"cellStyle",{colId:r.id,rowId:t.id}),a=null}}else a=i;if(!a){o.styleKeys=void 0;return}let l=Object.keys(a);for(let d of l)Reflect.set(e.style,d,Reflect.get(a,d));o.styleKeys=l}function je(n,e,t,r){let i=n.d(t,r),o=te(n,t,r),s=r.colDef.cellRenderer,a=typeof s=="string"?n.lc(s):s;if(a){let l={api:n.api,colDef:r.colDef,column:r,node:t,data:t.data,value:i,formatted:o,rowIndex:t.rowIndex,rendererParams:r.colDef.cellRendererParams};if(Zo(n,e,t,r,a,l)){hi(n,e,t,r,i,o);return}k(n,e);let d;try{d=a(l)}catch(c){n.reportError(c,"cellRenderer",{colId:r.id,rowId:t.id}),e.textContent=o;return}if(typeof d=="string")e.textContent=d;else if(d instanceof HTMLElement)e.replaceChildren(d);else if(d&&typeof d=="object"&&d.el instanceof HTMLElement){let c=d;e.replaceChildren(c.el);let u=xe(e);u.destroy=c.destroy,c.refresh&&(u.refresh=h=>c.refresh(h),u.rendererDefinition=a,u.rendererRowId=t.id,u.rendererColumnId=r.id)}else e.textContent=""}else k(n,e),e.textContent=o;hi(n,e,t,r,i,o)}function Qo(n,e,t){let r=e.colDef.align;if(r==="center"){n.push("mach-cell--center");return}if(r==="right"){n.push("mach-cell--right");return}(pe(e.colDef,"rightAligned")||pe(e.colDef,"numericColumn")||typeof t=="number")&&n.push("mach-cell--num")}function es(n,e,t,r,i){let o=r.colDef.cellClass;if(!o)return;if(typeof o=="string"){e.push(o);return}if(Array.isArray(o)){e.push(...o);return}let s={api:n.api,colDef:r.colDef,column:r,node:t,data:t.data,value:i,rowIndex:t.rowIndex};try{let a=o(s);typeof a=="string"?e.push(a):Array.isArray(a)&&e.push(...a)}catch(a){n.reportError(a,"cellClass",{colId:r.id,rowId:t.id})}}function ts(n,e,t){e.classList.contains("mach-cell--focus")&&n.push("mach-cell--focus"),e.classList.contains("mach-cell--editing")&&n.push("mach-cell--editing"),t.colDef.wrapText&&n.push("mach-cell--wrap")}function Re(n,e,t,r){let i=n.d(t,r),o=["mach-cell"];Qo(o,r,i),es(n,o,t,r,i),ts(o,e,r);let s=o.join(" ");e.className!==s&&(e.className=s)}function Se(n,e){return n&&Object.prototype.hasOwnProperty.call(n,e)?n[e]:void 0}function qe(n,e){if(n==null||n===""||!e||typeof e!="object")return;let t=Se(e,String(n));return typeof t=="string"?{color:t}:t}var Ye=class{constructor(e){this.e=e;this.Xn="";this.kr=!0}Jn(){var i;let e=getComputedStyle(this.e.o.root),t=`${e.getPropertyValue("--mach-header-font-weight")||650} ${e.fontSize} ${e.fontFamily}`;this[i="kr"]||(this[i]=t!==this.Xn),this.Xn=t;let r=!1;for(let o of this.e.n.c()){if(!this.kr&&o.minWidth!=null)continue;let s=o.colDef;if(o.minWidth=this.dc(o),o.manualWidth==null&&s.width==null&&s.autoWidth!==!1&&!o.hasCheckbox&&!o.isDetailToggle){let a=this.ma(o);r=a!==o.contentWidth||r,o.contentWidth=a}}return this.kr=!1,r}ga(e){return this.Lr===void 0&&(this.Lr=document.createElement("canvas").getContext("2d")),this.Lr?(this.Lr.font=this.Xn,this.Lr.measureText(e).width):e.replace(/[^\x00-\xff]/g,"mm").length*7}dc(e){let t=e.colDef,r=t.headerName??t.field??e.id;return Math.ceil(Math.max(t.minWidth??0,this.ga(r)+r.length*.15+28+(e.sortable?20:0)+(e.filterable?28:0)+(this.e.r.columnMenu&&!e.hasCheckbox&&!t.suppressColumnMenu?22:0)))}ma(e){let t=28,r=this.e.i.be(),i=Math.min(r.length,100);for(let o=0;o<i;o++){let s=r[i===1?0:Math.floor(o*(r.length-1)/(i-1))],a=this.e.d(s,e),l=qe(a,e.colDef.status)?.label??q(this.e,s,e,a);t=Math.max(t,this.ga(l.slice(0,128))+(e.colDef.status?44:28))}return Math.ceil(Math.min(z(e.colDef.maxWidth)??360,t))}};function f(n,e,t){let r=document.createElement(n);if(e&&(r.className=e),t)for(let i of Object.keys(t))r.setAttribute(i,t[i]);return r}function G(n,e){if(n.classList.add("mach-portal"),!e)return;let t=window.getComputedStyle(e);for(let r=0;r<t.length;r++){let i=t.item(r);if(!i.startsWith("--mach-"))continue;let o=t.getPropertyValue(i).trim();o&&n.style.setProperty(i,o)}n.style.colorScheme=t.colorScheme}function E(n,e,t){return n<e?e:n>t?t:n}function Y(n,e,t=4){let r=e.getBoundingClientRect(),i=n.getBoundingClientRect(),o=r.bottom+t,s=o+i.height>window.innerHeight-8?r.top-i.height-t:o;n.style.left=`${E(r.left,8,Math.max(8,window.innerWidth-i.width-8))}px`,n.style.top=`${E(s,8,Math.max(8,window.innerHeight-i.height-8))}px`}var pi=0;function fi(n="rg"){return pi++,`${n}-${pi}`}var mi='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M2 3.5h12L9.5 8v4.5L6.5 14V8L2 3.5z"/></svg>',gi='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 3l4 5H4l4-5z"/></svg>',yi='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 13l4-5H4l4 5z"/></svg>',vi='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.35" stroke-linecap="round"><path d="M2 4h3m3 0h6M2 8h7m3 0h2M2 12h1m3 0h8"/><circle cx="6.5" cy="4" r="1.35"/><circle cx="10.5" cy="8" r="1.35"/><circle cx="4.5" cy="12" r="1.35"/></svg>';var Xe=class{constructor(e){this.cc=e;this.Di=new Map}on(e,t){let r=this.Di.get(e);return r||(r=new Set,this.Di.set(e,r)),r.add(t),()=>{r.delete(t)}}once(e,t){let r=this.on(e,i=>{r(),t(i)});return r}emit(e,t){let r=this.Di.get(e);if(r)for(let i of[...r])try{i(t)}catch(o){console.error(`[mach-table] error in "${e}" listener`,o),this.cc?.(o,e)}}clear(){this.Di.clear()}};var X=class{constructor(e,t){this.manualWidth=null;this.contentWidth=null;this.flex=null;this.currentWidth=0;this.parentGroup=null;this.level=0;this.isDetailToggle=!1;this.id=e,this.colDef=t,this.hide=t.hide??!1;let r=t.pinned;this.pinned=r===!0?"left":r===!1||r==null?null:r,this.resetWidth()}get sortable(){return this.colDef.sortable!==!1}get resizable(){return this.colDef.resizable!==!1}get movable(){return this.colDef.movable!==!1}get filterable(){return this.colDef.filter!=null&&this.colDef.filter!==!1}get filterType(){let e=this.colDef.filter;return e===!0?"text":e??"text"}get hasCheckbox(){return this.colDef.checkboxSelection===!0}resetWidth(){this.manualWidth=null,this.contentWidth=null,this.flex=z(this.colDef.flex)??null}};var re=class n{constructor(e,t){this.parent=null;this.children=[];this.groupId=e,this.def=t}get headerName(){return this.def.headerName??this.def.groupId??""}getLeafColumns(e=[]){for(let t of this.children)t instanceof n?t.getLeafColumns(e):e.push(t);return e}};function fe(n){return Array.isArray(n.children)}var Me=150,rs=80;function J(n,e){let t=z(e.minWidth)??rs,r=z(e.maxWidth)??Number.MAX_SAFE_INTEGER,i=z(n)??z(e.width)??Me;return Math.max(t,Math.min(r,i))}function bi(n,e,t,r){let i=r.map((s,a)=>a).filter(s=>r[s]>0),o=t-e.reduce((s,a)=>s+a,0);for(;Math.abs(o)>.001&&i.length;){let s=i.reduce((l,d)=>l+r[d],0),a=0;if(i=i.filter(l=>{let d=e[l];return e[l]=J(d+o*r[l]/s,n[l]),a+=e[l]-d,e[l]!==d}),Math.abs(a)<1e-4)break;o-=a}}function wi(n,e){let t=n.map(r=>J(r.width??Me,r));return e>t.reduce((r,i)=>r+i,0)&&bi(n,t,e,n.map(r=>r.flex??0)),t}function Je(n,e){let t=n.map(r=>J(r.width??Me,r));return Number.isFinite(e)&&e>0&&bi(n,t,e,[...t]),t}var yr="__rg_detail_toggle__";function Ie(n){return z(n)!==void 0}var Ze=class{constructor(e){this.e=e;this.X=[];this.ya=new Map;this.Be=[];this.Zn=[];this.Pr=[];this.Qn=[];this.ze=[];this.eo=[];this.Zt=1;this.to=new Map;this.uc=0}Gr(e){this.eo=e?[...e]:[];let t=new Map(this.X.map(s=>[s.id,s])),r=this.e.r.defaultColDef,i=new Set(this.e.r.masterDetail&&this.e.r.detailToggleColumn?[yr]:[]),o=(s,a,l)=>s.map((d,c)=>{if(fe(d)){let C=d.groupId??d.headerName??`group_${c}_${l}`,R=new re(C,d);return R.parent=a,R.children=o(d.children,R,l+1),R}let u=d,h=u.colId??u.field??`col_${c}`,p=h,m=2;for(;i.has(p);)p=`${h}_${m++}`;i.add(p);let b=new X(p,li(u,r,this.e.r.columnTypes));b.parentGroup=a,b.level=l;let w=t.get(p);return w&&(b.manualWidth=w.manualWidth,b.contentWidth=w.contentWidth,b.flex=w.flex,b.hide=w.hide,b.pinned=w.pinned),b});if(this.Be=o(this.eo,null,0),this.e.r.masterDetail&&this.e.r.detailToggleColumn){let s=new X(yr,{colId:yr,headerName:"",width:38,pinned:"left",sortable:!1,resizable:!1,movable:!1,filter:!1});s.isDetailToggle=!0,this.Be.unshift(s)}if(this.X=this.Ei(this.Be),this.ya=new Map(this.X.map(s=>[s.id,s])),this.Zt=this.X.reduce((s,a)=>Math.max(s,a.level+1),1),this.ze=this.ze.filter(s=>this.X.some(a=>a.id===s.colId)),this.ze.length===0){let s=[];for(let a of this.X)a.colDef.initialSort&&s.push({colId:a.id,direction:a.colDef.initialSort});this.ze=s}this.Qt()}Ei(e,t=[]){for(let r of e)r instanceof re?this.Ei(r.children,t):t.push(r);return t}Qt(){let e=this.X.filter(t=>!t.hide);this.Zn=e.filter(t=>t.pinned==="left"),this.Qn=e.filter(t=>t.pinned==="right"),this.Pr=e.filter(t=>t.pinned===null),this.to.clear(),this.c().forEach((t,r)=>this.to.set(t.id,r))}_e(e){return this.to.get(e)??-1}te(){return this.X}xi(){return this.eo}hc(){return this.Be}pc(){return this.Zt}k(e){return this.ya.get(e)}T(e){return e==="left"?this.Zn:e==="right"?this.Qn:this.Pr}c(){return[...this.Zn,...this.Pr,...this.Qn]}nt(){return this.c().filter(e=>e.colDef.rowGroup===!0)}fc(){return this.c().filter(e=>e.colDef.aggFunc!=null&&e.colDef.rowGroup!==!0)}ro(){return this.Pr.some(e=>e.colDef.colSpan!=null)}va(){let e=this.c();return this.Pr.find(t=>!t.hasCheckbox&&!t.isDetailToggle)??e.find(t=>!t.hasCheckbox&&!t.isDetailToggle)??e[0]}er(e){return e.pinned==="left"?"left":e.pinned==="right"?"right":"center"}ba(e){this.uc=e;let t=e,r=[],i=[];for(let s of this.c()){let a=this.Ri(s);s.pinned!=null||s.colDef.suppressSizeToFit||s.manualWidth!=null?(s.currentWidth=J(a.width??Me,a),t-=s.currentWidth):(r.push(s),i.push(a))}let o=this.e.r.columnLayout==="fit"?Je(i,Math.max(0,t)):wi(i,Math.max(0,t));r.forEach((s,a)=>{s.currentWidth=o[a]})}Ri(e){let t=e.colDef;return{width:e.manualWidth??e.contentWidth??t.width??void 0,minWidth:e.minWidth??t.minWidth,maxWidth:t.maxWidth,flex:e.manualWidth==null?e.flex??void 0:void 0}}Se(e,t){return Ie(t)?(e.manualWidth=J(t,this.Ri(e)),e.flex=null,!0):!1}wa(e,t){return Ie(t)?(e.resetWidth(),e.contentWidth=J(t,this.Ri(e)),!0):!1}no(e,t){let r=this.k(e);!r||r.hide===!t||(r.hide=!t,this.Qt())}At(e,t){let r=this.k(e);if(!r)return!1;let i=this.er(r),o=u=>r.parentGroup?!0:this.er(u)===i,s=r.parentGroup?r.parentGroup.children:this.Be,a=s.filter(u=>u instanceof X&&!u.hide&&o(u)),l=a.indexOf(r);if(l<0)return!1;a.splice(l,1);let d=Math.max(0,Math.min(t,a.length));a.splice(d,0,r);let c=[];return s.forEach((u,h)=>{u instanceof X&&!u.hide&&o(u)&&c.push(h)}),c.length!==a.length?!1:(c.forEach((u,h)=>{s[u]=a[h]}),this.X=this.Ei(this.Be),this.Qt(),!0)}oo(e,t){let r=this.k(e);!r||!r.movable||(r.pinned=t,this.Qt())}Si(){return this.X.map(e=>({colId:e.id,hide:e.hide,width:e.manualWidth??e.currentWidth,flex:e.flex,widthMode:e.manualWidth==null?"auto":"manual",contentWidth:e.contentWidth??void 0,pinned:e.pinned}))}Ca(e){let t=new Map(e.map(r=>[r.colId,r]));for(let r of this.X){let i=t.get(r.id);i&&this.mc(r,i)}this.gc(e),this.Qt()}mc(e,t){typeof t.hide=="boolean"&&(e.hide=t.hide),t.widthMode==="auto"?(e.resetWidth(),Ie(t.flex)&&(e.flex=t.flex)):Ie(t.flex)?(e.flex=t.flex,e.manualWidth=null):this.Se(e,t.width),Ie(t.contentWidth)&&(e.contentWidth=J(t.contentWidth,this.Ri(e))),e.movable&&(t.pinned==="left"||t.pinned==="right"||t.pinned===null)&&(e.pinned=t.pinned)}gc(e){let t=new Map;e.forEach((r,i)=>t.set(r.colId,i));for(let r of["left","center","right"]){let i=[],o=[];this.Be.forEach((s,a)=>{s instanceof X&&!s.hide&&s.parentGroup===null&&s.movable&&this.er(s)===r&&(i.push(a),o.push(s))}),o.sort((s,a)=>(t.get(s.id)??Number.MAX_SAFE_INTEGER)-(t.get(a.id)??Number.MAX_SAFE_INTEGER)),i.forEach((s,a)=>{this.Be[s]=o[a]})}this.X=this.Ei(this.Be)}so(){for(let e of this.X){e.resetWidth(),e.hide=e.colDef.hide??!1;let t=e.colDef.pinned;e.pinned=t===!0?"left":t===!1||t==null?null:t}this.Qt()}J(){return this.ze.map(e=>({...e}))}Nr(e){if(!e||e.length===0){this.ze=[];return}this.ze=e.filter(t=>this.X.some(r=>r.id===t.colId)&&(t.direction==="asc"||t.direction==="desc")).map(t=>({colId:t.colId,direction:t.direction}))}Mi(e,t){let r=[...this.ze],i=r.findIndex(l=>l.colId===e.id),o=i>=0?r[i].direction:null,s=o===null?"asc":o==="asc"?"desc":null;t&&this.e.r.multiSort?s===null?i>=0&&r.splice(i,1):i>=0?r[i]={colId:e.id,direction:s}:r.push({colId:e.id,direction:s}):(r.length=0,s&&r.push({colId:e.id,direction:s})),this.ze=r}};function ie(n,e){if(n instanceof Error)return n;let t=new Error(typeof n=="string"?n:e);return t.name="AbortError",t}var is=()=>ie(void 0,"[MachTable] Operation cancelled.");function Qe(n,e,t=is){return e?new Promise((r,i)=>{let o=()=>{e.removeEventListener("abort",o),i(t())};if(n.then(r,i).finally(()=>e.removeEventListener("abort",o)),e.aborted){o();return}e.addEventListener("abort",o,{once:!0})}):n}function Ci(n){return n==null?"":String(n).toLowerCase()}function ns(n,e,t){let r=Ci(n),i=o=>{let s=(o.value??"").toLowerCase();switch(o.match){case"contains":return r.includes(s);case"notContains":return!r.includes(s);case"equals":return r===s;case"notEquals":return r!==s;case"startsWith":return r.startsWith(s);case"endsWith":return r.endsWith(s);case"blank":return r==="";case"notBlank":return r!=="";default:return!0}};return e.length===0||(t==="or"?e.some(i):e.every(i))}function os(n,e,t){switch(t.match){case"equals":return n===e;case"notEquals":return n!==e;case"lessThan":return n<e;case"lessThanOrEqual":return n<=e;case"greaterThan":return n>e;case"greaterThanOrEqual":return n>=e;case"inRange":return n>=e&&n<=(t.value2??e);default:return!0}}function ss(n,e){let t=n==null||n==="";if(e.match==="blank")return t;if(e.match==="notBlank")return!t;if(t)return!1;let r=typeof n=="number"?n:Number(n);if(Number.isNaN(r))return!1;let i=e.value;return i==null||Number.isNaN(i)?!1:os(r,i,e)}function as(n,e,t){let r=i=>ss(n,i);return e.length===0||(t==="or"?e.some(r):e.every(r))}function vr(n){if(n==null||n==="")return null;if(n instanceof Date)return isNaN(n.getTime())?null:n.getTime();if(typeof n=="number")return n;let e=Date.parse(String(n));return isNaN(e)?null:e}function ls(n,e,t){let r=vr(n),i=o=>{let s=r==null;if(o.match==="blank")return s;if(o.match==="notBlank")return!s;if(s)return!1;let a=r,l=o.value!=null?vr(o.value):null;if(l==null)return!1;switch(o.match){case"equals":return a===l;case"notEquals":return a!==l;case"lessThan":return a<l;case"greaterThan":return a>l;case"inRange":{let d=o.value2!=null?vr(o.value2):null;return d!=null?a>=l&&a<=d:a>=l}default:return!0}};return e.length===0||(t==="or"?e.some(i):e.every(i))}function ds(n,e){return e.length===0?!0:e.some(t=>t==null&&n==null||t===n)}function Ti(n,e){let t=e.type!=="set"&&e.operator==="or"?"or":"and";switch(e.type){case"text":return ns(n,e.conditions,t);case"number":return as(n,e.conditions,t);case"date":return ls(n,e.conditions,t);case"set":return ds(n,e.values);default:return!0}}function Di(n,e,t){if(n.kind==="condition"){let i=e.get(n.colId);return i?o=>Ti(t(o,i),n.filter):()=>!0}let r=n.children.map(i=>Di(i,e,t));return i=>{let o=n.operator==="or"?r.some(s=>s(i)):r.every(s=>s(i));return n.not?!o:o}}function br(n,e,t,r,i){let o=new Map(n.map(d=>[d.id,d])),s=Object.entries(e).flatMap(([d,c])=>{let u=o.get(d);return u?[{column:u,filter:c}]:[]}),a=t?Di(t.root,o,i):()=>!0,l=r?.trim().toLowerCase().split(/\s+/).filter(Boolean)??[];return d=>!s.every(({column:c,filter:u})=>Ti(i(d,c),u))||!a(d)?!1:l.every(c=>n.some(u=>Ci(i(d,u)).includes(c)))}var Ei=typeof Intl<"u"?new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}):null;function cs(n,e){let t=n==null||n==="",r=e==null||e==="";return!t&&!r?null:t&&r?0:t?1:-1}function us(n,e){let t=Number.isNaN(n),r=Number.isNaN(e);return t||r?t===r?0:t?1:-1:n-e}function hs(n,e){return n===e?0:n?1:-1}function et(n,e){let t=cs(n,e);if(t!==null)return t;if(typeof n=="number"&&typeof e=="number")return us(n,e);if(n instanceof Date&&e instanceof Date)return n.getTime()-e.getTime();if(typeof n=="boolean"&&typeof e=="boolean")return hs(n,e);let r=String(n),i=String(e);return Ei?Ei.compare(r,i):r.localeCompare(i)}function wr(n,e,t,r){let i=new Map(t.map(a=>[a.id,a])),o=e.flatMap(a=>{let l=i.get(a.colId);return l?[{column:l,compare:l.colDef.comparator??et,direction:a.direction}]:[]}),s=n.map(a=>({node:a,values:o.map(({column:l})=>r(a,l))}));return s.sort((a,l)=>{for(let d=0;d<o.length;d++){let c=o[d],u=c.compare(a.values[d],l.values[d],a.node,l.node);if(u!==0)return c.direction==="asc"?u:-u}return 0}),s.map(({node:a})=>a)}function xi(){return{count:0,numeric:0,sum:0,min:1/0,max:-1/0}}function Ri(n,e){n.count++,!(typeof e!="number"||!Number.isFinite(e))&&(n.numeric++,n.sum+=e,n.min=Math.min(n.min,e),n.max=Math.max(n.max,e))}function Si(n,e){return e==="count"?n?.count??0:n?.numeric?e==="min"?n.min:e==="max"?n.max:Number.isFinite(n.sum)?e==="avg"?n.sum/n.numeric:n.sum:null:null}function tt(n,e){let t=xi();for(let r of n)Ri(t,r);return Si(t,e)}var Ae={sum:n=>tt(n,"sum"),avg:n=>tt(n,"avg"),count:n=>n.length,min:n=>tt(n,"min"),max:n=>tt(n,"max"),first:n=>n.length>0?n[0]:null,last:n=>n.length>0?n[n.length-1]:null};function Mi(n,e,t){if(e===Ae.count)return n.length;let r=["sum","avg","min","max"].find(o=>e===Ae[o]);if(!r)return e(n.map(t));let i=xi();for(let o of n)Ri(i,t(o));return Si(i,r)}function rt(n){let e={...Ae,...n??{}};return t=>e[t]}var it="group:";function Ii(n){return n==null?"null":n instanceof Date?JSON.stringify(["date",String(n.getTime())]):JSON.stringify([typeof n,Cr(n)])}function Cr(n){return n==null?"(\u7A7A)":String(n)}function Ai(n){return it+JSON.stringify(n)}function ps(n,e,t){let r=new Map;for(let i of n){let o=t(i,e),s=Ii(o),a=r.get(s);a||(a={key:s,label:Cr(o),rows:[]},r.set(s,a)),a.rows.push(i)}return[...r.values()].sort((i,o)=>i.label.localeCompare(o.label,void 0,{numeric:!0,sensitivity:"base"})||i.key.localeCompare(o.key))}function Li(n,e,t,r,i){let o=[],s=(a,l,d)=>{if(l===e.length)return{display:a,leaves:a};let c=[],u=[];for(let h of ps(a,e[l],t)){let p=[...d,[e[l].id,h.key]],m=Ai(p);o.push(m);let b=s(h.rows,l+1,p);if(c.push({id:m,data:null,rowIndex:-1,selected:!1,isGroup:!0,groupLevel:l,groupKey:h.label,leafNodes:b.leaves,aggValues:r(b.leaves)}),i.has(m))for(let w of b.display)c.push(w);if(l>0)for(let w of b.leaves)u.push(w)}return{display:c,leaves:u}};return{rows:s(n,0,[]).display,ids:o}}function ki(n,e,t,r){let i=new Set([...n].filter(l=>l.startsWith("/g0:")));if(!i.size)return{expanded:n,ambiguous:[]};let o=new Map;for(let l of e){let d=[],c="";for(let u=0;u<t.length;u++){let h=r(l,t[u]);if(d.push([t[u].id,Ii(h)]),c+=`/g${u}:${Cr(h)}`,!i.has(c))continue;let p=Ai(d);o.set(c,o.has(c)&&o.get(c)!==p?null:p)}}let s=new Set([...n].filter(l=>!i.has(l))),a=[];for(let l of i){let d=o.get(l);d?s.add(d):d===null?a.push(l):s.add(l)}return{expanded:s,ambiguous:a}}function fs(n,e){let t=n?[n.root]:[];for(;t.length;){let r=t.pop();if(r.kind==="condition")e.add(r.colId);else for(let i of r.children)t.push(i)}}function Pi(n){let e=new Set(Object.keys(n.filterModel));fs(n.advancedFilter,e);let t=new Set(n.sortModel.map(a=>a.colId));for(let a of t)e.add(a);let r=n.columns.some(a=>a.colDef.rowGroup===!0),i=!!n.quickFilter?.trim(),o=n.columns.filter(a=>e.has(a.id)||i||a.colDef.rowGroup===!0||r&&a.colDef.aggFunc!=null),s=new Set;for(let a of o){let l=a.colDef;if(r&&l.rowGroup!==!0&&l.aggFunc!=null&&n.customAggregates?.[l.aggFunc]||l.valueGetter||t.has(a.id)&&l.comparator||!l.field)return null;s.add(l.field)}return[...s]}function Gi(n){return n!=null&&(typeof n=="object"||typeof n=="function")}function Ni(n,e){let t=new WeakMap;for(let r of n){if(r.data==null)continue;let i=e.map(o=>_(r.data,o));i.some(Gi)||t.set(r,i)}return t}function Oi(n,e,t,r){return t.length?!r||n===e||n==null||e==null?!0:t.some((i,o)=>{let s=_(e,i);return Gi(s)||!Object.is(r[o],s)}):!1}function ne(n){return ie(n.reason,"Block request aborted")}function nt(n){return Number.isFinite(n)?Math.max(1,Math.trunc(n)):1}var ot=class{constructor(e,t,r=4){this.maxBlocks=e;this.uo=t;this.maxConcurrentRequests=r;this.re=new Map;this.Z=new Map;this.Ta=0;this.ao=0;this.lo=0;this.Da=0;this.Ea=0;this.Ii=0;this.Ai=new Set;this.maxBlocks=nt(e),this.maxConcurrentRequests=nt(r)}configure(e,t=this.maxConcurrentRequests){this.maxBlocks=nt(e),this.maxConcurrentRequests=nt(t),this.co(),this.Li()}yc(e){this.Ai=e,this.co()}peek(e){let t=this.re.get(e);if(t)return t.touchedAt=++this.Ta,t}has(e){return this.re.has(e)}invalidate(e){let t=this.Z.get(e);t&&(this.Z.delete(e),t.controller.abort(),t.state==="queued"&&t.reject(ne(t.controller.signal)));let r=this.re.get(e);r&&(this.re.delete(e),this.uo?.(e,r))}load(e,t,r,i=0){if(r?.aborted)return Promise.reject(ne(r));let o=this.peek(e);if(o)return this.lo++,Promise.resolve(o);let s=this.Z.get(e);if(s)return this.lo++,s.priority=Math.max(s.priority,i),this.Li(),this.xa(e,s,r);this.Da++;let a=new AbortController,l,d,c=new Promise((p,m)=>{l=p,d=m}),u={controller:a,promise:c,consumers:0,loader:t,priority:i,state:"queued",resolve:l,reject:d};this.Z.set(e,u);let h=this.xa(e,u,r);return this.Li(),h}vc(){this.ao++,this.Ai.clear();for(let e of this.Z.values())e.controller.abort(),e.state==="queued"&&e.reject(ne(e.controller.signal));this.Z.clear();for(let[e,t]of this.re)this.uo?.(e,t);this.re.clear()}snapshot(){let e=0,t=0;for(let r of this.re.values())e+=r.rows.length;for(let r of this.Z.values())r.state==="active"&&t++;return{cachedBlockCount:this.re.size,loadingBlockCount:this.Z.size,activeRequestCount:t,queuedRequestCount:Math.max(0,this.Z.size-t),cachedRowCount:e,hitCount:this.lo,missCount:this.Da,evictionCount:this.Ea}}Li(){for(;this.Ii<this.maxConcurrentRequests;){let e,t;for(let[r,i]of this.Z)i.state!=="queued"||i.controller.signal.aborted||(!t||i.priority>t.priority)&&(e=r,t=i);if(e==null||!t)return;this.bc(e,t)}}bc(e,t){t.state="active",this.Ii++;let r=this.ao;this.wc(t).then(i=>{r===this.ao&&!t.controller.signal.aborted&&(this.re.set(e,{rows:i.rows,...i.lastRow==null?{}:{lastRow:i.lastRow},touchedAt:++this.Ta}),this.co()),t.resolve(i)},t.reject).finally(()=>{this.Ii=Math.max(0,this.Ii-1),this.Z.get(e)===t&&this.Z.delete(e),this.Li()})}wc(e){let{signal:t}=e.controller;return Qe(Promise.resolve().then(()=>{if(t.aborted)throw ne(t);return e.loader(t)}),t,()=>ne(t))}xa(e,t,r){return t.consumers++,new Promise((i,o)=>{let s=!1,a=d=>{s||(s=!0,r?.removeEventListener("abort",l),t.consumers=Math.max(0,t.consumers-1),d())},l=()=>a(()=>{t.consumers===0&&this.Z.get(e)===t&&(this.Z.delete(e),t.controller.abort(r?.reason),t.state==="queued"&&t.reject(ne(t.controller.signal))),o(ne(r))});r?.addEventListener("abort",l,{once:!0}),t.promise.then(d=>a(()=>i(d)),d=>a(()=>o(d instanceof Error?d:new Error(String(d??"Block request failed")))))})}co(){let e=Math.max(this.maxBlocks,this.Ai.size+1);for(;this.re.size>e;){let t=-1,r=Number.POSITIVE_INFINITY;for(let[o,s]of this.re)this.Ai.has(o)||s.touchedAt<r&&(t=o,r=s.touchedAt);if(t<0)return;let i=this.re.get(t);this.re.delete(t),this.Ea++,i&&this.uo?.(t,i)}}};function Le(n,e){if(n==null||typeof n!="object")return;let t=n[e];return Array.isArray(t)?t:void 0}var st=class{constructor(e){this.e=e;this.u=[];this.B=[];this.ie=new Map;this.we=[];this.p=new Map;this.ot={};this.st=null;this.Ke=null;this.P=new Set;this.j=new Set;this.tr=[];this.Or=new Map;this.Ra=[];this.G=null;this.rr=!1;this.Sa=!1;this.at=0;this.ki=null;this.Pi=null;this.Gi=new WeakMap;this.Fr=new WeakMap;this.lt=new Map;this.Hr=new Map;this.Vr=0;this.Ni=0;this.dt=null;this.ct=new Map;this.Lt=new Map;this.Oi=new Set;this.kt=new Map;this.ut=new ot(12,e=>this.Ma(e));this.Br=0;this.Fi=null;this.ho=!1;this.Ia=0;this.ae=[];this.W=1;this.Ur=20;this.st=V(e.r.advancedFilterModel)}resolveRowId(e,t,r){let i=this.e.r.resolveRowId;if(!i)return r;try{let o=i({data:e,index:t,api:this.e.api});if(typeof o=="string"&&o.length>0)return o;this.e.reportError(new Error("rowKey must resolve to a non-empty identifier"),"rowKey",{index:t})}catch(o){this.e.reportError(o,"rowKey",{index:t})}return r}get F(){return this.e.r.treeData}get f(){return this.e.r.datasource!=null}get Ce(){return this.f&&this.e.r.datasourceMode==="block"}ir(){if(this.f){if(this.Ce)return this.nr();let e=Math.max(0,this.we.length-this.u.length);return(this.G??this.u.length)+e}return this.we.length}po(){return this.Vr}zr(){return this.Ni}Cc(){return this.Sa}Hi(e){return!this.f||e?.aborted?Promise.resolve():(this.Ni++,this.e.Me(),this.e.api.editing.stop({cancel:!0}),this.e.z.clear(),this.Vi(),this.G=null,this.rr=!1,this.u=[],this.B=[],this.p.clear(),this.P.clear(),this.e._.clear(),this.w(),this.e.h({data:!0}),this.Ce?(this.ut.configure(this.e.r.maxBlocksInCache,this.e.r.datasourceMaxConcurrentRequests),this.Bi(0,e)):this.Aa(0,void 0,e))}Pt(e){this.Sa=e,this.e.o.Pt(e,this.e.y("loading"))}Aa(e,t,r){if(!this.f||this.rr||this.G!=null&&e>=this.G)return Promise.resolve();let i=this.e.r.blockSize,o=t??e+i;if(o<=e)return Promise.resolve();let s=++this.at,a=new AbortController,l=()=>a.abort(r?.reason);return r?.addEventListener("abort",l,{once:!0}),this.ki=a,this.rr=!0,this.Pt(!0),new Promise(d=>{let c=!1;this.Pi=d;let u=h=>{c||(c=!0,r?.removeEventListener("abort",l),s===this.at&&(this.rr=!1,this.ki=null,this.Pi=null,this.Pt(!1),h!=null&&h?.name!=="AbortError"&&this.e.reportError(h,"datasource.getRows",{startRow:e,endRow:o})),d())};this.La(e,o,a.signal,(h,p)=>{if(s!==this.at||this.e.s()||a.signal.aborted){u();return}typeof p=="number"&&p>=0?this.G=p:h.length<o-e&&(this.G=e+h.length);let m=this.u.length===0;this.Tc(h),u(),this.w(),this.e.h({data:!0}),m&&this.e.Te(),this.e.K.zi()},h=>u(a.signal.aborted||this.e.s()?void 0:h??new Error("Datasource request failed")))})}Vi(){this.at++,this.ki?.abort(),this.ki=null,this.rr=!1,this.Pt(!1),this.Pi?.(),this.Pi=null,this.ut.vc(),this.ct.clear(),this.Lt.clear(),this.Oi.clear();for(let[e,t]of this.kt)this.p.get(e)===t&&this.p.delete(e);this.kt.clear()}Tc(e){for(let t of e){if(t==null)continue;let r=this.u.length,i=this.resolveRowId(t,r,`inf-${this.e.or()}`);if(this.p.has(i)){this.e.reportError(new Error(`Duplicate row id: ${i}`),"datasource.getRows",{rowId:i});continue}let o={id:i,data:t,rowIndex:-1,selected:this.e.g.fo(i)};this.u.push(o),this.p.set(i,o),this.B.push(o)}}Bi(e,t,r=0){if(!this.Ce||e<0)return Promise.resolve();if(t?.aborted)return Promise.reject(this.ka(t.reason));let i=this.e.r.blockSize,o=this.at,s=e*i;if(s>=this.nr())return Promise.resolve();let a=this.G==null?s+i:Math.min(this.G,s+i),l=this.ut.load(e,d=>this.Dc(s,a,d),t,r);return this.Pt(this.u.length===0&&this.ut.snapshot().loadingBlockCount>0),l.then(d=>{o!==this.at||t?.aborted||this.e.s()||!this.Ce||!this.ut.has(e)||this.Oi.has(e)||(this.Ec(e,d),this.w(),this.e.h({data:!0}),this.e.K.zi(),o===this.at&&!this.e.s()&&this.Pa(this.e.a.mo().lastExcl-1))}).catch(d=>{throw d?.name!=="AbortError"&&this.e.reportError(d,"datasource.getRows",{startRow:s,endRow:a}),d}).finally(()=>{o===this.at&&this.Pt(this.u.length===0&&this.ut.snapshot().loadingBlockCount>0)})}Dc(e,t,r){return new Promise((i,o)=>{this.La(e,t,r,(s,a)=>i({rows:s,...typeof a=="number"&&a>=0?{lastRow:a}:{}}),s=>o(s instanceof Error?s:new Error(typeof s=="string"?s:"Datasource request failed")))})}La(e,t,r,i,o){let s=this.e.r.datasource,a=0,l=null,d=!1,c=p=>{d||(d=!0,l!=null&&clearTimeout(l),r.removeEventListener("abort",u),p())},u=()=>c(()=>o(this.ka(r.reason)));r.addEventListener("abort",u,{once:!0});let h=()=>{if(d)return;if(r.aborted||this.e.s()){u();return}a++;let p=!1,m=b=>{if(!(p||d)){if(p=!0,r.aborted||this.e.s()){u();return}a<=this.e.r.datasourceRetryCount?l=setTimeout(h,this.retryDelay(a)):c(()=>o(b))}};try{let b=s.getRows({startRow:e,endRow:t,sortModel:this.e.n.J(),filterModel:this.Q(),advancedFilterModel:this.Ie(),quickFilterText:this.Ke,signal:r,onSuccess:(w,C)=>{p||d||(p=!0,c(()=>i(w??[],C)))},fail:m});b&&typeof b.catch=="function"&&b.catch(m)}catch(b){m(b)}};h()}Ec(e,t){let r=this.e.r.blockSize,i=e*r;this.Ma(e),typeof t.lastRow=="number"&&t.lastRow>=0?this.G=t.lastRow:t.rows.length<r&&(this.G=i+t.rows.length),t.rows.forEach((o,s)=>{if(o==null)return;let a=i+s;if(this.G!=null&&a>=this.G)return;let l=this.resolveRowId(o,a,`block-${a}`),d=this.kt.get(l),c=this.p.get(l);if(c&&c!==d&&c.rowIndex!==a){this.e.reportError(new Error(`Duplicate row id: ${l}`),"datasource.getRows",{rowId:l});return}let u=d??{id:l,data:o,rowIndex:a,selected:this.e.g.fo(l)};u.rowIndex=a,u.selected=this.e.g.fo(l),this.kt.delete(l),this.ct.set(a,u),this.Lt.delete(a),this.p.set(l,u),this.Fr.set(u,a+1)}),this.Ga(),this.Oi.add(e)}Ma(e){this.Oi.delete(e);let t=this.e.r.blockSize,r=e*t,i;for(let o=r;o<r+t;o++){let s=this.ct.get(o);s&&(i??(i=new Set(this.e.z.getDirtyRowIds())),this.ct.delete(o),i.has(s.id)?this.kt.set(s.id,s):this.p.get(s.id)===s&&this.p.delete(s.id))}this.Ga()}Ga(){this.u=[...this.ct.entries()].sort(([e],[t])=>e-t).map(([,e])=>e),this.B=this.u}nr(){if(this.G!=null)return this.G;if(this.e.r.datasourceRowCount!=null)return this.e.r.datasourceRowCount;if(this.ct.size===0)return this.e.r.blockSize;let e=0;for(let t of this.ct.keys())e=Math.max(e,t+1);return e+this.e.r.blockSize}xc(e){let t=this.Lt.get(e);if(!t&&(t={id:`__mach_loading_${e}`,data:null,rowIndex:e,selected:!1,loading:!0},this.Lt.set(e,t),this.Lt.size>2e3)){let r=this.Lt.keys().next().value;r!=null&&this.Lt.delete(r)}return t}ka(e){return ie(e,"Operation aborted")}retryDelay(e){let t=Math.min(this.e.r.datasourceRetryDelay*2**Math.max(0,e-1),3e4),r=this.e.r.datasourceRetryJitter;return Math.max(0,Math.round(t*(1+(Math.random()*2-1)*r)))}Rc(e){if(this.Ce){this.Pa(e);return}if(!this.f||this.rr)return;let t=this.u.length;if(this.G!=null&&t>=this.G)return;let r=this.e.r.infiniteBufferRows;if(e+r<t&&e<t)return;let i=this.e.r.blockSize,o=this.G==null?t+i:Math.min(this.G,t+i);this.Aa(t,o)}Pa(e){if(e<0)return;this.Na();let t=this.e.r.blockSize,r=Math.floor(e/t),i=Math.floor(this.e.a.mo().first/t),o=this.e.r.blockPrefetch,s=r<this.Ia?-1:1;this.Ia=r;for(let a=i;a<r;a++)this.Bi(a,void 0,o+2).catch(()=>{});for(let a=0;a<=o;a++){let l=a===0?[r]:[r+s*a,r-s*a];for(let d of l)d<0||d*t>=this.nr()||this.Bi(d,void 0,o-a+1).catch(()=>{})}}We(){return this.Hi().catch(()=>{})}Sc(){return this.Vi(),this.f?this.Hi().catch(()=>{}):(this.G=null,this.ht(this.e.r.rowData),this.e.h({data:!0}),Promise.resolve())}destroy(){this.dt=null,this.Vi(),this.Oa(),this.go(),this.u=this.B=this.we=this.ae=[],this.p.clear(),this.ie.clear(),this.Or.clear(),this.Ra=[],this.P.clear(),this.j.clear(),this.tr=[]}yo(e,t,r){if(!this.Ce)return Promise.resolve();this.Na();let i=this.e.r.blockSize,o=Math.max(0,Math.trunc(e)),s=Math.min(this.nr(),Math.max(o,Math.trunc(t))),a=Math.floor(o/i),l=Math.max(a,Math.floor(Math.max(o,s-1)/i)),d=[];for(let c=a;c<=l;c++)d.push(this.Bi(c,r,100));return Promise.all(d).then(()=>{})}vo(){this.Ce&&(this.Ni++,this.e.Me(),this.e.api.editing.stop({cancel:!0}),this.e.z.clear(),this.Vi(),this.e._.clear(),this.u=[],this.B=[],this.p.clear(),this.w(),this.e.h({data:!0}))}bo(){return this.ut.snapshot()}Na(){let e=new Set(this.e.z.getDirtyRowIds());for(let[l,d]of this.kt)e.has(l)||(this.kt.delete(l),this.p.get(l)===d&&this.p.delete(l));let t=this.e.r.blockSize,r=new Set,{first:i,lastExcl:o}=this.e.a.mo();for(let l=i;l<o;l+=t)r.add(Math.floor(l/t));o>i&&r.add(Math.floor((o-1)/t));let s=this.e.a.D;s&&r.add(Math.floor(s.rowIndex/t));let a=this.e.l.Mc();a!=null&&r.add(Math.floor(a/t)),this.ut.yc(r)}ht(e){this.Ni++,this.e.Me(),this.e.api.editing.stop({cancel:!0}),this.Oa(),this.e.z.clear();let t=this.e.r.resolveRowId,r=this.e.r.childrenKey,i=[],o=[],s=new Map,a=new Map,l=0,d=(c,u,h)=>{let p=l++,m=this.resolveRowId(c,p,`auto-${p}`);if(s.has(m))return this.e.reportError(new Error(`Duplicate row id: ${m}`),"rowData",{rowId:m,index:p}),null;let b=this.F?Le(c,r):void 0,w={id:m,data:c,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(b)};if(this.Gi.set(w,u),i.push(w),s.set(m,w),h!=null){let C=a.get(h)??[];C.push(m),a.set(h,C)}else o.push(w);if(this.F&&Array.isArray(b))for(let C of b)C!=null&&d(C,u+1,m);return w};(e??[]).forEach(c=>{c!=null&&d(c,0,null)}),this.u=i,this.B=o,this.ie=a,this.p=s,this.e._.clear();for(let c of[...this.P])s.has(c)||this.P.delete(c);if(this.e.r.defaultExpandAll)for(let c of i)this.Fa(c.id)>0&&this.P.add(c.id);this.e.g.Ha(t!=null),this.w()}_r(e){return this.ie.get(e)??[]}Fa(e){return this.ie.get(e)?.length??0}wo(e){return this.Fa(e)>0}isTreeRowLoading(e){return this.p.get(e)?.treeLoading===!0}Oa(){for(let e of this.lt.values())e.abort();this.lt.clear(),this.Hr.clear()}loadTreeChildren(e,t=!1){let r=this.p.get(e),i=this.e.r.loadTreeChildren;if(!this.F||!r?.data||!i)return Promise.resolve([]);if(!t&&r.treeChildrenLoaded)return Promise.resolve(this._r(e).flatMap(l=>{let d=this.p.get(l)?.data;return d==null?[]:[d]}));let o=this.Hr.get(e);if(o&&!t)return o;this.lt.get(e)?.abort();let s=new AbortController;this.lt.set(e,s),r.treeLoading=!0,r.treeLoadError=void 0,this.e.h({data:!0});let a=Promise.resolve().then(()=>i({data:r.data,node:r,api:this.e.api,signal:s.signal})).then(l=>{if(s.signal.aborted||this.e.s())return[];if(!Array.isArray(l))throw new TypeError("[MachTable] loadTreeChildren must resolve to an array.");return this.Ic(r,l),r.treeChildrenLoaded=!0,r.treeLoadError=void 0,this.e.emit("treeChildrenLoaded",{rowId:e,rowNode:r,children:l}),l}).catch(l=>{if(s.signal.aborted||l?.name==="AbortError")return[];throw r.treeLoadError=l,r.treeChildrenLoaded=!1,this.e.reportError(l,"treeData.loadChildren",{rowId:e}),this.e.emit("treeChildrenLoadFailed",{rowId:e,rowNode:r,error:l}),l}).finally(()=>{this.lt.get(e)===s&&(this.lt.delete(e),this.Hr.delete(e),r.treeLoading=!1,this.e.h({data:!0}))});return this.Hr.set(e,a),a}Ic(e,t){let r=new Set,i=[...this._r(e.id)];for(;i.length>0;){let s=i.pop();r.has(s)||(r.add(s),i.push(...this._r(s)))}this.Ac(t,r);for(let s of r)this.lt.get(s)?.abort(),this.lt.delete(s),this.Hr.delete(s),this.ie.delete(s),this.p.delete(s),this.P.delete(s);this.ie.delete(e.id);let o=this.Co(e)+1;for(let s of t)s!=null&&this.To(e,s,o);this.Va(),this.e.g.Ha(this.e.r.resolveRowId!=null),this.w(),this.e.h({data:!0})}Ac(e,t){let r=this.e.r.resolveRowId,i=r?new Set([...this.p.keys()].filter(l=>!t.has(l))):null,o=new WeakSet,s=[...e],a=0;for(;s.length>0;){let l=s.pop();if(l==null)continue;if(typeof l=="object"){if(o.has(l))throw new TypeError("[MachTable] Lazy tree children contain a cyclic object graph.");o.add(l)}if(r&&i){let c=r({data:l,index:a++,api:this.e.api});if(typeof c!="string"||c.length===0)throw new TypeError("[MachTable] rowKey must resolve to a non-empty identifier for lazy tree children.");if(i.has(c))throw new Error(`Duplicate row id: ${c}`);i.add(c)}let d=Le(l,this.e.r.childrenKey);d&&s.push(...d)}}Kr(e,t=!0){let r=this.e.r.resolveRowId,i=[],o=[],s=[];if(e.remove?.length){let l=new Set,d=new Set,c=h=>{if(r){let m=[this.resolveRowId(h,-1,`__missing_remove_${this.e.or()}`)];for(;m.length>0;){let b=m.pop();if(!l.has(b)){l.add(b);for(let w of this.ie.get(b)??[])m.push(w)}}}else{let p=[h];for(;p.length>0;){let m=p.pop();d.add(m);let b=this.F?Le(m,this.e.r.childrenKey):void 0;if(b)for(let w of b)p.push(w)}}};e.remove.forEach(c),this.u=this.u.filter(h=>{let p=l.has(h.id)||h.data!=null&&d.has(h.data);return p&&(s.push(h.id),this.p.delete(h.id),this.ie.delete(h.id)),!p});let u=new Set(this.u);this.B=this.B.filter(h=>u.has(h))}if(e.update?.length)for(let l of e.update){let d;r?d=this.p.get(this.resolveRowId(l,-1,`__missing_update_${this.e.or()}`)):d=this.u.find(c=>c.data===l),d&&(o.push({node:d,before:d.data,after:l}),d.data=l,s.push(d.id),this.e.a._i(d),i.push(d))}if(e.add?.length){let l=e.addIndex!=null?Math.max(0,Math.min(e.addIndex,this.B.length)):this.B.length,d=[];e.add.forEach((c,u)=>{let h=this.resolveRowId(c,l+u,`add-${this.e.or()}`);if(this.p.has(h)){this.e.reportError(new Error(`Duplicate row id: ${h}`),"transaction.add",{rowId:h});return}let p={id:h,data:c,rowIndex:-1,selected:!1};this.p.set(h,p),this.Gi.set(p,0);let m=this.F?Le(c,this.e.r.childrenKey):void 0;if(m)for(let b of m)b!=null&&this.To(p,b,1);d.push(p)}),this.B=this.B.slice(0,l).concat(d,this.B.slice(l)),this.Va()}let a={pipelineChanged:this.Lc(e,o),updatedRowIds:i.map(l=>l.id)};return this.kc(a,t),this.e.z.Pc(s),a}kc(e,t){e.pipelineChanged&&(this.dt=null),t&&(e.pipelineChanged?this.w():e.updatedRowIds.length&&this.Ba())}Gc(e){if(e.length===0)return{pipelineChanged:!1,updatedRowIds:[]};let t=!1,r=new Set;for(let i of e){let o=this.Kr(i,!1);t||(t=o.pipelineChanged);for(let s of o.updatedRowIds)r.add(s)}return t?this.w():r.size>0&&this.Ba(),{pipelineChanged:t,updatedRowIds:[...r]}}Lc(e,t){if(e.add?.length||e.remove?.length)return!0;if(!t.length)return!1;let r=this.za();if(r===null)return!0;if(!r.length)return!1;let i=this.dt;return!i||r.length!==i.fields.length||r.some((o,s)=>o!==i.fields[s])?!0:t.some(({node:o,before:s,after:a})=>Oi(s,a,r,i.values.get(o)))}za(){if(this.F||this.e.r.masterDetail||this.e.r.getRowHeight||this._a())return null;let e=this.e.n.c();if(e.some(r=>r.colDef.autoHeight===!0||r.colDef.autoRowSpan===!0||r.colDef.rowSpan!=null))return null;let t=!this.e.r.manualFiltering;return Pi({columns:e,customAggregates:this.e.r.aggFuncs,sortModel:this.e.r.manualSorting?[]:this.e.n.J(),filterModel:t?this.ot:{},advancedFilter:t?this.st:null,quickFilter:t?this.Ke:null})}Nc(){let e=this.za();this.dt=e?.length?{fields:e,values:Ni(this.u,e)}:null}Ba(){this.e.emit("modelUpdated",{rowCount:this.ae.length})}To(e,t,r){let i=this.resolveRowId(t,-1,`add-${this.e.or()}`);if(this.p.has(i)){this.e.reportError(new Error(`Duplicate row id: ${i}`),"transaction.add",{rowId:i});return}let o=Le(t,this.e.r.childrenKey),s={id:i,data:t,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(o)};this.p.set(i,s),this.Gi.set(s,r);let a=this.ie.get(e.id)??[];if(a.push(s.id),this.ie.set(e.id,a),!!o)for(let l of o)l!=null&&this.To(s,l,r+1)}Va(){this.u=[];let e=t=>{this.u.push(t),this.p.has(t.id)||this.p.set(t.id,t);for(let r of this.ie.get(t.id)??[]){let i=this.p.get(r);i&&e(i)}};for(let t of this.B)e(t)}Wr(e){let t=JSON.stringify(this.ot),r=new Set(this.e.n.te().map(o=>o.id));this.ot=j(e,r);let i=JSON.stringify(this.ot)!==t;return i&&(this.dt=null),i}Q(){return{...this.ot}}sr(e){let t=new Set(this.e.n.te().map(s=>s.id)),r=V(e,t),i=JSON.stringify(this.st);this.st=r,this.e.r.advancedFilterModel=r;let o=JSON.stringify(r)!==i;return o&&(this.dt=null),o}Ie(){return V(this.st)}ar(e){let t=e!=null&&e.trim()!==""?e:null;return t===this.Ke?!1:(this.Ke=t,this.dt=null,!0)}$r(){return this.Ke}Do(){return Object.keys(this.ot).length>0||this.st!=null||this.Ke!=null}w(){this.dt=null;let e=this.e.le.start(),t=this.e.n.c(),r=(a,l)=>this.e.d(a,l);if(this.f){this.Oc(e);return}if(this.Fc(e))return;let i,o=[];if(this.F)i=this.Hc(t,r);else{i=this.u,this.Do()&&!this.e.r.manualFiltering&&(i=i.filter(br(t,this.ot,this.st,this.Ke,r)));let l=this.e.n.J();if(l.length>0&&!this.e.r.manualSorting)try{i=wr(i,l,t,r)}catch(c){this.e.reportError(c,"comparator",{sortModel:l})}let d=this.e.n.nt();if(d.length>0){let c=this.Vc(i,d);i=c.rows,o=c.ambiguousExpansions}else if(this.e.r.masterDetail){let c=[];for(let u of i)c.push(u),this.P.has(u.id)&&this.isRowExpandable(u)&&c.push({id:`__detail__${u.id}`,data:u.data,rowIndex:-1,selected:!1,isDetail:!0,masterId:u.id});i=c}}for(let a of this.u)a.rowIndex=-1;let s=0;i.forEach((a,l)=>{a.rowIndex=l,!a.isDetail&&!a.isGroup&&(s++,this.Fr.set(a,s))}),this.ae=i,this.lr(),this.Nc(),this.Ka(r),this.e.emit("modelUpdated",{rowCount:i.length}),this.e.le.Eo(e),this.Bc(o)}Oc(e){this.u.forEach((t,r)=>{this.Ce||(t.rowIndex=r),this.Fr.set(t,this.Ce?t.rowIndex+1:r+1)}),this.we=this.u,this.ae=this.u,this.Or.clear(),this.Vr++,this.e.emit("modelUpdated",{rowCount:this.u.length}),this.e.le.Eo(e)}Fc(e){let t=this.ho;return this.ho=!1,!t&&this._a()?(this.zc(e),!0):(this.go(),!1)}_a(){if(!this.e.r.dataProcessor||this.u.length<this.e.r.dataProcessorMinRows||this.F||this.e.r.masterDetail||this.e.n.nt().length>0)return!1;let e=!this.e.r.manualFiltering&&this.Do(),t=!this.e.r.manualSorting&&this.e.n.J().length>0;return e||t}zc(e){this.go();let t=this.e.r.dataProcessor;if(!t)return;let r=++this.Br,i=new AbortController;this.Fi=i;let o=this.e.n.c(),s=this.u.flatMap(d=>d.data==null?[]:[{id:d.id,data:d.data}]),a=!this.e.r.manualFiltering,l=!this.e.r.manualSorting;Promise.resolve().then(()=>t.process({rows:s,columns:o.map(d=>({colId:d.id,...d.colDef.field?{field:d.colDef.field}:{}})),sortModel:l?this.e.n.J():[],filterModel:a?this.Q():{},advancedFilterModel:a?this.Ie():null,quickFilterText:a?this.Ke:null,signal:i.signal})).then(d=>{if(r!==this.Br||i.signal.aborted||this.e.s())return;let c=new Set,u=[];for(let p of d.rowIds){if(c.has(p))continue;c.add(p);let m=this.p.get(p);m&&!m.isDetail&&!m.isGroup&&u.push(m)}for(let p of this.u)p.rowIndex=-1;u.forEach((p,m)=>{p.rowIndex=m,this.Fr.set(p,m+1)}),this.ae=u,this.lr();let h=(p,m)=>this.e.d(p,m);this.Ka(h),this.e.emit("modelUpdated",{rowCount:u.length}),this.e.le.Eo(e),this.e.h({data:!0})}).catch(d=>{r!==this.Br||i.signal.aborted||this.e.s()||(this.e.reportError(d,"dataProcessor.process"),this.ho=!0,this.w(),this.e.h({data:!0}))}).finally(()=>{r===this.Br&&(this.Fi=null)})}go(){this.Br++,this.Fi?.abort(),this.Fi=null}get Ae(){return this.e.r.paginationEnabled&&!this.f}lr(){if(!this.Ae){this.we=this.ae,this.Vr++;return}let e=this.jr(),t=this.getPageCount();if(this.W>t&&(this.W=t),this.W<1&&(this.W=1),this.e.r.paginationPage=this.W,this.e.r.paginationMode==="server"){this.ae.forEach((o,s)=>{o.rowIndex=s}),this.we=this.ae,this.Vr++;return}let r=(this.W-1)*e,i=this.ae.slice(r,r+e);i.forEach((o,s)=>{o.rowIndex=s}),this.we=i,this.Vr++}jr(){return this.Ur=this.e.r.paginationPageSize,Math.max(1,this.Ur)}qr(){return this.Ae?this.W:1}getTotalRowCount(){return this.f?this.ir():this.Ae&&this.e.r.paginationMode==="server"?this.e.r.paginationTotal:this.ae.length}getPageCount(){return this.Ae?Math.max(1,Math.ceil(this.getTotalRowCount()/this.jr())):1}Wa(){return this.ae}setPage(e,t=!1){if(!this.Ae)return;let r=this.getPageCount(),i=Math.max(1,Math.min(Math.round(e)||1,r));i!==this.W&&(this.W=i,this.e.r.paginationPage=i,this.lr(),this.e.h({data:!0}),this.e.a.dr(0,"top"),t||this.Ki())}setPageSize(e){if(!this.Ae)return;let t=Math.max(1,Math.round(e)||this.jr()),r=(this.W-1)*this.jr();this.e.r.paginationPageSize=t,this.Ur=t,this.W=Math.floor(r/t)+1,this.e.r.paginationPage=this.W,this.lr(),this.e.h({data:!0}),this.Ki()}$a(e,t){this.Ur=Math.max(1,Math.round(t)||1),this.e.r.paginationPageSize=this.Ur,this.W=Math.max(1,Math.round(e)||1),this.e.r.paginationPage=this.W}Wi(e){this.e.r.paginationEnabled!==e&&(this.e.r.paginationEnabled=e&&!this.f,this.e.r.paginationEnabled&&(this.W=1),this.lr(),this.e.h({data:!0}),this.Ki())}_c(){this.Ae&&(this.W=this.e.r.paginationMode==="server"?this.e.r.paginationPage:1,this.lr(),this.e.h({data:!0}),this.Ki())}Ki(){this.e.emit("paginationChanged",{page:this.qr(),pageSize:this.jr(),pageCount:this.getPageCount(),total:this.getTotalRowCount()})}Hc(e,t){let r=this.e.r.manualSorting?[]:this.e.n.J(),i=new Map,o=this.Do()&&!this.e.r.manualFiltering,s=br(e,this.ot,this.st,this.Ke,t),a=c=>{let u=i.get(c.id);if(u!==void 0)return u;let h=!0;if(o){h=s(c);for(let p of this.ie.get(c.id)??[]){let m=this.p.get(p);m&&a(m)&&(h=!0)}}return i.set(c.id,h),h},l=[],d=c=>{let u=c;r.length>0&&(u=wr(c,r,e,t));for(let h of u)if(a(h)&&(l.push(h),this.P.has(h.id))){let p=(this.ie.get(h.id)??[]).map(m=>this.p.get(m)).filter(m=>m!=null);d(p)}};return d(this.B),l}Kc(){let e=this.Ra,t=0;for(let r of this.we)!r.isDetail&&!r.isGroup&&(e[t++]=r);return e.length=t,e}Wc(e,t,r,i){let o=t.colDef.rowSpan;if(!o)return 1;try{let s=o({api:this.e.api,colDef:t.colDef,column:t,node:e,data:e.data,value:r,rowIndex:e.rowIndex});return Math.max(1,Math.min(Math.round(s)||1,i))}catch(s){return this.e.reportError(s,"rowSpan",{colId:t.id,rowId:e.id}),1}}$c(e,t,r,i,o){if(!r.colDef.autoRowSpan||i==null||i==="")return 1;let s=1;for(;t+s<e.length&&et(i,o(e[t+s],r))===0;)s++;return s}Uc(e,t,r){let i=new Int32Array(e.length),o=0;for(;o<e.length;){let s=e[o],a=r(s,t),l=t.colDef.rowSpan?this.Wc(s,t,a,e.length-o):this.$c(e,o,t,a,r);i[o]=l;for(let d=1;d<l;d++)i[o+d]=-1;o+=l}return i}Ka(e){if(this.Or.clear(),this.F||this.e.r.masterDetail||this.e.n.nt().length>0)return;let t=this.e.n.c().filter(i=>i.colDef.rowSpan!=null||i.colDef.autoRowSpan===!0);if(t.length===0)return;let r=this.Kc();if(r.length!==0)for(let i of t)this.Or.set(i.id,this.Uc(r,i,e))}jc(e){return this.Or.get(e)}Ua(e){return this.Fr.get(e)??0}Co(e){return this.Gi.get(e)??0}Vc(e,t){let r=rt(this.e.r.aggFuncs),i=this.e.n.fc();this.tr=[];let o=l=>{let d={};for(let c of i){let u=r(c.colDef.aggFunc);if(u)try{d[c.id]=Mi(l,u,h=>this.e.d(h,c))}catch(h){this.e.reportError(h,"aggFunc",{colId:c.id,aggFunc:c.colDef.aggFunc}),d[c.id]=null}}return d},s=ki(this.j,this.u,t,(l,d)=>this.e.d(l,d));this.j=s.expanded;let a=Li(e,t,(l,d)=>this.e.d(l,d),o,this.j);return this.tr=a.ids,{rows:a.rows,ambiguousExpansions:s.ambiguous}}Bc(e){for(let t of e){if(this.e.s())return;this.e.reportError(new Error(`Ambiguous legacy group expansion: ${t}`),"gridState.groupExpansion",{groupId:t})}}isRowExpandable(e){if(this.F){if(this.wo(e.id)||e.treeLoading)return!0;if(e.treeChildrenLoaded||!e.data||!this.e.r.loadTreeChildren)return!1;let r=this.e.r.isTreeRowExpandable;if(!r)return!1;try{return r({data:e.data,node:e,api:this.e.api})}catch(i){return this.e.reportError(i,"isTreeRowExpandable",{rowId:e.id}),!1}}if(!this.e.r.masterDetail)return!1;let t=this.e.r.isRowExpandable;if(t)try{return t({data:e.data,node:e,api:this.e.api})}catch(r){return this.e.reportError(r,"isRowExpandable",{rowId:e.id}),!1}return!0}isRowExpanded(e){return this.P.has(e)}qc(){return[...this.P]}Yc(){return[...this.j]}Xc(e,t){this.P=new Set(e.filter(r=>this.p.has(r))),this.j=new Set(t)}xo(e){return this.Ro(e,!0)}So(e){return this.Ro(e,!1)}$i(e){return this.Ro(e,!this.P.has(e))}Ro(e,t){let r=this.p.get(e);return!r||t&&!this.isRowExpandable(r)?!1:(t===this.P.has(e)||(t?this.P.add(e):this.P.delete(e),this.w(),this.e.h({data:!0}),this.e.emit("detailToggled",{rowId:e,rowNode:r,expanded:t}),t&&this.F&&!this.wo(e)&&!r.treeLoading&&this.loadTreeChildren(e).catch(()=>{})),t)}Mo(){let e=!1;for(let t of this.u)!this.P.has(t.id)&&this.isRowExpandable(t)&&(this.P.add(t.id),e=!0);e&&(this.w(),this.e.h({data:!0}))}Io(){this.P.size!==0&&(this.P.clear(),this.w(),this.e.h({data:!0}))}Ao(e){return this.setGroupExpanded(e,!this.j.has(e))}isGroupExpanded(e){return this.j.has(e)}Lo(){if(this.tr.length===0)return;let e=!1;for(let t of this.tr)this.j.has(t)||(this.j.add(t),e=!0);e&&(this.w(),this.e.h({data:!0}))}ko(){this.j.size!==0&&(this.j.clear(),this.w(),this.e.h({data:!0}))}setGroupExpanded(e,t){return!this.tr.includes(e)||t===this.j.has(e)||(t?this.j.add(e):this.j.delete(e),this.w(),this.e.h({data:!0})),t}ja(){return!this.F&&!this.f&&!this.e.r.dataProcessor&&this.e.r.paginationMode!=="server"&&this.e.n.J().length===0&&this.e.n.nt().length===0}qa(e,t){if(!this.ja()||!Number.isInteger(e)||!Number.isInteger(t))return!1;let r=this.m(e),i=this.m(t);if(!r||!i||r.isDetail||i.isDetail||r.isGroup||i.isGroup)return!1;let o=this.u.indexOf(r),s=this.u.indexOf(i);return o<0||s<0||o===s?!1:(this.u.splice(o,1),this.u.splice(s,0,r),this.w(),this.e.h({data:!0}),!0)}be(){return this.u}Jc(){return this.B}pt(){return this.we}A(){return this.Ce?this.nr():this.we.length}m(e){return this.Ce?e<0||e>=this.nr()?void 0:this.ct.get(e)??this.xc(e):this.we[e]}$(e){return this.p.get(e)}Po(e){this.u.forEach(e)}Go(e){let t=0;for(let r of this.ae)r.isDetail||r.isGroup||e(r,t++)}};var at=class{constructor(e){this.e=e;this.S=new Set;this.$e=null;this.Yr=new Set}fo(e){return this.S.has(e)}Zc(e){return this.Yr.has(e)}Ue(e){if(e.loading)return!1;let t=this.Qc(e),r=t?.colDef.selectable;if(!t||!r)return!0;try{return r({api:this.e.api,colDef:t.colDef,column:t,node:e,data:e.data,value:this.e.d(e,t),rowIndex:e.rowIndex})}catch(i){return this.e.reportError(i,"selectable",{rowId:e.id,colId:t?.id}),!1}}Qc(e){if(!(e.isGroup||e.isDetail))return this.e.n.c().find(t=>t.hasCheckbox&&t.colDef.selectable!=null)}je(){return this.e.i.be().filter(e=>this.S.has(e.id))}Ui(){return this.je().filter(e=>e.data!=null).map(e=>e.data)}ji(){return[...this.S]}eu(e){let t=new Set(e),r=this.e.i.be().filter(i=>t.has(i.id)&&!i.isDetail&&!i.isGroup).map(i=>({node:i,selected:!0}));this.De(r,!0)}Ha(e){if(!e)this.S.clear(),this.$e=null;else{let t=new Set(this.e.i.be().map(r=>r.id));for(let r of[...this.S])t.has(r)||this.S.delete(r);this.$e!=null&&!t.has(this.$e)&&(this.$e=null)}for(let t of this.e.i.be())t.selected=this.S.has(t.id);this.Ya()}Xa(e){let t=e.leafNodes??[];if(t.length===0)return{all:!1,some:!1};let r=0,i=0;for(let o of t)this.Ue(o)&&(r++,this.S.has(o.id)&&i++);return r===0?{all:!1,some:!1}:{all:i===r,some:i>0}}tu(e,t){let r=(e.leafNodes??[]).filter(i=>this.Ue(i));r.length!==0&&this.De(r.map(i=>({node:i,selected:t})))}Ja(e,t,r=!1){this.De([{node:e,selected:t,clearOthers:r}])}No(e,t=!0,r=!0){let i=this.e.i.$(e);i&&this.Ja(i,t,r)}ru(e,t){let r=t==="single";this.De([{node:e,selected:r?!0:!e.selected,clearOthers:r}]),this.$e=e.id}iu(e,t,r){return!r||!t.ctrlKey&&!t.metaKey?!1:(this.De([{node:e,selected:!e.selected}]),this.$e=e.id,!0)}nu(e,t,r){if(!r||!t.shiftKey||this.$e==null)return!1;let i=this.e.i.$(this.$e);if(!i||i.rowIndex<0||e.rowIndex<0)return!1;let o=Math.min(i.rowIndex,e.rowIndex),s=Math.max(i.rowIndex,e.rowIndex),a=[];for(let l=o;l<=s;l++){let d=this.e.i.m(l);d&&!d.isDetail&&!d.isGroup&&this.Ue(d)&&a.push({node:d,selected:!0})}return this.De(a),!0}Za(e,t,r){let i=this.e.r.rowSelection;if(i==="none"||!this.Ue(e))return;if(r){this.ru(e,i);return}let o=i==="multiple";this.iu(e,t,o)||this.nu(e,t,o)||(this.De([{node:e,selected:!0,clearOthers:!0}]),this.$e=e.id)}selectAll(e=!0){let t=this.e.r.rowSelection;if(t==="none")return;let i=(e?this.e.i.pt():this.e.i.be()).filter(o=>!o.isDetail&&!o.isGroup&&this.Ue(o));if(i.length!==0){if(t==="single"){this.De([{node:i[0],selected:!0,clearOthers:!0}]);return}this.De(i.map(o=>({node:o,selected:!0})))}}deselectAll(){this.De([],!0)}ou(){let t=this.e.i.pt().filter(r=>!r.isDetail&&!r.isGroup).filter(r=>this.Ue(r));if(t.length===0)return!1;if(this.e.i.f){let r=this.e.i.ir();if(t.length<r)return!1}return t.every(r=>this.S.has(r.id))}su(){let t=this.e.i.pt().filter(i=>!i.isDetail&&!i.isGroup).filter(i=>this.Ue(i)),r=t.reduce((i,o)=>i+(this.S.has(o.id)?1:0),0);if(r===0)return!1;if(this.e.i.f){let i=this.e.i.ir();if(t.length<i)return!0}return r>0&&r<t.length}au(e,t=!1){this.De(e,t)}lu(e,t,r){!t&&!e.some(i=>i.clearOthers)||(this.S=t?new Set:new Set(e.filter(i=>i.selected).flatMap(i=>r?this.Qa(i.node):[i.node.id])))}du(e,t){for(let r of e){if(!this.Ue(r.node))continue;let i=t?this.Qa(r.node):[r.node.id];for(let o of i)r.selected?this.S.add(o):this.S.delete(o)}}cu(e){let t=new Set;for(let r of new Set([...e,...this.S]))e.has(r)!==this.S.has(r)&&t.add(r);return t}uu(e,t,r){let i=[],o=new Set([...e,...r,...this.Yr]);for(let s of this.e.i.be()){let a=this.S.has(s.id);s.selected=a,(o.has(s.id)||t.get(s.id)!==a)&&s.rowIndex>=0&&i.push(s.rowIndex)}return i}De(e,t=!1){let r=new Set(this.S),i=this.e.i.F&&this.e.r.autoCheckedChildren;this.lu(e,t,i),this.du(e,i);let o=this.cu(r),s=new Map;for(let d of this.e.i.be())s.set(d.id,d.selected);let a=new Set(this.Yr);this.Ya();let l=this.uu(o,s,a);o.size>0&&(this.e.a.ft(l),this.e.K.zi(),this.e.emit("selectionChanged",{selectedNodes:this.je(),selectedRows:this.Ui()}))}Qa(e){let t=[e.id],r=i=>{for(let o of this.e.i._r(i))t.push(o),r(o)};return r(e.id),t}Ya(){if(this.Yr.clear(),!this.e.i.F)return;let e=t=>{let r=this.e.i._r(t);if(r.length===0)return{all:this.S.has(t),some:this.S.has(t)};let i=!0,o=!1;for(let s of r){let a=e(s);a.all?o=!0:(a.some&&(o=!0),i=!1)}return o&&!i&&this.Yr.add(t),i?this.S.add(t):this.S.delete(t),{all:i,some:o}};for(let t of this.e.i.Jc())e(t.id);for(let t of this.e.i.be())t.selected=this.S.has(t.id)}};var lt=class{constructor(e){this.e=e;this.Gt=null;this.ne=0;this.mt=0;this.Le=null;this.Nt=null;this.gt=e=>{let t=this.Fo(e);t&&(this.mt=this.nl(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.mt-t.startWidth)>=.5),!this.ne&&(this.ne=requestAnimationFrame(()=>{this.ne=0,this.fu()})))};this.ke=e=>{let t=this.Fo(e);t&&(this.mt=this.nl(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.mt-t.startWidth)>=.5),this.mu(t))};this.Ft=e=>{this.Fo(e)&&this.Ot()};this.tl=()=>{this.Ot()}}hu(e,t){if(!this.e.r.enableColumnResize||!t.resizable||e.isPrimary===!1)return;this.Ot();let r=e.currentTarget,i=t.currentWidth;this.mt=i,this.Gt={column:t,didResize:!1,handle:r,pointerId:e.pointerId,startFlex:t.flex,startManualWidth:t.manualWidth,startWidth:i,startX:e.clientX},window.addEventListener("pointermove",this.gt),window.addEventListener("pointerup",this.ke,!0),window.addEventListener("pointercancel",this.Ft,!0),r.addEventListener("lostpointercapture",this.tl);try{r.setPointerCapture?.(e.pointerId)}catch{}this.e.o.root.classList.add("mach-root--resizing"),r.classList.add("mach-header-resize--active"),this.pu(this.Gt)}Ot(e=!0){let t=this.Gt;t&&(this.Gt=null,this.Oo(),this.rl(t),e&&(t.column.manualWidth=t.startManualWidth,t.column.flex=t.startFlex,this.e.qe()),this.e.o.root.classList.remove("mach-root--resizing"),this.il(t))}mu(e){this.Gt=null,this.Oo(),e.didResize&&(Math.abs(this.mt-e.startWidth)<.5?(e.column.manualWidth=e.startManualWidth,e.column.flex=e.startFlex):this.e.n.Se(e.column,this.mt),this.e.qe()),this.rl(e);try{e.handle.releasePointerCapture?.(e.pointerId)}catch{}this.e.o.root.classList.remove("mach-root--resizing"),this.il(e),e.didResize&&this.e.cr([e.column])}fu(){let e=this.Gt;!e||!this.e.n.Se(e.column,this.mt)||(this.e.qe(),this.Xr(e),this.e.ol(e.column,!1))}pu(e){this.Le=document.createElement("div"),this.Le.className="mach-column-resize-guide",this.Le.setAttribute("aria-hidden","true"),this.Nt=document.createElement("span"),this.Nt.className="mach-column-resize-label",this.Le.appendChild(this.Nt),this.e.o.root.appendChild(this.Le),this.Xr(e)}Xr(e){if(!this.Le||!this.Nt)return;let t=this.e.o.root,r=t.getBoundingClientRect(),i=e.handle.parentElement.getBoundingClientRect(),o=Math.max(0,Math.min(t.clientWidth,i.right-r.left-t.clientLeft)),s=Math.max(32,Math.min(t.clientWidth-32,o));this.Le.style.left=`${o}px`,this.Le.style.top=`${Math.max(0,i.top-r.top-t.clientTop)}px`,this.Nt.style.left=`${s-o}px`,this.Nt.textContent=`${Math.round(e.column.currentWidth)} px`}il(e){e.handle.classList.remove("mach-header-resize--active"),this.Le?.remove(),this.Le=null,this.Nt=null}nl(e,t){let r=Number.isFinite(t)?t:e.startX;return Math.max(1,e.startWidth+r-e.startX)}Fo(e){let t=this.Gt;return t&&e.pointerId===t.pointerId?t:null}Oo(){this.ne&&cancelAnimationFrame(this.ne),this.ne=0}rl(e){window.removeEventListener("pointermove",this.gt),window.removeEventListener("pointerup",this.ke,!0),window.removeEventListener("pointercancel",this.Ft,!0),e.handle.removeEventListener("lostpointercapture",this.tl)}destroy(){this.Ot(!1),this.Oo(),this.e.o.root?.classList.remove("mach-root--resizing")}};var Fi=6,dt=class{constructor(e){this.e=e;this.Jr=null;this.ur=null;this.Ho=!1;this.de=0;this.qi=null;this.gt=e=>{if(this.ur){this.vu(e);return}let t=this.Jr;t&&(Math.abs(e.clientX-t.startX)<Fi&&Math.abs(e.clientY-t.startY)<Fi||this.bu(e))};this.ke=e=>{this.Jr=null,e.type!=="pointercancel"&&this.ur&&this.zo(e.clientX,e.clientY),this.Vo();let t=this.sl();t&&e.type!=="pointercancel"&&t.targetIndex>=0&&this.e.At(t.column.id,t.targetIndex)}}gu(e,t){e.button===0&&t.movable&&(this.Jr={column:t,startX:e.clientX,startY:e.clientY},window.addEventListener("pointermove",this.gt),window.addEventListener("pointerup",this.ke),window.addEventListener("pointercancel",this.ke))}yu(){let e=this.Ho;return this.Ho=!1,e}bu(e){let t=this.Jr;if(!t)return;let r=this.wu(t.column);if(!r||!r.parentElement){this.Vo();return}this.Ho=!0;let i=f("div","mach-drop-indicator"),o=f("div","mach-column-drag-ghost");o.textContent=t.column.colDef.headerName??t.column.colDef.field??t.column.id,o.ariaHidden="true",G(o,this.e.o.root),document.body.appendChild(o),r.parentElement.appendChild(i),r.classList.add("mach-header-cell--dragging"),this.e.o.root.classList.add("mach-root--dragging");let s=this.e.a.Bo(t.column),a=this.e.o.hr[s],l=this.e.n.T(s),d=new Float64Array(l.length+1),c=new Float64Array(l.length);for(let h=0;h<l.length;h++){let p=l[h].currentWidth;c[h]=d[h]+p/2,d[h+1]=d[h]+p}let u=o.getBoundingClientRect();this.ur={column:t.column,cellEl:r,ghost:o,indicator:i,targetIndex:-1,pane:s,containerLeft:a.getBoundingClientRect().left,startScrollLeft:this.e.o.M.center.scrollLeft,fromIndex:l.indexOf(t.column),midpoints:c,offsets:d,ghostWidth:u.width,ghostHeight:u.height},this.zo(e.clientX,e.clientY)}wu(e){let t=this.e.a.Bo(e);return this.e.o.hr[t].querySelector(`.mach-header-cell[data-col-id="${ms(e.id)}"]`)}vu(e){this.qi={clientX:e.clientX,clientY:e.clientY},!this.de&&(this.de=requestAnimationFrame(()=>{this.de=0;let t=this.qi;this.qi=null,t&&this.zo(t.clientX,t.clientY)}))}zo(e,t){let r=this.ur;if(!r)return;let i=E(e+12,8,window.innerWidth-r.ghostWidth-8),o=E(t+12,8,window.innerHeight-r.ghostHeight-8);r.ghost.style.transform=`translate3d(${i}px, ${o}px, 0)`;let s=r.pane==="center"?this.e.o.M.center.scrollLeft-r.startScrollLeft:0,a=e-(r.containerLeft-s),l=r.midpoints.length;for(let d=0;d<r.midpoints.length;d++)if(a<r.midpoints[d]){l=d;break}r.targetIndex=l>r.fromIndex?l-1:l,r.indicator.style.transform=`translate3d(${r.offsets[l]}px, 0, 0)`}sl(){let e=this.ur;return e?(this.ur=null,e.cellEl.classList.remove("mach-header-cell--dragging"),e.ghost.remove(),e.indicator.remove(),this.e.o.root.classList.remove("mach-root--dragging"),e):null}Vo(){window.removeEventListener("pointermove",this.gt),window.removeEventListener("pointerup",this.ke),window.removeEventListener("pointercancel",this.ke),this.de&&cancelAnimationFrame(this.de),this.de=0,this.qi=null}destroy(){this.Vo(),this.sl(),this.Jr=null}};function ms(n){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(n):n.replace(/[^a-zA-Z0-9_-]/g,"\\$&")}var Tr=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function ct(n,e=!0){if(n==="")return null;if(!e||typeof n!="string"||!Tr.test(n)||/^[+-]?0\d/.test(n))return n;let t=Number(n);return Number.isFinite(t)&&(!Number.isInteger(t)||Number.isSafeInteger(t))?t:n}function gs(n,e){let t=n==null?"":String(n);return t.includes(e)||t.includes('"')||t.includes(`
|
|
2
|
-
`)||t.includes("\r")?'"'+t.replace(/"/g,'""')+'"':t}function
|
|
3
|
-
`);return e.prependBOM?"\uFEFF"+i:i}function
|
|
4
|
-
`)}function
|
|
1
|
+
"use strict";var sr=Object.defineProperty;var co=Object.getOwnPropertyDescriptor;var uo=Object.getOwnPropertyNames;var ho=Object.prototype.hasOwnProperty;var po=(n,e)=>{for(var t in e)sr(n,t,{get:e[t],enumerable:!0})},fo=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of uo(e))!ho.call(n,i)&&i!==t&&sr(n,i,{get:()=>e[i],enumerable:!(r=co(e,i))||r.enumerable});return n};var mo=n=>fo(sr({},"__esModule",{value:!0}),n);var $a={};po($a,{BUILTIN_AGG_FUNCS:()=>Ae,DEFAULT_LOCALE:()=>T,EVENT_TYPES:()=>me,LOCALE_EN:()=>zi,actionsColumn:()=>qn,advancedFilterCondition:()=>ei,advancedFilterGroup:()=>ti,applyGridViewState:()=>Xr,buildColDefsFromSchema:()=>Wn,captureGridViewState:()=>Yr,clearGridState:()=>Sn,createActionButtonsRenderer:()=>be,createAggResolver:()=>et,createBusinessColumnTypes:()=>io,createColumnHelper:()=>Xn,createEnterprisePreset:()=>Zn,createGrid:()=>Bn,createGridViewManager:()=>ao,createLocalGridStateStore:()=>Or,createLocalGridViewStore:()=>Jr,createMachTableCommands:()=>$n,createMachTablePreset:()=>qr,createProgressBarRenderer:()=>Br,createRemoteExportRequest:()=>_n,createRowActionsRenderer:()=>Zt,createStatusTagRenderer:()=>Vr,defineColumns:()=>Jn,defineGridOptions:()=>eo,defineMachTableConfig:()=>to,defineMachTablePreset:()=>Qn,describeFilter:()=>Nt,downloadFile:()=>Pt,dragColumn:()=>jn,escapeHtml:()=>le,formatText:()=>_,formatTwo:()=>fe,getByPath:()=>B,indexColumn:()=>Un,isColDefGroup:()=>pe,isSafePath:()=>Be,linkRenderer:()=>_r,loadGridState:()=>qt,matchLocaleKey:()=>wt,normalizeAdvancedFilterModel:()=>O,normalizeColumnFilter:()=>_e,normalizeFilterModel:()=>K,normalizeGridState:()=>z,normalizeGridViewState:()=>or,normalizeSavedGridView:()=>we,parseCsv:()=>ut,parseDelimited:()=>ht,parseTsv:()=>ct,resolveGridFeatures:()=>tr,resolveSaveConflict:()=>sn,resolveTagVariant:()=>Yt,rowActionsColumn:()=>Yn,sanitizeFormulaCell:()=>ne,saveGridState:()=>jt,selectionColumn:()=>Kn,setByPath:()=>ce,toTsv:()=>dt,validateGridOptions:()=>Qt,version:()=>Wa});module.exports=mo($a);var He="0.37.0";function A(n,e,t=!1){if(!(typeof n!="number"||!Number.isFinite(n)||n<e))return t?Math.floor(n):n}function V(n){return A(n,0)||void 0}function Ve(n){return!n||typeof n.key!="string"||!n.key.trim()?null:{key:n.key.trim(),debounceMs:A(n.debounceMs,0,!0)??160,...n.sections?{sections:[...new Set(n.sections)]}:{},...n.store?{store:n.store}:{}}}function S(n,e,t,r=!1){let i=!1;for(let o of t)(r?Object.prototype.hasOwnProperty.call(n,o):n[o]!=null)&&(e[o]=n[o],i=!0);return i}var yo=new Set(["__proto__","prototype","constructor"]),Te=new Map;function ar(n){if(typeof n!="string"||n.length===0)return null;let e=Te.get(n);if(e!==void 0)return e;let t=n.split("."),r=t.every(i=>i.length>0&&!yo.has(i))?t:null;return n.length<=1024&&(Te.size>=256&&Te.delete(Te.keys().next().value),Te.set(n,r)),r}function Be(n){return ar(n)!==null}function B(n,e){if(n==null)return;let t=ar(e);if(!t)return;let r=n;for(let i of t){if(r==null)return;r=r[i]}return r}function ce(n,e,t){if(n==null)return!1;let r=ar(e);if(!r)return!1;let i=n;for(let o=0;o<r.length-1;o++){if(typeof i!="object"&&typeof i!="function"||i===null)return!1;i[r[o]]==null&&(i[r[o]]={}),i=i[r[o]]}return typeof i!="object"&&typeof i!="function"||i===null?!1:(i[r[r.length-1]]=t,!0)}var ue={text:["contains","notContains","equals","notEquals","startsWith","endsWith","blank","notBlank"],number:["equals","notEquals","lessThan","lessThanOrEqual","greaterThan","greaterThanOrEqual","inRange","blank","notBlank"],date:["equals","notEquals","lessThan","greaterThan","inRange","blank","notBlank"]};var vo=16,bo=512,wo=20,Co=2e3,To=2e3,Eo={text:new Set(ue.text),number:new Set(ue.number),date:new Set(ue.date)};function Do(n){return n==null||typeof n=="string"||typeof n=="number"&&Number.isFinite(n)}function xo(n,e,t){if(n==null||typeof n!="object")return null;let r=n;return typeof r.match!="string"||!t.has(r.match)?null:{match:r.match,...Ro(r,e)}}function Ro(n,e){let t=e==="number"?Zr(n.value):typeof n.value=="string"?n.value:void 0,r=e==="number"?Zr(n.value2):typeof n.value2=="string"?n.value2:void 0;return{...t!==void 0?{value:t}:{},...r!==void 0?{value2:r}:{}}}function Zr(n){return typeof n=="number"&&Number.isFinite(n)?n:void 0}function So(n,e){let t=[],r=Eo[e];for(let i of n.slice(0,wo)){let o=xo(i,e,r);o&&t.push(o)}return t}function _e(n){if(n==null||typeof n!="object")return null;let e=n;return e.type==="set"?Array.isArray(e.values)?{type:"set",values:e.values.filter(Do).slice(0,Co)}:null:e.type!=="text"&&e.type!=="number"&&e.type!=="date"||!Array.isArray(e.conditions)?null:{type:e.type,...e.operator==="or"||e.operator==="and"?{operator:e.operator}:{},conditions:So(e.conditions,e.type)}}function Mo(n,e){if(typeof n.colId!="string"||!n.colId.trim())return null;let t=n.colId.trim();if(e.validColumnIds?.has(t)===!1)return null;let r=_e(n.filter);return r?{kind:"condition",colId:t,filter:r}:null}function Io(n,e,t){if(!Array.isArray(n.children))return null;let r=[];for(let i of n.children){let o=Qr(i,e+1,t);o&&r.push(o)}return r.length===0?null:{kind:"group",operator:n.operator==="or"?"or":"and",children:r,...n.not===!0?{not:!0}:{}}}function Ao(n,e,t){return e<=vo&&t.nodes<bo&&n!=null&&typeof n=="object"}function Qr(n,e,t){if(!Ao(n,e,t)||t.ancestors.has(n))return null;t.ancestors.add(n),t.nodes++;let r=n,i=r.kind==="condition"?Mo(r,t):r.kind==="group"?Io(r,e,t):null;return t.ancestors.delete(n),i}function O(n,e){if(n==null||typeof n!="object")return null;let t=n;if(t.version!==1||t.root==null)return null;let r=Qr(t.root,0,{ancestors:new WeakSet,nodes:0,validColumnIds:e});return r?{version:1,root:r}:null}function ei(n,e){return{kind:"condition",colId:n,filter:e}}function K(n,e){if(n==null||typeof n!="object"||Array.isArray(n))return{};let t={};for(let[r,i]of Object.entries(n).slice(0,To)){let o=r.trim();if(!o||e?.has(o)===!1)continue;let s=_e(i);s&&(t[o]=s)}return t}function ti(n,e,t={}){return{kind:"group",operator:n,children:e,...t.not?{not:!0}:{}}}var lr={align:"center",sortable:!0,resizable:!0,movable:!0,filter:!1,minWidth:80},Ee={compact:{rowHeight:30,headerHeight:34,fontSize:12,cellPadding:6},normal:{rowHeight:36,headerHeight:40,fontSize:13,cellPadding:9},large:{rowHeight:44,headerHeight:48,fontSize:14,cellPadding:12}},De={multiSort:!0,stripedRows:!1,showCellBorders:!1,quickFilterText:null,suppressCellFocus:!1,suppressRowHoverHighlight:!1,suppressNoRowsOverlay:!1,suppressHeaderFocus:!1,loading:!1,error:null,className:"",singleClickEdit:!1,manualSorting:!1,manualFiltering:!1,showSummary:!1,indexOffset:0,applyRowDrag:!0,masterDetail:!1,detailToggleColumn:!0,treeData:!1,childrenKey:"children",autoCheckedChildren:!0,defaultExpandAll:!1,columnMenu:!1,suppressWarnings:!1,enableRangeSelection:!1,suppressClipboard:!1,contextMenu:!1,flashCells:!0,fillHandle:!0,ariaLabel:"MachTable data grid",ariaLabelledBy:"",ariaDescribedBy:"",overlayNoRowsTemplate:"",overlayLoadingTemplate:"",overlayErrorTemplate:"",allowUnsafeOverlayHtml:!1},Lo=Object.keys(De);function Po(n){let e={};for(let t of Lo)e[t]=n[t]??De[t];return e}function D(n,e,t,r=!1){return A(n,t,r)??e}function ko(n){return n&&Object.prototype.hasOwnProperty.call(Ee,n)?n:"normal"}function Go(n){return n.theme==="light"||n.theme==="dark"||n.theme==="auto"?n.theme:"light"}function No(n,e){let t=typeof n.pagination=="object"&&Array.isArray(n.pagination.pageSizeOptions)?n.pagination.pageSizeOptions:void 0,r=t?[...new Set(t.map(i=>D(i,0,1,!0)).filter(Boolean))]:[10,20,50,100];return r.includes(e)||r.push(e),r.sort((i,o)=>i-o)}function dr(n,e){let t=typeof n=="function"?n(e):B(e,n);return t==null?"":String(t)}function Oo(n){let e=n.rowKey,t=e?({data:r})=>dr(e,r):void 0;return{...t?{resolveRowId:t}:{},...e?{rowKey:e}:{}}}function Fo(n,e){let t=Ee[e];return{columnDefs:Array.isArray(n.columnDefs)?n.columnDefs:[],rowData:Array.isArray(n.rowData)?n.rowData:[],defaultColDef:{...lr,...n.defaultColDef??{}},columnTypes:n.columnTypes??{},...Oo(n),rowHeight:D(n.rowHeight,t.rowHeight,1),headerHeight:D(n.headerHeight,t.headerHeight,1),rowBuffer:D(n.rowBuffer,8,0,!0),columnLayout:n.columnLayout==="fit"?"fit":"normal",enableColumnResize:n.enableColumnResize===!0,domLayout:n.domLayout==="autoHeight"?"autoHeight":"normal",rowSelection:n.rowSelection==="single"||n.rowSelection==="multiple"?n.rowSelection:"none",size:e,pinnedTopRowData:Array.isArray(n.pinnedTopRowData)?n.pinnedTopRowData:[],pinnedBottomRowData:Array.isArray(n.pinnedBottomRowData)?n.pinnedBottomRowData:[]}}function Ho(n){return{rowStyleRules:Array.isArray(n.rowStyleRules)?n.rowStyleRules:[],theme:Go(n)}}function Vo(n){return{editType:n.editType==="fullRow"?"fullRow":"cell",editableIndicator:n.editableIndicator==="always"||n.editableIndicator==="none"?n.editableIndicator:"hover",rowDragPolicy:n.rowDragPolicy,undoStackSize:D(n.undoStackSize,100,0,!0),asyncTransactionWaitMillis:D(n.asyncTransactionWaitMillis,16,0,!0)}}function Bo(n){return{detailRowHeight:D(n.detailRowHeight,240,1)}}function _o(n){let e=typeof n.pagination=="object"?n.pagination:void 0,t=D(e?.pageSize,20,1,!0);return{paginationEnabled:n.pagination!==!1&&n.datasource==null,paginationMode:e?.mode==="server"?"server":"client",paginationPage:D(e?.page,1,1,!0),paginationTotal:D(e?.total,0,0,!0),paginationPageSize:t,paginationPageSizeOptions:No(n,t),paginationShowTotal:e?e.showTotal!==!1:!0,paginationShowSizeSelector:e?e.showPageSizeSelector!==!1:!0}}function cr(n){return{watermarkEnabled:n.watermark!=null&&n.watermark!==!1,watermarkConfig:n.watermark==null||n.watermark===!1?null:n.watermark===!0?{text:"MachTable"}:n.watermark}}function zo(n){return{advancedFilterModel:O(n.advancedFilterModel),persistence:Ve(n.persistence),locale:n.locale??{},tooltipShowDelay:D(n.tooltipShowDelay,600,0),statusBarEnabled:n.statusBar===!0||typeof n.statusBar=="object"&&n.statusBar!=null,statusBarPanels:typeof n.statusBar=="object"&&n.statusBar?.panels?n.statusBar.panels:["rowCount","selectedRowCount","rangeAggregate"]}}function Wo(n){return{datasourceMode:n.datasourceMode==="block"?"block":"sequential",blockSize:D(n.blockSize,100,1,!0),infiniteBufferRows:D(n.infiniteBufferRows,40,0,!0),maxBlocksInCache:D(n.maxBlocksInCache,12,1,!0),datasourceMaxConcurrentRequests:D(n.datasourceMaxConcurrentRequests,4,1,!0),blockPrefetch:D(n.blockPrefetch,1,0,!0),datasourceRowCount:n.datasourceRowCount==null?null:D(n.datasourceRowCount,0,0,!0),dataProcessorMinRows:D(n.dataProcessorMinRows,5e3,1,!0),datasourceRetryCount:D(n.datasourceRetryCount,2,0,!0),datasourceRetryDelay:D(n.datasourceRetryDelay,300,0,!0),datasourceRetryJitter:Math.min(1,D(n.datasourceRetryJitter,.15,0))}}var $o=["detailRowRenderer","isRowExpandable","aggFuncs","components","actionPolicy","summaryMethod","datasource","getRowHeight","tooltipComponent","getContextMenuItems","initialState","rowEditValidator","isTreeRowExpandable","loadTreeChildren","dataProcessor"];function Ko(n,e){for(let t of $o)n[t]&&Reflect.set(e,t,n[t])}function Uo(n,e){for(let t of Object.keys(n))t.startsWith("on")&&typeof n[t]=="function"&&Reflect.set(e,t,n[t])}function ri(n){let e=ko(n.size),t={...Po(n),...Fo(n,e),...Ho(n),...Vo(n),...Bo(n),..._o(n),...cr(n),...zo(n),...Wo(n),features:Array.isArray(n.features)?n.features:[]};return Ko(n,t),Uo(n,t),t}function ii(n){return Array.isArray(n)?n.filter(e=>typeof e=="string"&&e.length>0):typeof n=="string"&&n.length>0?[n]:[]}function he(n,e){return ii(n.type).includes(e)}function ni(n,e,t={}){let r={};for(let o of ii(n.type)){let s=t[o];s&&Object.assign(r,s)}let i={...e,...r,...n};return i.status&&!i.cellRenderer&&(i.cellRenderer="statusTag"),i}var ur=new WeakMap,ze=new WeakMap,We=new WeakMap;function xe(n){let e=ur.get(n);return e||(e={},ur.set(n,e)),e}function hr(n){return ur.get(n)}function oi(n,e){e?ze.set(n,e):ze.delete(n)}function si(n){let e=ze.get(n);return ze.delete(n),e}function ai(n,e){e?We.set(n,e):We.delete(n)}function pr(n){let e=We.get(n);return We.delete(n),e}function fr(n){if(n==null)return"";if(n instanceof Date)return n.toLocaleDateString();if(typeof n=="object")try{return JSON.stringify(n)}catch{return String(n)}return String(n)}function M(n,e){let t=hr(e);if(!t)return;t.flashTimer&&clearTimeout(t.flashTimer),t.flashTimer=void 0;let r=t.destroy;if(t.destroy=void 0,t.refresh=void 0,t.rendererDefinition=void 0,t.rendererRowId=void 0,t.rendererColumnId=void 0,!!r)try{r()}catch(i){n.reportError(i,"cellRenderer.destroy",{colId:e.dataset.colId})}}function li(n,e,t,r,i,o){let s=n.r.tooltipComponent?"":o,a=r.colDef.tooltipValueGetter;if(a)try{s=a({api:n.api,colDef:r.colDef,column:r,node:t,data:t.data,value:i})??o}catch(l){n.reportError(l,"tooltipValueGetter",{colId:r.id,rowId:t.id})}s?e.setAttribute("title",s):e.removeAttribute("title")}function jo(n,e,t,r,i,o){let s=hr(e);if(!s?.refresh||s.rendererDefinition!==i||s.rendererRowId!==t.id||s.rendererColumnId!==r.id)return!1;try{return e.querySelector(":scope > .mach-cell-edit-trigger")?.remove(),s.refresh(o)!==!1}catch(a){return n.reportError(a,"cellRenderer.refresh",{colId:r.id,rowId:t.id}),!1}}function ee(n,e,t){return U(n,e,t,n.d(e,t))}function U(n,e,t,r){let i=t.colDef.valueFormatter;if(i)try{let o=i({api:n.api,colDef:t.colDef,column:t,node:e,data:e.data,value:r});return o==null?"":String(o)}catch(o){n.reportError(o,"valueFormatter",{colId:t.id,rowId:e.id})}return fr(r)}function $e(n,e,t,r){let i=r.colDef.cellStyle,o=xe(e),s=o.styleKeys;if(s)for(let d of s)Reflect.set(e.style,d,"");if(!i){o.styleKeys=void 0;return}let a;if(typeof i=="function"){let d=n.d(t,r);try{a=i({api:n.api,colDef:r.colDef,column:r,node:t,data:t.data,value:d,rowIndex:t.rowIndex})}catch(c){n.reportError(c,"cellStyle",{colId:r.id,rowId:t.id}),a=null}}else a=i;if(!a){o.styleKeys=void 0;return}let l=Object.keys(a);for(let d of l)Reflect.set(e.style,d,Reflect.get(a,d));o.styleKeys=l}function Ke(n,e,t,r){let i=n.d(t,r),o=ee(n,t,r),s=r.colDef.cellRenderer,a=typeof s=="string"?n.dc(s):s;if(a){let l={api:n.api,colDef:r.colDef,column:r,node:t,data:t.data,value:i,formatted:o,rowIndex:t.rowIndex,rendererParams:r.colDef.cellRendererParams};if(jo(n,e,t,r,a,l)){li(n,e,t,r,i,o);return}M(n,e);let d;try{d=a(l)}catch(c){n.reportError(c,"cellRenderer",{colId:r.id,rowId:t.id}),e.textContent=o;return}if(typeof d=="string")e.textContent=d;else if(d instanceof HTMLElement)e.replaceChildren(d);else if(d&&typeof d=="object"&&d.el instanceof HTMLElement){let c=d;e.replaceChildren(c.el);let u=xe(e);u.destroy=c.destroy,c.refresh&&(u.refresh=h=>c.refresh(h),u.rendererDefinition=a,u.rendererRowId=t.id,u.rendererColumnId=r.id)}else e.textContent=""}else M(n,e),e.textContent=o;li(n,e,t,r,i,o)}function qo(n,e,t){let r=e.colDef.align;if(r==="center"){n.push("mach-cell--center");return}if(r==="right"){n.push("mach-cell--right");return}(he(e.colDef,"rightAligned")||he(e.colDef,"numericColumn")||typeof t=="number")&&n.push("mach-cell--num")}function Yo(n,e,t,r,i){let o=r.colDef.cellClass;if(!o)return;if(typeof o=="string"){e.push(o);return}if(Array.isArray(o)){e.push(...o);return}let s={api:n.api,colDef:r.colDef,column:r,node:t,data:t.data,value:i,rowIndex:t.rowIndex};try{let a=o(s);typeof a=="string"?e.push(a):Array.isArray(a)&&e.push(...a)}catch(a){n.reportError(a,"cellClass",{colId:r.id,rowId:t.id})}}function Xo(n,e,t){e.classList.contains("mach-cell--focus")&&n.push("mach-cell--focus"),e.classList.contains("mach-cell--editing")&&n.push("mach-cell--editing"),t.colDef.wrapText&&n.push("mach-cell--wrap")}function Re(n,e,t,r){let i=n.d(t,r),o=["mach-cell"];qo(o,r,i),Yo(n,o,t,r,i),Xo(o,e,r);let s=o.join(" ");e.className!==s&&(e.className=s)}function Se(n,e){return n&&Object.prototype.hasOwnProperty.call(n,e)?n[e]:void 0}function Ue(n,e){if(n==null||n===""||!e||typeof e!="object")return;let t=Se(e,String(n));return typeof t=="string"?{color:t}:t}var je=class{constructor(e){this.e=e;this.Jn="";this.kr=!0}Zn(){var i;let e=getComputedStyle(this.e.o.root),t=`${e.getPropertyValue("--mach-header-font-weight")||650} ${e.fontSize} ${e.fontFamily}`;this[i="kr"]||(this[i]=t!==this.Jn),this.Jn=t;let r=!1;for(let o of this.e.n.c()){if(!this.kr&&o.minWidth!=null)continue;let s=o.colDef;if(o.minWidth=this.cc(o),o.manualWidth==null&&s.width==null&&s.autoWidth!==!1&&!o.hasCheckbox&&!o.isDetailToggle){let a=this.ga(o);r=a!==o.contentWidth||r,o.contentWidth=a}}return this.kr=!1,r}ya(e){return this.Pr===void 0&&(this.Pr=document.createElement("canvas").getContext("2d")),this.Pr?(this.Pr.font=this.Jn,this.Pr.measureText(e).width):e.replace(/[^\x00-\xff]/g,"mm").length*7}cc(e){let t=e.colDef,r=t.headerName??t.field??e.id;return Math.ceil(Math.max(t.minWidth??0,this.ya(r)+r.length*.15+28+(e.sortable?20:0)+(e.filterable?28:0)+(this.e.r.columnMenu&&!e.hasCheckbox&&!t.suppressColumnMenu?22:0)))}ga(e){let t=28,r=this.e.i.be(),i=Math.min(r.length,100);for(let o=0;o<i;o++){let s=r[i===1?0:Math.floor(o*(r.length-1)/(i-1))],a=this.e.d(s,e),l=Ue(a,e.colDef.status)?.label??U(this.e,s,e,a);t=Math.max(t,this.ya(l.slice(0,128))+(e.colDef.status?44:28))}return Math.ceil(Math.min(V(e.colDef.maxWidth)??360,t))}};function f(n,e,t){let r=document.createElement(n);if(e&&(r.className=e),t)for(let i of Object.keys(t))r.setAttribute(i,t[i]);return r}function L(n,e){if(n.classList.add("mach-portal"),!e)return;let t=window.getComputedStyle(e);for(let r=0;r<t.length;r++){let i=t.item(r);if(!i.startsWith("--mach-"))continue;let o=t.getPropertyValue(i).trim();o&&n.style.setProperty(i,o)}n.style.colorScheme=t.colorScheme}function C(n,e,t){return n<e?e:n>t?t:n}function j(n,e,t=4){let r=e.getBoundingClientRect(),i=n.getBoundingClientRect(),o=r.bottom+t,s=o+i.height>window.innerHeight-8?r.top-i.height-t:o;n.style.left=`${C(r.left,8,Math.max(8,window.innerWidth-i.width-8))}px`,n.style.top=`${C(s,8,Math.max(8,window.innerHeight-i.height-8))}px`}var di=0;function ci(n="rg"){return di++,`${n}-${di}`}var ui='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M2 3.5h12L9.5 8v4.5L6.5 14V8L2 3.5z"/></svg>',hi='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 3l4 5H4l4-5z"/></svg>',pi='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 13l4-5H4l4 5z"/></svg>',fi='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.35" stroke-linecap="round"><path d="M2 4h3m3 0h6M2 8h7m3 0h2M2 12h1m3 0h8"/><circle cx="6.5" cy="4" r="1.35"/><circle cx="10.5" cy="8" r="1.35"/><circle cx="4.5" cy="12" r="1.35"/></svg>';var qe=class{constructor(e){this.uc=e;this.Di=new Map}on(e,t){let r=this.Di.get(e);return r||(r=new Set,this.Di.set(e,r)),r.add(t),()=>{r.delete(t)}}once(e,t){let r=this.on(e,i=>{r(),t(i)});return r}emit(e,t){let r=this.Di.get(e);if(r)for(let i of[...r])try{i(t)}catch(o){console.error(`[mach-table] error in "${e}" listener`,o),this.uc?.(o,e)}}clear(){this.Di.clear()}};var q=class{constructor(e,t){this.manualWidth=null;this.contentWidth=null;this.flex=null;this.currentWidth=0;this.parentGroup=null;this.level=0;this.isDetailToggle=!1;this.id=e,this.colDef=t,this.hide=t.hide??!1;let r=t.pinned;this.pinned=r===!0?"left":r===!1||r==null?null:r,this.resetWidth()}get sortable(){return this.colDef.sortable!==!1}get resizable(){return this.colDef.resizable!==!1}get movable(){return this.colDef.movable!==!1}get filterable(){return this.colDef.filter!=null&&this.colDef.filter!==!1}get filterType(){let e=this.colDef.filter;return e===!0?"text":e??"text"}get hasCheckbox(){return this.colDef.checkboxSelection===!0}resetWidth(){this.manualWidth=null,this.contentWidth=null,this.flex=V(this.colDef.flex)??null}};var te=class n{constructor(e,t){this.parent=null;this.children=[];this.groupId=e,this.def=t}get headerName(){return this.def.headerName??this.def.groupId??""}getLeafColumns(e=[]){for(let t of this.children)t instanceof n?t.getLeafColumns(e):e.push(t);return e}};function pe(n){return Array.isArray(n.children)}var Me=150,Jo=80;function Y(n,e){let t=V(e.minWidth)??Jo,r=V(e.maxWidth)??Number.MAX_SAFE_INTEGER,i=V(n)??V(e.width)??Me;return Math.max(t,Math.min(r,i))}function mi(n,e,t,r){let i=r.map((s,a)=>a).filter(s=>r[s]>0),o=t-e.reduce((s,a)=>s+a,0);for(;Math.abs(o)>.001&&i.length;){let s=i.reduce((l,d)=>l+r[d],0),a=0;if(i=i.filter(l=>{let d=e[l];return e[l]=Y(d+o*r[l]/s,n[l]),a+=e[l]-d,e[l]!==d}),Math.abs(a)<1e-4)break;o-=a}}function gi(n,e){let t=n.map(r=>Y(r.width??Me,r));return e>t.reduce((r,i)=>r+i,0)&&mi(n,t,e,n.map(r=>r.flex??0)),t}function Ye(n,e){let t=n.map(r=>Y(r.width??Me,r));return Number.isFinite(e)&&e>0&&mi(n,t,e,[...t]),t}var mr="__rg_detail_toggle__";function Ie(n){return V(n)!==void 0}var Xe=class{constructor(e){this.e=e;this.X=[];this.va=new Map;this.Be=[];this.Qn=[];this.Gr=[];this.eo=[];this._e=[];this.to=[];this.Zt=1;this.ro=new Map;this.hc=0}Nr(e){this.to=e?[...e]:[];let t=new Map(this.X.map(s=>[s.id,s])),r=this.e.r.defaultColDef,i=new Set(this.e.r.masterDetail&&this.e.r.detailToggleColumn?[mr]:[]),o=(s,a,l)=>s.map((d,c)=>{if(pe(d)){let b=d.groupId??d.headerName??`group_${c}_${l}`,x=new te(b,d);return x.parent=a,x.children=o(d.children,x,l+1),x}let u=d,h=u.colId??u.field??`col_${c}`,p=h,m=2;for(;i.has(p);)p=`${h}_${m++}`;i.add(p);let y=new q(p,ni(u,r,this.e.r.columnTypes));y.parentGroup=a,y.level=l;let v=t.get(p);return v&&(y.manualWidth=v.manualWidth,y.contentWidth=v.contentWidth,y.flex=v.flex,y.hide=v.hide,y.pinned=v.pinned),y});if(this.Be=o(this.to,null,0),this.e.r.masterDetail&&this.e.r.detailToggleColumn){let s=new q(mr,{colId:mr,headerName:"",width:38,pinned:"left",sortable:!1,resizable:!1,movable:!1,filter:!1});s.isDetailToggle=!0,this.Be.unshift(s)}if(this.X=this.xi(this.Be),this.va=new Map(this.X.map(s=>[s.id,s])),this.Zt=this.X.reduce((s,a)=>Math.max(s,a.level+1),1),this._e=this._e.filter(s=>this.X.some(a=>a.id===s.colId)),this._e.length===0){let s=[];for(let a of this.X)a.colDef.initialSort&&s.push({colId:a.id,direction:a.colDef.initialSort});this._e=s}this.Qt()}xi(e,t=[]){for(let r of e)r instanceof te?this.xi(r.children,t):t.push(r);return t}Qt(){let e=this.X.filter(t=>!t.hide);this.Qn=e.filter(t=>t.pinned==="left"),this.eo=e.filter(t=>t.pinned==="right"),this.Gr=e.filter(t=>t.pinned===null),this.ro.clear(),this.c().forEach((t,r)=>this.ro.set(t.id,r))}ze(e){return this.ro.get(e)??-1}te(){return this.X}Ri(){return this.to}pc(){return this.Be}fc(){return this.Zt}P(e){return this.va.get(e)}T(e){return e==="left"?this.Qn:e==="right"?this.eo:this.Gr}c(){return[...this.Qn,...this.Gr,...this.eo]}nt(){return this.c().filter(e=>e.colDef.rowGroup===!0)}mc(){return this.c().filter(e=>e.colDef.aggFunc!=null&&e.colDef.rowGroup!==!0)}no(){return this.Gr.some(e=>e.colDef.colSpan!=null)}ba(){let e=this.c();return this.Gr.find(t=>!t.hasCheckbox&&!t.isDetailToggle)??e.find(t=>!t.hasCheckbox&&!t.isDetailToggle)??e[0]}er(e){return e.pinned==="left"?"left":e.pinned==="right"?"right":"center"}wa(e){this.hc=e;let t=e,r=[],i=[];for(let s of this.c()){let a=this.Si(s);s.pinned!=null||s.colDef.suppressSizeToFit||s.manualWidth!=null?(s.currentWidth=Y(a.width??Me,a),t-=s.currentWidth):(r.push(s),i.push(a))}let o=this.e.r.columnLayout==="fit"?Ye(i,Math.max(0,t)):gi(i,Math.max(0,t));r.forEach((s,a)=>{s.currentWidth=o[a]})}Si(e){let t=e.colDef;return{width:e.manualWidth??e.contentWidth??t.width??void 0,minWidth:e.minWidth??t.minWidth,maxWidth:t.maxWidth,flex:e.manualWidth==null?e.flex??void 0:void 0}}Se(e,t){return Ie(t)?(e.manualWidth=Y(t,this.Si(e)),e.flex=null,!0):!1}Ca(e,t){return Ie(t)?(e.resetWidth(),e.contentWidth=Y(t,this.Si(e)),!0):!1}oo(e,t){let r=this.P(e);!r||r.hide===!t||(r.hide=!t,this.Qt())}At(e,t){let r=this.P(e);if(!r)return!1;let i=this.er(r),o=u=>r.parentGroup?!0:this.er(u)===i,s=r.parentGroup?r.parentGroup.children:this.Be,a=s.filter(u=>u instanceof q&&!u.hide&&o(u)),l=a.indexOf(r);if(l<0)return!1;a.splice(l,1);let d=Math.max(0,Math.min(t,a.length));a.splice(d,0,r);let c=[];return s.forEach((u,h)=>{u instanceof q&&!u.hide&&o(u)&&c.push(h)}),c.length!==a.length?!1:(c.forEach((u,h)=>{s[u]=a[h]}),this.X=this.xi(this.Be),this.Qt(),!0)}so(e,t){let r=this.P(e);!r||!r.movable||(r.pinned=t,this.Qt())}Mi(){return this.X.map(e=>({colId:e.id,hide:e.hide,width:e.manualWidth??e.currentWidth,flex:e.flex,widthMode:e.manualWidth==null?"auto":"manual",contentWidth:e.contentWidth??void 0,pinned:e.pinned}))}Ta(e){let t=new Map(e.map(r=>[r.colId,r]));for(let r of this.X){let i=t.get(r.id);i&&this.gc(r,i)}this.yc(e),this.Qt()}gc(e,t){typeof t.hide=="boolean"&&(e.hide=t.hide),t.widthMode==="auto"?(e.resetWidth(),Ie(t.flex)&&(e.flex=t.flex)):Ie(t.flex)?(e.flex=t.flex,e.manualWidth=null):this.Se(e,t.width),Ie(t.contentWidth)&&(e.contentWidth=Y(t.contentWidth,this.Si(e))),e.movable&&(t.pinned==="left"||t.pinned==="right"||t.pinned===null)&&(e.pinned=t.pinned)}yc(e){let t=new Map;e.forEach((r,i)=>t.set(r.colId,i));for(let r of["left","center","right"]){let i=[],o=[];this.Be.forEach((s,a)=>{s instanceof q&&!s.hide&&s.parentGroup===null&&s.movable&&this.er(s)===r&&(i.push(a),o.push(s))}),o.sort((s,a)=>(t.get(s.id)??Number.MAX_SAFE_INTEGER)-(t.get(a.id)??Number.MAX_SAFE_INTEGER)),i.forEach((s,a)=>{this.Be[s]=o[a]})}this.X=this.xi(this.Be)}ao(){for(let e of this.X){e.resetWidth(),e.hide=e.colDef.hide??!1;let t=e.colDef.pinned;e.pinned=t===!0?"left":t===!1||t==null?null:t}this.Qt()}J(){return this._e.map(e=>({...e}))}Or(e){if(!e||e.length===0){this._e=[];return}this._e=e.filter(t=>this.X.some(r=>r.id===t.colId)&&(t.direction==="asc"||t.direction==="desc")).map(t=>({colId:t.colId,direction:t.direction}))}Ii(e,t){let r=[...this._e],i=r.findIndex(l=>l.colId===e.id),o=i>=0?r[i].direction:null,s=o===null?"asc":o==="asc"?"desc":null;t&&this.e.r.multiSort?s===null?i>=0&&r.splice(i,1):i>=0?r[i]={colId:e.id,direction:s}:r.push({colId:e.id,direction:s}):(r.length=0,s&&r.push({colId:e.id,direction:s})),this._e=r}};function re(n,e){if(n instanceof Error)return n;let t=new Error(typeof n=="string"?n:e);return t.name="AbortError",t}var Zo=()=>re(void 0,"[MachTable] Operation cancelled.");function Je(n,e,t=Zo){return e?new Promise((r,i)=>{let o=()=>{e.removeEventListener("abort",o),i(t())};if(n.then(r,i).finally(()=>e.removeEventListener("abort",o)),e.aborted){o();return}e.addEventListener("abort",o,{once:!0})}):n}function yi(n){return n==null?"":String(n).toLowerCase()}function Qo(n,e,t){let r=yi(n),i=o=>{let s=(o.value??"").toLowerCase();switch(o.match){case"contains":return r.includes(s);case"notContains":return!r.includes(s);case"equals":return r===s;case"notEquals":return r!==s;case"startsWith":return r.startsWith(s);case"endsWith":return r.endsWith(s);case"blank":return r==="";case"notBlank":return r!=="";default:return!0}};return e.length===0||(t==="or"?e.some(i):e.every(i))}function es(n,e,t){switch(t.match){case"equals":return n===e;case"notEquals":return n!==e;case"lessThan":return n<e;case"lessThanOrEqual":return n<=e;case"greaterThan":return n>e;case"greaterThanOrEqual":return n>=e;case"inRange":return n>=e&&n<=(t.value2??e);default:return!0}}function ts(n,e){let t=n==null||n==="";if(e.match==="blank")return t;if(e.match==="notBlank")return!t;if(t)return!1;let r=typeof n=="number"?n:Number(n);if(Number.isNaN(r))return!1;let i=e.value;return i==null||Number.isNaN(i)?!1:es(r,i,e)}function rs(n,e,t){let r=i=>ts(n,i);return e.length===0||(t==="or"?e.some(r):e.every(r))}function gr(n){if(n==null||n==="")return null;if(n instanceof Date)return isNaN(n.getTime())?null:n.getTime();if(typeof n=="number")return n;let e=Date.parse(String(n));return isNaN(e)?null:e}function is(n,e,t){let r=gr(n),i=o=>{let s=r==null;if(o.match==="blank")return s;if(o.match==="notBlank")return!s;if(s)return!1;let a=r,l=o.value!=null?gr(o.value):null;if(l==null)return!1;switch(o.match){case"equals":return a===l;case"notEquals":return a!==l;case"lessThan":return a<l;case"greaterThan":return a>l;case"inRange":{let d=o.value2!=null?gr(o.value2):null;return d!=null?a>=l&&a<=d:a>=l}default:return!0}};return e.length===0||(t==="or"?e.some(i):e.every(i))}function ns(n,e){return e.length===0?!0:e.some(t=>t==null&&n==null||t===n)}function vi(n,e){let t=e.type!=="set"&&e.operator==="or"?"or":"and";switch(e.type){case"text":return Qo(n,e.conditions,t);case"number":return rs(n,e.conditions,t);case"date":return is(n,e.conditions,t);case"set":return ns(n,e.values);default:return!0}}function bi(n,e,t){if(n.kind==="condition"){let i=e.get(n.colId);return i?o=>vi(t(o,i),n.filter):()=>!0}let r=n.children.map(i=>bi(i,e,t));return i=>{let o=n.operator==="or"?r.some(s=>s(i)):r.every(s=>s(i));return n.not?!o:o}}function yr(n,e,t,r,i){let o=new Map(n.map(d=>[d.id,d])),s=Object.entries(e).flatMap(([d,c])=>{let u=o.get(d);return u?[{column:u,filter:c}]:[]}),a=t?bi(t.root,o,i):()=>!0,l=r?.trim().toLowerCase().split(/\s+/).filter(Boolean)??[];return d=>!s.every(({column:c,filter:u})=>vi(i(d,c),u))||!a(d)?!1:l.every(c=>n.some(u=>yi(i(d,u)).includes(c)))}var wi=typeof Intl<"u"?new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}):null;function os(n,e){let t=n==null||n==="",r=e==null||e==="";return!t&&!r?null:t&&r?0:t?1:-1}function ss(n,e){let t=Number.isNaN(n),r=Number.isNaN(e);return t||r?t===r?0:t?1:-1:n-e}function as(n,e){return n===e?0:n?1:-1}function Ze(n,e){let t=os(n,e);if(t!==null)return t;if(typeof n=="number"&&typeof e=="number")return ss(n,e);if(n instanceof Date&&e instanceof Date)return n.getTime()-e.getTime();if(typeof n=="boolean"&&typeof e=="boolean")return as(n,e);let r=String(n),i=String(e);return wi?wi.compare(r,i):r.localeCompare(i)}function vr(n,e,t,r){let i=new Map(t.map(a=>[a.id,a])),o=e.flatMap(a=>{let l=i.get(a.colId);return l?[{column:l,compare:l.colDef.comparator??Ze,direction:a.direction}]:[]}),s=n.map(a=>({node:a,values:o.map(({column:l})=>r(a,l))}));return s.sort((a,l)=>{for(let d=0;d<o.length;d++){let c=o[d],u=c.compare(a.values[d],l.values[d],a.node,l.node);if(u!==0)return c.direction==="asc"?u:-u}return 0}),s.map(({node:a})=>a)}function Ci(){return{count:0,numeric:0,sum:0,min:1/0,max:-1/0}}function Ti(n,e){n.count++,!(typeof e!="number"||!Number.isFinite(e))&&(n.numeric++,n.sum+=e,n.min=Math.min(n.min,e),n.max=Math.max(n.max,e))}function Ei(n,e){return e==="count"?n?.count??0:n?.numeric?e==="min"?n.min:e==="max"?n.max:Number.isFinite(n.sum)?e==="avg"?n.sum/n.numeric:n.sum:null:null}function Qe(n,e){let t=Ci();for(let r of n)Ti(t,r);return Ei(t,e)}var Ae={sum:n=>Qe(n,"sum"),avg:n=>Qe(n,"avg"),count:n=>n.length,min:n=>Qe(n,"min"),max:n=>Qe(n,"max"),first:n=>n.length>0?n[0]:null,last:n=>n.length>0?n[n.length-1]:null};function Di(n,e,t){if(e===Ae.count)return n.length;let r=["sum","avg","min","max"].find(o=>e===Ae[o]);if(!r)return e(n.map(t));let i=Ci();for(let o of n)Ti(i,t(o));return Ei(i,r)}function et(n){let e={...Ae,...n??{}};return t=>e[t]}var tt="group:";function xi(n){return n==null?"null":n instanceof Date?JSON.stringify(["date",String(n.getTime())]):JSON.stringify([typeof n,br(n)])}function br(n){return n==null?"(\u7A7A)":String(n)}function Ri(n){return tt+JSON.stringify(n)}function ls(n,e,t){let r=new Map;for(let i of n){let o=t(i,e),s=xi(o),a=r.get(s);a||(a={key:s,label:br(o),rows:[]},r.set(s,a)),a.rows.push(i)}return[...r.values()].sort((i,o)=>i.label.localeCompare(o.label,void 0,{numeric:!0,sensitivity:"base"})||i.key.localeCompare(o.key))}function Si(n,e,t,r,i){let o=[],s=(a,l,d)=>{if(l===e.length)return{display:a,leaves:a};let c=[],u=[];for(let h of ls(a,e[l],t)){let p=[...d,[e[l].id,h.key]],m=Ri(p);o.push(m);let y=s(h.rows,l+1,p);if(c.push({id:m,data:null,rowIndex:-1,selected:!1,isGroup:!0,groupLevel:l,groupKey:h.label,leafNodes:y.leaves,aggValues:r(y.leaves)}),i.has(m))for(let v of y.display)c.push(v);if(l>0)for(let v of y.leaves)u.push(v)}return{display:c,leaves:u}};return{rows:s(n,0,[]).display,ids:o}}function Mi(n,e,t,r){let i=new Set([...n].filter(l=>l.startsWith("/g0:")));if(!i.size)return{expanded:n,ambiguous:[]};let o=new Map;for(let l of e){let d=[],c="";for(let u=0;u<t.length;u++){let h=r(l,t[u]);if(d.push([t[u].id,xi(h)]),c+=`/g${u}:${br(h)}`,!i.has(c))continue;let p=Ri(d);o.set(c,o.has(c)&&o.get(c)!==p?null:p)}}let s=new Set([...n].filter(l=>!i.has(l))),a=[];for(let l of i){let d=o.get(l);d?s.add(d):d===null?a.push(l):s.add(l)}return{expanded:s,ambiguous:a}}function ds(n,e){let t=n?[n.root]:[];for(;t.length;){let r=t.pop();if(r.kind==="condition")e.add(r.colId);else for(let i of r.children)t.push(i)}}function Ii(n){let e=new Set(Object.keys(n.filterModel));ds(n.advancedFilter,e);let t=new Set(n.sortModel.map(a=>a.colId));for(let a of t)e.add(a);let r=n.columns.some(a=>a.colDef.rowGroup===!0),i=!!n.quickFilter?.trim(),o=n.columns.filter(a=>e.has(a.id)||i||a.colDef.rowGroup===!0||r&&a.colDef.aggFunc!=null),s=new Set;for(let a of o){let l=a.colDef;if(r&&l.rowGroup!==!0&&l.aggFunc!=null&&n.customAggregates?.[l.aggFunc]||l.valueGetter||t.has(a.id)&&l.comparator||!l.field)return null;s.add(l.field)}return[...s]}function Ai(n){return n!=null&&(typeof n=="object"||typeof n=="function")}function Li(n,e){let t=new WeakMap;for(let r of n){if(r.data==null)continue;let i=e.map(o=>B(r.data,o));i.some(Ai)||t.set(r,i)}return t}function Pi(n,e,t,r){return t.length?!r||n===e||n==null||e==null?!0:t.some((i,o)=>{let s=B(e,i);return Ai(s)||!Object.is(r[o],s)}):!1}function ie(n){return re(n.reason,"Block request aborted")}function rt(n){return Number.isFinite(n)?Math.max(1,Math.trunc(n)):1}var it=class{constructor(e,t,r=4){this.maxBlocks=e;this.ho=t;this.maxConcurrentRequests=r;this.re=new Map;this.Z=new Map;this.Ea=0;this.lo=0;this.co=0;this.Da=0;this.xa=0;this.Ai=0;this.Li=new Set;this.maxBlocks=rt(e),this.maxConcurrentRequests=rt(r)}configure(e,t=this.maxConcurrentRequests){this.maxBlocks=rt(e),this.maxConcurrentRequests=rt(t),this.uo(),this.Pi()}vc(e){this.Li=e,this.uo()}peek(e){let t=this.re.get(e);if(t)return t.touchedAt=++this.Ea,t}has(e){return this.re.has(e)}tr(e){let t=this.Z.get(e);t&&(this.Z.delete(e),t.controller.abort(),t.state==="queued"&&t.reject(ie(t.controller.signal)));let r=this.re.get(e);r&&(this.re.delete(e),this.ho?.(e,r))}load(e,t,r,i=0){if(r?.aborted)return Promise.reject(ie(r));let o=this.peek(e);if(o)return this.co++,Promise.resolve(o);let s=this.Z.get(e);if(s)return this.co++,s.priority=Math.max(s.priority,i),this.Pi(),this.Ra(e,s,r);this.Da++;let a=new AbortController,l,d,c=new Promise((p,m)=>{l=p,d=m}),u={controller:a,promise:c,consumers:0,loader:t,priority:i,state:"queued",resolve:l,reject:d};this.Z.set(e,u);let h=this.Ra(e,u,r);return this.Pi(),h}bc(){this.lo++,this.Li.clear();for(let e of this.Z.values())e.controller.abort(),e.state==="queued"&&e.reject(ie(e.controller.signal));this.Z.clear();for(let[e,t]of this.re)this.ho?.(e,t);this.re.clear()}snapshot(){let e=0,t=0;for(let r of this.re.values())e+=r.rows.length;for(let r of this.Z.values())r.state==="active"&&t++;return{cachedBlockCount:this.re.size,loadingBlockCount:this.Z.size,activeRequestCount:t,queuedRequestCount:Math.max(0,this.Z.size-t),cachedRowCount:e,hitCount:this.co,missCount:this.Da,evictionCount:this.xa}}Pi(){for(;this.Ai<this.maxConcurrentRequests;){let e,t;for(let[r,i]of this.Z)i.state!=="queued"||i.controller.signal.aborted||(!t||i.priority>t.priority)&&(e=r,t=i);if(e==null||!t)return;this.wc(e,t)}}wc(e,t){t.state="active",this.Ai++;let r=this.lo;this.Cc(t).then(i=>{r===this.lo&&!t.controller.signal.aborted&&(this.re.set(e,{rows:i.rows,...i.lastRow==null?{}:{lastRow:i.lastRow},touchedAt:++this.Ea}),this.uo()),t.resolve(i)},t.reject).finally(()=>{this.Ai=Math.max(0,this.Ai-1),this.Z.get(e)===t&&this.Z.delete(e),this.Pi()})}Cc(e){let{signal:t}=e.controller;return Je(Promise.resolve().then(()=>{if(t.aborted)throw ie(t);return e.loader(t)}),t,()=>ie(t))}Ra(e,t,r){return t.consumers++,new Promise((i,o)=>{let s=!1,a=d=>{s||(s=!0,r?.removeEventListener("abort",l),t.consumers=Math.max(0,t.consumers-1),d())},l=()=>a(()=>{t.consumers===0&&this.Z.get(e)===t&&(this.Z.delete(e),t.controller.abort(r?.reason),t.state==="queued"&&t.reject(ie(t.controller.signal))),o(ie(r))});r?.addEventListener("abort",l,{once:!0}),t.promise.then(d=>a(()=>i(d)),d=>a(()=>o(d instanceof Error?d:new Error(String(d??"Block request failed")))))})}uo(){let e=Math.max(this.maxBlocks,this.Li.size+1);for(;this.re.size>e;){let t=-1,r=Number.POSITIVE_INFINITY;for(let[o,s]of this.re)this.Li.has(o)||s.touchedAt<r&&(t=o,r=s.touchedAt);if(t<0)return;let i=this.re.get(t);this.re.delete(t),this.xa++,i&&this.ho?.(t,i)}}};function Le(n,e){if(n==null||typeof n!="object")return;let t=n[e];return Array.isArray(t)?t:void 0}var nt=class{constructor(e){this.e=e;this.u=[];this.B=[];this.ie=new Map;this.we=[];this.p=new Map;this.ot={};this.st=null;this.We=null;this.k=new Set;this.j=new Set;this.rr=[];this.Fr=new Map;this.Sa=[];this.G=null;this.ir=!1;this.Ma=!1;this.at=0;this.ki=null;this.Gi=null;this.Ni=new WeakMap;this.Hr=new WeakMap;this.lt=new Map;this.Vr=new Map;this.Br=0;this.Oi=0;this.dt=null;this.ct=new Map;this.Lt=new Map;this.Fi=new Set;this.Pt=new Map;this.ut=new it(12,e=>this.Ia(e));this._r=0;this.Hi=null;this.po=!1;this.Aa=0;this.ae=[];this.$=1;this.jr=20;this.st=O(e.r.advancedFilterModel)}resolveRowId(e,t,r){let i=this.e.r.resolveRowId;if(!i)return r;try{let o=i({data:e,index:t,api:this.e.api});if(typeof o=="string"&&o.length>0)return o;this.e.reportError(new Error("rowKey must resolve to a non-empty identifier"),"rowKey",{index:t})}catch(o){this.e.reportError(o,"rowKey",{index:t})}return r}get F(){return this.e.r.treeData}get f(){return this.e.r.datasource!=null}get Ce(){return this.f&&this.e.r.datasourceMode==="block"}nr(){if(this.f){if(this.Ce)return this.or();let e=Math.max(0,this.we.length-this.u.length);return(this.G??this.u.length)+e}return this.we.length}fo(){return this.Br}zr(){return this.Oi}Tc(){return this.Ma}Vi(e){return!this.f||e?.aborted?Promise.resolve():(this.Oi++,this.e.Me(),this.e.api.editing.stop({cancel:!0}),this.e._.clear(),this.Bi(),this.G=null,this.ir=!1,this.u=[],this.B=[],this.p.clear(),this.k.clear(),this.e.z.clear(),this.w(),this.e.h({data:!0}),this.Ce?(this.ut.configure(this.e.r.maxBlocksInCache,this.e.r.datasourceMaxConcurrentRequests),this._i(0,e)):this.La(0,void 0,e))}kt(e){this.Ma=e,this.e.o.kt(e,this.e.y("loading"))}La(e,t,r){if(!this.f||this.ir||this.G!=null&&e>=this.G)return Promise.resolve();let i=this.e.r.blockSize,o=t??e+i;if(o<=e)return Promise.resolve();let s=++this.at,a=new AbortController,l=()=>a.abort(r?.reason);return r?.addEventListener("abort",l,{once:!0}),this.ki=a,this.ir=!0,this.kt(!0),new Promise(d=>{let c=!1;this.Gi=d;let u=h=>{c||(c=!0,r?.removeEventListener("abort",l),s===this.at&&(this.ir=!1,this.ki=null,this.Gi=null,this.kt(!1),h!=null&&h?.name!=="AbortError"&&this.e.reportError(h,"datasource.getRows",{startRow:e,endRow:o})),d())};this.Pa(e,o,a.signal,(h,p)=>{if(s!==this.at||this.e.s()||a.signal.aborted){u();return}typeof p=="number"&&p>=0?this.G=p:h.length<o-e&&(this.G=e+h.length);let m=this.u.length===0;this.Ec(h),u(),this.w(),this.e.h({data:!0}),m&&this.e.Te(),this.e.W.zi()},h=>u(a.signal.aborted||this.e.s()?void 0:h??new Error("Datasource request failed")))})}Bi(){this.at++,this.ki?.abort(),this.ki=null,this.ir=!1,this.kt(!1),this.Gi?.(),this.Gi=null,this.ut.bc(),this.ct.clear(),this.Lt.clear(),this.Fi.clear();for(let[e,t]of this.Pt)this.p.get(e)===t&&this.p.delete(e);this.Pt.clear()}Ec(e){for(let t of e){if(t==null)continue;let r=this.u.length,i=this.resolveRowId(t,r,`inf-${this.e.sr()}`);if(this.p.has(i)){this.e.reportError(new Error(`Duplicate row id: ${i}`),"datasource.getRows",{rowId:i});continue}let o={id:i,data:t,rowIndex:-1,selected:this.e.g.mo(i)};this.u.push(o),this.p.set(i,o),this.B.push(o)}}_i(e,t,r=0){if(!this.Ce||e<0)return Promise.resolve();if(t?.aborted)return Promise.reject(this.ka(t.reason));let i=this.e.r.blockSize,o=this.at,s=e*i;if(s>=this.or())return Promise.resolve();let a=this.G==null?s+i:Math.min(this.G,s+i),l=this.ut.load(e,d=>this.Dc(s,a,d),t,r);return this.kt(this.u.length===0&&this.ut.snapshot().loadingBlockCount>0),l.then(d=>{o!==this.at||t?.aborted||this.e.s()||!this.Ce||!this.ut.has(e)||this.Fi.has(e)||(this.xc(e,d),this.w(),this.e.h({data:!0}),this.e.W.zi(),o===this.at&&!this.e.s()&&this.Ga(this.e.a.go().lastExcl-1))}).catch(d=>{throw d?.name!=="AbortError"&&this.e.reportError(d,"datasource.getRows",{startRow:s,endRow:a}),d}).finally(()=>{o===this.at&&this.kt(this.u.length===0&&this.ut.snapshot().loadingBlockCount>0)})}Dc(e,t,r){return new Promise((i,o)=>{this.Pa(e,t,r,(s,a)=>i({rows:s,...typeof a=="number"&&a>=0?{lastRow:a}:{}}),s=>o(s instanceof Error?s:new Error(typeof s=="string"?s:"Datasource request failed")))})}Pa(e,t,r,i,o){let s=this.e.r.datasource,a=0,l=null,d=!1,c=p=>{d||(d=!0,l!=null&&clearTimeout(l),r.removeEventListener("abort",u),p())},u=()=>c(()=>o(this.ka(r.reason)));r.addEventListener("abort",u,{once:!0});let h=()=>{if(d)return;if(r.aborted||this.e.s()){u();return}a++;let p=!1,m=y=>{if(!(p||d)){if(p=!0,r.aborted||this.e.s()){u();return}a<=this.e.r.datasourceRetryCount?l=setTimeout(h,this.retryDelay(a)):c(()=>o(y))}};try{let y=s.getRows({startRow:e,endRow:t,sortModel:this.e.n.J(),filterModel:this.Q(),advancedFilterModel:this.Ie(),quickFilterText:this.We,signal:r,onSuccess:(v,b)=>{p||d||(p=!0,c(()=>i(v??[],b)))},fail:m});y&&typeof y.catch=="function"&&y.catch(m)}catch(y){m(y)}};h()}xc(e,t){let r=this.e.r.blockSize,i=e*r;this.Ia(e),typeof t.lastRow=="number"&&t.lastRow>=0?this.G=t.lastRow:t.rows.length<r&&(this.G=i+t.rows.length),t.rows.forEach((o,s)=>{if(o==null)return;let a=i+s;if(this.G!=null&&a>=this.G)return;let l=this.resolveRowId(o,a,`block-${a}`),d=this.Pt.get(l),c=this.p.get(l);if(c&&c!==d&&c.rowIndex!==a){this.e.reportError(new Error(`Duplicate row id: ${l}`),"datasource.getRows",{rowId:l});return}let u=d??{id:l,data:o,rowIndex:a,selected:this.e.g.mo(l)};u.rowIndex=a,u.selected=this.e.g.mo(l),this.Pt.delete(l),this.ct.set(a,u),this.Lt.delete(a),this.p.set(l,u),this.Hr.set(u,a+1)}),this.Na(),this.Fi.add(e)}Ia(e){this.Fi.delete(e);let t=this.e.r.blockSize,r=e*t,i;for(let o=r;o<r+t;o++){let s=this.ct.get(o);s&&(i??(i=new Set(this.e._.getDirtyRowIds())),this.ct.delete(o),i.has(s.id)?this.Pt.set(s.id,s):this.p.get(s.id)===s&&this.p.delete(s.id))}this.Na()}Na(){this.u=[...this.ct.entries()].sort(([e],[t])=>e-t).map(([,e])=>e),this.B=this.u}or(){if(this.G!=null)return this.G;if(this.e.r.datasourceRowCount!=null)return this.e.r.datasourceRowCount;if(this.ct.size===0)return this.e.r.blockSize;let e=0;for(let t of this.ct.keys())e=Math.max(e,t+1);return e+this.e.r.blockSize}Rc(e){let t=this.Lt.get(e);if(!t&&(t={id:`__mach_loading_${e}`,data:null,rowIndex:e,selected:!1,loading:!0},this.Lt.set(e,t),this.Lt.size>2e3)){let r=this.Lt.keys().next().value;r!=null&&this.Lt.delete(r)}return t}ka(e){return re(e,"Operation aborted")}retryDelay(e){let t=Math.min(this.e.r.datasourceRetryDelay*2**Math.max(0,e-1),3e4),r=this.e.r.datasourceRetryJitter;return Math.max(0,Math.round(t*(1+(Math.random()*2-1)*r)))}Sc(e){if(this.Ce){this.Ga(e);return}if(!this.f||this.ir)return;let t=this.u.length;if(this.G!=null&&t>=this.G)return;let r=this.e.r.infiniteBufferRows;if(e+r<t&&e<t)return;let i=this.e.r.blockSize,o=this.G==null?t+i:Math.min(this.G,t+i);this.La(t,o)}Ga(e){if(e<0)return;this.Oa();let t=this.e.r.blockSize,r=Math.floor(e/t),i=Math.floor(this.e.a.go().first/t),o=this.e.r.blockPrefetch,s=r<this.Aa?-1:1;this.Aa=r;for(let a=i;a<r;a++)this._i(a,void 0,o+2).catch(()=>{});for(let a=0;a<=o;a++){let l=a===0?[r]:[r+s*a,r-s*a];for(let d of l)d<0||d*t>=this.or()||this._i(d,void 0,o-a+1).catch(()=>{})}}$e(){return this.Vi().catch(()=>{})}Mc(){return this.Bi(),this.f?this.Vi().catch(()=>{}):(this.G=null,this.ht(this.e.r.rowData),this.e.h({data:!0}),Promise.resolve())}destroy(){this.dt=null,this.Bi(),this.Fa(),this.yo(),this.u=this.B=this.we=this.ae=[],this.p.clear(),this.ie.clear(),this.Fr.clear(),this.Sa=[],this.k.clear(),this.j.clear(),this.rr=[]}vo(e,t,r){if(!this.Ce)return Promise.resolve();this.Oa();let i=this.e.r.blockSize,o=Math.max(0,Math.trunc(e)),s=Math.min(this.or(),Math.max(o,Math.trunc(t))),a=Math.floor(o/i),l=Math.max(a,Math.floor(Math.max(o,s-1)/i)),d=[];for(let c=a;c<=l;c++)d.push(this._i(c,r,100));return Promise.all(d).then(()=>{})}bo(){this.Ce&&(this.Oi++,this.e.Me(),this.e.api.editing.stop({cancel:!0}),this.e._.clear(),this.Bi(),this.e.z.clear(),this.u=[],this.B=[],this.p.clear(),this.w(),this.e.h({data:!0}))}wo(){return this.ut.snapshot()}Oa(){let e=new Set(this.e._.getDirtyRowIds());for(let[l,d]of this.Pt)e.has(l)||(this.Pt.delete(l),this.p.get(l)===d&&this.p.delete(l));let t=this.e.r.blockSize,r=new Set,{first:i,lastExcl:o}=this.e.a.go();for(let l=i;l<o;l+=t)r.add(Math.floor(l/t));o>i&&r.add(Math.floor((o-1)/t));let s=this.e.a.E;s&&r.add(Math.floor(s.rowIndex/t));let a=this.e.l.Ic();a!=null&&r.add(Math.floor(a/t)),this.ut.vc(r)}ht(e){this.Oi++,this.e.Me(),this.e.api.editing.stop({cancel:!0}),this.Fa(),this.e._.clear();let t=this.e.r.resolveRowId,r=this.e.r.childrenKey,i=[],o=[],s=new Map,a=new Map,l=0,d=(c,u,h)=>{let p=l++,m=this.resolveRowId(c,p,`auto-${p}`);if(s.has(m))return this.e.reportError(new Error(`Duplicate row id: ${m}`),"rowData",{rowId:m,index:p}),null;let y=this.F?Le(c,r):void 0,v={id:m,data:c,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(y)};if(this.Ni.set(v,u),i.push(v),s.set(m,v),h!=null){let b=a.get(h)??[];b.push(m),a.set(h,b)}else o.push(v);if(this.F&&Array.isArray(y))for(let b of y)b!=null&&d(b,u+1,m);return v};(e??[]).forEach(c=>{c!=null&&d(c,0,null)}),this.u=i,this.B=o,this.ie=a,this.p=s,this.e.z.clear();for(let c of[...this.k])s.has(c)||this.k.delete(c);if(this.e.r.defaultExpandAll)for(let c of i)this.Ha(c.id)>0&&this.k.add(c.id);this.e.g.Va(t!=null),this.w()}Wr(e){return this.ie.get(e)??[]}Ha(e){return this.ie.get(e)?.length??0}Co(e){return this.Ha(e)>0}isTreeRowLoading(e){return this.p.get(e)?.treeLoading===!0}Fa(){for(let e of this.lt.values())e.abort();this.lt.clear(),this.Vr.clear()}loadTreeChildren(e,t=!1){let r=this.p.get(e),i=this.e.r.loadTreeChildren;if(!this.F||!r?.data||!i)return Promise.resolve([]);if(!t&&r.treeChildrenLoaded)return Promise.resolve(this.Wr(e).flatMap(l=>{let d=this.p.get(l)?.data;return d==null?[]:[d]}));let o=this.Vr.get(e);if(o&&!t)return o;this.lt.get(e)?.abort();let s=new AbortController;this.lt.set(e,s),r.treeLoading=!0,r.treeLoadError=void 0,this.e.h({data:!0});let a=Promise.resolve().then(()=>i({data:r.data,node:r,api:this.e.api,signal:s.signal})).then(l=>{if(s.signal.aborted||this.e.s())return[];if(!Array.isArray(l))throw new TypeError("[MachTable] loadTreeChildren must resolve to an array.");return this.Ac(r,l),r.treeChildrenLoaded=!0,r.treeLoadError=void 0,this.e.emit("treeChildrenLoaded",{rowId:e,rowNode:r,children:l}),l}).catch(l=>{if(s.signal.aborted||l?.name==="AbortError")return[];throw r.treeLoadError=l,r.treeChildrenLoaded=!1,this.e.reportError(l,"treeData.loadChildren",{rowId:e}),this.e.emit("treeChildrenLoadFailed",{rowId:e,rowNode:r,error:l}),l}).finally(()=>{this.lt.get(e)===s&&(this.lt.delete(e),this.Vr.delete(e),r.treeLoading=!1,this.e.h({data:!0}))});return this.Vr.set(e,a),a}Ac(e,t){let r=new Set,i=[...this.Wr(e.id)];for(;i.length>0;){let s=i.pop();r.has(s)||(r.add(s),i.push(...this.Wr(s)))}this.Lc(t,r);for(let s of r)this.lt.get(s)?.abort(),this.lt.delete(s),this.Vr.delete(s),this.ie.delete(s),this.p.delete(s),this.k.delete(s);this.ie.delete(e.id);let o=this.To(e)+1;for(let s of t)s!=null&&this.Eo(e,s,o);this.Ba(),this.e.g.Va(this.e.r.resolveRowId!=null),this.w(),this.e.h({data:!0})}Lc(e,t){let r=this.e.r.resolveRowId,i=r?new Set([...this.p.keys()].filter(l=>!t.has(l))):null,o=new WeakSet,s=[...e],a=0;for(;s.length>0;){let l=s.pop();if(l==null)continue;if(typeof l=="object"){if(o.has(l))throw new TypeError("[MachTable] Lazy tree children contain a cyclic object graph.");o.add(l)}if(r&&i){let c=r({data:l,index:a++,api:this.e.api});if(typeof c!="string"||c.length===0)throw new TypeError("[MachTable] rowKey must resolve to a non-empty identifier for lazy tree children.");if(i.has(c))throw new Error(`Duplicate row id: ${c}`);i.add(c)}let d=Le(l,this.e.r.childrenKey);d&&s.push(...d)}}$r(e,t=!0){let r=this.e.r.resolveRowId,i=[],o=[],s=[];if(e.remove?.length){let l=new Set,d=new Set,c=h=>{if(r){let m=[this.resolveRowId(h,-1,`__missing_remove_${this.e.sr()}`)];for(;m.length>0;){let y=m.pop();if(!l.has(y)){l.add(y);for(let v of this.ie.get(y)??[])m.push(v)}}}else{let p=[h];for(;p.length>0;){let m=p.pop();d.add(m);let y=this.F?Le(m,this.e.r.childrenKey):void 0;if(y)for(let v of y)p.push(v)}}};e.remove.forEach(c),this.u=this.u.filter(h=>{let p=l.has(h.id)||h.data!=null&&d.has(h.data);return p&&(s.push(h.id),this.p.delete(h.id),this.ie.delete(h.id)),!p});let u=new Set(this.u);this.B=this.B.filter(h=>u.has(h))}if(e.update?.length)for(let l of e.update){let d;r?d=this.p.get(this.resolveRowId(l,-1,`__missing_update_${this.e.sr()}`)):d=this.u.find(c=>c.data===l),d&&(o.push({node:d,before:d.data,after:l}),d.data=l,s.push(d.id),this.e.a.Wi(d),i.push(d))}if(e.add?.length){let l=e.addIndex!=null?Math.max(0,Math.min(e.addIndex,this.B.length)):this.B.length,d=[];e.add.forEach((c,u)=>{let h=this.resolveRowId(c,l+u,`add-${this.e.sr()}`);if(this.p.has(h)){this.e.reportError(new Error(`Duplicate row id: ${h}`),"transaction.add",{rowId:h});return}let p={id:h,data:c,rowIndex:-1,selected:!1};this.p.set(h,p),this.Ni.set(p,0);let m=this.F?Le(c,this.e.r.childrenKey):void 0;if(m)for(let y of m)y!=null&&this.Eo(p,y,1);d.push(p)}),this.B=this.B.slice(0,l).concat(d,this.B.slice(l)),this.Ba()}let a={pipelineChanged:this.Pc(e,o),updatedRowIds:i.map(l=>l.id)};return this.kc(a,t),this.e._.Gc(s),a}kc(e,t){e.pipelineChanged&&(this.dt=null),t&&(e.pipelineChanged?this.w():e.updatedRowIds.length&&this._a())}Nc(e){if(e.length===0)return{pipelineChanged:!1,updatedRowIds:[]};let t=!1,r=new Set;for(let i of e){let o=this.$r(i,!1);t||(t=o.pipelineChanged);for(let s of o.updatedRowIds)r.add(s)}return t?this.w():r.size>0&&this._a(),{pipelineChanged:t,updatedRowIds:[...r]}}Pc(e,t){if(e.add?.length||e.remove?.length)return!0;if(!t.length)return!1;let r=this.za();if(r===null)return!0;if(!r.length)return!1;let i=this.dt;return!i||r.length!==i.fields.length||r.some((o,s)=>o!==i.fields[s])?!0:t.some(({node:o,before:s,after:a})=>Pi(s,a,r,i.values.get(o)))}za(){if(this.F||this.e.r.masterDetail||this.e.r.getRowHeight||this.Wa())return null;let e=this.e.n.c();if(e.some(r=>r.colDef.autoHeight===!0||r.colDef.autoRowSpan===!0||r.colDef.rowSpan!=null))return null;let t=!this.e.r.manualFiltering;return Ii({columns:e,customAggregates:this.e.r.aggFuncs,sortModel:this.e.r.manualSorting?[]:this.e.n.J(),filterModel:t?this.ot:{},advancedFilter:t?this.st:null,quickFilter:t?this.We:null})}Oc(){let e=this.za();this.dt=e?.length?{fields:e,values:Li(this.u,e)}:null}_a(){this.e.emit("modelUpdated",{rowCount:this.ae.length})}Eo(e,t,r){let i=this.resolveRowId(t,-1,`add-${this.e.sr()}`);if(this.p.has(i)){this.e.reportError(new Error(`Duplicate row id: ${i}`),"transaction.add",{rowId:i});return}let o=Le(t,this.e.r.childrenKey),s={id:i,data:t,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(o)};this.p.set(i,s),this.Ni.set(s,r);let a=this.ie.get(e.id)??[];if(a.push(s.id),this.ie.set(e.id,a),!!o)for(let l of o)l!=null&&this.Eo(s,l,r+1)}Ba(){this.u=[];let e=t=>{this.u.push(t),this.p.has(t.id)||this.p.set(t.id,t);for(let r of this.ie.get(t.id)??[]){let i=this.p.get(r);i&&e(i)}};for(let t of this.B)e(t)}Kr(e){let t=JSON.stringify(this.ot),r=new Set(this.e.n.te().map(o=>o.id));this.ot=K(e,r);let i=JSON.stringify(this.ot)!==t;return i&&(this.dt=null),i}Q(){return{...this.ot}}ar(e){let t=new Set(this.e.n.te().map(s=>s.id)),r=O(e,t),i=JSON.stringify(this.st);this.st=r,this.e.r.advancedFilterModel=r;let o=JSON.stringify(r)!==i;return o&&(this.dt=null),o}Ie(){return O(this.st)}lr(e){let t=e!=null&&e.trim()!==""?e:null;return t===this.We?!1:(this.We=t,this.dt=null,!0)}Ur(){return this.We}Do(){return Object.keys(this.ot).length>0||this.st!=null||this.We!=null}w(){this.dt=null;let e=this.e.le.start(),t=this.e.n.c(),r=(a,l)=>this.e.d(a,l);if(this.f){this.Fc(e);return}if(this.Hc(e))return;let i,o=[];if(this.F)i=this.Vc(t,r);else{i=this.u,this.Do()&&!this.e.r.manualFiltering&&(i=i.filter(yr(t,this.ot,this.st,this.We,r)));let l=this.e.n.J();if(l.length>0&&!this.e.r.manualSorting)try{i=vr(i,l,t,r)}catch(c){this.e.reportError(c,"comparator",{sortModel:l})}let d=this.e.n.nt();if(d.length>0){let c=this.Bc(i,d);i=c.rows,o=c.ambiguousExpansions}else if(this.e.r.masterDetail){let c=[];for(let u of i)c.push(u),this.k.has(u.id)&&this.isRowExpandable(u)&&c.push({id:`__detail__${u.id}`,data:u.data,rowIndex:-1,selected:!1,isDetail:!0,masterId:u.id});i=c}}for(let a of this.u)a.rowIndex=-1;let s=0;i.forEach((a,l)=>{a.rowIndex=l,!a.isDetail&&!a.isGroup&&(s++,this.Hr.set(a,s))}),this.ae=i,this.dr(),this.Oc(),this.$a(r),this.e.emit("modelUpdated",{rowCount:i.length}),this.e.le.xo(e),this._c(o)}Fc(e){this.u.forEach((t,r)=>{this.Ce||(t.rowIndex=r),this.Hr.set(t,this.Ce?t.rowIndex+1:r+1)}),this.we=this.u,this.ae=this.u,this.Fr.clear(),this.Br++,this.e.emit("modelUpdated",{rowCount:this.u.length}),this.e.le.xo(e)}Hc(e){let t=this.po;return this.po=!1,!t&&this.Wa()?(this.zc(e),!0):(this.yo(),!1)}Wa(){if(!this.e.r.dataProcessor||this.u.length<this.e.r.dataProcessorMinRows||this.F||this.e.r.masterDetail||this.e.n.nt().length>0)return!1;let e=!this.e.r.manualFiltering&&this.Do(),t=!this.e.r.manualSorting&&this.e.n.J().length>0;return e||t}zc(e){this.yo();let t=this.e.r.dataProcessor;if(!t)return;let r=++this._r,i=new AbortController;this.Hi=i;let o=this.e.n.c(),s=this.u.flatMap(d=>d.data==null?[]:[{id:d.id,data:d.data}]),a=!this.e.r.manualFiltering,l=!this.e.r.manualSorting;Promise.resolve().then(()=>t.process({rows:s,columns:o.map(d=>({colId:d.id,...d.colDef.field?{field:d.colDef.field}:{}})),sortModel:l?this.e.n.J():[],filterModel:a?this.Q():{},advancedFilterModel:a?this.Ie():null,quickFilterText:a?this.We:null,signal:i.signal})).then(d=>{if(r!==this._r||i.signal.aborted||this.e.s())return;let c=new Set,u=[];for(let p of d.rowIds){if(c.has(p))continue;c.add(p);let m=this.p.get(p);m&&!m.isDetail&&!m.isGroup&&u.push(m)}for(let p of this.u)p.rowIndex=-1;u.forEach((p,m)=>{p.rowIndex=m,this.Hr.set(p,m+1)}),this.ae=u,this.dr();let h=(p,m)=>this.e.d(p,m);this.$a(h),this.e.emit("modelUpdated",{rowCount:u.length}),this.e.le.xo(e),this.e.h({data:!0})}).catch(d=>{r!==this._r||i.signal.aborted||this.e.s()||(this.e.reportError(d,"dataProcessor.process"),this.po=!0,this.w(),this.e.h({data:!0}))}).finally(()=>{r===this._r&&(this.Hi=null)})}yo(){this._r++,this.Hi?.abort(),this.Hi=null}get Ae(){return this.e.r.paginationEnabled&&!this.f}dr(){if(!this.Ae){this.we=this.ae,this.Br++;return}let e=this.qr(),t=this.getPageCount();if(this.$>t&&(this.$=t),this.$<1&&(this.$=1),this.e.r.paginationPage=this.$,this.e.r.paginationMode==="server"){this.ae.forEach((o,s)=>{o.rowIndex=s}),this.we=this.ae,this.Br++;return}let r=(this.$-1)*e,i=this.ae.slice(r,r+e);i.forEach((o,s)=>{o.rowIndex=s}),this.we=i,this.Br++}qr(){return this.jr=this.e.r.paginationPageSize,Math.max(1,this.jr)}Yr(){return this.Ae?this.$:1}getTotalRowCount(){return this.f?this.nr():this.Ae&&this.e.r.paginationMode==="server"?this.e.r.paginationTotal:this.ae.length}getPageCount(){return this.Ae?Math.max(1,Math.ceil(this.getTotalRowCount()/this.qr())):1}Ka(){return this.ae}setPage(e,t=!1){if(!this.Ae)return;let r=this.getPageCount(),i=Math.max(1,Math.min(Math.round(e)||1,r));i!==this.$&&(this.$=i,this.e.r.paginationPage=i,this.dr(),this.e.h({data:!0}),this.e.a.cr(0,"top"),t||this.$i())}setPageSize(e){if(!this.Ae)return;let t=Math.max(1,Math.round(e)||this.qr()),r=(this.$-1)*this.qr();this.e.r.paginationPageSize=t,this.jr=t,this.$=Math.floor(r/t)+1,this.e.r.paginationPage=this.$,this.dr(),this.e.h({data:!0}),this.$i()}Ua(e,t){this.jr=Math.max(1,Math.round(t)||1),this.e.r.paginationPageSize=this.jr,this.$=Math.max(1,Math.round(e)||1),this.e.r.paginationPage=this.$}Ki(e){this.e.r.paginationEnabled!==e&&(this.e.r.paginationEnabled=e&&!this.f,this.e.r.paginationEnabled&&(this.$=1),this.dr(),this.e.h({data:!0}),this.$i())}Wc(){this.Ae&&(this.$=this.e.r.paginationMode==="server"?this.e.r.paginationPage:1,this.dr(),this.e.h({data:!0}),this.$i())}$i(){this.e.emit("paginationChanged",{page:this.Yr(),pageSize:this.qr(),pageCount:this.getPageCount(),total:this.getTotalRowCount()})}Vc(e,t){let r=this.e.r.manualSorting?[]:this.e.n.J(),i=new Map,o=this.Do()&&!this.e.r.manualFiltering,s=yr(e,this.ot,this.st,this.We,t),a=c=>{let u=i.get(c.id);if(u!==void 0)return u;let h=!0;if(o){h=s(c);for(let p of this.ie.get(c.id)??[]){let m=this.p.get(p);m&&a(m)&&(h=!0)}}return i.set(c.id,h),h},l=[],d=c=>{let u=c;r.length>0&&(u=vr(c,r,e,t));for(let h of u)if(a(h)&&(l.push(h),this.k.has(h.id))){let p=(this.ie.get(h.id)??[]).map(m=>this.p.get(m)).filter(m=>m!=null);d(p)}};return d(this.B),l}$c(){let e=this.Sa,t=0;for(let r of this.we)!r.isDetail&&!r.isGroup&&(e[t++]=r);return e.length=t,e}Kc(e,t,r,i){let o=t.colDef.rowSpan;if(!o)return 1;try{let s=o({api:this.e.api,colDef:t.colDef,column:t,node:e,data:e.data,value:r,rowIndex:e.rowIndex});return Math.max(1,Math.min(Math.round(s)||1,i))}catch(s){return this.e.reportError(s,"rowSpan",{colId:t.id,rowId:e.id}),1}}Uc(e,t,r,i,o){if(!r.colDef.autoRowSpan||i==null||i==="")return 1;let s=1;for(;t+s<e.length&&Ze(i,o(e[t+s],r))===0;)s++;return s}jc(e,t,r){let i=new Int32Array(e.length),o=0;for(;o<e.length;){let s=e[o],a=r(s,t),l=t.colDef.rowSpan?this.Kc(s,t,a,e.length-o):this.Uc(e,o,t,a,r);i[o]=l;for(let d=1;d<l;d++)i[o+d]=-1;o+=l}return i}$a(e){if(this.Fr.clear(),this.F||this.e.r.masterDetail||this.e.n.nt().length>0)return;let t=this.e.n.c().filter(i=>i.colDef.rowSpan!=null||i.colDef.autoRowSpan===!0);if(t.length===0)return;let r=this.$c();if(r.length!==0)for(let i of t)this.Fr.set(i.id,this.jc(r,i,e))}qc(e){return this.Fr.get(e)}ja(e){return this.Hr.get(e)??0}To(e){return this.Ni.get(e)??0}Bc(e,t){let r=et(this.e.r.aggFuncs),i=this.e.n.mc();this.rr=[];let o=l=>{let d={};for(let c of i){let u=r(c.colDef.aggFunc);if(u)try{d[c.id]=Di(l,u,h=>this.e.d(h,c))}catch(h){this.e.reportError(h,"aggFunc",{colId:c.id,aggFunc:c.colDef.aggFunc}),d[c.id]=null}}return d},s=Mi(this.j,this.u,t,(l,d)=>this.e.d(l,d));this.j=s.expanded;let a=Si(e,t,(l,d)=>this.e.d(l,d),o,this.j);return this.rr=a.ids,{rows:a.rows,ambiguousExpansions:s.ambiguous}}_c(e){for(let t of e){if(this.e.s())return;this.e.reportError(new Error(`Ambiguous legacy group expansion: ${t}`),"gridState.groupExpansion",{groupId:t})}}isRowExpandable(e){if(this.F){if(this.Co(e.id)||e.treeLoading)return!0;if(e.treeChildrenLoaded||!e.data||!this.e.r.loadTreeChildren)return!1;let r=this.e.r.isTreeRowExpandable;if(!r)return!1;try{return r({data:e.data,node:e,api:this.e.api})}catch(i){return this.e.reportError(i,"isTreeRowExpandable",{rowId:e.id}),!1}}if(!this.e.r.masterDetail)return!1;let t=this.e.r.isRowExpandable;if(t)try{return t({data:e.data,node:e,api:this.e.api})}catch(r){return this.e.reportError(r,"isRowExpandable",{rowId:e.id}),!1}return!0}isRowExpanded(e){return this.k.has(e)}Yc(){return[...this.k]}Xc(){return[...this.j]}Jc(e,t){this.k=new Set(e.filter(r=>this.p.has(r))),this.j=new Set(t)}Ro(e){return this.So(e,!0)}Mo(e){return this.So(e,!1)}Ui(e){return this.So(e,!this.k.has(e))}So(e,t){let r=this.p.get(e);return!r||t&&!this.isRowExpandable(r)?!1:(t===this.k.has(e)||(t?this.k.add(e):this.k.delete(e),this.w(),this.e.h({data:!0}),this.e.emit("detailToggled",{rowId:e,rowNode:r,expanded:t}),t&&this.F&&!this.Co(e)&&!r.treeLoading&&this.loadTreeChildren(e).catch(()=>{})),t)}Io(){let e=!1;for(let t of this.u)!this.k.has(t.id)&&this.isRowExpandable(t)&&(this.k.add(t.id),e=!0);e&&(this.w(),this.e.h({data:!0}))}Ao(){this.k.size!==0&&(this.k.clear(),this.w(),this.e.h({data:!0}))}Lo(e){return this.setGroupExpanded(e,!this.j.has(e))}isGroupExpanded(e){return this.j.has(e)}Po(){if(this.rr.length===0)return;let e=!1;for(let t of this.rr)this.j.has(t)||(this.j.add(t),e=!0);e&&(this.w(),this.e.h({data:!0}))}ko(){this.j.size!==0&&(this.j.clear(),this.w(),this.e.h({data:!0}))}setGroupExpanded(e,t){return!this.rr.includes(e)||t===this.j.has(e)||(t?this.j.add(e):this.j.delete(e),this.w(),this.e.h({data:!0})),t}qa(){return!this.F&&!this.f&&!this.e.r.dataProcessor&&this.e.r.paginationMode!=="server"&&this.e.n.J().length===0&&this.e.n.nt().length===0}Ya(e,t){if(!this.qa()||!Number.isInteger(e)||!Number.isInteger(t))return!1;let r=this.m(e),i=this.m(t);if(!r||!i||r.isDetail||i.isDetail||r.isGroup||i.isGroup)return!1;let o=this.u.indexOf(r),s=this.u.indexOf(i);return o<0||s<0||o===s?!1:(this.u.splice(o,1),this.u.splice(s,0,r),this.w(),this.e.h({data:!0}),!0)}be(){return this.u}Zc(){return this.B}pt(){return this.we}A(){return this.Ce?this.or():this.we.length}m(e){return this.Ce?e<0||e>=this.or()?void 0:this.ct.get(e)??this.Rc(e):this.we[e]}K(e){return this.p.get(e)}Go(e){this.u.forEach(e)}No(e){let t=0;for(let r of this.ae)r.isDetail||r.isGroup||e(r,t++)}};var ot=class{constructor(e){this.e=e;this.S=new Set;this.Ke=null;this.Xr=new Set}mo(e){return this.S.has(e)}Qc(e){return this.Xr.has(e)}Ue(e){if(e.loading)return!1;let t=this.eu(e),r=t?.colDef.selectable;if(!t||!r)return!0;try{return r({api:this.e.api,colDef:t.colDef,column:t,node:e,data:e.data,value:this.e.d(e,t),rowIndex:e.rowIndex})}catch(i){return this.e.reportError(i,"selectable",{rowId:e.id,colId:t?.id}),!1}}eu(e){if(!(e.isGroup||e.isDetail))return this.e.n.c().find(t=>t.hasCheckbox&&t.colDef.selectable!=null)}je(){return this.e.i.be().filter(e=>this.S.has(e.id))}ji(){return this.je().filter(e=>e.data!=null).map(e=>e.data)}qi(){return[...this.S]}tu(e){let t=new Set(e),r=this.e.i.be().filter(i=>t.has(i.id)&&!i.isDetail&&!i.isGroup).map(i=>({node:i,selected:!0}));this.Ee(r,!0)}Va(e){if(!e)this.S.clear(),this.Ke=null;else{let t=new Set(this.e.i.be().map(r=>r.id));for(let r of[...this.S])t.has(r)||this.S.delete(r);this.Ke!=null&&!t.has(this.Ke)&&(this.Ke=null)}for(let t of this.e.i.be())t.selected=this.S.has(t.id);this.Xa()}Ja(e){let t=e.leafNodes??[];if(t.length===0)return{all:!1,some:!1};let r=0,i=0;for(let o of t)this.Ue(o)&&(r++,this.S.has(o.id)&&i++);return r===0?{all:!1,some:!1}:{all:i===r,some:i>0}}ru(e,t){let r=(e.leafNodes??[]).filter(i=>this.Ue(i));r.length!==0&&this.Ee(r.map(i=>({node:i,selected:t})))}Za(e,t,r=!1){this.Ee([{node:e,selected:t,clearOthers:r}])}Oo(e,t=!0,r=!0){let i=this.e.i.K(e);i&&this.Za(i,t,r)}iu(e,t){let r=t==="single";this.Ee([{node:e,selected:r?!0:!e.selected,clearOthers:r}]),this.Ke=e.id}nu(e,t,r){return!r||!t.ctrlKey&&!t.metaKey?!1:(this.Ee([{node:e,selected:!e.selected}]),this.Ke=e.id,!0)}ou(e,t,r){if(!r||!t.shiftKey||this.Ke==null)return!1;let i=this.e.i.K(this.Ke);if(!i||i.rowIndex<0||e.rowIndex<0)return!1;let o=Math.min(i.rowIndex,e.rowIndex),s=Math.max(i.rowIndex,e.rowIndex),a=[];for(let l=o;l<=s;l++){let d=this.e.i.m(l);d&&!d.isDetail&&!d.isGroup&&this.Ue(d)&&a.push({node:d,selected:!0})}return this.Ee(a),!0}Qa(e,t,r){let i=this.e.r.rowSelection;if(i==="none"||!this.Ue(e))return;if(r){this.iu(e,i);return}let o=i==="multiple";this.nu(e,t,o)||this.ou(e,t,o)||(this.Ee([{node:e,selected:!0,clearOthers:!0}]),this.Ke=e.id)}selectAll(e=!0){let t=this.e.r.rowSelection;if(t==="none")return;let i=(e?this.e.i.pt():this.e.i.be()).filter(o=>!o.isDetail&&!o.isGroup&&this.Ue(o));if(i.length!==0){if(t==="single"){this.Ee([{node:i[0],selected:!0,clearOthers:!0}]);return}this.Ee(i.map(o=>({node:o,selected:!0})))}}deselectAll(){this.Ee([],!0)}su(){let t=this.e.i.pt().filter(r=>!r.isDetail&&!r.isGroup).filter(r=>this.Ue(r));if(t.length===0)return!1;if(this.e.i.f){let r=this.e.i.nr();if(t.length<r)return!1}return t.every(r=>this.S.has(r.id))}au(){let t=this.e.i.pt().filter(i=>!i.isDetail&&!i.isGroup).filter(i=>this.Ue(i)),r=t.reduce((i,o)=>i+(this.S.has(o.id)?1:0),0);if(r===0)return!1;if(this.e.i.f){let i=this.e.i.nr();if(t.length<i)return!0}return r>0&&r<t.length}lu(e,t=!1){this.Ee(e,t)}du(e,t,r){!t&&!e.some(i=>i.clearOthers)||(this.S=t?new Set:new Set(e.filter(i=>i.selected).flatMap(i=>r?this.tl(i.node):[i.node.id])))}cu(e,t){for(let r of e){if(!this.Ue(r.node))continue;let i=t?this.tl(r.node):[r.node.id];for(let o of i)r.selected?this.S.add(o):this.S.delete(o)}}uu(e){let t=new Set;for(let r of new Set([...e,...this.S]))e.has(r)!==this.S.has(r)&&t.add(r);return t}hu(e,t,r){let i=[],o=new Set([...e,...r,...this.Xr]);for(let s of this.e.i.be()){let a=this.S.has(s.id);s.selected=a,(o.has(s.id)||t.get(s.id)!==a)&&s.rowIndex>=0&&i.push(s.rowIndex)}return i}Ee(e,t=!1){let r=new Set(this.S),i=this.e.i.F&&this.e.r.autoCheckedChildren;this.du(e,t,i),this.cu(e,i);let o=this.uu(r),s=new Map;for(let d of this.e.i.be())s.set(d.id,d.selected);let a=new Set(this.Xr);this.Xa();let l=this.hu(o,s,a);o.size>0&&(this.e.a.ft(l),this.e.W.zi(),this.e.emit("selectionChanged",{selectedNodes:this.je(),selectedRows:this.ji()}))}tl(e){let t=[e.id],r=i=>{for(let o of this.e.i.Wr(i))t.push(o),r(o)};return r(e.id),t}Xa(){if(this.Xr.clear(),!this.e.i.F)return;let e=t=>{let r=this.e.i.Wr(t);if(r.length===0)return{all:this.S.has(t),some:this.S.has(t)};let i=!0,o=!1;for(let s of r){let a=e(s);a.all?o=!0:(a.some&&(o=!0),i=!1)}return o&&!i&&this.Xr.add(t),i?this.S.add(t):this.S.delete(t),{all:i,some:o}};for(let t of this.e.i.Zc())e(t.id);for(let t of this.e.i.be())t.selected=this.S.has(t.id)}};var st=class{constructor(e){this.e=e;this.Gt=null;this.ne=0;this.mt=0;this.Le=null;this.Nt=null;this.gt=e=>{let t=this.Ho(e);t&&(this.mt=this.ol(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.mt-t.startWidth)>=.5),!this.ne&&(this.ne=requestAnimationFrame(()=>{this.ne=0,this.mu()})))};this.Pe=e=>{let t=this.Ho(e);t&&(this.mt=this.ol(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.mt-t.startWidth)>=.5),this.gu(t))};this.Ft=e=>{this.Ho(e)&&this.Ot()};this.rl=()=>{this.Ot()}}pu(e,t){if(!this.e.r.enableColumnResize||!t.resizable||e.isPrimary===!1)return;this.Ot();let r=e.currentTarget,i=t.currentWidth;this.mt=i,this.Gt={column:t,didResize:!1,handle:r,pointerId:e.pointerId,startFlex:t.flex,startManualWidth:t.manualWidth,startWidth:i,startX:e.clientX},window.addEventListener("pointermove",this.gt),window.addEventListener("pointerup",this.Pe,!0),window.addEventListener("pointercancel",this.Ft,!0),r.addEventListener("lostpointercapture",this.rl);try{r.setPointerCapture?.(e.pointerId)}catch{}this.e.o.root.classList.add("mach-root--resizing"),r.classList.add("mach-header-resize--active"),this.fu(this.Gt)}Ot(e=!0){let t=this.Gt;t&&(this.Gt=null,this.Fo(),this.il(t),e&&(t.column.manualWidth=t.startManualWidth,t.column.flex=t.startFlex,this.e.qe()),this.e.o.root.classList.remove("mach-root--resizing"),this.nl(t))}gu(e){this.Gt=null,this.Fo(),e.didResize&&(Math.abs(this.mt-e.startWidth)<.5?(e.column.manualWidth=e.startManualWidth,e.column.flex=e.startFlex):this.e.n.Se(e.column,this.mt),this.e.qe()),this.il(e);try{e.handle.releasePointerCapture?.(e.pointerId)}catch{}this.e.o.root.classList.remove("mach-root--resizing"),this.nl(e),e.didResize&&this.e.ur([e.column])}mu(){let e=this.Gt;!e||!this.e.n.Se(e.column,this.mt)||(this.e.qe(),this.Jr(e),this.e.sl(e.column,!1))}fu(e){this.Le=document.createElement("div"),this.Le.className="mach-column-resize-guide",this.Le.setAttribute("aria-hidden","true"),this.Nt=document.createElement("span"),this.Nt.className="mach-column-resize-label",this.Le.appendChild(this.Nt),this.e.o.root.appendChild(this.Le),this.Jr(e)}Jr(e){if(!this.Le||!this.Nt)return;let t=this.e.o.root,r=t.getBoundingClientRect(),i=e.handle.parentElement.getBoundingClientRect(),o=Math.max(0,Math.min(t.clientWidth,i.right-r.left-t.clientLeft)),s=Math.max(32,Math.min(t.clientWidth-32,o));this.Le.style.left=`${o}px`,this.Le.style.top=`${Math.max(0,i.top-r.top-t.clientTop)}px`,this.Nt.style.left=`${s-o}px`,this.Nt.textContent=`${Math.round(e.column.currentWidth)} px`}nl(e){e.handle.classList.remove("mach-header-resize--active"),this.Le?.remove(),this.Le=null,this.Nt=null}ol(e,t){let r=Number.isFinite(t)?t:e.startX;return Math.max(1,e.startWidth+r-e.startX)}Ho(e){let t=this.Gt;return t&&e.pointerId===t.pointerId?t:null}Fo(){this.ne&&cancelAnimationFrame(this.ne),this.ne=0}il(e){window.removeEventListener("pointermove",this.gt),window.removeEventListener("pointerup",this.Pe,!0),window.removeEventListener("pointercancel",this.Ft,!0),e.handle.removeEventListener("lostpointercapture",this.rl)}destroy(){this.Ot(!1),this.Fo(),this.e.o.root?.classList.remove("mach-root--resizing")}};var ki=6,at=class{constructor(e){this.e=e;this.Zr=null;this.hr=null;this.Vo=!1;this.de=0;this.Yi=null;this.gt=e=>{if(this.hr){this.bu(e);return}let t=this.Zr;t&&(Math.abs(e.clientX-t.startX)<ki&&Math.abs(e.clientY-t.startY)<ki||this.wu(e))};this.Pe=e=>{this.Zr=null,e.type!=="pointercancel"&&this.hr&&this.zo(e.clientX,e.clientY),this.Bo();let t=this.al();t&&e.type!=="pointercancel"&&t.targetIndex>=0&&this.e.At(t.column.id,t.targetIndex)}}yu(e,t){e.button===0&&t.movable&&(this.Zr={column:t,startX:e.clientX,startY:e.clientY},window.addEventListener("pointermove",this.gt),window.addEventListener("pointerup",this.Pe),window.addEventListener("pointercancel",this.Pe))}vu(){let e=this.Vo;return this.Vo=!1,e}wu(e){let t=this.Zr;if(!t)return;let r=this.Cu(t.column);if(!r||!r.parentElement){this.Bo();return}this.Vo=!0;let i=f("div","mach-drop-indicator"),o=f("div","mach-column-drag-ghost");o.textContent=t.column.colDef.headerName??t.column.colDef.field??t.column.id,o.ariaHidden="true",L(o,this.e.o.root),document.body.appendChild(o),r.parentElement.appendChild(i),r.classList.add("mach-header-cell--dragging"),this.e.o.root.classList.add("mach-root--dragging");let s=this.e.a._o(t.column),a=this.e.o.pr[s],l=this.e.n.T(s),d=new Float64Array(l.length+1),c=new Float64Array(l.length);for(let h=0;h<l.length;h++){let p=l[h].currentWidth;c[h]=d[h]+p/2,d[h+1]=d[h]+p}let u=o.getBoundingClientRect();this.hr={column:t.column,cellEl:r,ghost:o,indicator:i,targetIndex:-1,pane:s,containerLeft:a.getBoundingClientRect().left,startScrollLeft:this.e.o.M.center.scrollLeft,fromIndex:l.indexOf(t.column),midpoints:c,offsets:d,ghostWidth:u.width,ghostHeight:u.height},this.zo(e.clientX,e.clientY)}Cu(e){let t=this.e.a._o(e);return this.e.o.pr[t].querySelector(`.mach-header-cell[data-col-id="${cs(e.id)}"]`)}bu(e){this.Yi={clientX:e.clientX,clientY:e.clientY},!this.de&&(this.de=requestAnimationFrame(()=>{this.de=0;let t=this.Yi;this.Yi=null,t&&this.zo(t.clientX,t.clientY)}))}zo(e,t){let r=this.hr;if(!r)return;let i=C(e+12,8,window.innerWidth-r.ghostWidth-8),o=C(t+12,8,window.innerHeight-r.ghostHeight-8);r.ghost.style.transform=`translate3d(${i}px, ${o}px, 0)`;let s=r.pane==="center"?this.e.o.M.center.scrollLeft-r.startScrollLeft:0,a=e-(r.containerLeft-s),l=r.midpoints.length;for(let d=0;d<r.midpoints.length;d++)if(a<r.midpoints[d]){l=d;break}r.targetIndex=l>r.fromIndex?l-1:l,r.indicator.style.transform=`translate3d(${r.offsets[l]}px, 0, 0)`}al(){let e=this.hr;return e?(this.hr=null,e.cellEl.classList.remove("mach-header-cell--dragging"),e.ghost.remove(),e.indicator.remove(),this.e.o.root.classList.remove("mach-root--dragging"),e):null}Bo(){window.removeEventListener("pointermove",this.gt),window.removeEventListener("pointerup",this.Pe),window.removeEventListener("pointercancel",this.Pe),this.de&&cancelAnimationFrame(this.de),this.de=0,this.Yi=null}destroy(){this.Bo(),this.al(),this.Zr=null}};function cs(n){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(n):n.replace(/[^a-zA-Z0-9_-]/g,"\\$&")}var wr=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function lt(n,e=!0){if(n==="")return null;if(!e||typeof n!="string"||!wr.test(n)||/^[+-]?0\d/.test(n))return n;let t=Number(n);return Number.isFinite(t)&&(!Number.isInteger(t)||Number.isSafeInteger(t))?t:n}function us(n,e){let t=n==null?"":String(n);return t.includes(e)||t.includes('"')||t.includes(`
|
|
2
|
+
`)||t.includes("\r")?'"'+t.replace(/"/g,'""')+'"':t}function ne(n){return typeof n!="string"||n===""||wr.test(n)?n:/^[\s\u0000-\u001f]*[=+\-@]/.test(n)?"'"+n:n}function Gi(n,e={}){let t=e.columnSeparator??",",r=e.protectFormulas??!0,i=n.map(o=>o.map(s=>us(r?ne(s):s,t)).join(t)).join(`\r
|
|
3
|
+
`);return e.prependBOM?"\uFEFF"+i:i}function Cr(n){return n==null?"":String(n)}function hs(n,e){let t=e?ne(n):n,r=Cr(t);return/["\t\n\r]/.test(r)?'"'+r.replace(/"/g,'""')+'"':r}function dt(n,e=!0){return n.map(t=>t.map(r=>hs(r,e)).join(" ")).join(`
|
|
4
|
+
`)}function ct(n){return ht(n," ")}function ut(n,e=","){return ht(n,e)}function ht(n,e){let t=[],r=[],i="",o=!1,s=0;for(;s<n.length;){let a=n[s];if(o){if(a==='"'){if(n[s+1]==='"'){i+='"',s+=2;continue}o=!1,s++;continue}i+=a,s++;continue}if(a==='"'&&i===""){o=!0,s++;continue}if(a===e){r.push(i),i="",s++;continue}if(a===`
|
|
5
5
|
`||a==="\r"){r.push(i),t.push(r),r=[],i="",a==="\r"&&n[s+1]===`
|
|
6
|
-
`?s+=2:s++;continue}i+=a,s++}return(i!==""||r.length>0)&&(r.push(i),t.push(r)),t}function vs(n){let e=null;try{return e=document.createElement("textarea"),e.value=n,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.focus(),e.select(),document.execCommand("copy")}catch{return!1}finally{e?.remove()}}async function mt(n){try{if(typeof navigator<"u"&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(n),!0}catch{}return vs(n)}var Vi=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),bs=new Set([...Vi,"Enter","F2","Tab"," ","Escape","Delete","Backspace"]),gt=class{constructor(e){this.e=e;this.ll=e=>{if(this._o(e)||this.e.r.suppressClipboard)return;let t=this.e.a.Zr();if(!t)return;let r=this.e.cl(t),i=e.clipboardData;i&&typeof i.setData=="function"?i.setData("text/plain",r):mt(r),e.type==="cut"&&this.e.Ko(t),e.preventDefault()};this.Tu=e=>{if(this._o(e)||this.e.r.suppressClipboard)return;let t=this.e.a.Wo();if(!t)return;let r=e.clipboardData,i=r&&typeof r.getData=="function"?r.getData("text/plain"):null;typeof i!="string"||i===""||(e.preventDefault(),this.e.ul(i,t.row,t.colIdx))};this.Cu=e=>{this._o(e)||this.e.s()||this.Du(e)||bs.has(e.key)&&(this.Eu(e)||this.xu(e)||this.Ru(e))}}init(){this.al("addEventListener")}destroy(){this.al("removeEventListener")}al(e){let t=this.e.o.root;t[e]("keydown",this.Cu),t[e]("copy",this.ll),t[e]("cut",this.ll),t[e]("paste",this.Tu)}dl(e,t,r){let i=this.e.n.c(),o=i.findIndex(d=>d.id===t);if(o<0)return null;let s=this.e.i.A(),a=o,l=e;for(let d=0;d<(i.length+1)*(s+1);d++){if(a+=r,a>=i.length){if(l>=s-1)return null;a=0,l=this.Ht(l+1,1)}else if(a<0){if(l<=0)return null;a=i.length-1,l=this.Ht(l-1,-1)}if(l<0||l>=s)return null;let c=this.e.i.m(l);if(c&&!c.isDetail&&this.e.l.q(c,i[a]))return{rowIndex:l,column:i[a]}}return null}Ht(e,t){let r=this.e.i.A();for(;e>=0&&e<r;){let i=this.e.i.m(e);if(!i||!i.isDetail)return e;e+=t}return-1}_o(e){let t=e.target;return e.defaultPrevented||t instanceof HTMLElement&&(t.isContentEditable||!!t.closest("button,a[href],input,textarea,select"))||this.e.l.isEditing()}Du(e){if(!e.ctrlKey&&!e.metaKey)return!1;let t=e.key.toLowerCase();return t==="a"?(this.e.r.rowSelection==="multiple"&&(e.preventDefault(),this.e.g.selectAll(!0)),!0):e.altKey||t!=="z"&&t!=="y"?!1:(e.preventDefault(),t==="z"&&!e.shiftKey?this.e._.undo():this.e._.redo(),!0)}Eu(e){let t=this.e.a;if(e.key==="Escape")return this.e.Me(),this.e.r.enableRangeSelection&&t.Pe()&&(e.preventDefault(),t.pr()),!0;if(e.key!=="Delete"&&e.key!=="Backspace")return!1;if(!this.e.r.enableRangeSelection)return!0;let r=t.Pe();return r&&!(r.r1===r.r2&&r.c1===r.c2)&&(e.preventDefault(),this.e.Ko(r)),!0}xu(e){if(this.e.a.D)return!1;let t=this.e.n.c();return this.e.i.A()>0&&t.length>0&&(e.preventDefault(),this.e.a.Ge(0,t[0].id)),!0}Ru(e){let t=this.e.a,r=t.D;if(!r)return;let i=this.e.n.c(),o=i.findIndex(c=>c.id===r.colId),s=this.e.i.A();if(o<0||s===0)return;let a={row:r.rowIndex,colIdx:o},l=this.Su(e,a,i,s);if(!l)return;e.preventDefault();let d=l.row!==a.row||l.colIdx!==a.colIdx;if(e.shiftKey&&this.e.r.enableRangeSelection&&d){t.Mu(l.row,l.colIdx);return}d&&t.Ge(l.row,i[l.colIdx].id)}Su(e,t,r,i){return Vi.has(e.key)?this.Iu(e,t,r.length,i):e.key==="Enter"||e.key==="F2"?this.Au(e,t,r,i):e.key===" "?(this.Lu(t.row),t):e.key==="Tab"?this.ku(e,t,r):null}Iu(e,t,r,i){let{row:o,colIdx:s}=t;switch(e.key){case"ArrowUp":o=this.Yi(o,this.Ht(o-1,-1),i);break;case"ArrowDown":o=this.Yi(o,this.Ht(o+1,1),i);break;case"ArrowLeft":s=Math.max(0,s-1);break;case"ArrowRight":s=Math.min(r-1,s+1);break;case"Home":s=0,e.ctrlKey&&(o=0);break;case"End":s=r-1,e.ctrlKey&&(o=Math.max(0,this.Ht(i-1,-1)));break;case"PageUp":case"PageDown":o=this.Pu(e.key,o,i);break}return{row:o,colIdx:s}}Yi(e,t,r){return t>=0&&t<r?t:e}Pu(e,t,r){let i=this.e.o.M.center,o=Math.max(1,Math.floor(i.clientHeight/this.e.r.rowHeight)),s=e==="PageUp"?-1:1,a=Math.max(0,Math.min(r-1,t+o*s));return this.Yi(t,this.Ht(a,s),r)}Au(e,t,r,i){let o=this.e.i.m(t.row),s=r[t.colIdx];if(o&&!o.isDetail&&s&&this.e.l.q(o,s))return this.e.l.start(t.row,s,e.key==="F2"?e.key:null),t;let a=this.Ht(t.row+1,1);return{...t,row:this.Yi(t.row,a,i)}}Lu(e){let t=this.e.i.m(e);if(!(!t||t.isDetail)){if(t.isGroup){this.e.i.Ao(t.id);return}this.e.r.rowSelection!=="none"&&this.e.g.Ja(t,!t.selected,this.e.r.rowSelection==="single")}}ku(e,t,r){let i=this.dl(t.row,r[t.colIdx].id,e.shiftKey?-1:1);return i?(this.e.a.Ge(i.rowIndex,i.column.id),this.e.l.start(i.rowIndex,i.column),t):null}};var N=null;function zi(n){N?.owner&&(n===N.owner||n.contains(N.owner))&&N.close()}function _i(n){let e=n.target;N?.contains(e)||N?.close()}function bt(){N?.reposition()}function Ki(n){n.key!=="Escape"||!N||(n.preventDefault(),n.stopImmediatePropagation(),N.close(!0))}function ws(n){N?.close!==n.close&&N?.close(),!N&&(N=n,document.addEventListener("mousedown",_i,!0),document.addEventListener("keydown",Ki,!0),window.addEventListener("resize",bt),window.addEventListener("scroll",bt,!0))}function Cs(n){N?.close===n&&(N=null,document.removeEventListener("mousedown",_i,!0),document.removeEventListener("keydown",Ki,!0),window.removeEventListener("resize",bt),window.removeEventListener("scroll",bt,!0))}function se(n,e){return e?`${n} ${e}`:n}function vt(n){let e=[];return n.forEach((t,r)=>{t.disabled||e.push(r)}),e}function Bi(n,e,t){let r=vt(n);if(r.length===0)return-1;let i=r.indexOf(e);return i<0?t>0?r[0]:r[r.length-1]:r[Math.max(0,Math.min(r.length-1,i+t))]}function yt(n,e){return n.findIndex(t=>t.value===e&&!t.disabled)}function Z(n){let e=f("div",se("mach-select-control",n.classNames?.root)),t=f("select",se("mach-select-native",n.classNames?.native));t.hidden=!0,t.tabIndex=-1,t.setAttribute("aria-hidden","true");let r=f("button",se("mach-select-trigger",n.classNames?.trigger));r.type="button",r.setAttribute("role","combobox"),r.setAttribute("aria-haspopup","listbox"),r.setAttribute("aria-expanded","false"),r.setAttribute("aria-label",n.ariaLabel);let i=f("span",se("mach-select-value",n.classNames?.value)),o=f("span",se("mach-select-caret",n.classNames?.caret));o.setAttribute("aria-hidden","true"),r.append(i,o);let s=f("div",se("mach-select-listbox",n.classNames?.listbox));s.id=fi("mach-select-listbox"),s.setAttribute("role","listbox"),s.setAttribute("aria-hidden","true"),r.setAttribute("aria-controls",s.id),e.append(t,r);let a=[...n.options],l=[],d=-1,c=!1,u=()=>n.themeSource??e.closest(".mach-root")??e,h=()=>{let g=a.find(y=>y.value===t.value);i.textContent=g?.label??t.value,l.forEach((y,D)=>{let T=a[D]?.value===t.value;y.setAttribute("aria-selected",T?"true":"false"),y.classList.toggle("mach-select-option--selected",T),y.classList.toggle("mach-select-option--active",D===d)}),r.setAttribute("aria-activedescendant",d>=0?l[d]?.id??"":"")},p=()=>{let g=r.getBoundingClientRect(),y=s.getBoundingClientRect(),D=Math.max(g.width,y.width),T=E(g.left,8,Math.max(8,window.innerWidth-D-8)),O=window.innerHeight-g.bottom-8,W=O<Math.min(y.height,240)&&g.top>O,L=W?Math.max(8,g.top-y.height-5):Math.min(window.innerHeight-y.height-8,g.bottom+5);s.style.minWidth=`${g.width}px`,s.style.left=`${T}px`,s.style.top=`${Math.max(8,L)}px`,s.classList.toggle("mach-select-listbox--above",W)},m=(g=!1)=>s.classList.contains("mach-select-listbox--open")?(s.classList.remove("mach-select-listbox--open","mach-select-listbox--above"),s.setAttribute("aria-hidden","true"),r.setAttribute("aria-expanded","false"),r.removeAttribute("aria-activedescendant"),s.remove(),Cs(m),g&&!c&&r.focus({preventScroll:!0}),!0):!1,b=(g,y=!0)=>{!a[g]||a[g].disabled||(d=g,h(),y&&l[g]?.scrollIntoView?.({block:"nearest"}))},w=()=>{c||r.disabled||s.classList.contains("mach-select-listbox--open")||(ws({owner:u(),close:m,contains:g=>e.contains(g)||s.contains(g),reposition:p}),d=yt(a,t.value),d<0&&(d=vt(a)[0]??-1),G(s,u()),document.body.appendChild(s),s.classList.add("mach-select-listbox--open"),s.setAttribute("aria-hidden","false"),r.setAttribute("aria-expanded","true"),p(),h(),l[d]?.scrollIntoView?.({block:"nearest"}))},C=g=>{let y=a[g];!y||y.disabled||(t.value=y.value,d=g,h(),m(!0),t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0})))},R=(g,y)=>{a=[...g],t.replaceChildren(),s.replaceChildren(),l=a.map((T,O)=>{let W=document.createElement("option");W.value=T.value,W.textContent=T.label,W.disabled=T.disabled===!0,t.appendChild(W);let L=f("button",se("mach-select-option",n.classNames?.option));return L.id=`${s.id}-option-${O}`,L.type="button",L.tabIndex=-1,L.dataset.value=T.value,L.disabled=T.disabled===!0,L.setAttribute("role","option"),L.textContent=T.label,L.addEventListener("mousedown",ar=>ar.preventDefault()),L.addEventListener("click",()=>C(O)),s.appendChild(L),L});let D=a.find(T=>!T.disabled)?.value??"";t.value=y!=null&&a.some(T=>T.value===y)?y:D,d=yt(a,t.value),h()},M=g=>{if(g.key==="Tab"){m();return}if(g.key==="Escape"){if(!m(!0))return;g.preventDefault(),g.stopPropagation();return}if(g.key==="Enter"||g.key===" "){g.preventDefault(),g.stopPropagation(),s.classList.contains("mach-select-listbox--open")?C(d):w();return}let y=d;if(g.key==="ArrowDown")y=Bi(a,d,1);else if(g.key==="ArrowUp")y=Bi(a,d,-1);else if(g.key==="Home")y=vt(a)[0]??-1;else if(g.key==="End"){let D=vt(a);y=D[D.length-1]??-1}else return;g.preventDefault(),g.stopPropagation(),s.classList.contains("mach-select-listbox--open")||w(),b(y)},v=()=>{d=yt(a,t.value),h(),n.onChange?.(t.value)};return r.addEventListener("click",()=>{m()||w()}),r.addEventListener("keydown",M),t.addEventListener("change",v),R(a,n.value),{el:e,native:t,trigger:r,listbox:s,contains:g=>e.contains(g)||s.contains(g),isOpen:()=>s.classList.contains("mach-select-listbox--open"),open:w,close:m,focus:()=>r.focus({preventScroll:!0}),getValue:()=>t.value,setValue:g=>{t.value=g,d=yt(a,g),h()},setOptions:R,destroy:()=>{c||(c=!0,m(),r.removeEventListener("keydown",M),t.removeEventListener("change",v),e.remove())}}}function Wi(n,e){let t=document.createElement("input");return t.type=n,t.className="mach-editor-input",e!=null&&e!==""&&(t.value=n==="date"?String(e).slice(0,10):String(e)),t}function Ts(n){return n?.options?.length?n.options:(n?.values??[]).map(e=>({label:String(e),value:e}))}function Ds(n,e){return e?.options?.length||e?.values?.length?"select":typeof n=="number"?"number":n instanceof Date||typeof n=="string"&&/^\d{4}-\d{2}-\d{2}/.test(n)?"date":"text"}function Er(n,e,t){let r=n.colDef,i=typeof r.cellEditor=="string"?r.cellEditor:Ds(e,r.cellEditorParams);if(i==="date"){let a=Wi("date",e),d=(e==null?"":String(e)).match(/T(\d{2}:\d{2})/);return{el:a,getValue:()=>a.value===""?null:d?`${a.value}T${d[1]}`:a.value,focus:()=>a.focus({preventScroll:!0})}}if(i==="select"){let a=Ts(r.cellEditorParams),l=Z({ariaLabel:r.headerName??r.field??n.id,options:a.map(d=>({value:String(d.value),label:d.label,disabled:d.disabled})),value:String(e??""),classNames:{root:"mach-editor-select-control",native:"mach-editor-select"}});return{el:l.el,getValue:()=>{let d=l.getValue();return a.find(u=>String(u.value)===d)?.value??d},focus:()=>l.focus(),destroy:()=>l.destroy()}}let o=i==="number",s=Wi(o?"number":"text",e);return!o&&t&&t.length===1&&(s.value=t),{el:s,getValue:()=>o?s.value===""?null:Number(s.value):s.value,focus:()=>{s.focus({preventScroll:!0}),s.select()}}}function ae(n){return n!=null&&typeof n.then=="function"}var wt=class{constructor(e){this.e=e;this.$o=0}Gu(){this.$o++}Uo(){let e=++this.$o;return()=>e===this.$o&&!this.e.s()}Xi(e){let t=e[0].node,r=this.e.n.te(),i=r.map(a=>this.e.d(t,a)),o=this.Qr(e),s=e.every(a=>Object.is(this.e.d(t,a.column),a.oldValue));return()=>s&&o()&&r.every((a,l)=>Object.is(this.e.d(t,a),i[l]))}Qr(e){let t=e[0].node,r=t.data,i=this.e.n.te(),o=new Set(i),s=e.every(a=>a.node===t&&o.has(a.column));return()=>s&&!this.e.s()&&this.e.i.$(t.id)===t&&t.data===r&&this.e.n.te()===i}Ji(e,t){let r=e.map(o=>this.Nu(o,t)),i=o=>{let s=o.filter(a=>a!=null);return s.length||!t()?s:this.Ou(e,t)};return r.some(ae)?Promise.all(r.map(o=>Promise.resolve(o))).then(i):i(r)}Nu(e,t){let{node:r,column:i,oldValue:o,newValue:s}=e,a=d=>(t()&&this.e.reportError(d,"validate",{colId:i.id,rowId:r.id}),{colId:i.id,message:"Validation failed"}),l=d=>typeof d=="string"?{colId:i.id,message:d}:null;try{let d=i.colDef.validate?.(s,{oldValue:o,newValue:s,node:r,data:r.data,column:i,colDef:i.colDef,api:this.e.api});return ae(d)?d.then(l,a):l(d)}catch(d){return a(d)}}Ou(e,t){let r=this.e.r.rowEditValidator;if(!r)return[];let i=e[0].node,o=Object.create(null);for(let l of this.e.n.te())o[l.id]=this.e.d(i,l);for(let l of e)o[l.column.id]=l.newValue;let s=l=>typeof l=="string"?[{colId:e[0].column.id,message:l}]:l&&typeof l=="object"?Object.entries(l).filter(([,d])=>typeof d=="string"&&d).map(([d,c])=>({colId:d,message:c})):[],a=l=>(t()&&this.e.reportError(l,"validate",{rowId:i.id}),[{colId:e[0].column.id,message:"Row validation failed"}]);try{let l=r({data:i.data,node:i,values:o,api:this.e.api,changes:e.map(({column:d,oldValue:c,newValue:u})=>({colId:d.id,oldValue:c,newValue:u}))});return ae(l)?l.then(s,a):s(l)}catch(l){return a(l)}}jo(e,t){let r=[],i=this.Qr(e);for(let o of e){if(!t()||!i()||!Object.is(this.e.d(o.node,o.column),o.oldValue)||!this.e.l.q(o.node,o.column)||!this.e.Zi(o.node,o.column,o.newValue,o.oldValue)){for(let s of r.reverse()){if(!t()||!i())break;this.e.Zi(s.node,s.column,s.oldValue,s.newValue)||this.e.reportError(new Error("A valueSetter rejected input rollback"),"inputRollback",{rowId:s.node.id})}return{colId:o.column.id,message:"Value was rejected by the column setter"}}r.push(o)}return t()&&i()?null:{colId:e[0].column.id,message:"Input target changed during commit"}}Fu(e){let t=this.Uo();if(this.e.s()||this.e.l.isEditing())return;let r=new Map;for(let a of e){if(a.newValue===void 0||Object.is(a.oldValue,a.newValue)||!this.e.l.q(a.node,a.column))continue;let l=r.get(a.node)??[];l.push(a),r.set(a.node,l)}let i=[...r.values()].map(a=>{let l=this.Xi(a),d=()=>t()&&l();return{changes:a,current:d,validation:this.Ji(a,d)}}),o=a=>{this.hl(i,a,t)},s=i.map(a=>a.validation);s.some(ae)?Promise.all(s.map(a=>Promise.resolve(a))).then(o):o(s)}hl(e,t,r){let i=e.map(()=>({applied:!1,errors:[]}));if(!r())return i;let o=new Set;this.e._.pl();try{e.forEach(({changes:s,current:a},l)=>{let d=i[l];if(!a()||!s.length)return;d.errors=[...t[l]];let c=d.errors.length?null:this.jo(s,r);if(!r())return;if(c&&d.errors.push(c),d.errors.length){this.e.reportError(new Error(d.errors.map(h=>h.message).join("; ")),"validate",{rowId:s[0].node.id,errors:d.errors});return}let u=this.Qr(s);d.applied=!0;for(let h of s){if(!r()||!u()){d.applied=!1;break}this.e.qo(h.node,h.column,h.oldValue,h.newValue),h.node.rowIndex>=0&&o.add(h.node.rowIndex)}})}finally{this.e._.fl()}return o.size&&r()&&(this.e.a.ft([...o]),this.e.ce.refresh(),this.e.Ye.refresh()),i}};function le(n,e,t,r,i,o){let s=t.colDef.valueParser;if(!s)return r;let a=s({api:n.api,colDef:t.colDef,column:t,data:e.data,node:e,value:r,oldValue:o,source:i});if(a!=null&&typeof a.then=="function")throw new TypeError("valueParser must return a synchronous value");return a}function ke(n,e,t,r){let i=n.d(e,t),o=t.colDef.valueSerializer;if(o)try{let s=o({api:n.api,colDef:t.colDef,column:t,data:e.data,node:e,value:i,target:r});if(s!=null&&typeof s.then=="function")throw new TypeError("valueSerializer must return a synchronous value");return s}catch(s){throw n.reportError(s,"valueSerializer",{colId:t.id,rowId:e.id}),s}return r==="xlsx"||r==="csv"&&typeof i=="number"?i:q(n,e,t,i)}var Es='<path d="M3 8.5 6.4 12 13.5 4"/>',xs='<path d="m4 4 8 8m0-8-8 8"/>';function $i(n,e){let t=document.createElement("button");return t.type="button",t.className=`mach-edit-control mach-edit-control--${n}`,t.setAttribute("aria-label",e),t.title=e,t.innerHTML=`<svg viewBox="0 0 16 16" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round">${n==="confirm"?Es:xs}</svg>`,t.addEventListener("mousedown",r=>{r.preventDefault(),r.stopPropagation()}),t}var Ct=class{constructor(e){this.e=e;this.b=null;this.E=null;this.ue=null;this.yt=0;this.Hu=e=>{if(this.b&&!(e.isComposing||e.keyCode===229)){if(e.key==="Enter")e.preventDefault(),e.stopPropagation(),this.he(!1);else if(e.key==="Escape")e.preventDefault(),e.stopPropagation(),this.he(!0);else if(e.key==="Tab"){e.preventDefault(),e.stopPropagation();let t=this.b,r=this.e.ns.dl(t.rowIndex,t.column.id,e.shiftKey?-1:1);this.he(!1).then(i=>{i&&r&&(this.e.a.dr(r.rowIndex,"nearest"),this.e.a.Ge(r.rowIndex,r.column.id),this.start(r.rowIndex,r.column))})}}}}isEditing(e,t){return this.b?e==null&&t==null?!0:this.b.rowIndex===e&&this.b.column.id===t:this.E?e==null&&t==null?!0:this.ei(this.E)!==e?!1:t==null||this.E.drafts.has(t):!1}Qi(){return this.b!=null}Mc(){return this.b?.node.rowIndex??(this.E?this.ei(this.E):null)}en(e){return this.E?e==null||this.ei(this.E)===e:!1}q(e,t){if(e.isDetail||e.isGroup||e.data==null)return!1;let r=t.colDef.editable;if(!r)return!1;if(typeof r=="function")try{return r({api:this.e.api,colDef:t.colDef,column:t,node:e,data:e.data,value:this.e.d(e,t),rowIndex:e.rowIndex})}catch(i){return this.e.reportError(i,"editable",{colId:t.id,rowId:e.id}),!1}return!0}start(e,t,r){if(this.e.r.editType==="fullRow")return this.startRow(e,t.id);if(this.E)return!1;if(this.b)return this.b.rowIndex===e&&this.b.column.id===t.id||this.he(!1).then(p=>{p&&!this.b&&!this.E&&this.start(e,t,r)}),!0;let i=this.e.i.m(e);if(!i||i.data==null||!this.q(i,t))return!1;let o=this.e.a.tn(e,t.id);if(!o)return!1;this.e.Me();let s=this.e.d(i,t),a=this.ml(i,t,e,s,r);if(!a)return!1;k(this.e,o);let l=f("div","mach-cell-editor-shell"),d=f("div","mach-cell-editor-controls"),c=$i("confirm","Confirm edit"),u=$i("cancel","Cancel edit");d.append(c,u),l.append(a.el,d),o.replaceChildren(l),o.classList.add("mach-cell--editing"),o.removeAttribute("title");let h=this.Hu;return a.el.addEventListener("keydown",h),c.addEventListener("click",p=>{p.stopPropagation(),this.he(!1)}),u.addEventListener("click",p=>{p.stopPropagation(),this.he(!0)}),this.b={node:i,column:t,editor:a,rowIndex:e,oldValue:s,cell:o,shell:l,keydown:h,confirmButton:c,cancelButton:u},this.Yo(a,t,i),this.e.emit("cellEditingStarted",{rowIndex:e,colId:t.id,rowNode:i}),!0}startRow(e,t){if(this.b||this.E)return!1;let r=this.e.i.m(e);if(!r||r.data==null||r.isDetail||r.isGroup)return!1;this.e.Me();let i=new Map;for(let l of this.e.n.c()){if(!this.q(r,l))continue;let d=this.e.d(r,l);i.set(l.id,{column:l,oldValue:d,value:d,mounted:null})}if(i.size===0)return!1;let o={node:r,rowIndex:e,drafts:i,validating:!1};if(this.E=o,this.e.a.ft([e]),i.size===0)return this.E=null,this.e.a.ft([e]),!1;let s=i.values().next().value,a=(t?i.get(t):void 0)??s;return a?.mounted&&this.Yo(a.mounted.editor,a.column,r),this.e.emit("rowEditingStarted",{rowIndex:e,rowNode:r,data:r.data}),!0}gl(e,t,r,i){if(this.b)return this.b.node===t&&this.b.column.id===r.id;let o=this.E;if(!o||o.node!==t)return!1;let s=o.drafts.get(r.id);return s?s.mounted?.cell!==i&&(s.mounted&&this.yl(s),!this.Vu(e,o,s,i))?(o.drafts.delete(r.id),!1):!0:!1}Xo(e,t,r){let i=this.E;if(i&&this.ei(i)===e){let o=i.drafts.get(t);o?.mounted?.cell===r&&this.yl(o);return}if(this.b?.cell===r){let o=this.b;this.he(!1),this.b===o&&this.he(!0)}}stop(e=!1){this.he(e)}he(e=!1){if(this.E)return this.Jo(e);let t=this.b;if(!t)return Promise.resolve(!1);if(e)return this.yt++,this.ue=null,Promise.resolve(this.fr(t,!0,t.oldValue));if(this.ue)return this.ue;let r;try{r=t.editor.getValue()}catch(u){return this.e.reportError(u,"cellEditor.getValue",{colId:t.column.id,rowId:t.node.id}),Promise.resolve(this.fr(t,!0,t.oldValue))}try{Object.is(r,t.oldValue)||(r=le(this.e,t.node,t.column,r,"editor",t.oldValue))}catch(u){return this.e.reportError(u,"valueParser",{colId:t.column.id,rowId:t.node.id}),this.ti(t.editor,u instanceof Error?u.message:String(u)),Promise.resolve(!1)}try{if(t.editor.isCancelAfterEnd?.(r))return Promise.resolve(this.fr(t,!0,t.oldValue))}catch(u){return this.e.reportError(u,"cellEditor.isCancelAfterEnd",{colId:t.column.id,rowId:t.node.id}),Promise.resolve(this.fr(t,!0,t.oldValue))}let i=[{node:t.node,column:t.column,oldValue:t.oldValue,newValue:r}],o=this.e.U.Xi(i),s=++this.yt,a=()=>s===this.yt&&this.b===t&&o(),l=u=>a()?u.length?(this.Zo(t,!1),this.ti(t.editor,u[0].message),!1):this.fr(t,!1,r):(s===this.yt&&this.b===t&&this.fr(t,!0,t.oldValue),!1),d=this.e.U.Ji(i,a);if(!ae(d))return Promise.resolve(l(d));this.Zo(t,!0);let c=d.then(l).finally(()=>{this.ue===c&&(this.ue=null)});return this.ue=c,c}Jo(e=!1){let t=this.E;if(!t)return Promise.resolve(!1);if(e)return this.yt++,this.ue=null,Promise.resolve(this.rn(t,!0));if(this.ue)return this.ue;for(let h of t.drafts.values())this.Qo(h);let r=[];for(let h of t.drafts.values())if(!Object.is(h.oldValue,h.value))try{let p=le(this.e,t.node,h.column,h.value,"editor",h.oldValue);p!==void 0&&!Object.is(h.oldValue,p)&&r.push({node:t.node,column:h.column,oldValue:h.oldValue,newValue:p})}catch(p){return this.e.reportError(p,"valueParser",{colId:h.column.id,rowId:t.node.id}),this.es(t,[{draft:h,message:p instanceof Error?p.message:String(p)}]),Promise.resolve(!1)}if(r.length===0)return Promise.resolve(this.rn(t,!1,r));let i=r.map(h=>t.drafts.get(h.column.id)),o=i.map(h=>h.value),s=this.e.U.Xi(r),a=++this.yt,l=()=>a===this.yt&&this.E===t&&s();for(let h of i)h.error=void 0;let d=h=>l()?h.length?(this.es(t,h.map(({colId:p,message:m})=>({draft:t.drafts.get(p)??i[0],message:m}))),!1):i.some((p,m)=>!Object.is(p.value,o[m]))?(t.validating=!1,this.ts(t,!1),!1):this.rn(t,!1,r):(a===this.yt&&this.E===t&&this.rn(t,!0),!1),c=this.e.U.Ji(r,l);if(!ae(c))return Promise.resolve(d(c));t.validating=!0,this.ts(t,!0);let u=c.then(d).finally(()=>{this.ue===u&&(this.ue=null)});return this.ue=u,u}fr(e,t,r){if(this.b!==e)return!1;let i={node:e.node,column:e.column,oldValue:e.oldValue,newValue:r},o=!t&&r!==void 0&&!Object.is(e.oldValue,r);if(o){let s=this.e.U.jo([i],()=>!this.e.s());if(s)return this.Zo(e,!1),this.ti(e.editor,s.message),!1}return this.b=null,o&&this.e.qo(e.node,e.column,e.oldValue,r),this.rs(e,!0),this.e.s()||(this.e.emit("cellEditingStopped",{rowIndex:e.rowIndex,colId:e.column.id,rowNode:e.node,oldValue:e.oldValue,newValue:o?r:e.oldValue}),e.node.rowIndex>=0&&this.e.a.ft([e.node.rowIndex]),this.e.ce.refresh(),this.e.Ye.refresh()),!0}rn(e,t,r=[]){if(this.E!==e)return!1;let i=t?[]:this.Bu(e,r);if(i==null)return!1;for(let s of e.drafts.values())s.mounted&&this.rs(s.mounted,!0),s.mounted=null;if(this.E=null,this.e.s())return!0;let o=this.ei(e);return this.e.emit("rowEditingStopped",{rowIndex:o,rowNode:e.node,data:e.node.data,cancelled:t,changes:i}),o>=0&&this.e.a.ft([o]),this.e.ce.refresh(),this.e.Ye.refresh(),!0}Bu(e,t){if(t.length===0)return[];let r=this.e.U.jo(t,()=>!this.e.s());if(r)return this.es(e,[{draft:e.drafts.get(r.colId)??e.drafts.get(t[0].column.id),message:r.message}]),null;let i=this.e.U.Qr(t);this.e._.pl();try{for(let o of t){if(!i())break;this.e.qo(e.node,o.column,o.oldValue,o.newValue)}}finally{this.e._.fl()}return t.map(({column:o,oldValue:s,newValue:a})=>({colId:o.id,oldValue:s,newValue:a}))}Vu(e,t,r,i){let o=this.ml(t.node,r.column,e,r.value,null);if(!o)return!1;k(this.e,i);let s=f("div","mach-row-editor-shell");s.appendChild(o.el),i.replaceChildren(s),i.classList.add("mach-cell--editing","mach-cell--row-editing"),i.removeAttribute("title");let a=d=>this.zu(d,t,r),l=()=>{try{r.value=o.getValue(),r.error=void 0}catch{}};return o.el.addEventListener("keydown",a),o.el.addEventListener("input",l),r.mounted={editor:o,cell:i,shell:s,keydown:a,input:l},r.error&&this.ti(o,r.error),t.validating&&(o.el.classList.add("mach-editor-validating"),o.el.setAttribute("aria-busy","true"),o.el.inert=!0),!0}yl(e){e.mounted&&(this.Qo(e),this.rs(e.mounted,!0),e.mounted=null)}Qo(e){if(e.mounted)try{let t=e.mounted.editor.getValue();t!==void 0&&(e.value=t)}catch(t){this.e.reportError(t,"cellEditor.getValue",{colId:e.column.id,rowId:this.E?.node.id})}}ml(e,t,r,i,o){let s=t.colDef,a;try{let l={api:this.e.api,colDef:s,column:t,node:e,data:e.data,value:i,rowIndex:r,keyPress:o};typeof s.cellEditor=="function"?a=s.cellEditor(l):typeof s.cellEditor=="string"&&!["text","number","date","select"].includes(s.cellEditor)?a=this.e._u(s.cellEditor)?.(l)??Er(t,i,o):a=Er(t,i,o)}catch(l){return this.e.reportError(l,"cellEditor",{colId:t.id,rowId:e.id}),null}if(!a||!(a.el instanceof HTMLElement))return this.e.reportError(new Error("cellEditor must return an editor with an HTMLElement el"),"cellEditor",{colId:t.id,rowId:e.id}),null;try{if(a.isCancelBeforeStart?.())return a.destroy?.(),null}catch(l){this.e.reportError(l,"cellEditor.isCancelBeforeStart",{colId:t.id,rowId:e.id});try{a.destroy?.()}catch{}return null}return a}es(e,t){e.validating=!1,this.ts(e,!1);for(let{draft:r,message:i}of t)r.error=i,r.mounted&&this.ti(r.mounted.editor,i);t[0].draft.mounted?.editor.focus?.()}ti(e,t){let r=e.el;r.classList.add("mach-editor-invalid"),r.setAttribute("title",t),r.setAttribute("aria-invalid","true"),r.classList.remove("mach-editor-validating"),r.removeAttribute("aria-busy"),r.inert=!1,(r.querySelector(".mach-select-trigger, input:not([type='hidden']), select:not([hidden]), textarea")??r).focus?.();let o=()=>{r.classList.remove("mach-editor-invalid"),r.removeAttribute("title"),r.removeAttribute("aria-invalid")};r.addEventListener("input",o,{once:!0})}Zo(e,t){e.editor.el.classList.toggle("mach-editor-validating",t),t?e.editor.el.setAttribute("aria-busy","true"):e.editor.el.removeAttribute("aria-busy"),e.editor.el.inert=t,e.confirmButton.disabled=t,e.cancelButton.disabled=!1,e.shell.classList.toggle("mach-editor-shell--busy",t)}ts(e,t){for(let r of e.drafts.values()){let i=r.mounted?.editor.el;i&&(i.classList.toggle("mach-editor-validating",t),t?i.setAttribute("aria-busy","true"):i.removeAttribute("aria-busy"),i.inert=t)}}Yo(e,t,r){try{e.focus?.()}catch(i){this.e.reportError(i,"cellEditor.focus",{colId:t.id,rowId:r.id})}}rs(e,t){e.editor.el.removeEventListener("keydown",e.keydown),e.input&&e.editor.el.removeEventListener("input",e.input),e.editor.el.classList.remove("mach-editor-validating"),e.editor.el.removeAttribute("aria-busy"),e.editor.el.inert=!1;try{e.editor.destroy?.()}catch(r){this.e.reportError(r,"cellEditor.destroy",{colId:e.cell.dataset.colId})}t&&e.cell.classList.remove("mach-cell--editing","mach-cell--row-editing","mach-cell--error")}ei(e){return e.node.rowIndex>=0?e.node.rowIndex:e.rowIndex}zu(e,t,r){if(this.E!==t)return;if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.Jo(!0);return}if(e.key==="Enter"&&!e.shiftKey){e.preventDefault(),e.stopPropagation(),this.Jo(!1);return}if(e.key!=="Tab")return;e.preventDefault(),e.stopPropagation(),this.Qo(r);let i=[...t.drafts.values()],o=i.indexOf(r),s=e.shiftKey?-1:1;for(let a=1;a<=i.length;a++){let l=i[(o+s*a+i.length)%i.length];if(l.mounted){this.Yo(l.mounted.editor,l.column,t.node);break}}}destroy(){(this.b||this.E)&&this.he(!0)}};var x={matchContains:"\u5305\u542B",matchNotContains:"\u4E0D\u5305\u542B",matchEquals:"\u7B49\u4E8E",matchNotEquals:"\u4E0D\u7B49\u4E8E",matchStartsWith:"\u5F00\u5934\u662F",matchEndsWith:"\u7ED3\u5C3E\u662F",matchBlank:"\u4E3A\u7A7A",matchNotBlank:"\u4E0D\u4E3A\u7A7A",matchLessThan:"\u5C0F\u4E8E",matchLessThanOrEqual:"\u5C0F\u4E8E\u7B49\u4E8E",matchGreaterThan:"\u5927\u4E8E",matchGreaterThanOrEqual:"\u5927\u4E8E\u7B49\u4E8E",matchInRange:"\u5728\u8303\u56F4\u5185",apply:"\u5E94\u7528",reset:"\u91CD\u7F6E",search:"\u641C\u7D22...",emptySetLabel:"(\u7A7A)",selectedCount:"\u5DF2\u9009 {n} \u9879",sortAsc:"\u5347\u5E8F",sortDesc:"\u964D\u5E8F",clearSort:"\u53D6\u6D88\u6392\u5E8F",pinLeft:"\u56FA\u5B9A\u5DE6\u4FA7",pinRight:"\u56FA\u5B9A\u53F3\u4FA7",clearPin:"\u53D6\u6D88\u56FA\u5B9A",autoSize:"\u81EA\u9002\u5E94\u5217\u5BBD",hideColumn:"\u9690\u85CF\u6B64\u5217",columnVisibility:"\u5217\u663E\u793A",resetAll:"\u91CD\u7F6E\u5168\u90E8",autoSizeAll:"\u5168\u90E8\u81EA\u9002\u5E94",columnSettings:"\u5217\u8BBE\u7F6E",totalLabel:"\u5408\u8BA1",totalRowsLabel:"\u5171 {n} \u884C",menuCopy:"\u590D\u5236",menuPaste:"\u7C98\u8D34",menuClearContents:"\u6E05\u9664\u5185\u5BB9",loading:"\u52A0\u8F7D\u4E2D...",statusSelected:"\u5DF2\u9009 {n} \u884C",statusSum:"\u548C {n}",statusAvg:"\u5747 {n}",statusCount:"\u8BA1 {n}",emptyRows:"\u6CA1\u6709\u53EF\u663E\u793A\u7684\u884C",emptyRowsHint:"\u6682\u65E0\u6570\u636E\uFF0C\u53EF\u8C03\u6574\u67E5\u8BE2\u6761\u4EF6\u540E\u91CD\u8BD5",paginationTotal:"\u5171 {n} \u6761",paginationPage:"\u7B2C {a} / {b} \u9875",perPage:"{n} \u6761/\u9875",pageFirst:"\u9996\u9875",pagePrev:"\u4E0A\u4E00\u9875",pageNext:"\u4E0B\u4E00\u9875",pageLast:"\u672B\u9875",requestFailed:"\u6570\u636E\u52A0\u8F7D\u5931\u8D25",requestFailedHint:"\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5",actionView:"\u67E5\u770B",actionEdit:"\u7F16\u8F91",actionDelete:"\u5220\u9664",actionConfirm:"\u786E\u8BA4",actionSave:"\u4FDD\u5B58",actionCancel:"\u53D6\u6D88",actionMore:"\u66F4\u591A\u64CD\u4F5C",rowDragHandle:"\u62D6\u52A8\u8C03\u6574\u987A\u5E8F\uFF1BAlt + \u4E0A\u4E0B\u65B9\u5411\u952E\u79FB\u52A8",rowDragUnavailable:"\u5F53\u524D\u6392\u5E8F\u6216\u6570\u636E\u6A21\u5F0F\u4E0D\u652F\u6301\u81EA\u52A8\u8C03\u6574\u987A\u5E8F",rowDragPosition:"\u7B2C {a} \u884C \u2192 \u7B2C {b} \u884C",rowDragOutside:"\u79FB\u56DE\u8868\u683C\u5185\u653E\u7F6E \xB7 Esc \u53D6\u6D88"},Ui={matchContains:"Contains",matchNotContains:"Not Contains",matchEquals:"Equals",matchNotEquals:"Not Equals",matchStartsWith:"Starts With",matchEndsWith:"Ends With",matchBlank:"Blank",matchNotBlank:"Not Blank",matchLessThan:"Less Than",matchLessThanOrEqual:"\u2264",matchGreaterThan:"Greater Than",matchGreaterThanOrEqual:"\u2265",matchInRange:"In Range",apply:"Apply",reset:"Reset",search:"Search...",emptySetLabel:"(blank)",selectedCount:"{n} selected",sortAsc:"Ascending",sortDesc:"Descending",clearSort:"Clear Sort",pinLeft:"Pin Left",pinRight:"Pin Right",clearPin:"Unpin",autoSize:"Auto Fit",hideColumn:"Hide Column",columnVisibility:"Columns",resetAll:"Reset All",autoSizeAll:"Fit All",columnSettings:"Column Settings",totalLabel:"Total",totalRowsLabel:"{n} rows",menuCopy:"Copy",menuPaste:"Paste",menuClearContents:"Clear Contents",loading:"Loading...",statusSelected:"{n} selected",statusSum:"Sum {n}",statusAvg:"Avg {n}",statusCount:"Cnt {n}",emptyRows:"No rows to display",emptyRowsHint:"Try adjusting your search or filters.",paginationTotal:"{n} items",paginationPage:"Page {a} / {b}",perPage:"{n} / page",pageFirst:"First",pagePrev:"Previous",pageNext:"Next",pageLast:"Last",requestFailed:"Unable to load data",requestFailedHint:"Check your connection and try again",actionView:"View",actionEdit:"Edit",actionDelete:"Delete",actionConfirm:"Confirm",actionSave:"Save",actionCancel:"Cancel",actionMore:"More actions",rowDragHandle:"Drag to reorder; Alt + Up/Down to move",rowDragUnavailable:"Reordering is unavailable in the current sort or data mode",rowDragPosition:"Row {a} \u2192 Row {b}",rowDragOutside:"Move inside to drop \xB7 Esc to cancel",rowDragSelection:"{a} selected rows \u2192 Row {b}",rowDragBefore:"Before",rowDragAfter:"After",rowDragInside:"Inside",rowDragRejected:"This destination is unavailable"},Rs={contains:"matchContains",notContains:"matchNotContains",equals:"matchEquals",notEquals:"matchNotEquals",startsWith:"matchStartsWith",endsWith:"matchEndsWith",blank:"matchBlank",notBlank:"matchNotBlank",lessThan:"matchLessThan",lessThanOrEqual:"matchLessThanOrEqual",greaterThan:"matchGreaterThan",greaterThanOrEqual:"matchGreaterThanOrEqual",inRange:"matchInRange"};function Tt(n){return Rs[n]??"matchEquals"}function K(n,e){return n.replace("{n}",String(e))}function me(n,e,t){return n.replace("{a}",String(e)).replace("{b}",String(t))}function xr(n){return n==="blank"||n==="notBlank"}function Dt(n){return n===null?"null:":`${typeof n}:${String(n)}`}var Et=class{constructor(e){this.e=e;this.v=null;this.vt=null;this.mr=null;this.bt=e=>{if(!this.v)return;let t=e.target;if(!this.v.contains(t)&&!this.mr?.contains(t)){this.close();return}this.mr?.contains(t)||(!(t instanceof Element)||!t.closest(".mach-filter-select-control"))&&this.vl()};this.wt=e=>{if(e.key==="Escape"){if(this.vl(!0)){e.preventDefault(),e.stopPropagation();return}this.close()}}}toggle(e,t){if(this.vt===e.id){this.close();return}this.close(),this.open(e,t)}open(e,t){let r=this.e.i.Q()[e.id]??null,i=r?.type??e.filterType,o=f("div","mach-filter-panel");o.setAttribute("role","dialog"),o.setAttribute("aria-label",`${e.id} filter`),i==="set"?this.Ku(o,e,r):this.Wu(o,e,i,r);let s=f("div","mach-filter-footer"),a=f("button","mach-filter-btn-reset");a.type="button",a.textContent=this.e.y("reset"),a.addEventListener("click",()=>{this.e.os(e,null),this.close()});let l=f("button","mach-filter-btn-apply");l.type="button",l.textContent=this.e.y("apply"),l.addEventListener("click",()=>{let c=this.bl(o);this.e.os(e,c),this.close()}),s.append(a,l),o.appendChild(s),G(o,this.e.o.root),document.body.appendChild(o),this.v=o,this.vt=e.id,Y(o,t),document.addEventListener("mousedown",this.bt,!0),document.addEventListener("keydown",this.wt,!0),o.querySelector(".mach-filter-select-trigger, input")?.focus()}close(){this.v&&(this.mr?.destroy(),this.mr=null,this.v.remove(),this.v=null,this.vt=null,document.removeEventListener("mousedown",this.bt,!0),document.removeEventListener("keydown",this.wt,!0))}destroy(){this.close()}Wu(e,t,r,i){let o=i&&i.type!=="set"&&i.conditions.length>0?i.conditions[0]:null,s=o?.match??(r==="text"?"contains":"equals"),{root:a,select:l}=this.$u(r,s),d=this.wl(r),c=this.wl(r,!0);this.Uu(r,s,o,d,c),this.Cl(s,d,c),l.addEventListener("change",()=>{this.Cl(l.value,d,c)}),this.ju(t,e,d,c);let u=f("div","mach-filter-body");u.append(a,d,c),e.appendChild(u),e.dataset.filterType=r}$u(e,t){let r=Z({ariaLabel:"Filter condition",options:he[e].map(i=>({value:i,label:this.e.y(Tt(i))})),value:t,classNames:{root:"mach-filter-select-control",native:"mach-filter-select",trigger:"mach-filter-select-trigger",value:"mach-filter-select-value",caret:"mach-filter-select-caret",listbox:"mach-filter-listbox",option:"mach-filter-listbox-option"},themeSource:this.e.o.root});return this.mr=r,{root:r.el,select:r.native}}vl(e=!1){return this.mr?.close(e)??!1}wl(e,t=!1){let i=f("input",`mach-filter-input${t?" mach-filter-input--second":""}`);return e==="number"&&(i.type="number"),e==="date"&&(i.type="date"),i}Uu(e,t,r,i,o){r?.value!=null&&!xr(t)&&(i.value=e==="date"?String(r.value).slice(0,10):String(r.value)),r&&"value2"in r&&r.value2!=null&&(o.value=e==="date"?String(r.value2).slice(0,10):String(r.value2))}Cl(e,t,r){t.style.display=xr(e)?"none":"",r.style.display=e==="inRange"?"":"none"}ju(e,t,r,i){let o=s=>{s.key==="Enter"&&(this.e.os(e,this.bl(t)),this.close())};r.addEventListener("keydown",o),i.addEventListener("keydown",o)}Ku(e,t,r){let o=t.colDef.filterParams,s;if(o?.values)s=o.values;else{let b=new Set;s=[];let w=this.e.i.be(),C=Math.min(w.length,o?.maxValues??500);for(let R=0;R<C;R++){let M=this.e.d(w[R],t),v=Dt(M??null);b.has(v)||(b.add(v),s.push(M))}}let a=new Set(r?.type==="set"?r.values.map(Dt):s.map(Dt)),l=f("input","mach-filter-input mach-filter-input--search");l.type="text",l.placeholder=this.e.y("search");let d=f("div","mach-filter-set-list"),c=[],u=new Map,h=b=>{d.textContent="",c.length=0;let w=b.trim().toLowerCase();for(let C of s){let R=C==null?this.e.y("emptySetLabel"):String(C);if(w&&!R.toLowerCase().includes(w))continue;let M=Dt(C);u.set(M,C);let v=f("label","mach-filter-set-item"),g=document.createElement("input");g.type="checkbox",g.checked=a.has(M),g.addEventListener("change",()=>{g.checked?a.add(M):a.delete(M),e.dataset.setSelected=JSON.stringify([...a])});let y=f("span");y.textContent=R,v.append(g,y),d.appendChild(v),c.push(g)}};l.addEventListener("input",()=>h(l.value)),h(""),e.dataset.filterType="set",e.dataset.setValues=JSON.stringify([...u.entries()]),e.dataset.setSelected=JSON.stringify([...a]),(()=>{let b=[...u.entries()];e.dataset.setValues=JSON.stringify(b)})();let m=f("div","mach-filter-body mach-filter-body--set");m.append(l,d),e.appendChild(m)}bl(e){let t=e.dataset.filterType;if(t==="set")return this.qu(e);if(t!=="text"&&t!=="number"&&t!=="date")return null;let r=e.querySelector(".mach-filter-select"),i=e.querySelectorAll(".mach-filter-input"),o=i[0],s=i[1];if(!r||!o)return null;let a=r.value;if(xr(a))return{type:t,conditions:[{match:a}]};let l=o.value;return l===""&&a!=="inRange"?null:t==="number"?this.Yu(a,l,s):t==="date"?this.Xu(a,l,s):{type:"text",conditions:[{match:a,value:l}]}}qu(e){let t=[],r=[];try{t=JSON.parse(e.dataset.setValues??"[]"),r=JSON.parse(e.dataset.setSelected??"[]")}catch{return null}let i=new Set(r),o=t.filter(([s])=>i.has(s)).map(([,s])=>s);return o.length===t.length||o.length===0?null:{type:"set",values:o}}Yu(e,t,r){let i=Number(t);if(Number.isNaN(i))return null;if(e!=="inRange")return{type:"number",conditions:[{match:e,value:i}]};let o=r?.value?Number(r.value):i;return Number.isNaN(o)?null:{type:"number",conditions:[{match:"inRange",value:i,value2:o}]}}Xu(e,t,r){return e!=="inRange"?{type:"date",conditions:[{match:e,value:t}]}:{type:"date",conditions:[{match:"inRange",value:t,value2:r?.value||t}]}}};var xt=class{constructor(e){this.e=e;this.v=null;this.vt=null;this.nn=null;this.sn="";this.ri=new Set;this.bt=e=>{let t=e.target;this.v&&!this.v.contains(t)&&!this.Zu(t)&&this.close()};this.wt=e=>{if(e.key!=="Escape")return;if([...this.ri].find(r=>r.isOpen())?.close(!0)){e.preventDefault(),e.stopImmediatePropagation();return}this.close()}}toggle(e,t){if(this.vt===e.id){this.close();return}this.close(),this.open(e,t)}Ju(e){this.close();let t=e??(()=>{let i=this.e.o.root.getBoundingClientRect(),o=document.createElement("div");return o.style.position="fixed",o.style.left=`${i.right-16}px`,o.style.top=`${i.top+this.e.r.headerHeight}px`,o.style.width="1px",o.style.height="1px",document.body.appendChild(o),this.nn=o,o})();this.open(null,t)}close(){this.Tl(),this.nn&&(this.nn.remove(),this.nn=null),this.v?.remove(),this.v=null,this.vt=null,document.removeEventListener("mousedown",this.bt,!0),document.removeEventListener("keydown",this.wt,!0)}destroy(){this.close()}open(e,t){let r=this.e.api,i=f("div","mach-filter-panel mach-column-panel");i.setAttribute("role",e?"menu":"dialog"),e||(i.setAttribute("aria-modal","false"),i.setAttribute("aria-label",this.e.y("columnSettings")));let o=f("div","mach-column-panel-title");if(o.textContent=e?e.colDef.headerName??e.colDef.field??e.id:this.e.y("columnSettings"),i.appendChild(o),e&&e.sortable){let C=f("div","mach-column-panel-actions"),R=(M,v)=>{let g=f("button","mach-column-panel-btn");return g.type="button",g.textContent=this.e.y(M),g.addEventListener("click",()=>{r.sorting.setModel(v?[{colId:e.id,direction:v}]:[]),this.close()}),g};C.append(R("sortAsc","asc"),R("sortDesc","desc"),R("clearSort",null)),i.appendChild(C)}let s=f("div","mach-column-panel-actions"),a=(C,R)=>{let M=f("button","mach-column-panel-btn");return M.type="button",M.textContent=this.e.y(C),M.addEventListener("click",()=>{e&&r.columns.setPinned(e.id,R),this.close()}),M};e&&(s.append(a("pinLeft","left"),a("pinRight","right"),a("clearPin",null)),i.appendChild(s));let l=f("div","mach-column-panel-actions"),d=f("button","mach-column-panel-btn");d.type="button",d.textContent=this.e.y("autoSize"),d.addEventListener("click",()=>{e?r.columns.autoSize(e.id):r.columns.autoSizeAll(),this.close()});let c=f("button","mach-column-panel-btn");c.type="button",c.textContent=this.e.y("hideColumn"),c.addEventListener("click",()=>{e&&r.columns.setVisible(e.id,!1),this.close()}),e&&(l.append(d,c),i.appendChild(l));let u=f("div","mach-column-panel-divider");i.appendChild(u);let h=f("div","mach-column-panel-subtitle");if(h.textContent=this.e.y("columnVisibility"),i.appendChild(h),!e){let C=document.createElement("input");C.type="search",C.className="mach-column-workbench-search",C.placeholder=this.e.y("search"),C.setAttribute("aria-label",this.e.y("search")),C.value=this.sn,C.addEventListener("input",()=>{this.sn=C.value.trim().toLocaleLowerCase(),this.ss(p,!0)}),i.appendChild(C)}let p=f("div","mach-column-panel-list");this.ss(p,!e),i.appendChild(p);let m=f("div","mach-filter-footer"),b=f("button","mach-filter-btn-reset");b.type="button",b.textContent=this.e.y("resetAll"),b.addEventListener("click",()=>{r.columns.resetState(),this.close()});let w=f("button","mach-filter-btn-apply");w.type="button",w.textContent=this.e.y("autoSizeAll"),w.addEventListener("click",()=>{r.columns.autoSizeAll(),this.close()}),m.append(b,w),i.appendChild(m),G(i,this.e.o.root),document.body.appendChild(i),this.v=i,this.vt=e?e.id:"__standalone__",Y(i,t),document.addEventListener("mousedown",this.bt,!0),document.addEventListener("keydown",this.wt,!0)}as(){if(!this.v)return;let e=this.v.querySelector(".mach-column-panel-list");e&&this.ss(e,this.vt==="__standalone__")}ss(e,t){let r=this.e.api;this.Tl(e),e.replaceChildren();let i=this.e.n.te().filter(o=>o.isDetailToggle?!1:!t||!this.sn?!0:`${o.colDef.headerName??o.colDef.field??o.id} ${o.id}`.toLocaleLowerCase().includes(this.sn));for(let o of i){let s=f("div",t?"mach-column-workbench-item":"mach-filter-set-item"),a=f("label","mach-column-workbench-label"),l=document.createElement("input");l.type="checkbox",l.checked=!o.hide,l.disabled=o.hasCheckbox,l.addEventListener("change",()=>{r.columns.setVisible(o.id,l.checked),this.as()});let d=f("span","mach-column-workbench-name");if(d.textContent=o.colDef.headerName??o.colDef.field??o.id,d.title=`${d.textContent} (${o.id})`,a.append(l,d),s.appendChild(a),t){let c=Z({ariaLabel:`${d.textContent} ${this.e.y("clearPin")}`,options:[{value:"",label:this.e.y("clearPin")},{value:"left",label:this.e.y("pinLeft")},{value:"right",label:this.e.y("pinRight")}],value:o.pinned??"",classNames:{root:"mach-column-workbench-pin-control",native:"mach-column-workbench-pin"},themeSource:this.e.o.root,onChange:m=>{r.columns.setPinned(o.id,m==="left"||m==="right"?m:null),this.as()}});c.trigger.disabled=!o.movable,c.native.disabled=!o.movable,this.ri.add(c),s.appendChild(c.el);let u=this.e.n.te().filter(m=>!m.hide&&m.parentGroup===o.parentGroup&&(o.parentGroup!=null||m.pinned===o.pinned)),h=u.indexOf(o),p=(m,b,w)=>{let C=f("button","mach-column-workbench-move");return C.type="button",C.textContent=m,C.disabled=w||o.hide||!o.movable,C.addEventListener("click",()=>{r.columns.move(o.id,b),this.as()}),C};s.append(p("\u2191",h-1,h<=0),p("\u2193",h+1,h<0||h>=u.length-1))}e.appendChild(s)}}Zu(e){return[...this.ri].some(t=>t.contains(e))}Tl(e){for(let t of[...this.ri])e&&!e.contains(t.el)||(t.destroy(),this.ri.delete(t))}};var Rt=class{constructor(e){this.e=e;this.v=null;this.bt=e=>{this.v&&!this.v.contains(e.target)&&this.close()};this.wt=e=>{e.key==="Escape"&&this.close()}}Qu(e){if(e){let o=this.e.i.m(e.rowIndex),s=this.e.n.k(e.colId);return o&&s?{node:o,column:s}:null}let t=this.e.a.Zr();if(!t)return null;let r=this.e.i.m(t.r1),i=this.e.n.c()[t.c1];return r&&i?{node:r,column:i}:null}eh(e,t){let r=this.e.r.getContextMenuItems;if(!r)return null;try{return r({data:e.data,node:e,api:this.e.api,colId:t.id,value:this.e.d(e,t),rowIndex:e.rowIndex})??null}catch(i){return this.e.reportError(i,"getContextMenuItems",{colId:t.id,rowId:e.id}),null}}th(e,t,r,i){let o=!1;for(let s of t){if(s.separator){e.appendChild(f("div","mach-context-menu-separator"));continue}let a=f("button","mach-context-menu-item");a.type="button",a.textContent=s.label??"",s.danger&&a.classList.add("mach-context-menu-item--danger"),a.disabled=s.disabled===!0,a.disabled||(o=!0,a.addEventListener("click",()=>this.rh(s,r,i))),e.appendChild(a)}return o}rh(e,t,r){this.close();try{e.action?.()}catch(i){this.e.reportError(i,"contextMenu.action",{colId:r.id,rowId:t.id})}}ls(e,t,r){let i=f("button","mach-context-menu-item");i.type="button",i.textContent=t,i.addEventListener("click",r),e.appendChild(i)}ih(e){let t=this.e;this.ls(e,t.y("menuCopy"),()=>{t.Dl(),this.close()}),!t.r.suppressClipboard&&(this.ls(e,t.y("menuPaste"),()=>{t.nh(),this.close()}),this.ls(e,t.y("menuClearContents"),()=>{let r=t.a.Zr();r&&t.Ko(r),this.close()}))}open(e,t,r){this.close();let i=this.Qu(r);if(!i)return;let o=f("div","mach-context-menu");if(o.setAttribute("role","menu"),this.e.r.getContextMenuItems){let s=this.eh(i.node,i.column);if(!s||!this.th(o,s,i.node,i.column))return;this.El(o,e,t);return}this.ih(o),this.El(o,e,t)}El(e,t,r){G(e,this.e.o.root),document.body.appendChild(e),this.v=e;let i=e.getBoundingClientRect(),o=E(t,8,Math.max(8,window.innerWidth-i.width-8)),s=E(r,8,Math.max(8,window.innerHeight-i.height-8));e.style.left=`${o}px`,e.style.top=`${s}px`,document.addEventListener("mousedown",this.bt,!0),document.addEventListener("keydown",this.wt,!0)}close(){this.v&&(this.v.remove(),this.v=null,document.removeEventListener("mousedown",this.bt,!0),document.removeEventListener("keydown",this.wt,!0))}destroy(){this.close()}};var St=class{constructor(e){this.e=e;this.v=null;this.an=0;this.ds=0;this.ii=null;this.ni=e=>{if(this.e.s()||!this.e.r.tooltipComponent)return;let r=e.target.closest(".mach-cell");if(!r||r===this.ii)return;this.cs(),this.ln(),this.ii=r;let i=this.oh(r);if(!i||r.classList.contains("mach-cell--editing"))return;let o=this.sh(i.node,i.column,i.index);this.ah(o,i.column)&&(this.an=window.setTimeout(()=>{this.e.s()||this.ii!==r||this.lh(r,o)},Math.max(0,this.e.r.tooltipShowDelay)))};this.xl=()=>{this.hide()}}init(){let e=this.e.o.Ee;e.addEventListener("mouseover",this.ni),e.addEventListener("mouseleave",this.xl)}destroy(){this.cs(),this.ln();let e=this.e.o.Ee;e.removeEventListener("mouseover",this.ni),e.removeEventListener("mouseleave",this.xl),this.ii=null}hide(){this.cs(),this.ln(),this.ii=null}cs(){this.an&&(clearTimeout(this.an),this.an=0),this.ds&&(clearTimeout(this.ds),this.ds=0)}ln(){this.v&&(this.v.remove(),this.v=null)}oh(e){let t=e.dataset.colId??"",r=Number(e.closest(".mach-row")?.dataset.index);if(Number.isNaN(r))return null;let i=this.e.i.m(r),o=t?this.e.n.k(t):void 0;return!i||!o||i.isDetail||i.isGroup?null:{node:i,column:o,index:r}}sh(e,t,r){return{data:e.data,node:e,api:this.e.api,colId:t.id,value:this.e.d(e,t),formatted:te(this.e,e,t),rowIndex:r}}ah(e,t){let r=t.colDef.tooltipValueGetter;if(!r)return!!e.formatted;try{r({...e,colDef:t.colDef,column:t})}catch(i){this.e.reportError(i,"tooltipValueGetter",{colId:t.id,rowId:e.node.id})}return!0}lh(e,t){this.ln();let r=this.e.r.tooltipComponent;if(!r)return;let i=f("div","mach-tooltip");i.setAttribute("role","tooltip");let o;try{o=r(t)}catch(s){this.e.reportError(s,"tooltipComponent",{colId:t.colId,rowIndex:t.rowIndex});return}typeof o=="string"?i.textContent=o:i.appendChild(o),G(i,this.e.o.root),document.body.appendChild(i),this.v=i,Y(i,e,6)}};var Mt=class{constructor(e){this.e=e;this.ee=null}init(){this.ee=document.createElement("div"),this.ee.className="mach-watermark",this.ee.setAttribute("aria-hidden","true"),this.ee.style.pointerEvents="none",this.e.o.root.appendChild(this.ee),this.apply()}apply(){if(!this.ee||this.e.s())return;let e=this.e.r.watermarkEnabled?this.e.r.watermarkConfig:null;if(!e||!e.text){this.ee.style.display="none",this.ee.style.backgroundImage="";return}let t=this.dh(e);this.ee.style.display="",t?(this.ee.style.backgroundImage=`url(${t})`,this.ee.style.backgroundColor=""):this.ee.style.backgroundImage=""}dh(e){try{let t=document.createElement("canvas"),r=t.getContext("2d");if(!r)return null;let i=e.fontSize??14,o=e.gap??160,s=e.angle??-22,a=e.color??(this.ch()?"rgba(255,255,255,0.9)":"rgba(31,55,88,0.9)"),l=e.opacity??.06;r.font=`500 ${i}px sans-serif`;let d=r.measureText(e.text),c=Math.ceil(d.width),u=Math.max(o,c+40);t.width=u,t.height=u;let h=t.getContext("2d");return h.clearRect(0,0,u,u),h.globalAlpha=l,h.fillStyle=a,h.font=`500 ${i}px sans-serif`,h.translate(u/2,u/2),h.rotate(s*Math.PI/180),h.textAlign="center",h.textBaseline="middle",h.fillText(e.text,0,0),t.toDataURL("image/png")}catch{return null}}ch(){return this.e.o.root.classList.contains("mach-theme-dark")}refresh(){this.apply()}destroy(){this.ee?.remove(),this.ee=null}};var It=class{constructor(e){this.e=e;this.xe=[];this.pe=-1;this.Ct=null}pl(){this.Ct||(this.Ct=[])}fl(){if(!this.Ct)return;let e=this.Ct;this.Ct=null,e.length>0&&this.push(e)}us(e){if(this.Ct){this.Ct.push(e);return}this.push([e])}push(e){let t=Math.max(0,this.e.r.undoStackSize);if(t!==0){for(this.xe.length=this.pe+1,this.xe.push(e);this.xe.length>t;)this.xe.shift();this.pe=this.xe.length-1}}uh(){let e=Math.max(0,this.e.r.undoStackSize);if(e===0){this.clear();return}for(;this.xe.length>e;)this.xe.shift(),this.pe--;this.pe<-1&&(this.pe=-1)}canUndo(){return this.pe>=0}canRedo(){return this.pe<this.xe.length-1}undo(){return this.e.Me(),this.canUndo()?(this.apply(this.xe[this.pe],!1),this.pe--,!0):!1}redo(){return this.e.Me(),this.canRedo()?(this.pe++,this.apply(this.xe[this.pe],!0),!0):!1}apply(e,t){let r=this.e,i=[];for(let o of e){let s=r.i.$(o.nodeId),a=r.n.k(o.columnId);if(!s||!a||s.data==null)continue;let l=t?o.newValue:o.oldValue,d=t?o.oldValue:o.newValue;r.Zi(s,a,l,d)&&(r.a._i(s),r.a.Rl([s.rowIndex],[a.id]),s.rowIndex>=0&&i.push(s.rowIndex),r.emit("cellValueChanged",{oldValue:d,newValue:l,rowNode:s,rowIndex:s.rowIndex,column:a,colDef:a.colDef,data:s.data}))}i.length>0&&r.a.ft(i),r.ce.refresh(),r.Ye.refresh()}clear(){this.xe=[],this.pe=-1,this.Ct=null}};var At=class{constructor(e){this.e=e;this.H=new Map;this.hs=!1;this.ps=null}init(){this.ps=this.e.fe.on("cellValueChanged",e=>{this.hs||this.us(e)})}us(e){let t=`${e.rowNode.id}\0${e.column.id}`,i=this.H.get(t)?.originalValue??e.oldValue;Object.is(e.newValue,i)?this.H.delete(t):this.H.set(t,{rowId:e.rowNode.id,colId:e.column.id,originalValue:i,value:e.newValue}),this.gr()}getDirtyRowIds(){return[...new Set([...this.H.values()].map(e=>e.rowId))]}getChanges(){let e=new Map;for(let t of this.H.values()){let r=this.e.i.$(t.rowId);if(!r?.data)continue;let i=e.get(t.rowId);i||(i={rowId:t.rowId,data:r.data,cells:[]},e.set(t.rowId,i)),i.cells.push({colId:t.colId,originalValue:t.originalValue,value:t.value})}return[...e.values()]}markSaved(e){if(!e)this.H.clear();else{let t=new Set(e);for(let[r,i]of this.H)t.has(i.rowId)&&this.H.delete(r)}this.gr()}hh(e){for(let t of e)for(let r of t.cells){let i=`${t.rowId}\0${r.colId}`,o=this.H.get(i);if(o){Object.is(o.value,r.value)?this.H.delete(i):o.originalValue=r.value;continue}let s=this.e.i.$(t.rowId),a=this.e.n.k(r.colId);if(!s||!a||s.data==null)continue;let l=this.e.d(s,a);Object.is(l,r.value)||this.H.set(i,{rowId:t.rowId,colId:r.colId,originalValue:r.value,value:l})}this.gr()}rollback(e){let t=e?new Set(e):null,r=[...this.H.entries()].filter(([,s])=>!t||t.has(s.rowId));if(r.length===0)return!1;let i=new Set,o=new Set;this.hs=!0;try{for(let[s,a]of r){let l=this.e.i.$(a.rowId),d=this.e.n.k(a.colId);if(!l||!d||l.data==null)continue;let c=this.e.d(l,d);if(Object.is(c,a.originalValue)){o.add(s);continue}this.e.Zi(l,d,a.originalValue,c)&&(o.add(s),this.e.a._i(l),l.rowIndex>=0&&i.add(l.rowIndex),this.e.emit("cellValueChanged",{oldValue:c,newValue:a.originalValue,rowNode:l,rowIndex:l.rowIndex,column:d,colDef:d.colDef,data:l.data}))}}finally{this.hs=!1}for(let s of o)this.H.delete(s);return i.size>0&&this.e.a.ft([...i]),this.e.ce.refresh(),this.e.Ye.refresh(),this.gr(),o.size>0}Pc(e){if(e.length===0)return;let t=new Set(e);for(let[r,i]of this.H)t.has(i.rowId)&&this.H.delete(r);this.gr()}clear(){this.H.size!==0&&(this.H.clear(),this.gr())}destroy(){this.ps?.(),this.ps=null,this.H.clear()}gr(){this.e.emit("dirtyStateChanged",{dirtyRowIds:this.getDirtyRowIds()})}};var Sr=class{constructor(){this.oi=null;this.dn=0;this.Sl=0;this.Ml=0}acquire(){this.dn++,this.ph();let e=!1;return()=>{e||(e=!0,this.dn=Math.max(0,this.dn-1),this.dn===0&&this.disconnect())}}snapshot(){return{count:this.Sl,totalMs:this.Ml}}ph(){if(!(this.oi||typeof PerformanceObserver>"u"))try{this.oi=new PerformanceObserver(e=>{for(let t of e.getEntries())this.Sl++,this.Ml+=t.duration}),this.oi.observe({entryTypes:["longtask"]})}catch{this.disconnect()}}disconnect(){let e=this.oi;this.oi=null;try{e?.disconnect()}catch{}}},Lt=new Sr;function Rr(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}var kt=class{constructor(){this.Vt=[];this.cn=[];this.un=[];this.fs=Lt.acquire(),this.hn=Lt.snapshot()}start(){return Rr()}fh(e,t,r){this.Vt.push({duration:Math.max(0,Rr()-e),rows:t,columns:r}),this.Vt.length>120&&this.Vt.shift()}mh(e){this.Il(this.cn,e)}Eo(e){this.Il(this.un,e)}snapshot(){let e=this.Vt.map(o=>o.duration),t=this.Vt[this.Vt.length-1],r=[...e].sort((o,s)=>o-s),i=Lt.snapshot();return{sampleCount:e.length,lastRenderMs:t?.duration??0,averageRenderMs:this.gh(e),maxRenderMs:r[r.length-1]??0,p95RenderMs:this.ms(r,!0),longRenderCount:e.filter(o=>o>16.7).length,renderedRows:t?.rows??0,renderedColumns:t?.columns??0,renderedCells:(t?.rows??0)*(t?.columns??0),layoutSampleCount:this.cn.length,p95LayoutMs:this.ms(this.cn),modelSampleCount:this.un.length,p95ModelMs:this.ms(this.un),longTaskCount:Math.max(0,i.count-this.hn.count),longTaskTotalMs:Math.max(0,i.totalMs-this.hn.totalMs),usedHeapBytes:this.usedHeapBytes()}}reset(){this.Vt=[],this.cn=[],this.un=[],this.hn=Lt.snapshot()}destroy(){this.fs?.(),this.fs=null}Il(e,t){e.push(Math.max(0,Rr()-t)),e.length>120&&e.shift()}gh(e){return e.length===0?0:e.reduce((t,r)=>t+r,0)/e.length}usedHeapBytes(){let e=typeof performance>"u"?void 0:performance.memory?.usedJSHeapSize;return typeof e=="number"&&Number.isFinite(e)?e:null}ms(e,t=!1){if(e.length===0)return 0;let r=t?e:[...e].sort((i,o)=>i-o);return r[Math.max(0,Math.ceil(r.length*.95)-1)]??0}};function ji(n,e){if(!(n==null||e==null))return[...new Set([...n,...e])]}function Ss(n,e){return n===!0||e===!0?!0:n?e?{rowIds:ji(n.rowIds,e.rowIds),rowIndexes:n.rowIndexes==null||e.rowIndexes==null?void 0:[...new Set([...n.rowIndexes,...e.rowIndexes])],columns:ji(n.columns,e.columns),force:n.force===!0||e.force===!0,includePinned:n.includePinned===!0||e.includePinned===!0}:n:e}function Ms(n,e){return{columns:n.columns===!0||e.columns===!0,header:n.header===!0||e.header===!0,pool:n.pool===!0||e.pool===!0,data:n.data===!0||e.data===!0,layout:n.layout===!0||e.layout===!0,cells:Ss(n.cells,e.cells),pinned:n.pinned===!0||e.pinned===!0,summary:n.summary===!0||e.summary===!0,overlays:n.overlays===!0||e.overlays===!0}}var Pt=class{constructor(e){this.apply=e;this.Bt=0;this.Tt=null;this.Al=0;this.Ll=0;this.kl=0;this.pn=!1}batch(e){if(this.pn)return e();this.Bt++;try{return e()}finally{this.Bt--,this.Bt===0&&this.flush()}}Pl(e){this.pn||(this.Ll++,this.Tt&&this.kl++,this.Tt=Ms(this.Tt??{},e),this.Bt===0&&this.flush())}flush(){if(this.pn||this.Bt>0||!this.Tt)return;let e=this.Tt;this.Tt=null,this.Al++,this.apply(e)}snapshot(){return{batchDepth:this.Bt,flushCount:this.Al,requestCount:this.Ll,coalescedRequestCount:this.kl,pending:this.Tt!=null}}destroy(){this.pn=!0,this.Tt=null,this.Bt=0}};var qi=Symbol.for("mach-table.adapter.lifecycle.v1");function Yi(n,e){Object.defineProperty(n,qi,{value:e})}function Mr(n){let e=n[qi]?.rowDrag;return e?.policy===n.getOption("rowDragPolicy")?e?.factory:void 0}var Xi=Symbol.for("mach-table.import.v1");function Ji(n,e){Object.defineProperty(n,Xi,{value:{begin:()=>e.U.Uo(),revision:()=>e.i.zr(),isEditing:()=>e.l.isEditing(),columns:()=>e.n.te(),visibleColumns:()=>e.n.c(),read:(r,i)=>e.d(r,i),editable:(r,i)=>e.l.q(r,i),parse:(r,i,o,s)=>le(e,r,i,o,"import",s),pasteRows:r=>{let i=[];for(let o of e.i.pt())if(!o.isGroup&&!o.isDetail&&i.push(o),i.length>=r)break;return i},resolveId:(r,i)=>e.r.resolveRowId?.({data:r,index:i,api:n}),validate:(r,i)=>e.U.Ji(r,i),guard:r=>e.U.Xi(r),commitRows:(r,i,o)=>e.U.hl(r,i,o)}})}function Zi(n){let e=n[Xi];if(!e)throw new TypeError("Import plans require a MachTable GridApi");return e}var ge=["gridReady","gridDestroyed","modelUpdated","cellClicked","cellDoubleClicked","cellContextMenu","rowClicked","rowDoubleClicked","selectionChanged","sortChanged","filterChanged","columnResized","columnMoved","columnVisibilityChanged","cellValueChanged","cellEditingStarted","cellEditingStopped","rowEditingStarted","rowEditingStopped","detailToggled","treeChildrenLoaded","treeChildrenLoadFailed","rowDragEnd","rangeSelectionChanged","paginationChanged","displayedColumnsChanged","gridError","dirtyStateChanged"];function Is(n,e,t,r){let i=n.columns().filter(u=>u.colDef.field),o=t.columns??e,s=new Map(i.map(u=>[u.id,u])),a=new Map,l=new Map;for(let u of i){let h=u.colDef.field;a.set(h,a.has(h)?null:u);let p=u.colDef.headerName;p&&l.set(p,l.has(p)?null:u)}let d=[],c=new Set;return o.forEach((u,h)=>{let p=(typeof u=="string"||typeof u=="number"?String(u):"").replace(/^\uFEFF/,"").trim(),m=s.get(p)??(a.has(p)?a.get(p):l.get(p));if(!m){if(r||t.columns||a.has(p)||l.has(p))throw new TypeError(`Unknown or ambiguous import column: ${p}`);return}if(c.has(m.colDef.field))throw new TypeError(`Duplicate import column: ${m.id}`);c.add(m.colDef.field),d.push({column:m,index:h})}),d.length?d:n.visibleColumns().filter(u=>u.colDef.field).map((u,h)=>({column:u,index:h}))}function As(n,e){if(!Array.isArray(n)||n.some(t=>!Array.isArray(t)))throw new TypeError("Import requires an array of rows");if(!Number.isInteger(e)||e<-1||e>=n.length)throw new RangeError("Invalid import header row");if(n.length-e-1>1e4||n.reduce((t,r)=>t+r.length,0)>1e5)throw new RangeError("Import supports 10000 data rows and 100000 cells")}function Ls(n,e,t,r,i,o){let s=t.colDef.field,a=n.read(e.node,t),l=o.parseValue?o.parseValue({value:i,field:s,rowIndex:e.rowIndex,columnIndex:r}):t.colDef.valueParser?n.parse(e.node,t,i,a):ct(i,o.coerceNumbers!==!1);if(l!=null&&typeof l.then=="function")throw new TypeError("Import parsers must return synchronous values");if(!ue(e.data,s,l))throw new TypeError(`Unsafe import field: ${s}`);e.changes.push({node:e.node,column:t,oldValue:a,newValue:l})}function ks(n,e,t,r,i,o,s,a){let l=a?.[t]??{},d=s?.[t]??{id:`import:${t}`,rowIndex:t,data:l,selected:!1},c={data:l,node:d,changes:[],rowIndex:t};for(let{column:u,index:h}of r)if(!(e[h]===void 0||s&&!n.editable(d,u)))try{Ls(n,c,u,h,e[h],i)}catch(p){o.issues.push({rowIndex:t,columnIndex:h,colId:u.id,code:"PARSE",message:p instanceof Error?p.message:String(p)})}o.rows.push(c)}function Qi(n,e,t={},r,i=!1,o){let s=t.headerRowIndex??(t.columns?-1:0);As(e,s);let a=Is(n,s<0?[]:e[s],t,i);if(!a.length)throw new TypeError("Import requires a writable field column");let l={rows:[],issues:[]};for(let d=s+1;d<e.length;d++){let c=e[d];c.some(u=>u!==""&&u!==void 0)&&ks(n,c,d-s-1,a,t,l,r,o)}return l}function de(n){return(n==null?"":String(n)).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Gt(n,e,t="text/plain;charset=utf-8"){try{if(typeof document>"u"||typeof Blob>"u")return!1;let r=document.createElement("a");if(typeof URL<"u"&&typeof URL.createObjectURL=="function"){let i=new Blob([e],{type:t}),o=URL.createObjectURL(i);r.href=o,r.download=n,r.click();let s=typeof URL.revokeObjectURL=="function"?URL.revokeObjectURL.bind(URL):null;s&&setTimeout(()=>{try{s(o)}catch{}},0)}else r.href=`data:${t},${encodeURIComponent(e)}`,r.download=n,r.click();return!0}catch{return!1}}var Pe={columnDefs:"array",rowData:"array",defaultColDef:"object",columnTypes:"object",rowKey:"unknown",rowHeight:"number",headerHeight:"number",rowBuffer:"number",columnLayout:"string",enableColumnResize:"boolean",domLayout:"string",rowSelection:"string",multiSort:"boolean",size:"string",stripedRows:"boolean",rowStyleRules:"array",showCellBorders:"boolean",theme:"string",quickFilterText:"string",advancedFilterModel:"object",masterDetail:"boolean",detailRowHeight:"number",detailRowRenderer:"function",isRowExpandable:"function",detailToggleColumn:"boolean",columnMenu:"boolean",aggFuncs:"object",components:"object",actionPolicy:"object",features:"array",initialState:"object",persistence:"boolean-object",locale:"object",editType:"string",editableIndicator:"string",rowEditValidator:"function",singleClickEdit:"boolean",manualSorting:"boolean",manualFiltering:"boolean",showSummary:"boolean",summaryMethod:"function",treeData:"boolean",childrenKey:"string",isTreeRowExpandable:"function",loadTreeChildren:"function",autoCheckedChildren:"boolean",defaultExpandAll:"boolean",indexOffset:"number",applyRowDrag:"boolean",rowDragPolicy:"object",undoStackSize:"number",asyncTransactionWaitMillis:"number",getRowHeight:"function",pinnedTopRowData:"array",pinnedBottomRowData:"array",pagination:"boolean-object",watermark:"boolean-object",suppressWarnings:"boolean",enableRangeSelection:"boolean",suppressClipboard:"boolean",contextMenu:"boolean",getContextMenuItems:"function",tooltipComponent:"function",tooltipShowDelay:"number",flashCells:"boolean",fillHandle:"boolean",statusBar:"boolean-object",datasource:"object",datasourceMode:"string",blockSize:"number",infiniteBufferRows:"number",maxBlocksInCache:"number",datasourceMaxConcurrentRequests:"number",blockPrefetch:"number",datasourceRowCount:"number",dataProcessor:"object-function",dataProcessorMinRows:"number",datasourceRetryCount:"number",datasourceRetryDelay:"number",datasourceRetryJitter:"number",suppressCellFocus:"boolean",suppressRowHoverHighlight:"boolean",suppressNoRowsOverlay:"boolean",suppressHeaderFocus:"boolean",ariaLabel:"string",ariaLabelledBy:"string",ariaDescribedBy:"string",loading:"boolean",error:"unknown",overlayNoRowsTemplate:"unknown",overlayLoadingTemplate:"unknown",overlayErrorTemplate:"unknown",allowUnsafeOverlayHtml:"boolean",className:"string"};var Ir=Object.freeze(Object.keys(Pe));var Ar=new Set(ge.map(n=>`on${n.charAt(0).toUpperCase()}${n.slice(1)}`));function Lr(n,e){return n==null||e==="unknown"?!0:e==="array"?Array.isArray(n):e==="boolean-object"?typeof n=="boolean"||typeof n=="object"&&!Array.isArray(n):e==="object"?typeof n=="object"&&!Array.isArray(n):e==="object-function"?typeof n=="function"||typeof n=="object"&&!Array.isArray(n):e==="number"?typeof n=="number"&&Number.isFinite(n):typeof n===e}function en(n){let e={};for(let[t,r]of Object.entries(n)){if(Ar.has(t)){(r==null||typeof r=="function")&&(e[t]=r);continue}let i=Pe[t];!i||!Lr(r,i)||(e[t]=r)}return e}var on=2e3,kr=1e5,Ge=512,Gs=1e4;function tn(n){return Array.isArray(n)?[...new Set(n.slice(0,kr).filter(e=>typeof e=="string"&&e.length>0&&e.length<=Ge))]:[]}function Ns(n){if(!Array.isArray(n))return[];let e=new Set,t=kr*Ge;for(let r of n.slice(0,kr)){if(typeof r!="string"||!r.length||e.has(r))continue;let i=r.startsWith(it)?65536:Ge;r.length>i||r.length>t||(e.add(r),t-=r.length)}return[...e]}function rn(n,e){return typeof n=="number"&&Number.isFinite(n)&&n>=1?Math.floor(n):e}function nn(n){return typeof n=="number"&&Number.isFinite(n)&&n>0?n:void 0}function Os(n,e){let t=nn(e.flex);for(let r of["width","contentWidth"]){let i=nn(e[r]);i!==void 0&&(n[r]=i)}e.flex===null?n.flex=null:t!==void 0&&(n.flex=t),(e.widthMode==="auto"||e.widthMode==="manual")&&(n.widthMode=e.widthMode)}function Fs(n,e){typeof e.hide=="boolean"&&(n.hide=e.hide),(e.pinned===null||e.pinned==="left"||e.pinned==="right")&&(n.pinned=e.pinned)}function Hs(n,e){if(n==null||typeof n!="object")return null;let t=n,r=typeof t.colId=="string"?t.colId.trim():"";if(!r||r.length>Ge||e.has(r))return null;e.add(r);let i={colId:r};return Fs(i,t),Os(i,t),i}function Vs(n){if(!Array.isArray(n))return[];let e=[],t=new Set;for(let r of n.slice(0,on)){let i=Hs(r,t);i&&e.push(i)}return e}function Bs(n){if(!Array.isArray(n))return[];let e=[],t=new Set;for(let r of n.slice(0,on)){if(r==null||typeof r!="object")continue;let i=r,o=typeof i.colId=="string"?i.colId.trim():"";!o||o.length>Ge||t.has(o)||i.direction!=="asc"&&i.direction!=="desc"||(t.add(o),e.push({colId:o,direction:i.direction}))}return e}function $(n){if(n==null||typeof n!="object")return null;let e=n;if(e.version!==2||!Array.isArray(e.columns)||!Array.isArray(e.sortModel))return null;let t=e.pagination!=null&&typeof e.pagination=="object"?e.pagination:{};return{version:2,columns:Vs(e.columns),sortModel:Bs(e.sortModel),filterModel:j(e.filterModel),advancedFilterModel:V(e.advancedFilterModel),quickFilterText:typeof e.quickFilterText=="string"&&e.quickFilterText.trim()?e.quickFilterText.slice(0,Gs):null,pagination:{enabled:t.enabled===!0,page:rn(t.page,1),pageSize:rn(t.pageSize,20)},selectedRowIds:tn(e.selectedRowIds),expandedRowIds:tn(e.expandedRowIds),expandedGroupIds:Ns(e.expandedGroupIds)}}function sn(n,e){let t=$(n);if(!t)throw new TypeError("[MachTable] Cannot persist an invalid GridState snapshot.");let r=new Set(e);return{version:2,columns:r.has("columns")?t.columns:[],sortModel:r.has("sort")?t.sortModel:[],filterModel:r.has("filter")?t.filterModel:{},advancedFilterModel:r.has("filter")?t.advancedFilterModel:null,quickFilterText:r.has("filter")?t.quickFilterText:null,pagination:r.has("pagination")?t.pagination:{enabled:!1,page:1,pageSize:20},selectedRowIds:r.has("selection")?t.selectedRowIds:[],expandedRowIds:r.has("expansion")?t.expandedRowIds:[],expandedGroupIds:r.has("expansion")?t.expandedGroupIds:[]}}function zs(n){try{if(typeof structuredClone=="function")return structuredClone(n)}catch{}return Array.isArray(n)?[...n]:n!=null&&typeof n=="object"?{...n}:n}function ln(n,e){let t=e?new Set(e.map(String)):null;return n.filter(r=>!t||t.has(r.rowId)).map(r=>({...r,data:zs(r.data),cells:r.cells.map(i=>({...i}))}))}function _s(n,e){let t=typeof n?.rowId=="string"?n.rowId:"";return!e.has(t)||typeof n.message!="string"||!n.message.trim()?null:{...n,rowId:t,message:n.message.trim(),...typeof n.code=="string"&&n.code.trim()?{code:n.code.trim()}:{},...Array.isArray(n.colIds)?{colIds:[...new Set(n.colIds.filter(r=>typeof r=="string"&&r.length>0))]}:{}}}function an(n,e){let t=new Map;for(let r of n??[]){let i=_s(r,e);i&&!t.has(i.rowId)&&t.set(i.rowId,i)}return[...t.values()]}function dn(n,e){let t=new Set(n.map(d=>d.rowId)),r=an(e?.conflicts,t),i=new Set(r.map(d=>d.rowId)),o=an(e?.failures,t).filter(d=>!i.has(d.rowId)),s=new Set([...o,...r].map(d=>d.rowId)),a=e?.savedRowIds==null?null:new Set(e.savedRowIds.map(String).filter(d=>t.has(d))),l=n.filter(d=>!s.has(d.rowId)&&(a==null||a.has(d.rowId)));return{submitted:n,saved:l,failures:o,conflicts:r}}function Ks(n,e){if(e.serverData===void 0)return null;let t=n.rows.getById(e.rowId);if(!t||t.data==null)return null;let r=n.getOption("rowKey");if(r){let s=typeof r=="function"?r(e.serverData):_(e.serverData,r);return String(s)===e.rowId?{data:e.serverData,mergeIntoCurrent:!1}:null}let i=t.data;return i!=null&&e.serverData!=null&&typeof i=="object"&&typeof e.serverData=="object"?{data:i,mergeIntoCurrent:!0}:null}function cn(n,e,t){if(n.isDestroyed())return!1;if(t==="keepLocal")return!0;let r=Ks(n,e);return r?(n.editing.rollback([e.rowId]),r.mergeIntoCurrent&&Object.assign(r.data,e.serverData),n.rows.transact({update:[r.data]}),n.editing.markSaved([e.rowId]),!0):!1}function un(n){return{setData:e=>n.ht(e),transact:e=>n.Kr(e),transactAsync:(e,t)=>n.yh(e,t),flushTransactions:()=>n.Gl(),getCount:()=>n.A(),getAt:e=>n.vh(e),getById:e=>n.$(e),forEach:e=>n.Po(e),forEachDisplayed:e=>n.Go(e),reorder:(e,t)=>n.bh(e,t),isRemote:()=>n.f(),reload:e=>n.reload(e),ensureLoaded:(e,t,r)=>n.yo(e,t,r),purgeCache:()=>n.vo(),getCacheSnapshot:()=>n.bo()}}function hn(n){return{getDefinitions:()=>n.xi(),setDefinitions:e=>n.Gr(e),getState:()=>n.Si(),setState:e=>n.wh(e),resetState:()=>n.so(),setVisible:(e,t)=>n.no(e,t),setPinned:(e,t)=>n.oo(e,t),move:(e,t)=>n.At(e,t),setWidth:(e,t)=>n.Se(e,t),fit:e=>n.Ch(e),autoSize:e=>n.Th(e),autoSizeAll:()=>n.Dh(),getWorkbenchItems:()=>n.Eh(),openWorkbench:e=>n.xh(e),closeWorkbench:()=>n.Rh()}}function pn(n){return{getRows:()=>n.Ui(),getVisibleRows:()=>n.Sh(),getNodes:()=>n.je(),getIds:()=>n.ji(),setRows:(e,t)=>n.Mh(e,t),setById:(e,t,r)=>n.No(e,t,r),selectAll:e=>n.selectAll(e),clear:()=>n.deselectAll(),getMode:()=>n.Ih(),setMode:e=>n.Ah(e),getRange:()=>n.Xe(),clearRange:()=>n.pr()}}function fn(n){return{startCell:e=>n.Lh(e),startRow:e=>n.kh(e),isRowActive:e=>n.en(e),stop:e=>n.Ph(e?.cancel===!0),getChanges:()=>n.getChanges(),getDirtyRowIds:()=>n.getDirtyRowIds(),markSaved:e=>n.Gh(e),rollback:e=>n.Nh(e),save:(e,t)=>n.Oh(e,t),undo:()=>n.undo(),redo:()=>n.redo(),canUndo:()=>n.canUndo(),canRedo:()=>n.canRedo()}}function mn(n){return{get:()=>n.getState(),apply:(e,t)=>n.Nl(e,t)}}function gn(n){return{get:()=>n.gs(),getPerformance:()=>n.Fh(),resetPerformance:()=>n.Hh()}}function yn(n){return{getModel:()=>n.Q(),setModel:e=>n.Wr(e),getAdvancedModel:()=>n.Ie(),setAdvancedModel:e=>n.sr(e),getQuickText:()=>n.$r(),setQuickText:e=>n.ar(e),isPresent:e=>e==null?Object.keys(n.Q()).length>0||n.Ie()!=null||n.$r()!=null:n.Vh(e)}}function vn(n){return{getModel:()=>n.J(),setModel:e=>n.Bh(e)}}function bn(n){return{isEnabled:()=>n.paginationEnabled(),setEnabled:e=>n.Wi(e),getPage:()=>n.getPage(),setPage:e=>n.setPage(e),getPageSize:()=>n.getPageSize(),setPageSize:e=>n.setPageSize(e),getPageCount:()=>n.getPageCount(),getTotalRowCount:()=>n.getTotalRowCount()}}function wn(n){return{isRowExpanded:e=>n.isRowExpanded(e),setRowExpanded:(e,t)=>n.isRowExpanded(e)===t?!1:(t?n.xo(e):n.So(e),n.isRowExpanded(e)===t),isTreeRowLoading:e=>n.isTreeRowLoading(e),loadTreeChildren:(e,t)=>n.loadTreeChildren(e,t),isGroupExpanded:e=>n.isGroupExpanded(e),setGroupExpanded:(e,t)=>n.isGroupExpanded(e)===t?!1:(n.zh(e),n.isGroupExpanded(e)===t),setAllGroupsExpanded:e=>e?n.Lo():n.ko(),setAllDetailsExpanded:e=>e?n.Mo():n.Io()}}function Cn(n){return{getRoot:()=>n._h(),scrollToRow:(e,t)=>n.dr(e,t),refreshCells:e=>n.refreshCells(e),refreshLayout:()=>n.refreshLayout(),flush:()=>n.Kh(),setOverlay:e=>n.setOverlay(e),getPinnedRows:e=>n.getPinnedRows(e),setPinnedRows:(e,t)=>n.setPinnedRows(e,t)}}function Tn(n){return{exportCsv:e=>n.Wh(e),importCsv:(e,t)=>n.importCsv(e,t),exportMatrix:e=>n.Ol(e),importMatrix:(e,t)=>n.importMatrix(e,t),print:e=>n.print(e),copyRange:()=>n.$h()}}function Nt(n){return ie(n?.reason,"The operation was aborted")}function Dn(n,e){return Qe(n,e,()=>Nt(e))}function Ws(){return{datasourceChanged:!1,filterChanged:!1,needsCellRefresh:!1,needsColumnRebuild:!1,needsHeaderRebuild:!1,needsPoolRebuild:!1,needsRelayout:!1,needsRowRebuild:!1,needsStateLoad:!1,needsSummaryRefresh:!1,needsFeatureReload:!1}}function S(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function Pr(n,e,t,r=!1){let i=P(n,t,r);return i===void 0||i===e?void 0:i}var Gr=class{constructor(e){this.e=e;this.si=[];this.Dt=null}batch(e){return this.e.Fl(()=>e(this.e.api))}Kh(){this.e.yr.flush()}_h(){return this.e.s()?null:this.e.o.root}ht(e){this.e.s()||(this.e.r.rowData=e??[],!this.e.i.f&&(this.e.i.ht(e),this.e.h({data:!0})))}Kr(e){if(this.e.s()||this.e.i.f)return;let t=this.e.i.Kr(e);this.Hl(t)}yh(e,t={}){if(this.e.s()||this.e.i.f)return Promise.resolve();if(t.signal?.aborted)return Promise.reject(Nt(t.signal));let r=new Promise((i,o)=>{let s={transaction:e,resolve:i,reject:o,signal:t.signal,aborted:!1};t.signal&&(s.onAbort=()=>{s.aborted||(s.aborted=!0,o(Nt(t.signal)))},t.signal.addEventListener("abort",s.onAbort,{once:!0})),this.si.push(s)});return this.Dt==null&&(this.Dt=setTimeout(()=>this.Gl(),this.e.r.asyncTransactionWaitMillis)),r}Gl(){this.Dt!=null&&clearTimeout(this.Dt),this.Dt=null;let e=this.si;this.si=[];let t=e.filter(r=>!r.aborted).map(r=>r.transaction);if(t.length>0&&!this.e.s()&&!this.e.i.f){let r=this.e.i.Gc(t);this.Hl(r)}for(let r of e)r.signal&&r.onAbort&&r.signal.removeEventListener("abort",r.onAbort),r.aborted||r.resolve()}Hl(e){if(e.pipelineChanged){this.e.h({data:!0});return}e.updatedRowIds.length!==0&&this.e.h({cells:{rowIds:e.updatedRowIds},summary:!0,overlays:!0})}xi(){return this.e.n.xi()}Gr(e){this.e.s()||(this.e.r.columnDefs=e??[],this.e.n.Gr(e),this.e.ys(),this.e.Je(),this.e.i.f?this.e.i.We():(this.e.i.w(),this.e.h({data:!0})))}Si(){return this.e.n.Si()}wh(e){this.e.s()||(this.e.n.Ca(e),this.e.Je())}so(){this.e.s()||(this.e.n.so(),this.e.Je())}no(e,t){this.e.s()||(this.e.n.no(e,t),this.e.Je(),this.e.emit("columnVisibilityChanged",{colId:e,visible:t}))}At(e,t){this.e.s()||this.e.At(e,t)}oo(e,t){this.e.s()||(this.e.n.oo(e,t),this.e.Je())}Se(e,t){if(this.e.s())return!1;let r=this.e.n.k(e);return!r||!this.e.n.Se(r,t)?!1:(this.e.qe(),this.e.cr([r]),!0)}Ch(e){if(this.e.s())return;let t=this.e.n.c(),r=t.filter(d=>d.pinned===null&&!d.colDef.suppressSizeToFit);if(r.length===0)return;let i=e??this.e.o.vs();if(!Number.isFinite(i)||i<=0)return;let o=t.reduce((d,c)=>d+(c.pinned!==null||c.colDef.suppressSizeToFit?c.currentWidth:0),0),s=Je(r.map(d=>({width:d.currentWidth,minWidth:d.colDef.minWidth,maxWidth:d.colDef.maxWidth})),Math.max(0,i-o)),a=this.e.r.columnLayout==="fit"&&e===void 0,l=r.filter((d,c)=>a?this.e.n.wa(d,s[c]):this.e.n.Se(d,s[c]));this.e.qe(),this.e.cr(l)}Th(e){if(this.e.s())return;let t=this.e.n.k(e);t&&this.Vl(t)&&(this.e.qe(),this.e.cr([t]))}Vl(e){return this.e.r.columnLayout==="fit"&&e.colDef.suppressSizeToFit?!1:e.hasCheckbox||e.isDetailToggle?this.e.n.Se(e,e.isDetailToggle?38:46):this.Uh(e,this.e.zt.ma(e))}Uh(e,t){return this.e.r.columnLayout==="fit"?this.e.n.wa(e,t):this.e.n.Se(e,t)}Dh(){if(this.e.s())return;let e=[];for(let t of this.e.n.c())this.Vl(t)&&e.push(t);e.length>0&&(this.e.qe(),this.e.cr(e))}J(){return this.e.n.J()}Bh(e){this.e.s()||(this.e.n.Nr(e),this.e.Nr())}Q(){return this.e.i.Q()}Wr(e){if(!this.e.s()){if(this.e.i.Wr(e),this.e.K.fn(),this.mn(),this.e.i.f){this.e.i.We();return}this.e.i.w(),this.e.h({data:!0})}}Ie(){return this.e.i.Ie()}sr(e){if(!(this.e.s()||!this.e.i.sr(e))){if(this.mn(),this.e.i.f){this.e.i.We();return}this.e.i.w(),this.e.h({data:!0})}}mn(){this.e.emit("filterChanged",{filterModel:this.e.i.Q(),advancedFilterModel:this.e.i.Ie()})}Vh(e){return Object.prototype.hasOwnProperty.call(this.e.i.Q(),e)}ar(e){this.e.s()||(this.e.r.quickFilterText=e!=null&&e.trim()!==""?e:null,this.e.i.ar(e)&&this.e.jh())}$r(){return this.e.i.$r()}Ih(){return this.e.r.rowSelection}Ah(e){this.e.s()||this.e.r.rowSelection!==e&&(this.e.r.rowSelection=e,e==="none"&&this.deselectAll(),this.e.K.ai(),this.e.a.bs())}je(){return this.e.g.je()}Ui(){return this.e.g.Ui()}No(e,t=!0,r=!0){this.e.g.No(e,t,r)}selectAll(e=!0){this.e.g.selectAll(e)}deselectAll(){this.e.g.deselectAll()}A(){return this.e.i.A()}vh(e){return this.e.i.m(e)}$(e){return this.e.i.$(e)}Po(e){this.e.i.Po(e)}Go(e){this.e.i.Go(e)}dr(e,t="top"){this.e.a.dr(e,t)}xo(e){return this.e.s()?!1:this.e.i.xo(e)}So(e){return this.e.s()?!1:this.e.i.So(e)}isRowExpanded(e){return this.e.i.isRowExpanded(e)}Mo(){this.e.s()||this.e.i.Mo()}Io(){this.e.s()||this.e.i.Io()}loadTreeChildren(e,t={}){return this.e.s()?Promise.resolve([]):this.e.i.loadTreeChildren(e,t.force===!0)}isTreeRowLoading(e){return!this.e.s()&&this.e.i.isTreeRowLoading(e)}zh(e){return this.e.s()?!1:this.e.i.Ao(e)}bh(e,t){return this.e.s()||this.e.l.isEditing()?!1:this.e.i.qa(e,t)}isGroupExpanded(e){return this.e.i.isGroupExpanded(e)}Lo(){this.e.s()||this.e.i.Lo()}ko(){this.e.s()||this.e.i.ko()}Mh(e,t=!0){if(this.e.s())return;let r=this.e.r.resolveRowId,i=[];for(let o of e){let s=r?this.e.i.$(this.e.i.resolveRowId(o,-1,`__missing_selection_${this.e.or()}`)):this.e.i.be().find(a=>a.data===o);s&&i.push({node:s,selected:!0})}i.length>0?this.e.g.au(i,t):t&&this.deselectAll()}Sh(){let e=new Set(this.e.g.je().map(t=>t.id));return this.e.i.pt().filter(t=>!t.isDetail&&!t.isGroup&&e.has(t.id)).map(t=>t.data).filter(Boolean)}ji(){return this.e.g.ji()}undo(){return this.e.s()?!1:this.e._.undo()}redo(){return this.e.s()?!1:this.e._.redo()}canUndo(){return this.e._.canUndo()}canRedo(){return this.e._.canRedo()}getDirtyRowIds(){return this.e.z.getDirtyRowIds()}getChanges(){return this.e.z.getChanges()}Gh(e){this.e.z.markSaved(e)}async Oh(e,t){let r=ln(this.e.z.getChanges(),t);if(r.length===0)return{submitted:[],saved:[],failures:[],conflicts:[]};let i=this.e.i.zr(),o=dn(r,await e(r));return!this.e.s()&&i===this.e.i.zr()&&this.e.z.hh(o.saved),o}Nh(e){return this.e.z.rollback(e)}setPinnedRows(e,t){if(this.e.s())return;let r=e==="top"?"pinnedTopRowData":"pinnedBottomRowData";this.e.r[r]=t??[],this.e.me.setRows(e,this.e.r[r])}getPinnedRows(e){return this.e.me.getRows(e)}Xe(){return this.e.a.Xe()}pr(){this.e.s()||this.e.a.pr()}$h(){return this.e.s()?Promise.resolve(!1):this.e.Dl()}xh(e){this.e.s()||this.e.columnMenu.Ju(e)}Rh(){this.e.columnMenu.close()}Eh(){return this.e.n.te().filter(e=>!e.isDetailToggle).map(e=>({colId:e.id,label:e.colDef.headerName??e.colDef.field??e.id,visible:!e.hide,pinned:e.pinned,width:e.currentWidth||e.manualWidth||e.colDef.width||0,movable:e.movable,hideable:!e.hasCheckbox}))}refreshLayout(){this.e.s()||(this.e.Te(),this.e.a.gn(!0))}f(){return this.e.i.f}reload(e={}){return this.e.s()?Promise.resolve():e.signal?.aborted?Promise.reject(Nt(e.signal)):this.e.i.f?Dn(this.e.i.Hi(e.signal),e.signal):(this.e.i.ht(this.e.r.rowData),this.e.h({data:!0}),Promise.resolve())}yo(e,t,r={}){return this.e.s()?Promise.resolve():Dn(this.e.i.yo(e,t,r.signal),r.signal)}vo(){this.e.s()||this.e.i.vo()}bo(){return this.e.i.bo()}paginationEnabled(){return this.e.i.Ae}Wi(e){this.e.s()||this.e.i.Wi(e)}getPage(){return this.e.i.qr()}setPage(e){this.e.s()||this.e.i.setPage(e)}getPageSize(){return this.e.r.paginationPageSize}setPageSize(e){this.e.s()||this.e.i.setPageSize(e)}getPageCount(){return this.e.i.getPageCount()}getTotalRowCount(){return this.e.i.getTotalRowCount()}importCsv(e,t={}){if(!e)return!1;let{parseValue:r,...i}=t;return this.importMatrix(pt(e,t.separator??","),{...i,parseValue:r?o=>r({...o,value:o.value}):void 0})}importMatrix(e,t={}){if(this.e.s()||this.e.i.f||!Array.isArray(e)||!e.length)return!1;try{let r=Zi(this.e.api),i=t.mode==="paste"?r.pasteRows(e.length):void 0,o=Qi(r,e,t,i);if(o.issues.length)return this.e.reportError(new Error(o.issues.map(s=>s.message).join("; ")),"import",{issues:o.issues}),!1;if(t.mode==="paste")this.e.vr(o.rows.flatMap(s=>s.changes));else{let s=o.rows.map(a=>a.data);t.mode==="append"?this.Kr({add:s}):this.ht(s)}return!0}catch(r){return this.e.reportError(r,"import"),!1}}print(e={}){if(this.e.s())return!1;try{let t=window.open("","_blank","width=980,height=720");if(!t)return!1;let r=this.e.n.c().filter(d=>!d.hasCheckbox&&!d.isDetailToggle&&!d.colDef.rowDrag),i=this.e.i.Wa().filter(d=>!d.isDetail&&!d.isGroup),s=e.includeHeader!==!1?`<tr>${r.map(d=>`<th>${de(d.colDef.headerName??d.colDef.field??d.id)}</th>`).join("")}</tr>`:"",a=i.map(d=>`<tr>${r.map(c=>{let u=te(this.e,d,c);return`<td>${de(u)}</td>`}).join("")}</tr>`).join(""),l=`<!doctype html><html><head><meta charset="utf-8"><title>${de(e.title??"MachTable")}</title><style>body{font-family:system-ui,"PingFang SC","Microsoft YaHei",sans-serif;padding:20px}h3{margin:0 0 12px;font-size:16px}table{border-collapse:collapse;width:100%;font-size:12px}th,td{border:1px solid #bbb;padding:5px 8px;text-align:left;word-break:break-all}th{background:#f2f5f9;font-weight:600}@page{margin:12mm}</style></head><body><h3>${de(e.title??"")}</h3><table>${s}${a}</table></body></html>`;return t.document.write(l),t.document.close(),t.focus(),t.print(),!0}catch{return!1}}Lh(e){let t=this.e.n.k(e.colId);return t?this.e.l.start(e.rowIndex,t,e.keyPress??null):!1}kh(e){return this.e.l.startRow(e)}en(e){return this.e.l.en(e)}Ph(e){return this.e.l.he(e??!1)}refreshCells(e){let t=e==null||e.rowIds==null&&e.rowIndexes==null&&e.columns==null;this.e.h({cells:e??!0,pinned:e?.includePinned??t,summary:t})}getOption(e){return this.e.r[e]}updateOptions(e){this.e.s()||(this.e.ws(e),e=en(e),Object.keys(e).length!==0&&this.e.Fl(()=>{let t=Ws(),r=this.e.r.columnMenu;this.qh(e,t),this.Yh(e,t),this.Xh(e,t),this.Jh(e,t),this.Zh(e),this.Qh(e,t),this.ep(e,t),this.tp(e,t),this.rp(e,t),this.ip(e,t),this.np(e,t,r)}))}qh(e,t){let r=this.e.r;S(e,"columnDefs")&&e.columnDefs!==r.columnDefs&&(r.columnDefs=Array.isArray(e.columnDefs)?e.columnDefs:[],t.needsColumnRebuild=!0,t.needsRowRebuild=!0),S(e,"rowData")&&e.rowData!==r.rowData&&(r.rowData=Array.isArray(e.rowData)?e.rowData:[],t.needsRowRebuild=!0),S(e,"initialState")&&e.initialState&&(r.initialState=e.initialState,t.stateToApply=e.initialState),this.op(e)}op(e){for(let t of ge){let r=`on${t.charAt(0).toUpperCase()}${t.slice(1)}`;S(e,r)&&Object.assign(this.e.r,{[r]:e[r]})}}Yh(e,t){let r=this.e.r;for(let o of["rowHeight","headerHeight","rowBuffer"]){let s=Pr(e[o],r[o],o==="rowBuffer"?0:1,o==="rowBuffer");s!==void 0&&(r[o]=s,t.needsRelayout=!0,o==="headerHeight"&&(t.needsHeaderRebuild=!0))}e.columnLayout!=null&&e.columnLayout!==r.columnLayout&&(r.columnLayout=e.columnLayout==="fit"?"fit":"normal",t.needsRelayout=!0),e.domLayout!=null&&e.domLayout!==r.domLayout&&(r.domLayout=e.domLayout==="autoHeight"?"autoHeight":"normal",this.e.o.sp(r.domLayout),t.needsPoolRebuild=!0),A(e,r,["multiSort"]);let i=Pr(e.detailRowHeight,r.detailRowHeight,1);i!==void 0&&(r.detailRowHeight=i,this.e.a.yn(),this.e.a.li(!0))}Xh(e,t){let r=this.e.r;e.editType!=null&&e.editType!==r.editType&&(this.e.l.stop(!0),r.editType=e.editType==="fullRow"?"fullRow":"cell",t.needsCellRefresh=!0),e.editableIndicator!=null&&e.editableIndicator!==r.editableIndicator&&(r.editableIndicator=e.editableIndicator==="always"||e.editableIndicator==="none"?e.editableIndicator:"hover",t.needsCellRefresh=!0),A(e,r,["rowEditValidator"],!0),A(e,r,["singleClickEdit","manualSorting","manualFiltering"])}Jh(e,t){let r=this.e.r;typeof e.enableColumnResize=="boolean"&&e.enableColumnResize!==r.enableColumnResize&&(this.e.di.Ot(),r.enableColumnResize=e.enableColumnResize,t.needsHeaderRebuild=!0),e.locale!=null&&e.locale!==r.locale&&(r.locale=e.locale,t.needsHeaderRebuild=!0,t.needsCellRefresh=!0,this.e.br.ge(),this.e.Ye.ge()),e.indexOffset!=null&&e.indexOffset!==r.indexOffset&&(r.indexOffset=e.indexOffset,t.needsCellRefresh=!0),e.showSummary!=null&&e.showSummary!==r.showSummary&&(r.showSummary=e.showSummary,t.needsSummaryRefresh=!0,t.needsRelayout=!0);let i=Pr(e.undoStackSize,r.undoStackSize,0,!0);i!==void 0&&(r.undoStackSize=i,this.e._.uh());let o=P(e.asyncTransactionWaitMillis,0,!0);o!==void 0&&(r.asyncTransactionWaitMillis=o),this.ap(e,t),this.lp(e)}ap(e,t){if(!S(e,"getRowHeight"))return;let r=this.e.r.getRowHeight!==e.getRowHeight;this.e.r.getRowHeight=e.getRowHeight,r&&this.e.a.vn(),t.needsRelayout=!0}lp(e){let t=this.e.r;e.enableRangeSelection!=null&&(t.enableRangeSelection=e.enableRangeSelection,e.enableRangeSelection||this.pr()),A(e,t,["tooltipComponent"],!0);let r=P(e.tooltipShowDelay,0);r!==void 0&&(t.tooltipShowDelay=r),A(e,t,["flashCells"]),A(e,t,["getContextMenuItems"],!0),e.theme!=null&&e.theme!==t.theme&&(t.theme=e.theme,this.e.o.Bl(e.theme),this.e.bn.refresh())}Zh(e){if(e.pagination===void 0)return;let t=this.e.r,r=e.pagination,i=r!==!1&&t.datasource==null;i!==t.paginationEnabled&&this.e.i.Wi(i),typeof r=="object"&&r&&this.dp(r),t.paginationEnabled&&this.e.i._c(),this.e.br.ge()}dp(e){let t=this.e.r;t.paginationMode=e.mode==="server"?"server":"client";let r=P(e.page,1,!0),i=P(e.total,0,!0);r!==void 0&&(t.paginationPage=r),i!==void 0&&(t.paginationTotal=i),e.pageSize!=null&&(t.paginationPageSize=e.pageSize),e.pageSizeOptions!=null&&(t.paginationPageSizeOptions=e.pageSizeOptions),e.showTotal!=null&&(t.paginationShowTotal=e.showTotal),e.showPageSizeSelector!=null&&(t.paginationShowSizeSelector=e.showPageSizeSelector)}Qh(e,t){S(e,"rowStyleRules")&&(this.e.r.rowStyleRules=Array.isArray(e.rowStyleRules)?e.rowStyleRules:[],t.needsCellRefresh=!0,this.e.h({pinned:!0})),this.cp(e,t),this.up(e,t);let r=this.e.r;e.stripedRows!=null&&e.stripedRows!==r.stripedRows&&(r.stripedRows=e.stripedRows,this.e.o.hp(e.stripedRows)),e.showCellBorders!=null&&e.showCellBorders!==r.showCellBorders&&(r.showCellBorders=e.showCellBorders,this.e.o.pp(e.showCellBorders))}cp(e,t){let r=this.e.r;e.watermark!==void 0&&(Object.assign(r,hr(e)),this.e.bn.refresh()),this.fp(e),S(e,"summaryMethod")&&(r.summaryMethod=e.summaryMethod,t.needsSummaryRefresh=!0)}fp(e){let t=this.e.r;A(e,t,["suppressClipboard","contextMenu","columnMenu","fillHandle"]),e.statusBar!==void 0&&(t.statusBarEnabled=e.statusBar===!0||typeof e.statusBar=="object"&&e.statusBar!=null,typeof e.statusBar=="object"&&e.statusBar?.panels&&(t.statusBarPanels=e.statusBar.panels),this.e.Ye.ge())}up(e,t){let{size:r}=e;if(r==null||!S(De,r)||r===this.e.r.size)return;let i=De[r];this.e.r.size=r,this.e.r.rowHeight=e.rowHeight??i.rowHeight,this.e.r.headerHeight=e.headerHeight??i.headerHeight,this.e.o.mp(r),t.needsRelayout=!0,t.needsHeaderRebuild=!0}ep(e,t){let r=this.e.r;A(e,r,["suppressCellFocus","suppressRowHoverHighlight","suppressNoRowsOverlay"]),e.suppressHeaderFocus!=null&&e.suppressHeaderFocus!==r.suppressHeaderFocus&&(r.suppressHeaderFocus=e.suppressHeaderFocus,t.needsHeaderRebuild=!0),this.gp(e),this.yp(e)}gp(e){let t=this.e.r,r=!1;for(let i of["ariaLabel","ariaLabelledBy","ariaDescribedBy"])S(e,i)&&(t[i]=e[i]??Ee[i],r=!0);r&&this.e.o.zl(t)}yp(e){let t=this.e.r;for(let r of["overlayNoRowsTemplate","overlayLoadingTemplate","overlayErrorTemplate"])S(e,r)&&(t[r]=e[r]??Ee[r]);A(e,t,["allowUnsafeOverlayHtml"]),S(e,"className")&&(t.className=e.className??"",this.e.o._l(t.className)),A(e,t,["loading"]),S(e,"error")&&(t.error=e.error??null)}tp(e,t){this.vp(e,t),this.bp(e,t);let r=this.e.r;A(e,r,["autoCheckedChildren"]),e.defaultExpandAll!=null&&e.defaultExpandAll!==r.defaultExpandAll&&(r.defaultExpandAll=e.defaultExpandAll,t.needsRowRebuild=!0),S(e,"advancedFilterModel")&&(t.filterChanged=this.e.i.sr(e.advancedFilterModel)||t.filterChanged),e.applyRowDrag!=null&&(r.applyRowDrag=e.applyRowDrag,t.needsCellRefresh=!0),S(e,"rowDragPolicy")&&(r.rowDragPolicy=e.rowDragPolicy,t.needsCellRefresh=!0),A(e,r,["suppressWarnings"])}vp(e,t){let r=this.e.r;if(e.rowSelection!=null&&e.rowSelection!==r.rowSelection&&(r.rowSelection=e.rowSelection,e.rowSelection==="none"&&this.deselectAll(),t.needsHeaderRebuild=!0,t.needsPoolRebuild=!0,this.e.wn()),e.quickFilterText!==void 0&&this.ar(e.quickFilterText),e.defaultColDef!==void 0&&e.defaultColDef!==r.defaultColDef&&(r.defaultColDef={...cr,...e.defaultColDef},t.needsColumnRebuild=!0),S(e,"columnTypes")&&e.columnTypes!==r.columnTypes&&(r.columnTypes=e.columnTypes??{},t.needsColumnRebuild=!0),S(e,"rowKey")){r.rowKey=e.rowKey;let i=e.rowKey;r.resolveRowId=i?({data:o})=>ur(i,o):void 0,t.needsRowRebuild=!0}}bp(e,t){let r=this.e.r;e.masterDetail!=null&&e.masterDetail!==r.masterDetail&&(r.masterDetail=e.masterDetail,t.needsColumnRebuild=!0,t.needsRowRebuild=!0),e.detailToggleColumn!=null&&e.detailToggleColumn!==r.detailToggleColumn&&(r.detailToggleColumn=e.detailToggleColumn,t.needsColumnRebuild=!0),e.treeData!=null&&e.treeData!==r.treeData&&(r.treeData=e.treeData,t.needsRowRebuild=!0,t.needsColumnRebuild=!0,this.e.wn()),e.childrenKey!=null&&e.childrenKey!==r.childrenKey&&(r.childrenKey=e.childrenKey,t.needsRowRebuild=!0),A(e,r,["isTreeRowExpandable","loadTreeChildren"],!0)&&(t.needsCellRefresh=!0)}rp(e,t){let r=this.e.r;A(e,r,["aggFuncs"],!0)&&(t.needsRowRebuild=!0),A(e,r,["components","actionPolicy"],!0)&&(t.needsCellRefresh=!0),S(e,"features")&&(r.features=Array.isArray(e.features)?e.features:[],t.needsFeatureReload=!0),this.wp(e,t),this.Cp(e,t)}wp(e,t){let r=this.e.r;S(e,"dataProcessor")&&this.e.Kl(e.dataProcessor)&&(t.needsRowRebuild=!0);let i=P(e.dataProcessorMinRows,1,!0);i!==void 0&&i!==r.dataProcessorMinRows&&(r.dataProcessorMinRows=i,t.needsRowRebuild=!0)}Cp(e,t){let r=this.e.r;S(e,"persistence")&&(r.persistence=ze(e.persistence),t.needsStateLoad=!0)}ip(e,t){this.Tp(e,t),this.Dp(e,t),this.Ep(e,t),this.xp(e)}Tp(e,t){let r=this.e.r;for(let o of["blockSize","maxBlocksInCache","datasourceMaxConcurrentRequests"]){let s=P(e[o],1,!0);s===void 0||s===r[o]||(r[o]=s,t.datasourceChanged||(t.datasourceChanged=r.datasourceMode==="block"))}for(let o of["infiniteBufferRows","blockPrefetch","datasourceRetryCount","datasourceRetryDelay"]){let s=P(e[o],0,!0);s!==void 0&&(r[o]=s)}let i=P(e.datasourceRetryJitter,0);i!==void 0&&(r.datasourceRetryJitter=Math.min(1,i))}Dp(e,t){let r=this.e.r;if(S(e,"datasourceMode")){let i=e.datasourceMode==="block"?"block":"sequential";i!==r.datasourceMode&&(r.datasourceMode=i,t.datasourceChanged=!0)}if(S(e,"datasourceRowCount")){let i=e.datasourceRowCount==null?null:P(e.datasourceRowCount,0,!0)??null;i!==r.datasourceRowCount&&(r.datasourceRowCount=i,t.datasourceChanged=!0)}}Ep(e,t){let r=this.e.r;S(e,"datasource")&&e.datasource!==r.datasource&&(r.datasource=e.datasource,r.paginationEnabled=e.datasource==null&&r.paginationEnabled,t.datasourceChanged=!0,this.e.br.ge()),A(e,r,["detailRowRenderer","isRowExpandable"],!0)&&(t.needsCellRefresh=!0)}xp(e){let t=this.e.r;e.pinnedTopRowData!==void 0&&(t.pinnedTopRowData=e.pinnedTopRowData??[],this.e.me.setRows("top",t.pinnedTopRowData)),e.pinnedBottomRowData!==void 0&&(t.pinnedBottomRowData=e.pinnedBottomRowData??[],this.e.me.setRows("bottom",t.pinnedBottomRowData))}np(e,t,r){let i=this.e.r;t.needsColumnRebuild&&(this.e.n.Gr(i.columnDefs),this.e.Je(),t.needsHeaderRebuild=!1,t.needsPoolRebuild=!1),t.needsStateLoad&&(this.e.ys(),this.e.Je()),t.needsFeatureReload&&this.e.Wl(i.features),this.Rp(t),t.filterChanged&&(this.mn(),!t.datasourceChanged&&!t.needsRowRebuild&&(this.e.i.f?this.e.i.We():(this.e.i.w(),this.e.h({data:!0})))),t.needsRelayout&&this.e.o.Sp(i.rowHeight,i.headerHeight),e.columnMenu!=null&&e.columnMenu!==r&&(t.needsHeaderRebuild=!0),t.stateToApply&&this.Nl(t.stateToApply),this.e.h({layout:t.needsRelayout,header:t.needsHeaderRebuild,pool:t.needsPoolRebuild,cells:t.needsCellRefresh&&!t.needsPoolRebuild?!0:void 0,summary:t.needsSummaryRefresh,overlays:!0})}Rp(e){if(e.datasourceChanged){this.e.i.Sc();return}if(e.needsRowRebuild){if(this.e.i.f){this.e.i.We();return}this.e.i.ht(this.e.r.rowData),this.e.h({data:!0})}}Wh(e={}){let t=this.Ol({...e,target:"csv",protectFormulas:!1});return Hi(t,e)}Ol(e={}){let t=this.e.n.c().filter(o=>!o.hasCheckbox&&!o.isDetailToggle),r=e.includeHeader===!1?[]:[t.map(o=>o.colDef.headerName??o.colDef.field??o.id)];if(e.headersOnly)return r;let i=e.onlySelected?this.e.g.je().slice().sort((o,s)=>o.rowIndex-s.rowIndex):e.onlyAllDisplayed?this.e.i.pt():this.e.i.Wa();return[...r,...i.filter(o=>!o.isDetail&&!o.isGroup).map(o=>t.map(s=>{let a=ke(this.e,o,s,e.target??"xlsx");return e.protectFormulas===!1?a:oe(a)}))]}getState(){return{version:2,columns:this.Si(),sortModel:this.J(),filterModel:this.Q(),advancedFilterModel:this.Ie(),quickFilterText:this.$r(),pagination:{enabled:this.paginationEnabled(),page:this.getPage(),pageSize:this.getPageSize()},selectedRowIds:this.ji(),expandedRowIds:this.e.i.qc(),expandedGroupIds:this.e.i.Yc()}}Nl(e,t={}){if(this.e.s())return;let r=$(e);if(!r){this.e.reportError(new TypeError("[MachTable] GridState must use the current version 2 schema."),"gridState.apply");return}let i=["columns","sort","filter","pagination","selection","expansion"],o=new Set(t.sections??i);this.e.l.stop(!0),this.Mp(r,o),this.Ip(r,o),t.emitEvents!==!1&&this.Ap(o)}Mp(e,t){t.has("columns")&&this.e.n.Ca(e.columns??[]),t.has("sort")&&this.e.n.Nr(e.sortModel??[]),t.has("filter")&&(this.e.i.Wr(e.filterModel??{}),this.e.i.sr(e.advancedFilterModel),this.e.i.ar(e.quickFilterText)),t.has("expansion")&&this.e.i.Xc(e.expandedRowIds??[],e.expandedGroupIds??[]),t.has("pagination")&&e.pagination&&(this.e.r.paginationEnabled=e.pagination.enabled&&!this.e.i.f,this.e.i.$a(e.pagination.page,e.pagination.pageSize),this.e.br.ge())}Ip(e,t){t.has("columns")&&this.e.Je(),this.e.i.f?this.e.i.We():(this.e.i.w(),this.e.h({data:!0})),this.e.K.Cs(),this.e.K.fn(),t.has("selection")&&this.e.g.eu(e.selectedRowIds??[])}Ap(e){e.has("sort")&&this.e.emit("sortChanged",{sortModel:this.J()}),e.has("filter")&&this.mn(),e.has("pagination")&&this.e.emit("paginationChanged",{page:this.getPage(),pageSize:this.getPageSize(),pageCount:this.getPageCount(),total:this.getTotalRowCount()})}gs(){return this.e.gs()}Fh(){return this.e.le.snapshot()}Hh(){this.e.le.reset()}setOverlay(e){if(e!=="loading"&&e!=="noRows"&&e!=="error"){this.e.o.$l();return}let t=this.e.r,r=e==="loading"?t.overlayLoadingTemplate||this.e.Ul():e==="noRows"?t.overlayNoRowsTemplate||this.e.jl():t.overlayErrorTemplate||this.e.ql();this.e.o.Cn(e,r,t.allowUnsafeOverlayHtml)}on(e,t){return this.e.fe.on(e,t)}destroy(){this.Dt!=null&&clearTimeout(this.Dt),this.Dt=null;let e=this.si;this.si=[];for(let t of e)t.signal&&t.onAbort&&t.signal.removeEventListener("abort",t.onAbort),t.aborted||t.resolve();this.e.destroy()}},$s={rows:un,columns:hn,selection:pn,editing:fn,filtering:yn,sorting:vn,pagination:bn,hierarchy:wn,view:Cn,state:mn,io:Tn,diagnostics:gn};function En(n){let e=new Gr(n),t={};for(let[r,i]of Object.entries($s)){let o;Object.defineProperty(t,r,{enumerable:!0,get:()=>o??(o=Object.freeze(i(e)))})}return Object.assign(t,{batch:r=>e.batch(r),whenReady:()=>n.whenReady(),getOption:r=>e.getOption(r),updateOptions:r=>e.updateOptions(r),on:(r,i)=>e.on(r,i),destroy:()=>e.destroy(),isDestroyed:()=>n.s()}),Ji(t,n),Yi(t,{suspend:()=>n.suspend(),resume:()=>t.view.refreshLayout(),canReplaceData:()=>!n.l.isEditing()&&n.z.getDirtyRowIds().length===0,readCell:(r,i)=>{let o=n.i.$(r),s=n.n.k(i);return o&&s?Dr(ke(n,o,s,"clipboard")):""},writeInput:r=>n.vr(r.flatMap(({rowId:i,colId:o,value:s})=>{let a=n.i.$(i),l=n.n.k(o);return a&&l?[{node:a,column:l,oldValue:n.d(a,l),newValue:s}]:[]}))}),Object.freeze(t)}var Us=["compact","normal","large"],Ot=class{constructor(e){this.e=e;this.ui={left:[],center:[],right:[]};this.hr={};this.hi=null;this.Es=null;this.xs=!1;this.xn=null;this.Rs=[];this.Rn=null;this.wr=0;this.Yl=-1;this.Xl=-1;this.Zt=1;this.Cr=null}init(e,t){let r=["mach-root",`mach-size--${t.size}`];t.stripedRows&&r.push("mach-striped"),t.showCellBorders&&r.push("mach-cell-borders"),t.domLayout==="autoHeight"&&r.push("mach-dom-layout--auto-height"),this.root=f("div",r.join(" ")),this._l(t.className),this.root.style.setProperty("--mach-row-h",`${t.rowHeight}px`),this.root.style.setProperty("--mach-header-h",`${t.headerHeight}px`),this.root.setAttribute("role","grid"),this.root.tabIndex=0,this.zl(t),this.ci=f("div","mach-header"),this.ci.setAttribute("role","rowgroup"),this.ui={left:[],center:[],right:[]},this.Ts={},this.hr={};for(let i of["left","center","right"]){let o=f("div",`mach-pane mach-pane--${i} mach-header-pane`),s=f("div","mach-header-rows");if(i==="center"){let a=f("div","mach-header-viewport");a.appendChild(s),o.appendChild(a)}else o.appendChild(s);this.ci.appendChild(o),this.Ts[i]=o,this.hr[i]=s}this.Jl(1),this.Ee=f("div","mach-body"),this.Tn=f("div","mach-pinned-rows mach-pinned-rows--top"),this.Tn.style.display="none",this.Dn=f("div","mach-pinned-rows mach-pinned-rows--bottom"),this.Dn.style.display="none",this.M={},this.Re={},this.Ds={};for(let i of["left","center","right"]){let o=f("div",`mach-pane mach-pane--${i} mach-body-pane`),s=f("div",`mach-body-viewport${i==="center"?" mach-body-viewport--scroll":""}`),a=f("div","mach-row-container");s.appendChild(a),o.appendChild(s),this.Ee.appendChild(o),this.Ds[i]=o,this.M[i]=s,this.Re[i]=a}this.Ze=f("div","mach-overlay"),this.Ze.style.display="none",this.Ze.setAttribute("role","status"),this.Ze.setAttribute("aria-live","polite"),this.Qe=f("div","mach-overlay-content"),this.Ze.appendChild(this.Qe),this.Et=f("div","mach-infinite-loading"),this.Et.style.display="none",this.Et.appendChild(f("div","mach-spinner")),this.En=f("span"),this.Et.appendChild(this.En),this.root.append(this.ci,this.Tn,this.Ee,this.Dn,this.Ze,this.Et),e.appendChild(this.root),typeof ResizeObserver<"u"&&(this.Rn=new ResizeObserver(i=>{let o=i[i.length-1]?.contentRect;if(!o)return;let s=Math.round(o.width),a=Math.round(o.height);s===this.Yl&&a===this.Xl||(this.Yl=s,this.Xl=a,!this.wr&&(this.wr=requestAnimationFrame(()=>{this.wr=0,this.e.Te()})))}),this.Rn.observe(this.root)),this.Bl(t.theme)}zl(e){e.ariaLabelledBy?(this.root.setAttribute("aria-labelledby",e.ariaLabelledBy),this.root.removeAttribute("aria-label")):(this.root.removeAttribute("aria-labelledby"),this.root.setAttribute("aria-label",e.ariaLabel)),e.ariaDescribedBy?this.root.setAttribute("aria-describedby",e.ariaDescribedBy):this.root.removeAttribute("aria-describedby")}Jl(e){this.Zt=e;for(let t of["left","center","right"]){let r=this.hr[t],i=this.ui[t];for(;i.length<e;){let o=f("div","mach-header-row");o.setAttribute("role","row"),o.setAttribute("aria-rowindex",String(i.length+1)),o.style.top=`${i.length*this.e.r.headerHeight}px`,o.style.height=`${this.e.r.headerHeight}px`,r.appendChild(o),i.push(o)}for(;i.length>e;)i.pop().remove()}this.Zl()}Ss(){return this.Zt}Zl(){this.ci.style.height=`${this.Zt*this.e.r.headerHeight}px`;for(let e of["left","center","right"])this.ui[e].forEach((r,i)=>{r.style.top=`${i*this.e.r.headerHeight}px`,r.style.height=`${this.e.r.headerHeight}px`})}Lp(e,t){this.Ql("left",e),this.Ql("right",t)}Ql(e,t){let r=this.Ts[e],i=this.Ds[e];r.style.width=`${t}px`,i.style.width=`${t}px`;let o=t<=0;r.classList.toggle("mach-pane--hidden",o),i.classList.toggle("mach-pane--hidden",o)}vs(){let e=this.M.center,t=Math.max(0,e.offsetWidth-e.clientWidth);return Math.max(0,this.Ee.clientWidth-t)}Sp(e,t){this.root.style.setProperty("--mach-row-h",`${e}px`),this.root.style.setProperty("--mach-header-h",`${t}px`),this.Zl()}mp(e){for(let t of Us)this.root.classList.toggle(`mach-size--${t}`,t===e)}Bl(e){if(!this.root)return;this.Cr?.(),this.Cr=null;let t=e==="dark"||e==="auto"&&this.kp();if(this.root.classList.toggle("mach-theme-dark",t),e==="auto"&&typeof window<"u"&&typeof window.matchMedia=="function"){let r=window.matchMedia("(prefers-color-scheme: dark)"),i=()=>this.root.classList.toggle("mach-theme-dark",r.matches);typeof r.addEventListener=="function"?(r.addEventListener("change",i),this.Cr=()=>r.removeEventListener("change",i)):typeof r.addListener=="function"&&(r.addListener(i),this.Cr=()=>r.removeListener(i))}}kp(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-color-scheme: dark)").matches}hp(e){this.root.classList.toggle("mach-striped",e)}pp(e){this.root.classList.toggle("mach-cell-borders",e)}sp(e){this.root.classList.toggle("mach-dom-layout--auto-height",e==="autoHeight")}_l(e){for(let t of this.Rs)this.root.classList.remove(t);this.Rs=[];for(let t of String(e??"").split(/\s+/).filter(Boolean))this.root.classList.contains(t)||(this.root.classList.add(t),this.Rs.push(t))}Pp(e){try{return typeof e=="function"?e():e}catch(t){return this.e.reportError(t,"overlayTemplate"),""}}Gp(e,t,r){if(typeof t=="object"&&t!=null&&"el"in t){this.Qe.appendChild(t.el),this.xn=t.destroy??null;return}if(t instanceof HTMLElement){this.Qe.appendChild(t);return}if(t){r?this.Qe.innerHTML=t:this.Qe.textContent=t;return}if(e!=="loading")return;let i=f("div","mach-spinner");i.setAttribute("aria-label","loading"),this.Qe.appendChild(i)}Cn(e,t,r=!1){this.hi===e&&this.Es===t&&this.xs===r||(this.hi=e,this.Es=t,this.xs=r,this.Ms(),this.Qe.replaceChildren(),this.Gp(e,this.Pp(t),r),this.Ze.style.display="",this.root.classList.add("mach-has-overlay"),this.Ze.setAttribute("role",e==="error"?"alert":"status"),this.root.setAttribute("aria-busy",e==="loading"?"true":"false"))}$l(){this.hi&&(this.hi=null,this.Es=null,this.xs=!1,this.Ze.style.display="none",this.root.classList.remove("mach-has-overlay"),this.Ms(),this.Qe.replaceChildren(),this.root.setAttribute("aria-busy","false"))}Pt(e,t){this.Et&&(e?(this.En.textContent!==t&&(this.En.textContent=t),this.Et.style.display="",this.root.setAttribute("aria-busy","true")):(this.Et.style.display="none",this.hi!=="loading"&&this.root.setAttribute("aria-busy","false")))}destroy(){this.Cr?.(),this.Cr=null,this.Rn?.disconnect(),this.Rn=null,this.wr&&cancelAnimationFrame(this.wr),this.wr=0,this.Ms(),this.root?.remove()}Ms(){if(!this.xn)return;let e=this.xn;this.xn=null;try{e()}catch(t){this.e.reportError(t,"overlayTemplate.destroy")}}};var js={contains:"\u5305\u542B",notContains:"\u4E0D\u5305\u542B",equals:"=",notEquals:"\u2260",startsWith:"\u5F00\u5934",endsWith:"\u7ED3\u5C3E",blank:"\u4E3A\u7A7A",notBlank:"\u975E\u7A7A",lessThan:"<",lessThanOrEqual:"\u2264",greaterThan:">",greaterThanOrEqual:"\u2265",inRange:"\u8303\u56F4"};function Ft(n){if(!n)return"";if(n.type==="set")return`\u5DF2\u9009 ${n.values.length} \u9879`;let e=[];for(let r of n.conditions){let i=js[r.match]??r.match,o=r.value,s="value2"in r?r.value2:void 0;r.match==="blank"||r.match==="notBlank"?e.push(i):r.match==="inRange"&&o!=null?e.push(`${i} ${o}~${s??o}`):o!=null&&String(o)!==""?e.push(`${i} ${o}`):e.push(i)}let t=n.operator==="or"?" \u6216 ":" \u4E14 ";return e.join(t)}function xn(n,e){let t=0,r=n.length;for(;t<r;){let i=t+r>>1;n[i]<=e?t=i+1:r=i}return t}function qs(n,e){let t=0,r=n.length;for(;t<r;){let i=t+r>>1;n[i]<e?t=i+1:r=i}return t}var ye=class{constructor(){this.ye=new Float64Array(1)}update(e){let t=0,r=this.ye.length!==e.length+1;for(let o=0;o<e.length;o++)t+=e[o].currentWidth,!r&&this.ye[o+1]!==t&&(r=!0);if(!r)return!1;let i=new Float64Array(e.length+1);for(let o=0;o<e.length;o++)i[o+1]=i[o]+e[o].currentWidth;return this.ye=i,!0}ed(){return this.ye[this.ye.length-1]??0}xt(e){let t=Math.max(0,Math.min(Math.trunc(e),this.ye.length-1));return this.ye[t]??0}Np(e){let t=Math.max(0,this.ye.length-1);return t===0?-1:Math.min(t-1,Math.max(0,xn(this.ye,Math.max(0,e))-1))}td(e,t,r=2){let i=Math.max(0,this.ye.length-1);if(i===0||t<=0||this.ed()<=t)return{first:0,lastExcl:i};let o=Math.max(0,e),s=o+t,a=Math.max(0,xn(this.ye,o)-1),l=Math.min(i,qs(this.ye,s));return{first:Math.max(0,a-r),lastExcl:Math.min(i,l+r)}}};var Ys=".mach-header-resize, .mach-filter-btn, .mach-menu-btn, .mach-select-all";function Nr(n){return n instanceof HTMLElement&&n.closest(Ys)!=null}function Or(n){return n==="ArrowLeft"||n==="ArrowRight"}var Ht=class{constructor(e){this.e=e;this.oe=[];this.Sn=[];this.rd={left:[],center:[],right:[]};this.N=new ye;this.Mn=0;this.In=Number.MAX_SAFE_INTEGER}ai(){this.nd(),this.e.di.Ot();for(let l of this.oe){let d=mr(l.el);if(d)try{d()}catch(c){this.e.reportError(c,"headerComponent.destroy",{colId:l.column.id})}}this.oe=[],this.Sn=[];let e=this.e.n.pc();this.e.o.Jl(e);let t=l=>l.pinned==="left"?"left":l.pinned==="right"?"right":"center",r=(l,d,c)=>{let u=[];for(let h of l)if(h instanceof re){let p=r(h.children,d+1,c);p.length>0&&u.push({group:h,level:d,children:p})}else!h.hide&&t(h)===c&&u.push({column:h,level:d,children:[]});return u},i=this.e.n.hc(),o=this.e.n.T("center"),s=new Set(o.slice(this.Mn,this.In));for(let l of["left","center","right"]){let d=r(i,0,l);this.rd[l]=l==="center"?this.od(d,s):d}let a=this.e.r.headerHeight;for(let l of["left","center","right"]){let d=this.e.o.ui[l];for(let u of d)u.textContent="";let c=u=>{let h=d[Math.min(u.level,d.length-1)];if(u.column){let p=this.Op(u.column,e-u.level,a);h.appendChild(p.el),this.oe.push(p)}else if(u.group){let p=this.Fp(u.group);h.appendChild(p),this.Sn.push({group:u.group,el:p})}for(let p of u.children)c(p)};for(let u of this.rd[l])c(u)}this.e.r.suppressHeaderFocus||this.oe.forEach((l,d)=>{l.el.tabIndex=d===0?0:-1}),this.et(),this.Cs(),this.fn(),this.zi()}sd(){let e=this.Mn,t=this.In;this.nd(),(e!==this.Mn||t!==this.In)&&this.ai()}nd(){let e=this.e.n.T("center"),t=this.e.o.M.center;this.N.update(e);let r=e.length>20?this.N.td(t.scrollLeft,t.clientWidth,2):{first:0,lastExcl:e.length};this.Mn=r.first,this.In=r.lastExcl}od(e,t){let r=[];for(let i of e){if(i.column){t.has(i.column)&&r.push(i);continue}let o=this.od(i.children,t);o.length>0&&r.push({...i,children:o})}return r}Op(e,t,r){let i=f("div","mach-header-cell mach-header-cell--leaf");e.hasCheckbox&&i.classList.add("mach-header-cell--selection"),i.dataset.colId=e.id,i.setAttribute("role","columnheader"),i.style.height=`${t*r}px`,this.Hp(i,e),this.Vp(i,e);let o=this.Bp(i,e);this.zp(i,e);let s=f("span","mach-sort-indicator");i.appendChild(s);let{filterBtn:a,filterTagEl:l}=this._p(i,e);return this.Kp(i,e),this.Wp(i,e),this.$p(i,e),{column:e,el:i,sortEl:s,filterBtn:a,filterTagEl:l,selectAllEl:o}}Hp(e,t){let r=t.colDef;typeof r.headerClass=="string"?e.classList.add(r.headerClass):Array.isArray(r.headerClass)&&e.classList.add(...r.headerClass),r.headerTooltip&&e.setAttribute("title",r.headerTooltip);let i=r.headerAlign??r.align;i==="center"?e.classList.add("mach-header-cell--center"):i==="right"&&e.classList.add("mach-header-cell--right")}Vp(e,t){this.e.r.suppressHeaderFocus||(e.tabIndex=-1,e.addEventListener("mousedown",()=>this.Is(t)),e.addEventListener("keydown",r=>this.Up(r,t)))}Bp(e,t){if(!t.hasCheckbox||this.e.r.rowSelection!=="multiple")return;let r=document.createElement("input");return r.type="checkbox",r.className="mach-select-all",r.setAttribute("aria-label","select all rows"),r.addEventListener("click",i=>i.stopPropagation()),r.addEventListener("change",()=>{r.checked?this.e.g.selectAll(!0):this.e.g.deselectAll()}),e.appendChild(r),r}zp(e,t){let r=t.colDef,i=r.headerComponent,o;if(!i){this.As(e,r.headerName??r.field??t.id);return}try{o=i({colDef:r,column:t,api:this.e.api})}catch(s){this.e.reportError(s,"headerComponent",{colId:t.id}),o=null}this.jp(e,t,o)}jp(e,t,r){if(typeof r=="string"){this.As(e,r);return}if(r instanceof HTMLElement){this.ad(e,r);return}if(r&&typeof r=="object"&&r.el instanceof HTMLElement){this.ad(e,r.el),ui(e,r.destroy);return}let i=t.colDef;this.As(e,i.headerName??i.field??t.id)}As(e,t){let r=f("span","mach-header-label");r.textContent=t,e.appendChild(r)}ad(e,t){let r=f("span","mach-header-label mach-header-label--custom");r.appendChild(t),e.appendChild(r)}_p(e,t){if(!t.filterable)return{};let r=document.createElement("button");r.type="button",r.className="mach-filter-btn",r.setAttribute("aria-label",`filter ${t.id}`),r.innerHTML=mi,r.addEventListener("click",o=>{o.stopPropagation(),this.e.Ls.toggle(t,r)}),e.appendChild(r);let i=f("span","mach-filter-tag");return e.appendChild(i),{filterBtn:r,filterTagEl:i}}Kp(e,t){if(!this.e.r.columnMenu||t.hasCheckbox||t.colDef.suppressColumnMenu)return;let r=document.createElement("button");r.type="button",r.className="mach-menu-btn";let o=`${t.colDef.headerName??t.colDef.field??t.id} \xB7 ${this.e.y("columnSettings")}`;r.setAttribute("aria-label",o),r.title=o,r.innerHTML=vi,r.addEventListener("click",s=>{s.stopPropagation(),this.e.columnMenu.toggle(t,r)}),e.appendChild(r)}Wp(e,t){if(!this.ld(t))return;let r=f("div","mach-header-resize");r.setAttribute("aria-hidden","true"),r.addEventListener("pointerdown",i=>{i.button===0&&(i.preventDefault(),i.stopPropagation(),this.e.di.hu(i,t))}),r.addEventListener("dblclick",i=>{i.stopPropagation(),this.e.api.columns.autoSize(t.id)}),r.addEventListener("click",i=>i.stopPropagation()),e.appendChild(r)}$p(e,t){e.addEventListener("click",r=>{this.e.An.yu()||Nr(r.target)||t.sortable&&this.e.Mi(t,r.shiftKey)}),e.addEventListener("pointerdown",r=>{r.button!==0||Nr(r.target)||this.e.An.gu(r,t)})}Fp(e){let t=f("div","mach-header-cell mach-header-cell--group");e.groupId&&(t.dataset.groupId=e.groupId),t.setAttribute("role","columnheader");let r=e.def;typeof r.headerClass=="string"?t.classList.add(r.headerClass):Array.isArray(r.headerClass)&&t.classList.add(...r.headerClass);let i=f("span","mach-header-label mach-header-label--group");return i.textContent=e.headerName,t.appendChild(i),t}et(){let e={left:0,center:0,right:0};for(let t of["left","center","right"]){let r=this.e.o.ui[t],i=0,o=new Map;for(let a of this.e.n.T(t))o.set(a.id,i),i+=a.currentWidth;let s=this.e.r.headerHeight;for(let a of this.oe){if(this.e.n.er(a.column)!==t)continue;let l=o.get(a.column.id)??0;a.el.style.width=`${a.column.currentWidth}px`,a.el.style.left=`${l}px`,a.el.setAttribute("aria-colindex",String(this.e.n._e(a.column.id)+1))}for(let a of this.Sn){let l=this.qp(a.group,t);if(l.length===0)continue;let d=o.get(l[0].id)??0,c=0;for(let u of l)c+=u.currentWidth;a.el.style.left=`${d}px`,a.el.style.width=`${c}px`,a.el.style.height=`${s}px`,a.el.setAttribute("aria-colspan",String(l.length))}for(let a of r)a.style.width=`${i}px`;e[t]=i}this.e.o.Lp(e.left,e.right)}qp(e,t){return e.getLeafColumns().filter(r=>!r.hide&&this.e.n.er(r)===t)}Up(e,t){this.e.s()||this.Yp(e,t)||this.Xp(e,t)||this.Jp(e,t)||this.Zp(e,t)||this.Qp(e)}Yp(e,t){return e.key!=="Enter"&&e.key!==" "?!1:(Nr(e.target)||(e.preventDefault(),t.sortable&&this.e.Mi(t,e.shiftKey)),!0)}Xp(e,t){if(!e.altKey||!Or(e.key))return!1;if(!this.ld(t))return!0;let r=e.key==="ArrowRight"?24:-24;return this.e.n.Se(t,t.currentWidth+r),this.e.qe(),this.e.cr([t]),e.preventDefault(),!0}Jp(e,t){if(!e.ctrlKey||!Or(e.key))return!1;if(!t.movable)return!0;e.preventDefault();let r=this.e.n.er(t),i=this.e.n.T(r),o=i.indexOf(t),s=e.key==="ArrowRight"?1:-1,a=Math.max(0,Math.min(i.length-1,o+s));return a!==o&&this.e.At(t.id,a),!0}Zp(e,t){if(e.altKey||e.ctrlKey||e.metaKey||!Or(e.key))return!1;e.preventDefault();let r=this.e.n.c(),i=r.indexOf(t);if(i<0)return!0;let o=e.key==="ArrowRight"?1:-1,s=Math.max(0,Math.min(r.length-1,i+o));return this.Is(r[s]),!0}Qp(e){if(e.key!=="Home"&&e.key!=="End")return!1;e.preventDefault();let t=this.e.n.c();if(t.length===0)return!0;let r=e.key==="Home"?0:t.length-1;return this.Is(t[r]),!0}Is(e){let t=this.oe.find(r=>r.column.id===e.id);if(!t&&!e.pinned&&(this.ef(e),this.sd(),t=this.oe.find(r=>r.column.id===e.id)),!!t){for(let r of this.oe)r.el.tabIndex=r===t?0:-1;t.el.focus({preventScroll:!0})}}ef(e){let t=this.e.n.T("center"),r=t.indexOf(e);if(r<0)return;let i=this.e.o.M.center;this.N.update(t);let o=this.N.xt(r),s=o+e.currentWidth;o<i.scrollLeft?i.scrollLeft=o:s>i.scrollLeft+i.clientWidth&&(i.scrollLeft=s-i.clientWidth)}ld(e){return this.e.r.enableColumnResize&&e.resizable}Cs(){let e=this.e.n.J(),t=e.length>1;for(let r of this.oe){let i=e.findIndex(o=>o.colId===r.column.id);if(i>=0){let o=e[i].direction,s=t?`<span class="mach-sort-badge">${i+1}</span>`:"";r.sortEl.innerHTML=(o==="asc"?gi:yi)+s,r.el.setAttribute("aria-sort",o==="asc"?"ascending":"descending"),r.el.classList.add("mach-header-cell--sorted")}else r.sortEl.innerHTML="",r.el.removeAttribute("aria-sort"),r.el.classList.remove("mach-header-cell--sorted")}}fn(){let e=this.e.i.Q();for(let t of this.oe){if(!t.filterBtn)continue;let r=e[t.column.id],i=r!=null;if(t.filterBtn.classList.toggle("mach-filter-btn--active",i),t.filterTagEl){let o=i?Ft(r):"";t.filterTagEl.style.display=o?"":"none",o&&(t.filterTagEl.textContent=o)}}}zi(){for(let e of this.oe)e.selectAllEl&&(e.selectAllEl.checked=this.e.g.ou(),e.selectAllEl.indeterminate=this.e.g.su())}destroy(){for(let e of this.oe){let t=mr(e.el);if(t)try{t()}catch(r){console.error("[mach-table] headerComponent destroy error",r)}}this.oe=[],this.Sn=[]}};var Vt=class{constructor(){this.ve=null;this.tt=null;this.Tr=!1;this.ks=-1;this.Ps=-1}tf(){return this.ve}Dr(){return this.tt}rf(){return this.ve!=null}start(e,t){(!t||!this.ve)&&(this.ve={...e}),this.tt={...e},this.invalidate()}nf(e){return this.ve?!0:e.colIdx<0?!1:(this.ve={...e},this.invalidate(),!0)}setEnd(e){this.tt={...e},this.invalidate()}clear(){this.ve=null,this.tt=null,this.invalidate()}invalidate(){this.Tr=!1,this.ks=-1,this.Ps=-1}normalize(e,t){return this.Tr!==!1&&this.ks===e&&this.Ps===t?this.Tr:(this.ks=e,this.Ps=t,!this.ve||!this.tt||e<=0||t<=0?(this.Tr=null,null):(this.Tr={r1:Math.max(0,Math.min(this.ve.row,this.tt.row,e-1)),r2:Math.max(0,Math.min(Math.max(this.ve.row,this.tt.row),e-1)),c1:Math.max(0,Math.min(this.ve.colIdx,this.tt.colIdx,t-1)),c2:Math.max(0,Math.min(Math.max(this.ve.colIdx,this.tt.colIdx),t-1))},this.Tr))}};var Bt=class{constructor(e){this.host=e;this.Ne=null;this.de=0;this.Ln=0;this.gt=e=>{let t=this.Ne;if(!(!t||e.pointerId!==t.pointerId)){if(t.clientX=e.clientX,t.clientY=e.clientY,!t.active){if(Math.abs(e.clientY-t.startY)<5)return;t.active=!0,this.host.root.classList.add("mach-root--row-dragging"),this.host.root.querySelectorAll(".mach-row").forEach(r=>r.classList.toggle("mach-row--drag-source",this.sourceContains(r.dataset.id??"")))}this.cd()}};this.af=()=>{if(this.de=0,!!this.Ne?.active){if(!this.current()){this.destroy();return}this.Xr(),this.lf()&&this.cd()}};this.ke=e=>{let t=this.Ne;if(!(!t||e.pointerId!==t.pointerId)){t.clientX=e.clientX,t.clientY=e.clientY,t.active&&this.current()&&this.Xr(),this.ud();try{t.active&&t.drop?.valid&&this.Gs(e.clientX,e.clientY)&&this.current()&&this.commitDrop(t.drop)}finally{this.release()}}};this.dd=e=>{e.key==="Escape"&&(e.preventDefault(),this.destroy())};this.Ft=e=>{e.type==="pointercancel"&&e.pointerId!==this.Ne?.pointerId||this.destroy()}}begin(e){let t=this.host.containers.map(i=>{let o=f("div","mach-row-drop-indicator");return o.hidden=!0,i.append(o),o}),r=f("div","mach-row-drag-preview");r.setAttribute("role","status"),r.hidden=!0,this.host.root.append(r),this.Ne={startY:e.clientY,clientX:e.clientX,clientY:e.clientY,pointerId:e.pointerId,indicators:t,preview:r,drop:null,active:!1},window.addEventListener("pointermove",this.gt),window.addEventListener("pointerup",this.ke),window.addEventListener("pointercancel",this.Ft),window.addEventListener("keydown",this.dd),window.addEventListener("blur",this.Ft)}of(e){return this.Ne?.active===!0&&this.sourceContains(e)}sf(e,t=()=>!0){this.Ln=requestAnimationFrame(()=>{this.Ln=0,t()&&[...this.host.root.querySelectorAll(".mach-row-drag-handle")].find(r=>r.closest(".mach-row")?.dataset.id===e)?.focus()})}cd(){this.de||(this.de=requestAnimationFrame(this.af))}Gs(e,t,r=0){let i=this.host.body.getBoundingClientRect();return e>=i.left&&e<=i.right&&t>=i.top-r&&t<=i.bottom+r}lf(){let e=this.Ne;if(!e||!this.Gs(e.clientX,e.clientY,28))return!1;let t=this.host.viewport,r=t.getBoundingClientRect(),i=Math.min(36,r.height/3);if(i<=0)return!1;let o=e.clientY<r.top+i?-Math.ceil(14*E((r.top+i-e.clientY)/i,0,1)):Math.ceil(14*E((e.clientY-r.bottom+i)/i,0,1));if(this.host.scrollBy)return this.host.scrollBy(o);let s=t.scrollTop;return t.scrollTop=E(s+o,0,Math.max(0,t.scrollHeight-t.clientHeight)),t.scrollTop!==s}Xr(){let e=this.Ne;if(!e?.active)return;let t=e.clientY-this.host.viewport.getBoundingClientRect().top+this.host.viewport.scrollTop,r=this.describe(t);e.drop=r;let i=this.Gs(e.clientX,e.clientY);for(let s of e.indicators){if(s.hidden=!i||!r?.valid,!r)continue;s.dataset.dropPosition=r.position??"",s.style.cssText=r.style??"";let a=parseFloat(s.parentElement.style.height),l=Math.min(this.host.getRowTop(r.boundary),Number.isFinite(a)?Math.max(0,a-2):1/0);s.style.transform=`translate3d(0, ${l}px, 0)`}let o=this.host.root.getBoundingClientRect();e.preview.hidden=!1,e.preview.textContent=i?r?.text??this.outsideText():this.outsideText(),e.preview.style.transform=`translate3d(${E(e.clientX-o.left+16,8,Math.max(8,o.width-224))}px, ${E(e.clientY-o.top+16,8,Math.max(8,o.height-48))}px, 0)`}ud(){let e=this.Ne;this.Ne=null,window.removeEventListener("pointermove",this.gt),window.removeEventListener("pointerup",this.ke),window.removeEventListener("pointercancel",this.Ft),window.removeEventListener("keydown",this.dd),window.removeEventListener("blur",this.Ft),cancelAnimationFrame(this.de),this.de=0,this.host.root?.classList.remove("mach-root--row-dragging"),this.host.root?.querySelectorAll(".mach-row--drag-source").forEach(t=>t.classList.remove("mach-row--drag-source")),e?.indicators.forEach(t=>t.remove()),e?.preview.remove()}destroy(){this.ud(),this.release(),cancelAnimationFrame(this.Ln),this.Ln=0}};function Rn(n,e,t,r,i){let o=r==="before"?-1:1,s=t.rowIndex+o,a=e(s);for(;a&&(a===n||a.isDetail);)s+=o,a=e(s);let l=a&&!a.loading?a.id:null;return{rowIds:[n.id],targetId:t.id,position:r,beforeId:r==="before"?l:t.id,afterId:r==="before"?t.id:l,expectedRevision:i}}var zt=class extends Bt{constructor(t,r,i,o){super({get root(){return t.o.root},get body(){return t.o.Ee},get viewport(){return t.o.M.center},get containers(){return Object.values(t.o.Re)},getRowTop:r,findRowAt:i,scrollBy:o});this.e=t;this._t=null}pd(t){return!t.loading&&!t.treeLoading&&!t.isGroup}fd(t){if(this.e.l.isEditing()||t.isDetail||!this.pd(t)||t.data==null||this.e.n.nt().length||this.e.r.applyRowDrag&&!this.e.i.ja())return!1;let r=this.Er("canDrag",()=>this.e.r.rowDragPolicy?.canDrag?.({node:t,api:this.e.api})??!0,!1);return r!==!0?r:!this.e.i.F||!!Mr(this.e.api)}canDrag(t){return this.fd(t)===!0}isSource(t){return this.Ns()?.isSource(t)??this.of(t.id)}start(t,r){if(this.destroy(),!this.canDrag(r)||t.isPrimary===!1)return;let i=this.Ns();if(i){i.start(t,r);return}let o=this.Er("getRevision",()=>this.Os(r),null);o&&(this._t={node:r,from:r.rowIndex,guard:o},this.begin(t))}moveWithKeyboard(t,r){if(!t.altKey||t.key!=="ArrowUp"&&t.key!=="ArrowDown"||(t.preventDefault(),t.stopPropagation(),!this.canDrag(r)))return;let i=this.Ns();if(i){i.moveWithKeyboard(t,r);return}let o=t.key==="ArrowUp"?-1:1,s=r.rowIndex+o;for(;this.e.i.m(s)?.isDetail;)s+=o;let a=this.e.i.m(s),l=this.Er("getRevision",()=>this.Os(r),null);if(!(!a||!l)){this._t={node:r,from:r.rowIndex,guard:l};try{this.commitDrop(this.destination(a,o>0))&&this.sf(r.id)}finally{this.release()}}}Er(t,r,i){try{return r()}catch(o){return this.e.reportError(o,`rowDragPolicy.${t}`),i}}Os(t){let r=this.e.i,i=this.e.n.te(),o=this.e.r.rowDragPolicy,s=r.zr(),a=r.po(),l=this.e.r.applyRowDrag,d=o?.getRevision?.();return{revision:d,current:()=>this.Er("getRevision",()=>o?.getRevision?.()===d&&s===r.zr()&&a===r.po()&&r.$(t.id)===t&&i===this.e.n.te()&&o===this.e.r.rowDragPolicy&&l===this.e.r.applyRowDrag,!1)}}Ns(){let t=Mr(this.e.api);return t!==this.hd&&(this.kn?.destroy(),this.hd=t,this.kn=t?this.Er("driver",()=>t({...this.host,api:this.e.api,capture:r=>this.Os(r),emit:(r,i,o,s,a)=>{this.e.emit("rowDragEnd",{rowNode:r,fromIndex:i,toIndex:o,targetIndex:s,applied:!1,intent:a})},report:(r,i)=>this.e.reportError(r,`rowDragPolicy.${i}`)}),void 0):void 0),this.kn}current(){return this._t?.guard.current()??!1}release(){this._t=null}sourceContains(t){return this._t?.node.id===t}outsideText(){return this.e.r.locale.rowDragOutside??x.rowDragOutside}describe(t){let r=E(this.host.findRowAt(t),0,this.e.i.A()-1),i=this.e.i.m(r);if(i?.isDetail&&(i=this.e.i.$(i.masterId)),!i)return null;let o=this.host.getRowTop(i.rowIndex),s=this.host.getRowTop(i.rowIndex+1);return this.destination(i,t>=(o+s)/2)}destination(t,r){let i=this._t,o=t.rowIndex+Number(r);for(;this.e.i.m(o)?.isDetail;)o++;let s=this.e.r.rowDragPolicy,a=!this.e.r.applyRowDrag||s?.canDrop?Rn(i.node,u=>this.e.i.m(u),t,r?"after":"before",i.guard.revision):void 0,l=s?.canDrop&&a?this.Er("canDrop",()=>s.canDrop({node:i.node,api:this.e.api,targetNode:t,intent:a}),!1):!0,d=l===!0&&this.pd(t),c=typeof l=="string"?l:me(this.e.r.locale.rowDragPosition??x.rowDragPosition,i.from+1,this.md(i.from,o)+1);return{node:t,intent:a,boundary:o,valid:d,text:c,position:r?"after":"before"}}commitDrop(t){let r=this._t;if(!r||!this.current()||!this.canDrag(r.node)||!this.current())return!1;let i=this.destination(t.node,t.boundary>t.node.rowIndex);if(!i.valid||!this.current())return!1;let o=i.boundary>r.from?i.boundary-1:i.boundary;for(;this.e.i.m(o)?.isDetail;)o--;if(r.from===o)return!1;let s=this.e.r.applyRowDrag&&this.e.i.qa(r.from,o);return this.e.r.applyRowDrag&&!s?!1:(this.e.emit("rowDragEnd",{rowNode:r.node,fromIndex:r.from,toIndex:i.boundary,targetIndex:s?r.node.rowIndex:this.md(r.from,i.boundary),applied:s,intent:i.intent}),!0)}md(t,r){let i=t+1;for(;this.e.i.m(i)?.isDetail;)i++;return r>t?r-(i-t):r}destroy(){this.kn?.destroy(),super.destroy()}};var Xs=new Set(["warning","danger","success","info"]);function Ne(n,e,t=null){if(!(e.data==null||e.isGroup||e.isDetail||e.loading))for(let r of n.r.rowStyleRules)try{if(r.when({data:e.data,node:e,api:n.api,rowPinned:t})===!0)return r}catch(i){n.reportError(i,"rowStyleRules",{rowId:e.id})}}function ve(n,e){n.style.removeProperty("--mach-row-rule-bg"),n.style.removeProperty("--mach-row-rule-fg"),e?.tone&&Xs.has(e.tone)?n.dataset.rowTone=e.tone:delete n.dataset.rowTone,e?.backgroundColor&&n.style.setProperty("--mach-row-rule-bg",e.backgroundColor),e?.color&&n.style.setProperty("--mach-row-rule-fg",e.color),n.classList.toggle("mach-row--styled",!!e)}var _t=class{constructor(){this.se=new Float64Array(0);this.xr=new Float64Array(1);this.Fs=new WeakMap;this.Kt=new Map;this.Rt=0}reset(e,t){this.se=new Float64Array(e.length),this.xr=new Float64Array(e.length+1),this.Fs=new WeakMap,this.Kt=new Map,this.Rt=0;for(let r=0;r<e.length;r++){this.Fs.set(e[r],r);let i=Math.max(1,t(e[r],r));this.se[r]=i,this.Hs(i,1),this.add(r,i)}}get length(){return this.se.length}indexOf(e){return this.Fs.get(e)??-1}update(e,t){if(e<0||e>=this.se.length)return!1;let r=Math.max(1,t),i=r-this.se[e];return Math.abs(i)<.01?!1:(this.Hs(this.se[e],-1),this.se[e]=r,this.Hs(r,1),this.add(e,i),!0)}xt(e){let t=Math.max(0,Math.min(Math.trunc(e),this.se.length)),r=0;for(;t>0;)r+=this.xr[t],t-=t&-t;return r}Vs(){return this.xt(this.se.length)}df(){return this.Rt}findIndex(e){if(this.se.length===0)return 0;let t=Math.max(0,e),r=0,i=0,o=1;for(;o<<1<=this.se.length;)o<<=1;for(;o>0;){let s=r+o;s<=this.se.length&&i+this.xr[s]<=t&&(r=s,i+=this.xr[s]),o>>=1}return Math.min(r,this.se.length-1)}add(e,t){for(let r=e+1;r<this.xr.length;r+=r&-r)this.xr[r]+=t}Hs(e,t){let r=(this.Kt.get(e)??0)+t;if(r<=0?this.Kt.delete(e):this.Kt.set(e,r),this.Kt.size===0)this.Rt=0;else if(t>0&&(this.Rt===0||e<this.Rt))this.Rt=e;else if(t<0&&e===this.Rt&&!this.Kt.has(e)){let i=Number.POSITIVE_INFINITY;for(let o of this.Kt.keys())i=Math.min(i,o);this.Rt=Number.isFinite(i)?i:0}}};var Js=16e6,Kt=class{constructor(){this.height=0;this.Wt=0;this.Rr=0;this.Pn=NaN;this.Bs=0}configure(e,t,r=!0){this.height=r?Math.min(e,Js):e,this.Wt=Math.max(0,e-t),this.Rr=Math.max(0,this.height-t),this.Pn=NaN}get St(){return this.Wt>this.Rr}cf(e){return this.Wt?E(e,0,this.Wt)*this.Rr/this.Wt:0}read(e){return e!==this.Pn&&(this.Pn=e,this.Bs=this.Rr>0?E(e,0,this.Rr)*this.Wt/this.Rr:0),this.Bs}anchor(e,t){this.Bs=E(e,0,this.Wt),this.Pn=t}};var F=["left","center","right"];function Sn(n){return!!n&&!n.hasCheckbox&&!n.isDetailToggle&&!n.colDef.rowDrag}function Mn(n){let e=n.length>1&&n.every(i=>typeof i=="number"&&!Number.isNaN(i)),t=e?(n[n.length-1]-n[0])/(n.length-1):0,r=!e||n.every(i=>Number.isInteger(i));return{difference:t,integer:r,numeric:e,values:n}}function In(n,e){let t=n.values.length;if(t===1)return n.values[0];if(!n.numeric)return n.values[e%t];let r=n.values[t-1]+n.difference*(e-t+1);return n.integer?Math.round(r):Math.round(r*1e6)/1e6}var Wt=class{constructor(e){this.e=e;this.O=[];this.Oe=0;this.rt=0;this.Fe=-1;this.ne=0;this.zs=0;this._s=0;this.gd=0;this.I=new Kt;this.Mt=0;this.Ks=!1;this.Gn=-1;this.Y=new _t;this.N=new ye;this.V=new Vt;this.Nn=!1;this.Ws=0;this.$s=Number.MAX_SAFE_INTEGER;this.D=null;this.Us=()=>{this.ne||(this.ne=requestAnimationFrame(()=>{this.ne=0,this.gn()}))};this.Bn=0;this.zn=new WeakMap;this.Ut=new Set;this._n="";this.pi=[];this.Ys=null;this.qs=e=>{if(e.defaultPrevented||e.ctrlKey||e.metaKey||e.shiftKey||!e.deltaY||!e.cancelable)return;let t=this.e.o.M.center,r=e.deltaMode===1?this.e.r.rowHeight:e.deltaMode===2?t.clientHeight:1,i=this.I.read(t.scrollTop);this.Kn(i+e.deltaY*r),this.I.read(t.scrollTop)!==i&&(e.preventDefault(),t.scrollLeft+=e.deltaX*r,this.Us())};this.Hn=null;this.mi=null;this.ia=!1;this.hf=null;this.Un=e=>{let t=this.mi;if(!t)return;let r=e;if(typeof r.clientX!="number")return;if(!t.active){let s=Math.abs(r.clientX-t.startX),a=Math.abs(r.clientY-t.startY);if(s<4&&a<4)return;t.active=!0,t.axis=s>=a?"h":"v",this.e.o.root.classList.add("mach-root--filling")}if(t.axis==="v"){let s=this.Bd(r),a=this.V.Dr();a&&a.row!==s&&(this.V.setEnd({row:s,colIdx:a.colIdx}),this.qt(),this.e.emit("rangeSelectionChanged",{range:this.Xe()}));return}let i=Math.max(t.c2+1,this.zd(r)),o=this.V.Dr();o&&o.colIdx!==i&&(this.V.setEnd({row:o.row,colIdx:i}),this.qt(),this.it(),this.e.emit("rangeSelectionChanged",{range:this.Xe()}))};this.Mr=e=>{let t=this.mi;if(!t)return;let r=e,i=()=>{this.js()};if(!t.active){i();return}if(t.axis==="h"){let s=typeof r.clientX=="number"?Math.max(t.c2+1,this.zd(r)):t.c2+1;if(i(),s>t.c2)this.nm(t.r1,t.r2,t.c1,t.c2,s),this.it();else{let a=this.V.Dr();if(!a||a.colIdx===t.c2)return;this.V.setEnd({row:a.row,colIdx:t.c2}),this.qt()}return}let o=typeof r.clientY=="number"?this.Bd(r):t.r2;if(i(),o>t.r2)this.sm(t.r1,t.r2,t.c1,t.c2,o),this.it();else{let s=this.V.Dr();if(!s||s.row===t.r2)return;this.V.setEnd({row:t.r2,colIdx:s.colIdx}),this.qt()}};this.yd=e=>{if(this.e.s())return;let t=e.target,r=this.Yt(e);if(r&&!t.closest(".mach-cell-editor-shell, .mach-row-editor-shell, .mach-row-drag-handle")&&!(e.detail>1&&this.e.l.Qi())){if(this.e.l.Qi()){let i=r.cellEl?.dataset.colId??"";if(this.e.l.isEditing(r.index,i))return;this.e.l.he(!1).then(o=>{if(!o||this.e.s())return;this.Wd(e,t,r);let s=i?this.e.n.k(i):void 0;s&&!this.e.l.Qi()&&this.e.l.q(r.node,s)&&this.e.l.start(r.index,s)});return}this.Wd(e,t,r)}};this.vd=e=>{if(this.e.s()||e.target.closest(".mach-cell-editor-shell, .mach-row-editor-shell"))return;let t=this.Yt(e);if(!t)return;let{node:r,index:i,cellEl:o}=t;if(r.isDetail||r.isGroup||!o)return;let s=o.dataset.colId??"",a=this.e.n.k(s);if(!a)return;let l=this.e.d(r,a),d=this.e.emit("cellDoubleClicked",{event:e,rowNode:r,rowIndex:i,column:a,colDef:a.colDef,value:l});a.colDef.onCellDoubleClick?.(d),this.e.emit("rowDoubleClicked",{event:e,rowNode:r,rowIndex:i}),this.e.l.q(r,a)&&this.e.l.start(i,a)};this.bd=e=>{if(this.e.s())return;let t=this.Yt(e);if(!t||t.node.isDetail||t.node.isGroup||!t.cellEl)return;let{node:r,index:i,cellEl:o}=t,s=o.dataset.colId??"",a=this.e.n.k(s);if(a&&(this.e.emit("cellContextMenu",{event:e,rowNode:r,rowIndex:i,column:a,colDef:a.colDef,value:this.e.d(r,a)}),this.e.r.contextMenu)){if(e.preventDefault(),this.e.r.enableRangeSelection&&!this.Pe()){let l=this.e.n._e(s);l>=0&&this.ra(i,l,!1)}this.e.na.open(e.clientX,e.clientY,{rowIndex:i,colId:s})}};this.wd=e=>{if(!this.vm(e)&&this.e.r.enableRangeSelection&&e.button===0){let t=this.Yt(e);if(t&&!t.node.isDetail&&!t.node.isGroup&&t.cellEl&&!t.cellEl.classList.contains("mach-cell--selection")){let r=this.e.n._e(t.cellEl.dataset.colId??"");r>=0&&(this.ra(t.index,r,e.shiftKey),this.Nn=!0,!e.shiftKey&&!this.e.r.suppressCellFocus&&this.Ge(t.index,t.cellEl.dataset.colId??""))}}};this.Ed=()=>{this.Nn=!1};this.ni=e=>{if(this.e.s())return;let t=this.Yt(e);if(this.Nn&&t&&!t.node.isDetail&&!t.node.isGroup&&t.cellEl){let r=this.e.n._e(t.cellEl.dataset.colId??""),i=this.V.Dr();r>=0&&i&&(i.row!==t.index||i.colIdx!==r)&&this.ra(t.index,r,!0)}this.e.r.suppressRowHoverHighlight||!t||t.node.isDetail||this._d(t.index)};this.Cd=()=>{this._d(-1)};this.Td=e=>{if(this.e.s()||e.button!==0||!e.target.closest(".mach-row-drag-handle"))return;let r=this.Yt(e);!r||r.node.isDetail||r.node.isGroup||(this.$t.start(e,r.node),e.preventDefault())};this.Dd=e=>{if(!e.target.closest(".mach-row-drag-handle"))return;let t=this.Yt(e);t&&this.$t.moveWithKeyboard(e,t.node)};this.$t=new zt(e,t=>this.He(t)-this.Mt,t=>this.On(t+this.Mt,this.e.i.A()),t=>this.uf(t))}init(){let e=this.e.o.M.center;this.zs=e.scrollLeft,this._s=e.scrollTop,e.addEventListener("scroll",this.Us,{passive:!0});let t=this.e.o.Ee;t.addEventListener("click",this.yd),t.addEventListener("dblclick",this.vd),t.addEventListener("contextmenu",this.bd),t.addEventListener("mousedown",this.wd),t.addEventListener("mouseover",this.ni),t.addEventListener("mouseleave",this.Cd),t.addEventListener("pointerdown",this.Td),t.addEventListener("keydown",this.Dd),window.addEventListener("mouseup",this.Ed)}suspend(){cancelAnimationFrame(this.ne),this.ne=0,this.js(),this.$t.destroy(),this.Nn=!1}destroy(){cancelAnimationFrame(this.ne);let e=this.e.o.M.center;e.removeEventListener("scroll",this.Us),e.removeEventListener("wheel",this.qs);let t=this.e.o.Ee;t.removeEventListener("click",this.yd),t.removeEventListener("dblclick",this.vd),t.removeEventListener("contextmenu",this.bd),t.removeEventListener("mousedown",this.wd),t.removeEventListener("mouseover",this.ni),t.removeEventListener("mouseleave",this.Cd),t.removeEventListener("pointerdown",this.Td),t.removeEventListener("keydown",this.Dd),window.removeEventListener("mouseup",this.Ed),this.js(),this.$t.destroy();for(let r of this.O){r.detailRow&&this.Fn(r.detailRow);for(let i of F)for(let o of r.cells[i]??[])r.index>=0&&this.e.l.Xo(r.index,o.dataset.colId??"",o),k(this.e,o)}this.Hn?.remove(),this.hf?.remove(),this.O=[],this.Oe=0,this.pi=[],this.Ut.clear(),this.Y.reset([],()=>this.e.r.rowHeight),this.N.update([]),this.Ys=null}Bo(e){return e.pinned==="left"?"left":e.pinned==="right"?"right":"center"}gn(e=!1){if(this.e.s())return;let t=this.e.o,r=t.M.center,i=r.scrollLeft,o=r.scrollTop,s=this.I.read(o),a=e||i!==this.zs,l=e||o!==this._s||s!==this.gd;!a&&!l||(this.zs=i,this._s=o,this.gd=s,a&&(t.hr.center.style.transform=`translate3d(${-i}px, 0, 0)`,this.e.K.sd(),this.e.me.pf(i)),l&&this.xd(o),this.e.Vn.hide(),this.li(!1,a),l&&this.e.i.Rc(this.Fe-1))}ff(){let e={left:0,center:0,right:0};for(let t of F)e[t]=this.e.n.T(t).reduce((r,i)=>r+i.currentWidth,0);return e}yn(){let e=this.e.o,t=this.ff();this.N.update(this.e.n.T("center")),t.center=this.N.ed();let r=this.e.i.pt(),i=this.mf(r.length);this.gf(r,i);let o=this.yf(i);this.vf(t,o),this.bf(o),e.root.setAttribute("aria-rowcount",String(i.rowCount+e.Ss()))}mf(e){let t=this.e.i.ir(),r=this.e.r.rowHeight,i=this.e.r.masterDetail?[]:this.wf(),o=this.e.r.datasourceMode!=="block"&&(this.e.r.masterDetail||this.e.r.getRowHeight!=null||i.length>0),s=o?this.Cf(r,i):`fixed|${r}`;return{autoHeightColumns:i,positionedCount:Math.min(t,e),rowCount:t,rowHeight:r,signature:s,variable:o}}Cf(e,t){let r=t.map(i=>`${i.id}:${i.currentWidth}`).join(",");return`${this.e.i.po()}|${e}|${this.e.r.detailRowHeight}|${r}`}gf(e,t){if(!t.variable){this.Tf(t);return}if(t.signature!==this._n||this.Y.length!==t.positionedCount){let r=e.slice(0,t.positionedCount);this.Y.reset(r,i=>this.Rd(i,t.autoHeightColumns)),this.Sd(t);return}if(this.Ut.size!==0){for(let r of this.Ut){let i=this.Y.indexOf(r);i>=0&&this.Y.update(i,this.Rd(r,t.autoHeightColumns))}this.Sd(t)}}Tf(e){this.Y.length>0&&this.Y.reset([],()=>e.rowHeight),this._n=e.signature,this.Ut.clear(),this.Bn=e.rowHeight}Sd(e){this._n=e.signature,this.Ut.clear(),this.Bn=this.Y.df()||e.rowHeight}yf(e){return(e.variable?this.Y.Vs():e.positionedCount*e.rowHeight)+Math.max(0,e.rowCount-e.positionedCount)*e.rowHeight}vf(e,t){let r=this.e.o,i=r.M.center,o=this.I.read(i.scrollTop),s=this.I.St;this.I.configure(t,i.clientHeight,this.e.r.domLayout!=="autoHeight");let a=Math.max(0,i.clientWidth-e.left-e.right),l=Math.max(e.center,a);for(let d of F){let c=r.Re[d];c.style.height=`${this.I.height}px`,c.style.overflow=this.I.St?"hidden":"",d==="center"&&(c.style.width=`${l}px`)}(s||this.I.St)&&this.Kn(o),this.xd(i.scrollTop),this.Ks!==this.I.St&&(this.Ks=this.I.St,this.Ks?i.addEventListener("wheel",this.qs,{passive:!1}):i.removeEventListener("wheel",this.qs))}Kn(e){let t=this.e.o.M.center;t.scrollTop=this.I.cf(e),this.I.anchor(e,t.scrollTop)}xd(e){let t=this.I.St;for(let r of["left","right"]){let i=this.e.o.Re[r].style;i.top=t?`${-e}px`:"",i.transform=t?"":`translate3d(0, ${-e}px, 0)`}}uf(e){let t=this.e.o.M.center,r=this.I.read(t.scrollTop);this.Kn(r+e);let i=this.I.read(t.scrollTop)!==r;return i&&this.gn(),i}_i(e){this.zn.delete(e),this.Ut.add(e)}bf(e){this.e.o.Ee.style.height=this.e.r.domLayout==="autoHeight"?`${e}px`:""}vn(){this.zn=new WeakMap,this.Ut.clear(),this._n=""}Rd(e,t){if(e.isDetail)return this.e.r.detailRowHeight;let r=this.zn.get(e);if(r!==void 0)return r;let i=this.e.r.rowHeight,o=this.e.r.getRowHeight;if(o)try{let s=o({data:e.data,node:e,api:this.e.api});i=Number.isFinite(s)?Math.max(1,s||i):i}catch(s){this.e.reportError(s,"getRowHeight",{rowId:e.id})}return t.length>0&&(i=Math.max(i,this.Df(e,t))),this.zn.set(e,i),i}He(e){let t=this.Y.length;return t===0?Math.max(0,e)*this.e.r.rowHeight:e<=t?this.Y.xt(e):this.Y.Vs()+(e-t)*this.e.r.rowHeight}On(e,t){if(t<=0)return 0;let r=this.Y.length,i=this.Y.Vs();if(r>0&&e<i)return this.Y.findIndex(e);let o=r+Math.floor(Math.max(0,e-i)/this.e.r.rowHeight);return Math.max(0,Math.min(o,t-1))}wf(){return this.e.n.c().filter(e=>e.colDef.autoHeight===!0)}get Ef(){return this.e.n.c().some(e=>e.colDef.autoHeight===!0)}Df(e,t){var d;this[d="Ys"]??(this[d]=document.createElement("canvas"));let r=this.Ys.getContext("2d");if(!r)return 0;let i=window.getComputedStyle(this.e.o.root),o=parseFloat(i.fontSize)||13;r.font=`${i.fontStyle} ${i.fontWeight} ${o}px ${i.fontFamily}`;let s=parseFloat(i.getPropertyValue("--mach-cell-padding"))||9,a=Math.round(o*1.45),l=1;for(let c of t){let u=te(this.e,e,c);if(!u)continue;let h=Math.max(10,c.currentWidth-s*2-2),p=1,m=0;for(let b of u){let w=r.measureText(b).width;if(m>0&&m+w>h?(p++,m=w):m+=w,p>=12)break}p>l&&(l=p)}return l*a+Math.round(s*.9)}Rl(e,t){if(this.e.r.flashCells)for(let r of e)for(let i of t)this.pi.push([r,i])}Md(){if(this.pi.length===0)return;let e=this.pi;this.pi=[];for(let[t,r]of e){let i=this.tn(t,r);if(!i)continue;i.classList.remove("mach-cell--flash"),i.offsetWidth,i.classList.add("mach-cell--flash");let o=xe(i),s=o.flashTimer;s&&clearTimeout(s),o.flashTimer=window.setTimeout(()=>{i.classList.remove("mach-cell--flash"),o.flashTimer=void 0},800)}}Te(){this.yn();let e=this.e.o.M.center,r=this.e.r.rowHeight;this.e.r.masterDetail&&(r=Math.min(r,this.e.r.detailRowHeight)),this.Bn>0&&(r=Math.min(r,this.Bn));let i=Math.ceil(e.clientHeight/Math.max(1,r)),o=this.e.r.domLayout==="autoHeight"?this.e.i.A():i+this.e.r.rowBuffer*2+1,s=o%2===0?o:o+1;if(this.Id())for(let l of this.O)this.Xs(l,"center");s>this.Oe&&this.xf(s),this.Js(),this.li(!0,!1),this.Zs()}xf(e){for(;this.Oe<e;){let t={index:-1,nodeId:"",kind:"master",rows:{},cells:{},cellColIds:{}},r=this.e.o;for(let i of F){if(this.e.n.T(i).length===0)continue;let s=f("div","mach-row");s.style.height=`${this.e.r.rowHeight}px`,s.setAttribute("role","row"),s.style.display="none",r.Re[i].appendChild(s),t.rows[i]=s,t.cells[i]=[],t.cellColIds[i]=[],this.Xs(t,i)}if(this.e.r.masterDetail){let i=f("div","mach-row mach-detail-row");i.style.height=`${this.e.r.detailRowHeight}px`,i.setAttribute("role","row"),i.style.display="none",r.Re.center.appendChild(i),t.detailRow=i}this.O.push(t),this.Oe++}}Sr(e){let t=this.e.n.T(e);return e!=="center"||t.length<=20||this.e.n.ro()?t:t.slice(this.Ws,this.$s)}Rf(e){let t=f("div","mach-cell");if(t.dataset.colId=e.id,t.setAttribute("role","gridcell"),e.hasCheckbox){let r=document.createElement("input");r.type=this.e.r.rowSelection==="single"?"radio":"checkbox",r.className="mach-row-checkbox",r.type==="radio"&&(r.name=`mach-radio-${this.e.gridId}`),r.setAttribute("aria-label","select row"),t.appendChild(r),t.classList.add("mach-cell--selection")}return t}Xs(e,t){let r=e.rows[t];if(!r)return;let i=this.Sr(t),o=e.cells[t]??[],s=e.cellColIds[t]??[];if(s.length===i.length&&s.every((c,u)=>c===i[u].id))return;let a=new Map;s.forEach((c,u)=>a.set(c,o[u]));let l=[],d=[];for(let c of i){let u=a.get(c.id)??this.Rf(c);a.delete(c.id),r.appendChild(u),l.push(u),d.push(c.id)}for(let c of a.values())e.index>=0&&this.e.l.Xo(e.index,c.dataset.colId??"",c),k(this.e,c),c.remove();e.cells[t]=l,e.cellColIds[t]=d}bs(){this.fi=void 0,this.Ad();for(let e of this.O){e.detailRow&&this.Fn(e.detailRow);for(let t of F){for(let r of e.cells[t]??[])k(this.e,r);e.rows[t]?.remove()}e.detailRow?.remove()}this.O=[],this.Oe=0,this.rt=0,this.Fe=-1,this.Te()}Js(){let e=this.Sf();for(let t of F){let r=this.e.n.T(t),i=this.Sr(t),o=this.Mf(t,i,r);this.If(t,i,o,e)}this.Af()}Sf(){return this.e.r.masterDetail||this.e.r.getRowHeight!=null||this.Ef}Mf(e,t,r){let i=0;e==="center"&&t.length>0&&(this.N.update(r),i=this.N.xt(r.indexOf(t[0])));let o=[];for(let s of t)o.push(i),i+=s.currentWidth;return o}If(e,t,r,i){for(let o of this.O){let s=o.cells[e],a=o.rows[e];if(!s||!a)continue;i||(a.style.height=`${this.e.r.rowHeight}px`);let l=Math.min(t.length,s.length);for(let d=0;d<l;d++){let c=t[d];s[d].style.width=`${c.currentWidth}px`,s[d].style.left=`${r[d]}px`,s[d].setAttribute("aria-colindex",String(this.e.n._e(c.id)+1))}}}Af(){if(!this.e.r.masterDetail)return;let e=`${this.e.r.detailRowHeight}px`;for(let t of this.O)t.detailRow?.style.setProperty("--mach-detail-h",e)}Id(){let e=this.e.o.M.center,t=this.e.n.T("center"),r=this.Ws,i=this.$s;this.N.update(t);let o=t.length>20?this.N.td(e.scrollLeft,e.clientWidth,2):{first:0,lastExcl:t.length};return this.Ws=o.first,this.$s=o.lastExcl,o.first!==r||o.lastExcl!==i}mo(){return{first:this.rt,lastExcl:this.Fe}}li(e=!1,t=!0){let r=this.e.le.start();if(!this.Lf(e,t))return;let i=Math.max(0,this.Fe-this.rt),o=this.e.n.T("left").length+this.Sr("center").length+this.e.n.T("right").length;this.e.le.fh(r,i,o)}Lf(e,t){let r=this.e.o.M.center,i=this.I.read(r.scrollTop)-r.scrollTop,o=i!==this.Mt;this.Mt=i;let s=this.e.i.A(),a=this.e.r.rowBuffer,l=t?this.Id():!1;if(this.kf(l),s===0){for(let u of this.O)this.Qs(u);return this.rt=0,this.Fe=0,!0}if(this.Pf(s,e,l))return!0;let{first:d,lastExcl:c}=this.Gf(r,s,a);return!e&&!l&&d===this.rt&&c===this.Fe?(o&&(this.Ld(),this.it()),l||o):(this.rt=d,this.Fe=c,this.Nf(d,c),this.kd(d,c,e,l),o&&this.Ld(),this.it(),!0)}Gf(e,t,r){let i=this.I.read(e.scrollTop),o=this.On(i,t),s=i+e.clientHeight,a=Math.min(t,this.On(s,t)+1);return{first:E(o-r,0,t-1),lastExcl:E(a+r,1,t)}}Nf(e,t){for(let r of this.O)r.index!==-1&&(r.index<e||r.index>=t)&&this.Qs(r)}kd(e,t,r,i){for(let o=e;o<t;o++){let s=this.e.i.m(o),a=this.O[o%this.Oe];if(!(!a||!s)){if(!r&&a.index===o&&a.nodeId===s.id){i&&a.kind==="master"&&this.Wn(a,s,"center");continue}this.Of(a,o)}}}kf(e){if(e){for(let t of this.O)this.Xs(t,"center");this.Js()}}Pf(e,t,r){return this.e.r.domLayout!=="autoHeight"?!1:(!t&&!r&&this.rt===0&&this.Fe===e||(this.rt=0,this.Fe=e,this.kd(0,e,t,r)),!0)}Qs(e){this.Pd(e),this.D?.rowIndex===e.index&&this.e.o.root.removeAttribute("aria-activedescendant"),e.index=-1,e.nodeId="",e.kind="master";for(let t of F){let r=e.rows[t];r&&(r.style.display="none",delete r.dataset.id,delete r.dataset.index,ve(r,void 0),r.classList.remove("mach-row--drag-source"))}e.detailRow&&(this.Fn(e.detailRow),e.detailRow.style.display="none")}Of(e,t){e.index>=0&&e.index!==t&&this.Pd(e);let r=this.e.i.m(t);if(!r){this.Qs(e);return}e.index=t,e.nodeId=r.id;let i=this.He(t),o=i-this.Mt,s=this.He(t+1)-i;if(r.isDetail){this.Ff(e,r,t,o,s);return}this.Hf(e,r,t,o,s)}Ld(){for(let e of this.O){if(e.index<this.rt||e.index>=this.Fe)continue;let t=`translateY(${this.He(e.index)-this.Mt}px)`;for(let r of Object.values(e.rows))r.style.transform=t;e.detailRow&&(e.detailRow.style.transform=t)}}Ff(e,t,r,i,o){e.kind="detail";for(let a of F){let l=e.rows[a];l&&(l.style.display="none")}let s=e.detailRow;s&&(s.style.display="",s.style.transform=`translateY(${i}px)`,s.style.height=`${o}px`,s.dataset.index=String(r),s.setAttribute("aria-rowindex",String(r+this.e.o.Ss()+1)),this.ea(s,t))}Hf(e,t,r,i,o){e.kind="master",e.detailRow&&(e.detailRow.style.display="none");let s=this.Vf(t),a=Ne(this.e,t);for(let l of F){let d=e.rows[l];d&&(this.Bf(d,t,r,i,o,s),ve(d,a),this.Wn(e,t,l))}this.D&&this.D.rowIndex===r&&this.$n()}Vf(e){let t=this.e.i.F,r=e.isGroup===!0,i=t&&this.e.i.wo(e.id),o=r||i||this.e.r.masterDetail&&this.e.i.isRowExpandable(e),s=r?this.e.i.isGroupExpanded(e.id):this.e.i.isRowExpanded(e.id),a=null;return r?a=(e.groupLevel??0)+1:t&&(a=this.e.i.Co(e)+1),{expanded:s,expandable:o,level:a}}Bf(e,t,r,i,o,s){e.style.display="",e.style.transform=`translateY(${i}px)`,e.style.height=`${o}px`,e.dataset.index=String(r),e.dataset.id=t.id,e.setAttribute("aria-rowindex",String(r+this.e.o.Ss()+1)),this.Gd(e,t);let a=this.Gn===r&&!this.e.r.suppressRowHoverHighlight;e.classList.toggle("mach-row--hover",a),e.classList.toggle("mach-row--odd",r%2===1),e.classList.toggle("mach-row--drag-source",this.$t.isSource(t)),this.zf(e,s)}Gd(e,t){e.classList.toggle("mach-row--selected",t.selected),e.setAttribute("aria-selected",t.selected?"true":"false")}zf(e,t){t.expandable?e.setAttribute("aria-expanded",t.expanded?"true":"false"):e.removeAttribute("aria-expanded"),t.level!=null?e.setAttribute("aria-level",String(t.level)):e.removeAttribute("aria-level")}Wn(e,t,r){let i=this.Sr(r),o=e.cells[r];if(!o)return;let s=e.index,a=r==="center"&&this.e.n.ro(),l=0;e.rows[r]?.classList.toggle("mach-row--editing",this.e.l.en(s));for(let d=0;d<i.length;d++){let c=i[d],u=o[d];if(a&&l>0){l--,k(this.e,u),u.setAttribute("aria-hidden","true"),u.style.display!=="none"&&(u.style.display="none");continue}if(u.style.display==="none"&&(u.style.display=""),u.removeAttribute("aria-hidden"),a){let h=this._f(t,c,s,i.length-d);h>1?(l=h-1,this.Kf(u,i,d,h)):(u.removeAttribute("aria-colspan"),u.style.width!==`${c.currentWidth}px`&&(u.style.width=`${c.currentWidth}px`))}else u.removeAttribute("aria-colspan");this.e.l.gl(s,t,c,u)||(this.Nd(u,t,c),this.ta(u,s,c))}}_f(e,t,r,i){let o=t.colDef.colSpan;if(!o)return 1;try{let s=o({api:this.e.api,colDef:t.colDef,column:t,node:e,data:e.data,value:this.e.d(e,t),rowIndex:r});return Math.max(1,Math.min(Math.round(s)||1,i))}catch(s){return this.e.reportError(s,"colSpan",{colId:t.id,rowId:e.id}),1}}Kf(e,t,r,i){let o=0;for(let s=r;s<r+i&&s<t.length;s++)o+=t[s].currentWidth;e.style.width=`${o}px`,e.setAttribute("aria-colspan",String(i))}ea(e,t){this.Fn(e);let r=t.masterId!=null?this.e.i.$(t.masterId):t,i=f("div","mach-detail");e.appendChild(i);let o=this.e.r.detailRowRenderer;if(o){let s={data:t.data,node:r??t,api:this.e.api},a;try{a=o(s)}catch(l){this.e.reportError(l,"detailRowRenderer",{rowId:t.id}),a=null}typeof a=="string"?i.textContent=a:a instanceof HTMLElement?i.appendChild(a):a&&typeof a=="object"&&a.el instanceof HTMLElement&&(i.appendChild(a.el),di(e,a.destroy))}}Fn(e){let t=ci(e);if(t)try{t()}catch(r){this.e.reportError(r,"detailRowRenderer.destroy")}e.textContent=""}Nd(e,t,r){if(t.loading){k(this.e,e),e.className="mach-cell mach-cell--loading",e.setAttribute("aria-readonly","true"),e.setAttribute("aria-busy","true");let o=f("span","mach-cell-loading-bar");o.style.width=`${34+(r.id.length*13+t.rowIndex*7)%44}%`,e.replaceChildren(o),this.jt(e);return}e.removeAttribute("aria-busy"),e.setAttribute("aria-readonly",this.e.l.q(t,r)?"false":"true"),e.removeAttribute("aria-expanded"),e.removeAttribute("aria-level");let i=this.Wf(t,r);if(i!=="standard"){k(this.e,e),this.$f(i,e,t,r);return}je(this.e,e,t,r),Re(this.e,e,t,r),Ue(this.e,e,t,r),this.Od(e,t,r),this.Uf(e,t,r)}Wf(e,t){return e.isGroup?"group":t.isDetailToggle?"detail":t.hasCheckbox?"checkbox":t.colDef.rowDrag?"drag":pe(t.colDef,"index")?"index":this.e.i.F&&this.Fd()?.id===t.id?"tree":"standard"}$f(e,t,r,i){if(e==="group")this.jf(t,r,i);else if(e==="detail"){let o=this.e.i.isRowExpanded(r.id),s=f("span",`mach-detail-toggle${o?" mach-detail-toggle--open":""}`);s.textContent="\u25B6",t.replaceChildren(s),t.classList.add("mach-cell--detail-toggle"),this.jt(t)}else if(e==="checkbox"){let o=t.querySelector(".mach-row-checkbox");o&&(o.checked=r.selected,o.indeterminate=this.e.g.Zc(r.id),o.disabled=!this.e.g.Ue(r)),t.className!=="mach-cell mach-cell--selection"&&(t.className="mach-cell mach-cell--selection"),this.jt(t)}else if(e==="drag")this.qf(t,r),t.className!=="mach-cell mach-cell--drag"&&(t.className="mach-cell mach-cell--drag"),this.jt(t);else if(e==="index"){t.textContent=String(this.e.i.Ua(r)+this.e.r.indexOffset);let s=`mach-cell mach-cell--index${i.colDef.align==="right"?" mach-cell--right":i.colDef.align==="center"?" mach-cell--center":""}`;t.className!==s&&(t.className=s),this.Od(t,r,i)}else this.Yf(t,r,i)}Uf(e,t,r){if(this.e.r.editType!=="cell"||this.e.r.editableIndicator==="none"||!this.e.l.q(t,r))return;let i=document.createElement("button");i.type="button",i.className=`mach-cell-edit-trigger mach-cell-edit-trigger--${this.e.r.editableIndicator}`,i.tabIndex=-1,i.title="Edit cell",i.setAttribute("aria-label","Edit cell"),i.innerHTML='<svg viewBox="0 0 16 16" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m10.8 2.7 2.5 2.5L5.5 13H3v-2.5z"/><path d="m9.5 4 2.5 2.5"/></svg>',i.addEventListener("mousedown",o=>{o.preventDefault(),o.stopPropagation()}),i.addEventListener("click",o=>{o.preventDefault(),o.stopPropagation(),this.Ge(t.rowIndex,r.id),this.e.l.start(t.rowIndex,r)}),e.appendChild(i)}Pd(e){if(!(e.index<0))for(let t of F)for(let r of e.cells[t]??[])this.e.l.Xo(e.index,r.dataset.colId??"",r)}Fd(){return this.fi!==void 0?this.fi:(this.fi=this.e.n.c().find(e=>!e.hasCheckbox&&!e.isDetailToggle&&!e.colDef.rowDrag&&!pe(e.colDef,"index"))??null,this.fi)}Yf(e,t,r){let i=this.e.i.isRowExpandable(t),o=this.e.i.Co(t),s=q(this.e,t,r,this.e.d(t,r)),a=f("span","mach-tree-indent");a.style.width=`${o*16}px`;let l=f("span","mach-tree-cell");if(o>0&&l.appendChild(a),i){let c=this.e.i.isRowExpanded(t.id);e.setAttribute("aria-expanded",c?"true":"false"),e.setAttribute("aria-level",String(o+1));let u=t.treeLoading?" mach-detail-toggle--loading":t.treeLoadError?" mach-detail-toggle--error":"",h=document.createElement("button");h.type="button",h.tabIndex=-1,h.className="mach-tree-toggle",h.setAttribute("aria-label",t.treeLoadError?"Retry loading children":c?"Collapse row":"Expand row"),h.setAttribute("aria-expanded",String(c)),t.treeLoadError&&(h.title="Retry loading children");let p=f("span",`mach-detail-toggle${c?" mach-detail-toggle--open":""}${u}`);p.setAttribute("aria-hidden","true"),p.textContent="\u25B6",h.appendChild(p),h.addEventListener("keydown",m=>{(m.key==="Enter"||m.key===" ")&&m.stopPropagation()}),l.appendChild(h)}else{let c=f("span","mach-tree-toggle-spacer");l.appendChild(c)}let d=f("span","mach-tree-text");d.textContent=s,l.appendChild(d),e.replaceChildren(l),s&&!this.e.r.tooltipComponent?e.title=s:e.removeAttribute("title"),Re(this.e,e,t,r)}jt(e){e.style.height!==""&&(e.style.height=""),e.style.zIndex!==""&&(e.style.zIndex=""),e.style.display==="none"&&(e.style.display=""),e.removeAttribute("aria-rowspan")}Od(e,t,r){let i=this.e.i.jc(r.id);if(!i||t.isDetail){this.jt(e);return}let o=this.e.i.Ua(t)-1;if(o<0||o>=i.length){this.jt(e);return}let s=i[o];if(s===-1){e.style.display="none",e.setAttribute("aria-hidden","true");return}if(e.style.display==="none"&&(e.style.display=""),e.removeAttribute("aria-hidden"),s>1){let a=Math.min(o+s,this.e.i.A()),l=this.He(a)-this.He(o);e.style.height=`${l>0?l:s*this.e.r.rowHeight}px`,e.style.zIndex="1",e.setAttribute("aria-rowspan",String(s))}else this.jt(e)}jf(e,t,r){if(r.hasCheckbox){this.Xf(e,t);return}if(r.isDetailToggle){this.Hd(e);return}let i=this.e.n.va();if(i&&r.id===i.id){this.Jf(e,t);return}this.Zf(e,t,r)||this.Hd(e)}Xf(e,t){let r=e.querySelector(".mach-row-checkbox");if(r){let i=this.e.g.Xa(t);r.checked=i.all,r.indeterminate=i.some&&!i.all}e.className!=="mach-cell mach-cell--selection"&&(e.className="mach-cell mach-cell--selection")}Jf(e,t){let r=this.e.i.isGroupExpanded(t.id),i=t.groupLevel??0;e.setAttribute("aria-expanded",r?"true":"false"),e.setAttribute("aria-level",String(i+1));let o=f("span","mach-group-label");o.style.paddingLeft=`${i*16}px`;let s=f("span",`mach-detail-toggle${r?" mach-detail-toggle--open":""}`);s.textContent="\u25B6";let a=f("span","mach-group-text"),l=this.e.n.nt()[i],d=l?.colDef.headerName?`${l.colDef.headerName}: `:"";a.textContent=`${d}${t.groupKey??""}`;let c=f("span","mach-group-count");c.textContent=`(${t.leafNodes?.length??0})`,o.append(s,a,c),e.replaceChildren(o),e.className!=="mach-cell mach-cell--group"&&(e.className="mach-cell mach-cell--group")}Zf(e,t,r){if(!r.colDef.aggFunc||!t.aggValues||!Object.prototype.hasOwnProperty.call(t.aggValues,r.id))return!1;let i=t.aggValues[r.id];return e.textContent=r.colDef.valueFormatter!=null?q(this.e,t,r,i):gr(i),e.className!=="mach-cell mach-cell--num"&&(e.className="mach-cell mach-cell--num"),!0}Hd(e){e.textContent="",e.className!=="mach-cell"&&(e.className="mach-cell")}ft(e){if(this.e.s())return;let t=new Set;for(let r of e){if(r<0||t.has(r))continue;t.add(r);let i=this.O[r%this.Oe];if(!i||i.index!==r)continue;let o=this.e.i.m(r);if(o){if(i.kind==="detail"){i.detailRow&&this.ea(i.detailRow,o);continue}for(let s of F){let a=i.rows[s];a&&this.Gd(a,o),i.cells[s]&&this.Wn(i,o,s)}}}this.$n(),this.Md()}refreshCells(e={}){if(this.e.s())return;let t=e.rowIds==null?null:new Set(e.rowIds),r=e.rowIndexes==null?null:new Set(e.rowIndexes),i=e.columns==null?null:new Set(e.columns);for(let o of this.O){let s=this.e.i.m(o.index);!s||!this.Qf(o,s,t,r)||this.em(o,s,i,e.force===!0)}this.$n(),this.Md()}Qf(e,t,r,i){return e.index<0?!1:r==null&&i==null?!0:r?.has(t.id)===!0||i?.has(e.index)===!0}em(e,t,r,i){if(e.kind==="detail"){r==null&&e.detailRow&&this.ea(e.detailRow,t);return}let o=r==null||this.e.n.ro(),s=Ne(this.e,t);for(let a of F){let l=e.rows[a];l&&ve(l,s),o?this.Wn(e,t,a):this.tm(e,t,a,r,i)}}tm(e,t,r,i,o){let s=this.Sr(r),a=e.cells[r];if(a)for(let l=0;l<s.length;l++){let d=s[l];if(!i.has(d.id))continue;let c=a[l];c&&(this.e.l.gl(e.index,t,d,c)||(o&&k(this.e,c),this.Nd(c,t,d),this.ta(c,e.index,d)))}}rm(){this.e.s()||(this.D&&this.D.rowIndex>=this.e.i.A()&&this.Ge(null,null),this.Ad(),this.yn(),this.li(!0),this.it(),this.Zs(),this.e.ce.refresh())}Zs(){let e=this.e.r;if(e.loading){let t=e.overlayLoadingTemplate||this.e.Ul();this.e.o.Cn("loading",t,e.allowUnsafeOverlayHtml);return}if(e.error!=null){let t=e.overlayErrorTemplate||this.e.ql();this.e.o.Cn("error",t,e.allowUnsafeOverlayHtml);return}if(this.e.i.A()===0&&!e.suppressNoRowsOverlay){let t=e.overlayNoRowsTemplate||this.e.jl();this.e.o.Cn("noRows",t,e.allowUnsafeOverlayHtml);return}this.e.o.$l()}tn(e,t){let r=this.e.n.k(t);if(!r)return null;let i=this.Bo(r),o=this.O[e%Math.max(1,this.Oe)]?.cellColIds[i]?.indexOf(r.id)??-1;if(o<0)return null;let s=this.O[e%this.Oe];return!s||s.index!==e||s.kind!=="master"?null:s.cells[i]?.[o]??null}Ad(){this.V.invalidate()}Pe(){let e=this.e.i.A(),t=this.e.n.c().length;return this.V.normalize(e,t)}Zr(){let e=this.Pe();if(e)return e;let t=this.D;if(t){let r=this.e.n._e(t.colId);if(r>=0)return{r1:t.rowIndex,c1:r,r2:t.rowIndex,c2:r}}return null}Xe(){let e=this.Pe();if(!e)return null;let t=this.e.n.c();return{row1:e.r1,row2:e.r2,colId1:t[e.c1]?.id??"",colId2:t[e.c2]?.id??""}}Wo(){let e=this.V.tf();if(e)return{row:e.row,colIdx:e.colIdx};let t=this.Zr();return t?{row:t.r1,colIdx:t.c1}:null}pr(){let e=this.Pe();this.V.clear(),e&&(this.qt(),this.it(),this.e.emit("rangeSelectionChanged",{range:null}))}qt(){for(let e of this.O)if(!(e.index<0||e.kind!=="master"))for(let t of F){let r=this.Sr(t);e.cells[t]?.forEach((i,o)=>{let s=r[o];s&&this.ta(i,e.index,s)})}}ra(e,t,r){this.V.start({row:e,colIdx:t},r),this.qt(),this.it(),this.e.emit("rangeSelectionChanged",{range:this.Xe()})}Mu(e,t){if(!this.V.rf()){let a=this.D;if(!a)return;let l=this.e.n._e(a.colId);if(!this.V.nf({row:a.rowIndex,colIdx:l}))return}let r=this.e.i.A(),i=this.e.n.c().length;this.V.setEnd({row:Math.max(0,Math.min(e,r-1)),colIdx:Math.max(0,Math.min(t,i-1))}),this.qt(),this.it();let o=this.e.n.c(),s=this.V.Dr();s&&s.colIdx<o.length&&this.Ge(s.row,o[s.colIdx].id),this.e.emit("rangeSelectionChanged",{range:this.Xe()})}ta(e,t,r){let i=this.Pe();if(!i){e.classList.contains("mach-cell--range")&&e.classList.remove("mach-cell--range","mach-cell--range-top","mach-cell--range-bottom","mach-cell--range-left","mach-cell--range-right");return}let o=this.e.n._e(r.id);if(o<0)return;let s=t>=i.r1&&t<=i.r2&&o>=i.c1&&o<=i.c2;e.classList.toggle("mach-cell--range",s),s?(e.classList.toggle("mach-cell--range-top",t===i.r1),e.classList.toggle("mach-cell--range-bottom",t===i.r2),e.classList.toggle("mach-cell--range-left",o===i.c1),e.classList.toggle("mach-cell--range-right",o===i.c2)):e.classList.remove("mach-cell--range-top","mach-cell--range-bottom","mach-cell--range-left","mach-cell--range-right")}im(){if(this.Hn)return this.Hn;let e=f("div","mach-fill-handle");return e.style.display="none",e.addEventListener("pointerdown",t=>{this.ia=!0,this.Vd(t)}),e.addEventListener("mousedown",t=>{this.ia||this.Vd(t)}),this.e.o.Re.center.appendChild(e),this.Hn=e,e}it(){let e=this.im(),t=this.Pe();if(!this.e.r.enableRangeSelection||!this.e.r.fillHandle||!t){e.style.display="none";return}let r=this.e.n,i=r.T("left").length,o=r.T("center");if(t.c2<i||t.c2>=i+o.length){e.style.display="none";return}let s=t.c2-i;this.N.update(o);let a=this.N.xt(s+1),l=this.He(Math.min(t.r2+1,this.e.i.A()))-this.Mt,d=this.e.o.M.center;if(this.I.St&&(l<d.scrollTop||l>d.scrollTop+d.clientHeight)){e.style.display="none";return}e.style.display="",e.style.left=`${this.I.St?Math.min(a-4,parseFloat(this.e.o.Re.center.style.width)-8):a-4}px`,e.style.top=`${Math.min(l-4,this.I.height-8)}px`}Vd(e){if(this.e.s()||e.button!==0)return;let t=this.Pe();t&&(e.preventDefault(),e.stopPropagation(),this.mi={r1:t.r1,r2:t.r2,c1:t.c1,c2:t.c2,startX:e.clientX,startY:e.clientY,axis:null,active:!1},window.addEventListener("pointermove",this.Un),window.addEventListener("mousemove",this.Un),window.addEventListener("pointerup",this.Mr),window.addEventListener("mouseup",this.Mr),window.addEventListener("pointercancel",this.Mr))}Bd(e){let r=this.e.o.Re.center.getBoundingClientRect(),i=e.clientY-r.top+this.Mt,o=this.e.i.A(),s=this.On(i,o);return Math.max(this.mi.r2,Math.min(s,o-1))}zd(e){let r=this.e.o.Re.center.getBoundingClientRect(),i=e.clientX-r.left,o=this.e.n,s=o.T("left").length,a=o.T("center");this.N.update(a);let l=this.N.Np(i);if(l<0)return s;let d=this.N.xt(l)+a[l].currentWidth/2;return i<d?s+l:l+1<a.length?s+l+1:s+a.length-1}js(){this.mi=null,this.ia=!1,window.removeEventListener("pointermove",this.Un),window.removeEventListener("mousemove",this.Un),window.removeEventListener("pointerup",this.Mr),window.removeEventListener("mouseup",this.Mr),window.removeEventListener("pointercancel",this.Mr),this.e.o.root.classList.remove("mach-root--filling")}nm(e,t,r,i,o){let s=this.e.n.c(),a=[];for(let l=e;l<=t;l++)this.om(l,r,i,o,s,a);this.e.vr(a),this.e.emit("rangeSelectionChanged",{range:this.Xe()})}om(e,t,r,i,o,s){let a=this.e.i.m(e);if(!a||a.isDetail||a.isGroup)return;let l=[];for(let c=t;c<=r;c++){let u=o[c];l.push(u?this.e.d(a,u):void 0)}let d=Mn(l);for(let c=r+1;c<=i;c++){let u=o[c];if(!Sn(u)||!this.e.l.q(a,u))continue;let h=In(d,c-t),p=this.e.d(a,u);s.push({node:a,column:u,oldValue:p,newValue:h})}}sm(e,t,r,i,o){let s=this.e.n.c(),a=[];this.am(e,t,r,i,o,s,a),this.e.vr(a),this.e.emit("rangeSelectionChanged",{range:this.Xe()})}am(e,t,r,i,o,s,a){for(let l=r;l<=i;l++){let d=s[l];Sn(d)&&this.lm(d,e,t,o,a)}}lm(e,t,r,i,o){let s=this.dm(e,t,r);if(s.length===1&&s[0]===void 0)return;let a=Mn(s);for(let l=r+1;l<=i;l++){let d=this.e.i.m(l);if(!d||d.isDetail||d.isGroup||!this.e.l.q(d,e))continue;let c=In(a,l-t),u=this.e.d(d,e);o.push({node:d,column:e,oldValue:u,newValue:c})}}dm(e,t,r){let i=[];for(let o=t;o<=r;o++){let s=this.e.i.m(o);i.push(s?this.e.d(s,e):void 0)}return i}Ge(e,t){if(this.cm(),e==null||t==null){this.D=null;return}this.D={rowIndex:e,colId:t},this.$n(),this.um()}$n(){if(!this.D)return;let e=this.tn(this.D.rowIndex,this.D.colId);if(e){let t=Math.max(0,this.e.n._e(this.D.colId));e.id=`mach-grid-${this.e.gridId}-r${this.D.rowIndex}-c${t}`,e.classList.add("mach-cell--focus"),this.e.o.root.setAttribute("aria-activedescendant",e.id)}}cm(){if(this.D){let e=this.tn(this.D.rowIndex,this.D.colId);e&&(e.classList.remove("mach-cell--focus"),e.removeAttribute("id"))}this.e.o.root.removeAttribute("aria-activedescendant")}um(){if(!this.D)return;this.dr(this.D.rowIndex,"nearest");let e=this.e.n.k(this.D.colId);if(!e||e.pinned)return;let t=this.e.o.M.center,r=this.e.n.T("center");this.N.update(r);let i=this.N.xt(r.indexOf(e)),o=t.scrollLeft,s=t.clientWidth;i<o?t.scrollLeft=i:i+e.currentWidth>o+s&&(t.scrollLeft=i+e.currentWidth-s)}dr(e,t="top"){let r=this.e.o.M.center,i=this.e.i.A();if(i===0)return;let o=E(e,0,i-1),s=r.clientHeight,a=this.I.read(r.scrollTop),l=this.He(o),d=this.He(o+1),c=a;t==="top"?c=l:t==="bottom"?c=d-s:t==="middle"?c=l-(s-(d-l))/2:l<a?c=l:d>a+s&&(c=d-s);let u=Math.max(0,this.He(i)-s);this.Kn(E(c,0,u)),this.gn()}_d(e){if(this.Gn===e)return;let t=this.Gn;this.Gn=e,this.Kd(t,!1),this.Kd(e,!0)}Kd(e,t){if(e<0)return;let r=this.O[e%this.Oe];if(!(!r||r.index!==e||r.kind!=="master"))for(let i of F)r.rows[i]?.classList.toggle("mach-row--hover",t)}gi(){this.e.o.root.focus({preventScroll:!0})}Yt(e){let t=e.target,r=t.closest(".mach-row");if(!r)return null;let i=Number(r.dataset.index);if(Number.isNaN(i))return null;let o=this.e.i.m(i);if(!o)return null;let s=t.closest(".mach-cell");return{node:o,index:i,cellEl:s}}Wd(e,t,r){let{node:i,index:o,cellEl:s}=r;if(this.hm(t,i,s)||this.pm(t,i,s))return;let a=s?.dataset.colId??"",l=a?this.e.n.k(a):void 0;this.fm(i,l)||i.isDetail||this.mm(t,i,o,e)||!s||!l||(this.gi(),this.e.r.suppressCellFocus||this.Ge(o,a),this.e.g.Za(i,e,!1),this.gm(e,i,o,l),this.ym(i,o,l))}hm(e,t,r){if(!t.isGroup)return!1;if(this.gi(),e.closest(".mach-row-checkbox")){let o=this.e.g.Xa(t).all;return this.e.g.tu(t,!o),!0}let i=this.e.n.va();return(!i||!r||r.dataset.colId===i.id)&&this.e.i.Ao(t.id),!0}fm(e,t){return!t?.isDetailToggle||e.isDetail?!1:(this.gi(),this.e.$i(e.id),!0)}mm(e,t,r,i){let o=e.closest(".mach-cell--selection");return o?(this.gi(),this.e.r.suppressCellFocus||this.Ge(r,o.dataset.colId??""),this.pr(),this.e.g.Za(t,i,!0),!0):!1}gm(e,t,r,i){let o=this.e.d(t,i),s=this.e.emit("cellClicked",{event:e,rowNode:t,rowIndex:r,column:i,colDef:i.colDef,value:o});i.colDef.onCellClick?.(s),this.e.emit("rowClicked",{event:e,rowNode:t,rowIndex:r})}ym(e,t,r){(this.e.r.singleClickEdit||r.colDef.singleClickEdit===!0)&&this.e.l.q(e,r)&&this.e.l.start(t,r)}pm(e,t,r){if(!this.e.i.F||!e.closest(".mach-tree-toggle"))return!1;let i=this.Fd();return!i||r?.dataset.colId!==i.id||!this.e.i.isRowExpandable(t)?!1:(this.gi(),t.treeLoadError?this.e.i.loadTreeChildren(t.id,!0).catch(()=>{}):this.e.i.$i(t.id),!0)}vm(e){return!!(e.target.closest(".mach-cell-editor-shell, .mach-row-editor-shell, .mach-tree-toggle, .mach-row-drag-handle")||this.e.l.Qi())}qf(e,t){let r=e.querySelector("button.mach-row-drag-handle"),i=r?.value===t.id?r:f("button","mach-row-drag-handle");i.type="button",i.value=t.id;let o=this.$t.fd(t);i.disabled=o!==!0;let s=this.e.r.locale.rowDragHandle??x.rowDragHandle;i.setAttribute("aria-label",s),i.title=typeof o=="string"?o:i.disabled?this.e.r.locale.rowDragUnavailable??x.rowDragUnavailable:s,i.setAttribute("aria-keyshortcuts","Alt+ArrowUp Alt+ArrowDown"),i!==r&&e.replaceChildren(i)}};var $t=class{constructor(e){this.e=e;this.Ve=null;this.$d={left:void 0,center:void 0,right:void 0};this.oa={left:[],center:[],right:[]}}init(){this.Ve=f("div","mach-footer"),this.Ve.style.display="none",this.Ve.setAttribute("role","row"),this.e.o.root.appendChild(this.Ve);for(let e of["left","center","right"]){let t=f("div",`mach-footer-row mach-footer-row--${e}`);t.style.height=`${this.e.r.rowHeight}px`,this.Ve.appendChild(t),this.$d[e]=t}}setVisible(e){this.Ve&&(this.Ve.style.display=e?"":"none")}refresh(){if(!this.Ve||this.e.s())return;let e=this.e.r.showSummary;if(this.setVisible(e),!e)return;let t=this.e.r.summaryMethod,r=this.e.i.pt().filter(o=>!o.isDetail&&!o.isGroup),i={...x,...this.e.r.locale};for(let o of["left","center","right"]){let s=this.e.n.T(o),a=this.$d[o];this.oa[o].length!==s.length&&(a.textContent="",this.oa[o]=s.map(()=>{let d=f("div","mach-footer-cell");return d.setAttribute("role","cell"),a.appendChild(d),d}));let l=0;s.forEach((d,c)=>{let u=this.oa[o][c];if(u.style.left=`${l}px`,u.style.width=`${d.currentWidth}px`,l+=d.currentWidth,d.hasCheckbox||d.isDetailToggle||d.colDef.rowDrag){u.textContent="";return}if(t)try{u.textContent=t({colId:d.id,column:d,values:r.map(h=>this.e.d(h,d))})}catch(h){this.e.reportError(h,"summaryMethod",{colId:d.id}),u.textContent=""}else c===0&&o==="left"?u.textContent=K(i.totalRowsLabel,r.length):u.textContent=""})}}destroy(){this.Ve?.remove(),this.Ve=null}};var Ut=class{constructor(e){this.e=e;this.C=null;this.jn=null;this.sa=null;this.Ir=null;this.Xt=null;this.yi=null;this.vi=null;this.bi=null;this.wi=null;this.Jt=[]}init(){this.C=f("div","mach-pagination"),this.C.style.display="none",this.C.setAttribute("role","navigation");let e=(t,r,i)=>{let o=f("button",`mach-pagination-btn ${t}`);return o.type="button",o.title=r,o.setAttribute("aria-label",r),o.textContent=i,o};this.jn=f("span","mach-pagination-total"),this.yi=e("mach-pagination-first",this.t("pageFirst"),"\xAB"),this.vi=e("mach-pagination-prev",this.t("pagePrev"),"\u2039"),this.sa=f("span","mach-pagination-page"),this.bi=e("mach-pagination-next",this.t("pageNext"),"\u203A"),this.wi=e("mach-pagination-last",this.t("pageLast"),"\xBB"),this.yi.addEventListener("click",()=>this.e.i.setPage(1)),this.vi.addEventListener("click",()=>this.e.i.setPage(this.e.i.qr()-1)),this.bi.addEventListener("click",()=>this.e.i.setPage(this.e.i.qr()+1)),this.wi.addEventListener("click",()=>this.e.i.setPage(this.e.i.getPageCount())),this.C.append(this.jn,this.yi,this.vi,this.sa,this.bi,this.wi),this.e.r.paginationShowSizeSelector&&(this.Xt=Z({ariaLabel:"page size",options:[],classNames:{root:"mach-pagination-size-control",native:"mach-pagination-size"},themeSource:this.e.o.root,onChange:t=>{let r=Number(t);Number.isNaN(r)||this.e.i.setPageSize(r)}}),this.Ir=this.Xt.native,this.Ud(),this.C.appendChild(this.Xt.el)),this.e.o.root.appendChild(this.C),this.Jt.push(this.e.fe.on("modelUpdated",()=>this.refresh()),this.e.fe.on("paginationChanged",()=>this.refresh())),this.refresh()}Ud(){if(!this.Ir)return;let e=this.e.r.paginationPageSizeOptions,t=this.e.r.paginationPageSize;e.includes(t)||(e.push(t),e.sort((r,i)=>r-i)),this.Xt?.setOptions(e.map(r=>({value:String(r),label:K(this.t("perPage"),r)})),String(t))}t(e){return this.e.r.locale?.[e]??x[e]}ge(){this.C&&(this.Ir&&this.e.r.paginationShowSizeSelector&&this.Ud(),this.refresh())}jd(e,t){e&&e.textContent!==t&&(e.textContent=t)}bm(e,t){let r=e<=1,i=e>=t;this.yi&&(this.yi.disabled=r),this.vi&&(this.vi.disabled=r),this.bi&&(this.bi.disabled=i),this.wi&&(this.wi.disabled=i)}refresh(){if(!this.C||this.e.s())return;let e=this.e.i,t=e.Ae,r=e.getTotalRowCount(),i=t&&r>0;if(this.C.style.display=i?"":"none",!i)return;let o=e.qr(),s=e.getPageCount();this.jn&&this.e.r.paginationShowTotal&&this.jd(this.jn,K(this.t("paginationTotal"),r)),this.jd(this.sa,me(this.t("paginationPage"),o,s)),this.bm(o,s),this.Ir&&Number(this.Ir.value)!==this.e.r.paginationPageSize&&this.Xt?.setValue(String(this.e.r.paginationPageSize))}destroy(){for(let e of this.Jt)e();this.Jt=[],this.Xt?.destroy(),this.Xt=null,this.Ir=null,this.C?.remove(),this.C=null}};var ce=["left","center","right"],jt=class{constructor(e){this.e=e;this.top=null;this.bottom=null}init(){this.top=this.qd(this.e.o.Tn),this.bottom=this.qd(this.e.o.Dn)}qd(e){let t={root:e,segments:{left:f("div"),center:f("div"),right:f("div")},centerViewport:f("div","mach-pinned-viewport"),rowWrappers:{left:[],center:[],right:[]},cells:[],data:[]};for(let r of ce)t.segments[r].className=`mach-pinned-seg mach-pinned-seg--${r}`,r!=="center"&&t.segments[r].classList.add("mach-pane--hidden"),r==="center"&&t.centerViewport.appendChild(t.segments[r]);return e.append(t.segments.left,t.centerViewport,t.segments.right),t}setData(e,t){this.e.s()||!this.top||!this.bottom||(this.top.data=e??[],this.bottom.data=t??[],this.ge(),this.et(),this.e.Te())}setRows(e,t){let r=this[e];this.e.s()||!r||(r.data=t??[],this.aa(r,e),this.et(),this.e.Te())}getRows(e){return this[e]?.data.slice()??[]}ge(){!this.top||!this.bottom||(this.aa(this.top,"top"),this.aa(this.bottom,"bottom"))}aa(e,t){for(let o of e.cells)for(let s of ce)for(let a of o[s])k(this.e,a);for(let o of ce){for(let s of e.rowWrappers[o])s.remove();e.rowWrappers[o]=[]}if(e.cells=[],e.root.style.display=e.data.length>0?"":"none",e.data.length===0)return;let r=this.e.r.rowHeight,i=this.e.n;e.data.forEach((o,s)=>{let a={id:`__pinned_${t}_${s}`,data:o,rowIndex:-1,selected:!1},l={},d=Ne(this.e,a,t);for(let c of ce){let u=f("div","mach-pinned-row");ve(u,d),u.style.height=`${r}px`,u.setAttribute("role","row"),l[c]=[];for(let h of i.T(c)){let p=f("div","mach-cell");if(p.dataset.colId=h.id,p.setAttribute("role","gridcell"),h.hasCheckbox&&p.classList.add("mach-cell--selection"),!h.hasCheckbox&&!h.isDetailToggle&&!h.colDef.rowDrag&&h.colDef.type!=="index")try{je(this.e,p,a,h),Re(this.e,p,a,h),Ue(this.e,p,a,h)}catch(m){this.e.reportError(m,"pinnedRow.render",{colId:h.id,side:t,rowIndex:s})}u.appendChild(p),l[c].push(p)}e.segments[c].appendChild(u),e.rowWrappers[c].push(u)}e.cells.push(l)})}et(){if(!this.top||!this.bottom)return;let e=this.e.n,t={left:0,center:0,right:0},r={left:[],center:[],right:[]};for(let i of ce){let o=0;for(let s of e.T(i))r[i].push(o),o+=s.currentWidth;t[i]=o}for(let i of[this.top,this.bottom]){let o=i.data.length===0;i.segments.left.classList.toggle("mach-pane--hidden",o||t.left<=0),i.segments.right.classList.toggle("mach-pane--hidden",o||t.right<=0),i.segments.left.style.width=`${t.left}px`,i.segments.right.style.width=`${t.right}px`,i.segments.center.style.width=`${t.center}px`,i.cells.forEach(s=>{let a=0;for(let l of ce){let d=e.T(l);s[l].forEach((c,u)=>{c.style.width=`${d[u].currentWidth}px`,c.style.left=`${r[l][u]}px`,c.setAttribute("aria-colindex",String(a+u+1))}),a+=d.length}})}}pf(e){this.top&&(this.top.segments.center.style.transform=`translateX(${-e}px)`),this.bottom&&(this.bottom.segments.center.style.transform=`translateX(${-e}px)`)}refresh(){this.ge(),this.et()}destroy(){for(let e of[this.top,this.bottom])if(e)for(let t of e.cells)for(let r of ce)for(let i of t[r])k(this.e,i);this.top=null,this.bottom=null}};var qt=class{constructor(e){this.e=e;this.C=null;this.Ar={};this.Jt=[]}init(){this.C=f("div","mach-statusbar"),this.C.style.display="none",this.C.setAttribute("role","status"),this.e.o.root.appendChild(this.C),this.ge(),this.Jt.push(this.e.fe.on("modelUpdated",()=>this.refresh()),this.e.fe.on("selectionChanged",()=>this.refresh()),this.e.fe.on("rangeSelectionChanged",()=>this.refresh()),this.e.fe.on("cellValueChanged",()=>this.refresh()))}ge(){if(!this.C)return;this.C.textContent="",this.Ar={};let e=this.e.r;if(!e.statusBarEnabled){this.C.style.display="none";return}for(let t of e.statusBarPanels){let r=f("span",`mach-statusbar-item mach-statusbar-item--${t}`);this.C.appendChild(r),this.Ar[t]=r}this.refresh()}text(e,t,r){let i=e[t]??x[t];if(r===void 0)return i;let o=typeof r=="number"?r:parseFloat(String(r))||0;return K(i,o)}la(e,t){let r=this.Ar[e];r&&r.textContent!==t&&(r.textContent=t)}wm(e){let t=this.e.i,r=t.ir(),i=t.Ae?t.getTotalRowCount():t.A(),o=K(this.text(e,"totalRowsLabel"),i);return t.f&&r>i?`${o} / ${r}`:o}Cm(e){let t=this.e.a.Pe();if(!t)return"";let r=this.e.n.c(),i=0,o=0;for(let l=t.r1;l<=t.r2;l++){let d=this.e.i.m(l);if(!(!d||d.isDetail||d.isGroup))for(let c=t.c1;c<=t.c2;c++){let u=r[c];if(!u)continue;let h=this.e.d(d,u);typeof h!="number"||Number.isNaN(h)||(i+=h,o++)}}if(o===0)return"";let s=Math.round(i/o*100)/100,a=Number.isInteger(i)?String(i):String(Math.round(i*100)/100);return`${this.text(e,"statusSum",a)} \xB7 ${this.text(e,"statusAvg",String(s))} \xB7 ${this.text(e,"statusCount",String(o))}`}refresh(){if(!this.C||this.e.s())return;let e=this.e.r;if(this.C.style.display=e.statusBarEnabled?"":"none",!e.statusBarEnabled)return;let t={...x,...e.locale};if(this.Ar.rowCount&&this.la("rowCount",this.wm(t)),this.Ar.selectedRowCount){let r=this.e.g.je().length;this.la("selectedRowCount",K(this.text(t,"statusSelected"),r))}this.Ar.rangeAggregate&&this.la("rangeAggregate",this.Cm(t))}destroy(){for(let e of this.Jt)e();this.Jt=[],this.C?.remove(),this.C=null}};function Fr(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function An(n){return typeof TextEncoder>"u"?n.length*2:new TextEncoder().encode(n).byteLength}function Hr(n={}){let e=(n.namespace??"mach-table:grid-state").replace(/:+$/,""),t=Math.max(1024,Math.floor(n.maxBytes??512*1024)),r=o=>`${e}:${o}`,i=(o,s,a)=>{try{n.onError?.(o,s,a)}catch{}};return{storageKey:r,load(o){try{let s=(n.storage??Fr())?.getItem(r(o));if(!s)return null;if(An(s)>t)throw new RangeError(`[MachTable] Stored grid state for "${o}" exceeds ${t} bytes.`);let a=JSON.parse(s);if(a?.schemaVersion!==2)throw new TypeError(`[MachTable] Stored grid state for "${o}" uses an unsupported schema.`);let l=$(a.state);if(!l)throw new TypeError(`[MachTable] Stored grid state for "${o}" is invalid.`);return l}catch(s){return i(s,"load",o),null}},save(o,s){try{let a=$(s);if(!a)throw new TypeError(`[MachTable] Invalid grid state for "${o}".`);let l=JSON.stringify({schemaVersion:2,savedAt:Date.now(),state:a});if(An(l)>t)throw new RangeError(`[MachTable] Grid state for "${o}" exceeds ${t} bytes.`);(n.storage??Fr())?.setItem(r(o),l)}catch(a){i(a,"save",o)}},clear(o){try{(n.storage??Fr())?.removeItem(r(o))}catch(s){i(s,"clear",o)}}}}var Vr=Hr();function Yt(n,e){Vr.save(n,e)}function Xt(n){return Vr.load(n)}function Ln(n){Vr.clear(n)}var Zs=[[/^(success|ok|done|complete|completed|normal|active|enabled|启用|正常|完成|已完成|运行|运行中|在线|生效|已发运)$/i,"success"],[/^(warning|warn|hold|pending|standby|待机|待审核|暂停|预警|部分完成|待下达|待复核|待发运)$/i,"warning"],[/^(error|fail|failed|danger|fault|offline|disabled|故障|失败|错误|异常|停用|离线|断开)$/i,"danger"],[/^(info|processing|new|draft|进行中|新建|草稿|审批中|同步中|执行中|已下达|装车中)$/i,"info"],[/^(neutral|default)$/i,"neutral"]];function Jt(n,e,t){let r=String(n??"");if(e){let i=Se(e,r);if(i)return i;let o=Se(e,r.toLowerCase());if(o)return o}for(let[i,o]of Zs)if(i.test(r))return o;return t==null?"neutral":Jt(t)}function zr(n={}){return e=>{if(e.value==null||e.value==="")return"";let t=String(e.value),r=qe(t,e.colDef.status),i=r?.label??Se(n.labelMap,t)??(e.formatted||t),o=r?.color,s=Jt(o??t,o?void 0:n.variantMap,i),a=document.createElement("span");return a.className=`mach-tag mach-tag--${s}`,a.textContent=i,o&&s!==o&&(a.style.color=o,a.style.backgroundColor=`color-mix(in srgb, ${o} 12%, transparent)`),a}}function _r(n={}){return e=>{let t=Number(e.value);if(isNaN(t))return e.formatted;let r=Math.max(0,Math.min(100,t)),i=f("div","mach-progress"),o=f("div","mach-progress__track"),s=f("div","mach-progress__bar");if(s.style.width=`${r}%`,n.color&&(s.style.background=n.color),o.appendChild(s),i.appendChild(o),n.showValue!==!1){let a=f("span","mach-progress__label");a.textContent=`${Math.round(r)}${n.unit??"%"}`,i.appendChild(a)}return i}}function Kr(n){if(n.value==null||n.value==="")return"";let e=f("span","mach-link");return e.textContent=n.formatted||String(n.value),e}var Wr={edit:'<path d="M11.5 2.5l2 2L5 13H3v-2l8.5-8.5z"/>',delete:'<path d="M3 5h10M6 5V3h4v2M5 5l.7 8h4.6L11 5"/>',view:'<path d="M1.5 8s2.4-4.2 6.5-4.2S14.5 8 14.5 8s-2.4 4.2-6.5 4.2S1.5 8 1.5 8z"/><circle cx="8" cy="8" r="1.8"/>',copy:'<rect x="5" y="5" width="8" height="8" rx="1"/><path d="M3 11V3h8"/>',download:'<path d="M8 2v8m0 0l-3-3m3 3l3-3M2.5 13.5h11"/>',refresh:'<path d="M13 3v4h-4M3 13V9h4"/><path d="M13 7a5.5 5.5 0 00-9.7-2.6M3 9a5.5 5.5 0 009.7 2.6"/>',close:'<path d="M3.5 3.5l9 9m0-9l-9 9"/>',check:'<path d="M2.5 8.5l3.5 3.5 7.5-8"/>',plus:'<path d="M8 2.5v11M2.5 8h11"/>',search:'<circle cx="7" cy="7" r="4.5"/><path d="M10.5 10.5L14 14"/>',more:'<circle cx="3" cy="8" r=".9" fill="currentColor" stroke="none"/><circle cx="8" cy="8" r=".9" fill="currentColor" stroke="none"/><circle cx="13" cy="8" r=".9" fill="currentColor" stroke="none"/>'};function Zt(n,e=14){let t=Wr[n]??"";return`<svg viewBox="0 0 16 16" width="${e}" height="${e}" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">${t}</svg>`}var ee=null,B=null;function kn(n){B&&n.contains(B)&&U()}function U(n=!1){ee?.remove(),ee=null,B&&(B.setAttribute("aria-expanded","false"),n&&B.isConnected&&B.focus({preventScroll:!0})),B=null,document.removeEventListener("mousedown",Pn,!0),document.removeEventListener("keydown",$r,!0)}function Pn(n){ee&&!ee.contains(n.target)&&!B?.contains(n.target)&&U()}function $r(n){if(!ee)return;if(n.key==="Escape"){n.preventDefault(),U(!0);return}let e=[...ee.querySelectorAll("button:not(:disabled)")];if(e.length===0)return;if(n.key==="Tab"){let i=e.indexOf(document.activeElement);(!n.shiftKey&&i===e.length-1||n.shiftKey&&i<=0)&&(n.preventDefault(),e[n.shiftKey?e.length-1:0].focus());return}if(n.key!=="ArrowDown"&&n.key!=="ArrowUp")return;n.preventDefault();let t=e.indexOf(document.activeElement),r=n.key==="ArrowDown"?1:-1;e[(t+r+e.length)%e.length].focus()}function Gn(n,e){let t=document.createElement("button");return t.type="button",t.className=e,n.variant&&n.variant!=="default"&&t.classList.add(`${e}--${n.variant}`),t.disabled=n.disabled===!0,n.icon&&Wr[n.icon]?t.innerHTML=`${Zt(n.icon,16)}<span>${n.label}</span>`:t.textContent=n.label,t.addEventListener("click",()=>n.pick(t)),t}function Qs(n,e){U();let t=f("div","mach-context-menu mach-action-menu");t.setAttribute("role","menu");for(let r of e){let i=Gn(r,"mach-context-menu-item");i.setAttribute("role","menuitem"),t.appendChild(i)}G(t,n.closest(".mach-root")),document.body.appendChild(t),Y(t,n),ee=t,B=n,n.setAttribute("aria-expanded","true"),document.addEventListener("mousedown",Pn,!0),document.addEventListener("keydown",$r,!0),t.querySelector("button:not(:disabled)")?.focus({preventScroll:!0})}function ea(n,e,t){U();let r=f("div","mach-action-drawer-backdrop"),i=f("section","mach-action-drawer");i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true"),i.setAttribute("aria-label",e);let o=f("header","mach-action-drawer__header"),s=document.createElement("strong");s.textContent=e;let a=document.createElement("button");a.type="button",a.className="mach-action-drawer__close",a.setAttribute("aria-label","Close"),a.title="Close",a.innerHTML=Zt("close",16),a.addEventListener("click",()=>U(!0)),o.append(s,a);let l=f("div","mach-action-drawer__body");for(let d of t)l.appendChild(Gn(d,"mach-action-drawer__item"));i.append(o,l),r.appendChild(i),r.addEventListener("mousedown",d=>{d.target===r&&U(!0)}),G(r,n.closest(".mach-root")),document.body.appendChild(r),ee=r,B=n,n.setAttribute("aria-expanded","true"),document.addEventListener("keydown",$r,!0),i.querySelector("button:not(:disabled)")?.focus({preventScroll:!0})}function Q(n,e){if(typeof n=="function")try{return n(e)}catch{return!1}return n===!0}function Nn(n){return n.variant??"default"}function On(n){return n.permission?typeof n.permission=="string"?[n.permission]:n.permission:[]}function Ur(n,e,t){return{...n.id?{actionId:n.id}:{},permissions:On(n),...t?{message:t}:{},params:e}}function Qt(n,e,t){let r=t.api.getOption("actionPolicy");try{r?.onError?r.onError(n,Ur(e,t)):console.error("[mach-table] action handler failed",n)}catch(i){console.error("[mach-table] action error policy failed",i,n)}}function ta(n,e){if(On(n).length===0)return!0;let r=e.api.getOption("actionPolicy");if(!r?.canAccess)return!0;try{return r.canAccess(Ur(n,e))}catch(i){return Qt(i,n,e),!1}}function ra(n,e){return n.filter(t=>{if(!ta(t,e))return!1;if(!t.show)return!0;try{return t.show(e)}catch{return!1}})}function jr(n,e,t){t.isConnected&&(t.disabled=Q(n.disabled,e)||Q(n.loading,e),t.classList.toggle("mach-action-btn--loading",Q(n.loading,e)))}function ia(n,e,t,r){Promise.resolve(n).catch(i=>Qt(i,e,t)).finally(()=>jr(e,t,r))}function na(n,e,t){try{ia(n.onClick(e),n,e,t)}catch(r){Qt(r,n,e),jr(n,e,t)}}function Br(n,e,t){if(n===!1)return!1;let r=typeof n=="string"?n:e.label??e.title??"Confirm action",i=t.api.getOption("actionPolicy");return i?.confirm?i.confirm(Ur(e,t,r)):typeof window>"u"||typeof window.confirm!="function"?!1:window.confirm(r)}function oa(n,e){if(n.confirm==null||n.confirm===!1)return!0;if(typeof n.confirm!="function")return Br(n.confirm,n,e);let t=n.confirm(e);return t instanceof Promise?t.then(r=>Br(r,n,e)):Br(t,n,e)}function sa(n){return(e,t)=>{if(Q(e.disabled,n))return;if(t.disabled=!0,t.classList.add("mach-action-btn--loading"),e.confirm==null||e.confirm===!1){na(e,n,t);return}(async()=>{await oa(e,n)&&await e.onClick(n)})().catch(i=>Qt(i,e,n)).finally(()=>{jr(e,n,t)})}}function aa(n,e,t){let r=document.createElement("button");r.type="button",r.className="mach-action-btn";let i=Nn(n);i!=="default"&&r.classList.add(`mach-action-btn--${i}`);let o=n.title??n.label??"Action";return r.title=o,r.setAttribute("aria-label",o),r.disabled=Q(n.disabled,e),Q(n.loading,e)&&(r.disabled=!0,r.classList.add("mach-action-btn--loading")),n.icon&&Wr[n.icon]?(r.innerHTML=Zt(n.icon),r.classList.add("mach-action-btn--icon")):r.textContent=n.label??o,r.addEventListener("mousedown",s=>s.stopPropagation()),r.addEventListener("click",s=>{s.stopPropagation(),t(n,r)}),r}function la(n,e,t,r,i){let o=document.createElement("button");o.type="button",o.className="mach-action-btn mach-action-btn--icon";let s=r.api.getOption("locale")??{},a=t.moreLabel??s.actionMore??x.actionMore;return o.title=a,o.setAttribute("aria-label",a),o.setAttribute("aria-haspopup",e==="drawer"?"dialog":"menu"),o.setAttribute("aria-expanded","false"),o.innerHTML=`${Zt("more",16)}<span class="mach-sr-only">\u22EF</span>`,o.addEventListener("mousedown",l=>l.stopPropagation()),o.addEventListener("click",l=>{l.stopPropagation();let d=n.map(c=>({label:c.label??c.title??"Action",icon:c.icon,variant:Nn(c),disabled:Q(c.disabled,r)||Q(c.loading,r),pick:u=>{U(),i(c,u)}}));e==="drawer"?ea(o,t.drawerTitle??a,d):Qs(o,d)}),o}function we(n){let e=Math.max(0,n.max??3),t=n.overflow??"menu";return r=>{let i=ra(n.actions,r);if(i.length===0)return"";let o=f("div","mach-actions"),s=t==="inline"?i:i.slice(0,e),a=t==="inline"?[]:i.slice(e),l=sa(r);for(let d of s)o.appendChild(aa(d,r,l));return a.length>0&&o.appendChild(la(a,t,n,r,l)),{el:o,destroy:()=>{B&&o.contains(B)&&U()}}}}function be(n,e,t){return n??e??t}function da(n,e){let t=e.api.getOption("locale")??{};return{view:be(n.labels?.view,t.actionView,x.actionView),edit:be(n.labels?.edit,t.actionEdit,x.actionEdit),delete:be(n.labels?.delete,t.actionDelete,x.actionDelete),confirm:be(n.labels?.confirm,t.actionConfirm,x.actionConfirm),save:be(n.labels?.save,t.actionSave,x.actionSave),cancel:be(n.labels?.cancel,t.actionCancel,x.actionCancel)}}function ca(n,e,t){let r=async()=>{if(!await e.api.editing.stop()||!n.onSave)return;let s=e.api.editing.getChanges().filter(a=>a.rowId===e.node.id);try{await n.onSave(e,s),e.api.editing.markSaved([e.node.id])}catch(a){throw e.api.editing.startRow(e.rowIndex),a}},i=n.onSave?t.save:n.labels?.confirm??n.labels?.save??t.confirm;return we({actions:[{icon:"check",title:i,variant:"success",onClick:r},{icon:"close",title:t.cancel,variant:"danger",onClick:()=>e.api.editing.stop({cancel:!0}).then(()=>{})}],overflow:"inline"})(e)}function ua(n,e,t){let r=[];return n.onView&&r.push({id:"view",icon:"view",title:t.view,variant:"primary",...n.permissions?.view?{permission:n.permissions.view}:{},onClick:n.onView}),n.edit!==!1&&r.push({id:"edit",icon:"edit",title:t.edit,variant:"warning",...n.permissions?.edit?{permission:n.permissions.edit}:{},onClick:n.onEdit??(()=>{e.api.editing.startRow(e.rowIndex)})}),n.onDelete&&r.push({id:"delete",icon:"delete",title:t.delete,variant:"danger",...n.permissions?.delete?{permission:n.permissions.delete}:{},...n.confirmDelete?{confirm:n.confirmDelete===!0?t.delete:n.confirmDelete}:{},onClick:n.onDelete}),r.push(...n.extraActions??[]),r}function er(n={}){return e=>{let t=da(n,e);if(e.api.editing.isRowActive(e.rowIndex))return ca(n,e,t);let r=ua(n,e,t);return we({actions:r,max:n.max,overflow:n.overflow??"menu",moreLabel:n.moreLabel,drawerTitle:n.drawerTitle})(e)}}var ha=zr(),pa=_r(),Fn=Object.freeze({statusTag:ha,progressBar:pa,link:Kr});var Oe=class{constructor(e){this.onError=e;this.qn=new Set;this.disposed=!1}add(e){let t=!0,r=()=>{if(t){t=!1,this.qn.delete(r);try{e()}catch(i){try{this.onError(i)}catch{}}}};return this.disposed?r():this.qn.add(r),r}L(e){return this.add(()=>e.destroy()),e}dispose(){if(this.disposed)return;this.disposed=!0;let e=[...this.qn].reverse();this.qn.clear();for(let t of e)t()}};function fa(n){return!!(n.field||n.valueGetter||n.cellRenderer||n.checkboxSelection||n.rowDrag||n.type||n.autoRowSpan||n.rowSpan)}function ma(n,e,t){n.width!=null&&n.minWidth!=null&&n.width<n.minWidth&&t.push(`\u5217 "${e}" \u7684 width(${n.width}) \u5C0F\u4E8E minWidth(${n.minWidth})\uFF0C\u5C06\u6309 minWidth \u6E32\u67D3`),n.width!=null&&n.maxWidth!=null&&n.width>n.maxWidth&&t.push(`\u5217 "${e}" \u7684 width(${n.width}) \u5927\u4E8E maxWidth(${n.maxWidth})\uFF0C\u5C06\u6309 maxWidth \u6E32\u67D3`)}function ga(n,e){let t=n.colId??n.field??`col_${e.leafIndex}`;e.seenIds.set(t,(e.seenIds.get(t)??0)+1),n.field&&!_e(n.field)&&e.issues.push(`\u5217 "${t}" \u7684 field \u8DEF\u5F84\u4E0D\u5B89\u5168\u6216\u65E0\u6548\uFF0C\u5DF2\u7981\u6B62\u8BFB\u53D6\u548C\u5199\u5165`),fa(n)||e.issues.push(`\u5217 "${t}" \u65E2\u65E0 field \u4E5F\u65E0 valueGetter\uFF0C\u5C06\u59CB\u7EC8\u663E\u793A\u7A7A\u503C\uFF08\u7EAF\u5DE5\u5177\u5217\u8BF7\u5FFD\u7565\u6B64\u63D0\u793A\uFF09`),ma(n,t,e.issues)}function Hn(n,e){for(let t of n){if(fe(t)){!Array.isArray(t.children)||t.children.length===0?e.issues.push(`\u5217\u5206\u7EC4 "${t.headerName??t.groupId??"?"}" \u7684 children \u4E3A\u7A7A`):Hn(t.children,e);continue}e.leafIndex++,ga(t,e)}}function Vn(n){if(!n||n.length===0)return[];let e={issues:[],seenIds:new Map,leafIndex:0};Hn(n,e);for(let[t,r]of e.seenIds)r>1&&e.issues.push(`\u5B58\u5728 ${r} \u4E2A\u91CD\u590D\u7684 colId/field "${t}"\uFF0C\u5DF2\u81EA\u52A8\u52A0\u540E\u7F00\u533A\u5206\uFF0C\u5EFA\u8BAE\u663E\u5F0F\u547D\u540D colId`);return e.issues}var Bn=new Set([...Ir,...Ar]);function ya(n,e){if(n===e)return 0;if(n.length===0)return e.length;if(e.length===0)return n.length;let t=Array.from({length:e.length+1},(r,i)=>i);for(let r=1;r<=n.length;r++){let i=[r];for(let o=1;o<=e.length;o++)i[o]=Math.min(i[o-1]+1,t[o]+1,t[o-1]+(n[r-1]===e[o-1]?0:1));t=i}return t[e.length]}function va(n){let e,t=Number.POSITIVE_INFINITY;for(let i of Bn){let o=ya(n.toLowerCase(),i.toLowerCase());o<t&&(t=o,e=i)}let r=Math.max(2,Math.floor(n.length*.3));return t<=r?e:void 0}function ba(n){let e=[];return n.rowKey!=null&&typeof n.rowKey!="string"&&typeof n.rowKey!="function"&&e.push({code:"INVALID_OPTION_VALUE",option:"rowKey",message:"rowKey \u5FC5\u987B\u662F\u5B57\u6BB5\u8DEF\u5F84\u6216\u8FD4\u56DE\u7A33\u5B9A\u4E1A\u52A1\u4E3B\u952E\u7684\u51FD\u6570"}),n.domLayout==="autoHeight"&&n.datasource!=null&&e.push({code:"OPTION_CONFLICT",option:"domLayout",message:"autoHeight \u4F1A\u6E32\u67D3\u5168\u90E8\u5DF2\u52A0\u8F7D\u884C\uFF0C\u4E0D\u9002\u7528\u4E8E datasource \u65E0\u9650\u6EDA\u52A8\u6A21\u5F0F"}),e.push(...wa(n)),n.enableColumnResize!=null&&typeof n.enableColumnResize!="boolean"&&e.push({code:"INVALID_OPTION_VALUE",option:"enableColumnResize",message:"enableColumnResize \u5FC5\u987B\u662F boolean\uFF1B\u672A\u914D\u7F6E\u65F6\u9ED8\u8BA4\u5173\u95ED"}),e}function wa(n){if(n.datasourceMode!=="block")return[];let e=[];return n.datasource==null&&e.push({code:"OPTION_CONFLICT",option:"datasourceMode",message:"datasourceMode='block' requires a datasource"}),typeof n.getRowHeight=="function"&&e.push({code:"OPTION_CONFLICT",option:"getRowHeight",message:"Random-access block rows require fixed rowHeight so unloaded offsets remain deterministic"}),n.masterDetail===!0&&e.push({code:"OPTION_CONFLICT",option:"masterDetail",message:"masterDetail is not supported by the sparse random-access block row model"}),n.treeData===!0&&e.push({code:"OPTION_CONFLICT",option:"treeData",message:"treeData requires the local/tree row model and cannot use random-access blocks"}),zn(n)||e.push({code:"MISSING_STABLE_ROW_ID",option:"rowKey",message:"Random-access blocks require rowKey to preserve selection and identity after eviction"}),e}function zn(n){return n.rowKey!=null}function Ca(n){let e=new Set(["enableColumnResize","pagination","rowKey"]),t=[];for(let r of Ir){if(e.has(r)||!Object.prototype.hasOwnProperty.call(n,r))continue;let i=n[r],o=Pe[r];Lr(i,o)||t.push({code:"INVALID_OPTION_VALUE",option:r,message:`${r} \u503C\u7C7B\u578B\u65E0\u6548\uFF0C\u671F\u671B ${o}`})}return t}function Ta(n){let e=[];for(let t of Object.keys(n)){if(Bn.has(t))continue;let r=va(t);e.push({code:"UNKNOWN_OPTION",option:t,...r?{suggestion:r}:{},message:r?`\u672A\u77E5 GridOption "${t}"\uFF0C\u662F\u5426\u60F3\u4F7F\u7528 "${r}"\uFF1F`:`\u672A\u77E5 GridOption "${t}"\uFF0C\u8BE5\u503C\u4E0D\u4F1A\u751F\u6548`})}return e}function Da(n,e){if(e.mode!=="server")return[];let t=[];zn(n)||t.push({code:"MISSING_STABLE_ROW_ID",option:"rowKey",message:"\u670D\u52A1\u7AEF\u5206\u9875\u5EFA\u8BAE\u63D0\u4F9B\u7A33\u5B9A rowKey\uFF0C\u5426\u5219\u8DE8\u9875\u9009\u62E9\u4E0E\u589E\u91CF\u66F4\u65B0\u65E0\u6CD5\u53EF\u9760\u4FDD\u6301"});let r=e.total;return r!==void 0&&(typeof r!="number"||!Number.isFinite(r)||r<0)&&t.push({code:"INVALID_OPTION_VALUE",option:"pagination.total",message:"\u670D\u52A1\u7AEF\u5206\u9875 total \u5FC5\u987B\u662F\u975E\u8D1F\u6709\u9650\u6570"}),t}function Ea(n){let e=[],t=n.pagination;return t!=null&&typeof t!="boolean"&&typeof t!="object"&&e.push({code:"INVALID_OPTION_VALUE",option:"pagination",message:"pagination \u5FC5\u987B\u662F boolean \u6216\u914D\u7F6E\u5BF9\u8C61"}),n.datasource!=null&&t!==void 0&&t!==!1&&e.push({code:"OPTION_CONFLICT",option:"pagination",message:"datasource \u987A\u5E8F\u65E0\u9650\u6A21\u5F0F\u4E0E pagination \u4E0D\u80FD\u540C\u65F6\u542F\u7528\uFF1B\u666E\u901A\u670D\u52A1\u7AEF\u5206\u9875\u8BF7\u4F7F\u7528 pagination.mode='server'"}),t&&typeof t=="object"&&e.push(...Da(n,t)),e}function xa(n){return n.treeData!==!0||n.masterDetail!==!0?[]:[{code:"OPTION_CONFLICT",option:"masterDetail",message:"treeData \u4E0E masterDetail \u4E0D\u80FD\u540C\u65F6\u542F\u7528\uFF0C\u4E3B\u4ECE\u660E\u7EC6\u5C06\u88AB\u5FFD\u7565"}]}function tr(n){let e=n,t=Ta(e);return t.push(...Ea(e)),t.push(...xa(e)),t.push(...Ca(e)),t.push(...ba(e)),t}function _n(n){let e=/^v?(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:[-+].*)?$/.exec(n.trim());return e?[Number(e[1]),Number(e[2]??0),Number(e[3]??0)]:null}function qr(n,e){for(let t=0;t<3;t++)if(n[t]!==e[t])return n[t]<e[t]?-1:1;return 0}function Ra(n){return n[0]>0?[n[0]+1,0,0]:n[1]>0?[0,n[1]+1,0]:[0,0,n[2]+1]}function Sa(n,e){if(e==="*"||e.toLowerCase()==="latest")return!0;let t=/^(\^|~|>=|<=|>|<|=)?\s*(.+)$/.exec(e);if(!t)return!1;let r=_n(t[2]);if(!r)return!1;let i=qr(n,r);switch(t[1]??"="){case">=":return i>=0;case"<=":return i<=0;case">":return i>0;case"<":return i<0;case"^":return i>=0&&qr(n,Ra(r))<0;case"~":return i>=0&&qr(n,[r[0],r[1]+1,0])<0;default:return i===0}}function Kn(n,e){if(!e?.trim())return!0;let t=n?_n(n):null;return t?e.split("||").some(r=>{let i=r.trim().split(/\s+/).filter(Boolean);return i.length>0&&i.every(o=>Sa(t,o))}):!1}function Ma(n){return[...new Set((n??[]).map(e=>e.trim()).filter(Boolean))]}function rr(n){let e=new Map;for(let t of n??[]){let r=(typeof t=="string"?t:t?.key??"").trim();if(!r||e.has(r))continue;let i=typeof t=="object"?t.version?.trim():void 0;e.set(r,{key:r,...i?{version:i}:{}})}return[...e.values()]}function ir(n){let e=[],t=new Map;for(let l of n){let d=typeof l?.key=="string"?l.key.trim():"";if(!d){e.push({code:"INVALID_FEATURE_KEY",message:"GridFeature.key must be a non-empty string"});continue}if(t.has(d)){e.push({code:"DUPLICATE_FEATURE",feature:d,message:`Duplicate GridFeature key: ${d}`});continue}t.set(d,l)}let r=new Set;for(let[l,d]of t){for(let c of rr(d.requires)){let u=t.get(c.key);u?Kn(u.version,c.version)||(r.add(l),e.push({code:"UNSUPPORTED_FEATURE_VERSION",feature:l,dependency:c.key,message:`GridFeature "${l}" requires "${c.key}" ${c.version}, received ${u.version??"unversioned"}`})):(r.add(l),e.push({code:"MISSING_FEATURE_DEPENDENCY",feature:l,dependency:c.key,message:`GridFeature "${l}" requires missing feature "${c.key}"`}))}for(let c of Ma(d.conflicts))if(t.has(c)){r.add(l),e.push({code:"FEATURE_CONFLICT",feature:l,dependency:c,message:`GridFeature "${l}" conflicts with "${c}"`});break}}let i=[],o=new Set,s=new Set,a=l=>{if(s.has(l))return!r.has(l);if(o.has(l))return r.add(l),e.push({code:"FEATURE_CYCLE",feature:l,message:`GridFeature dependency cycle includes "${l}"`}),!1;let d=t.get(l);if(!d||r.has(l))return!1;o.add(l);let c=!0;for(let u of rr(d.requires))a(u.key)||(c=!1);return o.delete(l),s.add(l),c?(i.push(d),!0):(r.add(l),!1)};for(let l of t.keys())a(l);return{features:i.filter(l=>!r.has(l.key.trim())),issues:e}}var Ia=["datasource","treeData"],Aa=["columnState.","gridState."],La=new Set(["valueFormatter","cellStyle","cellClass"]),ka=new Set(["selectionChanged","sortChanged","filterChanged","columnMoved","columnVisibilityChanged","displayedColumnsChanged","paginationChanged","detailToggled"]),Pa=0,nr=class{constructor(e,t){this.x=!1;this.Tm=0;this.Ci=0;this.Yd=!1;this.da="";this.R=new Oe(e=>console.error("[mach-table] resource cleanup error",e));this.activeFeatures=new Map;this.ec=0;this.Ti=0;this.recentErrors=[];this.It=null;this.tc=0;this.ca=0;this.ua=!1;this.ha=!1;this.pa=null;this.ac=null;this.Yn=new Set;let r;this.Xd=new Promise(i=>{r=i}),this.Jd=r,this.gridId=++Pa,this.r=si(t),this.fe=new Xe((i,o)=>{o==="gridError"?console.error("[mach-table] error in gridError listener",i):this.reportError(i,"eventBus.listener",{eventType:o})});try{if(this.Kl(t.dataProcessor),this.n=new Ze(this),this.i=this.R.L(new st(this)),this.g=new at(this),this.o=this.R.L(new Ot(this)),this.K=this.R.L(new Ht(this)),this.a=this.R.L(new Wt(this)),this.di=this.R.L(new lt(this)),this.An=this.R.L(new dt(this)),this.ns=this.R.L(new gt(this)),this.l=this.R.L(new Ct(this)),this.U=new wt(this),this._=new It(this),this.le=this.R.L(new kt),this.yr=this.R.L(new Pt(i=>this.Dm(i))),this.Ls=this.R.L(new Et(this)),this.columnMenu=this.R.L(new xt(this)),this.na=this.R.L(new Rt(this)),this.Vn=this.R.L(new St(this)),this.bn=this.R.L(new Mt(this)),this.br=this.R.L(new Ut(this)),this.me=this.R.L(new jt(this)),this.ce=this.R.L(new $t(this)),this.Ye=this.R.L(new qt(this)),this.api=En(this),this.zt=new Ye(this),this.z=this.R.L(new At(this)),this.R.add(()=>this.rc()),this.z.init(),this.o.init(e,this.r),this.bn.init(),this.a.init(),this.ns.init(),this.Vn.init(),this.br.init(),this.ce.init(),this.Ye.init(),this.me.init(),this.i.$a(this.r.paginationPage,this.r.paginationPageSize),this.n.Gr(this.r.columnDefs),this.i.sr(this.r.advancedFilterModel),this.i.ar(this.r.quickFilterText),this.wn(),this.ic(this.r.columnDefs),this.ws(t),this.K.ai(),this.r.datasource?this.i.Hi().catch(()=>{}):this.i.ht(this.r.rowData),this.r.initialState&&this.api.state.apply(this.r.initialState,{emitEvents:!1}),this.ys(),this.Te(),this.me.setData(this.r.pinnedTopRowData,this.r.pinnedBottomRowData),this.Wl(this.r.features),this.x)return;this.Ci=requestAnimationFrame(()=>{this.Ci=0,this.x||this.emit("gridReady",{}),this.nc()})}catch(i){throw this.api&&this.reportError(i,"grid.constructor"),this.destroy(),i}}Kl(e){if(e===this.Zd)return!1;let t=++this.ec,r=typeof e=="function"?e():e;if(this.x||t!==this.ec)return r?.destroy?.(),!1;let i=this.Qd;return this.Zd=e,r===this.r.dataProcessor&&i?!1:(this.r.dataProcessor=r,this.Qd=r?this.R.add(()=>r.destroy?.()):void 0,i?.(),!0)}whenReady(){return this.Xd}nc(){this.Yd||(this.Yd=!0,this.Jd(this.api))}lc(e){return this.r.components?.cellRenderers?.[e]??Fn[e]}_u(e){return this.r.components?.cellEditors?.[e]}Em(e){return rr(e.requires).map(t=>t.key).find(t=>!this.activeFeatures.has(t))}Wl(e){let t=this.Ti+1;if(this.rc(),this.x||this.Ti!==t)return;let r=ir(e??[]);for(let i of r.issues)this.reportError(new Error(i.message),"feature.manifest",{code:i.code,...i.feature?{key:i.feature}:{},...i.dependency?{dependency:i.dependency}:{}});for(let i of r.features){if(this.x||this.Ti!==t)return;let o=i.key.trim(),s=this.Em(i);if(s){this.reportError(new Error(`GridFeature "${o}" dependency "${s}" did not initialise`),"feature.manifest",{code:"FEATURE_DEPENDENCY_SETUP_FAILED",key:o,dependency:s});continue}let a=new Oe(c=>this.reportError(c,"feature.cleanup",{key:o})),l=c=>a.add(c),d={api:this.api,root:this.o.root,getOptions:()=>this.r,addEventListener:(c,u)=>l(this.fe.on(c,u)),onCleanup:c=>{l(c)},addManagedDomListener:(c,u,h,p)=>(c.addEventListener(u,h,p),l(()=>c.removeEventListener(u,h,p))),setManagedTimeout:(c,u)=>{let h=setTimeout(()=>{p(),c()},Math.max(0,u)),p=l(()=>clearTimeout(h));return h},createAbortController:()=>{let c=new AbortController;return l(()=>c.abort()),c},reportError:(c,u,h)=>this.reportError(c,`feature.${u}`,h)};try{let c=i.setup(d);if(typeof c=="function"&&l(c),this.x||this.Ti!==t){this.oc(o,{feature:i,scope:a});return}this.activeFeatures.set(o,{feature:i,scope:a})}catch(c){a.dispose(),this.reportError(c,"feature.setup",{key:o})}}}rc(){this.Ti++;let e=[...this.activeFeatures.entries()].reverse();this.activeFeatures.clear();for(let[t,r]of e)this.oc(t,r)}oc(e,t){t.scope.dispose();try{t.feature.destroy?.()}catch(r){this.reportError(r,"feature.destroy",{key:e})}}s(){return this.x}suspend(){this.Me(),this.api.editing.stop({cancel:!0}),this.Ls.close(),this.columnMenu.close(),this.na.close(),this.Vn.hide(),this.di.Ot(),this.An.destroy(),this.a.suspend(),zi(this.o.root),kn(this.o.root);let e=document.activeElement;e instanceof HTMLElement&&this.o.root.contains(e)&&e.blur()}or(){return++this.Tm}d(e,t){let r=t.colDef;if(r.valueGetter)try{return r.valueGetter({api:this.api,colDef:r,column:t,node:e,data:e.data})}catch(i){this.reportError(i,"valueGetter",{colId:t.id,rowId:e.id});return}if(r.field)return _(e.data,r.field)}y(e){return this.r.locale[e]??x[e]}Zi(e,t,r,i){let o=t.colDef;if(o.valueSetter)try{return o.valueSetter({oldValue:i,newValue:r,data:e.data,node:e,colDef:o,column:t,api:this.api})}catch(s){return this.reportError(s,"valueSetter",{colId:t.id,rowId:e.id}),!1}return o.field?ue(e.data,o.field,r):!1}qo(e,t,r,i){this.a._i(e),this.a.Rl([e.rowIndex],[t.id]),this._.us({nodeId:e.id,columnId:t.id,oldValue:r,newValue:i}),this.emit("cellValueChanged",{oldValue:r,newValue:i,rowNode:e,rowIndex:e.rowIndex,column:t,colDef:t.colDef,data:e.data})}cl(e){let r=this.n.c().slice(e.c1,e.c2+1),i=[];for(let o=e.r1;o<=e.r2;o++){let s=this.i.m(o);i.push(r.map(a=>!s||s.isDetail||s.isGroup?"":ke(this,s,a,"clipboard")))}return ut(i)}Dl(){let e=this.a.Zr();return e?mt(this.cl(e)):Promise.resolve(!1)}Ko(e){if(this.x)return;let t=this.n.c(),r=[];for(let i=e.r1;i<=e.r2;i++){let o=this.i.m(i);if(!(!o||o.isDetail||o.isGroup))for(let s=e.c1;s<=e.c2;s++){let a=t[s];!a||a.hasCheckbox||a.isDetailToggle||a.colDef.rowDrag||r.push({node:o,column:a,oldValue:this.d(o,a),newValue:null})}}this.vr(r)}vr(e){this.U.Fu(e)}Me(){this.U?.Gu()}ul(e,t,r){if(this.x)return;let i=ht(e);if(i.length===0)return;let o=this.n.c(),s=this.i.A(),a=[],l=t;for(let d of i){let c=this.xm(l,s);if(!c)break;this.Rm(c.node,d,o,r,a),l=c.index+1}this.vr(a)}xm(e,t){for(let r=e;r<t;r++){let i=this.i.m(r);if(i&&!i.isDetail&&!i.isGroup)return{index:r,node:i}}return null}Sm(e,t){let r=t;for(;r<e.length;){let i=e[r];if(!i.hasCheckbox&&!i.isDetailToggle&&!i.colDef.rowDrag)break;r++}return r}Rm(e,t,r,i,o){let s=i,a=o.length;for(let l of t){if(s=this.Sm(r,s),s>=r.length)return;let d=r[s];if(!this.l.q(e,d)){s++;continue}let c=this.d(e,d);try{let u=d.colDef.valueParser?le(this,e,d,l,"clipboard",c):ct(l,typeof c=="number"||d.colDef.cellEditor==="number");o.push({node:e,column:d,oldValue:c,newValue:u})}catch(u){o.splice(a),this.reportError(u,"validate",{rowId:e.id,colId:d.id});return}s++}}nh(){let e=this.a.Wo();if(!e)return Promise.resolve();let t=this.U.Uo(),r=this.i.m(e.row),i=this.n.c()[e.colIdx];if(!r||!i)return Promise.resolve();let o=this.d(r,i),s=this.U.Qr([{node:r,column:i,oldValue:o,newValue:o}]);try{if(typeof navigator<"u"&&navigator.clipboard?.readText)return navigator.clipboard.readText().then(a=>{let l=this.a.Wo();a&&t()&&s()&&l?.row===e.row&&l.colIdx===e.colIdx&&this.i.m(e.row)===r&&this.n.c()[e.colIdx]===i&&this.ul(a,e.row,e.colIdx)}).catch(()=>{})}catch{}return Promise.resolve()}emit(e,t){let r={type:e,api:this.api,...t};this.fe.emit(e,r);let i="on"+e.charAt(0).toUpperCase()+e.slice(1),o=this.r[i];if(typeof o=="function")try{o(r)}catch(a){e==="gridError"?console.error("[mach-table] error in onGridError",a):this.reportError(a,`eventHandler.${String(i)}`,{eventType:e})}return(e==="columnResized"&&r.finished||ka.has(e))&&this.Mm(),r}reportError(e,t,r){let i=this.Im(t,e),o=e instanceof Error?e.message:String(e);this.recentErrors.push({code:i,source:t,message:o,timestamp:Date.now(),...r?{context:r}:{}}),this.recentErrors.length>50&&this.recentErrors.splice(0,this.recentErrors.length-50),console.error(`[mach-table] ${i} (${t})`,e),!this.x&&this.emit("gridError",{code:i,error:e,source:t,context:r})}Im(e,t){if(Ia.some(i=>e.startsWith(i)))return"DATA_SOURCE_ERROR";let r=t instanceof Error?t.message:String(t);return e==="rowKey"||r.includes("Duplicate row id")?"DATA_INTEGRITY_ERROR":e==="validate"?"VALIDATION_ERROR":e.toLowerCase().includes("renderer")||La.has(e)?"RENDERER_ERROR":e.toLowerCase().includes("editor")||e==="editable"?"EDITOR_ERROR":e.startsWith("feature.")?"FEATURE_ERROR":Aa.some(i=>e.startsWith(i))?"STATE_ERROR":e.startsWith("eventBus.")||e.startsWith("eventHandler.")?"EVENT_HANDLER_ERROR":"GRID_ERROR"}gs(){return{gridId:this.gridId,version:Be,destroyed:this.x,infinite:this.i.f,loading:this.i.Cc()||this.r.loading,rowCount:this.i.ir(),renderedRowCount:this.o.Ee.querySelectorAll(".mach-row[data-index]").length,columnCount:this.n.te().length,selectedRowCount:this.g.je().length,dirtyRowCount:this.z.getDirtyRowIds().length,activeFeatures:[...this.activeFeatures].map(([e,t])=>({key:e,...t.feature.version?{version:t.feature.version}:{}})),performance:this.le.snapshot(),updates:this.yr.snapshot(),recentErrors:this.recentErrors.map(e=>({...e,...e.context?{context:{...e.context}}:{}}))}}Mi(e,t){this.n.Mi(e,t),this.Nr()}Nr(){if(this.K.Cs(),this.emit("sortChanged",{sortModel:this.n.J()}),this.i.f){this.i.We();return}this.i.w(),this.h({data:!0})}os(e,t){let r=this.i.Q();if(t?r[e.id]=t:delete r[e.id],this.i.Wr(r),this.K.fn(),this.emit("filterChanged",{filterModel:this.i.Q(),advancedFilterModel:this.i.Ie()}),this.i.f){this.i.We();return}this.i.w(),this.h({data:!0})}jh(){if(this.emit("filterChanged",{filterModel:this.i.Q(),advancedFilterModel:this.i.Ie()}),this.i.f){this.i.We();return}this.i.w(),this.h({data:!0})}At(e,t){this.n.At(e,t)&&(this.Je(),this.emit("columnMoved",{colId:e,toIndex:t}))}$i(e){return this.i.$i(e)}ol(e,t){this.emit("columnResized",{colId:e.id,width:e.currentWidth,finished:t})}cr(e){if(!(this.x||e.length===0))for(let t of e){if(this.x)break;this.ol(t,!0)}}ys(){let e=++this.tc,t=this.ca,r=this.r.persistence;if(!r)return;let{key:i,store:o,sections:s}=r,a;try{a=o?o.load(i):Xt(i)}catch(d){this.reportError(d,"gridState.load");return}let l=d=>{if(!(this.x||e!==this.tc||t!==this.ca||!d)){this.ua=!0;try{this.api.state.apply(d,{emitEvents:!1,...s?{sections:s}:{}})}finally{this.ua=!1}}};a&&typeof a.then=="function"?Promise.resolve(a).then(l).catch(d=>this.reportError(d,"gridState.load")):l(a)}Mm(){let e=this.r.persistence;if(!(!e||this.x||this.ua)){if(this.ca++,this.It&&clearTimeout(this.It),e.debounceMs===0){this.It=null,this.fa();return}this.It=setTimeout(()=>{this.It=null,this.fa()},e.debounceMs)}}fa(){let e=this.r.persistence;if(!e||this.x)return;let{key:t,store:r,sections:i}=e,o=this.api.state.get(),s=i?sn(o,i):o,a={key:t,...r?{store:r}:{},state:s};if(this.ha){this.pa=a;return}this.sc(a)}sc(e){try{let t=e.store?e.store.save(e.key,e.state):Yt(e.key,e.state);if(!t||typeof t.then!="function")return;this.ha=!0,Promise.resolve(t).catch(r=>this.reportError(r,"gridState.save")).finally(()=>{this.ha=!1;let r=this.pa;this.pa=null,r&&this.sc(r)})}catch(t){this.reportError(t,"gridState.save")}}ql(){let e=f("div","mach-empty mach-empty--error"),t=f("div","mach-empty__title");t.textContent=this.y("requestFailed");let r=f("div","mach-empty__hint");return r.textContent=this.y("requestFailedHint"),e.append(t,r),e}Ul(){let e=f("div","mach-loading"),t=f("div","mach-loading__visual");t.setAttribute("aria-hidden","true");for(let s=0;s<4;s+=1){let a=f("span","mach-loading__row");t.appendChild(a)}let r=f("div","mach-loading__status"),i=f("span","mach-spinner mach-loading__spinner");i.setAttribute("aria-hidden","true");let o=f("span","mach-loading__label");return o.textContent=this.y("loading"),r.append(i,o),e.append(t,r),e}jl(){let e=f("div","mach-empty");e.innerHTML='<svg class="mach-empty__icon" viewBox="0 0 96 84" aria-hidden="true"><rect stroke-opacity=".3" x="8" y="6" width="76" height="66" rx="9"/><path fill="#8b98ff" opacity=".12" stroke="none" d="M17 6H75Q84 6 84 15V26H8V15Q8 6 17 6Z"/><path stroke="var(--mach-body-fg)" opacity=".06" d="M8 26h76M38 26v46M61 26v46M8 42h76M8 57h76"/><path stroke-width="5" opacity=".5" d="M19 15h12m17 0h7m15 0h7"/><path stroke="var(--mach-body-fg)" opacity=".06" stroke-width="4" d="M19 34h12m14 0h8m15 0h8M19 49h12m14 0h8m15 0h8M19 64h12m14 0h8"/><circle stroke-opacity=".3" cx="72" cy="55" r="19"/><circle cx="70" cy="53" r="9"/><path d="m77 60 6 6m-16-16 6 6m0-6-6 6"/></svg>';let t=f("div","mach-empty__title");t.textContent=this.y("emptyRows");let r=f("div","mach-empty__hint");return r.textContent=this.y("emptyRowsHint"),e.append(t,r),e}ws(e){if(!(this.r.suppressWarnings||this.x)){if(e)for(let t of tr(e)){let r=`${t.code}:${t.option??""}:${t.message}`;this.Yn.has(r)||(this.Yn.add(r),console.warn(`[mach-table:${t.code}] ${t.message}`))}this.r.treeData&&this.n.nt().length>0&&console.warn("[mach-table] treeData \u4E0E rowGroup \u4E0D\u652F\u6301\u540C\u65F6\u542F\u7528\uFF0C\u884C\u5206\u7EC4\u5DF2\u88AB\u5FFD\u7565")}}ic(e){if(!(this.r.suppressWarnings||this.x)&&this.ac!==e){this.ac=e;for(let t of Vn(e))this.Yn.has(t)||(this.Yn.add(t),console.warn(`[mach-table] ${t}`))}}Je(){this.zt.kr=!0,this.yr.Pl({columns:!0})}h(e){(e.data||e.cells)&&(this.zt.kr=!0),this.yr.Pl(e)}Fl(e){return this.yr.batch(e)}Dm(e){this.x||(e.columns?this.Am():(e.header&&this.K.ai(),e.pool?this.a.bs():e.layout&&this.Te()),this.Lm(e),e.data&&!e.pool&&!e.columns?this.a.rm():e.cells&&this.a.refreshCells(e.cells===!0?void 0:e.cells),e.pinned&&this.me.refresh(),e.summary&&this.ce.refresh(),e.overlays&&this.a.Zs())}Lm(e){!(e.data||e.cells)||e.layout||e.columns||e.pool||this.zt.Jn()&&this.qe()}Am(){this.ws(),this.ic(this.n.xi()),this.a.vn(),this.K.ai(),this.a.bs(),this.Te(),this.me.ge(),this.ce.refresh(),this.emit("displayedColumnsChanged",{})}Te(){if(this.x)return;let e=this.le.start();this.wn(),this.zt.Jn(),this.n.ba(this.o.vs());let t=this.n.c().map(r=>`${r.id}:${r.currentWidth}`).join("|");this.da&&t!==this.da&&this.a.vn(),this.da=t,this.o.root.setAttribute("aria-colcount",String(this.n.c().length)),this.K.et(),this.a.Te(),this.me.et(),this.ce.refresh(),this.le.mh(e)}wn(){if(!this.o.root)return;let e=this.r.treeData||this.n.nt().length>0;this.o.root.setAttribute("role",e?"treegrid":"grid"),this.r.rowSelection==="multiple"?this.o.root.setAttribute("aria-multiselectable","true"):this.o.root.removeAttribute("aria-multiselectable"),this.n.c().some(r=>!!r.colDef.editable)?this.o.root.removeAttribute("aria-readonly"):this.o.root.setAttribute("aria-readonly","true")}qe(e=!0){this.x||(this.zt.Jn(),this.n.ba(this.o.vs()),e&&this.a.vn(),this.K.et(),this.a.yn(),this.a.Js(),this.a.li(!0),this.me.et(),this.ce.refresh())}destroy(){if(!this.x){if(this.It&&(clearTimeout(this.It),this.It=null,this.fa()),this.x=!0,this.Me(),this.Ci&&cancelAnimationFrame(this.Ci),this.Ci=0,this.api){this.nc();try{this.emit("gridDestroyed",{})}catch(e){console.error("[mach-table] grid destroy event",e)}}this.R.dispose(),this.fe.clear()}}};function Wn(n,e={}){if(!n)throw new Error("[mach-table] createGrid requires a container element");if(typeof document>"u")throw new Error("[mach-table] createGrid can only be used in a browser environment");return new nr(n,e).api}function Ga(n){return n.mode==="allMatching"?{mode:"allMatching",excludedKeys:[...n.excludedKeys]}:{mode:"explicit",selectedKeys:[...n.selectedKeys]}}function $n(n,e){if(e.scope!=="filtered"&&e.scope!=="selected")throw new TypeError("[MachTable] Remote export scope must be filtered or selected.");let t=n.state.get();return{version:1,scope:e.scope,columnIds:t.columns.filter(r=>!r.hide).map(r=>r.colId),sortModel:t.sortModel.map(r=>({...r})),filterModel:j(t.filterModel),advancedFilterModel:V(t.advancedFilterModel),quickFilterText:t.quickFilterText,...e.scope==="selected"?{selection:Ga(e.selection??{mode:"explicit",selectedKeys:t.selectedRowIds})}:{}}}function Na(n){return n.value===!0?"\u662F":n.value===!1?"\u5426":""}function Oa(n){return e=>{if(e.value==null||e.value==="")return"";let t=e.value instanceof Date?e.value.toISOString():String(e.value);return n==="datetime"?t.slice(0,16).replace("T"," "):t.slice(0,10)}}function Fa(n){return e=>{if(e.value==null)return"";let t=n.find(r=>r.value===e.value);return t?t.label:String(e.value)}}function Ha(n,e){return n.filterable===!1?!1:e==="number"?"number":e==="date"?"date":e==="select"||e==="boolean"?"set":"text"}function Va(n,e,t){if(t==="number"){n.type="rightAligned";return}if(t==="date"){n.valueFormatter=Oa(e.format);return}if(t==="boolean"){n.valueFormatter=Na;return}if(t!=="select")return;let r=e.options??[];n.valueFormatter=Fa(r),e.editable&&(n.cellEditor="select",n.cellEditorParams={options:r})}function Un(n){let e=n.type??"string",t={colId:n.field,field:n.field,headerName:n.title??n.field,width:n.width,minWidth:n.minWidth,maxWidth:n.maxWidth,flex:n.flex,pinned:n.pinned??void 0,hide:n.hidden??!1,editable:n.editable??!1,sortable:n.sortable??!0,resizable:n.resizable??!0,filter:Ha(n,e),cellClass:n.cellClass};return Va(t,n,e),t}function jn(n){let e=new Map(n.fields.map(i=>[i.field,i])),t=new Set,r=[];for(let i of n.fields){if(t.has(i.field))continue;(n.groups??[]).some(s=>s.fields.includes(i.field))||(r.push(Un(i)),t.add(i.field))}for(let i of n.groups??[]){let o=[];for(let s of i.fields){let a=e.get(s);!a||t.has(s)||(o.push(Un(a)),t.add(s))}o.length>0&&r.push({headerName:i.title,children:o})}return r}function H(n){let e=n();return e&&!e.isDestroyed()?e:null}function qn(n){let e=()=>n.getApi();return{search(t){H(e)?.filtering.setQuickText(t)},async refresh(){if(n.reload){await n.reload();return}let t=H(e);t&&(t.rows.isRemote()?await t.rows.reload():t.view.refreshCells())},openColumns(t){H(e)?.columns.openWorkbench(t)},setDensity(t){H(e)?.updateOptions({size:t})},selectAll(t=!0){H(e)?.selection.selectAll(t)},clearSelection(){let t=H(e);t?.selection.clear(),t?.selection.clearRange()},resetColumns(){H(e)?.columns.resetState()},resetView(){H(e)?.batch(t=>{t.selection.clear(),t.selection.clearRange(),t.filtering.setModel(null),t.filtering.setAdvancedModel(null),t.sorting.setModel(null),t.pagination.setPage(1),t.columns.resetState()})},undo(){return H(e)?.editing.undo()??!1},redo(){return H(e)?.editing.redo()??!1},canUndo(){return H(e)?.editing.canUndo()??!1},canRedo(){return H(e)?.editing.canRedo()??!1},exportCsv(t="mach-table.csv"){let r=H(e);return r?Gt(t,r.io.exportCsv({prependBOM:!0}),"text/csv;charset=utf-8"):!1},async toggleFullscreen(){if(typeof document>"u")return!1;if(document.fullscreenElement)return await document.exitFullscreen?.(),!1;let r=H(e)?.view.getRoot(),i=n.getFullscreenElement?.()??r?.parentElement??r;return i?.requestFullscreen?(await i.requestFullscreen(),!0):!1}}}var Fe={sortable:!1,resizable:!1,movable:!1,filter:!1,suppressSizeToFit:!0,suppressColumnMenu:!0};function Yn(n={}){let e=n.width??40;return{colId:"sel",headerName:"",width:e,minWidth:n.minWidth??e,maxWidth:n.maxWidth??e,pinned:"left",checkboxSelection:!0,...Fe,...n}}function Xn(n={}){let e=n.width??52;return{colId:"idx",headerName:"#",type:"index",width:e,minWidth:n.minWidth??e,maxWidth:n.maxWidth??e,pinned:"left",align:"center",headerAlign:"center",...Fe,...n}}function Jn(n={}){let e=n.width??40;return{colId:"drag",headerName:"",rowDrag:!0,width:e,minWidth:n.minWidth??e,maxWidth:n.maxWidth??e,pinned:"left",...Fe,...n}}function Zn(n={actions:[]}){let{width:e,pinned:t,...r}=n,i=r.actions?.length??0,o=r.overflow==="inline"?i:Math.min(i,r.max??3),s=r.overflow!=="inline"&&i>o,a=Math.max(1,o)*26+(s?26:0)+10;return{colId:"op",headerName:"\u64CD\u4F5C",width:e??Math.max(64,a),pinned:t??"right",cellRenderer:we(r),...Fe,cellRendererParams:void 0}}function Qn(n={}){let{width:e,pinned:t,...r}=n,i=(r.onView?1:0)+(r.edit===!1?0:1)+(r.onDelete?1:0)+(r.extraActions?.length??0),o=r.overflow==="inline"?i:Math.min(i,r.max??3),s=r.overflow!=="inline"&&i>o,a=Math.max(2,o)*26+(s?26:0)+10;return{colId:"op",headerName:"\u64CD\u4F5C",width:e??Math.max(72,a),pinned:t??"right",cellRenderer:er(r),...Fe,cellRendererParams:void 0}}function eo(){return{accessor:(n,e={})=>({...e,field:n}),display:n=>({...n}),group:n=>({...n,children:[...n.children]})}}function to(n){return[...n]}function Yr(n,e){return e===void 0?n:typeof e!="object"||e===null||typeof n!="object"||n===null?e:{...n,...e}}function Ba(n,e){return typeof n!="function"?e:typeof e!="function"?n:(...t)=>{let r;try{n(...t)}catch(i){r=i}try{e(...t)}catch(i){r??(r=i)}if(r!==void 0)throw r}}function za(n,e){if(!(!n.components&&!e.components))return{cellRenderers:{...n.components?.cellRenderers,...e.components?.cellRenderers},cellEditors:{...n.components?.cellEditors,...e.components?.cellEditors}}}function _a(n,e){if(!n.columnTypes&&!e.columnTypes)return;let t={},r=new Set([...Object.keys(n.columnTypes??{}),...Object.keys(e.columnTypes??{})]);for(let i of r)t[i]={...n.columnTypes?.[i],...e.columnTypes?.[i]};return t}function Ka(n,e,t){for(let r of new Set([...Object.keys(e),...Object.keys(t)])){if(!/^on[A-Z]/.test(r))continue;let i=e[r],o=t[r];typeof i!="function"||typeof o!="function"||(n[r]=Ba(i,o))}}function Wa(n,e){let t={...n,...e,features:e.features??n.features};(n.defaultColDef||e.defaultColDef)&&(t.defaultColDef={...n.defaultColDef,...e.defaultColDef}),(n.locale||e.locale)&&(t.locale={...n.locale,...e.locale});let r=za(n,e);r&&(t.components=r);let i=_a(n,e);return i&&(t.columnTypes=i),(n.aggFuncs||e.aggFuncs)&&(t.aggFuncs={...n.aggFuncs,...e.aggFuncs}),t.pagination=Yr(n.pagination,e.pagination),t.statusBar=Yr(n.statusBar,e.statusBar),t.watermark=Yr(n.watermark,e.watermark),Ka(t,n,e),t}function Xr(...n){return n.reduce(Wa,{})}function ro(n={}){return Xr({defaultColDef:{sortable:!0,resizable:!0,movable:!0,filter:!0},enableColumnResize:!0,rowSelection:"multiple",columnMenu:!0,contextMenu:!0,enableRangeSelection:!0,fillHandle:!0,statusBar:!0,stripedRows:!0},n)}function io(n){return n}function no(n){return n}function oo(n){return n}function He(n){return`${typeof n}:${String(n)}`}function Jr(n,e){return typeof n=="number"&&Number.isFinite(n)?n:e}function Zr(n){let e=Math.max(0,Jr(n.ttlMs,3e5)),t=Math.max(1,Math.floor(Jr(n.maxSize,2e3))),r=Math.max(0,Jr(n.batchDelayMs,0)),i=new Map,o=new Map,s=new Map,a=null,l=null,d=!1,c=v=>{let g=i.get(v);if(g){if(g.expiresAt<=Date.now()){i.delete(v);return}return i.delete(v),i.set(v,g),g}},u=(v,g)=>{for(i.delete(v),i.set(v,{label:g,expiresAt:e===0?1/0:Date.now()+e});i.size>t;)i.delete(i.keys().next().value)},h=v=>o.get(v.id)===v,p=(v,g,y)=>{h(v)&&(o.delete(v.id),s.delete(v.id),v.batch&&v.batch.pendingCount--,v.batch=void 0,y?v.reject(y.cause):v.resolve(g))},m=()=>{!d&&s.size>0&&a==null&&l==null&&(a=setTimeout(()=>{R()},r))},b=()=>{if(l?.pendingCount===0){let v=l;l=null,v.controller.abort()}s.size===0&&a!=null&&(clearTimeout(a),a=null),m()},w=(v,g)=>{let y=new Set(v.entries.map(T=>T.id)),D=new Map;for(let T of g){let O=He(T.value);y.has(O)&&D.set(O,String(T.label))}for(let T of v.entries){if(!h(T))continue;let O=D.get(T.id);u(T.id,O),p(T,O)}},C=(v,g)=>{let y=[];for(let D of v.entries)h(D)&&(y.push(D.key),p(D,void 0,{cause:g}));if(!(y.length===0||v.controller.signal.aborted))try{Promise.resolve(n.onError?.(g,y)).catch(()=>{})}catch{}},R=async()=>{if(a=null,d||l||s.size===0)return;let v=[...s.values()];s.clear();let g={entries:v,controller:new AbortController,pendingCount:v.length};for(let y of v)y.batch=g;l=g;try{let y=await n.load(v.map(D=>D.key),g.controller.signal);!d&&!g.controller.signal.aborted&&w(g,y)}catch(y){C(g,y)}finally{l===g&&(l=null),m()}},M=v=>{if(d)return Promise.reject(new Error("[MachTable] Dictionary resolver has been destroyed."));let g=He(v),y=c(g);if(y)return Promise.resolve(y.label);let D=o.get(g);if(D)return D.promise;let T,O,W=new Promise((ar,fo)=>{T=ar,O=fo}),L={id:g,key:v,promise:W,resolve:T,reject:O};return o.set(g,L),s.set(g,L),m(),W};return{get:v=>c(He(v))?.label,resolve:M,async resolveMany(v){let g=await Promise.all(v.map(async y=>[y,await M(y)]));return new Map(g.filter(y=>y[1]!==void 0))},prime(v){if(d)return;let g=new Map;for(let y of v){let D=He(y.value);g.delete(D),g.set(D,String(y.label))}for(let[y,D]of g){u(y,D);let T=o.get(y);T&&p(T,D)}b()},invalidate(v){if(v)for(let g of v){let y=He(g);i.delete(y);let D=o.get(y);D&&p(D,void 0)}else{i.clear();for(let g of o.values())p(g,void 0)}b()},destroy(){d=!0,a!=null&&clearTimeout(a),a=null,l?.controller.abort(),l=null;let v=new Error("[MachTable] Dictionary resolver has been destroyed.");for(let g of o.values())p(g,void 0,{cause:v});i.clear()},get size(){return i.size}}}function Ve(n){return n!=null&&n!==""}function $a(n){if(!Ve(n))return null;let e=typeof n=="number"?n:Number(n);return Number.isFinite(e)?e:null}function or(n,e){try{return new Intl.NumberFormat(n,e)}catch{return new Intl.NumberFormat(void 0,e)}}function so(n,e){try{return new Intl.DateTimeFormat(n,e)}catch{let t={...e};return delete t.timeZone,new Intl.DateTimeFormat(void 0,t)}}function Ua(n){if(!Ve(n))return null;let e=n instanceof Date?n:new Date(n);return Number.isFinite(e.getTime())?e:null}function ao(n={}){let e=n.emptyText??"",t=n.invalidText??"\u2014",r=or(n.locale,{maximumFractionDigits:n.maximumFractionDigits??2}),i=or(n.locale,{maximumFractionDigits:0}),o=or(n.locale,{style:"currency",currency:n.currency??"CNY",currencyDisplay:n.currencyDisplay??"symbol",maximumFractionDigits:n.maximumFractionDigits??2}),s=or(n.locale,{style:"percent",maximumFractionDigits:n.maximumFractionDigits??2}),a=so(n.locale,{year:"numeric",month:"2-digit",day:"2-digit",...n.timeZone?{timeZone:n.timeZone}:{}}),l=so(n.locale,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,...n.timeZone?{timeZone:n.timeZone}:{}}),d=(u,h=1)=>({value:p})=>{if(!Ve(p))return e;let m=$a(p);return m==null?t:u.format(m*h)},c=u=>({value:h})=>{if(!Ve(h))return e;let p=Ua(h);return p==null?t:u.format(p)};return Object.freeze({text:{align:"left",filter:"text"},number:{align:"right",filter:"number",cellEditor:"number",valueFormatter:d(r)},integer:{align:"right",filter:"number",cellEditor:"number",valueFormatter:d(i)},money:{align:"right",filter:"number",cellEditor:"number",valueFormatter:d(o)},percent:{align:"right",filter:"number",cellEditor:"number",valueFormatter:d(s)},percentage:{align:"right",filter:"number",cellEditor:"number",valueFormatter:d(s,.01)},date:{align:"center",filter:"date",cellEditor:"date",valueFormatter:c(a)},datetime:{align:"center",filter:"date",valueFormatter:c(l)},boolean:{align:"center",filter:"set",valueFormatter:({value:u})=>u===!0?n.trueText??"\u662F":u===!1?n.falseText??"\u5426":e},status:{filter:"set",cellRenderer:"statusTag"},link:{filter:"text",cellRenderer:"link"}})}function lo(n,e={}){return t=>{if(!Ve(t.value))return e.emptyText??"";let r=t.value,i=e.fallback?.(r)??String(r),o=n.get(r);if(o!==void 0)return o;let s=f("span","mach-dictionary-value mach-dictionary-value--loading");s.textContent=e.loadingText??i;let a=!0;return n.resolve(r).then(l=>{!a||!s.isConnected||(s.textContent=l??i,s.classList.remove("mach-dictionary-value--loading"))}).catch(()=>{!a||!s.isConnected||(s.textContent=i,s.classList.remove("mach-dictionary-value--loading"),s.classList.add("mach-dictionary-value--error"))}),{el:s,destroy:()=>{a=!1}}}}function co(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function uo(n){return typeof TextEncoder>"u"?n.length*2:new TextEncoder().encode(n).byteLength}function ho(n){if(typeof n!="string")return null;let e=n.trim();return e&&e.length<=256?e:null}function sr(n){if(n==null||typeof n!="object")return null;let e=n;if(e.version!==1)return null;let t=$({version:2,columns:e.columns,sortModel:e.sortModel,filterModel:e.filterModel,advancedFilterModel:e.advancedFilterModel,quickFilterText:e.quickFilterText,pagination:{enabled:!0,page:1,pageSize:e.pageSize},selectedRowIds:[],expandedRowIds:[],expandedGroupIds:[]});return t?{version:1,columns:t.columns,sortModel:t.sortModel,filterModel:t.filterModel,advancedFilterModel:t.advancedFilterModel,quickFilterText:t.quickFilterText,pageSize:t.pagination.pageSize}:null}function Ce(n){if(n==null||typeof n!="object")return null;let e=n,t=ho(e.id),r=typeof e.name=="string"?e.name.trim().slice(0,120):"",i=sr(e.state);if(e.schemaVersion!==1||!t||!r||!i)return null;let o=typeof e.createdAt=="number"&&Number.isFinite(e.createdAt)?e.createdAt:Date.now(),s=typeof e.updatedAt=="number"&&Number.isFinite(e.updatedAt)?e.updatedAt:o;return{schemaVersion:1,id:t,name:r,createdAt:o,updatedAt:s,state:i}}function Qr(n){let e=n.state.get();return{version:1,columns:e.columns,sortModel:e.sortModel,filterModel:e.filterModel,advancedFilterModel:e.advancedFilterModel,quickFilterText:e.quickFilterText,pageSize:e.pagination.pageSize}}function ei(n,e,t={}){let r=sr(e);if(!r||n.isDestroyed())return!1;let i=n.state.get();return n.state.apply({...i,columns:r.columns,sortModel:r.sortModel,filterModel:r.filterModel,advancedFilterModel:r.advancedFilterModel,quickFilterText:r.quickFilterText,pagination:{...i.pagination,page:1,pageSize:r.pageSize}},{sections:["columns","sort","filter","pagination"],emitEvents:t.emitEvents}),!0}function ti(n={}){let e=(n.namespace??"mach-table:views").replace(/:+$/,""),t=Math.max(1,Math.floor(n.maxViews??50)),r=Math.max(4096,Math.floor(n.maxBytes??512*1024)),i=l=>`${e}:${encodeURIComponent(l)}`,o=(l,d,c)=>{try{n.onError?.(l,d,c)}catch{}},s=l=>{let d=(n.storage??co())?.getItem(i(l));if(!d||uo(d)>r)return[];let c=JSON.parse(d);return c.schemaVersion!==1||!Array.isArray(c.views)?[]:c.views.flatMap(u=>{let h=Ce(u);return h?[h]:[]}).slice(0,t)},a=(l,d)=>{let c=JSON.stringify({schemaVersion:1,savedAt:Date.now(),views:d});if(uo(c)>r)throw new RangeError(`[MachTable] Saved views for "${l}" exceed ${r} bytes.`);let u=n.storage??co();if(!u)throw new Error("[MachTable] Saved view storage is unavailable.");u.setItem(i(l),c)};return{list(l){try{return s(l)}catch(d){return o(d,"list",l),[]}},save(l,d){try{let c=Ce(d);if(!c)throw new TypeError(`[MachTable] Invalid saved view for "${l}".`);let u=s(l).filter(h=>h.id!==c.id);u.unshift(c),a(l,u.slice(0,t))}catch(c){throw o(c,"save",l),c}},remove(l,d){try{a(l,s(l).filter(c=>c.id!==d))}catch(c){throw o(c,"remove",l),c}}}}function ja(){try{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID()}catch{}return`view-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function po(n,e){let t=e.scope.trim();if(!t||t.length>512)throw new TypeError("[MachTable] Grid view scope must contain between 1 and 512 characters.");let r=e.store??ti(),i=async()=>(await r.list(t)).flatMap(s=>{let a=Ce(s);return a?[a]:[]}).sort((s,a)=>a.updatedAt-s.updatedAt);return{list:i,async save(o,s){let a=o.trim().slice(0,120);if(!a)throw new TypeError("[MachTable] Grid view name must be a non-empty string.");let l=ho(s)??ja(),d=(await i()).find(h=>h.id===l),c=Date.now(),u={schemaVersion:1,id:l,name:a,createdAt:d?.createdAt??c,updatedAt:c,state:Qr(n)};return await r.save(t,u),u},async apply(o,s){let a=typeof o=="string"?(await i()).find(d=>d.id===o):Ce(o),l=typeof o=="string"?o:"provided view";if(!a)throw new Error(`[MachTable] Grid view "${l}" was not found.`);if(!ei(n,a.state,s))throw new Error(`[MachTable] Grid view "${a.id}" could not be applied.`);return a},async remove(o){await r.remove(t,o)}}}var qa=Be;0&&(module.exports={BUILTIN_AGG_FUNCS,DEFAULT_LOCALE,EVENT_TYPES,LOCALE_EN,actionsColumn,advancedFilterCondition,advancedFilterGroup,applyGridViewState,buildColDefsFromSchema,captureGridViewState,clearGridState,createActionButtonsRenderer,createAggResolver,createBusinessColumnTypes,createCachedDictionary,createColumnHelper,createDictionaryRenderer,createEnterprisePreset,createGrid,createGridViewManager,createLocalGridStateStore,createLocalGridViewStore,createMachTableCommands,createMachTablePreset,createProgressBarRenderer,createRemoteExportRequest,createRowActionsRenderer,createStatusTagRenderer,defineColumns,defineGridOptions,defineMachTableConfig,defineMachTablePreset,describeFilter,downloadFile,dragColumn,escapeHtml,formatText,formatTwo,getByPath,indexColumn,isColDefGroup,isSafePath,linkRenderer,loadGridState,matchLocaleKey,normalizeAdvancedFilterModel,normalizeColumnFilter,normalizeFilterModel,normalizeGridState,normalizeGridViewState,normalizeSavedGridView,parseCsv,parseDelimited,parseTsv,resolveGridFeatures,resolveSaveConflict,resolveTagVariant,rowActionsColumn,sanitizeFormulaCell,saveGridState,selectionColumn,setByPath,toTsv,validateGridOptions,version});
|
|
6
|
+
`?s+=2:s++;continue}i+=a,s++}return(i!==""||r.length>0)&&(r.push(i),t.push(r)),t}function ps(n){let e=null;try{return e=document.createElement("textarea"),e.value=n,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.focus(),e.select(),document.execCommand("copy")}catch{return!1}finally{e?.remove()}}async function pt(n){try{if(typeof navigator<"u"&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(n),!0}catch{}return ps(n)}var Ni=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),fs=new Set([...Ni,"Enter","F2","Tab"," ","Escape","Delete","Backspace"]),ft=class{constructor(e){this.e=e;this.dl=e=>{if(this.Wo(e)||this.e.r.suppressClipboard)return;let t=this.e.a.Qr();if(!t)return;let r=this.e.ul(t),i=e.clipboardData;i&&typeof i.setData=="function"?i.setData("text/plain",r):pt(r),e.type==="cut"&&this.e.$o(t),e.preventDefault()};this.Eu=e=>{if(this.Wo(e)||this.e.r.suppressClipboard)return;let t=this.e.a.Ko();if(!t)return;let r=e.clipboardData,i=r&&typeof r.getData=="function"?r.getData("text/plain"):null;typeof i!="string"||i===""||(e.preventDefault(),this.e.hl(i,t.row,t.colIdx))};this.Tu=e=>{this.Wo(e)||this.e.s()||this.Du(e)||fs.has(e.key)&&(this.xu(e)||this.Ru(e)||this.Su(e))}}init(){this.ll("addEventListener")}destroy(){this.ll("removeEventListener")}ll(e){let t=this.e.o.root;t[e]("keydown",this.Tu),t[e]("copy",this.dl),t[e]("cut",this.dl),t[e]("paste",this.Eu)}cl(e,t,r){let i=this.e.n.c(),o=i.findIndex(d=>d.id===t);if(o<0)return null;let s=this.e.i.A(),a=o,l=e;for(let d=0;d<(i.length+1)*(s+1);d++){if(a+=r,a>=i.length){if(l>=s-1)return null;a=0,l=this.Ht(l+1,1)}else if(a<0){if(l<=0)return null;a=i.length-1,l=this.Ht(l-1,-1)}if(l<0||l>=s)return null;let c=this.e.i.m(l);if(c&&!c.isDetail&&this.e.l.q(c,i[a]))return{rowIndex:l,column:i[a]}}return null}Ht(e,t){let r=this.e.i.A();for(;e>=0&&e<r;){let i=this.e.i.m(e);if(!i||!i.isDetail)return e;e+=t}return-1}Wo(e){let t=e.target;return e.defaultPrevented||t instanceof HTMLElement&&(t.isContentEditable||!!t.closest("button,a[href],input,textarea,select"))||this.e.l.isEditing()}Du(e){if(!e.ctrlKey&&!e.metaKey)return!1;let t=e.key.toLowerCase();return t==="a"?(this.e.r.rowSelection==="multiple"&&(e.preventDefault(),this.e.g.selectAll(!0)),!0):e.altKey||t!=="z"&&t!=="y"?!1:(e.preventDefault(),t==="z"&&!e.shiftKey?this.e.z.undo():this.e.z.redo(),!0)}xu(e){let t=this.e.a;if(e.key==="Escape")return this.e.Me(),this.e.r.enableRangeSelection&&t.ke()&&(e.preventDefault(),t.fr()),!0;if(e.key!=="Delete"&&e.key!=="Backspace")return!1;if(!this.e.r.enableRangeSelection)return!0;let r=t.ke();return r&&!(r.r1===r.r2&&r.c1===r.c2)&&(e.preventDefault(),this.e.$o(r)),!0}Ru(e){if(this.e.a.E)return!1;let t=this.e.n.c();return this.e.i.A()>0&&t.length>0&&(e.preventDefault(),this.e.a.Ge(0,t[0].id)),!0}Su(e){let t=this.e.a,r=t.E;if(!r)return;let i=this.e.n.c(),o=i.findIndex(c=>c.id===r.colId),s=this.e.i.A();if(o<0||s===0)return;let a={row:r.rowIndex,colIdx:o},l=this.Mu(e,a,i,s);if(!l)return;e.preventDefault();let d=l.row!==a.row||l.colIdx!==a.colIdx;if(e.shiftKey&&this.e.r.enableRangeSelection&&d){t.Iu(l.row,l.colIdx);return}d&&t.Ge(l.row,i[l.colIdx].id)}Mu(e,t,r,i){return Ni.has(e.key)?this.Au(e,t,r.length,i):e.key==="Enter"||e.key==="F2"?this.Lu(e,t,r,i):e.key===" "?(this.Pu(t.row),t):e.key==="Tab"?this.ku(e,t,r):null}Au(e,t,r,i){let{row:o,colIdx:s}=t;switch(e.key){case"ArrowUp":o=this.Xi(o,this.Ht(o-1,-1),i);break;case"ArrowDown":o=this.Xi(o,this.Ht(o+1,1),i);break;case"ArrowLeft":s=Math.max(0,s-1);break;case"ArrowRight":s=Math.min(r-1,s+1);break;case"Home":s=0,e.ctrlKey&&(o=0);break;case"End":s=r-1,e.ctrlKey&&(o=Math.max(0,this.Ht(i-1,-1)));break;case"PageUp":case"PageDown":o=this.Gu(e.key,o,i);break}return{row:o,colIdx:s}}Xi(e,t,r){return t>=0&&t<r?t:e}Gu(e,t,r){let i=this.e.o.M.center,o=Math.max(1,Math.floor(i.clientHeight/this.e.r.rowHeight)),s=e==="PageUp"?-1:1,a=Math.max(0,Math.min(r-1,t+o*s));return this.Xi(t,this.Ht(a,s),r)}Lu(e,t,r,i){let o=this.e.i.m(t.row),s=r[t.colIdx];if(o&&!o.isDetail&&s&&this.e.l.q(o,s))return this.e.l.start(t.row,s,e.key==="F2"?e.key:null),t;let a=this.Ht(t.row+1,1);return{...t,row:this.Xi(t.row,a,i)}}Pu(e){let t=this.e.i.m(e);if(!(!t||t.isDetail)){if(t.isGroup){this.e.i.Lo(t.id);return}this.e.r.rowSelection!=="none"&&this.e.g.Za(t,!t.selected,this.e.r.rowSelection==="single")}}ku(e,t,r){let i=this.cl(t.row,r[t.colIdx].id,e.shiftKey?-1:1);return i?(this.e.a.Ge(i.rowIndex,i.column.id),this.e.l.start(i.rowIndex,i.column),t):null}};var P=null;function Fi(n){P?.owner&&(n===P.owner||n.contains(P.owner))&&P.close()}function Hi(n){let e=n.target;P?.contains(e)||P?.close()}function yt(){P?.reposition()}function Vi(n){n.key!=="Escape"||!P||(n.preventDefault(),n.stopImmediatePropagation(),P.close(!0))}function ms(n){P?.close!==n.close&&P?.close(),!P&&(P=n,document.addEventListener("mousedown",Hi,!0),document.addEventListener("keydown",Vi,!0),window.addEventListener("resize",yt),window.addEventListener("scroll",yt,!0))}function gs(n){P?.close===n&&(P=null,document.removeEventListener("mousedown",Hi,!0),document.removeEventListener("keydown",Vi,!0),window.removeEventListener("resize",yt),window.removeEventListener("scroll",yt,!0))}function oe(n,e){return e?`${n} ${e}`:n}function gt(n){let e=[];return n.forEach((t,r)=>{t.disabled||e.push(r)}),e}function Oi(n,e,t){let r=gt(n);if(r.length===0)return-1;let i=r.indexOf(e);return i<0?t>0?r[0]:r[r.length-1]:r[Math.max(0,Math.min(r.length-1,i+t))]}function mt(n,e){return n.findIndex(t=>t.value===e&&!t.disabled)}function X(n){let e=f("div",oe("mach-select-control",n.classNames?.root)),t=f("select",oe("mach-select-native",n.classNames?.native));t.hidden=!0,t.tabIndex=-1,t.setAttribute("aria-hidden","true");let r=f("button",oe("mach-select-trigger",n.classNames?.trigger));r.type="button",r.setAttribute("role","combobox"),r.setAttribute("aria-haspopup","listbox"),r.setAttribute("aria-expanded","false"),r.setAttribute("aria-label",n.ariaLabel);let i=f("span",oe("mach-select-value",n.classNames?.value)),o=f("span",oe("mach-select-caret",n.classNames?.caret));o.setAttribute("aria-hidden","true"),r.append(i,o);let s=f("div",oe("mach-select-listbox",n.classNames?.listbox));s.id=ci("mach-select-listbox"),s.setAttribute("role","listbox"),s.setAttribute("aria-hidden","true"),r.setAttribute("aria-controls",s.id),e.append(t,r);let a=[...n.options],l=[],d=-1,c=!1,u=()=>n.themeSource??e.closest(".mach-root")??e,h=()=>{let g=a.find(w=>w.value===t.value);i.textContent=g?.label??t.value,l.forEach((w,W)=>{let I=a[W]?.value===t.value;w.setAttribute("aria-selected",I?"true":"false"),w.classList.toggle("mach-select-option--selected",I),w.classList.toggle("mach-select-option--active",W===d)}),r.setAttribute("aria-activedescendant",d>=0?l[d]?.id??"":"")},p=()=>{let g=r.getBoundingClientRect(),w=s.getBoundingClientRect(),W=Math.max(g.width,w.width),I=C(g.left,8,Math.max(8,window.innerWidth-W-8)),Ce=window.innerHeight-g.bottom-8,Q=Ce<Math.min(w.height,240)&&g.top>Ce,N=Q?Math.max(8,g.top-w.height-5):Math.min(window.innerHeight-w.height-8,g.bottom+5);s.style.minWidth=`${g.width}px`,s.style.left=`${I}px`,s.style.top=`${Math.max(8,N)}px`,s.classList.toggle("mach-select-listbox--above",Q)},m=(g=!1)=>s.classList.contains("mach-select-listbox--open")?(s.classList.remove("mach-select-listbox--open","mach-select-listbox--above"),s.setAttribute("aria-hidden","true"),r.setAttribute("aria-expanded","false"),r.removeAttribute("aria-activedescendant"),s.remove(),gs(m),g&&!c&&r.focus({preventScroll:!0}),!0):!1,y=(g,w=!0)=>{!a[g]||a[g].disabled||(d=g,h(),w&&l[g]?.scrollIntoView?.({block:"nearest"}))},v=()=>{c||r.disabled||s.classList.contains("mach-select-listbox--open")||(ms({owner:u(),close:m,contains:g=>e.contains(g)||s.contains(g),reposition:p}),d=mt(a,t.value),d<0&&(d=gt(a)[0]??-1),L(s,u()),document.body.appendChild(s),s.classList.add("mach-select-listbox--open"),s.setAttribute("aria-hidden","false"),r.setAttribute("aria-expanded","true"),p(),h(),l[d]?.scrollIntoView?.({block:"nearest"}))},b=g=>{let w=a[g];!w||w.disabled||(t.value=w.value,d=g,h(),m(!0),t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0})))},x=(g,w)=>{a=[...g],t.replaceChildren(),s.replaceChildren(),l=a.map((I,Ce)=>{let Q=document.createElement("option");Q.value=I.value,Q.textContent=I.label,Q.disabled=I.disabled===!0,t.appendChild(Q);let N=f("button",oe("mach-select-option",n.classNames?.option));return N.id=`${s.id}-option-${Ce}`,N.type="button",N.tabIndex=-1,N.dataset.value=I.value,N.disabled=I.disabled===!0,N.setAttribute("role","option"),N.textContent=I.label,N.addEventListener("mousedown",lo=>lo.preventDefault()),N.addEventListener("click",()=>b(Ce)),s.appendChild(N),N});let W=a.find(I=>!I.disabled)?.value??"";t.value=w!=null&&a.some(I=>I.value===w)?w:W,d=mt(a,t.value),h()},R=g=>{if(g.key==="Tab"){m();return}if(g.key==="Escape"){if(!m(!0))return;g.preventDefault(),g.stopPropagation();return}if(g.key==="Enter"||g.key===" "){g.preventDefault(),g.stopPropagation(),s.classList.contains("mach-select-listbox--open")?b(d):v();return}let w=d;if(g.key==="ArrowDown")w=Oi(a,d,1);else if(g.key==="ArrowUp")w=Oi(a,d,-1);else if(g.key==="Home")w=gt(a)[0]??-1;else if(g.key==="End"){let W=gt(a);w=W[W.length-1]??-1}else return;g.preventDefault(),g.stopPropagation(),s.classList.contains("mach-select-listbox--open")||v(),y(w)},H=()=>{d=mt(a,t.value),h(),n.onChange?.(t.value)};return r.addEventListener("click",()=>{m()||v()}),r.addEventListener("keydown",R),t.addEventListener("change",H),x(a,n.value),{el:e,native:t,trigger:r,listbox:s,contains:g=>e.contains(g)||s.contains(g),isOpen:()=>s.classList.contains("mach-select-listbox--open"),open:v,close:m,focus:()=>r.focus({preventScroll:!0}),getValue:()=>t.value,setValue:g=>{t.value=g,d=mt(a,g),h()},setOptions:x,destroy:()=>{c||(c=!0,m(),r.removeEventListener("keydown",R),t.removeEventListener("change",H),e.remove())}}}function Bi(n,e){let t=document.createElement("input");return t.type=n,t.className="mach-editor-input",e!=null&&e!==""&&(t.value=n==="date"?String(e).slice(0,10):String(e)),t}function ys(n){return n?.options?.length?n.options:(n?.values??[]).map(e=>({label:String(e),value:e}))}function vs(n,e){return e?.options?.length||e?.values?.length?"select":typeof n=="number"?"number":n instanceof Date||typeof n=="string"&&/^\d{4}-\d{2}-\d{2}/.test(n)?"date":"text"}function Tr(n,e,t){let r=n.colDef,i=typeof r.cellEditor=="string"?r.cellEditor:vs(e,r.cellEditorParams);if(i==="date"){let a=Bi("date",e),d=(e==null?"":String(e)).match(/T(\d{2}:\d{2})/);return{el:a,getValue:()=>a.value===""?null:d?`${a.value}T${d[1]}`:a.value,focus:()=>a.focus({preventScroll:!0})}}if(i==="select"){let a=ys(r.cellEditorParams),l=X({ariaLabel:r.headerName??r.field??n.id,options:a.map(d=>({value:String(d.value),label:d.label,disabled:d.disabled})),value:String(e??""),classNames:{root:"mach-editor-select-control",native:"mach-editor-select"}});return{el:l.el,getValue:()=>{let d=l.getValue();return a.find(u=>String(u.value)===d)?.value??d},focus:()=>l.focus(),destroy:()=>l.destroy()}}let o=i==="number",s=Bi(o?"number":"text",e);return!o&&t&&t.length===1&&(s.value=t),{el:s,getValue:()=>o?s.value===""?null:Number(s.value):s.value,focus:()=>{s.focus({preventScroll:!0}),s.select()}}}function se(n){return n!=null&&typeof n.then=="function"}var vt=class{constructor(e){this.e=e;this.Uo=0}Nu(){this.Uo++}jo(){let e=++this.Uo;return()=>e===this.Uo&&!this.e.s()}Ji(e){let t=e[0].node,r=this.e.n.te(),i=r.map(a=>this.e.d(t,a)),o=this.ei(e),s=e.every(a=>Object.is(this.e.d(t,a.column),a.oldValue));return()=>s&&o()&&r.every((a,l)=>Object.is(this.e.d(t,a),i[l]))}ei(e){let t=e[0].node,r=t.data,i=this.e.n.te(),o=new Set(i),s=e.every(a=>a.node===t&&o.has(a.column));return()=>s&&!this.e.s()&&this.e.i.K(t.id)===t&&t.data===r&&this.e.n.te()===i}Zi(e,t){let r=e.map(o=>this.Ou(o,t)),i=o=>{let s=o.filter(a=>a!=null);return s.length||!t()?s:this.Fu(e,t)};return r.some(se)?Promise.all(r.map(o=>Promise.resolve(o))).then(i):i(r)}Ou(e,t){let{node:r,column:i,oldValue:o,newValue:s}=e,a=d=>(t()&&this.e.reportError(d,"validate",{colId:i.id,rowId:r.id}),{colId:i.id,message:"Validation failed"}),l=d=>typeof d=="string"?{colId:i.id,message:d}:null;try{let d=i.colDef.validate?.(s,{oldValue:o,newValue:s,node:r,data:r.data,column:i,colDef:i.colDef,api:this.e.api});return se(d)?d.then(l,a):l(d)}catch(d){return a(d)}}Fu(e,t){let r=this.e.r.rowEditValidator;if(!r)return[];let i=e[0].node,o=Object.create(null);for(let l of this.e.n.te())o[l.id]=this.e.d(i,l);for(let l of e)o[l.column.id]=l.newValue;let s=l=>typeof l=="string"?[{colId:e[0].column.id,message:l}]:l&&typeof l=="object"?Object.entries(l).filter(([,d])=>typeof d=="string"&&d).map(([d,c])=>({colId:d,message:c})):[],a=l=>(t()&&this.e.reportError(l,"validate",{rowId:i.id}),[{colId:e[0].column.id,message:"Row validation failed"}]);try{let l=r({data:i.data,node:i,values:o,api:this.e.api,changes:e.map(({column:d,oldValue:c,newValue:u})=>({colId:d.id,oldValue:c,newValue:u}))});return se(l)?l.then(s,a):s(l)}catch(l){return a(l)}}qo(e,t){let r=[],i=this.ei(e);for(let o of e){if(!t()||!i()||!Object.is(this.e.d(o.node,o.column),o.oldValue)||!this.e.l.q(o.node,o.column)||!this.e.Qi(o.node,o.column,o.newValue,o.oldValue)){for(let s of r.reverse()){if(!t()||!i())break;this.e.Qi(s.node,s.column,s.oldValue,s.newValue)||this.e.reportError(new Error("A valueSetter rejected input rollback"),"inputRollback",{rowId:s.node.id})}return{colId:o.column.id,message:"Value was rejected by the column setter"}}r.push(o)}return t()&&i()?null:{colId:e[0].column.id,message:"Input target changed during commit"}}Hu(e){let t=this.jo();if(this.e.s()||this.e.l.isEditing())return;let r=new Map;for(let a of e){if(a.newValue===void 0||Object.is(a.oldValue,a.newValue)||!this.e.l.q(a.node,a.column))continue;let l=r.get(a.node)??[];l.push(a),r.set(a.node,l)}let i=[...r.values()].map(a=>{let l=this.Ji(a),d=()=>t()&&l();return{changes:a,current:d,validation:this.Zi(a,d)}}),o=a=>{this.pl(i,a,t)},s=i.map(a=>a.validation);s.some(se)?Promise.all(s.map(a=>Promise.resolve(a))).then(o):o(s)}pl(e,t,r){let i=e.map(()=>({applied:!1,errors:[]}));if(!r())return i;let o=new Set;this.e.z.fl();try{e.forEach(({changes:s,current:a},l)=>{let d=i[l];if(!a()||!s.length)return;d.errors=[...t[l]];let c=d.errors.length?null:this.qo(s,r);if(!r())return;if(c&&d.errors.push(c),d.errors.length){this.e.reportError(new Error(d.errors.map(h=>h.message).join("; ")),"validate",{rowId:s[0].node.id,errors:d.errors});return}let u=this.ei(s);d.applied=!0;for(let h of s){if(!r()||!u()){d.applied=!1;break}this.e.Yo(h.node,h.column,h.oldValue,h.newValue),h.node.rowIndex>=0&&o.add(h.node.rowIndex)}})}finally{this.e.z.ml()}return o.size&&r()&&(this.e.a.ft([...o]),this.e.ce.refresh(),this.e.Ye.refresh()),i}};function ae(n,e,t,r,i,o){let s=t.colDef.valueParser;if(!s)return r;let a=s({api:n.api,colDef:t.colDef,column:t,data:e.data,node:e,value:r,oldValue:o,source:i});if(a!=null&&typeof a.then=="function")throw new TypeError("valueParser must return a synchronous value");return a}function Pe(n,e,t,r){let i=n.d(e,t),o=t.colDef.valueSerializer;if(o)try{let s=o({api:n.api,colDef:t.colDef,column:t,data:e.data,node:e,value:i,target:r});if(s!=null&&typeof s.then=="function")throw new TypeError("valueSerializer must return a synchronous value");return s}catch(s){throw n.reportError(s,"valueSerializer",{colId:t.id,rowId:e.id}),s}return r==="xlsx"||r==="csv"&&typeof i=="number"?i:U(n,e,t,i)}var bs='<path d="M3 8.5 6.4 12 13.5 4"/>',ws='<path d="m4 4 8 8m0-8-8 8"/>';function _i(n,e){let t=document.createElement("button");return t.type="button",t.className=`mach-edit-control mach-edit-control--${n}`,t.setAttribute("aria-label",e),t.title=e,t.innerHTML=`<svg viewBox="0 0 16 16" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round">${n==="confirm"?bs:ws}</svg>`,t.addEventListener("mousedown",r=>{r.preventDefault(),r.stopPropagation()}),t}var bt=class{constructor(e){this.e=e;this.b=null;this.D=null;this.ue=null;this.yt=0;this.Vu=e=>{if(this.b&&!(e.isComposing||e.keyCode===229)){if(e.key==="Enter")e.preventDefault(),e.stopPropagation(),this.he(!1);else if(e.key==="Escape")e.preventDefault(),e.stopPropagation(),this.he(!0);else if(e.key==="Tab"){e.preventDefault(),e.stopPropagation();let t=this.b,r=this.e.os.cl(t.rowIndex,t.column.id,e.shiftKey?-1:1);this.he(!1).then(i=>{i&&r&&(this.e.a.cr(r.rowIndex,"nearest"),this.e.a.Ge(r.rowIndex,r.column.id),this.start(r.rowIndex,r.column))})}}}}isEditing(e,t){return this.b?e==null&&t==null?!0:this.b.rowIndex===e&&this.b.column.id===t:this.D?e==null&&t==null?!0:this.ti(this.D)!==e?!1:t==null||this.D.drafts.has(t):!1}en(){return this.b!=null}Ic(){return this.b?.node.rowIndex??(this.D?this.ti(this.D):null)}tn(e){return this.D?e==null||this.ti(this.D)===e:!1}q(e,t){if(e.isDetail||e.isGroup||e.data==null)return!1;let r=t.colDef.editable;if(!r)return!1;if(typeof r=="function")try{return r({api:this.e.api,colDef:t.colDef,column:t,node:e,data:e.data,value:this.e.d(e,t),rowIndex:e.rowIndex})}catch(i){return this.e.reportError(i,"editable",{colId:t.id,rowId:e.id}),!1}return!0}start(e,t,r){if(this.e.r.editType==="fullRow")return this.startRow(e,t.id);if(this.D)return!1;if(this.b)return this.b.rowIndex===e&&this.b.column.id===t.id||this.he(!1).then(p=>{p&&!this.b&&!this.D&&this.start(e,t,r)}),!0;let i=this.e.i.m(e);if(!i||i.data==null||!this.q(i,t))return!1;let o=this.e.a.rn(e,t.id);if(!o)return!1;this.e.Me();let s=this.e.d(i,t),a=this.gl(i,t,e,s,r);if(!a)return!1;M(this.e,o);let l=f("div","mach-cell-editor-shell"),d=f("div","mach-cell-editor-controls"),c=_i("confirm","Confirm edit"),u=_i("cancel","Cancel edit");d.append(c,u),l.append(a.el,d),o.replaceChildren(l),o.classList.add("mach-cell--editing"),o.removeAttribute("title");let h=this.Vu;return a.el.addEventListener("keydown",h),c.addEventListener("click",p=>{p.stopPropagation(),this.he(!1)}),u.addEventListener("click",p=>{p.stopPropagation(),this.he(!0)}),this.b={node:i,column:t,editor:a,rowIndex:e,oldValue:s,cell:o,shell:l,keydown:h,confirmButton:c,cancelButton:u},this.Xo(a,t,i),this.e.emit("cellEditingStarted",{rowIndex:e,colId:t.id,rowNode:i}),!0}startRow(e,t){if(this.b||this.D)return!1;let r=this.e.i.m(e);if(!r||r.data==null||r.isDetail||r.isGroup)return!1;this.e.Me();let i=new Map;for(let l of this.e.n.c()){if(!this.q(r,l))continue;let d=this.e.d(r,l);i.set(l.id,{column:l,oldValue:d,value:d,mounted:null})}if(i.size===0)return!1;let o={node:r,rowIndex:e,drafts:i,validating:!1};if(this.D=o,this.e.a.ft([e]),i.size===0)return this.D=null,this.e.a.ft([e]),!1;let s=i.values().next().value,a=(t?i.get(t):void 0)??s;return a?.mounted&&this.Xo(a.mounted.editor,a.column,r),this.e.emit("rowEditingStarted",{rowIndex:e,rowNode:r,data:r.data}),!0}yl(e,t,r,i){if(this.b)return this.b.node===t&&this.b.column.id===r.id;let o=this.D;if(!o||o.node!==t)return!1;let s=o.drafts.get(r.id);return s?s.mounted?.cell!==i&&(s.mounted&&this.vl(s),!this.Bu(e,o,s,i))?(o.drafts.delete(r.id),!1):!0:!1}Jo(e,t,r){let i=this.D;if(i&&this.ti(i)===e){let o=i.drafts.get(t);o?.mounted?.cell===r&&this.vl(o);return}if(this.b?.cell===r){let o=this.b;this.he(!1),this.b===o&&this.he(!0)}}stop(e=!1){this.he(e)}he(e=!1){if(this.D)return this.Zo(e);let t=this.b;if(!t)return Promise.resolve(!1);if(e)return this.yt++,this.ue=null,Promise.resolve(this.mr(t,!0,t.oldValue));if(this.ue)return this.ue;let r;try{r=t.editor.getValue()}catch(u){return this.e.reportError(u,"cellEditor.getValue",{colId:t.column.id,rowId:t.node.id}),Promise.resolve(this.mr(t,!0,t.oldValue))}try{Object.is(r,t.oldValue)||(r=ae(this.e,t.node,t.column,r,"editor",t.oldValue))}catch(u){return this.e.reportError(u,"valueParser",{colId:t.column.id,rowId:t.node.id}),this.ri(t.editor,u instanceof Error?u.message:String(u)),Promise.resolve(!1)}try{if(t.editor.isCancelAfterEnd?.(r))return Promise.resolve(this.mr(t,!0,t.oldValue))}catch(u){return this.e.reportError(u,"cellEditor.isCancelAfterEnd",{colId:t.column.id,rowId:t.node.id}),Promise.resolve(this.mr(t,!0,t.oldValue))}let i=[{node:t.node,column:t.column,oldValue:t.oldValue,newValue:r}],o=this.e.U.Ji(i),s=++this.yt,a=()=>s===this.yt&&this.b===t&&o(),l=u=>a()?u.length?(this.Qo(t,!1),this.ri(t.editor,u[0].message),!1):this.mr(t,!1,r):(s===this.yt&&this.b===t&&this.mr(t,!0,t.oldValue),!1),d=this.e.U.Zi(i,a);if(!se(d))return Promise.resolve(l(d));this.Qo(t,!0);let c=d.then(l).finally(()=>{this.ue===c&&(this.ue=null)});return this.ue=c,c}Zo(e=!1){let t=this.D;if(!t)return Promise.resolve(!1);if(e)return this.yt++,this.ue=null,Promise.resolve(this.nn(t,!0));if(this.ue)return this.ue;for(let h of t.drafts.values())this.es(h);let r=[];for(let h of t.drafts.values())if(!Object.is(h.oldValue,h.value))try{let p=ae(this.e,t.node,h.column,h.value,"editor",h.oldValue);p!==void 0&&!Object.is(h.oldValue,p)&&r.push({node:t.node,column:h.column,oldValue:h.oldValue,newValue:p})}catch(p){return this.e.reportError(p,"valueParser",{colId:h.column.id,rowId:t.node.id}),this.ts(t,[{draft:h,message:p instanceof Error?p.message:String(p)}]),Promise.resolve(!1)}if(r.length===0)return Promise.resolve(this.nn(t,!1,r));let i=r.map(h=>t.drafts.get(h.column.id)),o=i.map(h=>h.value),s=this.e.U.Ji(r),a=++this.yt,l=()=>a===this.yt&&this.D===t&&s();for(let h of i)h.error=void 0;let d=h=>l()?h.length?(this.ts(t,h.map(({colId:p,message:m})=>({draft:t.drafts.get(p)??i[0],message:m}))),!1):i.some((p,m)=>!Object.is(p.value,o[m]))?(t.validating=!1,this.rs(t,!1),!1):this.nn(t,!1,r):(a===this.yt&&this.D===t&&this.nn(t,!0),!1),c=this.e.U.Zi(r,l);if(!se(c))return Promise.resolve(d(c));t.validating=!0,this.rs(t,!0);let u=c.then(d).finally(()=>{this.ue===u&&(this.ue=null)});return this.ue=u,u}mr(e,t,r){if(this.b!==e)return!1;let i={node:e.node,column:e.column,oldValue:e.oldValue,newValue:r},o=!t&&r!==void 0&&!Object.is(e.oldValue,r);if(o){let s=this.e.U.qo([i],()=>!this.e.s());if(s)return this.Qo(e,!1),this.ri(e.editor,s.message),!1}return this.b=null,o&&this.e.Yo(e.node,e.column,e.oldValue,r),this.ns(e,!0),this.e.s()||(this.e.emit("cellEditingStopped",{rowIndex:e.rowIndex,colId:e.column.id,rowNode:e.node,oldValue:e.oldValue,newValue:o?r:e.oldValue}),e.node.rowIndex>=0&&this.e.a.ft([e.node.rowIndex]),this.e.ce.refresh(),this.e.Ye.refresh()),!0}nn(e,t,r=[]){if(this.D!==e)return!1;let i=t?[]:this._u(e,r);if(i==null)return!1;for(let s of e.drafts.values())s.mounted&&this.ns(s.mounted,!0),s.mounted=null;if(this.D=null,this.e.s())return!0;let o=this.ti(e);return this.e.emit("rowEditingStopped",{rowIndex:o,rowNode:e.node,data:e.node.data,cancelled:t,changes:i}),o>=0&&this.e.a.ft([o]),this.e.ce.refresh(),this.e.Ye.refresh(),!0}_u(e,t){if(t.length===0)return[];let r=this.e.U.qo(t,()=>!this.e.s());if(r)return this.ts(e,[{draft:e.drafts.get(r.colId)??e.drafts.get(t[0].column.id),message:r.message}]),null;let i=this.e.U.ei(t);this.e.z.fl();try{for(let o of t){if(!i())break;this.e.Yo(e.node,o.column,o.oldValue,o.newValue)}}finally{this.e.z.ml()}return t.map(({column:o,oldValue:s,newValue:a})=>({colId:o.id,oldValue:s,newValue:a}))}Bu(e,t,r,i){let o=this.gl(t.node,r.column,e,r.value,null);if(!o)return!1;M(this.e,i);let s=f("div","mach-row-editor-shell");s.appendChild(o.el),i.replaceChildren(s),i.classList.add("mach-cell--editing","mach-cell--row-editing"),i.removeAttribute("title");let a=d=>this.zu(d,t,r),l=()=>{try{r.value=o.getValue(),r.error=void 0}catch{}};return o.el.addEventListener("keydown",a),o.el.addEventListener("input",l),r.mounted={editor:o,cell:i,shell:s,keydown:a,input:l},r.error&&this.ri(o,r.error),t.validating&&(o.el.classList.add("mach-editor-validating"),o.el.setAttribute("aria-busy","true"),o.el.inert=!0),!0}vl(e){e.mounted&&(this.es(e),this.ns(e.mounted,!0),e.mounted=null)}es(e){if(e.mounted)try{let t=e.mounted.editor.getValue();t!==void 0&&(e.value=t)}catch(t){this.e.reportError(t,"cellEditor.getValue",{colId:e.column.id,rowId:this.D?.node.id})}}gl(e,t,r,i,o){let s=t.colDef,a;try{let l={api:this.e.api,colDef:s,column:t,node:e,data:e.data,value:i,rowIndex:r,keyPress:o};typeof s.cellEditor=="function"?a=s.cellEditor(l):typeof s.cellEditor=="string"&&!["text","number","date","select"].includes(s.cellEditor)?a=this.e.Wu(s.cellEditor)?.(l)??Tr(t,i,o):a=Tr(t,i,o)}catch(l){return this.e.reportError(l,"cellEditor",{colId:t.id,rowId:e.id}),null}if(!a||!(a.el instanceof HTMLElement))return this.e.reportError(new Error("cellEditor must return an editor with an HTMLElement el"),"cellEditor",{colId:t.id,rowId:e.id}),null;try{if(a.isCancelBeforeStart?.())return a.destroy?.(),null}catch(l){this.e.reportError(l,"cellEditor.isCancelBeforeStart",{colId:t.id,rowId:e.id});try{a.destroy?.()}catch{}return null}return a}ts(e,t){e.validating=!1,this.rs(e,!1);for(let{draft:r,message:i}of t)r.error=i,r.mounted&&this.ri(r.mounted.editor,i);t[0].draft.mounted?.editor.focus?.()}ri(e,t){let r=e.el;r.classList.add("mach-editor-invalid"),r.setAttribute("title",t),r.setAttribute("aria-invalid","true"),r.classList.remove("mach-editor-validating"),r.removeAttribute("aria-busy"),r.inert=!1,(r.querySelector(".mach-select-trigger, input:not([type='hidden']), select:not([hidden]), textarea")??r).focus?.();let o=()=>{r.classList.remove("mach-editor-invalid"),r.removeAttribute("title"),r.removeAttribute("aria-invalid")};r.addEventListener("input",o,{once:!0})}Qo(e,t){e.editor.el.classList.toggle("mach-editor-validating",t),t?e.editor.el.setAttribute("aria-busy","true"):e.editor.el.removeAttribute("aria-busy"),e.editor.el.inert=t,e.confirmButton.disabled=t,e.cancelButton.disabled=!1,e.shell.classList.toggle("mach-editor-shell--busy",t)}rs(e,t){for(let r of e.drafts.values()){let i=r.mounted?.editor.el;i&&(i.classList.toggle("mach-editor-validating",t),t?i.setAttribute("aria-busy","true"):i.removeAttribute("aria-busy"),i.inert=t)}}Xo(e,t,r){try{e.focus?.()}catch(i){this.e.reportError(i,"cellEditor.focus",{colId:t.id,rowId:r.id})}}ns(e,t){e.editor.el.removeEventListener("keydown",e.keydown),e.input&&e.editor.el.removeEventListener("input",e.input),e.editor.el.classList.remove("mach-editor-validating"),e.editor.el.removeAttribute("aria-busy"),e.editor.el.inert=!1;try{e.editor.destroy?.()}catch(r){this.e.reportError(r,"cellEditor.destroy",{colId:e.cell.dataset.colId})}t&&e.cell.classList.remove("mach-cell--editing","mach-cell--row-editing","mach-cell--error")}ti(e){return e.node.rowIndex>=0?e.node.rowIndex:e.rowIndex}zu(e,t,r){if(this.D!==t)return;if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.Zo(!0);return}if(e.key==="Enter"&&!e.shiftKey){e.preventDefault(),e.stopPropagation(),this.Zo(!1);return}if(e.key!=="Tab")return;e.preventDefault(),e.stopPropagation(),this.es(r);let i=[...t.drafts.values()],o=i.indexOf(r),s=e.shiftKey?-1:1;for(let a=1;a<=i.length;a++){let l=i[(o+s*a+i.length)%i.length];if(l.mounted){this.Xo(l.mounted.editor,l.column,t.node);break}}}destroy(){(this.b||this.D)&&this.he(!0)}};var T={matchContains:"\u5305\u542B",matchNotContains:"\u4E0D\u5305\u542B",matchEquals:"\u7B49\u4E8E",matchNotEquals:"\u4E0D\u7B49\u4E8E",matchStartsWith:"\u5F00\u5934\u662F",matchEndsWith:"\u7ED3\u5C3E\u662F",matchBlank:"\u4E3A\u7A7A",matchNotBlank:"\u4E0D\u4E3A\u7A7A",matchLessThan:"\u5C0F\u4E8E",matchLessThanOrEqual:"\u5C0F\u4E8E\u7B49\u4E8E",matchGreaterThan:"\u5927\u4E8E",matchGreaterThanOrEqual:"\u5927\u4E8E\u7B49\u4E8E",matchInRange:"\u5728\u8303\u56F4\u5185",apply:"\u5E94\u7528",reset:"\u91CD\u7F6E",search:"\u641C\u7D22...",emptySetLabel:"(\u7A7A)",selectedCount:"\u5DF2\u9009 {n} \u9879",sortAsc:"\u5347\u5E8F",sortDesc:"\u964D\u5E8F",clearSort:"\u53D6\u6D88\u6392\u5E8F",pinLeft:"\u56FA\u5B9A\u5DE6\u4FA7",pinRight:"\u56FA\u5B9A\u53F3\u4FA7",clearPin:"\u53D6\u6D88\u56FA\u5B9A",autoSize:"\u81EA\u9002\u5E94\u5217\u5BBD",hideColumn:"\u9690\u85CF\u6B64\u5217",columnVisibility:"\u5217\u663E\u793A",resetAll:"\u91CD\u7F6E\u5168\u90E8",autoSizeAll:"\u5168\u90E8\u81EA\u9002\u5E94",columnSettings:"\u5217\u8BBE\u7F6E",totalLabel:"\u5408\u8BA1",totalRowsLabel:"\u5171 {n} \u884C",menuCopy:"\u590D\u5236",menuPaste:"\u7C98\u8D34",menuClearContents:"\u6E05\u9664\u5185\u5BB9",loading:"\u52A0\u8F7D\u4E2D...",statusSelected:"\u5DF2\u9009 {n} \u884C",statusSum:"\u548C {n}",statusAvg:"\u5747 {n}",statusCount:"\u8BA1 {n}",emptyRows:"\u6CA1\u6709\u53EF\u663E\u793A\u7684\u884C",emptyRowsHint:"\u6682\u65E0\u6570\u636E\uFF0C\u53EF\u8C03\u6574\u67E5\u8BE2\u6761\u4EF6\u540E\u91CD\u8BD5",paginationTotal:"\u5171 {n} \u6761",paginationPage:"\u7B2C {a} / {b} \u9875",perPage:"{n} \u6761/\u9875",pageFirst:"\u9996\u9875",pagePrev:"\u4E0A\u4E00\u9875",pageNext:"\u4E0B\u4E00\u9875",pageLast:"\u672B\u9875",requestFailed:"\u6570\u636E\u52A0\u8F7D\u5931\u8D25",requestFailedHint:"\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5",actionView:"\u67E5\u770B",actionEdit:"\u7F16\u8F91",actionDelete:"\u5220\u9664",actionConfirm:"\u786E\u8BA4",actionSave:"\u4FDD\u5B58",actionCancel:"\u53D6\u6D88",actionMore:"\u66F4\u591A\u64CD\u4F5C",rowDragHandle:"\u62D6\u52A8\u8C03\u6574\u987A\u5E8F\uFF1BAlt + \u4E0A\u4E0B\u65B9\u5411\u952E\u79FB\u52A8",rowDragUnavailable:"\u5F53\u524D\u6392\u5E8F\u6216\u6570\u636E\u6A21\u5F0F\u4E0D\u652F\u6301\u81EA\u52A8\u8C03\u6574\u987A\u5E8F",rowDragPosition:"\u7B2C {a} \u884C \u2192 \u7B2C {b} \u884C",rowDragOutside:"\u79FB\u56DE\u8868\u683C\u5185\u653E\u7F6E \xB7 Esc \u53D6\u6D88"},zi={matchContains:"Contains",matchNotContains:"Not Contains",matchEquals:"Equals",matchNotEquals:"Not Equals",matchStartsWith:"Starts With",matchEndsWith:"Ends With",matchBlank:"Blank",matchNotBlank:"Not Blank",matchLessThan:"Less Than",matchLessThanOrEqual:"\u2264",matchGreaterThan:"Greater Than",matchGreaterThanOrEqual:"\u2265",matchInRange:"In Range",apply:"Apply",reset:"Reset",search:"Search...",emptySetLabel:"(blank)",selectedCount:"{n} selected",sortAsc:"Ascending",sortDesc:"Descending",clearSort:"Clear Sort",pinLeft:"Pin Left",pinRight:"Pin Right",clearPin:"Unpin",autoSize:"Auto Fit",hideColumn:"Hide Column",columnVisibility:"Columns",resetAll:"Reset All",autoSizeAll:"Fit All",columnSettings:"Column Settings",totalLabel:"Total",totalRowsLabel:"{n} rows",menuCopy:"Copy",menuPaste:"Paste",menuClearContents:"Clear Contents",loading:"Loading...",statusSelected:"{n} selected",statusSum:"Sum {n}",statusAvg:"Avg {n}",statusCount:"Cnt {n}",emptyRows:"No rows to display",emptyRowsHint:"Try adjusting your search or filters.",paginationTotal:"{n} items",paginationPage:"Page {a} / {b}",perPage:"{n} / page",pageFirst:"First",pagePrev:"Previous",pageNext:"Next",pageLast:"Last",requestFailed:"Unable to load data",requestFailedHint:"Check your connection and try again",actionView:"View",actionEdit:"Edit",actionDelete:"Delete",actionConfirm:"Confirm",actionSave:"Save",actionCancel:"Cancel",actionMore:"More actions",rowDragHandle:"Drag to reorder; Alt + Up/Down to move",rowDragUnavailable:"Reordering is unavailable in the current sort or data mode",rowDragPosition:"Row {a} \u2192 Row {b}",rowDragOutside:"Move inside to drop \xB7 Esc to cancel",rowDragSelection:"{a} selected rows \u2192 Row {b}",rowDragBefore:"Before",rowDragAfter:"After",rowDragInside:"Inside",rowDragRejected:"This destination is unavailable"},Cs={contains:"matchContains",notContains:"matchNotContains",equals:"matchEquals",notEquals:"matchNotEquals",startsWith:"matchStartsWith",endsWith:"matchEndsWith",blank:"matchBlank",notBlank:"matchNotBlank",lessThan:"matchLessThan",lessThanOrEqual:"matchLessThanOrEqual",greaterThan:"matchGreaterThan",greaterThanOrEqual:"matchGreaterThanOrEqual",inRange:"matchInRange"};function wt(n){return Cs[n]??"matchEquals"}function _(n,e){return n.replace("{n}",String(e))}function fe(n,e,t){return n.replace("{a}",String(e)).replace("{b}",String(t))}function Er(n){return n==="blank"||n==="notBlank"}function Ct(n){return n===null?"null:":`${typeof n}:${String(n)}`}var Tt=class{constructor(e){this.e=e;this.v=null;this.vt=null;this.gr=null;this.bt=e=>{if(!this.v)return;let t=e.target;if(!this.v.contains(t)&&!this.gr?.contains(t)){this.close();return}this.gr?.contains(t)||(!(t instanceof Element)||!t.closest(".mach-filter-select-control"))&&this.bl()};this.wt=e=>{if(e.key==="Escape"){if(this.bl(!0)){e.preventDefault(),e.stopPropagation();return}this.close()}}}toggle(e,t){if(this.vt===e.id){this.close();return}this.close(),this.open(e,t)}open(e,t){let r=this.e.i.Q()[e.id]??null,i=r?.type??e.filterType,o=f("div","mach-filter-panel");o.setAttribute("role","dialog"),o.setAttribute("aria-label",`${e.id} filter`),i==="set"?this.$u(o,e,r):this.Ku(o,e,i,r);let s=f("div","mach-filter-footer"),a=f("button","mach-filter-btn-reset");a.type="button",a.textContent=this.e.y("reset"),a.addEventListener("click",()=>{this.e.ss(e,null),this.close()});let l=f("button","mach-filter-btn-apply");l.type="button",l.textContent=this.e.y("apply"),l.addEventListener("click",()=>{let c=this.wl(o);this.e.ss(e,c),this.close()}),s.append(a,l),o.appendChild(s),L(o,this.e.o.root),document.body.appendChild(o),this.v=o,this.vt=e.id,j(o,t),document.addEventListener("mousedown",this.bt,!0),document.addEventListener("keydown",this.wt,!0),o.querySelector(".mach-filter-select-trigger, input")?.focus()}close(){this.v&&(this.gr?.destroy(),this.gr=null,this.v.remove(),this.v=null,this.vt=null,document.removeEventListener("mousedown",this.bt,!0),document.removeEventListener("keydown",this.wt,!0))}destroy(){this.close()}Ku(e,t,r,i){let o=i&&i.type!=="set"&&i.conditions.length>0?i.conditions[0]:null,s=o?.match??(r==="text"?"contains":"equals"),{root:a,select:l}=this.Uu(r,s),d=this.Cl(r),c=this.Cl(r,!0);this.ju(r,s,o,d,c),this.Tl(s,d,c),l.addEventListener("change",()=>{this.Tl(l.value,d,c)}),this.qu(t,e,d,c);let u=f("div","mach-filter-body");u.append(a,d,c),e.appendChild(u),e.dataset.filterType=r}Uu(e,t){let r=X({ariaLabel:"Filter condition",options:ue[e].map(i=>({value:i,label:this.e.y(wt(i))})),value:t,classNames:{root:"mach-filter-select-control",native:"mach-filter-select",trigger:"mach-filter-select-trigger",value:"mach-filter-select-value",caret:"mach-filter-select-caret",listbox:"mach-filter-listbox",option:"mach-filter-listbox-option"},themeSource:this.e.o.root});return this.gr=r,{root:r.el,select:r.native}}bl(e=!1){return this.gr?.close(e)??!1}Cl(e,t=!1){let i=f("input",`mach-filter-input${t?" mach-filter-input--second":""}`);return e==="number"&&(i.type="number"),e==="date"&&(i.type="date"),i}ju(e,t,r,i,o){r?.value!=null&&!Er(t)&&(i.value=e==="date"?String(r.value).slice(0,10):String(r.value)),r&&"value2"in r&&r.value2!=null&&(o.value=e==="date"?String(r.value2).slice(0,10):String(r.value2))}Tl(e,t,r){t.style.display=Er(e)?"none":"",r.style.display=e==="inRange"?"":"none"}qu(e,t,r,i){let o=s=>{s.key==="Enter"&&(this.e.ss(e,this.wl(t)),this.close())};r.addEventListener("keydown",o),i.addEventListener("keydown",o)}$u(e,t,r){let o=t.colDef.filterParams,s;if(o?.values)s=o.values;else{let y=new Set;s=[];let v=this.e.i.be(),b=Math.min(v.length,o?.maxValues??500);for(let x=0;x<b;x++){let R=this.e.d(v[x],t),H=Ct(R??null);y.has(H)||(y.add(H),s.push(R))}}let a=new Set(r?.type==="set"?r.values.map(Ct):s.map(Ct)),l=f("input","mach-filter-input mach-filter-input--search");l.type="text",l.placeholder=this.e.y("search");let d=f("div","mach-filter-set-list"),c=[],u=new Map,h=y=>{d.textContent="",c.length=0;let v=y.trim().toLowerCase();for(let b of s){let x=b==null?this.e.y("emptySetLabel"):String(b);if(v&&!x.toLowerCase().includes(v))continue;let R=Ct(b);u.set(R,b);let H=f("label","mach-filter-set-item"),g=document.createElement("input");g.type="checkbox",g.checked=a.has(R),g.addEventListener("change",()=>{g.checked?a.add(R):a.delete(R),e.dataset.setSelected=JSON.stringify([...a])});let w=f("span");w.textContent=x,H.append(g,w),d.appendChild(H),c.push(g)}};l.addEventListener("input",()=>h(l.value)),h(""),e.dataset.filterType="set",e.dataset.setValues=JSON.stringify([...u.entries()]),e.dataset.setSelected=JSON.stringify([...a]),(()=>{let y=[...u.entries()];e.dataset.setValues=JSON.stringify(y)})();let m=f("div","mach-filter-body mach-filter-body--set");m.append(l,d),e.appendChild(m)}wl(e){let t=e.dataset.filterType;if(t==="set")return this.Yu(e);if(t!=="text"&&t!=="number"&&t!=="date")return null;let r=e.querySelector(".mach-filter-select"),i=e.querySelectorAll(".mach-filter-input"),o=i[0],s=i[1];if(!r||!o)return null;let a=r.value;if(Er(a))return{type:t,conditions:[{match:a}]};let l=o.value;return l===""&&a!=="inRange"?null:t==="number"?this.Xu(a,l,s):t==="date"?this.Ju(a,l,s):{type:"text",conditions:[{match:a,value:l}]}}Yu(e){let t=[],r=[];try{t=JSON.parse(e.dataset.setValues??"[]"),r=JSON.parse(e.dataset.setSelected??"[]")}catch{return null}let i=new Set(r),o=t.filter(([s])=>i.has(s)).map(([,s])=>s);return o.length===t.length||o.length===0?null:{type:"set",values:o}}Xu(e,t,r){let i=Number(t);if(Number.isNaN(i))return null;if(e!=="inRange")return{type:"number",conditions:[{match:e,value:i}]};let o=r?.value?Number(r.value):i;return Number.isNaN(o)?null:{type:"number",conditions:[{match:"inRange",value:i,value2:o}]}}Ju(e,t,r){return e!=="inRange"?{type:"date",conditions:[{match:e,value:t}]}:{type:"date",conditions:[{match:"inRange",value:t,value2:r?.value||t}]}}};var Et=class{constructor(e){this.e=e;this.v=null;this.vt=null;this.sn=null;this.an="";this.ii=new Set;this.bt=e=>{let t=e.target;this.v&&!this.v.contains(t)&&!this.Qu(t)&&this.close()};this.wt=e=>{if(e.key!=="Escape")return;if([...this.ii].find(r=>r.isOpen())?.close(!0)){e.preventDefault(),e.stopImmediatePropagation();return}this.close()}}toggle(e,t){if(this.vt===e.id){this.close();return}this.close(),this.open(e,t)}Zu(e){this.close();let t=e??(()=>{let i=this.e.o.root.getBoundingClientRect(),o=document.createElement("div");return o.style.position="fixed",o.style.left=`${i.right-16}px`,o.style.top=`${i.top+this.e.r.headerHeight}px`,o.style.width="1px",o.style.height="1px",document.body.appendChild(o),this.sn=o,o})();this.open(null,t)}close(){this.El(),this.sn&&(this.sn.remove(),this.sn=null),this.v?.remove(),this.v=null,this.vt=null,document.removeEventListener("mousedown",this.bt,!0),document.removeEventListener("keydown",this.wt,!0)}destroy(){this.close()}open(e,t){let r=this.e.api,i=f("div","mach-filter-panel mach-column-panel");i.setAttribute("role",e?"menu":"dialog"),e||(i.setAttribute("aria-modal","false"),i.setAttribute("aria-label",this.e.y("columnSettings")));let o=f("div","mach-column-panel-title");if(o.textContent=e?e.colDef.headerName??e.colDef.field??e.id:this.e.y("columnSettings"),i.appendChild(o),e&&e.sortable){let b=f("div","mach-column-panel-actions"),x=(R,H)=>{let g=f("button","mach-column-panel-btn");return g.type="button",g.textContent=this.e.y(R),g.addEventListener("click",()=>{r.sorting.setModel(H?[{colId:e.id,direction:H}]:[]),this.close()}),g};b.append(x("sortAsc","asc"),x("sortDesc","desc"),x("clearSort",null)),i.appendChild(b)}let s=f("div","mach-column-panel-actions"),a=(b,x)=>{let R=f("button","mach-column-panel-btn");return R.type="button",R.textContent=this.e.y(b),R.addEventListener("click",()=>{e&&r.columns.setPinned(e.id,x),this.close()}),R};e&&(s.append(a("pinLeft","left"),a("pinRight","right"),a("clearPin",null)),i.appendChild(s));let l=f("div","mach-column-panel-actions"),d=f("button","mach-column-panel-btn");d.type="button",d.textContent=this.e.y("autoSize"),d.addEventListener("click",()=>{e?r.columns.autoSize(e.id):r.columns.autoSizeAll(),this.close()});let c=f("button","mach-column-panel-btn");c.type="button",c.textContent=this.e.y("hideColumn"),c.addEventListener("click",()=>{e&&r.columns.setVisible(e.id,!1),this.close()}),e&&(l.append(d,c),i.appendChild(l));let u=f("div","mach-column-panel-divider");i.appendChild(u);let h=f("div","mach-column-panel-subtitle");if(h.textContent=this.e.y("columnVisibility"),i.appendChild(h),!e){let b=document.createElement("input");b.type="search",b.className="mach-column-workbench-search",b.placeholder=this.e.y("search"),b.setAttribute("aria-label",this.e.y("search")),b.value=this.an,b.addEventListener("input",()=>{this.an=b.value.trim().toLocaleLowerCase(),this.as(p,!0)}),i.appendChild(b)}let p=f("div","mach-column-panel-list");this.as(p,!e),i.appendChild(p);let m=f("div","mach-filter-footer"),y=f("button","mach-filter-btn-reset");y.type="button",y.textContent=this.e.y("resetAll"),y.addEventListener("click",()=>{r.columns.resetState(),this.close()});let v=f("button","mach-filter-btn-apply");v.type="button",v.textContent=this.e.y("autoSizeAll"),v.addEventListener("click",()=>{r.columns.autoSizeAll(),this.close()}),m.append(y,v),i.appendChild(m),L(i,this.e.o.root),document.body.appendChild(i),this.v=i,this.vt=e?e.id:"__standalone__",j(i,t),document.addEventListener("mousedown",this.bt,!0),document.addEventListener("keydown",this.wt,!0)}ls(){if(!this.v)return;let e=this.v.querySelector(".mach-column-panel-list");e&&this.as(e,this.vt==="__standalone__")}as(e,t){let r=this.e.api;this.El(e),e.replaceChildren();let i=this.e.n.te().filter(o=>o.isDetailToggle?!1:!t||!this.an?!0:`${o.colDef.headerName??o.colDef.field??o.id} ${o.id}`.toLocaleLowerCase().includes(this.an));for(let o of i){let s=f("div",t?"mach-column-workbench-item":"mach-filter-set-item"),a=f("label","mach-column-workbench-label"),l=document.createElement("input");l.type="checkbox",l.checked=!o.hide,l.disabled=o.hasCheckbox,l.addEventListener("change",()=>{r.columns.setVisible(o.id,l.checked),this.ls()});let d=f("span","mach-column-workbench-name");if(d.textContent=o.colDef.headerName??o.colDef.field??o.id,d.title=`${d.textContent} (${o.id})`,a.append(l,d),s.appendChild(a),t){let c=X({ariaLabel:`${d.textContent} ${this.e.y("clearPin")}`,options:[{value:"",label:this.e.y("clearPin")},{value:"left",label:this.e.y("pinLeft")},{value:"right",label:this.e.y("pinRight")}],value:o.pinned??"",classNames:{root:"mach-column-workbench-pin-control",native:"mach-column-workbench-pin"},themeSource:this.e.o.root,onChange:m=>{r.columns.setPinned(o.id,m==="left"||m==="right"?m:null),this.ls()}});c.trigger.disabled=!o.movable,c.native.disabled=!o.movable,this.ii.add(c),s.appendChild(c.el);let u=this.e.n.te().filter(m=>!m.hide&&m.parentGroup===o.parentGroup&&(o.parentGroup!=null||m.pinned===o.pinned)),h=u.indexOf(o),p=(m,y,v)=>{let b=f("button","mach-column-workbench-move");return b.type="button",b.textContent=m,b.disabled=v||o.hide||!o.movable,b.addEventListener("click",()=>{r.columns.move(o.id,y),this.ls()}),b};s.append(p("\u2191",h-1,h<=0),p("\u2193",h+1,h<0||h>=u.length-1))}e.appendChild(s)}}Qu(e){return[...this.ii].some(t=>t.contains(e))}El(e){for(let t of[...this.ii])e&&!e.contains(t.el)||(t.destroy(),this.ii.delete(t))}};var Dt=class{constructor(e){this.e=e;this.v=null;this.bt=e=>{this.v&&!this.v.contains(e.target)&&this.close()};this.wt=e=>{e.key==="Escape"&&this.close()}}eh(e){if(e){let o=this.e.i.m(e.rowIndex),s=this.e.n.P(e.colId);return o&&s?{node:o,column:s}:null}let t=this.e.a.Qr();if(!t)return null;let r=this.e.i.m(t.r1),i=this.e.n.c()[t.c1];return r&&i?{node:r,column:i}:null}th(e,t){let r=this.e.r.getContextMenuItems;if(!r)return null;try{return r({data:e.data,node:e,api:this.e.api,colId:t.id,value:this.e.d(e,t),rowIndex:e.rowIndex})??null}catch(i){return this.e.reportError(i,"getContextMenuItems",{colId:t.id,rowId:e.id}),null}}rh(e,t,r,i){let o=!1;for(let s of t){if(s.separator){e.appendChild(f("div","mach-context-menu-separator"));continue}let a=f("button","mach-context-menu-item");a.type="button",a.textContent=s.label??"",s.danger&&a.classList.add("mach-context-menu-item--danger"),a.disabled=s.disabled===!0,a.disabled||(o=!0,a.addEventListener("click",()=>this.ih(s,r,i))),e.appendChild(a)}return o}ih(e,t,r){this.close();try{e.action?.()}catch(i){this.e.reportError(i,"contextMenu.action",{colId:r.id,rowId:t.id})}}ds(e,t,r){let i=f("button","mach-context-menu-item");i.type="button",i.textContent=t,i.addEventListener("click",r),e.appendChild(i)}nh(e){let t=this.e;this.ds(e,t.y("menuCopy"),()=>{t.Dl(),this.close()}),!t.r.suppressClipboard&&(this.ds(e,t.y("menuPaste"),()=>{t.oh(),this.close()}),this.ds(e,t.y("menuClearContents"),()=>{let r=t.a.Qr();r&&t.$o(r),this.close()}))}open(e,t,r){this.close();let i=this.eh(r);if(!i)return;let o=f("div","mach-context-menu");if(o.setAttribute("role","menu"),this.e.r.getContextMenuItems){let s=this.th(i.node,i.column);if(!s||!this.rh(o,s,i.node,i.column))return;this.xl(o,e,t);return}this.nh(o),this.xl(o,e,t)}xl(e,t,r){L(e,this.e.o.root),document.body.appendChild(e),this.v=e;let i=e.getBoundingClientRect(),o=C(t,8,Math.max(8,window.innerWidth-i.width-8)),s=C(r,8,Math.max(8,window.innerHeight-i.height-8));e.style.left=`${o}px`,e.style.top=`${s}px`,document.addEventListener("mousedown",this.bt,!0),document.addEventListener("keydown",this.wt,!0)}close(){this.v&&(this.v.remove(),this.v=null,document.removeEventListener("mousedown",this.bt,!0),document.removeEventListener("keydown",this.wt,!0))}destroy(){this.close()}};var xt=class{constructor(e){this.e=e;this.v=null;this.ln=0;this.cs=0;this.ni=null;this.oi=e=>{if(this.e.s()||!this.e.r.tooltipComponent)return;let r=e.target.closest(".mach-cell");if(!r||r===this.ni)return;this.us(),this.dn(),this.ni=r;let i=this.sh(r);if(!i||r.classList.contains("mach-cell--editing"))return;let o=this.ah(i.node,i.column,i.index);this.lh(o,i.column)&&(this.ln=window.setTimeout(()=>{this.e.s()||this.ni!==r||this.dh(r,o)},Math.max(0,this.e.r.tooltipShowDelay)))};this.Rl=()=>{this.hide()}}init(){let e=this.e.o.De;e.addEventListener("mouseover",this.oi),e.addEventListener("mouseleave",this.Rl)}destroy(){this.us(),this.dn();let e=this.e.o.De;e.removeEventListener("mouseover",this.oi),e.removeEventListener("mouseleave",this.Rl),this.ni=null}hide(){this.us(),this.dn(),this.ni=null}us(){this.ln&&(clearTimeout(this.ln),this.ln=0),this.cs&&(clearTimeout(this.cs),this.cs=0)}dn(){this.v&&(this.v.remove(),this.v=null)}sh(e){let t=e.dataset.colId??"",r=Number(e.closest(".mach-row")?.dataset.index);if(Number.isNaN(r))return null;let i=this.e.i.m(r),o=t?this.e.n.P(t):void 0;return!i||!o||i.isDetail||i.isGroup?null:{node:i,column:o,index:r}}ah(e,t,r){return{data:e.data,node:e,api:this.e.api,colId:t.id,value:this.e.d(e,t),formatted:ee(this.e,e,t),rowIndex:r}}lh(e,t){let r=t.colDef.tooltipValueGetter;if(!r)return!!e.formatted;try{r({...e,colDef:t.colDef,column:t})}catch(i){this.e.reportError(i,"tooltipValueGetter",{colId:t.id,rowId:e.node.id})}return!0}dh(e,t){this.dn();let r=this.e.r.tooltipComponent;if(!r)return;let i=f("div","mach-tooltip");i.setAttribute("role","tooltip");let o;try{o=r(t)}catch(s){this.e.reportError(s,"tooltipComponent",{colId:t.colId,rowIndex:t.rowIndex});return}typeof o=="string"?i.textContent=o:i.appendChild(o),L(i,this.e.o.root),document.body.appendChild(i),this.v=i,j(i,e,6)}};var Rt=class{constructor(e){this.e=e;this.ee=null}init(){this.ee=document.createElement("div"),this.ee.className="mach-watermark",this.ee.setAttribute("aria-hidden","true"),this.ee.style.pointerEvents="none",this.e.o.root.appendChild(this.ee),this.apply()}apply(){if(!this.ee||this.e.s())return;let e=this.e.r.watermarkEnabled?this.e.r.watermarkConfig:null;if(!e||!e.text){this.ee.style.display="none",this.ee.style.backgroundImage="";return}let t=this.ch(e);this.ee.style.display="",t?(this.ee.style.backgroundImage=`url(${t})`,this.ee.style.backgroundColor=""):this.ee.style.backgroundImage=""}ch(e){try{let t=document.createElement("canvas"),r=t.getContext("2d");if(!r)return null;let i=e.fontSize??14,o=e.gap??160,s=e.angle??-22,a=e.color??(this.uh()?"rgba(255,255,255,0.9)":"rgba(31,55,88,0.9)"),l=e.opacity??.06;r.font=`500 ${i}px sans-serif`;let d=r.measureText(e.text),c=Math.ceil(d.width),u=Math.max(o,c+40);t.width=u,t.height=u;let h=t.getContext("2d");return h.clearRect(0,0,u,u),h.globalAlpha=l,h.fillStyle=a,h.font=`500 ${i}px sans-serif`,h.translate(u/2,u/2),h.rotate(s*Math.PI/180),h.textAlign="center",h.textBaseline="middle",h.fillText(e.text,0,0),t.toDataURL("image/png")}catch{return null}}uh(){return this.e.o.root.classList.contains("mach-theme-dark")}refresh(){this.apply()}destroy(){this.ee?.remove(),this.ee=null}};var St=class{constructor(e){this.e=e;this.xe=[];this.pe=-1;this.Ct=null}fl(){this.Ct||(this.Ct=[])}ml(){if(!this.Ct)return;let e=this.Ct;this.Ct=null,e.length>0&&this.push(e)}hs(e){if(this.Ct){this.Ct.push(e);return}this.push([e])}push(e){let t=Math.max(0,this.e.r.undoStackSize);if(t!==0){for(this.xe.length=this.pe+1,this.xe.push(e);this.xe.length>t;)this.xe.shift();this.pe=this.xe.length-1}}hh(){let e=Math.max(0,this.e.r.undoStackSize);if(e===0){this.clear();return}for(;this.xe.length>e;)this.xe.shift(),this.pe--;this.pe<-1&&(this.pe=-1)}canUndo(){return this.pe>=0}canRedo(){return this.pe<this.xe.length-1}undo(){return this.e.Me(),this.canUndo()?(this.apply(this.xe[this.pe],!1),this.pe--,!0):!1}redo(){return this.e.Me(),this.canRedo()?(this.pe++,this.apply(this.xe[this.pe],!0),!0):!1}apply(e,t){let r=this.e,i=[];for(let o of e){let s=r.i.K(o.nodeId),a=r.n.P(o.columnId);if(!s||!a||s.data==null)continue;let l=t?o.newValue:o.oldValue,d=t?o.oldValue:o.newValue;r.Qi(s,a,l,d)&&(r.a.Wi(s),r.a.Sl([s.rowIndex],[a.id]),s.rowIndex>=0&&i.push(s.rowIndex),r.emit("cellValueChanged",{oldValue:d,newValue:l,rowNode:s,rowIndex:s.rowIndex,column:a,colDef:a.colDef,data:s.data}))}i.length>0&&r.a.ft(i),r.ce.refresh(),r.Ye.refresh()}clear(){this.xe=[],this.pe=-1,this.Ct=null}};var Mt=class{constructor(e){this.e=e;this.H=new Map;this.ps=!1;this.fs=null}init(){this.fs=this.e.fe.on("cellValueChanged",e=>{this.ps||this.hs(e)})}hs(e){let t=`${e.rowNode.id}\0${e.column.id}`,i=this.H.get(t)?.originalValue??e.oldValue;Object.is(e.newValue,i)?this.H.delete(t):this.H.set(t,{rowId:e.rowNode.id,colId:e.column.id,originalValue:i,value:e.newValue}),this.yr()}getDirtyRowIds(){return[...new Set([...this.H.values()].map(e=>e.rowId))]}getChanges(){let e=new Map;for(let t of this.H.values()){let r=this.e.i.K(t.rowId);if(!r?.data)continue;let i=e.get(t.rowId);i||(i={rowId:t.rowId,data:r.data,cells:[]},e.set(t.rowId,i)),i.cells.push({colId:t.colId,originalValue:t.originalValue,value:t.value})}return[...e.values()]}markSaved(e){if(!e)this.H.clear();else{let t=new Set(e);for(let[r,i]of this.H)t.has(i.rowId)&&this.H.delete(r)}this.yr()}ph(e){for(let t of e)for(let r of t.cells){let i=`${t.rowId}\0${r.colId}`,o=this.H.get(i);if(o){Object.is(o.value,r.value)?this.H.delete(i):o.originalValue=r.value;continue}let s=this.e.i.K(t.rowId),a=this.e.n.P(r.colId);if(!s||!a||s.data==null)continue;let l=this.e.d(s,a);Object.is(l,r.value)||this.H.set(i,{rowId:t.rowId,colId:r.colId,originalValue:r.value,value:l})}this.yr()}rollback(e){let t=e?new Set(e):null,r=[...this.H.entries()].filter(([,s])=>!t||t.has(s.rowId));if(r.length===0)return!1;let i=new Set,o=new Set;this.ps=!0;try{for(let[s,a]of r){let l=this.e.i.K(a.rowId),d=this.e.n.P(a.colId);if(!l||!d||l.data==null)continue;let c=this.e.d(l,d);if(Object.is(c,a.originalValue)){o.add(s);continue}this.e.Qi(l,d,a.originalValue,c)&&(o.add(s),this.e.a.Wi(l),l.rowIndex>=0&&i.add(l.rowIndex),this.e.emit("cellValueChanged",{oldValue:c,newValue:a.originalValue,rowNode:l,rowIndex:l.rowIndex,column:d,colDef:d.colDef,data:l.data}))}}finally{this.ps=!1}for(let s of o)this.H.delete(s);return i.size>0&&this.e.a.ft([...i]),this.e.ce.refresh(),this.e.Ye.refresh(),this.yr(),o.size>0}Gc(e){if(e.length===0)return;let t=new Set(e);for(let[r,i]of this.H)t.has(i.rowId)&&this.H.delete(r);this.yr()}clear(){this.H.size!==0&&(this.H.clear(),this.yr())}destroy(){this.fs?.(),this.fs=null,this.H.clear()}yr(){this.e.emit("dirtyStateChanged",{dirtyRowIds:this.getDirtyRowIds()})}};var xr=class{constructor(){this.si=null;this.cn=0;this.Ml=0;this.Il=0}acquire(){this.cn++,this.fh();let e=!1;return()=>{e||(e=!0,this.cn=Math.max(0,this.cn-1),this.cn===0&&this.disconnect())}}snapshot(){return{count:this.Ml,totalMs:this.Il}}fh(){if(!(this.si||typeof PerformanceObserver>"u"))try{this.si=new PerformanceObserver(e=>{for(let t of e.getEntries())this.Ml++,this.Il+=t.duration}),this.si.observe({entryTypes:["longtask"]})}catch{this.disconnect()}}disconnect(){let e=this.si;this.si=null;try{e?.disconnect()}catch{}}},It=new xr;function Dr(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}var At=class{constructor(){this.Vt=[];this.un=[];this.hn=[];this.ms=It.acquire(),this.pn=It.snapshot()}start(){return Dr()}mh(e,t,r){this.Vt.push({duration:Math.max(0,Dr()-e),rows:t,columns:r}),this.Vt.length>120&&this.Vt.shift()}gh(e){this.Al(this.un,e)}xo(e){this.Al(this.hn,e)}snapshot(){let e=this.Vt.map(o=>o.duration),t=this.Vt[this.Vt.length-1],r=[...e].sort((o,s)=>o-s),i=It.snapshot();return{sampleCount:e.length,lastRenderMs:t?.duration??0,averageRenderMs:this.yh(e),maxRenderMs:r[r.length-1]??0,p95RenderMs:this.gs(r,!0),longRenderCount:e.filter(o=>o>16.7).length,renderedRows:t?.rows??0,renderedColumns:t?.columns??0,renderedCells:(t?.rows??0)*(t?.columns??0),layoutSampleCount:this.un.length,p95LayoutMs:this.gs(this.un),modelSampleCount:this.hn.length,p95ModelMs:this.gs(this.hn),longTaskCount:Math.max(0,i.count-this.pn.count),longTaskTotalMs:Math.max(0,i.totalMs-this.pn.totalMs),usedHeapBytes:this.usedHeapBytes()}}reset(){this.Vt=[],this.un=[],this.hn=[],this.pn=It.snapshot()}destroy(){this.ms?.(),this.ms=null}Al(e,t){e.push(Math.max(0,Dr()-t)),e.length>120&&e.shift()}yh(e){return e.length===0?0:e.reduce((t,r)=>t+r,0)/e.length}usedHeapBytes(){let e=typeof performance>"u"?void 0:performance.memory?.usedJSHeapSize;return typeof e=="number"&&Number.isFinite(e)?e:null}gs(e,t=!1){if(e.length===0)return 0;let r=t?e:[...e].sort((i,o)=>i-o);return r[Math.max(0,Math.ceil(r.length*.95)-1)]??0}};function Wi(n,e){if(!(n==null||e==null))return[...new Set([...n,...e])]}function Ts(n,e){return n===!0||e===!0?!0:n?e?{rowIds:Wi(n.rowIds,e.rowIds),rowIndexes:n.rowIndexes==null||e.rowIndexes==null?void 0:[...new Set([...n.rowIndexes,...e.rowIndexes])],columns:Wi(n.columns,e.columns),force:n.force===!0||e.force===!0,includePinned:n.includePinned===!0||e.includePinned===!0}:n:e}function Es(n,e){return{columns:n.columns===!0||e.columns===!0,header:n.header===!0||e.header===!0,pool:n.pool===!0||e.pool===!0,data:n.data===!0||e.data===!0,layout:n.layout===!0||e.layout===!0,cells:Ts(n.cells,e.cells),pinned:n.pinned===!0||e.pinned===!0,summary:n.summary===!0||e.summary===!0,overlays:n.overlays===!0||e.overlays===!0}}var Lt=class{constructor(e){this.apply=e;this.Bt=0;this.Tt=null;this.Ll=0;this.Pl=0;this.kl=0;this.fn=!1}batch(e){if(this.fn)return e();this.Bt++;try{return e()}finally{this.Bt--,this.Bt===0&&this.flush()}}Gl(e){this.fn||(this.Pl++,this.Tt&&this.kl++,this.Tt=Es(this.Tt??{},e),this.Bt===0&&this.flush())}flush(){if(this.fn||this.Bt>0||!this.Tt)return;let e=this.Tt;this.Tt=null,this.Ll++,this.apply(e)}snapshot(){return{batchDepth:this.Bt,flushCount:this.Ll,requestCount:this.Pl,coalescedRequestCount:this.kl,pending:this.Tt!=null}}destroy(){this.fn=!0,this.Tt=null,this.Bt=0}};var $i=Symbol.for("mach-table.adapter.lifecycle.v1");function Ki(n,e){Object.defineProperty(n,$i,{value:e})}function Rr(n){let e=n[$i]?.rowDrag;return e?.policy===n.getOption("rowDragPolicy")?e?.factory:void 0}var Ui=Symbol.for("mach-table.import.v1");function ji(n,e){Object.defineProperty(n,Ui,{value:{begin:()=>e.U.jo(),revision:()=>e.i.zr(),isEditing:()=>e.l.isEditing(),columns:()=>e.n.te(),visibleColumns:()=>e.n.c(),read:(r,i)=>e.d(r,i),editable:(r,i)=>e.l.q(r,i),parse:(r,i,o,s)=>ae(e,r,i,o,"import",s),pasteRows:r=>{let i=[];for(let o of e.i.pt())if(!o.isGroup&&!o.isDetail&&i.push(o),i.length>=r)break;return i},resolveId:(r,i)=>e.r.resolveRowId?.({data:r,index:i,api:n}),validate:(r,i)=>e.U.Zi(r,i),guard:r=>e.U.Ji(r),commitRows:(r,i,o)=>e.U.pl(r,i,o)}})}function qi(n){let e=n[Ui];if(!e)throw new TypeError("Import plans require a MachTable GridApi");return e}var me=["gridReady","gridDestroyed","modelUpdated","cellClicked","cellDoubleClicked","cellContextMenu","rowClicked","rowDoubleClicked","selectionChanged","sortChanged","filterChanged","columnResized","columnMoved","columnVisibilityChanged","cellValueChanged","cellEditingStarted","cellEditingStopped","rowEditingStarted","rowEditingStopped","detailToggled","treeChildrenLoaded","treeChildrenLoadFailed","rowDragEnd","rangeSelectionChanged","paginationChanged","displayedColumnsChanged","gridError","dirtyStateChanged"];function Ds(n,e,t,r){let i=n.columns().filter(u=>u.colDef.field),o=t.columns??e,s=new Map(i.map(u=>[u.id,u])),a=new Map,l=new Map;for(let u of i){let h=u.colDef.field;a.set(h,a.has(h)?null:u);let p=u.colDef.headerName;p&&l.set(p,l.has(p)?null:u)}let d=[],c=new Set;return o.forEach((u,h)=>{let p=(typeof u=="string"||typeof u=="number"?String(u):"").replace(/^\uFEFF/,"").trim(),m=s.get(p)??(a.has(p)?a.get(p):l.get(p));if(!m){if(r||t.columns||a.has(p)||l.has(p))throw new TypeError(`Unknown or ambiguous import column: ${p}`);return}if(c.has(m.colDef.field))throw new TypeError(`Duplicate import column: ${m.id}`);c.add(m.colDef.field),d.push({column:m,index:h})}),d.length?d:n.visibleColumns().filter(u=>u.colDef.field).map((u,h)=>({column:u,index:h}))}function xs(n,e){if(!Array.isArray(n)||n.some(t=>!Array.isArray(t)))throw new TypeError("Import requires an array of rows");if(!Number.isInteger(e)||e<-1||e>=n.length)throw new RangeError("Invalid import header row");if(n.length-e-1>1e4||n.reduce((t,r)=>t+r.length,0)>1e5)throw new RangeError("Import supports 10000 data rows and 100000 cells")}function Rs(n,e,t,r,i,o){let s=t.colDef.field,a=n.read(e.node,t),l=o.parseValue?o.parseValue({value:i,field:s,rowIndex:e.rowIndex,columnIndex:r}):t.colDef.valueParser?n.parse(e.node,t,i,a):lt(i,o.coerceNumbers!==!1);if(l!=null&&typeof l.then=="function")throw new TypeError("Import parsers must return synchronous values");if(!ce(e.data,s,l))throw new TypeError(`Unsafe import field: ${s}`);e.changes.push({node:e.node,column:t,oldValue:a,newValue:l})}function Ss(n,e,t,r,i,o,s,a){let l=a?.[t]??{},d=s?.[t]??{id:`import:${t}`,rowIndex:t,data:l,selected:!1},c={data:l,node:d,changes:[],rowIndex:t};for(let{column:u,index:h}of r)if(!(e[h]===void 0||s&&!n.editable(d,u)))try{Rs(n,c,u,h,e[h],i)}catch(p){o.issues.push({rowIndex:t,columnIndex:h,colId:u.id,code:"PARSE",message:p instanceof Error?p.message:String(p)})}o.rows.push(c)}function Yi(n,e,t={},r,i=!1,o){let s=t.headerRowIndex??(t.columns?-1:0);xs(e,s);let a=Ds(n,s<0?[]:e[s],t,i);if(!a.length)throw new TypeError("Import requires a writable field column");let l={rows:[],issues:[]};for(let d=s+1;d<e.length;d++){let c=e[d];c.some(u=>u!==""&&u!==void 0)&&Ss(n,c,d-s-1,a,t,l,r,o)}return l}function le(n){return(n==null?"":String(n)).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Pt(n,e,t="text/plain;charset=utf-8"){try{if(typeof document>"u"||typeof Blob>"u")return!1;let r=document.createElement("a");if(typeof URL<"u"&&typeof URL.createObjectURL=="function"){let i=new Blob([e],{type:t}),o=URL.createObjectURL(i);r.href=o,r.download=n,r.click();let s=typeof URL.revokeObjectURL=="function"?URL.revokeObjectURL.bind(URL):null;s&&setTimeout(()=>{try{s(o)}catch{}},0)}else r.href=`data:${t},${encodeURIComponent(e)}`,r.download=n,r.click();return!0}catch{return!1}}var ke={columnDefs:"array",rowData:"array",defaultColDef:"object",columnTypes:"object",rowKey:"unknown",rowHeight:"number",headerHeight:"number",rowBuffer:"number",columnLayout:"string",enableColumnResize:"boolean",domLayout:"string",rowSelection:"string",multiSort:"boolean",size:"string",stripedRows:"boolean",rowStyleRules:"array",showCellBorders:"boolean",theme:"string",quickFilterText:"string",advancedFilterModel:"object",masterDetail:"boolean",detailRowHeight:"number",detailRowRenderer:"function",isRowExpandable:"function",detailToggleColumn:"boolean",columnMenu:"boolean",aggFuncs:"object",components:"object",actionPolicy:"object",features:"array",initialState:"object",persistence:"boolean-object",locale:"object",editType:"string",editableIndicator:"string",rowEditValidator:"function",singleClickEdit:"boolean",manualSorting:"boolean",manualFiltering:"boolean",showSummary:"boolean",summaryMethod:"function",treeData:"boolean",childrenKey:"string",isTreeRowExpandable:"function",loadTreeChildren:"function",autoCheckedChildren:"boolean",defaultExpandAll:"boolean",indexOffset:"number",applyRowDrag:"boolean",rowDragPolicy:"object",undoStackSize:"number",asyncTransactionWaitMillis:"number",getRowHeight:"function",pinnedTopRowData:"array",pinnedBottomRowData:"array",pagination:"boolean-object",watermark:"boolean-object",suppressWarnings:"boolean",enableRangeSelection:"boolean",suppressClipboard:"boolean",contextMenu:"boolean",getContextMenuItems:"function",tooltipComponent:"function",tooltipShowDelay:"number",flashCells:"boolean",fillHandle:"boolean",statusBar:"boolean-object",datasource:"object",datasourceMode:"string",blockSize:"number",infiniteBufferRows:"number",maxBlocksInCache:"number",datasourceMaxConcurrentRequests:"number",blockPrefetch:"number",datasourceRowCount:"number",dataProcessor:"object-function",dataProcessorMinRows:"number",datasourceRetryCount:"number",datasourceRetryDelay:"number",datasourceRetryJitter:"number",suppressCellFocus:"boolean",suppressRowHoverHighlight:"boolean",suppressNoRowsOverlay:"boolean",suppressHeaderFocus:"boolean",ariaLabel:"string",ariaLabelledBy:"string",ariaDescribedBy:"string",loading:"boolean",error:"unknown",overlayNoRowsTemplate:"unknown",overlayLoadingTemplate:"unknown",overlayErrorTemplate:"unknown",allowUnsafeOverlayHtml:"boolean",className:"string"};var Sr=Object.freeze(Object.keys(ke));var Mr=new Set(me.map(n=>`on${n.charAt(0).toUpperCase()}${n.slice(1)}`));function Ir(n,e){return n==null||e==="unknown"?!0:e==="array"?Array.isArray(n):e==="boolean-object"?typeof n=="boolean"||typeof n=="object"&&!Array.isArray(n):e==="object"?typeof n=="object"&&!Array.isArray(n):e==="object-function"?typeof n=="function"||typeof n=="object"&&!Array.isArray(n):e==="number"?typeof n=="number"&&Number.isFinite(n):typeof n===e}function Xi(n){let e={};for(let[t,r]of Object.entries(n)){if(Mr.has(t)){(r==null||typeof r=="function")&&(e[t]=r);continue}let i=ke[t];!i||!Ir(r,i)||(e[t]=r)}return e}var en=2e3,Ar=1e5,Ge=512,Is=1e4;function Ji(n){return Array.isArray(n)?[...new Set(n.slice(0,Ar).filter(e=>typeof e=="string"&&e.length>0&&e.length<=Ge))]:[]}function As(n){if(!Array.isArray(n))return[];let e=new Set,t=Ar*Ge;for(let r of n.slice(0,Ar)){if(typeof r!="string"||!r.length||e.has(r))continue;let i=r.startsWith(tt)?65536:Ge;r.length>i||r.length>t||(e.add(r),t-=r.length)}return[...e]}function Zi(n,e){return typeof n=="number"&&Number.isFinite(n)&&n>=1?Math.floor(n):e}function Qi(n){return typeof n=="number"&&Number.isFinite(n)&&n>0?n:void 0}function Ls(n,e){let t=Qi(e.flex);for(let r of["width","contentWidth"]){let i=Qi(e[r]);i!==void 0&&(n[r]=i)}e.flex===null?n.flex=null:t!==void 0&&(n.flex=t),(e.widthMode==="auto"||e.widthMode==="manual")&&(n.widthMode=e.widthMode)}function Ps(n,e){typeof e.hide=="boolean"&&(n.hide=e.hide),(e.pinned===null||e.pinned==="left"||e.pinned==="right")&&(n.pinned=e.pinned)}function ks(n,e){if(n==null||typeof n!="object")return null;let t=n,r=typeof t.colId=="string"?t.colId.trim():"";if(!r||r.length>Ge||e.has(r))return null;e.add(r);let i={colId:r};return Ps(i,t),Ls(i,t),i}function Gs(n){if(!Array.isArray(n))return[];let e=[],t=new Set;for(let r of n.slice(0,en)){let i=ks(r,t);i&&e.push(i)}return e}function Ns(n){if(!Array.isArray(n))return[];let e=[],t=new Set;for(let r of n.slice(0,en)){if(r==null||typeof r!="object")continue;let i=r,o=typeof i.colId=="string"?i.colId.trim():"";!o||o.length>Ge||t.has(o)||i.direction!=="asc"&&i.direction!=="desc"||(t.add(o),e.push({colId:o,direction:i.direction}))}return e}function z(n){if(n==null||typeof n!="object")return null;let e=n;if(e.version!==2||!Array.isArray(e.columns)||!Array.isArray(e.sortModel))return null;let t=e.pagination!=null&&typeof e.pagination=="object"?e.pagination:{};return{version:2,columns:Gs(e.columns),sortModel:Ns(e.sortModel),filterModel:K(e.filterModel),advancedFilterModel:O(e.advancedFilterModel),quickFilterText:typeof e.quickFilterText=="string"&&e.quickFilterText.trim()?e.quickFilterText.slice(0,Is):null,pagination:{enabled:t.enabled===!0,page:Zi(t.page,1),pageSize:Zi(t.pageSize,20)},selectedRowIds:Ji(e.selectedRowIds),expandedRowIds:Ji(e.expandedRowIds),expandedGroupIds:As(e.expandedGroupIds)}}function tn(n,e){let t=z(n);if(!t)throw new TypeError("[MachTable] Cannot persist an invalid GridState snapshot.");let r=new Set(e);return{version:2,columns:r.has("columns")?t.columns:[],sortModel:r.has("sort")?t.sortModel:[],filterModel:r.has("filter")?t.filterModel:{},advancedFilterModel:r.has("filter")?t.advancedFilterModel:null,quickFilterText:r.has("filter")?t.quickFilterText:null,pagination:r.has("pagination")?t.pagination:{enabled:!1,page:1,pageSize:20},selectedRowIds:r.has("selection")?t.selectedRowIds:[],expandedRowIds:r.has("expansion")?t.expandedRowIds:[],expandedGroupIds:r.has("expansion")?t.expandedGroupIds:[]}}function Os(n){try{if(typeof structuredClone=="function")return structuredClone(n)}catch{}return Array.isArray(n)?[...n]:n!=null&&typeof n=="object"?{...n}:n}function nn(n,e){let t=e?new Set(e.map(String)):null;return n.filter(r=>!t||t.has(r.rowId)).map(r=>({...r,data:Os(r.data),cells:r.cells.map(i=>({...i}))}))}function Fs(n,e){let t=typeof n?.rowId=="string"?n.rowId:"";return!e.has(t)||typeof n.message!="string"||!n.message.trim()?null:{...n,rowId:t,message:n.message.trim(),...typeof n.code=="string"&&n.code.trim()?{code:n.code.trim()}:{},...Array.isArray(n.colIds)?{colIds:[...new Set(n.colIds.filter(r=>typeof r=="string"&&r.length>0))]}:{}}}function rn(n,e){let t=new Map;for(let r of n??[]){let i=Fs(r,e);i&&!t.has(i.rowId)&&t.set(i.rowId,i)}return[...t.values()]}function on(n,e){let t=new Set(n.map(d=>d.rowId)),r=rn(e?.conflicts,t),i=new Set(r.map(d=>d.rowId)),o=rn(e?.failures,t).filter(d=>!i.has(d.rowId)),s=new Set([...o,...r].map(d=>d.rowId)),a=e?.savedRowIds==null?null:new Set(e.savedRowIds.map(String).filter(d=>t.has(d))),l=n.filter(d=>!s.has(d.rowId)&&(a==null||a.has(d.rowId)));return{submitted:n,saved:l,failures:o,conflicts:r}}function Hs(n,e){if(e.serverData===void 0)return null;let t=n.rows.getById(e.rowId);if(!t||t.data==null)return null;let r=n.getOption("rowKey");if(r){let s=typeof r=="function"?r(e.serverData):B(e.serverData,r);return String(s)===e.rowId?{data:e.serverData,mergeIntoCurrent:!1}:null}let i=t.data;return i!=null&&e.serverData!=null&&typeof i=="object"&&typeof e.serverData=="object"?{data:i,mergeIntoCurrent:!0}:null}function sn(n,e,t){if(n.isDestroyed())return!1;if(t==="keepLocal")return!0;let r=Hs(n,e);return r?(n.editing.rollback([e.rowId]),r.mergeIntoCurrent&&Object.assign(r.data,e.serverData),n.rows.transact({update:[r.data]}),n.editing.markSaved([e.rowId]),!0):!1}function an(n){return{setData:e=>n.ht(e),transact:e=>n.$r(e),transactAsync:(e,t)=>n.vh(e,t),flushTransactions:()=>n.Nl(),getCount:()=>n.A(),getAt:e=>n.bh(e),getById:e=>n.K(e),forEach:e=>n.Go(e),forEachDisplayed:e=>n.No(e),reorder:(e,t)=>n.wh(e,t),isRemote:()=>n.f(),reload:e=>n.reload(e),ensureLoaded:(e,t,r)=>n.vo(e,t,r),purgeCache:()=>n.bo(),getCacheSnapshot:()=>n.wo()}}function ln(n){return{getDefinitions:()=>n.Ri(),setDefinitions:e=>n.Nr(e),getState:()=>n.Mi(),setState:e=>n.Ch(e),resetState:()=>n.ao(),setVisible:(e,t)=>n.oo(e,t),setPinned:(e,t)=>n.so(e,t),move:(e,t)=>n.At(e,t),setWidth:(e,t)=>n.Se(e,t),fit:e=>n.Th(e),autoSize:e=>n.Eh(e),autoSizeAll:()=>n.Dh(),getWorkbenchItems:()=>n.xh(),openWorkbench:e=>n.Rh(e),closeWorkbench:()=>n.Sh()}}function dn(n){return{getRows:()=>n.ji(),getVisibleRows:()=>n.Mh(),getNodes:()=>n.je(),getIds:()=>n.qi(),setRows:(e,t)=>n.Ih(e,t),setById:(e,t,r)=>n.Oo(e,t,r),selectAll:e=>n.selectAll(e),clear:()=>n.deselectAll(),getMode:()=>n.Ah(),setMode:e=>n.Lh(e),getRange:()=>n.Xe(),clearRange:()=>n.fr()}}function cn(n){return{startCell:e=>n.Ph(e),startRow:e=>n.kh(e),isRowActive:e=>n.tn(e),stop:e=>n.Gh(e?.cancel===!0),getChanges:()=>n.getChanges(),getDirtyRowIds:()=>n.getDirtyRowIds(),markSaved:e=>n.Nh(e),rollback:e=>n.Oh(e),save:(e,t)=>n.Fh(e,t),undo:()=>n.undo(),redo:()=>n.redo(),canUndo:()=>n.canUndo(),canRedo:()=>n.canRedo()}}function un(n){return{get:()=>n.getState(),apply:(e,t)=>n.Ol(e,t)}}function hn(n){return{get:()=>n.ys(),getPerformance:()=>n.Hh(),resetPerformance:()=>n.Vh()}}function pn(n){return{getModel:()=>n.Q(),setModel:e=>n.Kr(e),getAdvancedModel:()=>n.Ie(),setAdvancedModel:e=>n.ar(e),getQuickText:()=>n.Ur(),setQuickText:e=>n.lr(e),isPresent:e=>e==null?Object.keys(n.Q()).length>0||n.Ie()!=null||n.Ur()!=null:n.Bh(e)}}function fn(n){return{getModel:()=>n.J(),setModel:e=>n._h(e)}}function mn(n){return{isEnabled:()=>n.paginationEnabled(),setEnabled:e=>n.Ki(e),getPage:()=>n.getPage(),setPage:e=>n.setPage(e),getPageSize:()=>n.getPageSize(),setPageSize:e=>n.setPageSize(e),getPageCount:()=>n.getPageCount(),getTotalRowCount:()=>n.getTotalRowCount()}}function gn(n){return{isRowExpanded:e=>n.isRowExpanded(e),setRowExpanded:(e,t)=>n.isRowExpanded(e)===t?!1:(t?n.Ro(e):n.Mo(e),n.isRowExpanded(e)===t),isTreeRowLoading:e=>n.isTreeRowLoading(e),loadTreeChildren:(e,t)=>n.loadTreeChildren(e,t),isGroupExpanded:e=>n.isGroupExpanded(e),setGroupExpanded:(e,t)=>n.isGroupExpanded(e)===t?!1:(n.zh(e),n.isGroupExpanded(e)===t),setAllGroupsExpanded:e=>e?n.Po():n.ko(),setAllDetailsExpanded:e=>e?n.Io():n.Ao()}}function yn(n){return{getRoot:()=>n.Wh(),scrollToRow:(e,t)=>n.cr(e,t),refreshCells:e=>n.refreshCells(e),refreshLayout:()=>n.refreshLayout(),flush:()=>n.$h(),setOverlay:e=>n.setOverlay(e),getPinnedRows:e=>n.getPinnedRows(e),setPinnedRows:(e,t)=>n.setPinnedRows(e,t)}}function vn(n){return{exportCsv:e=>n.Kh(e),importCsv:(e,t)=>n.importCsv(e,t),exportMatrix:e=>n.Fl(e),importMatrix:(e,t)=>n.importMatrix(e,t),print:e=>n.print(e),copyRange:()=>n.Uh()}}function kt(n){return re(n?.reason,"The operation was aborted")}function bn(n,e){return Je(n,e,()=>kt(e))}function Vs(){return{datasourceChanged:!1,filterChanged:!1,needsCellRefresh:!1,needsColumnRebuild:!1,needsHeaderRebuild:!1,needsPoolRebuild:!1,needsRelayout:!1,needsRowRebuild:!1,needsStateLoad:!1,needsSummaryRefresh:!1,needsFeatureReload:!1}}function E(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function Lr(n,e,t,r=!1){let i=A(n,t,r);return i===void 0||i===e?void 0:i}var Pr=class{constructor(e){this.e=e;this.ai=[];this.Et=null}batch(e){return this.e.Hl(()=>e(this.e.api))}$h(){this.e.vr.flush()}Wh(){return this.e.s()?null:this.e.o.root}ht(e){this.e.s()||(this.e.r.rowData=e??[],!this.e.i.f&&(this.e.i.ht(e),this.e.h({data:!0})))}$r(e){if(this.e.s()||this.e.i.f)return;let t=this.e.i.$r(e);this.Vl(t)}vh(e,t={}){if(this.e.s()||this.e.i.f)return Promise.resolve();if(t.signal?.aborted)return Promise.reject(kt(t.signal));let r=new Promise((i,o)=>{let s={transaction:e,resolve:i,reject:o,signal:t.signal,aborted:!1};t.signal&&(s.onAbort=()=>{s.aborted||(s.aborted=!0,o(kt(t.signal)))},t.signal.addEventListener("abort",s.onAbort,{once:!0})),this.ai.push(s)});return this.Et==null&&(this.Et=setTimeout(()=>this.Nl(),this.e.r.asyncTransactionWaitMillis)),r}Nl(){this.Et!=null&&clearTimeout(this.Et),this.Et=null;let e=this.ai;this.ai=[];let t=e.filter(r=>!r.aborted).map(r=>r.transaction);if(t.length>0&&!this.e.s()&&!this.e.i.f){let r=this.e.i.Nc(t);this.Vl(r)}for(let r of e)r.signal&&r.onAbort&&r.signal.removeEventListener("abort",r.onAbort),r.aborted||r.resolve()}Vl(e){if(e.pipelineChanged){this.e.h({data:!0});return}e.updatedRowIds.length!==0&&this.e.h({cells:{rowIds:e.updatedRowIds},summary:!0,overlays:!0})}Ri(){return this.e.n.Ri()}Nr(e){this.e.s()||(this.e.r.columnDefs=e??[],this.e.n.Nr(e),this.e.vs(),this.e.Je(),this.e.i.f?this.e.i.$e():(this.e.i.w(),this.e.h({data:!0})))}Mi(){return this.e.n.Mi()}Ch(e){this.e.s()||(this.e.n.Ta(e),this.e.Je())}ao(){this.e.s()||(this.e.n.ao(),this.e.Je())}oo(e,t){this.e.s()||(this.e.n.oo(e,t),this.e.Je(),this.e.emit("columnVisibilityChanged",{colId:e,visible:t}))}At(e,t){this.e.s()||this.e.At(e,t)}so(e,t){this.e.s()||(this.e.n.so(e,t),this.e.Je())}Se(e,t){if(this.e.s())return!1;let r=this.e.n.P(e);return!r||!this.e.n.Se(r,t)?!1:(this.e.qe(),this.e.ur([r]),!0)}Th(e){if(this.e.s())return;let t=this.e.n.c(),r=t.filter(d=>d.pinned===null&&!d.colDef.suppressSizeToFit);if(r.length===0)return;let i=e??this.e.o.bs();if(!Number.isFinite(i)||i<=0)return;let o=t.reduce((d,c)=>d+(c.pinned!==null||c.colDef.suppressSizeToFit?c.currentWidth:0),0),s=Ye(r.map(d=>({width:d.currentWidth,minWidth:d.colDef.minWidth,maxWidth:d.colDef.maxWidth})),Math.max(0,i-o)),a=this.e.r.columnLayout==="fit"&&e===void 0,l=r.filter((d,c)=>a?this.e.n.Ca(d,s[c]):this.e.n.Se(d,s[c]));this.e.qe(),this.e.ur(l)}Eh(e){if(this.e.s())return;let t=this.e.n.P(e);t&&this.Bl(t)&&(this.e.qe(),this.e.ur([t]))}Bl(e){return this.e.r.columnLayout==="fit"&&e.colDef.suppressSizeToFit?!1:e.hasCheckbox||e.isDetailToggle?this.e.n.Se(e,e.isDetailToggle?38:46):this.jh(e,this.e._t.ga(e))}jh(e,t){return this.e.r.columnLayout==="fit"?this.e.n.Ca(e,t):this.e.n.Se(e,t)}Dh(){if(this.e.s())return;let e=[];for(let t of this.e.n.c())this.Bl(t)&&e.push(t);e.length>0&&(this.e.qe(),this.e.ur(e))}J(){return this.e.n.J()}_h(e){this.e.s()||(this.e.n.Or(e),this.e.Or())}Q(){return this.e.i.Q()}Kr(e){if(!this.e.s()){if(this.e.i.Kr(e),this.e.W.mn(),this.gn(),this.e.i.f){this.e.i.$e();return}this.e.i.w(),this.e.h({data:!0})}}Ie(){return this.e.i.Ie()}ar(e){if(!(this.e.s()||!this.e.i.ar(e))){if(this.gn(),this.e.i.f){this.e.i.$e();return}this.e.i.w(),this.e.h({data:!0})}}gn(){this.e.emit("filterChanged",{filterModel:this.e.i.Q(),advancedFilterModel:this.e.i.Ie()})}Bh(e){return Object.prototype.hasOwnProperty.call(this.e.i.Q(),e)}lr(e){this.e.s()||(this.e.r.quickFilterText=e!=null&&e.trim()!==""?e:null,this.e.i.lr(e)&&this.e.qh())}Ur(){return this.e.i.Ur()}Ah(){return this.e.r.rowSelection}Lh(e){this.e.s()||this.e.r.rowSelection!==e&&(this.e.r.rowSelection=e,e==="none"&&this.deselectAll(),this.e.W.li(),this.e.a.ws())}je(){return this.e.g.je()}ji(){return this.e.g.ji()}Oo(e,t=!0,r=!0){this.e.g.Oo(e,t,r)}selectAll(e=!0){this.e.g.selectAll(e)}deselectAll(){this.e.g.deselectAll()}A(){return this.e.i.A()}bh(e){return this.e.i.m(e)}K(e){return this.e.i.K(e)}Go(e){this.e.i.Go(e)}No(e){this.e.i.No(e)}cr(e,t="top"){this.e.a.cr(e,t)}Ro(e){return this.e.s()?!1:this.e.i.Ro(e)}Mo(e){return this.e.s()?!1:this.e.i.Mo(e)}isRowExpanded(e){return this.e.i.isRowExpanded(e)}Io(){this.e.s()||this.e.i.Io()}Ao(){this.e.s()||this.e.i.Ao()}loadTreeChildren(e,t={}){return this.e.s()?Promise.resolve([]):this.e.i.loadTreeChildren(e,t.force===!0)}isTreeRowLoading(e){return!this.e.s()&&this.e.i.isTreeRowLoading(e)}zh(e){return this.e.s()?!1:this.e.i.Lo(e)}wh(e,t){return this.e.s()||this.e.l.isEditing()?!1:this.e.i.Ya(e,t)}isGroupExpanded(e){return this.e.i.isGroupExpanded(e)}Po(){this.e.s()||this.e.i.Po()}ko(){this.e.s()||this.e.i.ko()}Ih(e,t=!0){if(this.e.s())return;let r=this.e.r.resolveRowId,i=[];for(let o of e){let s=r?this.e.i.K(this.e.i.resolveRowId(o,-1,`__missing_selection_${this.e.sr()}`)):this.e.i.be().find(a=>a.data===o);s&&i.push({node:s,selected:!0})}i.length>0?this.e.g.lu(i,t):t&&this.deselectAll()}Mh(){let e=new Set(this.e.g.je().map(t=>t.id));return this.e.i.pt().filter(t=>!t.isDetail&&!t.isGroup&&e.has(t.id)).map(t=>t.data).filter(Boolean)}qi(){return this.e.g.qi()}undo(){return this.e.s()?!1:this.e.z.undo()}redo(){return this.e.s()?!1:this.e.z.redo()}canUndo(){return this.e.z.canUndo()}canRedo(){return this.e.z.canRedo()}getDirtyRowIds(){return this.e._.getDirtyRowIds()}getChanges(){return this.e._.getChanges()}Nh(e){this.e._.markSaved(e)}async Fh(e,t){let r=nn(this.e._.getChanges(),t);if(r.length===0)return{submitted:[],saved:[],failures:[],conflicts:[]};let i=this.e.i.zr(),o=on(r,await e(r));return!this.e.s()&&i===this.e.i.zr()&&this.e._.ph(o.saved),o}Oh(e){return this.e._.rollback(e)}setPinnedRows(e,t){if(this.e.s())return;let r=e==="top"?"pinnedTopRowData":"pinnedBottomRowData";this.e.r[r]=t??[],this.e.me.setRows(e,this.e.r[r])}getPinnedRows(e){return this.e.me.getRows(e)}Xe(){return this.e.a.Xe()}fr(){this.e.s()||this.e.a.fr()}Uh(){return this.e.s()?Promise.resolve(!1):this.e.Dl()}Rh(e){this.e.s()||this.e.columnMenu.Zu(e)}Sh(){this.e.columnMenu.close()}xh(){return this.e.n.te().filter(e=>!e.isDetailToggle).map(e=>({colId:e.id,label:e.colDef.headerName??e.colDef.field??e.id,visible:!e.hide,pinned:e.pinned,width:e.currentWidth||e.manualWidth||e.colDef.width||0,movable:e.movable,hideable:!e.hasCheckbox}))}refreshLayout(){this.e.s()||(this.e.Te(),this.e.a.yn(!0))}f(){return this.e.i.f}reload(e={}){return this.e.s()?Promise.resolve():e.signal?.aborted?Promise.reject(kt(e.signal)):this.e.i.f?bn(this.e.i.Vi(e.signal),e.signal):(this.e.i.ht(this.e.r.rowData),this.e.h({data:!0}),Promise.resolve())}vo(e,t,r={}){return this.e.s()?Promise.resolve():bn(this.e.i.vo(e,t,r.signal),r.signal)}bo(){this.e.s()||this.e.i.bo()}wo(){return this.e.i.wo()}paginationEnabled(){return this.e.i.Ae}Ki(e){this.e.s()||this.e.i.Ki(e)}getPage(){return this.e.i.Yr()}setPage(e){this.e.s()||this.e.i.setPage(e)}getPageSize(){return this.e.r.paginationPageSize}setPageSize(e){this.e.s()||this.e.i.setPageSize(e)}getPageCount(){return this.e.i.getPageCount()}getTotalRowCount(){return this.e.i.getTotalRowCount()}importCsv(e,t={}){if(!e)return!1;let{parseValue:r,...i}=t;return this.importMatrix(ut(e,t.separator??","),{...i,parseValue:r?o=>r({...o,value:o.value}):void 0})}importMatrix(e,t={}){if(this.e.s()||this.e.i.f||!Array.isArray(e)||!e.length)return!1;try{let r=qi(this.e.api),i=t.mode==="paste"?r.pasteRows(e.length):void 0,o=Yi(r,e,t,i);if(o.issues.length)return this.e.reportError(new Error(o.issues.map(s=>s.message).join("; ")),"import",{issues:o.issues}),!1;if(t.mode==="paste")this.e.br(o.rows.flatMap(s=>s.changes));else{let s=o.rows.map(a=>a.data);t.mode==="append"?this.$r({add:s}):this.ht(s)}return!0}catch(r){return this.e.reportError(r,"import"),!1}}print(e={}){if(this.e.s())return!1;try{let t=window.open("","_blank","width=980,height=720");if(!t)return!1;let r=this.e.n.c().filter(d=>!d.hasCheckbox&&!d.isDetailToggle&&!d.colDef.rowDrag),i=this.e.i.Ka().filter(d=>!d.isDetail&&!d.isGroup),s=e.includeHeader!==!1?`<tr>${r.map(d=>`<th>${le(d.colDef.headerName??d.colDef.field??d.id)}</th>`).join("")}</tr>`:"",a=i.map(d=>`<tr>${r.map(c=>{let u=ee(this.e,d,c);return`<td>${le(u)}</td>`}).join("")}</tr>`).join(""),l=`<!doctype html><html><head><meta charset="utf-8"><title>${le(e.title??"MachTable")}</title><style>body{font-family:system-ui,"PingFang SC","Microsoft YaHei",sans-serif;padding:20px}h3{margin:0 0 12px;font-size:16px}table{border-collapse:collapse;width:100%;font-size:12px}th,td{border:1px solid #bbb;padding:5px 8px;text-align:left;word-break:break-all}th{background:#f2f5f9;font-weight:600}@page{margin:12mm}</style></head><body><h3>${le(e.title??"")}</h3><table>${s}${a}</table></body></html>`;return t.document.write(l),t.document.close(),t.focus(),t.print(),!0}catch{return!1}}Ph(e){let t=this.e.n.P(e.colId);return t?this.e.l.start(e.rowIndex,t,e.keyPress??null):!1}kh(e){return this.e.l.startRow(e)}tn(e){return this.e.l.tn(e)}Gh(e){return this.e.l.he(e??!1)}refreshCells(e){let t=e==null||e.rowIds==null&&e.rowIndexes==null&&e.columns==null;this.e.h({cells:e??!0,pinned:e?.includePinned??t,summary:t})}getOption(e){return this.e.r[e]}updateOptions(e){this.e.s()||(this.e.Cs(e),e=Xi(e),Object.keys(e).length!==0&&this.e.Hl(()=>{let t=Vs(),r=this.e.r.columnMenu;this.Yh(e,t),this.Xh(e,t),this.Jh(e,t),this.Zh(e,t),this.Qh(e),this.ep(e,t),this.tp(e,t),this.rp(e,t),this.ip(e,t),this.np(e,t),this.op(e,t,r)}))}Yh(e,t){let r=this.e.r;E(e,"columnDefs")&&e.columnDefs!==r.columnDefs&&(r.columnDefs=Array.isArray(e.columnDefs)?e.columnDefs:[],t.needsColumnRebuild=!0,t.needsRowRebuild=!0),E(e,"rowData")&&e.rowData!==r.rowData&&(r.rowData=Array.isArray(e.rowData)?e.rowData:[],t.needsRowRebuild=!0),E(e,"initialState")&&e.initialState&&(r.initialState=e.initialState,t.stateToApply=e.initialState),this.sp(e)}sp(e){for(let t of me){let r=`on${t.charAt(0).toUpperCase()}${t.slice(1)}`;E(e,r)&&Object.assign(this.e.r,{[r]:e[r]})}}Xh(e,t){let r=this.e.r;for(let o of["rowHeight","headerHeight","rowBuffer"]){let s=Lr(e[o],r[o],o==="rowBuffer"?0:1,o==="rowBuffer");s!==void 0&&(r[o]=s,t.needsRelayout=!0,o==="headerHeight"&&(t.needsHeaderRebuild=!0))}e.columnLayout!=null&&e.columnLayout!==r.columnLayout&&(r.columnLayout=e.columnLayout==="fit"?"fit":"normal",t.needsRelayout=!0),e.domLayout!=null&&e.domLayout!==r.domLayout&&(r.domLayout=e.domLayout==="autoHeight"?"autoHeight":"normal",this.e.o.ap(r.domLayout),t.needsPoolRebuild=!0),S(e,r,["multiSort"]);let i=Lr(e.detailRowHeight,r.detailRowHeight,1);i!==void 0&&(r.detailRowHeight=i,this.e.a.vn(),this.e.a.di(!0))}Jh(e,t){let r=this.e.r;e.editType!=null&&e.editType!==r.editType&&(this.e.l.stop(!0),r.editType=e.editType==="fullRow"?"fullRow":"cell",t.needsCellRefresh=!0),e.editableIndicator!=null&&e.editableIndicator!==r.editableIndicator&&(r.editableIndicator=e.editableIndicator==="always"||e.editableIndicator==="none"?e.editableIndicator:"hover",t.needsCellRefresh=!0),S(e,r,["rowEditValidator"],!0),S(e,r,["singleClickEdit","manualSorting","manualFiltering"])}Zh(e,t){let r=this.e.r;typeof e.enableColumnResize=="boolean"&&e.enableColumnResize!==r.enableColumnResize&&(this.e.ci.Ot(),r.enableColumnResize=e.enableColumnResize,t.needsHeaderRebuild=!0),e.locale!=null&&e.locale!==r.locale&&(r.locale=e.locale,t.needsHeaderRebuild=!0,t.needsCellRefresh=!0,this.e.wr.ge(),this.e.Ye.ge()),e.indexOffset!=null&&e.indexOffset!==r.indexOffset&&(r.indexOffset=e.indexOffset,t.needsCellRefresh=!0),e.showSummary!=null&&e.showSummary!==r.showSummary&&(r.showSummary=e.showSummary,t.needsSummaryRefresh=!0,t.needsRelayout=!0);let i=Lr(e.undoStackSize,r.undoStackSize,0,!0);i!==void 0&&(r.undoStackSize=i,this.e.z.hh());let o=A(e.asyncTransactionWaitMillis,0,!0);o!==void 0&&(r.asyncTransactionWaitMillis=o),this.lp(e,t),this.dp(e)}lp(e,t){if(!E(e,"getRowHeight"))return;let r=this.e.r.getRowHeight!==e.getRowHeight;this.e.r.getRowHeight=e.getRowHeight,r&&this.e.a.bn(),t.needsRelayout=!0}dp(e){let t=this.e.r;e.enableRangeSelection!=null&&(t.enableRangeSelection=e.enableRangeSelection,e.enableRangeSelection||this.fr()),S(e,t,["tooltipComponent"],!0);let r=A(e.tooltipShowDelay,0);r!==void 0&&(t.tooltipShowDelay=r),S(e,t,["flashCells"]),S(e,t,["getContextMenuItems"],!0),e.theme!=null&&e.theme!==t.theme&&(t.theme=e.theme,this.e.o._l(e.theme),this.e.wn.refresh())}Qh(e){if(e.pagination===void 0)return;let t=this.e.r,r=e.pagination,i=r!==!1&&t.datasource==null;i!==t.paginationEnabled&&this.e.i.Ki(i),typeof r=="object"&&r&&this.cp(r),t.paginationEnabled&&this.e.i.Wc(),this.e.wr.ge()}cp(e){let t=this.e.r;t.paginationMode=e.mode==="server"?"server":"client";let r=A(e.page,1,!0),i=A(e.total,0,!0);r!==void 0&&(t.paginationPage=r),i!==void 0&&(t.paginationTotal=i),e.pageSize!=null&&(t.paginationPageSize=e.pageSize),e.pageSizeOptions!=null&&(t.paginationPageSizeOptions=e.pageSizeOptions),e.showTotal!=null&&(t.paginationShowTotal=e.showTotal),e.showPageSizeSelector!=null&&(t.paginationShowSizeSelector=e.showPageSizeSelector)}ep(e,t){E(e,"rowStyleRules")&&(this.e.r.rowStyleRules=Array.isArray(e.rowStyleRules)?e.rowStyleRules:[],t.needsCellRefresh=!0,this.e.h({pinned:!0})),this.up(e,t),this.hp(e,t);let r=this.e.r;e.stripedRows!=null&&e.stripedRows!==r.stripedRows&&(r.stripedRows=e.stripedRows,this.e.o.pp(e.stripedRows)),e.showCellBorders!=null&&e.showCellBorders!==r.showCellBorders&&(r.showCellBorders=e.showCellBorders,this.e.o.fp(e.showCellBorders))}up(e,t){let r=this.e.r;e.watermark!==void 0&&(Object.assign(r,cr(e)),this.e.wn.refresh()),this.mp(e),E(e,"summaryMethod")&&(r.summaryMethod=e.summaryMethod,t.needsSummaryRefresh=!0)}mp(e){let t=this.e.r;S(e,t,["suppressClipboard","contextMenu","columnMenu","fillHandle"]),e.statusBar!==void 0&&(t.statusBarEnabled=e.statusBar===!0||typeof e.statusBar=="object"&&e.statusBar!=null,typeof e.statusBar=="object"&&e.statusBar?.panels&&(t.statusBarPanels=e.statusBar.panels),this.e.Ye.ge())}hp(e,t){let{size:r}=e;if(r==null||!E(Ee,r)||r===this.e.r.size)return;let i=Ee[r];this.e.r.size=r,this.e.r.rowHeight=e.rowHeight??i.rowHeight,this.e.r.headerHeight=e.headerHeight??i.headerHeight,this.e.o.gp(r),t.needsRelayout=!0,t.needsHeaderRebuild=!0}tp(e,t){let r=this.e.r;S(e,r,["suppressCellFocus","suppressRowHoverHighlight","suppressNoRowsOverlay"]),e.suppressHeaderFocus!=null&&e.suppressHeaderFocus!==r.suppressHeaderFocus&&(r.suppressHeaderFocus=e.suppressHeaderFocus,t.needsHeaderRebuild=!0),this.yp(e),this.vp(e)}yp(e){let t=this.e.r,r=!1;for(let i of["ariaLabel","ariaLabelledBy","ariaDescribedBy"])E(e,i)&&(t[i]=e[i]??De[i],r=!0);r&&this.e.o.zl(t)}vp(e){let t=this.e.r;for(let r of["overlayNoRowsTemplate","overlayLoadingTemplate","overlayErrorTemplate"])E(e,r)&&(t[r]=e[r]??De[r]);S(e,t,["allowUnsafeOverlayHtml"]),E(e,"className")&&(t.className=e.className??"",this.e.o.Wl(t.className)),S(e,t,["loading"]),E(e,"error")&&(t.error=e.error??null)}rp(e,t){this.bp(e,t),this.wp(e,t);let r=this.e.r;S(e,r,["autoCheckedChildren"]),e.defaultExpandAll!=null&&e.defaultExpandAll!==r.defaultExpandAll&&(r.defaultExpandAll=e.defaultExpandAll,t.needsRowRebuild=!0),E(e,"advancedFilterModel")&&(t.filterChanged=this.e.i.ar(e.advancedFilterModel)||t.filterChanged),e.applyRowDrag!=null&&(r.applyRowDrag=e.applyRowDrag,t.needsCellRefresh=!0),E(e,"rowDragPolicy")&&(r.rowDragPolicy=e.rowDragPolicy,t.needsCellRefresh=!0),S(e,r,["suppressWarnings"])}bp(e,t){let r=this.e.r;if(e.rowSelection!=null&&e.rowSelection!==r.rowSelection&&(r.rowSelection=e.rowSelection,e.rowSelection==="none"&&this.deselectAll(),t.needsHeaderRebuild=!0,t.needsPoolRebuild=!0,this.e.Cn()),e.quickFilterText!==void 0&&this.lr(e.quickFilterText),e.defaultColDef!==void 0&&e.defaultColDef!==r.defaultColDef&&(r.defaultColDef={...lr,...e.defaultColDef},t.needsColumnRebuild=!0),E(e,"columnTypes")&&e.columnTypes!==r.columnTypes&&(r.columnTypes=e.columnTypes??{},t.needsColumnRebuild=!0),E(e,"rowKey")){r.rowKey=e.rowKey;let i=e.rowKey;r.resolveRowId=i?({data:o})=>dr(i,o):void 0,t.needsRowRebuild=!0}}wp(e,t){let r=this.e.r;e.masterDetail!=null&&e.masterDetail!==r.masterDetail&&(r.masterDetail=e.masterDetail,t.needsColumnRebuild=!0,t.needsRowRebuild=!0),e.detailToggleColumn!=null&&e.detailToggleColumn!==r.detailToggleColumn&&(r.detailToggleColumn=e.detailToggleColumn,t.needsColumnRebuild=!0),e.treeData!=null&&e.treeData!==r.treeData&&(r.treeData=e.treeData,t.needsRowRebuild=!0,t.needsColumnRebuild=!0,this.e.Cn()),e.childrenKey!=null&&e.childrenKey!==r.childrenKey&&(r.childrenKey=e.childrenKey,t.needsRowRebuild=!0),S(e,r,["isTreeRowExpandable","loadTreeChildren"],!0)&&(t.needsCellRefresh=!0)}ip(e,t){let r=this.e.r;S(e,r,["aggFuncs"],!0)&&(t.needsRowRebuild=!0),S(e,r,["components","actionPolicy"],!0)&&(t.needsCellRefresh=!0),E(e,"features")&&(r.features=Array.isArray(e.features)?e.features:[],t.needsFeatureReload=!0),this.Cp(e,t),this.Tp(e,t)}Cp(e,t){let r=this.e.r;E(e,"dataProcessor")&&this.e.$l(e.dataProcessor)&&(t.needsRowRebuild=!0);let i=A(e.dataProcessorMinRows,1,!0);i!==void 0&&i!==r.dataProcessorMinRows&&(r.dataProcessorMinRows=i,t.needsRowRebuild=!0)}Tp(e,t){let r=this.e.r;E(e,"persistence")&&(r.persistence=Ve(e.persistence),t.needsStateLoad=!0)}np(e,t){this.Ep(e,t),this.Dp(e,t),this.xp(e,t),this.Rp(e)}Ep(e,t){let r=this.e.r;for(let o of["blockSize","maxBlocksInCache","datasourceMaxConcurrentRequests"]){let s=A(e[o],1,!0);s===void 0||s===r[o]||(r[o]=s,t.datasourceChanged||(t.datasourceChanged=r.datasourceMode==="block"))}for(let o of["infiniteBufferRows","blockPrefetch","datasourceRetryCount","datasourceRetryDelay"]){let s=A(e[o],0,!0);s!==void 0&&(r[o]=s)}let i=A(e.datasourceRetryJitter,0);i!==void 0&&(r.datasourceRetryJitter=Math.min(1,i))}Dp(e,t){let r=this.e.r;if(E(e,"datasourceMode")){let i=e.datasourceMode==="block"?"block":"sequential";i!==r.datasourceMode&&(r.datasourceMode=i,t.datasourceChanged=!0)}if(E(e,"datasourceRowCount")){let i=e.datasourceRowCount==null?null:A(e.datasourceRowCount,0,!0)??null;i!==r.datasourceRowCount&&(r.datasourceRowCount=i,t.datasourceChanged=!0)}}xp(e,t){let r=this.e.r;E(e,"datasource")&&e.datasource!==r.datasource&&(r.datasource=e.datasource,r.paginationEnabled=e.datasource==null&&r.paginationEnabled,t.datasourceChanged=!0,this.e.wr.ge()),S(e,r,["detailRowRenderer","isRowExpandable"],!0)&&(t.needsCellRefresh=!0)}Rp(e){let t=this.e.r;e.pinnedTopRowData!==void 0&&(t.pinnedTopRowData=e.pinnedTopRowData??[],this.e.me.setRows("top",t.pinnedTopRowData)),e.pinnedBottomRowData!==void 0&&(t.pinnedBottomRowData=e.pinnedBottomRowData??[],this.e.me.setRows("bottom",t.pinnedBottomRowData))}op(e,t,r){let i=this.e.r;t.needsColumnRebuild&&(this.e.n.Nr(i.columnDefs),this.e.Je(),t.needsHeaderRebuild=!1,t.needsPoolRebuild=!1),t.needsStateLoad&&(this.e.vs(),this.e.Je()),t.needsFeatureReload&&this.e.Kl(i.features),this.Sp(t),t.filterChanged&&(this.gn(),!t.datasourceChanged&&!t.needsRowRebuild&&(this.e.i.f?this.e.i.$e():(this.e.i.w(),this.e.h({data:!0})))),t.needsRelayout&&this.e.o.Mp(i.rowHeight,i.headerHeight),e.columnMenu!=null&&e.columnMenu!==r&&(t.needsHeaderRebuild=!0),t.stateToApply&&this.Ol(t.stateToApply),this.e.h({layout:t.needsRelayout,header:t.needsHeaderRebuild,pool:t.needsPoolRebuild,cells:t.needsCellRefresh&&!t.needsPoolRebuild?!0:void 0,summary:t.needsSummaryRefresh,overlays:!0})}Sp(e){if(e.datasourceChanged){this.e.i.Mc();return}if(e.needsRowRebuild){if(this.e.i.f){this.e.i.$e();return}this.e.i.ht(this.e.r.rowData),this.e.h({data:!0})}}Kh(e={}){let t=this.Fl({...e,target:"csv",protectFormulas:!1});return Gi(t,e)}Fl(e={}){let t=this.e.n.c().filter(o=>!o.hasCheckbox&&!o.isDetailToggle),r=e.includeHeader===!1?[]:[t.map(o=>o.colDef.headerName??o.colDef.field??o.id)];if(e.headersOnly)return r;let i=e.onlySelected?this.e.g.je().slice().sort((o,s)=>o.rowIndex-s.rowIndex):e.onlyAllDisplayed?this.e.i.pt():this.e.i.Ka();return[...r,...i.filter(o=>!o.isDetail&&!o.isGroup).map(o=>t.map(s=>{let a=Pe(this.e,o,s,e.target??"xlsx");return e.protectFormulas===!1?a:ne(a)}))]}getState(){return{version:2,columns:this.Mi(),sortModel:this.J(),filterModel:this.Q(),advancedFilterModel:this.Ie(),quickFilterText:this.Ur(),pagination:{enabled:this.paginationEnabled(),page:this.getPage(),pageSize:this.getPageSize()},selectedRowIds:this.qi(),expandedRowIds:this.e.i.Yc(),expandedGroupIds:this.e.i.Xc()}}Ol(e,t={}){if(this.e.s())return;let r=z(e);if(!r){this.e.reportError(new TypeError("[MachTable] GridState must use the current version 2 schema."),"gridState.apply");return}let i=["columns","sort","filter","pagination","selection","expansion"],o=new Set(t.sections??i);this.e.l.stop(!0),this.Ip(r,o),this.Ap(r,o),t.emitEvents!==!1&&this.Lp(o)}Ip(e,t){t.has("columns")&&this.e.n.Ta(e.columns??[]),t.has("sort")&&this.e.n.Or(e.sortModel??[]),t.has("filter")&&(this.e.i.Kr(e.filterModel??{}),this.e.i.ar(e.advancedFilterModel),this.e.i.lr(e.quickFilterText)),t.has("expansion")&&this.e.i.Jc(e.expandedRowIds??[],e.expandedGroupIds??[]),t.has("pagination")&&e.pagination&&(this.e.r.paginationEnabled=e.pagination.enabled&&!this.e.i.f,this.e.i.Ua(e.pagination.page,e.pagination.pageSize),this.e.wr.ge())}Ap(e,t){t.has("columns")&&this.e.Je(),this.e.i.f?this.e.i.$e():(this.e.i.w(),this.e.h({data:!0})),this.e.W.Ts(),this.e.W.mn(),t.has("selection")&&this.e.g.tu(e.selectedRowIds??[])}Lp(e){e.has("sort")&&this.e.emit("sortChanged",{sortModel:this.J()}),e.has("filter")&&this.gn(),e.has("pagination")&&this.e.emit("paginationChanged",{page:this.getPage(),pageSize:this.getPageSize(),pageCount:this.getPageCount(),total:this.getTotalRowCount()})}ys(){return this.e.ys()}Hh(){return this.e.le.snapshot()}Vh(){this.e.le.reset()}setOverlay(e){if(e!=="loading"&&e!=="noRows"&&e!=="error"){this.e.o.Ul();return}let t=this.e.r,r=e==="loading"?t.overlayLoadingTemplate||this.e.jl():e==="noRows"?t.overlayNoRowsTemplate||this.e.ql():t.overlayErrorTemplate||this.e.Yl();this.e.o.Tn(e,r,t.allowUnsafeOverlayHtml)}on(e,t){return this.e.fe.on(e,t)}destroy(){this.Et!=null&&clearTimeout(this.Et),this.Et=null;let e=this.ai;this.ai=[];for(let t of e)t.signal&&t.onAbort&&t.signal.removeEventListener("abort",t.onAbort),t.aborted||t.resolve();this.e.destroy()}},Bs={rows:an,columns:ln,selection:dn,editing:cn,filtering:pn,sorting:fn,pagination:mn,hierarchy:gn,view:yn,state:un,io:vn,diagnostics:hn};function wn(n){let e=new Pr(n),t={};for(let[r,i]of Object.entries(Bs)){let o;Object.defineProperty(t,r,{enumerable:!0,get:()=>o??(o=Object.freeze(i(e)))})}return Object.assign(t,{batch:r=>e.batch(r),whenReady:()=>n.whenReady(),getOption:r=>e.getOption(r),updateOptions:r=>e.updateOptions(r),on:(r,i)=>e.on(r,i),destroy:()=>e.destroy(),isDestroyed:()=>n.s()}),ji(t,n),Ki(t,{suspend:()=>n.suspend(),resume:()=>t.view.refreshLayout(),canReplaceData:()=>!n.l.isEditing()&&n._.getDirtyRowIds().length===0,readCell:(r,i)=>{let o=n.i.K(r),s=n.n.P(i);return o&&s?Cr(Pe(n,o,s,"clipboard")):""},writeInput:r=>n.br(r.flatMap(({rowId:i,colId:o,value:s})=>{let a=n.i.K(i),l=n.n.P(o);return a&&l?[{node:a,column:l,oldValue:n.d(a,l),newValue:s}]:[]}))}),Object.freeze(t)}var _s=["compact","normal","large"],Gt=class{constructor(e){this.e=e;this.hi={left:[],center:[],right:[]};this.pr={};this.pi=null;this.xs=null;this.Rs=!1;this.Rn=null;this.Ss=[];this.Sn=null;this.Cr=0;this.Xl=-1;this.Jl=-1;this.Zt=1;this.Tr=null}init(e,t){let r=["mach-root",`mach-size--${t.size}`];t.stripedRows&&r.push("mach-striped"),t.showCellBorders&&r.push("mach-cell-borders"),t.domLayout==="autoHeight"&&r.push("mach-dom-layout--auto-height"),this.root=f("div",r.join(" ")),this.Wl(t.className),this.root.style.setProperty("--mach-row-h",`${t.rowHeight}px`),this.root.style.setProperty("--mach-header-h",`${t.headerHeight}px`),this.root.setAttribute("role","grid"),this.root.tabIndex=0,this.zl(t),this.ui=f("div","mach-header"),this.ui.setAttribute("role","rowgroup"),this.hi={left:[],center:[],right:[]},this.Es={},this.pr={};for(let i of["left","center","right"]){let o=f("div",`mach-pane mach-pane--${i} mach-header-pane`),s=f("div","mach-header-rows");if(i==="center"){let a=f("div","mach-header-viewport");a.appendChild(s),o.appendChild(a)}else o.appendChild(s);this.ui.appendChild(o),this.Es[i]=o,this.pr[i]=s}this.Zl(1),this.De=f("div","mach-body"),this.En=f("div","mach-pinned-rows mach-pinned-rows--top"),this.En.style.display="none",this.Dn=f("div","mach-pinned-rows mach-pinned-rows--bottom"),this.Dn.style.display="none",this.M={},this.Re={},this.Ds={};for(let i of["left","center","right"]){let o=f("div",`mach-pane mach-pane--${i} mach-body-pane`),s=f("div",`mach-body-viewport${i==="center"?" mach-body-viewport--scroll":""}`),a=f("div","mach-row-container");s.appendChild(a),o.appendChild(s),this.De.appendChild(o),this.Ds[i]=o,this.M[i]=s,this.Re[i]=a}this.Ze=f("div","mach-overlay"),this.Ze.style.display="none",this.Ze.setAttribute("role","status"),this.Ze.setAttribute("aria-live","polite"),this.Qe=f("div","mach-overlay-content"),this.Ze.appendChild(this.Qe),this.Dt=f("div","mach-infinite-loading"),this.Dt.style.display="none",this.Dt.appendChild(f("div","mach-spinner")),this.xn=f("span"),this.Dt.appendChild(this.xn),this.root.append(this.ui,this.En,this.De,this.Dn,this.Ze,this.Dt),e.appendChild(this.root),typeof ResizeObserver<"u"&&(this.Sn=new ResizeObserver(i=>{let o=i[i.length-1]?.contentRect;if(!o)return;let s=Math.round(o.width),a=Math.round(o.height);s===this.Xl&&a===this.Jl||(this.Xl=s,this.Jl=a,!this.Cr&&(this.Cr=requestAnimationFrame(()=>{this.Cr=0,this.e.Te()})))}),this.Sn.observe(this.root)),this._l(t.theme)}zl(e){e.ariaLabelledBy?(this.root.setAttribute("aria-labelledby",e.ariaLabelledBy),this.root.removeAttribute("aria-label")):(this.root.removeAttribute("aria-labelledby"),this.root.setAttribute("aria-label",e.ariaLabel)),e.ariaDescribedBy?this.root.setAttribute("aria-describedby",e.ariaDescribedBy):this.root.removeAttribute("aria-describedby")}Zl(e){this.Zt=e;for(let t of["left","center","right"]){let r=this.pr[t],i=this.hi[t];for(;i.length<e;){let o=f("div","mach-header-row");o.setAttribute("role","row"),o.setAttribute("aria-rowindex",String(i.length+1)),o.style.top=`${i.length*this.e.r.headerHeight}px`,o.style.height=`${this.e.r.headerHeight}px`,r.appendChild(o),i.push(o)}for(;i.length>e;)i.pop().remove()}this.Ql()}Ms(){return this.Zt}Ql(){this.ui.style.height=`${this.Zt*this.e.r.headerHeight}px`;for(let e of["left","center","right"])this.hi[e].forEach((r,i)=>{r.style.top=`${i*this.e.r.headerHeight}px`,r.style.height=`${this.e.r.headerHeight}px`})}Pp(e,t){this.ed("left",e),this.ed("right",t)}ed(e,t){let r=this.Es[e],i=this.Ds[e];r.style.width=`${t}px`,i.style.width=`${t}px`;let o=t<=0;r.classList.toggle("mach-pane--hidden",o),i.classList.toggle("mach-pane--hidden",o)}bs(){let e=this.M.center,t=Math.max(0,e.offsetWidth-e.clientWidth);return Math.max(0,this.De.clientWidth-t)}Mp(e,t){this.root.style.setProperty("--mach-row-h",`${e}px`),this.root.style.setProperty("--mach-header-h",`${t}px`),this.Ql()}gp(e){for(let t of _s)this.root.classList.toggle(`mach-size--${t}`,t===e)}_l(e){if(!this.root)return;this.Tr?.(),this.Tr=null;let t=e==="dark"||e==="auto"&&this.kp();if(this.root.classList.toggle("mach-theme-dark",t),e==="auto"&&typeof window<"u"&&typeof window.matchMedia=="function"){let r=window.matchMedia("(prefers-color-scheme: dark)"),i=()=>this.root.classList.toggle("mach-theme-dark",r.matches);typeof r.addEventListener=="function"?(r.addEventListener("change",i),this.Tr=()=>r.removeEventListener("change",i)):typeof r.addListener=="function"&&(r.addListener(i),this.Tr=()=>r.removeListener(i))}}kp(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-color-scheme: dark)").matches}pp(e){this.root.classList.toggle("mach-striped",e)}fp(e){this.root.classList.toggle("mach-cell-borders",e)}ap(e){this.root.classList.toggle("mach-dom-layout--auto-height",e==="autoHeight")}Wl(e){for(let t of this.Ss)this.root.classList.remove(t);this.Ss=[];for(let t of String(e??"").split(/\s+/).filter(Boolean))this.root.classList.contains(t)||(this.root.classList.add(t),this.Ss.push(t))}Gp(e){try{return typeof e=="function"?e():e}catch(t){return this.e.reportError(t,"overlayTemplate"),""}}Np(e,t,r){if(typeof t=="object"&&t!=null&&"el"in t){this.Qe.appendChild(t.el),this.Rn=t.destroy??null;return}if(t instanceof HTMLElement){this.Qe.appendChild(t);return}if(t){r?this.Qe.innerHTML=t:this.Qe.textContent=t;return}if(e!=="loading")return;let i=f("div","mach-spinner");i.setAttribute("aria-label","loading"),this.Qe.appendChild(i)}Tn(e,t,r=!1){this.pi===e&&this.xs===t&&this.Rs===r||(this.pi=e,this.xs=t,this.Rs=r,this.Is(),this.Qe.replaceChildren(),this.Np(e,this.Gp(t),r),this.Ze.style.display="",this.root.classList.add("mach-has-overlay"),this.Ze.setAttribute("role",e==="error"?"alert":"status"),this.root.setAttribute("aria-busy",e==="loading"?"true":"false"))}Ul(){this.pi&&(this.pi=null,this.xs=null,this.Rs=!1,this.Ze.style.display="none",this.root.classList.remove("mach-has-overlay"),this.Is(),this.Qe.replaceChildren(),this.root.setAttribute("aria-busy","false"))}kt(e,t){this.Dt&&(e?(this.xn.textContent!==t&&(this.xn.textContent=t),this.Dt.style.display="",this.root.setAttribute("aria-busy","true")):(this.Dt.style.display="none",this.pi!=="loading"&&this.root.setAttribute("aria-busy","false")))}destroy(){this.Tr?.(),this.Tr=null,this.Sn?.disconnect(),this.Sn=null,this.Cr&&cancelAnimationFrame(this.Cr),this.Cr=0,this.Is(),this.root?.remove()}Is(){if(!this.Rn)return;let e=this.Rn;this.Rn=null;try{e()}catch(t){this.e.reportError(t,"overlayTemplate.destroy")}}};var zs={contains:"\u5305\u542B",notContains:"\u4E0D\u5305\u542B",equals:"=",notEquals:"\u2260",startsWith:"\u5F00\u5934",endsWith:"\u7ED3\u5C3E",blank:"\u4E3A\u7A7A",notBlank:"\u975E\u7A7A",lessThan:"<",lessThanOrEqual:"\u2264",greaterThan:">",greaterThanOrEqual:"\u2265",inRange:"\u8303\u56F4"};function Nt(n){if(!n)return"";if(n.type==="set")return`\u5DF2\u9009 ${n.values.length} \u9879`;let e=[];for(let r of n.conditions){let i=zs[r.match]??r.match,o=r.value,s="value2"in r?r.value2:void 0;r.match==="blank"||r.match==="notBlank"?e.push(i):r.match==="inRange"&&o!=null?e.push(`${i} ${o}~${s??o}`):o!=null&&String(o)!==""?e.push(`${i} ${o}`):e.push(i)}let t=n.operator==="or"?" \u6216 ":" \u4E14 ";return e.join(t)}function Cn(n,e){let t=0,r=n.length;for(;t<r;){let i=t+r>>1;n[i]<=e?t=i+1:r=i}return t}function Ws(n,e){let t=0,r=n.length;for(;t<r;){let i=t+r>>1;n[i]<e?t=i+1:r=i}return t}var ge=class{constructor(){this.ye=new Float64Array(1)}update(e){let t=0,r=this.ye.length!==e.length+1;for(let o=0;o<e.length;o++)t+=e[o].currentWidth,!r&&this.ye[o+1]!==t&&(r=!0);if(!r)return!1;let i=new Float64Array(e.length+1);for(let o=0;o<e.length;o++)i[o+1]=i[o]+e[o].currentWidth;return this.ye=i,!0}td(){return this.ye[this.ye.length-1]??0}xt(e){let t=Math.max(0,Math.min(Math.trunc(e),this.ye.length-1));return this.ye[t]??0}Op(e){let t=Math.max(0,this.ye.length-1);return t===0?-1:Math.min(t-1,Math.max(0,Cn(this.ye,Math.max(0,e))-1))}rd(e,t,r=2){let i=Math.max(0,this.ye.length-1);if(i===0||t<=0||this.td()<=t)return{first:0,lastExcl:i};let o=Math.max(0,e),s=o+t,a=Math.max(0,Cn(this.ye,o)-1),l=Math.min(i,Ws(this.ye,s));return{first:Math.max(0,a-r),lastExcl:Math.min(i,l+r)}}};var $s=".mach-header-resize, .mach-filter-btn, .mach-menu-btn, .mach-select-all";function kr(n){return n instanceof HTMLElement&&n.closest($s)!=null}function Gr(n){return n==="ArrowLeft"||n==="ArrowRight"}var Ot=class{constructor(e){this.e=e;this.oe=[];this.Mn=[];this.nd={left:[],center:[],right:[]};this.N=new ge;this.In=0;this.An=Number.MAX_SAFE_INTEGER}li(){this.od(),this.e.ci.Ot();for(let l of this.oe){let d=pr(l.el);if(d)try{d()}catch(c){this.e.reportError(c,"headerComponent.destroy",{colId:l.column.id})}}this.oe=[],this.Mn=[];let e=this.e.n.fc();this.e.o.Zl(e);let t=l=>l.pinned==="left"?"left":l.pinned==="right"?"right":"center",r=(l,d,c)=>{let u=[];for(let h of l)if(h instanceof te){let p=r(h.children,d+1,c);p.length>0&&u.push({group:h,level:d,children:p})}else!h.hide&&t(h)===c&&u.push({column:h,level:d,children:[]});return u},i=this.e.n.pc(),o=this.e.n.T("center"),s=new Set(o.slice(this.In,this.An));for(let l of["left","center","right"]){let d=r(i,0,l);this.nd[l]=l==="center"?this.sd(d,s):d}let a=this.e.r.headerHeight;for(let l of["left","center","right"]){let d=this.e.o.hi[l];for(let u of d)u.textContent="";let c=u=>{let h=d[Math.min(u.level,d.length-1)];if(u.column){let p=this.Fp(u.column,e-u.level,a);h.appendChild(p.el),this.oe.push(p)}else if(u.group){let p=this.Hp(u.group);h.appendChild(p),this.Mn.push({group:u.group,el:p})}for(let p of u.children)c(p)};for(let u of this.nd[l])c(u)}this.e.r.suppressHeaderFocus||this.oe.forEach((l,d)=>{l.el.tabIndex=d===0?0:-1}),this.et(),this.Ts(),this.mn(),this.zi()}ad(){let e=this.In,t=this.An;this.od(),(e!==this.In||t!==this.An)&&this.li()}od(){let e=this.e.n.T("center"),t=this.e.o.M.center;this.N.update(e);let r=e.length>20?this.N.rd(t.scrollLeft,t.clientWidth,2):{first:0,lastExcl:e.length};this.In=r.first,this.An=r.lastExcl}sd(e,t){let r=[];for(let i of e){if(i.column){t.has(i.column)&&r.push(i);continue}let o=this.sd(i.children,t);o.length>0&&r.push({...i,children:o})}return r}Fp(e,t,r){let i=f("div","mach-header-cell mach-header-cell--leaf");e.hasCheckbox&&i.classList.add("mach-header-cell--selection"),i.dataset.colId=e.id,i.setAttribute("role","columnheader"),i.style.height=`${t*r}px`,this.Vp(i,e),this.Bp(i,e);let o=this._p(i,e);this.zp(i,e);let s=f("span","mach-sort-indicator");i.appendChild(s);let{filterBtn:a,filterTagEl:l}=this.Wp(i,e);return this.$p(i,e),this.Kp(i,e),this.Up(i,e),{column:e,el:i,sortEl:s,filterBtn:a,filterTagEl:l,selectAllEl:o}}Vp(e,t){let r=t.colDef;typeof r.headerClass=="string"?e.classList.add(r.headerClass):Array.isArray(r.headerClass)&&e.classList.add(...r.headerClass),r.headerTooltip&&e.setAttribute("title",r.headerTooltip);let i=r.headerAlign??r.align;i==="center"?e.classList.add("mach-header-cell--center"):i==="right"&&e.classList.add("mach-header-cell--right")}Bp(e,t){this.e.r.suppressHeaderFocus||(e.tabIndex=-1,e.addEventListener("mousedown",()=>this.As(t)),e.addEventListener("keydown",r=>this.jp(r,t)))}_p(e,t){if(!t.hasCheckbox||this.e.r.rowSelection!=="multiple")return;let r=document.createElement("input");return r.type="checkbox",r.className="mach-select-all",r.setAttribute("aria-label","select all rows"),r.addEventListener("click",i=>i.stopPropagation()),r.addEventListener("change",()=>{r.checked?this.e.g.selectAll(!0):this.e.g.deselectAll()}),e.appendChild(r),r}zp(e,t){let r=t.colDef,i=r.headerComponent,o;if(!i){this.Ls(e,r.headerName??r.field??t.id);return}try{o=i({colDef:r,column:t,api:this.e.api})}catch(s){this.e.reportError(s,"headerComponent",{colId:t.id}),o=null}this.qp(e,t,o)}qp(e,t,r){if(typeof r=="string"){this.Ls(e,r);return}if(r instanceof HTMLElement){this.ld(e,r);return}if(r&&typeof r=="object"&&r.el instanceof HTMLElement){this.ld(e,r.el),ai(e,r.destroy);return}let i=t.colDef;this.Ls(e,i.headerName??i.field??t.id)}Ls(e,t){let r=f("span","mach-header-label");r.textContent=t,e.appendChild(r)}ld(e,t){let r=f("span","mach-header-label mach-header-label--custom");r.appendChild(t),e.appendChild(r)}Wp(e,t){if(!t.filterable)return{};let r=document.createElement("button");r.type="button",r.className="mach-filter-btn",r.setAttribute("aria-label",`filter ${t.id}`),r.innerHTML=ui,r.addEventListener("click",o=>{o.stopPropagation(),this.e.Ps.toggle(t,r)}),e.appendChild(r);let i=f("span","mach-filter-tag");return e.appendChild(i),{filterBtn:r,filterTagEl:i}}$p(e,t){if(!this.e.r.columnMenu||t.hasCheckbox||t.colDef.suppressColumnMenu)return;let r=document.createElement("button");r.type="button",r.className="mach-menu-btn";let o=`${t.colDef.headerName??t.colDef.field??t.id} \xB7 ${this.e.y("columnSettings")}`;r.setAttribute("aria-label",o),r.title=o,r.innerHTML=fi,r.addEventListener("click",s=>{s.stopPropagation(),this.e.columnMenu.toggle(t,r)}),e.appendChild(r)}Kp(e,t){if(!this.dd(t))return;let r=f("div","mach-header-resize");r.setAttribute("aria-hidden","true"),r.addEventListener("pointerdown",i=>{i.button===0&&(i.preventDefault(),i.stopPropagation(),this.e.ci.pu(i,t))}),r.addEventListener("dblclick",i=>{i.stopPropagation(),this.e.api.columns.autoSize(t.id)}),r.addEventListener("click",i=>i.stopPropagation()),e.appendChild(r)}Up(e,t){e.addEventListener("click",r=>{this.e.Ln.vu()||kr(r.target)||t.sortable&&this.e.Ii(t,r.shiftKey)}),e.addEventListener("pointerdown",r=>{r.button!==0||kr(r.target)||this.e.Ln.yu(r,t)})}Hp(e){let t=f("div","mach-header-cell mach-header-cell--group");e.groupId&&(t.dataset.groupId=e.groupId),t.setAttribute("role","columnheader");let r=e.def;typeof r.headerClass=="string"?t.classList.add(r.headerClass):Array.isArray(r.headerClass)&&t.classList.add(...r.headerClass);let i=f("span","mach-header-label mach-header-label--group");return i.textContent=e.headerName,t.appendChild(i),t}et(){let e={left:0,center:0,right:0};for(let t of["left","center","right"]){let r=this.e.o.hi[t],i=0,o=new Map;for(let a of this.e.n.T(t))o.set(a.id,i),i+=a.currentWidth;let s=this.e.r.headerHeight;for(let a of this.oe){if(this.e.n.er(a.column)!==t)continue;let l=o.get(a.column.id)??0;a.el.style.width=`${a.column.currentWidth}px`,a.el.style.left=`${l}px`,a.el.setAttribute("aria-colindex",String(this.e.n.ze(a.column.id)+1))}for(let a of this.Mn){let l=this.Yp(a.group,t);if(l.length===0)continue;let d=o.get(l[0].id)??0,c=0;for(let u of l)c+=u.currentWidth;a.el.style.left=`${d}px`,a.el.style.width=`${c}px`,a.el.style.height=`${s}px`,a.el.setAttribute("aria-colspan",String(l.length))}for(let a of r)a.style.width=`${i}px`;e[t]=i}this.e.o.Pp(e.left,e.right)}Yp(e,t){return e.getLeafColumns().filter(r=>!r.hide&&this.e.n.er(r)===t)}jp(e,t){this.e.s()||this.Xp(e,t)||this.Jp(e,t)||this.Zp(e,t)||this.Qp(e,t)||this.ef(e)}Xp(e,t){return e.key!=="Enter"&&e.key!==" "?!1:(kr(e.target)||(e.preventDefault(),t.sortable&&this.e.Ii(t,e.shiftKey)),!0)}Jp(e,t){if(!e.altKey||!Gr(e.key))return!1;if(!this.dd(t))return!0;let r=e.key==="ArrowRight"?24:-24;return this.e.n.Se(t,t.currentWidth+r),this.e.qe(),this.e.ur([t]),e.preventDefault(),!0}Zp(e,t){if(!e.ctrlKey||!Gr(e.key))return!1;if(!t.movable)return!0;e.preventDefault();let r=this.e.n.er(t),i=this.e.n.T(r),o=i.indexOf(t),s=e.key==="ArrowRight"?1:-1,a=Math.max(0,Math.min(i.length-1,o+s));return a!==o&&this.e.At(t.id,a),!0}Qp(e,t){if(e.altKey||e.ctrlKey||e.metaKey||!Gr(e.key))return!1;e.preventDefault();let r=this.e.n.c(),i=r.indexOf(t);if(i<0)return!0;let o=e.key==="ArrowRight"?1:-1,s=Math.max(0,Math.min(r.length-1,i+o));return this.As(r[s]),!0}ef(e){if(e.key!=="Home"&&e.key!=="End")return!1;e.preventDefault();let t=this.e.n.c();if(t.length===0)return!0;let r=e.key==="Home"?0:t.length-1;return this.As(t[r]),!0}As(e){let t=this.oe.find(r=>r.column.id===e.id);if(!t&&!e.pinned&&(this.tf(e),this.ad(),t=this.oe.find(r=>r.column.id===e.id)),!!t){for(let r of this.oe)r.el.tabIndex=r===t?0:-1;t.el.focus({preventScroll:!0})}}tf(e){let t=this.e.n.T("center"),r=t.indexOf(e);if(r<0)return;let i=this.e.o.M.center;this.N.update(t);let o=this.N.xt(r),s=o+e.currentWidth;o<i.scrollLeft?i.scrollLeft=o:s>i.scrollLeft+i.clientWidth&&(i.scrollLeft=s-i.clientWidth)}dd(e){return this.e.r.enableColumnResize&&e.resizable}Ts(){let e=this.e.n.J(),t=e.length>1;for(let r of this.oe){let i=e.findIndex(o=>o.colId===r.column.id);if(i>=0){let o=e[i].direction,s=t?`<span class="mach-sort-badge">${i+1}</span>`:"";r.sortEl.innerHTML=(o==="asc"?hi:pi)+s,r.el.setAttribute("aria-sort",o==="asc"?"ascending":"descending"),r.el.classList.add("mach-header-cell--sorted")}else r.sortEl.innerHTML="",r.el.removeAttribute("aria-sort"),r.el.classList.remove("mach-header-cell--sorted")}}mn(){let e=this.e.i.Q();for(let t of this.oe){if(!t.filterBtn)continue;let r=e[t.column.id],i=r!=null;if(t.filterBtn.classList.toggle("mach-filter-btn--active",i),t.filterTagEl){let o=i?Nt(r):"";t.filterTagEl.style.display=o?"":"none",o&&(t.filterTagEl.textContent=o)}}}zi(){for(let e of this.oe)e.selectAllEl&&(e.selectAllEl.checked=this.e.g.su(),e.selectAllEl.indeterminate=this.e.g.au())}destroy(){for(let e of this.oe){let t=pr(e.el);if(t)try{t()}catch(r){console.error("[mach-table] headerComponent destroy error",r)}}this.oe=[],this.Mn=[]}};var Ft=class{constructor(){this.ve=null;this.tt=null;this.Er=!1;this.ks=-1;this.Gs=-1}rf(){return this.ve}Dr(){return this.tt}nf(){return this.ve!=null}start(e,t){(!t||!this.ve)&&(this.ve={...e}),this.tt={...e},this.tr()}of(e){return this.ve?!0:e.colIdx<0?!1:(this.ve={...e},this.tr(),!0)}setEnd(e){this.tt={...e},this.tr()}clear(){this.ve=null,this.tt=null,this.tr()}tr(){this.Er=!1,this.ks=-1,this.Gs=-1}normalize(e,t){return this.Er!==!1&&this.ks===e&&this.Gs===t?this.Er:(this.ks=e,this.Gs=t,!this.ve||!this.tt||e<=0||t<=0?(this.Er=null,null):(this.Er={r1:Math.max(0,Math.min(this.ve.row,this.tt.row,e-1)),r2:Math.max(0,Math.min(Math.max(this.ve.row,this.tt.row),e-1)),c1:Math.max(0,Math.min(this.ve.colIdx,this.tt.colIdx,t-1)),c2:Math.max(0,Math.min(Math.max(this.ve.colIdx,this.tt.colIdx),t-1))},this.Er))}};var Ht=class{constructor(e){this.host=e;this.Ne=null;this.de=0;this.Pn=0;this.gt=e=>{let t=this.Ne;if(!(!t||e.pointerId!==t.pointerId)){if(t.clientX=e.clientX,t.clientY=e.clientY,!t.active){if(Math.abs(e.clientY-t.startY)<5)return;t.active=!0,this.host.root.classList.add("mach-root--row-dragging"),this.host.root.querySelectorAll(".mach-row").forEach(r=>r.classList.toggle("mach-row--drag-source",this.sourceContains(r.dataset.id??"")))}this.ud()}};this.lf=()=>{if(this.de=0,!!this.Ne?.active){if(!this.current()){this.destroy();return}this.Jr(),this.df()&&this.ud()}};this.Pe=e=>{let t=this.Ne;if(!(!t||e.pointerId!==t.pointerId)){t.clientX=e.clientX,t.clientY=e.clientY,t.active&&this.current()&&this.Jr(),this.hd();try{t.active&&t.drop?.valid&&this.Ns(e.clientX,e.clientY)&&this.current()&&this.commitDrop(t.drop)}finally{this.release()}}};this.cd=e=>{e.key==="Escape"&&(e.preventDefault(),this.destroy())};this.Ft=e=>{e.type==="pointercancel"&&e.pointerId!==this.Ne?.pointerId||this.destroy()}}begin(e){let t=this.host.containers.map(i=>{let o=f("div","mach-row-drop-indicator");return o.hidden=!0,i.append(o),o}),r=f("div","mach-row-drag-preview");r.setAttribute("role","status"),r.hidden=!0,this.host.root.append(r),this.Ne={startY:e.clientY,clientX:e.clientX,clientY:e.clientY,pointerId:e.pointerId,indicators:t,preview:r,drop:null,active:!1},window.addEventListener("pointermove",this.gt),window.addEventListener("pointerup",this.Pe),window.addEventListener("pointercancel",this.Ft),window.addEventListener("keydown",this.cd),window.addEventListener("blur",this.Ft)}sf(e){return this.Ne?.active===!0&&this.sourceContains(e)}af(e,t=()=>!0){this.Pn=requestAnimationFrame(()=>{this.Pn=0,t()&&[...this.host.root.querySelectorAll(".mach-row-drag-handle")].find(r=>r.closest(".mach-row")?.dataset.id===e)?.focus()})}ud(){this.de||(this.de=requestAnimationFrame(this.lf))}Ns(e,t,r=0){let i=this.host.body.getBoundingClientRect();return e>=i.left&&e<=i.right&&t>=i.top-r&&t<=i.bottom+r}df(){let e=this.Ne;if(!e||!this.Ns(e.clientX,e.clientY,28))return!1;let t=this.host.viewport,r=t.getBoundingClientRect(),i=Math.min(36,r.height/3);if(i<=0)return!1;let o=e.clientY<r.top+i?-Math.ceil(14*C((r.top+i-e.clientY)/i,0,1)):Math.ceil(14*C((e.clientY-r.bottom+i)/i,0,1));if(this.host.scrollBy)return this.host.scrollBy(o);let s=t.scrollTop;return t.scrollTop=C(s+o,0,Math.max(0,t.scrollHeight-t.clientHeight)),t.scrollTop!==s}Jr(){let e=this.Ne;if(!e?.active)return;let t=e.clientY-this.host.viewport.getBoundingClientRect().top+this.host.viewport.scrollTop,r=this.describe(t);e.drop=r;let i=this.Ns(e.clientX,e.clientY);for(let s of e.indicators){if(s.hidden=!i||!r?.valid,!r)continue;s.dataset.dropPosition=r.position??"",s.style.cssText=r.style??"";let a=parseFloat(s.parentElement.style.height),l=Math.min(this.host.getRowTop(r.boundary),Number.isFinite(a)?Math.max(0,a-2):1/0);s.style.transform=`translate3d(0, ${l}px, 0)`}let o=this.host.root.getBoundingClientRect();e.preview.hidden=!1,e.preview.textContent=i?r?.text??this.outsideText():this.outsideText(),e.preview.style.transform=`translate3d(${C(e.clientX-o.left+16,8,Math.max(8,o.width-224))}px, ${C(e.clientY-o.top+16,8,Math.max(8,o.height-48))}px, 0)`}hd(){let e=this.Ne;this.Ne=null,window.removeEventListener("pointermove",this.gt),window.removeEventListener("pointerup",this.Pe),window.removeEventListener("pointercancel",this.Ft),window.removeEventListener("keydown",this.cd),window.removeEventListener("blur",this.Ft),cancelAnimationFrame(this.de),this.de=0,this.host.root?.classList.remove("mach-root--row-dragging"),this.host.root?.querySelectorAll(".mach-row--drag-source").forEach(t=>t.classList.remove("mach-row--drag-source")),e?.indicators.forEach(t=>t.remove()),e?.preview.remove()}destroy(){this.hd(),this.release(),cancelAnimationFrame(this.Pn),this.Pn=0}};function Tn(n,e,t,r,i){let o=r==="before"?-1:1,s=t.rowIndex+o,a=e(s);for(;a&&(a===n||a.isDetail);)s+=o,a=e(s);let l=a&&!a.loading?a.id:null;return{rowIds:[n.id],targetId:t.id,position:r,beforeId:r==="before"?l:t.id,afterId:r==="before"?t.id:l,expectedRevision:i}}var Vt=class extends Ht{constructor(t,r,i,o){super({get root(){return t.o.root},get body(){return t.o.De},get viewport(){return t.o.M.center},get containers(){return Object.values(t.o.Re)},getRowTop:r,findRowAt:i,scrollBy:o});this.e=t;this.zt=null}fd(t){return!t.loading&&!t.treeLoading&&!t.isGroup}md(t){if(this.e.l.isEditing()||t.isDetail||!this.fd(t)||t.data==null||this.e.n.nt().length||this.e.r.applyRowDrag&&!this.e.i.qa())return!1;let r=this.xr("canDrag",()=>this.e.r.rowDragPolicy?.canDrag?.({node:t,api:this.e.api})??!0,!1);return r!==!0?r:!this.e.i.F||!!Rr(this.e.api)}canDrag(t){return this.md(t)===!0}isSource(t){return this.Os()?.isSource(t)??this.sf(t.id)}start(t,r){if(this.destroy(),!this.canDrag(r)||t.isPrimary===!1)return;let i=this.Os();if(i){i.start(t,r);return}let o=this.xr("getRevision",()=>this.Fs(r),null);o&&(this.zt={node:r,from:r.rowIndex,guard:o},this.begin(t))}moveWithKeyboard(t,r){if(!t.altKey||t.key!=="ArrowUp"&&t.key!=="ArrowDown"||(t.preventDefault(),t.stopPropagation(),!this.canDrag(r)))return;let i=this.Os();if(i){i.moveWithKeyboard(t,r);return}let o=t.key==="ArrowUp"?-1:1,s=r.rowIndex+o;for(;this.e.i.m(s)?.isDetail;)s+=o;let a=this.e.i.m(s),l=this.xr("getRevision",()=>this.Fs(r),null);if(!(!a||!l)){this.zt={node:r,from:r.rowIndex,guard:l};try{this.commitDrop(this.destination(a,o>0))&&this.af(r.id)}finally{this.release()}}}xr(t,r,i){try{return r()}catch(o){return this.e.reportError(o,`rowDragPolicy.${t}`),i}}Fs(t){let r=this.e.i,i=this.e.n.te(),o=this.e.r.rowDragPolicy,s=r.zr(),a=r.fo(),l=this.e.r.applyRowDrag,d=o?.getRevision?.();return{revision:d,current:()=>this.xr("getRevision",()=>o?.getRevision?.()===d&&s===r.zr()&&a===r.fo()&&r.K(t.id)===t&&i===this.e.n.te()&&o===this.e.r.rowDragPolicy&&l===this.e.r.applyRowDrag,!1)}}Os(){let t=Rr(this.e.api);return t!==this.pd&&(this.kn?.destroy(),this.pd=t,this.kn=t?this.xr("driver",()=>t({...this.host,api:this.e.api,capture:r=>this.Fs(r),emit:(r,i,o,s,a)=>{this.e.emit("rowDragEnd",{rowNode:r,fromIndex:i,toIndex:o,targetIndex:s,applied:!1,intent:a})},report:(r,i)=>this.e.reportError(r,`rowDragPolicy.${i}`)}),void 0):void 0),this.kn}current(){return this.zt?.guard.current()??!1}release(){this.zt=null}sourceContains(t){return this.zt?.node.id===t}outsideText(){return this.e.r.locale.rowDragOutside??T.rowDragOutside}describe(t){let r=C(this.host.findRowAt(t),0,this.e.i.A()-1),i=this.e.i.m(r);if(i?.isDetail&&(i=this.e.i.K(i.masterId)),!i)return null;let o=this.host.getRowTop(i.rowIndex),s=this.host.getRowTop(i.rowIndex+1);return this.destination(i,t>=(o+s)/2)}destination(t,r){let i=this.zt,o=t.rowIndex+Number(r);for(;this.e.i.m(o)?.isDetail;)o++;let s=this.e.r.rowDragPolicy,a=!this.e.r.applyRowDrag||s?.canDrop?Tn(i.node,u=>this.e.i.m(u),t,r?"after":"before",i.guard.revision):void 0,l=s?.canDrop&&a?this.xr("canDrop",()=>s.canDrop({node:i.node,api:this.e.api,targetNode:t,intent:a}),!1):!0,d=l===!0&&this.fd(t),c=typeof l=="string"?l:fe(this.e.r.locale.rowDragPosition??T.rowDragPosition,i.from+1,this.gd(i.from,o)+1);return{node:t,intent:a,boundary:o,valid:d,text:c,position:r?"after":"before"}}commitDrop(t){let r=this.zt;if(!r||!this.current()||!this.canDrag(r.node)||!this.current())return!1;let i=this.destination(t.node,t.boundary>t.node.rowIndex);if(!i.valid||!this.current())return!1;let o=i.boundary>r.from?i.boundary-1:i.boundary;for(;this.e.i.m(o)?.isDetail;)o--;if(r.from===o)return!1;let s=this.e.r.applyRowDrag&&this.e.i.Ya(r.from,o);return this.e.r.applyRowDrag&&!s?!1:(this.e.emit("rowDragEnd",{rowNode:r.node,fromIndex:r.from,toIndex:i.boundary,targetIndex:s?r.node.rowIndex:this.gd(r.from,i.boundary),applied:s,intent:i.intent}),!0)}gd(t,r){let i=t+1;for(;this.e.i.m(i)?.isDetail;)i++;return r>t?r-(i-t):r}destroy(){this.kn?.destroy(),super.destroy()}};var Ks=new Set(["warning","danger","success","info"]);function Ne(n,e,t=null){if(!(e.data==null||e.isGroup||e.isDetail||e.loading))for(let r of n.r.rowStyleRules)try{if(r.when({data:e.data,node:e,api:n.api,rowPinned:t})===!0)return r}catch(i){n.reportError(i,"rowStyleRules",{rowId:e.id})}}function ye(n,e){n.style.removeProperty("--mach-row-rule-bg"),n.style.removeProperty("--mach-row-rule-fg"),e?.tone&&Ks.has(e.tone)?n.dataset.rowTone=e.tone:delete n.dataset.rowTone,e?.backgroundColor&&n.style.setProperty("--mach-row-rule-bg",e.backgroundColor),e?.color&&n.style.setProperty("--mach-row-rule-fg",e.color),n.classList.toggle("mach-row--styled",!!e)}var Bt=class{constructor(){this.se=new Float64Array(0);this.Rr=new Float64Array(1);this.Hs=new WeakMap;this.Wt=new Map;this.Rt=0}reset(e,t){this.se=new Float64Array(e.length),this.Rr=new Float64Array(e.length+1),this.Hs=new WeakMap,this.Wt=new Map,this.Rt=0;for(let r=0;r<e.length;r++){this.Hs.set(e[r],r);let i=Math.max(1,t(e[r],r));this.se[r]=i,this.Vs(i,1),this.add(r,i)}}get length(){return this.se.length}indexOf(e){return this.Hs.get(e)??-1}update(e,t){if(e<0||e>=this.se.length)return!1;let r=Math.max(1,t),i=r-this.se[e];return Math.abs(i)<.01?!1:(this.Vs(this.se[e],-1),this.se[e]=r,this.Vs(r,1),this.add(e,i),!0)}xt(e){let t=Math.max(0,Math.min(Math.trunc(e),this.se.length)),r=0;for(;t>0;)r+=this.Rr[t],t-=t&-t;return r}Bs(){return this.xt(this.se.length)}cf(){return this.Rt}findIndex(e){if(this.se.length===0)return 0;let t=Math.max(0,e),r=0,i=0,o=1;for(;o<<1<=this.se.length;)o<<=1;for(;o>0;){let s=r+o;s<=this.se.length&&i+this.Rr[s]<=t&&(r=s,i+=this.Rr[s]),o>>=1}return Math.min(r,this.se.length-1)}add(e,t){for(let r=e+1;r<this.Rr.length;r+=r&-r)this.Rr[r]+=t}Vs(e,t){let r=(this.Wt.get(e)??0)+t;if(r<=0?this.Wt.delete(e):this.Wt.set(e,r),this.Wt.size===0)this.Rt=0;else if(t>0&&(this.Rt===0||e<this.Rt))this.Rt=e;else if(t<0&&e===this.Rt&&!this.Wt.has(e)){let i=Number.POSITIVE_INFINITY;for(let o of this.Wt.keys())i=Math.min(i,o);this.Rt=Number.isFinite(i)?i:0}}};var Us=16e6,_t=class{constructor(){this.height=0;this.$t=0;this.Sr=0;this.Gn=NaN;this._s=0}configure(e,t,r=!0){this.height=r?Math.min(e,Us):e,this.$t=Math.max(0,e-t),this.Sr=Math.max(0,this.height-t),this.Gn=NaN}get St(){return this.$t>this.Sr}uf(e){return this.$t?C(e,0,this.$t)*this.Sr/this.$t:0}read(e){return e!==this.Gn&&(this.Gn=e,this._s=this.Sr>0?C(e,0,this.Sr)*this.$t/this.Sr:0),this._s}anchor(e,t){this._s=C(e,0,this.$t),this.Gn=t}};var k=["left","center","right"];function En(n){return!!n&&!n.hasCheckbox&&!n.isDetailToggle&&!n.colDef.rowDrag}function Dn(n){let e=n.length>1&&n.every(i=>typeof i=="number"&&!Number.isNaN(i)),t=e?(n[n.length-1]-n[0])/(n.length-1):0,r=!e||n.every(i=>Number.isInteger(i));return{difference:t,integer:r,numeric:e,values:n}}function xn(n,e){let t=n.values.length;if(t===1)return n.values[0];if(!n.numeric)return n.values[e%t];let r=n.values[t-1]+n.difference*(e-t+1);return n.integer?Math.round(r):Math.round(r*1e6)/1e6}var zt=class{constructor(e){this.e=e;this.O=[];this.Oe=0;this.rt=0;this.Fe=-1;this.ne=0;this.zs=0;this.Ws=0;this.yd=0;this.I=new _t;this.Mt=0;this.$s=!1;this.Nn=-1;this.Y=new Bt;this.N=new ge;this.V=new Ft;this.On=!1;this.Ks=0;this.Us=Number.MAX_SAFE_INTEGER;this.E=null;this.js=()=>{this.ne||(this.ne=requestAnimationFrame(()=>{this.ne=0,this.yn()}))};this._n=0;this.zn=new WeakMap;this.Ut=new Set;this.Wn="";this.fi=[];this.Xs=null;this.Ys=e=>{if(e.defaultPrevented||e.ctrlKey||e.metaKey||e.shiftKey||!e.deltaY||!e.cancelable)return;let t=this.e.o.M.center,r=e.deltaMode===1?this.e.r.rowHeight:e.deltaMode===2?t.clientHeight:1,i=this.I.read(t.scrollTop);this.$n(i+e.deltaY*r),this.I.read(t.scrollTop)!==i&&(e.preventDefault(),t.scrollLeft+=e.deltaX*r,this.js())};this.Vn=null;this.gi=null;this.na=!1;this.pf=null;this.jn=e=>{let t=this.gi;if(!t)return;let r=e;if(typeof r.clientX!="number")return;if(!t.active){let s=Math.abs(r.clientX-t.startX),a=Math.abs(r.clientY-t.startY);if(s<4&&a<4)return;t.active=!0,t.axis=s>=a?"h":"v",this.e.o.root.classList.add("mach-root--filling")}if(t.axis==="v"){let s=this._d(r),a=this.V.Dr();a&&a.row!==s&&(this.V.setEnd({row:s,colIdx:a.colIdx}),this.qt(),this.e.emit("rangeSelectionChanged",{range:this.Xe()}));return}let i=Math.max(t.c2+1,this.zd(r)),o=this.V.Dr();o&&o.colIdx!==i&&(this.V.setEnd({row:o.row,colIdx:i}),this.qt(),this.it(),this.e.emit("rangeSelectionChanged",{range:this.Xe()}))};this.Ir=e=>{let t=this.gi;if(!t)return;let r=e,i=()=>{this.qs()};if(!t.active){i();return}if(t.axis==="h"){let s=typeof r.clientX=="number"?Math.max(t.c2+1,this.zd(r)):t.c2+1;if(i(),s>t.c2)this.om(t.r1,t.r2,t.c1,t.c2,s),this.it();else{let a=this.V.Dr();if(!a||a.colIdx===t.c2)return;this.V.setEnd({row:a.row,colIdx:t.c2}),this.qt()}return}let o=typeof r.clientY=="number"?this._d(r):t.r2;if(i(),o>t.r2)this.am(t.r1,t.r2,t.c1,t.c2,o),this.it();else{let s=this.V.Dr();if(!s||s.row===t.r2)return;this.V.setEnd({row:t.r2,colIdx:s.colIdx}),this.qt()}};this.vd=e=>{if(this.e.s())return;let t=e.target,r=this.Yt(e);if(r&&!t.closest(".mach-cell-editor-shell, .mach-row-editor-shell, .mach-row-drag-handle")&&!(e.detail>1&&this.e.l.en())){if(this.e.l.en()){let i=r.cellEl?.dataset.colId??"";if(this.e.l.isEditing(r.index,i))return;this.e.l.he(!1).then(o=>{if(!o||this.e.s())return;this.Kd(e,t,r);let s=i?this.e.n.P(i):void 0;s&&!this.e.l.en()&&this.e.l.q(r.node,s)&&this.e.l.start(r.index,s)});return}this.Kd(e,t,r)}};this.bd=e=>{if(this.e.s()||e.target.closest(".mach-cell-editor-shell, .mach-row-editor-shell"))return;let t=this.Yt(e);if(!t)return;let{node:r,index:i,cellEl:o}=t;if(r.isDetail||r.isGroup||!o)return;let s=o.dataset.colId??"",a=this.e.n.P(s);if(!a)return;let l=this.e.d(r,a),d=this.e.emit("cellDoubleClicked",{event:e,rowNode:r,rowIndex:i,column:a,colDef:a.colDef,value:l});a.colDef.onCellDoubleClick?.(d),this.e.emit("rowDoubleClicked",{event:e,rowNode:r,rowIndex:i}),this.e.l.q(r,a)&&this.e.l.start(i,a)};this.wd=e=>{if(this.e.s())return;let t=this.Yt(e);if(!t||t.node.isDetail||t.node.isGroup||!t.cellEl)return;let{node:r,index:i,cellEl:o}=t,s=o.dataset.colId??"",a=this.e.n.P(s);if(a&&(this.e.emit("cellContextMenu",{event:e,rowNode:r,rowIndex:i,column:a,colDef:a.colDef,value:this.e.d(r,a)}),this.e.r.contextMenu)){if(e.preventDefault(),this.e.r.enableRangeSelection&&!this.ke()){let l=this.e.n.ze(s);l>=0&&this.ia(i,l,!1)}this.e.oa.open(e.clientX,e.clientY,{rowIndex:i,colId:s})}};this.Cd=e=>{if(!this.bm(e)&&this.e.r.enableRangeSelection&&e.button===0){let t=this.Yt(e);if(t&&!t.node.isDetail&&!t.node.isGroup&&t.cellEl&&!t.cellEl.classList.contains("mach-cell--selection")){let r=this.e.n.ze(t.cellEl.dataset.colId??"");r>=0&&(this.ia(t.index,r,e.shiftKey),this.On=!0,!e.shiftKey&&!this.e.r.suppressCellFocus&&this.Ge(t.index,t.cellEl.dataset.colId??""))}}};this.xd=()=>{this.On=!1};this.oi=e=>{if(this.e.s())return;let t=this.Yt(e);if(this.On&&t&&!t.node.isDetail&&!t.node.isGroup&&t.cellEl){let r=this.e.n.ze(t.cellEl.dataset.colId??""),i=this.V.Dr();r>=0&&i&&(i.row!==t.index||i.colIdx!==r)&&this.ia(t.index,r,!0)}this.e.r.suppressRowHoverHighlight||!t||t.node.isDetail||this.Wd(t.index)};this.Td=()=>{this.Wd(-1)};this.Ed=e=>{if(this.e.s()||e.button!==0||!e.target.closest(".mach-row-drag-handle"))return;let r=this.Yt(e);!r||r.node.isDetail||r.node.isGroup||(this.Kt.start(e,r.node),e.preventDefault())};this.Dd=e=>{if(!e.target.closest(".mach-row-drag-handle"))return;let t=this.Yt(e);t&&this.Kt.moveWithKeyboard(e,t.node)};this.Kt=new Vt(e,t=>this.He(t)-this.Mt,t=>this.Fn(t+this.Mt,this.e.i.A()),t=>this.hf(t))}init(){let e=this.e.o.M.center;this.zs=e.scrollLeft,this.Ws=e.scrollTop,e.addEventListener("scroll",this.js,{passive:!0});let t=this.e.o.De;t.addEventListener("click",this.vd),t.addEventListener("dblclick",this.bd),t.addEventListener("contextmenu",this.wd),t.addEventListener("mousedown",this.Cd),t.addEventListener("mouseover",this.oi),t.addEventListener("mouseleave",this.Td),t.addEventListener("pointerdown",this.Ed),t.addEventListener("keydown",this.Dd),window.addEventListener("mouseup",this.xd)}suspend(){cancelAnimationFrame(this.ne),this.ne=0,this.qs(),this.Kt.destroy(),this.On=!1}destroy(){cancelAnimationFrame(this.ne);let e=this.e.o.M.center;e.removeEventListener("scroll",this.js),e.removeEventListener("wheel",this.Ys);let t=this.e.o.De;t.removeEventListener("click",this.vd),t.removeEventListener("dblclick",this.bd),t.removeEventListener("contextmenu",this.wd),t.removeEventListener("mousedown",this.Cd),t.removeEventListener("mouseover",this.oi),t.removeEventListener("mouseleave",this.Td),t.removeEventListener("pointerdown",this.Ed),t.removeEventListener("keydown",this.Dd),window.removeEventListener("mouseup",this.xd),this.qs(),this.Kt.destroy();for(let r of this.O){r.detailRow&&this.Hn(r.detailRow);for(let i of k)for(let o of r.cells[i]??[])r.index>=0&&this.e.l.Jo(r.index,o.dataset.colId??"",o),M(this.e,o)}this.Vn?.remove(),this.pf?.remove(),this.O=[],this.Oe=0,this.fi=[],this.Ut.clear(),this.Y.reset([],()=>this.e.r.rowHeight),this.N.update([]),this.Xs=null}_o(e){return e.pinned==="left"?"left":e.pinned==="right"?"right":"center"}yn(e=!1){if(this.e.s())return;let t=this.e.o,r=t.M.center,i=r.scrollLeft,o=r.scrollTop,s=this.I.read(o),a=e||i!==this.zs,l=e||o!==this.Ws||s!==this.yd;!a&&!l||(this.zs=i,this.Ws=o,this.yd=s,a&&(t.pr.center.style.transform=`translate3d(${-i}px, 0, 0)`,this.e.W.ad(),this.e.me.ff(i)),l&&this.Rd(o),this.e.Bn.hide(),this.di(!1,a),l&&this.e.i.Sc(this.Fe-1))}mf(){let e={left:0,center:0,right:0};for(let t of k)e[t]=this.e.n.T(t).reduce((r,i)=>r+i.currentWidth,0);return e}vn(){let e=this.e.o,t=this.mf();this.N.update(this.e.n.T("center")),t.center=this.N.td();let r=this.e.i.pt(),i=this.gf(r.length);this.yf(r,i);let o=this.vf(i);this.bf(t,o),this.wf(o),e.root.setAttribute("aria-rowcount",String(i.rowCount+e.Ms()))}gf(e){let t=this.e.i.nr(),r=this.e.r.rowHeight,i=this.e.r.masterDetail?[]:this.Cf(),o=this.e.r.datasourceMode!=="block"&&(this.e.r.masterDetail||this.e.r.getRowHeight!=null||i.length>0),s=o?this.Tf(r,i):`fixed|${r}`;return{autoHeightColumns:i,positionedCount:Math.min(t,e),rowCount:t,rowHeight:r,signature:s,variable:o}}Tf(e,t){let r=t.map(i=>`${i.id}:${i.currentWidth}`).join(",");return`${this.e.i.fo()}|${e}|${this.e.r.detailRowHeight}|${r}`}yf(e,t){if(!t.variable){this.Ef(t);return}if(t.signature!==this.Wn||this.Y.length!==t.positionedCount){let r=e.slice(0,t.positionedCount);this.Y.reset(r,i=>this.Sd(i,t.autoHeightColumns)),this.Md(t);return}if(this.Ut.size!==0){for(let r of this.Ut){let i=this.Y.indexOf(r);i>=0&&this.Y.update(i,this.Sd(r,t.autoHeightColumns))}this.Md(t)}}Ef(e){this.Y.length>0&&this.Y.reset([],()=>e.rowHeight),this.Wn=e.signature,this.Ut.clear(),this._n=e.rowHeight}Md(e){this.Wn=e.signature,this.Ut.clear(),this._n=this.Y.cf()||e.rowHeight}vf(e){return(e.variable?this.Y.Bs():e.positionedCount*e.rowHeight)+Math.max(0,e.rowCount-e.positionedCount)*e.rowHeight}bf(e,t){let r=this.e.o,i=r.M.center,o=this.I.read(i.scrollTop),s=this.I.St;this.I.configure(t,i.clientHeight,this.e.r.domLayout!=="autoHeight");let a=Math.max(0,i.clientWidth-e.left-e.right),l=Math.max(e.center,a);for(let d of k){let c=r.Re[d];c.style.height=`${this.I.height}px`,c.style.overflow=this.I.St?"hidden":"",d==="center"&&(c.style.width=`${l}px`)}(s||this.I.St)&&this.$n(o),this.Rd(i.scrollTop),this.$s!==this.I.St&&(this.$s=this.I.St,this.$s?i.addEventListener("wheel",this.Ys,{passive:!1}):i.removeEventListener("wheel",this.Ys))}$n(e){let t=this.e.o.M.center;t.scrollTop=this.I.uf(e),this.I.anchor(e,t.scrollTop)}Rd(e){let t=this.I.St;for(let r of["left","right"]){let i=this.e.o.Re[r].style;i.top=t?`${-e}px`:"",i.transform=t?"":`translate3d(0, ${-e}px, 0)`}}hf(e){let t=this.e.o.M.center,r=this.I.read(t.scrollTop);this.$n(r+e);let i=this.I.read(t.scrollTop)!==r;return i&&this.yn(),i}Wi(e){this.zn.delete(e),this.Ut.add(e)}wf(e){this.e.o.De.style.height=this.e.r.domLayout==="autoHeight"?`${e}px`:""}bn(){this.zn=new WeakMap,this.Ut.clear(),this.Wn=""}Sd(e,t){if(e.isDetail)return this.e.r.detailRowHeight;let r=this.zn.get(e);if(r!==void 0)return r;let i=this.e.r.rowHeight,o=this.e.r.getRowHeight;if(o)try{let s=o({data:e.data,node:e,api:this.e.api});i=Number.isFinite(s)?Math.max(1,s||i):i}catch(s){this.e.reportError(s,"getRowHeight",{rowId:e.id})}return t.length>0&&(i=Math.max(i,this.Df(e,t))),this.zn.set(e,i),i}He(e){let t=this.Y.length;return t===0?Math.max(0,e)*this.e.r.rowHeight:e<=t?this.Y.xt(e):this.Y.Bs()+(e-t)*this.e.r.rowHeight}Fn(e,t){if(t<=0)return 0;let r=this.Y.length,i=this.Y.Bs();if(r>0&&e<i)return this.Y.findIndex(e);let o=r+Math.floor(Math.max(0,e-i)/this.e.r.rowHeight);return Math.max(0,Math.min(o,t-1))}Cf(){return this.e.n.c().filter(e=>e.colDef.autoHeight===!0)}get xf(){return this.e.n.c().some(e=>e.colDef.autoHeight===!0)}Df(e,t){var d;this[d="Xs"]??(this[d]=document.createElement("canvas"));let r=this.Xs.getContext("2d");if(!r)return 0;let i=window.getComputedStyle(this.e.o.root),o=parseFloat(i.fontSize)||13;r.font=`${i.fontStyle} ${i.fontWeight} ${o}px ${i.fontFamily}`;let s=parseFloat(i.getPropertyValue("--mach-cell-padding"))||9,a=Math.round(o*1.45),l=1;for(let c of t){let u=ee(this.e,e,c);if(!u)continue;let h=Math.max(10,c.currentWidth-s*2-2),p=1,m=0;for(let y of u){let v=r.measureText(y).width;if(m>0&&m+v>h?(p++,m=v):m+=v,p>=12)break}p>l&&(l=p)}return l*a+Math.round(s*.9)}Sl(e,t){if(this.e.r.flashCells)for(let r of e)for(let i of t)this.fi.push([r,i])}Id(){if(this.fi.length===0)return;let e=this.fi;this.fi=[];for(let[t,r]of e){let i=this.rn(t,r);if(!i)continue;i.classList.remove("mach-cell--flash"),i.offsetWidth,i.classList.add("mach-cell--flash");let o=xe(i),s=o.flashTimer;s&&clearTimeout(s),o.flashTimer=window.setTimeout(()=>{i.classList.remove("mach-cell--flash"),o.flashTimer=void 0},800)}}Te(){this.vn();let e=this.e.o.M.center,r=this.e.r.rowHeight;this.e.r.masterDetail&&(r=Math.min(r,this.e.r.detailRowHeight)),this._n>0&&(r=Math.min(r,this._n));let i=Math.ceil(e.clientHeight/Math.max(1,r)),o=this.e.r.domLayout==="autoHeight"?this.e.i.A():i+this.e.r.rowBuffer*2+1,s=o%2===0?o:o+1;if(this.Ad())for(let l of this.O)this.Js(l,"center");s>this.Oe&&this.Rf(s),this.Zs(),this.di(!0,!1),this.Qs()}Rf(e){for(;this.Oe<e;){let t={index:-1,nodeId:"",kind:"master",rows:{},cells:{},cellColIds:{}},r=this.e.o;for(let i of k){if(this.e.n.T(i).length===0)continue;let s=f("div","mach-row");s.style.height=`${this.e.r.rowHeight}px`,s.setAttribute("role","row"),s.style.display="none",r.Re[i].appendChild(s),t.rows[i]=s,t.cells[i]=[],t.cellColIds[i]=[],this.Js(t,i)}if(this.e.r.masterDetail){let i=f("div","mach-row mach-detail-row");i.style.height=`${this.e.r.detailRowHeight}px`,i.setAttribute("role","row"),i.style.display="none",r.Re.center.appendChild(i),t.detailRow=i}this.O.push(t),this.Oe++}}Mr(e){let t=this.e.n.T(e);return e!=="center"||t.length<=20||this.e.n.no()?t:t.slice(this.Ks,this.Us)}Sf(e){let t=f("div","mach-cell");if(t.dataset.colId=e.id,t.setAttribute("role","gridcell"),e.hasCheckbox){let r=document.createElement("input");r.type=this.e.r.rowSelection==="single"?"radio":"checkbox",r.className="mach-row-checkbox",r.type==="radio"&&(r.name=`mach-radio-${this.e.gridId}`),r.setAttribute("aria-label","select row"),t.appendChild(r),t.classList.add("mach-cell--selection")}return t}Js(e,t){let r=e.rows[t];if(!r)return;let i=this.Mr(t),o=e.cells[t]??[],s=e.cellColIds[t]??[];if(s.length===i.length&&s.every((c,u)=>c===i[u].id))return;let a=new Map;s.forEach((c,u)=>a.set(c,o[u]));let l=[],d=[];for(let c of i){let u=a.get(c.id)??this.Sf(c);a.delete(c.id),r.appendChild(u),l.push(u),d.push(c.id)}for(let c of a.values())e.index>=0&&this.e.l.Jo(e.index,c.dataset.colId??"",c),M(this.e,c),c.remove();e.cells[t]=l,e.cellColIds[t]=d}ws(){this.mi=void 0,this.Ld();for(let e of this.O){e.detailRow&&this.Hn(e.detailRow);for(let t of k){for(let r of e.cells[t]??[])M(this.e,r);e.rows[t]?.remove()}e.detailRow?.remove()}this.O=[],this.Oe=0,this.rt=0,this.Fe=-1,this.Te()}Zs(){let e=this.Mf();for(let t of k){let r=this.e.n.T(t),i=this.Mr(t),o=this.If(t,i,r);this.Af(t,i,o,e)}this.Lf()}Mf(){return this.e.r.masterDetail||this.e.r.getRowHeight!=null||this.xf}If(e,t,r){let i=0;e==="center"&&t.length>0&&(this.N.update(r),i=this.N.xt(r.indexOf(t[0])));let o=[];for(let s of t)o.push(i),i+=s.currentWidth;return o}Af(e,t,r,i){for(let o of this.O){let s=o.cells[e],a=o.rows[e];if(!s||!a)continue;i||(a.style.height=`${this.e.r.rowHeight}px`);let l=Math.min(t.length,s.length);for(let d=0;d<l;d++){let c=t[d];s[d].style.width=`${c.currentWidth}px`,s[d].style.left=`${r[d]}px`,s[d].setAttribute("aria-colindex",String(this.e.n.ze(c.id)+1))}}}Lf(){if(!this.e.r.masterDetail)return;let e=`${this.e.r.detailRowHeight}px`;for(let t of this.O)t.detailRow?.style.setProperty("--mach-detail-h",e)}Ad(){let e=this.e.o.M.center,t=this.e.n.T("center"),r=this.Ks,i=this.Us;this.N.update(t);let o=t.length>20?this.N.rd(e.scrollLeft,e.clientWidth,2):{first:0,lastExcl:t.length};return this.Ks=o.first,this.Us=o.lastExcl,o.first!==r||o.lastExcl!==i}go(){return{first:this.rt,lastExcl:this.Fe}}di(e=!1,t=!0){let r=this.e.le.start();if(!this.Pf(e,t))return;let i=Math.max(0,this.Fe-this.rt),o=this.e.n.T("left").length+this.Mr("center").length+this.e.n.T("right").length;this.e.le.mh(r,i,o)}Pf(e,t){let r=this.e.o.M.center,i=this.I.read(r.scrollTop)-r.scrollTop,o=i!==this.Mt;this.Mt=i;let s=this.e.i.A(),a=this.e.r.rowBuffer,l=t?this.Ad():!1;if(this.kf(l),s===0){for(let u of this.O)this.ea(u);return this.rt=0,this.Fe=0,!0}if(this.Gf(s,e,l))return!0;let{first:d,lastExcl:c}=this.Nf(r,s,a);return!e&&!l&&d===this.rt&&c===this.Fe?(o&&(this.Pd(),this.it()),l||o):(this.rt=d,this.Fe=c,this.Of(d,c),this.kd(d,c,e,l),o&&this.Pd(),this.it(),!0)}Nf(e,t,r){let i=this.I.read(e.scrollTop),o=this.Fn(i,t),s=i+e.clientHeight,a=Math.min(t,this.Fn(s,t)+1);return{first:C(o-r,0,t-1),lastExcl:C(a+r,1,t)}}Of(e,t){for(let r of this.O)r.index!==-1&&(r.index<e||r.index>=t)&&this.ea(r)}kd(e,t,r,i){for(let o=e;o<t;o++){let s=this.e.i.m(o),a=this.O[o%this.Oe];if(!(!a||!s)){if(!r&&a.index===o&&a.nodeId===s.id){i&&a.kind==="master"&&this.Kn(a,s,"center");continue}this.Ff(a,o)}}}kf(e){if(e){for(let t of this.O)this.Js(t,"center");this.Zs()}}Gf(e,t,r){return this.e.r.domLayout!=="autoHeight"?!1:(!t&&!r&&this.rt===0&&this.Fe===e||(this.rt=0,this.Fe=e,this.kd(0,e,t,r)),!0)}ea(e){this.Gd(e),this.E?.rowIndex===e.index&&this.e.o.root.removeAttribute("aria-activedescendant"),e.index=-1,e.nodeId="",e.kind="master";for(let t of k){let r=e.rows[t];r&&(r.style.display="none",delete r.dataset.id,delete r.dataset.index,ye(r,void 0),r.classList.remove("mach-row--drag-source"))}e.detailRow&&(this.Hn(e.detailRow),e.detailRow.style.display="none")}Ff(e,t){e.index>=0&&e.index!==t&&this.Gd(e);let r=this.e.i.m(t);if(!r){this.ea(e);return}e.index=t,e.nodeId=r.id;let i=this.He(t),o=i-this.Mt,s=this.He(t+1)-i;if(r.isDetail){this.Hf(e,r,t,o,s);return}this.Vf(e,r,t,o,s)}Pd(){for(let e of this.O){if(e.index<this.rt||e.index>=this.Fe)continue;let t=`translateY(${this.He(e.index)-this.Mt}px)`;for(let r of Object.values(e.rows))r.style.transform=t;e.detailRow&&(e.detailRow.style.transform=t)}}Hf(e,t,r,i,o){e.kind="detail";for(let a of k){let l=e.rows[a];l&&(l.style.display="none")}let s=e.detailRow;s&&(s.style.display="",s.style.transform=`translateY(${i}px)`,s.style.height=`${o}px`,s.dataset.index=String(r),s.setAttribute("aria-rowindex",String(r+this.e.o.Ms()+1)),this.ta(s,t))}Vf(e,t,r,i,o){e.kind="master",e.detailRow&&(e.detailRow.style.display="none");let s=this.Bf(t),a=Ne(this.e,t);for(let l of k){let d=e.rows[l];d&&(this._f(d,t,r,i,o,s),ye(d,a),this.Kn(e,t,l))}this.E&&this.E.rowIndex===r&&this.Un()}Bf(e){let t=this.e.i.F,r=e.isGroup===!0,i=t&&this.e.i.Co(e.id),o=r||i||this.e.r.masterDetail&&this.e.i.isRowExpandable(e),s=r?this.e.i.isGroupExpanded(e.id):this.e.i.isRowExpanded(e.id),a=null;return r?a=(e.groupLevel??0)+1:t&&(a=this.e.i.To(e)+1),{expanded:s,expandable:o,level:a}}_f(e,t,r,i,o,s){e.style.display="",e.style.transform=`translateY(${i}px)`,e.style.height=`${o}px`,e.dataset.index=String(r),e.dataset.id=t.id,e.setAttribute("aria-rowindex",String(r+this.e.o.Ms()+1)),this.Nd(e,t);let a=this.Nn===r&&!this.e.r.suppressRowHoverHighlight;e.classList.toggle("mach-row--hover",a),e.classList.toggle("mach-row--odd",r%2===1),e.classList.toggle("mach-row--drag-source",this.Kt.isSource(t)),this.zf(e,s)}Nd(e,t){e.classList.toggle("mach-row--selected",t.selected),e.setAttribute("aria-selected",t.selected?"true":"false")}zf(e,t){t.expandable?e.setAttribute("aria-expanded",t.expanded?"true":"false"):e.removeAttribute("aria-expanded"),t.level!=null?e.setAttribute("aria-level",String(t.level)):e.removeAttribute("aria-level")}Kn(e,t,r){let i=this.Mr(r),o=e.cells[r];if(!o)return;let s=e.index,a=r==="center"&&this.e.n.no(),l=0;e.rows[r]?.classList.toggle("mach-row--editing",this.e.l.tn(s));for(let d=0;d<i.length;d++){let c=i[d],u=o[d];if(a&&l>0){l--,M(this.e,u),u.setAttribute("aria-hidden","true"),u.style.display!=="none"&&(u.style.display="none");continue}if(u.style.display==="none"&&(u.style.display=""),u.removeAttribute("aria-hidden"),a){let h=this.Wf(t,c,s,i.length-d);h>1?(l=h-1,this.$f(u,i,d,h)):(u.removeAttribute("aria-colspan"),u.style.width!==`${c.currentWidth}px`&&(u.style.width=`${c.currentWidth}px`))}else u.removeAttribute("aria-colspan");this.e.l.yl(s,t,c,u)||(this.Od(u,t,c),this.ra(u,s,c))}}Wf(e,t,r,i){let o=t.colDef.colSpan;if(!o)return 1;try{let s=o({api:this.e.api,colDef:t.colDef,column:t,node:e,data:e.data,value:this.e.d(e,t),rowIndex:r});return Math.max(1,Math.min(Math.round(s)||1,i))}catch(s){return this.e.reportError(s,"colSpan",{colId:t.id,rowId:e.id}),1}}$f(e,t,r,i){let o=0;for(let s=r;s<r+i&&s<t.length;s++)o+=t[s].currentWidth;e.style.width=`${o}px`,e.setAttribute("aria-colspan",String(i))}ta(e,t){this.Hn(e);let r=t.masterId!=null?this.e.i.K(t.masterId):t,i=f("div","mach-detail");e.appendChild(i);let o=this.e.r.detailRowRenderer;if(o){let s={data:t.data,node:r??t,api:this.e.api},a;try{a=o(s)}catch(l){this.e.reportError(l,"detailRowRenderer",{rowId:t.id}),a=null}typeof a=="string"?i.textContent=a:a instanceof HTMLElement?i.appendChild(a):a&&typeof a=="object"&&a.el instanceof HTMLElement&&(i.appendChild(a.el),oi(e,a.destroy))}}Hn(e){let t=si(e);if(t)try{t()}catch(r){this.e.reportError(r,"detailRowRenderer.destroy")}e.textContent=""}Od(e,t,r){if(t.loading){M(this.e,e),e.className="mach-cell mach-cell--loading",e.setAttribute("aria-readonly","true"),e.setAttribute("aria-busy","true");let o=f("span","mach-cell-loading-bar");o.style.width=`${34+(r.id.length*13+t.rowIndex*7)%44}%`,e.replaceChildren(o),this.jt(e);return}e.removeAttribute("aria-busy"),e.setAttribute("aria-readonly",this.e.l.q(t,r)?"false":"true"),e.removeAttribute("aria-expanded"),e.removeAttribute("aria-level");let i=this.Kf(t,r);if(i!=="standard"){M(this.e,e),this.Uf(i,e,t,r);return}Ke(this.e,e,t,r),Re(this.e,e,t,r),$e(this.e,e,t,r),this.Fd(e,t,r),this.jf(e,t,r)}Kf(e,t){return e.isGroup?"group":t.isDetailToggle?"detail":t.hasCheckbox?"checkbox":t.colDef.rowDrag?"drag":he(t.colDef,"index")?"index":this.e.i.F&&this.Hd()?.id===t.id?"tree":"standard"}Uf(e,t,r,i){if(e==="group")this.qf(t,r,i);else if(e==="detail"){let o=this.e.i.isRowExpanded(r.id),s=f("span",`mach-detail-toggle${o?" mach-detail-toggle--open":""}`);s.textContent="\u25B6",t.replaceChildren(s),t.classList.add("mach-cell--detail-toggle"),this.jt(t)}else if(e==="checkbox"){let o=t.querySelector(".mach-row-checkbox");o&&(o.checked=r.selected,o.indeterminate=this.e.g.Qc(r.id),o.disabled=!this.e.g.Ue(r)),t.className!=="mach-cell mach-cell--selection"&&(t.className="mach-cell mach-cell--selection"),this.jt(t)}else if(e==="drag")this.Yf(t,r),t.className!=="mach-cell mach-cell--drag"&&(t.className="mach-cell mach-cell--drag"),this.jt(t);else if(e==="index"){t.textContent=String(this.e.i.ja(r)+this.e.r.indexOffset);let s=`mach-cell mach-cell--index${i.colDef.align==="right"?" mach-cell--right":i.colDef.align==="center"?" mach-cell--center":""}`;t.className!==s&&(t.className=s),this.Fd(t,r,i)}else this.Xf(t,r,i)}jf(e,t,r){if(this.e.r.editType!=="cell"||this.e.r.editableIndicator==="none"||!this.e.l.q(t,r))return;let i=document.createElement("button");i.type="button",i.className=`mach-cell-edit-trigger mach-cell-edit-trigger--${this.e.r.editableIndicator}`,i.tabIndex=-1,i.title="Edit cell",i.setAttribute("aria-label","Edit cell"),i.innerHTML='<svg viewBox="0 0 16 16" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m10.8 2.7 2.5 2.5L5.5 13H3v-2.5z"/><path d="m9.5 4 2.5 2.5"/></svg>',i.addEventListener("mousedown",o=>{o.preventDefault(),o.stopPropagation()}),i.addEventListener("click",o=>{o.preventDefault(),o.stopPropagation(),this.Ge(t.rowIndex,r.id),this.e.l.start(t.rowIndex,r)}),e.appendChild(i)}Gd(e){if(!(e.index<0))for(let t of k)for(let r of e.cells[t]??[])this.e.l.Jo(e.index,r.dataset.colId??"",r)}Hd(){return this.mi!==void 0?this.mi:(this.mi=this.e.n.c().find(e=>!e.hasCheckbox&&!e.isDetailToggle&&!e.colDef.rowDrag&&!he(e.colDef,"index"))??null,this.mi)}Xf(e,t,r){let i=this.e.i.isRowExpandable(t),o=this.e.i.To(t),s=U(this.e,t,r,this.e.d(t,r)),a=f("span","mach-tree-indent");a.style.width=`${o*16}px`;let l=f("span","mach-tree-cell");if(o>0&&l.appendChild(a),i){let c=this.e.i.isRowExpanded(t.id);e.setAttribute("aria-expanded",c?"true":"false"),e.setAttribute("aria-level",String(o+1));let u=t.treeLoading?" mach-detail-toggle--loading":t.treeLoadError?" mach-detail-toggle--error":"",h=document.createElement("button");h.type="button",h.tabIndex=-1,h.className="mach-tree-toggle",h.setAttribute("aria-label",t.treeLoadError?"Retry loading children":c?"Collapse row":"Expand row"),h.setAttribute("aria-expanded",String(c)),t.treeLoadError&&(h.title="Retry loading children");let p=f("span",`mach-detail-toggle${c?" mach-detail-toggle--open":""}${u}`);p.setAttribute("aria-hidden","true"),p.textContent="\u25B6",h.appendChild(p),h.addEventListener("keydown",m=>{(m.key==="Enter"||m.key===" ")&&m.stopPropagation()}),l.appendChild(h)}else{let c=f("span","mach-tree-toggle-spacer");l.appendChild(c)}let d=f("span","mach-tree-text");d.textContent=s,l.appendChild(d),e.replaceChildren(l),s&&!this.e.r.tooltipComponent?e.title=s:e.removeAttribute("title"),Re(this.e,e,t,r)}jt(e){e.style.height!==""&&(e.style.height=""),e.style.zIndex!==""&&(e.style.zIndex=""),e.style.display==="none"&&(e.style.display=""),e.removeAttribute("aria-rowspan")}Fd(e,t,r){let i=this.e.i.qc(r.id);if(!i||t.isDetail){this.jt(e);return}let o=this.e.i.ja(t)-1;if(o<0||o>=i.length){this.jt(e);return}let s=i[o];if(s===-1){e.style.display="none",e.setAttribute("aria-hidden","true");return}if(e.style.display==="none"&&(e.style.display=""),e.removeAttribute("aria-hidden"),s>1){let a=Math.min(o+s,this.e.i.A()),l=this.He(a)-this.He(o);e.style.height=`${l>0?l:s*this.e.r.rowHeight}px`,e.style.zIndex="1",e.setAttribute("aria-rowspan",String(s))}else this.jt(e)}qf(e,t,r){if(r.hasCheckbox){this.Jf(e,t);return}if(r.isDetailToggle){this.Vd(e);return}let i=this.e.n.ba();if(i&&r.id===i.id){this.Zf(e,t);return}this.Qf(e,t,r)||this.Vd(e)}Jf(e,t){let r=e.querySelector(".mach-row-checkbox");if(r){let i=this.e.g.Ja(t);r.checked=i.all,r.indeterminate=i.some&&!i.all}e.className!=="mach-cell mach-cell--selection"&&(e.className="mach-cell mach-cell--selection")}Zf(e,t){let r=this.e.i.isGroupExpanded(t.id),i=t.groupLevel??0;e.setAttribute("aria-expanded",r?"true":"false"),e.setAttribute("aria-level",String(i+1));let o=f("span","mach-group-label");o.style.paddingLeft=`${i*16}px`;let s=f("span",`mach-detail-toggle${r?" mach-detail-toggle--open":""}`);s.textContent="\u25B6";let a=f("span","mach-group-text"),l=this.e.n.nt()[i],d=l?.colDef.headerName?`${l.colDef.headerName}: `:"";a.textContent=`${d}${t.groupKey??""}`;let c=f("span","mach-group-count");c.textContent=`(${t.leafNodes?.length??0})`,o.append(s,a,c),e.replaceChildren(o),e.className!=="mach-cell mach-cell--group"&&(e.className="mach-cell mach-cell--group")}Qf(e,t,r){if(!r.colDef.aggFunc||!t.aggValues||!Object.prototype.hasOwnProperty.call(t.aggValues,r.id))return!1;let i=t.aggValues[r.id];return e.textContent=r.colDef.valueFormatter!=null?U(this.e,t,r,i):fr(i),e.className!=="mach-cell mach-cell--num"&&(e.className="mach-cell mach-cell--num"),!0}Vd(e){e.textContent="",e.className!=="mach-cell"&&(e.className="mach-cell")}ft(e){if(this.e.s())return;let t=new Set;for(let r of e){if(r<0||t.has(r))continue;t.add(r);let i=this.O[r%this.Oe];if(!i||i.index!==r)continue;let o=this.e.i.m(r);if(o){if(i.kind==="detail"){i.detailRow&&this.ta(i.detailRow,o);continue}for(let s of k){let a=i.rows[s];a&&this.Nd(a,o),i.cells[s]&&this.Kn(i,o,s)}}}this.Un(),this.Id()}refreshCells(e={}){if(this.e.s())return;let t=e.rowIds==null?null:new Set(e.rowIds),r=e.rowIndexes==null?null:new Set(e.rowIndexes),i=e.columns==null?null:new Set(e.columns);for(let o of this.O){let s=this.e.i.m(o.index);!s||!this.em(o,s,t,r)||this.tm(o,s,i,e.force===!0)}this.Un(),this.Id()}em(e,t,r,i){return e.index<0?!1:r==null&&i==null?!0:r?.has(t.id)===!0||i?.has(e.index)===!0}tm(e,t,r,i){if(e.kind==="detail"){r==null&&e.detailRow&&this.ta(e.detailRow,t);return}let o=r==null||this.e.n.no(),s=Ne(this.e,t);for(let a of k){let l=e.rows[a];l&&ye(l,s),o?this.Kn(e,t,a):this.rm(e,t,a,r,i)}}rm(e,t,r,i,o){let s=this.Mr(r),a=e.cells[r];if(a)for(let l=0;l<s.length;l++){let d=s[l];if(!i.has(d.id))continue;let c=a[l];c&&(this.e.l.yl(e.index,t,d,c)||(o&&M(this.e,c),this.Od(c,t,d),this.ra(c,e.index,d)))}}im(){this.e.s()||(this.E&&this.E.rowIndex>=this.e.i.A()&&this.Ge(null,null),this.Ld(),this.vn(),this.di(!0),this.it(),this.Qs(),this.e.ce.refresh())}Qs(){let e=this.e.r;if(e.loading){let t=e.overlayLoadingTemplate||this.e.jl();this.e.o.Tn("loading",t,e.allowUnsafeOverlayHtml);return}if(e.error!=null){let t=e.overlayErrorTemplate||this.e.Yl();this.e.o.Tn("error",t,e.allowUnsafeOverlayHtml);return}if(this.e.i.A()===0&&!e.suppressNoRowsOverlay){let t=e.overlayNoRowsTemplate||this.e.ql();this.e.o.Tn("noRows",t,e.allowUnsafeOverlayHtml);return}this.e.o.Ul()}rn(e,t){let r=this.e.n.P(t);if(!r)return null;let i=this._o(r),o=this.O[e%Math.max(1,this.Oe)]?.cellColIds[i]?.indexOf(r.id)??-1;if(o<0)return null;let s=this.O[e%this.Oe];return!s||s.index!==e||s.kind!=="master"?null:s.cells[i]?.[o]??null}Ld(){this.V.tr()}ke(){let e=this.e.i.A(),t=this.e.n.c().length;return this.V.normalize(e,t)}Qr(){let e=this.ke();if(e)return e;let t=this.E;if(t){let r=this.e.n.ze(t.colId);if(r>=0)return{r1:t.rowIndex,c1:r,r2:t.rowIndex,c2:r}}return null}Xe(){let e=this.ke();if(!e)return null;let t=this.e.n.c();return{row1:e.r1,row2:e.r2,colId1:t[e.c1]?.id??"",colId2:t[e.c2]?.id??""}}Ko(){let e=this.V.rf();if(e)return{row:e.row,colIdx:e.colIdx};let t=this.Qr();return t?{row:t.r1,colIdx:t.c1}:null}fr(){let e=this.ke();this.V.clear(),e&&(this.qt(),this.it(),this.e.emit("rangeSelectionChanged",{range:null}))}qt(){for(let e of this.O)if(!(e.index<0||e.kind!=="master"))for(let t of k){let r=this.Mr(t);e.cells[t]?.forEach((i,o)=>{let s=r[o];s&&this.ra(i,e.index,s)})}}ia(e,t,r){this.V.start({row:e,colIdx:t},r),this.qt(),this.it(),this.e.emit("rangeSelectionChanged",{range:this.Xe()})}Iu(e,t){if(!this.V.nf()){let a=this.E;if(!a)return;let l=this.e.n.ze(a.colId);if(!this.V.of({row:a.rowIndex,colIdx:l}))return}let r=this.e.i.A(),i=this.e.n.c().length;this.V.setEnd({row:Math.max(0,Math.min(e,r-1)),colIdx:Math.max(0,Math.min(t,i-1))}),this.qt(),this.it();let o=this.e.n.c(),s=this.V.Dr();s&&s.colIdx<o.length&&this.Ge(s.row,o[s.colIdx].id),this.e.emit("rangeSelectionChanged",{range:this.Xe()})}ra(e,t,r){let i=this.ke();if(!i){e.classList.contains("mach-cell--range")&&e.classList.remove("mach-cell--range","mach-cell--range-top","mach-cell--range-bottom","mach-cell--range-left","mach-cell--range-right");return}let o=this.e.n.ze(r.id);if(o<0)return;let s=t>=i.r1&&t<=i.r2&&o>=i.c1&&o<=i.c2;e.classList.toggle("mach-cell--range",s),s?(e.classList.toggle("mach-cell--range-top",t===i.r1),e.classList.toggle("mach-cell--range-bottom",t===i.r2),e.classList.toggle("mach-cell--range-left",o===i.c1),e.classList.toggle("mach-cell--range-right",o===i.c2)):e.classList.remove("mach-cell--range-top","mach-cell--range-bottom","mach-cell--range-left","mach-cell--range-right")}nm(){if(this.Vn)return this.Vn;let e=f("div","mach-fill-handle");return e.style.display="none",e.addEventListener("pointerdown",t=>{this.na=!0,this.Bd(t)}),e.addEventListener("mousedown",t=>{this.na||this.Bd(t)}),this.e.o.Re.center.appendChild(e),this.Vn=e,e}it(){let e=this.nm(),t=this.ke();if(!this.e.r.enableRangeSelection||!this.e.r.fillHandle||!t){e.style.display="none";return}let r=this.e.n,i=r.T("left").length,o=r.T("center");if(t.c2<i||t.c2>=i+o.length){e.style.display="none";return}let s=t.c2-i;this.N.update(o);let a=this.N.xt(s+1),l=this.He(Math.min(t.r2+1,this.e.i.A()))-this.Mt,d=this.e.o.M.center;if(this.I.St&&(l<d.scrollTop||l>d.scrollTop+d.clientHeight)){e.style.display="none";return}e.style.display="",e.style.left=`${this.I.St?Math.min(a-4,parseFloat(this.e.o.Re.center.style.width)-8):a-4}px`,e.style.top=`${Math.min(l-4,this.I.height-8)}px`}Bd(e){if(this.e.s()||e.button!==0)return;let t=this.ke();t&&(e.preventDefault(),e.stopPropagation(),this.gi={r1:t.r1,r2:t.r2,c1:t.c1,c2:t.c2,startX:e.clientX,startY:e.clientY,axis:null,active:!1},window.addEventListener("pointermove",this.jn),window.addEventListener("mousemove",this.jn),window.addEventListener("pointerup",this.Ir),window.addEventListener("mouseup",this.Ir),window.addEventListener("pointercancel",this.Ir))}_d(e){let r=this.e.o.Re.center.getBoundingClientRect(),i=e.clientY-r.top+this.Mt,o=this.e.i.A(),s=this.Fn(i,o);return Math.max(this.gi.r2,Math.min(s,o-1))}zd(e){let r=this.e.o.Re.center.getBoundingClientRect(),i=e.clientX-r.left,o=this.e.n,s=o.T("left").length,a=o.T("center");this.N.update(a);let l=this.N.Op(i);if(l<0)return s;let d=this.N.xt(l)+a[l].currentWidth/2;return i<d?s+l:l+1<a.length?s+l+1:s+a.length-1}qs(){this.gi=null,this.na=!1,window.removeEventListener("pointermove",this.jn),window.removeEventListener("mousemove",this.jn),window.removeEventListener("pointerup",this.Ir),window.removeEventListener("mouseup",this.Ir),window.removeEventListener("pointercancel",this.Ir),this.e.o.root.classList.remove("mach-root--filling")}om(e,t,r,i,o){let s=this.e.n.c(),a=[];for(let l=e;l<=t;l++)this.sm(l,r,i,o,s,a);this.e.br(a),this.e.emit("rangeSelectionChanged",{range:this.Xe()})}sm(e,t,r,i,o,s){let a=this.e.i.m(e);if(!a||a.isDetail||a.isGroup)return;let l=[];for(let c=t;c<=r;c++){let u=o[c];l.push(u?this.e.d(a,u):void 0)}let d=Dn(l);for(let c=r+1;c<=i;c++){let u=o[c];if(!En(u)||!this.e.l.q(a,u))continue;let h=xn(d,c-t),p=this.e.d(a,u);s.push({node:a,column:u,oldValue:p,newValue:h})}}am(e,t,r,i,o){let s=this.e.n.c(),a=[];this.lm(e,t,r,i,o,s,a),this.e.br(a),this.e.emit("rangeSelectionChanged",{range:this.Xe()})}lm(e,t,r,i,o,s,a){for(let l=r;l<=i;l++){let d=s[l];En(d)&&this.dm(d,e,t,o,a)}}dm(e,t,r,i,o){let s=this.cm(e,t,r);if(s.length===1&&s[0]===void 0)return;let a=Dn(s);for(let l=r+1;l<=i;l++){let d=this.e.i.m(l);if(!d||d.isDetail||d.isGroup||!this.e.l.q(d,e))continue;let c=xn(a,l-t),u=this.e.d(d,e);o.push({node:d,column:e,oldValue:u,newValue:c})}}cm(e,t,r){let i=[];for(let o=t;o<=r;o++){let s=this.e.i.m(o);i.push(s?this.e.d(s,e):void 0)}return i}Ge(e,t){if(this.um(),e==null||t==null){this.E=null;return}this.E={rowIndex:e,colId:t},this.Un(),this.hm()}Un(){if(!this.E)return;let e=this.rn(this.E.rowIndex,this.E.colId);if(e){let t=Math.max(0,this.e.n.ze(this.E.colId));e.id=`mach-grid-${this.e.gridId}-r${this.E.rowIndex}-c${t}`,e.classList.add("mach-cell--focus"),this.e.o.root.setAttribute("aria-activedescendant",e.id)}}um(){if(this.E){let e=this.rn(this.E.rowIndex,this.E.colId);e&&(e.classList.remove("mach-cell--focus"),e.removeAttribute("id"))}this.e.o.root.removeAttribute("aria-activedescendant")}hm(){if(!this.E)return;this.cr(this.E.rowIndex,"nearest");let e=this.e.n.P(this.E.colId);if(!e||e.pinned)return;let t=this.e.o.M.center,r=this.e.n.T("center");this.N.update(r);let i=this.N.xt(r.indexOf(e)),o=t.scrollLeft,s=t.clientWidth;i<o?t.scrollLeft=i:i+e.currentWidth>o+s&&(t.scrollLeft=i+e.currentWidth-s)}cr(e,t="top"){let r=this.e.o.M.center,i=this.e.i.A();if(i===0)return;let o=C(e,0,i-1),s=r.clientHeight,a=this.I.read(r.scrollTop),l=this.He(o),d=this.He(o+1),c=a;t==="top"?c=l:t==="bottom"?c=d-s:t==="middle"?c=l-(s-(d-l))/2:l<a?c=l:d>a+s&&(c=d-s);let u=Math.max(0,this.He(i)-s);this.$n(C(c,0,u)),this.yn()}Wd(e){if(this.Nn===e)return;let t=this.Nn;this.Nn=e,this.$d(t,!1),this.$d(e,!0)}$d(e,t){if(e<0)return;let r=this.O[e%this.Oe];if(!(!r||r.index!==e||r.kind!=="master"))for(let i of k)r.rows[i]?.classList.toggle("mach-row--hover",t)}yi(){this.e.o.root.focus({preventScroll:!0})}Yt(e){let t=e.target,r=t.closest(".mach-row");if(!r)return null;let i=Number(r.dataset.index);if(Number.isNaN(i))return null;let o=this.e.i.m(i);if(!o)return null;let s=t.closest(".mach-cell");return{node:o,index:i,cellEl:s}}Kd(e,t,r){let{node:i,index:o,cellEl:s}=r;if(this.pm(t,i,s)||this.fm(t,i,s))return;let a=s?.dataset.colId??"",l=a?this.e.n.P(a):void 0;this.mm(i,l)||i.isDetail||this.gm(t,i,o,e)||!s||!l||(this.yi(),this.e.r.suppressCellFocus||this.Ge(o,a),this.e.g.Qa(i,e,!1),this.ym(e,i,o,l),this.vm(i,o,l))}pm(e,t,r){if(!t.isGroup)return!1;if(this.yi(),e.closest(".mach-row-checkbox")){let o=this.e.g.Ja(t).all;return this.e.g.ru(t,!o),!0}let i=this.e.n.ba();return(!i||!r||r.dataset.colId===i.id)&&this.e.i.Lo(t.id),!0}mm(e,t){return!t?.isDetailToggle||e.isDetail?!1:(this.yi(),this.e.Ui(e.id),!0)}gm(e,t,r,i){let o=e.closest(".mach-cell--selection");return o?(this.yi(),this.e.r.suppressCellFocus||this.Ge(r,o.dataset.colId??""),this.fr(),this.e.g.Qa(t,i,!0),!0):!1}ym(e,t,r,i){let o=this.e.d(t,i),s=this.e.emit("cellClicked",{event:e,rowNode:t,rowIndex:r,column:i,colDef:i.colDef,value:o});i.colDef.onCellClick?.(s),this.e.emit("rowClicked",{event:e,rowNode:t,rowIndex:r})}vm(e,t,r){(this.e.r.singleClickEdit||r.colDef.singleClickEdit===!0)&&this.e.l.q(e,r)&&this.e.l.start(t,r)}fm(e,t,r){if(!this.e.i.F||!e.closest(".mach-tree-toggle"))return!1;let i=this.Hd();return!i||r?.dataset.colId!==i.id||!this.e.i.isRowExpandable(t)?!1:(this.yi(),t.treeLoadError?this.e.i.loadTreeChildren(t.id,!0).catch(()=>{}):this.e.i.Ui(t.id),!0)}bm(e){return!!(e.target.closest(".mach-cell-editor-shell, .mach-row-editor-shell, .mach-tree-toggle, .mach-row-drag-handle")||this.e.l.en())}Yf(e,t){let r=e.querySelector("button.mach-row-drag-handle"),i=r?.value===t.id?r:f("button","mach-row-drag-handle");i.type="button",i.value=t.id;let o=this.Kt.md(t);i.disabled=o!==!0;let s=this.e.r.locale.rowDragHandle??T.rowDragHandle;i.setAttribute("aria-label",s),i.title=typeof o=="string"?o:i.disabled?this.e.r.locale.rowDragUnavailable??T.rowDragUnavailable:s,i.setAttribute("aria-keyshortcuts","Alt+ArrowUp Alt+ArrowDown"),i!==r&&e.replaceChildren(i)}};var Wt=class{constructor(e){this.e=e;this.Ve=null;this.Ud={left:void 0,center:void 0,right:void 0};this.sa={left:[],center:[],right:[]}}init(){this.Ve=f("div","mach-footer"),this.Ve.style.display="none",this.Ve.setAttribute("role","row"),this.e.o.root.appendChild(this.Ve);for(let e of["left","center","right"]){let t=f("div",`mach-footer-row mach-footer-row--${e}`);t.style.height=`${this.e.r.rowHeight}px`,this.Ve.appendChild(t),this.Ud[e]=t}}setVisible(e){this.Ve&&(this.Ve.style.display=e?"":"none")}refresh(){if(!this.Ve||this.e.s())return;let e=this.e.r.showSummary;if(this.setVisible(e),!e)return;let t=this.e.r.summaryMethod,r=this.e.i.pt().filter(o=>!o.isDetail&&!o.isGroup),i={...T,...this.e.r.locale};for(let o of["left","center","right"]){let s=this.e.n.T(o),a=this.Ud[o];this.sa[o].length!==s.length&&(a.textContent="",this.sa[o]=s.map(()=>{let d=f("div","mach-footer-cell");return d.setAttribute("role","cell"),a.appendChild(d),d}));let l=0;s.forEach((d,c)=>{let u=this.sa[o][c];if(u.style.left=`${l}px`,u.style.width=`${d.currentWidth}px`,l+=d.currentWidth,d.hasCheckbox||d.isDetailToggle||d.colDef.rowDrag){u.textContent="";return}if(t)try{u.textContent=t({colId:d.id,column:d,values:r.map(h=>this.e.d(h,d))})}catch(h){this.e.reportError(h,"summaryMethod",{colId:d.id}),u.textContent=""}else c===0&&o==="left"?u.textContent=_(i.totalRowsLabel,r.length):u.textContent=""})}}destroy(){this.Ve?.remove(),this.Ve=null}};var $t=class{constructor(e){this.e=e;this.C=null;this.qn=null;this.aa=null;this.Ar=null;this.Xt=null;this.vi=null;this.bi=null;this.wi=null;this.Ci=null;this.Jt=[]}init(){this.C=f("div","mach-pagination"),this.C.style.display="none",this.C.setAttribute("role","navigation");let e=(t,r,i)=>{let o=f("button",`mach-pagination-btn ${t}`);return o.type="button",o.title=r,o.setAttribute("aria-label",r),o.textContent=i,o};this.qn=f("span","mach-pagination-total"),this.vi=e("mach-pagination-first",this.t("pageFirst"),"\xAB"),this.bi=e("mach-pagination-prev",this.t("pagePrev"),"\u2039"),this.aa=f("span","mach-pagination-page"),this.wi=e("mach-pagination-next",this.t("pageNext"),"\u203A"),this.Ci=e("mach-pagination-last",this.t("pageLast"),"\xBB"),this.vi.addEventListener("click",()=>this.e.i.setPage(1)),this.bi.addEventListener("click",()=>this.e.i.setPage(this.e.i.Yr()-1)),this.wi.addEventListener("click",()=>this.e.i.setPage(this.e.i.Yr()+1)),this.Ci.addEventListener("click",()=>this.e.i.setPage(this.e.i.getPageCount())),this.C.append(this.qn,this.vi,this.bi,this.aa,this.wi,this.Ci),this.e.r.paginationShowSizeSelector&&(this.Xt=X({ariaLabel:"page size",options:[],classNames:{root:"mach-pagination-size-control",native:"mach-pagination-size"},themeSource:this.e.o.root,onChange:t=>{let r=Number(t);Number.isNaN(r)||this.e.i.setPageSize(r)}}),this.Ar=this.Xt.native,this.jd(),this.C.appendChild(this.Xt.el)),this.e.o.root.appendChild(this.C),this.Jt.push(this.e.fe.on("modelUpdated",()=>this.refresh()),this.e.fe.on("paginationChanged",()=>this.refresh())),this.refresh()}jd(){if(!this.Ar)return;let e=this.e.r.paginationPageSizeOptions,t=this.e.r.paginationPageSize;e.includes(t)||(e.push(t),e.sort((r,i)=>r-i)),this.Xt?.setOptions(e.map(r=>({value:String(r),label:_(this.t("perPage"),r)})),String(t))}t(e){return this.e.r.locale?.[e]??T[e]}ge(){this.C&&(this.Ar&&this.e.r.paginationShowSizeSelector&&this.jd(),this.refresh())}qd(e,t){e&&e.textContent!==t&&(e.textContent=t)}wm(e,t){let r=e<=1,i=e>=t;this.vi&&(this.vi.disabled=r),this.bi&&(this.bi.disabled=r),this.wi&&(this.wi.disabled=i),this.Ci&&(this.Ci.disabled=i)}refresh(){if(!this.C||this.e.s())return;let e=this.e.i,t=e.Ae,r=e.getTotalRowCount(),i=t&&r>0;if(this.C.style.display=i?"":"none",!i)return;let o=e.Yr(),s=e.getPageCount();this.qn&&this.e.r.paginationShowTotal&&this.qd(this.qn,_(this.t("paginationTotal"),r)),this.qd(this.aa,fe(this.t("paginationPage"),o,s)),this.wm(o,s),this.Ar&&Number(this.Ar.value)!==this.e.r.paginationPageSize&&this.Xt?.setValue(String(this.e.r.paginationPageSize))}destroy(){for(let e of this.Jt)e();this.Jt=[],this.Xt?.destroy(),this.Xt=null,this.Ar=null,this.C?.remove(),this.C=null}};var de=["left","center","right"],Kt=class{constructor(e){this.e=e;this.top=null;this.bottom=null}init(){this.top=this.Yd(this.e.o.En),this.bottom=this.Yd(this.e.o.Dn)}Yd(e){let t={root:e,segments:{left:f("div"),center:f("div"),right:f("div")},centerViewport:f("div","mach-pinned-viewport"),rowWrappers:{left:[],center:[],right:[]},cells:[],data:[]};for(let r of de)t.segments[r].className=`mach-pinned-seg mach-pinned-seg--${r}`,r!=="center"&&t.segments[r].classList.add("mach-pane--hidden"),r==="center"&&t.centerViewport.appendChild(t.segments[r]);return e.append(t.segments.left,t.centerViewport,t.segments.right),t}setData(e,t){this.e.s()||!this.top||!this.bottom||(this.top.data=e??[],this.bottom.data=t??[],this.ge(),this.et(),this.e.Te())}setRows(e,t){let r=this[e];this.e.s()||!r||(r.data=t??[],this.la(r,e),this.et(),this.e.Te())}getRows(e){return this[e]?.data.slice()??[]}ge(){!this.top||!this.bottom||(this.la(this.top,"top"),this.la(this.bottom,"bottom"))}la(e,t){for(let o of e.cells)for(let s of de)for(let a of o[s])M(this.e,a);for(let o of de){for(let s of e.rowWrappers[o])s.remove();e.rowWrappers[o]=[]}if(e.cells=[],e.root.style.display=e.data.length>0?"":"none",e.data.length===0)return;let r=this.e.r.rowHeight,i=this.e.n;e.data.forEach((o,s)=>{let a={id:`__pinned_${t}_${s}`,data:o,rowIndex:-1,selected:!1},l={},d=Ne(this.e,a,t);for(let c of de){let u=f("div","mach-pinned-row");ye(u,d),u.style.height=`${r}px`,u.setAttribute("role","row"),l[c]=[];for(let h of i.T(c)){let p=f("div","mach-cell");if(p.dataset.colId=h.id,p.setAttribute("role","gridcell"),h.hasCheckbox&&p.classList.add("mach-cell--selection"),!h.hasCheckbox&&!h.isDetailToggle&&!h.colDef.rowDrag&&h.colDef.type!=="index")try{Ke(this.e,p,a,h),Re(this.e,p,a,h),$e(this.e,p,a,h)}catch(m){this.e.reportError(m,"pinnedRow.render",{colId:h.id,side:t,rowIndex:s})}u.appendChild(p),l[c].push(p)}e.segments[c].appendChild(u),e.rowWrappers[c].push(u)}e.cells.push(l)})}et(){if(!this.top||!this.bottom)return;let e=this.e.n,t={left:0,center:0,right:0},r={left:[],center:[],right:[]};for(let i of de){let o=0;for(let s of e.T(i))r[i].push(o),o+=s.currentWidth;t[i]=o}for(let i of[this.top,this.bottom]){let o=i.data.length===0;i.segments.left.classList.toggle("mach-pane--hidden",o||t.left<=0),i.segments.right.classList.toggle("mach-pane--hidden",o||t.right<=0),i.segments.left.style.width=`${t.left}px`,i.segments.right.style.width=`${t.right}px`,i.segments.center.style.width=`${t.center}px`,i.cells.forEach(s=>{let a=0;for(let l of de){let d=e.T(l);s[l].forEach((c,u)=>{c.style.width=`${d[u].currentWidth}px`,c.style.left=`${r[l][u]}px`,c.setAttribute("aria-colindex",String(a+u+1))}),a+=d.length}})}}ff(e){this.top&&(this.top.segments.center.style.transform=`translateX(${-e}px)`),this.bottom&&(this.bottom.segments.center.style.transform=`translateX(${-e}px)`)}refresh(){this.ge(),this.et()}destroy(){for(let e of[this.top,this.bottom])if(e)for(let t of e.cells)for(let r of de)for(let i of t[r])M(this.e,i);this.top=null,this.bottom=null}};var Ut=class{constructor(e){this.e=e;this.C=null;this.Lr={};this.Jt=[]}init(){this.C=f("div","mach-statusbar"),this.C.style.display="none",this.C.setAttribute("role","status"),this.e.o.root.appendChild(this.C),this.ge(),this.Jt.push(this.e.fe.on("modelUpdated",()=>this.refresh()),this.e.fe.on("selectionChanged",()=>this.refresh()),this.e.fe.on("rangeSelectionChanged",()=>this.refresh()),this.e.fe.on("cellValueChanged",()=>this.refresh()))}ge(){if(!this.C)return;this.C.textContent="",this.Lr={};let e=this.e.r;if(!e.statusBarEnabled){this.C.style.display="none";return}for(let t of e.statusBarPanels){let r=f("span",`mach-statusbar-item mach-statusbar-item--${t}`);this.C.appendChild(r),this.Lr[t]=r}this.refresh()}text(e,t,r){let i=e[t]??T[t];if(r===void 0)return i;let o=typeof r=="number"?r:parseFloat(String(r))||0;return _(i,o)}da(e,t){let r=this.Lr[e];r&&r.textContent!==t&&(r.textContent=t)}Cm(e){let t=this.e.i,r=t.nr(),i=t.Ae?t.getTotalRowCount():t.A(),o=_(this.text(e,"totalRowsLabel"),i);return t.f&&r>i?`${o} / ${r}`:o}Tm(e){let t=this.e.a.ke();if(!t)return"";let r=this.e.n.c(),i=0,o=0;for(let l=t.r1;l<=t.r2;l++){let d=this.e.i.m(l);if(!(!d||d.isDetail||d.isGroup))for(let c=t.c1;c<=t.c2;c++){let u=r[c];if(!u)continue;let h=this.e.d(d,u);typeof h!="number"||Number.isNaN(h)||(i+=h,o++)}}if(o===0)return"";let s=Math.round(i/o*100)/100,a=Number.isInteger(i)?String(i):String(Math.round(i*100)/100);return`${this.text(e,"statusSum",a)} \xB7 ${this.text(e,"statusAvg",String(s))} \xB7 ${this.text(e,"statusCount",String(o))}`}refresh(){if(!this.C||this.e.s())return;let e=this.e.r;if(this.C.style.display=e.statusBarEnabled?"":"none",!e.statusBarEnabled)return;let t={...T,...e.locale};if(this.Lr.rowCount&&this.da("rowCount",this.Cm(t)),this.Lr.selectedRowCount){let r=this.e.g.je().length;this.da("selectedRowCount",_(this.text(t,"statusSelected"),r))}this.Lr.rangeAggregate&&this.da("rangeAggregate",this.Tm(t))}destroy(){for(let e of this.Jt)e();this.Jt=[],this.C?.remove(),this.C=null}};function Nr(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function Rn(n){return typeof TextEncoder>"u"?n.length*2:new TextEncoder().encode(n).byteLength}function Or(n={}){let e=(n.namespace??"mach-table:grid-state").replace(/:+$/,""),t=Math.max(1024,Math.floor(n.maxBytes??512*1024)),r=o=>`${e}:${o}`,i=(o,s,a)=>{try{n.onError?.(o,s,a)}catch{}};return{storageKey:r,load(o){try{let s=(n.storage??Nr())?.getItem(r(o));if(!s)return null;if(Rn(s)>t)throw new RangeError(`[MachTable] Stored grid state for "${o}" exceeds ${t} bytes.`);let a=JSON.parse(s);if(a?.schemaVersion!==2)throw new TypeError(`[MachTable] Stored grid state for "${o}" uses an unsupported schema.`);let l=z(a.state);if(!l)throw new TypeError(`[MachTable] Stored grid state for "${o}" is invalid.`);return l}catch(s){return i(s,"load",o),null}},save(o,s){try{let a=z(s);if(!a)throw new TypeError(`[MachTable] Invalid grid state for "${o}".`);let l=JSON.stringify({schemaVersion:2,savedAt:Date.now(),state:a});if(Rn(l)>t)throw new RangeError(`[MachTable] Grid state for "${o}" exceeds ${t} bytes.`);(n.storage??Nr())?.setItem(r(o),l)}catch(a){i(a,"save",o)}},clear(o){try{(n.storage??Nr())?.removeItem(r(o))}catch(s){i(s,"clear",o)}}}}var Fr=Or();function jt(n,e){Fr.save(n,e)}function qt(n){return Fr.load(n)}function Sn(n){Fr.clear(n)}var js=[[/^(success|ok|done|complete|completed|normal|active|enabled|启用|正常|完成|已完成|运行|运行中|在线|生效|已发运)$/i,"success"],[/^(warning|warn|hold|pending|standby|待机|待审核|暂停|预警|部分完成|待下达|待复核|待发运)$/i,"warning"],[/^(error|fail|failed|danger|fault|offline|disabled|故障|失败|错误|异常|停用|离线|断开)$/i,"danger"],[/^(info|processing|new|draft|进行中|新建|草稿|审批中|同步中|执行中|已下达|装车中)$/i,"info"],[/^(neutral|default)$/i,"neutral"]];function Yt(n,e,t){let r=String(n??"");if(e){let i=Se(e,r);if(i)return i;let o=Se(e,r.toLowerCase());if(o)return o}for(let[i,o]of js)if(i.test(r))return o;return t==null?"neutral":Yt(t)}function Vr(n={}){return e=>{if(e.value==null||e.value==="")return"";let t=String(e.value),r=Ue(t,e.colDef.status),i=r?.label??Se(n.labelMap,t)??(e.formatted||t),o=r?.color,s=Yt(o??t,o?void 0:n.variantMap,i),a=document.createElement("span");return a.className=`mach-tag mach-tag--${s}`,a.textContent=i,o&&s!==o&&(a.style.color=o,a.style.backgroundColor=`color-mix(in srgb, ${o} 12%, transparent)`),a}}function Br(n={}){return e=>{let t=Number(e.value);if(isNaN(t))return e.formatted;let r=Math.max(0,Math.min(100,t)),i=f("div","mach-progress"),o=f("div","mach-progress__track"),s=f("div","mach-progress__bar");if(s.style.width=`${r}%`,n.color&&(s.style.background=n.color),o.appendChild(s),i.appendChild(o),n.showValue!==!1){let a=f("span","mach-progress__label");a.textContent=`${Math.round(r)}${n.unit??"%"}`,i.appendChild(a)}return i}}function _r(n){if(n.value==null||n.value==="")return"";let e=f("span","mach-link");return e.textContent=n.formatted||String(n.value),e}var zr={edit:'<path d="M11.5 2.5l2 2L5 13H3v-2l8.5-8.5z"/>',delete:'<path d="M3 5h10M6 5V3h4v2M5 5l.7 8h4.6L11 5"/>',view:'<path d="M1.5 8s2.4-4.2 6.5-4.2S14.5 8 14.5 8s-2.4 4.2-6.5 4.2S1.5 8 1.5 8z"/><circle cx="8" cy="8" r="1.8"/>',copy:'<rect x="5" y="5" width="8" height="8" rx="1"/><path d="M3 11V3h8"/>',download:'<path d="M8 2v8m0 0l-3-3m3 3l3-3M2.5 13.5h11"/>',refresh:'<path d="M13 3v4h-4M3 13V9h4"/><path d="M13 7a5.5 5.5 0 00-9.7-2.6M3 9a5.5 5.5 0 009.7 2.6"/>',close:'<path d="M3.5 3.5l9 9m0-9l-9 9"/>',check:'<path d="M2.5 8.5l3.5 3.5 7.5-8"/>',plus:'<path d="M8 2.5v11M2.5 8h11"/>',search:'<circle cx="7" cy="7" r="4.5"/><path d="M10.5 10.5L14 14"/>',more:'<circle cx="3" cy="8" r=".9" fill="currentColor" stroke="none"/><circle cx="8" cy="8" r=".9" fill="currentColor" stroke="none"/><circle cx="13" cy="8" r=".9" fill="currentColor" stroke="none"/>'};function Xt(n,e=14){let t=zr[n]??"";return`<svg viewBox="0 0 16 16" width="${e}" height="${e}" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">${t}</svg>`}var Z=null,F=null;function Mn(n){F&&n.contains(F)&&$()}function $(n=!1){Z?.remove(),Z=null,F&&(F.setAttribute("aria-expanded","false"),n&&F.isConnected&&F.focus({preventScroll:!0})),F=null,document.removeEventListener("mousedown",In,!0),document.removeEventListener("keydown",Wr,!0)}function In(n){Z&&!Z.contains(n.target)&&!F?.contains(n.target)&&$()}function Wr(n){if(!Z)return;if(n.key==="Escape"){n.preventDefault(),$(!0);return}let e=[...Z.querySelectorAll("button:not(:disabled)")];if(e.length===0)return;if(n.key==="Tab"){let i=e.indexOf(document.activeElement);(!n.shiftKey&&i===e.length-1||n.shiftKey&&i<=0)&&(n.preventDefault(),e[n.shiftKey?e.length-1:0].focus());return}if(n.key!=="ArrowDown"&&n.key!=="ArrowUp")return;n.preventDefault();let t=e.indexOf(document.activeElement),r=n.key==="ArrowDown"?1:-1;e[(t+r+e.length)%e.length].focus()}function An(n,e){let t=document.createElement("button");return t.type="button",t.className=e,n.variant&&n.variant!=="default"&&t.classList.add(`${e}--${n.variant}`),t.disabled=n.disabled===!0,n.icon&&zr[n.icon]?t.innerHTML=`${Xt(n.icon,16)}<span>${n.label}</span>`:t.textContent=n.label,t.addEventListener("click",()=>n.pick(t)),t}function qs(n,e){$();let t=f("div","mach-context-menu mach-action-menu");t.setAttribute("role","menu");for(let r of e){let i=An(r,"mach-context-menu-item");i.setAttribute("role","menuitem"),t.appendChild(i)}L(t,n.closest(".mach-root")),document.body.appendChild(t),j(t,n),Z=t,F=n,n.setAttribute("aria-expanded","true"),document.addEventListener("mousedown",In,!0),document.addEventListener("keydown",Wr,!0),t.querySelector("button:not(:disabled)")?.focus({preventScroll:!0})}function Ys(n,e,t){$();let r=f("div","mach-action-drawer-backdrop"),i=f("section","mach-action-drawer");i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true"),i.setAttribute("aria-label",e);let o=f("header","mach-action-drawer__header"),s=document.createElement("strong");s.textContent=e;let a=document.createElement("button");a.type="button",a.className="mach-action-drawer__close",a.setAttribute("aria-label","Close"),a.title="Close",a.innerHTML=Xt("close",16),a.addEventListener("click",()=>$(!0)),o.append(s,a);let l=f("div","mach-action-drawer__body");for(let d of t)l.appendChild(An(d,"mach-action-drawer__item"));i.append(o,l),r.appendChild(i),r.addEventListener("mousedown",d=>{d.target===r&&$(!0)}),L(r,n.closest(".mach-root")),document.body.appendChild(r),Z=r,F=n,n.setAttribute("aria-expanded","true"),document.addEventListener("keydown",Wr,!0),i.querySelector("button:not(:disabled)")?.focus({preventScroll:!0})}function J(n,e){if(typeof n=="function")try{return n(e)}catch{return!1}return n===!0}function Ln(n){return n.variant??"default"}function Pn(n){return n.permission?typeof n.permission=="string"?[n.permission]:n.permission:[]}function $r(n,e,t){return{...n.id?{actionId:n.id}:{},permissions:Pn(n),...t?{message:t}:{},params:e}}function Jt(n,e,t){let r=t.api.getOption("actionPolicy");try{r?.onError?r.onError(n,$r(e,t)):console.error("[mach-table] action handler failed",n)}catch(i){console.error("[mach-table] action error policy failed",i,n)}}function Xs(n,e){if(Pn(n).length===0)return!0;let r=e.api.getOption("actionPolicy");if(!r?.canAccess)return!0;try{return r.canAccess($r(n,e))}catch(i){return Jt(i,n,e),!1}}function Js(n,e){return n.filter(t=>{if(!Xs(t,e))return!1;if(!t.show)return!0;try{return t.show(e)}catch{return!1}})}function Kr(n,e,t){t.isConnected&&(t.disabled=J(n.disabled,e)||J(n.loading,e),t.classList.toggle("mach-action-btn--loading",J(n.loading,e)))}function Zs(n,e,t,r){Promise.resolve(n).catch(i=>Jt(i,e,t)).finally(()=>Kr(e,t,r))}function Qs(n,e,t){try{Zs(n.onClick(e),n,e,t)}catch(r){Jt(r,n,e),Kr(n,e,t)}}function Hr(n,e,t){if(n===!1)return!1;let r=typeof n=="string"?n:e.label??e.title??"Confirm action",i=t.api.getOption("actionPolicy");return i?.confirm?i.confirm($r(e,t,r)):typeof window>"u"||typeof window.confirm!="function"?!1:window.confirm(r)}function ea(n,e){if(n.confirm==null||n.confirm===!1)return!0;if(typeof n.confirm!="function")return Hr(n.confirm,n,e);let t=n.confirm(e);return t instanceof Promise?t.then(r=>Hr(r,n,e)):Hr(t,n,e)}function ta(n){return(e,t)=>{if(J(e.disabled,n))return;if(t.disabled=!0,t.classList.add("mach-action-btn--loading"),e.confirm==null||e.confirm===!1){Qs(e,n,t);return}(async()=>{await ea(e,n)&&await e.onClick(n)})().catch(i=>Jt(i,e,n)).finally(()=>{Kr(e,n,t)})}}function ra(n,e,t){let r=document.createElement("button");r.type="button",r.className="mach-action-btn";let i=Ln(n);i!=="default"&&r.classList.add(`mach-action-btn--${i}`);let o=n.title??n.label??"Action";return r.title=o,r.setAttribute("aria-label",o),r.disabled=J(n.disabled,e),J(n.loading,e)&&(r.disabled=!0,r.classList.add("mach-action-btn--loading")),n.icon&&zr[n.icon]?(r.innerHTML=Xt(n.icon),r.classList.add("mach-action-btn--icon")):r.textContent=n.label??o,r.addEventListener("mousedown",s=>s.stopPropagation()),r.addEventListener("click",s=>{s.stopPropagation(),t(n,r)}),r}function ia(n,e,t,r,i){let o=document.createElement("button");o.type="button",o.className="mach-action-btn mach-action-btn--icon";let s=r.api.getOption("locale")??{},a=t.moreLabel??s.actionMore??T.actionMore;return o.title=a,o.setAttribute("aria-label",a),o.setAttribute("aria-haspopup",e==="drawer"?"dialog":"menu"),o.setAttribute("aria-expanded","false"),o.innerHTML=`${Xt("more",16)}<span class="mach-sr-only">\u22EF</span>`,o.addEventListener("mousedown",l=>l.stopPropagation()),o.addEventListener("click",l=>{l.stopPropagation();let d=n.map(c=>({label:c.label??c.title??"Action",icon:c.icon,variant:Ln(c),disabled:J(c.disabled,r)||J(c.loading,r),pick:u=>{$(),i(c,u)}}));e==="drawer"?Ys(o,t.drawerTitle??a,d):qs(o,d)}),o}function be(n){let e=Math.max(0,n.max??3),t=n.overflow??"menu";return r=>{let i=Js(n.actions,r);if(i.length===0)return"";let o=f("div","mach-actions"),s=t==="inline"?i:i.slice(0,e),a=t==="inline"?[]:i.slice(e),l=ta(r);for(let d of s)o.appendChild(ra(d,r,l));return a.length>0&&o.appendChild(ia(a,t,n,r,l)),{el:o,destroy:()=>{F&&o.contains(F)&&$()}}}}function ve(n,e,t){return n??e??t}function na(n,e){let t=e.api.getOption("locale")??{};return{view:ve(n.labels?.view,t.actionView,T.actionView),edit:ve(n.labels?.edit,t.actionEdit,T.actionEdit),delete:ve(n.labels?.delete,t.actionDelete,T.actionDelete),confirm:ve(n.labels?.confirm,t.actionConfirm,T.actionConfirm),save:ve(n.labels?.save,t.actionSave,T.actionSave),cancel:ve(n.labels?.cancel,t.actionCancel,T.actionCancel)}}function oa(n,e,t){let r=async()=>{if(!await e.api.editing.stop()||!n.onSave)return;let s=e.api.editing.getChanges().filter(a=>a.rowId===e.node.id);try{await n.onSave(e,s),e.api.editing.markSaved([e.node.id])}catch(a){throw e.api.editing.startRow(e.rowIndex),a}},i=n.onSave?t.save:n.labels?.confirm??n.labels?.save??t.confirm;return be({actions:[{icon:"check",title:i,variant:"success",onClick:r},{icon:"close",title:t.cancel,variant:"danger",onClick:()=>e.api.editing.stop({cancel:!0}).then(()=>{})}],overflow:"inline"})(e)}function sa(n,e,t){let r=[];return n.onView&&r.push({id:"view",icon:"view",title:t.view,variant:"primary",...n.permissions?.view?{permission:n.permissions.view}:{},onClick:n.onView}),n.edit!==!1&&r.push({id:"edit",icon:"edit",title:t.edit,variant:"warning",...n.permissions?.edit?{permission:n.permissions.edit}:{},onClick:n.onEdit??(()=>{e.api.editing.startRow(e.rowIndex)})}),n.onDelete&&r.push({id:"delete",icon:"delete",title:t.delete,variant:"danger",...n.permissions?.delete?{permission:n.permissions.delete}:{},...n.confirmDelete?{confirm:n.confirmDelete===!0?t.delete:n.confirmDelete}:{},onClick:n.onDelete}),r.push(...n.extraActions??[]),r}function Zt(n={}){return e=>{let t=na(n,e);if(e.api.editing.isRowActive(e.rowIndex))return oa(n,e,t);let r=sa(n,e,t);return be({actions:r,max:n.max,overflow:n.overflow??"menu",moreLabel:n.moreLabel,drawerTitle:n.drawerTitle})(e)}}var aa=Vr(),la=Br(),kn=Object.freeze({statusTag:aa,progressBar:la,link:_r});var Oe=class{constructor(e){this.onError=e;this.Yn=new Set;this.disposed=!1}add(e){let t=!0,r=()=>{if(t){t=!1,this.Yn.delete(r);try{e()}catch(i){try{this.onError(i)}catch{}}}};return this.disposed?r():this.Yn.add(r),r}L(e){return this.add(()=>e.destroy()),e}dispose(){if(this.disposed)return;this.disposed=!0;let e=[...this.Yn].reverse();this.Yn.clear();for(let t of e)t()}};function da(n){return!!(n.field||n.valueGetter||n.cellRenderer||n.checkboxSelection||n.rowDrag||n.type||n.autoRowSpan||n.rowSpan)}function ca(n,e,t){n.width!=null&&n.minWidth!=null&&n.width<n.minWidth&&t.push(`\u5217 "${e}" \u7684 width(${n.width}) \u5C0F\u4E8E minWidth(${n.minWidth})\uFF0C\u5C06\u6309 minWidth \u6E32\u67D3`),n.width!=null&&n.maxWidth!=null&&n.width>n.maxWidth&&t.push(`\u5217 "${e}" \u7684 width(${n.width}) \u5927\u4E8E maxWidth(${n.maxWidth})\uFF0C\u5C06\u6309 maxWidth \u6E32\u67D3`)}function ua(n,e){let t=n.colId??n.field??`col_${e.leafIndex}`;e.seenIds.set(t,(e.seenIds.get(t)??0)+1),n.field&&!Be(n.field)&&e.issues.push(`\u5217 "${t}" \u7684 field \u8DEF\u5F84\u4E0D\u5B89\u5168\u6216\u65E0\u6548\uFF0C\u5DF2\u7981\u6B62\u8BFB\u53D6\u548C\u5199\u5165`),da(n)||e.issues.push(`\u5217 "${t}" \u65E2\u65E0 field \u4E5F\u65E0 valueGetter\uFF0C\u5C06\u59CB\u7EC8\u663E\u793A\u7A7A\u503C\uFF08\u7EAF\u5DE5\u5177\u5217\u8BF7\u5FFD\u7565\u6B64\u63D0\u793A\uFF09`),ca(n,t,e.issues)}function Gn(n,e){for(let t of n){if(pe(t)){!Array.isArray(t.children)||t.children.length===0?e.issues.push(`\u5217\u5206\u7EC4 "${t.headerName??t.groupId??"?"}" \u7684 children \u4E3A\u7A7A`):Gn(t.children,e);continue}e.leafIndex++,ua(t,e)}}function Nn(n){if(!n||n.length===0)return[];let e={issues:[],seenIds:new Map,leafIndex:0};Gn(n,e);for(let[t,r]of e.seenIds)r>1&&e.issues.push(`\u5B58\u5728 ${r} \u4E2A\u91CD\u590D\u7684 colId/field "${t}"\uFF0C\u5DF2\u81EA\u52A8\u52A0\u540E\u7F00\u533A\u5206\uFF0C\u5EFA\u8BAE\u663E\u5F0F\u547D\u540D colId`);return e.issues}var On=new Set([...Sr,...Mr]);function ha(n,e){if(n===e)return 0;if(n.length===0)return e.length;if(e.length===0)return n.length;let t=Array.from({length:e.length+1},(r,i)=>i);for(let r=1;r<=n.length;r++){let i=[r];for(let o=1;o<=e.length;o++)i[o]=Math.min(i[o-1]+1,t[o]+1,t[o-1]+(n[r-1]===e[o-1]?0:1));t=i}return t[e.length]}function pa(n){let e,t=Number.POSITIVE_INFINITY;for(let i of On){let o=ha(n.toLowerCase(),i.toLowerCase());o<t&&(t=o,e=i)}let r=Math.max(2,Math.floor(n.length*.3));return t<=r?e:void 0}function fa(n){let e=[];return n.rowKey!=null&&typeof n.rowKey!="string"&&typeof n.rowKey!="function"&&e.push({code:"INVALID_OPTION_VALUE",option:"rowKey",message:"rowKey \u5FC5\u987B\u662F\u5B57\u6BB5\u8DEF\u5F84\u6216\u8FD4\u56DE\u7A33\u5B9A\u4E1A\u52A1\u4E3B\u952E\u7684\u51FD\u6570"}),n.domLayout==="autoHeight"&&n.datasource!=null&&e.push({code:"OPTION_CONFLICT",option:"domLayout",message:"autoHeight \u4F1A\u6E32\u67D3\u5168\u90E8\u5DF2\u52A0\u8F7D\u884C\uFF0C\u4E0D\u9002\u7528\u4E8E datasource \u65E0\u9650\u6EDA\u52A8\u6A21\u5F0F"}),e.push(...ma(n)),n.enableColumnResize!=null&&typeof n.enableColumnResize!="boolean"&&e.push({code:"INVALID_OPTION_VALUE",option:"enableColumnResize",message:"enableColumnResize \u5FC5\u987B\u662F boolean\uFF1B\u672A\u914D\u7F6E\u65F6\u9ED8\u8BA4\u5173\u95ED"}),e}function ma(n){if(n.datasourceMode!=="block")return[];let e=[];return n.datasource==null&&e.push({code:"OPTION_CONFLICT",option:"datasourceMode",message:"datasourceMode='block' requires a datasource"}),typeof n.getRowHeight=="function"&&e.push({code:"OPTION_CONFLICT",option:"getRowHeight",message:"Random-access block rows require fixed rowHeight so unloaded offsets remain deterministic"}),n.masterDetail===!0&&e.push({code:"OPTION_CONFLICT",option:"masterDetail",message:"masterDetail is not supported by the sparse random-access block row model"}),n.treeData===!0&&e.push({code:"OPTION_CONFLICT",option:"treeData",message:"treeData requires the local/tree row model and cannot use random-access blocks"}),Fn(n)||e.push({code:"MISSING_STABLE_ROW_ID",option:"rowKey",message:"Random-access blocks require rowKey to preserve selection and identity after eviction"}),e}function Fn(n){return n.rowKey!=null}function ga(n){let e=new Set(["enableColumnResize","pagination","rowKey"]),t=[];for(let r of Sr){if(e.has(r)||!Object.prototype.hasOwnProperty.call(n,r))continue;let i=n[r],o=ke[r];Ir(i,o)||t.push({code:"INVALID_OPTION_VALUE",option:r,message:`${r} \u503C\u7C7B\u578B\u65E0\u6548\uFF0C\u671F\u671B ${o}`})}return t}function ya(n){let e=[];for(let t of Object.keys(n)){if(On.has(t))continue;let r=pa(t);e.push({code:"UNKNOWN_OPTION",option:t,...r?{suggestion:r}:{},message:r?`\u672A\u77E5 GridOption "${t}"\uFF0C\u662F\u5426\u60F3\u4F7F\u7528 "${r}"\uFF1F`:`\u672A\u77E5 GridOption "${t}"\uFF0C\u8BE5\u503C\u4E0D\u4F1A\u751F\u6548`})}return e}function va(n,e){if(e.mode!=="server")return[];let t=[];Fn(n)||t.push({code:"MISSING_STABLE_ROW_ID",option:"rowKey",message:"\u670D\u52A1\u7AEF\u5206\u9875\u5EFA\u8BAE\u63D0\u4F9B\u7A33\u5B9A rowKey\uFF0C\u5426\u5219\u8DE8\u9875\u9009\u62E9\u4E0E\u589E\u91CF\u66F4\u65B0\u65E0\u6CD5\u53EF\u9760\u4FDD\u6301"});let r=e.total;return r!==void 0&&(typeof r!="number"||!Number.isFinite(r)||r<0)&&t.push({code:"INVALID_OPTION_VALUE",option:"pagination.total",message:"\u670D\u52A1\u7AEF\u5206\u9875 total \u5FC5\u987B\u662F\u975E\u8D1F\u6709\u9650\u6570"}),t}function ba(n){let e=[],t=n.pagination;return t!=null&&typeof t!="boolean"&&typeof t!="object"&&e.push({code:"INVALID_OPTION_VALUE",option:"pagination",message:"pagination \u5FC5\u987B\u662F boolean \u6216\u914D\u7F6E\u5BF9\u8C61"}),n.datasource!=null&&t!==void 0&&t!==!1&&e.push({code:"OPTION_CONFLICT",option:"pagination",message:"datasource \u987A\u5E8F\u65E0\u9650\u6A21\u5F0F\u4E0E pagination \u4E0D\u80FD\u540C\u65F6\u542F\u7528\uFF1B\u666E\u901A\u670D\u52A1\u7AEF\u5206\u9875\u8BF7\u4F7F\u7528 pagination.mode='server'"}),t&&typeof t=="object"&&e.push(...va(n,t)),e}function wa(n){return n.treeData!==!0||n.masterDetail!==!0?[]:[{code:"OPTION_CONFLICT",option:"masterDetail",message:"treeData \u4E0E masterDetail \u4E0D\u80FD\u540C\u65F6\u542F\u7528\uFF0C\u4E3B\u4ECE\u660E\u7EC6\u5C06\u88AB\u5FFD\u7565"}]}function Qt(n){let e=n,t=ya(e);return t.push(...ba(e)),t.push(...wa(e)),t.push(...ga(e)),t.push(...fa(e)),t}function Hn(n){let e=/^v?(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:[-+].*)?$/.exec(n.trim());return e?[Number(e[1]),Number(e[2]??0),Number(e[3]??0)]:null}function Ur(n,e){for(let t=0;t<3;t++)if(n[t]!==e[t])return n[t]<e[t]?-1:1;return 0}function Ca(n){return n[0]>0?[n[0]+1,0,0]:n[1]>0?[0,n[1]+1,0]:[0,0,n[2]+1]}function Ta(n,e){if(e==="*"||e.toLowerCase()==="latest")return!0;let t=/^(\^|~|>=|<=|>|<|=)?\s*(.+)$/.exec(e);if(!t)return!1;let r=Hn(t[2]);if(!r)return!1;let i=Ur(n,r);switch(t[1]??"="){case">=":return i>=0;case"<=":return i<=0;case">":return i>0;case"<":return i<0;case"^":return i>=0&&Ur(n,Ca(r))<0;case"~":return i>=0&&Ur(n,[r[0],r[1]+1,0])<0;default:return i===0}}function Vn(n,e){if(!e?.trim())return!0;let t=n?Hn(n):null;return t?e.split("||").some(r=>{let i=r.trim().split(/\s+/).filter(Boolean);return i.length>0&&i.every(o=>Ta(t,o))}):!1}function Ea(n){return[...new Set((n??[]).map(e=>e.trim()).filter(Boolean))]}function er(n){let e=new Map;for(let t of n??[]){let r=(typeof t=="string"?t:t?.key??"").trim();if(!r||e.has(r))continue;let i=typeof t=="object"?t.version?.trim():void 0;e.set(r,{key:r,...i?{version:i}:{}})}return[...e.values()]}function tr(n){let e=[],t=new Map;for(let l of n){let d=typeof l?.key=="string"?l.key.trim():"";if(!d){e.push({code:"INVALID_FEATURE_KEY",message:"GridFeature.key must be a non-empty string"});continue}if(t.has(d)){e.push({code:"DUPLICATE_FEATURE",feature:d,message:`Duplicate GridFeature key: ${d}`});continue}t.set(d,l)}let r=new Set;for(let[l,d]of t){for(let c of er(d.requires)){let u=t.get(c.key);u?Vn(u.version,c.version)||(r.add(l),e.push({code:"UNSUPPORTED_FEATURE_VERSION",feature:l,dependency:c.key,message:`GridFeature "${l}" requires "${c.key}" ${c.version}, received ${u.version??"unversioned"}`})):(r.add(l),e.push({code:"MISSING_FEATURE_DEPENDENCY",feature:l,dependency:c.key,message:`GridFeature "${l}" requires missing feature "${c.key}"`}))}for(let c of Ea(d.conflicts))if(t.has(c)){r.add(l),e.push({code:"FEATURE_CONFLICT",feature:l,dependency:c,message:`GridFeature "${l}" conflicts with "${c}"`});break}}let i=[],o=new Set,s=new Set,a=l=>{if(s.has(l))return!r.has(l);if(o.has(l))return r.add(l),e.push({code:"FEATURE_CYCLE",feature:l,message:`GridFeature dependency cycle includes "${l}"`}),!1;let d=t.get(l);if(!d||r.has(l))return!1;o.add(l);let c=!0;for(let u of er(d.requires))a(u.key)||(c=!1);return o.delete(l),s.add(l),c?(i.push(d),!0):(r.add(l),!1)};for(let l of t.keys())a(l);return{features:i.filter(l=>!r.has(l.key.trim())),issues:e}}var Da=["datasource","treeData"],xa=["columnState.","gridState."],Ra=new Set(["valueFormatter","cellStyle","cellClass"]),Sa=new Set(["selectionChanged","sortChanged","filterChanged","columnMoved","columnVisibilityChanged","displayedColumnsChanged","paginationChanged","detailToggled"]),Ma=0,rr=class{constructor(e,t){this.x=!1;this.Em=0;this.Ti=0;this.Xd=!1;this.ca="";this.R=new Oe(e=>console.error("[mach-table] resource cleanup error",e));this.activeFeatures=new Map;this.tc=0;this.Ei=0;this.recentErrors=[];this.It=null;this.rc=0;this.ua=0;this.ha=!1;this.pa=!1;this.fa=null;this.lc=null;this.Xn=new Set;let r;this.Jd=new Promise(i=>{r=i}),this.Zd=r,this.gridId=++Ma,this.r=ri(t),this.fe=new qe((i,o)=>{o==="gridError"?console.error("[mach-table] error in gridError listener",i):this.reportError(i,"eventBus.listener",{eventType:o})});try{if(this.$l(t.dataProcessor),this.n=new Xe(this),this.i=this.R.L(new nt(this)),this.g=new ot(this),this.o=this.R.L(new Gt(this)),this.W=this.R.L(new Ot(this)),this.a=this.R.L(new zt(this)),this.ci=this.R.L(new st(this)),this.Ln=this.R.L(new at(this)),this.os=this.R.L(new ft(this)),this.l=this.R.L(new bt(this)),this.U=new vt(this),this.z=new St(this),this.le=this.R.L(new At),this.vr=this.R.L(new Lt(i=>this.Dm(i))),this.Ps=this.R.L(new Tt(this)),this.columnMenu=this.R.L(new Et(this)),this.oa=this.R.L(new Dt(this)),this.Bn=this.R.L(new xt(this)),this.wn=this.R.L(new Rt(this)),this.wr=this.R.L(new $t(this)),this.me=this.R.L(new Kt(this)),this.ce=this.R.L(new Wt(this)),this.Ye=this.R.L(new Ut(this)),this.api=wn(this),this._t=new je(this),this._=this.R.L(new Mt(this)),this.R.add(()=>this.ic()),this._.init(),this.o.init(e,this.r),this.wn.init(),this.a.init(),this.os.init(),this.Bn.init(),this.wr.init(),this.ce.init(),this.Ye.init(),this.me.init(),this.i.Ua(this.r.paginationPage,this.r.paginationPageSize),this.n.Nr(this.r.columnDefs),this.i.ar(this.r.advancedFilterModel),this.i.lr(this.r.quickFilterText),this.Cn(),this.nc(this.r.columnDefs),this.Cs(t),this.W.li(),this.r.datasource?this.i.Vi().catch(()=>{}):this.i.ht(this.r.rowData),this.r.initialState&&this.api.state.apply(this.r.initialState,{emitEvents:!1}),this.vs(),this.Te(),this.me.setData(this.r.pinnedTopRowData,this.r.pinnedBottomRowData),this.Kl(this.r.features),this.x)return;this.Ti=requestAnimationFrame(()=>{this.Ti=0,this.x||this.emit("gridReady",{}),this.oc()})}catch(i){throw this.api&&this.reportError(i,"grid.constructor"),this.destroy(),i}}$l(e){if(e===this.Qd)return!1;let t=++this.tc,r=typeof e=="function"?e():e;if(this.x||t!==this.tc)return r?.destroy?.(),!1;let i=this.ec;return this.Qd=e,r===this.r.dataProcessor&&i?!1:(this.r.dataProcessor=r,this.ec=r?this.R.add(()=>r.destroy?.()):void 0,i?.(),!0)}whenReady(){return this.Jd}oc(){this.Xd||(this.Xd=!0,this.Zd(this.api))}dc(e){return this.r.components?.cellRenderers?.[e]??kn[e]}Wu(e){return this.r.components?.cellEditors?.[e]}xm(e){return er(e.requires).map(t=>t.key).find(t=>!this.activeFeatures.has(t))}Kl(e){let t=this.Ei+1;if(this.ic(),this.x||this.Ei!==t)return;let r=tr(e??[]);for(let i of r.issues)this.reportError(new Error(i.message),"feature.manifest",{code:i.code,...i.feature?{key:i.feature}:{},...i.dependency?{dependency:i.dependency}:{}});for(let i of r.features){if(this.x||this.Ei!==t)return;let o=i.key.trim(),s=this.xm(i);if(s){this.reportError(new Error(`GridFeature "${o}" dependency "${s}" did not initialise`),"feature.manifest",{code:"FEATURE_DEPENDENCY_SETUP_FAILED",key:o,dependency:s});continue}let a=new Oe(c=>this.reportError(c,"feature.cleanup",{key:o})),l=c=>a.add(c),d={api:this.api,root:this.o.root,getOptions:()=>this.r,addEventListener:(c,u)=>l(this.fe.on(c,u)),onCleanup:c=>{l(c)},addManagedDomListener:(c,u,h,p)=>(c.addEventListener(u,h,p),l(()=>c.removeEventListener(u,h,p))),setManagedTimeout:(c,u)=>{let h=setTimeout(()=>{p(),c()},Math.max(0,u)),p=l(()=>clearTimeout(h));return h},createAbortController:()=>{let c=new AbortController;return l(()=>c.abort()),c},reportError:(c,u,h)=>this.reportError(c,`feature.${u}`,h)};try{let c=i.setup(d);if(typeof c=="function"&&l(c),this.x||this.Ei!==t){this.sc(o,{feature:i,scope:a});return}this.activeFeatures.set(o,{feature:i,scope:a})}catch(c){a.dispose(),this.reportError(c,"feature.setup",{key:o})}}}ic(){this.Ei++;let e=[...this.activeFeatures.entries()].reverse();this.activeFeatures.clear();for(let[t,r]of e)this.sc(t,r)}sc(e,t){t.scope.dispose();try{t.feature.destroy?.()}catch(r){this.reportError(r,"feature.destroy",{key:e})}}s(){return this.x}suspend(){this.Me(),this.api.editing.stop({cancel:!0}),this.Ps.close(),this.columnMenu.close(),this.oa.close(),this.Bn.hide(),this.ci.Ot(),this.Ln.destroy(),this.a.suspend(),Fi(this.o.root),Mn(this.o.root);let e=document.activeElement;e instanceof HTMLElement&&this.o.root.contains(e)&&e.blur()}sr(){return++this.Em}d(e,t){let r=t.colDef;if(r.valueGetter)try{return r.valueGetter({api:this.api,colDef:r,column:t,node:e,data:e.data})}catch(i){this.reportError(i,"valueGetter",{colId:t.id,rowId:e.id});return}if(r.field)return B(e.data,r.field)}y(e){return this.r.locale[e]??T[e]}Qi(e,t,r,i){let o=t.colDef;if(o.valueSetter)try{return o.valueSetter({oldValue:i,newValue:r,data:e.data,node:e,colDef:o,column:t,api:this.api})}catch(s){return this.reportError(s,"valueSetter",{colId:t.id,rowId:e.id}),!1}return o.field?ce(e.data,o.field,r):!1}Yo(e,t,r,i){this.a.Wi(e),this.a.Sl([e.rowIndex],[t.id]),this.z.hs({nodeId:e.id,columnId:t.id,oldValue:r,newValue:i}),this.emit("cellValueChanged",{oldValue:r,newValue:i,rowNode:e,rowIndex:e.rowIndex,column:t,colDef:t.colDef,data:e.data})}ul(e){let r=this.n.c().slice(e.c1,e.c2+1),i=[];for(let o=e.r1;o<=e.r2;o++){let s=this.i.m(o);i.push(r.map(a=>!s||s.isDetail||s.isGroup?"":Pe(this,s,a,"clipboard")))}return dt(i)}Dl(){let e=this.a.Qr();return e?pt(this.ul(e)):Promise.resolve(!1)}$o(e){if(this.x)return;let t=this.n.c(),r=[];for(let i=e.r1;i<=e.r2;i++){let o=this.i.m(i);if(!(!o||o.isDetail||o.isGroup))for(let s=e.c1;s<=e.c2;s++){let a=t[s];!a||a.hasCheckbox||a.isDetailToggle||a.colDef.rowDrag||r.push({node:o,column:a,oldValue:this.d(o,a),newValue:null})}}this.br(r)}br(e){this.U.Hu(e)}Me(){this.U?.Nu()}hl(e,t,r){if(this.x)return;let i=ct(e);if(i.length===0)return;let o=this.n.c(),s=this.i.A(),a=[],l=t;for(let d of i){let c=this.Rm(l,s);if(!c)break;this.Sm(c.node,d,o,r,a),l=c.index+1}this.br(a)}Rm(e,t){for(let r=e;r<t;r++){let i=this.i.m(r);if(i&&!i.isDetail&&!i.isGroup)return{index:r,node:i}}return null}Mm(e,t){let r=t;for(;r<e.length;){let i=e[r];if(!i.hasCheckbox&&!i.isDetailToggle&&!i.colDef.rowDrag)break;r++}return r}Sm(e,t,r,i,o){let s=i,a=o.length;for(let l of t){if(s=this.Mm(r,s),s>=r.length)return;let d=r[s];if(!this.l.q(e,d)){s++;continue}let c=this.d(e,d);try{let u=d.colDef.valueParser?ae(this,e,d,l,"clipboard",c):lt(l,typeof c=="number"||d.colDef.cellEditor==="number");o.push({node:e,column:d,oldValue:c,newValue:u})}catch(u){o.splice(a),this.reportError(u,"validate",{rowId:e.id,colId:d.id});return}s++}}oh(){let e=this.a.Ko();if(!e)return Promise.resolve();let t=this.U.jo(),r=this.i.m(e.row),i=this.n.c()[e.colIdx];if(!r||!i)return Promise.resolve();let o=this.d(r,i),s=this.U.ei([{node:r,column:i,oldValue:o,newValue:o}]);try{if(typeof navigator<"u"&&navigator.clipboard?.readText)return navigator.clipboard.readText().then(a=>{let l=this.a.Ko();a&&t()&&s()&&l?.row===e.row&&l.colIdx===e.colIdx&&this.i.m(e.row)===r&&this.n.c()[e.colIdx]===i&&this.hl(a,e.row,e.colIdx)}).catch(()=>{})}catch{}return Promise.resolve()}emit(e,t){let r={type:e,api:this.api,...t};this.fe.emit(e,r);let i="on"+e.charAt(0).toUpperCase()+e.slice(1),o=this.r[i];if(typeof o=="function")try{o(r)}catch(a){e==="gridError"?console.error("[mach-table] error in onGridError",a):this.reportError(a,`eventHandler.${String(i)}`,{eventType:e})}return(e==="columnResized"&&r.finished||Sa.has(e))&&this.Im(),r}reportError(e,t,r){let i=this.Am(t,e),o=e instanceof Error?e.message:String(e);this.recentErrors.push({code:i,source:t,message:o,timestamp:Date.now(),...r?{context:r}:{}}),this.recentErrors.length>50&&this.recentErrors.splice(0,this.recentErrors.length-50),console.error(`[mach-table] ${i} (${t})`,e),!this.x&&this.emit("gridError",{code:i,error:e,source:t,context:r})}Am(e,t){if(Da.some(i=>e.startsWith(i)))return"DATA_SOURCE_ERROR";let r=t instanceof Error?t.message:String(t);return e==="rowKey"||r.includes("Duplicate row id")?"DATA_INTEGRITY_ERROR":e==="validate"?"VALIDATION_ERROR":e.toLowerCase().includes("renderer")||Ra.has(e)?"RENDERER_ERROR":e.toLowerCase().includes("editor")||e==="editable"?"EDITOR_ERROR":e.startsWith("feature.")?"FEATURE_ERROR":xa.some(i=>e.startsWith(i))?"STATE_ERROR":e.startsWith("eventBus.")||e.startsWith("eventHandler.")?"EVENT_HANDLER_ERROR":"GRID_ERROR"}ys(){return{gridId:this.gridId,version:He,destroyed:this.x,infinite:this.i.f,loading:this.i.Tc()||this.r.loading,rowCount:this.i.nr(),renderedRowCount:this.o.De.querySelectorAll(".mach-row[data-index]").length,columnCount:this.n.te().length,selectedRowCount:this.g.je().length,dirtyRowCount:this._.getDirtyRowIds().length,activeFeatures:[...this.activeFeatures].map(([e,t])=>({key:e,...t.feature.version?{version:t.feature.version}:{}})),performance:this.le.snapshot(),updates:this.vr.snapshot(),recentErrors:this.recentErrors.map(e=>({...e,...e.context?{context:{...e.context}}:{}}))}}Ii(e,t){this.n.Ii(e,t),this.Or()}Or(){if(this.W.Ts(),this.emit("sortChanged",{sortModel:this.n.J()}),this.i.f){this.i.$e();return}this.i.w(),this.h({data:!0})}ss(e,t){let r=this.i.Q();if(t?r[e.id]=t:delete r[e.id],this.i.Kr(r),this.W.mn(),this.emit("filterChanged",{filterModel:this.i.Q(),advancedFilterModel:this.i.Ie()}),this.i.f){this.i.$e();return}this.i.w(),this.h({data:!0})}qh(){if(this.emit("filterChanged",{filterModel:this.i.Q(),advancedFilterModel:this.i.Ie()}),this.i.f){this.i.$e();return}this.i.w(),this.h({data:!0})}At(e,t){this.n.At(e,t)&&(this.Je(),this.emit("columnMoved",{colId:e,toIndex:t}))}Ui(e){return this.i.Ui(e)}sl(e,t){this.emit("columnResized",{colId:e.id,width:e.currentWidth,finished:t})}ur(e){if(!(this.x||e.length===0))for(let t of e){if(this.x)break;this.sl(t,!0)}}vs(){let e=++this.rc,t=this.ua,r=this.r.persistence;if(!r)return;let{key:i,store:o,sections:s}=r,a;try{a=o?o.load(i):qt(i)}catch(d){this.reportError(d,"gridState.load");return}let l=d=>{if(!(this.x||e!==this.rc||t!==this.ua||!d)){this.ha=!0;try{this.api.state.apply(d,{emitEvents:!1,...s?{sections:s}:{}})}finally{this.ha=!1}}};a&&typeof a.then=="function"?Promise.resolve(a).then(l).catch(d=>this.reportError(d,"gridState.load")):l(a)}Im(){let e=this.r.persistence;if(!(!e||this.x||this.ha)){if(this.ua++,this.It&&clearTimeout(this.It),e.debounceMs===0){this.It=null,this.ma();return}this.It=setTimeout(()=>{this.It=null,this.ma()},e.debounceMs)}}ma(){let e=this.r.persistence;if(!e||this.x)return;let{key:t,store:r,sections:i}=e,o=this.api.state.get(),s=i?tn(o,i):o,a={key:t,...r?{store:r}:{},state:s};if(this.pa){this.fa=a;return}this.ac(a)}ac(e){try{let t=e.store?e.store.save(e.key,e.state):jt(e.key,e.state);if(!t||typeof t.then!="function")return;this.pa=!0,Promise.resolve(t).catch(r=>this.reportError(r,"gridState.save")).finally(()=>{this.pa=!1;let r=this.fa;this.fa=null,r&&this.ac(r)})}catch(t){this.reportError(t,"gridState.save")}}Yl(){let e=f("div","mach-empty mach-empty--error"),t=f("div","mach-empty__title");t.textContent=this.y("requestFailed");let r=f("div","mach-empty__hint");return r.textContent=this.y("requestFailedHint"),e.append(t,r),e}jl(){let e=f("div","mach-loading"),t=f("div","mach-loading__visual");t.setAttribute("aria-hidden","true");for(let s=0;s<4;s+=1){let a=f("span","mach-loading__row");t.appendChild(a)}let r=f("div","mach-loading__status"),i=f("span","mach-spinner mach-loading__spinner");i.setAttribute("aria-hidden","true");let o=f("span","mach-loading__label");return o.textContent=this.y("loading"),r.append(i,o),e.append(t,r),e}ql(){let e=f("div","mach-empty");e.innerHTML='<svg class="mach-empty__icon" viewBox="0 0 96 84" aria-hidden="true"><rect stroke-opacity=".3" x="8" y="6" width="76" height="66" rx="9"/><path fill="#8b98ff" opacity=".12" stroke="none" d="M17 6H75Q84 6 84 15V26H8V15Q8 6 17 6Z"/><path stroke="var(--mach-body-fg)" opacity=".06" d="M8 26h76M38 26v46M61 26v46M8 42h76M8 57h76"/><path stroke-width="5" opacity=".5" d="M19 15h12m17 0h7m15 0h7"/><path stroke="var(--mach-body-fg)" opacity=".06" stroke-width="4" d="M19 34h12m14 0h8m15 0h8M19 49h12m14 0h8m15 0h8M19 64h12m14 0h8"/><circle stroke-opacity=".3" cx="72" cy="55" r="19"/><circle cx="70" cy="53" r="9"/><path d="m77 60 6 6m-16-16 6 6m0-6-6 6"/></svg>';let t=f("div","mach-empty__title");t.textContent=this.y("emptyRows");let r=f("div","mach-empty__hint");return r.textContent=this.y("emptyRowsHint"),e.append(t,r),e}Cs(e){if(!(this.r.suppressWarnings||this.x)){if(e)for(let t of Qt(e)){let r=`${t.code}:${t.option??""}:${t.message}`;this.Xn.has(r)||(this.Xn.add(r),console.warn(`[mach-table:${t.code}] ${t.message}`))}this.r.treeData&&this.n.nt().length>0&&console.warn("[mach-table] treeData \u4E0E rowGroup \u4E0D\u652F\u6301\u540C\u65F6\u542F\u7528\uFF0C\u884C\u5206\u7EC4\u5DF2\u88AB\u5FFD\u7565")}}nc(e){if(!(this.r.suppressWarnings||this.x)&&this.lc!==e){this.lc=e;for(let t of Nn(e))this.Xn.has(t)||(this.Xn.add(t),console.warn(`[mach-table] ${t}`))}}Je(){this._t.kr=!0,this.vr.Gl({columns:!0})}h(e){(e.data||e.cells)&&(this._t.kr=!0),this.vr.Gl(e)}Hl(e){return this.vr.batch(e)}Dm(e){this.x||(e.columns?this.Lm():(e.header&&this.W.li(),e.pool?this.a.ws():e.layout&&this.Te()),this.Pm(e),e.data&&!e.pool&&!e.columns?this.a.im():e.cells&&this.a.refreshCells(e.cells===!0?void 0:e.cells),e.pinned&&this.me.refresh(),e.summary&&this.ce.refresh(),e.overlays&&this.a.Qs())}Pm(e){!(e.data||e.cells)||e.layout||e.columns||e.pool||this._t.Zn()&&this.qe()}Lm(){this.Cs(),this.nc(this.n.Ri()),this.a.bn(),this.W.li(),this.a.ws(),this.Te(),this.me.ge(),this.ce.refresh(),this.emit("displayedColumnsChanged",{})}Te(){if(this.x)return;let e=this.le.start();this.Cn(),this._t.Zn(),this.n.wa(this.o.bs());let t=this.n.c().map(r=>`${r.id}:${r.currentWidth}`).join("|");this.ca&&t!==this.ca&&this.a.bn(),this.ca=t,this.o.root.setAttribute("aria-colcount",String(this.n.c().length)),this.W.et(),this.a.Te(),this.me.et(),this.ce.refresh(),this.le.gh(e)}Cn(){if(!this.o.root)return;let e=this.r.treeData||this.n.nt().length>0;this.o.root.setAttribute("role",e?"treegrid":"grid"),this.r.rowSelection==="multiple"?this.o.root.setAttribute("aria-multiselectable","true"):this.o.root.removeAttribute("aria-multiselectable"),this.n.c().some(r=>!!r.colDef.editable)?this.o.root.removeAttribute("aria-readonly"):this.o.root.setAttribute("aria-readonly","true")}qe(e=!0){this.x||(this._t.Zn(),this.n.wa(this.o.bs()),e&&this.a.bn(),this.W.et(),this.a.vn(),this.a.Zs(),this.a.di(!0),this.me.et(),this.ce.refresh())}destroy(){if(!this.x){if(this.It&&(clearTimeout(this.It),this.It=null,this.ma()),this.x=!0,this.Me(),this.Ti&&cancelAnimationFrame(this.Ti),this.Ti=0,this.api){this.oc();try{this.emit("gridDestroyed",{})}catch(e){console.error("[mach-table] grid destroy event",e)}}this.R.dispose(),this.fe.clear()}}};function Bn(n,e={}){if(!n)throw new Error("[mach-table] createGrid requires a container element");if(typeof document>"u")throw new Error("[mach-table] createGrid can only be used in a browser environment");return new rr(n,e).api}function Ia(n){return n.mode==="allMatching"?{mode:"allMatching",excludedKeys:[...n.excludedKeys]}:{mode:"explicit",selectedKeys:[...n.selectedKeys]}}function _n(n,e){if(e.scope!=="filtered"&&e.scope!=="selected")throw new TypeError("[MachTable] Remote export scope must be filtered or selected.");let t=n.state.get();return{version:1,scope:e.scope,columnIds:t.columns.filter(r=>!r.hide).map(r=>r.colId),sortModel:t.sortModel.map(r=>({...r})),filterModel:K(t.filterModel),advancedFilterModel:O(t.advancedFilterModel),quickFilterText:t.quickFilterText,...e.scope==="selected"?{selection:Ia(e.selection??{mode:"explicit",selectedKeys:t.selectedRowIds})}:{}}}function Aa(n){return n.value===!0?"\u662F":n.value===!1?"\u5426":""}function La(n){return e=>{if(e.value==null||e.value==="")return"";let t=e.value instanceof Date?e.value.toISOString():String(e.value);return n==="datetime"?t.slice(0,16).replace("T"," "):t.slice(0,10)}}function Pa(n){return e=>{if(e.value==null)return"";let t=n.find(r=>r.value===e.value);return t?t.label:String(e.value)}}function ka(n,e){return n.filterable===!1?!1:e==="number"?"number":e==="date"?"date":e==="select"||e==="boolean"?"set":"text"}function Ga(n,e,t){if(t==="number"){n.type="rightAligned";return}if(t==="date"){n.valueFormatter=La(e.format);return}if(t==="boolean"){n.valueFormatter=Aa;return}if(t!=="select")return;let r=e.options??[];n.valueFormatter=Pa(r),e.editable&&(n.cellEditor="select",n.cellEditorParams={options:r})}function zn(n){let e=n.type??"string",t={colId:n.field,field:n.field,headerName:n.title??n.field,width:n.width,minWidth:n.minWidth,maxWidth:n.maxWidth,flex:n.flex,pinned:n.pinned??void 0,hide:n.hidden??!1,editable:n.editable??!1,sortable:n.sortable??!0,resizable:n.resizable??!0,filter:ka(n,e),cellClass:n.cellClass};return Ga(t,n,e),t}function Wn(n){let e=new Map(n.fields.map(i=>[i.field,i])),t=new Set,r=[];for(let i of n.fields){if(t.has(i.field))continue;(n.groups??[]).some(s=>s.fields.includes(i.field))||(r.push(zn(i)),t.add(i.field))}for(let i of n.groups??[]){let o=[];for(let s of i.fields){let a=e.get(s);!a||t.has(s)||(o.push(zn(a)),t.add(s))}o.length>0&&r.push({headerName:i.title,children:o})}return r}function G(n){let e=n();return e&&!e.isDestroyed()?e:null}function $n(n){let e=()=>n.getApi();return{search(t){G(e)?.filtering.setQuickText(t)},async refresh(){if(n.reload){await n.reload();return}let t=G(e);t&&(t.rows.isRemote()?await t.rows.reload():t.view.refreshCells())},openColumns(t){G(e)?.columns.openWorkbench(t)},setDensity(t){G(e)?.updateOptions({size:t})},selectAll(t=!0){G(e)?.selection.selectAll(t)},clearSelection(){let t=G(e);t?.selection.clear(),t?.selection.clearRange()},resetColumns(){G(e)?.columns.resetState()},resetView(){G(e)?.batch(t=>{t.selection.clear(),t.selection.clearRange(),t.filtering.setModel(null),t.filtering.setAdvancedModel(null),t.sorting.setModel(null),t.pagination.setPage(1),t.columns.resetState()})},undo(){return G(e)?.editing.undo()??!1},redo(){return G(e)?.editing.redo()??!1},canUndo(){return G(e)?.editing.canUndo()??!1},canRedo(){return G(e)?.editing.canRedo()??!1},exportCsv(t="mach-table.csv"){let r=G(e);return r?Pt(t,r.io.exportCsv({prependBOM:!0}),"text/csv;charset=utf-8"):!1},async toggleFullscreen(){if(typeof document>"u")return!1;if(document.fullscreenElement)return await document.exitFullscreen?.(),!1;let r=G(e)?.view.getRoot(),i=n.getFullscreenElement?.()??r?.parentElement??r;return i?.requestFullscreen?(await i.requestFullscreen(),!0):!1}}}var Fe={sortable:!1,resizable:!1,movable:!1,filter:!1,suppressSizeToFit:!0,suppressColumnMenu:!0};function Kn(n={}){let e=n.width??40;return{colId:"sel",headerName:"",width:e,minWidth:n.minWidth??e,maxWidth:n.maxWidth??e,pinned:"left",checkboxSelection:!0,...Fe,...n}}function Un(n={}){let e=n.width??52;return{colId:"idx",headerName:"#",type:"index",width:e,minWidth:n.minWidth??e,maxWidth:n.maxWidth??e,pinned:"left",align:"center",headerAlign:"center",...Fe,...n}}function jn(n={}){let e=n.width??40;return{colId:"drag",headerName:"",rowDrag:!0,width:e,minWidth:n.minWidth??e,maxWidth:n.maxWidth??e,pinned:"left",...Fe,...n}}function qn(n={actions:[]}){let{width:e,pinned:t,...r}=n,i=r.actions?.length??0,o=r.overflow==="inline"?i:Math.min(i,r.max??3),s=r.overflow!=="inline"&&i>o,a=Math.max(1,o)*26+(s?26:0)+10;return{colId:"op",headerName:"\u64CD\u4F5C",width:e??Math.max(64,a),pinned:t??"right",cellRenderer:be(r),...Fe,cellRendererParams:void 0}}function Yn(n={}){let{width:e,pinned:t,...r}=n,i=(r.onView?1:0)+(r.edit===!1?0:1)+(r.onDelete?1:0)+(r.extraActions?.length??0),o=r.overflow==="inline"?i:Math.min(i,r.max??3),s=r.overflow!=="inline"&&i>o,a=Math.max(2,o)*26+(s?26:0)+10;return{colId:"op",headerName:"\u64CD\u4F5C",width:e??Math.max(72,a),pinned:t??"right",cellRenderer:Zt(r),...Fe,cellRendererParams:void 0}}function Xn(){return{accessor:(n,e={})=>({...e,field:n}),display:n=>({...n}),group:n=>({...n,children:[...n.children]})}}function Jn(n){return[...n]}function jr(n,e){return e===void 0?n:typeof e!="object"||e===null||typeof n!="object"||n===null?e:{...n,...e}}function Na(n,e){return typeof n!="function"?e:typeof e!="function"?n:(...t)=>{let r;try{n(...t)}catch(i){r=i}try{e(...t)}catch(i){r??(r=i)}if(r!==void 0)throw r}}function Oa(n,e){if(!(!n.components&&!e.components))return{cellRenderers:{...n.components?.cellRenderers,...e.components?.cellRenderers},cellEditors:{...n.components?.cellEditors,...e.components?.cellEditors}}}function Fa(n,e){if(!n.columnTypes&&!e.columnTypes)return;let t={},r=new Set([...Object.keys(n.columnTypes??{}),...Object.keys(e.columnTypes??{})]);for(let i of r)t[i]={...n.columnTypes?.[i],...e.columnTypes?.[i]};return t}function Ha(n,e,t){for(let r of new Set([...Object.keys(e),...Object.keys(t)])){if(!/^on[A-Z]/.test(r))continue;let i=e[r],o=t[r];typeof i!="function"||typeof o!="function"||(n[r]=Na(i,o))}}function Va(n,e){let t={...n,...e,features:e.features??n.features};(n.defaultColDef||e.defaultColDef)&&(t.defaultColDef={...n.defaultColDef,...e.defaultColDef}),(n.locale||e.locale)&&(t.locale={...n.locale,...e.locale});let r=Oa(n,e);r&&(t.components=r);let i=Fa(n,e);return i&&(t.columnTypes=i),(n.aggFuncs||e.aggFuncs)&&(t.aggFuncs={...n.aggFuncs,...e.aggFuncs}),t.pagination=jr(n.pagination,e.pagination),t.statusBar=jr(n.statusBar,e.statusBar),t.watermark=jr(n.watermark,e.watermark),Ha(t,n,e),t}function qr(...n){return n.reduce(Va,{})}function Zn(n={}){return qr({defaultColDef:{sortable:!0,resizable:!0,movable:!0,filter:!0},enableColumnResize:!0,rowSelection:"multiple",columnMenu:!0,contextMenu:!0,enableRangeSelection:!0,fillHandle:!0,statusBar:!0,stripedRows:!0},n)}function Qn(n){return n}function eo(n){return n}function to(n){return n}function nr(n){return n!=null&&n!==""}function Ba(n){if(!nr(n))return null;let e=typeof n=="number"?n:Number(n);return Number.isFinite(e)?e:null}function ir(n,e){try{return new Intl.NumberFormat(n,e)}catch{return new Intl.NumberFormat(void 0,e)}}function ro(n,e){try{return new Intl.DateTimeFormat(n,e)}catch{let t={...e};return delete t.timeZone,new Intl.DateTimeFormat(void 0,t)}}function _a(n){if(!nr(n))return null;let e=n instanceof Date?n:new Date(n);return Number.isFinite(e.getTime())?e:null}function io(n={}){let e=n.emptyText??"",t=n.invalidText??"\u2014",r=ir(n.locale,{maximumFractionDigits:n.maximumFractionDigits??2}),i=ir(n.locale,{maximumFractionDigits:0}),o=ir(n.locale,{style:"currency",currency:n.currency??"CNY",currencyDisplay:n.currencyDisplay??"symbol",maximumFractionDigits:n.maximumFractionDigits??2}),s=ir(n.locale,{style:"percent",maximumFractionDigits:n.maximumFractionDigits??2}),a=ro(n.locale,{year:"numeric",month:"2-digit",day:"2-digit",...n.timeZone?{timeZone:n.timeZone}:{}}),l=ro(n.locale,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,...n.timeZone?{timeZone:n.timeZone}:{}}),d=(u,h=1)=>({value:p})=>{if(!nr(p))return e;let m=Ba(p);return m==null?t:u.format(m*h)},c=u=>({value:h})=>{if(!nr(h))return e;let p=_a(h);return p==null?t:u.format(p)};return Object.freeze({text:{align:"left",filter:"text"},number:{align:"right",filter:"number",cellEditor:"number",valueFormatter:d(r)},integer:{align:"right",filter:"number",cellEditor:"number",valueFormatter:d(i)},money:{align:"right",filter:"number",cellEditor:"number",valueFormatter:d(o)},percent:{align:"right",filter:"number",cellEditor:"number",valueFormatter:d(s)},percentage:{align:"right",filter:"number",cellEditor:"number",valueFormatter:d(s,.01)},date:{align:"center",filter:"date",cellEditor:"date",valueFormatter:c(a)},datetime:{align:"center",filter:"date",valueFormatter:c(l)},boolean:{align:"center",filter:"set",valueFormatter:({value:u})=>u===!0?n.trueText??"\u662F":u===!1?n.falseText??"\u5426":e},status:{filter:"set",cellRenderer:"statusTag"},link:{filter:"text",cellRenderer:"link"}})}function no(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function oo(n){return typeof TextEncoder>"u"?n.length*2:new TextEncoder().encode(n).byteLength}function so(n){if(typeof n!="string")return null;let e=n.trim();return e&&e.length<=256?e:null}function or(n){if(n==null||typeof n!="object")return null;let e=n;if(e.version!==1)return null;let t=z({version:2,columns:e.columns,sortModel:e.sortModel,filterModel:e.filterModel,advancedFilterModel:e.advancedFilterModel,quickFilterText:e.quickFilterText,pagination:{enabled:!0,page:1,pageSize:e.pageSize},selectedRowIds:[],expandedRowIds:[],expandedGroupIds:[]});return t?{version:1,columns:t.columns,sortModel:t.sortModel,filterModel:t.filterModel,advancedFilterModel:t.advancedFilterModel,quickFilterText:t.quickFilterText,pageSize:t.pagination.pageSize}:null}function we(n){if(n==null||typeof n!="object")return null;let e=n,t=so(e.id),r=typeof e.name=="string"?e.name.trim().slice(0,120):"",i=or(e.state);if(e.schemaVersion!==1||!t||!r||!i)return null;let o=typeof e.createdAt=="number"&&Number.isFinite(e.createdAt)?e.createdAt:Date.now(),s=typeof e.updatedAt=="number"&&Number.isFinite(e.updatedAt)?e.updatedAt:o;return{schemaVersion:1,id:t,name:r,createdAt:o,updatedAt:s,state:i}}function Yr(n){let e=n.state.get();return{version:1,columns:e.columns,sortModel:e.sortModel,filterModel:e.filterModel,advancedFilterModel:e.advancedFilterModel,quickFilterText:e.quickFilterText,pageSize:e.pagination.pageSize}}function Xr(n,e,t={}){let r=or(e);if(!r||n.isDestroyed())return!1;let i=n.state.get();return n.state.apply({...i,columns:r.columns,sortModel:r.sortModel,filterModel:r.filterModel,advancedFilterModel:r.advancedFilterModel,quickFilterText:r.quickFilterText,pagination:{...i.pagination,page:1,pageSize:r.pageSize}},{sections:["columns","sort","filter","pagination"],emitEvents:t.emitEvents}),!0}function Jr(n={}){let e=(n.namespace??"mach-table:views").replace(/:+$/,""),t=Math.max(1,Math.floor(n.maxViews??50)),r=Math.max(4096,Math.floor(n.maxBytes??512*1024)),i=l=>`${e}:${encodeURIComponent(l)}`,o=(l,d,c)=>{try{n.onError?.(l,d,c)}catch{}},s=l=>{let d=(n.storage??no())?.getItem(i(l));if(!d||oo(d)>r)return[];let c=JSON.parse(d);return c.schemaVersion!==1||!Array.isArray(c.views)?[]:c.views.flatMap(u=>{let h=we(u);return h?[h]:[]}).slice(0,t)},a=(l,d)=>{let c=JSON.stringify({schemaVersion:1,savedAt:Date.now(),views:d});if(oo(c)>r)throw new RangeError(`[MachTable] Saved views for "${l}" exceed ${r} bytes.`);let u=n.storage??no();if(!u)throw new Error("[MachTable] Saved view storage is unavailable.");u.setItem(i(l),c)};return{list(l){try{return s(l)}catch(d){return o(d,"list",l),[]}},save(l,d){try{let c=we(d);if(!c)throw new TypeError(`[MachTable] Invalid saved view for "${l}".`);let u=s(l).filter(h=>h.id!==c.id);u.unshift(c),a(l,u.slice(0,t))}catch(c){throw o(c,"save",l),c}},remove(l,d){try{a(l,s(l).filter(c=>c.id!==d))}catch(c){throw o(c,"remove",l),c}}}}function za(){try{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID()}catch{}return`view-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function ao(n,e){let t=e.scope.trim();if(!t||t.length>512)throw new TypeError("[MachTable] Grid view scope must contain between 1 and 512 characters.");let r=e.store??Jr(),i=async()=>(await r.list(t)).flatMap(s=>{let a=we(s);return a?[a]:[]}).sort((s,a)=>a.updatedAt-s.updatedAt);return{list:i,async save(o,s){let a=o.trim().slice(0,120);if(!a)throw new TypeError("[MachTable] Grid view name must be a non-empty string.");let l=so(s)??za(),d=(await i()).find(h=>h.id===l),c=Date.now(),u={schemaVersion:1,id:l,name:a,createdAt:d?.createdAt??c,updatedAt:c,state:Yr(n)};return await r.save(t,u),u},async apply(o,s){let a=typeof o=="string"?(await i()).find(d=>d.id===o):we(o),l=typeof o=="string"?o:"provided view";if(!a)throw new Error(`[MachTable] Grid view "${l}" was not found.`);if(!Xr(n,a.state,s))throw new Error(`[MachTable] Grid view "${a.id}" could not be applied.`);return a},async remove(o){await r.remove(t,o)}}}var Wa=He;0&&(module.exports={BUILTIN_AGG_FUNCS,DEFAULT_LOCALE,EVENT_TYPES,LOCALE_EN,actionsColumn,advancedFilterCondition,advancedFilterGroup,applyGridViewState,buildColDefsFromSchema,captureGridViewState,clearGridState,createActionButtonsRenderer,createAggResolver,createBusinessColumnTypes,createColumnHelper,createEnterprisePreset,createGrid,createGridViewManager,createLocalGridStateStore,createLocalGridViewStore,createMachTableCommands,createMachTablePreset,createProgressBarRenderer,createRemoteExportRequest,createRowActionsRenderer,createStatusTagRenderer,defineColumns,defineGridOptions,defineMachTableConfig,defineMachTablePreset,describeFilter,downloadFile,dragColumn,escapeHtml,formatText,formatTwo,getByPath,indexColumn,isColDefGroup,isSafePath,linkRenderer,loadGridState,matchLocaleKey,normalizeAdvancedFilterModel,normalizeColumnFilter,normalizeFilterModel,normalizeGridState,normalizeGridViewState,normalizeSavedGridView,parseCsv,parseDelimited,parseTsv,resolveGridFeatures,resolveSaveConflict,resolveTagVariant,rowActionsColumn,sanitizeFormulaCell,saveGridState,selectionColumn,setByPath,toTsv,validateGridOptions,version});
|